Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

downshift

Package Overview
Dependencies
Maintainers
2
Versions
354
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

downshift - npm Package Compare versions

Comparing version 7.1.3-alpha.1 to 7.2.0

CHANGELOG.md

2

dist/downshift.umd.min.js

@@ -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,l=o?Symbol.for("react.fragment"):60107,u=o?Symbol.for("react.strict_mode"):60108,d=o?Symbol.for("react.profiler"):60114,a=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 l:case d:case u:case m:return e;default:switch(e=e&&e.$$typeof){case c:case g:case y:case I:case a: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=a,i.Element=r,i.ForwardRef=g,i.Fragment=l,i.Lazy=y,i.Memo=I,i.Portal=s,i.Profiler=d,i.StrictMode=u,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)===a},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)===l},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)===d},i.isStrictMode=function(e){return S(e)===u},i.isSuspense=function(e){return S(e)===m},i.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===l||e===p||e===d||e===u||e===m||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===I||e.$$typeof===a||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=$;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 oe=e=>"object"==typeof e&&null!=e&&1===e.nodeType,re=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,se=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return re(n.overflowY,t)||re(n.overflowX,t)||(e=>{let t=(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},le=(e,t,n,i,o,r,s,l)=>r<e&&s>t||r>e&&s<t?0:r<=e&&l<=n||s>=t&&l>=n?r-e-i:s>t&&l<n||r<e&&l>n?s-t+o:0,ue=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};let de=0;function ae(e){return"function"==typeof e?e:ce}function ce(){}function he(e,t){if(!e)return;const n=((e,t)=>{var n,i,o,r,s,l;if("undefined"==typeof document)return[];let{scrollMode:u,block:d,inline:a,boundary:c,skipOverflowHiddenElements:h}=t,p="function"==typeof c?c:e=>e!==c;if(!oe(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,m=[],f=e;for(;oe(f)&&p(f);){if(f=ue(f),f===g){m.push(f);break}null!=f&&f===document.body&&se(f)&&!se(document.documentElement)||null!=f&&se(f,h)&&m.push(f)}let I=null!=(i=null==(n=window.visualViewport)?void 0:n.width)?i:innerWidth,y=null!=(r=null==(o=window.visualViewport)?void 0:o.height)?r:innerHeight,v=null!=(s=window.scrollX)?s:pageXOffset,x=null!=(l=window.scrollY)?l:pageYOffset,{height:b,width:w,top:S,right:C,bottom:k,left:O}=e.getBoundingClientRect(),M="start"===d||"nearest"===d?S:"end"===d?k:S+b/2,E="center"===a?O+w/2:"end"===a?C:O,D=[];for(let e=0;e<m.length;e++){let t=m[e],{height:n,width:i,top:o,right:r,bottom:s,left:l}=t.getBoundingClientRect();if("if-needed"===u&&S>=0&&O>=0&&k<=y&&C<=I&&S>=o&&k<=s&&O>=l&&C<=r)return D;let c=getComputedStyle(t),h=parseInt(c.borderLeftWidth,10),p=parseInt(c.borderTopWidth,10),f=parseInt(c.borderRightWidth,10),P=parseInt(c.borderBottomWidth,10),T=0,R=0,H="offsetWidth"in t?t.offsetWidth-t.clientWidth-h-f:0,F="offsetHeight"in t?t.offsetHeight-t.clientHeight-p-P:0,K="offsetWidth"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,V="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)T="start"===d?M:"end"===d?M-y:"nearest"===d?le(x,x+y,y,p,P,x+M,x+M+b,b):M-y/2,R="start"===a?E:"center"===a?E-I/2:"end"===a?E-I:le(v,v+I,I,h,f,v+E,v+E+w,w),T=Math.max(0,T+x),R=Math.max(0,R+v);else{T="start"===d?M-o-p:"end"===d?M-s+P+F:"nearest"===d?le(o,s,n,p,P+F,M,M+b,b):M-(o+n/2)+F/2,R="start"===a?E-l-h:"center"===a?E-(l+i/2)+H/2:"end"===a?E-r+f+H:le(l,r,i,h,f+H,E,E+w,w);let{scrollLeft:e,scrollTop:u}=t;T=Math.max(0,Math.min(u+T/V,t.scrollHeight-n/V+F)),R=Math.max(0,Math.min(e+R/K,t.scrollWidth-i/K+H)),M+=u-T,E+=e-R}D.push({el:t,top:T,left:R})}return D})(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 pe(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function ge(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 me(){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 fe(){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 Ie(){return String(de++)}function ye(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 ve(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}const xe=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function be(e){void 0===e&&(e={});const t={};return xe.forEach((n=>{e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function we(e,t){return Object.keys(e).reduce(((n,i)=>(n[i]=Se(t,i)?t[i]:e[i],n)),{})}function Se(e,t){return void 0!==e[t]}function Ce(e){const{key:t,keyCode:n}=e;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?`Arrow${t}`:t}function ke(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 l=Oe(e,s,n,i,o);return-1===l?t>=n?-1:t:l}function Oe(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?Oe(1,0,n,i,!1):Oe(-1,n-1,n,i,!1):-1}function Me(e,t,n,i){return void 0===i&&(i=!0),t.some((t=>t&&(pe(t,e,n)||i&&pe(t,n.document.activeElement,n))))}const Ee=ge((e=>{Pe(e).textContent=""}),500);function De(e,t){const n=Pe(t);e&&(n.textContent=e,Ee(t))}function Pe(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 Te=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 Re=(()=>{class e extends t.Component{constructor(e){var t;super(e),t=this,this.id=this.props.id||`downshift-${Ie()}`,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=be(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=be(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 l={};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],Se(this.props,e)||(l[e]=s[e]))})),r&&s.hasOwnProperty("inputValue")&&this.props.onInputValueChange(s.inputValue,{...this.getStateAndHelpers(),...s}),l}),(()=>{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:l}=t.getState();return{[i]:fe(o,t.rootRef),role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-owns":l?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=ke(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=ke(-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=Oe(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=Oe(-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,...l}=void 0===e?{}:e;const{isOpen:u}=t.getState(),d={onClick:me(n,t.buttonHandleClick),onKeyDown:me(o,t.buttonHandleKeyDown),onKeyUp:me(r,t.buttonHandleKeyUp),onBlur:me(s,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=Ce(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:l,...u}=void 0===e?{}:e,d={};n="onChange";const{inputValue:a,isOpen:c,highlightedIndex:h}=t.getState();return u.disabled||(d={onChange:me(r,s,t.inputHandleChange),onKeyDown:me(i,t.inputHandleKeyDown),onBlur:me(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=Ce(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]:fe(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:l,...u}=void 0===e?{}:e;void 0===s?(t.items.push(l),s=t.items.indexOf(l)):t.items[s]=l;const d=o,a={onMouseMove:me(n,(()=>{s!==t.getState().highlightedIndex&&(t.setHighlightedIndex(s,{type:2}),t.avoidScrolling=!0,t.internalSetTimeout((()=>t.avoidScrolling=!1),250))})),onMouseDown:me(i,(e=>{e.preventDefault()})),onClick:me(d,(()=>{t.selectItemAtIndex(s,{type:9})}))},c=u.disabled?{onMouseDown:a.onMouseDown}:a;return{id:t.getItemId(s),role:"option","aria-selected":t.getState().highlightedIndex===s,...c,...u}},this.clearItems=()=>{this.items=[]},this.reset=function(e,n){void 0===e&&(e={}),e=be(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=be(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=ge((()=>{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,De(i,this.props.environment.document)}),200);const{defaultHighlightedIndex:n,initialHighlightedIndex:i=n,defaultIsOpen:o,initialIsOpen:r=o,initialInputValue:s="",initialSelectedItem:l=null}=this.props,u=this.getState({highlightedIndex:i,isOpen:r,inputValue:s,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),we(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=ke(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: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:C}=this;return{getRootProps:s,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:C,itemToString:o,id:r,highlightedIndex:e,inputValue:t,isOpen:i,selectedItem:n}}componentDidMount(){{const e=()=>{this.isMouseDown=!0},t=e=>{this.isMouseDown=!1;!Me(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=Me(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){Se(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=ve(this.props.children,ce);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=ve(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:ye,itemToString:e=>null==e?"":String(e),onStateChange:ce,onInputValueChange:ce,onUserAction:ce,onChange:ce,onSelect:ce,onOuterClick:ce,selectedItemChanged:(e,t)=>e!==t,environment:"undefined"==typeof window?{}:window,stateReducer:(e,t)=>t,suppressRefError:!1,scrollIntoView:he},e.stateChangeTypes=Te,e})();var He=Re;const Fe={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Ke(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${Be(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 Ve=ge(((e,t)=>{De(e(),t)}),200),$e="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function Ae(e){let{id:n=`downshift-${Ie()}`,labelId:i,menuId:o,getItemId:r,toggleButtonId:s,inputId:l}=e;return t.useRef({labelId:i||`${n}-label`,menuId:o||`${n}-menu`,getItemId:r||(e=>`${n}-item-${e}`),toggleButtonId:s||`${n}-toggle-button`,inputId:l||`${n}-input`}).current}function Ne(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Be(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Le(e){const n=t.useRef(e);return n.current=e,n}function _e(e,n,i){const o=t.useRef(),r=t.useRef(),s=t.useCallback(((t,n)=>{r.current=n,t=we(t,n.props);const i=e(t,n);return n.props.stateReducer(t,{...n,changes:i})}),[e]),[l,u]=t.useReducer(s,n),d=Le(i),a=t.useCallback((e=>u({props:d.current,...e})),[d]),c=r.current;return t.useEffect((()=>{c&&o.current&&o.current!==l&&Ke(c,we(o.current,c.props),l),o.current=l}),[l,i,c]),[l,a]}function je(e,t,n){const[i,o]=_e(e,t,n);return[we(i,n),o]}const Ue={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:he,environment:"undefined"==typeof window?{}:window};function We(e,t,n){void 0===n&&(n=Fe);const i=e[`default${Be(t)}`];return void 0!==i?i:n[t]}function ze(e,t,n){void 0===n&&(n=Fe);const i=e[t];if(void 0!==i)return i;const o=e[`initial${Be(t)}`];return void 0!==o?o:We(e,t,n)}function qe(e){const t=ze(e,"selectedItem"),n=ze(e,"isOpen"),i=ze(e,"highlightedIndex"),o=ze(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function Ye(e,t,n){const{items:i,initialHighlightedIndex:o,defaultHighlightedIndex:r}=e,{selectedItem:s,highlightedIndex:l}=t;return 0===i.length?-1:void 0!==o&&l===o?o:void 0!==r?r:s?i.indexOf(s):0===n?-1:n<0?i.length-1:0}function Xe(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&&!Me(t.target,n.map((e=>e.current)),i)&&o()},l=()=>{r.current.isTouchMove=!1},u=()=>{r.current.isTouchMove=!0},d=t=>{!e||r.current.isTouchMove||Me(t.target,n.map((e=>e.current)),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",s),i.addEventListener("touchstart",l),i.addEventListener("touchmove",u),i.addEventListener("touchend",d),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",s),i.removeEventListener("touchstart",l),i.removeEventListener("touchmove",u),i.removeEventListener("touchend",d)}}),[e,i]),r}let Ge=()=>ce;function Je(e,n,i){let{isInitialMount:o,highlightedIndex:r,items:s,environment:l,...u}=i;t.useEffect((()=>{o||Ve((()=>e({highlightedIndex:r,highlightedItem:s[r],resultCount:s.length,...u})),l.document)}),n)}function Qe(e){let{highlightedIndex:n,isOpen:i,itemRefs:o,getItemNodeFromIndex:r,menuElement:s,scrollIntoView:l}=e;const u=t.useRef(!0);return $e((()=>{n<0||!i||!Object.keys(o.current).length||(!1===u.current?u.current=!0:l(r(n),s))}),[n]),u}let Ze=ce;function et(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:Ye(o,e,0)};break;case n.FunctionOpenMenu:r={isOpen:!0,highlightedIndex:Ye(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:We(o,"highlightedIndex"),isOpen:We(o,"isOpen"),selectedItem:We(o,"selectedItem"),inputValue:We(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...r}}var tt=function(){return tt=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},tt.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 nt=tt(tt({},Ue),{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.":""}}),it=ce;var ot=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 rt(e,t){const{type:n,props:i,altKey:o}=t;let r;switch(n){case 14:r={isOpen:We(i,"isOpen"),highlightedIndex:We(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(),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(s)){var a=r(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});r={inputValue:o,highlightedIndex:s,isOpen:!0}}break;case 1:r={highlightedIndex:e.isOpen?ke(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):o&&null==e.selectedItem?-1:Ye(i,e,1),isOpen:!0};break;case 2:if(e.isOpen&&o)r={isOpen:We(i,"isOpen"),highlightedIndex:We(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};else{r={highlightedIndex:e.isOpen?ke(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):Ye(i,e,-1),isOpen:!0}}break;case 7:case 8:r={isOpen:We(i,"isOpen"),highlightedIndex:We(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 5:r={highlightedIndex:Oe(1,0,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:r={highlightedIndex:Oe(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:r={highlightedIndex:ke(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 10:r={highlightedIndex:ke(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 et(e,t,ot)}return{...e,...r}}function st(e){void 0===e&&(e={}),it();const n={...nt,...e},{items:i,scrollIntoView:o,environment:r,itemToString:s,getA11ySelectionMessage:l,getA11yStatusMessage:u}=n,d=qe(n),[a,c]=je(rt,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=Ae(n),b=t.useRef(),w=t.useRef(!0),S=Le({state:a,props:n}),C=t.useCallback((e=>y.current[x.getItemId(e)]),[x]);Je(u,[h,p,m,i],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:r,itemToString:s,...a}),Je(l,[g],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:r,itemToString:s,...a});const k=Qe({menuElement:I.current,highlightedIndex:p,isOpen:h,itemRefs:y,scrollIntoView:o,getItemNodeFromIndex:C});t.useEffect((()=>(v.current=ge((e=>{e({type:20,inputValue:""})}),500),()=>{v.current.cancel()})),[]),t.useEffect((()=>{m&&v.current(c)}),[c,m]),Ze({isInitialMount:w.current,props:n,state:a}),t.useEffect((()=>{w.current||(b.current=i.length)}));const O=Xe(h,[I,f],r,(()=>{c({type:11})})),M=Ge();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,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;return M("getMenuProps",u,i,I),{[i]:fe(s,(e=>{I.current=e})),id:x.menuId,role:"listbox","aria-labelledby":x.labelId,tabIndex:-1,onMouseLeave:me(n,(()=>{c({type:12})})),...l}}),[c,M,x]);return{getToggleButtonProps:t.useCallback((function(e,t){let{onBlur:n,onClick:i,onKeyDown:o,refKey:r="ref",ref:s,...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=Ce(e);t&&E[t]?E[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&c({type:3,key:t,getItemNodeFromIndex:C})},p={[r]:fe(s,(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:me(n,(()=>{d.isOpen&&!O.current.isMouseDown&&c({type:11})})),...l};return l.disabled||(p.onClick=me(i,a),p.onKeyDown=me(o,h)),M("getToggleButtonProps",u,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:l,disabled:u,...d}=void 0===e?{}:e;const{state:a,props:h}=S.current,p=t??i[n],m=Ne(n,p,h.items),f=()=>{c({type:14,index:m})},I=Ne(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),[s]:fe(l,(e=>{e&&(y.current[x.getItemId(I)]=e)})),...d};return u||(v.onClick=me(r,f)),v.onMouseMove=me(o,(()=>{m!==a.highlightedIndex&&(k.current=!1,c({type:13,index:m,disabled:u}))})),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}}st.stateChangeTypes=ot;var lt=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=ce;const dt={...Ue,getA11yStatusMessage:ye};function at(e,t){const{type:n,props:i,altKey:o}=t;let r;switch(n){case 13:r={isOpen:We(i,"isOpen"),highlightedIndex:We(i,"highlightedIndex"),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case 0:r=e.isOpen?{highlightedIndex:ke(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:o&&null==e.selectedItem?-1:Ye(i,e,1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 1:r=e.isOpen?o?{isOpen:We(i,"isOpen"),highlightedIndex:We(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}}:{highlightedIndex:ke(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:Ye(i,e,-1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 7:r={isOpen:We(i,"isOpen"),highlightedIndex:We(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:ke(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 6:r={highlightedIndex:ke(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 3:r={highlightedIndex:Oe(1,0,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:r={highlightedIndex:Oe(-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:We(i,"highlightedIndex"),inputValue:t.inputValue};break;case 10:r={isOpen:!0,highlightedIndex:Ye(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 et(e,t,lt)}return{...e,...r}}function ct(e){void 0===e&&(e={}),ut();const n={...dt,...e},{initialIsOpen:i,defaultIsOpen:o,items:r,scrollIntoView:s,environment:l,getA11yStatusMessage:u,getA11ySelectionMessage:d,itemToString:a}=n,c=function(e){const t=qe(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]=_e(e,n,i);return t.useEffect((()=>{Se(i,"selectedItem")&&(o.current!==i.selectedItem&&s({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=r.selectedItem===o.current?i.selectedItem:r.selectedItem)})),[we(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=Ae(n),C=t.useRef(),k=Le({state:h,props:n}),O=t.useCallback((e=>v.current[S.getItemId(e)]),[S]);Je(u,[g,m,I,r],{isInitialMount:w.current,previousResultCount:C.current,items:r,environment:l,itemToString:a,...h}),Je(d,[f],{isInitialMount:w.current,previousResultCount:C.current,items:r,environment:l,itemToString:a,...h});const M=Qe({menuElement:y.current,highlightedIndex:m,isOpen:g,itemRefs:v,scrollIntoView:s,getItemNodeFromIndex:O});Ze({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=Xe(g,[x,y,b],l,(()=>{p({type:9,selectItem:!1})})),D=Ge();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]:fe(o,(e=>{y.current=e})),id:S.menuId,role:"listbox","aria-labelledby":S.labelId,onMouseLeave:me(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:l,onPress:u,disabled:d,...a}=void 0===e?{}:e;const{props:c,state:h}=k.current,g=Ne(n,t,c.items);if(g<0)throw new Error("Pass either item or item index in getItemProps!");const m=l;return{[i]:fe(o,(e=>{e&&(v.current[S.getItemId(g)]=e)})),disabled:d,role:"option","aria-selected":`${g===h.highlightedIndex}`,id:S.getItemId(g),...!d&&{onClick:me(m,(()=>{p({type:13,index:n})}))},onMouseMove:me(r,(()=>{n!==h.highlightedIndex&&(M.current=!1,p({type:12,index:n,disabled:d}))})),onMouseDown:me(s,(e=>e.preventDefault())),...a}}),[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]:fe(o,(e=>{b.current=e})),"aria-controls":S.menuId,"aria-expanded":s.isOpen,id:S.toggleButtonId,tabIndex:-1,...!r.disabled&&{onClick:me(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: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=k.current.state,g=e=>{const t=Ce(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={onChange:me(i,o,m),onKeyDown:me(n,g),onBlur:me(s,f),onFocus:me(r,I)}),{[u]:fe(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,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}}ct.stateChangeTypes=lt;const ht={activeIndex:-1,selectedItems:[]};function pt(e,t){return ze(e,t,ht)}function gt(e,t){return We(e,t,ht)}function mt(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 ft={itemToString:Ue.itemToString,stateReducer:Ue.stateReducer,environment:Ue.environment,getA11yRemovalMessage:function(e){const{removedSelectedItem:t,itemToString:n}=e;return`${n(t)} has been removed.`},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"};let It=ce;var yt=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 vt(e,t){const{type:n,index:i,props:o,selectedItem:r}=t,{activeIndex:s,selectedItems:l}=e;let u;switch(n){case 0:u={activeIndex:i};break;case 4:u={activeIndex:s-1<0?0:s-1};break;case 3:u={activeIndex:s+1>=l.length?-1:s+1};break;case 2:case 1:{if(s<0)break;let e=s;1===l.length?e=-1:s===l.length-1&&(e=l.length-2),u={selectedItems:[...l.slice(0,s),...l.slice(s+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,r]};break;case 7:u={activeIndex:-1};break;case 9:{let e=s;const t=l.indexOf(r);if(t<0)break;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:gt(o,"activeIndex"),selectedItems:gt(o,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...u}}function xt(e){void 0===e&&(e={}),It();const n={...ft,...e},{getA11yRemovalMessage:i,itemToString:o,environment:r,keyNavigationNext:s,keyNavigationPrevious:l}=n,[u,d]=je(vt,function(e){return{activeIndex:pt(e,"activeIndex"),selectedItems:pt(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=Le({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));De(i({itemToString:o,resultCount:c.length,removedSelectedItem:e,activeIndex:a,activeSelectedItem:c[a]}),r.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]),Ze({isInitialMount:h.current,props:n,state:u});const I=Ge();t.useEffect((()=>(h.current=!1,()=>{h.current=!0})),[]);const y=t.useMemo((()=>({[l](){d({type:4})},[s](){d({type:3})},Delete(){d({type:1})},Backspace(){d({type:2})}})),[d,s,l]),v=t.useMemo((()=>({[l](e){mt(e)&&d({type:5})},Backspace(e){mt(e)&&d({type:6})}})),[d,l]);return{getSelectedItemProps:t.useCallback((function(e){let{refKey:t="ref",ref:n,onClick:i,onKeyDown:o,selectedItem:r,index:s,...l}=void 0===e?{}:e;const{state:u}=f.current;if(Ne(s,r,u.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return{[t]:fe(n,(e=>{e&&m.current.push(e)})),tabIndex:s===u.activeIndex?0:-1,onClick:me(i,(()=>{d({type:0,index:s})})),onKeyDown:me(o,(e=>{const t=Ce(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:r,preventKeyAction:s=!1,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;return I("getDropdownProps",u,n,p),{[n]:fe(i,(e=>{e&&(p.current=e)})),...!s&&{onKeyDown:me(o,(e=>{const t=Ce(e);t&&v[t]&&v[t](e)})),onClick:me(r,(()=>{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}}xt.stateChangeTypes=yt,e.default=He,e.resetIdCounter=function(){de=0},e.useCombobox=ct,e.useMultipleSelection=xt,e.useSelect=st,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";function n(e,t){if(null==e)return{};var n,o,i={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},o.apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}var u={exports:{}},s={},l="function"==typeof Symbol&&Symbol.for,a=l?Symbol.for("react.element"):60103,c=l?Symbol.for("react.portal"):60106,d=l?Symbol.for("react.fragment"):60107,p=l?Symbol.for("react.strict_mode"):60108,f=l?Symbol.for("react.profiler"):60114,g=l?Symbol.for("react.provider"):60109,h=l?Symbol.for("react.context"):60110,m=l?Symbol.for("react.async_mode"):60111,I=l?Symbol.for("react.concurrent_mode"):60111,v=l?Symbol.for("react.forward_ref"):60112,y=l?Symbol.for("react.suspense"):60113,x=l?Symbol.for("react.suspense_list"):60120,b=l?Symbol.for("react.memo"):60115,w=l?Symbol.for("react.lazy"):60116,S=l?Symbol.for("react.block"):60121,C=l?Symbol.for("react.fundamental"):60117,k=l?Symbol.for("react.responder"):60118,O=l?Symbol.for("react.scope"):60119;function M(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case a:switch(e=e.type){case m:case I:case d:case f:case p:case y:return e;default:switch(e=e&&e.$$typeof){case h:case v:case w:case b:case g:return e;default:return t}}case c:return t}}}function D(e){return M(e)===I}s.AsyncMode=m,s.ConcurrentMode=I,s.ContextConsumer=h,s.ContextProvider=g,s.Element=a,s.ForwardRef=v,s.Fragment=d,s.Lazy=w,s.Memo=b,s.Portal=c,s.Profiler=f,s.StrictMode=p,s.Suspense=y,s.isAsyncMode=function(e){return D(e)||M(e)===m},s.isConcurrentMode=D,s.isContextConsumer=function(e){return M(e)===h},s.isContextProvider=function(e){return M(e)===g},s.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},s.isForwardRef=function(e){return M(e)===v},s.isFragment=function(e){return M(e)===d},s.isLazy=function(e){return M(e)===w},s.isMemo=function(e){return M(e)===b},s.isPortal=function(e){return M(e)===c},s.isProfiler=function(e){return M(e)===f},s.isStrictMode=function(e){return M(e)===p},s.isSuspense=function(e){return M(e)===y},s.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===d||e===I||e===f||e===p||e===y||e===x||"object"==typeof e&&null!==e&&(e.$$typeof===w||e.$$typeof===b||e.$$typeof===g||e.$$typeof===h||e.$$typeof===v||e.$$typeof===C||e.$$typeof===k||e.$$typeof===O||e.$$typeof===S)},s.typeOf=M;function E(){}function P(){}P.resetWarningCache=E;u.exports=function(){function e(e,t,n,o,i,r){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==r){var u=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 u.name="Invariant Violation",u}}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:P,resetWarningCache:E};return n.PropTypes=n,n}();var K=u.exports,T={},R=60103,H=60106,F=60107,V=60108,A=60114,N=60109,B=60110,L=60112,_=60113,$=60120,j=60115,U=60116,W=60121,z=60122,q=60117,Y=60129,X=60131;if("function"==typeof Symbol&&Symbol.for){var G=Symbol.for;R=G("react.element"),H=G("react.portal"),F=G("react.fragment"),V=G("react.strict_mode"),A=G("react.profiler"),N=G("react.provider"),B=G("react.context"),L=G("react.forward_ref"),_=G("react.suspense"),$=G("react.suspense_list"),j=G("react.memo"),U=G("react.lazy"),W=G("react.block"),z=G("react.server.block"),q=G("react.fundamental"),Y=G("react.debug_trace_mode"),X=G("react.legacy_hidden")}function J(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case R:switch(e=e.type){case F:case A:case V:case _:case $:return e;default:switch(e=e&&e.$$typeof){case B:case L:case U:case j:case N:return e;default:return t}}case H:return t}}}var Q=N,Z=R,ee=L,te=F,ne=U,oe=j,ie=H,re=A,ue=V,se=_;T.ContextConsumer=B,T.ContextProvider=Q,T.Element=Z,T.ForwardRef=ee,T.Fragment=te,T.Lazy=ne,T.Memo=oe,T.Portal=ie,T.Profiler=re,T.StrictMode=ue,T.Suspense=se,T.isAsyncMode=function(){return!1},T.isConcurrentMode=function(){return!1},T.isContextConsumer=function(e){return J(e)===B},T.isContextProvider=function(e){return J(e)===N},T.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===R},T.isForwardRef=function(e){return J(e)===L},T.isFragment=function(e){return J(e)===F},T.isLazy=function(e){return J(e)===U},T.isMemo=function(e){return J(e)===j},T.isPortal=function(e){return J(e)===H},T.isProfiler=function(e){return J(e)===A},T.isStrictMode=function(e){return J(e)===V},T.isSuspense=function(e){return J(e)===_},T.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===F||e===A||e===Y||e===V||e===_||e===$||e===X||"object"==typeof e&&null!==e&&(e.$$typeof===U||e.$$typeof===j||e.$$typeof===N||e.$$typeof===B||e.$$typeof===L||e.$$typeof===q||e.$$typeof===W||e[0]===z)},T.typeOf=J;let le=e=>"object"==typeof e&&null!=e&&1===e.nodeType,ae=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,ce=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return ae(n.overflowY,t)||ae(n.overflowX,t)||(e=>{let t=(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},de=(e,t,n,o,i,r,u,s)=>r<e&&u>t||r>e&&u<t?0:r<=e&&s<=n||u>=t&&s>=n?r-e-o:u>t&&s<n||r<e&&s>n?u-t+i:0,pe=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};var fe=0;function ge(e){return"function"==typeof e?e:he}function he(){}function me(e,t){if(e){var n=((e,t)=>{var n,o,i,r,u,s;if("undefined"==typeof document)return[];let{scrollMode:l,block:a,inline:c,boundary:d,skipOverflowHiddenElements:p}=t,f="function"==typeof d?d:e=>e!==d;if(!le(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,h=[],m=e;for(;le(m)&&f(m);){if(m=pe(m),m===g){h.push(m);break}null!=m&&m===document.body&&ce(m)&&!ce(document.documentElement)||null!=m&&ce(m,p)&&h.push(m)}let I=null!=(o=null==(n=window.visualViewport)?void 0:n.width)?o:innerWidth,v=null!=(r=null==(i=window.visualViewport)?void 0:i.height)?r:innerHeight,y=null!=(u=window.scrollX)?u:pageXOffset,x=null!=(s=window.scrollY)?s:pageYOffset,{height:b,width:w,top:S,right:C,bottom:k,left:O}=e.getBoundingClientRect(),M="start"===a||"nearest"===a?S:"end"===a?k:S+b/2,D="center"===c?O+w/2:"end"===c?C:O,E=[];for(let e=0;e<h.length;e++){let t=h[e],{height:n,width:o,top:i,right:r,bottom:u,left:s}=t.getBoundingClientRect();if("if-needed"===l&&S>=0&&O>=0&&k<=v&&C<=I&&S>=i&&k<=u&&O>=s&&C<=r)return E;let d=getComputedStyle(t),p=parseInt(d.borderLeftWidth,10),f=parseInt(d.borderTopWidth,10),m=parseInt(d.borderRightWidth,10),P=parseInt(d.borderBottomWidth,10),K=0,T=0,R="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-m:0,H="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-P:0,F="offsetWidth"in t?0===t.offsetWidth?0:o/t.offsetWidth:0,V="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)K="start"===a?M:"end"===a?M-v:"nearest"===a?de(x,x+v,v,f,P,x+M,x+M+b,b):M-v/2,T="start"===c?D:"center"===c?D-I/2:"end"===c?D-I:de(y,y+I,I,p,m,y+D,y+D+w,w),K=Math.max(0,K+x),T=Math.max(0,T+y);else{K="start"===a?M-i-f:"end"===a?M-u+P+H:"nearest"===a?de(i,u,n,f,P+H,M,M+b,b):M-(i+n/2)+H/2,T="start"===c?D-s-p:"center"===c?D-(s+o/2)+R/2:"end"===c?D-r+m+R:de(s,r,o,p,m+R,D,D+w,w);let{scrollLeft:e,scrollTop:l}=t;K=Math.max(0,Math.min(l+K/V,t.scrollHeight-n/V+H)),T=Math.max(0,Math.min(e+T/F,t.scrollWidth-o/F+R)),M+=l-K,D+=e-T}E.push({el:t,top:K,left:T})}return E})(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((function(e){var t=e.el,n=e.top,o=e.left;t.scrollTop=n,t.scrollLeft=o}))}}function Ie(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function ve(e,t){var n;function o(){n&&clearTimeout(n)}function i(){for(var i=arguments.length,r=new Array(i),u=0;u<i;u++)r[u]=arguments[u];o(),n=setTimeout((function(){n=null,e.apply(void 0,r)}),t)}return i.cancel=o,i}function ye(){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,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.some((function(t){return t&&t.apply(void 0,[e].concat(o)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function be(){return String(fe++)}function we(e){var t=e.isOpen,n=e.resultCount,o=e.previousResultCount;return t?n?n!==o?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 Se(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var Ce=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function ke(e){void 0===e&&(e={});var t={};return Ce.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function Oe(e,t){return Object.keys(e).reduce((function(n,o){return n[o]=Me(t,o)?t[o]:e[o],n}),{})}function Me(e,t){return void 0!==e[t]}function De(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function Ee(e,t,n,o,i){if(void 0===i&&(i=!0),0===n)return-1;var r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);var u=t+e;u<0?u=i?r:0:u>r&&(u=i?0:r);var s=Pe(e,u,n,o,i);return-1===s?t>=n?-1:t:s}function Pe(e,t,n,o,i){var r=o(t);if(!r||!r.hasAttribute("disabled"))return t;if(e>0){for(var u=t+1;u<n;u++)if(!o(u).hasAttribute("disabled"))return u}else for(var s=t-1;s>=0;s--)if(!o(s).hasAttribute("disabled"))return s;return i?e>0?Pe(1,0,n,o,!1):Pe(-1,n-1,n,o,!1):-1}function Ke(e,t,n,o){return void 0===o&&(o=!0),t.some((function(t){return t&&(Ie(t,e,n)||o&&Ie(t,n.document.activeElement,n))}))}var Te=ve((function(e){He(e).textContent=""}),500);function Re(e,t){var n=He(t);e&&(n.textContent=e,Te(t))}function He(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).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 Fe=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}),Ve=["refKey","ref"],Ae=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Ne=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Be=["refKey","ref"],Le=["onMouseMove","onMouseDown","onClick","onPress","index","item"],_e=function(){var e=function(e){var u,s;function l(t){var r=e.call(this,t)||this;r.id=r.props.id||"downshift-"+be(),r.menuId=r.props.menuId||r.id+"-menu",r.labelId=r.props.labelId||r.id+"-label",r.inputId=r.props.inputId||r.id+"-input",r.getItemId=r.props.getItemId||function(e){return r.id+"-item-"+e},r.input=null,r.items=[],r.itemCount=null,r.previousResultCount=0,r.timeoutIds=[],r.internalSetTimeout=function(e,t){var n=setTimeout((function(){r.timeoutIds=r.timeoutIds.filter((function(e){return e!==n})),e()}),t);r.timeoutIds.push(n)},r.setItemCount=function(e){r.itemCount=e},r.unsetItemCount=function(){r.itemCount=null},r.setHighlightedIndex=function(e,t){void 0===e&&(e=r.props.defaultHighlightedIndex),void 0===t&&(t={}),t=ke(t),r.internalSetState(o({highlightedIndex:e},t))},r.clearSelection=function(e){r.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:r.props.defaultHighlightedIndex,isOpen:r.props.defaultIsOpen},e)},r.selectItem=function(e,t,n){t=ke(t),r.internalSetState(o({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,selectedItem:e,inputValue:r.props.itemToString(e)},t),n)},r.selectItemAtIndex=function(e,t,n){var o=r.items[e];null!=o&&r.selectItem(o,t,n)},r.selectHighlightedItem=function(e,t){return r.selectItemAtIndex(r.getState().highlightedIndex,e,t)},r.internalSetState=function(e,t){var n,i,u={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&r.props.onInputValueChange(e.inputValue,o({},r.getStateAndHelpers(),e)),r.setState((function(t){t=r.getState(t);var l=s?e(t):e;l=r.props.stateReducer(t,l),n=l.hasOwnProperty("selectedItem");var a={};return n&&l.selectedItem!==t.selectedItem&&(i=l.selectedItem),l.type=l.type||0,Object.keys(l).forEach((function(e){t[e]!==l[e]&&(u[e]=l[e]),"type"!==e&&(l[e],Me(r.props,e)||(a[e]=l[e]))})),s&&l.hasOwnProperty("inputValue")&&r.props.onInputValueChange(l.inputValue,o({},r.getStateAndHelpers(),l)),a}),(function(){ge(t)(),Object.keys(u).length>1&&r.props.onStateChange(u,r.getStateAndHelpers()),n&&r.props.onSelect(e.selectedItem,r.getStateAndHelpers()),void 0!==i&&r.props.onChange(i,r.getStateAndHelpers()),r.props.onUserAction(u,r.getStateAndHelpers())}))},r.rootRef=function(e){return r._rootNode=e},r.getRootProps=function(e,t){var i,u=void 0===e?{}:e,s=u.refKey,l=void 0===s?"ref":s,a=u.ref,c=n(u,Ve),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;r.getRootProps.called=!0,r.getRootProps.refKey=l,r.getRootProps.suppressRefError=p;var f=r.getState().isOpen;return o(((i={})[l]=xe(a,r.rootRef),i.role="combobox",i["aria-expanded"]=f,i["aria-haspopup"]="listbox",i["aria-owns"]=f?r.menuId:null,i["aria-labelledby"]=r.labelId,i),c)},r.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=Ee(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=Ee(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;if(n&&null!=o){e.preventDefault();var i=this.items[o],r=this.getItemNodeFromIndex(o);if(null==i||r&&r.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(o({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},r.buttonKeyDownHandlers=o({},r.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),r.inputKeyDownHandlers=o({},r.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var o=this.getItemCount();if(!(o<=0)&&n){var i=Pe(1,0,o,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(i,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var o=this.getItemCount();if(!(o<=0)&&n){var i=Pe(-1,o-1,o,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(i,{type:8})}}}}),r.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick;t.onPress;var u=t.onKeyDown,s=t.onKeyUp,l=t.onBlur,a=n(t,Ae),c=r.getState().isOpen,d={onClick:ye(i,r.buttonHandleClick),onKeyDown:ye(u,r.buttonHandleKeyDown),onKeyUp:ye(s,r.buttonHandleKeyUp),onBlur:ye(l,r.buttonHandleBlur)};return o({type:"button",role:"button","aria-label":c?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},a.disabled?{}:d,a)},r.buttonHandleKeyUp=function(e){e.preventDefault()},r.buttonHandleKeyDown=function(e){var t=De(e);r.buttonKeyDownHandlers[t]&&r.buttonKeyDownHandlers[t].call(i(r),e)},r.buttonHandleClick=function(e){e.preventDefault(),r.props.environment.document.activeElement===r.props.environment.document.body&&e.target.focus(),r.internalSetTimeout((function(){return r.toggleMenu({type:13})}))},r.buttonHandleBlur=function(e){var t=e.target;r.internalSetTimeout((function(){r.isMouseDown||null!=r.props.environment.document.activeElement&&r.props.environment.document.activeElement.id===r.inputId||r.props.environment.document.activeElement===t||r.reset({type:14})}))},r.getLabelProps=function(e){return o({htmlFor:r.inputId,id:r.labelId},e)},r.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,u=t.onBlur,s=t.onChange,l=t.onInput;t.onChangeText;var a=n(t,Ne),c={};var d,p=r.getState(),f=p.inputValue,g=p.isOpen,h=p.highlightedIndex;a.disabled||((d={}).onChange=ye(s,l,r.inputHandleChange),d.onKeyDown=ye(i,r.inputHandleKeyDown),d.onBlur=ye(u,r.inputHandleBlur),c=d);return o({"aria-autocomplete":"list","aria-activedescendant":g&&"number"==typeof h&&h>=0?r.getItemId(h):null,"aria-controls":g?r.menuId:null,"aria-labelledby":r.labelId,autoComplete:"off",value:f,id:r.inputId},c,a)},r.inputHandleKeyDown=function(e){var t=De(e);t&&r.inputKeyDownHandlers[t]&&r.inputKeyDownHandlers[t].call(i(r),e)},r.inputHandleChange=function(e){r.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:r.props.defaultHighlightedIndex})},r.inputHandleBlur=function(){r.internalSetTimeout((function(){var e=r.props.environment.document&&!!r.props.environment.document.activeElement&&!!r.props.environment.document.activeElement.dataset&&r.props.environment.document.activeElement.dataset.toggle&&r._rootNode&&r._rootNode.contains(r.props.environment.document.activeElement);r.isMouseDown||e||r.reset({type:10})}))},r.menuRef=function(e){r._menuNode=e},r.getMenuProps=function(e,t){var i,u=void 0===e?{}:e,s=u.refKey,l=void 0===s?"ref":s,a=u.ref,c=n(u,Be),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;return r.getMenuProps.called=!0,r.getMenuProps.refKey=l,r.getMenuProps.suppressRefError=p,o(((i={})[l]=xe(a,r.menuRef),i.role="listbox",i["aria-labelledby"]=c&&c["aria-label"]?null:r.labelId,i.id=r.menuId,i),c)},r.getItemProps=function(e){var t,i=void 0===e?{}:e,u=i.onMouseMove,s=i.onMouseDown,l=i.onClick;i.onPress;var a=i.index,c=i.item,d=void 0===c?void 0:c,p=n(i,Le);void 0===a?(r.items.push(d),a=r.items.indexOf(d)):r.items[a]=d;var f=l,g=((t={onMouseMove:ye(u,(function(){a!==r.getState().highlightedIndex&&(r.setHighlightedIndex(a,{type:2}),r.avoidScrolling=!0,r.internalSetTimeout((function(){return r.avoidScrolling=!1}),250))})),onMouseDown:ye(s,(function(e){e.preventDefault()}))}).onClick=ye(f,(function(){r.selectItemAtIndex(a,{type:9})})),t),h=p.disabled?{onMouseDown:g.onMouseDown}:g;return o({id:r.getItemId(a),role:"option","aria-selected":r.getState().highlightedIndex===a},h,p)},r.clearItems=function(){r.items=[]},r.reset=function(e,t){void 0===e&&(e={}),e=ke(e),r.internalSetState((function(t){var n=t.selectedItem;return o({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,inputValue:r.props.itemToString(n)},e)}),t)},r.toggleMenu=function(e,t){void 0===e&&(e={}),e=ke(e),r.internalSetState((function(t){var n=t.isOpen;return o({isOpen:!n},n&&{highlightedIndex:r.props.defaultHighlightedIndex},e)}),(function(){var n=r.getState(),o=n.isOpen,i=n.highlightedIndex;o&&r.getItemCount()>0&&"number"==typeof i&&r.setHighlightedIndex(i,e),ge(t)()}))},r.openMenu=function(e){r.internalSetState({isOpen:!0},e)},r.closeMenu=function(e){r.internalSetState({isOpen:!1},e)},r.updateStatus=ve((function(){var e=r.getState(),t=r.items[e.highlightedIndex],n=r.getItemCount(),i=r.props.getA11yStatusMessage(o({itemToString:r.props.itemToString,previousResultCount:r.previousResultCount,resultCount:n,highlightedItem:t},e));r.previousResultCount=n,Re(i,r.props.environment.document)}),200);var u=r.props,s=u.defaultHighlightedIndex,l=u.initialHighlightedIndex,a=void 0===l?s:l,c=u.defaultIsOpen,d=u.initialIsOpen,p=void 0===d?c:d,f=u.initialInputValue,g=void 0===f?"":f,h=u.initialSelectedItem,m=void 0===h?null:h,I=r.getState({highlightedIndex:a,isOpen:p,inputValue:g,selectedItem:m});return null!=I.selectedItem&&void 0===r.props.initialInputValue&&(I.inputValue=r.props.itemToString(I.selectedItem)),r.state=I,r}s=e,(u=l).prototype=Object.create(s.prototype),u.prototype.constructor=u,r(u,s);var a=l.prototype;return a.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},a.getState=function(e){return void 0===e&&(e=this.state),Oe(e,this.props)},a.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},a.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},a.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},a.moveHighlightedIndex=function(e,t){var n=this,o=this.getItemCount(),i=this.getState().highlightedIndex;if(o>0){var r=Ee(e,i,o,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(r,t)}},a.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,i=e.isOpen,r=this.props.itemToString,u=this.id,s=this.getRootProps,l=this.getToggleButtonProps,a=this.getLabelProps,c=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,g=this.closeMenu,h=this.toggleMenu,m=this.selectItem,I=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,x=this.clearSelection,b=this.clearItems;return{getRootProps:s,getToggleButtonProps:l,getLabelProps:a,getMenuProps:c,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:g,toggleMenu:h,selectItem:m,selectItemAtIndex:I,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:x,clearItems:b,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:r,id:u,highlightedIndex:t,inputValue:n,isOpen:i,selectedItem:o}},a.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!Ke(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},o=function(){e.isTouchMove=!1},i=function(){e.isTouchMove=!0},r=function(t){var n=Ke(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},u=this.props.environment;u.addEventListener("mousedown",t),u.addEventListener("mouseup",n),u.addEventListener("touchstart",o),u.addEventListener("touchmove",i),u.addEventListener("touchend",r),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),u.removeEventListener("mousedown",t),u.removeEventListener("mouseup",n),u.removeEventListener("touchstart",o),u.removeEventListener("touchmove",i),u.removeEventListener("touchend",r)}},a.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,o=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==o},a.componentDidUpdate=function(e,t){Me(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()},a.componentWillUnmount=function(){this.cleanup()},a.render=function(){var e=Se(this.props.children,he);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;var n=Se(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},l}(t.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:we,itemToString:function(e){return null==e?"":String(e)},onStateChange:he,onInputValueChange:he,onUserAction:he,onChange:he,onSelect:he,onOuterClick:he,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:me},e.stateChangeTypes=Fe,e}(),$e=_e,je=["isInitialMount","highlightedIndex","items","environment"],Ue={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function We(e,t,n){var i=e.props,r=e.type,u={};Object.keys(t).forEach((function(i){!function(e,t,n,i){var r=t.props,u=t.type,s="on"+Ge(e)+"Change";r[s]&&void 0!==i[e]&&i[e]!==n[e]&&r[s](o({type:u},i))}(i,e,t,n),n[i]!==t[i]&&(u[i]=n[i])})),i.onStateChange&&Object.keys(u).length&&i.onStateChange(o({type:r},u))}var ze=ve((function(e,t){Re(e(),t)}),200),qe="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function Ye(e){var n=e.id,o=void 0===n?"downshift-"+be():n,i=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,l=e.inputId;return t.useRef({labelId:i||o+"-label",menuId:r||o+"-menu",getItemId:u||function(e){return o+"-item-"+e},toggleButtonId:s||o+"-toggle-button",inputId:l||o+"-input"}).current}function Xe(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Ge(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Je(e){var n=t.useRef(e);return n.current=e,n}function Qe(e,n,i){var r=t.useRef(),u=t.useRef(),s=t.useCallback((function(t,n){u.current=n,t=Oe(t,n.props);var i=e(t,n);return n.props.stateReducer(t,o({},n,{changes:i}))}),[e]),l=t.useReducer(s,n),a=l[0],c=l[1],d=Je(i),p=t.useCallback((function(e){return c(o({props:d.current},e))}),[d]),f=u.current;return t.useEffect((function(){f&&r.current&&r.current!==a&&We(f,Oe(r.current,f.props),a),r.current=a}),[a,i,f]),[a,p]}function Ze(e,t,n){var o=Qe(e,t,n),i=o[0],r=o[1];return[Oe(i,n),r]}var et={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:me,environment:"undefined"==typeof window?{}:window};function tt(e,t,n){void 0===n&&(n=Ue);var o=e["default"+Ge(t)];return void 0!==o?o:n[t]}function nt(e,t,n){void 0===n&&(n=Ue);var o=e[t];if(void 0!==o)return o;var i=e["initial"+Ge(t)];return void 0!==i?i:tt(e,t,n)}function ot(e){var t=nt(e,"selectedItem"),n=nt(e,"isOpen"),o=nt(e,"highlightedIndex"),i=nt(e,"inputValue");return{highlightedIndex:o<0&&t&&n?e.items.indexOf(t):o,isOpen:n,selectedItem:t,inputValue:i}}function it(e,t,n){var o=e.items,i=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,u=t.selectedItem,s=t.highlightedIndex;return 0===o.length?-1:void 0!==i&&s===i?i:void 0!==r?r:u?o.indexOf(u):0===n?-1:n<0?o.length-1:0}function rt(e,n,o,i){var r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((function(){var t=function(){r.current.isMouseDown=!0},u=function(t){r.current.isMouseDown=!1,e&&!Ke(t.target,n.map((function(e){return e.current})),o)&&i()},s=function(){r.current.isTouchMove=!1},l=function(){r.current.isTouchMove=!0},a=function(t){!e||r.current.isTouchMove||Ke(t.target,n.map((function(e){return e.current})),o,!1)||i()};return o.addEventListener("mousedown",t),o.addEventListener("mouseup",u),o.addEventListener("touchstart",s),o.addEventListener("touchmove",l),o.addEventListener("touchend",a),function(){o.removeEventListener("mousedown",t),o.removeEventListener("mouseup",u),o.removeEventListener("touchstart",s),o.removeEventListener("touchmove",l),o.removeEventListener("touchend",a)}}),[e,o]),r}var ut=function(){return he};function st(e,i,r){var u=r.isInitialMount,s=r.highlightedIndex,l=r.items,a=r.environment,c=n(r,je);t.useEffect((function(){u||ze((function(){return e(o({highlightedIndex:s,highlightedItem:l[s],resultCount:l.length},c))}),a.document)}),i)}function lt(e){var n=e.highlightedIndex,o=e.isOpen,i=e.itemRefs,r=e.getItemNodeFromIndex,u=e.menuElement,s=e.scrollIntoView,l=t.useRef(!0);return qe((function(){n<0||!o||!Object.keys(i.current).length||(!1===l.current?l.current=!0:s(r(n),u))}),[n]),l}var at=he;function ct(e,t,n){var i,r=t.type,u=t.props;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:it(u,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:it(u,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:tt(u,"highlightedIndex"),isOpen:tt(u,"isOpen"),selectedItem:tt(u,"selectedItem"),inputValue:tt(u,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return o({},e,i)}var dt=function(){return dt=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},dt.apply(this,arguments)};K.array.isRequired,K.func,K.func,K.func,K.number,K.number,K.number,K.bool,K.bool,K.bool,K.any,K.any,K.any,K.string,K.string,K.string,K.func,K.string,K.func,K.func,K.func,K.func,K.func,K.shape({addEventListener:K.func,removeEventListener:K.func,document:K.shape({getElementById:K.func,activeElement:K.any,body:K.any})});var pt=dt(dt({},et),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,o=e.previousResultCount;return t?n?n!==o?"".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.":""}}),ft=he,gt=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 ht(e,t){var n,i=t.type,r=t.props,u=t.altKey;switch(i){case 14:n={isOpen:tt(r,"isOpen"),highlightedIndex:tt(r,"highlightedIndex"),selectedItem:r.items[t.index]};break;case 3:var s=t.key,l=""+e.inputValue+s,a=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,o=e.items,i=e.itemToString,r=e.getItemNodeFromIndex,u=t.toLowerCase(),s=0;s<o.length;s++){var l=(s+n+(t.length<2?1:0))%o.length,a=o[l];if(void 0!==a&&i(a).toLowerCase().startsWith(u)){var c=r(l);if(!(null==c?void 0:c.hasAttribute("disabled")))return l}}return n}({keysSoFar:l,highlightedIndex:!e.isOpen&&e.selectedItem?r.items.indexOf(e.selectedItem):e.highlightedIndex,items:r.items,itemToString:r.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});n={inputValue:l,highlightedIndex:a,isOpen:!0};break;case 1:n={highlightedIndex:e.isOpen?Ee(1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1):u&&null==e.selectedItem?-1:it(r,e,1),isOpen:!0};break;case 2:if(e.isOpen&&u)n=o({isOpen:tt(r,"isOpen"),highlightedIndex:tt(r,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex]});else n={highlightedIndex:e.isOpen?Ee(-1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1):it(r,e,-1),isOpen:!0};break;case 7:case 8:n=o({isOpen:tt(r,"isOpen"),highlightedIndex:tt(r,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex]});break;case 5:n={highlightedIndex:Pe(1,0,r.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:n={highlightedIndex:Pe(-1,r.items.length-1,r.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:n={highlightedIndex:Ee(-10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case 10:n={highlightedIndex:Ee(10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case 4:n={isOpen:!1,highlightedIndex:-1};break;case 11:n=o({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex]});break;case 19:n={selectedItem:t.selectedItem};break;default:return ct(e,t,gt)}return o({},e,n)}var mt=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],It=["onBlur","onClick","onKeyDown","refKey","ref"],vt=["item","index","onMouseMove","onClick","refKey","ref","disabled"];function yt(e){void 0===e&&(e={}),ft();var i=o({},pt,e),r=i.items,u=i.scrollIntoView,s=i.environment,l=i.itemToString,a=i.getA11ySelectionMessage,c=i.getA11yStatusMessage,d=Ze(ht,ot(i),i),p=d[0],f=d[1],g=p.isOpen,h=p.highlightedIndex,m=p.selectedItem,I=p.inputValue,v=t.useRef(null),y=t.useRef(null),x=t.useRef({}),b=t.useRef(null),w=Ye(i),S=t.useRef(),C=t.useRef(!0),k=Je({state:p,props:i}),O=t.useCallback((function(e){return x.current[w.getItemId(e)]}),[w]);st(c,[g,h,I,r],o({isInitialMount:C.current,previousResultCount:S.current,items:r,environment:s,itemToString:l},p)),st(a,[m],o({isInitialMount:C.current,previousResultCount:S.current,items:r,environment:s,itemToString:l},p));var M=lt({menuElement:y.current,highlightedIndex:h,isOpen:g,itemRefs:x,scrollIntoView:u,getItemNodeFromIndex:O});t.useEffect((function(){return b.current=ve((function(e){e({type:20,inputValue:""})}),500),function(){b.current.cancel()}}),[]),t.useEffect((function(){I&&b.current(f)}),[f,I]),at({isInitialMount:C.current,props:i,state:p}),t.useEffect((function(){C.current||(S.current=r.length)}));var D=rt(g,[y,v],s,(function(){f({type:11})})),E=ut();t.useEffect((function(){return C.current=!1,function(){C.current=!0}}),[]),t.useEffect((function(){g||(x.current={})}),[g]);var P=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),f({type:1,getItemNodeFromIndex:O,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),f({type:2,getItemNodeFromIndex:O,altKey:e.altKey})},Home:function(e){e.preventDefault(),f({type:5,getItemNodeFromIndex:O})},End:function(e){e.preventDefault(),f({type:6,getItemNodeFromIndex:O})},Escape:function(){k.current.state.isOpen&&f({type:4})},Enter:function(e){e.preventDefault(),f({type:k.current.state.isOpen?7:0})},PageUp:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:9,getItemNodeFromIndex:O}))},PageDown:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:10,getItemNodeFromIndex:O}))}," ":function(e){e.preventDefault();var t=k.current.state;t.isOpen?t.inputValue?f({type:3,key:" ",getItemNodeFromIndex:O}):f({type:8}):f({type:0})}}}),[f,O,k]),K=t.useCallback((function(){f({type:15})}),[f]),T=t.useCallback((function(){f({type:17})}),[f]),R=t.useCallback((function(){f({type:16})}),[f]),H=t.useCallback((function(e){f({type:18,highlightedIndex:e})}),[f]),F=t.useCallback((function(e){f({type:19,selectedItem:e})}),[f]),V=t.useCallback((function(){f({type:21})}),[f]),A=t.useCallback((function(e){f({type:20,inputValue:e})}),[f]),N=t.useCallback((function(e){return o({id:w.labelId,htmlFor:w.toggleButtonId},e)}),[w]),B=t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.onMouseLeave,s=r.refKey,l=void 0===s?"ref":s;r.onKeyDown,r.onBlur;var a=r.ref,c=n(r,mt),d=(void 0===t?{}:t).suppressRefError;return E("getMenuProps",void 0!==d&&d,l,y),o(((i={})[l]=xe(a,(function(e){y.current=e})),i.id=w.menuId,i.role="listbox",i["aria-labelledby"]=w.labelId,i.tabIndex=-1,i.onMouseLeave=ye(u,(function(){f({type:12})})),i),c)}),[f,E,w]);return{getToggleButtonProps:t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.onBlur,s=r.onClick,l=r.onKeyDown,a=r.refKey,c=void 0===a?"ref":a,d=r.ref,p=n(r,It),g=(void 0===t?{}:t).suppressRefError,h=void 0!==g&&g,m=k.current.state,I=o(((i={})[c]=xe(d,(function(e){v.current=e})),i["aria-activedescendant"]=m.isOpen&&m.highlightedIndex>-1?w.getItemId(m.highlightedIndex):"",i["aria-controls"]=w.menuId,i["aria-expanded"]=k.current.state.isOpen,i["aria-haspopup"]="listbox",i["aria-labelledby"]=""+w.labelId,i.id=w.toggleButtonId,i.role="combobox",i.tabIndex=0,i.onBlur=ye(u,(function(){m.isOpen&&!D.current.isMouseDown&&f({type:11})})),i),p);return p.disabled||(I.onClick=ye(s,(function(){f({type:0})})),I.onKeyDown=ye(l,(function(e){var t=De(e);t&&P[t]?P[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&f({type:3,key:t,getItemNodeFromIndex:O})}))),E("getToggleButtonProps",h,c,v),I}),[k,w,E,f,D,P,O]),getLabelProps:N,getMenuProps:B,getItemProps:t.useCallback((function(e){var t,i=void 0===e?{}:e,u=i.item,s=i.index,l=i.onMouseMove,a=i.onClick,c=i.refKey,d=void 0===c?"ref":c,p=i.ref,g=i.disabled,h=n(i,vt),I=k.current,v=I.state,y=I.props,b=null!=u?u:r[s],S=Xe(s,b,y.items),C=Xe(S,b,y.items);if(C<0)throw new Error("Pass either item or item index in getItemProps!");var O=o(((t={disabled:g,role:"option","aria-selected":""+(b===m),id:w.getItemId(C)})[d]=xe(p,(function(e){e&&(x.current[w.getItemId(C)]=e)})),t),h);return g||(O.onClick=ye(a,(function(){f({type:14,index:S})}))),O.onMouseMove=ye(l,(function(){S!==v.highlightedIndex&&(M.current=!1,f({type:13,index:S,disabled:g}))})),O}),[k,r,m,w,M,f]),toggleMenu:K,openMenu:R,closeMenu:T,setHighlightedIndex:H,selectItem:F,reset:V,setInputValue:A,highlightedIndex:h,isOpen:g,selectedItem:m,inputValue:I}}yt.stateChangeTypes=gt;var xt=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});K.array.isRequired,K.func,K.func,K.func,K.number,K.number,K.number,K.bool,K.bool,K.bool,K.any,K.any,K.any,K.string,K.string,K.string,K.string,K.string,K.string,K.func,K.string,K.string,K.func,K.func,K.func,K.func,K.func,K.func,K.shape({addEventListener:K.func,removeEventListener:K.func,document:K.shape({getElementById:K.func,activeElement:K.any,body:K.any})});var bt=he,wt=o({},et,{getA11yStatusMessage:we});function St(e,t){var n,i=t.type,r=t.props,u=t.altKey;switch(i){case 13:n={isOpen:tt(r,"isOpen"),highlightedIndex:tt(r,"highlightedIndex"),selectedItem:r.items[t.index],inputValue:r.itemToString(r.items[t.index])};break;case 0:n=e.isOpen?{highlightedIndex:Ee(1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:u&&null==e.selectedItem?-1:it(r,e,1,t.getItemNodeFromIndex),isOpen:r.items.length>=0};break;case 1:n=e.isOpen?u?o({isOpen:tt(r,"isOpen"),highlightedIndex:tt(r,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])}):{highlightedIndex:Ee(-1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:it(r,e,-1,t.getItemNodeFromIndex),isOpen:r.items.length>=0};break;case 7:n=o({isOpen:tt(r,"isOpen"),highlightedIndex:tt(r,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])});break;case 2:n=o({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case 5:n={highlightedIndex:Ee(-10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case 6:n={highlightedIndex:Ee(10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case 3:n={highlightedIndex:Pe(1,0,r.items.length,t.getItemNodeFromIndex,!1)};break;case 4:n={highlightedIndex:Pe(-1,r.items.length-1,r.items.length,t.getItemNodeFromIndex,!1)};break;case 9:n=o({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&t.selectItem&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])});break;case 8:n={isOpen:!0,highlightedIndex:tt(r,"highlightedIndex"),inputValue:t.inputValue};break;case 10:n={isOpen:!0,highlightedIndex:it(r,e,0)};break;case 19:n={selectedItem:t.selectedItem,inputValue:r.itemToString(t.selectedItem)};break;case 22:n={inputValue:t.inputValue};break;default:return ct(e,t,xt)}return o({},e,n)}var Ct=["onMouseLeave","refKey","ref"],kt=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Ot=["onClick","onPress","refKey","ref"],Mt=["onKeyDown","onChange","onInput","onFocus","onBlur","onChangeText","refKey","ref"];function Dt(e){void 0===e&&(e={}),bt();var i=o({},wt,e),r=i.initialIsOpen,u=i.defaultIsOpen,s=i.items,l=i.scrollIntoView,a=i.environment,c=i.getA11yStatusMessage,d=i.getA11ySelectionMessage,p=i.itemToString,f=function(e){var t=ot(e),n=t.selectedItem,i=t.inputValue;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),o({},t,{inputValue:i})}(i),g=function(e,n,o){var i=t.useRef(),r=Qe(e,n,o),u=r[0],s=r[1];return t.useEffect((function(){Me(o,"selectedItem")&&(i.current!==o.selectedItem&&s({type:22,inputValue:o.itemToString(o.selectedItem)}),i.current=u.selectedItem===i.current?o.selectedItem:u.selectedItem)})),[Oe(u,o),s]}(St,f,i),h=g[0],m=g[1],I=h.isOpen,v=h.highlightedIndex,y=h.selectedItem,x=h.inputValue,b=t.useRef(null),w=t.useRef({}),S=t.useRef(null),C=t.useRef(null),k=t.useRef(!0),O=Ye(i),M=t.useRef(),D=Je({state:h,props:i}),E=t.useCallback((function(e){return w.current[O.getItemId(e)]}),[O]);st(c,[I,v,x,s],o({isInitialMount:k.current,previousResultCount:M.current,items:s,environment:a,itemToString:p},h)),st(d,[y],o({isInitialMount:k.current,previousResultCount:M.current,items:s,environment:a,itemToString:p},h));var P=lt({menuElement:b.current,highlightedIndex:v,isOpen:I,itemRefs:w,scrollIntoView:l,getItemNodeFromIndex:E});at({isInitialMount:k.current,props:i,state:h}),t.useEffect((function(){(r||u||I)&&S.current&&S.current.focus()}),[]),t.useEffect((function(){k.current||(M.current=s.length)}));var K=rt(I,[S,b,C],a,(function(){m({type:9,selectItem:!1})})),T=ut();t.useEffect((function(){return k.current=!1,function(){k.current=!0}}),[]),t.useEffect((function(){if(I){if(document.activeElement!==S.current){var e;null==S||null==(e=S.current)||e.focus()}}else w.current={}}),[I]);var R=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),m({type:0,altKey:e.altKey,getItemNodeFromIndex:E})},ArrowUp:function(e){e.preventDefault(),m({type:1,altKey:e.altKey,getItemNodeFromIndex:E})},Home:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:3,getItemNodeFromIndex:E}))},End:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:4,getItemNodeFromIndex:E}))},Escape:function(e){var t=D.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),m({type:2}))},Enter:function(e){D.current.state.isOpen&&229!==e.which&&(e.preventDefault(),m({type:7,getItemNodeFromIndex:E}))},PageUp:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:5,getItemNodeFromIndex:E}))},PageDown:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:6,getItemNodeFromIndex:E}))}}}),[m,D,E]),H=t.useCallback((function(e){return o({id:O.labelId,htmlFor:O.inputId},e)}),[O]),F=t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.onMouseLeave,s=r.refKey,l=void 0===s?"ref":s,a=r.ref,c=n(r,Ct),d=(void 0===t?{}:t).suppressRefError;return T("getMenuProps",void 0!==d&&d,l,b),o(((i={})[l]=xe(a,(function(e){b.current=e})),i.id=O.menuId,i.role="listbox",i["aria-labelledby"]=O.labelId,i.onMouseLeave=ye(u,(function(){m({type:11})})),i),c)}),[m,T,O]),V=t.useCallback((function(e){var t,i,r=void 0===e?{}:e,u=r.item,s=r.index,l=r.refKey,a=void 0===l?"ref":l,c=r.ref,d=r.onMouseMove,p=r.onMouseDown,f=r.onClick;r.onPress;var g=r.disabled,h=n(r,kt),I=D.current,v=I.props,y=I.state,x=Xe(s,u,v.items);if(x<0)throw new Error("Pass either item or item index in getItemProps!");var b=f;return o(((t={})[a]=xe(c,(function(e){e&&(w.current[O.getItemId(x)]=e)})),t.disabled=g,t.role="option",t["aria-selected"]=""+(x===y.highlightedIndex),t.id=O.getItemId(x),t),!g&&((i={}).onClick=ye(b,(function(){m({type:13,index:s})})),i),{onMouseMove:ye(d,(function(){s!==y.highlightedIndex&&(P.current=!1,m({type:12,index:s,disabled:g}))})),onMouseDown:ye(p,(function(e){return e.preventDefault()}))},h)}),[m,D,P,O]),A=t.useCallback((function(e){var t,i=void 0===e?{}:e,r=i.onClick;i.onPress;var u=i.refKey,s=void 0===u?"ref":u,l=i.ref,a=n(i,Ot),c=D.current.state;return o(((t={})[s]=xe(l,(function(e){C.current=e})),t["aria-controls"]=O.menuId,t["aria-expanded"]=c.isOpen,t.id=O.toggleButtonId,t.tabIndex=-1,t),!a.disabled&&o({},{onClick:ye(r,(function(){m({type:14})}))}),a)}),[m,D,O]),N=t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.onKeyDown,s=r.onChange,l=r.onInput,a=r.onFocus,c=r.onBlur;r.onChangeText;var d=r.refKey,p=void 0===d?"ref":d,f=r.ref,g=n(r,Mt),h=(void 0===t?{}:t).suppressRefError;T("getInputProps",void 0!==h&&h,p,S);var I,v=D.current.state,y={};g.disabled||((I={}).onChange=ye(s,l,(function(e){m({type:8,inputValue:e.target.value})})),I.onKeyDown=ye(u,(function(e){var t=De(e);t&&R[t]&&R[t](e)})),I.onBlur=ye(c,(function(){v.isOpen&&!K.current.isMouseDown&&m({type:9,selectItem:!0})})),I.onFocus=ye(a,(function(){v.isOpen||m({type:10})})),y=I);return o(((i={})[p]=xe(f,(function(e){S.current=e})),i["aria-activedescendant"]=v.isOpen&&v.highlightedIndex>-1?O.getItemId(v.highlightedIndex):"",i["aria-autocomplete"]="list",i["aria-controls"]=O.menuId,i["aria-expanded"]=v.isOpen,i["aria-labelledby"]=O.labelId,i.autoComplete="off",i.id=O.inputId,i.role="combobox",i.value=v.inputValue,i),y,g)}),[m,R,D,K,T,O]),B=t.useCallback((function(){m({type:15})}),[m]),L=t.useCallback((function(){m({type:17})}),[m]),_=t.useCallback((function(){m({type:16})}),[m]),$=t.useCallback((function(e){m({type:18,highlightedIndex:e})}),[m]),j=t.useCallback((function(e){m({type:19,selectedItem:e})}),[m]);return{getItemProps:V,getLabelProps:H,getMenuProps:F,getInputProps:N,getToggleButtonProps:A,toggleMenu:B,openMenu:_,closeMenu:L,setHighlightedIndex:$,setInputValue:t.useCallback((function(e){m({type:20,inputValue:e})}),[m]),selectItem:j,reset:t.useCallback((function(){m({type:21})}),[m]),highlightedIndex:v,isOpen:I,selectedItem:y,inputValue:x}}Dt.stateChangeTypes=xt;var Et={activeIndex:-1,selectedItems:[]};function Pt(e,t){return nt(e,t,Et)}function Kt(e,t){return tt(e,t,Et)}function Tt(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;var t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}K.array,K.array,K.array,K.func,K.func,K.func,K.number,K.number,K.number,K.func,K.func,K.string,K.string,K.shape({addEventListener:K.func,removeEventListener:K.func,document:K.shape({getElementById:K.func,activeElement:K.any,body:K.any})});var Rt={itemToString:et.itemToString,stateReducer:et.stateReducer,environment:et.environment,getA11yRemovalMessage:function(e){var t=e.removedSelectedItem;return(0,e.itemToString)(t)+" has been removed."},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"},Ht=he,Ft=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 Vt(e,t){var n,i=t.type,r=t.index,u=t.props,s=t.selectedItem,l=e.activeIndex,a=e.selectedItems;switch(i){case 0:n={activeIndex:r};break;case 4:n={activeIndex:l-1<0?0:l-1};break;case 3:n={activeIndex:l+1>=a.length?-1:l+1};break;case 2:case 1:if(l<0)break;var c=l;1===a.length?c=-1:l===a.length-1&&(c=a.length-2),n=o({selectedItems:[].concat(a.slice(0,l),a.slice(l+1))},{activeIndex:c});break;case 5:n={activeIndex:a.length-1};break;case 6:n={selectedItems:a.slice(0,a.length-1)};break;case 8:n={selectedItems:[].concat(a,[s])};break;case 7:n={activeIndex:-1};break;case 9:var d=l,p=a.indexOf(s);if(p<0)break;1===a.length?d=-1:p===a.length-1&&(d=a.length-2),n={selectedItems:[].concat(a.slice(0,p),a.slice(p+1)),activeIndex:d};break;case 10:n={selectedItems:t.selectedItems};break;case 11:n={activeIndex:t.activeIndex};break;case 12:n={activeIndex:Kt(u,"activeIndex"),selectedItems:Kt(u,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return o({},e,n)}var At=["refKey","ref","onClick","onKeyDown","selectedItem","index"],Nt=["refKey","ref","onKeyDown","onClick","preventKeyAction"];function Bt(e){void 0===e&&(e={}),Ht();var i=o({},Rt,e),r=i.getA11yRemovalMessage,u=i.itemToString,s=i.environment,l=i.keyNavigationNext,a=i.keyNavigationPrevious,c=Ze(Vt,function(e){return{activeIndex:Pt(e,"activeIndex"),selectedItems:Pt(e,"selectedItems")}}(i),i),d=c[0],p=c[1],f=d.activeIndex,g=d.selectedItems,h=t.useRef(!0),m=t.useRef(null),I=t.useRef(g),v=t.useRef();v.current=[];var y=Je({state:d,props:i});t.useEffect((function(){if(!h.current){if(g.length<I.current.length){var e=I.current.find((function(e){return g.indexOf(e)<0}));Re(r({itemToString:u,resultCount:g.length,removedSelectedItem:e,activeIndex:f,activeSelectedItem:g[f]}),s.document)}I.current=g}}),[g.length]),t.useEffect((function(){h.current||(-1===f&&m.current?m.current.focus():v.current[f]&&v.current[f].focus())}),[f]),at({isInitialMount:h.current,props:i,state:d});var x=ut();t.useEffect((function(){return h.current=!1,function(){h.current=!0}}),[]);var b=t.useMemo((function(){var e;return(e={})[a]=function(){p({type:4})},e[l]=function(){p({type:3})},e.Delete=function(){p({type:1})},e.Backspace=function(){p({type:2})},e}),[p,l,a]),w=t.useMemo((function(){var e;return(e={})[a]=function(e){Tt(e)&&p({type:5})},e.Backspace=function(e){Tt(e)&&p({type:6})},e}),[p,a]);return{getSelectedItemProps:t.useCallback((function(e){var t,i=void 0===e?{}:e,r=i.refKey,u=void 0===r?"ref":r,s=i.ref,l=i.onClick,a=i.onKeyDown,c=i.selectedItem,d=i.index,f=n(i,At),g=y.current.state;if(Xe(d,c,g.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return o(((t={})[u]=xe(s,(function(e){e&&v.current.push(e)})),t.tabIndex=d===g.activeIndex?0:-1,t.onClick=ye(l,(function(){p({type:0,index:d})})),t.onKeyDown=ye(a,(function(e){var t=De(e);t&&b[t]&&b[t](e)})),t),f)}),[p,y,b]),getDropdownProps:t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.refKey,s=void 0===u?"ref":u,l=r.ref,a=r.onKeyDown,c=r.onClick,d=r.preventKeyAction,f=void 0!==d&&d,g=n(r,Nt),h=(void 0===t?{}:t).suppressRefError;return x("getDropdownProps",void 0!==h&&h,s,m),o(((i={})[s]=xe(l,(function(e){e&&(m.current=e)})),i),!f&&{onKeyDown:ye(a,(function(e){var t=De(e);t&&w[t]&&w[t](e)})),onClick:ye(c,(function(){p({type:7})}))},g)}),[p,w,x]),addSelectedItem:t.useCallback((function(e){p({type:8,selectedItem:e})}),[p]),removeSelectedItem:t.useCallback((function(e){p({type:9,selectedItem:e})}),[p]),setSelectedItems:t.useCallback((function(e){p({type:10,selectedItems:e})}),[p]),setActiveIndex:t.useCallback((function(e){p({type:11,activeIndex:e})}),[p]),reset:t.useCallback((function(){p({type:12})}),[p]),selectedItems:g,activeIndex:f}}Bt.stateChangeTypes=Ft,e.default=$e,e.resetIdCounter=function(){fe=0},e.useCombobox=Dt,e.useMultipleSelection=Bt,e.useSelect=yt,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=downshift.umd.min.js.map
{
"name": "downshift",
"version": "7.1.3-alpha.1",
"version": "7.2.0",
"description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.",

@@ -10,2 +10,3 @@ "main": "dist/downshift.cjs.js",

"sideEffects": false,
"browserslist": [],
"scripts": {

@@ -12,0 +13,0 @@ "build": "npm run build:web --silent && npm run build:native --silent",

@@ -1,2 +0,10 @@

!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;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 F=e=>"object"==typeof e&&null!=e&&1===e.nodeType,V=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,N=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return V(n.overflowY,t)||V(n.overflowX,t)||(e=>{let t=(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},A=(e,t,n,i,o,s,r,l)=>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,B=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};let L=0;function $(e){return"function"==typeof e?e:_}function _(){}function U(e,t){if(!e)return;const n=((e,t)=>{var n,i,o,s,r,l;if("undefined"==typeof document)return[];let{scrollMode:u,block:d,inline:a,boundary:c,skipOverflowHiddenElements:h}=t,p="function"==typeof c?c:e=>e!==c;if(!F(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,m=[],f=e;for(;F(f)&&p(f);){if(f=B(f),f===g){m.push(f);break}null!=f&&f===document.body&&N(f)&&!N(document.documentElement)||null!=f&&N(f,h)&&m.push(f)}let I=null!=(i=null==(n=window.visualViewport)?void 0:n.width)?i:innerWidth,y=null!=(s=null==(o=window.visualViewport)?void 0:o.height)?s:innerHeight,v=null!=(r=window.scrollX)?r:pageXOffset,x=null!=(l=window.scrollY)?l:pageYOffset,{height:b,width:w,top:S,right:k,bottom:C,left:O}=e.getBoundingClientRect(),M="start"===d||"nearest"===d?S:"end"===d?C:S+b/2,E="center"===a?O+w/2:"end"===a?k:O,D=[];for(let e=0;e<m.length;e++){let t=m[e],{height:n,width:i,top:o,right:s,bottom:r,left:l}=t.getBoundingClientRect();if("if-needed"===u&&S>=0&&O>=0&&C<=y&&k<=I&&S>=o&&C<=r&&O>=l&&k<=s)return D;let c=getComputedStyle(t),h=parseInt(c.borderLeftWidth,10),p=parseInt(c.borderTopWidth,10),f=parseInt(c.borderRightWidth,10),P=parseInt(c.borderBottomWidth,10),R=0,T=0,H="offsetWidth"in t?t.offsetWidth-t.clientWidth-h-f:0,K="offsetHeight"in t?t.offsetHeight-t.clientHeight-p-P:0,F="offsetWidth"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,V="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)R="start"===d?M:"end"===d?M-y:"nearest"===d?A(x,x+y,y,p,P,x+M,x+M+b,b):M-y/2,T="start"===a?E:"center"===a?E-I/2:"end"===a?E-I:A(v,v+I,I,h,f,v+E,v+E+w,w),R=Math.max(0,R+x),T=Math.max(0,T+v);else{R="start"===d?M-o-p:"end"===d?M-r+P+K:"nearest"===d?A(o,r,n,p,P+K,M,M+b,b):M-(o+n/2)+K/2,T="start"===a?E-l-h:"center"===a?E-(l+i/2)+H/2:"end"===a?E-s+f+H:A(l,s,i,h,f+H,E,E+w,w);let{scrollLeft:e,scrollTop:u}=t;R=Math.max(0,Math.min(u+R/V,t.scrollHeight-n/V+K)),T=Math.max(0,Math.min(e+T/F,t.scrollWidth-i/F+H)),M+=u-R,E+=e-T}D.push({el:t,top:R,left:T})}return D})(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 j(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function W(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 z(){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 q(){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 X(){return String(L++)}function Y(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 G(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}const J=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Q(e){void 0===e&&(e={});const t={};return J.forEach((n=>{e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function Z(e,t){return Object.keys(e).reduce(((n,i)=>(n[i]=ee(t,i)?t[i]:e[i],n)),{})}function ee(e,t){return void 0!==e[t]}function te(e){const{key:t,keyCode:n}=e;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?`Arrow${t}`:t}function ne(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=ie(e,r,n,i,o);return-1===l?t>=n?-1:t:l}function ie(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?ie(1,0,n,i,!1):ie(-1,n-1,n,i,!1):-1}function oe(e,t,n,i){return void 0===i&&(i=!0),t.some((t=>t&&(j(t,e,n)||i&&j(t,n.document.activeElement,n))))}const se=W((e=>{le(e).textContent=""}),500);function re(e,t){const n=le(t);e&&(n.textContent=e,se(t))}function le(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 ue=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 de=(()=>{class e extends t.Component{constructor(e){var t;super(e),t=this,this.id=this.props.id||`downshift-${X()}`,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=Q(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=Q(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],ee(this.props,e)||(l[e]=r[e]))})),s&&r.hasOwnProperty("inputValue")&&this.props.onInputValueChange(r.inputValue,{...this.getStateAndHelpers(),...r}),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]:q(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=ne(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=ne(-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=ie(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=ie(-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:z(n,t.buttonHandleClick),onKeyDown:z(o,t.buttonHandleKeyDown),onKeyUp:z(s,t.buttonHandleKeyUp),onBlur:z(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=te(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:z(s,r,t.inputHandleChange),onKeyDown:z(i,t.inputHandleKeyDown),onBlur:z(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=te(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]:q(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:z(n,(()=>{r!==t.getState().highlightedIndex&&(t.setHighlightedIndex(r,{type:2}),t.avoidScrolling=!0,t.internalSetTimeout((()=>t.avoidScrolling=!1),250))})),onMouseDown:z(i,(e=>{e.preventDefault()})),onClick:z(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=Q(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=Q(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),$(n)()}))},this.openMenu=e=>{this.internalSetState({isOpen:!0},e)},this.closeMenu=e=>{this.internalSetState({isOpen:!1},e)},this.updateStatus=W((()=>{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,re(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),Z(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=ne(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;!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: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){ee(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=G(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=G(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:Y,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:U},e.stateChangeTypes=ue,e})();var ae=de;const ce={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function he(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${Ie(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 pe=W(((e,t)=>{re(e(),t)}),200),ge="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function me(e){let{id:n=`downshift-${X()}`,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 fe(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Ie(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function ye(e){const n=t.useRef(e);return n.current=e,n}function ve(e,n,i){const o=t.useRef(),s=t.useRef(),r=t.useCallback(((t,n)=>{s.current=n,t=Z(t,n.props);const i=e(t,n);return n.props.stateReducer(t,{...n,changes:i})}),[e]),[l,u]=t.useReducer(r,n),d=ye(i),a=t.useCallback((e=>u({props:d.current,...e})),[d]),c=s.current;return t.useEffect((()=>{c&&o.current&&o.current!==l&&he(c,Z(o.current,c.props),l),o.current=l}),[l,i,c]),[l,a]}function xe(e,t,n){const[i,o]=ve(e,t,n);return[Z(i,n),o]}const be={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:U,environment:"undefined"==typeof window?{}:window};function we(e,t,n){void 0===n&&(n=ce);const i=e[`default${Ie(t)}`];return void 0!==i?i:n[t]}function Se(e,t,n){void 0===n&&(n=ce);const i=e[t];if(void 0!==i)return i;const o=e[`initial${Ie(t)}`];return void 0!==o?o:we(e,t,n)}function ke(e){const t=Se(e,"selectedItem"),n=Se(e,"isOpen"),i=Se(e,"highlightedIndex"),o=Se(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function Ce(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 Oe(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&&!oe(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||oe(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 Me=()=>_;function Ee(e,n,i){let{isInitialMount:o,highlightedIndex:s,items:r,environment:l,...u}=i;t.useEffect((()=>{o||pe((()=>e({highlightedIndex:s,highlightedItem:r[s],resultCount:r.length,...u})),l.document)}),n)}function De(e){let{highlightedIndex:n,isOpen:i,itemRefs:o,getItemNodeFromIndex:s,menuElement:r,scrollIntoView:l}=e;const u=t.useRef(!0);return ge((()=>{n<0||!i||!Object.keys(o.current).length||(!1===u.current?u.current=!0:l(s(n),r))}),[n]),u}let Pe=_;function Re(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:Ce(o,e,0)};break;case n.FunctionOpenMenu:s={isOpen:!0,highlightedIndex:Ce(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:we(o,"highlightedIndex"),isOpen:we(o,"isOpen"),selectedItem:we(o,"selectedItem"),inputValue:we(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...s}}var Te=function(){return Te=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},Te.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 He=Te(Te({},be),{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.":""}}),Ke=_;var Fe=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 Ve(e,t){const{type:n,props:i,altKey:o}=t;let s;switch(n){case 14:s={isOpen:we(i,"isOpen"),highlightedIndex:we(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?ne(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):o&&null==e.selectedItem?-1:Ce(i,e,1),isOpen:!0};break;case 2:if(e.isOpen&&o)s={isOpen:we(i,"isOpen"),highlightedIndex:we(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};else{s={highlightedIndex:e.isOpen?ne(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):Ce(i,e,-1),isOpen:!0}}break;case 7:case 8:s={isOpen:we(i,"isOpen"),highlightedIndex:we(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 5:s={highlightedIndex:ie(1,0,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:s={highlightedIndex:ie(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:s={highlightedIndex:ne(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 10:s={highlightedIndex:ne(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 Re(e,t,Fe)}return{...e,...s}}function Ne(e){void 0===e&&(e={}),Ke();const n={...He,...e},{items:i,scrollIntoView:o,environment:s,itemToString:r,getA11ySelectionMessage:l,getA11yStatusMessage:u}=n,d=ke(n),[a,c]=xe(Ve,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=me(n),b=t.useRef(),w=t.useRef(!0),S=ye({state:a,props:n}),k=t.useCallback((e=>y.current[x.getItemId(e)]),[x]);Ee(u,[h,p,m,i],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:s,itemToString:r,...a}),Ee(l,[g],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:s,itemToString:r,...a});const C=De({menuElement:I.current,highlightedIndex:p,isOpen:h,itemRefs:y,scrollIntoView:o,getItemNodeFromIndex:k});t.useEffect((()=>(v.current=W((e=>{e({type:20,inputValue:""})}),500),()=>{v.current.cancel()})),[]),t.useEffect((()=>{m&&v.current(c)}),[c,m]),Pe({isInitialMount:w.current,props:n,state:a}),t.useEffect((()=>{w.current||(b.current=i.length)}));const O=Oe(h,[I,f],s,(()=>{c({type:11})})),M=Me();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]:q(r,(e=>{I.current=e})),id:x.menuId,role:"listbox","aria-labelledby":x.labelId,tabIndex:-1,onMouseLeave:z(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=te(e);t&&E[t]?E[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&c({type:3,key:t,getItemNodeFromIndex:k})},p={[s]:q(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:z(n,(()=>{d.isOpen&&!O.current.isMouseDown&&c({type:11})})),...l};return l.disabled||(p.onClick=z(i,a),p.onKeyDown=z(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=fe(n,p,h.items),f=()=>{c({type:14,index:m})},I=fe(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]:q(l,(e=>{e&&(y.current[x.getItemId(I)]=e)})),...d};return u||(v.onClick=z(s,f)),v.onMouseMove=z(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}}Ne.stateChangeTypes=Fe;var Ae=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 Be=_;const Le={...be,getA11yStatusMessage:Y};function $e(e,t){const{type:n,props:i,altKey:o}=t;let s;switch(n){case 13:s={isOpen:we(i,"isOpen"),highlightedIndex:we(i,"highlightedIndex"),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case 0:s=e.isOpen?{highlightedIndex:ne(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:o&&null==e.selectedItem?-1:Ce(i,e,1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 1:s=e.isOpen?o?{isOpen:we(i,"isOpen"),highlightedIndex:we(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}}:{highlightedIndex:ne(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:Ce(i,e,-1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 7:s={isOpen:we(i,"isOpen"),highlightedIndex:we(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:ne(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 6:s={highlightedIndex:ne(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 3:s={highlightedIndex:ie(1,0,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:s={highlightedIndex:ie(-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:we(i,"highlightedIndex"),inputValue:t.inputValue};break;case 10:s={isOpen:!0,highlightedIndex:Ce(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 Re(e,t,Ae)}return{...e,...s}}function _e(e){void 0===e&&(e={}),Be();const n={...Le,...e},{initialIsOpen:i,defaultIsOpen:o,items:s,scrollIntoView:r,environment:l,getA11yStatusMessage:u,getA11ySelectionMessage:d,itemToString:a}=n,c=function(e){const t=ke(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]=ve(e,n,i);return t.useEffect((()=>{ee(i,"selectedItem")&&(o.current!==i.selectedItem&&r({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=s.selectedItem===o.current?i.selectedItem:s.selectedItem)})),[Z(s,i),r]}($e,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=me(n),k=t.useRef(),C=ye({state:h,props:n}),O=t.useCallback((e=>v.current[S.getItemId(e)]),[S]);Ee(u,[g,m,I,s],{isInitialMount:w.current,previousResultCount:k.current,items:s,environment:l,itemToString:a,...h}),Ee(d,[f],{isInitialMount:w.current,previousResultCount:k.current,items:s,environment:l,itemToString:a,...h});const M=De({menuElement:y.current,highlightedIndex:m,isOpen:g,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:O});Pe({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=Oe(g,[x,y,b],l,(()=>{p({type:9,selectItem:!1})})),D=Me();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]:q(o,(e=>{y.current=e})),id:S.menuId,role:"listbox","aria-labelledby":S.labelId,onMouseLeave:z(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=fe(n,t,c.items);if(g<0)throw new Error("Pass either item or item index in getItemProps!");const m=l;return{[i]:q(o,(e=>{e&&(v.current[S.getItemId(g)]=e)})),disabled:d,role:"option","aria-selected":`${g===h.highlightedIndex}`,id:S.getItemId(g),...!d&&{onClick:z(m,(()=>{p({type:13,index:n})}))},onMouseMove:z(s,(()=>{n!==h.highlightedIndex&&(M.current=!1,p({type:12,index:n,disabled:d}))})),onMouseDown:z(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]:q(o,(e=>{b.current=e})),"aria-controls":S.menuId,"aria-expanded":r.isOpen,id:S.toggleButtonId,tabIndex:-1,...!s.disabled&&{onClick:z(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=te(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:z(i,o,m),onKeyDown:z(n,g),onBlur:z(r,f),onFocus:z(s,I)}),{[u]:q(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=Ae;const Ue={activeIndex:-1,selectedItems:[]};function je(e,t){return Se(e,t,Ue)}function We(e,t){return we(e,t,Ue)}function ze(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 qe={itemToString:be.itemToString,stateReducer:be.stateReducer,environment:be.environment,getA11yRemovalMessage:function(e){const{removedSelectedItem:t,itemToString:n}=e;return`${n(t)} has been removed.`},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"};let Xe=_;var Ye=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 Ge(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:{if(r<0)break;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);if(t<0)break;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:We(o,"activeIndex"),selectedItems:We(o,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...u}}function Je(e){void 0===e&&(e={}),Xe();const n={...qe,...e},{getA11yRemovalMessage:i,itemToString:o,environment:s,keyNavigationNext:r,keyNavigationPrevious:l}=n,[u,d]=xe(Ge,function(e){return{activeIndex:je(e,"activeIndex"),selectedItems:je(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=ye({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));re(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]),Pe({isInitialMount:h.current,props:n,state:u});const I=Me();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){ze(e)&&d({type:5})},Backspace(e){ze(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(fe(r,s,u.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return{[t]:q(n,(e=>{e&&m.current.push(e)})),tabIndex:r===u.activeIndex?0:-1,onClick:z(i,(()=>{d({type:0,index:r})})),onKeyDown:z(o,(e=>{const t=te(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]:q(i,(e=>{e&&(p.current=e)})),...!r&&{onKeyDown:z(o,(e=>{const t=te(e);t&&v[t]&&v[t](e)})),onClick:z(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}}Je.stateChangeTypes=Ye,e.default=ae,e.resetIdCounter=function(){L=0},e.useCombobox=_e,e.useMultipleSelection=Je,e.useSelect=Ne,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);function r(e,t){if(null==e)return{};var n,i,o={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u.apply(this,arguments)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var a={},d=60103,c=60106,p=60107,f=60108,g=60114,h=60109,m=60110,I=60112,v=60113,y=60120,x=60115,b=60116,w=60121,S=60122,k=60117,C=60129,O=60131;
/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/if("function"==typeof Symbol&&Symbol.for){var M=Symbol.for;d=M("react.element"),c=M("react.portal"),p=M("react.fragment"),f=M("react.strict_mode"),g=M("react.profiler"),h=M("react.provider"),m=M("react.context"),I=M("react.forward_ref"),v=M("react.suspense"),y=M("react.suspense_list"),x=M("react.memo"),b=M("react.lazy"),w=M("react.block"),S=M("react.server.block"),k=M("react.fundamental"),C=M("react.debug_trace_mode"),O=M("react.legacy_hidden")}function D(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case d:switch(e=e.type){case p:case g:case f:case v:case y:return e;default:switch(e=e&&e.$$typeof){case m:case I:case b:case x:case h:return e;default:return t}}case c:return t}}}var E=h,K=d,P=I,T=p,R=b,H=x,F=c,V=g,N=f,A=v;a.ContextConsumer=m,a.ContextProvider=E,a.Element=K,a.ForwardRef=P,a.Fragment=T,a.Lazy=R,a.Memo=H,a.Portal=F,a.Profiler=V,a.StrictMode=N,a.Suspense=A,a.isAsyncMode=function(){return!1},a.isConcurrentMode=function(){return!1},a.isContextConsumer=function(e){return D(e)===m},a.isContextProvider=function(e){return D(e)===h},a.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===d},a.isForwardRef=function(e){return D(e)===I},a.isFragment=function(e){return D(e)===p},a.isLazy=function(e){return D(e)===b},a.isMemo=function(e){return D(e)===x},a.isPortal=function(e){return D(e)===c},a.isProfiler=function(e){return D(e)===g},a.isStrictMode=function(e){return D(e)===f},a.isSuspense=function(e){return D(e)===v},a.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===p||e===g||e===C||e===f||e===v||e===y||e===O||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===x||e.$$typeof===h||e.$$typeof===m||e.$$typeof===I||e.$$typeof===k||e.$$typeof===w||e[0]===S)},a.typeOf=D;let B=e=>"object"==typeof e&&null!=e&&1===e.nodeType,L=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,_=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return L(n.overflowY,t)||L(n.overflowX,t)||(e=>{let t=(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},j=(e,t,n,i,o,r,u,s)=>r<e&&u>t||r>e&&u<t?0:r<=e&&s<=n||u>=t&&s>=n?r-e-i:u>t&&s<n||r<e&&s>n?u-t+o:0,U=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};var $=0;function W(e){return"function"==typeof e?e:z}function z(){}function q(e,t){if(e){var n=((e,t)=>{var n,i,o,r,u,s;if("undefined"==typeof document)return[];let{scrollMode:l,block:a,inline:d,boundary:c,skipOverflowHiddenElements:p}=t,f="function"==typeof c?c:e=>e!==c;if(!B(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,h=[],m=e;for(;B(m)&&f(m);){if(m=U(m),m===g){h.push(m);break}null!=m&&m===document.body&&_(m)&&!_(document.documentElement)||null!=m&&_(m,p)&&h.push(m)}let I=null!=(i=null==(n=window.visualViewport)?void 0:n.width)?i:innerWidth,v=null!=(r=null==(o=window.visualViewport)?void 0:o.height)?r:innerHeight,y=null!=(u=window.scrollX)?u:pageXOffset,x=null!=(s=window.scrollY)?s:pageYOffset,{height:b,width:w,top:S,right:k,bottom:C,left:O}=e.getBoundingClientRect(),M="start"===a||"nearest"===a?S:"end"===a?C:S+b/2,D="center"===d?O+w/2:"end"===d?k:O,E=[];for(let e=0;e<h.length;e++){let t=h[e],{height:n,width:i,top:o,right:r,bottom:u,left:s}=t.getBoundingClientRect();if("if-needed"===l&&S>=0&&O>=0&&C<=v&&k<=I&&S>=o&&C<=u&&O>=s&&k<=r)return E;let c=getComputedStyle(t),p=parseInt(c.borderLeftWidth,10),f=parseInt(c.borderTopWidth,10),m=parseInt(c.borderRightWidth,10),K=parseInt(c.borderBottomWidth,10),P=0,T=0,R="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-m:0,H="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-K:0,F="offsetWidth"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,V="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)P="start"===a?M:"end"===a?M-v:"nearest"===a?j(x,x+v,v,f,K,x+M,x+M+b,b):M-v/2,T="start"===d?D:"center"===d?D-I/2:"end"===d?D-I:j(y,y+I,I,p,m,y+D,y+D+w,w),P=Math.max(0,P+x),T=Math.max(0,T+y);else{P="start"===a?M-o-f:"end"===a?M-u+K+H:"nearest"===a?j(o,u,n,f,K+H,M,M+b,b):M-(o+n/2)+H/2,T="start"===d?D-s-p:"center"===d?D-(s+i/2)+R/2:"end"===d?D-r+m+R:j(s,r,i,p,m+R,D,D+w,w);let{scrollLeft:e,scrollTop:l}=t;P=Math.max(0,Math.min(l+P/V,t.scrollHeight-n/V+H)),T=Math.max(0,Math.min(e+T/F,t.scrollWidth-i/F+R)),M+=l-P,D+=e-T}E.push({el:t,top:P,left:T})}return E})(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((function(e){var t=e.el,n=e.top,i=e.left;t.scrollTop=n,t.scrollLeft=i}))}}function X(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function Y(e,t){var n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,r=new Array(o),u=0;u<o;u++)r[u]=arguments[u];i(),n=setTimeout((function(){n=null,e.apply(void 0,r)}),t)}return o.cancel=i,o}function G(){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((function(t){return t&&t.apply(void 0,[e].concat(i)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function Q(){return String($++)}function Z(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;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 ee(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var te=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function ne(e){void 0===e&&(e={});var t={};return te.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function ie(e,t){return Object.keys(e).reduce((function(n,i){return n[i]=oe(t,i)?t[i]:e[i],n}),{})}function oe(e,t){return void 0!==e[t]}function re(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function ue(e,t,n,i,o){if(void 0===o&&(o=!0),0===n)return-1;var r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);var u=t+e;u<0?u=o?r:0:u>r&&(u=o?0:r);var s=se(e,u,n,i,o);return-1===s?t>=n?-1:t:s}function se(e,t,n,i,o){var r=i(t);if(!r||!r.hasAttribute("disabled"))return t;if(e>0){for(var u=t+1;u<n;u++)if(!i(u).hasAttribute("disabled"))return u}else for(var s=t-1;s>=0;s--)if(!i(s).hasAttribute("disabled"))return s;return o?e>0?se(1,0,n,i,!1):se(-1,n-1,n,i,!1):-1}function le(e,t,n,i){return void 0===i&&(i=!0),t.some((function(t){return t&&(X(t,e,n)||i&&X(t,n.document.activeElement,n))}))}var ae=Y((function(e){ce(e).textContent=""}),500);function de(e,t){var n=ce(t);e&&(n.textContent=e,ae(t))}function ce(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).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}),fe=["refKey","ref"],ge=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],he=["onKeyDown","onBlur","onChange","onInput","onChangeText"],me=["refKey","ref"],Ie=["onMouseMove","onMouseDown","onClick","onPress","index","item"],ve=function(){var e=function(e){var n,i;function o(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+Q(),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var i=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==i})),e()}),t);n.timeoutIds.push(i)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=ne(t),n.internalSetState(u({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,i){t=ne(t),n.internalSetState(u({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),i)},n.selectItemAtIndex=function(e,t,i){var o=n.items[e];null!=o&&n.selectItem(o,t,i)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var i,o,r={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,u({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var l=s?e(t):e;l=n.props.stateReducer(t,l),i=l.hasOwnProperty("selectedItem");var a={};return i&&l.selectedItem!==t.selectedItem&&(o=l.selectedItem),l.type=l.type||0,Object.keys(l).forEach((function(e){t[e]!==l[e]&&(r[e]=l[e]),"type"!==e&&(l[e],oe(n.props,e)||(a[e]=l[e]))})),s&&l.hasOwnProperty("inputValue")&&n.props.onInputValueChange(l.inputValue,u({},n.getStateAndHelpers(),l)),a}),(function(){W(t)(),Object.keys(r).length>1&&n.props.onStateChange(r,n.getStateAndHelpers()),i&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(r,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var i,o=void 0===e?{}:e,s=o.refKey,l=void 0===s?"ref":s,a=o.ref,d=r(o,fe),c=(void 0===t?{}:t).suppressRefError,p=void 0!==c&&c;n.getRootProps.called=!0,n.getRootProps.refKey=l,n.getRootProps.suppressRefError=p;var f=n.getState().isOpen;return u(((i={})[l]=J(a,n.rootRef),i.role="combobox",i["aria-expanded"]=f,i["aria-haspopup"]="listbox",i["aria-owns"]=f?n.menuId:null,i["aria-labelledby"]=n.labelId,i),d)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=ue(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=ue(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,i=t.highlightedIndex;if(n&&null!=i){e.preventDefault();var o=this.items[i],r=this.getItemNodeFromIndex(i);if(null==o||r&&r.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(u({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=u({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=u({},n.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var i=this.getItemCount();if(!(i<=0)&&n){var o=se(1,0,i,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var i=this.getItemCount();if(!(i<=0)&&n){var o=se(-1,i-1,i,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick;t.onPress;var o=t.onKeyDown,s=t.onKeyUp,l=t.onBlur,a=r(t,ge),d=n.getState().isOpen,c={onClick:G(i,n.buttonHandleClick),onKeyDown:G(o,n.buttonHandleKeyDown),onKeyUp:G(s,n.buttonHandleKeyUp),onBlur:G(l,n.buttonHandleBlur)};return u({type:"button",role:"button","aria-label":d?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},a.disabled?{}:c,a)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=re(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(s(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return u({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,o=t.onBlur,s=t.onChange,l=t.onInput;t.onChangeText;var a=r(t,he),d={};var c,p=n.getState(),f=p.inputValue,g=p.isOpen,h=p.highlightedIndex;a.disabled||((c={}).onInput=G(s,l,n.inputHandleChange),c.onKeyDown=G(i,n.inputHandleKeyDown),c.onBlur=G(o,n.inputHandleBlur),d=c);return u({"aria-autocomplete":"list","aria-activedescendant":g&&"number"==typeof h&&h>=0?n.getItemId(h):null,"aria-controls":g?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:f,id:n.inputId},d,a)},n.inputHandleKeyDown=function(e){var t=re(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(s(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var i,o=void 0===e?{}:e,s=o.refKey,l=void 0===s?"ref":s,a=o.ref,d=r(o,me),c=(void 0===t?{}:t).suppressRefError,p=void 0!==c&&c;return n.getMenuProps.called=!0,n.getMenuProps.refKey=l,n.getMenuProps.suppressRefError=p,u(((i={})[l]=J(a,n.menuRef),i.role="listbox",i["aria-labelledby"]=d&&d["aria-label"]?null:n.labelId,i.id=n.menuId,i),d)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,o=i.onMouseMove,s=i.onMouseDown,l=i.onClick;i.onPress;var a=i.index,d=i.item,c=void 0===d?void 0:d,p=r(i,Ie);void 0===a?(n.items.push(c),a=n.items.indexOf(c)):n.items[a]=c;var f=l,g=((t={onMouseMove:G(o,(function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:G(s,(function(e){e.preventDefault()}))}).onClick=G(f,(function(){n.selectItemAtIndex(a,{type:9})})),t),h=p.disabled?{onMouseDown:g.onMouseDown}:g;return u({id:n.getItemId(a),role:"option","aria-selected":n.getState().highlightedIndex===a},h,p)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=ne(e),n.internalSetState((function(t){var i=t.selectedItem;return u({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(i)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=ne(e),n.internalSetState((function(t){var i=t.isOpen;return u({isOpen:!i},i&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var i=n.getState(),o=i.isOpen,r=i.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof r&&n.setHighlightedIndex(r,e),W(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=Y((function(){var e=n.getState(),t=n.items[e.highlightedIndex],i=n.getItemCount(),o=n.props.getA11yStatusMessage(u({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:i,highlightedItem:t},e));n.previousResultCount=i,de(o,n.props.environment.document)}),200);var i=n.props,o=i.defaultHighlightedIndex,l=i.initialHighlightedIndex,a=void 0===l?o:l,d=i.defaultIsOpen,c=i.initialIsOpen,p=void 0===c?d:c,f=i.initialInputValue,g=void 0===f?"":f,h=i.initialSelectedItem,m=void 0===h?null:h,I=n.getState({highlightedIndex:a,isOpen:p,inputValue:g,selectedItem:m});return null!=I.selectedItem&&void 0===n.props.initialInputValue&&(I.inputValue=n.props.itemToString(I.selectedItem)),n.state=I,n}i=e,(n=o).prototype=Object.create(i.prototype),n.prototype.constructor=n,l(n,i);var a=o.prototype;return a.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},a.getState=function(e){return void 0===e&&(e=this.state),ie(e,this.props)},a.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},a.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},a.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},a.moveHighlightedIndex=function(e,t){var n=this,i=this.getItemCount(),o=this.getState().highlightedIndex;if(i>0){var r=ue(e,o,i,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(r,t)}},a.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,i=e.selectedItem,o=e.isOpen,r=this.props.itemToString,u=this.id,s=this.getRootProps,l=this.getToggleButtonProps,a=this.getLabelProps,d=this.getMenuProps,c=this.getInputProps,p=this.getItemProps,f=this.openMenu,g=this.closeMenu,h=this.toggleMenu,m=this.selectItem,I=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,x=this.clearSelection,b=this.clearItems;return{getRootProps:s,getToggleButtonProps:l,getLabelProps:a,getMenuProps:d,getInputProps:c,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:g,toggleMenu:h,selectItem:m,selectItemAtIndex:I,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:x,clearItems:b,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:r,id:u,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:i}},a.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!le(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},i=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},r=function(t){var n=le(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},u=this.props.environment;u.addEventListener("mousedown",t),u.addEventListener("mouseup",n),u.addEventListener("touchstart",i),u.addEventListener("touchmove",o),u.addEventListener("touchend",r),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),u.removeEventListener("mousedown",t),u.removeEventListener("mouseup",n),u.removeEventListener("touchstart",i),u.removeEventListener("touchmove",o),u.removeEventListener("touchend",r)}},a.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,i=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==i},a.componentDidUpdate=function(e,t){oe(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()},a.componentWillUnmount=function(){this.cleanup()},a.render=function(){var e=ee(this.props.children,z);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;var n=ee(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},o}(t.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Z,itemToString:function(e){return null==e?"":String(e)},onStateChange:z,onInputValueChange:z,onUserAction:z,onChange:z,onSelect:z,onOuterClick:z,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:q},e.stateChangeTypes=pe,e}(),ye=ve,xe=["isInitialMount","highlightedIndex","items","environment"],be={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function we(e,t,n){var i=e.props,o=e.type,r={};Object.keys(t).forEach((function(i){!function(e,t,n,i){var o=t.props,r=t.type,s="on"+Me(e)+"Change";o[s]&&void 0!==i[e]&&i[e]!==n[e]&&o[s](u({type:r},i))}(i,e,t,n),n[i]!==t[i]&&(r[i]=n[i])})),i.onStateChange&&Object.keys(r).length&&i.onStateChange(u({type:o},r))}var Se=Y((function(e,t){de(e(),t)}),200),ke="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function Ce(e){var n=e.id,i=void 0===n?"downshift-"+Q():n,o=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,l=e.inputId;return t.useRef({labelId:o||i+"-label",menuId:r||i+"-menu",getItemId:u||function(e){return i+"-item-"+e},toggleButtonId:s||i+"-toggle-button",inputId:l||i+"-input"}).current}function Oe(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Me(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function De(e){var n=t.useRef(e);return n.current=e,n}function Ee(e,n,i){var o=t.useRef(),r=t.useRef(),s=t.useCallback((function(t,n){r.current=n,t=ie(t,n.props);var i=e(t,n);return n.props.stateReducer(t,u({},n,{changes:i}))}),[e]),l=t.useReducer(s,n),a=l[0],d=l[1],c=De(i),p=t.useCallback((function(e){return d(u({props:c.current},e))}),[c]),f=r.current;return t.useEffect((function(){f&&o.current&&o.current!==a&&we(f,ie(o.current,f.props),a),o.current=a}),[a,i,f]),[a,p]}function Ke(e,t,n){var i=Ee(e,t,n),o=i[0],r=i[1];return[ie(o,n),r]}var Pe={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:q,environment:"undefined"==typeof window?{}:window};function Te(e,t,n){void 0===n&&(n=be);var i=e["default"+Me(t)];return void 0!==i?i:n[t]}function Re(e,t,n){void 0===n&&(n=be);var i=e[t];if(void 0!==i)return i;var o=e["initial"+Me(t)];return void 0!==o?o:Te(e,t,n)}function He(e){var t=Re(e,"selectedItem"),n=Re(e,"isOpen"),i=Re(e,"highlightedIndex"),o=Re(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function Fe(e,t,n){var i=e.items,o=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,u=t.selectedItem,s=t.highlightedIndex;return 0===i.length?-1:void 0!==o&&s===o?o:void 0!==r?r:u?i.indexOf(u):0===n?-1:n<0?i.length-1:0}function Ve(e,n,i,o){var r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((function(){var t=function(){r.current.isMouseDown=!0},u=function(t){r.current.isMouseDown=!1,e&&!le(t.target,n.map((function(e){return e.current})),i)&&o()},s=function(){r.current.isTouchMove=!1},l=function(){r.current.isTouchMove=!0},a=function(t){!e||r.current.isTouchMove||le(t.target,n.map((function(e){return e.current})),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",u),i.addEventListener("touchstart",s),i.addEventListener("touchmove",l),i.addEventListener("touchend",a),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",u),i.removeEventListener("touchstart",s),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",a)}}),[e,i]),r}var Ne=function(){return z};function Ae(e,n,i){var o=i.isInitialMount,s=i.highlightedIndex,l=i.items,a=i.environment,d=r(i,xe);t.useEffect((function(){o||Se((function(){return e(u({highlightedIndex:s,highlightedItem:l[s],resultCount:l.length},d))}),a.document)}),n)}function Be(e){var n=e.highlightedIndex,i=e.isOpen,o=e.itemRefs,r=e.getItemNodeFromIndex,u=e.menuElement,s=e.scrollIntoView,l=t.useRef(!0);return ke((function(){n<0||!i||!Object.keys(o.current).length||(!1===l.current?l.current=!0:s(r(n),u))}),[n]),l}var Le=z;function _e(e,t,n){var i,o=t.type,r=t.props;switch(o){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Fe(r,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Fe(r,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Te(r,"highlightedIndex"),isOpen:Te(r,"isOpen"),selectedItem:Te(r,"selectedItem"),inputValue:Te(r,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return u({},e,i)}var je=function(){return je=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},je.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 Ue=je(je({},Pe),{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.":""}}),$e=z,We=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 ze(e,t){var n,i=t.type,o=t.props,r=t.altKey;switch(i){case 14:n={isOpen:Te(o,"isOpen"),highlightedIndex:Te(o,"highlightedIndex"),selectedItem:o.items[t.index]};break;case 3:var s=t.key,l=""+e.inputValue+s,a=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.getItemNodeFromIndex,u=t.toLowerCase(),s=0;s<i.length;s++){var l=(s+n+(t.length<2?1:0))%i.length,a=i[l];if(void 0!==a&&o(a).toLowerCase().startsWith(u)){var d=r(l);if(!(null==d?void 0:d.hasAttribute("disabled")))return l}}return n}({keysSoFar:l,highlightedIndex:!e.isOpen&&e.selectedItem?o.items.indexOf(e.selectedItem):e.highlightedIndex,items:o.items,itemToString:o.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});n={inputValue:l,highlightedIndex:a,isOpen:!0};break;case 1:n={highlightedIndex:e.isOpen?ue(1,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1):r&&null==e.selectedItem?-1:Fe(o,e,1),isOpen:!0};break;case 2:if(e.isOpen&&r)n=u({isOpen:Te(o,"isOpen"),highlightedIndex:Te(o,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex]});else n={highlightedIndex:e.isOpen?ue(-1,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1):Fe(o,e,-1),isOpen:!0};break;case 7:case 8:n=u({isOpen:Te(o,"isOpen"),highlightedIndex:Te(o,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex]});break;case 5:n={highlightedIndex:se(1,0,o.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:n={highlightedIndex:se(-1,o.items.length-1,o.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:n={highlightedIndex:ue(-10,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1)};break;case 10:n={highlightedIndex:ue(10,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1)};break;case 4:n={isOpen:!1,highlightedIndex:-1};break;case 11:n=u({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex]});break;case 19:n={selectedItem:t.selectedItem};break;default:return _e(e,t,We)}return u({},e,n)}var qe=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],Xe=["onBlur","onClick","onKeyDown","refKey","ref"],Ye=["item","index","onMouseMove","onClick","refKey","ref","disabled"];function Ge(e){void 0===e&&(e={}),$e();var n=u({},Ue,e),i=n.items,o=n.scrollIntoView,s=n.environment,l=n.itemToString,a=n.getA11ySelectionMessage,d=n.getA11yStatusMessage,c=Ke(ze,He(n),n),p=c[0],f=c[1],g=p.isOpen,h=p.highlightedIndex,m=p.selectedItem,I=p.inputValue,v=t.useRef(null),y=t.useRef(null),x=t.useRef({}),b=t.useRef(null),w=Ce(n),S=t.useRef(),k=t.useRef(!0),C=De({state:p,props:n}),O=t.useCallback((function(e){return x.current[w.getItemId(e)]}),[w]);Ae(d,[g,h,I,i],u({isInitialMount:k.current,previousResultCount:S.current,items:i,environment:s,itemToString:l},p)),Ae(a,[m],u({isInitialMount:k.current,previousResultCount:S.current,items:i,environment:s,itemToString:l},p));var M=Be({menuElement:y.current,highlightedIndex:h,isOpen:g,itemRefs:x,scrollIntoView:o,getItemNodeFromIndex:O});t.useEffect((function(){return b.current=Y((function(e){e({type:20,inputValue:""})}),500),function(){b.current.cancel()}}),[]),t.useEffect((function(){I&&b.current(f)}),[f,I]),Le({isInitialMount:k.current,props:n,state:p}),t.useEffect((function(){k.current||(S.current=i.length)}));var D=Ve(g,[y,v],s,(function(){f({type:11})})),E=Ne();t.useEffect((function(){return k.current=!1,function(){k.current=!0}}),[]),t.useEffect((function(){g||(x.current={})}),[g]);var K=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),f({type:1,getItemNodeFromIndex:O,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),f({type:2,getItemNodeFromIndex:O,altKey:e.altKey})},Home:function(e){e.preventDefault(),f({type:5,getItemNodeFromIndex:O})},End:function(e){e.preventDefault(),f({type:6,getItemNodeFromIndex:O})},Escape:function(){C.current.state.isOpen&&f({type:4})},Enter:function(e){e.preventDefault(),f({type:C.current.state.isOpen?7:0})},PageUp:function(e){C.current.state.isOpen&&(e.preventDefault(),f({type:9,getItemNodeFromIndex:O}))},PageDown:function(e){C.current.state.isOpen&&(e.preventDefault(),f({type:10,getItemNodeFromIndex:O}))}," ":function(e){e.preventDefault();var t=C.current.state;t.isOpen?t.inputValue?f({type:3,key:" ",getItemNodeFromIndex:O}):f({type:8}):f({type:0})}}}),[f,O,C]),P=t.useCallback((function(){f({type:15})}),[f]),T=t.useCallback((function(){f({type:17})}),[f]),R=t.useCallback((function(){f({type:16})}),[f]),H=t.useCallback((function(e){f({type:18,highlightedIndex:e})}),[f]),F=t.useCallback((function(e){f({type:19,selectedItem:e})}),[f]),V=t.useCallback((function(){f({type:21})}),[f]),N=t.useCallback((function(e){f({type:20,inputValue:e})}),[f]),A=t.useCallback((function(e){return u({id:w.labelId,htmlFor:w.toggleButtonId},e)}),[w]),B=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onMouseLeave,s=i.refKey,l=void 0===s?"ref":s;i.onKeyDown,i.onBlur;var a=i.ref,d=r(i,qe),c=(void 0===t?{}:t).suppressRefError;return E("getMenuProps",void 0!==c&&c,l,y),u(((n={})[l]=J(a,(function(e){y.current=e})),n.id=w.menuId,n.role="listbox",n["aria-labelledby"]=w.labelId,n.tabIndex=-1,n.onMouseLeave=G(o,(function(){f({type:12})})),n),d)}),[f,E,w]);return{getToggleButtonProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onBlur,s=i.onClick,l=i.onKeyDown,a=i.refKey,d=void 0===a?"ref":a,c=i.ref,p=r(i,Xe),g=(void 0===t?{}:t).suppressRefError,h=void 0!==g&&g,m=C.current.state,I=u(((n={})[d]=J(c,(function(e){v.current=e})),n["aria-activedescendant"]=m.isOpen&&m.highlightedIndex>-1?w.getItemId(m.highlightedIndex):"",n["aria-controls"]=w.menuId,n["aria-expanded"]=C.current.state.isOpen,n["aria-haspopup"]="listbox",n["aria-labelledby"]=""+w.labelId,n.id=w.toggleButtonId,n.role="combobox",n.tabIndex=0,n.onBlur=G(o,(function(){m.isOpen&&!D.current.isMouseDown&&f({type:11})})),n),p);return p.disabled||(I.onClick=G(s,(function(){f({type:0})})),I.onKeyDown=G(l,(function(e){var t=re(e);t&&K[t]?K[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&f({type:3,key:t,getItemNodeFromIndex:O})}))),E("getToggleButtonProps",h,d,v),I}),[C,w,E,f,D,K,O]),getLabelProps:A,getMenuProps:B,getItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,o=n.item,s=n.index,l=n.onMouseMove,a=n.onClick,d=n.refKey,c=void 0===d?"ref":d,p=n.ref,g=n.disabled,h=r(n,Ye),I=C.current,v=I.state,y=I.props,b=null!=o?o:i[s],S=Oe(s,b,y.items),k=Oe(S,b,y.items);if(k<0)throw new Error("Pass either item or item index in getItemProps!");var O=u(((t={disabled:g,role:"option","aria-selected":""+(b===m),id:w.getItemId(k)})[c]=J(p,(function(e){e&&(x.current[w.getItemId(k)]=e)})),t),h);return g||(O.onClick=G(a,(function(){f({type:14,index:S})}))),O.onMouseMove=G(l,(function(){S!==v.highlightedIndex&&(M.current=!1,f({type:13,index:S,disabled:g}))})),O}),[C,i,m,w,M,f]),toggleMenu:P,openMenu:R,closeMenu:T,setHighlightedIndex:H,selectItem:F,reset:V,setInputValue:N,highlightedIndex:h,isOpen:g,selectedItem:m,inputValue:I}}Ge.stateChangeTypes=We;var Je=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})});var Qe=z,Ze=u({},Pe,{getA11yStatusMessage:Z});function et(e,t){var n,i=t.type,o=t.props,r=t.altKey;switch(i){case 13:n={isOpen:Te(o,"isOpen"),highlightedIndex:Te(o,"highlightedIndex"),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case 0:n=e.isOpen?{highlightedIndex:ue(1,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:r&&null==e.selectedItem?-1:Fe(o,e,1,t.getItemNodeFromIndex),isOpen:o.items.length>=0};break;case 1:n=e.isOpen?r?u({isOpen:Te(o,"isOpen"),highlightedIndex:Te(o,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])}):{highlightedIndex:ue(-1,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:Fe(o,e,-1,t.getItemNodeFromIndex),isOpen:o.items.length>=0};break;case 7:n=u({isOpen:Te(o,"isOpen"),highlightedIndex:Te(o,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case 2:n=u({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case 5:n={highlightedIndex:ue(-10,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1)};break;case 6:n={highlightedIndex:ue(10,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1)};break;case 3:n={highlightedIndex:se(1,0,o.items.length,t.getItemNodeFromIndex,!1)};break;case 4:n={highlightedIndex:se(-1,o.items.length-1,o.items.length,t.getItemNodeFromIndex,!1)};break;case 9:n=u({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case 8:n={isOpen:!0,highlightedIndex:Te(o,"highlightedIndex"),inputValue:t.inputValue};break;case 10:n={isOpen:!0,highlightedIndex:Fe(o,e,0)};break;case 19:n={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case 22:n={inputValue:t.inputValue};break;default:return _e(e,t,Je)}return u({},e,n)}var tt=["onMouseLeave","refKey","ref"],nt=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],it=["onClick","onPress","refKey","ref"],ot=["onKeyDown","onChange","onInput","onFocus","onBlur","onChangeText","refKey","ref"];function rt(e){void 0===e&&(e={}),Qe();var n=u({},Ze,e),i=n.initialIsOpen,o=n.defaultIsOpen,s=n.items,l=n.scrollIntoView,a=n.environment,d=n.getA11yStatusMessage,c=n.getA11ySelectionMessage,p=n.itemToString,f=function(e){var t=He(e),n=t.selectedItem,i=t.inputValue;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),u({},t,{inputValue:i})}(n),g=function(e,n,i){var o=t.useRef(),r=Ee(e,n,i),u=r[0],s=r[1];return t.useEffect((function(){oe(i,"selectedItem")&&(o.current!==i.selectedItem&&s({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=u.selectedItem===o.current?i.selectedItem:u.selectedItem)})),[ie(u,i),s]}(et,f,n),h=g[0],m=g[1],I=h.isOpen,v=h.highlightedIndex,y=h.selectedItem,x=h.inputValue,b=t.useRef(null),w=t.useRef({}),S=t.useRef(null),k=t.useRef(null),C=t.useRef(!0),O=Ce(n),M=t.useRef(),D=De({state:h,props:n}),E=t.useCallback((function(e){return w.current[O.getItemId(e)]}),[O]);Ae(d,[I,v,x,s],u({isInitialMount:C.current,previousResultCount:M.current,items:s,environment:a,itemToString:p},h)),Ae(c,[y],u({isInitialMount:C.current,previousResultCount:M.current,items:s,environment:a,itemToString:p},h));var K=Be({menuElement:b.current,highlightedIndex:v,isOpen:I,itemRefs:w,scrollIntoView:l,getItemNodeFromIndex:E});Le({isInitialMount:C.current,props:n,state:h}),t.useEffect((function(){(i||o||I)&&S.current&&S.current.focus()}),[]),t.useEffect((function(){C.current||(M.current=s.length)}));var P=Ve(I,[S,b,k],a,(function(){m({type:9,selectItem:!1})})),T=Ne();t.useEffect((function(){return C.current=!1,function(){C.current=!0}}),[]),t.useEffect((function(){if(I){if(document.activeElement!==S.current){var e;null==S||null==(e=S.current)||e.focus()}}else w.current={}}),[I]);var R=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),m({type:0,altKey:e.altKey,getItemNodeFromIndex:E})},ArrowUp:function(e){e.preventDefault(),m({type:1,altKey:e.altKey,getItemNodeFromIndex:E})},Home:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:3,getItemNodeFromIndex:E}))},End:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:4,getItemNodeFromIndex:E}))},Escape:function(e){var t=D.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),m({type:2}))},Enter:function(e){D.current.state.isOpen&&229!==e.which&&(e.preventDefault(),m({type:7,getItemNodeFromIndex:E}))},PageUp:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:5,getItemNodeFromIndex:E}))},PageDown:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:6,getItemNodeFromIndex:E}))}}}),[m,D,E]),H=t.useCallback((function(e){return u({id:O.labelId,htmlFor:O.inputId},e)}),[O]),F=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onMouseLeave,s=i.refKey,l=void 0===s?"ref":s,a=i.ref,d=r(i,tt),c=(void 0===t?{}:t).suppressRefError;return T("getMenuProps",void 0!==c&&c,l,b),u(((n={})[l]=J(a,(function(e){b.current=e})),n.id=O.menuId,n.role="listbox",n["aria-labelledby"]=O.labelId,n.onMouseLeave=G(o,(function(){m({type:11})})),n),d)}),[m,T,O]),V=t.useCallback((function(e){var t,n,i=void 0===e?{}:e,o=i.item,s=i.index,l=i.refKey,a=void 0===l?"ref":l,d=i.ref,c=i.onMouseMove,p=i.onMouseDown,f=i.onClick;i.onPress;var g=i.disabled,h=r(i,nt),I=D.current,v=I.props,y=I.state,x=Oe(s,o,v.items);if(x<0)throw new Error("Pass either item or item index in getItemProps!");var b=f;return u(((t={})[a]=J(d,(function(e){e&&(w.current[O.getItemId(x)]=e)})),t.disabled=g,t.role="option",t["aria-selected"]=""+(x===y.highlightedIndex),t.id=O.getItemId(x),t),!g&&((n={}).onClick=G(b,(function(){m({type:13,index:s})})),n),{onMouseMove:G(c,(function(){s!==y.highlightedIndex&&(K.current=!1,m({type:12,index:s,disabled:g}))})),onMouseDown:G(p,(function(e){return e.preventDefault()}))},h)}),[m,D,K,O]),N=t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.onClick;n.onPress;var o=n.refKey,s=void 0===o?"ref":o,l=n.ref,a=r(n,it),d=D.current.state;return u(((t={})[s]=J(l,(function(e){k.current=e})),t["aria-controls"]=O.menuId,t["aria-expanded"]=d.isOpen,t.id=O.toggleButtonId,t.tabIndex=-1,t),!a.disabled&&u({},{onClick:G(i,(function(){m({type:14})}))}),a)}),[m,D,O]),A=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onKeyDown,s=i.onChange,l=i.onInput,a=i.onFocus,d=i.onBlur;i.onChangeText;var c=i.refKey,p=void 0===c?"ref":c,f=i.ref,g=r(i,ot),h=(void 0===t?{}:t).suppressRefError;T("getInputProps",void 0!==h&&h,p,S);var I,v=D.current.state,y={};g.disabled||((I={}).onInput=G(s,l,(function(e){m({type:8,inputValue:e.target.value})})),I.onKeyDown=G(o,(function(e){var t=re(e);t&&R[t]&&R[t](e)})),I.onBlur=G(d,(function(){v.isOpen&&!P.current.isMouseDown&&m({type:9,selectItem:!0})})),I.onFocus=G(a,(function(){v.isOpen||m({type:10})})),y=I);return u(((n={})[p]=J(f,(function(e){S.current=e})),n["aria-activedescendant"]=v.isOpen&&v.highlightedIndex>-1?O.getItemId(v.highlightedIndex):"",n["aria-autocomplete"]="list",n["aria-controls"]=O.menuId,n["aria-expanded"]=v.isOpen,n["aria-labelledby"]=O.labelId,n.autoComplete="off",n.id=O.inputId,n.role="combobox",n.value=v.inputValue,n),y,g)}),[m,R,D,P,T,O]),B=t.useCallback((function(){m({type:15})}),[m]),L=t.useCallback((function(){m({type:17})}),[m]),_=t.useCallback((function(){m({type:16})}),[m]),j=t.useCallback((function(e){m({type:18,highlightedIndex:e})}),[m]),U=t.useCallback((function(e){m({type:19,selectedItem:e})}),[m]);return{getItemProps:V,getLabelProps:H,getMenuProps:F,getInputProps:A,getToggleButtonProps:N,toggleMenu:B,openMenu:_,closeMenu:L,setHighlightedIndex:j,setInputValue:t.useCallback((function(e){m({type:20,inputValue:e})}),[m]),selectItem:U,reset:t.useCallback((function(){m({type:21})}),[m]),highlightedIndex:v,isOpen:I,selectedItem:y,inputValue:x}}rt.stateChangeTypes=Je;var ut={activeIndex:-1,selectedItems:[]};function st(e,t){return Re(e,t,ut)}function lt(e,t){return Te(e,t,ut)}function at(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;var 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})});var dt={itemToString:Pe.itemToString,stateReducer:Pe.stateReducer,environment:Pe.environment,getA11yRemovalMessage:function(e){var t=e.removedSelectedItem;return(0,e.itemToString)(t)+" has been removed."},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"},ct=z,pt=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 ft(e,t){var n,i=t.type,o=t.index,r=t.props,s=t.selectedItem,l=e.activeIndex,a=e.selectedItems;switch(i){case 0:n={activeIndex:o};break;case 4:n={activeIndex:l-1<0?0:l-1};break;case 3:n={activeIndex:l+1>=a.length?-1:l+1};break;case 2:case 1:if(l<0)break;var d=l;1===a.length?d=-1:l===a.length-1&&(d=a.length-2),n=u({selectedItems:[].concat(a.slice(0,l),a.slice(l+1))},{activeIndex:d});break;case 5:n={activeIndex:a.length-1};break;case 6:n={selectedItems:a.slice(0,a.length-1)};break;case 8:n={selectedItems:[].concat(a,[s])};break;case 7:n={activeIndex:-1};break;case 9:var c=l,p=a.indexOf(s);if(p<0)break;1===a.length?c=-1:p===a.length-1&&(c=a.length-2),n={selectedItems:[].concat(a.slice(0,p),a.slice(p+1)),activeIndex:c};break;case 10:n={selectedItems:t.selectedItems};break;case 11:n={activeIndex:t.activeIndex};break;case 12:n={activeIndex:lt(r,"activeIndex"),selectedItems:lt(r,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return u({},e,n)}var gt=["refKey","ref","onClick","onKeyDown","selectedItem","index"],ht=["refKey","ref","onKeyDown","onClick","preventKeyAction"];function mt(e){void 0===e&&(e={}),ct();var n=u({},dt,e),i=n.getA11yRemovalMessage,o=n.itemToString,s=n.environment,l=n.keyNavigationNext,a=n.keyNavigationPrevious,d=Ke(ft,function(e){return{activeIndex:st(e,"activeIndex"),selectedItems:st(e,"selectedItems")}}(n),n),c=d[0],p=d[1],f=c.activeIndex,g=c.selectedItems,h=t.useRef(!0),m=t.useRef(null),I=t.useRef(g),v=t.useRef();v.current=[];var y=De({state:c,props:n});t.useEffect((function(){if(!h.current){if(g.length<I.current.length){var e=I.current.find((function(e){return g.indexOf(e)<0}));de(i({itemToString:o,resultCount:g.length,removedSelectedItem:e,activeIndex:f,activeSelectedItem:g[f]}),s.document)}I.current=g}}),[g.length]),t.useEffect((function(){h.current||(-1===f&&m.current?m.current.focus():v.current[f]&&v.current[f].focus())}),[f]),Le({isInitialMount:h.current,props:n,state:c});var x=Ne();t.useEffect((function(){return h.current=!1,function(){h.current=!0}}),[]);var b=t.useMemo((function(){var e;return(e={})[a]=function(){p({type:4})},e[l]=function(){p({type:3})},e.Delete=function(){p({type:1})},e.Backspace=function(){p({type:2})},e}),[p,l,a]),w=t.useMemo((function(){var e;return(e={})[a]=function(e){at(e)&&p({type:5})},e.Backspace=function(e){at(e)&&p({type:6})},e}),[p,a]);return{getSelectedItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.refKey,o=void 0===i?"ref":i,s=n.ref,l=n.onClick,a=n.onKeyDown,d=n.selectedItem,c=n.index,f=r(n,gt),g=y.current.state;if(Oe(c,d,g.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return u(((t={})[o]=J(s,(function(e){e&&v.current.push(e)})),t.tabIndex=c===g.activeIndex?0:-1,t.onClick=G(l,(function(){p({type:0,index:c})})),t.onKeyDown=G(a,(function(e){var t=re(e);t&&b[t]&&b[t](e)})),t),f)}),[p,y,b]),getDropdownProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.refKey,s=void 0===o?"ref":o,l=i.ref,a=i.onKeyDown,d=i.onClick,c=i.preventKeyAction,f=void 0!==c&&c,g=r(i,ht),h=(void 0===t?{}:t).suppressRefError;return x("getDropdownProps",void 0!==h&&h,s,m),u(((n={})[s]=J(l,(function(e){e&&(m.current=e)})),n),!f&&{onKeyDown:G(a,(function(e){var t=re(e);t&&w[t]&&w[t](e)})),onClick:G(d,(function(){p({type:7})}))},g)}),[p,w,x]),addSelectedItem:t.useCallback((function(e){p({type:8,selectedItem:e})}),[p]),removeSelectedItem:t.useCallback((function(e){p({type:9,selectedItem:e})}),[p]),setSelectedItems:t.useCallback((function(e){p({type:10,selectedItems:e})}),[p]),setActiveIndex:t.useCallback((function(e){p({type:11,activeIndex:e})}),[p]),reset:t.useCallback((function(){p({type:12})}),[p]),selectedItems:g,activeIndex:f}}mt.stateChangeTypes=pt,e.default=ye,e.resetIdCounter=function(){$=0},e.useCombobox=rt,e.useMultipleSelection=mt,e.useSelect=Ge,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc