(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.atlas = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i-1},AuthenticationContext.prototype.getCachedToken=function(t){if(!this._hasResource(t))return null;var e=this._getItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+t),i=this._getItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+t),n=this.config.expireOffsetSeconds||300;return i&&i>this._now()+n?e:(this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+t,""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+t,0),null)},AuthenticationContext.prototype.getCachedUser=function(){if(this._user)return this._user;var t=this._getItem(this.CONSTANTS.STORAGE.IDTOKEN);return this._user=this._createUser(t),this._user},AuthenticationContext.prototype.registerCallback=function(t,e,i){this._activeRenewals[e]=t,this._callBacksMappedToRenewStates[t]||(this._callBacksMappedToRenewStates[t]=[]);var n=this;this._callBacksMappedToRenewStates[t].push(i),this._callBackMappedToRenewStates[t]||(this._callBackMappedToRenewStates[t]=function(i,o,s,r){n._activeRenewals[e]=null;for(var a=0;a-1)){var e=this._user.profile.upn.split("@");t+="&domain_hint="+encodeURIComponent(e[e.length-1])}return t},AuthenticationContext.prototype._createUser=function(t){var e=null,i=this._extractIdToken(t);return i&&i.hasOwnProperty("aud")&&(i.aud.toLowerCase()===this.config.clientId.toLowerCase()?(e={userName:"",profile:i},i.hasOwnProperty("upn")?e.userName=i.upn:i.hasOwnProperty("email")&&(e.userName=i.email)):this.warn("IdToken has invalid aud field")),e},AuthenticationContext.prototype._getHash=function(t){return t.indexOf("#/")>-1?t=t.substring(t.indexOf("#/")+2):t.indexOf("#")>-1&&(t=t.substring(1)),t},AuthenticationContext.prototype.isCallback=function(t){t=this._getHash(t);var e=this._deserialize(t);return e.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION)||e.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)||e.hasOwnProperty(this.CONSTANTS.ID_TOKEN)},AuthenticationContext.prototype.getLoginError=function(){return this._getItem(this.CONSTANTS.STORAGE.LOGIN_ERROR)},AuthenticationContext.prototype.getRequestInfo=function(t){t=this._getHash(t);var e=this._deserialize(t),i={valid:!1,parameters:{},stateMatch:!1,stateResponse:"",requestType:this.REQUEST_TYPE.UNKNOWN};if(e&&(i.parameters=e,e.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION)||e.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)||e.hasOwnProperty(this.CONSTANTS.ID_TOKEN))){i.valid=!0;var n="";if(!e.hasOwnProperty("state"))return this.warn("No state returned"),i;if(this.verbose("State: "+e.state),n=e.state,i.stateResponse=n,this._matchState(i))return i;if(!i.stateMatch&&window.parent){i.requestType=this._requestType;for(var o=this._renewStates,s=0;s-1&&e+1-1)return null;if(this.config&&this.config.endpoints)for(var i in this.config.endpoints)if(t.indexOf(i)>-1)return this.config.endpoints[i];return t.indexOf("http://")>-1||t.indexOf("https://")>-1?this._getHostFromUri(t)===this._getHostFromUri(this.config.redirectUri)?this.config.loginResource:null:this.config.loginResource},AuthenticationContext.prototype._getHostFromUri=function(t){var e=String(t).replace(/^(https?:)\/\//,"");return e=e.split("/")[0]},AuthenticationContext.prototype.handleWindowCallback=function(t){if(null==t&&(t=window.location.hash),this.isCallback(t)){var e=null,i=!1;this._openedWindows.length>0&&this._openedWindows[this._openedWindows.length-1].opener&&this._openedWindows[this._openedWindows.length-1].opener._adalInstance?(e=this._openedWindows[this._openedWindows.length-1].opener._adalInstance,i=!0):window.parent&&window.parent._adalInstance&&(e=window.parent._adalInstance);var n,o,s=e.getRequestInfo(t),r=null;o=i||window.parent!==window?e._callBackMappedToRenewStates[s.stateResponse]:e.callback,e.info("Returned from redirect url"),e.saveTokenFromHash(s),s.requestType===this.REQUEST_TYPE.RENEW_TOKEN&&window.parent?(window.parent!==window?e.verbose("Window is in iframe, acquiring token silently"):e.verbose("acquiring token interactive in progress"),n=s.parameters[e.CONSTANTS.ACCESS_TOKEN]||s.parameters[e.CONSTANTS.ID_TOKEN],r=e.CONSTANTS.ACCESS_TOKEN):s.requestType===this.REQUEST_TYPE.LOGIN&&(n=s.parameters[e.CONSTANTS.ID_TOKEN],r=e.CONSTANTS.ID_TOKEN);var a=s.parameters[e.CONSTANTS.ERROR_DESCRIPTION],h=s.parameters[e.CONSTANTS.ERROR];try{o&&o(a,n,h,r)}catch(t){e.error("Error occurred in user defined callback function: "+t)}window.parent!==window||i||(e.config.navigateToLoginRequestUrl?window.location.href=e._getItem(e.CONSTANTS.STORAGE.LOGIN_REQUEST):window.location.hash="")}},AuthenticationContext.prototype._getNavigateUrl=function(t,e){var i="common";this.config.tenant&&(i=this.config.tenant);var n=this.instance+i+"/oauth2/authorize"+this._serialize(t,this.config,e)+this._addLibMetadata();return this.info("Navigate url:"+n),n},AuthenticationContext.prototype._extractIdToken=function(t){var e=this._decodeJwt(t);if(!e)return null;try{var i=e.JWSPayload,n=this._base64DecodeStringUrlSafe(i);return n?JSON.parse(n):(this.info("The returned id_token could not be base64 url safe decoded."),null)}catch(t){this.error("The returned id_token could not be decoded",t)}return null},AuthenticationContext.prototype._base64DecodeStringUrlSafe=function(t){return t=t.replace(/-/g,"+").replace(/_/g,"/"),window.atob?decodeURIComponent(escape(window.atob(t))):decodeURIComponent(escape(this._decode(t)))},AuthenticationContext.prototype._decode=function(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=(t=String(t).replace(/=+$/,"")).length;if(i%4==1)throw new Error("The token to be decoded is not correctly encoded.");for(var n,o,s,r,a,h,c,T,S="",u=0;u>16&255,c=a>>8&255,S+=String.fromCharCode(h,c);break}if(u+1===i-1){h=(a=n<<18|o<<12)>>16&255,S+=String.fromCharCode(h);break}h=(a=n<<18|o<<12|s<<6|r)>>16&255,c=a>>8&255,T=255&a,S+=String.fromCharCode(h,c,T)}return S},AuthenticationContext.prototype._decodeJwt=function(t){if(this._isEmpty(t))return null;var e=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);return!e||e.length<4?(this.warn("The returned id_token is not parseable."),null):{header:e[1],JWSPayload:e[2],JWSSig:e[3]}},AuthenticationContext.prototype._convertUrlSafeToRegularBase64EncodedString=function(t){return t.replace("-","+").replace("_","/")},AuthenticationContext.prototype._serialize=function(t,e,i){var n=[];if(null!==e){n.push("?response_type="+t),n.push("client_id="+encodeURIComponent(e.clientId)),i&&n.push("resource="+encodeURIComponent(i)),n.push("redirect_uri="+encodeURIComponent(e.redirectUri)),n.push("state="+encodeURIComponent(e.state)),e.hasOwnProperty("slice")&&n.push("slice="+encodeURIComponent(e.slice)),e.hasOwnProperty("extraQueryParameter")&&n.push(e.extraQueryParameter);var o=e.correlationId?e.correlationId:this._guid();n.push("client-request-id="+encodeURIComponent(o))}return n.join("&")},AuthenticationContext.prototype._deserialize=function(t){var e,i=/\+/g,n=/([^&=]+)=([^&]*)/g,o=function(t){return decodeURIComponent(t.replace(i," "))},s={};for(e=n.exec(t);e;)s[o(e[1])]=o(e[2]),e=n.exec(t);return s},AuthenticationContext.prototype._decimalToHex=function(t){for(var e=t.toString(16);e.length<2;)e="0"+e;return e},AuthenticationContext.prototype._guid=function(){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues){var e=new Uint8Array(16);return t.getRandomValues(e),e[6]|=64,e[6]&=79,e[8]|=128,e[8]&=191,this._decimalToHex(e[0])+this._decimalToHex(e[1])+this._decimalToHex(e[2])+this._decimalToHex(e[3])+"-"+this._decimalToHex(e[4])+this._decimalToHex(e[5])+"-"+this._decimalToHex(e[6])+this._decimalToHex(e[7])+"-"+this._decimalToHex(e[8])+this._decimalToHex(e[9])+"-"+this._decimalToHex(e[10])+this._decimalToHex(e[11])+this._decimalToHex(e[12])+this._decimalToHex(e[13])+this._decimalToHex(e[14])+this._decimalToHex(e[15])}for(var i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n="0123456789abcdef",o=0,s="",r=0;r<36;r++)"-"!==i[r]&&"4"!==i[r]&&(o=16*Math.random()|0),"x"===i[r]?s+=n[o]:"y"===i[r]?(o&=3,s+=n[o|=8]):s+=i[r];return s},AuthenticationContext.prototype._expiresIn=function(t){return t||(t=3599),this._now()+parseInt(t,10)},AuthenticationContext.prototype._now=function(){return Math.round((new Date).getTime()/1e3)},AuthenticationContext.prototype._addAdalFrame=function(t){if(void 0!==t){this.info("Add adal frame to document:"+t);var e=document.getElementById(t);if(!e){if(document.createElement&&document.documentElement&&(window.opera||-1===window.navigator.userAgent.indexOf("MSIE 5.0"))){var i=document.createElement("iframe");i.setAttribute("id",t),i.setAttribute("aria-hidden","true"),i.style.visibility="hidden",i.style.position="absolute",i.style.width=i.style.height=i.borderWidth="0px",e=document.getElementsByTagName("body")[0].appendChild(i)}else document.body&&document.body.insertAdjacentHTML&&document.body.insertAdjacentHTML("beforeEnd",'');window.frames&&window.frames[t]&&(e=window.frames[t])}return e}},AuthenticationContext.prototype._saveItem=function(t,e,i){if(this.config&&this.config.cacheLocation&&"localStorage"===this.config.cacheLocation){if(!this._supportsLocalStorage())return this.info("Local storage is not supported"),!1;if(i){var n=this._getItem(t)||"";localStorage.setItem(t,n+e+this.CONSTANTS.CACHE_DELIMETER)}else localStorage.setItem(t,e);return!0}return this._supportsSessionStorage()?(sessionStorage.setItem(t,e),!0):(this.info("Session storage is not supported"),!1)},AuthenticationContext.prototype._getItem=function(t){return this.config&&this.config.cacheLocation&&"localStorage"===this.config.cacheLocation?this._supportsLocalStorage()?localStorage.getItem(t):(this.info("Local storage is not supported"),null):this._supportsSessionStorage()?sessionStorage.getItem(t):(this.info("Session storage is not supported"),null)},AuthenticationContext.prototype._supportsLocalStorage=function(){try{return!!window.localStorage&&(window.localStorage.setItem("storageTest","A"),"A"==window.localStorage.getItem("storageTest")&&(window.localStorage.removeItem("storageTest"),!window.localStorage.getItem("storageTest")))}catch(t){return!1}},AuthenticationContext.prototype._supportsSessionStorage=function(){try{return!!window.sessionStorage&&(window.sessionStorage.setItem("storageTest","A"),"A"==window.sessionStorage.getItem("storageTest")&&(window.sessionStorage.removeItem("storageTest"),!window.sessionStorage.getItem("storageTest")))}catch(t){return!1}},AuthenticationContext.prototype._cloneConfig=function(t){if(null===t||"object"!=typeof t)return t;var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},AuthenticationContext.prototype._addLibMetadata=function(){return"&x-client-SKU=Js&x-client-Ver="+this._libVersion()},AuthenticationContext.prototype.log=function(t,e,i,n){if(t<=Logging.level){if(!Logging.piiLoggingEnabled&&n)return;var o=(new Date).toUTCString(),s="";s=this.config.correlationId?o+":"+this.config.correlationId+"-"+this._libVersion()+"-"+this.CONSTANTS.LEVEL_STRING_MAP[t]+" "+e:o+":"+this._libVersion()+"-"+this.CONSTANTS.LEVEL_STRING_MAP[t]+" "+e,i&&(s+="\nstack:\n"+i.stack),Logging.log(s)}},AuthenticationContext.prototype.error=function(t,e){this.log(this.CONSTANTS.LOGGING_LEVEL.ERROR,t,e)},AuthenticationContext.prototype.warn=function(t){this.log(this.CONSTANTS.LOGGING_LEVEL.WARN,t,null)},AuthenticationContext.prototype.info=function(t){this.log(this.CONSTANTS.LOGGING_LEVEL.INFO,t,null)},AuthenticationContext.prototype.verbose=function(t){this.log(this.CONSTANTS.LOGGING_LEVEL.VERBOSE,t,null)},AuthenticationContext.prototype.errorPii=function(t,e){this.log(this.CONSTANTS.LOGGING_LEVEL.ERROR,t,e,!0)},AuthenticationContext.prototype.warnPii=function(t){this.log(this.CONSTANTS.LOGGING_LEVEL.WARN,t,null,!0)},AuthenticationContext.prototype.infoPii=function(t){this.log(this.CONSTANTS.LOGGING_LEVEL.INFO,t,null,!0)},AuthenticationContext.prototype.verbosePii=function(t){this.log(this.CONSTANTS.LOGGING_LEVEL.VERBOSE,t,null,!0)},AuthenticationContext.prototype._libVersion=function(){return"1.0.17"},"undefined"!=typeof module&&module.exports&&(module.exports=AuthenticationContext,module.exports.inject=function(t){return new AuthenticationContext(t)}),AuthenticationContext}(); },{}],2:[function(require,module,exports){ "use strict";var AI,Microsoft;!function(t){t.ApplicationInsights||(t.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(t){!function(t){var n=function(){return function(){}}();t.Base=n}(t.Telemetry||(t.Telemetry={}))}(Microsoft||(Microsoft={})),function(t){!function(t){var n=function(){return function(){this.ver=1,this.sampleRate=100,this.tags={}}}();t.Envelope=n}(t.Telemetry||(t.Telemetry={}))}(Microsoft||(Microsoft={})),function(t){!function(t){t.Context||(t.Context={})}(t.ApplicationInsights||(t.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(t){!function(t){t.Context||(t.Context={})}(t.ApplicationInsights||(t.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(t){!function(t){t.Context||(t.Context={})}(t.ApplicationInsights||(t.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(t){!function(t){t.Context||(t.Context={})}(t.ApplicationInsights||(t.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(t){!function(t){t.Context||(t.Context={})}(t.ApplicationInsights||(t.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(t){!function(t){t.Context||(t.Context={})}(t.ApplicationInsights||(t.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(t){!function(t){t.Context||(t.Context={})}(t.ApplicationInsights||(t.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(t){!function(t){t.Context||(t.Context={})}(t.ApplicationInsights||(t.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(t){t.ApplicationInsights||(t.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(t){t.ApplicationInsights||(t.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(t){t.ApplicationInsights||(t.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(t){!function(t){t[t.Verbose=0]="Verbose",t[t.Information=1]="Information",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.Critical=4]="Critical"}(t.SeverityLevel||(t.SeverityLevel={}))}(AI||(AI={})),function(t){t.ApplicationInsights||(t.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(){}return t._createLazyMethod=function(n){var i=window[t.appInsightsName];i[n]=function(){var t=arguments;i.queue?i.queue.push(function(){return i[n].apply(i,t)}):i[n].apply(i,t)}},t._defineLazyMethods=function(){var n=window[t.appInsightsName];try{n.cookie=document.cookie}catch(t){}n.queue=[];for(var i=["clearAuthenticatedUserContext","flush","setAuthenticatedUserContext","startTrackEvent","startTrackPage","stopTrackEvent","stopTrackPage","trackDependency","trackEvent","trackException","trackMetric","trackPageView","trackTrace"];i.length;)t._createLazyMethod(i.pop())},t._download=function(n){t.appInsightsInstance.config=n;var i=window[t.appInsightsName];if(i.queue||(i.queue=[]),setTimeout(function(){var t=document.createElement("script");t.src=n.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js",document.head.appendChild(t)}),!n.disableExceptionTracking){t._createLazyMethod("_onerror");var o=window.onerror;window.onerror=function(t,n,e,s,c){var r=o&&o(t,n,e,s,c);return!0!==r&&i._onerror(t,n,e,s,c),r}}},Object.defineProperty(t,"appInsightsInstance",{get:function(){if("undefined"!=typeof window)return window[t.appInsightsName]||(window[t.appInsightsName]={downloadAndSetup:t._download,_defineLazyMethods:t._defineLazyMethods},t._defineLazyMethods()),window[t.appInsightsName]},enumerable:!0,configurable:!0}),t.appInsightsInitialized=!1,t.appInsightsName="appInsights",t}();n.AppInsights=i.appInsightsInstance}(require,exports); },{}],3:[function(require,module,exports){ var asn1=exports;asn1.bignum=require("bn.js"),asn1.define=require("./asn1/api").define,asn1.base=require("./asn1/base"),asn1.constants=require("./asn1/constants"),asn1.decoders=require("./asn1/decoders"),asn1.encoders=require("./asn1/encoders"); },{"./asn1/api":4,"./asn1/base":6,"./asn1/constants":10,"./asn1/decoders":12,"./asn1/encoders":15,"bn.js":18}],4:[function(require,module,exports){ var asn1=require("../asn1"),inherits=require("inherits"),api=exports;function Entity(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}api.define=function(e,t){return new Entity(e,t)},Entity.prototype._createNamed=function(e){var t;try{t=require("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){t=function(e){this._initNamed(e)}}return inherits(t,e),t.prototype._initNamed=function(t){e.call(this,t)},new t(this)},Entity.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(asn1.decoders[e])),this.decoders[e]},Entity.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},Entity.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(asn1.encoders[e])),this.encoders[e]},Entity.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}; },{"../asn1":3,"inherits":102,"vm":162}],5:[function(require,module,exports){ var inherits=require("inherits"),Reporter=require("../base").Reporter,Buffer=require("buffer").Buffer;function DecoderBuffer(e,r){Reporter.call(this,r),Buffer.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function EncoderBuffer(e,r){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof EncoderBuffer||(e=new EncoderBuffer(e,r)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return r.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=Buffer.byteLength(e);else{if(!Buffer.isBuffer(e))return r.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}inherits(DecoderBuffer,Reporter),exports.DecoderBuffer=DecoderBuffer,DecoderBuffer.prototype.save=function(){return{offset:this.offset,reporter:Reporter.prototype.save.call(this)}},DecoderBuffer.prototype.restore=function(e){var r=new DecoderBuffer(this.base);return r.offset=e.offset,r.length=this.offset,this.offset=e.offset,Reporter.prototype.restore.call(this,e.reporter),r},DecoderBuffer.prototype.isEmpty=function(){return this.offset===this.length},DecoderBuffer.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},DecoderBuffer.prototype.skip=function(e,r){if(!(this.offset+e<=this.length))return this.error(r||"DecoderBuffer overrun");var t=new DecoderBuffer(this.base);return t._reporterState=this._reporterState,t.offset=this.offset,t.length=this.offset+e,this.offset+=e,t},DecoderBuffer.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},exports.EncoderBuffer=EncoderBuffer,EncoderBuffer.prototype.join=function(e,r){return e||(e=new Buffer(this.length)),r||(r=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(t){t.join(e,r),r+=t.length}):("number"==typeof this.value?e[r]=this.value:"string"==typeof this.value?e.write(this.value,r):Buffer.isBuffer(this.value)&&this.value.copy(e,r),r+=this.length),e)}; },{"../base":6,"buffer":49,"inherits":102}],6:[function(require,module,exports){ var base=exports;base.Reporter=require("./reporter").Reporter,base.DecoderBuffer=require("./buffer").DecoderBuffer,base.EncoderBuffer=require("./buffer").EncoderBuffer,base.Node=require("./node"); },{"./buffer":5,"./node":7,"./reporter":8}],7:[function(require,module,exports){ var Reporter=require("../base").Reporter,EncoderBuffer=require("../base").EncoderBuffer,DecoderBuffer=require("../base").DecoderBuffer,assert=require("minimalistic-assert"),tags=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],methods=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(tags),overrided=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function Node(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}module.exports=Node;var stateProps=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Node.prototype.clone=function(){var e=this._baseState,t={};stateProps.forEach(function(r){t[r]=e[r]});var r=new this.constructor(t.parent);return r._baseState=t,r},Node.prototype._wrap=function(){var e=this._baseState;methods.forEach(function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},Node.prototype._init=function(e){var t=this._baseState;assert(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),assert.equal(t.children.length,1,"Root node can have only one child")},Node.prototype._useArgs=function(e){var t=this._baseState,r=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(assert(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(assert(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);var n=e[r];t[n]=r}),t}))},overrided.forEach(function(e){Node.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),tags.forEach(function(e){Node.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return assert(null===t.tag),t.tag=e,this._useArgs(r),this}}),Node.prototype.use=function(e){assert(e);var t=this._baseState;return assert(null===t.use),t.use=e,this},Node.prototype.optional=function(){return this._baseState.optional=!0,this},Node.prototype.def=function(e){var t=this._baseState;return assert(null===t.default),t.default=e,t.optional=!0,this},Node.prototype.explicit=function(e){var t=this._baseState;return assert(null===t.explicit&&null===t.implicit),t.explicit=e,this},Node.prototype.implicit=function(e){var t=this._baseState;return assert(null===t.explicit&&null===t.implicit),t.implicit=e,this},Node.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},Node.prototype.key=function(e){var t=this._baseState;return assert(null===t.key),t.key=e,this},Node.prototype.any=function(){return this._baseState.any=!0,this},Node.prototype.choice=function(e){var t=this._baseState;return assert(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},Node.prototype.contains=function(e){var t=this._baseState;return assert(null===t.use),t.contains=e,this},Node.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var n,i=r.default,o=!0,s=null;if(null!==r.key&&(s=e.enterKey(r.key)),r.optional){var c=null;if(null!==r.explicit?c=r.explicit:null!==r.implicit?c=r.implicit:null!==r.tag&&(c=r.tag),null!==c||r.any){if(o=this._peekTag(e,c,r.any),e.isError(o))return o}else{var u=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(u)}}if(r.obj&&o&&(n=e.enterObject()),o){if(null!==r.explicit){var l=this._decodeTag(e,r.explicit);if(e.isError(l))return l;e=l}var a=e.offset;if(null===r.use&&null===r.choice){if(r.any)u=e.save();var d=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(d))return d;r.any?i=e.raw(u):e=d}if(t&&t.track&&null!==r.tag&&t.track(e.path(),a,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),i=r.any?i:null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),e.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(e,t)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var f=new DecoderBuffer(i);i=this._getUse(r.contains,e._reporterState.obj)._decode(f,t)}}return r.obj&&o&&(i=e.leaveObject(n)),null===r.key||null===i&&!0!==o?null!==s&&e.exitKey(s):e.leaveKey(s,r.key,i),i},Node.prototype._decodeGeneric=function(e,t,r){var n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},Node.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),assert(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},Node.prototype._decodeChoice=function(e,t){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some(function(o){var s=e.save(),c=r.choice[o];try{var u=c._decode(e,t);if(e.isError(u))return!1;n={type:o,value:u},i=!0}catch(t){return e.restore(s),!1}return!0},this),i?n:e.error("Choice not matched")},Node.prototype._createEncoderBuffer=function(e){return new EncoderBuffer(e,this.reporter)},Node.prototype._encode=function(e,t,r){var n=this._baseState;if(null===n.default||n.default!==e){var i=this._encodeValue(e,t,r);if(void 0!==i&&!this._skipDefault(i,t,r))return i}},Node.prototype._encodeValue=function(e,t,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new Reporter);var i=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}var o=null,s=!1;if(n.any)i=this._createEncoderBuffer(e);else if(n.choice)i=this._encodeChoice(e,t);else if(n.contains)o=this._getUse(n.contains,r)._encode(e,t),s=!0;else if(n.children)o=n.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var n=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var i=r._encode(e[r._baseState.key],t,e);return t.leaveKey(n),i},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return t.error("Too many args for : "+n.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var c=this.clone();c._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(r){var n=this._baseState;return this._getUse(n.args[0],e)._encode(r,t)},c))}else null!==n.use?i=this._getUse(n.use,r)._encode(e,t):(o=this._encodePrimitive(n.tag,e),s=!0);if(!n.any&&null===n.choice){var u=null!==n.implicit?n.implicit:n.tag,l=null===n.implicit?"universal":"context";null===u?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(i=this._encodeComposite(u,s,l,o))}return null!==n.explicit&&(i=this._encodeComposite(n.explicit,!1,"context",i)),i},Node.prototype._encodeChoice=function(e,t){var r=this._baseState,n=r.choice[e.type];return n||assert(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},Node.prototype._encodePrimitive=function(e,t){var r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},Node.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},Node.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}; },{"../base":6,"minimalistic-assert":112}],8:[function(require,module,exports){ var inherits=require("inherits");function Reporter(r){this._reporterState={obj:null,path:[],options:r||{},errors:[]}}function ReporterError(r,t){this.path=r,this.rethrow(t)}exports.Reporter=Reporter,Reporter.prototype.isError=function(r){return r instanceof ReporterError},Reporter.prototype.save=function(){var r=this._reporterState;return{obj:r.obj,pathLen:r.path.length}},Reporter.prototype.restore=function(r){var t=this._reporterState;t.obj=r.obj,t.path=t.path.slice(0,r.pathLen)},Reporter.prototype.enterKey=function(r){return this._reporterState.path.push(r)},Reporter.prototype.exitKey=function(r){var t=this._reporterState;t.path=t.path.slice(0,r-1)},Reporter.prototype.leaveKey=function(r,t,e){var o=this._reporterState;this.exitKey(r),null!==o.obj&&(o.obj[t]=e)},Reporter.prototype.path=function(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function(){var r=this._reporterState,t=r.obj;return r.obj={},t},Reporter.prototype.leaveObject=function(r){var t=this._reporterState,e=t.obj;return t.obj=r,e},Reporter.prototype.error=function(r){var t,e=this._reporterState,o=r instanceof ReporterError;if(t=o?r:new ReporterError(e.path.map(function(r){return"["+JSON.stringify(r)+"]"}).join(""),r.message||r,r.stack),!e.options.partial)throw t;return o||e.errors.push(t),t},Reporter.prototype.wrapResult=function(r){var t=this._reporterState;return t.options.partial?{result:this.isError(r)?null:r,errors:t.errors}:r},inherits(ReporterError,Error),ReporterError.prototype.rethrow=function(r){if(this.message=r+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this}; },{"inherits":102}],9:[function(require,module,exports){ var constants=require("../constants");exports.tagClass={0:"universal",1:"application",2:"context",3:"private"},exports.tagClassByName=constants._reverse(exports.tagClass),exports.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},exports.tagByName=constants._reverse(exports.tag); },{"../constants":10}],10:[function(require,module,exports){ var constants=exports;constants._reverse=function(r){var e={};return Object.keys(r).forEach(function(n){(0|n)==n&&(n|=0);var t=r[n];e[t]=n}),e},constants.der=require("./der"); },{"./der":9}],11:[function(require,module,exports){ var inherits=require("inherits"),asn1=require("../../asn1"),base=asn1.base,bignum=asn1.bignum,der=asn1.constants.der;function DERDecoder(r){this.enc="der",this.name=r.name,this.entity=r,this.tree=new DERNode,this.tree._init(r.body)}function DERNode(r){base.Node.call(this,"der",r)}function derDecodeTag(r,e){var t=r.readUInt8(e);if(r.isError(t))return t;var i=der.tagClass[t>>6],o=0==(32&t);if(31==(31&t)){var n=t;for(t=0;128==(128&n);){if(n=r.readUInt8(e),r.isError(n))return n;t<<=7,t|=127&n}}else t&=31;return{cls:i,primitive:o,tag:t,tagStr:der.tag[t]}}function derDecodeLen(r,e,t){var i=r.readUInt8(t);if(r.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var o=127&i;if(o>4)return r.error("length octect is too long");i=0;for(var n=0;n=31?n.error("Multi-octet tag encoding unsupported"):(r||(o|=32),o|=der.tagClassByName[t||"universal"]<<6)}module.exports=DEREncoder,DEREncoder.prototype.encode=function(e,r){return this.tree._encode(e,r).join()},inherits(DERNode,base.Node),DERNode.prototype._encodeComposite=function(e,r,t,n){var o,i=encodeTag(e,r,t,this.reporter);if(n.length<128)return(o=new Buffer(2))[0]=i,o[1]=n.length,this._createEncoderBuffer([o,n]);for(var f=1,s=n.length;s>=256;s>>=8)f++;(o=new Buffer(2+f))[0]=i,o[1]=128|f;s=1+f;for(var u=n.length;u>0;s--,u>>=8)o[s]=255&u;return this._createEncoderBuffer([o,n])},DERNode.prototype._encodeStr=function(e,r){if("bitstr"===r)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===r){for(var t=new Buffer(2*e.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var o=0;for(n=0;n=128;i>>=7)o++}var f=new Buffer(o),s=f.length-1;for(n=e.length-1;n>=0;n--){i=e[n];for(f[s--]=127&i;(i>>=7)>0;)f[s--]=128|127&i}return this._createEncoderBuffer(f)},DERNode.prototype._encodeTime=function(e,r){var t,n=new Date(e);return"gentime"===r?t=[two(n.getFullYear()),two(n.getUTCMonth()+1),two(n.getUTCDate()),two(n.getUTCHours()),two(n.getUTCMinutes()),two(n.getUTCSeconds()),"Z"].join(""):"utctime"===r?t=[two(n.getFullYear()%100),two(n.getUTCMonth()+1),two(n.getUTCDate()),two(n.getUTCHours()),two(n.getUTCMinutes()),two(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(t,"octstr")},DERNode.prototype._encodeNull=function(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function(e,r){if("string"==typeof e){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if("number"!=typeof e&&!Buffer.isBuffer(e)){var t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=new Buffer(t)}if(Buffer.isBuffer(e)){var n=e.length;0===e.length&&n++;var o=new Buffer(n);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var i=e;i>=256;i>>=8)n++;for(i=(o=new Array(n)).length-1;i>=0;i--)o[i]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new Buffer(o))},DERNode.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},DERNode.prototype._use=function(e,r){return"function"==typeof e&&(e=e(r)),e._getEncoder("der").tree},DERNode.prototype._skipDefault=function(e,r,t){var n,o=this._baseState;if(null===o.default)return!1;var i=e.join();if(void 0===o.defaultBuffer&&(o.defaultBuffer=this._encodeValue(o.default,r,t).join()),i.length!==o.defaultBuffer.length)return!1;for(n=0;n0)throw new Error("Invalid string. Length must be a multiple of 4");var e=o.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function byteLength(o){var r=getLens(o),e=r[0],t=r[1];return 3*(e+t)/4-t}function _byteLength(o,r,e){return 3*(r+e)/4-e}function toByteArray(o){for(var r,e=getLens(o),t=e[0],n=e[1],u=new Arr(_byteLength(o,t,n)),p=0,a=n>0?t-4:t,h=0;h>16&255,u[p++]=r>>8&255,u[p++]=255&r;return 2===n&&(r=revLookup[o.charCodeAt(h)]<<2|revLookup[o.charCodeAt(h+1)]>>4,u[p++]=255&r),1===n&&(r=revLookup[o.charCodeAt(h)]<<10|revLookup[o.charCodeAt(h+1)]<<4|revLookup[o.charCodeAt(h+2)]>>2,u[p++]=r>>8&255,u[p++]=255&r),u}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}function encodeChunk(o,r,e){for(var t,n=[],u=r;up?p:u+16383));return 1===t?(r=o[e-1],n.push(lookup[r>>2]+lookup[r<<4&63]+"==")):2===t&&(r=(o[e-2]<<8)+o[e-1],n.push(lookup[r>>10]+lookup[r>>4&63]+lookup[r<<2&63]+"=")),n.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63; },{}],18:[function(require,module,exports){ !function(t,i){"use strict";function r(t,i){if(!t)throw new Error(i||"Assertion failed")}function h(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,i,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var e;"object"==typeof t?t.exports=n:i.BN=n,n.BN=n,n.wordSize=26;try{e=require("buffer").Buffer}catch(t){}function o(t,i,r){for(var h=0,n=Math.min(t.length,r),e=i;e=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return h}function s(t,i,r,h){for(var n=0,e=Math.min(t.length,r),o=i;o=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,i){return t.cmp(i)>0?t:i},n.min=function(t,i){return t.cmp(i)<0?t:i},n.prototype._init=function(t,i,h){if("number"==typeof t)return this._initNumber(t,i,h);if("object"==typeof t)return this._initArray(t,i,h);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===i?this._parseHex(t,n):this._parseBase(t,i,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initNumber=function(t,i,h){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initArray=function(t,i,h){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===h)for(n=0,e=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},n.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)n=o(t,r,r+6),this.words[h]|=n<>>26-e&4194303,(e+=24)>=26&&(e-=26,h++);r+6!==i&&(n=o(t,i,r+6),this.words[h]|=n<>>26-e&4194303),this.strip()},n.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var h=0,n=1;n<=67108863;n*=i)h++;h--,n=n/i|0;for(var e=t.length-r,o=e%h,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],a=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,i,r){r.negative=i.negative^t.negative;var h=t.length+i.length|0;r.length=h,h=h-1|0;var n=0|t.words[0],e=0|i.words[0],o=n*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,i){var h;if(i=0|i||1,16===(t=t||10)||"hex"===t){h="";for(var n=0,e=0,o=0;o>>24-n&16777215)||o!==this.length-1?u[6-m.length]+m+h:m+h,(n+=2)>=26&&(n-=26,o--)}for(0!==e&&(h=e.toString(16)+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}if(t===(0|t)&&t>=2&&t<=36){var f=a[t],d=l[t];h="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);h=(p=p.idivn(d)).isZero()?M+h:u[f-M.length]+M+h}for(this.isZero()&&(h="0"+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,i){return r(void 0!==e),this.toArrayLike(e,t,i)},n.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},n.prototype.toArrayLike=function(t,i,h){var n=this.byteLength(),e=h||Math.max(1,n);r(n<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(e),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},n.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var h=0;ht.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),h=t%26;this._expand(i),h>0&&i--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-h),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var h=t/26|0,n=t%26;return this._expand(h+1),this.words[h]=i?this.words[h]|1<t.length?(r=this,h=t):(r=t,h=this);for(var n=0,e=0;e>>26;for(;0!==n&&e>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,h,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,h=t):(r=t,h=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,x=0|o[5],S=8191&x,Z=x>>>13,R=0|o[6],B=8191&R,q=R>>>13,N=0|o[7],L=8191&N,I=N>>>13,z=0|o[8],T=8191&z,E=z>>>13,O=0|o[9],F=8191&O,C=O>>>13,D=0|s[0],H=8191&D,K=D>>>13,J=0|s[1],U=8191&J,G=J>>>13,P=0|s[2],Q=8191&P,V=P>>>13,W=0|s[3],X=8191&W,Y=W>>>13,$=0|s[4],j=8191&$,tt=$>>>13,it=0|s[5],rt=8191&it,ht=it>>>13,nt=0|s[6],et=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(h=Math.imul(m,H))|0)+((8191&(n=(n=Math.imul(m,K))+Math.imul(f,H)|0))<<13)|0;a=((e=Math.imul(f,K))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,h=Math.imul(p,H),n=(n=Math.imul(p,K))+Math.imul(M,H)|0,e=Math.imul(M,K);var gt=(a+(h=h+Math.imul(m,U)|0)|0)+((8191&(n=(n=n+Math.imul(m,G)|0)+Math.imul(f,U)|0))<<13)|0;a=((e=e+Math.imul(f,G)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,h=Math.imul(g,H),n=(n=Math.imul(g,K))+Math.imul(c,H)|0,e=Math.imul(c,K),h=h+Math.imul(p,U)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(M,U)|0,e=e+Math.imul(M,G)|0;var ct=(a+(h=h+Math.imul(m,Q)|0)|0)+((8191&(n=(n=n+Math.imul(m,V)|0)+Math.imul(f,Q)|0))<<13)|0;a=((e=e+Math.imul(f,V)|0)+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,h=Math.imul(y,H),n=(n=Math.imul(y,K))+Math.imul(b,H)|0,e=Math.imul(b,K),h=h+Math.imul(g,U)|0,n=(n=n+Math.imul(g,G)|0)+Math.imul(c,U)|0,e=e+Math.imul(c,G)|0,h=h+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(M,Q)|0,e=e+Math.imul(M,V)|0;var wt=(a+(h=h+Math.imul(m,X)|0)|0)+((8191&(n=(n=n+Math.imul(m,Y)|0)+Math.imul(f,X)|0))<<13)|0;a=((e=e+Math.imul(f,Y)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,h=Math.imul(k,H),n=(n=Math.imul(k,K))+Math.imul(A,H)|0,e=Math.imul(A,K),h=h+Math.imul(y,U)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,U)|0,e=e+Math.imul(b,G)|0,h=h+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,V)|0)+Math.imul(c,Q)|0,e=e+Math.imul(c,V)|0,h=h+Math.imul(p,X)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(M,X)|0,e=e+Math.imul(M,Y)|0;var yt=(a+(h=h+Math.imul(m,j)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,j)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,h=Math.imul(S,H),n=(n=Math.imul(S,K))+Math.imul(Z,H)|0,e=Math.imul(Z,K),h=h+Math.imul(k,U)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(A,U)|0,e=e+Math.imul(A,G)|0,h=h+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(b,Q)|0,e=e+Math.imul(b,V)|0,h=h+Math.imul(g,X)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(c,X)|0,e=e+Math.imul(c,Y)|0,h=h+Math.imul(p,j)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(M,j)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(h=h+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ht)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,ht)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,h=Math.imul(B,H),n=(n=Math.imul(B,K))+Math.imul(q,H)|0,e=Math.imul(q,K),h=h+Math.imul(S,U)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(Z,U)|0,e=e+Math.imul(Z,G)|0,h=h+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,V)|0)+Math.imul(A,Q)|0,e=e+Math.imul(A,V)|0,h=h+Math.imul(y,X)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,X)|0,e=e+Math.imul(b,Y)|0,h=h+Math.imul(g,j)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(c,j)|0,e=e+Math.imul(c,tt)|0,h=h+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,ht)|0;var _t=(a+(h=h+Math.imul(m,et)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,h=Math.imul(L,H),n=(n=Math.imul(L,K))+Math.imul(I,H)|0,e=Math.imul(I,K),h=h+Math.imul(B,U)|0,n=(n=n+Math.imul(B,G)|0)+Math.imul(q,U)|0,e=e+Math.imul(q,G)|0,h=h+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(Z,Q)|0,e=e+Math.imul(Z,V)|0,h=h+Math.imul(k,X)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(A,X)|0,e=e+Math.imul(A,Y)|0,h=h+Math.imul(y,j)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,j)|0,e=e+Math.imul(b,tt)|0,h=h+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,ht)|0,h=h+Math.imul(p,et)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(h=h+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,h=Math.imul(T,H),n=(n=Math.imul(T,K))+Math.imul(E,H)|0,e=Math.imul(E,K),h=h+Math.imul(L,U)|0,n=(n=n+Math.imul(L,G)|0)+Math.imul(I,U)|0,e=e+Math.imul(I,G)|0,h=h+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul(q,Q)|0,e=e+Math.imul(q,V)|0,h=h+Math.imul(S,X)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(Z,X)|0,e=e+Math.imul(Z,Y)|0,h=h+Math.imul(k,j)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,j)|0,e=e+Math.imul(A,tt)|0,h=h+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,ht)|0,h=h+Math.imul(g,et)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,h=h+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(h=h+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,h=Math.imul(F,H),n=(n=Math.imul(F,K))+Math.imul(C,H)|0,e=Math.imul(C,K),h=h+Math.imul(T,U)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(E,U)|0,e=e+Math.imul(E,G)|0,h=h+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(I,Q)|0,e=e+Math.imul(I,V)|0,h=h+Math.imul(B,X)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(q,X)|0,e=e+Math.imul(q,Y)|0,h=h+Math.imul(S,j)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(Z,j)|0,e=e+Math.imul(Z,tt)|0,h=h+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,ht)|0,h=h+Math.imul(y,et)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,h=h+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,h=h+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var xt=(a+(h=h+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h=Math.imul(F,U),n=(n=Math.imul(F,G))+Math.imul(C,U)|0,e=Math.imul(C,G),h=h+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,V)|0)+Math.imul(E,Q)|0,e=e+Math.imul(E,V)|0,h=h+Math.imul(L,X)|0,n=(n=n+Math.imul(L,Y)|0)+Math.imul(I,X)|0,e=e+Math.imul(I,Y)|0,h=h+Math.imul(B,j)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(q,j)|0,e=e+Math.imul(q,tt)|0,h=h+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,ht)|0,h=h+Math.imul(k,et)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,h=h+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,h=h+Math.imul(g,mt)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var St=(a+(h=h+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,h=Math.imul(F,Q),n=(n=Math.imul(F,V))+Math.imul(C,Q)|0,e=Math.imul(C,V),h=h+Math.imul(T,X)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(E,X)|0,e=e+Math.imul(E,Y)|0,h=h+Math.imul(L,j)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(I,j)|0,e=e+Math.imul(I,tt)|0,h=h+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,ht)|0)+Math.imul(q,rt)|0,e=e+Math.imul(q,ht)|0,h=h+Math.imul(S,et)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,h=h+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,h=h+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var Zt=(a+(h=h+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(n>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,h=Math.imul(F,X),n=(n=Math.imul(F,Y))+Math.imul(C,X)|0,e=Math.imul(C,Y),h=h+Math.imul(T,j)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(E,j)|0,e=e+Math.imul(E,tt)|0,h=h+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,ht)|0,h=h+Math.imul(B,et)|0,n=(n=n+Math.imul(B,ot)|0)+Math.imul(q,et)|0,e=e+Math.imul(q,ot)|0,h=h+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,h=h+Math.imul(k,mt)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var Rt=(a+(h=h+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,h=Math.imul(F,j),n=(n=Math.imul(F,tt))+Math.imul(C,j)|0,e=Math.imul(C,tt),h=h+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(E,rt)|0,e=e+Math.imul(E,ht)|0,h=h+Math.imul(L,et)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,h=h+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(q,ut)|0,e=e+Math.imul(q,at)|0,h=h+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Bt=(a+(h=h+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,h=Math.imul(F,rt),n=(n=Math.imul(F,ht))+Math.imul(C,rt)|0,e=Math.imul(C,ht),h=h+Math.imul(T,et)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(E,et)|0,e=e+Math.imul(E,ot)|0,h=h+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,h=h+Math.imul(B,mt)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul(q,mt)|0,e=e+Math.imul(q,ft)|0;var qt=(a+(h=h+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,h=Math.imul(F,et),n=(n=Math.imul(F,ot))+Math.imul(C,et)|0,e=Math.imul(C,ot),h=h+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(E,ut)|0,e=e+Math.imul(E,at)|0,h=h+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Nt=(a+(h=h+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,Mt)|0)+Math.imul(q,pt)|0))<<13)|0;a=((e=e+Math.imul(q,Mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h=Math.imul(F,ut),n=(n=Math.imul(F,at))+Math.imul(C,ut)|0,e=Math.imul(C,at),h=h+Math.imul(T,mt)|0,n=(n=n+Math.imul(T,ft)|0)+Math.imul(E,mt)|0,e=e+Math.imul(E,ft)|0;var Lt=(a+(h=h+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h=Math.imul(F,mt),n=(n=Math.imul(F,ft))+Math.imul(C,mt)|0,e=Math.imul(C,ft);var It=(a+(h=h+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,Mt)|0)+Math.imul(E,pt)|0))<<13)|0;a=((e=e+Math.imul(E,Mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var zt=(a+(h=Math.imul(F,pt))|0)+((8191&(n=(n=Math.imul(F,Mt))+Math.imul(C,pt)|0))<<13)|0;return a=((e=Math.imul(C,Mt))+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=xt,u[10]=St,u[11]=Zt,u[12]=Rt,u[13]=Bt,u[14]=qt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function d(t,i,r){return(new p).mulp(t,i,r)}function p(t,i){this.x=t,this.y=i}Math.imul||(f=m),n.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,i):r<63?m(this,t,i):r<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var h=0,n=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,h=o,o=n}return 0!==h?r.words[e]=h:r.length--,r.strip()}(this,t,i):d(this,t,i)},p.prototype.makeRBT=function(t){for(var i=new Array(t),r=n.prototype._countBits(t)-1,h=0;h>=1;return h},p.prototype.permute=function(t,i,r,h,n,e){for(var o=0;o>>=1)n++;return 1<>>=13,h[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,i+=n/67108864|0,i+=e>>>26,this.words[h]=67108863&e}return 0!==i&&(this.words[h]=i,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>n}return i}(t);if(0===i.length)return new n(1);for(var r=this,h=0;h=0);var i,h=t%26,n=(t-h)/26,e=67108863>>>26-h<<26-h;if(0!==h){var o=0;for(i=0;i>>26-h}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i=0),n=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,i,h){return r(0===this.negative),this.iushrn(t,i,h)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,h=(t-i)/26,n=1<=0);var i=t%26,h=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=h)return this;if(0!==i&&h++,this.length=Math.min(h,this.length),0!==i){var n=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(u/67108864|0),this.words[n+h]=67108863&e}for(;n>26,this.words[n+h]=67108863&e;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n>26,this.words[n]=67108863&e;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,i){var r=(this.length,t.length),h=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),h.iushln(r),o=0|e.words[e.length-1]);var s,u=h.length-e.length;if("mod"!==i){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|h.words[e.length+m])+(0|h.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),h._ishlnsubmul(e,f,m);0!==h.negative;)f--,h.negative=0,h._ishlnsubmul(e,1,m),h.isZero()||(h.negative^=1);s&&(s.words[m]=f)}return s&&s.strip(),h.strip(),"div"!==i&&0!==r&&h.iushrn(r),{div:s||null,mod:h}},n.prototype.divmod=function(t,i,h){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,h=t.ushrn(1),n=t.andln(1),e=r.cmp(h);return e<0||1===n&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,h=0,n=this.length-1;n>=0;n--)h=(i*h+(0|this.words[n]))%t;return h},n.prototype.idivn=function(t){r(t<=67108863);for(var i=0,h=this.length-1;h>=0;h--){var n=(0|this.words[h])+67108864*i;this.words[h]=n/t|0,i=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new n(1),o=new n(0),s=new n(0),u=new n(1),a=0;i.isEven()&&h.isEven();)i.iushrn(1),h.iushrn(1),++a;for(var l=h.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(h.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(h.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(h)>=0?(i.isub(h),e.isub(s),o.isub(u)):(h.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:h.iushln(a)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new n(1),s=new n(0),u=h.clone();i.cmpn(1)>0&&h.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(h.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(h.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(h)>=0?(i.isub(h),o.isub(s)):(h.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var h=0;i.isEven()&&r.isEven();h++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var e=i;i=r,r=e}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(h)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,h=(t-i)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var i,h=t<0;if(0!==this.negative&&!h)return-1;if(0===this.negative&&h)return 1;if(this.strip(),this.length>1)i=1;else{h&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:nt.length)return 1;if(this.length=0;r--){var h=0|this.words[r],n=0|t.words[r];if(h!==n){hn&&(i=1);break}}return i},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new b(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};function v(t,i){this.name=t,this.p=new n(i,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function c(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function b(t){if("string"==typeof t){var i=n._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){b.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var h=i0?r.isub(this.p):r.strip(),r},v.prototype.split=function(t,i){t.iushrn(this.n,0,i)},v.prototype.imulK=function(t){return t.imul(this.k)},h(g,v),g.prototype.split=function(t,i){for(var r=Math.min(t.length,9),h=0;h>>22,n=e}n>>>=22,t.words[h-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r>>=26,t.words[r]=n,i=h}return 0!==i&&(t.words[t.length++]=i),t},n._prime=function(t){if(M[t])return M[t];var i;if("k256"===t)i=new g;else if("p224"===t)i=new c;else if("p192"===t)i=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new y}return M[t]=i,i},b.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},b.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},b.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},b.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},b.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},b.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},b.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},b.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},b.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},b.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},b.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},b.prototype.isqr=function(t){return this.imul(t,t.clone())},b.prototype.sqr=function(t){return this.mul(t,t)},b.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var h=this.m.add(new n(1)).iushrn(2);return this.pow(t,h)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new n(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;h--){for(var a=i.words[h],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===h&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},b.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},b.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},n.mont=function(t){return new _(t)},h(_,b),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},_.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(h).iushrn(this.shift),e=n;return n.cmp(this.m)>=0?e=n.isub(this.m):n.cmpn(0)<0&&(e=n.iadd(this.m)),e._forceRed(this)},_.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new n(0)._forceRed(this);var r=t.mul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(h).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); },{"buffer":20}],19:[function(require,module,exports){ var r;function Rand(t){this.rand=t}if(module.exports=function(t){return r||(r=new Rand(null)),r.generate(t)},module.exports.Rand=Rand,Rand.prototype.generate=function(t){return this._rand(t)},Rand.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n>>24]^f[_>>>16&255]^a[I>>>8&255]^s[255&l]^e[X++],B=u[_>>>24]^f[I>>>16&255]^a[l>>>8&255]^s[255&y]^e[X++],c=u[I>>>24]^f[l>>>16&255]^a[y>>>8&255]^s[255&_]^e[X++],i=u[l>>>24]^f[y>>>16&255]^a[_>>>8&255]^s[255&I]^e[X++],y=S,_=B,I=c,l=i;return S=(n[y>>>24]<<24|n[_>>>16&255]<<16|n[I>>>8&255]<<8|n[255&l])^e[X++],B=(n[_>>>24]<<24|n[I>>>16&255]<<16|n[l>>>8&255]<<8|n[255&y])^e[X++],c=(n[I>>>24]<<24|n[l>>>16&255]<<16|n[y>>>8&255]<<8|n[255&_])^e[X++],i=(n[l>>>24]<<24|n[y>>>16&255]<<16|n[_>>>8&255]<<8|n[255&I])^e[X++],[S>>>=0,B>>>=0,c>>>=0,i>>>=0]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var r=new Array(256),e=0;e<256;e++)r[e]=e<128?e<<1:e<<1^283;for(var t=[],n=[],o=[[],[],[],[]],S=[[],[],[],[]],B=0,c=0,i=0;i<256;++i){var u=c^c<<1^c<<2^c<<3^c<<4;u=u>>>8^255&u^99,t[B]=u,n[u]=B;var f=r[B],a=r[f],s=r[a],y=257*r[u]^16843008*u;o[0][B]=y<<24|y>>>8,o[1][B]=y<<16|y>>>16,o[2][B]=y<<8|y>>>24,o[3][B]=y,y=16843009*s^65537*a^257*f^16843008*B,S[0][u]=y<<24|y>>>8,S[1][u]=y<<16|y>>>16,S[2][u]=y<<8|y>>>24,S[3][u]=y,0===B?B=c=1:(B=f^r[r[r[s^f]]],c^=r[r[c]])}return{SBOX:t,INV_SBOX:n,SUB_MIX:o,INV_SUB_MIX:S}}();function AES(r){this._key=asUInt32Array(r),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var r=this._key,e=r.length,t=e+6,n=4*(t+1),o=[],S=0;S>>24,B=G.SBOX[B>>>24]<<24|G.SBOX[B>>>16&255]<<16|G.SBOX[B>>>8&255]<<8|G.SBOX[255&B],B^=RCON[S/e|0]<<24):e>6&&S%e==4&&(B=G.SBOX[B>>>24]<<24|G.SBOX[B>>>16&255]<<16|G.SBOX[B>>>8&255]<<8|G.SBOX[255&B]),o[S]=o[S-e]^B}for(var c=[],i=0;i>>24]]^G.INV_SUB_MIX[1][G.SBOX[f>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[f>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[255&f]]}this._nRounds=t,this._keySchedule=o,this._invKeySchedule=c},AES.prototype.encryptBlockRaw=function(r){return cryptBlock(r=asUInt32Array(r),this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(r){var e=this.encryptBlockRaw(r),t=Buffer.allocUnsafe(16);return t.writeUInt32BE(e[0],0),t.writeUInt32BE(e[1],4),t.writeUInt32BE(e[2],8),t.writeUInt32BE(e[3],12),t},AES.prototype.decryptBlock=function(r){var e=(r=asUInt32Array(r))[1];r[1]=r[3],r[3]=e;var t=cryptBlock(r,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),n=Buffer.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[3],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[1],12),n},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},module.exports.AES=AES; },{"safe-buffer":148}],22:[function(require,module,exports){ var aes=require("./aes"),Buffer=require("safe-buffer").Buffer,Transform=require("cipher-base"),inherits=require("inherits"),GHASH=require("./ghash"),xor=require("buffer-xor"),incr32=require("./incr32");function xorTest(t,e){var r=0;t.length!==e.length&&r++;for(var a=Math.min(t.length,e.length),i=0;i16)throw new Error("unable to decrypt data");for(var t=-1;++t16)return r=this.cache.slice(0,16),this.cache=this.cache.slice(16),r}else if(this.cache.length>=16)return r=this.cache.slice(0,16),this.cache=this.cache.slice(16),r;return null},Splitter.prototype.flush=function(){if(this.cache.length)return this.cache},exports.createDecipher=createDecipher,exports.createDecipheriv=createDecipheriv; },{"./aes":21,"./authCipher":22,"./modes":34,"./streamCipher":37,"cipher-base":50,"evp_bytestokey":86,"inherits":102,"safe-buffer":148}],25:[function(require,module,exports){ var MODES=require("./modes"),AuthCipher=require("./authCipher"),Buffer=require("safe-buffer").Buffer,StreamCipher=require("./streamCipher"),Transform=require("cipher-base"),aes=require("./aes"),ebtk=require("evp_bytestokey"),inherits=require("inherits");function Cipher(e,r,t){Transform.call(this),this._cache=new Splitter,this._cipher=new aes.AES(r),this._prev=Buffer.from(t),this._mode=e,this._autopadding=!0}inherits(Cipher,Transform),Cipher.prototype._update=function(e){var r,t;this._cache.add(e);for(var i=[];r=this._cache.get();)t=this._mode.encrypt(this,r),i.push(t);return Buffer.concat(i)};var PADDING=Buffer.alloc(16,16);function Splitter(){this.cache=Buffer.allocUnsafe(0)}function createCipheriv(e,r,t){var i=MODES[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=Buffer.from(r)),r.length!==i.key/8)throw new TypeError("invalid key length "+r.length);if("string"==typeof t&&(t=Buffer.from(t)),"GCM"!==i.mode&&t.length!==i.iv)throw new TypeError("invalid iv length "+t.length);return"stream"===i.type?new StreamCipher(i.module,r,t):"auth"===i.type?new AuthCipher(i.module,r,t):new Cipher(i.module,r,t)}function createCipher(e,r){var t=MODES[e.toLowerCase()];if(!t)throw new TypeError("invalid suite type");var i=ebtk(r,!1,t.key,t.iv);return createCipheriv(e,i.key,i.iv)}Cipher.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Splitter.prototype.add=function(e){this.cache=Buffer.concat([this.cache,e])},Splitter.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},Splitter.prototype.flush=function(){for(var e=16-this.cache.length,r=Buffer.allocUnsafe(e),t=-1;++t>>0,0),r.writeUInt32BE(t[1]>>>0,4),r.writeUInt32BE(t[2]>>>0,8),r.writeUInt32BE(t[3]>>>0,12),r}function GHASH(t){this.h=t,this.state=Buffer.alloc(16,0),this.cache=Buffer.allocUnsafe(0)}GHASH.prototype.ghash=function(t){for(var r=-1;++r0;t--)e[t]=e[t]>>>1|(1&e[t-1])<<31;e[0]=e[0]>>>1,r&&(e[0]=e[0]^225<<24)}this.state=fromArray(a)},GHASH.prototype.update=function(t){var r;for(this.cache=Buffer.concat([this.cache,t]);this.cache.length>=16;)r=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(r)},GHASH.prototype.final=function(t,r){return this.cache.length&&this.ghash(Buffer.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,t,0,r])),this.state},module.exports=GHASH; },{"safe-buffer":148}],27:[function(require,module,exports){ function incr32(r){for(var n,t=r.length;t--;){if(255!==(n=r.readUInt8(t))){n++,r.writeUInt8(n,t);break}r.writeUInt8(0,t)}}module.exports=incr32; },{}],28:[function(require,module,exports){ var xor=require("buffer-xor");exports.encrypt=function(r,e){var p=xor(e,r._prev);return r._prev=r._cipher.encryptBlock(p),r._prev},exports.decrypt=function(r,e){var p=r._prev;r._prev=e;var c=r._cipher.decryptBlock(e);return xor(c,p)}; },{"buffer-xor":48}],29:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer,xor=require("buffer-xor");function encryptStart(e,r,c){var f=r.length,t=xor(r,e._cache);return e._cache=e._cache.slice(f),e._prev=Buffer.concat([e._prev,c?r:t]),t}exports.encrypt=function(e,r,c){for(var f,t=Buffer.allocUnsafe(0);r.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=Buffer.allocUnsafe(0)),!(e._cache.length<=r.length)){t=Buffer.concat([t,encryptStart(e,r,c)]);break}f=e._cache.length,t=Buffer.concat([t,encryptStart(e,r.slice(0,f),c)]),r=r.slice(f)}return t}; },{"buffer-xor":48,"safe-buffer":148}],30:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer;function encryptByte(r,e,f){for(var n,t,u=-1,c=0;++u<8;)n=e&1<<7-u?128:0,c+=(128&(t=r._cipher.encryptBlock(r._prev)[0]^n))>>u%8,r._prev=shiftIn(r._prev,f?n:t);return c}function shiftIn(r,e){var f=r.length,n=-1,t=Buffer.allocUnsafe(r.length);for(r=Buffer.concat([r,Buffer.from([e])]);++n>7;return t}exports.encrypt=function(r,e,f){for(var n=e.length,t=Buffer.allocUnsafe(n),u=-1;++u=0||!r.umod(e.prime1)||!r.umod(e.prime2);)r=new bn(randomBytes(n));return r}module.exports=crt,crt.getr=getr; }).call(this,require("buffer").Buffer) },{"bn.js":18,"buffer":49,"randombytes":132}],42:[function(require,module,exports){ module.exports=require("./browser/algorithms.json"); },{"./browser/algorithms.json":43}],43:[function(require,module,exports){ module.exports={ "sha224WithRSAEncryption": { "sign": "rsa", "hash": "sha224", "id": "302d300d06096086480165030402040500041c" }, "RSA-SHA224": { "sign": "ecdsa/rsa", "hash": "sha224", "id": "302d300d06096086480165030402040500041c" }, "sha256WithRSAEncryption": { "sign": "rsa", "hash": "sha256", "id": "3031300d060960864801650304020105000420" }, "RSA-SHA256": { "sign": "ecdsa/rsa", "hash": "sha256", "id": "3031300d060960864801650304020105000420" }, "sha384WithRSAEncryption": { "sign": "rsa", "hash": "sha384", "id": "3041300d060960864801650304020205000430" }, "RSA-SHA384": { "sign": "ecdsa/rsa", "hash": "sha384", "id": "3041300d060960864801650304020205000430" }, "sha512WithRSAEncryption": { "sign": "rsa", "hash": "sha512", "id": "3051300d060960864801650304020305000440" }, "RSA-SHA512": { "sign": "ecdsa/rsa", "hash": "sha512", "id": "3051300d060960864801650304020305000440" }, "RSA-SHA1": { "sign": "rsa", "hash": "sha1", "id": "3021300906052b0e03021a05000414" }, "ecdsa-with-SHA1": { "sign": "ecdsa", "hash": "sha1", "id": "" }, "sha256": { "sign": "ecdsa", "hash": "sha256", "id": "" }, "sha224": { "sign": "ecdsa", "hash": "sha224", "id": "" }, "sha384": { "sign": "ecdsa", "hash": "sha384", "id": "" }, "sha512": { "sign": "ecdsa", "hash": "sha512", "id": "" }, "DSA-SHA": { "sign": "dsa", "hash": "sha1", "id": "" }, "DSA-SHA1": { "sign": "dsa", "hash": "sha1", "id": "" }, "DSA": { "sign": "dsa", "hash": "sha1", "id": "" }, "DSA-WITH-SHA224": { "sign": "dsa", "hash": "sha224", "id": "" }, "DSA-SHA224": { "sign": "dsa", "hash": "sha224", "id": "" }, "DSA-WITH-SHA256": { "sign": "dsa", "hash": "sha256", "id": "" }, "DSA-SHA256": { "sign": "dsa", "hash": "sha256", "id": "" }, "DSA-WITH-SHA384": { "sign": "dsa", "hash": "sha384", "id": "" }, "DSA-SHA384": { "sign": "dsa", "hash": "sha384", "id": "" }, "DSA-WITH-SHA512": { "sign": "dsa", "hash": "sha512", "id": "" }, "DSA-SHA512": { "sign": "dsa", "hash": "sha512", "id": "" }, "DSA-RIPEMD160": { "sign": "dsa", "hash": "rmd160", "id": "" }, "ripemd160WithRSA": { "sign": "rsa", "hash": "rmd160", "id": "3021300906052b2403020105000414" }, "RSA-RIPEMD160": { "sign": "rsa", "hash": "rmd160", "id": "3021300906052b2403020105000414" }, "md5WithRSAEncryption": { "sign": "rsa", "hash": "md5", "id": "3020300c06082a864886f70d020505000410" }, "RSA-MD5": { "sign": "rsa", "hash": "md5", "id": "3020300c06082a864886f70d020505000410" } } },{}],44:[function(require,module,exports){ module.exports={ "1.3.132.0.10": "secp256k1", "1.3.132.0.33": "p224", "1.2.840.10045.3.1.1": "p192", "1.2.840.10045.3.1.7": "p256", "1.3.132.0.34": "p384", "1.3.132.0.35": "p521" } },{}],45:[function(require,module,exports){ (function (Buffer){ var createHash=require("create-hash"),stream=require("stream"),inherits=require("inherits"),sign=require("./sign"),verify=require("./verify"),algorithms=require("./algorithms.json");function Sign(e){stream.Writable.call(this);var t=algorithms[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=createHash(t.hash),this._tag=t.id,this._signType=t.sign}function Verify(e){stream.Writable.call(this);var t=algorithms[e];if(!t)throw new Error("Unknown message digest");this._hash=createHash(t.hash),this._tag=t.id,this._signType=t.sign}function createSign(e){return new Sign(e)}function createVerify(e){return new Verify(e)}Object.keys(algorithms).forEach(function(e){algorithms[e].id=new Buffer(algorithms[e].id,"hex"),algorithms[e.toLowerCase()]=algorithms[e]}),inherits(Sign,stream.Writable),Sign.prototype._write=function(e,t,i){this._hash.update(e),i()},Sign.prototype.update=function(e,t){return"string"==typeof e&&(e=new Buffer(e,t)),this._hash.update(e),this},Sign.prototype.sign=function(e,t){this.end();var i=this._hash.digest(),r=sign(i,e,this._hashType,this._signType,this._tag);return t?r.toString(t):r},inherits(Verify,stream.Writable),Verify.prototype._write=function(e,t,i){this._hash.update(e),i()},Verify.prototype.update=function(e,t){return"string"==typeof e&&(e=new Buffer(e,t)),this._hash.update(e),this},Verify.prototype.verify=function(e,t,i){"string"==typeof t&&(t=new Buffer(t,i)),this.end();var r=this._hash.digest();return verify(t,r,e,this._signType,this._tag)},module.exports={Sign:createSign,Verify:createVerify,createSign:createSign,createVerify:createVerify}; }).call(this,require("buffer").Buffer) },{"./algorithms.json":43,"./sign":46,"./verify":47,"buffer":49,"create-hash":53,"inherits":102,"stream":157}],46:[function(require,module,exports){ (function (Buffer){ var createHmac=require("create-hmac"),crt=require("browserify-rsa"),EC=require("elliptic").ec,BN=require("bn.js"),parseKeys=require("parse-asn1"),curves=require("./curves.json");function sign(e,r,t,n,a){var u=parseKeys(r);if(u.curve){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");return ecSign(e,u)}if("dsa"===u.type){if("dsa"!==n)throw new Error("wrong private key type");return dsaSign(e,u,t)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");e=Buffer.concat([a,e]);for(var i=u.modulus.byteLength(),o=[0,1];e.length+o.length+10&&t.ishrn(n),t}function bits2octets(e,r){e=(e=bits2int(e,r)).mod(r);var t=new Buffer(e.toArray());if(t.length=r)throw new Error("invalid sig")}module.exports=verify; }).call(this,require("buffer").Buffer) },{"./curves.json":44,"bn.js":18,"buffer":49,"elliptic":68,"parse-asn1":118}],48:[function(require,module,exports){ (function (Buffer){ module.exports=function(e,n){for(var r=Math.min(e.length,n.length),t=new Buffer(r),f=0;fK_MAX_LENGTH)throw new RangeError('The value "'+r+'" is invalid for option "size"');var t=new Uint8Array(r);return t.__proto__=Buffer.prototype,t}function Buffer(r,t,e){if("number"==typeof r){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(r)}return from(r,t,e)}function from(r,t,e){if("string"==typeof r)return fromString(r,t);if(ArrayBuffer.isView(r))return fromArrayLike(r);if(null==r)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(isInstance(r,ArrayBuffer)||r&&isInstance(r.buffer,ArrayBuffer))return fromArrayBuffer(r,t,e);if("number"==typeof r)throw new TypeError('The "value" argument must not be of type number. Received type number');var f=r.valueOf&&r.valueOf();if(null!=f&&f!==r)return Buffer.from(f,t,e);var n=fromObject(r);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof r[Symbol.toPrimitive])return Buffer.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}function assertSize(r){if("number"!=typeof r)throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function alloc(r,t,e){return assertSize(r),r<=0?createBuffer(r):void 0!==t?"string"==typeof e?createBuffer(r).fill(t,e):createBuffer(r).fill(t):createBuffer(r)}function allocUnsafe(r){return assertSize(r),createBuffer(r<0?0:0|checked(r))}function fromString(r,t){if("string"==typeof t&&""!==t||(t="utf8"),!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var e=0|byteLength(r,t),f=createBuffer(e),n=f.write(r,t);return n!==e&&(f=f.slice(0,n)),f}function fromArrayLike(r){for(var t=r.length<0?0:0|checked(r.length),e=createBuffer(t),f=0;f=K_MAX_LENGTH)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|r}function SlowBuffer(r){return+r!=r&&(r=0),Buffer.alloc(+r)}function byteLength(r,t){if(Buffer.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||isInstance(r,ArrayBuffer))return r.byteLength;if("string"!=typeof r)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var e=r.length,f=arguments.length>2&&!0===arguments[2];if(!f&&0===e)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return utf8ToBytes(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return base64ToBytes(r).length;default:if(n)return f?-1:utf8ToBytes(r).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(r,t,e){var f=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(t>>>=0))return"";for(r||(r="utf8");;)switch(r){case"hex":return hexSlice(this,t,e);case"utf8":case"utf-8":return utf8Slice(this,t,e);case"ascii":return asciiSlice(this,t,e);case"latin1":case"binary":return latin1Slice(this,t,e);case"base64":return base64Slice(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,e);default:if(f)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),f=!0}}function swap(r,t,e){var f=r[t];r[t]=r[e],r[e]=f}function bidirectionalIndexOf(r,t,e,f,n){if(0===r.length)return-1;if("string"==typeof e?(f=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),numberIsNaN(e=+e)&&(e=n?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(n)return-1;e=r.length-1}else if(e<0){if(!n)return-1;e=0}if("string"==typeof t&&(t=Buffer.from(t,f)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(r,t,e,f,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):arrayIndexOf(r,[t],e,f,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(r,t,e,f,n){var i,o=1,u=r.length,s=t.length;if(void 0!==f&&("ucs2"===(f=String(f).toLowerCase())||"ucs-2"===f||"utf16le"===f||"utf-16le"===f)){if(r.length<2||t.length<2)return-1;o=2,u/=2,s/=2,e/=2}function h(r,t){return 1===o?r[t]:r.readUInt16BE(t*o)}if(n){var a=-1;for(i=e;iu&&(e=u-s),i=e;i>=0;i--){for(var c=!0,p=0;pn&&(f=n):f=n;var i=t.length;f>i/2&&(f=i/2);for(var o=0;o239?4:h>223?3:h>191?2:1;if(n+c<=e)switch(c){case 1:h<128&&(a=h);break;case 2:128==(192&(i=r[n+1]))&&(s=(31&h)<<6|63&i)>127&&(a=s);break;case 3:i=r[n+1],o=r[n+2],128==(192&i)&&128==(192&o)&&(s=(15&h)<<12|(63&i)<<6|63&o)>2047&&(s<55296||s>57343)&&(a=s);break;case 4:i=r[n+1],o=r[n+2],u=r[n+3],128==(192&i)&&128==(192&o)&&128==(192&u)&&(s=(15&h)<<18|(63&i)<<12|(63&o)<<6|63&u)>65535&&s<1114112&&(a=s)}null===a?(a=65533,c=1):a>65535&&(a-=65536,f.push(a>>>10&1023|55296),a=56320|1023&a),f.push(a),n+=c}return decodeCodePointsArray(f)}exports.kMaxLength=K_MAX_LENGTH,Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport(),Buffer.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),Buffer.poolSize=8192,Buffer.from=function(r,t,e){return from(r,t,e)},Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(r,t,e){return alloc(r,t,e)},Buffer.allocUnsafe=function(r){return allocUnsafe(r)},Buffer.allocUnsafeSlow=function(r){return allocUnsafe(r)},Buffer.isBuffer=function(r){return null!=r&&!0===r._isBuffer&&r!==Buffer.prototype},Buffer.compare=function(r,t){if(isInstance(r,Uint8Array)&&(r=Buffer.from(r,r.offset,r.byteLength)),isInstance(t,Uint8Array)&&(t=Buffer.from(t,t.offset,t.byteLength)),!Buffer.isBuffer(r)||!Buffer.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;for(var e=r.length,f=t.length,n=0,i=Math.min(e,f);nt&&(r+=" ... "),""},Buffer.prototype.compare=function(r,t,e,f,n){if(isInstance(r,Uint8Array)&&(r=Buffer.from(r,r.offset,r.byteLength)),!Buffer.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(void 0===t&&(t=0),void 0===e&&(e=r?r.length:0),void 0===f&&(f=0),void 0===n&&(n=this.length),t<0||e>r.length||f<0||n>this.length)throw new RangeError("out of range index");if(f>=n&&t>=e)return 0;if(f>=n)return-1;if(t>=e)return 1;if(this===r)return 0;for(var i=(n>>>=0)-(f>>>=0),o=(e>>>=0)-(t>>>=0),u=Math.min(i,o),s=this.slice(f,n),h=r.slice(t,e),a=0;a>>=0,isFinite(e)?(e>>>=0,void 0===f&&(f="utf8")):(f=e,e=void 0)}var n=this.length-t;if((void 0===e||e>n)&&(e=n),r.length>0&&(e<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");for(var i=!1;;)switch(f){case"hex":return hexWrite(this,r,t,e);case"utf8":case"utf-8":return utf8Write(this,r,t,e);case"ascii":return asciiWrite(this,r,t,e);case"latin1":case"binary":return latin1Write(this,r,t,e);case"base64":return base64Write(this,r,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,r,t,e);default:if(i)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),i=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(r){var t=r.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,r);for(var e="",f=0;ff)&&(e=f);for(var n="",i=t;ie)throw new RangeError("Trying to access beyond buffer length")}function checkInt(r,t,e,f,n,i){if(!Buffer.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||tr.length)throw new RangeError("Index out of range")}function checkIEEE754(r,t,e,f,n,i){if(e+f>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function writeFloat(r,t,e,f,n){return t=+t,e>>>=0,n||checkIEEE754(r,t,e,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(r,t,e,f,23,4),e+4}function writeDouble(r,t,e,f,n){return t=+t,e>>>=0,n||checkIEEE754(r,t,e,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(r,t,e,f,52,8),e+8}Buffer.prototype.slice=function(r,t){var e=this.length;(r=~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),(t=void 0===t?e:~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),t>>=0,t>>>=0,e||checkOffset(r,t,this.length);for(var f=this[r],n=1,i=0;++i>>=0,t>>>=0,e||checkOffset(r,t,this.length);for(var f=this[r+--t],n=1;t>0&&(n*=256);)f+=this[r+--t]*n;return f},Buffer.prototype.readUInt8=function(r,t){return r>>>=0,t||checkOffset(r,1,this.length),this[r]},Buffer.prototype.readUInt16LE=function(r,t){return r>>>=0,t||checkOffset(r,2,this.length),this[r]|this[r+1]<<8},Buffer.prototype.readUInt16BE=function(r,t){return r>>>=0,t||checkOffset(r,2,this.length),this[r]<<8|this[r+1]},Buffer.prototype.readUInt32LE=function(r,t){return r>>>=0,t||checkOffset(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+16777216*this[r+3]},Buffer.prototype.readUInt32BE=function(r,t){return r>>>=0,t||checkOffset(r,4,this.length),16777216*this[r]+(this[r+1]<<16|this[r+2]<<8|this[r+3])},Buffer.prototype.readIntLE=function(r,t,e){r>>>=0,t>>>=0,e||checkOffset(r,t,this.length);for(var f=this[r],n=1,i=0;++i=(n*=128)&&(f-=Math.pow(2,8*t)),f},Buffer.prototype.readIntBE=function(r,t,e){r>>>=0,t>>>=0,e||checkOffset(r,t,this.length);for(var f=t,n=1,i=this[r+--f];f>0&&(n*=256);)i+=this[r+--f]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},Buffer.prototype.readInt8=function(r,t){return r>>>=0,t||checkOffset(r,1,this.length),128&this[r]?-1*(255-this[r]+1):this[r]},Buffer.prototype.readInt16LE=function(r,t){r>>>=0,t||checkOffset(r,2,this.length);var e=this[r]|this[r+1]<<8;return 32768&e?4294901760|e:e},Buffer.prototype.readInt16BE=function(r,t){r>>>=0,t||checkOffset(r,2,this.length);var e=this[r+1]|this[r]<<8;return 32768&e?4294901760|e:e},Buffer.prototype.readInt32LE=function(r,t){return r>>>=0,t||checkOffset(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},Buffer.prototype.readInt32BE=function(r,t){return r>>>=0,t||checkOffset(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},Buffer.prototype.readFloatLE=function(r,t){return r>>>=0,t||checkOffset(r,4,this.length),ieee754.read(this,r,!0,23,4)},Buffer.prototype.readFloatBE=function(r,t){return r>>>=0,t||checkOffset(r,4,this.length),ieee754.read(this,r,!1,23,4)},Buffer.prototype.readDoubleLE=function(r,t){return r>>>=0,t||checkOffset(r,8,this.length),ieee754.read(this,r,!0,52,8)},Buffer.prototype.readDoubleBE=function(r,t){return r>>>=0,t||checkOffset(r,8,this.length),ieee754.read(this,r,!1,52,8)},Buffer.prototype.writeUIntLE=function(r,t,e,f){(r=+r,t>>>=0,e>>>=0,f)||checkInt(this,r,t,e,Math.pow(2,8*e)-1,0);var n=1,i=0;for(this[t]=255&r;++i>>=0,e>>>=0,f)||checkInt(this,r,t,e,Math.pow(2,8*e)-1,0);var n=e-1,i=1;for(this[t+n]=255&r;--n>=0&&(i*=256);)this[t+n]=r/i&255;return t+e},Buffer.prototype.writeUInt8=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,1,255,0),this[t]=255&r,t+1},Buffer.prototype.writeUInt16LE=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,2,65535,0),this[t]=255&r,this[t+1]=r>>>8,t+2},Buffer.prototype.writeUInt16BE=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=255&r,t+2},Buffer.prototype.writeUInt32LE=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=255&r,t+4},Buffer.prototype.writeUInt32BE=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=255&r,t+4},Buffer.prototype.writeIntLE=function(r,t,e,f){if(r=+r,t>>>=0,!f){var n=Math.pow(2,8*e-1);checkInt(this,r,t,e,n-1,-n)}var i=0,o=1,u=0;for(this[t]=255&r;++i>0)-u&255;return t+e},Buffer.prototype.writeIntBE=function(r,t,e,f){if(r=+r,t>>>=0,!f){var n=Math.pow(2,8*e-1);checkInt(this,r,t,e,n-1,-n)}var i=e-1,o=1,u=0;for(this[t+i]=255&r;--i>=0&&(o*=256);)r<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(r/o>>0)-u&255;return t+e},Buffer.prototype.writeInt8=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=255&r,t+1},Buffer.prototype.writeInt16LE=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,2,32767,-32768),this[t]=255&r,this[t+1]=r>>>8,t+2},Buffer.prototype.writeInt16BE=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=255&r,t+2},Buffer.prototype.writeInt32LE=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,4,2147483647,-2147483648),this[t]=255&r,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4},Buffer.prototype.writeInt32BE=function(r,t,e){return r=+r,t>>>=0,e||checkInt(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=255&r,t+4},Buffer.prototype.writeFloatLE=function(r,t,e){return writeFloat(this,r,t,!0,e)},Buffer.prototype.writeFloatBE=function(r,t,e){return writeFloat(this,r,t,!1,e)},Buffer.prototype.writeDoubleLE=function(r,t,e){return writeDouble(this,r,t,!0,e)},Buffer.prototype.writeDoubleBE=function(r,t,e){return writeDouble(this,r,t,!1,e)},Buffer.prototype.copy=function(r,t,e,f){if(!Buffer.isBuffer(r))throw new TypeError("argument should be a Buffer");if(e||(e=0),f||0===f||(f=this.length),t>=r.length&&(t=r.length),t||(t=0),f>0&&f=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),r.length-t=0;--i)r[i+t]=this[i+e];else Uint8Array.prototype.set.call(r,this.subarray(e,f),t);return n},Buffer.prototype.fill=function(r,t,e,f){if("string"==typeof r){if("string"==typeof t?(f=t,t=0,e=this.length):"string"==typeof e&&(f=e,e=this.length),void 0!==f&&"string"!=typeof f)throw new TypeError("encoding must be a string");if("string"==typeof f&&!Buffer.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(1===r.length){var n=r.charCodeAt(0);("utf8"===f&&n<128||"latin1"===f)&&(r=n)}}else"number"==typeof r&&(r&=255);if(t<0||this.length>>=0,e=void 0===e?this.length:e>>>0,r||(r=0),"number"==typeof r)for(i=t;i55295&&e<57344){if(!n){if(e>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===f){(t-=3)>-1&&i.push(239,191,189);continue}n=e;continue}if(e<56320){(t-=3)>-1&&i.push(239,191,189),n=e;continue}e=65536+(n-55296<<10|e-56320)}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,e<128){if((t-=1)<0)break;i.push(e)}else if(e<2048){if((t-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((t-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function asciiToBytes(r){for(var t=[],e=0;e>8,n=e%256,i.push(n),i.push(f);return i}function base64ToBytes(r){return base64.toByteArray(base64clean(r))}function blitBuffer(r,t,e,f){for(var n=0;n=t.length||n>=r.length);++n)t[n+e]=r[n];return n}function isInstance(r,t){return r instanceof t||null!=r&&null!=r.constructor&&null!=r.constructor.name&&r.constructor.name===t.name}function numberIsNaN(r){return r!=r} },{"base64-js":17,"ieee754":101}],50:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer,Transform=require("stream").Transform,StringDecoder=require("string_decoder").StringDecoder,inherits=require("inherits");function CipherBase(t){Transform.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits(CipherBase,Transform),CipherBase.prototype.update=function(t,e,r){"string"==typeof t&&(t=Buffer.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},CipherBase.prototype.setAutoPadding=function(){},CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},CipherBase.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},CipherBase.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},CipherBase.prototype._finalOrDigest=function(t){var e=this.__final()||Buffer.alloc(0);return t&&(e=this._toString(e,t,!0)),e},CipherBase.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new StringDecoder(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},module.exports=CipherBase; },{"inherits":102,"safe-buffer":148,"stream":157,"string_decoder":158}],51:[function(require,module,exports){ (function (Buffer){ function isArray(r){return Array.isArray?Array.isArray(r):"[object Array]"===objectToString(r)}function isBoolean(r){return"boolean"==typeof r}function isNull(r){return null===r}function isNullOrUndefined(r){return null==r}function isNumber(r){return"number"==typeof r}function isString(r){return"string"==typeof r}function isSymbol(r){return"symbol"==typeof r}function isUndefined(r){return void 0===r}function isRegExp(r){return"[object RegExp]"===objectToString(r)}function isObject(r){return"object"==typeof r&&null!==r}function isDate(r){return"[object Date]"===objectToString(r)}function isError(r){return"[object Error]"===objectToString(r)||r instanceof Error}function isFunction(r){return"function"==typeof r}function isPrimitive(r){return null===r||"boolean"==typeof r||"number"==typeof r||"string"==typeof r||"symbol"==typeof r||void 0===r}function objectToString(r){return Object.prototype.toString.call(r)}exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=Buffer.isBuffer; }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) },{"../../is-buffer/index.js":103}],52:[function(require,module,exports){ (function (Buffer){ var elliptic=require("elliptic"),BN=require("bn.js");module.exports=function(e){return new ECDH(e)};var aliases={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function ECDH(e){this.curveType=aliases[e],this.curveType||(this.curveType={name:e}),this.curve=new elliptic.ec(this.curveType.name),this.keys=void 0}function formatReturnValue(e,t,r){Array.isArray(e)||(e=e.toArray());var i=new Buffer(e);if(r&&i.lengthr)?a=("rmd160"===e?new RIPEMD160:sha(e)).update(a).digest():a.lengthblocksize?s=e(s):s.length0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(f,r);return e+=this._buffer(t,e),f},Cipher.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},Cipher.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=utils.r28shl(r,n),s=utils.r28shl(s,n),utils.pc2(r,s,t.keys,i)}},DES.prototype._update=function(t,e,r,s){var i=this._desState,n=utils.readUInt32BE(t,e),p=utils.readUInt32BE(t,e+4);utils.ip(n,p,i.tmp,0),n=i.tmp[0],p=i.tmp[1],"encrypt"===this.type?this._encrypt(i,n,p,i.tmp,0):this._decrypt(i,n,p,i.tmp,0),n=i.tmp[0],p=i.tmp[1],utils.writeUInt32BE(r,n,s),utils.writeUInt32BE(r,p,s+4)},DES.prototype._pad=function(t,e){for(var r=t.length-e,s=e;s>>0,n=o}utils.rip(p,n,s,i)},DES.prototype._decrypt=function(t,e,r,s,i){for(var n=r,p=e,u=t.keys.length-2;u>=0;u-=2){var l=t.keys[u],a=t.keys[u+1];utils.expand(n,t.tmp,0),l^=t.tmp[0],a^=t.tmp[1];var h=utils.substitute(l,a),o=n;n=(p^utils.permute(h))>>>0,p=o}utils.rip(n,p,s,i)}; },{"../des":58,"inherits":102,"minimalistic-assert":112}],62:[function(require,module,exports){ "use strict";var assert=require("minimalistic-assert"),inherits=require("inherits"),des=require("../des"),Cipher=des.Cipher,DES=des.DES;function EDEState(e,t){assert.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),p=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[DES.create({type:"encrypt",key:r}),DES.create({type:"decrypt",key:p}),DES.create({type:"encrypt",key:i})]:[DES.create({type:"decrypt",key:i}),DES.create({type:"encrypt",key:p}),DES.create({type:"decrypt",key:r})]}function EDE(e){Cipher.call(this,e);var t=new EDEState(this.type,this.options.key);this._edeState=t}inherits(EDE,Cipher),module.exports=EDE,EDE.create=function(e){return new EDE(e)},EDE.prototype._update=function(e,t,r,p){var i=this._edeState;i.ciphers[0]._update(e,t,r,p),i.ciphers[1]._update(r,p,r,p),i.ciphers[2]._update(r,p,r,p)},EDE.prototype._pad=DES.prototype._pad,EDE.prototype._unpad=DES.prototype._unpad; },{"../des":58,"inherits":102,"minimalistic-assert":112}],63:[function(require,module,exports){ "use strict";exports.readUInt32BE=function(r,o){return(r[0+o]<<24|r[1+o]<<16|r[2+o]<<8|r[3+o])>>>0},exports.writeUInt32BE=function(r,o,t){r[0+t]=o>>>24,r[1+t]=o>>>16&255,r[2+t]=o>>>8&255,r[3+t]=255&o},exports.ip=function(r,o,t,e){for(var f=0,n=0,a=6;a>=0;a-=2){for(var p=0;p<=24;p+=8)f<<=1,f|=o>>>p+a&1;for(p=0;p<=24;p+=8)f<<=1,f|=r>>>p+a&1}for(a=6;a>=0;a-=2){for(p=1;p<=25;p+=8)n<<=1,n|=o>>>p+a&1;for(p=1;p<=25;p+=8)n<<=1,n|=r>>>p+a&1}t[e+0]=f>>>0,t[e+1]=n>>>0},exports.rip=function(r,o,t,e){for(var f=0,n=0,a=0;a<4;a++)for(var p=24;p>=0;p-=8)f<<=1,f|=o>>>p+a&1,f<<=1,f|=r>>>p+a&1;for(a=4;a<8;a++)for(p=24;p>=0;p-=8)n<<=1,n|=o>>>p+a&1,n<<=1,n|=r>>>p+a&1;t[e+0]=f>>>0,t[e+1]=n>>>0},exports.pc1=function(r,o,t,e){for(var f=0,n=0,a=7;a>=5;a--){for(var p=0;p<=24;p+=8)f<<=1,f|=o>>p+a&1;for(p=0;p<=24;p+=8)f<<=1,f|=r>>p+a&1}for(p=0;p<=24;p+=8)f<<=1,f|=o>>p+a&1;for(a=1;a<=3;a++){for(p=0;p<=24;p+=8)n<<=1,n|=o>>p+a&1;for(p=0;p<=24;p+=8)n<<=1,n|=r>>p+a&1}for(p=0;p<=24;p+=8)n<<=1,n|=r>>p+a&1;t[e+0]=f>>>0,t[e+1]=n>>>0},exports.r28shl=function(r,o){return r<>>28-o};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];exports.pc2=function(r,o,t,e){for(var f=0,n=0,a=pc2table.length>>>1,p=0;p>>pc2table[p]&1;for(p=a;p>>pc2table[p]&1;t[e+0]=f>>>0,t[e+1]=n>>>0},exports.expand=function(r,o,t){var e=0,f=0;e=(1&r)<<5|r>>>27;for(var n=23;n>=15;n-=4)e<<=6,e|=r>>>n&63;for(n=11;n>=3;n-=4)f|=r>>>n&63,f<<=6;f|=(31&r)<<1|r>>>31,o[t+0]=e>>>0,o[t+1]=f>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];exports.substitute=function(r,o){for(var t=0,e=0;e<4;e++){t<<=4,t|=sTable[64*e+(r>>>18-6*e&63)]}for(e=0;e<4;e++){t<<=4,t|=sTable[256+64*e+(o>>>18-6*e&63)]}return t>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];exports.permute=function(r){for(var o=0,t=0;t>>permuteTable[t]&1;return o>>>0},exports.padSplit=function(r,o,t){for(var e=r.toString(2);e.lengthe;)i.ishrn(1);if(i.isEven()&&i.iadd(ONE),i.testn(1)||i.iadd(TWO),r.cmp(TWO)){if(!r.cmp(FIVE))for(;i.mod(TEN).cmp(THREE);)i.iadd(FOUR)}else for(;i.mod(TWENTYFOUR).cmp(ELEVEN);)i.iadd(FOUR);if(simpleSieve(n=i.shrn(1))&&simpleSieve(i)&&fermatTest(n)&&fermatTest(i)&&millerRabin.test(n)&&millerRabin.test(i))return i}} },{"bn.js":18,"miller-rabin":111,"randombytes":132}],67:[function(require,module,exports){ module.exports={ "modp1": { "gen": "02", "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff" }, "modp2": { "gen": "02", "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff" }, "modp5": { "gen": "02", "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff" }, "modp14": { "gen": "02", "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff" }, "modp15": { "gen": "02", "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff" }, "modp16": { "gen": "02", "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff" }, "modp17": { "gen": "02", "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff" }, "modp18": { "gen": "02", "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" } } },{}],68:[function(require,module,exports){ "use strict";var elliptic=exports;elliptic.version=require("../package.json").version,elliptic.utils=require("./elliptic/utils"),elliptic.rand=require("brorand"),elliptic.curve=require("./elliptic/curve"),elliptic.curves=require("./elliptic/curves"),elliptic.ec=require("./elliptic/ec"),elliptic.eddsa=require("./elliptic/eddsa"); },{"../package.json":83,"./elliptic/curve":71,"./elliptic/curves":74,"./elliptic/ec":75,"./elliptic/eddsa":78,"./elliptic/utils":82,"brorand":19}],69:[function(require,module,exports){ "use strict";var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,getNAF=utils.getNAF,getJSF=utils.getJSF,assert=utils.assert;function BaseCurve(e,t){this.type=e,this.p=new BN(t.p,16),this.red=t.prime?BN.red(t.prime):BN.mont(this.p),this.zero=new BN(0).toRed(this.red),this.one=new BN(1).toRed(this.red),this.two=new BN(2).toRed(this.red),this.n=t.n&&new BN(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}module.exports=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(e,t){assert(e.precomputed);var r=e._getDoubles(),n=getNAF(t,1),i=(1<=u;t--)s=(s<<1)+n[t];o.push(s)}for(var l=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(u=0;u=0;s--){for(t=0;s>=0&&0===o[s];s--)t++;if(s>=0&&t++,u=u.dblp(t),s<0)break;var l=o[s];assert(0!==l),u="affine"===e.type?l>0?u.mixedAdd(i[l-1>>1]):u.mixedAdd(i[-l-1>>1].neg()):l>0?u.add(i[l-1>>1]):u.add(i[-l-1>>1].neg())}return"affine"===e.type?u.toP():u},BaseCurve.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,u=this._wnafT2,s=this._wnafT3,l=0,d=0;d=1;d-=2){var p=d-1,a=d;if(1===o[p]&&1===o[a]){var g=[t[p],null,null,t[a]];0===t[p].y.cmp(t[a].y)?(g[1]=t[p].add(t[a]),g[2]=t[p].toJ().mixedAdd(t[a].neg())):0===t[p].y.cmp(t[a].y.redNeg())?(g[1]=t[p].toJ().mixedAdd(t[a]),g[2]=t[p].add(t[a].neg())):(g[1]=t[p].toJ().mixedAdd(t[a]),g[2]=t[p].toJ().mixedAdd(t[a].neg()));var f=[-3,-1,-5,-7,0,7,5,1,3],v=getJSF(r[p],r[a]);l=Math.max(v[0].length,l),s[p]=new Array(l),s[a]=new Array(l);for(var c=0;c=0;d--){for(var N=0;d>=0;){var _=!0;for(c=0;c=0&&N++,B=B.dblp(N),d<0)break;for(c=0;c0?P=u[c][m-1>>1]:m<0&&(P=u[c][-m-1>>1].neg()),B="affine"===P.type?B.mixedAdd(P):B.add(P))}}for(d=0;d=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),e=this.z.redSqr();e=e.redIAdd(e);var i=this.curve._mulA(t),d=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),s=i.redAdd(r),u=s.redSub(e),h=i.redSub(r),o=d.redMul(u),n=s.redMul(h),l=d.redMul(h),p=u.redMul(s);return this.curve.point(o,n,p,l)},Point.prototype._projDbl=function(){var t,r,e,i=this.x.redAdd(this.y).redSqr(),d=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(d)).redAdd(s);if(this.zOne)t=i.redSub(d).redSub(s).redMul(u.redSub(this.curve.two)),r=u.redMul(n.redSub(s)),e=u.redSqr().redSub(u).redSub(u);else{var h=this.z.redSqr(),o=u.redSub(h).redISub(h);t=i.redSub(d).redISub(s).redMul(o),r=u.redMul(n.redSub(s)),e=u.redMul(o)}}else{var n=d.redAdd(s);h=this.curve._mulC(this.z).redSqr(),o=n.redSub(h).redSub(h);t=this.curve._mulC(i.redISub(n)).redMul(o),r=this.curve._mulC(n).redMul(d.redISub(s)),e=n.redMul(o)}return this.curve.point(t,r,e)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),e=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),d=this.z.redMul(t.z.redAdd(t.z)),s=e.redSub(r),u=d.redSub(i),h=d.redAdd(i),o=e.redAdd(r),n=s.redMul(u),l=h.redMul(o),p=s.redMul(o),c=u.redMul(h);return this.curve.point(n,l,c,p)},Point.prototype._projAdd=function(t){var r,e,i=this.z.redMul(t.z),d=i.redSqr(),s=this.x.redMul(t.x),u=this.y.redMul(t.y),h=this.curve.d.redMul(s).redMul(u),o=d.redSub(h),n=d.redAdd(h),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(u),p=i.redMul(o).redMul(l);return this.curve.twisted?(r=i.redMul(n).redMul(u.redSub(this.curve._mulA(s))),e=o.redMul(n)):(r=i.redMul(n).redMul(u.redSub(s)),e=this.curve._mulC(o).redMul(n)),this.curve.point(p,r,e)},Point.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},Point.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},Point.prototype.mulAdd=function(t,r,e){return this.curve._wnafMulAdd(1,[this,r],[t,e],2,!1)},Point.prototype.jmulAdd=function(t,r,e){return this.curve._wnafMulAdd(1,[this,r],[t,e],2,!0)},Point.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},Point.prototype.eqXToP=function(t){var r=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var e=t.clone(),i=this.curve.redN.redMul(this.z);;){if(e.iadd(this.curve.n),e.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add; },{"../../elliptic":68,"../curve":71,"bn.js":18,"inherits":102}],71:[function(require,module,exports){ "use strict";var curve=exports;curve.base=require("./base"),curve.short=require("./short"),curve.mont=require("./mont"),curve.edwards=require("./edwards"); },{"./base":69,"./edwards":70,"./mont":72,"./short":73}],72:[function(require,module,exports){ "use strict";var curve=require("../curve"),BN=require("bn.js"),inherits=require("inherits"),Base=curve.base,elliptic=require("../../elliptic"),utils=elliptic.utils;function MontCurve(t){Base.call(this,"mont",t),this.a=new BN(t.a,16).toRed(this.red),this.b=new BN(t.b,16).toRed(this.red),this.i4=new BN(4).toRed(this.red).redInvm(),this.two=new BN(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(t,r,e){Base.BasePoint.call(this,t,"projective"),null===r&&null===e?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN(r,16),this.z=new BN(e,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.validate=function(t){var r=t.normalize().x,e=r.redSqr(),i=e.redMul(r).redAdd(e.redMul(this.a)).redAdd(r);return 0===i.redSqrt().redSqr().cmp(i)},inherits(Point,Base.BasePoint),MontCurve.prototype.decodePoint=function(t,r){return this.point(utils.toArray(t,r),1)},MontCurve.prototype.point=function(t,r){return new Point(this,t,r)},MontCurve.prototype.pointFromJSON=function(t){return Point.fromJSON(this,t)},Point.prototype.precompute=function(){},Point.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point.fromJSON=function(t,r){return new Point(t,r[0],r[1]||t.one)},Point.prototype.inspect=function(){return this.isInfinity()?"":""},Point.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),r=this.x.redSub(this.z).redSqr(),e=t.redSub(r),i=t.redMul(r),o=e.redMul(r.redAdd(this.curve.a24.redMul(e)));return this.curve.point(i,o)},Point.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(t,r){var e=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),n=t.x.redSub(t.z).redMul(e),u=o.redMul(i),d=r.z.redMul(n.redAdd(u).redSqr()),s=r.x.redMul(n.redISub(u).redSqr());return this.curve.point(d,s)},Point.prototype.mul=function(t){for(var r=t.clone(),e=this,i=this.curve.point(null,null),o=[];0!==r.cmpn(0);r.iushrn(1))o.push(r.andln(1));for(var n=o.length-1;n>=0;n--)0===o[n]?(e=e.diffAdd(i,this),i=i.dbl()):(i=e.diffAdd(i,this),e=e.dbl());return i},Point.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()}; },{"../../elliptic":68,"../curve":71,"bn.js":18,"inherits":102}],73:[function(require,module,exports){ "use strict";var curve=require("../curve"),elliptic=require("../../elliptic"),BN=require("bn.js"),inherits=require("inherits"),Base=curve.base,assert=elliptic.utils.assert;function ShortCurve(r){Base.call(this,"short",r),this.a=new BN(r.a,16).toRed(this.red),this.b=new BN(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function Point(r,e,t,d){Base.BasePoint.call(this,r,"affine"),null===e&&null===t?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN(e,16),this.y=new BN(t,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(r,e,t,d){Base.BasePoint.call(this,r,"jacobian"),null===e&&null===t&&null===d?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN(0)):(this.x=new BN(e,16),this.y=new BN(t,16),this.z=new BN(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits(ShortCurve,Base),module.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(r){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,t;if(r.beta)e=new BN(r.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);e=(e=d[0].cmp(d[1])<0?d[0]:d[1]).toRed(this.red)}if(r.lambda)t=new BN(r.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?t=i[0]:(t=i[1],assert(0===this.g.mul(t).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:t,basis:r.basis?r.basis.map(function(r){return{a:new BN(r.a,16),b:new BN(r.b,16)}}):this._getEndoBasis(t)}}},ShortCurve.prototype._getEndoRoots=function(r){var e=r===this.p?this.red:BN.mont(r),t=new BN(2).toRed(e).redInvm(),d=t.redNeg(),i=new BN(3).toRed(e).redNeg().redSqrt().redMul(t);return[d.redAdd(i).fromRed(),d.redSub(i).fromRed()]},ShortCurve.prototype._getEndoBasis=function(r){for(var e,t,d,i,n,u,s,o,h,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),p=r,a=this.n.clone(),c=new BN(1),f=new BN(0),S=new BN(0),v=new BN(1),b=0;0!==p.cmpn(0);){var I=a.div(p);o=a.sub(I.mul(p)),h=S.sub(I.mul(c));var A=v.sub(I.mul(f));if(!d&&o.cmp(l)<0)e=s.neg(),t=c,d=o.neg(),i=h;else if(d&&2==++b)break;s=o,a=p,p=o,S=c,c=h,v=f,f=A}n=o.neg(),u=h;var M=d.sqr().add(i.sqr());return n.sqr().add(u.sqr()).cmp(M)>=0&&(n=e,u=t),d.negative&&(d=d.neg(),i=i.neg()),n.negative&&(n=n.neg(),u=u.neg()),[{a:d,b:i},{a:n,b:u}]},ShortCurve.prototype._endoSplit=function(r){var e=this.endo.basis,t=e[0],d=e[1],i=d.b.mul(r).divRound(this.n),n=t.b.neg().mul(r).divRound(this.n),u=i.mul(t.a),s=n.mul(d.a),o=i.mul(t.b),h=n.mul(d.b);return{k1:r.sub(u).sub(s),k2:o.add(h).neg()}},ShortCurve.prototype.pointFromX=function(r,e){(r=new BN(r,16)).red||(r=r.toRed(this.red));var t=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),d=t.redSqrt();if(0!==d.redSqr().redSub(t).cmp(this.zero))throw new Error("invalid point");var i=d.fromRed().isOdd();return(e&&!i||!e&&i)&&(d=d.redNeg()),this.point(r,d)},ShortCurve.prototype.validate=function(r){if(r.inf)return!0;var e=r.x,t=r.y,d=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(d).redIAdd(this.b);return 0===t.redSqr().redISub(i).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(r,e,t){for(var d=this._endoWnafT1,i=this._endoWnafT2,n=0;n":""},Point.prototype.isInfinity=function(){return this.inf},Point.prototype.add=function(r){if(this.inf)return r;if(r.inf)return this;if(this.eq(r))return this.dbl();if(this.neg().eq(r))return this.curve.point(null,null);if(0===this.x.cmp(r.x))return this.curve.point(null,null);var e=this.y.redSub(r.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(r.x).redInvm()));var t=e.redSqr().redISub(this.x).redISub(r.x),d=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,d)},Point.prototype.dbl=function(){if(this.inf)return this;var r=this.y.redAdd(this.y);if(0===r.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),d=r.redInvm(),i=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(d),n=i.redSqr().redISub(this.x.redAdd(this.x)),u=i.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,u)},Point.prototype.getX=function(){return this.x.fromRed()},Point.prototype.getY=function(){return this.y.fromRed()},Point.prototype.mul=function(r){return r=new BN(r,16),this._hasDoubles(r)?this.curve._fixedNafMul(this,r):this.curve.endo?this.curve._endoWnafMulAdd([this],[r]):this.curve._wnafMul(this,r)},Point.prototype.mulAdd=function(r,e,t){var d=[this,e],i=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(d,i):this.curve._wnafMulAdd(1,d,i,2)},Point.prototype.jmulAdd=function(r,e,t){var d=[this,e],i=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(d,i,!0):this.curve._wnafMulAdd(1,d,i,2,!0)},Point.prototype.eq=function(r){return this===r||this.inf===r.inf&&(this.inf||0===this.x.cmp(r.x)&&0===this.y.cmp(r.y))},Point.prototype.neg=function(r){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(r&&this.precomputed){var t=this.precomputed,d=function(r){return r.neg()};e.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(d)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(d)}}}return e},Point.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits(JPoint,Base.BasePoint),ShortCurve.prototype.jpoint=function(r,e,t){return new JPoint(this,r,e,t)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var r=this.z.redInvm(),e=r.redSqr(),t=this.x.redMul(e),d=this.y.redMul(e).redMul(r);return this.curve.point(t,d)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(r){if(this.isInfinity())return r;if(r.isInfinity())return this;var e=r.z.redSqr(),t=this.z.redSqr(),d=this.x.redMul(e),i=r.x.redMul(t),n=this.y.redMul(e.redMul(r.z)),u=r.y.redMul(t.redMul(this.z)),s=d.redSub(i),o=n.redSub(u);if(0===s.cmpn(0))return 0!==o.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),l=h.redMul(s),p=d.redMul(h),a=o.redSqr().redIAdd(l).redISub(p).redISub(p),c=o.redMul(p.redISub(a)).redISub(n.redMul(l)),f=this.z.redMul(r.z).redMul(s);return this.curve.jpoint(a,c,f)},JPoint.prototype.mixedAdd=function(r){if(this.isInfinity())return r.toJ();if(r.isInfinity())return this;var e=this.z.redSqr(),t=this.x,d=r.x.redMul(e),i=this.y,n=r.y.redMul(e).redMul(this.z),u=t.redSub(d),s=i.redSub(n);if(0===u.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var o=u.redSqr(),h=o.redMul(u),l=t.redMul(o),p=s.redSqr().redIAdd(h).redISub(l).redISub(l),a=s.redMul(l.redISub(p)).redISub(i.redMul(h)),c=this.z.redMul(u);return this.curve.jpoint(p,a,c)},JPoint.prototype.dblp=function(r){if(0===r)return this;if(this.isInfinity())return this;if(!r)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,t=0;t=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},JPoint.prototype.inspect=function(){return this.isInfinity()?"":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}; },{"../../elliptic":68,"../curve":71,"bn.js":18,"inherits":102}],74:[function(require,module,exports){ "use strict";var pre,curves=exports,hash=require("hash.js"),elliptic=require("../elliptic"),assert=elliptic.utils.assert;function PresetCurve(f){"short"===f.type?this.curve=new elliptic.curve.short(f):"edwards"===f.type?this.curve=new elliptic.curve.edwards(f):this.curve=new elliptic.curve.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,assert(this.g.validate(),"Invalid curve"),assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(f,e){Object.defineProperty(curves,f,{configurable:!0,enumerable:!0,get:function(){var a=new PresetCurve(e);return Object.defineProperty(curves,f,{configurable:!0,enumerable:!0,value:a}),a}})}curves.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{pre=require("./precomputed/secp256k1")}catch(f){pre=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]}); },{"../elliptic":68,"./precomputed/secp256k1":81,"hash.js":88}],75:[function(require,module,exports){ "use strict";var BN=require("bn.js"),HmacDRBG=require("hmac-drbg"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,KeyPair=require("./key"),Signature=require("./signature");function EC(e){if(!(this instanceof EC))return new EC(e);"string"==typeof e&&(assert(elliptic.curves.hasOwnProperty(e),"Unknown curve "+e),e=elliptic.curves[e]),e instanceof elliptic.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}module.exports=EC,EC.prototype.keyPair=function(e){return new KeyPair(this,e)},EC.prototype.keyFromPrivate=function(e,t){return KeyPair.fromPrivate(this,e,t)},EC.prototype.keyFromPublic=function(e,t){return KeyPair.fromPublic(this,e,t)},EC.prototype.genKeyPair=function(e){e||(e={});for(var t=new HmacDRBG({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||elliptic.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new BN(2));;){var i=new BN(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},EC.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},EC.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new BN(e,16));for(var i=this.n.byteLength(),s=t.getPrivate().toArray("be",i),u=e.toArray("be",i),o=new HmacDRBG({hash:this.hash,entropy:s,nonce:u,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new BN(1)),h=0;;h++){var a=n.k?n.k(h):new BN(o.generate(this.n.byteLength()));if(!((a=this._truncateToN(a,!0)).cmpn(1)<=0||a.cmp(c)>=0)){var p=this.g.mul(a);if(!p.isInfinity()){var m=p.getX(),v=m.umod(this.n);if(0!==v.cmpn(0)){var y=a.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){var l=(p.getY().isOdd()?1:0)|(0!==m.cmp(v)?2:0);return n.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),l^=1),new Signature({r:v,s:y,recoveryParam:l})}}}}}},EC.prototype.verify=function(e,t,r,n){e=this._truncateToN(new BN(e,16)),r=this.keyFromPublic(r,n);var i=(t=new Signature(t,"hex")).r,s=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var u,o=s.invm(this.n),c=o.mul(e).umod(this.n),h=o.mul(i).umod(this.n);return this.curve._maxwellTrick?!(u=this.g.jmulAdd(c,r.getPublic(),h)).isInfinity()&&u.eqXToP(i):!(u=this.g.mulAdd(c,r.getPublic(),h)).isInfinity()&&0===u.getX().umod(this.n).cmp(i)},EC.prototype.recoverPubKey=function(e,t,r,n){assert((3&r)===r,"The recovery param is more than two bits"),t=new Signature(t,n);var i=this.n,s=new BN(e),u=t.r,o=t.s,c=1&r,h=r>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");u=h?this.curve.pointFromX(u.add(this.curve.n),c):this.curve.pointFromX(u,c);var a=t.r.invm(i),p=i.sub(s).mul(a).umod(i),m=o.mul(a).umod(i);return this.g.mulAdd(p,u,m)},EC.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Signature(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}; },{"../../elliptic":68,"./key":76,"./signature":77,"bn.js":18,"hmac-drbg":100}],76:[function(require,module,exports){ "use strict";var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;function KeyPair(i,t){this.ec=i,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}module.exports=KeyPair,KeyPair.fromPublic=function(i,t,e){return t instanceof KeyPair?t:new KeyPair(i,{pub:t,pubEnc:e})},KeyPair.fromPrivate=function(i,t,e){return t instanceof KeyPair?t:new KeyPair(i,{priv:t,privEnc:e})},KeyPair.prototype.validate=function(){var i=this.getPublic();return i.isInfinity()?{result:!1,reason:"Invalid public key"}:i.validate()?i.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(i,t){return"string"==typeof i&&(t=i,i=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,i):this.pub},KeyPair.prototype.getPrivate=function(i){return"hex"===i?this.priv.toString(16,2):this.priv},KeyPair.prototype._importPrivate=function(i,t){this.priv=new BN(i,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(i,t){if(i.x||i.y)return"mont"===this.ec.curve.type?assert(i.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert(i.x&&i.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(i.x,i.y));this.pub=this.ec.curve.decodePoint(i,t)},KeyPair.prototype.derive=function(i){return i.mul(this.priv).getX()},KeyPair.prototype.sign=function(i,t,e){return this.ec.sign(i,this,t,e)},KeyPair.prototype.verify=function(i,t){return this.ec.verify(i,t,this)},KeyPair.prototype.inspect=function(){return""}; },{"../../elliptic":68,"bn.js":18}],77:[function(require,module,exports){ "use strict";var BN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;function Signature(t,e){if(t instanceof Signature)return t;this._importDER(t,e)||(assert(t.r&&t.s,"Signature without r or s"),this.r=new BN(t.r,16),this.s=new BN(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function Position(){this.place=0}function getLength(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,a=0,c=e.place;a>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}module.exports=Signature,Signature.prototype._importDER=function(t,e){t=utils.toArray(t,e);var r=new Position;if(48!==t[r.place++])return!1;if(getLength(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=getLength(t,r),i=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var a=getLength(t,r);if(t.length!==a+r.place)return!1;var c=t.slice(r.place,a+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===c[0]&&128&c[1]&&(c=c.slice(1)),this.r=new BN(i),this.s=new BN(c),this.recoveryParam=null,!0},Signature.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=rmPadding(e),r=rmPadding(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];constructLength(n,e.length),(n=n.concat(e)).push(2),constructLength(n,r.length);var i=n.concat(r),a=[48];return constructLength(a,i.length),a=a.concat(i),utils.encode(a,t)}; },{"../../elliptic":68,"bn.js":18}],78:[function(require,module,exports){ "use strict";var hash=require("hash.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=require("./key"),Signature=require("./signature");function EDDSA(t){if(assert("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(t);t=elliptic.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=hash.sha512}module.exports=EDDSA,EDDSA.prototype.sign=function(t,e){t=parseBytes(t);var i=this.keyFromSecret(e),r=this.hashInt(i.messagePrefix(),t),n=this.g.mul(r),s=this.encodePoint(n),o=this.hashInt(s,i.pubBytes(),t).mul(i.priv()),u=r.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:s})},EDDSA.prototype.verify=function(t,e,i){t=parseBytes(t),e=this.makeSignature(e);var r=this.keyFromPublic(i),n=this.hashInt(e.Rencoded(),r.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(r.pub().mul(n)).eq(s)},EDDSA.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=0;){var s;if(n.isOdd()){var l=n.andln(e-1);s=l>(e>>1)-1?(e>>1)-l:l,n.isubn(s)}else s=0;r.push(s);for(var u=0!==n.cmpn(0)&&0===n.andln(e-1)?i+1:1,a=1;a0||i.cmpn(-n)>0;){var s,l,u,a=t.andln(3)+e&3,c=i.andln(3)+n&3;if(3===a&&(a=-1),3===c&&(c=-1),0==(1&a))s=0;else s=3!==(u=t.andln(7)+e&7)&&5!==u||2!==c?a:-a;if(r[0].push(s),0==(1&c))l=0;else l=3!==(u=i.andln(7)+n&7)&&5!==u||2!==a?c:-c;r[1].push(l),2*e===s+1&&(e=1-e),2*n===l+1&&(n=1-n),t.iushrn(1),i.iushrn(1)}return r}function cachedProperty(t,i,r){var e="_"+i;t.prototype[i]=function(){return void 0!==this[e]?this[e]:this[e]=r.call(this)}}function parseBytes(t){return"string"==typeof t?utils.toArray(t,"hex"):t}function intFromLE(t){return new BN(t,"hex","le")}utils.assert=minAssert,utils.toArray=minUtils.toArray,utils.zero2=minUtils.zero2,utils.toHex=minUtils.toHex,utils.encode=minUtils.encode,utils.getNAF=getNAF,utils.getJSF=getJSF,utils.cachedProperty=cachedProperty,utils.parseBytes=parseBytes,utils.intFromLE=intFromLE; },{"bn.js":18,"minimalistic-assert":112,"minimalistic-crypto-utils":113}],83:[function(require,module,exports){ module.exports={ "_args": [ [ "elliptic@6.4.1", "D:\\a\\1\\s\\src\\SDKs\\Js\\Map" ] ], "_development": true, "_from": "elliptic@6.4.1", "_id": "elliptic@6.4.1", "_inBundle": false, "_integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", "_location": "/elliptic", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, "raw": "elliptic@6.4.1", "name": "elliptic", "escapedName": "elliptic", "rawSpec": "6.4.1", "saveSpec": null, "fetchSpec": "6.4.1" }, "_requiredBy": [ "/browserify-sign", "/create-ecdh" ], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", "_spec": "6.4.1", "_where": "D:\\a\\1\\s\\src\\SDKs\\Js\\Map", "author": { "name": "Fedor Indutny", "email": "fedor@indutny.com" }, "bugs": { "url": "https://github.com/indutny/elliptic/issues" }, "dependencies": { "bn.js": "^4.4.0", "brorand": "^1.0.1", "hash.js": "^1.0.0", "hmac-drbg": "^1.0.0", "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" }, "description": "EC cryptography", "devDependencies": { "brfs": "^1.4.3", "coveralls": "^2.11.3", "grunt": "^0.4.5", "grunt-browserify": "^5.0.0", "grunt-cli": "^1.2.0", "grunt-contrib-connect": "^1.0.0", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-uglify": "^1.0.1", "grunt-mocha-istanbul": "^3.0.1", "grunt-saucelabs": "^8.6.2", "istanbul": "^0.4.2", "jscs": "^2.9.0", "jshint": "^2.6.0", "mocha": "^2.1.0" }, "files": [ "lib" ], "homepage": "https://github.com/indutny/elliptic", "keywords": [ "EC", "Elliptic", "curve", "Cryptography" ], "license": "MIT", "main": "lib/elliptic.js", "name": "elliptic", "repository": { "type": "git", "url": "git+ssh://git@github.com/indutny/elliptic.git" }, "scripts": { "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", "lint": "npm run jscs && npm run jshint", "test": "npm run lint && npm run unit", "unit": "istanbul test _mocha --reporter=spec test/index.js", "version": "grunt dist && git add dist/" }, "version": "6.4.1" } },{}],84:[function(require,module,exports){ (function (process,global){ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):t.ES6Promise=r()}(this,function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,o=void 0,e=void 0,i=function(t,r){h[n]=t,h[n+1]=r,2===(n+=2)&&(e?e(v):g())};var s="undefined"!=typeof window?window:void 0,u=s||{},f=u.MutationObserver||u.WebKitMutationObserver,c="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),a="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function l(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else s=o[t]=n,++e._eventsCount;return e}function onceWrapper(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(n=s[e]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:emitNone(n,l,this);break;case 2:emitOne(n,l,this,arguments[1]);break;case 3:emitTwo(n,l,this,arguments[1],arguments[2]);break;case 4:emitThree(n,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():spliceOne(n,i),1===n.length&&(r[e]=n[0]),r.removeListener&&this.emit("removeListener",e,s||t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,n,r;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=objectCreate(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=objectCreate(null):delete n[e]),this;if(0===arguments.length){var i,o=objectKeys(n);for(r=0;r=0;r--)this.removeListener(e,t[r]);return this},EventEmitter.prototype.listeners=function(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}; },{}],86:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer,MD5=require("md5.js");function EVP_BytesToKey(e,f,r,t){if(Buffer.isBuffer(e)||(e=Buffer.from(e,"binary")),f&&(Buffer.isBuffer(f)||(f=Buffer.from(f,"binary")),8!==f.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var u=r/8,a=Buffer.alloc(u),l=Buffer.alloc(t||0),n=Buffer.alloc(0);u>0||t>0;){var i=new MD5;i.update(n),i.update(e),f&&i.update(f),n=i.digest();var o=0;if(u>0){var B=a.length-u;o=Math.min(u,n.length),n.copy(a,B,0,o),u-=o}if(o0){var h=l.length-t,s=Math.min(t,n.length-o);n.copy(l,h,o,o+s),t-=s}}return n.fill(0),{key:a,iv:l}}module.exports=EVP_BytesToKey; },{"md5.js":110,"safe-buffer":148}],87:[function(require,module,exports){ "use strict";var Buffer=require("safe-buffer").Buffer,Transform=require("stream").Transform,inherits=require("inherits");function throwIfNotStringOrBuffer(t,e){if(!Buffer.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}function HashBase(t){Transform.call(this),this._block=Buffer.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits(HashBase,Transform),HashBase.prototype._transform=function(t,e,r){var s=null;try{this.update(t,e)}catch(t){s=t}r(s)},HashBase.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},HashBase.prototype.update=function(t,e){if(throwIfNotStringOrBuffer(t,"Data"),this._finalized)throw new Error("Digest already called");Buffer.isBuffer(t)||(t=Buffer.from(t,e));for(var r=this._block,s=0;this._blockOffset+t.length-s>=this._blockSize;){for(var i=this._blockOffset;i0;++f)this._length[f]+=o,(o=this._length[f]/4294967296|0)>0&&(this._length[f]-=4294967296*o);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},module.exports=HashBase; },{"inherits":102,"safe-buffer":148,"stream":157}],88:[function(require,module,exports){ var hash=exports;hash.utils=require("./hash/utils"),hash.common=require("./hash/common"),hash.sha=require("./hash/sha"),hash.ripemd=require("./hash/ripemd"),hash.hmac=require("./hash/hmac"),hash.sha1=hash.sha.sha1,hash.sha256=hash.sha.sha256,hash.sha224=hash.sha.sha224,hash.sha384=hash.sha.sha384,hash.sha512=hash.sha.sha512,hash.ripemd160=hash.ripemd.ripemd160; },{"./hash/common":89,"./hash/hmac":90,"./hash/ripemd":91,"./hash/sha":92,"./hash/utils":99}],89:[function(require,module,exports){ "use strict";var utils=require("./utils"),assert=require("minimalistic-assert");function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}exports.BlockHash=BlockHash,BlockHash.prototype.update=function(t,i){if(t=utils.toArray(t,i),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var h=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-h,t.length),0===this.pending.length&&(this.pending=null),t=utils.join32(t,0,t.length-h,this.endian);for(var n=0;n>>24&255,n[s++]=t>>>16&255,n[s++]=t>>>8&255,n[s++]=255&t}else for(n[s++]=255&t,n[s++]=t>>>8&255,n[s++]=t>>>16&255,n[s++]=t>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,a=8;athis.blockSize&&(t=(new this.Hash).update(t).digest()),assert(t.length<=this.blockSize);for(var i=t.length;i>>3}function g1_256(r){return rotr32(r,17)^rotr32(r,19)^r>>>10}exports.ft_1=ft_1,exports.ch32=ch32,exports.maj32=maj32,exports.p32=p32,exports.s0_256=s0_256,exports.s1_256=s1_256,exports.g0_256=g0_256,exports.g1_256=g1_256; },{"../utils":99}],99:[function(require,module,exports){ "use strict";var assert=require("minimalistic-assert"),inherits=require("inherits");function isSurrogatePair(r,t){return 55296==(64512&r.charCodeAt(t))&&(!(t<0||t+1>=r.length)&&56320==(64512&r.charCodeAt(t+1)))}function toArray(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var o=[];if("string"==typeof r)if(t){if("hex"===t)for((r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r),u=0;u>6|192,o[n++]=63&e|128):isSurrogatePair(r,u)?(e=65536+((1023&e)<<10)+(1023&r.charCodeAt(++u)),o[n++]=e>>18|240,o[n++]=e>>12&63|128,o[n++]=e>>6&63|128,o[n++]=63&e|128):(o[n++]=e>>12|224,o[n++]=e>>6&63|128,o[n++]=63&e|128)}else for(u=0;u>>24|r>>>8&65280|r<<8&16711680|(255&r)<<24)>>>0}function toHex32(r,t){for(var o="",n=0;n>>0}return e}function split32(r,t){for(var o=new Array(4*r.length),n=0,u=0;n>>24,o[u+1]=e>>>16&255,o[u+2]=e>>>8&255,o[u+3]=255&e):(o[u+3]=e>>>24,o[u+2]=e>>>16&255,o[u+1]=e>>>8&255,o[u]=255&e)}return o}function rotr32(r,t){return r>>>t|r<<32-t}function rotl32(r,t){return r<>>32-t}function sum32(r,t){return r+t>>>0}function sum32_3(r,t,o){return r+t+o>>>0}function sum32_4(r,t,o,n){return r+t+o+n>>>0}function sum32_5(r,t,o,n,u){return r+t+o+n+u>>>0}function sum64(r,t,o,n){var u=r[t],e=n+r[t+1]>>>0,h=(e>>0,r[t+1]=e}function sum64_hi(r,t,o,n){return(t+n>>>0>>0}function sum64_lo(r,t,o,n){return t+n>>>0}function sum64_4_hi(r,t,o,n,u,e,h,_){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)<_?1:0)>>>0}function sum64_4_lo(r,t,o,n,u,e,h,_){return t+n+e+_>>>0}function sum64_5_hi(r,t,o,n,u,e,h,_,l,f){var a=0,x=t;return a+=(x=x+n>>>0)>>0)>>0)<_?1:0,r+o+u+h+l+(a+=(x=x+f>>>0)>>0}function sum64_5_lo(r,t,o,n,u,e,h,_,l,f){return t+n+e+_+f>>>0}function rotr64_hi(r,t,o){return(t<<32-o|r>>>o)>>>0}function rotr64_lo(r,t,o){return(r<<32-o|t>>>o)>>>0}function shr64_hi(r,t,o){return r>>>o}function shr64_lo(r,t,o){return(r<<32-o|t>>>o)>>>0}exports.inherits=inherits,exports.toArray=toArray,exports.toHex=toHex,exports.htonl=htonl,exports.toHex32=toHex32,exports.zero2=zero2,exports.zero8=zero8,exports.join32=join32,exports.split32=split32,exports.rotr32=rotr32,exports.rotl32=rotl32,exports.sum32=sum32,exports.sum32_3=sum32_3,exports.sum32_4=sum32_4,exports.sum32_5=sum32_5,exports.sum64=sum64,exports.sum64_hi=sum64_hi,exports.sum64_lo=sum64_lo,exports.sum64_4_hi=sum64_4_hi,exports.sum64_4_lo=sum64_4_lo,exports.sum64_5_hi=sum64_5_hi,exports.sum64_5_lo=sum64_5_lo,exports.rotr64_hi=rotr64_hi,exports.rotr64_lo=rotr64_lo,exports.shr64_hi=shr64_hi,exports.shr64_lo=shr64_lo; },{"inherits":102,"minimalistic-assert":112}],100:[function(require,module,exports){ "use strict";var hash=require("hash.js"),utils=require("minimalistic-crypto-utils"),assert=require("minimalistic-assert");function HmacDRBG(t){if(!(this instanceof HmacDRBG))return new HmacDRBG(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=utils.toArray(t.entropy,t.entropyEnc||"hex"),i=utils.toArray(t.nonce,t.nonceEnc||"hex"),s=utils.toArray(t.pers,t.persEnc||"hex");assert(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,i,s)}module.exports=HmacDRBG,HmacDRBG.prototype._init=function(t,e,i){var s=t.concat(e).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(i||[])),this._reseed=1},HmacDRBG.prototype.generate=function(t,e,i,s){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(s=i,i=e,e=null),i&&(i=utils.toArray(i,s||"hex"),this._update(i));for(var h=[];h.length>1,n=-7,i=a?h-1:0,e=a?-1:1,s=o[t+i];for(i+=e,M=s&(1<<-n)-1,s>>=-n,n+=w;n>0;M=256*M+o[t+i],i+=e,n-=8);for(p=M&(1<<-n)-1,M>>=-n,n+=r;n>0;p=256*p+o[t+i],i+=e,n-=8);if(0===M)M=1-N;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=N}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(o,t,a,r,h,M){var p,w,f,N=8*M-h-1,n=(1<>1,e=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(w=isNaN(t)?1:0,p=n):(p=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-p))<1&&(p--,f*=2),(t+=p+i>=1?e/f:e*Math.pow(2,1-i))*f>=2&&(p++,f/=2),p+i>=n?(w=0,p=n):p+i>=1?(w=(t*f-1)*Math.pow(2,h),p+=i):(w=t*Math.pow(2,i-1)*Math.pow(2,h),p=0));h>=8;o[a+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;o[a+s]=255&p,s+=u,p/=256,N-=8);o[a+s-u]|=128*l}; },{}],102:[function(require,module,exports){ "function"==typeof Object.create?module.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}; },{}],103:[function(require,module,exports){ function isBuffer(f){return!!f.constructor&&"function"==typeof f.constructor.isBuffer&&f.constructor.isBuffer(f)}function isSlowBuffer(f){return"function"==typeof f.readFloatLE&&"function"==typeof f.slice&&isBuffer(f.slice(0,0))}module.exports=function(f){return null!=f&&(isBuffer(f)||isSlowBuffer(f)||!!f._isBuffer)}; },{}],104:[function(require,module,exports){ var toString={}.toString;module.exports=Array.isArray||function(r){return"[object Array]"==toString.call(r)}; },{}],105:[function(require,module,exports){ var chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function InvalidCharacterError(r){this.message=r}function polyfill(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,a,n=0,t=0,i="";a=o.charAt(t++);~a&&(e=n%4?64*e+a:a,n++%4)?i+=String.fromCharCode(255&e>>(-2*n&6)):0)a=chars.indexOf(a);return i}InvalidCharacterError.prototype=new Error,InvalidCharacterError.prototype.name="InvalidCharacterError",module.exports="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||polyfill; },{}],106:[function(require,module,exports){ var atob=require("./atob");function b64DecodeUnicode(e){return decodeURIComponent(atob(e).replace(/(.)/g,function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t}))}module.exports=function(e){var r=e.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw"Illegal base64url string!"}try{return b64DecodeUnicode(r)}catch(e){return atob(r)}}; },{"./atob":105}],107:[function(require,module,exports){ "use strict";var base64_url_decode=require("./base64_url_decode");function InvalidTokenError(r){this.message=r}InvalidTokenError.prototype=new Error,InvalidTokenError.prototype.name="InvalidTokenError",module.exports=function(r,e){if("string"!=typeof r)throw new InvalidTokenError("Invalid token specified");var o=!0===(e=e||{}).header?0:1;try{return JSON.parse(base64_url_decode(r.split(".")[o]))}catch(r){throw new InvalidTokenError("Invalid token specified: "+r.message)}},module.exports.InvalidTokenError=InvalidTokenError; },{"./base64_url_decode":106}],108:[function(require,module,exports){ (function (global){ (function(){var n,t=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",e="Expected a function",u="__lodash_hash_undefined__",i=500,o="__lodash_placeholder__",f=1,c=2,a=4,l=1,h=2,v=1,p=2,_=4,s=8,g=16,y=32,d=64,w=128,x=256,b=512,E=30,m="...",z=800,S=16,O=1,$=2,U=1/0,W=9007199254740991,R=1.7976931348623157e308,D=NaN,N=4294967295,q=N-1,B=N>>>1,Z=[["ary",w],["bind",v],["bindKey",p],["curry",s],["curryRight",g],["flip",b],["partial",y],["partialRight",d],["rearg",x]],M="[object Arguments]",T="[object Array]",j="[object AsyncFunction]",K="[object Boolean]",A="[object Date]",J="[object DOMException]",L="[object Error]",Q="[object Function]",X="[object GeneratorFunction]",Y="[object Map]",C="[object Number]",P="[object Null]",I="[object Object]",F="[object Proxy]",G="[object RegExp]",H="[object Set]",k="[object String]",V="[object Symbol]",nn="[object Undefined]",tn="[object WeakMap]",rn="[object WeakSet]",en="[object ArrayBuffer]",un="[object DataView]",on="[object Float32Array]",fn="[object Float64Array]",cn="[object Int8Array]",an="[object Int16Array]",ln="[object Int32Array]",hn="[object Uint8Array]",vn="[object Uint8ClampedArray]",pn="[object Uint16Array]",_n="[object Uint32Array]",sn=/\b__p \+= '';/g,gn=/\b(__p \+=) '' \+/g,yn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,dn=/&(?:amp|lt|gt|quot|#39);/g,wn=/[&<>"']/g,xn=RegExp(dn.source),bn=RegExp(wn.source),En=/<%-([\s\S]+?)%>/g,mn=/<%([\s\S]+?)%>/g,zn=/<%=([\s\S]+?)%>/g,Sn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,On=/^\w*$/,$n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Un=/[\\^$.*+?()[\]{}|]/g,Wn=RegExp(Un.source),Rn=/^\s+|\s+$/g,Dn=/^\s+/,Nn=/\s+$/,qn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Bn=/\{\n\/\* \[wrapped with (.+)\] \*/,Zn=/,? & /,Mn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Tn=/\\(\\)?/g,jn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Kn=/\w*$/,An=/^[-+]0x[0-9a-f]+$/i,Jn=/^0b[01]+$/i,Ln=/^\[object .+?Constructor\]$/,Qn=/^0o[0-7]+$/i,Xn=/^(?:0|[1-9]\d*)$/,Yn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Cn=/($^)/,Pn=/['\n\r\u2028\u2029\\]/g,In="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Fn="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Gn="[\\ud800-\\udfff]",Hn="["+Fn+"]",kn="["+In+"]",Vn="\\d+",nt="[\\u2700-\\u27bf]",tt="[a-z\\xdf-\\xf6\\xf8-\\xff]",rt="[^\\ud800-\\udfff"+Fn+Vn+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",et="\\ud83c[\\udffb-\\udfff]",ut="[^\\ud800-\\udfff]",it="(?:\\ud83c[\\udde6-\\uddff]){2}",ot="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ct="(?:"+tt+"|"+rt+")",at="(?:"+ft+"|"+rt+")",lt="(?:"+kn+"|"+et+")"+"?",ht="[\\ufe0e\\ufe0f]?"+lt+("(?:\\u200d(?:"+[ut,it,ot].join("|")+")[\\ufe0e\\ufe0f]?"+lt+")*"),vt="(?:"+[nt,it,ot].join("|")+")"+ht,pt="(?:"+[ut+kn+"?",kn,it,ot,Gn].join("|")+")",_t=RegExp("['’]","g"),st=RegExp(kn,"g"),gt=RegExp(et+"(?="+et+")|"+pt+ht,"g"),yt=RegExp([ft+"?"+tt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Hn,ft,"$"].join("|")+")",at+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Hn,ft+ct,"$"].join("|")+")",ft+"?"+ct+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ft+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Vn,vt].join("|"),"g"),dt=RegExp("[\\u200d\\ud800-\\udfff"+In+"\\ufe0e\\ufe0f]"),wt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],bt=-1,Et={};Et[on]=Et[fn]=Et[cn]=Et[an]=Et[ln]=Et[hn]=Et[vn]=Et[pn]=Et[_n]=!0,Et[M]=Et[T]=Et[en]=Et[K]=Et[un]=Et[A]=Et[L]=Et[Q]=Et[Y]=Et[C]=Et[I]=Et[G]=Et[H]=Et[k]=Et[tn]=!1;var mt={};mt[M]=mt[T]=mt[en]=mt[un]=mt[K]=mt[A]=mt[on]=mt[fn]=mt[cn]=mt[an]=mt[ln]=mt[Y]=mt[C]=mt[I]=mt[G]=mt[H]=mt[k]=mt[V]=mt[hn]=mt[vn]=mt[pn]=mt[_n]=!0,mt[L]=mt[Q]=mt[tn]=!1;var zt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},St=parseFloat,Ot=parseInt,$t="object"==typeof global&&global&&global.Object===Object&&global,Ut="object"==typeof self&&self&&self.Object===Object&&self,Wt=$t||Ut||Function("return this")(),Rt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Dt=Rt&&"object"==typeof module&&module&&!module.nodeType&&module,Nt=Dt&&Dt.exports===Rt,qt=Nt&&$t.process,Bt=function(){try{return qt&&qt.binding&&qt.binding("util")}catch(n){}}(),Zt=Bt&&Bt.isArrayBuffer,Mt=Bt&&Bt.isDate,Tt=Bt&&Bt.isMap,jt=Bt&&Bt.isRegExp,Kt=Bt&&Bt.isSet,At=Bt&&Bt.isTypedArray;function Jt(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function Lt(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u-1}function It(n,t,r){for(var e=-1,u=null==n?0:n.length;++e-1;);return r}function gr(n,t){for(var r=n.length;r--&&er(t,n[r],0)>-1;);return r}var yr=cr({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),dr=cr({"&":"&","<":"<",">":">",'"':""","'":"'"});function wr(n){return"\\"+zt[n]}function xr(n){return dt.test(n)}function br(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function Er(n,t){return function(r){return n(t(r))}}function mr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r",""":'"',"'":"'"});var Rr=function In(Fn){var Gn,Hn=(Fn=null==Fn?Wt:Rr.defaults(Wt.Object(),Fn,Rr.pick(Wt,xt))).Array,kn=Fn.Date,Vn=Fn.Error,nt=Fn.Function,tt=Fn.Math,rt=Fn.Object,et=Fn.RegExp,ut=Fn.String,it=Fn.TypeError,ot=Hn.prototype,ft=nt.prototype,ct=rt.prototype,at=Fn["__core-js_shared__"],lt=ft.toString,ht=ct.hasOwnProperty,vt=0,pt=(Gn=/[^.]+$/.exec(at&&at.keys&&at.keys.IE_PROTO||""))?"Symbol(src)_1."+Gn:"",gt=ct.toString,dt=lt.call(rt),zt=Wt._,$t=et("^"+lt.call(ht).replace(Un,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ut=Nt?Fn.Buffer:n,Rt=Fn.Symbol,Dt=Fn.Uint8Array,qt=Ut?Ut.allocUnsafe:n,Bt=Er(rt.getPrototypeOf,rt),nr=rt.create,cr=ct.propertyIsEnumerable,Dr=ot.splice,Nr=Rt?Rt.isConcatSpreadable:n,qr=Rt?Rt.iterator:n,Br=Rt?Rt.toStringTag:n,Zr=function(){try{var n=Ki(rt,"defineProperty");return n({},"",{}),n}catch(n){}}(),Mr=Fn.clearTimeout!==Wt.clearTimeout&&Fn.clearTimeout,Tr=kn&&kn.now!==Wt.Date.now&&kn.now,jr=Fn.setTimeout!==Wt.setTimeout&&Fn.setTimeout,Kr=tt.ceil,Ar=tt.floor,Jr=rt.getOwnPropertySymbols,Lr=Ut?Ut.isBuffer:n,Qr=Fn.isFinite,Xr=ot.join,Yr=Er(rt.keys,rt),Cr=tt.max,Pr=tt.min,Ir=kn.now,Fr=Fn.parseInt,Gr=tt.random,Hr=ot.reverse,kr=Ki(Fn,"DataView"),Vr=Ki(Fn,"Map"),ne=Ki(Fn,"Promise"),te=Ki(Fn,"Set"),re=Ki(Fn,"WeakMap"),ee=Ki(rt,"create"),ue=re&&new re,ie={},oe=lo(kr),fe=lo(Vr),ce=lo(ne),ae=lo(te),le=lo(re),he=Rt?Rt.prototype:n,ve=he?he.valueOf:n,pe=he?he.toString:n;function _e(n){if(Wf(n)&&!df(n)&&!(n instanceof de)){if(n instanceof ye)return n;if(ht.call(n,"__wrapped__"))return ho(n)}return new ye(n)}var se=function(){function t(){}return function(r){if(!Uf(r))return{};if(nr)return nr(r);t.prototype=r;var e=new t;return t.prototype=n,e}}();function ge(){}function ye(t,r){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=n}function de(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=N,this.__views__=[]}function we(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=r?t:r)),t}function Me(t,r,e,u,i,o){var l,h=r&f,v=r&c,p=r&a;if(e&&(l=i?e(t,u,i,o):e(t)),l!==n)return l;if(!Uf(t))return t;var _=df(t);if(_){if(l=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&ht.call(n,"index")&&(r.index=n.index,r.input=n.input),r}(t),!h)return ei(t,l)}else{var s=Li(t),g=s==Q||s==X;if(Ef(t))return Hu(t,h);if(s==I||s==M||g&&!i){if(l=v||g?{}:Xi(t),!h)return v?function(n,t){return ui(n,Ji(n),t)}(t,function(n,t){return n&&ui(t,oc(t),n)}(l,t)):function(n,t){return ui(n,Ai(n),t)}(t,Ne(l,t))}else{if(!mt[s])return i?t:{};l=function(n,t,r){var e,u,i,o=n.constructor;switch(t){case en:return ku(n);case K:case A:return new o(+n);case un:return function(n,t){var r=t?ku(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}(n,r);case on:case fn:case cn:case an:case ln:case hn:case vn:case pn:case _n:return Vu(n,r);case Y:return new o;case C:case k:return new o(n);case G:return(i=new(u=n).constructor(u.source,Kn.exec(u))).lastIndex=u.lastIndex,i;case H:return new o;case V:return e=n,ve?rt(ve.call(e)):{}}}(t,s,h)}}o||(o=new me);var y=o.get(t);if(y)return y;if(o.set(t,l),Bf(t))return t.forEach(function(n){l.add(Me(n,r,e,n,t,o))}),l;if(Rf(t))return t.forEach(function(n,u){l.set(u,Me(n,r,e,u,t,o))}),l;var d=_?n:(p?v?Ni:Di:v?oc:ic)(t);return Qt(d||t,function(n,u){d&&(n=t[u=n]),We(l,u,Me(n,r,e,u,t,o))}),l}function Te(t,r,e){var u=e.length;if(null==t)return!u;for(t=rt(t);u--;){var i=e[u],o=r[i],f=t[i];if(f===n&&!(i in t)||!o(f))return!1}return!0}function je(t,r,u){if("function"!=typeof t)throw new it(e);return eo(function(){t.apply(n,u)},r)}function Ke(n,r,e,u){var i=-1,o=Pt,f=!0,c=n.length,a=[],l=r.length;if(!c)return a;e&&(r=Ft(r,vr(e))),u?(o=It,f=!1):r.length>=t&&(o=_r,f=!1,r=new Ee(r));n:for(;++i-1},xe.prototype.set=function(n,t){var r=this.__data__,e=Re(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this},be.prototype.clear=function(){this.size=0,this.__data__={hash:new we,map:new(Vr||xe),string:new we}},be.prototype.delete=function(n){var t=Ti(this,n).delete(n);return this.size-=t?1:0,t},be.prototype.get=function(n){return Ti(this,n).get(n)},be.prototype.has=function(n){return Ti(this,n).has(n)},be.prototype.set=function(n,t){var r=Ti(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Ee.prototype.add=Ee.prototype.push=function(n){return this.__data__.set(n,u),this},Ee.prototype.has=function(n){return this.__data__.has(n)},me.prototype.clear=function(){this.__data__=new xe,this.size=0},me.prototype.delete=function(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r},me.prototype.get=function(n){return this.__data__.get(n)},me.prototype.has=function(n){return this.__data__.has(n)},me.prototype.set=function(n,r){var e=this.__data__;if(e instanceof xe){var u=e.__data__;if(!Vr||u.length0&&r(f)?t>1?Ye(f,t-1,r,e,u):Gt(u,f):e||(u[u.length]=f)}return u}var Ce=ci(),Pe=ci(!0);function Ie(n,t){return n&&Ce(n,t,ic)}function Fe(n,t){return n&&Pe(n,t,ic)}function Ge(n,t){return Ct(t,function(t){return Sf(n[t])})}function He(t,r){for(var e=0,u=(r=Pu(r,t)).length;null!=t&&et}function tu(n,t){return null!=n&&ht.call(n,t)}function ru(n,t){return null!=n&&t in rt(n)}function eu(t,r,e){for(var u=e?It:Pt,i=t[0].length,o=t.length,f=o,c=Hn(o),a=1/0,l=[];f--;){var h=t[f];f&&r&&(h=Ft(h,vr(r))),a=Pr(h.length,a),c[f]=!e&&(r||i>=120&&h.length>=120)?new Ee(f&&h):n}h=t[0];var v=-1,p=c[0];n:for(;++v=f)return c;var a=r[e];return c*("desc"==a?-1:1)}}return n.index-t.index}(n,t,r)})}function wu(n,t,r){for(var e=-1,u=t.length,i={};++e-1;)f!==n&&Dr.call(f,c,1),Dr.call(n,c,1);return n}function bu(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Ci(u)?Dr.call(n,u,1):Ku(n,u)}}return n}function Eu(n,t){return n+Ar(Gr()*(t-n+1))}function mu(n,t){var r="";if(!n||t<1||t>W)return r;do{t%2&&(r+=n),(t=Ar(t/2))&&(n+=n)}while(t);return r}function zu(n,t){return uo(no(n,t,Dc),n+"")}function Su(n){return Se(_c(n))}function Ou(n,t){var r=_c(n);return fo(r,Ze(t,0,r.length))}function $u(t,r,e,u){if(!Uf(t))return t;for(var i=-1,o=(r=Pu(r,t)).length,f=o-1,c=t;null!=c&&++iu?0:u+t),(r=r>u?u:r)<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=Hn(u);++e>>1,o=n[i];null!==o&&!Mf(o)&&(r?o<=t:o=t){var l=r?null:mi(n);if(l)return Sr(l);f=!1,i=_r,a=new Ee}else a=r?[]:c;n:for(;++u=u?t:Du(t,r,e)}var Gu=Mr||function(n){return Wt.clearTimeout(n)};function Hu(n,t){if(t)return n.slice();var r=n.length,e=qt?qt(r):new n.constructor(r);return n.copy(e),e}function ku(n){var t=new n.constructor(n.byteLength);return new Dt(t).set(new Dt(n)),t}function Vu(n,t){var r=t?ku(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}function ni(t,r){if(t!==r){var e=t!==n,u=null===t,i=t==t,o=Mf(t),f=r!==n,c=null===r,a=r==r,l=Mf(r);if(!c&&!l&&!o&&t>r||o&&f&&a&&!c&&!l||u&&f&&a||!e&&a||!i)return 1;if(!u&&!o&&!l&&t1?e[i-1]:n,f=i>2?e[2]:n;for(o=t.length>3&&"function"==typeof o?(i--,o):n,f&&Pi(e[0],e[1],f)&&(o=i<3?n:o,i=1),r=rt(r);++u-1?i[o?r[f]:f]:n}}function pi(t){return Ri(function(r){var u=r.length,i=u,o=ye.prototype.thru;for(t&&r.reverse();i--;){var f=r[i];if("function"!=typeof f)throw new it(e);if(o&&!c&&"wrapper"==Bi(f))var c=new ye([],!0)}for(i=c?i:u;++i1&&s.reverse(),h&&ac))return!1;var v=o.get(t);if(v&&o.get(r))return v==r;var p=-1,_=!0,s=e&h?new Ee:n;for(o.set(t,r),o.set(r,t);++p-1&&n%1==0&&n1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(qn,"{\n/* [wrapped with "+t+"] */\n")}(e,function(n,t){return Qt(Z,function(r){var e="_."+r[0];t&r[1]&&!Pt(n,e)&&n.push(e)}),n.sort()}(function(n){var t=n.match(Bn);return t?t[1].split(Zn):[]}(e),r)))}function oo(t){var r=0,e=0;return function(){var u=Ir(),i=S-(u-e);if(e=u,i>0){if(++r>=z)return arguments[0]}else r=0;return t.apply(n,arguments)}}function fo(t,r){var e=-1,u=t.length,i=u-1;for(r=r===n?u:r;++e1?t[r-1]:n;return e="function"==typeof e?(t.pop(),e):n,No(t,e)});function Ko(n){var t=_e(n);return t.__chain__=!0,t}function Ao(n,t){return t(n)}var Jo=Ri(function(t){var r=t.length,e=r?t[0]:0,u=this.__wrapped__,i=function(n){return Be(n,t)};return!(r>1||this.__actions__.length)&&u instanceof de&&Ci(e)?((u=u.slice(e,+e+(r?1:0))).__actions__.push({func:Ao,args:[i],thisArg:n}),new ye(u,this.__chain__).thru(function(t){return r&&!t.length&&t.push(n),t})):this.thru(i)});var Lo=ii(function(n,t,r){ht.call(n,r)?++n[r]:qe(n,r,1)});var Qo=vi(so),Xo=vi(go);function Yo(n,t){return(df(n)?Qt:Ae)(n,Mi(t,3))}function Co(n,t){return(df(n)?Xt:Je)(n,Mi(t,3))}var Po=ii(function(n,t,r){ht.call(n,r)?n[r].push(t):qe(n,r,[t])});var Io=zu(function(n,t,r){var e=-1,u="function"==typeof t,i=xf(n)?Hn(n.length):[];return Ae(n,function(n){i[++e]=u?Jt(t,n,r):uu(n,t,r)}),i}),Fo=ii(function(n,t,r){qe(n,r,t)});function Go(n,t){return(df(n)?Ft:pu)(n,Mi(t,3))}var Ho=ii(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]});var ko=zu(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Pi(n,t[0],t[1])?t=[]:r>2&&Pi(t[0],t[1],t[2])&&(t=[t[0]]),du(n,Ye(t,1),[])}),Vo=Tr||function(){return Wt.Date.now()};function nf(t,r,e){return r=e?n:r,r=t&&null==r?t.length:r,Si(t,w,n,n,n,n,r)}function tf(t,r){var u;if("function"!=typeof r)throw new it(e);return t=Lf(t),function(){return--t>0&&(u=r.apply(this,arguments)),t<=1&&(r=n),u}}var rf=zu(function(n,t,r){var e=v;if(r.length){var u=mr(r,Zi(rf));e|=y}return Si(n,e,t,r,u)}),ef=zu(function(n,t,r){var e=v|p;if(r.length){var u=mr(r,Zi(ef));e|=y}return Si(t,e,n,r,u)});function uf(t,r,u){var i,o,f,c,a,l,h=0,v=!1,p=!1,_=!0;if("function"!=typeof t)throw new it(e);function s(r){var e=i,u=o;return i=o=n,h=r,c=t.apply(u,e)}function g(t){var e=t-l;return l===n||e>=r||e<0||p&&t-h>=f}function y(){var n=Vo();if(g(n))return d(n);a=eo(y,function(n){var t=r-(n-l);return p?Pr(t,f-(n-h)):t}(n))}function d(t){return a=n,_&&i?s(t):(i=o=n,c)}function w(){var t=Vo(),e=g(t);if(i=arguments,o=this,l=t,e){if(a===n)return function(n){return h=n,a=eo(y,r),v?s(n):c}(l);if(p)return a=eo(y,r),s(l)}return a===n&&(a=eo(y,r)),c}return r=Xf(r)||0,Uf(u)&&(v=!!u.leading,f=(p="maxWait"in u)?Cr(Xf(u.maxWait)||0,r):f,_="trailing"in u?!!u.trailing:_),w.cancel=function(){a!==n&&Gu(a),h=0,i=l=o=a=n},w.flush=function(){return a===n?c:d(Vo())},w}var of=zu(function(n,t){return je(n,1,t)}),ff=zu(function(n,t,r){return je(n,Xf(t)||0,r)});function cf(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new it(e);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(cf.Cache||be),r}function af(n){if("function"!=typeof n)throw new it(e);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}cf.Cache=be;var lf=Iu(function(n,t){var r=(t=1==t.length&&df(t[0])?Ft(t[0],vr(Mi())):Ft(Ye(t,1),vr(Mi()))).length;return zu(function(e){for(var u=-1,i=Pr(e.length,r);++u=t}),yf=iu(function(){return arguments}())?iu:function(n){return Wf(n)&&ht.call(n,"callee")&&!cr.call(n,"callee")},df=Hn.isArray,wf=Zt?vr(Zt):function(n){return Wf(n)&&Ve(n)==en};function xf(n){return null!=n&&$f(n.length)&&!Sf(n)}function bf(n){return Wf(n)&&xf(n)}var Ef=Lr||Xc,mf=Mt?vr(Mt):function(n){return Wf(n)&&Ve(n)==A};function zf(n){if(!Wf(n))return!1;var t=Ve(n);return t==L||t==J||"string"==typeof n.message&&"string"==typeof n.name&&!Nf(n)}function Sf(n){if(!Uf(n))return!1;var t=Ve(n);return t==Q||t==X||t==j||t==F}function Of(n){return"number"==typeof n&&n==Lf(n)}function $f(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=W}function Uf(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function Wf(n){return null!=n&&"object"==typeof n}var Rf=Tt?vr(Tt):function(n){return Wf(n)&&Li(n)==Y};function Df(n){return"number"==typeof n||Wf(n)&&Ve(n)==C}function Nf(n){if(!Wf(n)||Ve(n)!=I)return!1;var t=Bt(n);if(null===t)return!0;var r=ht.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&<.call(r)==dt}var qf=jt?vr(jt):function(n){return Wf(n)&&Ve(n)==G};var Bf=Kt?vr(Kt):function(n){return Wf(n)&&Li(n)==H};function Zf(n){return"string"==typeof n||!df(n)&&Wf(n)&&Ve(n)==k}function Mf(n){return"symbol"==typeof n||Wf(n)&&Ve(n)==V}var Tf=At?vr(At):function(n){return Wf(n)&&$f(n.length)&&!!Et[Ve(n)]};var jf=xi(vu),Kf=xi(function(n,t){return n<=t});function Af(n){if(!n)return[];if(xf(n))return Zf(n)?Ur(n):ei(n);if(qr&&n[qr])return function(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}(n[qr]());var t=Li(n);return(t==Y?br:t==H?Sr:_c)(n)}function Jf(n){return n?(n=Xf(n))===U||n===-U?(n<0?-1:1)*R:n==n?n:0:0===n?n:0}function Lf(n){var t=Jf(n),r=t%1;return t==t?r?t-r:t:0}function Qf(n){return n?Ze(Lf(n),0,N):0}function Xf(n){if("number"==typeof n)return n;if(Mf(n))return D;if(Uf(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=Uf(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=n.replace(Rn,"");var r=Jn.test(n);return r||Qn.test(n)?Ot(n.slice(2),r?2:8):An.test(n)?D:+n}function Yf(n){return ui(n,oc(n))}function Cf(n){return null==n?"":Tu(n)}var Pf=oi(function(n,t){if(Hi(t)||xf(t))ui(t,ic(t),n);else for(var r in t)ht.call(t,r)&&We(n,r,t[r])}),If=oi(function(n,t){ui(t,oc(t),n)}),Ff=oi(function(n,t,r,e){ui(t,oc(t),n,e)}),Gf=oi(function(n,t,r,e){ui(t,ic(t),n,e)}),Hf=Ri(Be);var kf=zu(function(t,r){t=rt(t);var e=-1,u=r.length,i=u>2?r[2]:n;for(i&&Pi(r[0],r[1],i)&&(u=1);++e1),t}),ui(n,Ni(n),r),e&&(r=Me(r,f|c|a,Ui));for(var u=t.length;u--;)Ku(r,t[u]);return r});var lc=Ri(function(n,t){return null==n?{}:function(n,t){return wu(n,t,function(t,r){return tc(n,r)})}(n,t)});function hc(n,t){if(null==n)return{};var r=Ft(Ni(n),function(n){return[n]});return t=Mi(t),wu(n,r,function(n,r){return t(n,r[0])})}var vc=zi(ic),pc=zi(oc);function _c(n){return null==n?[]:pr(n,ic(n))}var sc=li(function(n,t,r){return t=t.toLowerCase(),n+(r?gc(t):t)});function gc(n){return zc(Cf(n).toLowerCase())}function yc(n){return(n=Cf(n))&&n.replace(Yn,yr).replace(st,"")}var dc=li(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),wc=li(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),xc=ai("toLowerCase");var bc=li(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()});var Ec=li(function(n,t,r){return n+(r?" ":"")+zc(t)});var mc=li(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),zc=ai("toUpperCase");function Sc(t,r,e){return t=Cf(t),(r=e?n:r)===n?function(n){return wt.test(n)}(t)?function(n){return n.match(yt)||[]}(t):function(n){return n.match(Mn)||[]}(t):t.match(r)||[]}var Oc=zu(function(t,r){try{return Jt(t,n,r)}catch(n){return zf(n)?n:new Vn(n)}}),$c=Ri(function(n,t){return Qt(t,function(t){t=ao(t),qe(n,t,rf(n[t],n))}),n});function Uc(n){return function(){return n}}var Wc=pi(),Rc=pi(!0);function Dc(n){return n}function Nc(n){return au("function"==typeof n?n:Me(n,f))}var qc=zu(function(n,t){return function(r){return uu(r,n,t)}}),Bc=zu(function(n,t){return function(r){return uu(n,r,t)}});function Zc(n,t,r){var e=ic(t),u=Ge(t,e);null!=r||Uf(t)&&(u.length||!e.length)||(r=t,t=n,n=this,u=Ge(t,ic(t)));var i=!(Uf(r)&&"chain"in r&&!r.chain),o=Sf(n);return Qt(u,function(r){var e=t[r];n[r]=e,o&&(n.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=n(this.__wrapped__);return(r.__actions__=ei(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,Gt([this.value()],arguments))})}),n}function Mc(){}var Tc=yi(Ft),jc=yi(Yt),Kc=yi(Vt);function Ac(n){return Ii(n)?fr(ao(n)):function(n){return function(t){return He(t,n)}}(n)}var Jc=wi(),Lc=wi(!0);function Qc(){return[]}function Xc(){return!1}var Yc=gi(function(n,t){return n+t},0),Cc=Ei("ceil"),Pc=gi(function(n,t){return n/t},1),Ic=Ei("floor");var Fc,Gc=gi(function(n,t){return n*t},1),Hc=Ei("round"),kc=gi(function(n,t){return n-t},0);return _e.after=function(n,t){if("function"!=typeof t)throw new it(e);return n=Lf(n),function(){if(--n<1)return t.apply(this,arguments)}},_e.ary=nf,_e.assign=Pf,_e.assignIn=If,_e.assignInWith=Ff,_e.assignWith=Gf,_e.at=Hf,_e.before=tf,_e.bind=rf,_e.bindAll=$c,_e.bindKey=ef,_e.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return df(n)?n:[n]},_e.chain=Ko,_e.chunk=function(t,r,e){r=(e?Pi(t,r,e):r===n)?1:Cr(Lf(r),0);var u=null==t?0:t.length;if(!u||r<1)return[];for(var i=0,o=0,f=Hn(Kr(u/r));ii?0:i+e),(u=u===n||u>i?i:Lf(u))<0&&(u+=i),u=e>u?0:Qf(u);e>>0)?(t=Cf(t))&&("string"==typeof r||null!=r&&!qf(r))&&!(r=Tu(r))&&xr(t)?Fu(Ur(t),0,e):t.split(r,e):[]},_e.spread=function(n,t){if("function"!=typeof n)throw new it(e);return t=null==t?0:Cr(Lf(t),0),zu(function(r){var e=r[t],u=Fu(r,0,t);return e&&Gt(u,e),Jt(n,this,u)})},_e.tail=function(n){var t=null==n?0:n.length;return t?Du(n,1,t):[]},_e.take=function(t,r,e){return t&&t.length?Du(t,0,(r=e||r===n?1:Lf(r))<0?0:r):[]},_e.takeRight=function(t,r,e){var u=null==t?0:t.length;return u?Du(t,(r=u-(r=e||r===n?1:Lf(r)))<0?0:r,u):[]},_e.takeRightWhile=function(n,t){return n&&n.length?Ju(n,Mi(t,3),!1,!0):[]},_e.takeWhile=function(n,t){return n&&n.length?Ju(n,Mi(t,3)):[]},_e.tap=function(n,t){return t(n),n},_e.throttle=function(n,t,r){var u=!0,i=!0;if("function"!=typeof n)throw new it(e);return Uf(r)&&(u="leading"in r?!!r.leading:u,i="trailing"in r?!!r.trailing:i),uf(n,t,{leading:u,maxWait:t,trailing:i})},_e.thru=Ao,_e.toArray=Af,_e.toPairs=vc,_e.toPairsIn=pc,_e.toPath=function(n){return df(n)?Ft(n,ao):Mf(n)?[n]:ei(co(Cf(n)))},_e.toPlainObject=Yf,_e.transform=function(n,t,r){var e=df(n),u=e||Ef(n)||Tf(n);if(t=Mi(t,4),null==r){var i=n&&n.constructor;r=u?e?new i:[]:Uf(n)&&Sf(i)?se(Bt(n)):{}}return(u?Qt:Ie)(n,function(n,e,u){return t(r,n,e,u)}),r},_e.unary=function(n){return nf(n,1)},_e.union=Uo,_e.unionBy=Wo,_e.unionWith=Ro,_e.uniq=function(n){return n&&n.length?ju(n):[]},_e.uniqBy=function(n,t){return n&&n.length?ju(n,Mi(t,2)):[]},_e.uniqWith=function(t,r){return r="function"==typeof r?r:n,t&&t.length?ju(t,n,r):[]},_e.unset=function(n,t){return null==n||Ku(n,t)},_e.unzip=Do,_e.unzipWith=No,_e.update=function(n,t,r){return null==n?n:Au(n,t,Cu(r))},_e.updateWith=function(t,r,e,u){return u="function"==typeof u?u:n,null==t?t:Au(t,r,Cu(e),u)},_e.values=_c,_e.valuesIn=function(n){return null==n?[]:pr(n,oc(n))},_e.without=qo,_e.words=Sc,_e.wrap=function(n,t){return hf(Cu(t),n)},_e.xor=Bo,_e.xorBy=Zo,_e.xorWith=Mo,_e.zip=To,_e.zipObject=function(n,t){return Xu(n||[],t||[],We)},_e.zipObjectDeep=function(n,t){return Xu(n||[],t||[],$u)},_e.zipWith=jo,_e.entries=vc,_e.entriesIn=pc,_e.extend=If,_e.extendWith=Ff,Zc(_e,_e),_e.add=Yc,_e.attempt=Oc,_e.camelCase=sc,_e.capitalize=gc,_e.ceil=Cc,_e.clamp=function(t,r,e){return e===n&&(e=r,r=n),e!==n&&(e=(e=Xf(e))==e?e:0),r!==n&&(r=(r=Xf(r))==r?r:0),Ze(Xf(t),r,e)},_e.clone=function(n){return Me(n,a)},_e.cloneDeep=function(n){return Me(n,f|a)},_e.cloneDeepWith=function(t,r){return Me(t,f|a,r="function"==typeof r?r:n)},_e.cloneWith=function(t,r){return Me(t,a,r="function"==typeof r?r:n)},_e.conformsTo=function(n,t){return null==t||Te(n,t,ic(t))},_e.deburr=yc,_e.defaultTo=function(n,t){return null==n||n!=n?t:n},_e.divide=Pc,_e.endsWith=function(t,r,e){t=Cf(t),r=Tu(r);var u=t.length,i=e=e===n?u:Ze(Lf(e),0,u);return(e-=r.length)>=0&&t.slice(e,i)==r},_e.eq=_f,_e.escape=function(n){return(n=Cf(n))&&bn.test(n)?n.replace(wn,dr):n},_e.escapeRegExp=function(n){return(n=Cf(n))&&Wn.test(n)?n.replace(Un,"\\$&"):n},_e.every=function(t,r,e){var u=df(t)?Yt:Le;return e&&Pi(t,r,e)&&(r=n),u(t,Mi(r,3))},_e.find=Qo,_e.findIndex=so,_e.findKey=function(n,t){return tr(n,Mi(t,3),Ie)},_e.findLast=Xo,_e.findLastIndex=go,_e.findLastKey=function(n,t){return tr(n,Mi(t,3),Fe)},_e.floor=Ic,_e.forEach=Yo,_e.forEachRight=Co,_e.forIn=function(n,t){return null==n?n:Ce(n,Mi(t,3),oc)},_e.forInRight=function(n,t){return null==n?n:Pe(n,Mi(t,3),oc)},_e.forOwn=function(n,t){return n&&Ie(n,Mi(t,3))},_e.forOwnRight=function(n,t){return n&&Fe(n,Mi(t,3))},_e.get=nc,_e.gt=sf,_e.gte=gf,_e.has=function(n,t){return null!=n&&Qi(n,t,tu)},_e.hasIn=tc,_e.head=wo,_e.identity=Dc,_e.includes=function(n,t,r,e){n=xf(n)?n:_c(n),r=r&&!e?Lf(r):0;var u=n.length;return r<0&&(r=Cr(u+r,0)),Zf(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&er(n,t,r)>-1},_e.indexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:Lf(r);return u<0&&(u=Cr(e+u,0)),er(n,t,u)},_e.inRange=function(t,r,e){return r=Jf(r),e===n?(e=r,r=0):e=Jf(e),function(n,t,r){return n>=Pr(t,r)&&n=-W&&n<=W},_e.isSet=Bf,_e.isString=Zf,_e.isSymbol=Mf,_e.isTypedArray=Tf,_e.isUndefined=function(t){return t===n},_e.isWeakMap=function(n){return Wf(n)&&Li(n)==tn},_e.isWeakSet=function(n){return Wf(n)&&Ve(n)==rn},_e.join=function(n,t){return null==n?"":Xr.call(n,t)},_e.kebabCase=dc,_e.last=mo,_e.lastIndexOf=function(t,r,e){var u=null==t?0:t.length;if(!u)return-1;var i=u;return e!==n&&(i=(i=Lf(e))<0?Cr(u+i,0):Pr(i,u-1)),r==r?function(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}(t,r,i):rr(t,ir,i,!0)},_e.lowerCase=wc,_e.lowerFirst=xc,_e.lt=jf,_e.lte=Kf,_e.max=function(t){return t&&t.length?Qe(t,Dc,nu):n},_e.maxBy=function(t,r){return t&&t.length?Qe(t,Mi(r,2),nu):n},_e.mean=function(n){return or(n,Dc)},_e.meanBy=function(n,t){return or(n,Mi(t,2))},_e.min=function(t){return t&&t.length?Qe(t,Dc,vu):n},_e.minBy=function(t,r){return t&&t.length?Qe(t,Mi(r,2),vu):n},_e.stubArray=Qc,_e.stubFalse=Xc,_e.stubObject=function(){return{}},_e.stubString=function(){return""},_e.stubTrue=function(){return!0},_e.multiply=Gc,_e.nth=function(t,r){return t&&t.length?yu(t,Lf(r)):n},_e.noConflict=function(){return Wt._===this&&(Wt._=zt),this},_e.noop=Mc,_e.now=Vo,_e.pad=function(n,t,r){n=Cf(n);var e=(t=Lf(t))?$r(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return di(Ar(u),r)+n+di(Kr(u),r)},_e.padEnd=function(n,t,r){n=Cf(n);var e=(t=Lf(t))?$r(n):0;return t&&er){var u=t;t=r,r=u}if(e||t%1||r%1){var i=Gr();return Pr(t+i*(r-t+St("1e-"+((i+"").length-1))),r)}return Eu(t,r)},_e.reduce=function(n,t,r){var e=df(n)?Ht:ar,u=arguments.length<3;return e(n,Mi(t,4),r,u,Ae)},_e.reduceRight=function(n,t,r){var e=df(n)?kt:ar,u=arguments.length<3;return e(n,Mi(t,4),r,u,Je)},_e.repeat=function(t,r,e){return r=(e?Pi(t,r,e):r===n)?1:Lf(r),mu(Cf(t),r)},_e.replace=function(){var n=arguments,t=Cf(n[0]);return n.length<3?t:t.replace(n[1],n[2])},_e.result=function(t,r,e){var u=-1,i=(r=Pu(r,t)).length;for(i||(i=1,t=n);++uW)return[];var r=N,e=Pr(n,N);t=Mi(t),n-=N;for(var u=hr(e,t);++r=o)return t;var c=e-$r(u);if(c<1)return u;var a=f?Fu(f,0,c).join(""):t.slice(0,c);if(i===n)return a+u;if(f&&(c+=a.length-c),qf(i)){if(t.slice(c).search(i)){var l,h=a;for(i.global||(i=et(i.source,Cf(Kn.exec(i))+"g")),i.lastIndex=0;l=i.exec(h);)var v=l.index;a=a.slice(0,v===n?c:v)}}else if(t.indexOf(Tu(i),c)!=c){var p=a.lastIndexOf(i);p>-1&&(a=a.slice(0,p))}return a+u},_e.unescape=function(n){return(n=Cf(n))&&xn.test(n)?n.replace(dn,Wr):n},_e.uniqueId=function(n){var t=++vt;return Cf(n)+t},_e.upperCase=mc,_e.upperFirst=zc,_e.each=Yo,_e.eachRight=Co,_e.first=wo,Zc(_e,(Fc={},Ie(_e,function(n,t){ht.call(_e.prototype,t)||(Fc[t]=n)}),Fc),{chain:!1}),_e.VERSION="4.17.5",Qt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){_e[n].placeholder=_e}),Qt(["drop","take"],function(t,r){de.prototype[t]=function(e){e=e===n?1:Cr(Lf(e),0);var u=this.__filtered__&&!r?new de(this):this.clone();return u.__filtered__?u.__takeCount__=Pr(e,u.__takeCount__):u.__views__.push({size:Pr(e,N),type:t+(u.__dir__<0?"Right":"")}),u},de.prototype[t+"Right"]=function(n){return this.reverse()[t](n).reverse()}}),Qt(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==O||3==r;de.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:Mi(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),Qt(["head","last"],function(n,t){var r="take"+(t?"Right":"");de.prototype[n]=function(){return this[r](1).value()[0]}}),Qt(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");de.prototype[n]=function(){return this.__filtered__?new de(this):this[r](1)}}),de.prototype.compact=function(){return this.filter(Dc)},de.prototype.find=function(n){return this.filter(n).head()},de.prototype.findLast=function(n){return this.reverse().find(n)},de.prototype.invokeMap=zu(function(n,t){return"function"==typeof n?new de(this):this.map(function(r){return uu(r,n,t)})}),de.prototype.reject=function(n){return this.filter(af(Mi(n)))},de.prototype.slice=function(t,r){t=Lf(t);var e=this;return e.__filtered__&&(t>0||r<0)?new de(e):(t<0?e=e.takeRight(-t):t&&(e=e.drop(t)),r!==n&&(e=(r=Lf(r))<0?e.dropRight(-r):e.take(r-t)),e)},de.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},de.prototype.toArray=function(){return this.take(N)},Ie(de.prototype,function(t,r){var e=/^(?:filter|find|map|reject)|While$/.test(r),u=/^(?:head|last)$/.test(r),i=_e[u?"take"+("last"==r?"Right":""):r],o=u||/^find/.test(r);i&&(_e.prototype[r]=function(){var r=this.__wrapped__,f=u?[1]:arguments,c=r instanceof de,a=f[0],l=c||df(r),h=function(n){var t=i.apply(_e,Gt([n],f));return u&&v?t[0]:t};l&&e&&"function"==typeof a&&1!=a.length&&(c=l=!1);var v=this.__chain__,p=!!this.__actions__.length,_=o&&!v,s=c&&!p;if(!o&&l){r=s?r:new de(this);var g=t.apply(r,f);return g.__actions__.push({func:Ao,args:[h],thisArg:n}),new ye(g,v)}return _&&s?t.apply(this,f):(g=this.thru(h),_?u?g.value()[0]:g.value():g)})}),Qt(["pop","push","shift","sort","splice","unshift"],function(n){var t=ot[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);_e.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(df(u)?u:[],n)}return this[r](function(r){return t.apply(df(r)?r:[],n)})}}),Ie(de.prototype,function(n,t){var r=_e[t];if(r){var e=r.name+"";(ie[e]||(ie[e]=[])).push({name:t,func:r})}}),ie[_i(n,p).name]=[{name:"wrapper",func:n}],de.prototype.clone=function(){var n=new de(this.__wrapped__);return n.__actions__=ei(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=ei(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=ei(this.__views__),n},de.prototype.reverse=function(){if(this.__filtered__){var n=new de(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},de.prototype.value=function(){var n=this.__wrapped__.value(),t=this.__dir__,r=df(n),e=t<0,u=r?n.length:0,i=function(n,t,r){for(var e=-1,u=r.length;++e=this.__values__.length;return{done:t,value:t?n:this.__values__[this.__index__++]}},_e.prototype.plant=function(t){for(var r,e=this;e instanceof ge;){var u=ho(e);u.__index__=0,u.__values__=n,r?i.__wrapped__=u:r=u;var i=u;e=e.__wrapped__}return i.__wrapped__=t,r},_e.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof de){var r=t;return this.__actions__.length&&(r=new de(this)),(r=r.reverse()).__actions__.push({func:Ao,args:[$o],thisArg:n}),new ye(r,this.__chain__)}return this.thru($o)},_e.prototype.toJSON=_e.prototype.valueOf=_e.prototype.value=function(){return Lu(this.__wrapped__,this.__actions__)},_e.prototype.first=_e.prototype.head,qr&&(_e.prototype[qr]=function(){return this}),_e}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Wt._=Rr,define(function(){return Rr})):Dt?((Dt.exports=Rr)._=Rr,Rt._=Rr):Wt._=Rr}).call(this); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],109:[function(require,module,exports){ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.mapboxgl=e()}(this,function(){"use strict";var t,e,r;function i(i,n){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),(r=n(a)).workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))}else e=n;else t=n}return i(0,function(t){function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t,e){return t(e={exports:{}},e.exports),e.exports}var i=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),n=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,o=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,a={now:i,frame:function(t){var e=n(t);return{cancel:function(){return o(e)}}},getImageData:function(t){var e=self.document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0,t.width,t.height),r.getImageData(0,0,t.width,t.height)},resolveURL:function(t){var e=self.document.createElement("a");return e.href=t,e.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio},supportsWebp:!1};if(self.document){var s=self.document.createElement("img");s.onload=function(){a.supportsWebp=!0},s.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="}var l=u;function u(t,e,r,i){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=i}u.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},u.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},u.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},u.prototype.solveCurveX=function(t,e){var r,i,n,o,a;for(void 0===e&&(e=1e-6),n=t,a=0;a<8;a++){if(o=this.sampleCurveX(n)-t,Math.abs(o)(i=1))return i;for(;ro?r=n:i=n,n=.5*(i-r)+r}return n},u.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var c=function(t,e,r){this.column=t,this.row=e,this.zoom=r};c.prototype.clone=function(){return new c(this.column,this.row,this.zoom)},c.prototype.zoomTo=function(t){return this.clone()._zoomTo(t)},c.prototype.sub=function(t){return this.clone()._sub(t)},c.prototype._zoomTo=function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},c.prototype._sub=function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this};var h=p;function p(t,e){this.x=t,this.y=e}function f(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0;r0;)e[r]=arguments[r+1];for(var i=0,n=e;i(e.y-t.y)*(r.x-t.x)}function I(t){for(var e=0,r=0,i=t.length,n=i-1,o=void 0,a=void 0;r=200&&r.status<300&&r.response?e(null,{data:i,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):e(new k(r.statusText,r.status,t.url))},r.send(),{cancel:function(){return r.abort()}}};function L(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function D(t,e,r){if(r&&r[t]){var i=r[t].indexOf(e);-1!==i&&r[t].splice(i,1)}}var R=function(t,e){void 0===e&&(e={}),v(this,e),this.type=t},B=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",v({error:e},r))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(R),O=function(){};O.prototype.on=function(t,e){return this._listeners=this._listeners||{},L(t,e,this._listeners),this},O.prototype.off=function(t,e){return D(t,e,this._listeners),D(t,e,this._oneTimeListeners),this},O.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},L(t,e,this._oneTimeListeners),this},O.prototype.fire=function(t){"string"==typeof t&&(t=new R(t,arguments[1]||{}));var e=t.type;if(this.listens(e)){t.target=this;for(var r=0,i=this._listeners&&this._listeners[e]?this._listeners[e].slice():[];r0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},O.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var F={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},lineMetrics:{type:"boolean",default:!1}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"string",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"string",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Heatmap"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}}},V=function(t,e,r,i){this.message=(t?t+": ":"")+r,i&&(this.identifier=i),null!=e&&e.__line__&&(this.line=e.__line__)};function N(t){var e=t.key,r=t.value;return r?[new V(e,r,"constants have been deprecated as of v8")]:[]}function j(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var i=0,n=e;i":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var rt=[G,W,X,H,K,Y,tt(J)];function it(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&!it(t.itemType,e.itemType)&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,i=rt;r255?255:t}function n(t){return t<0?0:t>1?1:t}function o(t){return"%"===t[t.length-1]?i(parseFloat(t)/100*255):i(parseInt(t))}function a(t){return"%"===t[t.length-1]?n(parseFloat(t)/100):n(parseFloat(t))}function s(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,n=t.replace(/ /g,"").toLowerCase();if(n in r)return r[n].slice();if("#"===n[0])return 4===n.length?(e=parseInt(n.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===n.length&&(e=parseInt(n.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=n.indexOf("("),u=n.indexOf(")");if(-1!==l&&u+1===n.length){var c=n.substr(0,l),h=n.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=a(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),p];case"hsla":if(4!==h.length)return null;p=a(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,d=a(h[1]),m=a(h[2]),y=m<=.5?m*(d+1):m+d-m*d,v=2*m-y;return[i(255*s(v,y,f+1/3)),i(255*s(v,y,f)),i(255*s(v,y,f-1/3)),p];default:return null}}return null}}catch(t){}}).parseCSSColor,ot=function(t,e,r,i){void 0===i&&(i=1),this.r=t,this.g=e,this.b=r,this.a=i};ot.parse=function(t){if(t){if(t instanceof ot)return t;if("string"==typeof t){var e=nt(t);if(e)return new ot(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},ot.prototype.toString=function(){var t=this.toArray(),e=t[0],r=t[1],i=t[2],n=t[3];return"rgba("+Math.round(e)+","+Math.round(r)+","+Math.round(i)+","+n+")"},ot.prototype.toArray=function(){var t=this.r,e=this.g,r=this.b,i=this.a;return 0===i?[0,0,0,0]:[255*t/i,255*e/i,255*r/i,i]},ot.black=new ot(0,0,0,1),ot.white=new ot(1,1,1,1),ot.transparent=new ot(0,0,0,0);var at=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};at.prototype.compare=function(t,e){return this.collator.compare(t,e)},at.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var st=function(t,e,r){this.type=Q,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function lt(t,e,r,i){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:"Invalid rgba value ["+[t,e,r,i].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof i?[t,e,r,i]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ut(t){if(null===t)return G;if("string"==typeof t)return X;if("boolean"==typeof t)return H;if("number"==typeof t)return W;if(t instanceof ot)return K;if(t instanceof at)return Q;if(Array.isArray(t)){for(var e,r=t.length,i=0,n=t;i4)return e.error("Expected 1, 2, or 3 arguments, but found "+(t.length-1)+" instead.");var r,i;if(t.length>2){var n=t[1];if("string"!=typeof n||!(n in dt))return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=dt[n]}else r=J;if(t.length>3){if("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2]))return e.error('The length argument to "array" must be a positive integer literal',2);i=t[2]}var o=tt(r,i),a=e.parse(t[t.length-1],t.length-1,J);return a?new mt(o,a):null},mt.prototype.evaluate=function(t){var e=this.input.evaluate(t);if(it(this.type,ut(e)))throw new ht("Expected value to be of type "+et(this.type)+", but found "+et(ut(e))+" instead.");return e},mt.prototype.eachChild=function(t){t(this.input)},mt.prototype.possibleOutputs=function(){return this.input.possibleOutputs()},mt.prototype.serialize=function(){var t=["array"],e=this.type.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){t.push(e.kind);var r=this.type.N;"number"==typeof r&&t.push(r)}return t.push(this.input.serialize()),t};var yt={"to-number":W,"to-color":K},vt=function(t,e){this.type=t,this.args=e};vt.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");for(var r=t[0],i=yt[r],n=[],o=1;o4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":lt(e[0],e[1],e[2],e[3])))return new ot(e[0]/255,e[1]/255,e[2]/255,e[3]);throw new ht(r||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}for(var a=null,s=0,l=this.args;s=0)return!1;var r=!0;return t.eachChild(function(t){r&&!Et(t,e)&&(r=!1)}),r}xt.prototype.evaluate=function(t){return this._evaluate(t,this.args)},xt.prototype.eachChild=function(t){this.args.forEach(t)},xt.prototype.possibleOutputs=function(){return[void 0]},xt.prototype.serialize=function(){return[this.name].concat(this.args.map(function(t){return t.serialize()}))},xt.parse=function(t,e){var r=t[0],i=xt.definitions[r];if(!i)return e.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var n=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter(function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1}),s=[],l=1;lr&&ee))throw new ht("Input is not a number.");o=a-1}}return Math.max(a-1,0)}Tt.prototype.parse=function(t,e,r,i,n){return void 0===n&&(n={}),e?this.concat(e,r,i)._parse(t,n):this._parse(t,n)},Tt.prototype._parse=function(t,e){if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[r];if(i){var n=i.parse(t,this);if(!n)return null;if(this.expectedType){var o=this.expectedType,a=n.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind||"value"!==a.kind)if("array"===o.kind&&"value"===a.kind)e.omitTypeAnnotations||(n=new mt(o,n));else if("color"!==o.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(this.expectedType,n.type))return null}else e.omitTypeAnnotations||(n=new vt(o,[n]));else e.omitTypeAnnotations||(n=new ft(o,[n]))}if(!(n instanceof ct)&&function t(e){if(e instanceof St)return t(e.boundExpression);if(e instanceof xt&&"error"===e.name)return!1;if(e instanceof st)return!1;var r=e instanceof vt||e instanceof ft||e instanceof mt,i=!0;return e.eachChild(function(e){i=r?i&&t(e):i&&e instanceof ct}),!!i&&(bt(e)&&Et(e,["zoom","heatmap-density","line-progress","is-supported-script"]))}(n)){var s=new _t;try{n=new ct(n.type,n.evaluate(s))}catch(t){return this.error(t.message),null}}return n}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},Tt.prototype.concat=function(t,e,r){var i="number"==typeof t?this.path.concat(t):this.path,n=r?this.scope.concat(r):this.scope;return new Tt(this.registry,i,e||null,n,this.errors)},Tt.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var i=""+this.key+e.map(function(t){return"["+t+"]"}).join("");this.errors.push(new q(i,t))},Tt.prototype.checkSubtype=function(t,e){var r=it(t,e);return r&&this.error(r),r};var zt=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var i=0,n=r;i=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var h=e.parse(l,c,o);if(!h)return null;o=o||h.type,n.push([s,h])}return new zt(o,r,n)},zt.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);var n=e.length;return i>=e[n-1]?r[n-1].evaluate(t):r[At(e,i)].evaluate(t)},zt.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Mt=Object.freeze({number:It,color:function(t,e,r){return new ot(It(t.r,e.r,r),It(t.g,e.g,r),It(t.b,e.b,r),It(t.a,e.a,r))},array:function(t,e,r){return t.map(function(t,i){return It(t,e[i],r)})}}),kt=function(t,e,r,i){this.type=t,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(var n=0,o=i;n1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:a}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,W)))return null;var s=[],l=null;e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var u=0;u=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);var d=e.parse(h,f,l);if(!d)return null;l=l||d.type,s.push([c,d])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new kt(l,r,i,s):e.error("Type "+et(l)+" is not interpolatable.")},kt.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);var n=e.length;if(i>=e[n-1])return r[n-1].evaluate(t);var o=At(e,i),a=e[o],s=e[o+1],l=kt.interpolationFactor(this.interpolation,i,a,s),u=r[o].evaluate(t),c=r[o+1].evaluate(t);return Mt[this.type.kind.toLowerCase()](u,c,l)},kt.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new ht("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new ht("Array index must be an integer, but found "+e+" instead.");return r[e]},Dt.prototype.eachChild=function(t){t(this.index),t(this.input)},Dt.prototype.possibleOutputs=function(){return[void 0]},Dt.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Rt=function(t,e,r,i,n,o){this.inputType=t,this.type=e,this.input=r,this.cases=i,this.outputs=n,this.otherwise=o};Rt.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var n={},o=[],a=2;aNumber.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof p&&Math.floor(p)!==p)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,ut(p)))return null}else r=ut(p);if(void 0!==n[String(p)])return u.error("Branch labels must be unique.");n[String(p)]=o.length}var f=e.parse(l,a,i);if(!f)return null;i=i||f.type,o.push(f)}var d=e.parse(t[1],1,J);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,i);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new Rt(r,i,d,n,o,m):null},Rt.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ut(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},Rt.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},Rt.prototype.possibleOutputs=function(){return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()})).concat(this.otherwise.possibleOutputs());var t},Rt.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],i={},n=0,o=Object.keys(this.cases).sort();ni.evaluate(t)}function Xt(t,e){var r=e[0],i=e[1];return r.evaluate(t)<=i.evaluate(t)}function Ht(t,e){var r=e[0],i=e[1];return r.evaluate(t)>=i.evaluate(t)}function Kt(t){return{type:t}}function Yt(t){return{result:"success",value:t}}function Jt(t){return{result:"error",value:t}}function Qt(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function te(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function ee(t){return!!t.expression&&t.expression.interpolated}xt.register(Ut,{error:[{kind:"error"},[X],function(t,e){var r=e[0];throw new ht(r.evaluate(t))}],typeof:[X,[J],function(t,e){return et(ut(e[0].evaluate(t)))}],"to-string":[X,[J],function(t,e){var r=e[0],i=typeof(r=r.evaluate(t));return null===r?"":"string"===i||"number"===i||"boolean"===i?String(r):r instanceof ot?r.toString():JSON.stringify(r)}],"to-boolean":[H,[J],function(t,e){var r=e[0];return Boolean(r.evaluate(t))}],"to-rgba":[tt(W,4),[K],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[K,[W,W,W],$t],rgba:[K,[W,W,W,W],$t],has:{type:H,overloads:[[[X],function(t,e){return qt(e[0].evaluate(t),t.properties())}],[[X,Y],function(t,e){var r=e[0],i=e[1];return qt(r.evaluate(t),i.evaluate(t))}]]},get:{type:J,overloads:[[[X],function(t,e){return Zt(e[0].evaluate(t),t.properties())}],[[X,Y],function(t,e){var r=e[0],i=e[1];return Zt(r.evaluate(t),i.evaluate(t))}]]},"feature-state":[J,[X],function(t,e){return Zt(e[0].evaluate(t),t.featureState||{})}],properties:[Y,[],function(t){return t.properties()}],"geometry-type":[X,[],function(t){return t.geometryType()}],id:[J,[],function(t){return t.id()}],zoom:[W,[],function(t){return t.globals.zoom}],"heatmap-density":[W,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[W,[],function(t){return t.globals.lineProgress||0}],"+":[W,Kt(W),function(t,e){for(var r=0,i=0,n=e;i":[H,[X,J],function(t,e){var r=e[0],i=e[1],n=t.properties()[r.value],o=i.value;return typeof n==typeof o&&n>o}],"filter-id->":[H,[J],function(t,e){var r=e[0],i=t.id(),n=r.value;return typeof i==typeof n&&i>n}],"filter-<=":[H,[X,J],function(t,e){var r=e[0],i=e[1],n=t.properties()[r.value],o=i.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[H,[J],function(t,e){var r=e[0],i=t.id(),n=r.value;return typeof i==typeof n&&i<=n}],"filter->=":[H,[X,J],function(t,e){var r=e[0],i=e[1],n=t.properties()[r.value],o=i.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[H,[J],function(t,e){var r=e[0],i=t.id(),n=r.value;return typeof i==typeof n&&i>=n}],"filter-has":[H,[J],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[H,[],function(t){return null!==t.id()}],"filter-type-in":[H,[tt(X)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[H,[tt(J)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[H,[X,tt(J)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[H,[X,tt(J)],function(t,e){var r=e[0],i=e[1];return function(t,e,r,i){for(;r<=i;){var n=r+i>>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}(t.properties()[r.value],i.value,0,i.value.length-1)}],">":{type:H,overloads:[[[W,W],Wt],[[X,X],Wt],[[X,X,Q],function(t,e){var r=e[0],i=e[1];return e[2].evaluate(t).compare(r.evaluate(t),i.evaluate(t))>0}]]},"<":{type:H,overloads:[[[W,W],Gt],[[X,X],Gt],[[X,X,Q],function(t,e){var r=e[0],i=e[1];return e[2].evaluate(t).compare(r.evaluate(t),i.evaluate(t))<0}]]},">=":{type:H,overloads:[[[W,W],Ht],[[X,X],Ht],[[X,X,Q],function(t,e){var r=e[0],i=e[1];return e[2].evaluate(t).compare(r.evaluate(t),i.evaluate(t))>=0}]]},"<=":{type:H,overloads:[[[W,W],Xt],[[X,X],Xt],[[X,X,Q],function(t,e){var r=e[0],i=e[1];return e[2].evaluate(t).compare(r.evaluate(t),i.evaluate(t))<=0}]]},all:{type:H,overloads:[[[H,H],function(t,e){var r=e[0],i=e[1];return r.evaluate(t)&&i.evaluate(t)}],[Kt(H),function(t,e){for(var r=0,i=e;rle?Math.pow(t,1/3):t/se+oe}function pe(t){return t>ae?t*t*t:se*(t-oe)}function fe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function de(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function me(t){var e=de(t.r),r=de(t.g),i=de(t.b),n=he((.4124564*e+.3575761*r+.1804375*i)/re),o=he((.2126729*e+.7151522*r+.072175*i)/ie);return{l:116*o-16,a:500*(n-o),b:200*(o-he((.0193339*e+.119192*r+.9503041*i)/ne)),alpha:t.a}}function ye(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,i=isNaN(t.b)?e:e-t.b/200;return e=ie*pe(e),r=re*pe(r),i=ne*pe(i),new ot(fe(3.2404542*r-1.5371385*e-.4985314*i),fe(-.969266*r+1.8760108*e+.041556*i),fe(.0556434*r-.2040259*e+1.0572252*i),t.alpha)}var ve={forward:me,reverse:ye,interpolate:function(t,e,r){return{l:It(t.l,e.l,r),a:It(t.a,e.a,r),b:It(t.b,e.b,r),alpha:It(t.alpha,e.alpha,r)}}},ge={forward:function(t){var e=me(t),r=e.l,i=e.a,n=e.b,o=Math.atan2(n,i)*ce;return{h:o<0?o+360:o,c:Math.sqrt(i*i+n*n),l:r,alpha:t.a}},reverse:function(t){var e=t.h*ue,r=t.c;return ye({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:function(t,e,r){var i=e-t;return t+r*(i>180||i<-180?i-360*Math.round(i/360):i)}(t.h,e.h,r),c:It(t.c,e.c,r),l:It(t.l,e.l,r),alpha:It(t.alpha,e.alpha,r)}}},_e=Object.freeze({lab:ve,hcl:ge});function xe(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function be(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function we(t){return t}function Ee(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Se(t,e,r,i,n){return Ee(typeof r===n?i[r]:void 0,t.default,e.default)}function Te(t,e,r){if("number"!==xe(r))return Ee(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var n=Ie(t.stops,r);return t.stops[n][1]}function Ae(t,e,r){var i=void 0!==t.base?t.base:1;if("number"!==xe(r))return Ee(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var o=Ie(t.stops,r),a=function(t,e,r,i){var n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(r,i,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Mt[e.type]||we;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=_e[t.colorSpace];u=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==i)return u(r,i,a)}}:u(s,l,a)}function ze(t,e,r){return"color"===e.type?r=ot.parse(r):xe(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Ee(r,t.default,e.default)}function Ie(t,e){for(var r,i,n=0,o=t.length-1,a=0;n<=o;){if(r=t[a=Math.floor((n+o)/2)][0],i=t[a+1][0],e===r||e>r&&ee&&(o=a-1)}return Math.max(a-1,0)}var Me=function(t,e){var r;this.expression=t,this._warningHistory={},this._defaultValue="color"===(r=e).type&&be(r.default)?new ot(0,0,0,0):"color"===r.type?ot.parse(r.default)||null:void 0===r.default?null:r.default,"enum"===e.type&&(this._enumValues=e.values)};function ke(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Ut}function Ce(t,e){var r=new Tt(Ut,[],function(t){var e={color:K,string:X,number:W,enum:X,boolean:H};return"array"===t.type?tt(e[t.value]||J,t.length):e[t.type]||null}(e)),i=r.parse(t);return i?Yt(new Me(i,e)):Jt(r.errors)}Me.prototype.evaluateWithoutErrorHandling=function(t,e,r){return this._evaluator||(this._evaluator=new _t),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this.expression.evaluate(this._evaluator)},Me.prototype.evaluate=function(t,e,r){this._evaluator||(this._evaluator=new _t),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r;try{var i=this.expression.evaluate(this._evaluator);if(null==i)return this._defaultValue;if(this._enumValues&&!(i in this._enumValues))throw new ht("Expected value to be one of "+Object.keys(this._enumValues).map(function(t){return JSON.stringify(t)}).join(", ")+", but found "+JSON.stringify(i)+" instead.");return i}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Pe=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!wt(e.expression)};Pe.prototype.evaluateWithoutErrorHandling=function(t,e,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r)},Pe.prototype.evaluate=function(t,e,r){return this._styleExpression.evaluate(t,e,r)};var Le=function(t,e,r){this.kind=t,this.zoomStops=r.labels,this._styleExpression=e,this.isStateDependent="camera"!==t&&!wt(e.expression),r instanceof kt&&(this._interpolationType=r.interpolation)};function De(t,e){if("error"===(t=Ce(t,e)).result)return t;var r=t.value.expression,i=bt(r);if(!i&&!Qt(e))return Jt([new q("","data expressions not supported")]);var n=Et(r,["zoom"]);if(!n&&!te(e))return Jt([new q("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof Lt)r=t(e.result);else if(e instanceof Pt)for(var i=0,n=e.args;ii.maximum?[new V(e,r,r+" is greater than the maximum value "+i.maximum)]:[]}function Ne(t){var e,r,i,n=t.valueSpec,o=U(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,l=!s,u="array"===xe(t.value.stops)&&"array"===xe(t.value.stops[0])&&"object"===xe(t.value.stops[0][0]),c=Oe({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new V(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Fe({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===xe(r)&&0===r.length&&e.push(new V(t.key,r,"array must have at least one stop")),e},default:function(t){return sr({key:t.key,value:t.value,valueSpec:n,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&c.push(new V(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||c.push(new V(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!ee(t.valueSpec)&&c.push(new V(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Qt(t.valueSpec)?c.push(new V(t.key,t.value,"property functions not supported")):s&&!te(t.valueSpec)&&c.push(new V(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!u||void 0!==t.value.property||c.push(new V(t.key,t.value,'"property" property is required')),c;function h(t){var e=[],o=t.value,s=t.key;if("array"!==xe(o))return[new V(s,o,"array expected, "+xe(o)+" found")];if(2!==o.length)return[new V(s,o,"array length 2 expected, length "+o.length+" found")];if(u){if("object"!==xe(o[0]))return[new V(s,o,"object expected, "+xe(o[0])+" found")];if(void 0===o[0].zoom)return[new V(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new V(s,o,"object stop key must have value")];if(i&&i>U(o[0].zoom))return[new V(s,o[0].zoom,"stop zoom values must appear in ascending order")];U(o[0].zoom)!==i&&(i=U(o[0].zoom),r=void 0,a={}),e=e.concat(Oe({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Ve,value:p}}))}else e=e.concat(p({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return e.concat(sr({key:s+"[1]",value:o[1],valueSpec:n,style:t.style,styleSpec:t.styleSpec}))}function p(t,i){var s=xe(t.value),l=U(t.value),u=null!==t.value?t.value:i;if(e){if(s!==e)return[new V(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new V(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var c="number expected, "+s+" found";return Qt(n)&&void 0===o&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new V(t.key,u,c)]}return"categorical"!==o||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==o&&"number"===s&&void 0!==r&&l=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function We(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?Xe(t[1],t[2],"=="):"!="===r?Ye(Xe(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?Xe(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(We))):"all"===r?["all"].concat(t.slice(1).map(We)):"none"===r?["all"].concat(t.slice(1).map(We).map(Ye)):"in"===r?He(t[1],t.slice(2)):"!in"===r?Ye(He(t[1],t.slice(2))):"has"===r?Ke(t[1]):"!has"!==r||Ye(Ke(t[1]))}function Xe(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function He(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(Ge)]]:["filter-in-small",t,["literal",e]]}}function Ke(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ye(t){return["!",t]}function Je(t){return $e($(t.value))?je(j({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,i=e.key;if("array"!==xe(r))return[new V(i,r,"array expected, "+xe(r)+" found")];var n,o=e.styleSpec,a=[];if(r.length<1)return[new V(i,r,"filter array must have at least 1 element")];switch(a=a.concat(Ue({key:i+"[0]",value:r[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),U(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===U(r[1])&&a.push(new V(i,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new V(i,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(n=xe(r[1]))&&a.push(new V(i+"[1]",r[1],"string expected, "+n+" found"));for(var s=2;s=u[p+0]&&i>=u[p+1]?(a[h]=!0,o.push(l[h])):a[h]=!1}}},_r.prototype._forEachCell=function(t,e,r,i,n,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(i),h=s;h<=u;h++)for(var p=l;p<=c;p++){var f=this.d*p+h;if(n.call(this,t,e,r,i,f,o,a))return}},_r.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},_r.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=gr+this.cells.length+1+1,r=0,i=0;i=0)){var h=t[c];u[c]=br[l].shallow.indexOf(c)>=0?h:Sr(h,e)}t instanceof Error&&(u.message=t.message)}return{name:l,properties:u}}throw new Error("can't serialize object of type "+typeof t)}function Tr(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof xr)return t;if(Array.isArray(t))return t.map(function(t){return Tr(t)});if("object"==typeof t){var e=t,r=e.name,i=e.properties;if(!r)throw new Error("can't deserialize object of anonymous class");var n=br[r].klass;if(!n)throw new Error("can't deserialize unregistered class "+r);if(n.deserialize)return n.deserialize(i._serialized);for(var o=Object.create(n.prototype),a=0,s=Object.keys(i);a=0?i[l]:Tr(i[l])}return o}throw new Error("can't deserialize object of type "+typeof t)}var Ar=function(){this.first=!0};Ar.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Ir(t){for(var e=0,r=t;e=65097&&t<=65103)||zr["CJK Compatibility Ideographs"](t)||zr["CJK Compatibility"](t)||zr["CJK Radicals Supplement"](t)||zr["CJK Strokes"](t)||!(!zr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||zr["CJK Unified Ideographs Extension A"](t)||zr["CJK Unified Ideographs"](t)||zr["Enclosed CJK Letters and Months"](t)||zr["Hangul Compatibility Jamo"](t)||zr["Hangul Jamo Extended-A"](t)||zr["Hangul Jamo Extended-B"](t)||zr["Hangul Jamo"](t)||zr["Hangul Syllables"](t)||zr.Hiragana(t)||zr["Ideographic Description Characters"](t)||zr.Kanbun(t)||zr["Kangxi Radicals"](t)||zr["Katakana Phonetic Extensions"](t)||zr.Katakana(t)&&12540!==t||!(!zr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!zr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||zr["Unified Canadian Aboriginal Syllabics"](t)||zr["Unified Canadian Aboriginal Syllabics Extended"](t)||zr["Vertical Forms"](t)||zr["Yijing Hexagram Symbols"](t)||zr["Yi Syllables"](t)||zr["Yi Radicals"](t)))}function Cr(t){return!(kr(t)||function(t){return!!(zr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||zr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||zr["Letterlike Symbols"](t)||zr["Number Forms"](t)||zr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||zr["Control Pictures"](t)&&9251!==t||zr["Optical Character Recognition"](t)||zr["Enclosed Alphanumerics"](t)||zr["Geometric Shapes"](t)||zr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||zr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||zr["CJK Symbols and Punctuation"](t)||zr.Katakana(t)||zr["Private Use Area"](t)||zr["CJK Compatibility Forms"](t)||zr["Small Form Variants"](t)||zr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Pr(t,e){return!(!e&&(t>=1424&&t<=2303||zr["Arabic Presentation Forms-A"](t)||zr["Arabic Presentation Forms-B"](t))||t>=2304&&t<=3583||t>=3840&&t<=4255||zr.Khmer(t))}var Lr,Dr=!1,Rr=null,Br=!1,Or=new O,Fr={applyArabicShaping:null,processBidirectionalText:null,isLoaded:function(){return Br||null!=Fr.applyArabicShaping}},Vr=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ar,this.transition={})};Vr.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,i=t;rthis.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(e=1)return 1;var e=n*n,r=e*n;return 4*(n<.5?r:3*(n-e)+r-.75)}())}return r};var qr=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};qr.prototype.possiblyEvaluate=function(t){for(var e=new Wr(this._properties),r=0,i=Object.keys(this._values);ri.zoomHistory.lastIntegerZoom?{from:t,to:e,fromScale:2,toScale:1,t:o+(1-o)*a}:{from:r,to:e,fromScale:.5,toScale:1,t:1-(1-a)*o}},Kr.prototype.interpolate=function(t){return t};var Yr=function(t){this.specification=t};Yr.prototype.possiblyEvaluate=function(t,e){return!!t.expression.evaluate(e)},Yr.prototype.interpolate=function(){return!1};var Jr=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},t){var r=t[e],i=this.defaultPropertyValues[e]=new Nr(r,void 0),n=this.defaultTransitionablePropertyValues[e]=new jr(r);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}};wr("DataDrivenProperty",Hr),wr("DataConstantProperty",Xr),wr("CrossFadedProperty",Kr),wr("ColorRampProperty",Yr);var Qr=function(t){function e(e,r){for(var i in t.call(this),this.id=e.id,this.metadata=e.metadata,this.type=e.type,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,this.visibility="visible","background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),this._featureFilter=function(){return!0},r.layout&&(this._unevaluatedLayout=new Zr(r.layout)),this._transitionablePaint=new Ur(r.paint),e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(var n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){if(null!=e){var i="layers."+this.id+".layout."+t;if(this._validate(mr,i,t,e,r))return}"visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility="none"===e?e:"visible"},e.prototype.getPaintProperty=function(t){return b(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(null!=e){var i="layers."+this.id+".paint."+t;if(this._validate(dr,i,t,e,r))return!1}if(b(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t].value.isDataDriven();this._transitionablePaint.setValue(t,e);var o=this._transitionablePaint._values[t].value.isDataDriven();return this._handleSpecialPaintPropertyUpdate(t),o||n},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t)),this.paint=this._transitioningPaint.possiblyEvaluate(t)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return"none"===this.visibility&&(t.layout=t.layout||{},t.layout.visibility="none"),E(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._validate=function(t,e,r,i,n){return(!n||!1!==n.validate)&&yr(this,t.call(pr,{key:e,layerType:this.type,objectKey:r,value:i,styleSpec:F,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof Gr&&Qt(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(O),ti={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},ei=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},ri=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function ii(t,e){void 0===e&&(e=1);var r=0,i=0;return{members:t.map(function(t){var n,o=(n=t.type,ti[n].BYTES_PER_ELEMENT),a=r=ni(r,Math.max(e,o)),s=t.components||1;return i=Math.max(i,o),r+=o*s,{name:t.name,type:t.type,components:s,offset:a}}),size:ni(r,Math.max(i,e)),alignment:e}}function ni(t,e){return Math.ceil(t/e)*e}ri.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},ri.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},ri.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},ri.prototype.clear=function(){this.length=0},ri.prototype.resize=function(t){this.reserve(t),this.length=t},ri.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},ri.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var oi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var i=2*r;return this.int16[i+0]=t,this.int16[i+1]=e,r},e.prototype.emplace=function(t,e,r){var i=2*t;return this.int16[i+0]=e,this.int16[i+1]=r,t},e}(ri);oi.prototype.bytesPerElement=4,wr("StructArrayLayout2i4",oi);var ai=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i){var n=this.length;this.resize(n+1);var o=4*n;return this.int16[o+0]=t,this.int16[o+1]=e,this.int16[o+2]=r,this.int16[o+3]=i,n},e.prototype.emplace=function(t,e,r,i,n){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,t},e}(ri);ai.prototype.bytesPerElement=8,wr("StructArrayLayout4i8",ai);var si=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i,n,o){var a=this.length;this.resize(a+1);var s=6*a;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=n,this.int16[s+5]=o,a},e.prototype.emplace=function(t,e,r,i,n,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(ri);si.prototype.bytesPerElement=12,wr("StructArrayLayout2i4i12",si);var li=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i,n,o,a,s){var l=this.length;this.resize(l+1);var u=6*l,c=12*l;return this.int16[u+0]=t,this.int16[u+1]=e,this.int16[u+2]=r,this.int16[u+3]=i,this.uint8[c+8]=n,this.uint8[c+9]=o,this.uint8[c+10]=a,this.uint8[c+11]=s,l},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l){var u=6*t,c=12*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=i,this.int16[u+3]=n,this.uint8[c+8]=o,this.uint8[c+9]=a,this.uint8[c+10]=s,this.uint8[c+11]=l,t},e}(ri);li.prototype.bytesPerElement=12,wr("StructArrayLayout4i4ub12",li);var ui=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i,n,o,a,s){var l=this.length;this.resize(l+1);var u=8*l;return this.int16[u+0]=t,this.int16[u+1]=e,this.int16[u+2]=r,this.int16[u+3]=i,this.uint16[u+4]=n,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=s,l},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l){var u=8*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=i,this.int16[u+3]=n,this.uint16[u+4]=o,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,t},e}(ri);ui.prototype.bytesPerElement=16,wr("StructArrayLayout4i4ui16",ui);var ci=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var i=this.length;this.resize(i+1);var n=3*i;return this.float32[n+0]=t,this.float32[n+1]=e,this.float32[n+2]=r,i},e.prototype.emplace=function(t,e,r,i){var n=3*t;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t},e}(ri);ci.prototype.bytesPerElement=12,wr("StructArrayLayout3f12",ci);var hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.uint32[r+0]=t,e},e.prototype.emplace=function(t,e){var r=1*t;return this.uint32[r+0]=e,t},e}(ri);hi.prototype.bytesPerElement=4,wr("StructArrayLayout1ul4",hi);var pi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i,n,o,a,s,l,u,c){var h=this.length;this.resize(h+1);var p=12*h,f=6*h;return this.int16[p+0]=t,this.int16[p+1]=e,this.int16[p+2]=r,this.int16[p+3]=i,this.int16[p+4]=n,this.int16[p+5]=o,this.uint32[f+3]=a,this.uint16[p+8]=s,this.uint16[p+9]=l,this.int16[p+10]=u,this.int16[p+11]=c,h},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l,u,c,h){var p=12*t,f=6*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=i,this.int16[p+3]=n,this.int16[p+4]=o,this.int16[p+5]=a,this.uint32[f+3]=s,this.uint16[p+8]=l,this.uint16[p+9]=u,this.int16[p+10]=c,this.int16[p+11]=h,t},e}(ri);pi.prototype.bytesPerElement=24,wr("StructArrayLayout6i1ul2ui2i24",pi);var fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i,n,o){var a=this.length;this.resize(a+1);var s=6*a;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=n,this.int16[s+5]=o,a},e.prototype.emplace=function(t,e,r,i,n,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(ri);fi.prototype.bytesPerElement=12,wr("StructArrayLayout2i2i2i12",fi);var di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var i=4*r;return this.uint8[i+0]=t,this.uint8[i+1]=e,r},e.prototype.emplace=function(t,e,r){var i=4*t;return this.uint8[i+0]=e,this.uint8[i+1]=r,t},e}(ri);di.prototype.bytesPerElement=4,wr("StructArrayLayout2ub4",di);var mi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i,n,o,a,s,l,u,c,h,p,f){var d=this.length;this.resize(d+1);var m=20*d,y=10*d,v=40*d;return this.int16[m+0]=t,this.int16[m+1]=e,this.uint16[m+2]=r,this.uint16[m+3]=i,this.uint32[y+2]=n,this.uint32[y+3]=o,this.uint32[y+4]=a,this.uint16[m+10]=s,this.uint16[m+11]=l,this.uint16[m+12]=u,this.float32[y+7]=c,this.float32[y+8]=h,this.uint8[v+36]=p,this.uint8[v+37]=f,d},e.prototype.emplace=function(t,e,r,i,n,o,a,s,l,u,c,h,p,f,d){var m=20*t,y=10*t,v=40*t;return this.int16[m+0]=e,this.int16[m+1]=r,this.uint16[m+2]=i,this.uint16[m+3]=n,this.uint32[y+2]=o,this.uint32[y+3]=a,this.uint32[y+4]=s,this.uint16[m+10]=l,this.uint16[m+11]=u,this.uint16[m+12]=c,this.float32[y+7]=h,this.float32[y+8]=p,this.uint8[v+36]=f,this.uint8[v+37]=d,t},e}(ri);mi.prototype.bytesPerElement=40,wr("StructArrayLayout2i2ui3ul3ui2f2ub40",mi);var yi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.float32[r+0]=t,e},e.prototype.emplace=function(t,e){var r=1*t;return this.float32[r+0]=e,t},e}(ri);yi.prototype.bytesPerElement=4,wr("StructArrayLayout1f4",yi);var vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var i=this.length;this.resize(i+1);var n=3*i;return this.int16[n+0]=t,this.int16[n+1]=e,this.int16[n+2]=r,i},e.prototype.emplace=function(t,e,r,i){var n=3*t;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t},e}(ri);vi.prototype.bytesPerElement=6,wr("StructArrayLayout3i6",vi);var gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var i=this.length;this.resize(i+1);var n=2*i,o=4*i;return this.uint32[n+0]=t,this.uint16[o+2]=e,this.uint16[o+3]=r,i},e.prototype.emplace=function(t,e,r,i){var n=2*t,o=4*t;return this.uint32[n+0]=e,this.uint16[o+2]=r,this.uint16[o+3]=i,t},e}(ri);gi.prototype.bytesPerElement=8,wr("StructArrayLayout1ul2ui8",gi);var _i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var i=this.length;this.resize(i+1);var n=3*i;return this.uint16[n+0]=t,this.uint16[n+1]=e,this.uint16[n+2]=r,i},e.prototype.emplace=function(t,e,r,i){var n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t},e}(ri);_i.prototype.bytesPerElement=6,wr("StructArrayLayout3ui6",_i);var xi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var i=2*r;return this.uint16[i+0]=t,this.uint16[i+1]=e,r},e.prototype.emplace=function(t,e,r){var i=2*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,t},e}(ri);xi.prototype.bytesPerElement=4,wr("StructArrayLayout2ui4",xi);var bi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var i=2*r;return this.float32[i+0]=t,this.float32[i+1]=e,r},e.prototype.emplace=function(t,e,r){var i=2*t;return this.float32[i+0]=e,this.float32[i+1]=r,t},e}(ri);bi.prototype.bytesPerElement=8,wr("StructArrayLayout2f8",bi);var wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,i){var n=this.length;this.resize(n+1);var o=4*n;return this.float32[o+0]=t,this.float32[o+1]=e,this.float32[o+2]=r,this.float32[o+3]=i,n},e.prototype.emplace=function(t,e,r,i,n){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=i,this.float32[o+3]=n,t},e}(ri);wi.prototype.bytesPerElement=16,wr("StructArrayLayout4f16",wi);var Ei=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},radius:{configurable:!0},signedDistanceFromAnchor:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorPointY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.x1.set=function(t){this._structArray.int16[this._pos2+2]=t},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.y1.set=function(t){this._structArray.int16[this._pos2+3]=t},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.x2.set=function(t){this._structArray.int16[this._pos2+4]=t},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.y2.set=function(t){this._structArray.int16[this._pos2+5]=t},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},r.radius.get=function(){return this._structArray.int16[this._pos2+10]},r.radius.set=function(t){this._structArray.int16[this._pos2+10]=t},r.signedDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+11]},r.signedDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+11]=t},r.anchorPoint.get=function(){return new h(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(ei);Ei.prototype.size=24;var Si=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new Ei(this,t)},e}(pi);wr("CollisionBoxArray",Si);var Ti=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},hidden:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.glyphStartIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.numGlyphs.set=function(t){this._structArray.uint16[this._pos2+3]=t},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.vertexStartIndex.set=function(t){this._structArray.uint32[this._pos4+2]=t},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineStartIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.lineLength.set=function(t){this._structArray.uint32[this._pos4+4]=t},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.segment.set=function(t){this._structArray.uint16[this._pos2+10]=t},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.lowerSize.set=function(t){this._structArray.uint16[this._pos2+11]=t},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.upperSize.set=function(t){this._structArray.uint16[this._pos2+12]=t},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetX.set=function(t){this._structArray.float32[this._pos4+7]=t},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.lineOffsetY.set=function(t){this._structArray.float32[this._pos4+8]=t},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.writingMode.set=function(t){this._structArray.uint8[this._pos1+36]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+37]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+37]=t},Object.defineProperties(e.prototype,r),e}(ei);Ti.prototype.size=40;var Ai=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new Ti(this,t)},e}(mi);wr("PlacedSymbolArray",Ai);var zi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={offsetX:{configurable:!0}};return r.offsetX.get=function(){return this._structArray.float32[this._pos4+0]},r.offsetX.set=function(t){this._structArray.float32[this._pos4+0]=t},Object.defineProperties(e.prototype,r),e}(ei);zi.prototype.size=4;var Ii=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e.prototype.get=function(t){return new zi(this,t)},e}(yi);wr("GlyphOffsetArray",Ii);var Mi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={x:{configurable:!0},y:{configurable:!0},tileUnitDistanceFromAnchor:{configurable:!0}};return r.x.get=function(){return this._structArray.int16[this._pos2+0]},r.x.set=function(t){this._structArray.int16[this._pos2+0]=t},r.y.get=function(){return this._structArray.int16[this._pos2+1]},r.y.set=function(t){this._structArray.int16[this._pos2+1]=t},r.tileUnitDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+2]},r.tileUnitDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+2]=t},Object.defineProperties(e.prototype,r),e}(ei);Mi.prototype.size=6;var ki=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e.prototype.get=function(t){return new Mi(this,t)},e}(vi);wr("SymbolLineVertexArray",ki);var Ci=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+0]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+3]=t},Object.defineProperties(e.prototype,r),e}(ei);Ci.prototype.size=8;var Pi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new Ci(this,t)},e}(gi);wr("FeatureIndexArray",Pi);var Li=ii([{name:"a_pos",components:2,type:"Int16"}],4).members,Di=function(t){void 0===t&&(t=[]),this.segments=t};Di.prototype.prepareSegment=function(t,e,r){var i=this.segments[this.segments.length-1];return t>Di.MAX_VERTEX_ARRAY_LENGTH&&A("Max vertices per segment is "+Di.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>Di.MAX_VERTEX_ARRAY_LENGTH)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},this.segments.push(i)),i},Di.prototype.get=function(){return this.segments},Di.prototype.destroy=function(){for(var t=0,e=this.segments;tqi.max||a.yqi.max)&&A("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Gi(t,e,r,i,n){t.emplaceBack(2*e+(i+1)/2,2*r+(n+1)/2)}var Wi=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new oi,this.indexArray=new _i,this.segments=new Di,this.programConfigurations=new ji(Li,t.layers,t.zoom)};function Xi(t,e,r){for(var i=0;i=3)for(var s=0;s1){if(Ji(t,e))return!0;for(var i=0;i1?t.distSqr(r):t.distSqr(r.sub(e)._mult(n)._add(e))}function rn(t,e){for(var r,i,n,o=!1,a=0;ae.y!=n.y>e.y&&e.x<(n.x-i.x)*(e.y-i.y)/(n.y-i.y)+i.x&&(o=!o);return o}function nn(t,e){for(var r=!1,i=0,n=t.length-1;ie.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function on(t,e,r){var i=e.paint.get(t).value;return"constant"===i.kind?i.value:r.programConfigurations.get(e.id).binders[t].statistics.max}function an(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function sn(t,e,r,i,n){if(!e[0]&&!e[1])return t;var o=h.convert(e);"viewport"===r&&o._rotate(-i);for(var a=[],s=0;s=$i||u<0||u>=$i)){var c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),h=c.vertexLength;Gi(this.layoutVertexArray,l,u,-1,-1),Gi(this.layoutVertexArray,l,u,1,-1),Gi(this.layoutVertexArray,l,u,1,1),Gi(this.layoutVertexArray,l,u,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),c.vertexLength+=4,c.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r)},wr("CircleBucket",Wi,{omit:["layers"]});var ln={paint:new Jr({"circle-radius":new Hr(F.paint_circle["circle-radius"]),"circle-color":new Hr(F.paint_circle["circle-color"]),"circle-blur":new Hr(F.paint_circle["circle-blur"]),"circle-opacity":new Hr(F.paint_circle["circle-opacity"]),"circle-translate":new Xr(F.paint_circle["circle-translate"]),"circle-translate-anchor":new Xr(F.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Xr(F.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Xr(F.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Hr(F.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Hr(F.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Hr(F.paint_circle["circle-stroke-opacity"])})},un="undefined"!=typeof Float32Array?Float32Array:Array;function cn(){var t=new un(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function hn(){var t=new un(3);return t[0]=0,t[1]=0,t[2]=0,t}function pn(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function fn(t,e,r){var i=new un(3);return i[0]=t,i[1]=e,i[2]=r,i}Math.PI;var dn,mn=pn,yn=(dn=hn(),function(t,e,r,i,n,o){var a,s;for(e||(e=3),r||(r=0),s=i?Math.min(i*e+r,t.length):t.length,a=r;a0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=i*a,t[2]=n*a,t[3]=o*a),t}function _n(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*a,t[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*a,t[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*a,t[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*a,t}var xn=function(){var t=vn();return function(e,r,i,n,o,a){var s,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,s=i;st.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l80*r){i=o=t[0],n=a=t[1];for(var d=r;do&&(o=s),l>a&&(a=l);u=0!==(u=Math.max(o-i,a-n))?1/u:0}return jn(p,f,r,i,n,u),f}function Vn(t,e,r,i,n){var o,a;if(n===ao(t,e,r,i)>0)for(o=e;o=e;o-=i)a=io(o,t[o],t[o+1],a);return a&&Qn(a,a.next)&&(no(a),a=a.next),a}function Nn(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!Qn(i,i.next)&&0!==Jn(i.prev,i,i.next))i=i.next;else{if(no(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function jn(t,e,r,i,n,o,a){if(t){!a&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=Xn(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,i=r,s=0,e=0;e0||l>0&&i;)0!==s&&(0===l||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,l--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,u*=2}while(a>1)}(n)}(t,i,n,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?$n(t,i,n,o):Un(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),no(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?jn(t=qn(t,e,r),e,r,i,n,o,2):2===a&&Zn(t,e,r,i,n,o):jn(Nn(t),e,r,i,n,o,1);break}}}function Un(t){var e=t.prev,r=t,i=t.next;if(Jn(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Kn(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&Jn(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function $n(t,e,r,i){var n=t.prev,o=t,a=t.next;if(Jn(n,o,a)>=0)return!1;for(var s=n.xo.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,c=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,h=Xn(s,l,e,r,i),p=Xn(u,c,e,r,i),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=p;){if(f!==t.prev&&f!==t.next&&Kn(n.x,n.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Jn(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,d!==t.prev&&d!==t.next&&Kn(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Jn(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&Kn(n.x,n.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Jn(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&Kn(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Jn(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function qn(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!Qn(n,o)&&to(n,i,i.next,o)&&eo(n,o)&&eo(o,n)&&(e.push(n.i/r),e.push(i.i/r),e.push(o.i/r),no(i),no(i.next),i=t=o),i=i.next}while(i!==t);return i}function Zn(t,e,r,i,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Yn(a,s)){var l=ro(a,s);return a=Nn(a,a.next),l=Nn(l,l.next),jn(a,e,r,i,n,o),void jn(l,e,r,i,n,o)}s=s.next}a=a.next}while(a!==t)}function Gn(t,e){return t.x-e.x}function Wn(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x=i.x&&i.x>=c&&n!==i.x&&Kn(or.x)&&eo(i,t)&&(r=i,p=l),i=i.next;return r}(t,e)){var r=ro(e,t);Nn(r,r.next)}}function Xn(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Hn(t){var e=t,r=t;do{e.x=0&&(t-a)*(i-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function Yn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&to(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&eo(t,e)&&eo(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)}function Jn(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Qn(t,e){return t.x===e.x&&t.y===e.y}function to(t,e,r,i){return!!(Qn(t,e)&&Qn(r,i)||Qn(t,i)&&Qn(r,e))||Jn(t,e,r)>0!=Jn(t,e,i)>0&&Jn(r,i,t)>0!=Jn(r,i,e)>0}function eo(t,e){return Jn(t.prev,t,t.next)<0?Jn(t,e,t.next)>=0&&Jn(t,t.prev,e)>=0:Jn(t,e,t.prev)<0||Jn(t,t.next,e)<0}function ro(t,e){var r=new oo(t.i,t.x,t.y),i=new oo(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function io(t,e,r,i){var n=new oo(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function no(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function oo(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ao(t,e,r,i){for(var n=0,o=e,a=r-i;o0&&(i+=t[n-1].length,r.holes.push(i))}return r},Bn.default=On;var so=uo,lo=uo;function uo(t,e,r,i,n){!function t(e,r,i,n,o){for(;n>i;){if(n-i>600){var a=n-i+1,s=r-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(i,Math.floor(r-s*u/a+c)),Math.min(n,Math.floor(r+(a-s)*u/a+c)),o)}var h=e[r],p=i,f=n;for(co(e,i,r),o(e[n],h)>0&&co(e,i,n);p0;)f--}0===o(e[i],h)?co(e,i,f):co(e,++f,n),f<=r&&(i=f+1),r<=f&&(n=f-1)}}(t,e,r||0,i||t.length-1,n||ho)}function co(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function ho(t,e){return te?1:0}function po(t,e){var r=t.length;if(r<=1)return[t];for(var i,n,o=[],a=0;a1)for(var l=0;l$i)||t.y===e.y&&(t.y<0||t.y>$i)}function Eo(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>$i})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>$i})}bo.prototype.populate=function(t,e){for(var r=0,i=t;r=1){var y=p[d-1];if(!wo(m,y)){u.vertexLength+4>Di.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var v=m.sub(y)._perp()._unit(),g=y.dist(m);f+g>32768&&(f=0),xo(this.layoutVertexArray,m.x,m.y,v.x,v.y,0,0,f),xo(this.layoutVertexArray,m.x,m.y,v.x,v.y,0,1,f),f+=g,xo(this.layoutVertexArray,y.x,y.y,v.x,v.y,0,0,f),xo(this.layoutVertexArray,y.x,y.y,v.x,v.y,0,1,f);var _=u.vertexLength;this.indexArray.emplaceBack(_,_+1,_+2),this.indexArray.emplaceBack(_+1,_+2,_+3),u.vertexLength+=4,u.primitiveLength+=2}}}}u.vertexLength+a>Di.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(a,this.layoutVertexArray,this.indexArray));for(var x=[],b=[],w=u.vertexLength,E=0,S=o;E>3}if(n--,1===i||2===i)o+=t.readSVarint(),a+=t.readSVarint(),1===i&&(e&&s.push(e),e=[]),e.push(new h(o,a));else{if(7!==i)throw new Error("unknown command "+i);e&&e.push(e[0].clone())}}return e&&s.push(e),s},Io.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos>3}if(i--,1===r||2===r)(n+=t.readSVarint())s&&(s=n),(o+=t.readSVarint())u&&(u=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,s,u]},Io.prototype.toGeoJSON=function(t,e,r){var i,n,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=Io.types[this.type];function c(t){for(var e=0;e>3;e=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return e}(r))}function Do(t,e,r){if(3===t){var i=new Co(r,r.readVarint()+r.pos);i.length&&(e[i.name]=i)}}Po.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new zo(this._pbf,e,this.extent,this._keys,this._values)};var Ro={VectorTile:function(t,e){this.layers=t.readFields(Do,{},e)},VectorTileFeature:zo,VectorTileLayer:Co},Bo=Ro.VectorTileFeature.types,Oo=63,Fo=Math.cos(Math.PI/180*37.5),Vo=.5,No=Math.pow(2,14)/Vo;function jo(t,e,r,i,n,o,a){t.emplaceBack(e.x,e.y,i?1:0,n?1:-1,Math.round(Oo*r.x)+128,Math.round(Oo*r.y)+128,1+(0===o?0:o<0?-1:1)|(a*Vo&63)<<2,a*Vo>>6)}var Uo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new li,this.indexArray=new _i,this.programConfigurations=new ji(Ao,t.layers,t.zoom),this.segments=new Di};function $o(t,e){return(t/e.tileTotal*(e.end-e.start)+e.start)*(No-1)}Uo.prototype.populate=function(t,e){for(var r=0,i=t;r=2&&t[u-1].equals(t[u-2]);)u--;for(var c=0;cc){var M=d.dist(x);if(M>2*h){var k=d.sub(d.sub(x)._mult(h/M)._round());this.distance+=k.dist(x),this.addCurrentVertex(k,this.distance,w.mult(1),0,0,!1,f,s),x=k}}var C=x&&b,P=C?r:b?v:g;if(C&&"round"===P&&(zn&&(P="bevel"),"bevel"===P&&(z>2&&(P="flipbevel"),z100)T=E.clone().mult(-1);else{var L=w.x*E.y-w.y*E.x>0?-1:1,D=z*w.add(E).mag()/w.sub(E).mag();T._perp()._mult(D*L)}this.addCurrentVertex(d,this.distance,T,0,0,!1,f,s),this.addCurrentVertex(d,this.distance,T.mult(-1),0,0,!1,f,s)}else if("bevel"===P||"fakeround"===P){var R=w.x*E.y-w.y*E.x>0,B=-Math.sqrt(z*z-1);if(R?(y=0,m=B):(m=0,y=B),_||this.addCurrentVertex(d,this.distance,w,m,y,!1,f,s),"fakeround"===P){for(var O=Math.floor(8*(.5-(A-.5))),F=void 0,V=0;V=0;N--)F=w.mult((N+1)/(O+1))._add(E)._unit(),this.addPieSliceVertex(d,this.distance,F,R,f,s)}b&&this.addCurrentVertex(d,this.distance,E,-m,-y,!1,f,s)}else"butt"===P?(_||this.addCurrentVertex(d,this.distance,w,0,0,!1,f,s),b&&this.addCurrentVertex(d,this.distance,E,0,0,!1,f,s)):"square"===P?(_||(this.addCurrentVertex(d,this.distance,w,1,1,!1,f,s),this.e1=this.e2=-1),b&&this.addCurrentVertex(d,this.distance,E,-1,-1,!1,f,s)):"round"===P&&(_||(this.addCurrentVertex(d,this.distance,w,0,0,!1,f,s),this.addCurrentVertex(d,this.distance,w,1,1,!0,f,s),this.e1=this.e2=-1),b&&(this.addCurrentVertex(d,this.distance,E,-1,-1,!0,f,s),this.addCurrentVertex(d,this.distance,E,0,0,!1,f,s)));if(I&&S2*h){var U=d.add(b.sub(d)._mult(h/j)._round());this.distance+=U.dist(d),this.addCurrentVertex(U,this.distance,E.mult(1),0,0,!1,f,s),d=U}}_=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a)}},Uo.prototype.addCurrentVertex=function(t,e,r,i,n,o,a,s){var l,u=this.layoutVertexArray,c=this.indexArray;s&&(e=$o(e,s)),l=r.clone(),i&&l._sub(r.perp()._mult(i)),jo(u,t,l,o,!1,i,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,l=r.mult(-1),n&&l._sub(r.perp()._mult(n)),jo(u,t,l,o,!0,-n,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,e>No/2&&!s&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,i,n,o,a))},Uo.prototype.addPieSliceVertex=function(t,e,r,i,n,o){r=r.mult(i?-1:1);var a=this.layoutVertexArray,s=this.indexArray;o&&(e=$o(e,o)),jo(a,t,r,!1,i,0,e),this.e3=n.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),n.primitiveLength++),i?this.e2=this.e3:this.e1=this.e3},wr("LineBucket",Uo,{omit:["layers"]});var qo=new Jr({"line-cap":new Xr(F.layout_line["line-cap"]),"line-join":new Hr(F.layout_line["line-join"]),"line-miter-limit":new Xr(F.layout_line["line-miter-limit"]),"line-round-limit":new Xr(F.layout_line["line-round-limit"])}),Zo={paint:new Jr({"line-opacity":new Hr(F.paint_line["line-opacity"]),"line-color":new Hr(F.paint_line["line-color"]),"line-translate":new Xr(F.paint_line["line-translate"]),"line-translate-anchor":new Xr(F.paint_line["line-translate-anchor"]),"line-width":new Hr(F.paint_line["line-width"]),"line-gap-width":new Hr(F.paint_line["line-gap-width"]),"line-offset":new Hr(F.paint_line["line-offset"]),"line-blur":new Hr(F.paint_line["line-blur"]),"line-dasharray":new Kr(F.paint_line["line-dasharray"]),"line-pattern":new Kr(F.paint_line["line-pattern"]),"line-gradient":new Yr(F.paint_line["line-gradient"])}),layout:qo},Go=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new Vr(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,i,n){return r=v({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,i,n)},e}(Hr))(Zo.paint.properties["line-width"].specification);Go.useIntegerZoom=!0;var Wo=function(t){function e(e){t.call(this,e,Zo)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=Cn(t,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=Go.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Uo(t)},e.prototype.queryRadius=function(t){var e=t,r=Xo(on("line-width",this,e),on("line-gap-width",this,e)),i=on("line-offset",this,e);return r/2+Math.abs(i)+an(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,i,n,o,a){var s=sn(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,a),l=a/2*Xo(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(i=function(t,e){for(var r=[],i=new h(0,0),n=0;n0?e+2*t:t}var Ho=ii([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),Ko=ii([{name:"a_projected_pos",components:3,type:"Float32"}],4),Yo=(ii([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ii([{name:"a_placed",components:2,type:"Uint8"}],4)),Jo=(ii([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Qo=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function ta(t,e,r){var i=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?t=t.toLocaleUpperCase():"lowercase"===i&&(t=t.toLocaleLowerCase()),Fr.applyArabicShaping&&(t=Fr.applyArabicShaping(t)),t}ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"hidden"}]),ii([{type:"Float32",name:"offsetX"}]),ii([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var ea={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},ra=function(t){function e(e,r,i,n){t.call(this,e,r),this.angle=i,void 0!==n&&(this.segment=n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(h);function ia(t,e){var r=e.expression;if("constant"===r.kind)return{functionType:"constant",layoutSize:r.evaluate(new Vr(t+1))};if("source"===r.kind)return{functionType:"source"};for(var i=r.zoomStops,n=0;n0)&&("constant"!==n.value.kind||n.value.value.length>0),l="constant"!==a.value.kind||a.value.value&&a.value.value.length>0;if(this.features=[],s||l){for(var u=e.iconDependencies,c=e.glyphDependencies,h=new Vr(this.zoom),p=0,f=t;p=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(var l=0;l0;this.addCollisionDebugVertices(s,l,u,c,h?this.collisionCircle:this.collisionBox,a.anchorPoint,r,h)}}}},ca.prototype.deserializeCollisionBoxes=function(t,e,r,i,n){for(var o={},a=e;a0},ca.prototype.hasIconData=function(){return this.icon.segments.get().length>0},ca.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},ca.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},ca.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&(this.sortedAngle=t,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var r=[],i=0;in.maxh||t>n.maxw||r<=n.maxh&&t<=n.maxw&&(a=n.maxw*n.maxh-t*r)o.free)){if(r===o.h)return this.allocShelf(s,t,r,i);r>o.h||rc)&&(h=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r,i)):null},t.prototype.allocFreebin=function(t,e,r,i){var n=this.freebins.splice(t,1)[0];return n.id=i,n.w=e,n.h=r,n.refcount=0,this.bins[i]=n,this.ref(n),n},t.prototype.allocShelf=function(t,e,r,i){var n=this.shelves[t].alloc(e,r,i);return this.bins[i]=n,this.ref(n),n},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,r=0;rthis.free||e>this.h)return null;var i=this.x;return this.x+=t,this.free-=t,new function(t,e,r,i,n,o,a){this.id=t,this.x=e,this.y=r,this.w=i,this.h=n,this.maxw=o||i,this.maxh=a||n,this.refcount=0}(r,i,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}()}),_a=function(t,e){var r=e.pixelRatio;this.paddedRect=t,this.pixelRatio=r},xa={tl:{configurable:!0},br:{configurable:!0},displaySize:{configurable:!0}};xa.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},xa.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},xa.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(_a.prototype,xa);var ba=function(t){var e=new Mn({width:0,height:0}),r={},i=new ga(0,0,{autoResize:!0});for(var n in t){var o=t[n],a=i.packOne(o.data.width+2,o.data.height+2);e.resize({width:i.w,height:i.h}),Mn.copy(o.data,e,{x:0,y:0},{x:a.x+1,y:a.y+1},o.data),r[n]=new _a(a,o)}i.shrink(),e.resize({width:i.w,height:i.h}),this.image=e,this.positions=r};wr("ImagePosition",_a),wr("ImageAtlas",ba);var wa=self.HTMLImageElement,Ea=self.HTMLCanvasElement,Sa=self.HTMLVideoElement,Ta=self.ImageData,Aa=function(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,i)};Aa.prototype.update=function(t,e){var r=t.width,i=t.height,n=!this.size||this.size[0]!==r||this.size[1]!==i,o=this.context,a=o.gl;this.useMipmap=Boolean(e&&e.useMipmap),a.bindTexture(a.TEXTURE_2D,this.texture),n?(this.size=[r,i],o.pixelStoreUnpack.set(1),this.format!==a.RGBA||e&&!1===e.premultiply||o.pixelStoreUnpackPremultiplyAlpha.set(!0),t instanceof wa||t instanceof Ea||t instanceof Sa||t instanceof Ta?a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,a.UNSIGNED_BYTE,t):a.texImage2D(a.TEXTURE_2D,0,this.format,r,i,0,this.format,a.UNSIGNED_BYTE,t.data)):t instanceof wa||t instanceof Ea||t instanceof Sa||t instanceof Ta?a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,t):a.texSubImage2D(a.TEXTURE_2D,0,0,0,r,i,a.RGBA,a.UNSIGNED_BYTE,t.data),this.useMipmap&&this.isSizePowerOfTwo()&&a.generateMipmap(a.TEXTURE_2D)},Aa.prototype.bind=function(t,e,r){var i=this.context.gl;i.bindTexture(i.TEXTURE_2D,this.texture),r!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=i.LINEAR),t!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,e),this.wrap=e)},Aa.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},Aa.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var za=function(t,e,r,i,n){var o,a,s=8*n-i-1,l=(1<>1,c=-7,h=r?n-1:0,p=r?-1:1,f=t[e+h];for(h+=p,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=i;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),o-=u}return(f?-1:1)*a*Math.pow(2,o-i)},Ia=function(t,e,r,i,n,o){var a,s,l,u=8*o-n-1,c=(1<>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,d=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,n),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;t[r+f]=255&s,f+=d,s/=256,n-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*m},Ma=ka;function ka(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}function Ca(t){return t.type===ka.Bytes?t.readVarint()+t.pos:t.pos+1}function Pa(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function La(t,e,r){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(i);for(var n=r.pos-1;n>=t;n--)r.buf[n+i]=r.buf[n]}function Da(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Za(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}ka.Varint=0,ka.Fixed64=1,ka.Bytes=2,ka.Fixed32=5,ka.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&i,t(n,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=$a(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Za(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=$a(this.buf,this.pos)+4294967296*$a(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=$a(this.buf,this.pos)+4294967296*Za(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=za(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=za(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,i=this.buf;return e=127&(r=i[this.pos++]),r<128?e:(e|=(127&(r=i[this.pos++]))<<7,r<128?e:(e|=(127&(r=i[this.pos++]))<<14,r<128?e:(e|=(127&(r=i[this.pos++]))<<21,r<128?e:function(t,e,r){var i,n,o=r.buf;if(i=(112&(n=o[r.pos++]))>>4,n<128)return Pa(t,i,e);if(i|=(127&(n=o[r.pos++]))<<3,n<128)return Pa(t,i,e);if(i|=(127&(n=o[r.pos++]))<<10,n<128)return Pa(t,i,e);if(i|=(127&(n=o[r.pos++]))<<17,n<128)return Pa(t,i,e);if(i|=(127&(n=o[r.pos++]))<<24,n<128)return Pa(t,i,e);if(i|=(1&(n=o[r.pos++]))<<31,n<128)return Pa(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,r){for(var i="",n=e;n239?4:l>223?3:l>191?2:1;if(n+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(o=t[n+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,i+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),i+=String.fromCharCode(u),n+=c}return i}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=Ca(this);for(t=t||[];this.pos127;);else if(e===ka.Bytes)this.pos=this.readVarint()+this.pos;else if(e===ka.Fixed32)this.pos+=4;else{if(e!==ka.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var i,n,o=0;o55295&&i<57344){if(!n){i>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):n=i;continue}if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,n=i;continue}i=n-55296<<10|i-56320|65536,n=null}else n&&(t[r++]=239,t[r++]=191,t[r++]=189,n=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=63&i|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&La(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Ia(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ia(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&La(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,e,r){this.writeTag(t,ka.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,Da,e)},writePackedSVarint:function(t,e){this.writeMessage(t,Ra,e)},writePackedBoolean:function(t,e){this.writeMessage(t,Fa,e)},writePackedFloat:function(t,e){this.writeMessage(t,Ba,e)},writePackedDouble:function(t,e){this.writeMessage(t,Oa,e)},writePackedFixed32:function(t,e){this.writeMessage(t,Va,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,Na,e)},writePackedFixed64:function(t,e){this.writeMessage(t,ja,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,Ua,e)},writeBytesField:function(t,e){this.writeTag(t,ka.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,ka.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,ka.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,ka.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,ka.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,ka.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,ka.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,ka.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,ka.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,ka.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Ga=3;function Wa(t,e,r){1===t&&r.readMessage(Xa,e)}function Xa(t,e,r){if(3===t){var i=r.readMessage(Ha,{}),n=i.id,o=i.bitmap,a=i.width,s=i.height,l=i.left,u=i.top,c=i.advance;e.push({id:n,bitmap:new In({width:a+2*Ga,height:s+2*Ga},o),metrics:{width:a,height:s,left:l,top:u,advance:c}})}}function Ha(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}var Ka=Ga,Ya=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.callbackID=0,x(["receive"],this),this.target.addEventListener("message",this.receive,!1)};Ya.prototype.send=function(t,e,r,i){var n=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[n]=r);var o=[];this.target.postMessage({targetMapId:i,sourceMapId:this.mapId,type:t,id:String(n),data:Sr(e,o)},o)},Ya.prototype.receive=function(t){var e,r=this,i=t.data,n=i.id;if(!i.targetMapId||this.mapId===i.targetMapId){var o=function(t,e){var i=[];r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(n),error:t?Sr(t):null,data:Sr(e,i)},i)};if(""===i.type)e=this.callbacks[i.id],delete this.callbacks[i.id],e&&i.error?e(Tr(i.error)):e&&e(null,Tr(i.data));else if(void 0!==i.id&&this.parent[i.type])this.parent[i.type](i.sourceMapId,Tr(i.data),o);else if(void 0!==i.id&&this.parent.getWorkerSource){var a=i.type.split("."),s=Tr(i.data);this.parent.getWorkerSource(i.sourceMapId,a[0],s.source)[a[1]](s,o)}else this.parent[i.type](Tr(i.data))}},Ya.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)};var Ja=r(function(t,e){!function(t){function e(t,e,i){var n=r(256*t,256*(e=Math.pow(2,i)-e-1),i),o=r(256*(t+1),256*(e+1),i);return n[0]+","+n[1]+","+o[0]+","+o[1]}function r(t,e,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[t*i-2*Math.PI*6378137/2,e*i-2*Math.PI*6378137/2]}t.getURL=function(t,r,i,n,o,a){return a=a||{},t+"?"+["bbox="+e(i,n,o),"format="+(a.format||"image/png"),"service="+(a.service||"WMS"),"version="+(a.version||"1.1.1"),"request="+(a.request||"GetMap"),"srs="+(a.srs||"EPSG:3857"),"width="+(a.width||256),"height="+(a.height||256),"layers="+r].join("&")},t.getTileBBox=e,t.getMercCoords=r,Object.defineProperty(t,"__esModule",{value:!0})}(e)});e(Ja);var Qa=Ja.getTileBBox,ts=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=is(0,t,e,r)};ts.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},ts.prototype.url=function(t,e){var r=Qa(this.x,this.y,this.z),i=function(t,e,r){for(var i,n="",o=t;o>0;o--)n+=(e&(i=1<this.canonical.z?new rs(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new rs(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},rs.prototype.isChildOf=function(t){var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},rs.prototype.children=function(t){if(this.overscaledZ>=t)return[new rs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new rs(e,this.wrap,e,r,i),new rs(e,this.wrap,e,r+1,i),new rs(e,this.wrap,e,r,i+1),new rs(e,this.wrap,e,r+1,i+1)]},rs.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+this.border||e<-this.border||e>=this.dim+this.border)throw new RangeError("out of range source coordinates for DEM data");return(e+this.border)*this.stride+(t+this.border)},wr("Level",ns);var os=function(t,e,r){this.uid=t,this.scale=e||1,this.level=r||new ns(256,512),this.loaded=!!r};os.prototype.loadFromImage=function(t,e){if(t.height!==t.width)throw new RangeError("DEM tiles must be square");if(e&&"mapbox"!==e&&"terrarium"!==e)return A('"'+e+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');var r=this.level=new ns(t.width,t.width/2),i=t.data;this._unpackData(r,i,e||"mapbox");for(var n=0;n=0&&l[3]>=0&&this.grid.insert(o,l[0],l[1],l[2],l[3])}},hs.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Ro.VectorTile(new Ma(this.rawTileData)).layers,this.sourceLayerCoder=new ss(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},hs.prototype.query=function(t,e,r){var i=this;this.loadVTLayers();for(var n=t.params||{},o=$i/t.tileSize/t.scale,a=Ze(n.filter),s=t.queryGeometry,l=t.queryPadding*o,u=1/0,c=1/0,h=-1/0,p=-1/0,f=0;f=0)return!0;return!1}(o,l)){var u=this.sourceLayerCoder.decode(r),c=this.vtLayers[u].feature(i);if(n(new Vr(this.tileID.overscaledZ),c))for(var h=0;h>a.z,l=new h(a.x*s,a.y*s),u=new h(l.x+s,l.y+s),c=this.segments.prepareSegment(4,r,i);r.emplaceBack(l.x,l.y,l.x,l.y),r.emplaceBack(u.x,l.y,u.x,l.y),r.emplaceBack(l.x,u.y,l.x,u.y),r.emplaceBack(u.x,u.y,u.x,u.y);var p=c.vertexLength;i.emplaceBack(p,p+1,p+2),i.emplaceBack(p+1,p+2,p+3),c.vertexLength+=4,c.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(r,as.members),this.maskedIndexBuffer=e.createIndexBuffer(i)}},fs.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},fs.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=function(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(t,r,i,n){var o=i||n;return e[r]=!o||o.toLowerCase(),""}),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var i=Date.now(),n=!1;if(this.expirationTime>i)n=!1;else if(e)if(this.expirationTime=200&&r.status<300&&r.response){var i;try{i=JSON.parse(r.response)}catch(t){return e(t)}e(null,i)}else 401===r.status&&t.url.match(/mapbox.com/)?e(new k(r.statusText+": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens",r.status,t.url)):e(new k(r.statusText,r.status,t.url))},r.send(),{cancel:function(){return r.abort()}}},t.getImage=function(t,e){return P(t,function(t,r){if(t)e(t);else if(r){var i=new self.Image,n=self.URL||self.webkitURL;i.onload=function(){e(null,i),n.revokeObjectURL(i.src)};var o=new self.Blob([new Uint8Array(r.data)],{type:"image/png"});i.cacheControl=r.cacheControl,i.expires=r.expires,i.src=r.data.byteLength?n.createObjectURL(o):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}})},t.ResourceType=M,t.RGBAImage=Mn,t.default$3=ga,t.ImagePosition=_a,t.default$4=Aa,t.getArrayBuffer=P,t.default$5=function(t){return new Ma(t).readFields(Wa,[])},t.default$6=zr,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var i=t.length,n=new Array(t.length),o=null;t.forEach(function(t,a){e(t,function(t,e){t&&(o=t),n[a]=e,0==--i&&r(o,n)})})},t.AlphaImage=In,t.default$7=F,t.endsWith=b,t.extend=v,t.sphericalToCartesian=function(t){var e=t[0],r=t[1],i=t[2];return r+=90,r*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(i),y:e*Math.sin(r)*Math.sin(i),z:e*Math.cos(i)}},t.Evented=O,t.validateStyle=pr,t.validateLight=fr,t.emitValidationErrors=yr,t.default$8=ot,t.number=It,t.Properties=Jr,t.Transitionable=Ur,t.Transitioning=qr,t.PossiblyEvaluated=Wr,t.DataConstantProperty=Xr,t.warnOnce=A,t.uniqueId=_,t.default$9=Ya,t.pick=function(t,e){for(var r={},i=0;i0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.cross=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=n*l-o*s,t[1]=o*a-i*l,t[2]=i*s-n*a,t},t.transformMat3=function(t,e,r){var i=e[0],n=e[1],o=e[2];return t[0]=i*r[0]+n*r[3]+o*r[6],t[1]=i*r[1]+n*r[4]+o*r[7],t[2]=i*r[2]+n*r[5]+o*r[8],t},t.len=mn,t.forEach$1=yn,t.PosArray=oi,t.UnwrappedTileID=es,t.create$4=function(){var t=new un(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},t.rotate=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=i*l+o*s,t[1]=n*l+a*s,t[2]=i*-s+o*l,t[3]=n*-s+a*l,t},t.ease=m,t.bezier=d,t.default$23=Vr,t.setRTLTextPlugin=function(t,e){if(Dr)throw new Error("setRTLTextPlugin cannot be called multiple times.");Dr=!0,Rr=a.resolveURL(t),Lr=function(t){t?(Dr=!1,Rr=null,e&&e(t)):Br=!0},Or.fire(new R("pluginAvailable",{pluginURL:Rr,completionCallback:Lr}))},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.default$24=Ze,t.default$25=ra,t.register=wr,t.GLYPH_PBF_BORDER=Ka,t.shapeText=function(t,e,r,i,n,o,a,s,l,u){var c=t.trim();u===ds.vertical&&(c=function(t){for(var e="",r=0;r-r/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;si;)u-=l.shift().angleDelta;if(u>n)return!1;a++,s+=h.dist(p)}return!0}function o(t){for(var e=0,r=0;rd){var _=(d-f)/g,x=t.number(y.x,v.x,_),b=t.number(y.y,v.y,_),w=new t.default$25(x,b,v.angleTo(y),m);if(w._round(),h&&!n(e,w,p,h,r))return;return w}f+=g}}function u(e,r,i,l,u,c,h,p,f){var d=a(l,c,h),m=s(l,u),y=0===e[0].x||e[0].x===f||0===e[0].y||e[0].y===f;return r-m*h=0&&S=0&&T=0&&y+f<=d){var A=new t.default$25(S,T,w,g);A._round(),s&&!n(r,A,u,s,l)||v.push(A)}}m+=b}return h||v.length||c||(v=e(r,m/2,a,s,l,u,c,!0,p)),v}(e,y?r/2*p%r:(m/2+2*c)*h*p%r,r,d,i,m*h,y,!1,f)}i.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},i.prototype.update=function(e,i){for(var n=this,o=0,a=e;o0&&(v=Math.max(10*l,v),this._addLineCollisionCircles(e,r,i,i.segment,g,v,n,o,a,h))}else{if(p){var _=new t.default(m,f),x=new t.default(y,f),b=new t.default(m,d),w=new t.default(y,d),E=p*Math.PI/180;_._rotate(E),x._rotate(E),b._rotate(E),w._rotate(E),m=Math.min(_.x,x.x,b.x,w.x),y=Math.max(_.x,x.x,b.x,w.x),f=Math.min(_.y,x.y,b.y,w.y),d=Math.max(_.y,x.y,b.y,w.y)}e.emplaceBack(i.x,i.y,m,f,y,d,n,o,a,0,0)}this.boxEndIndex=e.length};h.prototype._addLineCollisionCircles=function(t,e,r,i,n,o,a,s,l,u){var c=o/2,h=Math.floor(n/c),p=1+.4*Math.log(u)/Math.LN2,f=Math.floor(h*p/2),d=-o/2,m=r,y=i+1,v=d,g=-n/2,_=g-n/4;do{if(--y<0){if(v>g)return;y=0;break}v-=e[y].dist(m),m=e[y]}while(v>_);for(var x=e[y].dist(e[y+1]),b=-f;bn&&(E+=w-n),!(E=e.length)return;x=e[y].dist(e[y+1])}var S=E-v,T=e[y],A=e[y+1].sub(T)._unit()._mult(S)._add(T)._round(),z=Math.abs(E-d)0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}function m(t,e){return te?1:0}function y(e,r,i){void 0===r&&(r=1),void 0===i&&(i=!1);for(var n=1/0,o=1/0,a=-1/0,s=-1/0,l=e[0],u=0;ua)&&(a=c.x),(!u||c.y>s)&&(s=c.y)}var h=a-n,f=s-o,d=Math.min(h,f),m=d/2,y=new p(null,v);if(0===d)return new t.default(n,o);for(var _=n;_b.d||!b.d)&&(b=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-b.d<=r||(m=E.h/2,y.push(new g(E.p.x-m,E.p.y-m,m,e)),y.push(new g(E.p.x+m,E.p.y-m,m,e)),y.push(new g(E.p.x-m,E.p.y+m,m,e)),y.push(new g(E.p.x+m,E.p.y+m,m,e)),w+=4)}return i&&(console.log("num probes: "+w),console.log("best distance: "+b.d)),b.p}function v(t,e){return e.max-t.max}function g(e,r,i,n){this.p=new t.default(e,r),this.h=i,this.d=function(e,r){for(var i=!1,n=1/0,o=0;oe.y!=h.y>e.y&&e.x<(h.x-c.x)*(e.y-c.y)/(h.y-c.y)+c.x&&(i=!i),n=Math.min(n,t.distToSegmentSquared(e,c,h))}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}function _(e,r,i,n,o,a){e.createArrays(),e.symbolInstances=[];var s=512*e.overscaling;e.tilePixelRatio=t.default$10/s,e.compareText={},e.iconsNeedLinear=!1;var l=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,c={};if("composite"===e.textSizeData.functionType){var h=e.textSizeData.zoomRange,p=h.min,f=h.max;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new t.default$23(p)),u["text-size"].possiblyEvaluate(new t.default$23(f))]}if("composite"===e.iconSizeData.functionType){var d=e.iconSizeData.zoomRange,m=d.min,y=d.max;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new t.default$23(m)),u["icon-size"].possiblyEvaluate(new t.default$23(y))]}c.layoutTextSize=u["text-size"].possiblyEvaluate(new t.default$23(e.zoom+1)),c.layoutIconSize=u["icon-size"].possiblyEvaluate(new t.default$23(e.zoom+1)),c.textMaxSize=u["text-size"].possiblyEvaluate(new t.default$23(18));for(var v=24*l.get("text-line-height"),g="map"===l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),_=l.get("text-keep-upright"),b=0,w=e.features;b=t.default$10||l.y<0||l.y>=t.default$10||e.symbolInstances.push(function(e,r,i,n,o,a,s,l,u,p,f,d,m,y,v,g,_,x,w,E,S){var T,A,z=e.addToLineVertexArray(r,i),I=0,M=0,k=0,C=n.horizontal?n.horizontal.text:"",P=[];if(n.horizontal){var L=a.layout.get("text-rotate").evaluate(w,{});T=new h(s,i,r,l,u,p,n.horizontal,f,d,m,e.overscaling,L),M+=b(e,r,n.horizontal,a,m,w,y,z,n.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,P,E,S),n.vertical&&(k+=b(e,r,n.vertical,a,m,w,y,z,t.WritingMode.vertical,P,E,S))}var D=T?T.boxStartIndex:e.collisionBoxArray.length,R=T?T.boxEndIndex:e.collisionBoxArray.length;if(o){var B=function(e,r,i,n,o,a){var s,l,u,c,h=r.image,p=i.layout,f=r.top-1/h.pixelRatio,d=r.left-1/h.pixelRatio,m=r.bottom+1/h.pixelRatio,y=r.right+1/h.pixelRatio;if("none"!==p.get("icon-text-fit")&&o){var v=y-d,g=m-f,_=p.get("text-size").evaluate(a,{})/24,x=o.left*_,b=o.right*_,w=o.top*_,E=b-x,S=o.bottom*_-w,T=p.get("icon-text-fit-padding")[0],A=p.get("icon-text-fit-padding")[1],z=p.get("icon-text-fit-padding")[2],I=p.get("icon-text-fit-padding")[3],M="width"===p.get("icon-text-fit")?.5*(S-g):0,k="height"===p.get("icon-text-fit")?.5*(E-v):0,C="width"===p.get("icon-text-fit")||"both"===p.get("icon-text-fit")?E:v,P="height"===p.get("icon-text-fit")||"both"===p.get("icon-text-fit")?S:g;s=new t.default(x+k-I,w+M-T),l=new t.default(x+k+A+C,w+M-T),u=new t.default(x+k+A+C,w+M+z+P),c=new t.default(x+k-I,w+M+z+P)}else s=new t.default(d,f),l=new t.default(y,f),u=new t.default(y,m),c=new t.default(d,m);var L=i.layout.get("icon-rotate").evaluate(a,{})*Math.PI/180;if(L){var D=Math.sin(L),R=Math.cos(L),B=[R,-D,D,R];s._matMult(B),l._matMult(B),c._matMult(B),u._matMult(B)}return[{tl:s,tr:l,bl:c,br:u,tex:h.paddedRect,writingMode:void 0,glyphOffset:[0,0]}]}(0,o,a,0,n.horizontal,w),O=a.layout.get("icon-rotate").evaluate(w,{});A=new h(s,i,r,l,u,p,o,v,g,!1,e.overscaling,O),I=4*B.length;var F=e.iconSizeData,V=null;"source"===F.functionType?V=[10*a.layout.get("icon-size").evaluate(w,{})]:"composite"===F.functionType&&(V=[10*S.compositeIconSizes[0].evaluate(w,{}),10*S.compositeIconSizes[1].evaluate(w,{})]),e.addSymbols(e.icon,B,V,x,_,w,!1,r,z.lineStartIndex,z.lineLength)}var N=A?A.boxStartIndex:e.collisionBoxArray.length,j=A?A.boxEndIndex:e.collisionBoxArray.length;return e.glyphOffsetArray.length>=t.default$27.MAX_GLYPHS&&t.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),{key:C,textBoxStartIndex:D,textBoxEndIndex:R,iconBoxStartIndex:N,iconBoxEndIndex:j,textOffset:y,iconOffset:x,anchor:r,line:i,featureIndex:l,feature:w,numGlyphVertices:M,numVerticalGlyphVertices:k,numIconVertices:I,textOpacityState:new c,iconOpacityState:new c,isDuplicate:!1,placedTextSymbolIndices:P,crossTileID:0}}(e,l,s,i,n,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,_,T,I,m,E,A,M,v,r,o,a))};if("line"===k)for(var L=0,D=function(e,r,i,n,o){for(var a=[],s=0;s=n&&p.x>=n||(h.x>=n?h=new t.default(n,h.y+(p.y-h.y)*((n-h.x)/(p.x-h.x)))._round():p.x>=n&&(p=new t.default(n,h.y+(p.y-h.y)*((n-h.x)/(p.x-h.x)))._round()),h.y>=o&&p.y>=o||(h.y>=o?h=new t.default(h.x+(p.x-h.x)*((o-h.y)/(p.y-h.y)),o)._round():p.y>=o&&(p=new t.default(h.x+(p.x-h.x)*((o-h.y)/(p.y-h.y)),o)._round()),u&&h.equals(u[u.length-1])||(u=[h],a.push(u)),u.push(p)))))}return a}(r.geometry,0,0,t.default$10,t.default$10);L1){var $=l(U,z,i.vertical||i.horizontal,n,24,x);$&&P(U,$)}}else if("Polygon"===r.type)for(var q=0,Z=t.default$26(r.geometry,0);q=0;a--)if(i.dist(o[a])0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,i=e[t];t>0;){var n=t-1>>1,o=e[n];if(r(i,o)>=0)break;e[t]=o,t=n}e[t]=i},_down:function(t){for(var e=this.data,r=this.compare,i=this.length>>1,n=e[t];t=0)break;e[t]=s,t=o}e[t]=n}},p.default=f;var E=function(e){var r=new t.AlphaImage({width:0,height:0}),i={},n=new t.default$3(0,0,{autoResize:!0});for(var o in e){var a=e[o],s=i[o]={};for(var l in a){var u=a[+l];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var c=n.packOne(u.bitmap.width+2,u.bitmap.height+2);r.resize({width:n.w,height:n.h}),t.AlphaImage.copy(u.bitmap,r,{x:0,y:0},{x:c.x+1,y:c.y+1},u.bitmap),s[l]={rect:c,metrics:u.metrics}}}}n.shrink(),r.resize({width:n.w,height:n.h}),this.image=r,this.positions=i};t.register("GlyphAtlas",E);var S=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming};function T(e,r){for(var i=new t.default$23(r),n=0,o=e;n=A.maxzoom||"none"!==A.visibility&&(T(S,o.zoom),(h[A.id]=A.createBucket({index:s.bucketLayerIDs.length,layers:S,zoom:o.zoom,pixelRatio:o.pixelRatio,overscaling:o.overscaling,collisionBoxArray:o.collisionBoxArray,sourceLayerIndex:y,sourceID:o.source})).populate(v,p),s.bucketLayerIDs.push(S.map(function(t){return t.id})))}}}var z=t.mapObject(p.glyphDependencies,function(t){return Object.keys(t).map(Number)});Object.keys(z).length?i.send("getGlyphs",{uid:this.uid,stacks:z},function(t,e){l||(l=t,u=e,M.call(o))}):u={};var I=Object.keys(p.iconDependencies);function M(){if(l)return n(l);if(u&&c){var e=new E(u),r=new t.default$30(c);for(var i in h){var o=h[i];o instanceof t.default$27&&(T(o.layers,this.zoom),_(o,u,e.positions,c,r.positions,this.showCollisionBoxes))}this.status="done",n(null,{buckets:t.values(h).filter(function(t){return!t.isEmpty()}),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,iconAtlasImage:r.image})}}I.length?i.send("getImages",{icons:I},function(t,e){l||(l=t,c=e,M.call(o))}):c={},M.call(this)};var A="undefined"!=typeof performance,z={getEntriesByName:function(t){return!!(A&&performance&&performance.getEntriesByName)&&performance.getEntriesByName(t)},mark:function(t){return!!(A&&performance&&performance.mark)&&performance.mark(t)},measure:function(t,e,r){return!!(A&&performance&&performance.measure)&&performance.measure(t,e,r)},clearMarks:function(t){return!!(A&&performance&&performance.clearMarks)&&performance.clearMarks(t)},clearMeasures:function(t){return!!(A&&performance&&performance.clearMeasures)&&performance.clearMeasures(t)}},I=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},z.mark(this._marks.start)};function M(e,r){var i=t.getArrayBuffer(e.request,function(e,i){e?r(e):i&&r(null,{vectorTile:new t.default$31.VectorTile(new t.default$32(i.data)),rawData:i.data,cacheControl:i.cacheControl,expires:i.expires})});return function(){i.cancel(),r()}}I.prototype.finish=function(){z.mark(this._marks.end);var t=z.getEntriesByName(this._marks.measure);return 0===t.length&&(z.measure(this._marks.measure,this._marks.start,this._marks.end),t=z.getEntriesByName(this._marks.measure),z.clearMarks(this._marks.start),z.clearMarks(this._marks.end),z.clearMeasures(this._marks.measure)),t},z.Performance=I;var k=function(t,e,r){this.actor=t,this.layerIndex=e,this.loadVectorData=r||M,this.loading={},this.loaded={}};k.prototype.loadTile=function(e,r){var i=this,n=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new z.Performance(e.request),a=this.loading[n]=new S(e);a.abort=this.loadVectorData(e,function(e,s){if(delete i.loading[n],e||!s)return r(e);var l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);var c={};if(o){var h=o.finish();h&&(c.resourceTiming=JSON.parse(JSON.stringify(h)))}a.vectorTile=s.vectorTile,a.parse(s.vectorTile,i.layerIndex,i.actor,function(e,i){if(e||!i)return r(e);r(null,t.extend({rawTileData:l.slice(0)},i,u,c))}),i.loaded=i.loaded||{},i.loaded[n]=a})},k.prototype.reloadTile=function(t,e){var r=this.loaded,i=t.uid,n=this;if(r&&r[i]){var o=r[i];o.showCollisionBoxes=t.showCollisionBoxes;var a=function(t,r){var i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,n.layerIndex,n.actor,i)),e(t,r)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&o.parse(o.vectorTile,this.layerIndex,this.actor,a)}},k.prototype.abortTile=function(t,e){var r=this.loading,i=t.uid;r&&r[i]&&r[i].abort&&(r[i].abort(),delete r[i]),e()},k.prototype.removeTile=function(t,e){var r=this.loaded,i=t.uid;r&&r[i]&&delete r[i],e()};var C=function(){this.loading={},this.loaded={}};C.prototype.loadTile=function(e,r){var i=e.uid,n=e.encoding,o=new t.default$33(i);this.loading[i]=o,o.loadFromImage(e.rawImageData,n),delete this.loading[i],this.loaded=this.loaded||{},this.loaded[i]=o,r(null,o)},C.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var P={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142};function L(t){var e=0;if(t&&t.length>0){e+=Math.abs(D(t[0]));for(var r=1;r2){for(a=0;a=0}(t)===e?t:t.reverse()}var N=t.default$31.VectorTileFeature.prototype.toGeoJSON,j=function(e){this._feature=e,this.extent=t.default$10,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};j.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,i=this._feature.geometry;r>31}function rt(t,e){for(var r=t.loadGeometry(),i=t.type,n=0,o=0,a=r.length,s=0;sn;){if(o-n>600){var s=o-n+1,l=i-n+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,r,i,Math.max(n,Math.floor(i-l*c/s+h)),Math.min(o,Math.floor(i+(s-l)*c/s+h)),a)}var p=r[2*i+a],f=n,d=o;for(nt(e,r,n,i),r[2*o+a]>p&&nt(e,r,n,o);fp;)d--}r[2*n+a]===p?nt(e,r,n,d):nt(e,r,++d,o),d<=i&&(n=d+1),i<=d&&(o=d-1)}}(e,r,s,n,o,a%2),t(e,r,i,n,s-1,a+1),t(e,r,i,s+1,o,a+1)}}(this.ids,this.coords,this.nodeSize,0,this.ids.length-1,0)}function ut(t){return t[0]}function ct(t){return t[1]}function ht(t){this.options=vt(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function pt(t,e,r,i,n){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:i,properties:n}}function ft(t){return{type:"Feature",properties:dt(t),geometry:{type:"Point",coordinates:[(i=t.x,360*(i-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,i}function dt(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return vt(vt({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function mt(t){return t/360+.5}function yt(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function vt(t,e){for(var r in e)t[r]=e[r];return t}function gt(t){return t.x}function _t(t){return t.y}function xt(t,e,r,i,n,o){var a=n-r,s=o-i;if(0!==a||0!==s){var l=((t-r)*a+(e-i)*s)/(a*a+s*s);l>1?(r=n,i=o):l>0&&(r+=a*l,i+=s*l)}return(a=t-r)*a+(s=e-i)*s}function bt(t,e,r,i){var n={id:void 0===t?null:t,type:e,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)wt(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var i=0;i0&&(a+=i?(n*u-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-o,2))),n=l,o=u}var c=e.length-3;e[2]=1,function t(e,r,i,n){for(var o,a=n,s=i-r>>1,l=i-r,u=e[r],c=e[r+1],h=e[i],p=e[i+1],f=r+3;fa)o=f,a=d;else if(d===a){var m=Math.abs(f-s);mn&&(o-r>3&&t(e,r,o,n),e[o+2]=a,i-o>3&&t(e,o,i,n))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function At(t,e,r,i){for(var n=0;n1?1:r}function Mt(t,e,r,i,n,o,a,s){if(i/=e,o>=(r/=e)&&a=i)return null;for(var l=[],u=0;u=r&&d=i)){var m=[];if("Point"===p||"MultiPoint"===p)kt(h,m,r,i,n);else if("LineString"===p)Ct(h,m,r,i,n,!1,s.lineMetrics);else if("MultiLineString"===p)Lt(h,m,r,i,n,!1);else if("Polygon"===p)Lt(h,m,r,i,n,!0);else if("MultiPolygon"===p)for(var y=0;y=r&&a<=i&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function Ct(t,e,r,i,n,o,a){for(var s,l,u=Pt(t),c=0===n?Rt:Bt,h=t.start,p=0;p=r&&(l=c(u,f,d,y,v,r),a&&(u.start=h+s*l)):g>=i?_=r&&(l=c(u,f,d,y,v,r),x=!0),_>i&&g<=i&&(l=c(u,f,d,y,v,i),x=!0),!o&&x&&(a&&(u.end=h+s*l),e.push(u),u=Pt(t)),a&&(h+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(g=0===n?f:d)>=r&&g<=i&&Dt(u,f,d,m),b=u.length-3,o&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&Dt(u,u[0],u[1],u[2]),u.length&&e.push(u)}function Pt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Lt(t,e,r,i,n,o){for(var a=0;aa.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function Ut(t,e,r,i){var n=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&e.size<(n?a:i))r.numPoints+=e.length/3;else{for(var s=[],l=0;la)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;n&&function(t,e){for(var r=0,i=0,n=t.length,o=n-2;i0===e)for(i=0,n=t.length;i24)throw new Error("maxZoom should be in the 0-24 range");var i=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var i=0;i=r&&s<=n&&l>=i&&l<=o&&c.push(t[d]);else{var m=Math.floor((f+p)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=n&&l>=i&&l<=o&&c.push(t[m]);var y=(h+1)%2;(0===h?r<=s:i<=l)&&(u.push(f),u.push(m-1),u.push(y)),(0===h?n>=s:o>=l)&&(u.push(m+1),u.push(p),u.push(y))}}return c}(this.ids,this.coords,t,e,r,i,this.nodeSize)},within:function(t,e,r){return function(t,e,r,i,n,o){for(var a=[0,t.length-1,0],s=[],l=n*n;a.length;){var u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=o)for(var p=h;p<=c;p++)at(e[2*p],e[2*p+1],r,i)<=l&&s.push(t[p]);else{var f=Math.floor((h+c)/2),d=e[2*f],m=e[2*f+1];at(d,m,r,i)<=l&&s.push(t[f]);var y=(u+1)%2;(0===u?r-n<=d:i-n<=m)&&(a.push(h),a.push(f-1),a.push(y)),(0===u?r+n>=d:i+n>=m)&&(a.push(f+1),a.push(c),a.push(y))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)}},ht.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,reduce:null,initial:function(){return{}},map:function(t){return t}},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;for(var i,n,o=[],a=0;a=this.options.minZoom;s--){var l=+Date.now();o=this._cluster(o,s),this.trees[s]=st(o,gt,_t,this.options.nodeSize,Float32Array),e&&console.log("z%d: %d clusters in %dms",s,o.length,+Date.now()-l)}return e&&console.timeEnd("total time"),this},getClusters:function(t,e){var r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=180===t[2]?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){var a=this.getClusters([r,i,180,o],e),s=this.getClusters([-180,i,n,o],e);return a.concat(s)}for(var l=this.trees[this._limitZoom(e)],u=l.range(mt(r),yt(o),mt(n),yt(i)),c=[],h=0;h>5,r=t%32,i="No cluster with the specified id.",n=this.trees[r];if(!n)throw new Error(i);var o=n.points[e];if(!o)throw new Error(i);for(var a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=n.within(o.x,o.y,a),l=[],u=0;u1&&console.time("creation"),p=this.tiles[h]=jt(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,n){if(e===l.maxZoom||e===n)continue;var d=1<1&&console.time("clipping");var m,y,v,g,_,x,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,S=1+b;m=y=v=g=null,_=Mt(t,c,r-b,r+E,0,p.minX,p.maxX,l),x=Mt(t,c,r+w,r+S,0,p.minX,p.maxX,l),t=null,_&&(m=Mt(_,c,i-b,i+E,1,p.minY,p.maxY,l),y=Mt(_,c,i+w,i+S,1,p.minY,p.maxY,l),_=null),x&&(v=Mt(x,c,i-b,i+E,1,p.minY,p.maxY,l),g=Mt(x,c,i+w,i+S,1,p.minY,p.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*r,2*i),s.push(y||[],e+1,2*r,2*i+1),s.push(v||[],e+1,2*r+1,2*i),s.push(g||[],e+1,2*r+1,2*i+1)}}},qt.prototype.getTile=function(t,e,r){var i=this.options,n=i.extent,o=i.debug;if(t<0||t>24)return null;var a=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Zt(u,c,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,h),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Vt(this.tiles[s],n):null):null};var Wt=function(e){function r(t,r,i){e.call(this,t,r,Gt),i&&(this.loadGeoJSON=i)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var t=this;if(this._pendingCallback&&this._pendingLoadDataParams){var e=this._pendingCallback,r=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(r&&r.request&&r.request.collectResourceTiming)&&new z.Performance(r.request);this.loadGeoJSON(r,function(n,o){if(n||!o)return e(n);if("object"!=typeof o)return e(new Error("Input data is not a valid GeoJSON object."));!function t(e,r){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(O(t,r)),e;case"Feature":return e.geometry=t(e.geometry,r),e;case"Polygon":case"MultiPolygon":return function(t,e){return"Polygon"===t.type?t.coordinates=F(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(O(F,e))),t}(e,r);default:return e}}(o,!0);try{t._geoJSONIndex=r.cluster?(a=r.superclusterOptions,new ht(a)).load(o.features):new qt(o,r.geojsonVtOptions)}catch(n){return e(n)}t.loaded={};var a,s={};if(i){var l=i.finish();l&&(s.resourceTiming={},s.resourceTiming[r.source]=JSON.parse(JSON.stringify(l)))}e(null,s)})}},r.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},r.prototype.reloadTile=function(t,r){var i=this.loaded,n=t.uid;return i&&i[n]?e.prototype.reloadTile.call(this,t,r):this.loadTile(t,r)},r.prototype.loadGeoJSON=function(e,r){if(e.request)t.getJSON(e.request,r);else{if("string"!=typeof e.data)return r(new Error("Input data is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(t){return r(new Error("Input data is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},r.prototype.getClusterExpansionZoom=function(t,e){e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))},r.prototype.getClusterChildren=function(t,e){e(null,this._geoJSONIndex.getChildren(t.clusterId))},r.prototype.getClusterLeaves=function(t,e){e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))},r}(k),Xt=function(e){var r=this;this.self=e,this.actor=new t.default$9(e,this),this.layerIndexes={},this.workerSourceTypes={vector:k,geojson:Wt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(r.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');r.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isLoaded())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText}};return Xt.prototype.setLayers=function(t,e,r){this.getLayerIndex(t).replace(e),r()},Xt.prototype.updateLayers=function(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()},Xt.prototype.loadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)},Xt.prototype.loadDEMTile=function(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)},Xt.prototype.reloadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)},Xt.prototype.abortTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)},Xt.prototype.removeTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)},Xt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},Xt.prototype.removeSource=function(t,e,r){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var i=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==i.removeSource?i.removeSource(e,r):r()}},Xt.prototype.loadWorkerSource=function(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}},Xt.prototype.loadRTLTextPlugin=function(e,r,i){try{t.plugin.isLoaded()||(this.self.importScripts(r),i(t.plugin.isLoaded()?null:new Error("RTL Text Plugin failed to import scripts from "+r)))}catch(t){i(t.toString())}},Xt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new i),e},Xt.prototype.getWorkerSource=function(t,e,r){var i=this;if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){var n={send:function(e,r,n){i.actor.send(e,r,n,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](n,this.getLayerIndex(t))}return this.workerSources[t][e][r]},Xt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new C),this.demWorkerSources[t][e]},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&new Xt(self),Xt}),i(0,function(t){var e=t.createCommonjsModule(function(t){function e(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray&&Function.prototype&&Function.prototype.bind&&Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,r=new Blob([""],{type:"text/javascript"}),i=URL.createObjectURL(r);try{e=new Worker(i),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(i),t}()&&"Uint8ClampedArray"in window&&ArrayBuffer.isView&&function(t){return void 0===r[t]&&(r[t]=function(t){var r=document.createElement("canvas"),i=Object.create(e.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=t,r.probablySupportsContext?r.probablySupportsContext("webgl",i)||r.probablySupportsContext("experimental-webgl",i):r.supportsContext?r.supportsContext("webgl",i)||r.supportsContext("experimental-webgl",i):r.getContext("webgl",i)||r.getContext("experimental-webgl",i)}(t)),r[t]}(t&&t.failIfMajorPerformanceCaveat))}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e);var r={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),r={create:function(e,r,i){var n=t.default$1.document.createElement(e);return r&&(n.className=r),i&&i.appendChild(n),n},createNS:function(e,r){return t.default$1.document.createElementNS(e,r)}},i=t.default$1.document?t.default$1.document.documentElement.style:null;function n(t){if(!i)return null;for(var e=0;e=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var h={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null},p="See https://www.mapbox.com/api-documentation/#access-tokens";function f(t,e){var r=x(h.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"/"!==r.path&&(t.path=""+r.path+t.path),!h.REQUIRE_ACCESS_TOKEN)return b(t);if(!(e=e||h.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+p);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+p);return t.params.push("access_token="+e),b(t)}function d(t){return 0===t.indexOf("mapbox:")}var m=function(t,e){if(!d(t))return t;var r=x(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),f(r,e)},y=function(t,e,r,i){var n=x(t);return d(t)?(n.path="/styles/v1"+n.path+"/sprite"+e+r,f(n,i)):(n.path+=""+e+r,b(n))},v=/(\.(png|jpg)\d*)(?=$)/,g=function(e,r,i){if(!r||!d(r))return e;var n=x(e),o=t.default$2.devicePixelRatio>=2||512===i?"@2x":"",a=t.default$2.supportsWebp?".webp":"$1";return n.path=n.path.replace(v,""+o+a),function(t){for(var e=0;e=0?1.2:1))}function A(t,e,r,i,n,o,a){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else{var l=o.requests[s];l||(l=o.requests[s]=[],I.loadGlyphRange(r,s,i.url,i.requestTransform,function(t,e){if(e)for(var r in e)o.glyphs[+r]=e[+r];for(var i=0,n=l;ithis.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};R.prototype.wrap=function(){return new R(t.wrap(this.lng,-180,180),this.lat)},R.prototype.toArray=function(){return[this.lng,this.lat]},R.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},R.prototype.toBounds=function(t){var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new B(new R(this.lng-r,this.lat-e),new R(this.lng+r,this.lat+e))},R.convert=function(t){if(t instanceof R)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new R(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new R(Number(t.lng),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, or an array of [, ]")};var B=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};B.prototype.setNorthEast=function(t){return this._ne=t instanceof R?new R(t.lng,t.lat):R.convert(t),this},B.prototype.setSouthWest=function(t){return this._sw=t instanceof R?new R(t.lng,t.lat):R.convert(t),this},B.prototype.extend=function(t){var e,r,i=this._sw,n=this._ne;if(t instanceof R)e=t,r=t;else{if(!(t instanceof B))return Array.isArray(t)?t.every(Array.isArray)?this.extend(B.convert(t)):this.extend(R.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return i||n?(i.lng=Math.min(e.lng,i.lng),i.lat=Math.min(e.lat,i.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new R(e.lng,e.lat),this._ne=new R(r.lng,r.lat)),this},B.prototype.getCenter=function(){return new R((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},B.prototype.getSouthWest=function(){return this._sw},B.prototype.getNorthEast=function(){return this._ne},B.prototype.getNorthWest=function(){return new R(this.getWest(),this.getNorth())},B.prototype.getSouthEast=function(){return new R(this.getEast(),this.getSouth())},B.prototype.getWest=function(){return this._sw.lng},B.prototype.getSouth=function(){return this._sw.lat},B.prototype.getEast=function(){return this._ne.lng},B.prototype.getNorth=function(){return this._ne.lat},B.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},B.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},B.prototype.isEmpty=function(){return!(this._sw&&this._ne)},B.convert=function(t){return!t||t instanceof B?t:new B(t)};var O=function(t,e,r){this.bounds=B.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24};O.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},O.prototype.contains=function(t){var e=Math.floor(this.lngX(this.bounds.getWest(),t.z)),r=Math.floor(this.latY(this.bounds.getNorth(),t.z)),i=Math.ceil(this.lngX(this.bounds.getEast(),t.z)),n=Math.ceil(this.latY(this.bounds.getSouth(),t.z));return t.x>=e&&t.x=r&&t.y0&&(l[new t.OverscaledTileID(e.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+10&&(i.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",i))}})},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(e){if(e)r.fire(new t.ErrorEvent(e));else{var i={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(i.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",i))}}),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.dispatcher.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e,this.workerID),this},r.prototype.getClusterChildren=function(t,e){return this.dispatcher.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e,this.workerID),this},r.prototype.getClusterLeaves=function(t,e,r,i){return this.dispatcher.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},i,this.workerID),this},r.prototype._updateWorkerData=function(e){var r=this,i=t.extend({},this.workerOptions),n=this._data;"string"==typeof n?(i.request=this.map._transformRequest(t.default$2.resolveURL(n),t.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(n),this.workerID=this.dispatcher.send(this.type+".loadData",i,function(t,n){r._removed||n&&n.abandoned||(r._loaded=!0,n&&n.resourceTiming&&n.resourceTiming[r.id]&&(r._resourceTiming=n.resourceTiming[r.id].slice(0)),r.dispatcher.send(r.type+".coalesce",{source:i.source},null,r.workerID),e(t))},this.workerID)},r.prototype.loadTile=function(e,r){var i=this,n=void 0===e.workerID?"loadTile":"reloadTile",o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.default$2.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};e.workerID=this.dispatcher.send(n,o,function(t,o){return e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(o,i.map.painter,"reloadTile"===n),r(null))},this.workerID)},r.prototype.abortTile=function(t){t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},null,t.workerID)},r.prototype.onRemove=function(){this._removed=!0,this.dispatcher.send("removeSource",{type:this.type,source:this.id},null,this.workerID)},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),U=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};U.prototype.bind=function(t,e,r,i,n,o,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==i.length,u=0;!l&&uthis.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},K.prototype.has=function(t){return t.wrapped().key in this.data},K.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},K.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},K.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},K.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,i=void 0===e?0:this.data[r].indexOf(e),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this},K.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this};var Y=function(t,e,r){this.context=t;var i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(r),this.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};Y.prototype.unbindVAO=function(){this.context.extVertexArrayObject&&this.context.bindVertexArrayOES.set(null)},Y.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},Y.prototype.updateData=function(t){var e=this.context.gl;this.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},Y.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var J={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Q=function(t,e,r,i){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;var n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};Q.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},Q.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},Q.prototype.enableAttributes=function(t,e){for(var r=0;r1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,i),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype.getZoom=function(t){return t.zoom+t.scaleZoom(t.tileSize/this._source.tileSize)},r.prototype._findLoadedChildren=function(t,e,r){var i=!1;for(var n in this._tiles){var o=this._tiles[n];if(!(r[n]||!o.hasData()||o.tileID.overscaledZ<=t.overscaledZ||o.tileID.overscaledZ>e)){var a=Math.pow(2,o.tileID.canonical.z-t.canonical.z);if(Math.floor(o.tileID.canonical.x/a)===t.canonical.x&&Math.floor(o.tileID.canonical.y/a)===t.canonical.y)for(r[n]=o.tileID,i=!0;o&&o.tileID.overscaledZ-1>t.overscaledZ;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);if(!s)break;(o=this._tiles[s.key])&&o.hasData()&&(delete r[n],r[s.key]=s)}}}return i},r.prototype.findLoadedParent=function(t,e,r){for(var i=t.overscaledZ-1;i>=e;i--){var n=t.scaledTo(i);if(!n)return;var o=String(n.key),a=this._tiles[o];if(a&&a.hasData())return r[o]=n,a;if(this._cache.has(n))return r[o]=n,this._cache.get(n)}},r.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=Math.floor(5*e),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(i)},r.prototype.handleWrapJump=function(t){var e=(t-(void 0===this._prevLng?t:this._prevLng))/360,r=Math.round(e);if(this._prevLng=t,r){var i={};for(var n in this._tiles){var o=this._tiles[n];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),i[o.tileID.key]=o}for(var a in this._tiles=i,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var s in this._tiles){var l=this._tiles[s];this._setTileReloadTimer(s,l)}}},r.prototype.update=function(e){var i=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var n;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(n=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(n=n.filter(function(t){return i._source.hasTile(t)}))):n=[];var o,a=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),s=Math.max(a-r.maxOverzooming,this._source.minzoom),l=Math.max(a+r.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(n,a),c={};if(Bt(this._source.type))for(var h=Object.keys(u),p=0;p=t.default$2.now())){i._findLoadedChildren(d,l,u)&&(u[f]=d);var y=i.findLoadedParent(d,s,c);y&&i._addTile(y.tileID)}}for(o in c)u[o]||(i._coveredTiles[o]=!0);for(o in c)u[o]=c[o];for(var v=t.keysDifference(this._tiles,u),g=0;gthis._source.maxzoom){var p=l.children(this._source.maxzoom)[0],f=this.getTile(p);f&&f.hasData()?i[p.key]=p:h=!1}else{this._findLoadedChildren(l,a,i);for(var d=l.children(this._source.maxzoom),m=0;m=o;--y){var v=l.scaledTo(y);if(n[v.key])break;if(n[v.key]=!0,!(u=this.getTile(v))&&c&&(u=this._addTile(v)),u&&(i[v.key]=v,c=u.wasRequested(),u.hasData()))break}}}return i},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));var i=Boolean(r);return i||(r=new t.default$14(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,i||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout(function(){r._reloadTile(t,"expired"),delete r._timers[t]},i))},r.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r){for(var i=[],n=this.getIds(),o=1/0,a=1/0,s=-1/0,l=-1/0,u=e[0].zoom,c=0;c=0&&v[1].y+y>=0){for(var g=[],_=0;_=t.default$2.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){t=t||"_geojsonTileLayer",this._state.updateState(t,e,r)},r.prototype.getFeatureState=function(t,e){return t=t||"_geojsonTileLayer",this._state.getState(t,e)},r}(t.Evented);function Rt(e,r){var i=r.zoomTo(e.canonical.z);return new t.default((i.column-(e.canonical.x+e.wrap*Math.pow(2,e.canonical.z)))*t.default$10,(i.row-e.canonical.y)*t.default$10)}function Bt(t){return"raster"===t||"image"===t||"video"===t}function Ot(){return new t.default$1.Worker(ui.workerUrl)}Dt.maxOverzooming=10,Dt.maxUnderzooming=3;var Ft,Vt=function(){this.active={}};function Nt(e,r){var i={};for(var n in e)"ref"!==n&&(i[n]=e[n]);return t.default$17.forEach(function(t){t in r&&(i[t]=r[t])}),i}function jt(t){t=t.slice();for(var e=Object.create(null),r=0;rthis.width||i<0||e>this.height)return!n&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=i){if(n)return!0;for(var s=0;s0:a},Kt.prototype._queryCircle=function(t,e,r,i,n){var o=t-r,a=t+r,s=e-r,l=e+r;if(a<0||o>this.width||l<0||s>this.height)return!i&&[];var u=[],c={hitTest:i,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(o,s,a,l,this._queryCellCircle,u,c,n),i?u.length>0:u},Kt.prototype.query=function(t,e,r,i,n){return this._query(t,e,r,i,!1,n)},Kt.prototype.hitTest=function(t,e,r,i,n){return this._query(t,e,r,i,!0,n)},Kt.prototype.hitTestCircle=function(t,e,r,i){return this._queryCircle(t,e,r,!0,i)},Kt.prototype._queryCell=function(t,e,r,i,n,o,a,s){var l=a.seenUids,u=this.boxCells[n];if(null!==u)for(var c=this.bboxes,h=0,p=u;h=c[d+0]&&i>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var m=this.circleCells[n];if(null!==m)for(var y=this.circles,v=0,g=m;va*a+s*s},Kt.prototype._circleAndRectCollide=function(t,e,r,i,n,o,a){var s=(o-i)/2,l=Math.abs(t-(i+s));if(l>s+r)return!1;var u=(a-n)/2,c=Math.abs(e-(n+u));if(c>u+r)return!1;if(l<=s||c<=u)return!0;var h=l-s,p=c-u;return h*h+p*p<=r*r};var Yt=t.default$18.layout;function Jt(e,r,i,n,o){var a=t.identity(new Float32Array(16));return r?(t.identity(a),t.scale(a,a,[1/o,1/o,1]),i||t.rotateZ(a,a,n.angle)):(t.scale(a,a,[n.width/2,-n.height/2,1]),t.translate(a,a,[1,-1,0]),t.multiply(a,a,e)),a}function Qt(e,r,i,n,o){var a=t.identity(new Float32Array(16));return r?(t.multiply(a,a,e),t.scale(a,a,[o,o,1]),i||t.rotateZ(a,a,-n.angle)):(t.scale(a,a,[1,-1,1]),t.translate(a,a,[-1,-1,0]),t.scale(a,a,[2/n.width,2/n.height,1])),a}function te(e,r){var i=[e.x,e.y,0,1];ce(i,i,r);var n=i[3];return{point:new t.default(i[0]/n,i[1]/n),signedDistanceFromCamera:n}}function ee(t,e){var r=t[0]/t[3],i=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&i>=-e[1]&&i<=e[1]}function re(e,r,i,n,o,a,s,l){var u=n?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(u,i.transform.zoom,Yt.properties[n?"text-size":"icon-size"]),h=[256/i.width*2+1,256/i.height*2+1],p=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();for(var f=e.lineVertexArray,d=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=i.transform.width/i.transform.height,y=!1,v=0;vMath.abs(i.x-r.x)*n?{useVertical:!0}:(e===t.WritingMode.vertical?r.yi.x)?{needsFlipping:!0}:null}function oe(e,r,i,n,o,a,s,l,u,c,h,p,f,d){var m,y=r/24,v=e.lineOffsetX*r,g=e.lineOffsetY*r;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ie(y,l,v,g,i,h,p,e,u,a,f,!1);if(!w)return{notEnoughRoom:!0};var E=te(w.first.point,s).point,S=te(w.last.point,s).point;if(n&&!i){var T=ne(e.writingMode,E,S,d);if(T)return T}m=[w.first];for(var A=e.glyphStartIndex+1;A<_-1;A++)m.push(se(y*l.getoffsetX(A),v,g,i,h,p,e.segment,x,b,u,a,f,!1));m.push(w.last)}else{if(n&&!i){var z=te(p,o).point,I=e.lineStartIndex+e.segment+1,M=new t.default(u.getx(I),u.gety(I)),k=te(M,o),C=k.signedDistanceFromCamera>0?k.point:ae(p,M,z,1,o),P=ne(e.writingMode,z,C,d);if(P)return P}var L=se(y*l.getoffsetX(e.glyphStartIndex),v,g,i,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,f,!1);if(!L)return{notEnoughRoom:!0};m=[L]}for(var D=0,R=m;D0?1:-1,y=0;n&&(m*=-1,y=Math.PI),m<0&&(y+=Math.PI);for(var v=m>0?l+s:l+s+1,g=v,_=o,x=o,b=0,w=0,E=Math.abs(d);b+w<=E;){if((v+=m)=u)return null;if(x=_,void 0===(_=p[v])){var S=new t.default(c.getx(v),c.gety(v)),T=te(S,h);if(T.signedDistanceFromCamera>0)_=p[v]=T.point;else{var A=v-m;_=ae(0===b?a:new t.default(c.getx(A),c.gety(A)),S,x,E-b+1,h)}}b+=w,w=x.dist(_)}var z=(E-b)/w,I=_.sub(x),M=I.mult(z)._add(x);return M._add(I._unit()._perp()._mult(i*m)),{point:M,angle:y+Math.atan2(_.y-x.y,_.x-x.x),tileDistance:f?{prevTileDistance:v-m===g?0:c.gettileUnitDistanceFromAnchor(v-m),lastSegmentViewportDistance:E-b}:null}}var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ue(t,e){for(var r=0;rI)pe(e,M,!1);else{var D=this.projectPoint(c,k,C),R=P*T;if(m.length>0){var B=D.x-m[m.length-4],O=D.y-m[m.length-3];if(R*R*2>B*B+O*O&&M+8-z&&F=this.screenRightBoundary||i<100||e>this.screenBottomBoundary},he.prototype.isInsideGrid=function(t,e,r,i){return r>=0&&t=0&&e0,x=x&&b.offscreen);var A=v.collisionArrays.textCircles;if(A){var z=e.text.placedSymbolArray.get(v.placedTextSymbolIndices[0]),I=t.evaluateSizeForFeature(e.textSizeData,h,z);w=this.collisionIndex.placeCollisionCircles(A,c.get("text-allow-overlap"),o,a,v.key,z,e.lineVertexArray,e.glyphOffsetArray,I,r,i,s,"map"===c.get("text-pitch-alignment"),d.predicate),g=c.get("text-allow-overlap")||w.circles.length>0,x=x&&w.offscreen}v.collisionArrays.iconFeatureIndex&&(T=v.collisionArrays.iconFeatureIndex),v.collisionArrays.iconBox&&(_=(E=this.collisionIndex.placeCollisionBox(v.collisionArrays.iconBox,c.get("icon-allow-overlap"),a,r,d.predicate)).box.length>0,x=x&&E.offscreen),p||f?f?p||(_=_&&g):g=_&&g:_=g=_&&g,g&&b&&this.collisionIndex.insertCollisionBox(b.box,c.get("text-ignore-placement"),e.bucketInstanceId,S,d.ID),_&&E&&this.collisionIndex.insertCollisionBox(E.box,c.get("icon-ignore-placement"),e.bucketInstanceId,T,d.ID),g&&w&&this.collisionIndex.insertCollisionCircles(w.circles,c.get("text-ignore-placement"),e.bucketInstanceId,S,d.ID),this.placements[v.crossTileID]=new ve(g,_,x||e.justReloaded),l[v.crossTileID]=!0}}e.justReloaded=!1},_e.prototype.commit=function(t,e){this.commitTime=e;var r=!1,i=t&&0!==this.fadeDuration?(this.commitTime-t.commitTime)/this.fadeDuration:1,n=t?t.opacities:{};for(var o in this.placements){var a=this.placements[o],s=n[o];s?(this.opacities[o]=new ye(s,i,a.text,a.icon),r=r||a.text!==s.text.placed||a.icon!==s.icon.placed):(this.opacities[o]=new ye(null,i,a.text,a.icon,a.skipFade),r=r||a.text||a.icon)}for(var l in n){var u=n[l];if(!this.opacities[l]){var c=new ye(u,i,!1,!1);c.isHidden()||(this.opacities[l]=c,r=r||u.text.placed||u.icon.placed)}}r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)},_e.prototype.updateLayerOpacities=function(t,e){for(var r={},i=0,n=e;i0||s.numVerticalGlyphVertices>0,h=s.numIconVertices>0;if(c){for(var p=Ie(u.text),f=(s.numGlyphVertices+s.numVerticalGlyphVertices)/4,d=0;dt},_e.prototype.setStale=function(){this.stale=!0};var be=Math.pow(2,25),we=Math.pow(2,24),Ee=Math.pow(2,17),Se=Math.pow(2,16),Te=Math.pow(2,9),Ae=Math.pow(2,8),ze=Math.pow(2,1);function Ie(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*be+e*we+r*Ee+e*Se+r*Te+e*Ae+r*ze+e}var Me=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};Me.prototype.continuePlacement=function(t,e,r,i,n){for(;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=r[e[n._currentPlacementIndex]],l=n.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(n._inProgressLayer||(n._inProgressLayer=new Me),n._inProgressLayer.continuePlacement(i[s.source],n.placement,n._showCollisionBoxes,s,a))return;delete n._inProgressLayer}n._currentPlacementIndex--}this._done=!0},ke.prototype.commit=function(t,e){return this.placement.commit(t,e),this.placement};var Ce=512/t.default$10/2,Pe=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var i=0,n=e;it.overscaledZ)for(var l in s){var u=s[l];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,o)}else{var c=s[t.scaledTo(Number(a)).key];c&&c.findMatches(e.symbolInstances,t,o)}}for(var h=0,p=e.symbolInstances;h1?"@2x":"",l=t.getJSON(r(y(e,s,".json"),t.ResourceType.SpriteJSON),function(t,e){l=null,a||(a=t,n=e,c())}),u=t.getImage(r(y(e,s,".png"),t.ResourceType.SpriteImage),function(t,e){u=null,a||(a=t,o=e,c())});function c(){if(a)i(a);else if(n&&o){var e=t.default$2.getImageData(o),r={};for(var s in n){var l=n[s],u=l.width,c=l.height,h=l.x,p=l.y,f=l.sdf,d=l.pixelRatio,m=new t.RGBAImage({width:u,height:c});t.RGBAImage.copy(e,m,{x:h,y:p},{x:0,y:0},{width:u,height:c}),r[s]={data:m,pixelRatio:d,sdf:f}}i(null,r)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(e.sprite,this.map._transformRequest,function(e,r){if(i._spriteRequest=null,e)i.fire(new t.ErrorEvent(e));else if(r)for(var n in r)i.imageManager.addImage(n,r[n]);i.imageManager.setLoaded(!0),i.fire(new t.Event("data",{dataType:"style"}))}):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var o=jt(this.stylesheet.layers);this._order=o.map(function(t){return t.id}),this._layers={};for(var a=0,s=o;a0)throw new Error("Unimplemented: "+n.map(function(t){return t.command}).join(", ")+".");return i.forEach(function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)}),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,i){var n=this;if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,i))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Dt(e,r,this.dispatcher);o.style=this,o.setEventedParent(this,function(){return{isSourceLoaded:n.loaded(),source:o.serialize(),sourceId:e}}),o.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.clearTiles(),i.onRemove&&i.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,i){this._checkLoaded();var n=e.id;if(this.getLayer(n))this.fire(new t.ErrorEvent(new Error('Layer with id "'+n+'" already exists on this map')));else if("object"==typeof e.source&&(this.addSource(n,e.source),e=t.clone(e),e=t.extend(e,{source:n})),!this._validate(t.validateStyle.layer,"layers."+n,e,{arrayIndex:-1},i)){var o=t.default$20(e);this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}});var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source){var s=this._removedLayers[n];delete this._removedLayers[n],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var i=this._order.indexOf(e);this._order.splice(i,1);var n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e]}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.setLayerZoomRange=function(e,r,i){this._checkLoaded();var n=this.getLayer(e);n?n.minzoom===r&&n.maxzoom===i||(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r){this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.default$13(i.filter,r))return null==r?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",r)||(i.filter=t.clone(r),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,i){this._checkLoaded();var n=this.getLayer(e);n?t.default$13(n.getLayoutProperty(r),i)||(n.setLayoutProperty(r,i),this._updateLayer(n)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(t,e){return this.getLayer(t).getLayoutProperty(e)},r.prototype.setPaintProperty=function(e,r,i){this._checkLoaded();var n=this.getLayer(e);n?t.default$13(n.getPaintProperty(r),i)||(n.setPaintProperty(r,i)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var i=e.source,n=e.sourceLayer,o=this.sourceCaches[i];void 0!==o?"vector"!==o.getSource().type||n?o.setFeatureState(n,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types."))):this.fire(new t.ErrorEvent(new Error("The source '"+i+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,i=e.sourceLayer,n=this.sourceCaches[r];if(void 0!==n){if("vector"!==n.getSource().type||i)return n.getFeatureState(i,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){var e=this;return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,function(t){return t.serialize()}),layers:this._order.map(function(t){return e._layers[t].serialize()})},function(t){return void 0!==t})},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenRenderedFeatures=function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var i=this._order[r],n=0,o=t;n 0.5) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n gl_FragColor *= .1;\n }\n}",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field boxes in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n}\n"},collisionCircle:{fragmentSource:"uniform float u_overscale_factor;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n float alpha = 0.5;\n\n // Red = collision, hide label\n vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n\n // Blue = no collision, label is showing\n if (v_placed > 0.5) {\n color = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n color *= .2;\n }\n\n float extrude_scale_length = length(v_extrude_scale);\n float extrude_length = length(v_extrude) * extrude_scale_length;\n float stroke_width = 15.0 * extrude_scale_length / u_overscale_factor;\n float radius = v_radius * extrude_scale_length;\n\n float distance_to_edge = abs(extrude_length - radius);\n float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);\n\n gl_FragColor = opacity_t * color;\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\n\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field circles in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n\n highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur\n gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius\n\n v_extrude = a_extrude * padding_factor;\n v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;\n}\n"},debug:{fragmentSource:"uniform highp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fill:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillOutlinePattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n\n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n}\n"},fillExtrusion:{fragmentSource:"varying vec4 v_color;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n gl_FragColor = v_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec4 v_color;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n vec3 normal = a_normal_ed.xyz;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrusionPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec3 normal = a_normal_ed.xyz;\n float edgedistance = a_normal_ed.w;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n float z = t > 0.0 ? height : base;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(edgedistance, z * u_height_factor); // extrusion side\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos);\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},extrusionTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(0.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);\n\n v_pos.x = a_pos.x;\n v_pos.y = 1.0 - a_pos.y;\n}\n"},hillshadePrepare:{fragmentSource:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nuniform vec2 u_dimension;\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_image, coord) * 255.0;\n return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0;\n}\n\nvoid main() {\n vec2 epsilon = 1.0 / u_dimension;\n\n // queried pixels:\n // +-----------+\n // | | | |\n // | a | b | c |\n // | | | |\n // +-----------+\n // | | | |\n // | d | e | f |\n // | | | |\n // +-----------+\n // | | | |\n // | g | h | i |\n // | | | |\n // +-----------+\n\n float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0);\n float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0);\n float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0);\n float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0);\n float e = getElevation(v_pos, 0.0);\n float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0);\n float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0);\n float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0);\n float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0);\n\n // here we divide the x and y slopes by 8 * pixel size\n // where pixel size (aka meters/pixel) is:\n // circumference of the world / (pixels per tile * number of tiles)\n // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom))\n // which can be reduced to: pow(2, 19.25619978527 - u_zoom)\n // we want to vertically exaggerate the hillshading though, because otherwise\n // it is barely noticeable at low zooms. to do this, we multiply this by some\n // scale factor pow(2, (u_zoom - u_maxzoom) * a) where a is an arbitrary value\n // Here we use a=0.3 which works out to the expression below. see \n // nickidlugash's awesome breakdown for more info\n // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556\n float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;\n\n vec2 deriv = vec2(\n (c + f + f + i) - (a + d + d + g),\n (g + h + h + i) - (a + b + b + c)\n ) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom);\n\n gl_FragColor = clamp(vec4(\n deriv.x / 2.0 + 0.5,\n deriv.y / 2.0 + 0.5,\n 1.0,\n 1.0), 0.0, 1.0);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;\n}\n"},hillshade:{fragmentSource:"uniform sampler2D u_image;\nvarying vec2 v_pos;\n\nuniform vec2 u_latrange;\nuniform vec2 u_light;\nuniform vec4 u_shadow;\nuniform vec4 u_highlight;\nuniform vec4 u_accent;\n\n#define PI 3.141592653589793\n\nvoid main() {\n vec4 pixel = texture2D(u_image, v_pos);\n\n vec2 deriv = ((pixel.rg * 2.0) - 1.0);\n\n // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude\n // to account for mercator projection distortion. see #4807 for details\n float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1]));\n // We also multiply the slope by an arbitrary z-factor of 1.25\n float slope = atan(1.25 * length(deriv) / scaleFactor);\n float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0);\n\n float intensity = u_light.x;\n // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal\n // position property to account for 0deg corresponding to north/the top of the viewport in the style spec\n // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal.\n float azimuth = u_light.y + PI;\n\n // We scale the slope exponentially based on intensity, using a calculation similar to\n // the exponential interpolation function in the style spec:\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228\n // so that higher intensity values create more opaque hillshading.\n float base = 1.875 - intensity * 1.75;\n float maxValue = 0.5 * PI;\n float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope;\n\n // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine\n // so that the accent color's rate of change eases in while the shade color's eases out.\n float accent = cos(scaledSlope);\n // We multiply both the accent and shade color by a clamped intensity value\n // so that intensities >= 0.5 do not additionally affect the color values\n // while intensity values < 0.5 make the overall color more transparent.\n vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);\n float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);\n vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);\n gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_texture_pos / 8192.0;\n}\n"},line:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_linesofar;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},lineGradient:{fragmentSource:"\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nuniform sampler2D u_image;\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n // For gradient lines, v_lineprogress is the ratio along the entire line,\n // scaled to [0, 2^15), and the gradient ramp is stored in a texture.\n vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5));\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n// the attribute conveying progress along a line is scaled to [0, 2^15)\n#define MAX_LINE_DISTANCE 32767.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_lineprogress = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},linePattern:{fragmentSource:"uniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_fade;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n\n // v_normal.y is 0 at the midpoint of the line, -1 at the lower edge, 1 at the upper edge\n // we clamp the line width outset to be between 0 and half the pattern height plus padding (2.0)\n // to ensure we don't sample outside the designated symbol on the sprite sheet.\n // 0.5 is added to shift the component to be bounded between 0 and 1 for interpolation of\n // the texture coordinate\n float y_a = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_a.y + 2.0) / 2.0) / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_b.y + 2.0) / 2.0) / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n gl_FragColor = color * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_linesofar = a_linesofar;\n v_width2 = vec2(outset, inset);\n}\n"},lineSDF:{fragmentSource:"\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist =outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n v_width2 = vec2(outset, inset);\n}\n"},raster:{fragmentSource:"uniform float u_fade_t;\nuniform float u_opacity;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n if (color0.a > 0.0) {\n color0.rgb = color0.rgb / color0.a;\n }\n if (color1.a > 0.0) {\n color1.rgb = color1.rgb / color1.a;\n }\n vec4 color = mix(color0, color1, u_fade_t);\n color.a *= u_opacity;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n // We are using Int16 for texture position coordinates to give us enough precision for\n // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer\n // as an arbitrarily high number to preserve adequate precision when rendering.\n // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,\n // so math for modifying either is consistent.\n v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"uniform sampler2D u_texture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = opacity * v_fade_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\nuniform highp float u_camera_to_center_distance;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform float u_fade_change;\n\n#pragma mapbox: define lowp float opacity\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n\n float size;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // See comments in symbol_sdf.vertex\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // See comments in symbol_sdf.vertex\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n\n v_tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n}\n"},symbolSDF:{fragmentSource:"#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\n\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform sampler2D u_texture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 tex = v_data0.xy;\n float gamma_scale = v_data1.x;\n float size = v_data1.y;\n float fade_opacity = v_data1[2];\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n lowp vec4 color = fill_color;\n highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);\n lowp float buff = (256.0 - 64.0) / 256.0;\n if (u_is_halo) {\n color = halo_color;\n gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n }\n\n lowp float dist = texture2D(u_texture, tex).a;\n highp float gamma_scaled = gamma * gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n gl_FragColor = color * (alpha * opacity * fade_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\n// contents of a_size vary based on the type of property value\n// used for {text,icon}-size.\n// For constants, a_size is disabled.\n// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.\n// For composite functions:\n// [ text-size(lowerZoomStop, feature),\n// text-size(upperZoomStop, feature) ]\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\n\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform highp float u_camera_to_center_distance;\nuniform float u_fade_change;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n float size;\n\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // If the label is pitched with the map, layout is done in pitched space,\n // which makes labels in the distance smaller relative to viewport space.\n // We counteract part of that effect by multiplying by the perspective ratio.\n // If the label isn't pitched with the map, we do layout in viewport space,\n // which makes labels in the distance larger relative to the features around\n // them. We counteract part of that effect by dividing by the perspective ratio.\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units\n // To figure out that angle in projected space, we draw a short horizontal line in tile\n // space, project it, and measure its angle in projected space.\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n float gamma_scale = gl_Position.w;\n\n vec2 tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n\n v_data0 = vec2(tex.x, tex.y);\n v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);\n}\n"}},Ue=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,$e=function(t){var e=je[t],r={};e.fragmentSource=e.fragmentSource.replace(Ue,function(t,e,i,n,o){return r[o]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nvarying "+i+" "+n+" "+o+";\n#else\nuniform "+i+" "+n+" u_"+o+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+o+"\n "+i+" "+n+" "+o+" = u_"+o+";\n#endif\n"}),e.vertexSource=e.vertexSource.replace(Ue,function(t,e,i,n,o){var a="float"===n?"vec2":"vec4";return r[o]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float a_"+o+"_t;\nattribute "+i+" "+a+" a_"+o+";\nvarying "+i+" "+n+" "+o+";\n#else\nuniform "+i+" "+n+" u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+o+" = unpack_mix_"+a+"(a_"+o+", a_"+o+"_t);\n#else\n "+i+" "+n+" "+o+" = u_"+o+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float a_"+o+"_t;\nattribute "+i+" "+a+" a_"+o+";\n#else\nuniform "+i+" "+n+" u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+i+" "+n+" "+o+" = unpack_mix_"+a+"(a_"+o+", a_"+o+"_t);\n#else\n "+i+" "+n+" "+o+" = u_"+o+";\n#endif\n"})};for(var qe in je)$e(qe);var Ze=je,Ge=function(e,r,i,n){var o=e.gl;this.program=o.createProgram();var a=i.defines().concat("#define DEVICE_PIXEL_RATIO "+t.default$2.devicePixelRatio.toFixed(1));n&&a.push("#define OVERDRAW_INSPECTOR;");var s=a.concat(Ze.prelude.fragmentSource,r.fragmentSource).join("\n"),l=a.concat(Ze.prelude.vertexSource,r.vertexSource).join("\n"),u=o.createShader(o.FRAGMENT_SHADER);o.shaderSource(u,s),o.compileShader(u),o.attachShader(this.program,u);var c=o.createShader(o.VERTEX_SHADER);o.shaderSource(c,l),o.compileShader(c),o.attachShader(this.program,c);for(var h=i.layoutAttributes||[],p=0;p>16,s>>16),i.uniform2f(r.uniforms.u_pixel_coord_lower,65535&a,65535&s)};function or(t,e,r,i,n){if(!rr(r.paint.get("fill-pattern"),t))for(var o=!0,a=0,s=i;a0){var s=t.default$2.now(),l=(s-e.timeAdded)/a,u=r?(s-r.timeAdded)/a:-1,c=i.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),f=p&&e.refreshedUponExpiration?1:t.clamp(p?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}function fr(e,r,i){var n=e.context,o=n.gl,a=i.posMatrix,s=e.useProgram("debug");n.setDepthMode(kt.disabled),n.setStencilMode(Ct.disabled),n.setColorMode(e.colorModeForRenderPass()),o.uniformMatrix4fv(s.uniforms.u_matrix,!1,a),o.uniform4f(s.uniforms.u_color,1,0,0,1),e.debugVAO.bind(n,s,e.debugBuffer,[]),o.drawArrays(o.LINE_STRIP,0,e.debugBuffer.length);for(var l=function(t,e,r,i){i=i||1;var n,o,a,s,l,u,c,h,p=[];for(n=0,o=t.length;n":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]},mr={symbol:function(t,e,r,i){if("translucent"===t.renderPass){var n=t.context;n.setStencilMode(Ct.disabled),n.setColorMode(t.colorModeForRenderPass()),0!==r.paint.get("icon-opacity").constantOr(1)&&Ye(t,e,r,i,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright")),0!==r.paint.get("text-opacity").constantOr(1)&&Ye(t,e,r,i,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright")),e.map.showCollisionBoxes&&function(t,e,r,i){Xe(t,e,r,i,!1),Xe(t,e,r,i,!0)}(t,e,r,i)}},circle:function(t,e,r,i){if("translucent"===t.renderPass){var n=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity");if(0!==n.constantOr(1)||0!==o.constantOr(1)&&0!==a.constantOr(1)){var s=t.context,l=s.gl;s.setDepthMode(t.depthModeForSublayer(0,kt.ReadOnly)),s.setStencilMode(Ct.disabled),s.setColorMode(t.colorModeForRenderPass());for(var u=!0,c=0;c0?1-1/(1.001-n):-n),s.uniform1f(u.uniforms.u_contrast_factor,(o=r.paint.get("raster-contrast"))>0?1/(1-o):1+o),s.uniform3fv(u.uniforms.u_spin_weights,function(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}(r.paint.get("raster-hue-rotate"))),s.uniform1f(u.uniforms.u_buffer_scale,1),s.uniform1i(u.uniforms.u_image0,0),s.uniform1i(u.uniforms.u_image1,1);for(var c=i.length&&i[0].overscaledZ,h=0,p=i;he.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function gr(t,e,r,i,n){var o=Math.max(r,Math.floor(e.y0)),a=Math.min(i,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,h=e.dx<0,p=o;pl.dy&&(a=s,s=l,l=a),s.dy>u.dy&&(a=s,s=u,u=a),l.dy>u.dy&&(a=l,l=u,u=a),s.dy&&gr(u,s,i,n,o),l.dy&&gr(u,l,i,n,o)}yr.prototype.resize=function(e,r){var i=this.context.gl;if(this.width=e*t.default$2.devicePixelRatio,this.height=r*t.default$2.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var n=0,o=this.style._order;n=0;this.currentLayer--){var y=i.style._layers[a[i.currentLayer]];y.source!==(d&&d.id)&&(m=[],(d=i.style.sourceCaches[y.source])&&(i.clearStencil(),m=d.getVisibleCoordinates(),d.getSource().isTileClipped&&i._renderTileClippingMasks(m))),i.renderLayer(i,d,y,m)}this.renderPass="translucent";var v,g=[];for(this.currentLayer=0,this.currentLayer;this.currentLayer0?e.pop():null},yr.prototype._createProgramCached=function(t,e){this.cache=this.cache||{};var r=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new Ge(this.context,Ze[t],e,this._showOverdrawInspector)),this.cache[r]},yr.prototype.useProgram=function(t,e){var r=this._createProgramCached(t,e||this.emptyProgramConfiguration);return this.context.program.set(r.program),r};var xr=function(t,e,r){this.tileSize=512,this._renderWorldCopies=void 0===r||r,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new R(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},br={minZoom:{configurable:!0},maxZoom:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerPoint:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},unmodified:{configurable:!0},x:{configurable:!0},y:{configurable:!0},point:{configurable:!0}};xr.prototype.clone=function(){var t=new xr(this._minZoom,this._maxZoom,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},br.minZoom.get=function(){return this._minZoom},br.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},br.maxZoom.get=function(){return this._maxZoom},br.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},br.renderWorldCopies.get=function(){return this._renderWorldCopies},br.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},br.worldSize.get=function(){return this.tileSize*this.scale},br.centerPoint.get=function(){return this.size._div(2)},br.size.get=function(){return new t.default(this.width,this.height)},br.bearing.get=function(){return-this.angle/Math.PI*180},br.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$4(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},br.pitch.get=function(){return this._pitch/Math.PI*180},br.pitch.set=function(e){var r=t.clamp(e,0,60)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},br.fov.get=function(){return this._fov/Math.PI*180},br.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},br.zoom.get=function(){return this._zoom},br.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},br.center.get=function(){return this._center},br.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},xr.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},xr.prototype.getVisibleUnwrappedCoordinates=function(e){var r=this.pointCoordinate(new t.default(0,0),0),i=this.pointCoordinate(new t.default(this.width,0),0),n=Math.floor(r.column),o=Math.floor(i.column),a=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var s=n;s<=o;s++)0!==s&&a.push(new t.UnwrappedTileID(s,e));return a},xr.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),i=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var n=this.pointCoordinate(this.centerPoint,r),o=new t.default(n.column-.5,n.row-.5);return function(e,r,i,n){void 0===n&&(n=!0);var o=1<=0&&l<=o)for(u=r;ua&&(n=a-m)}if(this.lngRange){var y=this.x,v=u.x/2;y-vl&&(i=l-v)}void 0===i&&void 0===n||(this.center=this.unproject(new t.default(void 0!==i?i:this.x,void 0!==n?n:this.y))),this._unmodified=c,this._constraining=!1}},xr.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var e=this._fov/2,r=Math.PI/2+this._pitch,i=Math.sin(e)*this.cameraToCenterDistance/Math.sin(Math.PI-r-e),n=this.x,o=this.y,a=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),s=new Float64Array(16);t.perspective(s,this._fov,this.width/this.height,1,a),t.scale(s,s,[1,-1,1]),t.translate(s,s,[0,0,-this.cameraToCenterDistance]),t.rotateX(s,s,this._pitch),t.rotateZ(s,s,this.angle),t.translate(s,s,[-n,-o,0]);var l=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));t.scale(s,s,[1,1,l,1]),this.projMatrix=s;var u=this.width%2/2,c=this.height%2/2,h=Math.cos(this.angle),p=Math.sin(this.angle),f=n-Math.round(n)+h*u+p*c,d=o-Math.round(o)+h*c+p*u,m=new Float64Array(s);if(t.translate(m,m,[f>.5?f-1:f,d>.5?d-1:d,0]),this.alignedProjMatrix=m,s=t.create(),t.scale(s,s,[this.width/2,-this.height/2,1]),t.translate(s,s,[1,-1,0]),this.pixelMatrix=t.multiply(new Float64Array(16),s,this.projMatrix),!(s=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=s,this._posMatrixCache={},this._alignedPosMatrixCache={}}},xr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.default(0,0)).zoomTo(this.zoom),r=[e.column*this.tileSize,e.row*this.tileSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},Object.defineProperties(xr.prototype,br);var wr=function(){var e,r,i,n;t.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=(e=this._updateHashUnthrottled.bind(this),300,r=!1,i=0,n=function(){i=0,r&&(e(),i=setTimeout(n,300),r=!1)},function(){return r=!0,i||n(),i})};wr.prototype.addTo=function(e){return this._map=e,t.default$1.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},wr.prototype.remove=function(){return t.default$1.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},wr.prototype.getHashString=function(t){var e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,i),o=Math.round(e.lng*n)/n,a=Math.round(e.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch(),u="";return u+=t?"#/"+o+"/"+a+"/"+r:"#"+r+"/"+a+"/"+o,(s||l)&&(u+="/"+Math.round(10*s)/10),l&&(u+="/"+Math.round(l)),u},wr.prototype._onHashChange=function(){var e=t.default$1.location.hash.replace("#","").split("/");return e.length>=3&&(this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:+(e[3]||0),pitch:+(e[4]||0)}),!0)},wr.prototype._updateHashUnthrottled=function(){var e=this.getHashString();t.default$1.history.replaceState(t.default$1.history.state,"",e)};var Er=function(e){function i(i,n,o,a){void 0===a&&(a={});var s=r.mousePos(n.getCanvasContainer(),o),l=n.unproject(s);e.call(this,i,t.extend({point:s,lngLat:l,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var n={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,n),i}(t.Event),Sr=function(e){function i(i,n,o){var a=r.touchPos(n.getCanvasContainer(),o),s=a.map(function(t){return n.unproject(t)}),l=a.reduce(function(t,e,r,i){return t.add(e.div(i.length))},new t.default(0,0)),u=n.unproject(l);e.call(this,i,{points:a,point:l,lngLats:s,lngLat:u,originalEvent:o}),this._defaultPrevented=!1}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var n={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,n),i}(t.Event),Tr=function(t){function e(e,r,i){t.call(this,e,{originalEvent:i}),this._defaultPrevented=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,r),e}(t.Event),Ar=function(e){this._map=e,this._el=e.getCanvasContainer(),this._delta=0,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};Ar.prototype.isEnabled=function(){return!!this._enabled},Ar.prototype.isActive=function(){return!!this._active},Ar.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},Ar.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Ar.prototype.onWheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.default$1.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,i=t.default$2.now(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this.isActive()||this._start(e)),e.preventDefault()}},Ar.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},Ar.prototype._start=function(e){if(this._delta){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),this._active=!0,this._map.fire(new t.Event("movestart",{originalEvent:e})),this._map.fire(new t.Event("zoomstart",{originalEvent:e})),this._finishTimeout&&clearTimeout(this._finishTimeout);var i=r.mousePos(this._el,e);this._around=R.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame))}},Ar.prototype._onScrollFrame=function(){var e=this;if(this._frameId=null,this.isActive()){var r=this._map.transform;if(0!==this._delta){var i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,n=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==n&&(n=1/n);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*n))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a="number"==typeof this._targetZoom?this._targetZoom:r.zoom,s=this._startZoom,l=this._easing,u=!1;if("wheel"===this._type&&s&&l){var c=Math.min((t.default$2.now()-this._lastWheelEventTime)/200,1),h=l(c);r.zoom=t.number(s,a,h),c<1?this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame)):u=!0}else r.zoom=a,u=!0;r.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire(new t.Event("move",{originalEvent:this._lastWheelEvent})),this._map.fire(new t.Event("zoom",{originalEvent:this._lastWheelEvent})),u&&(this._active=!1,this._finishTimeout=setTimeout(function(){e._map.fire(new t.Event("zoomend",{originalEvent:e._lastWheelEvent})),e._map.fire(new t.Event("moveend",{originalEvent:e._lastWheelEvent})),delete e._targetZoom},200))}},Ar.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var i=this._prevEase,n=(t.default$2.now()-i.start)/i.duration,o=i.easing(n+.01)-i.easing(n),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);r=t.bezier(a,s,.25,1)}return this._prevEase={start:t.default$2.now(),duration:e,easing:r},r};var zr=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=r.clickTolerance||1,t.bindAll(["_onMouseMove","_onMouseUp","_onKeyDown"],this)};zr.prototype.isEnabled=function(){return!!this._enabled},zr.prototype.isActive=function(){return!!this._active},zr.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},zr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},zr.prototype.onMouseDown=function(e){this.isEnabled()&&e.shiftKey&&0===e.button&&(t.default$1.document.addEventListener("mousemove",this._onMouseMove,!1),t.default$1.document.addEventListener("keydown",this._onKeyDown,!1),t.default$1.document.addEventListener("mouseup",this._onMouseUp,!1),r.disableDrag(),this._startPos=this._lastPos=r.mousePos(this._el,e),this._active=!0)},zr.prototype._onMouseMove=function(t){var e=r.mousePos(this._el,t);if(!(this._lastPos.equals(e)||!this._box&&e.dist(this._startPos)180&&(f=180);var d=f/180;u+=h*f*(d/2),Math.abs(r._normalizeBearing(u,0))0&&r-e[0][0]>160;)e.shift()};var kr=t.bezier(0,0,.3,1),Cr=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._state="disabled",this._clickTolerance=r.clickTolerance||1,t.bindAll(["_onMove","_onMouseUp","_onTouchEnd","_onBlur","_onDragFrame"],this)};Cr.prototype.isEnabled=function(){return"disabled"!==this._state},Cr.prototype.isActive=function(){return"active"===this._state},Cr.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._state="enabled")},Cr.prototype.disable=function(){if(this.isEnabled())switch(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("dragend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},Cr.prototype.onMouseDown=function(e){"enabled"===this._state&&(e.ctrlKey||0!==r.mouseButton(e)||(r.addEventListener(t.default$1.document,"mousemove",this._onMove,{capture:!0}),r.addEventListener(t.default$1.document,"mouseup",this._onMouseUp),this._start(e)))},Cr.prototype.onTouchStart=function(e){"enabled"===this._state&&(e.touches.length>1||(r.addEventListener(t.default$1.document,"touchmove",this._onMove,{capture:!0,passive:!1}),r.addEventListener(t.default$1.document,"touchend",this._onTouchEnd),this._start(e)))},Cr.prototype._start=function(e){t.default$1.addEventListener("blur",this._onBlur),this._state="pending",this._startPos=this._mouseDownPos=this._lastPos=r.mousePos(this._el,e),this._inertia=[[t.default$2.now(),this._startPos]]},Cr.prototype._onMove=function(e){e.preventDefault();var i=r.mousePos(this._el,e);this._lastPos.equals(i)||"pending"===this._state&&i.dist(this._mouseDownPos)1400&&(s=1400,a._unit()._mult(s));var l=s/750,u=a.mult(-l/2);this._map.panBy(u,{duration:1e3*l,easing:kr,noMoveStart:!0},{originalEvent:t})}}},Cr.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},Cr.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.default$2.now();e.length>0&&r-e[0][0]>160;)e.shift()};var Pr=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onKeyDown"],this)};function Lr(t){return t*(2-t)}Pr.prototype.isEnabled=function(){return!!this._enabled},Pr.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},Pr.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},Pr.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,r=0,i=0,n=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(o=1,t.preventDefault());break;default:return}var a=this._map,s=a.getZoom(),l={duration:300,delayEndEvents:500,easing:Lr,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+15*r,pitch:a.getPitch()+10*i,offset:[100*-n,100*-o],center:a.getCenter()};a.easeTo(l,{originalEvent:t})}};var Dr=function(e){this._map=e,t.bindAll(["_onDblClick","_onZoomEnd"],this)};Dr.prototype.isEnabled=function(){return!!this._enabled},Dr.prototype.isActive=function(){return!!this._active},Dr.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Dr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Dr.prototype.onTouchStart=function(t){var e=this;this.isEnabled()&&(t.points.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._zoom(t)):this._tapped=setTimeout(function(){e._tapped=null},300)))},Dr.prototype.onDblClick=function(t){this.isEnabled()&&(t.originalEvent.preventDefault(),this._zoom(t))},Dr.prototype._zoom=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)},Dr.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)};var Rr=t.bezier(0,0,.15,1),Br=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onMove","_onEnd","_onTouchFrame"],this)};Br.prototype.isEnabled=function(){return!!this._enabled},Br.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)},Br.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._enabled=!1)},Br.prototype.disableRotation=function(){this._rotationDisabled=!0},Br.prototype.enableRotation=function(){this._rotationDisabled=!1},Br.prototype.onStart=function(e){if(this.isEnabled()&&2===e.touches.length){var i=r.mousePos(this._el,e.touches[0]),n=r.mousePos(this._el,e.touches[1]);this._startVec=i.sub(n),this._gestureIntent=void 0,this._inertia=[],r.addEventListener(t.default$1.document,"touchmove",this._onMove,{passive:!1}),r.addEventListener(t.default$1.document,"touchend",this._onEnd)}},Br.prototype._getTouchEventData=function(t){var e=r.mousePos(this._el,t.touches[0]),i=r.mousePos(this._el,t.touches[1]),n=e.sub(i);return{vec:n,center:e.add(i).div(2),scale:n.mag()/this._startVec.mag(),bearing:this._rotationDisabled?0:180*n.angleWith(this._startVec)/Math.PI}},Br.prototype._onMove=function(e){if(2===e.touches.length){var r=this._getTouchEventData(e),i=r.vec,n=r.scale,o=r.bearing;if(!this._gestureIntent){var a=Math.abs(1-n)>.15;Math.abs(o)>10?this._gestureIntent="rotate":a&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._map.fire(new t.Event(this._gestureIntent+"start",{originalEvent:e})),this._map.fire(new t.Event("movestart",{originalEvent:e})),this._startVec=i)}this._lastTouchEvent=e,this._frameId||(this._frameId=this._map._requestRenderFrame(this._onTouchFrame)),e.preventDefault()}},Br.prototype._onTouchFrame=function(){this._frameId=null;var e=this._gestureIntent;if(e){var r=this._map.transform;this._startScale||(this._startScale=r.scale,this._startBearing=r.bearing);var i=this._getTouchEventData(this._lastTouchEvent),n=i.center,o=i.bearing,a=i.scale,s=r.pointLocation(n),l=r.locationPoint(s);"rotate"===e&&(r.bearing=this._startBearing+o),r.zoom=r.scaleZoom(this._startScale*a),r.setLocationAtPoint(s,l),this._map.fire(new t.Event(e,{originalEvent:this._lastTouchEvent})),this._map.fire(new t.Event("move",{originalEvent:this._lastTouchEvent})),this._drainInertiaBuffer(),this._inertia.push([t.default$2.now(),a,n])}},Br.prototype._onEnd=function(e){r.removeEventListener(t.default$1.document,"touchmove",this._onMove,{passive:!1}),r.removeEventListener(t.default$1.document,"touchend",this._onEnd);var i=this._gestureIntent,n=this._startScale;if(this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._gestureIntent,delete this._startScale,delete this._startBearing,delete this._lastTouchEvent,i){this._map.fire(new t.Event(i+"end",{originalEvent:e})),this._drainInertiaBuffer();var o=this._inertia,a=this._map;if(o.length<2)a.snapToNorth({},{originalEvent:e});else{var s=o[o.length-1],l=o[0],u=a.transform.scaleZoom(n*s[1]),c=a.transform.scaleZoom(n*l[1]),h=u-c,p=(s[0]-l[0])/1e3,f=s[2];if(0!==p&&u!==c){var d=.15*h/p;Math.abs(d)>2.5&&(d=d>0?2.5:-2.5);var m=1e3*Math.abs(d/(12*.15)),y=u+d*m/2e3;y<0&&(y=0),a.easeTo({zoom:y,duration:m,easing:Rr,around:this._aroundCenter?a.getCenter():a.unproject(f),noMoveStart:!0},{originalEvent:e})}else a.snapToNorth({},{originalEvent:e})}}},Br.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.default$2.now();e.length>2&&r-e[0][0]>160;)e.shift()};var Or={scrollZoom:Ar,boxZoom:zr,dragRotate:Mr,dragPan:Cr,keyboard:Pr,doubleClickZoom:Dr,touchZoomRotate:Br},Fr=function(e){function r(r,i){e.call(this),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.getCenter=function(){return this.transform.center},r.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},r.prototype.panBy=function(e,r,i){return e=t.default.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},r),i)},r.prototype.panTo=function(e,r,i){return this.easeTo(t.extend({center:e},r),i)},r.prototype.getZoom=function(){return this.transform.zoom},r.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},r.prototype.zoomTo=function(e,r,i){return this.easeTo(t.extend({zoom:e},r),i)},r.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},r.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},r.prototype.getBearing=function(){return this.transform.bearing},r.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},r.prototype.rotateTo=function(e,r,i){return this.easeTo(t.extend({bearing:e},r),i)},r.prototype.resetNorth=function(e,r){return this.rotateTo(0,t.extend({duration:1e3},e),r),this},r.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())e?1:0}),["bottom","left","right","top"])){e=B.convert(e);var n=[(r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2],o=Math.min(r.padding.right,r.padding.left),a=Math.min(r.padding.top,r.padding.bottom);r.offset=[r.offset[0]+n[0],r.offset[1]+n[1]];var s=t.default.convert(r.offset),l=this.transform,u=l.project(e.getNorthWest()),c=l.project(e.getSouthEast()),h=c.sub(u),p=(l.width-2*o-2*Math.abs(s.x))/h.x,f=(l.height-2*a-2*Math.abs(s.y))/h.y;if(!(f<0||p<0))return r.center=l.unproject(u.add(c).div(2)),r.zoom=Math.min(l.scaleZoom(l.scale*Math.min(p,f)),r.maxZoom),r.bearing=0,r;t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}else t.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'")},r.prototype.fitBounds=function(e,r,i){var n=this.cameraForBounds(e,r);return n?(r=t.extend(n,r)).linear?this.easeTo(r,i):this.flyTo(r,i):this},r.prototype.jumpTo=function(e,r){this.stop();var i=this.transform,n=!1,o=!1,a=!1;return"zoom"in e&&i.zoom!==+e.zoom&&(n=!0,i.zoom=+e.zoom),void 0!==e.center&&(i.center=R.convert(e.center)),"bearing"in e&&i.bearing!==+e.bearing&&(o=!0,i.bearing=+e.bearing),"pitch"in e&&i.pitch!==+e.pitch&&(a=!0,i.pitch=+e.pitch),this.fire(new t.Event("movestart",r)).fire(new t.Event("move",r)),n&&this.fire(new t.Event("zoomstart",r)).fire(new t.Event("zoom",r)).fire(new t.Event("zoomend",r)),o&&this.fire(new t.Event("rotatestart",r)).fire(new t.Event("rotate",r)).fire(new t.Event("rotateend",r)),a&&this.fire(new t.Event("pitchstart",r)).fire(new t.Event("pitch",r)).fire(new t.Event("pitchend",r)),this.fire(new t.Event("moveend",r))},r.prototype.easeTo=function(e,r){var i=this;this.stop(),!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate&&(e.duration=0);var n=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?+e.zoom:o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:s,h=n.centerPoint.add(t.default.convert(e.offset)),p=n.pointLocation(h),f=R.convert(e.center||p);this._normalizeCenter(f);var d,m,y=n.project(p),v=n.project(f).sub(y),g=n.zoomScale(l-o);return e.around&&(d=R.convert(e.around),m=n.locationPoint(d)),this._zooming=l!==o,this._rotating=a!==u,this._pitching=c!==s,this._prepareEase(r,e.noMoveStart),clearTimeout(this._easeEndTimeoutID),this._ease(function(e){if(i._zooming&&(n.zoom=t.number(o,l,e)),i._rotating&&(n.bearing=t.number(a,u,e)),i._pitching&&(n.pitch=t.number(s,c,e)),d)n.setLocationAtPoint(d,m);else{var p=n.zoomScale(n.zoom-o),f=l>o?Math.min(2,g):Math.max(.5,g),_=Math.pow(f,1-e),x=n.unproject(y.add(v.mult(e*_)).mult(p));n.setLocationAtPoint(n.renderWorldCopies?x.wrap():x,h)}i._fireMoveEvents(r)},function(){e.delayEndEvents?i._easeEndTimeoutID=setTimeout(function(){return i._afterEase(r)},e.delayEndEvents):i._afterEase(r)},e),this},r.prototype._prepareEase=function(e,r){this._moving=!0,r||this.fire(new t.Event("movestart",e)),this._zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e){var r=this._zooming,i=this._rotating,n=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,r&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),n&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))},r.prototype.flyTo=function(e,r){var i=this;this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var n=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?t.clamp(+e.zoom,n.minZoom,n.maxZoom):o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:s,h=n.zoomScale(l-o),p=n.centerPoint.add(t.default.convert(e.offset)),f=n.pointLocation(p),d=R.convert(e.center||f);this._normalizeCenter(d);var m=n.project(f),y=n.project(d).sub(m),v=e.curve,g=Math.max(n.width,n.height),_=g/h,x=y.mag();if("minZoom"in e){var b=t.clamp(Math.min(e.minZoom,o,l),n.minZoom,n.maxZoom),w=g/n.zoomScale(b-o);v=Math.sqrt(w/x*2)}var E=v*v;function S(t){var e=(_*_-g*g+(t?-1:1)*E*E*x*x)/(2*(t?_:g)*E*x);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function A(t){return(Math.exp(t)+Math.exp(-t))/2}var z=S(0),I=function(t){return A(z)/A(z+v*t)},M=function(t){return g*((A(z)*(T(e=z+v*t)/A(e))-T(z))/E)/x;var e},k=(S(1)-z)/v;if(Math.abs(x)<1e-6||!isFinite(k)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,r);var C=_e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==u,this._pitching=c!==s,this._prepareEase(r,!1),this._ease(function(e){var h=e*k,f=1/I(h);n.zoom=1===e?l:o+n.scaleZoom(f),i._rotating&&(n.bearing=t.number(a,u,e)),i._pitching&&(n.pitch=t.number(s,c,e));var d=n.unproject(m.add(y.mult(M(h))).mult(f));n.setLocationAtPoint(n.renderWorldCopies?d.wrap():d,p),i._fireMoveEvents(r)},function(){return i._afterEase(r)},e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var t=this._onEaseEnd;delete this._onEaseEnd,t.call(this)}return this},r.prototype._ease=function(e,r,i){!1===i.animate||0===i.duration?(e(1),r()):(this._easeStart=t.default$2.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.default$2.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var i=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),Vr=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};Vr.prototype.getDefaultPosition=function(){return"bottom-right"},Vr.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},Vr.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0},Vr.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var e=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:h.ACCESS_TOKEN}];if(t){var r=e.reduce(function(t,r,i){return r.value&&(t+=r.key+"="+r.value+(i=0)return!1;return!0})).length?(this._container.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null}},Vr.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var Nr=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};Nr.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.href="https://www.mapbox.com/",e.setAttribute("aria-label","Mapbox logo"),e.setAttribute("rel","noopener"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},Nr.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},Nr.prototype.getDefaultPosition=function(){return"bottom-left"},Nr.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},Nr.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},Nr.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var jr=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};jr.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},jr.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,i=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than minZoom");var n=new xr(e.minZoom,e.maxZoom,e.renderWorldCopies);i.call(this,n,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new jr;var o=e.transformRequest;if(this._transformRequest=o?function(t,e){return o(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){var a=t.default$1.document.getElementById(e.container);if(!a)throw new Error("Container '"+e.container+"' not found.");this._container=a}else{if(!(e.container instanceof $r))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),void 0!==t.default$1&&(t.default$1.addEventListener("online",this._onWindowOnline,!1),t.default$1.addEventListener("resize",this._onWindowResize,!1)),function(t,e){var i=t.getCanvasContainer(),n=null,o=!1,a=null;for(var s in Or)t[s]=new Or[s](t,e),e.interactive&&e[s]&&t[s].enable(e[s]);r.addEventListener(i,"mouseout",function(e){t.fire(new Er("mouseout",t,e))}),r.addEventListener(i,"mousedown",function(n){o=!0,a=r.mousePos(i,n);var s=new Er("mousedown",t,n);t.fire(s),s.defaultPrevented||(e.interactive&&!t.doubleClickZoom.isActive()&&t.stop(),t.boxZoom.onMouseDown(n),t.boxZoom.isActive()||t.dragPan.isActive()||t.dragRotate.onMouseDown(n),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onMouseDown(n))}),r.addEventListener(i,"mouseup",function(e){var r=t.dragRotate.isActive();n&&!r&&t.fire(new Er("contextmenu",t,n)),n=null,o=!1,t.fire(new Er("mouseup",t,e))}),r.addEventListener(i,"mousemove",function(e){if(!t.dragPan.isActive()&&!t.dragRotate.isActive()){for(var r=e.target;r&&r!==i;)r=r.parentNode;r===i&&t.fire(new Er("mousemove",t,e))}}),r.addEventListener(i,"mouseover",function(e){for(var r=e.target;r&&r!==i;)r=r.parentNode;r===i&&t.fire(new Er("mouseover",t,e))}),r.addEventListener(i,"touchstart",function(r){var i=new Sr("touchstart",t,r);t.fire(i),i.defaultPrevented||(e.interactive&&t.stop(),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onTouchStart(r),t.touchZoomRotate.onStart(r),t.doubleClickZoom.onTouchStart(i))},{passive:!1}),r.addEventListener(i,"touchmove",function(e){t.fire(new Sr("touchmove",t,e))},{passive:!1}),r.addEventListener(i,"touchend",function(e){t.fire(new Sr("touchend",t,e))}),r.addEventListener(i,"touchcancel",function(e){t.fire(new Sr("touchcancel",t,e))}),r.addEventListener(i,"click",function(n){var o=r.mousePos(i,n);(o.equals(a)||o.dist(a)=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},n.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},n.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update(),this},n.prototype.getMaxZoom=function(){return this.transform.maxZoom},n.prototype.project=function(t){return this.transform.locationPoint(R.convert(t))},n.prototype.unproject=function(e){return this.transform.pointLocation(t.default.convert(e))},n.prototype.isMoving=function(){return this._moving||this.dragPan.isActive()||this.dragRotate.isActive()||this.scrollZoom.isActive()},n.prototype.isZooming=function(){return this._zooming||this.scrollZoom.isActive()},n.prototype.isRotating=function(){return this._rotating||this.dragRotate.isActive()},n.prototype.on=function(t,e,r){var n,o=this;if(void 0===r)return i.prototype.on.call(this,t,e);var a=function(){if("mouseenter"===t||"mouseover"===t){var i=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var a=o.getLayer(e)?o.queryRenderedFeatures(n.point,{layers:[e]}):[];a.length?i||(i=!0,r.call(o,new Er(t,o,n.originalEvent,{features:a}))):i=!1},mouseout:function(){i=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(i){(o.getLayer(e)?o.queryRenderedFeatures(i.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,r.call(o,new Er(t,o,i.originalEvent)))},mouseout:function(e){a&&(a=!1,r.call(o,new Er(t,o,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var i=o.getLayer(e)?o.queryRenderedFeatures(t.point,{layers:[e]}):[];i.length&&(t.features=i,r.call(o,t),delete t.features)},n)}}();for(var s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(a),a.delegates)o.on(s,a.delegates[s]);return this},n.prototype.off=function(t,e,r){if(void 0===r)return i.prototype.off.call(this,t,e);if(this._delegatedListeners&&this._delegatedListeners[t])for(var n=this._delegatedListeners[t],o=0;o180;){var a=r.locationPoint(t);if(a.x>=0&&a.y>=0&&a.x<=r.width&&a.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}Xr.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},Xr.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Mr(t,{button:"left",element:this._compass}),r.addEventListener(this._compass,"mousedown",this._handler.onMouseDown),this._handler.enable()),this._container},Xr.prototype.onRemove=function(){r.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),r.removeEventListener(this._compass,"mousedown",this._handler.onMouseDown),this._handler.disable(),delete this._handler),delete this._map},Xr.prototype._createButton=function(t,e,i){var n=r.create("button",t,this._container);return n.type="button",n.setAttribute("aria-label",e),n.addEventListener("click",i),n};var Kr={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Yr(t,e,r){var i=t.classList;for(var n in Kr)i.remove("mapboxgl-"+r+"-anchor-"+n);i.add("mapboxgl-"+r+"-anchor-"+e)}var Jr,Qr=function(e){function i(i){if(e.call(this),(arguments[0]instanceof t.default$1.HTMLElement||2===arguments.length)&&(i=t.extend({element:i},arguments[1])),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._draggable=i&&i.draggable||!1,this._state="inactive",i&&i.element)this._element=i.element,this._offset=t.default.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=r.create("div");var n=r.createNS("http://www.w3.org/2000/svg","svg");n.setAttributeNS(null,"height","41px"),n.setAttributeNS(null,"width","27px"),n.setAttributeNS(null,"viewBox","0 0 27 41");var o=r.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");var a=r.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");var s=r.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");for(var l=0,u=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];l5280?oi(e,u,p/5280,"mi"):oi(e,u,p,"ft")}else r&&"nautical"===r.unit?oi(e,u,h/1852,"nm"):oi(e,u,h,"m")}function oi(t,e,r,i){var n,o,a,s=(n=r,(o=Math.pow(10,(""+Math.floor(n)).length-1))*(a=(a=n/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:1)),l=s/r;"m"===i&&s>=1e3&&(s/=1e3,i="km"),t.style.width=e*l+"px",t.innerHTML=s+i}ii.prototype.getDefaultPosition=function(){return"bottom-left"},ii.prototype._onMove=function(){ni(this._map,this._container,this.options)},ii.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},ii.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},ii.prototype.setUnit=function(t){this.options.unit=t,ni(this._map,this._container,this.options)};var ai=function(){this._fullscreen=!1,t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.default$1.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.default$1.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.default$1.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.default$1.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl"};ai.prototype.onAdd=function(e){return this._map=e,this._mapContainer=this._map.getContainer(),this._container=r.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._container.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._container},ai.prototype.onRemove=function(){r.remove(this._container),this._map=null,t.default$1.document.removeEventListener(this._fullscreenchange,this._changeIcon)},ai.prototype._checkFullscreenSupport=function(){return!!(t.default$1.document.fullscreenEnabled||t.default$1.document.mozFullScreenEnabled||t.default$1.document.msFullscreenEnabled||t.default$1.document.webkitFullscreenEnabled)},ai.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button",this._className+"-icon "+this._className+"-fullscreen",this._container);e.setAttribute("aria-label","Toggle fullscreen"),e.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.default$1.document.addEventListener(this._fullscreenchange,this._changeIcon)},ai.prototype._isFullscreen=function(){return this._fullscreen},ai.prototype._changeIcon=function(){(t.default$1.document.fullscreenElement||t.default$1.document.mozFullScreenElement||t.default$1.document.webkitFullscreenElement||t.default$1.document.msFullscreenElement)===this._mapContainer!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"))},ai.prototype._onClickFullscreen=function(){this._isFullscreen()?t.default$1.document.exitFullscreen?t.default$1.document.exitFullscreen():t.default$1.document.mozCancelFullScreen?t.default$1.document.mozCancelFullScreen():t.default$1.document.msExitFullscreen?t.default$1.document.msExitFullscreen():t.default$1.document.webkitCancelFullScreen&&t.default$1.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen()};var si={closeButton:!0,closeOnClick:!0,className:""},li=function(e){function i(r){e.call(this),this.options=t.extend(Object.create(si),r),t.bindAll(["_update","_onClickClose"],this)}return e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i,i.prototype.addTo=function(e){return this._map=e,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this.fire(new t.Event("open")),this},i.prototype.isOpen=function(){return!!this._map},i.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire(new t.Event("close")),this},i.prototype.getLngLat=function(){return this._lngLat},i.prototype.setLngLat=function(t){return this._lngLat=R.convert(t),this._pos=null,this._update(),this},i.prototype.setText=function(e){return this.setDOMContent(t.default$1.document.createTextNode(e))},i.prototype.setHTML=function(e){var r,i=t.default$1.document.createDocumentFragment(),n=t.default$1.document.createElement("body");for(n.innerHTML=e;r=n.firstChild;)i.appendChild(r);return this.setDOMContent(i)},i.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},i.prototype._createContent=function(){this._content&&r.remove(this._content),this._content=r.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},i.prototype._update=function(){var e=this;if(this._map&&this._lngLat&&this._content){this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(t){return e._container.classList.add(t)})),this._map.transform.renderWorldCopies&&(this._lngLat=Hr(this._lngLat,this._pos,this._map.transform));var i=this._pos=this._map.project(this._lngLat),n=this.options.anchor,o=function e(r){if(r){if("number"==typeof r){var i=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.default(0,0),top:new t.default(0,r),"top-left":new t.default(i,i),"top-right":new t.default(-i,i),bottom:new t.default(0,-r),"bottom-left":new t.default(i,-i),"bottom-right":new t.default(-i,-i),left:new t.default(r,0),right:new t.default(-r,0)}}if(r instanceof t.default||Array.isArray(r)){var n=t.default.convert(r);return{center:n,top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}return{center:t.default.convert(r.center||[0,0]),top:t.default.convert(r.top||[0,0]),"top-left":t.default.convert(r["top-left"]||[0,0]),"top-right":t.default.convert(r["top-right"]||[0,0]),bottom:t.default.convert(r.bottom||[0,0]),"bottom-left":t.default.convert(r["bottom-left"]||[0,0]),"bottom-right":t.default.convert(r["bottom-right"]||[0,0]),left:t.default.convert(r.left||[0,0]),right:t.default.convert(r.right||[0,0])}}return e(new t.default(0,0))}(this.options.offset);if(!n){var a,s=this._container.offsetWidth,l=this._container.offsetHeight;a=i.y+o.bottom.ythis._map.transform.height-l?["bottom"]:[],i.xthis._map.transform.width-s/2&&a.push("right"),n=0===a.length?"bottom":a.join("-")}var u=i.add(o[n]).round();r.setTransform(this._container,Kr[n]+" translate("+u.x+"px,"+u.y+"px)"),Yr(this._container,n,"popup")}},i.prototype._onClickClose=function(){this.remove()},i}(t.Evented),ui={version:"0.47.0",supported:e,workerCount:Math.max(Math.floor(t.default$2.hardwareConcurrency/2),1),setRTLTextPlugin:t.setRTLTextPlugin,Map:Zr,NavigationControl:Xr,GeolocateControl:ei,AttributionControl:Vr,ScaleControl:ii,FullscreenControl:ai,Popup:li,Marker:Qr,Style:Ve,LngLat:R,LngLatBounds:B,Point:t.default,Evented:t.Evented,config:h,get accessToken(){return h.ACCESS_TOKEN},set accessToken(t){h.ACCESS_TOKEN=t},workerUrl:""};return ui}),r}); },{}],110:[function(require,module,exports){ "use strict";var inherits=require("inherits"),HashBase=require("hash-base"),Buffer=require("safe-buffer").Buffer,ARRAY16=new Array(16);function MD5(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(n,f){return n<>>32-f}function fnF(n,f,t,i,s,e,r){return rotl(n+(f&t|~f&i)+s+e|0,r)+f|0}function fnG(n,f,t,i,s,e,r){return rotl(n+(f&i|t&~i)+s+e|0,r)+f|0}function fnH(n,f,t,i,s,e,r){return rotl(n+(f^t^i)+s+e|0,r)+f|0}function fnI(n,f,t,i,s,e,r){return rotl(n+(t^(f|~i))+s+e|0,r)+f|0}inherits(MD5,HashBase),MD5.prototype._update=function(){for(var n=ARRAY16,f=0;f<16;++f)n[f]=this._block.readInt32LE(4*f);var t=this._a,i=this._b,s=this._c,e=this._d;t=fnF(t,i,s,e,n[0],3614090360,7),e=fnF(e,t,i,s,n[1],3905402710,12),s=fnF(s,e,t,i,n[2],606105819,17),i=fnF(i,s,e,t,n[3],3250441966,22),t=fnF(t,i,s,e,n[4],4118548399,7),e=fnF(e,t,i,s,n[5],1200080426,12),s=fnF(s,e,t,i,n[6],2821735955,17),i=fnF(i,s,e,t,n[7],4249261313,22),t=fnF(t,i,s,e,n[8],1770035416,7),e=fnF(e,t,i,s,n[9],2336552879,12),s=fnF(s,e,t,i,n[10],4294925233,17),i=fnF(i,s,e,t,n[11],2304563134,22),t=fnF(t,i,s,e,n[12],1804603682,7),e=fnF(e,t,i,s,n[13],4254626195,12),s=fnF(s,e,t,i,n[14],2792965006,17),t=fnG(t,i=fnF(i,s,e,t,n[15],1236535329,22),s,e,n[1],4129170786,5),e=fnG(e,t,i,s,n[6],3225465664,9),s=fnG(s,e,t,i,n[11],643717713,14),i=fnG(i,s,e,t,n[0],3921069994,20),t=fnG(t,i,s,e,n[5],3593408605,5),e=fnG(e,t,i,s,n[10],38016083,9),s=fnG(s,e,t,i,n[15],3634488961,14),i=fnG(i,s,e,t,n[4],3889429448,20),t=fnG(t,i,s,e,n[9],568446438,5),e=fnG(e,t,i,s,n[14],3275163606,9),s=fnG(s,e,t,i,n[3],4107603335,14),i=fnG(i,s,e,t,n[8],1163531501,20),t=fnG(t,i,s,e,n[13],2850285829,5),e=fnG(e,t,i,s,n[2],4243563512,9),s=fnG(s,e,t,i,n[7],1735328473,14),t=fnH(t,i=fnG(i,s,e,t,n[12],2368359562,20),s,e,n[5],4294588738,4),e=fnH(e,t,i,s,n[8],2272392833,11),s=fnH(s,e,t,i,n[11],1839030562,16),i=fnH(i,s,e,t,n[14],4259657740,23),t=fnH(t,i,s,e,n[1],2763975236,4),e=fnH(e,t,i,s,n[4],1272893353,11),s=fnH(s,e,t,i,n[7],4139469664,16),i=fnH(i,s,e,t,n[10],3200236656,23),t=fnH(t,i,s,e,n[13],681279174,4),e=fnH(e,t,i,s,n[0],3936430074,11),s=fnH(s,e,t,i,n[3],3572445317,16),i=fnH(i,s,e,t,n[6],76029189,23),t=fnH(t,i,s,e,n[9],3654602809,4),e=fnH(e,t,i,s,n[12],3873151461,11),s=fnH(s,e,t,i,n[15],530742520,16),t=fnI(t,i=fnH(i,s,e,t,n[2],3299628645,23),s,e,n[0],4096336452,6),e=fnI(e,t,i,s,n[7],1126891415,10),s=fnI(s,e,t,i,n[14],2878612391,15),i=fnI(i,s,e,t,n[5],4237533241,21),t=fnI(t,i,s,e,n[12],1700485571,6),e=fnI(e,t,i,s,n[3],2399980690,10),s=fnI(s,e,t,i,n[10],4293915773,15),i=fnI(i,s,e,t,n[1],2240044497,21),t=fnI(t,i,s,e,n[8],1873313359,6),e=fnI(e,t,i,s,n[15],4264355552,10),s=fnI(s,e,t,i,n[6],2734768916,15),i=fnI(i,s,e,t,n[13],1309151649,21),t=fnI(t,i,s,e,n[4],4149444226,6),e=fnI(e,t,i,s,n[11],3174756917,10),s=fnI(s,e,t,i,n[2],718787259,15),i=fnI(i,s,e,t,n[9],3951481745,21),this._a=this._a+t|0,this._b=this._b+i|0,this._c=this._c+s|0,this._d=this._d+e|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var n=Buffer.allocUnsafe(16);return n.writeInt32LE(this._a,0),n.writeInt32LE(this._b,4),n.writeInt32LE(this._c,8),n.writeInt32LE(this._d,12),n},module.exports=MD5; },{"hash-base":87,"inherits":102,"safe-buffer":148}],111:[function(require,module,exports){ var bn=require("bn.js"),brorand=require("brorand");function MillerRabin(r){this.rand=r||new brorand.Rand}module.exports=MillerRabin,MillerRabin.create=function(r){return new MillerRabin(r)},MillerRabin.prototype._randbelow=function(r){var n=r.bitLength(),e=Math.ceil(n/8);do{var t=new bn(this.rand.generate(e))}while(t.cmp(r)>=0);return t},MillerRabin.prototype._randrange=function(r,n){var e=n.sub(r);return r.add(this._randbelow(e))},MillerRabin.prototype.test=function(r,n,e){var t=r.bitLength(),a=bn.mont(r),i=new bn(1).toRed(a);n||(n=Math.max(1,t/48|0));for(var o=r.subn(1),b=0;!o.testn(b);b++);for(var d=r.shrn(b),u=o.toRed(a);n>0;n--){var f=this._randrange(new bn(2),o);e&&e(f);var c=f.toRed(a).redPow(d);if(0!==c.cmp(i)&&0!==c.cmp(u)){for(var l=1;l0;n--){var u=this._randrange(new bn(2),i),f=r.gcd(u);if(0!==f.cmpn(1))return f;var c=u.toRed(t).redPow(b);if(0!==c.cmp(a)&&0!==c.cmp(d)){for(var l=1;l>8,a=255&o;u?e.push(u,a):e.push(a)}return e}function zero2(r){return 1===r.length?"0"+r:r}function toHex(r){for(var t="",e=0;e=6?"utf-8":"binary"}module.exports=defaultEncoding; }).call(this,require('_process')) },{"_process":125}],122:[function(require,module,exports){ (function (Buffer){ var MAX_ALLOC=Math.pow(2,30)-1;function checkBuffer(r,e){if("string"!=typeof r&&!Buffer.isBuffer(r))throw new TypeError(e+" must be a buffer or string")}module.exports=function(r,e,o,t){if(checkBuffer(r,"Password"),checkBuffer(e,"Salt"),"number"!=typeof o)throw new TypeError("Iterations not a number");if(o<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>MAX_ALLOC||t!=t)throw new TypeError("Bad key length")}; }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) },{"../../is-buffer/index.js":103}],123:[function(require,module,exports){ var md5=require("create-hash/md5"),RIPEMD160=require("ripemd160"),sha=require("sha.js"),checkParameters=require("./precondition"),defaultEncoding=require("./default-encoding"),Buffer=require("safe-buffer").Buffer,ZEROS=Buffer.alloc(128),sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(e,r,a){var s=getDigest(e),f="sha512"===e||"sha384"===e?128:64;r.length>f?r=s(r):r.length1)for(var r=1;r=e.length){i++;break}var f=e.slice(2,o-1);if(("0002"!==n.toString("hex")&&!t||"0001"!==n.toString("hex")&&t)&&i++,f.length<8&&i++,i)throw new Error("decryption error");return e.slice(o)}function compare(r,e){r=Buffer.from(r),e=Buffer.from(e);var t=0,n=r.length;r.length!==e.length&&(t++,n=Math.min(r.length,e.length));for(var o=-1;++of||new BN(e).cmp(i.modulus)>=0)throw new Error("decryption error");o=t?withPublic(new BN(e),i):crt(e,i);var u=Buffer.alloc(f-o.length);if(o=Buffer.concat([u,o],f),4===n)return oaep(i,o);if(1===n)return pkcs1(i,o,t);if(3===n)return o;throw new Error("unknown padding")}; },{"./mgf":127,"./withPublic":130,"./xor":131,"bn.js":18,"browserify-rsa":41,"create-hash":53,"parse-asn1":118,"safe-buffer":148}],129:[function(require,module,exports){ var parseKeys=require("parse-asn1"),randomBytes=require("randombytes"),createHash=require("create-hash"),mgf=require("./mgf"),xor=require("./xor"),BN=require("bn.js"),withPublic=require("./withPublic"),crt=require("browserify-rsa"),Buffer=require("safe-buffer").Buffer;function oaep(r,e){var o=r.modulus.byteLength(),n=e.length,f=createHash("sha1").update(Buffer.alloc(0)).digest(),u=f.length,t=2*u;if(n>o-t-2)throw new Error("message too long");var a=Buffer.alloc(o-n-t-2),l=o-u-1,i=randomBytes(u),c=xor(Buffer.concat([f,a,Buffer.alloc(1,1),e],l),mgf(i,l)),s=xor(i,mgf(c,u));return new BN(Buffer.concat([Buffer.alloc(1),s,c],o))}function pkcs1(r,e,o){var n,f=e.length,u=r.modulus.byteLength();if(f>u-11)throw new Error("message too long");return n=o?Buffer.alloc(u-f-3,255):nonZero(u-f-3),new BN(Buffer.concat([Buffer.from([0,o?1:2]),n,Buffer.alloc(1),e],u))}function nonZero(r){for(var e,o=Buffer.allocUnsafe(r),n=0,f=randomBytes(2*r),u=0;n=0)throw new Error("data too long for modulus")}return o?crt(f,u):withPublic(f,u)}; },{"./mgf":127,"./withPublic":130,"./xor":131,"bn.js":18,"browserify-rsa":41,"create-hash":53,"parse-asn1":118,"randombytes":132,"safe-buffer":148}],130:[function(require,module,exports){ var BN=require("bn.js"),Buffer=require("safe-buffer").Buffer;function withPublic(e,r){return Buffer.from(e.toRed(BN.mont(r.modulus)).redPow(new BN(r.publicExponent)).fromRed().toArray())}module.exports=withPublic; },{"bn.js":18,"safe-buffer":148}],131:[function(require,module,exports){ module.exports=function(r,e){for(var n=r.length,o=-1;++o65536)throw new Error("requested too many random bytes");var o=new global.Uint8Array(r);r>0&&crypto.getRandomValues(o);var t=Buffer.from(o.buffer);return"function"==typeof e?process.nextTick(function(){e(null,t)}):t}crypto&&crypto.getRandomValues?module.exports=randomBytes:module.exports=oldBrowser; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":125,"safe-buffer":148}],133:[function(require,module,exports){ (function (process,global){ "use strict";function oldBrowser(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var safeBuffer=require("safe-buffer"),randombytes=require("randombytes"),Buffer=safeBuffer.Buffer,kBufferMaxLength=safeBuffer.kMaxLength,crypto=global.crypto||global.msCrypto,kMaxUint32=Math.pow(2,32)-1;function assertOffset(r,e){if("number"!=typeof r||r!=r)throw new TypeError("offset must be a number");if(r>kMaxUint32||r<0)throw new TypeError("offset must be a uint32");if(r>kBufferMaxLength||r>e)throw new RangeError("offset out of range")}function assertSize(r,e,n){if("number"!=typeof r||r!=r)throw new TypeError("size must be a number");if(r>kMaxUint32||r<0)throw new TypeError("size must be a uint32");if(r+e>n||r>kBufferMaxLength)throw new RangeError("buffer too small")}function randomFill(r,e,n,t){if(!(Buffer.isBuffer(r)||r instanceof global.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)t=e,e=0,n=r.length;else if("function"==typeof n)t=n,n=r.length-e;else if("function"!=typeof t)throw new TypeError('"cb" argument must be a function');return assertOffset(e,r.length),assertSize(n,e,r.length),actualFill(r,e,n,t)}function actualFill(r,e,n,t){if(process.browser){var o=r.buffer,f=new Uint8Array(o,e,n);return crypto.getRandomValues(f),t?void process.nextTick(function(){t(null,r)}):r}if(!t)return randombytes(n).copy(r,e),r;randombytes(n,function(n,o){if(n)return t(n);o.copy(r,e),t(null,r)})}function randomFillSync(r,e,n){if(void 0===e&&(e=0),!(Buffer.isBuffer(r)||r instanceof global.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return assertOffset(e,r.length),void 0===n&&(n=r.length-e),assertSize(n,e,r.length),actualFill(r,e,n)}crypto&&crypto.getRandomValues||!process.browser?(exports.randomFill=randomFill,exports.randomFillSync=randomFillSync):(exports.randomFill=oldBrowser,exports.randomFillSync=oldBrowser); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":125,"randombytes":132,"safe-buffer":148}],134:[function(require,module,exports){ module.exports=require("./lib/_stream_duplex.js"); },{"./lib/_stream_duplex.js":135}],135:[function(require,module,exports){ "use strict";var pna=require("process-nextick-args"),objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};module.exports=Duplex;var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");util.inherits(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v0?("string"==typeof t||d.objectMode||Object.getPrototypeOf(t)===Buffer.prototype||(t=_uint8ArrayToBuffer(t)),n?d.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):addChunk(e,d,t,!0):d.ended?e.emit("error",new Error("stream.push() after EOF")):(d.reading=!1,d.decoder&&!r?(t=d.decoder.write(t),d.objectMode||0!==t.length?addChunk(e,d,t,!1):maybeReadMore(e,d)):addChunk(e,d,t,!1))):n||(d.reading=!1));return needMoreData(d)}function addChunk(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&emitReadable(e)),maybeReadMore(e,t)}function chunkInvalid(e,t){var r;return _isUint8Array(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function needMoreData(e){return!e.ended&&(e.needReadable||e.length=MAX_HWM?e=MAX_HWM:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function howMuchToRead(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=computeNewHighWaterMark(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function onEofChunk(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,emitReadable(e)}}function emitReadable(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(debug("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?pna.nextTick(emitReadable_,e):emitReadable_(e))}function emitReadable_(e){debug("emit readable"),e.emit("readable"),flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,pna.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=fromListPartial(e,t.buffer,t.decoder),r);var r}function fromListPartial(e,t,r){var n;return ei.length?i.length:e;if(d===i.length?a+=i:a+=i.slice(0,e),0===(e-=d)){d===i.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(d));break}++n}return t.length-=n,a}function copyFromBuffer(e,t){var r=Buffer.allocUnsafe(e),n=t.head,a=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var i=n.data,d=e>i.length?i.length:e;if(i.copy(r,r.length-e,0,d),0===(e-=d)){d===i.length?(++a,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(d));break}++a}return t.length-=a,r}function endReadable(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,pna.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function indexOf(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return debug("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var n,a=t.needReadable;return debug("need readable",a),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==n&&this.emit("data",n),n},Readable.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,debug("pipe count=%d opts=%j",n.pipesCount,t);var a=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?d:b;function i(t,a){debug("onunpipe"),t===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,debug("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",o),e.removeListener("error",h),e.removeListener("unpipe",i),r.removeListener("end",d),r.removeListener("end",b),r.removeListener("data",s),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||o())}function d(){debug("onend"),e.end()}n.endEmitted?pna.nextTick(a):r.once("end",a),e.on("unpipe",i);var o=pipeOnDrain(r);e.on("drain",o);var u=!1;var l=!1;function s(t){debug("ondata"),l=!1,!1!==e.write(t)||l||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==indexOf(n.pipes,e))&&!u&&(debug("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,l=!0),r.pause())}function h(t){debug("onerror",t),b(),e.removeListener("error",h),0===EElistenerCount(e,"error")&&e.emit("error",t)}function f(){e.removeListener("finish",p),b()}function p(){debug("onfinish"),e.removeListener("close",f),b()}function b(){debug("unpipe"),r.unpipe(e)}return r.on("data",s),prependListener(e,"error",h),e.once("close",f),e.once("finish",p),e.emit("pipe",r),n.flowing||(debug("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,a=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?setImmediate:pna.nextTick;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")},Stream=require("./internal/streams/stream"),Buffer=require("safe-buffer").Buffer,OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(e){return Buffer.from(e)}function _isUint8Array(e){return Buffer.isBuffer(e)||e instanceof OurUint8Array}var realHasInstance,destroyImpl=require("./internal/streams/destroy");function nop(){}function WritableState(e,t){Duplex=Duplex||require("./_stream_duplex"),e=e||{};var i=t instanceof Duplex;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,n=e.writableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(n||0===n)?n:o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){onwrite(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(e){if(Duplex=Duplex||require("./_stream_duplex"),!(realHasInstance.call(Writable,this)||this instanceof Duplex))return new Writable(e);this._writableState=new WritableState(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),Stream.call(this)}function writeAfterEnd(e,t){var i=new Error("write after end");e.emit("error",i),pna.nextTick(t,i)}function validChunk(e,t,i,r){var n=!0,o=!1;return null===i?o=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),pna.nextTick(r,o),n=!1),n}function decodeChunk(e,t,i){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Buffer.from(t,i)),t}function writeOrBuffer(e,t,i,r,n,o){if(!i){var a=decodeChunk(t,r,n);r!==a&&(i=!0,n="buffer",r=a)}var f=t.objectMode?1:r.length;t.length+=f;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,i){var r=this._writableState;"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||endWritable(this,r,i)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(e,t){this.end(),t(e)}; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) },{"./_stream_duplex":135,"./internal/streams/destroy":141,"./internal/streams/stream":142,"_process":125,"core-util-is":51,"inherits":102,"process-nextick-args":124,"safe-buffer":148,"timers":159,"util-deprecate":160}],140:[function(require,module,exports){ "use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Buffer=require("safe-buffer").Buffer,util=require("util");function copyBuffer(t,e,i){t.copy(e,i)}module.exports=function(){function t(){_classCallCheck(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,i=""+e.data;e=e.next;)i+=t+e.data;return i},t.prototype.concat=function(t){if(0===this.length)return Buffer.alloc(0);if(1===this.length)return this.head.data;for(var e=Buffer.allocUnsafe(t>>>0),i=this.head,n=0;i;)copyBuffer(i.data,e,n),n+=i.data.length,i=i.next;return e},t}(),util&&util.inspect&&util.inspect.custom&&(module.exports.prototype[util.inspect.custom]=function(){var t=util.inspect({length:this.length});return this.constructor.name+" "+t}); },{"safe-buffer":148,"util":20}],141:[function(require,module,exports){ "use strict";var pna=require("process-nextick-args");function destroy(t,e){var r=this,a=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return a||i?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||pna.nextTick(emitErrorNT,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(pna.nextTick(emitErrorNT,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)}),this)}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(t,e){t.emit("error",e)}module.exports={destroy:destroy,undestroy:undestroy}; },{"process-nextick-args":124}],142:[function(require,module,exports){ module.exports=require("events").EventEmitter; },{"events":85}],143:[function(require,module,exports){ module.exports=require("./readable").PassThrough; },{"./readable":144}],144:[function(require,module,exports){ exports=module.exports=require("./lib/_stream_readable.js"),exports.Stream=exports,exports.Readable=exports,exports.Writable=require("./lib/_stream_writable.js"),exports.Duplex=require("./lib/_stream_duplex.js"),exports.Transform=require("./lib/_stream_transform.js"),exports.PassThrough=require("./lib/_stream_passthrough.js"); },{"./lib/_stream_duplex.js":135,"./lib/_stream_passthrough.js":136,"./lib/_stream_readable.js":137,"./lib/_stream_transform.js":138,"./lib/_stream_writable.js":139}],145:[function(require,module,exports){ module.exports=require("./readable").Transform; },{"./readable":144}],146:[function(require,module,exports){ module.exports=require("./lib/_stream_writable.js"); },{"./lib/_stream_writable.js":139}],147:[function(require,module,exports){ "use strict";var Buffer=require("buffer").Buffer,inherits=require("inherits"),HashBase=require("hash-base"),ARRAY16=new Array(16),zl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(t,s){return t<>>32-s}function fn1(t,s,r,i,h,e,n,f){return rotl(t+(s^r^i)+e+n|0,f)+h|0}function fn2(t,s,r,i,h,e,n,f){return rotl(t+(s&r|~s&i)+e+n|0,f)+h|0}function fn3(t,s,r,i,h,e,n,f){return rotl(t+((s|~r)^i)+e+n|0,f)+h|0}function fn4(t,s,r,i,h,e,n,f){return rotl(t+(s&i|r&~i)+e+n|0,f)+h|0}function fn5(t,s,r,i,h,e,n,f){return rotl(t+(s^(r|~i))+e+n|0,f)+h|0}inherits(RIPEMD160,HashBase),RIPEMD160.prototype._update=function(){for(var t=ARRAY16,s=0;s<16;++s)t[s]=this._block.readInt32LE(4*s);for(var r=0|this._a,i=0|this._b,h=0|this._c,e=0|this._d,n=0|this._e,f=0|this._a,l=0|this._b,_=0|this._c,o=0|this._d,c=0|this._e,u=0;u<80;u+=1){var a,b;u<16?(a=fn1(r,i,h,e,n,t[zl[u]],hl[0],sl[u]),b=fn5(f,l,_,o,c,t[zr[u]],hr[0],sr[u])):u<32?(a=fn2(r,i,h,e,n,t[zl[u]],hl[1],sl[u]),b=fn4(f,l,_,o,c,t[zr[u]],hr[1],sr[u])):u<48?(a=fn3(r,i,h,e,n,t[zl[u]],hl[2],sl[u]),b=fn3(f,l,_,o,c,t[zr[u]],hr[2],sr[u])):u<64?(a=fn4(r,i,h,e,n,t[zl[u]],hl[3],sl[u]),b=fn2(f,l,_,o,c,t[zr[u]],hr[3],sr[u])):(a=fn5(r,i,h,e,n,t[zl[u]],hl[4],sl[u]),b=fn1(f,l,_,o,c,t[zr[u]],hr[4],sr[u])),r=n,n=e,e=rotl(h,10),h=i,i=a,f=c,c=o,o=rotl(_,10),_=l,l=b}var E=this._b+h+o|0;this._b=this._c+e+c|0,this._c=this._d+n+f|0,this._d=this._e+r+l|0,this._e=this._a+i+_|0,this._a=E},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=Buffer.alloc?Buffer.alloc(20):new Buffer(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},module.exports=RIPEMD160; },{"buffer":49,"hash-base":87,"inherits":102}],148:[function(require,module,exports){ var buffer=require("buffer"),Buffer=buffer.Buffer;function copyProps(f,r){for(var e in f)r[e]=f[e]}function SafeBuffer(f,r,e){return Buffer(f,r,e)}Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?module.exports=buffer:(copyProps(buffer,exports),exports.Buffer=SafeBuffer),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(f,r,e){if("number"==typeof f)throw new TypeError("Argument must not be a number");return Buffer(f,r,e)},SafeBuffer.alloc=function(f,r,e){if("number"!=typeof f)throw new TypeError("Argument must be a number");var u=Buffer(f);return void 0!==r?"string"==typeof e?u.fill(r,e):u.fill(r):u.fill(0),u},SafeBuffer.allocUnsafe=function(f){if("number"!=typeof f)throw new TypeError("Argument must be a number");return Buffer(f)},SafeBuffer.allocUnsafeSlow=function(f){if("number"!=typeof f)throw new TypeError("Argument must be a number");return buffer.SlowBuffer(f)}; },{"buffer":49}],149:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer;function Hash(t,i){this._block=Buffer.alloc(t),this._finalSize=i,this._blockSize=t,this._len=0}Hash.prototype.update=function(t,i){"string"==typeof t&&(i=i||"utf8",t=Buffer.from(t,i));for(var e=this._block,s=this._blockSize,h=t.length,o=this._len,l=0;l=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var s=(4294967295&e)>>>0,h=(e-s)/4294967296;this._block.writeUInt32BE(h,this._blockSize-8),this._block.writeUInt32BE(s,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},module.exports=Hash; },{"safe-buffer":148}],150:[function(require,module,exports){ var exports=module.exports=function(e){e=e.toLowerCase();var r=exports[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};exports.sha=require("./sha"),exports.sha1=require("./sha1"),exports.sha224=require("./sha224"),exports.sha256=require("./sha256"),exports.sha384=require("./sha384"),exports.sha512=require("./sha512"); },{"./sha":151,"./sha1":152,"./sha224":153,"./sha256":154,"./sha384":155,"./sha512":156}],151:[function(require,module,exports){ var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl5(t){return t<<5|t>>>27}function rotl30(t){return t<<30|t>>>2}function ft(t,i,r,h){return 0===t?i&r|~i&h:2===t?i&r|i&h|r&h:i^r^h}inherits(Sha,Hash),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(t){for(var i=this._w,r=0|this._a,h=0|this._b,s=0|this._c,e=0|this._d,n=0|this._e,_=0;_<16;++_)i[_]=t.readInt32BE(4*_);for(;_<80;++_)i[_]=i[_-3]^i[_-8]^i[_-14]^i[_-16];for(var a=0;a<80;++a){var o=~~(a/20),f=rotl5(r)+ft(o,h,s,e)+n+i[a]+K[o]|0;n=e,e=s,s=rotl30(h),h=r,r=f}this._a=r+this._a|0,this._b=h+this._b|0,this._c=s+this._c|0,this._d=e+this._d|0,this._e=n+this._e|0},Sha.prototype._hash=function(){var t=Buffer.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},module.exports=Sha; },{"./hash":149,"inherits":102,"safe-buffer":148}],152:[function(require,module,exports){ var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha1(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl1(t){return t<<1|t>>>31}function rotl5(t){return t<<5|t>>>27}function rotl30(t){return t<<30|t>>>2}function ft(t,i,r,h){return 0===t?i&r|~i&h:2===t?i&r|i&h|r&h:i^r^h}inherits(Sha1,Hash),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(t){for(var i=this._w,r=0|this._a,h=0|this._b,s=0|this._c,e=0|this._d,n=0|this._e,_=0;_<16;++_)i[_]=t.readInt32BE(4*_);for(;_<80;++_)i[_]=rotl1(i[_-3]^i[_-8]^i[_-14]^i[_-16]);for(var a=0;a<80;++a){var o=~~(a/20),f=rotl5(r)+ft(o,h,s,e)+n+i[a]+K[o]|0;n=e,e=s,s=rotl30(h),h=r,r=f}this._a=r+this._a|0,this._b=h+this._b|0,this._c=s+this._c|0,this._d=e+this._d|0,this._e=n+this._e|0},Sha1.prototype._hash=function(){var t=Buffer.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},module.exports=Sha1; },{"./hash":149,"inherits":102,"safe-buffer":148}],153:[function(require,module,exports){ var inherits=require("inherits"),Sha256=require("./sha256"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(64);function Sha224(){this.init(),this._w=W,Hash.call(this,64,56)}inherits(Sha224,Sha256),Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Sha224.prototype._hash=function(){var t=Buffer.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},module.exports=Sha224; },{"./hash":149,"./sha256":154,"inherits":102,"safe-buffer":148}],154:[function(require,module,exports){ var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],W=new Array(64);function Sha256(){this.init(),this._w=W,Hash.call(this,64,56)}function ch(t,i,h){return h^t&(i^h)}function maj(t,i,h){return t&i|h&(t|i)}function sigma0(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function sigma1(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function gamma0(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function gamma1(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}inherits(Sha256,Hash),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(t){for(var i=this._w,h=0|this._a,s=0|this._b,r=0|this._c,e=0|this._d,n=0|this._e,_=0|this._f,a=0|this._g,f=0|this._h,u=0;u<16;++u)i[u]=t.readInt32BE(4*u);for(;u<64;++u)i[u]=gamma1(i[u-2])+i[u-7]+gamma0(i[u-15])+i[u-16]|0;for(var o=0;o<64;++o){var c=f+sigma1(n)+ch(n,_,a)+K[o]+i[o]|0,m=sigma0(h)+maj(h,s,r)|0;f=a,a=_,_=n,n=e+c|0,e=r,r=s,s=h,h=c+m|0}this._a=h+this._a|0,this._b=s+this._b|0,this._c=r+this._c|0,this._d=e+this._d|0,this._e=n+this._e|0,this._f=_+this._f|0,this._g=a+this._g|0,this._h=f+this._h|0},Sha256.prototype._hash=function(){var t=Buffer.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},module.exports=Sha256; },{"./hash":149,"inherits":102,"safe-buffer":148}],155:[function(require,module,exports){ var inherits=require("inherits"),SHA512=require("./sha512"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash.call(this,128,112)}inherits(Sha384,SHA512),Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Sha384.prototype._hash=function(){var h=Buffer.allocUnsafe(48);function i(i,t,s){h.writeInt32BE(i,s),h.writeInt32BE(t,s+4)}return i(this._ah,this._al,0),i(this._bh,this._bl,8),i(this._ch,this._cl,16),i(this._dh,this._dl,24),i(this._eh,this._el,32),i(this._fh,this._fl,40),h},module.exports=Sha384; },{"./hash":149,"./sha512":156,"inherits":102,"safe-buffer":148}],156:[function(require,module,exports){ var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W=new Array(160);function Sha512(){this.init(),this._w=W,Hash.call(this,128,112)}function Ch(h,t,i){return i^h&(t^i)}function maj(h,t,i){return h&t|i&(h|t)}function sigma0(h,t){return(h>>>28|t<<4)^(t>>>2|h<<30)^(t>>>7|h<<25)}function sigma1(h,t){return(h>>>14|t<<18)^(h>>>18|t<<14)^(t>>>9|h<<23)}function Gamma0(h,t){return(h>>>1|t<<31)^(h>>>8|t<<24)^h>>>7}function Gamma0l(h,t){return(h>>>1|t<<31)^(h>>>8|t<<24)^(h>>>7|t<<25)}function Gamma1(h,t){return(h>>>19|t<<13)^(t>>>29|h<<3)^h>>>6}function Gamma1l(h,t){return(h>>>19|t<<13)^(t>>>29|h<<3)^(h>>>6|t<<26)}function getCarry(h,t){return h>>>0>>0?1:0}inherits(Sha512,Hash),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(h){for(var t=this._w,i=0|this._ah,s=0|this._bh,r=0|this._ch,_=0|this._dh,a=0|this._eh,e=0|this._fh,l=0|this._gh,n=0|this._hh,f=0|this._al,g=0|this._bl,u=0|this._cl,c=0|this._dl,m=0|this._el,o=0|this._fl,y=0|this._gl,C=0|this._hl,d=0;d<32;d+=2)t[d]=h.readInt32BE(4*d),t[d+1]=h.readInt32BE(4*d+4);for(;d<160;d+=2){var b=t[d-30],p=t[d-30+1],G=Gamma0(b,p),v=Gamma0l(p,b),B=Gamma1(b=t[d-4],p=t[d-4+1]),S=Gamma1l(p,b),w=t[d-14],E=t[d-14+1],I=t[d-32],j=t[d-32+1],q=v+E|0,H=G+w+getCarry(q,v)|0;H=(H=H+B+getCarry(q=q+S|0,S)|0)+I+getCarry(q=q+j|0,j)|0,t[d]=H,t[d+1]=q}for(var W=0;W<160;W+=2){H=t[W],q=t[W+1];var x=maj(i,s,r),A=maj(f,g,u),U=sigma0(i,f),k=sigma0(f,i),z=sigma1(a,m),D=sigma1(m,a),F=K[W],J=K[W+1],L=Ch(a,e,l),M=Ch(m,o,y),N=C+D|0,O=n+z+getCarry(N,C)|0;O=(O=(O=O+L+getCarry(N=N+M|0,M)|0)+F+getCarry(N=N+J|0,J)|0)+H+getCarry(N=N+q|0,q)|0;var P=k+A|0,Q=U+x+getCarry(P,k)|0;n=l,C=y,l=e,y=o,e=a,o=m,a=_+O+getCarry(m=c+N|0,c)|0,_=r,c=u,r=s,u=g,s=i,g=f,i=O+Q+getCarry(f=N+P|0,N)|0}this._al=this._al+f|0,this._bl=this._bl+g|0,this._cl=this._cl+u|0,this._dl=this._dl+c|0,this._el=this._el+m|0,this._fl=this._fl+o|0,this._gl=this._gl+y|0,this._hl=this._hl+C|0,this._ah=this._ah+i+getCarry(this._al,f)|0,this._bh=this._bh+s+getCarry(this._bl,g)|0,this._ch=this._ch+r+getCarry(this._cl,u)|0,this._dh=this._dh+_+getCarry(this._dl,c)|0,this._eh=this._eh+a+getCarry(this._el,m)|0,this._fh=this._fh+e+getCarry(this._fl,o)|0,this._gh=this._gh+l+getCarry(this._gl,y)|0,this._hh=this._hh+n+getCarry(this._hl,C)|0},Sha512.prototype._hash=function(){var h=Buffer.allocUnsafe(64);function t(t,i,s){h.writeInt32BE(t,s),h.writeInt32BE(i,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),h},module.exports=Sha512; },{"./hash":149,"inherits":102,"safe-buffer":148}],157:[function(require,module,exports){ module.exports=Stream;var EE=require("events").EventEmitter,inherits=require("inherits");function Stream(){EE.call(this)}inherits(Stream,EE),Stream.Readable=require("readable-stream/readable.js"),Stream.Writable=require("readable-stream/writable.js"),Stream.Duplex=require("readable-stream/duplex.js"),Stream.Transform=require("readable-stream/transform.js"),Stream.PassThrough=require("readable-stream/passthrough.js"),Stream.Stream=Stream,Stream.prototype.pipe=function(e,r){var t=this;function n(r){e.writable&&!1===e.write(r)&&t.pause&&t.pause()}function a(){t.readable&&t.resume&&t.resume()}t.on("data",n),e.on("drain",a),e._isStdio||r&&!1===r.end||(t.on("end",i),t.on("close",s));var o=!1;function i(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function m(e){if(u(),0===EE.listenerCount(this,"error"))throw e}function u(){t.removeListener("data",n),e.removeListener("drain",a),t.removeListener("end",i),t.removeListener("close",s),t.removeListener("error",m),e.removeListener("error",m),t.removeListener("end",u),t.removeListener("close",u),e.removeListener("close",u)}return t.on("error",m),e.on("error",m),t.on("end",u),t.on("close",u),e.on("close",u),e.emit("pipe",t),e}; },{"events":85,"inherits":102,"readable-stream/duplex.js":134,"readable-stream/passthrough.js":143,"readable-stream/readable.js":144,"readable-stream/transform.js":145,"readable-stream/writable.js":146}],158:[function(require,module,exports){ "use strict";var Buffer=require("safe-buffer").Buffer,isEncoding=Buffer.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function normalizeEncoding(t){var e=_normalizeEncoding(t);if("string"!=typeof e&&(Buffer.isEncoding===isEncoding||!isEncoding(t)))throw new Error("Unknown encoding: "+t);return e||t}function StringDecoder(t){var e;switch(this.encoding=normalizeEncoding(t),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,e=4;break;case"utf8":this.fillLast=utf8FillLast,e=4;break;case"base64":this.text=base64Text,this.end=base64End,e=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer.allocUnsafe(e)}function utf8CheckByte(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function utf8CheckIncomplete(t,e,s){var i=e.length-1;if(i=0?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}function utf8CheckExtraBytes(t,e,s){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}function utf8FillLast(t){var e=this.lastTotal-this.lastNeed,s=utf8CheckExtraBytes(this,t,e);return void 0!==s?s:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function utf8Text(t,e){var s=utf8CheckIncomplete(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=s;var i=t.length-(s-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function utf8End(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function utf16Text(t,e){if((t.length-e)%2==0){var s=t.toString("utf16le",e);if(s){var i=s.charCodeAt(s.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],s.slice(0,-1)}return s}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function utf16End(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var s=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,s)}return e}function base64Text(t,e){var s=(t.length-e)%3;return 0===s?t.toString("base64",e):(this.lastNeed=3-s,this.lastTotal=3,1===s?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-s))}function base64End(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function simpleWrite(t){return t.toString(this.encoding)}function simpleEnd(t){return t&&t.length?this.write(t):""}exports.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(t){if(0===t.length)return"";var e,s;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";s=this.lastNeed,this.lastNeed=0}else s=0;return s=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(e){var t=nextImmediateId++,i=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[t]=!0,nextTick(function(){immediateIds[t]&&(i?e.apply(null,i):e.call(null),exports.clearImmediate(t))}),t},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(e){delete immediateIds[e]}; }).call(this,require("timers").setImmediate,require("timers").clearImmediate) },{"process/browser.js":125,"timers":159}],160:[function(require,module,exports){ (function (global){ function deprecate(r,e){if(config("noDeprecation"))return r;var o=!1;return function(){if(!o){if(config("throwDeprecation"))throw new Error(e);config("traceDeprecation")?console.trace(e):console.warn(e),o=!0}return r.apply(this,arguments)}}function config(r){try{if(!global.localStorage)return!1}catch(r){return!1}var e=global.localStorage[r];return null!=e&&"true"===String(e).toLowerCase()}module.exports=deprecate; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],161:[function(require,module,exports){ "use strict";!function(){var e,r,n=0,t=[];for(f.BUFFER_SIZE=512,f.bin=a,f.test=function(e){if("string"==typeof e)return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(e)},r=0;r<256;r++)t[r]=(r+256).toString(16).substr(1);if("undefined"!=typeof module&&"function"==typeof require){var o=require("crypto");module.exports=f}else"undefined"!=typeof window&&(window.uuid=f);function a(){var t=function(t){var a,i,s;if(void 0!==o){if(void 0===e||n+t>f.BUFFER_SIZE)if(n=0,o.getRandomValues)e=new Uint8Array(f.BUFFER_SIZE),o.getRandomValues(bytes);else{if(!o.randomBytes)throw new Error("Non-standard crypto library");e=o.randomBytes(f.BUFFER_SIZE)}return e.slice(n,n+=t)}for(a=[],r=0;r-1};u.prototype.append=function(t,e){t=a(t),e=h(e);var r=this.map[t];this.map[t]=r?r+","+e:e},u.prototype.delete=function(t){delete this.map[a(t)]},u.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},u.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},u.prototype.set=function(t,e){this.map[a(t)]=h(e)},u.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},u.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),f(t)},u.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),f(t)},u.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),f(t)},e.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var s=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var o=[301,302,303,307,308];v.redirect=function(t,e){if(-1===o.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},t.Headers=u,t.Request=m,t.Response=v,t.fetch=function(t,r){return new Promise(function(n,i){var s=new m(t,r),o=new XMLHttpRequest;o.onload=function(){var t,e,r={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new u,t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}}),e)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new v(i,r))},o.onerror=function(){i(new TypeError("Network request failed"))},o.ontimeout=function(){i(new TypeError("Network request failed"))},o.open(s.method,s.url,!0),"include"===s.credentials&&(o.withCredentials=!0),"responseType"in o&&e.blob&&(o.responseType="blob"),s.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send(void 0===s._bodyInit?null:s._bodyInit)})},t.fetch.polyfill=!0}function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function u(t){this.map={},t instanceof u?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function p(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&n(t))this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!i(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=d(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=l(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}}),e}function v(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new u(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:this); },{}],164:[function(require,module,exports){ module.exports={ "name": "azure-maps-control", "author": "Microsoft Corporation", "version": "1.3.10", "description": "Map SDK for Azure Maps", "keywords": [ "azure", "maps", "ui", "map", "control", "lbs", "microsoft" ], "scripts": { "lessc": "node_modules/.bin/lessc", "browserify": "node_modules/.bin/browserify", "test": "mocha-parallel-tests --timeout 30000 --require ts-node/register test/**/*.ts", "test-filter": "mocha-parallel-tests --timeout 30000 --require ts-node/register", "tslint": "node_modules/.bin/tslint --project ./tsconfig.json", "docs": "tsc --declaration --declarationDir ./docs --emitDeclarationOnly --stripInternal" }, "dependencies": {}, "devDependencies": { "@mapbox/mapbox-gl-rtl-text": "0.1.2", "@types/adal-angular": "^1.0.1", "@types/jwt-decode": "^2.2.0", "@types/lodash": "4.14.106", "@types/mapbox-gl": "0.47.0", "@types/mocha": "5.2.5", "@types/puppeteer": "1.6.3", "adal-angular": "^1.0.17", "applicationinsights-js": "1.0.15", "browserify": "^16.2.3", "deamdify": "0.3.0", "es6-promise": "4.1.1", "http-server": "^0.10.0", "jwt-decode": "^2.2.0", "less": "^3.9.0", "less-plugin-clean-css": "^1.5.1", "lodash": "4.17.5", "mapbox-gl": "0.47.0", "mocha": "5.2.0", "mocha-parallel-tests": "2.0.4", "node-fetch": "^2.2.0", "puppeteer": "1.8.0", "ts-node": "7.0.1", "tsify": "^4.0.1", "tslint": "^5.11.0", "tslint-microsoft-contrib": "^5.2.1", "typescript": "^2.8.1", "uglifyify": "^5.0.1", "uuid-random": "^1.0.6", "whatwg-fetch": "2.0.3" }, "license": "SEE LICENSE IN LICENSE.TXT", "files": [ "typings/**/*", "dist/**/*", "thirdpartynotices.txt" ], "types": "./typings/index.d.ts" } },{}],165:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),mapboxgl=require("mapbox-gl"),uuid=require("uuid-random"),Localizer_1=require("./helpers/localization/Localizer"),Version_1=require("./helpers/Version"),AuthenticationOptions_1=require("./map/services/options/AuthenticationOptions"),defaultUserRegion="Unified",defaultLanguage="NGT",defaultSessionId=uuid(),defaultAuthOptions=new AuthenticationOptions_1.AuthenticationOptions,hasSetAuthenticationOptions=!1,hasSetUserRegion=!1,hasSetLanguage=!1,hasSetSessionId=!1;function getAuthenticationOptions(){return _.clone(defaultAuthOptions)}function getLanguage(){return defaultLanguage}function getSessionId(){return defaultSessionId}function getSubscriptionKey(){return defaultAuthOptions.authType===AuthenticationOptions_1.AuthenticationType.subscriptionKey?defaultAuthOptions.subscriptionKey:void 0}function getUserRegion(){return defaultUserRegion}function getVersion(){return Version_1.Version.getFullVersion()}function isSupported(e){return mapboxgl.supported({failIfMajorPerformanceCaveat:e})}function setAuthenticationOptions(e){defaultAuthOptions=(new AuthenticationOptions_1.AuthenticationOptions).merge(defaultAuthOptions,e),hasSetAuthenticationOptions=!0}function setLanguage(e){defaultLanguage=Localizer_1.Localizer.getCode(e),hasSetLanguage=!0}function setSessionId(e){defaultSessionId=e,hasSetSessionId=!0}function setSubscriptionKey(e){defaultAuthOptions.setSubscriptionKey(e),hasSetAuthenticationOptions=!0}function setUserRegion(e){defaultUserRegion=e,hasSetUserRegion=!0}function _hasSetSessionId(){return hasSetSessionId}function _hasSetLanguage(){return hasSetLanguage}function _hasSetUserRegion(){return hasSetUserRegion}function _hasSetAuthenticationOptions(){return hasSetAuthenticationOptions}exports.getAuthenticationOptions=getAuthenticationOptions,exports.getLanguage=getLanguage,exports.getSessionId=getSessionId,exports.getSubscriptionKey=getSubscriptionKey,exports.getUserRegion=getUserRegion,exports.getVersion=getVersion,exports.isSupported=isSupported,exports.setAuthenticationOptions=setAuthenticationOptions,exports.setLanguage=setLanguage,exports.setSessionId=setSessionId,exports.setSubscriptionKey=setSubscriptionKey,exports.setUserRegion=setUserRegion,exports._hasSetSessionId=_hasSetSessionId,exports._hasSetLanguage=_hasSetLanguage,exports._hasSetUserRegion=_hasSetUserRegion,exports._hasSetAuthenticationOptions=_hasSetAuthenticationOptions; },{"./helpers/Version":176,"./helpers/localization/Localizer":180,"./map/services/options/AuthenticationOptions":214,"lodash":108,"mapbox-gl":109,"uuid-random":161}],166:[function(require,module,exports){ "use strict";var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),mapboxgl=require("mapbox-gl"),Html_1=require("./helpers/Html"),UserAgent_1=require("./helpers/UserAgent"),EventEmitter_1=require("./map/events/EventEmitter"),data_1=require("./namespace/data"),HtmlMarkerOptions_1=require("./options/HtmlMarkerOptions"),HtmlMarker=function(e){function t(t){var n=e.call(this,["click","contextmenu","dblclick","drag","dragstart","dragend","keydown","keypress","keyup","mousedown","mousemove","mouseout","mouseover","mouseup"])||this;return n._onDrag=function(){var e=n.marker.getLngLat().wrap();n.options.position=new data_1.Position(e.lng,e.lat),n._invokeEvent("drag",{type:"drag",target:n})},n._onDragStart=function(){n._invokeEvent("dragstart",{type:"dragstart",target:n})},n._onDragEnd=function(){n._invokeEvent("dragend",{type:"dragend",target:n})},n._bubbleElementEvent=function(e){n._invokeEvent(e.type,{type:e.type,target:n})},n.options=(new HtmlMarkerOptions_1.HtmlMarkerOptions).merge(_.cloneDeepWith(t,HtmlMarkerOptions_1.HtmlMarkerOptions._cloneCustomizer)),n._buildMarker(n.options),n}return __extends(t,e),t.prototype.getOptions=function(){return _.cloneDeepWith(this.options,HtmlMarkerOptions_1.HtmlMarkerOptions._cloneCustomizer)},t.prototype.setOptions=function(e){var n=(new HtmlMarkerOptions_1.HtmlMarkerOptions).merge(this.options,_.cloneDeepWith(e,HtmlMarkerOptions_1.HtmlMarkerOptions._cloneCustomizer));_.isEqual(n.htmlContent,this.options.htmlContent)?("string"!=typeof n.htmlContent||n.color===this.options.color&&n.text===this.options.text||(this.element.innerHTML=this._getSubbedHtmlString(n)),n.draggable!==this.options.draggable&&this.marker.setDraggable(n.draggable),_.isEqual(n.pixelOffset,this.options.pixelOffset)||this.marker.setOffset(n.pixelOffset),_.isEqual(n.position,this.options.position)||this.marker.setLngLat(n.position),n.visible!==this.options.visible&&(n.visible?this.element.classList.remove(t.hiddenClass):this.element.classList.add(t.hiddenClass))):(this.marker.remove(),this._buildMarker(n),this.map&&(this.marker.addTo(this.map._getMap()),this._getCollectionContainer().appendChild(this.element))),this.options=n},t.prototype.togglePopup=function(){if(this.options.popup)if(this.options.popup.isOpen())this.options.popup.close();else{if(!this.map)throw new Error("The marker must be added to a map before calling togglePopup().");this.options.popup.setOptions({position:this.options.position}),this.options.popup.open(this.map)}},t.prototype._addToMap=function(e,t){this.map&&this.map!==e&&this._removeFromMap(),t&&(this.options.position=_.cloneDeep(t),this.marker.setLngLat(this.options.position)),this.map!==e&&(this.map=e,this.marker.addTo(e._getMap()),this._getCollectionContainer().appendChild(this.element))},t.prototype._removeFromMap=function(){this.map&&(this.marker.remove(),delete this.map)},t.prototype._getId=function(){if(this.element)return"string"==typeof this.options.htmlContent?this.element.firstChild.id:this.element.id},t.prototype._buildMarker=function(e){if("string"==typeof e.htmlContent){var n=this._getSubbedHtmlString(e);this.element=Html_1.Html.convertHtmlString(n)}else this.element=e.htmlContent;this.element.classList.add(t.containerClass),this.element.draggable=!UserAgent_1.UserAgent.isEdgeOrIE(),e.visible||this.element.classList.add(t.hiddenClass),this.marker=new mapboxgl.Marker({element:this.element,offset:e.pixelOffset,draggable:e.draggable}).setLngLat(e.position),this.marker.on("drag",this._onDrag),this.marker.on("dragstart",this._onDragStart),this.marker.on("dragend",this._onDragEnd),this.element.addEventListener("click",this._bubbleElementEvent),this.element.addEventListener("dblclick",this._bubbleElementEvent),this.element.addEventListener("contextmenu",this._bubbleElementEvent),this.element.addEventListener("mousedown",this._bubbleElementEvent),this.element.addEventListener("mouseup",this._bubbleElementEvent),this.element.addEventListener("mouseover",this._bubbleElementEvent),this.element.addEventListener("mousemove",this._bubbleElementEvent),this.element.addEventListener("mouseout",this._bubbleElementEvent),this.element.addEventListener("keydown",this._bubbleElementEvent),this.element.addEventListener("keypress",this._bubbleElementEvent),this.element.addEventListener("keyup",this._bubbleElementEvent)},t.prototype._getSubbedHtmlString=function(e){if("string"==typeof e.htmlContent)return e.htmlContent.replace(/{color}/g,e.color||"").replace(/{text}/g,e.text||"")},t.prototype._getCollectionContainer=function(){var e=this.map.getCanvasContainer().querySelector("."+t.collectionContainerClass);return e||((e=document.createElement("div")).classList.add(t.collectionContainerClass),this.map.getCanvasContainer().appendChild(e)),e},t.collectionContainerClass="marker-collection-container",t.hiddenClass="hidden-accessible-element",t.containerClass="marker-container",t}(EventEmitter_1.EventEmitter);exports.HtmlMarker=HtmlMarker; },{"./helpers/Html":172,"./helpers/UserAgent":175,"./map/events/EventEmitter":189,"./namespace/data":245,"./options/HtmlMarkerOptions":277,"lodash":108,"mapbox-gl":109}],167:[function(require,module,exports){ "use strict";var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0});var Options_1=require("./helpers/Options"),Padding=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bottom=0,e.left=0,e.right=0,e.top=0,e}return __extends(e,t),e}(Options_1.Options);exports.Padding=Padding; },{"./helpers/Options":173}],168:[function(require,module,exports){ "use strict";var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(exports,"__esModule",{value:!0});var Pixel=function(t){function e(e,n){return t.call(this,e,n)||this}return __extends(e,t),e.fromData=function(t){var n=NaN,r=NaN,o=new Set(["y"]),a=new Set(["x"]);return Object.keys(t).forEach(function(e){var i=e.toLowerCase();isNaN(n)&&o.has(i)&&"number"==typeof t[e]?n=t[e]:isNaN(r)&&a.has(i)&&"number"==typeof t[e]&&(r=t[e])}),isNaN(n)||isNaN(r)?null:new e(n,r)},e.getX=function(t){return t.length>0?t[0]:NaN},e.getY=function(t){return t.length>1?t[1]:NaN},e}(Array);exports.Pixel=Pixel; },{}],169:[function(require,module,exports){ "use strict";var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),mapboxgl=require("mapbox-gl"),Html_1=require("./helpers/Html"),EventEmitter_1=require("./map/events/EventEmitter"),PopupOptions_1=require("./options/PopupOptions"),Popup=function(t){function e(n){var o=t.call(this,["open","close"])||this;return o.attach=function(t){o.map!==t&&(o.map&&o.remove(),o.map=t,o.marker.addTo(o.map._getMap()),o._getCollectionContainer().appendChild(o.containerHtml),o.map._trackPopup(o))},o.open=function(t){o.attach(t),o.containerHtml.classList.remove(e.hiddenClass),o._invokeEvent("open",{target:o,type:"open"})},o.close=function(){o.containerHtml.classList.add(e.hiddenClass),o._invokeEvent("close",{target:o,type:"close"})},o.remove=function(){o.map&&(o.map._untrackPopup(o),o.marker.remove(),delete o.map)},o.isOpen=function(){return o.map&&!o.containerHtml.classList.contains(e.hiddenClass)},o.options=(new PopupOptions_1.PopupOptions).merge(_.cloneDeepWith(n,PopupOptions_1.PopupOptions._cloneCustomizer)),o.containerHtml=document.createElement("div"),o.containerHtml.classList.add(e.containerClass),o.containerHtml.classList.add(e.hiddenClass),o.containerHtml.addEventListener("focusin",function(){o.map&&!o.isOpen()&&o.open(o.map)}),o.contentContainerHtml=document.createElement("div"),o.contentContainerHtml.classList.add(e.contentContainerClass),o.contentContainerHtml.setAttribute("role","dialog"),o.contentContainerHtml.setAttribute("aria-label","Map Information Window"),o.contentContainerHtml.setAttribute("tabindex","0"),o.contentContainerHtml.appendChild(Html_1.Html.convertHtmlString(o.options.content)),o.containerHtml.appendChild(o.contentContainerHtml),o.arrowHtml=document.createElement("div"),o.arrowHtml.classList.add(e.arrowClass),o.containerHtml.appendChild(o.arrowHtml),o.options.closeButton&&(o.closeButton=o._createCloseButton(),o.containerHtml.appendChild(o.closeButton)),o.marker=new mapboxgl.Marker({element:o.containerHtml,offset:o.options.pixelOffset,anchor:"bottom"}).setLngLat(o.options.position),o}return __extends(e,t),e.prototype.setPopupOptions=function(t){this.setOptions(t)},e.prototype.setOptions=function(t){var e=(new PopupOptions_1.PopupOptions).merge(this.options,_.cloneDeepWith(t,PopupOptions_1.PopupOptions._cloneCustomizer));if(e.content!==this.options.content){for(;this.contentContainerHtml.firstChild;)this.contentContainerHtml.removeChild(this.contentContainerHtml.firstChild);this.contentContainerHtml.appendChild(Html_1.Html.convertHtmlString(e.content))}e.closeButton&&!this.closeButton?(this.closeButton=this._createCloseButton(),this.containerHtml.appendChild(this.closeButton)):!e.closeButton&&this.closeButton&&(this.containerHtml.removeChild(this.closeButton),delete this.closeButton),_.isEqual(e.position,this.options.position)||this.marker.setLngLat(e.position),_.isEqual(e.pixelOffset,this.options.pixelOffset)||this.marker.setOffset(e.pixelOffset),this.options=e},e.prototype.getPopupOptions=function(){return this.getOptions()},e.prototype.getOptions=function(){return _.cloneDeepWith(this.options,PopupOptions_1.PopupOptions._cloneCustomizer)},e.prototype._getCollectionContainer=function(){var t=this.map.getMapContainer().querySelector("."+e.collectionContainerClass);return t||((t=document.createElement("div")).classList.add(e.collectionContainerClass),t.setAttribute("role","region"),t.setAttribute("aria-label","Map Information"),this.map.getMapContainer().appendChild(t)),t},e.prototype._createCloseButton=function(){var t=document.createElement("button");return t.addEventListener("click",this.close),t.classList.add(e.closeClass),t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex","0"),t.innerHTML="x",t},e.collectionContainerClass="popup-collection-container",e.contentContainerClass="popup-content-container",e.hiddenClass="hidden-accessible-element",e.containerClass="popup-container",e.arrowClass="popup-arrow",e.closeClass="popup-close",e}(EventEmitter_1.EventEmitter);exports.Popup=Popup; },{"./helpers/Html":172,"./map/events/EventEmitter":189,"./options/PopupOptions":278,"lodash":108,"mapbox-gl":109}],170:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),uuid=require("uuid-random"),data_1=require("./namespace/data"),math=require("./namespace/math"),Shape=function(){function e(t,r,i){var a;if("Feature"===t.type){var n=t;a=_.cloneDeep(n.geometry),i=n.properties?_.cloneDeep(n.properties):{},r=n.id||uuid()}else a=_.cloneDeep(t),r=r||uuid(),i=i?_.cloneDeep(i):{};i[e._shapeIdPropName]=r,this.data=new data_1.Feature(a,i,r),this._handleCircle()}return e.prototype.addProperty=function(e,t){_.isEqual(this.data.properties[e],t)||(this.data.properties[e]=_.cloneDeep(t),"subType"!==e&&"radius"!==e||this._handleCircle(),this.dataSource&&this.dataSource._updateSource())},e.prototype.getBounds=function(){var e,t=this.getCoordinates(),r=this.getType();if("Point"===r)if(this.circlePolygon){var i=this.circlePolygon.geometry.coordinates;e=data_1.BoundingBox.fromPositions(i[0])}else{i=t;e=new data_1.BoundingBox(i,i)}else if("MultiPoint"===r||"LineString"===r){i=t;e=data_1.BoundingBox.fromPositions(i)}else if("Polygon"===r){i=t;e=data_1.BoundingBox.fromPositions(i[0])}else if("MultiLineString"===r)for(var a=0,n=i=t;a0||(e.indexOf("Trident/")>0||e.indexOf("Edge/")>0)},e}();exports.UserAgent=UserAgent; },{}],176:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var pkg=require("../../../package.json"),Version=function(){function e(){}return e.getFullVersion=function(){return pkg.version},e.getEndpointVersion=function(){var e=pkg.version.indexOf(".");return-1===(e=pkg.version.indexOf(".",e+1))?pkg.version:pkg.version.substring(0,e)},e}();exports.Version=Version; },{"../../../package.json":164}],177:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var CultureCode=function(){function e(){}return e.parse=function(e){var r=(e=e.toLowerCase()).lastIndexOf("-");return-1!==r?{code:e,language:e.substring(0,r),region:e.substring(r+1)}:{code:e,language:e}},e}();exports.CultureCode=CultureCode; },{}],178:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.localeIndex={localizationsPath:"sdk/localizations",sensitiveUserRegions:["il","kr","pk","in","cn","ar","bh","eg","jo","sa","kw","om","qa","ma","ae"],locales:{defaultLanguage:{defaultRegion:{code:"NGT",strings:"en.json"}},ar:{defaultRegion:{code:"ar-SA",strings:"en.json"}},bg:{defaultRegion:{code:"bg-BG",strings:"en.json"}},cs:{defaultRegion:{code:"cs-CZ",strings:"en.json"}},da:{defaultRegion:{code:"da-DK",strings:"en.json"}},de:{defaultRegion:{code:"de-DE",strings:"en.json"}},el:{defaultRegion:{code:"el-GR",strings:"en.json"}},en:{defaultRegion:{code:"en",strings:"en.json"},us:{code:"en-US",strings:"en.json"}},es:{defaultRegion:{code:"es-ES",strings:"en.json"},mx:{code:"es-MX",strings:"en.json"}},fi:{defaultRegion:{code:"fi-FI",strings:"en.json"}},fr:{defaultRegion:{code:"fr-FR",strings:"en.json"}},hu:{defaultRegion:{code:"hu-HU",strings:"en.json"}},id:{defaultRegion:{code:"id-ID",strings:"en.json"}},it:{defaultRegion:{code:"it-IT",strings:"en.json"}},ko:{defaultRegion:{code:"ko-KR",strings:"en.json"}},lt:{defaultRegion:{code:"lt-LT",strings:"en.json"}},ms:{defaultRegion:{code:"ms-MY",strings:"en.json"}},nb:{defaultRegion:{code:"nb-NO",strings:"en.json"}},nl:{defaultRegion:{code:"nl-NL",strings:"en.json"}},pl:{defaultRegion:{code:"pl-PL",strings:"en.json"}},pt:{defaultRegion:{code:"pt-PT",strings:"en.json"},br:{code:"pt-BR",strings:"en.json"}},ru:{defaultRegion:{code:"ru-RU",strings:"en.json"}},sk:{defaultRegion:{code:"sk-SK",strings:"en.json"}},sl:{defaultRegion:{code:"sl-SL",strings:"en.json"}},sv:{defaultRegion:{code:"sv-SE",strings:"en.json"}},th:{defaultRegion:{code:"th-TH",strings:"en.json"}},tr:{defaultRegion:{code:"tr-TR",strings:"en.json"}},zh:{defaultRegion:{code:"zh-Hant",strings:"en.json"}},"zh-hant":{defaultRegion:{code:"zh-Hant",strings:"en.json"}}}}; },{}],179:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var LocalizedStrings=function(){return function(){this.Unknown="Unknown",this.Accident="Accident",this.Fog="Fog",this.Danger="Danger",this.Rain="Rain",this.Ice="Ice",this.Jam="Jam",this.LaneClosed="Lane Closed",this.RoadClosed="Road Closed",this.RoadWorks="Road Works",this.Wind="Wind",this.Flood="Flood",this.Detour="Detour"}}();exports.LocalizedStrings=LocalizedStrings; },{}],180:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var vars=require("../../../../variables.json"),Url_1=require("../Url"),Version_1=require("../Version"),CultureCode_1=require("./CultureCode"),LocaleIndex_1=require("./LocaleIndex"),LocalizedStrings_1=require("./LocalizedStrings"),Localizer=function(){function e(){}return e.getCode=function(e){var r=CultureCode_1.CultureCode.parse(e);return-1===LocaleIndex_1.localeIndex.sensitiveUserRegions.indexOf(r.region)?this.getLocaleData(r).code:e},e.getStrings=function(e){var r=this.getLocaleData(e);return new Url_1.Url((new Url_1.UrlOptions).merge({domain:vars.env.staticAssetsDomain,path:LocaleIndex_1.localeIndex.localizationsPath+"/"+r.strings,queryParams:{"api-version":Version_1.Version.getEndpointVersion()}})).get().then(function(e){return e},function(){return new LocalizedStrings_1.LocalizedStrings})},e.getLocaleData=function(e){if("string"==typeof e&&(e=CultureCode_1.CultureCode.parse(e)),LocaleIndex_1.localeIndex.locales[e.code])return LocaleIndex_1.localeIndex.locales[e.code].defaultRegion;var r;if(LocaleIndex_1.localeIndex.locales[e.language])r=LocaleIndex_1.localeIndex.locales[e.language];else{if(-1!==e.language.indexOf("-"))return this.getLocaleData(e.language);r=LocaleIndex_1.localeIndex.locales.defaultLanguage}return e.region&&r[e.region]?r[e.region]:r.defaultRegion},e}();exports.Localizer=Localizer; },{"../../../../variables.json":279,"../Url":174,"../Version":176,"./CultureCode":177,"./LocaleIndex":178,"./LocalizedStrings":179}],181:[function(require,module,exports){ "use strict";function __export(e){for(var r in e)exports.hasOwnProperty(r)||(exports[r]=e[r])}Object.defineProperty(exports,"__esModule",{value:!0});var es6_promise_1=require("es6-promise");require("whatwg-fetch");var vars=require("../../variables.json");window.Promise=window.Promise||es6_promise_1.Promise;var mapboxgl=require("mapbox-gl"),Url_1=require("./helpers/Url"),Version_1=require("./helpers/Version"),rtlPluginUrl=new Url_1.Url((new Url_1.UrlOptions).merge({domain:vars.env.staticAssetsDomain,path:"sdk/js/mapbox-gl-rtl-text.js",queryParams:{"api-version":Version_1.Version.getEndpointVersion()}}));mapboxgl.setRTLTextPlugin(rtlPluginUrl.toString(),function(e){});var control=require("./namespace/controls");exports.control=control;var data=require("./namespace/data");exports.data=data;var layer=require("./namespace/layer");exports.layer=layer;var math=require("./namespace/math");exports.math=math;var source=require("./namespace/source");exports.source=source;var HtmlMarker_1=require("./HtmlMarker");exports.HtmlMarker=HtmlMarker_1.HtmlMarker;var Map_1=require("./map/Map");exports.Map=Map_1.Map;var Pixel_1=require("./Pixel");exports.Pixel=Pixel_1.Pixel;var Popup_1=require("./Popup");exports.Popup=Popup_1.Popup;var Shape_1=require("./Shape");exports.Shape=Shape_1.Shape;var AuthenticationOptions_1=require("./map/services/options/AuthenticationOptions");exports.AuthenticationType=AuthenticationOptions_1.AuthenticationType;var ControlOptions_1=require("./map/options/ControlOptions");exports.ControlPosition=ControlOptions_1.ControlPosition;var ControlStyle_1=require("./namespace/controls/ControlStyle");exports.ControlStyle=ControlStyle_1.ControlStyle,__export(require("./Atlas")); },{"../../variables.json":279,"./Atlas":165,"./HtmlMarker":166,"./Pixel":168,"./Popup":169,"./Shape":170,"./helpers/Url":174,"./helpers/Version":176,"./map/Map":183,"./map/options/ControlOptions":203,"./map/services/options/AuthenticationOptions":214,"./namespace/controls":233,"./namespace/controls/ControlStyle":224,"./namespace/data":245,"./namespace/layer":256,"./namespace/math":269,"./namespace/source":274,"es6-promise":84,"mapbox-gl":109,"whatwg-fetch":163}],182:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var applicationinsights_js_1=require("applicationinsights-js"),variables=require("../../../variables.json"),Version_1=require("../helpers/Version"),Insights=function(){function i(i){this.options=i,this.options.disableTelemetry||(applicationinsights_js_1.AppInsights.downloadAndSetup({instrumentationKey:variables.env.appInsightsKey,disableExceptionTracking:!0,disableAjaxTracking:!0,isCookieUseDisabled:!0,maxBatchInterval:5e3,disableTelemetry:this.options.disableTelemetry}),applicationinsights_js_1.AppInsights.queue.push(function(){return applicationinsights_js_1.AppInsights.context.application.ver=Version_1.Version.getFullVersion()}))}return i.prototype.trackEvent=function(){for(var i=[],t=0;tn;)n+=360;if(!(t=this.map.cameraForBounds([[r,o],[n,a]],{padding:i.padding,offset:i.offset,maxZoom:i.maxZoom})))throw new Error("The map cannot be fit to the current canvas with the given CameraBoundsOptions.");this.map.setMaxZoom(i.maxZoom)}else{var s=(new CameraOptions_1.CameraOptions).merge(this.getCamera(),e);if(s.centerOffset&&s.centerOffset.length>=2){var p=s.centerOffset,l=math.mercatorPositionsToPixels([s.center],s.zoom);l[0][0]+=p[0],l[0][1]+=p[1],s.center=math.mercatorPixelsToPositions(l,s.zoom)[0]}t={center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,around:void 0},this.map.setMinZoom(s.minZoom),this.map.setMaxZoom(s.maxZoom)}var c=(new AnimationOptions_1.AnimationOptions).merge(e),d={duration:c.duration,easing:function(e){return e},offset:[0,0],animate:!0};"jump"===c.type?this.map.jumpTo(t):"ease"===c.type?this.map.easeTo(__assign({},t,d)):"fly"===c.type&&this.map.flyTo(__assign({},t,d))},e.prototype.setCameraBounds=function(e){this.setCamera(e)},e.prototype.getCamera=function(){var e=this.map.getBounds().getSouthWest().toArray(),t=this.map.getBounds().getNorthEast().toArray();return{zoom:this.map.getZoom(),center:this.map.getCenter().toArray(),bearing:this.map.getBearing(),pitch:this.map.getPitch(),bounds:new data_1.BoundingBox(e,t),minZoom:this.map.getMinZoom(),maxZoom:this.map.getMaxZoom()}},e.prototype.setStyle=function(e){delete e.preserveDrawingBuffer;var t=(new StyleOptions_1.StyleOptions).merge(this.styleOptions,e);t.autoResize!==this.styleOptions.autoResize&&this._setAutoResize(t.autoResize),t.language!==this.styleOptions.language&&(this.localizedStringsPromise=Localizer_1.Localizer.getStrings(t.language)),this._addStyleComponents(t,this.serviceOptions),this.styleOptions=t},e.prototype.getStyle=function(){return _.cloneDeep(this.styleOptions)},e.prototype.addIcon=function(e,t){this.imageSprite.add(e,t)},e.prototype.addPins=function(e,t){var i,o=(new PinLayerOptions_1.PinLayerOptions).merge(t),r=this.layers.getLayerById(o.name),a=!1;if(r||(a=!0,r=new layer_1.SymbolLayer(o.name+"-source",o.name,{source:o.name+"-source",minZoom:o.minZoom,maxZoom:o.maxZoom,iconOptions:{anchor:"center",size:o.iconSize,image:{type:"identity",property:"icon",default:o.icon},ignorePlacement:!o.cluster,opacity:o.opacity},textOptions:{anchor:"center",textField:["case",["has","point_count"],["to-string",["get","point_count"]],["has","title"],["to-string",["get","title"]],o.title],font:["case",["has","point_count"],["literal",["StandardFontCondensed-Bold"]],["literal",[o.textFont]]],size:["case",["has","point_count"],20,o.fontSize],ignorePlacement:!o.cluster,opacity:o.opacity,offset:["case",["has","point_count"],["literal",[.5,-.45]],["literal",[o.textOffset[0]/16,o.textOffset[1]/16]]],color:o.fontColor}})),!(r instanceof layer_1.SymbolLayer))throw new Error("A layer with name '"+o.name+"' already exists but it is not a SymbolLayer.A SymbolLayer should be used for rendering pins.");var n=r.getSource();"string"==typeof n?(i=n,n=this.sources.getById(i)):i=n.getId();var s=!1;if(n||(s=!0,n=new source_1.DataSource(i,{cluster:o.cluster})),!(n instanceof source_1.DataSource))throw new Error("The source with name '"+i+"' already exists but it is not a DataSource.New data can only be added to a DataSource.");s&&this.sources.add(n),a&&this.layers.add(r,o.before);var p=new data_1.FeatureCollection(e);o.defer?(o.overwrite&&n._clearNoUpdate(),n._addNoUpdate(p)):o.overwrite?n.setShapes(p):n.add(p)},e.prototype.addCircles=function(e,t){var i,o=(new CircleLayerOptions_1.CircleLayerOptions).merge(t),r=this.layers.getLayerById(o.name),a=!1;if(r||(a=!0,r=new layer_1.BubbleLayer(o.name+"-source",o.name,{source:o.name+"-source",minZoom:o.minZoom,maxZoom:o.maxZoom,opacity:o.opacity,radius:{type:"identity",property:"radius",default:o.radius},color:{type:"identity",property:"color",default:o.color},strokeColor:{type:"identity",property:"outlineColor",default:o.outlineColor},strokeWidth:{type:"identity",property:"outlineWidth",default:o.outlineWidth}})),!(r instanceof layer_1.BubbleLayer))throw new Error("A layer with name '"+o.name+"' already exists but it is not a BubbleLayer.A BubbleLayer should be used for rendering circles.");var n=r.getSource();"string"==typeof n?(i=n,n=this.sources.getById(i)):i=n.getId();var s=!1;if(n||(s=!0,n=new source_1.DataSource(i)),!(n instanceof source_1.DataSource))throw new Error("The source with name '"+i+"' already exists but it is not a DataSource.New data can only be added to a DataSource.");s&&this.sources.add(n),a&&this.layers.add(r,o.before);var p=new data_1.FeatureCollection(e);o.defer?(o.overwrite&&n._clearNoUpdate(),n._addNoUpdate(p)):o.overwrite?n.setShapes(p):n.add(p)},e.prototype.addLinestrings=function(e,t){var i,o=(new LinestringLayerOptions_1.LinestringLayerOptions).merge(t),r=this.layers.getLayerById(o.name),a=!1;if(r||(a=!0,r=new layer_1.LineLayer(o.name+"-source",o.name,{source:o.name+"-source",minZoom:o.minZoom,maxZoom:o.maxZoom,lineCap:o.cap,lineJoin:o.join,strokeOpacity:o.opacity,strokeColor:{type:"identity",property:"color",default:o.color},strokeWidth:{type:"identity",property:"width",default:o.width}})),!(r instanceof layer_1.LineLayer))throw new Error("A layer with name '"+o.name+"' already exists but it is not a LineLayer.A LineLayer should be used for rendering linestrings.");var n=r.getSource();"string"==typeof n?(i=n,n=this.sources.getById(i)):i=n.getId();var s=!1;if(n||(s=!0,n=new source_1.DataSource(i)),!(n instanceof source_1.DataSource))throw new Error("The source with name '"+i+"' already exists but it is not a DataSource.New data can only be added to a DataSource.");s&&this.sources.add(n),a&&this.layers.add(r,o.before);var p=new data_1.FeatureCollection(e);o.defer?(o.overwrite&&n._clearNoUpdate(),n._addNoUpdate(p)):o.overwrite?n.setShapes(p):n.add(p)},e.prototype.addPolygons=function(e,t){var i,o=(new PolygonLayerOptions_1.PolygonLayerOptions).merge(t),r=this.layers.getLayerById(o.name),a=!1;if(r||(a=!0,r=new layer_1.PolygonLayer(o.name+"-source",o.name,{source:o.name+"-source",minZoom:o.minZoom,maxZoom:o.maxZoom,fillOpacity:o.opacity,fillColor:{type:"identity",property:"color",default:o.color}})),!(r instanceof layer_1.PolygonLayer))throw new Error("A layer with name '"+o.name+"' already exists but it is not a PolygonLayer.A PolygonLayer should be used for rendering linestrings.");var n=r.getSource();"string"==typeof n?(i=n,n=this.sources.getById(i)):i=n.getId();var s=!1;if(n||(s=!0,n=new source_1.DataSource(i)),!(n instanceof source_1.DataSource))throw new Error("The source with name '"+i+"' already exists but it is not a DataSource.New data can only be added to a DataSource.");s&&this.sources.add(n),a&&this.layers.add(r,o.before);var p=new data_1.FeatureCollection(e);o.defer?(o.overwrite&&n._clearNoUpdate(),n._addNoUpdate(p)):o.overwrite?n.setShapes(p):n.add(p)},e.prototype.addRaster=function(e,t){var i,o=(new RasterLayerOptions_1.RasterLayerOptions).merge(t),r=this.layers.getLayerById(o.name),a=!1;if(r||(a=!0,r=new layer_1.TileLayer({maxZoom:o.maxZoom,minZoom:o.minZoom,opacity:o.opacity,tileSize:256,tileUrl:"{subdomain}"},o.name)),!(r instanceof layer_1.TileLayer))throw new Error("A layer with name '"+o.name+"' already exists but it is not a TileLayer.A TileLayer should be used for rendering raster images.");if("{subdomain}"!==r.getOptions().tileUrl)throw new Error("A TileLayer with name '"+o.name+"' already exists but was configured for a single tile url [default for new TileLayer(...)].");(i=o.overwrite?[]:r.getOptions().subdomains||[]).push.apply(i,e),r._setOptionsNoUpdate({subdomains:i}),o.defer?a&&this.layers._addNoUpdate(r,o.before):this.layers.add(r,o.before)},e.prototype.getLayers=function(){return this.layers.getLayers().map(function(e){return e.getId()})},e.prototype.removeLayers=function(e){for(var t=0,i=e;t0?n.results[0].address.freeformAddress:e.UNKNOWN_LOCATION_STRING;r.innerText="Location: "+p,t.atlasMapLiveStateInfo.appendChild(r);var l=document.createElement("p");l.innerText="Latitude: "+a.center[1].toFixed(e.COORDINATE_FRACTION_PRECISION),t.atlasMapLiveStateInfo.appendChild(l);var s=document.createElement("p");s.innerText="Longitude: "+a.center[0].toFixed(e.COORDINATE_FRACTION_PRECISION),t.atlasMapLiveStateInfo.appendChild(s)}).catch(function(n){t.atlasMapLiveStateInfo.innerHTML="";var i=document.createElement("p");i.innerText="Zoom: "+a.zoom.toFixed(e.ZOOM_FRACTION_PRECISION),t.atlasMapLiveStateInfo.appendChild(i);var r=document.createElement("p");r.innerText="Location: "+e.UNKNOWN_LOCATION_STRING,t.atlasMapLiveStateInfo.appendChild(r);var p=document.createElement("p");p.innerText="Latitude: "+a.center[1].toFixed(e.COORDINATE_FRACTION_PRECISION),t.atlasMapLiveStateInfo.appendChild(p);var l=document.createElement("p");l.innerText="Longitude: "+a.center[0].toFixed(e.COORDINATE_FRACTION_PRECISION),t.atlasMapLiveStateInfo.appendChild(l)})},this.map=a}return e.COORDINATE_FRACTION_PRECISION=5,e.ZOOM_FRACTION_PRECISION=2,e.UNKNOWN_LOCATION_STRING="unknown",e}();exports.AccessibleMapDelegate=AccessibleMapDelegate; },{"../../services/NearbyGeographySearchService":213}],185:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),FlowServiceDelegate=function(){return function(e,o){var t=this;this.callCounter=0,this.listenerEnabled=!1,this.flowComponent=void 0,this.flowPath=void 0,this.addToMap=function(){if(!t.map._isReady())throw new Error("Traffic flow could not be added to the map because the map is not ready. Please use a ready event listener to guarantee the map is ready before enabling traffic flow.");t.listenerEnabled||(t.map.events.add("styledata",t.addToMap),t.listenerEnabled=!0);var e=t.map.getStyle(),o=t.map.getTraffic(),a=t.styleDefinitions.getFlowPath(e,o);if(a&&t.flowPath!==a){t.callCounter++;var n=t.callCounter;t.styleDefinitions.getFlowComponent(e,o).then(function(e){if(t.callCounter===n){t.flowComponent&&(t.map.layers.remove(t.flowComponent.layer),t.map.sources.remove(t.flowComponent.sources),delete t.flowComponent);var o=t.map.layers.getLayers(),l=_.findIndex(o,function(e){return"transit"===e.getId()}),r=-1!==l?o[l+1]:void 0;t.map.sources.add(e.sources),t.map.layers.add(e.layer,r),t.flowComponent=e,t.flowPath=a}})}},this.removeFromMap=function(){t.callCounter++,t.listenerEnabled&&(t.map.events.remove("styledata",t.addToMap),t.listenerEnabled=!1),t.flowPath&&delete t.flowPath,t.flowComponent&&(t.map.layers.remove(t.flowComponent.layer),t.map.sources.remove(t.flowComponent.sources),delete t.flowComponent)},this.styleDefinitions=o,this.map=e}}();exports.FlowServiceDelegate=FlowServiceDelegate; },{"lodash":108}],186:[function(require,module,exports){ "use strict";var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var data_1=require("../../../namespace/data"),Incident=function(e){function r(t,n){var a=new data_1.Point(new data_1.Position(t.op.x,t.op.y)),c={icon:r.getSeverityColorName(t.ty)+"-"+r.getIncidentTypeIconName(t.ic),incidentType:r.getIncidentTypeName(t.ic,n),description:t.d,length:t.l,delay:t.dl,from:t.f,color:r.getSeverityColorHexCode(t.ty),to:t.t,id:t.id};return e.call(this,a,c)||this}return __extends(r,e),r.getIncidentTypeName=function(e,r){switch(e){case 0:return r.Unknown;case 1:return r.Accident;case 2:return r.Fog;case 3:return r.Danger;case 4:return r.Rain;case 5:return r.Ice;case 6:return r.Jam;case 7:return r.LaneClosed;case 8:return r.RoadClosed;case 9:return r.RoadWorks;case 10:return r.Wind;case 11:return r.Flood;case 12:return r.Detour;default:return r.Unknown}},r.getIncidentTypeIconName=function(e){switch(e){case 0:return"unknown";case 1:return"accident";case 2:return"fog";case 3:return"danger";case 4:return"rain";case 5:return"ice";case 6:return"jam";case 7:return"lane-closed";case 8:return"road-closed";case 9:return"road-work";case 10:return"wind";case 11:return"flood";case 12:return"detour";default:return"unknown"}},r.getSeverityColorName=function(e){switch(e){case 0:return"grey";case 1:return"yellow";case 2:return"orange";case 3:return"red";case 4:default:return"grey"}},r.getSeverityColorHexCode=function(e){switch(e){case 0:return"#B5B6B7";case 1:return"#F4C951";case 2:return"#F4873F";case 3:return"#F04F4E";case 4:default:return"#B5B6B7"}},r}(data_1.Feature);exports.Incident=Incident; },{"../../../namespace/data":245}],187:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var IncidentPopupIconName,math=require("../../../namespace/math"),Popup_1=require("../../../Popup");!function(e){e.DELAY="delay",e.LENGTH="length",e.FROM="from",e.TO="to"}(IncidentPopupIconName||(IncidentPopupIconName={}));var IncidentPopupFactory=function(){function e(){}return e.build=function(e,t){void 0===t&&(t="en-US");var i=document.createElement("div");i.classList.add("incident-popup-title"),i.classList.add("font-segoeui-b"),i.setAttribute("tabindex","0"),i.innerText=e.properties.incidentType,i.setAttribute("aria-label","Incident Type "+e.properties.incidentType);var n=document.createElement("div");n.classList.add("incident-popup-subtitle"),n.classList.add("font-segoeui-b"),n.setAttribute("aria-label","Incident Description "+e.properties.description),n.setAttribute("tabindex","0"),n.innerText=e.properties.description;var o=document.createElement("div");o.classList.add("incident-popup-header"),o.style.backgroundColor=e.properties.color,o.appendChild(i),o.appendChild(n);var a=document.createElement("div");if(a.classList.add("incident-popup-body"),e.properties.delay){var r=Math.floor(e.properties.delay/60)+" min",p=this.createInfoSection(r,IncidentPopupIconName.DELAY);a.appendChild(p)}if(e.properties.length){var d=new Intl.NumberFormat([t,"en-US"],{maximumFractionDigits:2}),c=void 0;if("en-US"===t){var s=math.convertDistance(e.properties.length,"meters","miles");c=d.format(s)+" miles"}else{var u=math.convertDistance(e.properties.length,"meters","kilometers");c=d.format(u)+" km"}var l=this.createInfoSection(c,IncidentPopupIconName.LENGTH);a.appendChild(l)}if(e.properties.from){var m=this.createInfoSection(e.properties.from,IncidentPopupIconName.FROM);a.appendChild(m)}if(e.properties.to){var v=this.createInfoSection(e.properties.to,IncidentPopupIconName.TO);a.appendChild(v)}var f=document.createElement("div");return f.classList.add("incident-popup-content"),f.appendChild(o),f.appendChild(a),new Popup_1.Popup({content:f,position:e.geometry.coordinates})},e.createInfoSection=function(e,t){var i=document.createElement("div");i.classList.add("incident-popup-info");var n=document.createElement("div");n.classList.add("icon"),n.classList.add(t);var o=document.createElement("span");return o.classList.add("message"),o.classList.add("font-segoeui"),o.setAttribute("aria-label","Incident "+t+" "+e),o.setAttribute("tabindex","0"),o.innerText=e,i.appendChild(n),i.appendChild(o),i},e}();exports.IncidentPopupFactory=IncidentPopupFactory; },{"../../../Popup":169,"../../../namespace/math":269}],188:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Dictionary_1=require("../../../helpers/Dictionary"),data_1=require("../../../namespace/data"),IncidentService_1=require("../../services/IncidentService"),Incident_1=require("./Incident"),IncidentPopupFactory_1=require("./IncidentPopupFactory"),IncidentServiceDelegate=function(){return function(e){var n=this;this.incidentLayerName="incidents",this.popups=new Dictionary_1.Dictionary,this.addToMap=function(){n.map.addPins([],{name:n.incidentLayerName,cluster:!1}),n.map.addEventListener("mouseenter",n.incidentLayerName,n.cursorToPointer),n.map.addEventListener("mouseleave",n.incidentLayerName,n.cursorToDefault),n.map.addEventListener("click",n.incidentLayerName,n.openIncidentPopup),n.map.events.add("moveend",n.updateIncidents),n.map.events.add("styledata",n.updateLanguage),n.updateIncidents()},this.removeFromMap=function(){n.map.removeLayers([n.incidentLayerName]),n.map.removeEventListener("click",n.incidentLayerName,n.openIncidentPopup),n.map.removeEventListener("mouseenter",n.incidentLayerName,n.cursorToPointer),n.map.removeEventListener("mouseleave",n.incidentLayerName,n.cursorToDefault),n.map.events.remove("moveend",n.updateIncidents),n.map.events.remove("styledata",n.updateLanguage),n.cleanUpPopups()},this.updateIncidents=function(){var e=Math.ceil(n.map.getCamera().zoom),t=n.map.getCamera().bounds;n.incidentLanguage=n.map.getStyle().language;var i=n.map._getLocalizedStrings(),a=n.incidentService.request({bbox:t,zoom:e,params:{expandCluster:!0,originalPosition:!0,language:n.incidentLanguage}});Promise.all([a,i]).then(function(e){var i=e[0],a=e[1];if(n.map.getTraffic().incidents){var p=[];n.cleanUpPopups();for(var o=0,r=i.tm.poi||[];o0,name:n.incidentLayerName})}})},this.cursorToPointer=function(e){n.map.getCanvas().style.cursor="pointer"},this.cursorToDefault=function(e){n.map.getCanvas().style.cursor=""},this.openIncidentPopup=function(e){var t=e.features[0].properties.id;n.popups.has(t)&&n.popups.get(t).open(n.map)},this.cleanUpPopups=function(){n.popups.forEach(function(e){e.remove()}),n.popups.clear()},this.updateLanguage=function(){n.map.getStyle().language!==n.incidentLanguage&&n.updateIncidents()},this.map=e,this.incidentService=new IncidentService_1.IncidentService(this.map.authentication)}}();exports.IncidentServiceDelegate=IncidentServiceDelegate; },{"../../../helpers/Dictionary":171,"../../../namespace/data":245,"../../services/IncidentService":212,"./Incident":186,"./IncidentPopupFactory":187}],189:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Dictionary_1=require("../../helpers/Dictionary"),EventEmitter=function(){function t(t){this.listeners=new Dictionary_1.Dictionary,this.supportedEvents=new Set;for(var e=0,n=t;e0)this._triggerTokenFetch();else if(s<=0)throw this._saveItem(t.constants.storage.accessTokenKey,""),new Error(t.constants.errors.tokenExpired)}else this._triggerTokenFetch();return n}if(this.options.authType===AuthenticationOptions_1.AuthenticationType.subscriptionKey)return this.options.subscriptionKey},t.prototype._getTokenExpiry=function(t){var e=jwt_decode(t).exp,o=this._getCurrentTime();return e-o>0?e-o:-1},t.prototype._storeAccessToken=function(e){this._saveItem(t.constants.storage.accessTokenKey,e);var o={map:this.map,type:t.constants.events.tokenAcquired};this.map.events.invoke(t.constants.events.tokenAcquired,o)},t.prototype._saveItem=function(t,e){return this._supportsLocalStorage()?(localStorage.setItem(t,e),!0):!!this._supportsSessionStorage()&&(sessionStorage.setItem(t,e),!0)},t.prototype._getItem=function(t){return this._supportsLocalStorage()?localStorage.getItem(t):this._supportsSessionStorage()?sessionStorage.getItem(t):null},t.prototype._supportsLocalStorage=function(){try{return!!window.localStorage&&(window.localStorage.setItem(t.constants.storage.testStorageKey,"A"),"A"===window.localStorage.getItem(t.constants.storage.testStorageKey)&&(window.localStorage.removeItem(t.constants.storage.testStorageKey),!window.localStorage.getItem(t.constants.storage.testStorageKey)))}catch(t){return!1}},t.prototype._supportsSessionStorage=function(){try{return!!window.sessionStorage&&(window.sessionStorage.setItem(t.constants.storage.testStorageKey,"A"),"A"===window.sessionStorage.getItem(t.constants.storage.testStorageKey)&&(window.sessionStorage.removeItem(t.constants.storage.testStorageKey),!window.sessionStorage.getItem(t.constants.storage.testStorageKey)))}catch(t){return!1}},t.prototype._getCurrentTime=function(){return Math.round((new Date).getTime()/1e3)},t.prototype.signRequest=function(t){t.headers=t.headers||{},t.headers[vars.constants.sessionIdHeaderName]=this.sessionId,t.headers[vars.constants.msOriginHeaderName]=vars.constants.msOriginHeaderValue,t.headers[vars.constants.mapAgentHeaderName]="MapControl/"+pkg.version+" (Web)";var e=this.getToken();switch(this.options.authType){case AuthenticationOptions_1.AuthenticationType.aad:case AuthenticationOptions_1.AuthenticationType.anonymous:t.headers[vars.constants.msClientIdHeaderName]=this.options.clientId,t.headers[vars.constants.authorizationHeaderName]=vars.constants.authorizationTokenPrefix+e;break;case AuthenticationOptions_1.AuthenticationType.subscriptionKey:if("url"in t)-1!==t.url.indexOf("?")?t.url+="&subscription-key="+e:t.url+="?&subscription-key="+e;else{if(!("domain"in t))throw new Error("Could not determine if the provided object was UrlOptions or RequestParameters");t.queryParams=t.queryParams||{},t.queryParams["subscription-key"]=e}break;default:throw new Error("An invalid authentication type was specified")}return t},t.constants={preferredCacheLocation:"localStorage",storage:{accessTokenKey:"access.token.key",testStorageKey:"testStorage"},events:{tokenAcquired:"tokenacquired"},tokenExpiresIn:3599,tokenRefreshClockSkew:300,errors:{tokenExpired:"Token Expired, Try again"}},t}();exports.AuthenticationManager=AuthenticationManager; },{"../../../../package.json":164,"../../../../variables.json":279,"../services/options/AuthenticationOptions":214,"adal-angular":1,"jwt-decode":107}],192:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ControlOptions_1=require("../options/ControlOptions"),ControlManager=function(){function t(t){for(var e in this.map=t,this.controlContainer=document.createElement("div"),this.controlContainer.classList.add("atlas-control-container"),ControlOptions_1.ControlPosition)if(ControlOptions_1.ControlPosition.hasOwnProperty(e)){var o=document.createElement("div");o.classList.add(ControlOptions_1.ControlPosition[e]),o.classList.add("subcontrol-container"),this.controlContainer.appendChild(o)}this.map.getMapContainer().appendChild(this.controlContainer)}return t.prototype.add=function(t,e){if(Array.isArray(t))for(var o=0,n=t;o0))throw new Error("Control position "+o.position+" does not exist.");r.item(0).appendChild(n)},t.prototype._remove=function(t){t.onRemove()},t}();exports.ControlManager=ControlManager; },{"../options/ControlOptions":203}],193:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var layer_1=require("../../namespace/layer"),EventEmitter_1=require("../events/EventEmitter"),MapCallbackHandler_1=require("../events/MapCallbackHandler"),EventManager=function(){function e(e){this.map=e,this.mapCallbackHandler=new MapCallbackHandler_1.MapCallbackHandler(this.map)}return e.prototype.add=function(e,n,t){if("function"==typeof n)this._addGlobalListener(e,n,!1,!1);else if(Array.isArray(n))for(var i=0,o=n;i=0;t--)this._removeMapboxLayers(this.layers[t]),this.layers[t]._setMap(void 0),this.map.events._disableLayerEvents(this.layers[t]),this.layersById.delete(this.layers[t].getId()),this.layers.splice(t,1)},t.prototype.getLayerById=function(t){return this.layersById.get(t)},t.prototype.getLayers=function(){return this.layers.slice(0)},t.prototype.move=function(t,s){var i=t instanceof layer_1.Layer?t.getId():t,a=s instanceof layer_1.Layer?s.getId():s;if(!this.layersById.has(i))throw new Error("The layer '"+i+"' has not been added to the map and cannot be moved.");var h=_.findIndex(this.layers,function(t){return t.getId()===i});if(this._moveMapboxLayers(this.layers[h],a),t=this.layers[h],this.layers.splice(h,1),this.layersById.has(a)){var o=_.findIndex(this.layers,function(t){return t.getId()===a});this.layers.splice(o,0,t)}else this.layers.push(t)},t.prototype._moveMapboxLayers=function(t,s){for(var i=this._getMapboxBefore(s),a=0,h=t._getLayerIds();a0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=6&&(a=t.call(this,i[0],i[1],i[2],i[3],i[4],i[5])||this))}return a}return __extends(e,t),e.fromBoundingBox=function(t){var r=e.getWest(t),a=e.getSouth(t),n=e.getEast(t),i=e.getNorth(t);return new e([r,a,n,i])},e.fromDimensions=function(t,r,a){var n=t[0],i=t[1],l=Math.min(Math.max(i+a/2,-85.5),85.5),g=Math.min(Math.max(i-a/2,-85.5),85.5),m=math.normalizeLongitude(n+r/2);return new e([math.normalizeLongitude(n-r/2),g,m,l])},e.fromEdges=function(t,r,a,n){return new e([t,r,a,n])},e.containsPosition=function(t,r){var a=e.getCenter(t),n=Math.abs(a[1]-r[1]),i=Math.abs(a[0]-r[0]);i>180&&(i=360-i);var l=e.getHeight(t),g=e.getWidth(t);return n<=l/2+1e-8&&i<=g/2+1e-8},e.crossesAntimeridian=function(t){return math.normalizeLongitude(e.getEast(t))-math.normalizeLongitude(e.getWest(t))<0},e.getCenter=function(t){var r=math.normalizeLongitude(e.getEast(t)),a=math.normalizeLongitude(e.getWest(t));a>r&&(r+=360);var n=math.normalizeLongitude((a+r)/2),i=math.normalizeLatitude(e.getSouth(t)),l=math.normalizeLatitude(e.getNorth(t));return[n,math.normalizeLatitude((i+l)/2)]},e.getHeight=function(t){var r=math.normalizeLatitude(e.getNorth(t))-math.normalizeLatitude(e.getSouth(t));return isNaN(r)?0:r},e.getWidth=function(t){var r=math.normalizeLongitude(e.getEast(t))-math.normalizeLongitude(e.getWest(t));return isNaN(r)?0:r<0?r+=360:r},e.getSouthWest=function(t){var e=this.getSouth(t),r=this.getWest(t);return isNaN(e)||isNaN(r)?null:[r,e]},e.getNorthEast=function(t){var e=this.getNorth(t),r=this.getEast(t);return isNaN(e)||isNaN(r)?null:[r,e]},e.getNorthWest=function(t){var e=this.getNorth(t),r=this.getWest(t);return isNaN(e)||isNaN(r)?null:[r,e]},e.getSouthEast=function(t){var e=this.getSouth(t),r=this.getEast(t);return isNaN(e)||isNaN(r)?null:[r,e]},e.getSouth=function(t){return t&&t.length>=4?t[1]:NaN},e.getWest=function(t){return t&&t.length>=4?t[0]:NaN},e.getNorth=function(t){if(t){if(4===t.length)return t[3];if(6===t.length)return t[4]}return NaN},e.getEast=function(t){if(t){if(4===t.length)return t[2];if(6===t.length)return t[3]}return NaN},e.intersect=function(t,r){var a=e.getCenter(t),n=e.getCenter(r),i=Math.abs(a[1]-n[1]),l=Math.abs(a[0]-n[0]);l>180&&(l=360-l);var g=e.getHeight(t),m=e.getWidth(t),u=e.getHeight(r),f=e.getWidth(r);return i<=g/2+u/2&&l<=m/2+f/2},e.merge=function(t,r){var a=t&&4===t.length,n=r&&4===r.length;if(a&&!n)return t;if(n&&!a)return r;if(!a&&!n)return null;var i=Math.max(math.normalizeLatitude(e.getNorth(t)),math.normalizeLatitude(e.getNorth(r))),l=Math.min(math.normalizeLatitude(e.getSouth(t)),math.normalizeLatitude(e.getSouth(r))),g=[t,r],m=[],u=0;for(u=0;u=L[0]?v[1]=Math.max(v[1],L[1]):(N.push(v),v=L),u++}N.push(v);var o=N.length,p=N[0][0]+360-N[o-1][1],z=[N[o-1][1],N[0][0]];for(u=1;up&&(p=S,z=[N[u-1][1],N[u][0]])}return new e([z[1],l],[z[0],i])},e.fromPositions=function(t){for(var r,a=NaN,n=NaN,i=NaN,l=NaN,g=t.length,m=new Array(g),u=0;g--;)if((r=t[g])&&r.length>=2){var f=math.normalizeLatitude(r[1]);a=isNaN(a)?f:Math.max(a,f),n=isNaN(n)?f:Math.min(n,f),m[u++]=math.normalizeLongitude(r[0])}if(u){m.length=u,m.sort(function(t,e){return t-e});var h=m[0]+360-m[u-1],c=0;for(g=1;gh&&(h=N,c=g)}i=m[c],l=m[(c||u)-1]}return isNaN(i)||isNaN(n)||isNaN(l)||isNaN(a)?null:new e([i,n,l,a])},e.fromLatLngs=function(t){return e.fromPositions(Position_1.Position.fromLatLngs(t))},e.fromData=function(t){var r,a=null;if(Array.isArray(t)&&t.length>0){for(var n=0,i=t;n=2)return[m[0],m[1],m[0],m[1]];break;case"LineString":case"MultiPoint":return e.fromPositions(g.coordinates);case"Polygon":case"MultiLineString":var u=g.coordinates;if(u&&u.length>0){for(var f=0,h=u.length;f0){for(f=0,h=c.length;f=6?(a=new e([i,m,t[2],180,g,t[5]]),n=new e([-180,m,t[2],l,g,t[5]])):(a=new e([i,m,180,g]),n=new e([-180,m,l,g])),r.push(a,n)}else r.push(new e(t));return r},e}(Array);exports.BoundingBox=BoundingBox; },{"../../Shape":170,"../math":269,"./Position":244}],235:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Feature=function(){function e(t,r,i){this.type="Feature",this.type=e.TYPE,this.properties=r||{},this.id=i,this.geometry=t}return e.TYPE="Feature",e}();exports.Feature=Feature; },{}],236:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var FeatureCollection=function(){function e(t){this.type="FeatureCollection",this.type=e.TYPE,this.features=t}return e.TYPE="FeatureCollection",e}();exports.FeatureCollection=FeatureCollection; },{}],237:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var GeometryCollection=function(){function e(t){this.type="GeometryCollection",this.type=e.TYPE,this.geometries=t}return e.TYPE="GeometryCollection",e}();exports.GeometryCollection=GeometryCollection; },{}],238:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var LineString=function(){function t(e,i){this.type="LineString",this.type=t.TYPE,this.coordinates=e,this.bbox=i}return t.TYPE="LineString",t}();exports.LineString=LineString; },{}],239:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MultiLineString=function(){function t(i,e){this.type="MultiLineString",this.type=t.TYPE,this.coordinates=i,this.bbox=e}return t.TYPE="MultiLineString",t}();exports.MultiLineString=MultiLineString; },{}],240:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MultiPoint=function(){function t(i,e){this.type="MultiPoint",this.type=t.TYPE,this.coordinates=i,this.bbox=e}return t.TYPE="MultiPoint",t}();exports.MultiPoint=MultiPoint; },{}],241:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MultiPolygon=function(){function t(o,e){this.type="MultiPolygon",this.type=t.TYPE,this.coordinates=o,this.bbox=e}return t.TYPE="MultiPolygon",t}();exports.MultiPolygon=MultiPolygon; },{}],242:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Point=function(){function t(e){this.type="Point",this.type=t.TYPE,this.coordinates=e}return t.TYPE="Point",t}();exports.Point=Point; },{}],243:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Position_1=require("./Position"),Polygon=function(){function o(t,i){this.type="Polygon",this.type=o.TYPE,1===Position_1.Position._getDimensions(t)?this.coordinates=[t]:this.coordinates=t,this.bbox=i}return o.TYPE="Polygon",o}();exports.Polygon=Polygon; },{"./Position":244}],244:[function(require,module,exports){ "use strict";var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var math=require("../math"),Position=function(t){function e(e,r,n){return n?t.call(this,e,r,n)||this:t.call(this,e,r)||this}return __extends(e,t),e.fromPosition=function(t){return 2===t.length?new e(t[0],t[1]):t.length>2?new e(t[0],t[1],t[2]):null},e.areEqual=function(t,e,r){if(void 0===r&&(r=6),t&&t.length>=2&&e&&e.length>=2){var n=Math.pow(10,r),a=math.normalizeLatitude(t[1]),u=math.normalizeLatitude(e[1]),o=math.normalizeLongitude(t[0]),i=math.normalizeLongitude(e[0]);if(0!==Math.round((a-u)*n)/n)return!1;var f=Math.round((o-i)*n)/n;return 0===f||360===f}return!1},e.fromLatLng=function(t,e,r){var n=[];if("number"==typeof t)n.push(t),"number"==typeof e&&n.push(e),"number"==typeof r&&n.push(r);else if(Array.isArray(t))t.length>=2&&"number"==typeof t[0]&&"number"==typeof t[1]&&(t.length>=3&&"number"==typeof t[2]?n.push(t[0],t[1],t[2]):n.push(t[0],t[1]));else if("object"==typeof t){var a=["lat","latitude","y"],u=["lng","longitude","lon","x"],o=["elv","elevation","alt","altitude","z"],i=NaN,f=NaN,s=NaN;Object.keys(t).forEach(function(e,r,n){var l=e.toLowerCase();isNaN(i)&&a.indexOf(l)>=0&&"number"==typeof t[e]?i=t[e]:isNaN(f)&&u.indexOf(l)>=0&&"number"==typeof t[e]?f=t[e]:isNaN(s)&&o.indexOf(l)>=0&&"number"==typeof t[e]&&(s=t[e])}),isNaN(i)||isNaN(f)||(n.push(f,i),isNaN(s)||n.push(s))}return n.length>=2?n:null},e.fromLatLngs=function(t){var r=[];if(Array.isArray(t))for(var n=0,a=t.length;n0))throw new Error("The {subdomain} placeholder was included in the tileUrl but no subdomains were specified");for(var o=[],i=0,e=this.options.subdomains;i=0){var o=Math.pow(10,n);t=Math.round(t*o)/o}return t}function getCardinalSpline(t,e,a,n){var o;if(!t||t.length<=2)return o;"number"!=typeof e&&(e=.5),("number"!=typeof a||a<=0)&&(a=15);var r=t.length;o=t.slice(0),n?(data_1.Position.areEqual(o[0],o[r-1])&&(o.pop(),r--),o.unshift(t[r-1]),o.push(t[0]),o.push(t[1]),r++):(o.unshift(t[0]),o.push(t[r-1]));var i,s,c,h=[];h.push([1,0,0,0]);for(var u=1;u=2&&e&&e.length>=2){var a=_toRadians(t[1]),n=_toRadians(e[1]),o=_toRadians(e[0]-t[0]),r=Math.sin(o)*Math.cos(n),i=Math.cos(a)*Math.sin(n)-Math.sin(a)*Math.cos(n)*Math.cos(o);return(_toDegrees(Math.atan2(r,i))+360)%360}return NaN}function getLengthOfPath(t,e){var a,n=0;Array.isArray(t)?a=t:t.type&&"LineString"===t.type&&(a=t.coordinates);for(var o=0,r=a.length-1;o=2){for(var i=o.length,s=1;s=e){var c=getHeading(o[s-1],o[s]);return getDestination(o[s-1],c,e-r,a)}r+=n}return e>=r?o[i-1]:o[0]}return null}function getRegularPolygonPath(t,e,a,n,o){n=n||"meters",o=o||0;for(var r=[],i=360/a,s=0;s<=a;s++)r.push(getDestination(t,(s*i+o)%360,e,n));return r}function interpolate(t,e,a){a=void 0===a?.5:a;var n=getDistanceTo(t,e,"kilometers");return getDestination(t,getHeading(t,e),n*a,"kilometers")}function normalizeLatitude(t){return t>90?(t=(t+90)%360)>180?90-(t-180):t-90:t<-90?(t=(t-90)%360)<-180?-90-(t+180):t+90:t}function normalizeLongitude(t){return t>180?(t+180)%360-180:t<-180?(t-180)%360+180:t}function rotatePositions(t,e,a){for(var n,o,r=[],i=0,s=t.length;i=0;o--){var s=t[o];s instanceof Shape_1.Shape?this._addToSources(s,e):this._addToSources(new Shape_1.Shape(s),e)}else if("FeatureCollection"===t.type){var p=t.features;for(o=p.length-1;o>=0;o--)this._addToSources(new Shape_1.Shape(p[o]),e)}else if("GeometryCollection"===t.type){var a=t.geometries;for(o=a.length-1;o>=0;o--)this._addToSources(new Shape_1.Shape(a[o]),e)}else this._addToSources(new Shape_1.Shape(t),e)},e.prototype._clearNoUpdate=function(){this.shapes=[],this.shapesMap=new Dictionary_1.Dictionary},e.prototype._updateSource=function(){var t=this;void 0===this.timeoutId&&(performance.now()=this.shapes.length)throw new Error("The specified remove index '"+t+"' is greater than the maximum possible index '"+(this.shapes.length-1)+"'");this.shapesMap.delete(this.shapes[t].getId()),this.shapes[t]._setDataSource(null),this.shapes.splice(t,1),this._updateShapesMap(t)}else this.shapes[this.shapesMap.get(t)]._setDataSource(null),this.shapes.splice(this.shapesMap.get(t),1),this._updateShapesMap(this.shapesMap.get(t)),this.shapesMap.delete(t)},e.prototype._updateShapesMap=function(t){for(var e=t;e{text}',e.pixelOffset=new Pixel_1.Pixel(0,-18),e.position=new Position_1.Position(0,0),e.popup=void 0,e.text=void 0,e.visible=!0,e}return __extends(e,t),e._cloneCustomizer=function(t){if(t instanceof Popup_1.Popup||_.isElement(t))return t},e}(Options_1.Options);exports.HtmlMarkerOptions=HtmlMarkerOptions; },{"../Pixel":168,"../Popup":169,"../helpers/Options":173,"../namespace/data/Position":244,"lodash":108,"uuid-random":161}],278:[function(require,module,exports){ "use strict";var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var _=require("lodash"),Options_1=require("../helpers/Options"),Position_1=require("../namespace/data/Position"),Pixel_1=require("../Pixel"),PopupOptions=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.position=new Position_1.Position(0,0),e.content=document.createElement("span"),e.pixelOffset=new Pixel_1.Pixel(0,0),e.closeButton=!0,e}return __extends(e,t),e._cloneCustomizer=function(t){if(_.isElement(t))return t},e}(Options_1.Options);exports.PopupOptions=PopupOptions; },{"../Pixel":168,"../helpers/Options":173,"../namespace/data/Position":244,"lodash":108}],279:[function(require,module,exports){ module.exports={ "env": { "domain": "atlas.microsoft.com", "staticAssetsDomain": "atlas.microsoft.com", "styleDefinitionsPath": "styles/definitions/2018-05-31.json", "appInsightsKey": "e96cb745-c6f5-409c-a775-c4313e468c1d", "aadInstance": "https://login.microsoftonline.com/" }, "constants": { "resourceId": "https://atlas.microsoft.com/", "authorizationHeaderName": "Authorization", "authorizationTokenPrefix": "Bearer ", "msClientIdHeaderName": "x-ms-client-id", "sessionIdHeaderName": "Session-Id", "msOriginHeaderName": "Ms-Am-Request-Origin", "msOriginHeaderValue": "MapControl", "mapAgentHeaderName": "Map-Agent" } } },{}]},{},[181])(181) });