react-map-gl-geocoder
Version:
React wrapper for mapbox-gl-geocoder for use with react-map-gl
1 lines • 74 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("events"),require("react-map-gl")):"function"==typeof define&&define.amd?define(["react","events","react-map-gl"],t):(e=e||self).reactMapGlGeocoder=t(e.react,e.events,e.reactMapGl)}(this,function(e,t,n){t=t&&t.hasOwnProperty("default")?t.default:t;var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var a=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,i=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,u=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,d=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116;function g(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case l:case h:case o:case s:case a:case f:return e;default:switch(e=e&&e.$$typeof){case c:case p:case u:return e;default:return t}}case y:case d:case i:return t}}}function m(e){return g(e)===h}t.typeOf=g,t.AsyncMode=l,t.ConcurrentMode=h,t.ContextConsumer=c,t.ContextProvider=u,t.Element=r,t.ForwardRef=p,t.Fragment=o,t.Lazy=y,t.Memo=d,t.Portal=i,t.Profiler=s,t.StrictMode=a,t.Suspense=f,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===h||e===s||e===a||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===u||e.$$typeof===c||e.$$typeof===p)},t.isAsyncMode=function(e){return m(e)||g(e)===l},t.isConcurrentMode=m,t.isContextConsumer=function(e){return g(e)===c},t.isContextProvider=function(e){return g(e)===u},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return g(e)===p},t.isFragment=function(e){return g(e)===o},t.isLazy=function(e){return g(e)===y},t.isMemo=function(e){return g(e)===d},t.isPortal=function(e){return g(e)===i},t.isProfiler=function(e){return g(e)===s},t.isStrictMode=function(e){return g(e)===a},t.isSuspense=function(e){return g(e)===f}});i(a);var s=o(function(e,t){"production"!==process.env.NODE_ENV&&function(){Object.defineProperty(t,"__esModule",{value:!0});var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,h=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.memo"):60115,d=e?Symbol.for("react.lazy"):60116,y=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=0,o="Warning: "+e.replace(/%s/g,function(){return n[i++]});"undefined"!=typeof console&&console.warn(o);try{throw new Error(o)}catch(e){}};function g(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var y=e.type;switch(y){case c:case l:case i:case a:case o:case p:return y;default:var g=y&&y.$$typeof;switch(g){case u:case h:case s:return g;default:return t}}case d:case f:case r:return t}}}var m=c,v=l,b=u,_=s,x=n,w=h,E=i,M=d,O=f,j=r,P=a,S=o,k=p,R=!1;function C(e){return g(e)===l}t.typeOf=g,t.AsyncMode=m,t.ConcurrentMode=v,t.ContextConsumer=b,t.ContextProvider=_,t.Element=x,t.ForwardRef=w,t.Fragment=E,t.Lazy=M,t.Memo=O,t.Portal=j,t.Profiler=P,t.StrictMode=S,t.Suspense=k,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===l||e===a||e===o||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===f||e.$$typeof===s||e.$$typeof===u||e.$$typeof===h)},t.isAsyncMode=function(e){return R||(R=!0,function(e,t){if(void 0===t)throw new Error("`lowPriorityWarning(condition, format, ...args)` requires a warning message argument");if(!e){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];y.apply(void 0,[t].concat(r))}}(!1,"The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(e)||g(e)===c},t.isConcurrentMode=C,t.isContextConsumer=function(e){return g(e)===u},t.isContextProvider=function(e){return g(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return g(e)===h},t.isFragment=function(e){return g(e)===i},t.isLazy=function(e){return g(e)===d},t.isMemo=function(e){return g(e)===f},t.isPortal=function(e){return g(e)===r},t.isProfiler=function(e){return g(e)===a},t.isStrictMode=function(e){return g(e)===o},t.isSuspense=function(e){return g(e)===p}}()});i(s);var u=o(function(e){e.exports="production"===process.env.NODE_ENV?a:s}),c=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;function p(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var f=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=p(e),o=1;o<arguments.length;o++){for(var a in n=Object(arguments[o]))l.call(n,a)&&(i[a]=n[a]);if(c){r=c(n);for(var s=0;s<r.length;s++)h.call(n,r[s])&&(i[r[s]]=n[r[s]])}}return i},d="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",y=function(){};if("production"!==process.env.NODE_ENV){var g=d,m={},v=Function.call.bind(Object.prototype.hasOwnProperty);y=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function b(e,t,n,r,i){if("production"!==process.env.NODE_ENV)for(var o in e)if(v(e,o)){var a;try{if("function"!=typeof e[o]){var s=Error((r||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.");throw s.name="Invariant Violation",s}a=e[o](t,o,r,n,null,g)}catch(e){a=e}if(!a||a instanceof Error||y((r||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),a instanceof Error&&!(a.message in m)){m[a.message]=!0;var u=i?i():"";y("Failed "+n+" type: "+a.message+(null!=u?u:""))}}}b.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(m={})};var _=b,x=Function.call.bind(Object.prototype.hasOwnProperty),w=function(){};function E(){return null}function M(){}function O(){}"production"!==process.env.NODE_ENV&&(w=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),O.resetWarningCache=M;var j=o(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,r="@@iterator",i="<<anonymous>>",o={array:l("array"),bool:l("boolean"),func:l("function"),number:l("number"),object:l("object"),string:l("string"),symbol:l("symbol"),any:c(E),arrayOf:function(e){return c(function(t,n,r,i,o){if("function"!=typeof e)return new s("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a))return new s("Invalid "+i+" `"+o+"` of type `"+p(a)+"` supplied to `"+r+"`, expected an array.");for(var u=0;u<a.length;u++){var c=e(a,u,r,i,o+"["+u+"]",d);if(c instanceof Error)return c}return null})},element:c(function(t,n,r,i,o){var a=t[n];return e(a)?null:new s("Invalid "+i+" `"+o+"` of type `"+p(a)+"` supplied to `"+r+"`, expected a single ReactElement.")}),elementType:c(function(e,t,n,r,i){var o=e[t];return u.isValidElementType(o)?null:new s("Invalid "+r+" `"+i+"` of type `"+p(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return c(function(t,n,r,o,a){var u;return t[n]instanceof e?null:new s("Invalid "+o+" `"+a+"` of type `"+((u=t[n]).constructor&&u.constructor.name?u.constructor.name:i)+"` supplied to `"+r+"`, expected instance of `"+(e.name||i)+"`.")})},node:c(function(e,t,n,r,i){return h(e[t])?null:new s("Invalid "+r+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return c(function(t,n,r,i,o){if("function"!=typeof e)return new s("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],u=p(a);if("object"!==u)return new s("Invalid "+i+" `"+o+"` of type `"+u+"` supplied to `"+r+"`, expected an object.");for(var c in a)if(x(a,c)){var l=e(a,c,r,i,o+"."+c,d);if(l instanceof Error)return l}return null})},oneOf:function(e){return Array.isArray(e)?c(function(t,n,r,i,o){for(var u=t[n],c=0;c<e.length;c++)if(a(u,e[c]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===y(t)?String(t):t});return new s("Invalid "+i+" `"+o+"` of value `"+String(u)+"` supplied to `"+r+"`, expected one of "+l+".")}):("production"!==process.env.NODE_ENV&&w(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),E)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&w("Invalid argument supplied to oneOfType, expected an instance of array."),E;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return w("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+g(n)+" at index "+t+"."),E}return c(function(t,n,r,i,o){for(var a=0;a<e.length;a++)if(null==(0,e[a])(t,n,r,i,o,d))return null;return new s("Invalid "+i+" `"+o+"` supplied to `"+r+"`.")})},shape:function(e){return c(function(t,n,r,i,o){var a=t[n],u=p(a);if("object"!==u)return new s("Invalid "+i+" `"+o+"` of type `"+u+"` supplied to `"+r+"`, expected `object`.");for(var c in e){var l=e[c];if(l){var h=l(a,c,r,i,o+"."+c,d);if(h)return h}}return null})},exact:function(e){return c(function(t,n,r,i,o){var a=t[n],u=p(a);if("object"!==u)return new s("Invalid "+i+" `"+o+"` of type `"+u+"` supplied to `"+r+"`, expected `object`.");var c=f({},t[n],e);for(var l in c){var h=e[l];if(!h)return new s("Invalid "+i+" `"+o+"` key `"+l+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=h(a,l,r,i,o+"."+l,d);if(y)return y}return null})}};function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function s(e){this.message=e,this.stack=""}function c(e){if("production"!==process.env.NODE_ENV)var n={},r=0;function o(o,a,u,c,l,h,p){if(c=c||i,h=h||u,p!==d){if(t){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var y=c+":"+u;!n[y]&&r<3&&(w("You are manually calling a React.PropTypes validation function for the `"+h+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[y]=!0,r++)}}return null==a[u]?o?new s(null===a[u]?"The "+l+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`.":"The "+l+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(a,u,c,l,h)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function l(e){return c(function(t,n,r,i,o,a){var u=t[n];return p(u)!==e?new s("Invalid "+i+" `"+o+"` of type `"+y(u)+"` supplied to `"+r+"`, expected `"+e+"`."):null})}function h(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(h);if(null===t||e(t))return!0;var i=function(e){var i=t&&(n&&t[n]||t[r]);if("function"==typeof i)return i}();if(!i)return!1;var o,a=i.call(t);if(i!==t.entries){for(;!(o=a.next()).done;)if(!h(o.value))return!1}else for(;!(o=a.next()).done;){var s=o.value;if(s&&!h(s[1]))return!1}return!0;default:return!1}}function p(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function y(e){if(null==e)return""+e;var t=p(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){var t=y(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return s.prototype=Error.prototype,o.checkPropTypes=_,o.resetWarningCache=_.resetWarningCache,o.PropTypes=o,o}(u.isElement,!0):function(){function e(e,t,n,r,i,o){if(o!==d){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:O,resetWarningCache:M};return n.PropTypes=n,n}()}),P=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var r in n)S.call(n,r)&&(e[r]=n[r])}return e},S=Object.prototype.hasOwnProperty,k=o(function(e,t){!function(){var t={};e.exports=t,t.simpleFilter=function(e,n){return n.filter(function(n){return t.test(e,n)})},t.test=function(e,n){return null!==t.match(e,n)},t.match=function(e,t,n){var r,i=0,o=[],a=t.length,s=0,u=0,c=(n=n||{}).pre||"",l=n.post||"",h=n.caseSensitive&&t||t.toLowerCase();e=n.caseSensitive&&e||e.toLowerCase();for(var p=0;p<a;p++)r=t[p],h[p]===e[i]?(r=c+r+l,i+=1,u+=1+u):u=0,s+=u,o[o.length]=r;return i===e.length?(s=h===e?Infinity:s,{rendered:o.join(""),score:s}):null},t.filter=function(e,n,r){return n&&0!==n.length?"string"!=typeof e?n:(r=r||{},n.reduce(function(n,i,o,a){var s=i;r.extract&&(s=r.extract(i));var u=t.match(e,s,r);return null!=u&&(n[n.length]={string:u.rendered,score:u.score,index:o,original:i}),n},[]).sort(function(e,t){return t.score-e.score||e.index-t.index})):[]}}()}),R=function(e){return this.component=e,this.items=[],this.active=0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,e.el.parentNode.insertBefore(this.wrapper,e.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(e){this.items.push(e)},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){for(var e=0;e<this.items.length;e++)this.drawItem(this.items[e],this.active===e);this.show()}else this.hide()},R.prototype.drawItem=function(e,t){var n=document.createElement("li"),r=document.createElement("a");t&&(n.className+=" active"),r.innerHTML=e.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,e)}.bind(this))},R.prototype.handleMouseUp=function(e){this.selectingListItem=!1,this.component.value(e.original),this.clear(),this.draw()},R.prototype.move=function(e){this.active=e,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)},R.prototype.drawError=function(e){var t=document.createElement("li");t.innerHTML=e,this.element.appendChild(t),this.show()};var C=R,A=function(e,t,n){return this.options=P({minLength:2,limit:5,filter:!0},n=n||{}),this.el=e,this.data=t||[],this.list=new C(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(e){this.handleKeyUp(e.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(e){this.handleKeyDown(e)}.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(e){this.handlePaste(e)}.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};A.prototype.handleKeyUp=function(e){40!==e&&38!==e&&27!==e&&13!==e&&9!==e&&this.handleInputChange(this.el.value)},A.prototype.handleKeyDown=function(e){switch(e.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&e.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()}},A.prototype.handleBlur=function(){this.list.selectingListItem||this.list.hide()},A.prototype.handlePaste=function(e){if(e.clipboardData)this.handleInputChange(e.clipboardData.getData("Text"));else{var t=this;setTimeout(function(){t.handleInputChange(e.target.value)},100)}},A.prototype.handleInputChange=function(e){this.query=this.normalize(e),this.list.clear(),this.query.length<this.options.minLength?this.list.draw():this.getCandidates(function(e){for(var t=0;t<e.length&&(this.list.add(e[t]),t!==this.options.limit-1);t++);this.list.draw()}.bind(this))},A.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},A.prototype.update=function(e){this.data=e,this.handleKeyUp()},A.prototype.clear=function(){this.data=[],this.list.clear()},A.prototype.normalize=function(e){return e.toLowerCase()},A.prototype.match=function(e,t){return e.indexOf(t)>-1},A.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},A.prototype.getCandidates=function(e){var t={pre:"<strong>",post:"</strong>",extract:function(e){return this.getItemValue(e)}.bind(this)};e(this.options.filter?k.filter(this.query,this.data,t).map(function(e){return{original:e.original,string:this.render(e.original,e.string)}}.bind(this)):this.data.map(function(e){return{original:e,string:this.render(e)}}.bind(this)))},A.prototype.getItemValue=function(e){return e},A.prototype.render=function(e,t){if(t)return t;for(var n=this.getItemValue(e.original?e.original:e),r=this.normalize(n),i=r.lastIndexOf(this.query);i>-1;){var o=i+this.query.length;n=n.slice(0,i)+"<strong>"+n.slice(i,o)+"</strong>"+n.slice(o),i=r.slice(0,i).lastIndexOf(this.query)}return n},A.prototype.renderError=function(e){this.list.drawError(e)};var T=A,I=o(function(e){window.Suggestions=e.exports=T}),L=NaN,N="[object Symbol]",q=/^\s+|\s+$/g,F=/^[-+]0x[0-9a-f]+$/i,z=/^0b[01]+$/i,B=/^0o[0-7]+$/i,V=parseInt,D="object"==typeof r&&r&&r.Object===Object&&r,$="object"==typeof self&&self&&self.Object===Object&&self,G=D||$||Function("return this")(),U=Object.prototype.toString,Z=Math.max,Q=Math.min,H=function(){return G.Date.now()};function W(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function K(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&U.call(e)==N}(e))return L;if(W(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=W(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(q,"");var n=z.test(e);return n||B.test(e)?V(e.slice(2),n?2:8):F.test(e)?L:+e}var J={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]]}},Y=function(e){return e?e.split(/,\s*</).reduce(function(e,t){var n=function(e){var t=e.match(/<?([^>]*)>(.*)/);if(!t)return null;var n=t[1],r=t[2].split(";"),i=null,o=r.reduce(function(e,t){var n=function(e){var t=e.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return t?{key:t[1],value:t[2]}:null}(t);return n?"rel"===n.key?(i||(i=n.value),e):(e[n.key]=n.value,e):e},{});return i?{url:n,rel:i,params:o}:null}(t);return n?(n.rel.split(/\s+/).forEach(function(t){e[t]||(e[t]={url:n.url,params:n.params})}),e):e},{}):{}};function X(e,t){this.request=e,this.headers=t.headers,this.rawBody=t.body,this.statusCode=t.statusCode;try{this.body=JSON.parse(t.body||"{}")}catch(e){this.body=t.body}this.links=Y(this.headers.link)}X.prototype.hasNextPage=function(){return!!this.links.next},X.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null};var ee=X,te={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"},ne=function(e){var t,n=e.type||te.ERROR_HTTP;if(e.body)try{t=JSON.parse(e.body)}catch(n){t=e.body}else t=null;var r=e.message||null;r||("string"==typeof t?r=t:t&&"string"==typeof t.message?r=t.message:n===te.ERROR_REQUEST_ABORTED&&(r="Request aborted")),this.message=r,this.type=n,this.statusCode=e.statusCode||null,this.request=e.request,this.body=t},re={};function ie(e){var t=e.total,n=e.loaded;return{total:t,transferred:n,percent:100*n/t}}var oe=o(function(e,t){!function(n){var i=t,o=e&&e.exports==i&&e,a="object"==typeof r&&r;a.global!==a&&a.window!==a||(n=a);var s=function(e){this.message=e};(s.prototype=new Error).name="InvalidCharacterError";var u=function(e){throw new s(e)},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=/[\t\n\f\r ]/g,h={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var t,n,r,i,o=e.length%3,a="",s=-1,l=e.length-o;++s<l;)t=e.charCodeAt(s)<<16,n=e.charCodeAt(++s)<<8,r=e.charCodeAt(++s),a+=c.charAt((i=t+n+r)>>18&63)+c.charAt(i>>12&63)+c.charAt(i>>6&63)+c.charAt(63&i);return 2==o?(t=e.charCodeAt(s)<<8,n=e.charCodeAt(++s),a+=c.charAt((i=t+n)>>10)+c.charAt(i>>4&63)+c.charAt(i<<2&63)+"="):1==o&&(i=e.charCodeAt(s),a+=c.charAt(i>>2)+c.charAt(i<<4&63)+"=="),a},decode:function(e){var t=(e=String(e).replace(l,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9\/]/.test(e))&&u("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,i=0,o="",a=-1;++a<t;)r=c.indexOf(e.charAt(a)),n=i%4?64*n+r:r,i++%4&&(o+=String.fromCharCode(255&n>>(-2*i&6)));return o},version:"0.1.0"};if(i&&!i.nodeType)if(o)o.exports=h;else for(var p in h)h.hasOwnProperty(p)&&(i[p]=h[p]);else n.base64=h}(r)}),ae={};function se(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var ue=function(e){if(ae[e])return ae[e];var t=e.split("."),n=t[0],r=t[1];if(!r)throw new Error("Invalid token");var i=function(e){try{return JSON.parse(oe.decode(e))}catch(e){throw new Error("Invalid token")}}(r),o={usage:n,user:i.u};return se(i,"a")&&(o.authorization=i.a),se(i,"exp")&&(o.expires=1e3*i.exp),se(i,"iat")&&(o.created=1e3*i.iat),se(i,"scopes")&&(o.scopes=i.scopes),se(i,"client")&&(o.client=i.client),se(i,"ll")&&(o.lastLogin=i.ll),se(i,"iu")&&(o.impersonator=i.iu),ae[e]=o,o},ce=o(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||e,a),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=this._events[n?n+e:e];if(!t)return[];if(t.fn)return[t.fn];for(var r=0,i=t.length,o=new Array(i);r<i;r++)o[r]=t[r].fn;return o},s.prototype.listenerCount=function(e){var t=this._events[n?n+e:e];return t?t.fn?1:t.length:0},s.prototype.emit=function(e,t,r,i,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,i),!0;case 5:return l.fn.call(l.context,t,r,i,o),!0;case 6:return l.fn.call(l.context,t,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var p,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,r);break;case 4:l[c].fn.call(l[c].context,t,r,i);break;default:if(!u)for(p=1,u=new Array(h-1);p<h;p++)u[p-1]=arguments[p];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?this._events[t=n?n+e:e]&&a(this,t):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s});function le(e){return Array.isArray(e)?e.map(encodeURIComponent).join(","):encodeURIComponent(String(e))}function he(e,t,n){if(!1===n||null===n)return e;var r=/\?/.test(e)?"&":"?",i=encodeURIComponent(t);return void 0!==n&&""!==n&&!0!==n&&(i+="="+le(n)),""+e+r+i}var pe={appendQueryObject:function(e,t){if(!t)return e;var n=e;return Object.keys(t).forEach(function(e){var r=t[e];void 0!==r&&(Array.isArray(r)&&(r=r.filter(function(e){return!!e}).join(",")),n=he(n,e,r))}),n},appendQueryParam:he,prependOrigin:function(e,t){if(!t)return e;if("http"===e.slice(0,4))return e;var n="/"===e[0]?"":"/";return""+t.replace(/\/$/,"")+n+e},interpolateRouteParams:function(e,t){return t?e.replace(/\/:([a-zA-Z0-9]+)/g,function(e,n){var r=t[n];if(void 0===r)throw new Error("Unspecified route parameter "+n);return"/"+le(r)}):e}},fe=1;function de(e,t){if(!e)throw new Error("MapiRequest requires a client");if(!t||!t.path||!t.method)throw new Error("MapiRequest requires an options object with path and method properties");var n={};t.body&&(n["content-type"]="application/json");var r=P(n,t.headers),i=Object.keys(r).reduce(function(e,t){return e[t.toLowerCase()]=r[t],e},{});this.id=fe++,this._options=t,this.emitter=new ce,this.client=e,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=t.path,this.method=t.method,this.origin=t.origin||e.origin,this.query=t.query||{},this.params=t.params||{},this.body=t.body||null,this.file=t.file||null,this.headers=i}de.prototype.url=function(e){var t=pe.prependOrigin(this.path,this.origin);t=pe.appendQueryObject(t,this.query);var n=this.params;if(e){t=pe.appendQueryParam(t,"access_token",e);var r=ue(e).user;n=P({ownerId:r},n)}return pe.interpolateRouteParams(t,n)},de.prototype.send=function(){var e=this;if(e.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return e.sent=!0,e.client.sendRequest(e).then(function(t){return e.response=t,e.emitter.emit(te.EVENT_RESPONSE,t),t},function(t){throw e.error=t,e.emitter.emit(te.EVENT_ERROR,t),t})},de.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),this.response||this.error||this.aborted||(this.aborted=!0,this.client.abortRequest(this))},de.prototype.eachPage=function(e){var t=this;function n(n){e(null,n,function(){delete t._nextPageRequest;var e=n.nextPage();e&&(t._nextPageRequest=e,i(e))})}function r(t){e(t,null,function(){})}function i(e){e.send().then(n,r)}i(this)},de.prototype.clone=function(){return this._extend()},de.prototype._extend=function(e){var t=P(this._options,e);return new de(this.client,t)};var ye=de;function ge(e){if(!e||!e.accessToken)throw new Error("Cannot create a client without an access token");ue(e.accessToken),this.accessToken=e.accessToken,this.origin=e.origin||te.API_ORIGIN}ge.prototype.createRequest=function(e){return new ye(this,e)};var me=ge;function ve(e){me.call(this,e)}(ve.prototype=Object.create(me.prototype)).constructor=ve,ve.prototype.sendRequest=function(e){return Promise.resolve().then(function(){var t=function(e,t){var n=e.url(t),r=new window.XMLHttpRequest;return r.open(e.method,n),Object.keys(e.headers).forEach(function(t){r.setRequestHeader(t,e.headers[t])}),r}(e,e.client.accessToken);return function(e,t){return new Promise(function(n,r){t.onprogress=function(t){e.emitter.emit(te.EVENT_PROGRESS_DOWNLOAD,ie(t))};var i=e.file;i&&(t.upload.onprogress=function(t){e.emitter.emit(te.EVENT_PROGRESS_UPLOAD,ie(t))}),t.onerror=function(e){r(e)},t.onabort=function(){var t=new ne({request:e,type:te.ERROR_REQUEST_ABORTED});r(t)},t.onload=function(){if(delete re[e.id],t.status<200||t.status>=400){var i=new ne({request:e,body:t.response,statusCode:t.status});r(i)}else n(t)};var o=e.body;"string"==typeof o?t.send(o):o?t.send(JSON.stringify(o)):i?t.send(i):t.send(),re[e.id]=t}).then(function(t){return function(e,t){return new ee(e,{body:t.response,headers:(n=t.getAllResponseHeaders(),r={},n?(n.trim().split(/[\r|\n]+/).forEach(function(e){var t=function(e){var t=e.indexOf(":");return{name:e.substring(0,t).trim().toLowerCase(),value:e.substring(t+1).trim()}}(e);r[t.name]=t.value}),r):r),statusCode:t.status});var n,r}(e,t)})}(e,t)})},ve.prototype.abortRequest=function(e){var t=re[e.id];t&&(t.abort(),delete re[e.id])};var be=function(e){return new ve(e)},_e=be,xe=Object.prototype.toString,we="value",Ee={};function Me(e){var t=Array.isArray(e);return function(n){var r=Oe(Ee.plainArray,n);if(r)return r;if(t&&n.length!==e.length)return"an array with "+e.length+" items";for(var i=0;i<n.length;i++)if(r=Oe(t?e[i]:e,n[i]))return[i].concat(r)}}function Oe(e,t){if(null!=t||e.hasOwnProperty("__required")){var n=e(t);return n?Array.isArray(n)?n:[n]:void 0}}function je(e,t){var n=e.length,r=e[n-1],i=e.slice(0,n-1);return 0===i.length&&(i=[we]),t=P(t,{path:i}),"function"==typeof r?r(t):Se(t,function(e){return"must be "+(/^an? /.test(t=e)?t:/^[aeiou]/i.test(t)?"an "+t:/^[a-z]/i.test(t)?"a "+t:t)+".";var t}(r))}function Pe(e){return e.length<2?e[0]:2===e.length?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e.slice(-1)}function Se(e,t){return(ke(e.path)?"Item at position ":"")+e.path.join(".")+" "+t}function ke(e){return"number"==typeof e[e.length-1]||"number"==typeof e[0]}Ee.assert=function(e,t){return t=t||{},function(n){var r=Oe(e,n);if(r){var i=je(r,t);throw t.apiName&&(i=t.apiName+": "+i),new Error(i)}}},Ee.shape=function(e){var t,n=(t=e,Object.keys(t||{}).map(function(e){return{key:e,value:t[e]}}));return function(e){var t,r=Oe(Ee.plainObject,e);if(r)return r;for(var i=[],o=0;o<n.length;o++)(r=Oe(n[o].value,e[t=n[o].key]))&&i.push([t].concat(r));return i.length<2?i[0]:function(e){i=i.map(function(t){return"- "+t[0]+": "+je(t,e).split("\n").join("\n ")});var t=e.path.join(".");return"The following properties"+(t===we?"":" of "+t)+" have invalid values:\n "+i.join("\n ")}}},Ee.strictShape=function(e){var t=Ee.shape(e);return function(n){var r=t(n);if(r)return r;var i=Object.keys(n).reduce(function(t,n){return void 0===e[n]&&t.push(n),t},[]);return 0!==i.length?function(){return"The following keys are invalid: "+i.join(", ")}:void 0}},Ee.arrayOf=function(e){return Me(e)},Ee.tuple=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return Me(e)},Ee.required=function(e){function t(t){return null==t?function(e){return Se(e,ke(e.path)?"cannot be undefined/null.":"is required.")}:e.apply(this,arguments)}return t.__required=!0,t},Ee.oneOfType=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return function(t){var n=e.map(function(e){return Oe(e,t)}).filter(Boolean);if(n.length===e.length)return n.every(function(e){return 1===e.length&&"string"==typeof e[0]})?Pe(n.map(function(e){return e[0]})):n.reduce(function(e,t){return t.length>e.length?t:e})}},Ee.equal=function(e){return function(t){if(t!==e)return JSON.stringify(e)}},Ee.oneOf=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments),t=e.map(function(e){return Ee.equal(e)});return Ee.oneOfType.apply(this,t)},Ee.range=function(e){var t=e[0],n=e[1];return function(e){if(Oe(Ee.number,e)||e<t||e>n)return"number between "+t+" & "+n+" (inclusive)"}},Ee.any=function(){},Ee.boolean=function(e){if("boolean"!=typeof e)return"boolean"},Ee.number=function(e){if("number"!=typeof e)return"number"},Ee.plainArray=function(e){if(!Array.isArray(e))return"array"},Ee.plainObject=function(e){if("[object Object]"!==xe.call(t=e)||null!==(n=Object.getPrototypeOf(t))&&n!==Object.getPrototypeOf({}))return"object";var t,n},Ee.string=function(e){if("string"!=typeof e)return"string"},Ee.func=function(e){if("function"!=typeof e)return"function"},Ee.validate=Oe,Ee.processMessage=je;var Re=Ee,Ce=P(Re,{file:function(e){if("undefined"!=typeof window){if(e instanceof r.Blob||e instanceof r.ArrayBuffer)return;return"Blob or ArrayBuffer"}if("string"!=typeof e&&void 0===e.pipe)return"Filename or Readable stream"},date:function(e){if("boolean"==typeof e)return"date";try{var t=new Date(e);if(t.getTime&&isNaN(t.getTime()))return"date"}catch(e){return"date"}},coordinates:function(e){return Re.tuple(Re.number,Re.number)(e)},assertShape:function(e,t){return Re.assert(Re.strictShape(e),t)}}),Ae=function(e,t){var n=function(e,n){return-1!==t.indexOf(e)&&void 0!==n};return"function"==typeof t&&(n=t),Object.keys(e).filter(function(t){return n(t,e[t])}).reduce(function(t,n){return t[n]=e[n],t},{})},Te=function(e){return function(e,t){return Object.keys(e).reduce(function(t,n){return t[n]="boolean"==typeof(r=e[n])?JSON.stringify(r):r,t;var r},{})}(e)},Ie={},Le=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];Ie.forwardGeocode=function(e){Ce.assertShape({query:Ce.required(Ce.string),mode:Ce.oneOf("mapbox.places","mapbox.places-permanent"),countries:Ce.arrayOf(Ce.string),proximity:Ce.coordinates,types:Ce.arrayOf(Ce.oneOf(Le)),autocomplete:Ce.boolean,bbox:Ce.arrayOf(Ce.number),limit:Ce.number,language:Ce.arrayOf(Ce.string)})(e),e.mode=e.mode||"mapbox.places";var t=Te(P({country:e.countries},Ae(e,["proximity","types","autocomplete","bbox","limit","language"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:Ae(e,["mode","query"]),query:t})},Ie.reverseGeocode=function(e){Ce.assertShape({query:Ce.required(Ce.coordinates),mode:Ce.oneOf("mapbox.places","mapbox.places-permanent"),countries:Ce.arrayOf(Ce.string),types:Ce.arrayOf(Ce.oneOf(Le)),bbox:Ce.arrayOf(Ce.number),limit:Ce.number,language:Ce.arrayOf(Ce.string),reverseMode:Ce.oneOf("distance","score")})(e),e.mode=e.mode||"mapbox.places";var t=Te(P({country:e.countries},Ae(e,["country","types","bbox","limit","language","reverseMode"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:Ae(e,["mode","query"]),query:t})};var Ne,qe=(Ne=Ie,function(e){var t;t=me.prototype.isPrototypeOf(e)?e:be(e);var n=Object.create(Ne);return n.client=t,n});if("production"!==process.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 Fe=self.crypto||self.msCrypto;function ze(e){this.origin=e.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=e.accessToken,this.version="0.2.0",this.sessionID=this.generateSessionID(),this.userAgent=this.getUserAgent(),this.options=e,this.send=this.send.bind(this),this.countries=e.countries?e.countries.split(","):null,this.types=e.types?e.types.split(","):null,this.bbox=e.bbox?e.bbox:null,this.language=e.language?e.language.split(","):null,this.limit=e.limit?+e.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(e),this.eventQueue=new Array,this.flushInterval=e.flushInterval||1e3,this.maxQueueSize=e.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}ze.prototype={select:function(e,t){var n=this.getSelectedIndex(e,t),r=this.getEventPayload("search.select",t);if(r.resultIndex=n,r.resultPlaceName=e.place_name,r.resultId=e.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(e){var t=this.getEventPayload("search.start",e);if(t.queryString)return this.push(t)},keyevent:function(e,t){if(e.key&&!e.metaKey&&-1===[9,27,37,39,13,38,40].indexOf(e.keyCode)){var n=this.getEventPayload("search.keystroke",t);if(n.lastAction=e.key,n.queryString)return this.push(n)}},send:function(e,t){if(!this.enableEventLogging)return t?t():void 0;var n=this.getRequestOptions(e);this.request(n,function(e){return e?this.handleError(e,t):t?t():void 0}.bind(this))},getRequestOptions:function(e){return Array.isArray(e)||(e=[e]),{method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}},getEventPayload:function(e,t){var n;n=t.options.proximity?[t.options.proximity.longitude,t.options.proximity.latitude]:null;var r=t._map?t._map.getZoom():null,i={event:e,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:t.options.limit,mapZoom:r,keyboardLocale:this.locale};return i.queryString="search.select"===e?t.inputString:"search.select"!=e&&t._inputEl?t._inputEl.value:t.inputString,i},request:function(e,t){var n=new XMLHttpRequest;for(var r in n.onreadystatechange=function(){if(4==this.readyState)return t(204==this.status?null:this.statusText)},n.open(e.method,e.host+"/"+e.path,!0),e.headers)n.setRequestHeader(r,e.headers[r]);n.send(e.body)},handleError:function(e,t){if(t)return t(e)},generateSessionID:function(){return function(e){e=e||21;for(var t="",n=Fe.getRandomValues(new Uint8Array(e));0<e--;)t+="Uint8ArdomValuesObj012345679BCDEFGHIJKLMNPQRSTWXYZ_cfghkpqvwxyz-"[63&n[e]];return t}()},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(e,t){if(t._typeahead){var n=e.id;return t._typeahead.data.map(function(e){return e.id}).indexOf(n)}},shouldEnableLogging:function(e){return!(!1===e.enableEventLogging||e.origin&&-1==e.origin.indexOf("api.mapbox.com")||e.localGeocoder||e.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(e,t){this.eventQueue.push(e),(this.eventQueue.length>=this.maxQueueSize||t)&&this.flush()},remove:function(){this.flush()}};var Be=ze,Ve={placeholder:{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"}},De=o(function(e){!function(t,n,r){e.exports?e.exports=r():t.subtag=r()}(r,0,function(){var e="",t=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function n(e){return e.match(t)||[]}function r(t){return{language:(t=n(t))[1]||e,extlang:t[2]||e,script:t[3]||e,region:t[4]||e}}function i(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0})}function o(t,o,a){function s(r){return n(r)[t]||e}i(s,"pattern",o),i(r,a,s)}return o(1,/^[a-zA-Z]{2,3}$/,"language"),o(2,/^[a-zA-Z]{3}$/,"extlang"),o(3,/^[a-zA-Z]{4}$/,"script"),o(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),i(r,"split",function(e){return n(e).filter(function(e,t){return e&&t})}),r})}),$e=t.EventEmitter;function Ge(e){this._eventEmitter=new $e,this.options=P({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null}Ge.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,getItemValue:function(e){return e.place_name},render:function(e){var t=e.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title">'+t[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address">'+t.splice(1,t.length).join(",")+"</div></div>"}},onAdd:function(e){this._map=e,this.setLanguage(),this.geocoderService=qe(_e({accessToken:this.options.accessToken,origin:this.options.origin})),this.eventManager=new Be(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this);var t=this.container=document.createElement("div");t.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var n=this.createIcon("search",'<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._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",function(e,t,n){var r,i,o,a,s,u,c=0,l=!1,h=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=r,o=i;return r=i=void 0,c=t,a=e.apply(o,n)}function d(e){var n=e-u;return void 0===u||n>=t||n<0||h&&e-c>=o}function y(){var e=H();if(d(e))return g(e);s=setTimeout(y,function(e){var n=t-(e-u);return h?Q(n,o-(e-c)):n}(e))}function g(e){return s=void 0,p&&r?f(e):(r=i=void 0,a)}function m(){var e=H(),n=d(e);if(r=arguments,i=this,u=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(y,t),l?f(e):a}(u);if(h)return s=setTimeout(y,t),f(u)}return void 0===s&&(s=setTimeout(y,t)),a}return t=K(t)||0,W(void 0)&&(l=!!(void 0).leading,o=(h="maxWait"in void 0)?Z(K((void 0).maxWait)||0,t):o,p="trailing"in void 0?!!(void 0).trailing:p),m.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=u=i=s=void 0},m.flush=function(){return void 0===s?a:g(H())},m}(this._onKeyDown,200)),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",function(e){this.eventManager.keyevent(e,this)}.bind(this));var r=document.createElement("div");r.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var i=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(i),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),t.appendChild(n),t.appendChild(this._inputEl),t.appendChild(r),this._typeahead=new I(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1),t},createIcon:function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+e),n.setAttribute("viewBox","0 0 18 18"),n.setAttribute("xml:space","preserve"),n.setAttribute("width",18),n.setAttribute("height",18),n.innerHTML=t,n},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_onKeyDown:function(e){var t=27,n=9;if(e.keyCode===t&&this.options.clearAndBlurOnEsc)return this._clear(e),this._inputEl.blur();var r=e.target&&e.target.shadowRoot?e.target.shadowRoot.activeElement:e.target;if(!r||!r.value)return this.fresh=!0,e.keyCode!==n&&this.clear(e),this._clearEl.style.display="none";e.metaKey||-1!==[n,t,37,39,13,38,40].indexOf(e.keyCode)||r.value.length>=this.options.minLength&&this._geocode(r.value)},_showButton:function(){this._typeahead.selected&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onBlur:function(e){this.options.clearOnBlur&&this._clearOnBlur(e),this.options.collapsed&&this._collapse()},_onChange:function(){var e=this._typeahead.selected;if(e&&e.id!==this.lastSelected){var t;if(this._clearEl.style.display="none",this.options.flyTo)if(e.properties&&!J[e.properties.short_code]&&e.bbox){var n=e.bbox;t=P({},this.options.flyTo),this._map.fitBounds([[n[0],n[1]],[n[2],n[3]]],t)}else e.properties&&J[e.properties.short_code]?(t=P({},this.options.flyTo),this._map.fitBounds(J[e.properties.short_code].bbox,t)):((t=P({},{zoom:this.options.zoom},this.options.flyTo)).center=e.center,this._map.flyTo(t));this.options.marker&&this._mapboxgl&&this._handleMarker(e),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this._eventEmitter.emit("result",{result:e}),this.eventManager.select(e,this),this.lastSelected=e.id}},_geocode:function(e){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:e}),this.inputString=e;var t,n=this,r=["bbox","limit","proximity","countries","types","language","reverseMode"].reduce(