!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.MapboxGeocoder=e()}}(function(){var e;return function(){function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){return i(t[o][1][e]||e)},c,c.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(e,t){this.eventQueue.push(e),(this.eventQueue.length>=this.maxQueueSize||t)&&this.flush()},remove:function(){this.flush()}},t.exports=r},{nanoid:30}],2:[function(e,t,n){t.exports={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},{}],3:[function(e,t,n){"use strict";function r(e){this._eventEmitter=new a,this.options=o({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null}var i=e("suggestions"),s=e("lodash.debounce"),o=e("xtend"),a=e("events").EventEmitter,u=e("./exceptions"),l=e("@mapbox/mapbox-sdk"),c=e("@mapbox/mapbox-sdk/services/geocoding"),h=e("./events"),p=e("./localization"),f=e("subtag");r.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,getItemValue:function(e){return e.place_name},render:function(e){var t=e.place_name.split(",");return'
'+t[0]+'
'+t.splice(1,t.length).join(",")+"
"}},onAdd:function(e){if(this._map=e,this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=c(l({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new h(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this);var t=this.container=document.createElement("div");t.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var n=this.createIcon("search",'');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",s(this._onKeyDown,200)),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",function(e){this.eventManager.keyevent(e,this)}.bind(this));var r=document.createElement("div");r.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var o=this.createIcon("close",'');return this._clearEl.appendChild(o),this._loadingEl=this.createIcon("loading",''),r.appendChild(this._clearEl),r.appendChild(this._loadingEl),t.appendChild(n),t.appendChild(this._inputEl),t.appendChild(r),this._typeahead=new i(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1),t},createIcon:function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+e),n.setAttribute("viewBox","0 0 18 18"),n.setAttribute("xml:space","preserve"),n.setAttribute("width",18),n.setAttribute("height",18),n.innerHTML=t,n},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_onKeyDown:function(e){if(27===e.keyCode&&this.options.clearAndBlurOnEsc)return this._clear(e),this._inputEl.blur();var t=e.target&&e.target.shadowRoot?e.target.shadowRoot.activeElement:e.target;if(!(t?t.value:""))return this.fresh=!0,9!==e.keyCode&&this.clear(e),this._clearEl.style.display="none";e.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(e.keyCode)||t.value.length>=this.options.minLength&&this._geocode(t.value)},_showButton:function(){this._typeahead.selected&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onBlur:function(e){this.options.clearOnBlur&&this._clearOnBlur(e),this.options.collapsed&&this._collapse()},_onChange:function(){var e=this._typeahead.selected;if(e&&e.id!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var t;if(e.properties&&!u[e.properties.short_code]&&e.bbox){var n=e.bbox;t=o({},this.options.flyTo),this._map.fitBounds([[n[0],n[1]],[n[2],n[3]]],t)}else if(e.properties&&u[e.properties.short_code])t=o({},this.options.flyTo),this._map.fitBounds(u[e.properties.short_code].bbox,t);else{var r={zoom:this.options.zoom};t=o({},r,this.options.flyTo),t.center=e.center,this._map.flyTo(t)}}this.options.marker&&this._mapboxgl&&this._handleMarker(e),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this._eventEmitter.emit("result",{result:e}),this.eventManager.select(e,this),this.lastSelected=e.id}},_geocode:function(e){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:e}),this.inputString=e;var t,n=["bbox","limit","proximity","countries","types","language","reverseMode","mode"],r=this,i=n.reduce(function(e,t){return r.options[t]&&(["countries","types","language"].indexOf(t)>-1?e[t]=r.options[t].split(/[\s,]+/):e[t]=r.options[t],"proximity"===t&&r.options[t]&&r.options[t].longitude&&r.options[t].latitude&&(e[t]=[r.options[t].longitude,r.options[t].latitude])),e},{});if(this.options.localGeocoderOnly)t=Promise.resolve();else if(this.options.reverseGeocode&&/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(e)){var s=e.split(/[\s(,)?]+/).map(function(e){return parseFloat(e,10)}).reverse();i.types&&i.types[0],i=o(i,{query:s,limit:1}),t=this.geocoderService.reverseGeocode(i).send()}else i=o(i,{query:e}),t=this.geocoderService.forwardGeocode(i).send();var a=[];return this.options.localGeocoder&&((a=this.options.localGeocoder(e))||(a=[])),t.then(function(e){this._loadingEl.style.display="none";var t={};e?"200"==e.statusCode&&(t=e.body):t={type:"FeatureCollection",features:[]},t.config=i,this.fresh&&(this.eventManager.start(this),this.fresh=!1),t.features=t.features?a.concat(t.features):a,this.options.filter&&t.features.length&&(t.features=t.features.filter(this.options.filter)),t.features.length?(this._clearEl.style.display="block",this._eventEmitter.emit("results",t),this._typeahead.update(t.features)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",t))}.bind(this)),t.catch(function(e){this._loadingEl.style.display="none",a.length&&this.options.localGeocoder?(this._clearEl.style.display="block",this._typeahead.update(a)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:a}),this._eventEmitter.emit("error",{error:e})}.bind(this)),t},_clear:function(e){e&&e.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(e){this._clear(e),this._inputEl.focus()},_clearOnBlur:function(e){var t=this;e.relatedTarget&&t._clear(e)},_onQueryResult:function(e){var t=e.body;if(t.features.length){var n=t.features[0];this._typeahead.selected=n,this._inputEl.value=n.place_name,this._onChange()}},_updateProximity:function(){if(this._map.getZoom()>9){var e=this._map.getCenter().wrap();this.setProximity({longitude:e.lng,latitude:e.lat})}else this.setProximity(null)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(e){return this._geocode(e).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("
There was an error reaching the server
")},_renderNoResults:function(){this._renderMessage("
No results found
")},_renderMessage:function(e){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(e)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var e=this.options.language.split(",")[0],t=f.language(e),n=p.placeholder[t];if(n)return n}return"Search"},setInput:function(e){return this._inputEl.value=e,this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this},setProximity:function(e){return this.options.proximity=e,this},getProximity:function(){return this.options.proximity},setRenderFunction:function(e){return e&&"function"==typeof e&&(this._typeahead.render=e),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(e){var t=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=e||this.options.language||t,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(e){return this.options.zoom=e,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(e){return this.options.flyTo=e,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(e){return this.placeholder=e||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this},getBbox:function(){return this.options.bbox},setBbox:function(e){return this.options.bbox=e,this},getCountries:function(){return this.options.countries},setCountries:function(e){return this.options.countries=e,this},getTypes:function(){return this.options.types},setTypes:function(e){return this.options.types=e,this},getMinLength:function(){return this.options.minLength},setMinLength:function(e){return this.options.minLength=e,this._typeahead&&(this._typeahead.minLength=e),this},getLimit:function(){return this.options.limit},setLimit:function(e){return this.options.limit=e,this._typeahead&&(this._typeahead.options.limit=e),this},getFilter:function(){return this.options.filter},setFilter:function(e){return this.options.filter=e,this},_handleMarker:function(e){this._removeMarker();var t={color:"#4668F2"},n=o({},t,this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(n),this.mapMarker.setLngLat(e.center).addTo(this._map),this},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(e,t){return this._eventEmitter.on(e,t),this},off:function(e,t){return this._eventEmitter.removeListener(e,t),this.eventManager.remove(),this}},t.exports=r},{"./events":1,"./exceptions":2,"./localization":4,"@mapbox/mapbox-sdk":6,"@mapbox/mapbox-sdk/services/geocoding":17,events:25,"lodash.debounce":29,subtag:32,suggestions:33,xtend:36}],4:[function(e,t,n){"use strict";var r={de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje"};t.exports={placeholder:r}},{}],5:[function(e,t,n){"use strict";function r(e){var t=Array.isArray(e),n=function(n){return t?e[n]:e};return function(r){var s=i(v.plainArray,r);if(s)return s;if(t&&r.length!==e.length)return"an array with "+e.length+" items";for(var o=0;oe.length?t:e})}},v.equal=function(e){return function(t){if(t!==e)return JSON.stringify(e)}},v.oneOf=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments),t=e.map(function(e){return v.equal(e)});return v.oneOfType.apply(this,t)},v.range=function(e){var t=e[0],n=e[1];return function(e){if(i(v.number,e)||en)return"number between "+t+" & "+n+" (inclusive)"}},v.any=function(){},v.boolean=function(e){if("boolean"!=typeof e)return"boolean"},v.number=function(e){if("number"!=typeof e)return"number"},v.plainArray=function(e){if(!Array.isArray(e))return"array"},v.plainObject=function(e){if(!p(e))return"object"},v.string=function(e){if("string"!=typeof e)return"string"},v.func=function(e){if("function"!=typeof e)return"function"},v.validate=i,v.processMessage=s,t.exports=v},{"is-plain-obj":28,xtend:36}],6:[function(e,t,n){"use strict";var r=e("./lib/client");t.exports=r},{"./lib/client":7}],7:[function(e,t,n){"use strict";function r(e){o.call(this,e)}function i(e){return new r(e)}var s=e("./browser-layer"),o=e("../classes/mapi-client");r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.prototype.sendRequest=s.browserSend,r.prototype.abortRequest=s.browserAbort,t.exports=i},{"../classes/mapi-client":9,"./browser-layer":8}],8:[function(e,t,n){"use strict";function r(e){var t=f[e.id];t&&(t.abort(),delete f[e.id])}function i(e,t){return new l(e,{body:t.response,headers:p(t.getAllResponseHeaders()),statusCode:t.status})}function s(e){var t=e.total,n=e.loaded;return{total:t,transferred:n,percent:100*n/t}}function o(e,t){return new Promise(function(n,r){t.onprogress=function(t){e.emitter.emit(h.EVENT_PROGRESS_DOWNLOAD,s(t))};var i=e.file;i&&(t.upload.onprogress=function(t){e.emitter.emit(h.EVENT_PROGRESS_UPLOAD,s(t))}),t.onerror=function(e){r(e)},t.onabort=function(){var t=new c({request:e,type:h.ERROR_REQUEST_ABORTED});r(t)},t.onload=function(){if(delete f[e.id],t.status<200||t.status>=400){var i=new c({request:e,body:t.response,statusCode:t.status});return void r(i)}n(t)};var o=e.body;"string"==typeof o?t.send(o):o?t.send(JSON.stringify(o)):i?t.send(i):t.send(),f[e.id]=t}).then(function(t){return i(e,t)})}function a(e,t){var n=e.url(t),r=new window.XMLHttpRequest;return r.open(e.method,n),Object.keys(e.headers).forEach(function(t){r.setRequestHeader(t,e.headers[t])}),r}function u(e){return Promise.resolve().then(function(){var t=a(e,e.client.accessToken);return o(e,t)})}var l=e("../classes/mapi-response"),c=e("../classes/mapi-error"),h=e("../constants"),p=e("../helpers/parse-headers"),f={};t.exports={browserAbort:r,sendRequestXhr:o,browserSend:u,createRequestXhr:a}},{"../classes/mapi-error":10,"../classes/mapi-response":12,"../constants":13,"../helpers/parse-headers":14}],9:[function(e,t,n){"use strict";function r(e){if(!e||!e.accessToken)throw new Error("Cannot create a client without an access token");i(e.accessToken),this.accessToken=e.accessToken,this.origin=e.origin||o.API_ORIGIN}var i=e("@mapbox/parse-mapbox-token"),s=e("./mapi-request"),o=e("../constants");r.prototype.createRequest=function(e){return new s(this,e)},t.exports=r},{"../constants":13,"./mapi-request":11,"@mapbox/parse-mapbox-token":23}],10:[function(e,t,n){"use strict";function r(e){var t,n=e.type||i.ERROR_HTTP;if(e.body)try{t=JSON.parse(e.body)}catch(n){t=e.body}else t=null;var r=e.message||null;r||("string"==typeof t?r=t:t&&"string"==typeof t.message?r=t.message:n===i.ERROR_REQUEST_ABORTED&&(r="Request aborted")),this.message=r,this.type=n,this.statusCode=e.statusCode||null,this.request=e.request,this.body=t}var i=e("../constants");t.exports=r},{"../constants":13}],11:[function(e,t,n){"use strict";function r(e,t){if(!e)throw new Error("MapiRequest requires a client");if(!t||!t.path||!t.method)throw new Error("MapiRequest requires an options object with path and method properties");var n={};t.body&&(n["content-type"]="application/json");var r=s(n,t.headers),i=Object.keys(r).reduce(function(e,t){return e[t.toLowerCase()]=r[t],e},{});this.id=l++,this._options=t,this.emitter=new o,this.client=e,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=t.path,this.method=t.method,this.origin=t.origin||e.origin,this.query=t.query||{},this.params=t.params||{},this.body=t.body||null,this.file=t.file||null,this.headers=i}var i=e("@mapbox/parse-mapbox-token"),s=e("xtend"),o=e("eventemitter3"),a=e("../helpers/url-utils"),u=e("../constants"),l=1;r.prototype.url=function(e){var t=a.prependOrigin(this.path,this.origin);t=a.appendQueryObject(t,this.query);var n=this.params;if(e){t=a.appendQueryParam(t,"access_token",e);var r=i(e).user;n=s({ownerId:r},n)}return t=a.interpolateRouteParams(t,n),t},r.prototype.send=function(){var e=this;if(e.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return e.sent=!0,e.client.sendRequest(e).then(function(t){return e.response=t,e.emitter.emit(u.EVENT_RESPONSE,t),t},function(t){throw e.error=t,e.emitter.emit(u.EVENT_ERROR,t),t})},r.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),this.response||this.error||this.aborted||(this.aborted=!0,this.client.abortRequest(this))},r.prototype.eachPage=function(e){function t(t){function n(){delete i._nextPageRequest;var e=t.nextPage();e&&(i._nextPageRequest=e,r(e))}e(null,t,n)}function n(t){e(t,null,function(){})}function r(e){e.send().then(t,n)}var i=this;r(this)},r.prototype.clone=function(){return this._extend()},r.prototype._extend=function(e){var t=s(this._options,e);return new r(this.client,t)},t.exports=r},{"../constants":13,"../helpers/url-utils":16,"@mapbox/parse-mapbox-token":23,eventemitter3:26,xtend:36}],12:[function(e,t,n){"use strict";function r(e,t){this.request=e,this.headers=t.headers,this.rawBody=t.body,this.statusCode=t.statusCode;try{this.body=JSON.parse(t.body||"{}")}catch(e){this.body=t.body}this.links=i(this.headers.link)}var i=e("../helpers/parse-link-header");r.prototype.hasNextPage=function(){return!!this.links.next},r.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},t.exports=r},{"../helpers/parse-link-header":15}],13:[function(e,t,n){"use strict";t.exports={API_ORIGIN:"https://api.mapbox.com",EVENT_PROGRESS_DOWNLOAD:"downloadProgress",EVENT_PROGRESS_UPLOAD:"uploadProgress",EVENT_ERROR:"error",EVENT_RESPONSE:"response",ERROR_HTTP:"HttpError",ERROR_REQUEST_ABORTED:"RequestAbortedError"}},{}],14:[function(e,t,n){"use strict";function r(e){var t=e.indexOf(":");return{name:e.substring(0,t).trim().toLowerCase(),value:e.substring(t+1).trim()}}function i(e){var t={};return e?(e.trim().split(/[\r|\n]+/).forEach(function(e){var n=r(e);t[n.name]=n.value}),t):t}t.exports=i},{}],15:[function(e,t,n){"use strict";function r(e){var t=e.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return t?{key:t[1],value:t[2]}:null}function i(e){var t=e.match(/]*)>(.*)/);if(!t)return null;var n=t[1],i=t[2].split(";"),s=null,o=i.reduce(function(e,t){var n=r(t);return n?"rel"===n.key?(s||(s=n.value),e):(e[n.key]=n.value,e):e},{});return s?{url:n,rel:s,params:o}:null}function s(e){return e?e.split(/,\s*>(-2*i&6)));return s},f=function(e){e=String(e),/[^\0-\xFF]/.test(e)&&l("The string to be encoded contains characters outside of the Latin1 range.");for(var t,n,r,i,s=e.length%3,o="",a=-1,u=e.length-s;++a>18&63)+c.charAt(i>>12&63)+c.charAt(i>>6&63)+c.charAt(63&i);return 2==s?(t=e.charCodeAt(a)<<8,n=e.charCodeAt(++a),i=t+n,o+=c.charAt(i>>10)+c.charAt(i>>4&63)+c.charAt(i<<2&63)+"="):1==s&&(i=e.charCodeAt(a),o+=c.charAt(i>>2)+c.charAt(i<<4&63)+"=="),o},d={encode:f,decode:p,version:"0.1.0"};if("function"==typeof e&&"object"==typeof e.amd&&e.amd)e(function(){return d});else if(s&&!s.nodeType)if(o)o.exports=d;else for(var v in d)d.hasOwnProperty(v)&&(s[v]=d[v]);else i.base64=d}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],25:[function(e,t,n){function r(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=x(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}function i(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function s(e,t,n){if(t)e.call(n);else for(var r=e.length,i=y(e,r),s=0;s0&&a.length>s){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=o[t]=n,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var f=new Error('Unhandled "error" event. ('+t+")");throw f.context=t,f}if(!(n=h[e]))return!1;var d="function"==typeof n;switch(r=arguments.length){case 1:s(n,d,this);break;case 2:o(n,d,this,arguments[1]);break;case 3:a(n,d,this,arguments[1],arguments[2]);break;case 4:u(n,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),c=1;c=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():v(n,i),1===n.length&&(r[e]=n[0]),r.removeListener&&this.emit("removeListener",e,o||t)}return this},r.prototype.removeAllListeners=function(e){var t,n,r;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=x(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=x(null):delete n[e]),this;if(0===arguments.length){var i,s=w(n);for(r=0;r=0;r--)this.removeListener(e,t[r]);return this},r.prototype.listeners=function(e){return f(this,e,!0)},r.prototype.rawListeners=function(e){return f(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},r.prototype.listenerCount=d,r.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],26:[function(e,t,n){"use strict";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new i(n,r||e,s),a=l?l+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],o]:e._events[a].push(o):(e._events[a]=o,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}var u=Object.prototype.hasOwnProperty,l="~";Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(l=!1)),a.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)u.call(e,t)&&n.push(l?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},a.prototype.listeners=function(e){var t=l?l+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,s=new Array(i);r=t||n<0||k&&r>=m}function c(){var e=w();if(l(e))return h(e);b=setTimeout(c,u(e))}function h(e){return b=void 0,T&&v?i(e):(v=y=void 0,g)}function p(){void 0!==b&&clearTimeout(b),O=0,v=E=y=b=void 0}function f(){return void 0===b?g:h(w())}function d(){var e=w(),n=l(e);if(v=arguments,y=this,E=e,n){if(void 0===b)return s(E);if(k)return b=setTimeout(c,t),i(E)}return void 0===b&&(b=setTimeout(c,t)),g}var v,y,m,g,b,E,O=0,L=!1,k=!1,T=!0;if("function"!=typeof e)throw new TypeError(a);return t=o(t)||0,r(n)&&(L=!!n.leading,k="maxWait"in n,m=k?_(o(n.maxWait)||0,t):m,T="trailing"in n?!!n.trailing:T),d.cancel=p,d.flush=f,d}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==typeof e}function s(e){return"symbol"==typeof e||i(e)&&b.call(e)==l}function o(e){if("number"==typeof e)return e;if(s(e))return u;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var n=p.test(e);return n||f.test(e)?d(e.slice(2),n?2:8):h.test(e)?u:+e}var a="Expected a function",u=NaN,l="[object Symbol]",c=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,f=/^0o[0-7]+$/i,d=parseInt,v="object"==typeof e&&e&&e.Object===Object&&e,y="object"==typeof self&&self&&self.Object===Object&&self,m=v||y||Function("return this")(),g=Object.prototype,b=g.toString,_=Math.max,x=Math.min,w=function(){return m.Date.now()};t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],30:[function(e,t,n){(function(e){if("production"!==e.env.NODE_ENV&&("undefined"==typeof self||!self.crypto&&!self.msCrypto))throw new Error("Your browser does not have secure random generator. If you don’t need unpredictable IDs, you can use nanoid/non-secure.");var n=self.crypto||self.msCrypto;t.exports=function(e){e=e||21;for(var t="",r=n.getRandomValues(new Uint8Array(e));01)for(var n=1;n-1},o.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},o.prototype.getCandidates=function(e){var t,n={pre:"",post:"",extract:function(e){return this.getItemValue(e)}.bind(this)};this.options.filter?(t=i.filter(this.query,this.data,n),t=t.map(function(e){return{original:e.original,string:this.render(e.original,e.string)}}.bind(this))):t=this.data.map(function(e){return{original:e,string:this.render(e)}}.bind(this)),e(t)},o.prototype.getItemValue=function(e){return e},o.prototype.render=function(e,t){if(t)return t;for(var n=e.original?this.getItemValue(e.original):this.getItemValue(e),r=this.normalize(n),i=r.lastIndexOf(this.query);i>-1;){var s=i+this.query.length;n=n.slice(0,i)+""+n.slice(i,s)+""+n.slice(s),i=r.slice(0,i).lastIndexOf(this.query)}return n},o.prototype.renderError=function(e){this.list.drawError(e)},t.exports=o},{"./list":34,fuzzy:27,xtend:36}],36:[function(e,t,n){function r(){for(var e={},t=0;t