From ad7fc957a91da23c46884b02f40f6cdf6c58541e Mon Sep 17 00:00:00 2001 From: Sam Tsai Date: Thu, 15 Jun 2017 12:00:55 -0400 Subject: [PATCH] [Issue 157] move `onConfirm` to be after state Let the state be set with updated value then trigger `onConfirm` --- dist/accessible-autocomplete.min.js | 2 +- dist/accessible-autocomplete.min.js.map | 2 +- dist/lib/accessible-autocomplete.preact.min.js | 2 +- dist/lib/accessible-autocomplete.preact.min.js.map | 2 +- dist/lib/accessible-autocomplete.react.min.js | 2 +- dist/lib/accessible-autocomplete.react.min.js.map | 2 +- src/autocomplete.js | 11 ++++++----- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dist/accessible-autocomplete.min.js b/dist/accessible-autocomplete.min.js index ccc5e548..81088a29 100644 --- a/dist/accessible-autocomplete.min.js +++ b/dist/accessible-autocomplete.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.accessibleAutocomplete=t():e.accessibleAutocomplete=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=1)}([function(e,t,n){!function(){"use strict";function t(){}function n(e,n){var o,r,l,i,u=T;for(i=arguments.length;i-- >2;)D.push(arguments[i]);for(n&&null!=n.children&&(D.length||D.push(n.children),delete n.children);D.length;)if((r=D.pop())&&void 0!==r.pop)for(i=r.length;i--;)D.push(r[i]);else!0!==r&&!1!==r||(r=null),(l="function"!=typeof e)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(l=!1)),l&&o?u[u.length-1]+=r:u===T?u=[r]:u.push(r),o=l;var s=new t;return s.nodeName=e,s.children=u,s.attributes=null==n?void 0:n,s.key=null==n?void 0:n.key,void 0!==A.vnode&&A.vnode(s),s}function o(e,t){for(var n in t)e[n]=t[n];return e}function r(e,t){return n(e.nodeName,o(o({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function l(e){!e.__d&&(e.__d=!0)&&1==V.push(e)&&(A.debounceRendering||setTimeout)(i)}function i(){var e,t=V;for(V=[];e=t.pop();)e.__d&&N(e)}function u(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&s(e,t.nodeName):n||e._componentConstructor===t.nodeName}function s(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function a(e){var t=o({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function p(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function c(e){e.parentNode&&e.parentNode.removeChild(e)}function d(e,t,n,o,r){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&o(e);else if("class"!==t||r)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var l in n)l in o||(e.style[l]="");for(var l in o)e.style[l]="number"==typeof o[l]&&!1===L.test(l)?o[l]+"px":o[l]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var i=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,h,i):e.removeEventListener(t,h,i),(e.__l||(e.__l={}))[t]=o}else if("list"!==t&&"type"!==t&&!r&&t in e)f(e,t,null==o?"":o),null!=o&&!1!==o||e.removeAttribute(t);else{var u=r&&t!==(t=t.replace(/^xlink\:?/,""));null==o||!1===o?u?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(u?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function f(e,t,n){try{e[t]=n}catch(e){}}function h(e){return this.__l[e.type](A.event&&A.event(e)||e)}function m(){for(var e;e=R.pop();)A.afterMount&&A.afterMount(e),e.componentDidMount&&e.componentDidMount()}function _(e,t,n,o,r,l){q++||(P=null!=r&&void 0!==r.ownerSVGElement,B=null!=e&&!("__preactattr_"in e));var i=v(e,t,n,o,l);return r&&i.parentNode!==r&&r.appendChild(i),--q||(B=!1,l||m()),i}function v(e,t,n,o,r){var l=e,i=P;if(null==t&&(t=""),"string"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(l=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(l,e),g(e,!0))),l.__preactattr_=!0,l;if("function"==typeof t.nodeName)return S(e,t,n,o);if(P="svg"===t.nodeName||"foreignObject"!==t.nodeName&&P,(!e||!s(e,String(t.nodeName)))&&(l=p(String(t.nodeName),P),e)){for(;e.firstChild;)l.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(l,e),g(e,!0)}var u=l.firstChild,a=l.__preactattr_||(l.__preactattr_={}),c=t.children;return!B&&c&&1===c.length&&"string"==typeof c[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=c[0]&&(u.nodeValue=c[0]):(c&&c.length||null!=u)&&y(l,c,n,o,B||null!=a.dangerouslySetInnerHTML),w(l,t.attributes,a),P=i,l}function y(e,t,n,o,r){var l,i,s,a,p=e.childNodes,d=[],f={},h=0,m=0,_=p.length,y=0,b=t?t.length:0;if(0!==_)for(var w=0;w<_;w++){var O=p[w],C=O.__preactattr_,E=b&&C?O._component?O._component.__k:C.key:null;null!=E?(h++,f[E]=O):(C||(void 0!==O.splitText?!r||O.nodeValue.trim():r))&&(d[y++]=O)}if(0!==b)for(var w=0;w=_?e.appendChild(a):a!==p[w]&&(a===p[w+1]?c(p[w]):e.insertBefore(a,p[w]||null)))}if(h)for(var w in f)void 0!==f[w]&&g(f[w],!1);for(;m<=y;)void 0!==(a=d[y--])&&g(a,!1)}function g(e,t){var n=e._component;n?I(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||c(e),b(e))}function b(e){for(e=e.lastChild;e;){var t=e.previousSibling;g(e,!0),e=t}}function w(e,t,n){var o;for(o in n)t&&null!=t[o]||null==n[o]||d(e,o,n[o],n[o]=void 0,P);for(o in t)"children"===o||"innerHTML"===o||o in n&&t[o]===("value"===o||"checked"===o?e[o]:n[o])||d(e,o,n[o],n[o]=t[o],P)}function O(e){var t=e.constructor.name;(U[t]||(U[t]=[])).push(e)}function C(e,t,n){var o,r=U[e.name];if(e.prototype&&e.prototype.render?(o=new e(t,n),k.call(o,t,n)):(o=new k(t,n),o.constructor=e,o.render=E),r)for(var l=r.length;l--;)if(r[l].constructor===e){o.__b=r[l].__b,r.splice(l,1);break}return o}function E(e,t,n){return this.constructor(e,n)}function x(e,t,n,o,r){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||r?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.__c||(e.__c=e.context),e.context=o),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==n&&(1!==n&&!1===A.syncComponentUpdates&&e.base?l(e):N(e,1,r)),e.__r&&e.__r(e))}function N(e,t,n,r){if(!e.__x){var l,i,u,s=e.props,p=e.state,c=e.context,d=e.__p||s,f=e.__s||p,h=e.__c||c,v=e.base,y=e.__b,b=v||y,w=e._component,O=!1;if(v&&(e.props=d,e.state=f,e.context=h,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(s,p,c)?O=!0:e.componentWillUpdate&&e.componentWillUpdate(s,p,c),e.props=s,e.state=p,e.context=c),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!O){l=e.render(s,p,c),e.getChildContext&&(c=o(o({},c),e.getChildContext()));var E,S,k=l&&l.nodeName;if("function"==typeof k){var M=a(l);i=w,i&&i.constructor===k&&M.key==i.__k?x(i,M,1,c,!1):(E=i,e._component=i=C(k,M,c),i.__b=i.__b||y,i.__u=e,x(i,M,0,c,!1),N(i,1,n,!0)),S=i.base}else u=b,E=w,E&&(u=e._component=null),(b||1===t)&&(u&&(u._component=null),S=_(u,l,c,n||!v,b&&b.parentNode,!0));if(b&&S!==b&&i!==w){var D=b.parentNode;D&&S!==D&&(D.replaceChild(S,b),E||(b._component=null,g(b,!1)))}if(E&&I(E),e.base=S,S&&!r){for(var T=e,L=e;L=L.__u;)(T=L).base=S;S._component=T,S._componentConstructor=T.constructor}}if(!v||n?R.unshift(e):O||(m(),e.componentDidUpdate&&e.componentDidUpdate(d,f,h),A.afterUpdate&&A.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);q||r||m()}}function S(e,t,n,o){for(var r=e&&e._component,l=r,i=e,u=r&&e._componentConstructor===t.nodeName,s=u,p=a(t);r&&!s&&(r=r.__u);)s=r.constructor===t.nodeName;return r&&s&&(!o||r._component)?(x(r,p,3,n,o),e=r.base):(l&&!u&&(I(l),e=i=null),r=C(t.nodeName,p,n),e&&!r.__b&&(r.__b=e,i=null),x(r,p,1,n,o),e=r.base,i&&e!==i&&(i._component=null,g(i,!1))),e}function I(e){A.beforeUnmount&&A.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?I(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,c(t),O(e),b(t)),e.__r&&e.__r(null)}function k(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}function M(e,t,n){return _(n,e,{},!1,t,!1)}var A={},D=[],T=[],L=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,V=[],R=[],q=0,P=!1,B=!1,U={};o(k.prototype,{setState:function(e,t){var n=this.state;this.__s||(this.__s=o({},n)),o(n,"function"==typeof e?e(n,this.props):e),t&&(this.__h=this.__h||[]).push(t),l(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),N(this,2)},render:function(){}});var j={h:n,createElement:n,cloneElement:r,Component:k,render:M,rerender:i,options:A};e.exports=j}()},function(e,t,n){e.exports=n(2)},function(e,t,n){"use strict";function o(e){if(!e.element)throw new Error("element is not defined");if(!e.id)throw new Error("id is not defined");if(!e.source)throw new Error("source is not defined");Array.isArray(e.source)&&(e.source=s(e.source)),(0,l.render)((0,l.createElement)(u.default,e),e.element)}var r=Object.assign||function(e){for(var t=1;t47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return y?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,d=Object.assign||function(e){for(var t=1;t=o;this.setState({query:u}),l||!s&&a&&p?r(u,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:i&&n?0:-1})}):!s&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.props.onConfirm(n),this.setState({focused:-1,menuOpen:!1,query:o,selected:-1})},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,l=n.selected,i=l!==r.length-1,u=i&&o;u&&this.handleOptionFocus(l+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),this.state.selected>=0&&this.handleOptionClick(e,this.state.selected))},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:s(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,l=t.minLength,i=t.name,u=t.placeholder,s=t.required,p=t.showAllValues,c=t.tNoResults,h=t.tStatusQueryTooShort,_=t.tStatusNoResults,v=t.tStatusSelectedOption,y=t.tStatusResults,g=t.dropdownArrow,b=this.state,O=b.focused,C=b.hovered,E=b.menuOpen,x=b.options,N=b.query,S=b.selected,I=this.hasAutoselect(),k=-1===O,M=0===x.length,A=0!==N.length,D=N.length>=l,T=this.props.showNoOptionsFound&&k&&M&&A&&D,L=n+"__wrapper",V=n+"__input",R=null!==O,q=R?" "+V+"--focused":"",P=this.props.showAllValues?" "+V+"--show-all-values":" "+V+"--default",B=n+"__dropdown-arrow-down",U=-1!==O&&null!==O,j=n+"__menu",F=j+"--"+o,W=E||T,K=j+"--"+(W?"visible":"hidden"),H=n+"__option",Q=n+"__hint",$=this.templateInputValue(x[S]),z=$&&0===$.toLowerCase().indexOf(N.toLowerCase()),G=z&&I?N+$.substr(N.length):"",J=w&&G,X=void 0;return p&&"string"==typeof(X=g({className:B}))&&(X=(0,f.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:X}})),(0,f.createElement)("div",{className:L,onKeyDown:this.handleKeyDown},(0,f.createElement)(m.default,{length:x.length,queryLength:N.length,minQueryLength:l,selectedOption:this.templateInputValue(x[S]),tQueryTooShort:h,tNoResults:_,tSelectedOption:v,tResults:y}),J&&(0,f.createElement)("span",null,(0,f.createElement)("input",{className:Q,readonly:!0,tabIndex:"-1",value:G})),(0,f.createElement)("input",d({"aria-activedescendant":!!U&&r+"__option--"+O,"aria-expanded":E,"aria-owns":r+"__listbox",autoComplete:"off",className:""+V+q+P,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:i,placeholder:u,ref:function(t){e.elementReferences[-1]=t},role:"combobox",type:"text",required:s,value:N})),X,(0,f.createElement)("ul",{className:j+" "+F+" "+K,id:r+"__listbox",role:"listbox"},x.map(function(t,n){var o=-1===O?S===n:O===n,l=o&&null===C?" "+H+"--focused":"",i=n%2?" "+H+"--odd":"";return(0,f.createElement)("li",{"aria-selected":O===n,className:""+H+l+i,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+"__option--"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:"option",tabIndex:"-1"})}),T&&(0,f.createElement)("li",{className:H+" "+H+"--no-results"},c())))},t}(f.Component),p.defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:v.default},c);t.default=O},function(e,t,n){"use strict";function o(e,t){}function r(e,t){if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){"function"!=typeof t&&null!==t||(e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t))}t.__esModule=!0,t.default=void 0;var i,u,s=n(0),a=(u=i=function(e){function t(){var n,l,i;o(this,t);for(var u=arguments.length,s=Array(u),a=0;a2;)B.push(arguments[i]);for(t&&null!=t.children&&(B.length||B.push(t.children),delete t.children);B.length;)if((r=B.pop())&&void 0!==r.pop)for(i=r.length;i--;)B.push(r[i]);else"boolean"==typeof r&&(r=null),(l="function"!=typeof e)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(l=!1)),l&&n?s[s.length-1]+=r:s===P?s=[r]:s.push(r),n=l;var u=new o;return u.nodeName=e,u.children=s,u.attributes=null==t?void 0:t,u.key=null==t?void 0:t.key,void 0!==T.vnode&&T.vnode(u),u}function l(e,t){for(var n in t)e[n]=t[n];return e}function i(e,t){return r(e.nodeName,l(l({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function s(e){!e._dirty&&(e._dirty=!0)&&1==R.push(e)&&(T.debounceRendering||L)(u)}function u(){var e,t=R;for(R=[];e=t.pop();)e._dirty&&S(e)}function a(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&p(e,t.nodeName):n||e._componentConstructor===t.nodeName}function p(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function c(e){var t=l({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var o in n)void 0===t[o]&&(t[o]=n[o]);return t}function d(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.normalizedNodeName=e,n}function f(e){var t=e.parentNode;t&&t.removeChild(e)}function h(e,t,n,o,r){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&o(e);else if("class"!==t||r)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var l in n)l in o||(e.style[l]="");for(var l in o)e.style[l]="number"==typeof o[l]&&!1===V.test(l)?o[l]+"px":o[l]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var i=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,v,i):e.removeEventListener(t,v,i),(e._listeners||(e._listeners={}))[t]=o}else if("list"!==t&&"type"!==t&&!r&&t in e)m(e,t,null==o?"":o),null!=o&&!1!==o||e.removeAttribute(t);else{var s=r&&t!==(t=t.replace(/^xlink\:?/,""));null==o||!1===o?s?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(s?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function m(e,t,n){try{e[t]=n}catch(e){}}function v(e){return this._listeners[e.type](T.event&&T.event(e)||e)}function _(){for(var e;e=q.pop();)T.afterMount&&T.afterMount(e),e.componentDidMount&&e.componentDidMount()}function y(e,t,n,o,r,l){j++||(U=null!=r&&void 0!==r.ownerSVGElement,F=null!=e&&!("__preactattr_"in e));var i=b(e,t,n,o,l);return r&&i.parentNode!==r&&r.appendChild(i),--j||(F=!1,l||_()),i}function b(e,t,n,o,r){var l=e,i=U;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(l=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(l,e),w(e,!0))),l.__preactattr_=!0,l;var s=t.nodeName;if("function"==typeof s)return I(e,t,n,o);if(U="svg"===s||"foreignObject"!==s&&U,s=String(s),(!e||!p(e,s))&&(l=d(s,U),e)){for(;e.firstChild;)l.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(l,e),w(e,!0)}var u=l.firstChild,a=l.__preactattr_,c=t.children;if(null==a){a=l.__preactattr_={};for(var f=l.attributes,h=f.length;h--;)a[f[h].name]=f[h].value}return!F&&c&&1===c.length&&"string"==typeof c[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=c[0]&&(u.nodeValue=c[0]):(c&&c.length||null!=u)&&g(l,c,n,o,F||null!=a.dangerouslySetInnerHTML),C(l,t.attributes,a),U=i,l}function g(e,t,n,o,r){var l,i,s,u,p,c=e.childNodes,d=[],h={},m=0,v=0,_=c.length,y=0,g=t?t.length:0;if(0!==_)for(var O=0;O<_;O++){var C=c[O],x=C.__preactattr_,E=g&&x?C._component?C._component.__key:x.key:null;null!=E?(m++,h[E]=C):(x||(void 0!==C.splitText?!r||C.nodeValue.trim():r))&&(d[y++]=C)}if(0!==g)for(var O=0;O47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return y?{onInput:e}:b?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,d=Object.assign||function(e){for(var t=1;t=o;this.setState({query:s}),l||!u&&a&&p?r(s,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:i&&n?0:-1})}):!u&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.setState({focused:-1,menuOpen:!1,query:o,selected:-1},this.props.onConfirm(n))},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,l=n.selected,i=l!==r.length-1,s=i&&o;s&&this.handleOptionFocus(l+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),this.state.selected>=0&&this.handleOptionClick(e,this.state.selected))},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(g[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:u(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,l=t.minLength,i=t.name,s=t.placeholder,u=t.required,p=t.showAllValues,c=t.tNoResults,h=t.tStatusQueryTooShort,v=t.tStatusNoResults,_=t.tStatusSelectedOption,y=t.tStatusResults,b=t.dropdownArrow,g=this.state,O=g.focused,C=g.hovered,x=g.menuOpen,E=g.options,N=g.query,k=g.selected,S=this.hasAutoselect(),I=-1===O,M=0===E.length,A=0!==N.length,D=N.length>=l,T=this.props.showNoOptionsFound&&I&&M&&A&&D,B=n+"__wrapper",P=n+"__input",L=null!==O,V=L?" "+P+"--focused":"",R=this.props.showAllValues?" "+P+"--show-all-values":" "+P+"--default",q=n+"__dropdown-arrow-down",j=-1!==O&&null!==O,U=n+"__menu",F=U+"--"+o,W=x||T,K=U+"--"+(W?"visible":"hidden"),H=n+"__option",Q=n+"__hint",$=this.templateInputValue(E[k]),z=$&&0===$.toLowerCase().indexOf(N.toLowerCase()),G=z&&S?N+$.substr(N.length):"",J=w&&G,X=void 0;return p&&"string"==typeof(X=b({className:q}))&&(X=(0,f.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:X}})),(0,f.createElement)("div",{className:B,onKeyDown:this.handleKeyDown},(0,f.createElement)(m.default,{length:E.length,queryLength:N.length,minQueryLength:l,selectedOption:this.templateInputValue(E[k]),tQueryTooShort:h,tNoResults:v,tSelectedOption:_,tResults:y}),J&&(0,f.createElement)("span",null,(0,f.createElement)("input",{className:Q,readonly:!0,tabIndex:"-1",value:G})),(0,f.createElement)("input",d({"aria-activedescendant":!!j&&r+"__option--"+O,"aria-expanded":x,"aria-owns":r+"__listbox",autoComplete:"off",className:""+P+V+R,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:i,placeholder:s,ref:function(t){e.elementReferences[-1]=t},role:"combobox",type:"text",required:u,value:N})),X,(0,f.createElement)("ul",{className:U+" "+F+" "+K,id:r+"__listbox",role:"listbox"},E.map(function(t,n){var o=-1===O?k===n:O===n,l=o&&null===C?" "+H+"--focused":"",i=n%2?" "+H+"--odd":"";return(0,f.createElement)("li",{"aria-selected":O===n,className:""+H+l+i,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+"__option--"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:"option",tabIndex:"-1"})}),T&&(0,f.createElement)("li",{className:H+" "+H+"--no-results"},c())))},t}(f.Component),p.defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:_.default},c);t.default=O},function(e,t,n){"use strict";function o(e,t){}function r(e,t){if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){"function"!=typeof t&&null!==t||(e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t))}t.__esModule=!0,t.default=void 0;var i,s,u=n(0),a=(s=i=function(e){function t(){var n,l,i;o(this,t);for(var s=arguments.length,u=Array(s),a=0;a2;)A.push(arguments[i]);for(n&&null!=n.children&&(A.length||A.push(n.children),delete n.children);A.length;)if((r=A.pop())&&void 0!==r.pop)for(i=r.length;i--;)A.push(r[i]);else!0!==r&&!1!==r||(r=null),(l=\"function\"!=typeof e)&&(null==r?r=\"\":\"number\"==typeof r?r=String(r):\"string\"!=typeof r&&(l=!1)),l&&o?u[u.length-1]+=r:u===D?u=[r]:u.push(r),o=l;var s=new t;return s.nodeName=e,s.children=u,s.attributes=null==n?void 0:n,s.key=null==n?void 0:n.key,void 0!==T.vnode&&T.vnode(s),s}function o(e,t){for(var n in t)e[n]=t[n];return e}function r(e,t){return n(e.nodeName,o(o({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function l(e){!e.__d&&(e.__d=!0)&&1==R.push(e)&&(T.debounceRendering||setTimeout)(i)}function i(){var e,t=R;for(R=[];e=t.pop();)e.__d&&N(e)}function u(e,t,n){return\"string\"==typeof t||\"number\"==typeof t?void 0!==e.splitText:\"string\"==typeof t.nodeName?!e._componentConstructor&&s(e,t.nodeName):n||e._componentConstructor===t.nodeName}function s(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function a(e){var t=o({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function p(e,t){var n=t?document.createElementNS(\"http://www.w3.org/2000/svg\",e):document.createElement(e);return n.__n=e,n}function c(e){e.parentNode&&e.parentNode.removeChild(e)}function d(e,t,n,o,r){if(\"className\"===t&&(t=\"class\"),\"key\"===t);else if(\"ref\"===t)n&&n(null),o&&o(e);else if(\"class\"!==t||r)if(\"style\"===t){if(o&&\"string\"!=typeof o&&\"string\"!=typeof n||(e.style.cssText=o||\"\"),o&&\"object\"==typeof o){if(\"string\"!=typeof n)for(var l in n)l in o||(e.style[l]=\"\");for(var l in o)e.style[l]=\"number\"==typeof o[l]&&!1===L.test(l)?o[l]+\"px\":o[l]}}else if(\"dangerouslySetInnerHTML\"===t)o&&(e.innerHTML=o.__html||\"\");else if(\"o\"==t[0]&&\"n\"==t[1]){var i=t!==(t=t.replace(/Capture$/,\"\"));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,h,i):e.removeEventListener(t,h,i),(e.__l||(e.__l={}))[t]=o}else if(\"list\"!==t&&\"type\"!==t&&!r&&t in e)f(e,t,null==o?\"\":o),null!=o&&!1!==o||e.removeAttribute(t);else{var u=r&&t!==(t=t.replace(/^xlink\\:?/,\"\"));null==o||!1===o?u?e.removeAttributeNS(\"http://www.w3.org/1999/xlink\",t.toLowerCase()):e.removeAttribute(t):\"function\"!=typeof o&&(u?e.setAttributeNS(\"http://www.w3.org/1999/xlink\",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||\"\"}function f(e,t,n){try{e[t]=n}catch(e){}}function h(e){return this.__l[e.type](T.event&&T.event(e)||e)}function m(){for(var e;e=V.pop();)T.afterMount&&T.afterMount(e),e.componentDidMount&&e.componentDidMount()}function _(e,t,n,o,r,l){q++||(P=null!=r&&void 0!==r.ownerSVGElement,B=null!=e&&!(\"__preactattr_\"in e));var i=v(e,t,n,o,l);return r&&i.parentNode!==r&&r.appendChild(i),--q||(B=!1,l||m()),i}function v(e,t,n,o,r){var l=e,i=P;if(null==t&&(t=\"\"),\"string\"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(l=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(l,e),b(e,!0))),l.__preactattr_=!0,l;if(\"function\"==typeof t.nodeName)return S(e,t,n,o);if(P=\"svg\"===t.nodeName||\"foreignObject\"!==t.nodeName&&P,(!e||!s(e,String(t.nodeName)))&&(l=p(String(t.nodeName),P),e)){for(;e.firstChild;)l.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(l,e),b(e,!0)}var u=l.firstChild,a=l.__preactattr_||(l.__preactattr_={}),c=t.children;return!B&&c&&1===c.length&&\"string\"==typeof c[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=c[0]&&(u.nodeValue=c[0]):(c&&c.length||null!=u)&&y(l,c,n,o,B||null!=a.dangerouslySetInnerHTML),w(l,t.attributes,a),P=i,l}function y(e,t,n,o,r){var l,i,s,a,p=e.childNodes,d=[],f={},h=0,m=0,_=p.length,y=0,g=t?t.length:0;if(0!==_)for(var w=0;w<_;w++){var O=p[w],C=O.__preactattr_,E=g&&C?O._component?O._component.__k:C.key:null;null!=E?(h++,f[E]=O):(C||(void 0!==O.splitText?!r||O.nodeValue.trim():r))&&(d[y++]=O)}if(0!==g)for(var w=0;w=_?e.appendChild(a):a!==p[w]&&(a===p[w+1]?c(p[w]):e.insertBefore(a,p[w]||null)))}if(h)for(var w in f)void 0!==f[w]&&b(f[w],!1);for(;m<=y;)void 0!==(a=d[y--])&&b(a,!1)}function b(e,t){var n=e._component;n?I(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||c(e),g(e))}function g(e){for(e=e.lastChild;e;){var t=e.previousSibling;b(e,!0),e=t}}function w(e,t,n){var o;for(o in n)t&&null!=t[o]||null==n[o]||d(e,o,n[o],n[o]=void 0,P);for(o in t)\"children\"===o||\"innerHTML\"===o||o in n&&t[o]===(\"value\"===o||\"checked\"===o?e[o]:n[o])||d(e,o,n[o],n[o]=t[o],P)}function O(e){var t=e.constructor.name;(U[t]||(U[t]=[])).push(e)}function C(e,t,n){var o,r=U[e.name];if(e.prototype&&e.prototype.render?(o=new e(t,n),k.call(o,t,n)):(o=new k(t,n),o.constructor=e,o.render=E),r)for(var l=r.length;l--;)if(r[l].constructor===e){o.__b=r[l].__b,r.splice(l,1);break}return o}function E(e,t,n){return this.constructor(e,n)}function x(e,t,n,o,r){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||r?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.__c||(e.__c=e.context),e.context=o),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==n&&(1!==n&&!1===T.syncComponentUpdates&&e.base?l(e):N(e,1,r)),e.__r&&e.__r(e))}function N(e,t,n,r){if(!e.__x){var l,i,u,s=e.props,p=e.state,c=e.context,d=e.__p||s,f=e.__s||p,h=e.__c||c,v=e.base,y=e.__b,g=v||y,w=e._component,O=!1;if(v&&(e.props=d,e.state=f,e.context=h,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(s,p,c)?O=!0:e.componentWillUpdate&&e.componentWillUpdate(s,p,c),e.props=s,e.state=p,e.context=c),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!O){l=e.render(s,p,c),e.getChildContext&&(c=o(o({},c),e.getChildContext()));var E,S,k=l&&l.nodeName;if(\"function\"==typeof k){var M=a(l);i=w,i&&i.constructor===k&&M.key==i.__k?x(i,M,1,c,!1):(E=i,e._component=i=C(k,M,c),i.__b=i.__b||y,i.__u=e,x(i,M,0,c,!1),N(i,1,n,!0)),S=i.base}else u=g,E=w,E&&(u=e._component=null),(g||1===t)&&(u&&(u._component=null),S=_(u,l,c,n||!v,g&&g.parentNode,!0));if(g&&S!==g&&i!==w){var A=g.parentNode;A&&S!==A&&(A.replaceChild(S,g),E||(g._component=null,b(g,!1)))}if(E&&I(E),e.base=S,S&&!r){for(var D=e,L=e;L=L.__u;)(D=L).base=S;S._component=D,S._componentConstructor=D.constructor}}if(!v||n?V.unshift(e):O||(m(),e.componentDidUpdate&&e.componentDidUpdate(d,f,h),T.afterUpdate&&T.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);q||r||m()}}function S(e,t,n,o){for(var r=e&&e._component,l=r,i=e,u=r&&e._componentConstructor===t.nodeName,s=u,p=a(t);r&&!s&&(r=r.__u);)s=r.constructor===t.nodeName;return r&&s&&(!o||r._component)?(x(r,p,3,n,o),e=r.base):(l&&!u&&(I(l),e=i=null),r=C(t.nodeName,p,n),e&&!r.__b&&(r.__b=e,i=null),x(r,p,1,n,o),e=r.base,i&&e!==i&&(i._component=null,b(i,!1))),e}function I(e){T.beforeUnmount&&T.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?I(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,c(t),O(e),g(t)),e.__r&&e.__r(null)}function k(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}function M(e,t,n){return _(n,e,{},!1,t,!1)}var T={},A=[],D=[],L=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,R=[],V=[],q=0,P=!1,B=!1,U={};o(k.prototype,{setState:function(e,t){var n=this.state;this.__s||(this.__s=o({},n)),o(n,\"function\"==typeof e?e(n,this.props):e),t&&(this.__h=this.__h||[]).push(t),l(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),N(this,2)},render:function(){}});var j={h:n,createElement:n,cloneElement:r,Component:k,render:M,rerender:i,options:T};e.exports=j}()},function(e,t,n){e.exports=n(2)},function(e,t,n){\"use strict\";function o(e){if(!e.element)throw new Error(\"element is not defined\");if(!e.id)throw new Error(\"id is not defined\");if(!e.source)throw new Error(\"source is not defined\");Array.isArray(e.source)&&(e.source=s(e.source)),(0,l.render)((0,l.createElement)(u.default,e),e.element)}var r=Object.assign||function(e){for(var t=1;t47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return y?{onInput:e}:b?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,d=Object.assign||function(e){for(var t=1;t=o;this.setState({query:u}),l||!s&&a&&p?r(u,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:i&&n?0:-1})}):!s&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.props.onConfirm(n),this.setState({focused:-1,menuOpen:!1,query:o,selected:-1})},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,l=n.selected,i=l!==r.length-1,u=i&&o;u&&this.handleOptionFocus(l+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){if(this.state.menuOpen){e.preventDefault();this.state.selected>=0&&this.handleOptionClick(e,this.state.selected)}},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(g[e.keyCode]){case\"up\":this.handleUpArrow(e);break;case\"down\":this.handleDownArrow(e);break;case\"space\":this.handleSpace(e);break;case\"enter\":this.handleEnter(e);break;case\"escape\":this.handleComponentBlur({query:this.state.query});break;default:s(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,l=t.minLength,i=t.name,u=t.placeholder,s=t.required,p=t.showAllValues,c=t.tNoResults,h=t.tStatusQueryTooShort,_=t.tStatusNoResults,v=t.tStatusSelectedOption,y=t.tStatusResults,b=t.dropdownArrow,g=this.state,O=g.focused,C=g.hovered,E=g.menuOpen,x=g.options,N=g.query,S=g.selected,I=this.hasAutoselect(),k=-1===O,M=0===x.length,T=0!==N.length,A=N.length>=l,D=this.props.showNoOptionsFound&&k&&M&&T&&A,L=n+\"__wrapper\",R=n+\"__input\",V=null!==O,q=V?\" \"+R+\"--focused\":\"\",P=this.props.showAllValues?\" \"+R+\"--show-all-values\":\" \"+R+\"--default\",B=n+\"__dropdown-arrow-down\",U=-1!==O&&null!==O,j=n+\"__menu\",F=j+\"--\"+o,W=E||D,K=j+\"--\"+(W?\"visible\":\"hidden\"),H=n+\"__option\",Q=n+\"__hint\",$=this.templateInputValue(x[S]),z=$&&0===$.toLowerCase().indexOf(N.toLowerCase()),G=z&&I?N+$.substr(N.length):\"\",J=w&&G,X=void 0;return p&&\"string\"==typeof(X=b({className:B}))&&(X=(0,f.createElement)(\"div\",{className:n+\"__dropdown-arrow-down-wrapper\",dangerouslySetInnerHTML:{__html:X}})),(0,f.createElement)(\"div\",{className:L,onKeyDown:this.handleKeyDown},(0,f.createElement)(m.default,{length:x.length,queryLength:N.length,minQueryLength:l,selectedOption:this.templateInputValue(x[S]),tQueryTooShort:h,tNoResults:_,tSelectedOption:v,tResults:y}),J&&(0,f.createElement)(\"span\",null,(0,f.createElement)(\"input\",{className:Q,readonly:!0,tabIndex:\"-1\",value:G})),(0,f.createElement)(\"input\",d({\"aria-activedescendant\":!!U&&r+\"__option--\"+O,\"aria-expanded\":E,\"aria-owns\":r+\"__listbox\",autoComplete:\"off\",className:\"\"+R+q+P,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:i,placeholder:u,ref:function(t){e.elementReferences[-1]=t},role:\"combobox\",type:\"text\",required:s,value:N})),X,(0,f.createElement)(\"ul\",{className:j+\" \"+F+\" \"+K,id:r+\"__listbox\",role:\"listbox\"},x.map(function(t,n){var o=-1===O?S===n:O===n,l=o&&null===C?\" \"+H+\"--focused\":\"\",i=n%2?\" \"+H+\"--odd\":\"\";return(0,f.createElement)(\"li\",{\"aria-selected\":O===n,className:\"\"+H+l+i,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+\"__option--\"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:\"option\",tabIndex:\"-1\"})}),D&&(0,f.createElement)(\"li\",{className:H+\" \"+H+\"--no-results\"},c())))},t}(f.Component),p.defaultProps={autoselect:!1,cssNamespace:\"autocomplete\",defaultValue:\"\",displayMenu:\"inline\",minLength:0,name:\"input-autocomplete\",placeholder:\"\",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return\"No results found\"},dropdownArrow:v.default},c);t.default=O},function(e,t,n){\"use strict\";function o(e,t){if(!(e instanceof t))return;(\"Cannot call a class as a function\")}function r(e,t){if(!e)return;(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}function l(e,t){if(\"function\"!=typeof t&&null!==t)return;(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0,t.default=void 0;var i,u,s=n(0),a=(u=i=function(e){function t(){var n,l,i;o(this,t);for(var u=arguments.length,s=Array(u),a=0;a2;)B.push(arguments[i]);for(t&&null!=t.children&&(B.length||B.push(t.children),delete t.children);B.length;)if((r=B.pop())&&void 0!==r.pop)for(i=r.length;i--;)B.push(r[i]);else\"boolean\"==typeof r&&(r=null),(l=\"function\"!=typeof e)&&(null==r?r=\"\":\"number\"==typeof r?r=String(r):\"string\"!=typeof r&&(l=!1)),l&&n?s[s.length-1]+=r:s===P?s=[r]:s.push(r),n=l;var a=new o;return a.nodeName=e,a.children=s,a.attributes=null==t?void 0:t,a.key=null==t?void 0:t.key,void 0!==D.vnode&&D.vnode(a),a}function l(e,t){for(var n in t)e[n]=t[n];return e}function i(e,t){return r(e.nodeName,l(l({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function s(e){!e._dirty&&(e._dirty=!0)&&1==V.push(e)&&(D.debounceRendering||L)(a)}function a(){var e,t=V;for(V=[];e=t.pop();)e._dirty&&S(e)}function u(e,t,n){return\"string\"==typeof t||\"number\"==typeof t?void 0!==e.splitText:\"string\"==typeof t.nodeName?!e._componentConstructor&&p(e,t.nodeName):n||e._componentConstructor===t.nodeName}function p(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function c(e){var t=l({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var o in n)void 0===t[o]&&(t[o]=n[o]);return t}function d(e,t){var n=t?document.createElementNS(\"http://www.w3.org/2000/svg\",e):document.createElement(e);return n.normalizedNodeName=e,n}function f(e){var t=e.parentNode;t&&t.removeChild(e)}function h(e,t,n,o,r){if(\"className\"===t&&(t=\"class\"),\"key\"===t);else if(\"ref\"===t)n&&n(null),o&&o(e);else if(\"class\"!==t||r)if(\"style\"===t){if(o&&\"string\"!=typeof o&&\"string\"!=typeof n||(e.style.cssText=o||\"\"),o&&\"object\"==typeof o){if(\"string\"!=typeof n)for(var l in n)l in o||(e.style[l]=\"\");for(var l in o)e.style[l]=\"number\"==typeof o[l]&&!1===R.test(l)?o[l]+\"px\":o[l]}}else if(\"dangerouslySetInnerHTML\"===t)o&&(e.innerHTML=o.__html||\"\");else if(\"o\"==t[0]&&\"n\"==t[1]){var i=t!==(t=t.replace(/Capture$/,\"\"));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,v,i):e.removeEventListener(t,v,i),(e._listeners||(e._listeners={}))[t]=o}else if(\"list\"!==t&&\"type\"!==t&&!r&&t in e)m(e,t,null==o?\"\":o),null!=o&&!1!==o||e.removeAttribute(t);else{var s=r&&t!==(t=t.replace(/^xlink\\:?/,\"\"));null==o||!1===o?s?e.removeAttributeNS(\"http://www.w3.org/1999/xlink\",t.toLowerCase()):e.removeAttribute(t):\"function\"!=typeof o&&(s?e.setAttributeNS(\"http://www.w3.org/1999/xlink\",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||\"\"}function m(e,t,n){try{e[t]=n}catch(e){}}function v(e){return this._listeners[e.type](D.event&&D.event(e)||e)}function _(){for(var e;e=q.pop();)D.afterMount&&D.afterMount(e),e.componentDidMount&&e.componentDidMount()}function y(e,t,n,o,r,l){j++||(U=null!=r&&void 0!==r.ownerSVGElement,F=null!=e&&!(\"__preactattr_\"in e));var i=b(e,t,n,o,l);return r&&i.parentNode!==r&&r.appendChild(i),--j||(F=!1,l||_()),i}function b(e,t,n,o,r){var l=e,i=U;if(null!=t&&\"boolean\"!=typeof t||(t=\"\"),\"string\"==typeof t||\"number\"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(l=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(l,e),w(e,!0))),l.__preactattr_=!0,l;var s=t.nodeName;if(\"function\"==typeof s)return I(e,t,n,o);if(U=\"svg\"===s||\"foreignObject\"!==s&&U,s=String(s),(!e||!p(e,s))&&(l=d(s,U),e)){for(;e.firstChild;)l.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(l,e),w(e,!0)}var a=l.firstChild,u=l.__preactattr_,c=t.children;if(null==u){u=l.__preactattr_={};for(var f=l.attributes,h=f.length;h--;)u[f[h].name]=f[h].value}return!F&&c&&1===c.length&&\"string\"==typeof c[0]&&null!=a&&void 0!==a.splitText&&null==a.nextSibling?a.nodeValue!=c[0]&&(a.nodeValue=c[0]):(c&&c.length||null!=a)&&g(l,c,n,o,F||null!=u.dangerouslySetInnerHTML),O(l,t.attributes,u),U=i,l}function g(e,t,n,o,r){var l,i,s,a,p,c=e.childNodes,d=[],h={},m=0,v=0,_=c.length,y=0,g=t?t.length:0;if(0!==_)for(var C=0;C<_;C++){var O=c[C],x=O.__preactattr_,E=g&&x?O._component?O._component.__key:x.key:null;null!=E?(m++,h[E]=O):(x||(void 0!==O.splitText?!r||O.nodeValue.trim():r))&&(d[y++]=O)}if(0!==g)for(var C=0;C47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function u(e){return y?{onInput:e}:b?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,d=Object.assign||function(e){for(var t=1;t=o;this.setState({query:s}),l||!a&&u&&p?r(s,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:i&&n?0:-1})}):!a&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.setState({focused:-1,menuOpen:!1,query:o,selected:-1},this.props.onConfirm(n))},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,l=n.selected,i=l!==r.length-1,s=i&&o;s&&this.handleOptionFocus(l+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){if(this.state.menuOpen){e.preventDefault();this.state.selected>=0&&this.handleOptionClick(e,this.state.selected)}},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(g[e.keyCode]){case\"up\":this.handleUpArrow(e);break;case\"down\":this.handleDownArrow(e);break;case\"space\":this.handleSpace(e);break;case\"enter\":this.handleEnter(e);break;case\"escape\":this.handleComponentBlur({query:this.state.query});break;default:a(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,l=t.minLength,i=t.name,s=t.placeholder,a=t.required,p=t.showAllValues,c=t.tNoResults,h=t.tStatusQueryTooShort,v=t.tStatusNoResults,_=t.tStatusSelectedOption,y=t.tStatusResults,b=t.dropdownArrow,g=this.state,C=g.focused,O=g.hovered,x=g.menuOpen,E=g.options,N=g.query,k=g.selected,S=this.hasAutoselect(),I=-1===C,M=0===E.length,T=0!==N.length,A=N.length>=l,D=this.props.showNoOptionsFound&&I&&M&&T&&A,B=n+\"__wrapper\",P=n+\"__input\",L=null!==C,R=L?\" \"+P+\"--focused\":\"\",V=this.props.showAllValues?\" \"+P+\"--show-all-values\":\" \"+P+\"--default\",q=n+\"__dropdown-arrow-down\",j=-1!==C&&null!==C,U=n+\"__menu\",F=U+\"--\"+o,W=x||D,K=U+\"--\"+(W?\"visible\":\"hidden\"),H=n+\"__option\",Q=n+\"__hint\",$=this.templateInputValue(E[k]),z=$&&0===$.toLowerCase().indexOf(N.toLowerCase()),G=z&&S?N+$.substr(N.length):\"\",J=w&&G,X=void 0;return p&&\"string\"==typeof(X=b({className:q}))&&(X=(0,f.createElement)(\"div\",{className:n+\"__dropdown-arrow-down-wrapper\",dangerouslySetInnerHTML:{__html:X}})),(0,f.createElement)(\"div\",{className:B,onKeyDown:this.handleKeyDown},(0,f.createElement)(m.default,{length:E.length,queryLength:N.length,minQueryLength:l,selectedOption:this.templateInputValue(E[k]),tQueryTooShort:h,tNoResults:v,tSelectedOption:_,tResults:y}),J&&(0,f.createElement)(\"span\",null,(0,f.createElement)(\"input\",{className:Q,readonly:!0,tabIndex:\"-1\",value:G})),(0,f.createElement)(\"input\",d({\"aria-activedescendant\":!!j&&r+\"__option--\"+C,\"aria-expanded\":x,\"aria-owns\":r+\"__listbox\",autoComplete:\"off\",className:\"\"+P+R+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},u(this.handleInputChange),{onFocus:this.handleInputFocus,name:i,placeholder:s,ref:function(t){e.elementReferences[-1]=t},role:\"combobox\",type:\"text\",required:a,value:N})),X,(0,f.createElement)(\"ul\",{className:U+\" \"+F+\" \"+K,id:r+\"__listbox\",role:\"listbox\"},E.map(function(t,n){var o=-1===C?k===n:C===n,l=o&&null===O?\" \"+H+\"--focused\":\"\",i=n%2?\" \"+H+\"--odd\":\"\";return(0,f.createElement)(\"li\",{\"aria-selected\":C===n,className:\"\"+H+l+i,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+\"__option--\"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:\"option\",tabIndex:\"-1\"})}),D&&(0,f.createElement)(\"li\",{className:H+\" \"+H+\"--no-results\"},c())))},t}(f.Component),p.defaultProps={autoselect:!1,cssNamespace:\"autocomplete\",defaultValue:\"\",displayMenu:\"inline\",minLength:0,name:\"input-autocomplete\",placeholder:\"\",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return\"No results found\"},dropdownArrow:_.default},c);t.default=C},function(e,t,n){\"use strict\";function o(e,t){if(!(e instanceof t))return;(\"Cannot call a class as a function\")}function r(e,t){if(!e)return;(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}function l(e,t){if(\"function\"!=typeof t&&null!==t)return;(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0,t.default=void 0;var i,s,a=n(0),u=(s=i=function(e){function t(){var n,l,i;o(this,t);for(var s=arguments.length,a=Array(s),u=0;u47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return v?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,h=Object.assign||function(e){for(var t=1;t=o;this.setState({query:s}),u||!i&&a&&p?r(s,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:l&&n?0:-1})}):!i&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.props.onConfirm(n),this.setState({focused:-1,menuOpen:!1,query:o,selected:-1})},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,u=n.selected,l=u!==r.length-1,s=l&&o;s&&this.handleOptionFocus(u+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),this.state.selected>=0&&this.handleOptionClick(e,this.state.selected))},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:i(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,u=t.minLength,l=t.name,s=t.placeholder,i=t.required,p=t.showAllValues,c=t.tNoResults,f=t.tStatusQueryTooShort,y=t.tStatusNoResults,O=t.tStatusSelectedOption,v=t.tStatusResults,g=t.dropdownArrow,b=this.state,_=b.focused,C=b.hovered,I=b.menuOpen,E=b.options,S=b.query,x=b.selected,D=this.hasAutoselect(),A=-1===_,M=0===E.length,q=0!==S.length,N=S.length>=u,R=this.props.showNoOptionsFound&&A&&M&&q&&N,k=n+"__wrapper",B=n+"__input",P=null!==_,T=P?" "+B+"--focused":"",V=this.props.showAllValues?" "+B+"--show-all-values":" "+B+"--default",j=n+"__dropdown-arrow-down",F=-1!==_&&null!==_,L=n+"__menu",K=L+"--"+o,Q=I||R,U=L+"--"+(Q?"visible":"hidden"),W=n+"__option",H=n+"__hint",$=this.templateInputValue(E[x]),z=$&&0===$.toLowerCase().indexOf(S.toLowerCase()),G=z&&D?S+$.substr(S.length):"",J=w&&G,X=void 0;return p&&"string"==typeof(X=g({className:j}))&&(X=(0,d.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:X}})),(0,d.createElement)("div",{className:k,onKeyDown:this.handleKeyDown},(0,d.createElement)(m.default,{length:E.length,queryLength:S.length,minQueryLength:u,selectedOption:this.templateInputValue(E[x]),tQueryTooShort:f,tNoResults:y,tSelectedOption:O,tResults:v}),J&&(0,d.createElement)("span",null,(0,d.createElement)("input",{className:H,readonly:!0,tabIndex:"-1",value:G})),(0,d.createElement)("input",h({"aria-activedescendant":!!F&&r+"__option--"+_,"aria-expanded":I,"aria-owns":r+"__listbox",autoComplete:"off",className:""+B+T+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:l,placeholder:s,ref:function(t){e.elementReferences[-1]=t},role:"combobox",type:"text",required:i,value:S})),X,(0,d.createElement)("ul",{className:L+" "+K+" "+U,id:r+"__listbox",role:"listbox"},E.map(function(t,n){var o=-1===_?x===n:_===n,u=o&&null===C?" "+W+"--focused":"",l=n%2?" "+W+"--odd":"";return(0,d.createElement)("li",{"aria-selected":_===n,className:""+W+u+l,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+"__option--"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:"option",tabIndex:"-1"})}),R&&(0,d.createElement)("li",{className:W+" "+W+"--no-results"},c())))},t}(d.Component),p.defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:O.default},c);t.default=_},function(e,t,n){"use strict";function o(e,t){}function r(e,t){if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){"function"!=typeof t&&null!==t||(e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t))}t.__esModule=!0,t.default=void 0;var l,s,i=n(0),a=(s=l=function(e){function t(){var n,u,l;o(this,t);for(var s=arguments.length,i=Array(s),a=0;a47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return O?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,h=Object.assign||function(e){for(var t=1;t=o;this.setState({query:s}),u||!i&&a&&p?r(s,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:l&&n?0:-1})}):!i&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.setState({focused:-1,menuOpen:!1,query:o,selected:-1},this.props.onConfirm(n))},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,u=n.selected,l=u!==r.length-1,s=l&&o;s&&this.handleOptionFocus(u+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),this.state.selected>=0&&this.handleOptionClick(e,this.state.selected))},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:i(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,u=t.minLength,l=t.name,s=t.placeholder,i=t.required,p=t.showAllValues,c=t.tNoResults,f=t.tStatusQueryTooShort,y=t.tStatusNoResults,v=t.tStatusSelectedOption,O=t.tStatusResults,g=t.dropdownArrow,b=this.state,_=b.focused,C=b.hovered,I=b.menuOpen,E=b.options,S=b.query,x=b.selected,D=this.hasAutoselect(),A=-1===_,M=0===E.length,q=0!==S.length,N=S.length>=u,R=this.props.showNoOptionsFound&&A&&M&&q&&N,k=n+"__wrapper",B=n+"__input",P=null!==_,T=P?" "+B+"--focused":"",V=this.props.showAllValues?" "+B+"--show-all-values":" "+B+"--default",j=n+"__dropdown-arrow-down",F=-1!==_&&null!==_,L=n+"__menu",K=L+"--"+o,Q=I||R,U=L+"--"+(Q?"visible":"hidden"),W=n+"__option",H=n+"__hint",$=this.templateInputValue(E[x]),z=$&&0===$.toLowerCase().indexOf(S.toLowerCase()),G=z&&D?S+$.substr(S.length):"",J=w&&G,X=void 0;return p&&"string"==typeof(X=g({className:j}))&&(X=(0,d.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:X}})),(0,d.createElement)("div",{className:k,onKeyDown:this.handleKeyDown},(0,d.createElement)(m.default,{length:E.length,queryLength:S.length,minQueryLength:u,selectedOption:this.templateInputValue(E[x]),tQueryTooShort:f,tNoResults:y,tSelectedOption:v,tResults:O}),J&&(0,d.createElement)("span",null,(0,d.createElement)("input",{className:H,readonly:!0,tabIndex:"-1",value:G})),(0,d.createElement)("input",h({"aria-activedescendant":!!F&&r+"__option--"+_,"aria-expanded":I,"aria-owns":r+"__listbox",autoComplete:"off",className:""+B+T+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:l,placeholder:s,ref:function(t){e.elementReferences[-1]=t},role:"combobox",type:"text",required:i,value:S})),X,(0,d.createElement)("ul",{className:L+" "+K+" "+U,id:r+"__listbox",role:"listbox"},E.map(function(t,n){var o=-1===_?x===n:_===n,u=o&&null===C?" "+W+"--focused":"",l=n%2?" "+W+"--odd":"";return(0,d.createElement)("li",{"aria-selected":_===n,className:""+W+u+l,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+"__option--"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:"option",tabIndex:"-1"})}),R&&(0,d.createElement)("li",{className:W+" "+W+"--no-results"},c())))},t}(d.Component),p.defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:v.default},c);t.default=_},function(e,t,n){"use strict";function o(e,t){}function r(e,t){if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){"function"!=typeof t&&null!==t||(e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t))}t.__esModule=!0,t.default=void 0;var l,s,i=n(0),a=(s=l=function(e){function t(){var n,u,l;o(this,t);for(var s=arguments.length,i=Array(s),a=0;a47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return v?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,h=Object.assign||function(e){for(var t=1;t=o;this.setState({query:l}),u||!i&&a&&p?r(l,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:s&&n?0:-1})}):!i&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.props.onConfirm(n),this.setState({focused:-1,menuOpen:!1,query:o,selected:-1})},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,u=n.selected,s=u!==r.length-1,l=s&&o;l&&this.handleOptionFocus(u+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){if(this.state.menuOpen){e.preventDefault();this.state.selected>=0&&this.handleOptionClick(e,this.state.selected)}},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case\"up\":this.handleUpArrow(e);break;case\"down\":this.handleDownArrow(e);break;case\"space\":this.handleSpace(e);break;case\"enter\":this.handleEnter(e);break;case\"escape\":this.handleComponentBlur({query:this.state.query});break;default:i(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,u=t.minLength,s=t.name,l=t.placeholder,i=t.required,p=t.showAllValues,c=t.tNoResults,f=t.tStatusQueryTooShort,y=t.tStatusNoResults,O=t.tStatusSelectedOption,v=t.tStatusResults,g=t.dropdownArrow,b=this.state,_=b.focused,E=b.hovered,C=b.menuOpen,I=b.options,S=b.query,x=b.selected,D=this.hasAutoselect(),A=-1===_,M=0===I.length,q=0!==S.length,R=S.length>=u,N=this.props.showNoOptionsFound&&A&&M&&q&&R,T=n+\"__wrapper\",k=n+\"__input\",B=null!==_,P=B?\" \"+k+\"--focused\":\"\",V=this.props.showAllValues?\" \"+k+\"--show-all-values\":\" \"+k+\"--default\",j=n+\"__dropdown-arrow-down\",F=-1!==_&&null!==_,L=n+\"__menu\",K=L+\"--\"+o,Q=C||N,U=L+\"--\"+(Q?\"visible\":\"hidden\"),W=n+\"__option\",H=n+\"__hint\",$=this.templateInputValue(I[x]),z=$&&0===$.toLowerCase().indexOf(S.toLowerCase()),G=z&&D?S+$.substr(S.length):\"\",J=w&&G,X=void 0;return p&&\"string\"==typeof(X=g({className:j}))&&(X=(0,d.createElement)(\"div\",{className:n+\"__dropdown-arrow-down-wrapper\",dangerouslySetInnerHTML:{__html:X}})),(0,d.createElement)(\"div\",{className:T,onKeyDown:this.handleKeyDown},(0,d.createElement)(m.default,{length:I.length,queryLength:S.length,minQueryLength:u,selectedOption:this.templateInputValue(I[x]),tQueryTooShort:f,tNoResults:y,tSelectedOption:O,tResults:v}),J&&(0,d.createElement)(\"span\",null,(0,d.createElement)(\"input\",{className:H,readonly:!0,tabIndex:\"-1\",value:G})),(0,d.createElement)(\"input\",h({\"aria-activedescendant\":!!F&&r+\"__option--\"+_,\"aria-expanded\":C,\"aria-owns\":r+\"__listbox\",autoComplete:\"off\",className:\"\"+k+P+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:s,placeholder:l,ref:function(t){e.elementReferences[-1]=t},role:\"combobox\",type:\"text\",required:i,value:S})),X,(0,d.createElement)(\"ul\",{className:L+\" \"+K+\" \"+U,id:r+\"__listbox\",role:\"listbox\"},I.map(function(t,n){var o=-1===_?x===n:_===n,u=o&&null===E?\" \"+W+\"--focused\":\"\",s=n%2?\" \"+W+\"--odd\":\"\";return(0,d.createElement)(\"li\",{\"aria-selected\":_===n,className:\"\"+W+u+s,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+\"__option--\"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:\"option\",tabIndex:\"-1\"})}),N&&(0,d.createElement)(\"li\",{className:W+\" \"+W+\"--no-results\"},c())))},t}(d.Component),p.defaultProps={autoselect:!1,cssNamespace:\"autocomplete\",defaultValue:\"\",displayMenu:\"inline\",minLength:0,name:\"input-autocomplete\",placeholder:\"\",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return\"No results found\"},dropdownArrow:O.default},c);t.default=_},function(e,t,n){\"use strict\";function o(e,t){if(!(e instanceof t))return;(\"Cannot call a class as a function\")}function r(e,t){if(!e)return;(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}function u(e,t){if(\"function\"!=typeof t&&null!==t)return;(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0,t.default=void 0;var s,l,i=n(0),a=(l=s=function(e){function t(){var n,u,s;o(this,t);for(var l=arguments.length,i=Array(l),a=0;a47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return O?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,h=Object.assign||function(e){for(var t=1;t=o;this.setState({query:l}),u||!i&&a&&p?r(l,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:s&&n?0:-1})}):!i&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.setState({focused:-1,menuOpen:!1,query:o,selected:-1},this.props.onConfirm(n))},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,u=n.selected,s=u!==r.length-1,l=s&&o;l&&this.handleOptionFocus(u+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){if(this.state.menuOpen){e.preventDefault();this.state.selected>=0&&this.handleOptionClick(e,this.state.selected)}},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case\"up\":this.handleUpArrow(e);break;case\"down\":this.handleDownArrow(e);break;case\"space\":this.handleSpace(e);break;case\"enter\":this.handleEnter(e);break;case\"escape\":this.handleComponentBlur({query:this.state.query});break;default:i(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,u=t.minLength,s=t.name,l=t.placeholder,i=t.required,p=t.showAllValues,c=t.tNoResults,f=t.tStatusQueryTooShort,y=t.tStatusNoResults,v=t.tStatusSelectedOption,O=t.tStatusResults,g=t.dropdownArrow,b=this.state,_=b.focused,E=b.hovered,C=b.menuOpen,I=b.options,S=b.query,x=b.selected,D=this.hasAutoselect(),A=-1===_,M=0===I.length,q=0!==S.length,R=S.length>=u,N=this.props.showNoOptionsFound&&A&&M&&q&&R,T=n+\"__wrapper\",k=n+\"__input\",B=null!==_,P=B?\" \"+k+\"--focused\":\"\",V=this.props.showAllValues?\" \"+k+\"--show-all-values\":\" \"+k+\"--default\",j=n+\"__dropdown-arrow-down\",F=-1!==_&&null!==_,L=n+\"__menu\",K=L+\"--\"+o,Q=C||N,U=L+\"--\"+(Q?\"visible\":\"hidden\"),W=n+\"__option\",H=n+\"__hint\",$=this.templateInputValue(I[x]),z=$&&0===$.toLowerCase().indexOf(S.toLowerCase()),G=z&&D?S+$.substr(S.length):\"\",J=w&&G,X=void 0;return p&&\"string\"==typeof(X=g({className:j}))&&(X=(0,d.createElement)(\"div\",{className:n+\"__dropdown-arrow-down-wrapper\",dangerouslySetInnerHTML:{__html:X}})),(0,d.createElement)(\"div\",{className:T,onKeyDown:this.handleKeyDown},(0,d.createElement)(m.default,{length:I.length,queryLength:S.length,minQueryLength:u,selectedOption:this.templateInputValue(I[x]),tQueryTooShort:f,tNoResults:y,tSelectedOption:v,tResults:O}),J&&(0,d.createElement)(\"span\",null,(0,d.createElement)(\"input\",{className:H,readonly:!0,tabIndex:\"-1\",value:G})),(0,d.createElement)(\"input\",h({\"aria-activedescendant\":!!F&&r+\"__option--\"+_,\"aria-expanded\":C,\"aria-owns\":r+\"__listbox\",autoComplete:\"off\",className:\"\"+k+P+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:s,placeholder:l,ref:function(t){e.elementReferences[-1]=t},role:\"combobox\",type:\"text\",required:i,value:S})),X,(0,d.createElement)(\"ul\",{className:L+\" \"+K+\" \"+U,id:r+\"__listbox\",role:\"listbox\"},I.map(function(t,n){var o=-1===_?x===n:_===n,u=o&&null===E?\" \"+W+\"--focused\":\"\",s=n%2?\" \"+W+\"--odd\":\"\";return(0,d.createElement)(\"li\",{\"aria-selected\":_===n,className:\"\"+W+u+s,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+\"__option--\"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:\"option\",tabIndex:\"-1\"})}),N&&(0,d.createElement)(\"li\",{className:W+\" \"+W+\"--no-results\"},c())))},t}(d.Component),p.defaultProps={autoselect:!1,cssNamespace:\"autocomplete\",defaultValue:\"\",displayMenu:\"inline\",minLength:0,name:\"input-autocomplete\",placeholder:\"\",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return\"No results found\"},dropdownArrow:v.default},c);t.default=_},function(e,t,n){\"use strict\";function o(e,t){if(!(e instanceof t))return;(\"Cannot call a class as a function\")}function r(e,t){if(!e)return;(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}function u(e,t){if(\"function\"!=typeof t&&null!==t)return;(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0,t.default=void 0;var s,l,i=n(0),a=(l=s=function(e){function t(){var n,u,s;o(this,t);for(var l=arguments.length,i=Array(l),a=0;a47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return v?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,h=Object.assign||function(e){for(var t=1;t=o;this.setState({query:s}),u||!i&&a&&p?r(s,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:l&&n?0:-1})}):!i&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.props.onConfirm(n),this.setState({focused:-1,menuOpen:!1,query:o,selected:-1})},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,u=n.selected,l=u!==r.length-1,s=l&&o;s&&this.handleOptionFocus(u+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),this.state.selected>=0&&this.handleOptionClick(e,this.state.selected))},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:i(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,u=t.minLength,l=t.name,s=t.placeholder,i=t.required,p=t.showAllValues,c=t.tNoResults,f=t.tStatusQueryTooShort,y=t.tStatusNoResults,O=t.tStatusSelectedOption,v=t.tStatusResults,g=t.dropdownArrow,b=this.state,_=b.focused,C=b.hovered,I=b.menuOpen,E=b.options,S=b.query,x=b.selected,D=this.hasAutoselect(),A=-1===_,M=0===E.length,q=0!==S.length,N=S.length>=u,R=this.props.showNoOptionsFound&&A&&M&&q&&N,k=n+"__wrapper",B=n+"__input",P=null!==_,T=P?" "+B+"--focused":"",V=this.props.showAllValues?" "+B+"--show-all-values":" "+B+"--default",j=n+"__dropdown-arrow-down",F=-1!==_&&null!==_,L=n+"__menu",K=L+"--"+o,Q=I||R,U=L+"--"+(Q?"visible":"hidden"),W=n+"__option",H=n+"__hint",$=this.templateInputValue(E[x]),z=$&&0===$.toLowerCase().indexOf(S.toLowerCase()),G=z&&D?S+$.substr(S.length):"",J=w&&G,X=void 0;return p&&"string"==typeof(X=g({className:j}))&&(X=(0,d.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:X}})),(0,d.createElement)("div",{className:k,onKeyDown:this.handleKeyDown},(0,d.createElement)(m.default,{length:E.length,queryLength:S.length,minQueryLength:u,selectedOption:this.templateInputValue(E[x]),tQueryTooShort:f,tNoResults:y,tSelectedOption:O,tResults:v}),J&&(0,d.createElement)("span",null,(0,d.createElement)("input",{className:H,readonly:!0,tabIndex:"-1",value:G})),(0,d.createElement)("input",h({"aria-activedescendant":!!F&&r+"__option--"+_,"aria-expanded":I,"aria-owns":r+"__listbox",autoComplete:"off",className:""+B+T+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:l,placeholder:s,ref:function(t){e.elementReferences[-1]=t},role:"combobox",type:"text",required:i,value:S})),X,(0,d.createElement)("ul",{className:L+" "+K+" "+U,id:r+"__listbox",role:"listbox"},E.map(function(t,n){var o=-1===_?x===n:_===n,u=o&&null===C?" "+W+"--focused":"",l=n%2?" "+W+"--odd":"";return(0,d.createElement)("li",{"aria-selected":_===n,className:""+W+u+l,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+"__option--"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:"option",tabIndex:"-1"})}),R&&(0,d.createElement)("li",{className:W+" "+W+"--no-results"},c())))},t}(d.Component),p.defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:O.default},c);t.default=_},function(e,t,n){"use strict";function o(e,t){}function r(e,t){if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){"function"!=typeof t&&null!==t||(e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t))}t.__esModule=!0,t.default=void 0;var l,s,i=n(0),a=(s=l=function(e){function t(){var n,u,l;o(this,t);for(var s=arguments.length,i=Array(s),a=0;a47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return O?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,h=Object.assign||function(e){for(var t=1;t=o;this.setState({query:s}),u||!i&&a&&p?r(s,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:l&&n?0:-1})}):!i&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.setState({focused:-1,menuOpen:!1,query:o,selected:-1},this.props.onConfirm(n))},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,u=n.selected,l=u!==r.length-1,s=l&&o;s&&this.handleOptionFocus(u+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),this.state.selected>=0&&this.handleOptionClick(e,this.state.selected))},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:i(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,u=t.minLength,l=t.name,s=t.placeholder,i=t.required,p=t.showAllValues,c=t.tNoResults,f=t.tStatusQueryTooShort,y=t.tStatusNoResults,v=t.tStatusSelectedOption,O=t.tStatusResults,g=t.dropdownArrow,b=this.state,_=b.focused,C=b.hovered,I=b.menuOpen,E=b.options,S=b.query,x=b.selected,D=this.hasAutoselect(),A=-1===_,M=0===E.length,q=0!==S.length,N=S.length>=u,R=this.props.showNoOptionsFound&&A&&M&&q&&N,k=n+"__wrapper",B=n+"__input",P=null!==_,T=P?" "+B+"--focused":"",V=this.props.showAllValues?" "+B+"--show-all-values":" "+B+"--default",j=n+"__dropdown-arrow-down",F=-1!==_&&null!==_,L=n+"__menu",K=L+"--"+o,Q=I||R,U=L+"--"+(Q?"visible":"hidden"),W=n+"__option",H=n+"__hint",$=this.templateInputValue(E[x]),z=$&&0===$.toLowerCase().indexOf(S.toLowerCase()),G=z&&D?S+$.substr(S.length):"",J=w&&G,X=void 0;return p&&"string"==typeof(X=g({className:j}))&&(X=(0,d.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:X}})),(0,d.createElement)("div",{className:k,onKeyDown:this.handleKeyDown},(0,d.createElement)(m.default,{length:E.length,queryLength:S.length,minQueryLength:u,selectedOption:this.templateInputValue(E[x]),tQueryTooShort:f,tNoResults:y,tSelectedOption:v,tResults:O}),J&&(0,d.createElement)("span",null,(0,d.createElement)("input",{className:H,readonly:!0,tabIndex:"-1",value:G})),(0,d.createElement)("input",h({"aria-activedescendant":!!F&&r+"__option--"+_,"aria-expanded":I,"aria-owns":r+"__listbox",autoComplete:"off",className:""+B+T+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:l,placeholder:s,ref:function(t){e.elementReferences[-1]=t},role:"combobox",type:"text",required:i,value:S})),X,(0,d.createElement)("ul",{className:L+" "+K+" "+U,id:r+"__listbox",role:"listbox"},E.map(function(t,n){var o=-1===_?x===n:_===n,u=o&&null===C?" "+W+"--focused":"",l=n%2?" "+W+"--odd":"";return(0,d.createElement)("li",{"aria-selected":_===n,className:""+W+u+l,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+"__option--"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:"option",tabIndex:"-1"})}),R&&(0,d.createElement)("li",{className:W+" "+W+"--no-results"},c())))},t}(d.Component),p.defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:v.default},c);t.default=_},function(e,t,n){"use strict";function o(e,t){}function r(e,t){if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){"function"!=typeof t&&null!==t||(e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t))}t.__esModule=!0,t.default=void 0;var l,s,i=n(0),a=(s=l=function(e){function t(){var n,u,l;o(this,t);for(var s=arguments.length,i=Array(s),a=0;a47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return v?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,h=Object.assign||function(e){for(var t=1;t=o;this.setState({query:l}),u||!i&&a&&p?r(l,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:s&&n?0:-1})}):!i&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.props.onConfirm(n),this.setState({focused:-1,menuOpen:!1,query:o,selected:-1})},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,u=n.selected,s=u!==r.length-1,l=s&&o;l&&this.handleOptionFocus(u+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){if(this.state.menuOpen){e.preventDefault();this.state.selected>=0&&this.handleOptionClick(e,this.state.selected)}},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case\"up\":this.handleUpArrow(e);break;case\"down\":this.handleDownArrow(e);break;case\"space\":this.handleSpace(e);break;case\"enter\":this.handleEnter(e);break;case\"escape\":this.handleComponentBlur({query:this.state.query});break;default:i(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,u=t.minLength,s=t.name,l=t.placeholder,i=t.required,p=t.showAllValues,c=t.tNoResults,f=t.tStatusQueryTooShort,y=t.tStatusNoResults,O=t.tStatusSelectedOption,v=t.tStatusResults,g=t.dropdownArrow,b=this.state,_=b.focused,E=b.hovered,C=b.menuOpen,I=b.options,S=b.query,x=b.selected,D=this.hasAutoselect(),A=-1===_,M=0===I.length,R=0!==S.length,q=S.length>=u,N=this.props.showNoOptionsFound&&A&&M&&R&&q,T=n+\"__wrapper\",k=n+\"__input\",B=null!==_,P=B?\" \"+k+\"--focused\":\"\",V=this.props.showAllValues?\" \"+k+\"--show-all-values\":\" \"+k+\"--default\",j=n+\"__dropdown-arrow-down\",F=-1!==_&&null!==_,L=n+\"__menu\",K=L+\"--\"+o,Q=C||N,U=L+\"--\"+(Q?\"visible\":\"hidden\"),W=n+\"__option\",H=n+\"__hint\",$=this.templateInputValue(I[x]),z=$&&0===$.toLowerCase().indexOf(S.toLowerCase()),G=z&&D?S+$.substr(S.length):\"\",J=w&&G,X=void 0;return p&&\"string\"==typeof(X=g({className:j}))&&(X=(0,d.createElement)(\"div\",{className:n+\"__dropdown-arrow-down-wrapper\",dangerouslySetInnerHTML:{__html:X}})),(0,d.createElement)(\"div\",{className:T,onKeyDown:this.handleKeyDown},(0,d.createElement)(m.default,{length:I.length,queryLength:S.length,minQueryLength:u,selectedOption:this.templateInputValue(I[x]),tQueryTooShort:f,tNoResults:y,tSelectedOption:O,tResults:v}),J&&(0,d.createElement)(\"span\",null,(0,d.createElement)(\"input\",{className:H,readonly:!0,tabIndex:\"-1\",value:G})),(0,d.createElement)(\"input\",h({\"aria-activedescendant\":!!F&&r+\"__option--\"+_,\"aria-expanded\":C,\"aria-owns\":r+\"__listbox\",autoComplete:\"off\",className:\"\"+k+P+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:s,placeholder:l,ref:function(t){e.elementReferences[-1]=t},role:\"combobox\",type:\"text\",required:i,value:S})),X,(0,d.createElement)(\"ul\",{className:L+\" \"+K+\" \"+U,id:r+\"__listbox\",role:\"listbox\"},I.map(function(t,n){var o=-1===_?x===n:_===n,u=o&&null===E?\" \"+W+\"--focused\":\"\",s=n%2?\" \"+W+\"--odd\":\"\";return(0,d.createElement)(\"li\",{\"aria-selected\":_===n,className:\"\"+W+u+s,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+\"__option--\"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:\"option\",tabIndex:\"-1\"})}),N&&(0,d.createElement)(\"li\",{className:W+\" \"+W+\"--no-results\"},c())))},t}(d.Component),p.defaultProps={autoselect:!1,cssNamespace:\"autocomplete\",defaultValue:\"\",displayMenu:\"inline\",minLength:0,name:\"input-autocomplete\",placeholder:\"\",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return\"No results found\"},dropdownArrow:O.default},c);t.default=_},function(e,t,n){\"use strict\";function o(e,t){if(!(e instanceof t))return;(\"Cannot call a class as a function\")}function r(e,t){if(!e)return;(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}function u(e,t){if(\"function\"!=typeof t&&null!==t)return;(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0,t.default=void 0;var s,l,i=n(0),a=(l=s=function(e){function t(){var n,u,s;o(this,t);for(var l=arguments.length,i=Array(l),a=0;a47&&e<58||32===e||8===e||e>64&&e<91||e>95&&e<112||e>185&&e<193||e>218&&e<223}function a(e){return O?{onInput:e}:g?{onChange:e}:void 0}t.__esModule=!0,t.default=void 0;var p,c,h=Object.assign||function(e){for(var t=1;t=o;this.setState({query:l}),u||!i&&a&&p?r(l,function(e){var n=e.length>0;t.setState({menuOpen:n,options:e,selected:s&&n?0:-1})}):!i&&p||this.setState({menuOpen:!1,options:[]})},t.prototype.handleInputClick=function(e){this.handleInputChange(e)},t.prototype.handleInputFocus=function(e){this.setState({focused:-1})},t.prototype.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.prototype.handleOptionMouseEnter=function(e,t){this.setState({hovered:t})},t.prototype.handleOptionMouseOut=function(e,t){this.setState({hovered:null})},t.prototype.handleOptionTouchEnd=function(e,t){this.handleOptionClick(e,t)},t.prototype.handleOptionClick=function(e,t){var n=this.state.options[t],o=this.templateInputValue(n);this.setState({focused:-1,menuOpen:!1,query:o,selected:-1},this.props.onConfirm(n))},t.prototype.handleOptionMouseDown=function(e){e.preventDefault()},t.prototype.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,o=t.selected;-1!==o&&n&&this.handleOptionFocus(o-1)},t.prototype.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,o=n.menuOpen,r=n.options,u=n.selected,s=u!==r.length-1,l=s&&o;l&&this.handleOptionFocus(u+1)}},t.prototype.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&(e.preventDefault(),this.props.source(\"\",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.prototype.handleEnter=function(e){if(this.state.menuOpen){e.preventDefault();this.state.selected>=0&&this.handleOptionClick(e,this.state.selected)}},t.prototype.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.prototype.handleKeyDown=function(e){switch(b[e.keyCode]){case\"up\":this.handleUpArrow(e);break;case\"down\":this.handleDownArrow(e);break;case\"space\":this.handleSpace(e);break;case\"enter\":this.handleEnter(e);break;case\"escape\":this.handleComponentBlur({query:this.state.query});break;default:i(e.keyCode)&&this.handlePrintableKey(e)}},t.prototype.render=function(){var e=this,t=this.props,n=t.cssNamespace,o=t.displayMenu,r=t.id,u=t.minLength,s=t.name,l=t.placeholder,i=t.required,p=t.showAllValues,c=t.tNoResults,f=t.tStatusQueryTooShort,y=t.tStatusNoResults,v=t.tStatusSelectedOption,O=t.tStatusResults,g=t.dropdownArrow,b=this.state,_=b.focused,E=b.hovered,C=b.menuOpen,I=b.options,S=b.query,x=b.selected,D=this.hasAutoselect(),A=-1===_,M=0===I.length,R=0!==S.length,q=S.length>=u,N=this.props.showNoOptionsFound&&A&&M&&R&&q,T=n+\"__wrapper\",k=n+\"__input\",B=null!==_,P=B?\" \"+k+\"--focused\":\"\",V=this.props.showAllValues?\" \"+k+\"--show-all-values\":\" \"+k+\"--default\",j=n+\"__dropdown-arrow-down\",F=-1!==_&&null!==_,L=n+\"__menu\",K=L+\"--\"+o,Q=C||N,U=L+\"--\"+(Q?\"visible\":\"hidden\"),W=n+\"__option\",H=n+\"__hint\",$=this.templateInputValue(I[x]),z=$&&0===$.toLowerCase().indexOf(S.toLowerCase()),G=z&&D?S+$.substr(S.length):\"\",J=w&&G,X=void 0;return p&&\"string\"==typeof(X=g({className:j}))&&(X=(0,d.createElement)(\"div\",{className:n+\"__dropdown-arrow-down-wrapper\",dangerouslySetInnerHTML:{__html:X}})),(0,d.createElement)(\"div\",{className:T,onKeyDown:this.handleKeyDown},(0,d.createElement)(m.default,{length:I.length,queryLength:S.length,minQueryLength:u,selectedOption:this.templateInputValue(I[x]),tQueryTooShort:f,tNoResults:y,tSelectedOption:v,tResults:O}),J&&(0,d.createElement)(\"span\",null,(0,d.createElement)(\"input\",{className:H,readonly:!0,tabIndex:\"-1\",value:G})),(0,d.createElement)(\"input\",h({\"aria-activedescendant\":!!F&&r+\"__option--\"+_,\"aria-expanded\":C,\"aria-owns\":r+\"__listbox\",autoComplete:\"off\",className:\"\"+k+P+V,id:r,onClick:function(t){return e.handleInputClick(t)},onBlur:this.handleInputBlur},a(this.handleInputChange),{onFocus:this.handleInputFocus,name:s,placeholder:l,ref:function(t){e.elementReferences[-1]=t},role:\"combobox\",type:\"text\",required:i,value:S})),X,(0,d.createElement)(\"ul\",{className:L+\" \"+K+\" \"+U,id:r+\"__listbox\",role:\"listbox\"},I.map(function(t,n){var o=-1===_?x===n:_===n,u=o&&null===E?\" \"+W+\"--focused\":\"\",s=n%2?\" \"+W+\"--odd\":\"\";return(0,d.createElement)(\"li\",{\"aria-selected\":_===n,className:\"\"+W+u+s,dangerouslySetInnerHTML:{__html:e.templateSuggestion(t)},id:r+\"__option--\"+n,key:n,onFocusOut:function(t){return e.handleOptionBlur(t,n)},onClick:function(t){return e.handleOptionClick(t,n)},onMouseDown:e.handleOptionMouseDown,onMouseEnter:function(t){return e.handleOptionMouseEnter(t,n)},onMouseOut:function(t){return e.handleOptionMouseOut(t,n)},onTouchEnd:function(t){return e.handleOptionTouchEnd(t,n)},ref:function(t){e.elementReferences[n]=t},role:\"option\",tabIndex:\"-1\"})}),N&&(0,d.createElement)(\"li\",{className:W+\" \"+W+\"--no-results\"},c())))},t}(d.Component),p.defaultProps={autoselect:!1,cssNamespace:\"autocomplete\",defaultValue:\"\",displayMenu:\"inline\",minLength:0,name:\"input-autocomplete\",placeholder:\"\",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return\"No results found\"},dropdownArrow:v.default},c);t.default=_},function(e,t,n){\"use strict\";function o(e,t){if(!(e instanceof t))return;(\"Cannot call a class as a function\")}function r(e,t){if(!e)return;(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}function u(e,t){if(\"function\"!=typeof t&&null!==t)return;(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0,t.default=void 0;var s,l,i=n(0),a=(l=s=function(e){function t(){var n,u,s;o(this,t);for(var l=arguments.length,i=Array(l),a=0;a {} } this.setState({ focused: null, menuOpen: newState.menuOpen || false, query: newQuery, selected: null - }) + }, setStateCallback) } handleOptionBlur (event, index) { @@ -266,13 +268,12 @@ export default class Autocomplete extends Component { handleOptionClick (event, index) { const selectedOption = this.state.options[index] const newQuery = this.templateInputValue(selectedOption) - this.props.onConfirm(selectedOption) this.setState({ focused: -1, menuOpen: false, query: newQuery, selected: -1 - }) + }, this.props.onConfirm(selectedOption)) } handleOptionMouseDown (event) {