app/assets/javascripts/mapbox-gl-geocoder.js in mapbox-gl-rails-0.53.1 vs app/assets/javascripts/mapbox-gl-geocoder.js in mapbox-gl-rails-0.54.0

- old
+ new

@@ -1,3 +1,2 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.MapboxGeocoder=t()}}(function(){var t;return function(){function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){return i(e[s][1][t]||t)},c,c.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}return t}()({1:[function(t,e,n){e.exports={"country.3148":{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},"country.3145":{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},"country.330":{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},"country.3179":{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},{}],2:[function(t,e,n){"use strict";function r(t){this._eventEmitter=new a,this.options=s({},this.options,t)}var i=t("suggestions"),o=t("lodash.debounce"),s=t("xtend"),a=t("events").EventEmitter,u=t("./exceptions"),l=t("mapbox/lib/services/geocoding");r.prototype={options:{placeholder:"Search",zoom:16,flyTo:!0,trackProximity:!1,minLength:2,limit:5},onAdd:function(t){this._map=t,this.mapboxClient=new l(this.options.accessToken),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this._clear=this._clear.bind(this),this._updateProximity=this._updateProximity.bind(this);var e=this.container=document.createElement("div");e.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var n=document.createElement("span");n.className="geocoder-icon geocoder-icon-search",this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.placeholder=this.options.placeholder,this._inputEl.addEventListener("keydown",this._onKeyDown),this._inputEl.addEventListener("change",this._onChange);var r=document.createElement("div");return r.classList.add("geocoder-pin-right"),this._clearEl=document.createElement("button"),this._clearEl.className="geocoder-icon geocoder-icon-close",this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this._clear),this._loadingEl=document.createElement("span"),this._loadingEl.className="geocoder-icon geocoder-icon-loading",r.appendChild(this._clearEl),r.appendChild(this._loadingEl),e.appendChild(n),e.appendChild(this._inputEl),e.appendChild(r),this._typeahead=new i(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this._typeahead.getItemValue=function(t){return t.place_name},this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),e},onRemove:function(){return this.container.parentNode.removeChild(this.container),this._map=null,this.options.trackProximity&&this._map.off("moveend",this._updateProximity),this},_onKeyDown:o(function(t){var e=t.target.shadowRoot?t.target.shadowRoot.activeElement:t.target;if(!e.value)return this._clearEl.style.display="none";t.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(t.keyCode)||e.value.length>=this.options.minLength&&this._geocode(e.value)},200),_onChange:function(){this._inputEl.value&&(this._clearEl.style.display="block");var t=this._typeahead.selected;if(t){if(this.options.flyTo)if(!u[t.id]&&t.bbox){var e=t.bbox;this._map.fitBounds([[e[0],e[1]],[e[2],e[3]]])}else u[t.id]?this._map.fitBounds(u[t.id].bbox):this._map.flyTo({center:t.center,zoom:this.options.zoom});this._eventEmitter.emit("result",{result:t})}},_geocode:function(t){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t});var e=this.mapboxClient.geocodeForward(t,this.options),n=[];return this.options.localGeocoder&&((n=this.options.localGeocoder(t))||(n=[])),e.then(function(t){this._loadingEl.style.display="none";var e={};"200"==t.status&&(e=t.entity),e.features=e.features?n.concat(e.features):n,this.options.filter&&e.features.length&&(e.features=e.features.filter(this.options.filter)),e.features.length?this._clearEl.style.display="block":(this._clearEl.style.display="none",this._typeahead.selected=null),this._eventEmitter.emit("results",e),this._typeahead.update(e.features)}.bind(this)),e.catch(function(t){this._loadingEl.style.display="none",n.length?this._clearEl.style.display="block":(this._clearEl.style.display="none",this._typeahead.selected=null),this._eventEmitter.emit("results",{features:n}),this._typeahead.update(n),this._eventEmitter.emit("error",{error:t})}.bind(this)),e},_clear:function(t){t&&t.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._inputEl.focus(),this._clearEl.style.display="none",this._eventEmitter.emit("clear")},_onQueryResult:function(t){var e=t.entity;if(e.features.length){var n=e.features[0];this._typeahead.selected=n,this._inputEl.value=n.place_name,this._onChange()}},_updateProximity:function(){if(this._map.getZoom()>9){var t=this._map.getCenter().wrap();this.setProximity({longitude:t.lng,latitude:t.lat})}else this.setProximity(null)},query:function(t){return this._geocode(t).then(this._onQueryResult),this},setInput:function(t){return this._inputEl.value=t,this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this},setProximity:function(t){return this.options.proximity=t,this},getProximity:function(){return this.options.proximity},on:function(t,e){return this._eventEmitter.on(t,e),this},off:function(t,e){return this._eventEmitter.removeListener(t,e),this}},e.exports=r},{"./exceptions":1,events:3,"lodash.debounce":11,"mapbox/lib/services/geocoding":19,suggestions:51,xtend:55}],3:[function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function s(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!o(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,o,u,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(n=this._events[t],a(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(s(n))for(o=Array.prototype.slice.call(arguments,1),l=n.slice(),r=l.length,u=0;u<r;u++)l[u].apply(this,o);return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?s(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,s(this._events[t])&&!this._events[t].warned&&(n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,a;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(s(n)){for(a=o;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){r=a;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],4:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(h===setTimeout)return setTimeout(t,0);if((h===r||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function s(t){if(f===clearTimeout)return clearTimeout(t);if((f===i||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function a(){v&&d&&(v=!1,d.length?m=d.concat(m):y=-1,m.length&&u())}function u(){if(!v){var t=o(a);v=!0;for(var e=m.length;e;){for(d=m,m=[];++y<e;)d&&d[y].run();y=-1,e=m.length}d=null,v=!1,s(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}var h,f,p=e.exports={};!function(){try{h="function"==typeof setTimeout?setTimeout:r}catch(t){h=r}try{f="function"==typeof clearTimeout?clearTimeout:i}catch(t){f=i}}();var d,m=[],v=!1,y=-1;p.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];m.push(new l(t,e)),1!==m.length||v||o(u)},l.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(t){return[]},p.binding=function(t){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(t){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}],5:[function(e,n,r){(function(e){!function(i){function o(t){throw new RangeError(I[t])}function s(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function a(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(S,"."),r+s(t.split("."),e).join(".")}function u(t){for(var e,n,r=[],i=0,o=t.length;i<o;)e=t.charCodeAt(i++),e>=55296&&e<=56319&&i<o?(n=t.charCodeAt(i++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--)):r.push(e);return r}function l(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=R(t>>>10&1023|55296),t=56320|1023&t),e+=R(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:A}function h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,n){var r=0;for(t=n?D(t/k):t>>1,t+=D(t/e);t>U*C>>1;r+=A)t=D(t/U);return D(r+(U+1)*t/(t+j))}function p(t){var e,n,r,i,s,a,u,h,p,d,m=[],v=t.length,y=0,g=P,b=O;for(n=t.lastIndexOf(L),n<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&o("not-basic"),m.push(t.charCodeAt(r));for(i=n>0?n+1:0;i<v;){for(s=y,a=1,u=A;i>=v&&o("invalid-input"),h=c(t.charCodeAt(i++)),(h>=A||h>D((_-y)/a))&&o("overflow"),y+=h*a,p=u<=b?E:u>=b+C?C:u-b,!(h<p);u+=A)d=A-p,a>D(_/d)&&o("overflow"),a*=d;e=m.length+1,b=f(y-s,e,0==s),D(y/e)>_-g&&o("overflow"),g+=D(y/e),y%=e,m.splice(y++,0,g)}return l(m)}function d(t){var e,n,r,i,s,a,l,c,p,d,m,v,y,g,b,x=[];for(t=u(t),v=t.length,e=P,n=0,s=O,a=0;a<v;++a)(m=t[a])<128&&x.push(R(m));for(r=i=x.length,i&&x.push(L);r<v;){for(l=_,a=0;a<v;++a)(m=t[a])>=e&&m<l&&(l=m);for(y=r+1,l-e>D((_-n)/y)&&o("overflow"),n+=(l-e)*y,e=l,a=0;a<v;++a)if(m=t[a],m<e&&++n>_&&o("overflow"),m==e){for(c=n,p=A;d=p<=s?E:p>=s+C?C:p-s,!(c<d);p+=A)b=c-d,g=A-d,x.push(R(h(d+b%g,0))),c=D(b/g);x.push(R(h(c,0))),s=f(n,y,r==i),n=0,++r}++n,++e}return x.join("")}function m(t){return a(t,function(t){return T.test(t)?p(t.slice(4).toLowerCase()):t})}function v(t){return a(t,function(t){return q.test(t)?"xn--"+d(t):t})}var y="object"==typeof r&&r&&!r.nodeType&&r,g="object"==typeof n&&n&&!n.nodeType&&n,b="object"==typeof e&&e;b.global!==b&&b.window!==b&&b.self!==b||(i=b);var x,w,_=2147483647,A=36,E=1,C=26,j=38,k=700,O=72,P=128,L="-",T=/^xn--/,q=/[^\x20-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},U=A-E,D=Math.floor,R=String.fromCharCode;if(x={version:"1.4.1",ucs2:{decode:u,encode:l},decode:p,encode:d,toASCII:v,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return x});else if(y&&g)if(n.exports==y)g.exports=x;else for(w in x)x.hasOwnProperty(w)&&(y[w]=x[w]);else i.punycode=x}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,n,o){e=e||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var l=t.length;u>0&&l>u&&(l=u);for(var c=0;c<l;++c){var h,f,p,d,m=t[c].replace(a,"%20"),v=m.indexOf(n);v>=0?(h=m.substr(0,v),f=m.substr(v+1)):(h=m,f=""),p=decodeURIComponent(h),d=decodeURIComponent(f),r(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],7:[function(t,e,n){"use strict";function r(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,n,a){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?r(s(t),function(s){var a=encodeURIComponent(i(s))+n;return o(t[s])?r(t[s],function(t){return a+encodeURIComponent(i(t))}).join(e):a+encodeURIComponent(i(t[s]))}).join(e):a?encodeURIComponent(i(a))+n+encodeURIComponent(i(t)):""};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},{}],8:[function(t,e,n){"use strict";n.decode=n.parse=t("./decode"),n.encode=n.stringify=t("./encode")},{"./decode":6,"./encode":7}],9:[function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,n){if(t&&l.isObject(t)&&t instanceof r)return t;var i=new r;return i.parse(t,e,n),i}function o(t){return l.isString(t)&&(t=i(t)),t instanceof r?t.format():r.prototype.format.call(t)}function s(t,e){return i(t,!1,!0).resolve(e)}function a(t,e){return t?i(t,!1,!0).resolveObject(e):e}var u=t("punycode"),l=t("./util");n.parse=i,n.resolve=s,n.resolveObject=a,n.format=o,n.Url=r;var c=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(p),m=["'"].concat(d),v=["%","/","?",";","#"].concat(m),y=["/","?","#"],g=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,x={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=t("querystring");r.prototype.parse=function(t,e,n){if(!l.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),i=-1!==r&&r<t.indexOf("#")?"?":"#",o=t.split(i),s=/\\/g;o[0]=o[0].replace(s,"/"),t=o.join(i);var a=t;if(a=a.trim(),!n&&1===t.split("#").length){var h=f.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],this.query=e?A.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var p=c.exec(a);if(p){p=p[0];var d=p.toLowerCase();this.protocol=d,a=a.substr(p.length)}if(n||p||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var E="//"===a.substr(0,2);!E||p&&w[p]||(a=a.substr(2),this.slashes=!0)}if(!w[p]&&(E||p&&!_[p])){for(var C=-1,j=0;j<y.length;j++){var k=a.indexOf(y[j]);-1!==k&&(-1===C||k<C)&&(C=k)}var O,P;P=-1===C?a.lastIndexOf("@"):a.lastIndexOf("@",C),-1!==P&&(O=a.slice(0,P),a=a.slice(P+1),this.auth=decodeURIComponent(O)),C=-1;for(var j=0;j<v.length;j++){var k=a.indexOf(v[j]);-1!==k&&(-1===C||k<C)&&(C=k)}-1===C&&(C=a.length),this.host=a.slice(0,C),a=a.slice(C),this.parseHost(),this.hostname=this.hostname||"";var L="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!L)for(var T=this.hostname.split(/\./),j=0,q=T.length;j<q;j++){var S=T[j];if(S&&!S.match(g)){for(var I="",U=0,D=S.length;U<D;U++)S.charCodeAt(U)>127?I+="x":I+=S[U];if(!I.match(g)){var R=T.slice(0,j),N=T.slice(j+1),F=S.match(b);F&&(R.push(F[1]),N.unshift(F[2])),N.length&&(a="/"+N.join(".")+a),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),L||(this.hostname=u.toASCII(this.hostname));var z=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+z,this.href+=this.host,L&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!x[d])for(var j=0,q=m.length;j<q;j++){var Q=m[j];if(-1!==a.indexOf(Q)){var H=encodeURIComponent(Q);H===Q&&(H=escape(Q)),a=a.split(Q).join(H)}}var K=a.indexOf("#");-1!==K&&(this.hash=a.substr(K),a=a.slice(0,K));var $=a.indexOf("?");if(-1!==$?(this.search=a.substr($),this.query=a.substr($+1),e&&(this.query=A.parse(this.query)),a=a.slice(0,$)):e&&(this.search="",this.query={}),a&&(this.pathname=a),_[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var z=this.pathname||"",B=this.search||"";this.path=z+B}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",i=!1,o="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&l.isObject(this.query)&&Object.keys(this.query).length&&(o=A.stringify(this.query));var s=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||_[e])&&!1!==i?(i="//"+(i||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):i||(i=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),s=s.replace("#","%23"),e+i+n+s+r},r.prototype.resolve=function(t){return this.resolveObject(i(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(l.isString(t)){var e=new r;e.parse(t,!1,!0),t=e}for(var n=new r,i=Object.keys(this),o=0;o<i.length;o++){var s=i[o];n[s]=this[s]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),u=0;u<a.length;u++){var c=a[u];"protocol"!==c&&(n[c]=t[c])}return _[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!_[t.protocol]){for(var h=Object.keys(t),f=0;f<h.length;f++){var p=h[f];n[p]=t[p]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||w[t.protocol])n.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var m=n.pathname||"",v=n.search||"";n.path=m+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var y=n.pathname&&"/"===n.pathname.charAt(0),g=t.host||t.pathname&&"/"===t.pathname.charAt(0),b=g||y||n.host&&t.pathname,x=b,A=n.pathname&&n.pathname.split("/")||[],d=t.pathname&&t.pathname.split("/")||[],E=n.protocol&&!_[n.protocol];if(E&&(n.hostname="",n.port=null,n.host&&(""===A[0]?A[0]=n.host:A.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),b=b&&(""===d[0]||""===A[0])),g)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,A=d;else if(d.length)A||(A=[]),A.pop(),A=A.concat(d),n.search=t.search,n.query=t.query;else if(!l.isNullOrUndefined(t.search)){if(E){n.hostname=n.host=A.shift();var C=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");C&&(n.auth=C.shift(),n.host=n.hostname=C.shift())}return n.search=t.search,n.query=t.query,l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!A.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var j=A.slice(-1)[0],k=(n.host||t.host||A.length>1)&&("."===j||".."===j)||""===j,O=0,P=A.length;P>=0;P--)j=A[P],"."===j?A.splice(P,1):".."===j?(A.splice(P,1),O++):O&&(A.splice(P,1),O--);if(!b&&!x)for(;O--;O)A.unshift("..");!b||""===A[0]||A[0]&&"/"===A[0].charAt(0)||A.unshift(""),k&&"/"!==A.join("/").substr(-1)&&A.push("");var L=""===A[0]||A[0]&&"/"===A[0].charAt(0);if(E){n.hostname=n.host=L?"":A.length?A.shift():"";var C=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");C&&(n.auth=C.shift(),n.host=n.hostname=C.shift())}return b=b||n.host&&A.length,b&&!L&&A.unshift(""),A.length?n.pathname=A.join("/"):(n.pathname=null,n.path=null),l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":10,punycode:5,querystring:8}],10:[function(t,e,n){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],11:[function(t,e,n){(function(t){function n(t,e,n){function i(e){var n=m,r=v;return m=v=void 0,E=e,g=t.apply(r,n)}function o(t){return E=t,b=setTimeout(c,e),C?i(t):g}function u(t){var n=t-A,r=t-E,i=e-n;return j?w(i,y-r):i}function l(t){var n=t-A,r=t-E;return void 0===A||n>=e||n<0||j&&r>=y}function c(){var t=_();if(l(t))return h(t);b=setTimeout(c,u(t))}function h(t){return b=void 0,k&&m?i(t):(m=v=void 0,g)}function f(){void 0!==b&&clearTimeout(b),E=0,m=A=v=b=void 0}function p(){return void 0===b?g:h(_())}function d(){var t=_(),n=l(t);if(m=arguments,v=this,A=t,n){if(void 0===b)return o(A);if(j)return b=setTimeout(c,e),i(A)}return void 0===b&&(b=setTimeout(c,e)),g}var m,v,y,g,b,A,E=0,C=!1,j=!1,k=!0;if("function"!=typeof t)throw new TypeError(a);return e=s(e)||0,r(n)&&(C=!!n.leading,j="maxWait"in n,y=j?x(s(n.maxWait)||0,e):y,k="trailing"in n?!!n.trailing:k),d.cancel=f,d.flush=p,d}function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function i(t){return!!t&&"object"==typeof t}function o(t){return"symbol"==typeof t||i(t)&&b.call(t)==l}function s(t){if("number"==typeof t)return t;if(o(t))return u;if(r(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=r(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(c,"");var n=f.test(t);return n||p.test(t)?d(t.slice(2),n?2:8):h.test(t)?u:+t}var a="Expected a function",u=NaN,l="[object Symbol]",c=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,p=/^0o[0-7]+$/i,d=parseInt,m="object"==typeof t&&t&&t.Object===Object&&t,v="object"==typeof self&&self&&self.Object===Object&&self,y=m||v||Function("return this")(),g=Object.prototype,b=g.toString,x=Math.max,w=Math.min,_=function(){return y.Date.now()};e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],12:[function(t,e,n){"use strict";t("./promise");var r=t("rest/interceptor"),i=r({success:function(t){var e=t&&t.callback;return"function"==typeof e&&e(null,t.entity,t),t},error:function(t){var e=t&&t.callback;if("function"==typeof e){var n=t.error||t.entity;"object"!=typeof n&&(n=new Error(n)),e(n)}return t}});e.exports=i},{"./promise":18,"rest/interceptor":27}],13:[function(t,e,n){"use strict";t("./promise");var r=t("rest");e.exports=function(e){return r.wrap(t("rest/interceptor/errorCode")).wrap(t("rest/interceptor/pathPrefix"),{prefix:e.endpoint}).wrap(t("rest/interceptor/mime"),{mime:"application/json"}).wrap(t("rest/interceptor/template")).wrap(t("rest/interceptor/defaultRequest"),{params:{access_token:e.accessToken}}).wrap(t("./paginator"),{access_token:e.accessToken}).wrap(t("./standard_response")).wrap(t("./callbackify"))}},{"./callbackify":12,"./paginator":17,"./promise":18,"./standard_response":20,rest:23,"rest/interceptor/defaultRequest":28,"rest/interceptor/errorCode":29,"rest/interceptor/mime":30,"rest/interceptor/pathPrefix":31,"rest/interceptor/template":32}],14:[function(t,e,n){e.exports.DEFAULT_ENDPOINT="https://api.mapbox.com"},{}],15:[function(t,e,n){"use strict";function r(t){var e=t.split(".")[1];if(!e)return null;e=e.replace(/-/g,"+").replace(/_/g,"/");var n=e.length%4;if(2===n&&(e+="=="),3===n&&(e+="="),1===n||n>3)return null;try{return JSON.parse(i.decode(e)).u}catch(t){return null}}var i=t("rest/util/base64");e.exports=r},{"rest/util/base64":42}],16:[function(t,e,n){"use strict";function r(t){function e(e,n){this.name=t,i("string"==typeof e,"accessToken required to instantiate Mapbox client");var r=o.DEFAULT_ENDPOINT;void 0!==n&&(i("object"==typeof n,"options must be an object"),n.endpoint&&(i("string"==typeof n.endpoint,"endpoint must be a string"),r=n.endpoint),n.account&&(i("string"==typeof n.account,"account must be a string"),this.owner=n.account)),this.client=s({endpoint:r,accessToken:e}),this.accessToken=e,this.endpoint=r,this.owner=this.owner||a(e),i(!!this.owner,"could not determine account from provided accessToken")}return e}var i=t("../vendor/invariant"),o=t("./constants"),s=t("./client"),a=t("./get_user");e.exports=r},{"../vendor/invariant":50,"./client":13,"./constants":14,"./get_user":15}],17:[function(t,e,n){"use strict";t("./promise");var r=t("rest/interceptor"),i=t("rest/parsers/rfc5988"),o=t("url"),s=t("querystring"),a=r({success:function(t,e){var n=t&&t.headers&&t.headers.Link,r=t&&t.request&&t.request.originator;if(n){var a=i.parse(n).filter(function(t){return"next"===t.rel})[0];a&&(t.nextPage=function(t){var n=o.parse(a.href),i=s.parse(n.query);return i.access_token=i.access_token||e.access_token,n.search=s.stringify(i),r({path:o.format(n),callback:t})})}return t}});e.exports=a},{"./promise":18,querystring:8,"rest/interceptor":27,"rest/parsers/rfc5988":40,url:9}],18:[function(t,e,n){"use strict";"undefined"==typeof Promise&&t("es6-promise").polyfill(),e.export=Promise},{"es6-promise":21}],19:[function(t,e,n){"use strict";function r(t,e){var n=Math.pow(10,e);return Math.round(t*n)/n}var i=t("../../vendor/invariant"),o=t("../make_service"),s=o("MapboxGeocoding");s.prototype.geocodeForward=function(t,e,n){if(void 0===n&&"function"==typeof e&&(n=e,e={}),Array.isArray(t)){if("mapbox.places-permanent"!==e.dataset)throw new Error("Batch geocoding is only available with the mapbox.places-permanent endpoint. See https://mapbox.com/api-documentation/#batch-requests for details");t=t.join(";")}i("string"==typeof t,"query must be a string"),i("object"==typeof e,"options must be an object");var o={query:t,dataset:"mapbox.places"},s=3;return e.precision&&(i("number"==typeof e.precision,"precision option must be number"),s=e.precision),e.proximity&&(i("number"==typeof e.proximity.latitude&&"number"==typeof e.proximity.longitude,"proximity must be an object with numeric latitude & longitude properties"),o.proximity=r(e.proximity.longitude,s)+","+r(e.proximity.latitude,s)),e.bbox&&(i("number"==typeof e.bbox[0]&&"number"==typeof e.bbox[1]&&"number"==typeof e.bbox[2]&&"number"==typeof e.bbox[3]&&4===e.bbox.length,"bbox must be an array with numeric values in the form [minX, minY, maxX, maxY]"),o.bbox=e.bbox[0]+","+e.bbox[1]+","+e.bbox[2]+","+e.bbox[3]),e.limit&&(i("number"==typeof e.limit,"limit must be a number"),o.limit=e.limit),e.dataset&&(i("string"==typeof e.dataset,"dataset option must be string"),o.dataset=e.dataset),e.country&&(i("string"==typeof e.country,"country option must be string"),o.country=e.country),e.language&&(i("string"==typeof e.language,"language option must be string"),o.language=e.language),e.types&&(i("string"==typeof e.types,"types option must be string"),o.types=e.types),"boolean"==typeof e.autocomplete&&(i("boolean"==typeof e.autocomplete,"autocomplete must be a boolean"),o.autocomplete=e.autocomplete),this.client({path:"/geocoding/v5/{dataset}/{query}.json{?access_token,proximity,country,types,bbox,limit,autocomplete,language}",params:o,callback:n})},s.prototype.geocodeReverse=function(t,e,n){void 0===n&&"function"==typeof e&&(n=e,e={}),i("object"==typeof t,"location must be an object"),i("object"==typeof e,"options must be an object"),i("number"==typeof t.latitude&&"number"==typeof t.longitude,"location must be an object with numeric latitude & longitude properties");var o={dataset:"mapbox.places"};e.dataset&&(i("string"==typeof e.dataset,"dataset option must be string"),o.dataset=e.dataset);var s=5;return e.precision&&(i("number"==typeof e.precision,"precision option must be number"),s=e.precision),e.language&&(i("string"==typeof e.language,"language option must be string"),o.language=e.language),e.types&&(i("string"==typeof e.types,"types option must be string"),o.types=e.types),e.limit&&(i("number"==typeof e.limit,"limit option must be a number"),i(1===e.types.split(",").length,"a single type must be specified to use the limit option"),o.limit=e.limit),o.longitude=r(t.longitude,s),o.latitude=r(t.latitude,s),this.client({path:"/geocoding/v5/{dataset}/{longitude},{latitude}.json{?access_token,types,limit,language}",params:o,callback:n})},e.exports=s},{"../../vendor/invariant":50,"../make_service":16}],20:[function(t,e,n){function r(t){return{url:t.url,status:t.status&&t.status.code,headers:t.headers,entity:t.entity,error:t.error,callback:t.request&&t.request.callback,nextPage:t.nextPage}}var i=t("rest/interceptor"),o=i({response:r});e.exports=o},{"rest/interceptor":27}],21:[function(e,n,r){(function(i,o){!function(e,i){"object"==typeof r&&void 0!==n?n.exports=i():"function"==typeof t&&t.amd?t(i):e.ES6Promise=i()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function n(t){return"function"==typeof t}function r(t){Q=t}function s(t){H=t} -function a(){return void 0!==M?function(){M(l)}:u()}function u(){var t=setTimeout;return function(){return t(l,1)}}function l(){for(var t=0;t<z;t+=2){(0,Y[t])(Y[t+1]),Y[t]=void 0,Y[t+1]=void 0}z=0}function c(t,e){var n=this,r=new this.constructor(f);void 0===r[J]&&L(r);var i=n._state;if(i){var o=arguments[i-1];H(function(){return k(i,r,o,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(f);return x(n,t),n}function f(){}function p(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function m(t){try{return t.then}catch(t){return et.error=t,et}}function v(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}function y(t,e,n){H(function(t){var r=!1,i=v(n,e,function(n){r||(r=!0,e!==n?x(t,n):_(t,n))},function(e){r||(r=!0,A(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,A(t,i))},t)}function g(t,e){e._state===X?_(t,e._result):e._state===tt?A(t,e._result):E(e,void 0,function(e){return x(t,e)},function(e){return A(t,e)})}function b(t,e,r){e.constructor===t.constructor&&r===c&&e.constructor.resolve===h?g(t,e):r===et?(A(t,et.error),et.error=null):void 0===r?_(t,e):n(r)?y(t,e,r):_(t,e)}function x(e,n){e===n?A(e,p()):t(n)?b(e,n,m(n)):_(e,n)}function w(t){t._onerror&&t._onerror(t._result),C(t)}function _(t,e){t._state===W&&(t._result=e,t._state=X,0!==t._subscribers.length&&H(C,t))}function A(t,e){t._state===W&&(t._state=tt,t._result=e,H(w,t))}function E(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+X]=n,i[o+tt]=r,0===o&&t._state&&H(C,t)}function C(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,i=void 0,o=t._result,s=0;s<e.length;s+=3)r=e[s],i=e[s+n],r?k(n,r,i,o):i(o);t._subscribers.length=0}}function j(t,e){try{return t(e)}catch(t){return et.error=t,et}}function k(t,e,r,i){var o=n(r),s=void 0,a=void 0,u=void 0,l=void 0;if(o){if(s=j(r,i),s===et?(l=!0,a=s.error,s.error=null):u=!0,e===s)return void A(e,d())}else s=i,u=!0;e._state!==W||(o&&u?x(e,s):l?A(e,a):t===X?_(e,s):t===tt&&A(e,s))}function O(t,e){try{e(function(e){x(t,e)},function(e){A(t,e)})}catch(e){A(t,e)}}function P(){return nt++}function L(t){t[J]=nt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function T(){return new Error("Array Methods must be provided an Array")}function q(t){return new rt(this,t).promise}function S(t){var e=this;return new e(F(t)?function(n,r){for(var i=t.length,o=0;o<i;o++)e.resolve(t[o]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function I(t){var e=this,n=new e(f);return A(n,t),n}function U(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function D(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function R(){var t=void 0;if(void 0!==o)t=o;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=it}var N=void 0;N=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var F=N,z=0,M=void 0,Q=void 0,H=function(t,e){Y[z]=t,Y[z+1]=e,2===(z+=2)&&(Q?Q(l):Z())},K="undefined"!=typeof window?window:void 0,$=K||{},B=$.MutationObserver||$.WebKitMutationObserver,V="undefined"==typeof self&&void 0!==i&&"[object process]"==={}.toString.call(i),G="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Y=new Array(1e3),Z=void 0;Z=V?function(){return function(){return i.nextTick(l)}}():B?function(){var t=0,e=new B(l),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}():G?function(){var t=new MessageChannel;return t.port1.onmessage=l,function(){return t.port2.postMessage(0)}}():void 0===K&&"function"==typeof e?function(){try{var t=Function("return this")().require("vertx");return M=t.runOnLoop||t.runOnContext,a()}catch(t){return u()}}():u();var J=Math.random().toString(36).substring(2),W=void 0,X=1,tt=2,et={error:null},nt=0,rt=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(f),this.promise[J]||L(this.promise),F(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?_(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&_(this.promise,this._result))):A(this.promise,T())}return t.prototype._enumerate=function(t){for(var e=0;this._state===W&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var i=m(t);if(i===c&&t._state!==W)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===it){var o=new n(f);b(o,t,i),this._willSettleAt(o,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===W&&(this._remaining--,t===tt?A(r,n):this._result[e]=n),0===this._remaining&&_(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(X,e,t)},function(t){return n._settledAt(tt,e,t)})},t}(),it=function(){function t(e){this[J]=P(),this._result=this._state=void 0,this._subscribers=[],f!==e&&("function"!=typeof e&&U(),this instanceof t?O(this,e):D())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this,n=e.constructor;return e.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})})},t}();return it.prototype.then=c,it.all=q,it.race=S,it.resolve=h,it.reject=I,it._setScheduler=r,it._setAsap=s,it._asap=H,it.polyfill=R,it.Promise=it,it})}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:4}],22:[function(t,e,n){"use strict";function r(t,e){var n,r,i,o,s;if(n=t,i={},e){for(r in e)s=new RegExp("\\{"+r+"\\}"),s.test(n)?n=n.replace(s,encodeURIComponent(e[r]),"g"):i[r]=e[r];o=a.write(i),o&&(n+=-1===n.indexOf("?")?"?":"&",n+=o)}return n}function i(t,e){return 0===t.indexOf(e)}function o(t,e){if(!(this instanceof o))return new o(t,e);t instanceof o?(this._template=t.template,this._params=s({},this._params,e)):(this._template=(t||"").toString(),this._params=e||{})}var s,a,u,l,c,h;s=t("./util/mixin"),a=t("./mime/type/application/x-www-form-urlencoded"),l=/([a-z][a-z0-9\+\-\.]*:)\/\/([^@]+@)?(([^:\/]+)(:([0-9]+))?)?(\/[^?#]*)?(\?[^#]*)?(#\S*)?/i,c=/^([a-z][a-z0-9\-\+\.]*:\/\/|\/)/i,h=/([a-z][a-z0-9\+\-\.]*:)\/\/([^@]+@)?(([^:\/]+)(:([0-9]+))?)?\//i,o.prototype={append:function(t,e){return new o(this._template+t,s({},this._params,e))},fullyQualify:function(){if("undefined"==typeof location)return this;if(this.isFullyQualified())return this;var t=this._template;return i(t,"//")?t=u.protocol+t:i(t,"/")?t=u.origin+t:this.isAbsolute()||(t=u.origin+u.pathname.substring(0,u.pathname.lastIndexOf("/")+1)),-1===t.indexOf("/",8)&&(t+="/"),new o(t,this._params)},isAbsolute:function(){return c.test(this.build())},isFullyQualified:function(){return h.test(this.build())},isCrossOrigin:function(){if(!u)return!0;var t=this.parts();return t.protocol!==u.protocol||t.hostname!==u.hostname||t.port!==u.port},parts:function(){var t,e;return t=this.fullyQualify().build().match(l),e={href:t[0],protocol:t[1],host:t[3]||"",hostname:t[4]||"",port:t[6],pathname:t[7]||"",search:t[8]||"",hash:t[9]||""},e.origin=e.protocol+"//"+e.host,e.port=e.port||("https:"===e.protocol?"443":"http:"===e.protocol?"80":""),e},build:function(t){return r(this._template,s({},this._params,t))},toString:function(){return this.build()}},u="undefined"!=typeof location?new o(location.href).parts():void 0,e.exports=o},{"./mime/type/application/x-www-form-urlencoded":37,"./util/mixin":45}],23:[function(t,e,n){"use strict";var r=t("./client/default"),i=t("./client/xhr");r.setPlatformDefaultClient(i),e.exports=r},{"./client/default":25,"./client/xhr":26}],24:[function(t,e,n){"use strict";e.exports=function(t,e){return e&&(t.skip=function(){return e}),t.wrap=function(e,n){return e(t,n)},t.chain=function(){return"undefined"!=typeof console&&console.log("rest.js: client.chain() is deprecated, use client.wrap() instead"),t.wrap.apply(this,arguments)},t}},{}],25:[function(t,e,n){"use strict";function r(){return o.apply(void 0,arguments)}var i,o,s;i=t("../client"),"function"!=typeof Promise&&console&&console.log&&console.log("An ES6 Promise implementation is required to use rest.js. See https://github.com/cujojs/when/blob/master/docs/es6-promise-shim.md for using when.js as a Promise polyfill."),r.setDefaultClient=function(t){o=t},r.getDefaultClient=function(){return o},r.resetDefaultClient=function(){o=s},r.setPlatformDefaultClient=function(t){if(s)throw new Error("Unable to redefine platformDefaultClient");o=s=t},e.exports=i(r)},{"../client":24}],26:[function(t,e,n){"use strict";function r(t){var e={};return t?(t.trim().split(u).forEach(function(t){var n,r,i;n=t.indexOf(":"),r=o(t.substring(0,n).trim()),i=t.substring(n+1).trim(),e[r]?Array.isArray(e[r])?e[r].push(i):e[r]=[e[r],i]:e[r]=i}),e):e}function i(t,e){return Object.keys(e||{}).forEach(function(n){if(e.hasOwnProperty(n)&&n in t)try{t[n]=e[n]}catch(t){}}),t}var o,s,a,u;o=t("../util/normalizeHeaderName"),s=t("../util/responsePromise"),a=t("../client"),u=/[\r|\n]+/,e.exports=a(function(t){return s.promise(function(e,n){var o,s,a,u,l,c,h,f;if(t="string"==typeof t?{path:t}:t||{},h={request:t},t.canceled)return h.error="precanceled",void n(h);if(!(f=t.engine||XMLHttpRequest))return void n({request:t,error:"xhr-not-available"});l=t.entity,t.method=t.method||(l?"POST":"GET"),s=t.method,a=h.url=t.path||"";try{o=h.raw=new f,i(o,t.mixin),o.open(s,a,!0),i(o,t.mixin),u=t.headers;for(c in u)"Content-Type"===c&&"multipart/form-data"===u[c]||o.setRequestHeader(c,u[c]);t.canceled=!1,t.cancel=function(){t.canceled=!0,o.abort(),n(h)},o.onreadystatechange=function(){t.canceled||o.readyState===(f.DONE||4)&&(h.status={code:o.status,text:o.statusText},h.headers=r(o.getAllResponseHeaders()),h.entity=o.responseText,1223===h.status.code&&(h.status.code=204),h.status.code>0?e(h):setTimeout(function(){e(h)},0))};try{o.onerror=function(){h.error="loaderror",n(h)}}catch(t){}o.send(l)}catch(t){h.error="loaderror",n(h)}})})},{"../client":24,"../util/normalizeHeaderName":46,"../util/responsePromise":47}],27:[function(t,e,n){"use strict";function r(t){return t}function i(t){return t}function o(t){return t}function s(t){if(!(this instanceof s))return new s(t);l(this,t)}function a(t){var e,n,a,l;return t=t||{},e=t.init||r,n=t.request||i,a=t.success||t.response||o,l=t.error||function(){return Promise.resolve((t.response||o).apply(this,arguments)).then(Promise.reject.bind(Promise))},function(r,i){function o(t){var e,u;return e={},u={arguments:Array.prototype.slice.call(arguments),client:o},t="string"==typeof t?{path:t}:t||{},t.originator=t.originator||o,c(n.call(e,t,i,u),function(t){var n,o,c;return c=r,t instanceof s&&(o=t.abort,c=t.client||c,n=t.response,t=t.request),n=n||Promise.resolve(t).then(function(t){return Promise.resolve(c(t)).then(function(t){return a.call(e,t,i,u)},function(t){return l.call(e,t,i,u)})}),o?Promise.race([n,o]):n},function(e){return Promise.reject({request:t,error:e})})}return"object"==typeof r&&(i=r),"function"!=typeof r&&(r=t.client||u),i=e(i||{}),h(o,r)}}var u,l,c,h;u=t("./client/default"),l=t("./util/mixin"),c=t("./util/responsePromise"),h=t("./client"),a.ComplexRequest=s,e.exports=a},{"./client":24,"./client/default":25,"./util/mixin":45,"./util/responsePromise":47}],28:[function(t,e,n){"use strict";var r,i,o;r=t("../interceptor"),i=t("../util/mixin"),o=function(){function t(t,e,n){(t in e||t in n)&&(e[t]=i({},n[t],e[t]))}function e(t,e,n){t in n&&!(t in e)&&(e[t]=n[t])}var n={method:e,path:e,params:t,headers:t,entity:e,mixin:t};return function(t,e){for(var r in n)n[r](r,t,e);return t}}(),e.exports=r({request:function(t,e){return o(t,e)}})},{"../interceptor":27,"../util/mixin":45}],29:[function(t,e,n){"use strict";var r;r=t("../interceptor"),e.exports=r({init:function(t){return t.code=t.code||400,t},response:function(t,e){return t.status&&t.status.code>=e.code?Promise.reject(t):t}})},{"../interceptor":27}],30:[function(t,e,n){"use strict";var r,i,o,s,a,u;r=t("../interceptor"),i=t("../mime"),o=t("../mime/registry"),u=t("../util/attempt"),s={read:function(t){return t},write:function(t){return t}},a={read:function(){throw"No read method found on converter"},write:function(){throw"No write method found on converter"}},e.exports=r({init:function(t){return t.registry=t.registry||o,t},request:function(t,e){var n,r;return r=t.headers||(t.headers={}),n=i.parse(r["Content-Type"]||e.mime||"text/plain"),r.Accept=r.Accept||e.accept||n.raw+", application/json;q=0.8, text/plain;q=0.5, */*;q=0.2","entity"in t?(r["Content-Type"]=n.raw,e.registry.lookup(n).catch(function(){if(e.permissive)return s;throw"mime-unknown"}).then(function(r){var i=e.client||t.originator,o=r.write||a.write;return u(o.bind(void 0,t.entity,{client:i,request:t,mime:n,registry:e.registry})).catch(function(){throw"mime-serialization"}).then(function(e){return t.entity=e,t})})):t},response:function(t,e){if(!(t.headers&&t.headers["Content-Type"]&&t.entity))return t;var n=i.parse(t.headers["Content-Type"]);return e.registry.lookup(n).catch(function(){return s}).then(function(r){var i=e.client||t.request&&t.request.originator,o=r.read||a.read;return u(o.bind(void 0,t.entity,{client:i,response:t,mime:n,registry:e.registry})).catch(function(e){throw t.error="mime-deserialization",t.cause=e,t}).then(function(e){return t.entity=e,t})})}})},{"../interceptor":27,"../mime":33,"../mime/registry":34,"../util/attempt":41}],31:[function(t,e,n){"use strict";function r(t,e){return 0===t.indexOf(e)}function i(t,e){return t.lastIndexOf(e)+e.length===t.length}var o,s;o=t("../interceptor"),s=t("../UrlBuilder"),e.exports=o({request:function(t,e){var n;return e.prefix&&!new s(t.path).isFullyQualified()&&(n=e.prefix,t.path&&(i(n,"/")||r(t.path,"/")||(n+="/"),n+=t.path),t.path=n),t}})},{"../UrlBuilder":22,"../interceptor":27}],32:[function(t,e,n){"use strict";var r,i,o;r=t("../interceptor"),i=t("../util/uriTemplate"),o=t("../util/mixin"),e.exports=r({init:function(t){return t.params=t.params||{},t.template=t.template||"",t},request:function(t,e){var n,r;return n=t.path||e.template,r=o({},t.params,e.params),t.path=i.expand(n,r),delete t.params,t}})},{"../interceptor":27,"../util/mixin":45,"../util/uriTemplate":49}],33:[function(t,e,n){"use strict";function r(t){var e,n;return e=t.split(";"),n=e[0].trim().split("+"),{raw:t,type:n[0],suffix:n[1]?"+"+n[1]:"",params:e.slice(1).reduce(function(t,e){return e=e.split("="),t[e[0].trim()]=e[1]?e[1].trim():void 0,t},{})}}e.exports={parse:r}},{}],34:[function(t,e,n){"use strict";function r(t){this.lookup=function(e){var n;return n="string"==typeof e?i.parse(e):e,t[n.raw]?t[n.raw]:t[n.type+n.suffix]?t[n.type+n.suffix]:t[n.type]?t[n.type]:t[n.suffix]?t[n.suffix]:Promise.reject(new Error('Unable to locate converter for mime "'+n.raw+'"'))},this.delegate=function(t){return{read:function(){var e=arguments;return this.lookup(t).then(function(t){return t.read.apply(this,e)}.bind(this))}.bind(this),write:function(){var e=arguments;return this.lookup(t).then(function(t){return t.write.apply(this,e)}.bind(this))}.bind(this)}},this.register=function(e,n){return t[e]=Promise.resolve(n),t[e]},this.child=function(){return new r(Object.create(t))}}var i,o;i=t("../mime"),o=new r({}),o.register("application/hal",t("./type/application/hal")),o.register("application/json",t("./type/application/json")),o.register("application/x-www-form-urlencoded",t("./type/application/x-www-form-urlencoded")),o.register("multipart/form-data",t("./type/multipart/form-data")),o.register("text/plain",t("./type/text/plain")),o.register("+json",o.delegate("application/json")),e.exports=o},{"../mime":33,"./type/application/hal":35,"./type/application/json":36,"./type/application/x-www-form-urlencoded":37,"./type/multipart/form-data":38,"./type/text/plain":39}],35:[function(t,e,n){"use strict";function r(t,e,n){Object.defineProperty(t,e,{value:n,configurable:!0,enumerable:!1,writeable:!0})}var i,o,s,a,u;i=t("../../../interceptor/pathPrefix"),o=t("../../../interceptor/template"),s=t("../../../util/find"),a=t("../../../util/lazyPromise"),u=t("../../../util/responsePromise"),e.exports={read:function(t,e){function n(t,e){(e&&c&&c.warn||c.log)&&(c.warn||c.log).call(c,"Relationship '"+t+"' is deprecated, see "+e)}var l,c;return e=e||{},l=e.client,c=e.console||c,e.registry.lookup(e.mime.suffix).then(function(n){return n.read(t,e)}).then(function(t){return s.findProperties(t,"_embedded",function(t,e,n){Object.keys(t).forEach(function(n){if(!(n in e)){var i=u({entity:t[n]});r(e,n,i)}}),r(e,n,t)}),s.findProperties(t,"_links",function(t,e,s){Object.keys(t).forEach(function(i){var s=t[i];i in e||r(e,i,u.make(a(function(){return s.deprecation&&n(i,s.deprecation),!0===s.templated?o(l)({path:s.href}):l({path:s.href})})))}),r(e,s,t),r(e,"clientFor",function(e,r){var s=t[e];if(!s)throw new Error("Unknown relationship: "+e);return s.deprecation&&n(e,s.deprecation),!0===s.templated?o(r||l,{template:s.href}):i(r||l,{prefix:s.href})}),r(e,"requestFor",function(t,e,n){return this.clientFor(t,n)(e)})}),t})},write:function(t,e){return e.registry.lookup(e.mime.suffix).then(function(n){return n.write(t,e)})}}},{"../../../interceptor/pathPrefix":31,"../../../interceptor/template":32,"../../../util/find":43,"../../../util/lazyPromise":44,"../../../util/responsePromise":47}],36:[function(t,e,n){"use strict";function r(t,e){return{read:function(e){return JSON.parse(e,t)},write:function(t){return JSON.stringify(t,e)},extend:r}}e.exports=r()},{}],37:[function(t,e,n){"use strict";function r(t){return t=encodeURIComponent(t),t.replace(s,"+")}function i(t){return t=t.replace(a," "),decodeURIComponent(t)}function o(t,e,n){return Array.isArray(n)?n.forEach(function(n){t=o(t,e,n)}):(t.length>0&&(t+="&"),t+=r(e),void 0!==n&&null!==n&&(t+="="+r(n))),t}var s,a;s=/%20/g,a=/\+/g,e.exports={read:function(t){var e={};return t.split("&").forEach(function(t){var n,r,o;n=t.split("="),r=i(n[0]),o=2===n.length?i(n[1]):null,r in e?(Array.isArray(e[r])||(e[r]=[e[r]]),e[r].push(o)):e[r]=o}),e},write:function(t){var e="";return Object.keys(t).forEach(function(n){e=o(e,n,t[n])}),e}}},{}],38:[function(t,e,n){"use strict";function r(t){return t&&1===t.nodeType&&"FORM"===t.tagName}function i(t){var e,n=new FormData;for(var r in t)t.hasOwnProperty(r)&&(e=t[r],e instanceof File?n.append(r,e,e.name):e instanceof Blob?n.append(r,e):n.append(r,String(e)));return n}e.exports={write:function(t){if("undefined"==typeof FormData)throw new Error("The multipart/form-data mime serializer requires FormData support");if(t instanceof FormData)return t;if(r(t))return new FormData(t);if("object"==typeof t&&null!==t)return i(t);throw new Error("Unable to create FormData from object "+t)}}},{}],39:[function(t,e,n){"use strict";e.exports={read:function(t){return t},write:function(t){return t.toString()}}},{}],40:[function(t,e,n){e.exports=function(){function t(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var e={parse:function(e,n){function r(t){j<O||(j>O&&(O=j,P=[]),P.push(t))}function i(){var t,n,i,s,a,u,l,c,h;for(u=j,l=j,t=[],c=j,h=j,n=o(),null!==n?(i=p(),null!==i?(44===e.charCodeAt(j)?(s=",",j++):(s=null,0===k&&r('","')),null!==s?(a=p(),null!==a?n=[n,i,s,a]:(n=null,j=h)):(n=null,j=h)):(n=null,j=h)):(n=null,j=h),null!==n&&(n=function(t,e){return e}(0,n[0])),null===n&&(j=c);null!==n;)t.push(n),c=j,h=j,n=o(),null!==n?(i=p(),null!==i?(44===e.charCodeAt(j)?(s=",",j++):(s=null,0===k&&r('","')),null!==s?(a=p(),null!==a?n=[n,i,s,a]:(n=null,j=h)):(n=null,j=h)):(n=null,j=h)):(n=null,j=h),null!==n&&(n=function(t,e){return e}(0,n[0])),null===n&&(j=c);return null!==t?(n=o(),null!==n?t=[t,n]:(t=null,j=l)):(t=null,j=l),null!==t&&(t=function(t,e,n){return e.concat([n])}(0,t[0],t[1])),null===t&&(j=u),t}function o(){var t,n,i,o,u,l,c,h;if(c=j,h=j,60===e.charCodeAt(j)?(t="<",j++):(t=null,0===k&&r('"<"')),null!==t)if(null!==(n=a()))if(62===e.charCodeAt(j)?(i=">",j++):(i=null,0===k&&r('">"')),null!==i)if(null!==(o=p())){for(u=[],l=s();null!==l;)u.push(l),l=s();null!==u?t=[t,n,i,o,u]:(t=null,j=h)}else t=null,j=h;else t=null,j=h;else t=null,j=h;else t=null,j=h;return null!==t&&(t=function(t,e,n){var r={};return n.forEach(function(t){r[t[0]]=t[1]}),r.href=e,r}(0,t[1],t[4])),null===t&&(j=c),t}function s(){var t,n,i,o,s,a;return s=j,a=j,59===e.charCodeAt(j)?(t=";",j++):(t=null,0===k&&r('";"')),null!==t?(n=p(),null!==n?(i=u(),null!==i?(o=p(),null!==o?t=[t,n,i,o]:(t=null,j=a)):(t=null,j=a)):(t=null,j=a)):(t=null,j=a),null!==t&&(t=function(t,e){return e}(0,t[2])),null===t&&(j=s),t}function a(){var t,n,i;if(i=j,/^[^>]/.test(e.charAt(j))?(n=e.charAt(j),j++):(n=null,0===k&&r("[^>]")),null!==n)for(t=[];null!==n;)t.push(n),/^[^>]/.test(e.charAt(j))?(n=e.charAt(j),j++):(n=null,0===k&&r("[^>]"));else t=null;return null!==t&&(t=function(t,e){return e.join("")}(0,t)),null===t&&(j=i),t}function u(){var t,e,n,r;return n=j,r=j,t=l(),null!==t?(e=c(),e=null!==e?e:"",null!==e?t=[t,e]:(t=null,j=r)):(t=null,j=r),null!==t&&(t=function(t,e,n){return[e,n]}(0,t[0],t[1])),null===t&&(j=n),t}function l(){var t,n,i;if(i=j,/^[a-z]/.test(e.charAt(j))?(n=e.charAt(j),j++):(n=null,0===k&&r("[a-z]")),null!==n)for(t=[];null!==n;)t.push(n),/^[a-z]/.test(e.charAt(j))?(n=e.charAt(j),j++):(n=null,0===k&&r("[a-z]"));else t=null;return null!==t&&(t=function(t,e){return e.join("")}(0,t)),null===t&&(j=i),t}function c(){var t,n,i,o;return i=j,o=j,61===e.charCodeAt(j)?(t="=",j++):(t=null,0===k&&r('"="')),null!==t?(n=h(),null===n&&(n=d()),null!==n?t=[t,n]:(t=null,j=o)):(t=null,j=o),null!==t&&(t=function(t,e){return e}(0,t[1])),null===t&&(j=i),t}function h(){var t,e,n;if(n=j,null!==(e=f()))for(t=[];null!==e;)t.push(e),e=f();else t=null;return null!==t&&(t=function(t,e){return e.join("")}(0,t)),null===t&&(j=n),t}function f(){var t;return 33===e.charCodeAt(j)?(t="!",j++):(t=null,0===k&&r('"!"')),null===t&&(35===e.charCodeAt(j)?(t="#",j++):(t=null,0===k&&r('"#"')),null===t&&(36===e.charCodeAt(j)?(t="$",j++):(t=null,0===k&&r('"$"')),null===t&&(37===e.charCodeAt(j)?(t="%",j++):(t=null,0===k&&r('"%"')),null===t&&(38===e.charCodeAt(j)?(t="&",j++):(t=null,0===k&&r('"&"')),null===t&&(39===e.charCodeAt(j)?(t="'",j++):(t=null,0===k&&r('"\'"')),null===t&&(40===e.charCodeAt(j)?(t="(",j++):(t=null,0===k&&r('"("')),null===t&&(41===e.charCodeAt(j)?(t=")",j++):(t=null,0===k&&r('")"')),null===t&&(42===e.charCodeAt(j)?(t="*",j++):(t=null,0===k&&r('"*"')),null===t&&(43===e.charCodeAt(j)?(t="+",j++):(t=null,0===k&&r('"+"')),null===t&&(45===e.charCodeAt(j)?(t="-",j++):(t=null,0===k&&r('"-"')),null===t&&(46===e.charCodeAt(j)?(t=".",j++):(t=null,0===k&&r('"."')),null===t&&(124===e.charCodeAt(j)?(t="|",j++):(t=null,0===k&&r('"|"')),null===t&&null===(t=x())&&(58===e.charCodeAt(j)?(t=":",j++):(t=null,0===k&&r('":"')),null===t&&(60===e.charCodeAt(j)?(t="<",j++):(t=null,0===k&&r('"<"')),null===t&&(61===e.charCodeAt(j)?(t="=",j++):(t=null,0===k&&r('"="')),null===t&&(62===e.charCodeAt(j)?(t=">",j++):(t=null,0===k&&r('">"')),null===t&&(63===e.charCodeAt(j)?(t="?",j++):(t=null,0===k&&r('"?"')),null===t&&(64===e.charCodeAt(j)?(t="@",j++):(t=null,0===k&&r('"@"')),null===t&&null===(t=b())&&(91===e.charCodeAt(j)?(t="[",j++):(t=null,0===k&&r('"["')),null===t&&(93===e.charCodeAt(j)?(t="]",j++):(t=null,0===k&&r('"]"')),null===t&&(94===e.charCodeAt(j)?(t="^",j++):(t=null,0===k&&r('"^"')),null===t&&(95===e.charCodeAt(j)?(t="_",j++):(t=null,0===k&&r('"_"')),null===t&&(96===e.charCodeAt(j)?(t="`",j++):(t=null,0===k&&r('"`"')),null===t&&(123===e.charCodeAt(j)?(t="{",j++):(t=null,0===k&&r('"{"')),null===t&&(/^[\/\/]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r("[\\/\\/]")),null===t&&(125===e.charCodeAt(j)?(t="}",j++):(t=null,0===k&&r('"}"')),null===t&&(126===e.charCodeAt(j)?(t="~",j++):(t=null,0===k&&r('"~"'))))))))))))))))))))))))))))),t}function p(){var t,e;for(t=[],e=w();null!==e;)t.push(e),e=w();return t}function d(){var t,e,n,r,i;return r=j,i=j,t=_(),null!==t?(e=m(),null!==e?(n=_(),null!==n?t=[t,e,n]:(t=null,j=i)):(t=null,j=i)):(t=null,j=i),null!==t&&(t=function(t,e){return e}(0,t[1])),null===t&&(j=r),t}function m(){var t,e,n;for(n=j,t=[],e=A(),null===e&&(e=E());null!==e;)t.push(e),null===(e=A())&&(e=E());return null!==t&&(t=function(t,e){return e.join("")}(0,t)),null===t&&(j=n),t}function v(){var t;return/^[\0-]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r("[\\0-]")),t}function y(){var t;return/^[A-Z]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r("[A-Z]")),t}function g(){var t;return/^[a-z]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r("[a-z]")),t}function b(){var t;return t=y(),null===t&&(t=g()),t}function x(){var t;return/^[0-9]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r("[0-9]")),t}function w(){var t;return/^[ ]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r("[ ]")),t}function _(){var t;return/^["]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r('["]')),t}function A(){var t;return/^[^"]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r('[^"]')),t}function E(){var t,n,i;return i=j,/^[\\]/.test(e.charAt(j))?(t=e.charAt(j),j++):(t=null,0===k&&r("[\\\\]")),null!==t?(n=v(),null!==n?t=[t,n]:(t=null,j=i)):(t=null,j=i),t}var C={start:i,LinkValue:o,LinkParams:s,URIReference:a,LinkParam:u,LinkParamName:l,LinkParamValue:c,PToken:h,PTokenChar:f,OptionalSP:p,QuotedString:d,QuotedStringInternal:m,Char:v,UpAlpha:y,LoAlpha:g,Alpha:b,Digit:x,SP:w,DQ:_,QDText:A,QuotedPair:E};if(void 0!==n){if(void 0===C[n])throw new Error("Invalid rule name: "+t(n)+".")}else n="start";var j=0,k=0,O=0,P=[],L=C[n]();if(null===L||j!==e.length){var T=Math.max(j,O),q=T<e.length?e.charAt(T):null,S=function(){for(var t=1,n=1,r=!1,i=0;i<Math.max(j,O);i++){var o=e.charAt(i);"\n"===o?(r||t++,n=1,r=!1):"\r"===o||"\u2028"===o||"\u2029"===o?(t++,n=1,r=!0):(n++,r=!1)}return{line:t,column:n}}();throw new this.SyntaxError(function(t){t.sort();for(var e=null,n=[],r=0;r<t.length;r++)t[r]!==e&&(n.push(t[r]),e=t[r]);return n}(P),q,T,S.line,S.column)}return L},toSource:function(){return this._source}};return e.SyntaxError=function(e,n,r,i,o){this.name="SyntaxError",this.expected=e,this.found=n,this.message=function(e,n){var r,i;switch(e.length){case 0:r="end of input";break;case 1:r=e[0];break;default:r=e.slice(0,e.length-1).join(", ")+" or "+e[e.length-1]}return i=n?t(n):"end of input","Expected "+r+" but "+i+" found."}(e,n),this.offset=r,this.line=i,this.column=o},e.SyntaxError.prototype=Error.prototype,e}()},{}],41:[function(t,e,n){"use strict";function r(t){try{return Promise.resolve(t())}catch(t){return Promise.reject(t)}}e.exports=r},{}],42:[function(t,e,n){"use strict";function r(t){if(/([^\u0000-\u00ff])/.test(t))throw new Error("Can't base64 encode non-ASCII characters.");for(var e,n,r,i=0,s=[];i<t.length;){switch(e=t.charCodeAt(i),r=i%3){case 0:s.push(o.charAt(e>>2));break;case 1:s.push(o.charAt((3&n)<<4|e>>4));break;case 2:s.push(o.charAt((15&n)<<2|e>>6)),s.push(o.charAt(63&e))}n=e,i+=1}return 0===r?(s.push(o.charAt((3&n)<<4)),s.push("==")):1===r&&(s.push(o.charAt((15&n)<<2)),s.push("=")),s.join("")}function i(t){if(t=t.replace(/\s/g,""),!/^[a-z0-9\+\/\s]+\={0,2}$/i.test(t)||t.length%4>0)throw new Error("Not a base64-encoded string.");var e,n,r=0,i=[];for(t=t.replace(/\=/g,"");r<t.length;){switch(e=o.indexOf(t.charAt(r)),r%4){case 1:i.push(String.fromCharCode(n<<2|e>>4));break;case 2:i.push(String.fromCharCode((15&n)<<4|e>>2));break;case 3:i.push(String.fromCharCode((3&n)<<6|e))}n=e,r+=1}return i.join("")}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";e.exports={encode:r,decode:i}},{}],43:[function(t,e,n){"use strict";e.exports={findProperties:function t(e,n,r){"object"==typeof e&&null!==e&&(n in e&&r(e[n],e,n),Object.keys(e).forEach(function(i){t(e[i],n,r)}))}}},{}],44:[function(t,e,n){"use strict";function r(t){var e,n,r,o;return e=!1,r=new Promise(function(t,e){n={resolve:t,reject:e}}),o=r.then,r.then=function(){return e||(e=!0,i(t).then(n.resolve,n.reject)),o.apply(r,arguments)},r}var i=t("./attempt");e.exports=r},{"./attempt":41}],45:[function(t,e,n){"use strict";function r(t){var e,n,r,o;for(t||(t={}),e=1,n=arguments.length;e<n;e+=1){r=arguments[e];for(o in r)o in t&&(t[o]===r[o]||o in i&&i[o]===r[o])||(t[o]=r[o])}return t}var i={};e.exports=r},{}],46:[function(t,e,n){"use strict";function r(t){return t.toLowerCase().split("-").map(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}).join("-")}e.exports=r},{}],47:[function(t,e,n){"use strict";function r(t,e){return t.then(function(t){return t&&t[e]},function(t){return Promise.reject(t&&t[e])})}function i(){return r(this,"entity")}function o(){return r(r(this,"status"),"code")}function s(){return r(this,"headers")}function a(t){return t=h(t),r(this.headers(),t)}function u(t){return t=[].concat(t),l(t.reduce(function(t,e){return t.then(function(t){if("string"==typeof e&&(e={rel:e}),"function"!=typeof t.entity.clientFor)throw new Error("Hypermedia response expected");return t.entity.clientFor(e.rel)({params:e.params})})},this))}function l(t){return t.status=o,t.headers=s,t.header=a,t.entity=i,t.follow=u,t}function c(t,e,n){return l(Promise.resolve(t).then(e,n))}var h=t("./normalizeHeaderName");c.make=l,c.reject=function(t){return l(Promise.reject(t))},c.promise=function(t){return l(new Promise(t))},e.exports=c},{"./normalizeHeaderName":46}],48:[function(t,e,n){"use strict";function r(t,e){if("string"!=typeof t)throw new Error("String required for URL encoding");return t.split("").map(function(t){if(e.hasOwnProperty(t))return t;var n=t.charCodeAt(0);if(n<=127){var r=n.toString(16).toUpperCase();return"%"+(r.length%2==1?"0":"")+r}return encodeURIComponent(t).toUpperCase()}).join("")}function i(t){return t=t||s.unreserved,function(e){return r(e,t)}}function o(t){return decodeURIComponent(t)}var s;s=function(){var t={alpha:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",digit:"0123456789"};return t.genDelims=":/?#[]@",t.subDelims="!$&'()*+,;=",t.reserved=t.genDelims+t.subDelims,t.unreserved=t.alpha+t.digit+"-._~",t.url=t.reserved+t.unreserved,t.scheme=t.alpha+t.digit+"+-.",t.userinfo=t.unreserved+t.subDelims+":",t.host=t.unreserved+t.subDelims,t.port=t.digit,t.pchar=t.unreserved+t.subDelims+":@",t.segment=t.pchar,t.path=t.segment+"/",t.query=t.pchar+"/?",t.fragment=t.pchar+"/?",Object.keys(t).reduce(function(e,n){return e[n]=t[n].split("").reduce(function(t,e){return t[e]=!0,t},{}),e},{})}(),e.exports={decode:o,encode:i(),encodeURL:i(s.url),encodeScheme:i(s.scheme),encodeUserInfo:i(s.userinfo),encodeHost:i(s.host),encodePort:i(s.port),encodePathSegment:i(s.segment),encodePath:i(s.path),encodeQuery:i(s.query),encodeFragment:i(s.fragment)}},{}],49:[function(t,e,n){"use strict";function r(t,e,n){return e.split(",").reduce(function(e,r){var i,o;if(i={},"*"===r.slice(-1)&&(r=r.slice(0,-1),i.explode=!0),u.test(r)){var a=u.exec(r);r=a[1],i.maxLength=parseInt(a[2])}return r=s.decode(r),void 0===(o=n[r])||null===o?e:(Array.isArray(o)?e=o.reduce(function(e,n){return e.length?(e+=i.explode?t.separator:",",t.named&&i.explode&&(e+=t.encoder(r),e+=n.length?"=":t.empty)):(e+=t.first, -t.named&&(e+=t.encoder(r),e+=n.length?"=":t.empty)),e+=t.encoder(n)},e):"object"==typeof o?e=Object.keys(o).reduce(function(e,n){return e.length?e+=i.explode?t.separator:",":(e+=t.first,t.named&&!i.explode&&(e+=t.encoder(r),e+=o[n].length?"=":t.empty)),e+=t.encoder(n),e+=i.explode?"=":",",e+=t.encoder(o[n])},e):(o=String(o),i.maxLength&&(o=o.slice(0,i.maxLength)),e+=e.length?t.separator:t.first,t.named&&(e+=t.encoder(r),e+=o.length?"=":t.empty),e+=t.encoder(o)),e)},"")}function i(t,e){var n;if(n=a[t.slice(0,1)],n?t=t.slice(1):n=a[""],n.reserved)throw new Error("Reserved expression operations are not supported");return r(n,t,e)}function o(t,e){var n,r,o;for(o="",r=0;;){if(-1===(n=t.indexOf("{",r))){o+=t.slice(r);break}o+=t.slice(r,n),r=t.indexOf("}",n)+1,o+=i(t.slice(n+1,r-1),e)}return o}var s,a,u;s=t("./uriEncoder"),u=/^([^:]*):([0-9]+)$/,a={"":{first:"",separator:",",named:!1,empty:"",encoder:s.encode},"+":{first:"",separator:",",named:!1,empty:"",encoder:s.encodeURL},"#":{first:"#",separator:",",named:!1,empty:"",encoder:s.encodeURL},".":{first:".",separator:".",named:!1,empty:"",encoder:s.encode},"/":{first:"/",separator:"/",named:!1,empty:"",encoder:s.encode},";":{first:";",separator:";",named:!0,empty:"",encoder:s.encode},"?":{first:"?",separator:"&",named:!0,empty:"=",encoder:s.encode},"&":{first:"&",separator:"&",named:!0,empty:"=",encoder:s.encode},"=":{reserved:!0},",":{reserved:!0},"!":{reserved:!0},"@":{reserved:!0},"|":{reserved:!0}},e.exports={expand:o}},{"./uriEncoder":48}],50:[function(t,e,n){(function(t){"use strict";var n=t.env.NODE_ENV,r=function(t,e,r,i,o,s,a,u){if("production"!==n&&void 0===e)throw new Error("invariant requires an error message argument");if(!t){var l;if(void 0===e)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,i,o,s,a,u],h=0;l=new Error(e.replace(/%s/g,function(){return c[h++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}};e.exports=r}).call(this,t("_process"))},{_process:4}],51:[function(t,e,n){"use strict";var r=t("./src/suggestions");window.Suggestions=e.exports=r},{"./src/suggestions":54}],52:[function(t,e,n){!function(){var t=this,r={};void 0!==n?e.exports=r:t.fuzzy=r,r.simpleFilter=function(t,e){return e.filter(function(e){return r.test(t,e)})},r.test=function(t,e){return null!==r.match(t,e)},r.match=function(t,e,n){n=n||{};var r,i=0,o=[],s=e.length,a=0,u=0,l=n.pre||"",c=n.post||"",h=n.caseSensitive&&e||e.toLowerCase();t=n.caseSensitive&&t||t.toLowerCase();for(var f=0;f<s;f++)r=e[f],h[f]===t[i]?(r=l+r+c,i+=1,u+=1+u):u=0,a+=u,o[o.length]=r;return i===t.length?(a=h===t?1/0:a,{rendered:o.join(""),score:a}):null},r.filter=function(t,e,n){return e&&0!==e.length?"string"!=typeof t?e:(n=n||{},e.reduce(function(e,i,o,s){var a=i;n.extract&&(a=n.extract(i));var u=r.match(t,a,n);return null!=u&&(e[e.length]={string:u.rendered,score:u.score,index:o,original:i}),e},[]).sort(function(t,e){var n=e.score-t.score;return n||t.index-e.index})):[]}}()},{}],53:[function(t,e,n){"Use strict";var r=function(t){return this.component=t,this.items=[],this.active=0,this.element=document.createElement("ul"),this.element.className="suggestions",this.selectingListItem=!1,t.el.parentNode.insertBefore(this.element,t.el.nextSibling),this};r.prototype.show=function(){this.element.style.display="block"},r.prototype.hide=function(){this.element.style.display="none"},r.prototype.add=function(t){this.items.push(t)},r.prototype.clear=function(){this.items=[],this.active=0},r.prototype.isEmpty=function(){return!this.items.length},r.prototype.draw=function(){if(this.element.innerHTML="",0===this.items.length)return void this.hide();for(var t=0;t<this.items.length;t++)this.drawItem(this.items[t],this.active===t);this.show()},r.prototype.drawItem=function(t,e){var n=document.createElement("li"),r=document.createElement("a");e&&(n.className+=" active"),r.innerHTML=t.string,n.appendChild(r),this.element.appendChild(n),n.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),n.addEventListener("mouseup",function(){this.handleMouseUp.call(this,t)}.bind(this))},r.prototype.handleMouseUp=function(t){this.selectingListItem=!1,this.component.value(t.original),this.clear(),this.draw()},r.prototype.move=function(t){this.active=t,this.draw()},r.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)},r.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},e.exports=r},{}],54:[function(t,e,n){"use strict";var r=t("xtend"),i=t("fuzzy"),o=t("./list"),s=function(t,e,n){return n=n||{},this.options=r({minLength:2,limit:5,filter:!0},n),this.el=t,this.data=e||[],this.list=new o(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(t){this.handleKeyUp(t.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(t){this.handleKeyDown(t)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(t){this.handlePaste(t)}.bind(this)),this};s.prototype.handleKeyUp=function(t){40!==t&&38!==t&&27!==t&&13!==t&&9!==t&&this.handleInputChange(this.el.value)},s.prototype.handleKeyDown=function(t){switch(t.keyCode){case 13:case 9:t.preventDefault(),this.list.isEmpty()||(this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},s.prototype.handleBlur=function(){this.list.selectingListItem||this.list.hide()},s.prototype.handlePaste=function(t){if(t.clipboardData)this.handleInputChange(t.clipboardData.getData("Text"));else{var e=this;setTimeout(function(){e.handleInputChange(t.target.value)},100)}},s.prototype.handleInputChange=function(t){if(this.query=this.normalize(t),this.list.clear(),this.query.length<this.options.minLength)return void this.list.draw();this.getCandidates(function(t){for(var e=0;e<t.length&&(this.list.add(t[e]),e!==this.options.limit-1);e++);this.list.draw()}.bind(this))},s.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},s.prototype.update=function(t){this.data=t,this.handleKeyUp()},s.prototype.clear=function(){this.data=[],this.list.clear()},s.prototype.normalize=function(t){return t=t.toLowerCase()},s.prototype.match=function(t,e){return t.indexOf(e)>-1},s.prototype.value=function(t){if(this.selected=t,this.el.value=this.getItemValue(t),document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")},s.prototype.getCandidates=function(t){var e={pre:"<strong>",post:"</strong>",extract:function(t){return this.getItemValue(t)}.bind(this)};t(this.options.filter?i.filter(this.query,this.data,e):this.data.map(function(t){for(var e=this.getItemValue(t),n=this.normalize(e),r=n.lastIndexOf(this.query);r>-1;){var i=r+this.query.length;e=e.slice(0,r)+"<strong>"+e.slice(r,i)+"</strong>"+e.slice(i),r=n.slice(0,r).lastIndexOf(this.query)}return{original:t,string:e}}.bind(this)))},s.prototype.getItemValue=function(t){return t},e.exports=s},{"./list":53,fuzzy:52,xtend:55}],55:[function(t,e,n){function r(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var r in n)i.call(n,r)&&(t[r]=n[r])}return t}e.exports=r;var i=Object.prototype.hasOwnProperty},{}]},{},[2])(2)}); +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.MapboxGeocoder=t()}}(function(){var t;return function(){function t(e,n,r){function i(o,a){if(!n[o]){if(!e[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:{}};e[o][0].call(c.exports,function(t){return i(e[o][1][t]||t)},c,c.exports,t,e,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}return t}()({1:[function(t,e,n){"use strict";function r(t){this.origin=t.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=t.accessToken,this.version="0.2.0",this.sessionID=this.generateSessionID(),this.userAgent=this.getUserAgent(),this.options=t,this.send=this.send.bind(this),this.countries=t.countries?t.countries.split(","):null,this.types=t.types?t.types.split(","):null,this.bbox=t.bbox?t.bbox:null,this.language=t.language?t.language.split(","):null,this.limit=t.limit?+t.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(t),this.eventQueue=new Array,this.flushInterval=t.flushInterval||1e3,this.maxQueueSize=t.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}var i=t("nanoid");r.prototype={select:function(t,e){var n=this.getSelectedIndex(t,e),r=this.getEventPayload("search.select",e);if(r.resultIndex=n,r.resultPlaceName=t.place_name,r.resultId=t.id,(n!==this.lastSentIndex||r.queryString!==this.lastSentInput)&&-1!=n&&(this.lastSentIndex=n,this.lastSentInput=r.queryString,r.queryString))return this.push(r)},start:function(t){var e=this.getEventPayload("search.start",t);if(e.queryString)return this.push(e)},keyevent:function(t,e){if(t.key&&!t.metaKey&&-1===[9,27,37,39,13,38,40].indexOf(t.keyCode)){var n=this.getEventPayload("search.keystroke",e);if(n.lastAction=t.key,n.queryString)return this.push(n)}},send:function(t,e){if(this.enableEventLogging){var n=this.getRequestOptions(t);this.request(n,function(t){return t?this.handleError(t,e):e?e():void 0}.bind(this))}else if(e)return e()},getRequestOptions:function(t){return Array.isArray(t)||(t=[t]),{method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}},getEventPayload:function(t,e){var n;n=e.options.proximity?[e.options.proximity.longitude,e.options.proximity.latitude]:null;var r=e._map?e._map.getZoom():null;return{event:t,created:+new Date,sessionIdentifier:this.sessionID,country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",proximity:n,limit:e.options.limit,queryString:e._inputEl?e._inputEl.value:e.inputString,mapZoom:r,keyboardLocale:this.locale}},request:function(t,e){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4==this.readyState)return e(204==this.status?null:this.statusText)},n.open(t.method,t.host+"/"+t.path,!0);for(var r in t.headers){var i=t.headers[r];n.setRequestHeader(r,i)}n.send(t.body)},handleError:function(t,e){if(e)return e(t)},generateSessionID:function(){return i()},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(t,e){if(e._typeahead){var n=e._typeahead.data,r=t.id;return n.map(function(t){return t.id}).indexOf(r)}},shouldEnableLogging:function(t){return!1!==t.enableEventLogging&&((!t.origin||-1!=t.origin.indexOf("api.mapbox.com"))&&(!t.localGeocoder&&!t.filter))},flush:function(){this.eventQueue.length>0&&(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(t,e){this.eventQueue.push(t),(this.eventQueue.length>=this.maxQueueSize||e)&&this.flush()},remove:function(){this.flush()}},e.exports=r},{nanoid:30}],2:[function(t,e,n){e.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(t,e,n){"use strict";function r(t){this._eventEmitter=new u,this.options=a({},this.options,t),this.inputString="",this.fresh=!0,this.lastSelected=null}var i,s=t("suggestions"),o=t("lodash.debounce"),a=t("xtend"),u=t("events").EventEmitter,l=t("./exceptions"),c=t("@mapbox/mapbox-sdk"),h=t("@mapbox/mapbox-sdk/services/geocoding"),p=t("./events"),f=t("./localization"),d=t("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,getItemValue:function(t){return t.place_name},render:function(t){var e=t.place_name.split(",");return'<div class="geocoder-suggestion"><div class="geocoder-suggestion-title">'+e[0]+'</div><div class="geocoder-suggestion-address">'+e.splice(1,e.length).join(",")+"</div></div>"}},onAdd:function(t){this._map=t,this.setLanguage(),i=h(c({accessToken:this.options.accessToken,origin:this.options.origin})),this.eventManager=new p(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.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);var e=this.container=document.createElement("div");e.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var n=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",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._inputEl.addEventListener("blur",this._collapse)),this._inputEl.addEventListener("keydown",o(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(t){this.eventManager.keyevent(t,this)}.bind(this));var r=document.createElement("div");r.classList.add("geocoder-pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear);var a=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');return this._clearEl.appendChild(a),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),r.appendChild(this._clearEl),r.appendChild(this._loadingEl),e.appendChild(n),e.appendChild(this._inputEl),e.appendChild(r),this._typeahead=new s(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),e},createIcon:function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("class","geocoder-icon geocoder-icon-"+t),n.setAttribute("viewBox","0 0 18 18"),n.setAttribute("xml:space","preserve"),n.setAttribute("width",18),n.setAttribute("height",18),n.innerHTML=e,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(t){var e=t.target&&t.target.shadowRoot?t.target.shadowRoot.activeElement:t.target;if(!(e?e.value:""))return this.fresh=!0,9!==t.keyCode&&this.clear(t),this._clearEl.style.display="none";t.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(t.keyCode)||e.value.length>=this.options.minLength&&this._geocode(e.value)},_showButton:function(){this._typeahead.selected&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onChange:function(){var t=this._typeahead.selected;if(t&&t.id!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(t.properties&&!l[t.properties.short_code]&&t.bbox){var n=t.bbox;e=a({},this.options.flyTo),this._map.fitBounds([[n[0],n[1]],[n[2],n[3]]],e)}else if(t.properties&&l[t.properties.short_code])e=a({},this.options.flyTo),this._map.fitBounds(l[t.properties.short_code].bbox,e);else{var r={zoom:this.options.zoom};e=a({},r,this.options.flyTo),e.center=t.center,this._map.flyTo(e)}}this.options.marker&&this._mapboxgl&&this._handleMarker(t),this._eventEmitter.emit("result",{result:t}),this.eventManager.select(t,this),this.lastSelected=t.id}},_geocode:function(t){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t}),this.inputString=t;var e,n=["bbox","limit","proximity","countries","types","language","reverseMode"],r=this,s=n.reduce(function(t,e){return r.options[e]&&(["countries","types","language"].indexOf(e)>-1?t[e]=r.options[e].split(/[\s,]+/):t[e]=r.options[e],"proximity"===e&&r.options[e]&&r.options[e].longitude&&r.options[e].latitude&&(t[e]=[r.options[e].longitude,r.options[e].latitude])),t},{});if(this.options.reverseGeocode&&/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(t)){var o=t.split(/[\s(,)?]+/).map(function(t){return parseFloat(t,10)}).reverse();s.types&&s.types[0],s=a(s,{query:o,limit:1}),e=i.reverseGeocode(s).send()}else s=a(s,{query:t}),e=i.forwardGeocode(s).send();var u=[];return this.options.localGeocoder&&((u=this.options.localGeocoder(t))||(u=[])),e.then(function(t){this._loadingEl.style.display="none";var e={};"200"==t.statusCode&&(e=t.body),e.features=e.features?u.concat(e.features):u,this.options.filter&&e.features.length&&(e.features=e.features.filter(this.options.filter)),e.features.length?this._clearEl.style.display="block":(this._clearEl.style.display="none",this._typeahead.selected=null),e.config=s,this.fresh&&(this.eventManager.start(this),this.fresh=!1),this._eventEmitter.emit("results",e),this._typeahead.update(e.features)}.bind(this)),e.catch(function(t){this._loadingEl.style.display="none",u.length?this._clearEl.style.display="block":(this._clearEl.style.display="none",this._typeahead.selected=null),this._eventEmitter.emit("results",{features:u}),this._typeahead.update(u),this._eventEmitter.emit("error",{error:t})}.bind(this)),e},clear:function(t){t&&t.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._inputEl.focus(),this._clearEl.style.display="none",this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},_onQueryResult:function(t){var e=t.body;if(e.features.length){var n=e.features[0];this._typeahead.selected=n,this._inputEl.value=n.place_name,this._onChange()}},_updateProximity:function(){if(this._map.getZoom()>9){var t=this._map.getCenter().wrap();this.setProximity({longitude:t.lng,latitude:t.lat})}else this.setProximity(null)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("geocoder-collapsed")},_unCollapse:function(){this.container.classList.remove("geocoder-collapsed")},query:function(t){return this._geocode(t).then(this._onQueryResult),this},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var t=this.options.language.split(",")[0],e=d.language(t),n=f.placeholder[e];if(n)return n}return"Search"},setInput:function(t){return this._inputEl.value=t,this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this},setProximity:function(t){return this.options.proximity=t,this},getProximity:function(){return this.options.proximity},setRenderFunction:function(t){return t&&"function"==typeof t&&(this._typeahead.render=t),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(t){var e=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=t||this.options.language||e,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(t){return this.options.zoom=t,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(t){return this.options.flyTo=t,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(t){return this.placeholder=t||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this},getBbox:function(){return this.options.bbox},setBbox:function(t){return this.options.bbox=t,this},getCountries:function(){return this.options.countries},setCountries:function(t){return this.options.countries=t,this},getTypes:function(){return this.options.types},setTypes:function(t){return this.options.types=t,this},getMinLength:function(){return this.options.minLength},setMinLength:function(t){return this.options.minLength=t,this._typeahead&&(this._typeahead.minLength=t),this},getLimit:function(){return this.options.limit},setLimit:function(t){return this.options.limit=t,this._typeahead&&(this._typeahead.options.limit=t),this},getFilter:function(){return this.options.filter},setFilter:function(t){return this.options.filter=t,this},_handleMarker:function(t){this._removeMarker();var e={color:"#4668F2"},n=a({},e,this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(n),this.mapMarker.setLngLat(t.center).addTo(this._map),this},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(t,e){return this._eventEmitter.on(t,e),this},off:function(t,e){return this._eventEmitter.removeListener(t,e),this.eventManager.remove(),this}},e.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(t,e,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"};e.exports={placeholder:r}},{}],5:[function(t,e,n){"use strict";function r(t){var e=Array.isArray(t),n=function(n){return e?t[n]:t};return function(r){var s=i(v.plainArray,r);if(s)return s;if(e&&r.length!==t.length)return"an array with "+t.length+" items";for(var o=0;o<r.length;o++)if(s=i(n(o),r[o]))return[o].concat(s)}}function i(t,e){if(null!=e||t.hasOwnProperty("__required")){var n=t(e);return n?Array.isArray(n)?n:[n]:void 0}}function s(t,e){var n=t.length,r=t[n-1],i=t.slice(0,n-1);return 0===i.length&&(i=[d]),e=f(e,{path:i}),"function"==typeof r?r(e):l(e,a(r))}function o(t){return t.length<2?t[0]:2===t.length?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t.slice(-1)}function a(t){return"must be "+u(t)+"."}function u(t){return/^an? /.test(t)?t:/^[aeiou]/i.test(t)?"an "+t:/^[a-z]/i.test(t)?"a "+t:t}function l(t,e){var n=c(t.path),r=t.path.join(".")+" "+e;return(n?"Item at position ":"")+r}function c(t){return"number"==typeof t[t.length-1]||"number"==typeof t[0]}function h(t){return Object.keys(t||{}).map(function(e){return{key:e,value:t[e]}})}var p=t("is-plain-obj"),f=t("xtend"),d="value",v={};v.assert=function(t,e){return e=e||{},function(n){var r=i(t,n);if(r){var o=s(r,e);throw e.apiName&&(o=e.apiName+": "+o),new Error(o)}}},v.shape=function(t){var e=h(t);return function(t){var n=i(v.plainObject,t);if(n)return n;for(var r,o,a=[],u=0;u<e.length;u++)r=e[u].key,o=e[u].value,(n=i(o,t[r]))&&a.push([r].concat(n));return a.length<2?a[0]:function(t){a=a.map(function(e){return"- "+e[0]+": "+s(e,t).split("\n").join("\n ")});var e=t.path.join(".");return"The following properties"+(e===d?"":" of "+e)+" have invalid values:\n "+a.join("\n ")}}},v.strictShape=function(t){var e=v.shape(t);return function(n){var r=e(n);if(r)return r;var i=Object.keys(n).reduce(function(e,n){return void 0===t[n]&&e.push(n),e},[]);return 0!==i.length?function(){return"The following keys are invalid: "+i.join(", ")}:void 0}},v.arrayOf=function(t){return r(t)},v.tuple=function(){return r(Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments))},v.required=function(t){function e(e){return null==e?function(t){return l(t,c(t.path)?"cannot be undefined/null.":"is required.")}:t.apply(this,arguments)}return e.__required=!0,e},v.oneOfType=function(){var t=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return function(e){var n=t.map(function(t){return i(t,e)}).filter(Boolean);if(n.length===t.length)return n.every(function(t){return 1===t.length&&"string"==typeof t[0]})?o(n.map(function(t){return t[0]})):n.reduce(function(t,e){return e.length>t.length?e:t})}},v.equal=function(t){return function(e){if(e!==t)return JSON.stringify(t)}},v.oneOf=function(){var t=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments),e=t.map(function(t){return v.equal(t)});return v.oneOfType.apply(this,e)},v.range=function(t){var e=t[0],n=t[1];return function(t){if(i(v.number,t)||t<e||t>n)return"number between "+e+" & "+n+" (inclusive)"}},v.any=function(){},v.boolean=function(t){if("boolean"!=typeof t)return"boolean"},v.number=function(t){if("number"!=typeof t)return"number"},v.plainArray=function(t){if(!Array.isArray(t))return"array"},v.plainObject=function(t){if(!p(t))return"object"},v.string=function(t){if("string"!=typeof t)return"string"},v.func=function(t){if("function"!=typeof t)return"function"},v.validate=i,v.processMessage=s,e.exports=v},{"is-plain-obj":28,xtend:36}],6:[function(t,e,n){"use strict";var r=t("./lib/client");e.exports=r},{"./lib/client":7}],7:[function(t,e,n){"use strict";function r(t){o.call(this,t)}function i(t){return new r(t)}var s=t("./browser-layer"),o=t("../classes/mapi-client");r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.prototype.sendRequest=s.browserSend,r.prototype.abortRequest=s.browserAbort,e.exports=i},{"../classes/mapi-client":9,"./browser-layer":8}],8:[function(t,e,n){"use strict";function r(t){var e=f[t.id];e&&(e.abort(),delete f[t.id])}function i(t,e){return new l(t,{body:e.response,headers:p(e.getAllResponseHeaders()),statusCode:e.status})}function s(t){var e=t.total,n=t.loaded;return{total:e,transferred:n,percent:100*n/e}}function o(t,e){return new Promise(function(n,r){e.onprogress=function(e){t.emitter.emit(h.EVENT_PROGRESS_DOWNLOAD,s(e))};var i=t.file;i&&(e.upload.onprogress=function(e){t.emitter.emit(h.EVENT_PROGRESS_UPLOAD,s(e))}),e.onerror=function(t){r(t)},e.onabort=function(){var e=new c({request:t,type:h.ERROR_REQUEST_ABORTED});r(e)},e.onload=function(){if(delete f[t.id],e.status<200||e.status>=400){var i=new c({request:t,body:e.response,statusCode:e.status});return void r(i)}n(e)};var o=t.body;"string"==typeof o?e.send(o):o?e.send(JSON.stringify(o)):i?e.send(i):e.send(),f[t.id]=e}).then(function(e){return i(t,e)})}function a(t,e){var n=t.url(e),r=new window.XMLHttpRequest;return r.open(t.method,n),Object.keys(t.headers).forEach(function(e){r.setRequestHeader(e,t.headers[e])}),r}function u(t){return Promise.resolve().then(function(){var e=a(t,t.client.accessToken);return o(t,e)})}var l=t("../classes/mapi-response"),c=t("../classes/mapi-error"),h=t("../constants"),p=t("../helpers/parse-headers"),f={};e.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(t,e,n){"use strict";function r(t){if(!t||!t.accessToken)throw new Error("Cannot create a client without an access token");i(t.accessToken),this.accessToken=t.accessToken,this.origin=t.origin||o.API_ORIGIN}var i=t("@mapbox/parse-mapbox-token"),s=t("./mapi-request"),o=t("../constants");r.prototype.createRequest=function(t){return new s(this,t)},e.exports=r},{"../constants":13,"./mapi-request":11,"@mapbox/parse-mapbox-token":23}],10:[function(t,e,n){"use strict";function r(t){var e,n=t.type||i.ERROR_HTTP;if(t.body)try{e=JSON.parse(t.body)}catch(n){e=t.body}else e=null;var r=t.message||null;r||("string"==typeof e?r=e:e&&"string"==typeof e.message?r=e.message:n===i.ERROR_REQUEST_ABORTED&&(r="Request aborted")),this.message=r,this.type=n,this.statusCode=t.statusCode||null,this.request=t.request,this.body=e}var i=t("../constants");e.exports=r},{"../constants":13}],11:[function(t,e,n){"use strict";function r(t,e){if(!t)throw new Error("MapiRequest requires a client");if(!e||!e.path||!e.method)throw new Error("MapiRequest requires an options object with path and method properties");var n={};e.body&&(n["content-type"]="application/json");var r=s(n,e.headers),i=Object.keys(r).reduce(function(t,e){return t[e.toLowerCase()]=r[e],t},{});this.id=l++,this._options=e,this.emitter=new o,this.client=t,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=e.path,this.method=e.method,this.origin=e.origin||t.origin,this.query=e.query||{},this.params=e.params||{},this.body=e.body||null,this.file=e.file||null,this.headers=i}var i=t("@mapbox/parse-mapbox-token"),s=t("xtend"),o=t("eventemitter3"),a=t("../helpers/url-utils"),u=t("../constants"),l=1;r.prototype.url=function(t){var e=a.prependOrigin(this.path,this.origin);e=a.appendQueryObject(e,this.query);var n=this.params;if(t){e=a.appendQueryParam(e,"access_token",t);var r=i(t).user;n=s({ownerId:r},n)}return e=a.interpolateRouteParams(e,n),e},r.prototype.send=function(){var t=this;if(t.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return t.sent=!0,t.client.sendRequest(t).then(function(e){return t.response=e,t.emitter.emit(u.EVENT_RESPONSE,e),e},function(e){throw t.error=e,t.emitter.emit(u.EVENT_ERROR,e),e})},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(t){function e(e){function n(){delete i._nextPageRequest;var t=e.nextPage();t&&(i._nextPageRequest=t,r(t))}t(null,e,n)}function n(e){t(e,null,function(){})}function r(t){t.send().then(e,n)}var i=this;r(this)},r.prototype.clone=function(){return this._extend()},r.prototype._extend=function(t){var e=s(this._options,t);return new r(this.client,e)},e.exports=r},{"../constants":13,"../helpers/url-utils":16,"@mapbox/parse-mapbox-token":23,eventemitter3:26,xtend:36}],12:[function(t,e,n){"use strict";function r(t,e){this.request=t,this.headers=e.headers,this.rawBody=e.body,this.statusCode=e.statusCode;try{this.body=JSON.parse(e.body||"{}")}catch(t){this.body=e.body}this.links=i(this.headers.link)}var i=t("../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},e.exports=r},{"../helpers/parse-link-header":15}],13:[function(t,e,n){"use strict";e.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(t,e,n){"use strict";function r(t){var e=t.indexOf(":");return{name:t.substring(0,e).trim().toLowerCase(),value:t.substring(e+1).trim()}}function i(t){var e={};return t?(t.trim().split(/[\r|\n]+/).forEach(function(t){var n=r(t);e[n.name]=n.value}),e):e}e.exports=i},{}],15:[function(t,e,n){"use strict";function r(t){var e=t.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return e?{key:e[1],value:e[2]}:null}function i(t){var e=t.match(/<?([^>]*)>(.*)/);if(!e)return null;var n=e[1],i=e[2].split(";"),s=null,o=i.reduce(function(t,e){var n=r(e);return n?"rel"===n.key?(s||(s=n.value),t):(t[n.key]=n.value,t):t},{});return s?{url:n,rel:s,params:o}:null}function s(t){return t?t.split(/,\s*</).reduce(function(t,e){var n=i(e);return n?(n.rel.split(/\s+/).forEach(function(e){t[e]||(t[e]={url:n.url,params:n.params})}),t):t},{}):{}}e.exports=s},{}],16:[function(t,e,n){"use strict";function r(t){return t.map(encodeURIComponent).join(",")}function i(t){return Array.isArray(t)?r(t):encodeURIComponent(String(t))}function s(t,e,n){if(!1===n||null===n)return t;var r=/\?/.test(t)?"&":"?",s=encodeURIComponent(e);return void 0!==n&&""!==n&&!0!==n&&(s+="="+i(n)),""+t+r+s}function o(t,e){if(!e)return t;var n=t;return Object.keys(e).forEach(function(t){var r=e[t];void 0!==r&&(Array.isArray(r)&&(r=r.filter(function(t){return!!t}).join(",")),n=s(n,t,r))}),n}function a(t,e){if(!e)return t;if("http"===t.slice(0,4))return t;var n="/"===t[0]?"":"/";return""+e.replace(/\/$/,"")+n+t}function u(t,e){return e?t.replace(/\/:([a-zA-Z0-9]+)/g,function(t,n){var r=e[n];if(void 0===r)throw new Error("Unspecified route parameter "+n);return"/"+i(r)}):t}e.exports={appendQueryObject:o,appendQueryParam:s,prependOrigin:a,interpolateRouteParams:u}},{}],17:[function(t,e,n){"use strict";var r=t("xtend"),i=t("./service-helpers/validator"),s=t("./service-helpers/pick"),o=t("./service-helpers/stringify-booleans"),a=t("./service-helpers/create-service-factory"),u={},l=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];u.forwardGeocode=function(t){i.assertShape({query:i.required(i.string),mode:i.oneOf("mapbox.places","mapbox.places-permanent"),countries:i.arrayOf(i.string),proximity:i.coordinates,types:i.arrayOf(i.oneOf(l)),autocomplete:i.boolean,bbox:i.arrayOf(i.number),limit:i.number,language:i.arrayOf(i.string)})(t),t.mode=t.mode||"mapbox.places";var e=o(r({country:t.countries},s(t,["proximity","types","autocomplete","bbox","limit","language"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:s(t,["mode","query"]),query:e})},u.reverseGeocode=function(t){i.assertShape({query:i.required(i.coordinates),mode:i.oneOf("mapbox.places","mapbox.places-permanent"),countries:i.arrayOf(i.string),types:i.arrayOf(i.oneOf(l)),bbox:i.arrayOf(i.number),limit:i.number,language:i.arrayOf(i.string),reverseMode:i.oneOf("distance","score")})(t),t.mode=t.mode||"mapbox.places";var e=o(r({country:t.countries},s(t,["country","types","bbox","limit","language","reverseMode"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:s(t,["mode","query"]),query:e})},e.exports=a(u)},{"./service-helpers/create-service-factory":18,"./service-helpers/pick":20,"./service-helpers/stringify-booleans":21,"./service-helpers/validator":22,xtend:36}],18:[function(t,e,n){"use strict";function r(t){return function(e){var n;n=i.prototype.isPrototypeOf(e)?e:s(e);var r=Object.create(t);return r.client=n,r}}var i=t("../../lib/classes/mapi-client"),s=t("../../lib/client");e.exports=r},{"../../lib/classes/mapi-client":9,"../../lib/client":7}],19:[function(t,e,n){"use strict";function r(t,e){return Object.keys(t).reduce(function(n,r){return n[r]=e(r,t[r]),n},{})}e.exports=r},{}],20:[function(t,e,n){"use strict";function r(t,e){var n=function(t,n){return-1!==e.indexOf(t)&&void 0!==n};return"function"==typeof e&&(n=e),Object.keys(t).filter(function(e){return n(e,t[e])}).reduce(function(e,n){return e[n]=t[n],e},{})}e.exports=r},{}],21:[function(t,e,n){"use strict";function r(t){return i(t,function(t,e){return"boolean"==typeof e?JSON.stringify(e):e})}var i=t("./object-map");e.exports=r},{"./object-map":19}],22:[function(t,e,n){(function(n){"use strict";function r(t){if("undefined"!=typeof window){if(t instanceof n.Blob||t instanceof n.ArrayBuffer)return;return"Blob or ArrayBuffer"}if("string"!=typeof t&&void 0===t.pipe)return"Filename or Readable stream"}function i(t,e){return u.assert(u.strictShape(t),e)}function s(t){if("boolean"==typeof t)return"date";try{var e=new Date(t);if(e.getTime&&isNaN(e.getTime()))return"date"}catch(t){return"date"}}function o(t){return u.tuple(u.number,u.number)(t)}var a=t("xtend"),u=t("@mapbox/fusspot");e.exports=a(u,{file:r,date:s,coordinates:o,assertShape:i})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"@mapbox/fusspot":5,xtend:36}],23:[function(t,e,n){"use strict";function r(t){if(a[t])return a[t];var e=t.split("."),n=e[0],r=e[1];if(!r)throw new Error("Invalid token");var o=i(r),u={usage:n,user:o.u};return s(o,"a")&&(u.authorization=o.a),s(o,"exp")&&(u.expires=1e3*o.exp),s(o,"iat")&&(u.created=1e3*o.iat),s(o,"scopes")&&(u.scopes=o.scopes),s(o,"client")&&(u.client=o.client),s(o,"ll")&&(u.lastLogin=o.ll),s(o,"iu")&&(u.impersonator=o.iu),a[t]=u,u}function i(t){try{return JSON.parse(o.decode(t))}catch(t){throw new Error("Invalid token")}}function s(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var o=t("base-64"),a={};e.exports=r},{"base-64":24}],24:[function(e,n,r){(function(e){!function(i){var s="object"==typeof r&&r,o="object"==typeof n&&n&&n.exports==s&&n,a="object"==typeof e&&e;a.global!==a&&a.window!==a||(i=a);var u=function(t){this.message=t};u.prototype=new Error,u.prototype.name="InvalidCharacterError";var l=function(t){throw new u(t)},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=/[\t\n\f\r ]/g,p=function(t){t=String(t).replace(h,"");var e=t.length;e%4==0&&(t=t.replace(/==?$/,""),e=t.length),(e%4==1||/[^+a-zA-Z0-9\/]/.test(t))&&l("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,i=0,s="",o=-1;++o<e;)r=c.indexOf(t.charAt(o)),n=i%4?64*n+r:r,i++%4&&(s+=String.fromCharCode(255&n>>(-2*i&6)));return s},f=function(t){t=String(t),/[^\0-\xFF]/.test(t)&&l("The string to be encoded contains characters outside of the Latin1 range.");for(var e,n,r,i,s=t.length%3,o="",a=-1,u=t.length-s;++a<u;)e=t.charCodeAt(a)<<16,n=t.charCodeAt(++a)<<8,r=t.charCodeAt(++a),i=e+n+r,o+=c.charAt(i>>18&63)+c.charAt(i>>12&63)+c.charAt(i>>6&63)+c.charAt(63&i);return 2==s?(e=t.charCodeAt(a)<<8,n=t.charCodeAt(++a),i=e+n,o+=c.charAt(i>>10)+c.charAt(i>>4&63)+c.charAt(i<<2&63)+"="):1==s&&(i=t.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 t&&"object"==typeof t.amd&&t.amd)t(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(t,e,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(t){return void 0===t._maxListeners?r.defaultMaxListeners:t._maxListeners}function s(t,e,n){if(e)t.call(n);else for(var r=t.length,i=y(t,r),s=0;s<r;++s)i[s].call(n)}function o(t,e,n,r){if(e)t.call(n,r);else for(var i=t.length,s=y(t,i),o=0;o<i;++o)s[o].call(n,r)}function a(t,e,n,r,i){if(e)t.call(n,r,i);else for(var s=t.length,o=y(t,s),a=0;a<s;++a)o[a].call(n,r,i)}function u(t,e,n,r,i,s){if(e)t.call(n,r,i,s);else for(var o=t.length,a=y(t,o),u=0;u<o;++u)a[u].call(n,r,i,s)}function l(t,e,n,r){if(e)t.apply(n,r);else for(var i=t.length,s=y(t,i),o=0;o<i;++o)s[o].apply(n,r)}function c(t,e,n,r){var s,o,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if(o=t._events,o?(o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]):(o=t._events=x(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(s=i(t))&&s>0&&a.length>s){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=o[e]=n,++t._eventsCount;return t}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 t=new Array(arguments.length),e=0;e<t.length;++e)t[e]=arguments[e];this.listener.apply(this.target,t)}}function p(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=E.call(h,r);return i.listener=n,r.wrapFn=i,i}function f(t,e,n){var r=t._events;if(!r)return[];var i=r[e];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?m(i):y(i,i.length):[]}function d(t){var e=this._events;if(e){var n=e[t];if("function"==typeof n)return 1;if(n)return n.length}return 0}function v(t,e){for(var n=e,r=n+1,i=t.length;r<i;n+=1,r+=1)t[n]=t[r];t.pop()}function y(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function m(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function g(t){var e=function(){};return e.prototype=t,new e}function b(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return n}function _(t){var e=this;return function(){return e.apply(t,arguments)}}var x=Object.create||g,w=Object.keys||b,E=Function.prototype.bind||_;e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0;var L,O=10;try{var k={};Object.defineProperty&&Object.defineProperty(k,"x",{value:0}),L=0===k.x}catch(t){L=!1}L?Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return O},set:function(t){if("number"!=typeof t||t<0||t!==t)throw new TypeError('"defaultMaxListeners" must be a positive number');O=t}}):r.defaultMaxListeners=O,r.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},r.prototype.getMaxListeners=function(){return i(this)},r.prototype.emit=function(t){var e,n,r,i,c,h,p="error"===t;if(h=this._events)p=p&&null==h.error;else if(!p)return!1;if(p){if(arguments.length>1&&(e=arguments[1]),e instanceof Error)throw e;var f=new Error('Unhandled "error" event. ('+e+")");throw f.context=e,f}if(!(n=h[t]))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<r;c++)i[c-1]=arguments[c];l(n,d,this,i)}return!0},r.prototype.addListener=function(t,e){return c(this,t,e,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(t,e){return c(this,t,e,!0)},r.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,p(this,t,e)),this},r.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,p(this,t,e)),this},r.prototype.removeListener=function(t,e){var n,r,i,s,o;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=x(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():v(n,i),1===n.length&&(r[t]=n[0]),r.removeListener&&this.emit("removeListener",t,o||e)}return this},r.prototype.removeAllListeners=function(t){var e,n,r;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=x(null),this._eventsCount=0):n[t]&&(0==--this._eventsCount?this._events=x(null):delete n[t]),this;if(0===arguments.length){var i,s=w(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=x(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},r.prototype.listeners=function(t){return f(this,t,!0)},r.prototype.rawListeners=function(t){return f(this,t,!1)},r.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},r.prototype.listenerCount=d,r.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],26:[function(t,e,n){"use strict";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(t,e,n,r,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new i(n,r||t,s),a=l?l+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}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 t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)u.call(t,e)&&n.push(l?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=l?l+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,s=new Array(i);r<i;r++)s[r]=n[r].fn;return s},a.prototype.listenerCount=function(t){var e=l?l+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,r,i,s){var o=l?l+t:t;if(!this._events[o])return!1;var a,u,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,r),!0;case 5:return c.fn.call(c.context,e,n,r,i),!0;case 6:return c.fn.call(c.context,e,n,r,i,s),!0}for(u=1,a=new Array(h-1);u<h;u++)a[u-1]=arguments[u];c.fn.apply(c.context,a)}else{var p,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),h){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,n);break;case 4:c[u].fn.call(c[u].context,e,n,r);break;default:if(!a)for(p=1,a=new Array(h-1);p<h;p++)a[p-1]=arguments[p];c[u].fn.apply(c[u].context,a)}}return!0},a.prototype.on=function(t,e,n){return s(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return s(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,n,r){var i=l?l+t:t;if(!this._events[i])return this;if(!e)return o(this,i),this;var s=this._events[i];if(s.fn)s.fn!==e||r&&!s.once||n&&s.context!==n||o(this,i);else{for(var a=0,u=[],c=s.length;a<c;a++)(s[a].fn!==e||r&&!s[a].once||n&&s[a].context!==n)&&u.push(s[a]);u.length?this._events[i]=1===u.length?u[0]:u:o(this,i)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=l?l+t:t,this._events[e]&&o(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=l,a.EventEmitter=a,void 0!==e&&(e.exports=a)},{}],27:[function(t,e,n){!function(){var t=this,r={};void 0!==n?e.exports=r:t.fuzzy=r,r.simpleFilter=function(t,e){return e.filter(function(e){return r.test(t,e)})},r.test=function(t,e){return null!==r.match(t,e)},r.match=function(t,e,n){n=n||{};var r,i=0,s=[],o=e.length,a=0,u=0,l=n.pre||"",c=n.post||"",h=n.caseSensitive&&e||e.toLowerCase();t=n.caseSensitive&&t||t.toLowerCase();for(var p=0;p<o;p++)r=e[p],h[p]===t[i]?(r=l+r+c,i+=1,u+=1+u):u=0,a+=u,s[s.length]=r;return i===t.length?(a=h===t?1/0:a,{rendered:s.join(""),score:a}):null},r.filter=function(t,e,n){return e&&0!==e.length?"string"!=typeof t?e:(n=n||{},e.reduce(function(e,i,s,o){var a=i;n.extract&&(a=n.extract(i));var u=r.match(t,a,n);return null!=u&&(e[e.length]={string:u.rendered,score:u.score,index:s,original:i}),e},[]).sort(function(t,e){var n=e.score-t.score;return n||t.index-e.index})):[]}}()},{}],28:[function(t,e,n){"use strict";var r=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===r.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],29:[function(t,e,n){(function(t){function n(t,e,n){function i(e){var n=v,r=y;return v=y=void 0,L=e,g=t.apply(r,n)}function s(t){return L=t,b=setTimeout(c,e),O?i(t):g}function u(t){var n=t-E,r=t-L,i=e-n;return k?x(i,m-r):i}function l(t){var n=t-E,r=t-L;return void 0===E||n>=e||n<0||k&&r>=m}function c(){var t=w();if(l(t))return h(t);b=setTimeout(c,u(t))}function h(t){return b=void 0,T&&v?i(t):(v=y=void 0,g)}function p(){void 0!==b&&clearTimeout(b),L=0,v=E=y=b=void 0}function f(){return void 0===b?g:h(w())}function d(){var t=w(),n=l(t);if(v=arguments,y=this,E=t,n){if(void 0===b)return s(E);if(k)return b=setTimeout(c,e),i(E)}return void 0===b&&(b=setTimeout(c,e)),g}var v,y,m,g,b,E,L=0,O=!1,k=!1,T=!0;if("function"!=typeof t)throw new TypeError(a);return e=o(e)||0,r(n)&&(O=!!n.leading,k="maxWait"in n,m=k?_(o(n.maxWait)||0,e):m,T="trailing"in n?!!n.trailing:T),d.cancel=p,d.flush=f,d}function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function i(t){return!!t&&"object"==typeof t}function s(t){return"symbol"==typeof t||i(t)&&b.call(t)==l}function o(t){if("number"==typeof t)return t;if(s(t))return u;if(r(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=r(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(c,"");var n=p.test(t);return n||f.test(t)?d(t.slice(2),n?2:8):h.test(t)?u:+t}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 t&&t&&t.Object===Object&&t,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()};e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],30:[function(t,e,n){(function(t){if("production"!==t.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;e.exports=function(t){t=t||21;for(var e="",r=n.getRandomValues(new Uint8Array(t));0<t--;)e+="Uint8ArdomValuesObj012345679BCDEFGHIJKLMNPQRSTWXYZ_cfghkpqvwxyz-"[63&r[t]];return e}}).call(this,t("_process"))},{_process:31}],31:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(t){if(h===setTimeout)return setTimeout(t,0);if((h===r||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function o(t){if(p===clearTimeout)return clearTimeout(t);if((p===i||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function a(){y&&d&&(y=!1,d.length?v=d.concat(v):m=-1,v.length&&u())}function u(){if(!y){var t=s(a);y=!0;for(var e=v.length;e;){for(d=v,v=[];++m<e;)d&&d[m].run();m=-1,e=v.length}d=null,y=!1,o(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}var h,p,f=e.exports={};!function(){try{h="function"==typeof setTimeout?setTimeout:r}catch(t){h=r}try{p="function"==typeof clearTimeout?clearTimeout:i}catch(t){p=i}}();var d,v=[],y=!1,m=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];v.push(new l(t,e)),1!==v.length||y||s(u)},l.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=c,f.addListener=c,f.once=c,f.off=c,f.removeListener=c,f.removeAllListeners=c,f.emit=c,f.prependListener=c,f.prependOnceListener=c,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],32:[function(t,e,n){!function(t,n,r){void 0!==e&&e.exports?e.exports=r():t.subtag=r()}(this,0,function(){function t(t){return t.match(o)||[]}function e(e){return t(e).filter(function(t,e){return t&&e})}function n(e){return e=t(e),{language:e[1]||s,extlang:e[2]||s,script:e[3]||s,region:e[4]||s}}function r(t,e,n){Object.defineProperty(t,e,{value:n,enumerable:!0})}function i(e,i,o){function a(n){return t(n)[e]||s}r(a,"pattern",i),r(n,o,a)}var s="",o=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;return i(1,/^[a-zA-Z]{2,3}$/,"language"),i(2,/^[a-zA-Z]{3}$/,"extlang"),i(3,/^[a-zA-Z]{4}$/,"script"),i(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),r(n,"split",e),n})},{}],33:[function(t,e,n){"use strict";var r=t("./src/suggestions");window.Suggestions=e.exports=r},{"./src/suggestions":35}],34:[function(t,e,n){"Use strict";var r=function(t){return this.component=t,this.items=[],this.active=0,this.element=document.createElement("ul"),this.element.className="suggestions",this.selectingListItem=!1,t.el.parentNode.insertBefore(this.element,t.el.nextSibling),this};r.prototype.show=function(){this.element.style.display="block"},r.prototype.hide=function(){this.element.style.display="none"},r.prototype.add=function(t){this.items.push(t)},r.prototype.clear=function(){this.items=[],this.active=0},r.prototype.isEmpty=function(){return!this.items.length},r.prototype.isVisible=function(){return"block"===this.element.style.display},r.prototype.draw=function(){if(this.element.innerHTML="",0===this.items.length)return void this.hide();for(var t=0;t<this.items.length;t++)this.drawItem(this.items[t],this.active===t);this.show()},r.prototype.drawItem=function(t,e){var n=document.createElement("li"),r=document.createElement("a");e&&(n.className+=" active"),r.innerHTML=t.string,n.appendChild(r),this.element.appendChild(n),n.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),n.addEventListener("mouseup",function(){this.handleMouseUp.call(this,t)}.bind(this))},r.prototype.handleMouseUp=function(t){this.selectingListItem=!1,this.component.value(t.original),this.clear(),this.draw()},r.prototype.move=function(t){this.active=t,this.draw()},r.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)},r.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},e.exports=r},{}],35:[function(t,e,n){"use strict";var r=t("xtend"),i=t("fuzzy"),s=t("./list"),o=function(t,e,n){return n=n||{},this.options=r({minLength:2,limit:5,filter:!0},n),this.el=t,this.data=e||[],this.list=new s(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(t){this.handleKeyUp(t.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(t){this.handleKeyDown(t)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(t){this.handlePaste(t)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};o.prototype.handleKeyUp=function(t){40!==t&&38!==t&&27!==t&&13!==t&&9!==t&&this.handleInputChange(this.el.value)},o.prototype.handleKeyDown=function(t){switch(t.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&t.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},o.prototype.handleBlur=function(){this.list.selectingListItem||this.list.hide()},o.prototype.handlePaste=function(t){if(t.clipboardData)this.handleInputChange(t.clipboardData.getData("Text"));else{var e=this;setTimeout(function(){e.handleInputChange(t.target.value)},100)}},o.prototype.handleInputChange=function(t){if(this.query=this.normalize(t),this.list.clear(),this.query.length<this.options.minLength)return void this.list.draw();this.getCandidates(function(t){for(var e=0;e<t.length&&(this.list.add(t[e]),e!==this.options.limit-1);e++);this.list.draw()}.bind(this))},o.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},o.prototype.update=function(t){this.data=t,this.handleKeyUp()},o.prototype.clear=function(){this.data=[],this.list.clear()},o.prototype.normalize=function(t){return t=t.toLowerCase()},o.prototype.match=function(t,e){return t.indexOf(e)>-1},o.prototype.value=function(t){if(this.selected=t,this.el.value=this.getItemValue(t),document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")},o.prototype.getCandidates=function(t){var e,n={pre:"<strong>",post:"</strong>",extract:function(t){return this.getItemValue(t)}.bind(this)};this.options.filter?(e=i.filter(this.query,this.data,n),e=e.map(function(t){return{original:t.original,string:this.render(t.original,t.string)}}.bind(this))):e=this.data.map(function(t){return{original:t,string:this.render(t)}}.bind(this)),t(e)},o.prototype.getItemValue=function(t){return t},o.prototype.render=function(t,e){if(e)return e;for(var n=t.original?this.getItemValue(t.original):this.getItemValue(t),r=this.normalize(n),i=r.lastIndexOf(this.query);i>-1;){var s=i+this.query.length;n=n.slice(0,i)+"<strong>"+n.slice(i,s)+"</strong>"+n.slice(s),i=r.slice(0,i).lastIndexOf(this.query)}return n},e.exports=o},{"./list":34,fuzzy:27,xtend:36}],36:[function(t,e,n){function r(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var r in n)i.call(n,r)&&(t[r]=n[r])}return t}e.exports=r;var i=Object.prototype.hasOwnProperty},{}]},{},[3])(3)});