azure-maps-control 3.2.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atlas-core-bare-snr-min.js +1 -1
- package/dist/atlas-core-bare-snr.js +295 -160
- package/dist/atlas-core-bare.js +295 -160
- package/dist/atlas-core-bare.min.js +1 -1
- package/dist/atlas-core-snr.js +295 -160
- package/dist/atlas-core.js +295 -160
- package/dist/atlas-core.min.js +1 -1
- package/dist/atlas-esm.js +295 -160
- package/dist/atlas-esm.min.js +3 -3
- package/dist/atlas.css +45 -6
- package/dist/atlas.js +295 -160
- package/dist/atlas.min.css +1 -1
- package/dist/atlas.min.js +1 -1
- package/package.json +3 -3
- package/typings/index.d.ts +11 -1
|
@@ -52,4 +52,4 @@ Elle s’applique également, même si Microsoft connaissait ou devrait connaît
|
|
|
52
52
|
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("azuremaps-maplibre-gl")):"function"==typeof define&&define.amd?define(["exports","azuremaps-maplibre-gl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).atlas=e.atlas||{},e.maplibregl)}(this,function(l,D){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function q(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function U(o){var t,r;return o.__esModule?o:("function"==typeof(t=o.default)?(r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)}).prototype=t.prototype:r={},Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(o).forEach(function(e){var t=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(r,e,t.get?t:{enumerable:!0,get:function(){return o[e]}})}),r)}for(var j,H,t={exports:{}},o=U(Object.freeze({__proto__:null,default:{}})),B=t,F=0,z=[],K=0;K<256;K++)z[K]=(K+256).toString(16).substr(1);function G(){e=16,(!j||Y.BUFFER_SIZE<F+e)&&(F=0,j=Y.randomBytes(Y.BUFFER_SIZE));var e=j.slice(F,F+=e);return e[6]=15&e[6]|64,e[8]=63&e[8]|128,e}function Y(){var e=G();return z[e[0]]+z[e[1]]+z[e[2]]+z[e[3]]+"-"+z[e[4]]+z[e[5]]+"-"+z[e[6]]+z[e[7]]+"-"+z[e[8]]+z[e[9]]+"-"+z[e[10]]+z[e[11]]+z[e[12]]+z[e[13]]+z[e[14]]+z[e[15]]}Y.BUFFER_SIZE=4096,Y.bin=G,Y.clearBuffer=function(){j=null,F=0},Y.test=function(e){return"string"==typeof e&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},"undefined"!=typeof crypto?H=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(H=window.msCrypto),H=H||o,(B.exports=Y).randomBytes=function(){if(H){if(H.randomBytes)return H.randomBytes;if(H.getRandomValues)return"function"!=typeof Uint8Array.prototype.slice?function(e){e=new Uint8Array(e);return H.getRandomValues(e),Array.from(e)}:function(e){e=new Uint8Array(e);return H.getRandomValues(e),e}}return function(e){for(var t=[],o=0;o<e;o++)t.push(Math.floor(256*Math.random()));return t}}();var W=q(t.exports),Z="atlas.microsoft.com",Q="atlas.microsoft.com",o="styling",B="2023-01-01",V="https://login.microsoftonline.com/",J="api-version",X="Authorization",$="Bearer ",ee="jwt-sas ",te="{{azMapsDomain}}",oe="{azMapsDomain}",re="{{azMapsView}}",ne="view",ie="{{azMapsLanguage}}",ae="{{azMapsStylingPath}}",se="{{azMapsStylePath}}",ce="styling",ue="styles",t="2.0",le="Map-Agent",he="x-ms-client-id",de="Ms-Am-Request-Origin",pe="MapControl",fe="https://atlas.microsoft.com/.default",ge="Session-Id",me=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ye=(ve.prototype.merge=function(){for(var t,e,o,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var i=me(r),a=i.next();!a.done;a=i.next()){var s=a.value;if(s)for(var c in s)s.hasOwnProperty(c)&&this.hasOwnProperty(c)&&(void 0!==s[c]&&null!=s[c]?this[c]instanceof ve?this[c].merge(s[c]):this[c]=s[c]:(o=o||new(Object.getPrototypeOf(this).constructor),this[c]=o[c]))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return this},ve);function ve(){}var _e,we,be=window&&window.__extends||(_e=function(e,t){return(_e=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}_e(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Ce=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},Ee=(be(Se,we=ye),Se);function Se(){var e=null!==we&&we.apply(this,arguments)||this;return e.domain=void 0,e.headers={},e.path="",e.protocol="https",e.queryParams={},e.subdomain="",e}Ie.prototype.get=function(){return fetch(this.toString(),{method:"GET",mode:"cors",headers:new Headers(this.options.headers)}).then(function(e){if(e.ok)return e.json();throw new Error("HTTP ".concat(e.status,": ").concat(e.statusText))})},Ie.prototype.toString=function(){var e=this,t=Object.entries(e.options.queryParams).map(function(e){var e=Ce(e,2),t=e[0],e=e[1];return"".concat(t,"=").concat(e)}).join("&"),o=[],r=e.options.path||"";return Ie.protoRegEx.test(r)?o.push(r):(e.options.domain&&(Ie.protoRegEx.test(e.options.domain)||(o.push("".concat(e.options.protocol,"://")),o.push(e.options.subdomain?"".concat(e.options.subdomain,"."):"")),o.push(e.options.domain)),o.push(e.options.path?"/".concat(r):"")),o.push(t?"?".concat(t):""),o.join("")},Ie.protoRegEx=new RegExp(/^(((file|http|https):\/\/)|blob:)/i);var Te=Ie;function Ie(e){this.options=(new Ee).merge(e)}Ae.parse=function(e){var t=(e=e.toLowerCase()).lastIndexOf("-");return-1!==t?{code:e,language:e.substring(0,t),region:e.substring(t+1)}:{code:e,language:e}};var ke=Ae;function Ae(){}var Pe={localizationsPath:"locs/mapcontrol/2019-3-12",sensitiveUserRegions:["il","kr","pk","in","cn","ar","bh","eg","jo","sa","kw","om","qa","ma","ae"],locales:{defaultLanguage:{defaultRegion:{code:"NGT",strings:"en/resource.json"},latn:{code:"NGT-Latn",strings:"en/resource.json"}},ar:{defaultRegion:{code:"ar",strings:"ar-sa/resource.json"}},bg:{defaultRegion:{code:"bg-BG",strings:"bg-bg/resource.json"}},cs:{defaultRegion:{code:"cs-CZ",strings:"cs-cz/resource.json"}},da:{defaultRegion:{code:"da-DK",strings:"da-dk/resource.json"}},de:{defaultRegion:{code:"de-DE",strings:"de-de/resource.json"}},el:{defaultRegion:{code:"el-GR",strings:"el-gr/resource.json"}},en:{defaultRegion:{code:"en",strings:"en/resource.json"},us:{code:"en-US",strings:"en/resource.json"},au:{code:"en-AU",strings:"en/resource.json"},gb:{code:"en-GB",strings:"en/resource.json"},nz:{code:"en-NZ",strings:"en/resource.json"}},es:{defaultRegion:{code:"es-ES",strings:"es-es/resource.json"},mx:{code:"es-MX",strings:"es-mx/resource.json"}},fi:{defaultRegion:{code:"fi-FI",strings:"fi-fi/resource.json"}},fr:{defaultRegion:{code:"fr-FR",strings:"fr-fr/resource.json"}},hu:{defaultRegion:{code:"hu-HU",strings:"hu-hu/resource.json"}},id:{defaultRegion:{code:"id-ID",strings:"id-id/resource.json"}},it:{defaultRegion:{code:"it-IT",strings:"it-it/resource.json"}},ko:{defaultRegion:{code:"ko-KR",strings:"ko-kr/resource.json"}},lt:{defaultRegion:{code:"lt-LT",strings:"lt-lt/resource.json"}},ms:{defaultRegion:{code:"ms-MY",strings:"ms-my/resource.json"}},nb:{defaultRegion:{code:"nb-NO",strings:"nb-no/resource.json"}},nl:{defaultRegion:{code:"nl-NL",strings:"nl-nl/resource.json"}},pl:{defaultRegion:{code:"pl-PL",strings:"pl-pl/resource.json"}},pt:{defaultRegion:{code:"pt-PT",strings:"pt-pt/resource.json"},br:{code:"pt-BR",strings:"pt-br/resource.json"}},ru:{defaultRegion:{code:"ru-RU",strings:"ru-ru/resource.json"}},sk:{defaultRegion:{code:"sk-SK",strings:"sk-sk/resource.json"}},sl:{defaultRegion:{code:"sl-SL",strings:"sl-sl/resource.json"}},sv:{defaultRegion:{code:"sv-SE",strings:"sv-se/resource.json"}},th:{defaultRegion:{code:"th-TH",strings:"th-th/resource.json"}},tr:{defaultRegion:{code:"tr-TR",strings:"tr-tr/resource.json"}},zh:{defaultRegion:{code:"zh",strings:"en/resource.json"}},"zh-hans":{defaultRegion:{code:"zh-Hans",strings:"zh-cn/resource.json"},cn:{code:"zh-Hans-CN",strings:"zh-cn/resource.json"}},"zh-hant":{defaultRegion:{code:"zh-Hant",strings:"en/resource.json"},tw:{code:"zh-Hant-TW",strings:"zh-tw/resource.json"}}}},Oe=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"},Re=(xe.getCode=function(e){var t=ke.parse(e);return-1===Pe.sensitiveUserRegions.indexOf(t.region)?this.getLocaleData(t).code:e},xe.getStrings=function(e){e=this.getLocaleData(e);return Pe.locales.defaultLanguage.defaultRegion.code===e.code?new Promise(function(e){e(new Oe)}):new Te({domain:Q,path:"".concat(Pe.localizationsPath,"/").concat(e.strings)}).get().then(function(e){return e},function(){return new Oe})},xe.getLocaleData=function(e){if("string"==typeof e&&(e=ke.parse(e)),Pe.locales[e.code])return Pe.locales[e.code].defaultRegion;var t;if(Pe.locales[e.language])t=Pe.locales[e.language];else{if(-1!==e.language.indexOf("-"))return this.getLocaleData(e.language);t=Pe.locales.defaultLanguage}return e.region&&t[e.region]?t[e.region]:t.defaultRegion},xe);function xe(){}Ne.getEdgeOrIEVersion=function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");return 0<t?parseInt(e.substring(t+5,e.indexOf(".",t)),10):0<e.indexOf("Trident/")?(t=e.indexOf("rv:"),parseInt(e.substring(t+3,e.indexOf(".",t)),10)):0<(t=e.indexOf("Edge/"))?parseInt(e.substring(t+5,e.indexOf(".",t)),10):-1},Ne.isEdgeOrIE=function(){return-1!==this.getEdgeOrIEVersion()},Ne.isIE=function(){var e=this.getEdgeOrIEVersion();return-1!==e&&e<=11};var Me=Ne;function Ne(){}var Le="3.2.1",De=(qe.getFullVersion=function(){return Le},qe.getEndpointVersion=function(){var e=Le.indexOf(".");return-1===(e=Le.indexOf(".",e+1))?Le:Le.substring(0,e)},qe);function qe(){}var Ue,je,be=window&&window.__extends||(Ue=function(e,t){return(Ue=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Ue(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),He=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},Be=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},Fe=(l.AuthenticationType=void 0,(r=l.AuthenticationType||(l.AuthenticationType={})).subscriptionKey="subscriptionKey",r.aad="aad",r.anonymous="anonymous",r.sas="sas",be(ze,je=ye),ze.prototype.setSubscriptionKey=function(e){this.authType=l.AuthenticationType.subscriptionKey,this.subscriptionKey=e},ze.prototype.setAadProperties=function(e,t,o,r,n){this.authType=l.AuthenticationType.aad,this.authContext=n||this.authContext,this.aadInstance=r||this.aadInstance,this.clientId=e,this.aadAppId=t,this.aadTenant=o},ze.prototype.setTokenCallbackFunction=function(e){this.authType=l.AuthenticationType.anonymous,this.getToken=e},ze.prototype.setSasCallbackFunction=function(e){this.authType=l.AuthenticationType.sas,this.getToken=e},ze.prototype.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=je.prototype.merge.apply(this,Be([],He(e),!1));return o.authType===l.AuthenticationType.subscriptionKey?o.authContext=o.aadAppId=o.getToken=void 0:o.authType===l.AuthenticationType.aad?o.subscriptionKey=o.getToken=void 0:o.authType===l.AuthenticationType.anonymous?o.subscriptionKey=o.authContext=o.aadAppId=void 0:o.authType===l.AuthenticationType.sas&&(o.authContext=o.subscriptionKey=o.aadAppId=void 0),o},ze);function ze(){var e=null!==je&&je.apply(this,arguments)||this;return e.authType=void 0,e.subscriptionKey=void 0,e.clientId=void 0,e.aadAppId=void 0,e.aadTenant=void 0,e.aadInstance=void 0,e.getToken=void 0,e.sasToken=void 0,e.authContext=void 0,e}var Ke;var Ge="NGT",Ye=W(),We=Z,Ze=Q,Qe=o,Ve=B,Je=t,Xe=new Fe,$e=!1,et=!1,tt=!1,ot=!1,rt=!1,nt=!1,it=!1,at=!1,st=!1;function ct(){return Object.assign({},Xe)}function ut(){return Ze}function lt(){return We}function ht(){return Qe}function dt(){return Ve}function pt(){return Je}function ft(){return D.getWorkerCount()}function gt(){return D.getMaxParallelImageRequests()}function mt(){return Ge}function yt(){return Ye}function vt(){return Xe.authType===l.AuthenticationType.subscriptionKey?Xe.subscriptionKey:void 0}function _t(){return Ke}function wt(e){Xe=(new Fe).merge(Xe,e),st=!0}function bt(e){We=e,et=!0}function Ct(e){Qe=e,tt=!0}function Et(e){0<e&&(D.setWorkerCount(e),rt=!0)}function St(e){0<e&&(D.setMaxParallelImageRequests(e),nt=!0)}function Tt(e){Ge=Re.getCode(e),it=!0}function It(e){Ye=e,at=!0}function kt(e){Xe.setSubscriptionKey(e),st=!0}function At(e){Ke=e,$e=!0}function Pt(e,t){if(t=Math.abs(t||1),"string"==typeof e&&zt[e.toLowerCase()]){for(var o=zt[e.toLowerCase()],r=/calc\(([0-9.]+)[px]*\s*\*\s*\{scale\}\)/gi,n=o,i=r.exec(o);i;)n=n.replace(i[0],parseFloat(i[1])*t+""),i=r.exec(o);return n=n.replace("{scale}",t+"")}throw new Error("Invalid templateName.")}function Ot(){return st}function Rt(){return et}function xt(){return tt}function Mt(){return rt}function Nt(){return nt}function Lt(){return it}function Dt(){return at}function qt(){return $e}function Ut(){var e=new Te({domain:Q,path:"sdk/javascript/mapcontrol/".concat(De.getEndpointVersion(),"/mapbox-gl-rtl-text.min.js")});D.setRTLTextPlugin(e.toString(),!0).catch(function(e){e&&console.warn(e)})}function jt(e){var t=document.createElement("span");return t.innerText=e,t.classList.add("tooltiptext"),-1!=navigator.userAgent.indexOf("Edg")?t.classList.add("edge"):-1!=navigator.userAgent.indexOf("Chrome")?t.classList.add("chrome"):-1!=navigator.userAgent.indexOf("Safari")?t.classList.add("safari"):-1!=navigator.userAgent.indexOf("Firefox")&&t.classList.add("firefox"),-1!=navigator.userAgent.indexOf("Windows")?t.classList.add("win"):-1!=navigator.userAgent.indexOf("Macintosh")&&t.classList.add("mac"),t}function Ht(n,i,a){function e(e){var t=i.getBoundingClientRect(),o=n.getBoundingClientRect(),r=t.x+o.width>window.innerWidth?window.innerWidth-o.width:t.x,o=t.y+t.height+o.height+4>window.innerHeight?t.y-o.height-4:t.y+t.height+4;a&&i.parentElement&&(t=i.parentElement?i.parentElement.getBoundingClientRect():null,n.style.position="absolute",r-=t.x,o-=t.y),n.style.transform="translate(".concat(r,"px, ").concat(o,"px)"),n.style.display="block"}void 0===a&&(a=!1),i.addEventListener("mouseover",e),i.addEventListener("focusin",e),i.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||"block"!==n.style.display||(e.stopPropagation(),n.style.display="none")})}var Bt,Ft,zt={marker:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(27 * {scale})" height="calc(39 * {scale})" viewBox="-1 -1 26 38"><path d="M12.25.25a12.254 12.254 0 0 0-12 12.494c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z" style="fill:{color};stroke:{secondaryColor};stroke-width:1"/><text x="12.5" y="17.5" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(28 * {scale})" height="calc(39 * {scale})" viewBox="-1 -1 27 38"><path d="M12.25.25a12.254 12.254 0 0 0-12 12.494c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z" style="fill:{color};stroke:{secondaryColor};stroke-width:2"/><text x="12.5" y="18.5" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-circle":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(28 * {scale})" height="calc(39 * {scale})" viewBox="-1 -1 27 38"><path d="M12.25.25a12.254 12.254 0 0 0-12 12.494c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z" style="fill:{color};stroke:{secondaryColor};stroke-width:1"/><circle cx="12.5" cy="12.5" r="9" fill="{secondaryColor}"/><text x="12" y="17.5" style="font-size:14px;fill:#000;text-anchor:middle">{text}</text></svg>',pin:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(24 * {scale})" height="calc(28 * {scale})" viewBox="0 0 24 28"><path d="m11.988 16.615a5.15 5.15 0 0 1-2.268-.525 4.909 4.909 0 0 1-2.805-4.442 5.019 5.019 0 0 1 5.072-4.936h.012a5.03 5.03 0 0 1 5.085 4.961 4.907 4.907 0 0 1-.549 2.224 5.114 5.114 0 0 1-4.548 2.718zm0-8.06a3.173 3.173 0 0 0-3.226 3.099 3.081 3.081 0 0 0 1.77 2.782 3.299 3.299 0 0 0 4.365-1.386 3.049 3.049 0 0 0 .342-1.381 3.184 3.184 0 0 0-3.239-3.114h-.012z" fill="{secondaryColor}"/><path d="m11.999.922a10.908 10.908 0 0 0-11.076 10.732 10.639 10.639 0 0 0 4.418 8.598l6.658 6.464 6.658-6.463a10.537 10.537 0 0 0 2.198-15.041 11.182 11.182 0 0 0-8.856-4.289zm1.873 14.341a4.221 4.221 0 0 1-5.589-1.789 3.945 3.945 0 0 1-.445-1.8 4.164 4.164 0 0 1 8.323-.037 4.028 4.028 0 0 1-2.289 3.626Z" fill="{color}"/><path d="m11.999 28-7.256-7.044a11.611 11.611 0 0 1-4.743-9.303 11.844 11.844 0 0 1 11.988-11.652.102 .102 0 0 1 .02 0 12.164 12.164 0 0 1 9.577 4.647 11.357 11.357 0 0 1 2.299 8.614 11.521 11.521 0 0 1-4.63 7.695zm-.01-26.157a9.997 9.997 0 0 0-10.143 9.812 9.769 9.769 0 0 0 4.04 7.853l.099.083 6.014 5.838 6.113-5.922a9.7 9.7 0 0 0 3.945-6.505 9.533 9.533 0 0 0-1.933-7.229 10.305 10.305 0 0 0-8.116-3.931h-.021zm.021 14.772a5.11 5.11 0 0 1-4.547-2.718 4.868 4.868 0 0 1 .932-5.743 5.118 5.118 0 0 1 3.58-1.46h.024a5.031 5.031 0 0 1 5.084 4.938 4.92 4.92 0 0 1-2.805 4.457h0a5.152 5.152 0 0 1-2.269.525zm-.011-8.079h-.015a3.277 3.277 0 0 0-2.295.933 3.029 3.029 0 0 0-.587 3.58 3.297 3.297 0 0 0 4.364 1.386h0a3.092 3.092 0 0 0 1.772-2.795 3.185 3.185 0 0 0-3.239-3.105z" fill="{secondaryColor}"/><text x="12" y="17" style="font-size:14px;fill:#000;text-anchor:middle">{text}</text></svg>',"pin-round":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(25 * {scale})" height="calc(25 * {scale})" viewBox="0 0 25 25"><g transform="translate(0 1)"><circle cx="12.25" cy="11.5833" r="11" fill="{color}"/><path d="m12.25 23.583a12 12 0 1 1 12-12 12 12 0 0 1-12 12zm0-22a10 10 0 1 0 10 10 10 10 0 0 0-10-10z" fill="{secondaryColor}"/><circle cx="12.25" cy="11.5833" r="4.2386" fill="{secondaryColor}"/></g><text x="12.5" y="17" style="font-size:14px;fill:#000;text-anchor:middle">{text}</text></svg>',"marker-flat":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(27 * {scale})" height="calc(42.8 * {scale})" viewBox="0 0 1600 2570"><g fill="{color}"><path d="M691 2419c-409-575-641-1086-683-1504-10-106-10-136 5-224 31-188 105-330 241-458 129-124 270-190 453-214 69-9 113-10 182-1 373 46 655 326 703 698 40 308-120 801-424 1309-134 224-348 535-369 535-4 0-53-63-108-141z"/></g><g fill="rgba(0,0,0,0.15)" style="transform:scale(-1,1);transform-origin:center"><path d="M691 2419c-407-571-639-1083-682-1498-14-139-3-249 37-371 69-208 254-402 459-481 68-27 217-59 271-59h24v160 180 940 635c0 349-2 635-5 635-2 0-49-63-104-141z"/></g><circle cx="800" cy="800" r="600" fill="{secondaryColor}"/><text x="800" y="1100" style="font-size:800px;fill:#000;text-anchor:middle">{text}</text></svg>',"marker-arrow":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(25.47 * {scale})" height="calc(35.18 * {scale})" viewBox="0 0 4330 5980"><g fill="{color}"><path d="m2080 5969c-49-20-93-63-115-113-25-55-1928-5486-1953-5573-40-138 67-282 210-283 36 0 246 73 987 345 518 190 947 345 955 345 8 0 438-155 955-345 615-226 954-345 979-345 87 0 165 47 204 123 46 91 107-95-957 2942-537 1535-986 2805-997 2823-11 18-43 46-72 62-41 24-62 30-111 29-33 0-71-5-85-10z"/></g><g fill="{secondaryColor}"><path d="m2200 1600c-36 10-83 2-484-84-243-53-451-94-461-91-11 4-22 18-25 31-5 19 114 371 436 1292 244 697 448 1273 454 1281 19 24 50 30 71 12z"/><path d="m2200 1600c-36 10-83 2-484-84-243-53-451-94-461-91-11 4-22 18-25 31-5 19 114 371 436 1292 244 697 448 1273 454 1281 19 24 50 30 71 12z" style="transform:scale(-1,1);transform-origin:center"/></g><g fill="rgba(0,0,0,0.2)" ><path d="m2165 685c8 0 438-155 955-345 615-226 954-345 979-345 87 0 165 47 204 123 46 91 107-95-957 2942-537 1535-986 2805-997 2823-11 18-43 46-72 62-41 24-62 30-111 29z"/></g><text x="2165" y="3300" style="font-size:2500px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-ball-pin":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(15.67 * {scale})" height="calc(33.33 * {scale})" viewBox="0 0 235 452"><g transform="translate(-135 10)"><path fill="{secondaryColor}" d="m256 442 0 0c-13 0-18-11-18-24l-6-323c0-13 11-24 24-24h0c13 0 24 11 24 24l-6 323c0 13-5 24-18 24z"/><circle style="fill:{color};stroke-width:10;stroke:{secondaryColor}" cx="256" cy="112" r="111"/><ellipse transform="matrix(0.834 0.5518 -0.5518 0.834 65.7916 -97.18)" fill="rgba(255,255,255,0.3)" cx="194.399" cy="60.749" rx="19.076" ry="32.428"/></g><text x="117.5" y="160" style="font-size:160px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-square":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(26.67 * {scale})" height="calc(32.27 * {scale})" viewBox="0 0 2000 2420"><g transform="translate(100 100)" style="stroke:{secondaryColor};stroke-width:100;fill:{color}"><path d="M845 2152c-22-37-58-95-80-129-22-35-62-99-90-143l-50-80-312 0-313 0 0-900 0-900 900 0 900 0 0 900 0 900-313 0-313 0-34 58c-19 31-38 59-42 60-5 2-8 8-8 12 0 9-69 123-88 145-5 6-11 15-13 21-16 39-77 123-89 124-8 0-33-31-55-68z"/></g><text x="1000" y="1300" style="font-size:1000px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-square-cluster":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(33.33 * {scale})" height="calc(38.8 * {scale})" viewBox="0 0 2500 2910"><g transform="translate(100 100)" style="stroke:{secondaryColor};stroke-width:100;fill:{color}"><path d="m866 2652c-17-31-37-68-46-82-9-14-32-54-51-90-19-36-50-92-70-125l-36-60-332-3-331-2 0-905 0-905 660 0 660 0 0-38c0-71 50-196 102-258 71-85 189-164 244-164 12 0 26-4 29-10 8-13 222-13 230 0 3 6 17 10 30 10 25 0 117 45 154 76 130 107 191 232 191 392 0 155-63 284-190 386-36 29-129 76-150 76-11 0-22 5-25 10-3 6-31 10-61 10l-54 0 0 660 0 660-332 2-332 3-29 50c-17 28-48 84-70 125-22 41-47 86-56 100-9 14-30 51-46 83-17 32-36 57-45 57-8 0-28-25-44-58z"/></g><text x="1650" y="900" style="font-size:1000px;fill:#fff">+</text><text x="1000" y="1800" style="font-size:1000px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-square-rounded":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(26.8 * {scale})" height="calc(32.27 * {scale})" viewBox="0 0 2010 2410"><g transform="translate(100 100)" style="stroke:{secondaryColor};stroke-width:100;fill:{color}"><path d="M856 2155c-20-30-36-59-36-65 0-5-4-10-10-10-5 0-10-5-10-11 0-5-18-37-40-69-22-32-40-64-40-69 0-6-4-11-10-11-5 0-10-5-10-10 0-6-15-33-32-60l-33-50-127 0c-74 0-129-4-133-10-3-5-17-10-30-10-25 0-116-45-155-76-87-69-142-151-178-265-15-46-17-1075-2-1084 5-3 10-17 10-30 0-13 5-27 10-30 6-3 10-13 10-22 0-22 83-135 122-168 57-46 62-50 112-75l50-25 585 0 586 0 63 34c84 46 169 133 212 218l35 68 0 565 0 565-28 59c-32 69-100 157-139 180-15 9-33 22-40 29-23 22-99 57-123 57-13 0-27 5-30 10-4 6-60 10-135 10l-128 0-128 205c-84 136-133 205-144 205-10 0-33-24-54-55z"/></g><text x="1000" y="1300" style="font-size:1000px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-square-rounded-cluster":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(33.33 * {scale})" height="calc(32.13 * {scale})" viewBox="0 0 2500 2900"><g transform="translate(100 100)" style="stroke:{secondaryColor};stroke-width:100;fill:{color}"><path d="m874 2669c-9-18-26-49-37-68-11-20-30-55-43-78-13-24-36-64-51-90-14-27-38-69-52-95l-26-48-142 0c-84 0-144-4-148-10-3-5-17-10-30-10-25 0-118-46-154-76-91-76-136-142-175-254-13-38-16-119-16-554 0-358 3-520 12-545 40-125 106-219 195-278 127-84 116-83 646-83l467 0 0-42c0-46 11-87 45-163 54-121 169-220 306-264 46-14 232-14 278 0 165 53 284 175 340 350 19 61 14 204-10 273-32 91-94 178-169 240-38 31-130 76-155 76-13 0-27 5-30 10-3 6-28 10-56 10l-49 0 0 462c0 446-1 464-21 522-32 91-94 178-169 240-38 31-130 76-155 76-13 0-27 5-30 10-4 6-65 10-149 10-138 0-143 1-154 23-12 23-62 114-112 202-16 28-44 79-63 115-42 77-67 88-93 39z"/></g><text x="1650" y="900" style="font-size:1000px;fill:#fff">+</text><text x="1000" y="1800" style="font-size:1000px;fill:#fff;text-anchor:middle">{text}</text></svg>',flag:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(23.5 * {scale})" height="calc(40 * {scale})" viewBox="34 28 198 308"><path style="stroke:{secondaryColor};stroke-width:15;stroke-linecap:round;" d="M42 327l0 -291"/><path style="fill:{color};stroke:{secondaryColor};stroke-width:10;stroke-linejoin:round;" d="M49 50c70 30 104 28 178 2-21 42-21 74 0 116-72 25-101 25-178 0l0-118z"/><text x="130" y="165" style="font-size:100px;fill:#fff;text-anchor:middle">{text}</text></svg>',"flag-triangle":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(27 * {scale})" height="calc(35.33 * {scale})" viewBox="0 0 40.5 53"><g transform="translate(-31 -20)"><path fill="{secondaryColor}" d="M34.7,73.3V48.4l34.6-10.1c0.7-0.2,1.2-0.8,1.2-1.5s-0.4-1.4-1-1.7L33.7,20.5c-0.5-0.2-1.1-0.2-1.6,0.2 c-0.5,0.3-0.7,0.8-0.7,1.4v51.2H34.7z"/><polygon points="34.7,24.5 66,36.5 34.7,45 34.7,10" fill="{color}"/></g><text x="11" y="21" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"rounded-square":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(34 * {scale})" height="calc(34 * {scale})" viewBox="0 0 34 34"><g transform="translate(2 2)"><rect x="0" y="0" rx="8" ry="8" width="30" height="30" style="stroke:{secondaryColor};stroke-width:2;fill:{color}"/></g><text x="17" y="22" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"rounded-square-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(38 * {scale})" height="calc(38 * {scale})" viewBox="0 0 38 38"><g transform="translate(4 4)"><rect x="0" y="0" rx="8" ry="8" width="30" height="30" style="stroke:{secondaryColor};stroke-width:4;fill:{color}"/></g><text x="19" y="24" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',triangle:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(36 * {scale})" height="calc(36 * {scale})" viewBox="0 0 36 36"><g transform="translate(2 2)"><polygon points="16,0 32,32 0,32 16,0" style="stroke:{secondaryColor};stroke-width:2;fill:{color}"/></g><text x="17.5" y="30" style="font-size:12px;fill:#fff;text-anchor:middle">{text}</text></svg>',"triangle-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(40 * {scale})" height="calc(40 * {scale})" viewBox="0 0 40 40"><g transform="translate(4 4)"><polygon points="16,0 32,32 0,32 16,0" style="stroke:{secondaryColor};stroke-width:4;fill:{color}"/></g><text x="19.5" y="32" style="font-size:12px;fill:#fff;text-anchor:middle">{text}</text></svg>',hexagon:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(35 * {scale})" height="calc(40 * {scale})" viewBox="0 0 35 40"><g transform="translate(2 2)"><path d="M31 9 15.5 0 0 9 0 27 15.5 36 31 27 31 9Z" style="stroke:{secondaryColor};stroke-width:2;fill:{color}"/></g><text x="17.5" y="25" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"hexagon-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(39 * {scale})" height="calc(44 * {scale})" viewBox="0 0 39 44"><g transform="translate(4 4)"><path d="M31 9 15.5 0 0 9 0 27 15.5 36 31 27 31 9Z" style="stroke:{secondaryColor};stroke-width:4;fill:{color}"/></g><text x="19.5" y="27" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"hexagon-rounded":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(40 * {scale})" height="calc(40 * {scale})" viewBox="0 0 1100 1100"><g transform="translate(50 50)"><path style="stroke:{secondaryColor};stroke-width:50;fill:{color}" d="M881 210 561 25c-33-19-88-19-121 0L119 210c-33 19-61 67-61 105v370c0 39 27 86 61 105l321 185c33 19 88 19 122 0l321-185c33-19 61-67 61-105V315C942 276 915 229 881 210z"/></g><text x="550" y="700" style="font-size:400px;fill:#fff;text-anchor:middle">{text}</text></svg>',"hexagon-rounded-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(40 * {scale})" height="calc(40 * {scale})" viewBox="0 0 1200 1200"><g transform="translate(100 100)"><path style="stroke:{secondaryColor};stroke-width:100;fill:{color}" d="M881 210 561 25c-33-19-88-19-121 0L119 210c-33 19-61 67-61 105v370c0 39 27 86 61 105l321 185c33 19 88 19 122 0l321-185c33-19 61-67 61-105V315C942 276 915 229 881 210z"/></g><text x="600" y="750" style="font-size:400px;fill:#fff;text-anchor:middle">{text}</text></svg>',"triangle-arrow-up":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(28 * {scale})" height="calc(28 * {scale})" viewBox="0 0 28 28"><g transform="translate(2 2)"><polygon points="12,0 0,24 12,17 24,24" stroke-width="2" stroke="{secondaryColor}" fill="{color}"/></g><text x="14" y="17" style="font-size:8px;fill:#fff;text-anchor:middle">{text}</text></svg>',"triangle-arrow-left":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(28 * {scale})" height="calc(28 * {scale})" viewBox="0 0 28 28"><g transform="translate(2 2)"><polygon points="24,12 0,0 7,12 0,24" stroke-width="2" stroke="{secondaryColor}" fill="{color}"/></g><text x="14" y="16.5" style="font-size:8px;fill:#fff;text-anchor:middle">{text}</text></svg>',"arrow-up":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(12.16 * {scale})" height="calc(30.1 * {scale})" viewBox="0 0 902 364"><g fill="{color}" transform="matrix(0,2.4,-2.4,0,897,-930)"><polygon points="902,222 233,222 233,364 0,182 233,0 233,141 902,141 902,222"/></g><text x="450" y="700" style="font-size:900px;fill:#000;text-anchor:middle">{text}</text></svg>',"arrow-up-thin":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(16 * {scale})" height="calc(33.33 * {scale})" viewBox="0 0 12 25"><g transform="translate(-136.91823 -751.91998)"><path fill="{color}" d="m148.271 760.71c-1.641-.547-3.186-1.47-4.633-2.769l0 18.07-1.675 0 0-18.07c-1.447 1.299-2.986 2.222-4.616 2.769l0-1.231c2.325-1.596 4.006-3.812 5.043-6.65l.838 0c1.037 2.838 2.718 5.055 5.043 6.65l0 1.231z"/></g><text x="6" y="20" style="font-size:10px;fill:#000;text-anchor:middle">{text}</text></svg>',car:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(21.93 * {scale})" height="calc(40.9 * {scale})" viewBox="0 0 6580 12270"><g transform="translate(0 12270) rotate(-90)"><path fill="{secondaryColor}" d="M7045 6566c-42-13-105-44-105-51 0-2 23-105 50-228 28-123 50-230 50-236 0-8-241-11-907-11-855 0-1145 6-1513 30-85 6-189 13-230 15-41 3-133 10-205 15-286 21-430 32-705 50-953 63-1459 18-2335-205-304-77-746-209-799-238-131-72-221-408-285-1062-34-345-42-532-48-1130-16-1557 108-2532 336-2649 32-17 469-149 676-205 409-110 819-191 1205-238 116-14 224-18 540-18 395 1 494 5 1140 50 1124 79 1224 82 2496 78l641-3-53-237c-29-131-52-238-51-239 1-1 31-14 66-29 56-23 76-26 142-23 67 3 83 7 120 33 23 17 50 41 61 55 10 14 51 117 91 230l73 205 674 3 675 2 90-39c98-43 198-72 315-93 122-21 829-18 990 5 321 45 626 143 849 270 293 168 516 378 704 662 266 402 416 893 467 1527 15 174 8 882-9 998-6 41-18 127-27 190-69 502-253 969-523 1325-79 105-262 284-381 374-189 142-355 229-574 300-336 110-526 139-952 148-457 9-685-23-887-124l-47-24-678-6-678-6-64 179c-79 224-92 253-121 284-67 70-177 97-274 66zm-2752-5073c-23-2-64-2-90 0-26 2-7 3 42 3 50 0 71-1 48-3zm395 0c-21-2-55-2-75 0-21 2-4 4 37 4 41 0 58-2 38-4z"/><path fill="{color}" d="M7043 6498c-13-6-23-19-23-28 0-9 23-117 50-240 28-123 50-230 50-237 0-22-2126-13-2465 10-132 10-400 28-595 42-661 47-824 55-1160 62-435 7-656-8-1040-73-415-70-865-183-1447-365-168-53-272-556-325-1569-16-319-16-1311 0-1630 45-872 129-1366 257-1518 22-26 51-39 172-77 557-177 1122-310 1563-369 271-36 351-40 690-40 361 1 463 6 1165 54 1122 78 1288 83 2337 79 460-2 840-7 843-11 4-4-17-117-47-252l-55-245 39-16c76-30 180-8 224 47 10 13 54 124 98 246l79 222 709 0 709 0 47-24c74-37 219-83 322-101 122-22 606-32 802-16 374 29 658 102 933 238 124 62 271 155 361 230l61 51 6 100c19 278 103 497 247 643 88 89 173 136 278 152l70 11 41 131c116 369 159 673 168 1170 10 584-38 984-167 1397l-40 126-70 12c-193 33-348 175-441 405-56 139-89 302-89 445 0 43-3 47-58 91-290 235-644 384-1068 450-191 29-796 39-974 16-135-18-263-54-368-102l-75-35-701 0-701 0-79 223c-82 232-102 267-163 293-38 16-138 17-170 2zm-2023-820c332-15 1155-12 1835 6 308 8 563 12 566 8 4-4 10-21 13-38 7-30 6-31-92-77-518-244-1197-396-2112-474-295-25-1282-25-1579 0-231 20-473 46-479 51-6 7 49 110 93 171 160 226 416 335 855 365 142 10 539 5 900-12zm3304-263c525-111 899-887 934-1935 19-557-37-1023-172-1435-186-563-521-900-896-899-81 0-158 14-525 92-426 91-431 92-540 146-195 96-287 207-306 368-12 104-11 2985 1 3078 22 170 135 291 365 389 49 21 191 55 480 115 226 47 419 87 430 89 45 10 164 6 229-8zm-5570-485c112-43 197-156 216-291 12-83 13-2623 1-2706-23-158-125-273-270-304-44-9-100-1-542 75-272 47-514 91-539 98-266 68-487 424-594 958-56 280-70 548-40 800 56 484 207 878 414 1081 115 114 122 116 702 218 277 49 524 90 550 90 26 1 72-8 102-19zm2111-3440c1023-44 1884-213 2462-486l113-53-7-33c-3-18-8-35-10-37-2-3-236 1-521 7-993 24-1271 26-1708 11-541-18-1128-18-1249-1-377 56-588 181-734 437-32 55-41 79-32 84 12 8 246 32 491 51 356 28 815 36 1195 20z"/></g><text x="3250" y="8250" style="font-size:3000px;fill:#fff;text-anchor:middle">{text}</text></svg>',checker:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(16 * {scale})" height="calc(16 * {scale})" viewBox="0 0 16 16"><pattern id="p" x="0" y="0" width="16" height="16" patternUnits="userSpaceOnUse"><rect fill="{color}" x="0" width="8" height="8" y="0"/><rect fill="{color}" x="8" width="8" height="8" y="8"/></pattern><rect x="0" y="0" width="16" height="16" fill="{secondaryColor}"/><rect x="0" y="0" width="16" height="16" fill="url(#p)"/></svg>',"checker-rotated":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(16 * {scale})" height="calc(16 * {scale})" viewBox="0 0 60 60"><rect width="60" height="60" fill="{secondaryColor}"/><rect width="42.42" height="42.42" transform="translate(30 0) rotate(45)" fill="{color}"/></svg>',"zig-zag":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(15 * {scale})" height="calc(15 * {scale})" viewBox="0 0 120 120"><rect x="0" y="0" width="120" height="120" fill="{secondaryColor}"/><polygon fill="{color}" points="120 120 60 120 90 90 120 60 120 0 120 0 60 60 0 0 0 60 30 90 60 120 120 120"/></svg>',"zig-zag-vertical":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(15 * {scale})" height="calc(15 * {scale})" viewBox="0 0 120 120"><rect x="0" y="0" width="120" height="120" fill="{secondaryColor}"/><polygon fill="{color}" points="120 0 120 60 90 30 60 0 0 0 0 0 60 60 0 120 60 120 90 90 120 60 120 0"/></svg>',"circles-spaced":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(20 * {scale})" height="calc(20 * {scale})" viewBox="0 0 20 20"><defs><pattern id="p" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="2" stroke="none" fill="{color}"/></pattern></defs><rect x="0" y="0" width="20" height="20" fill="{secondaryColor}"/><rect x="0" y="0" width="100" height="100" fill="url(#p)"/></svg>',circles:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(7 * {scale})" height="calc(7 * {scale})" viewBox="0 0 20 20"><defs><pattern id="p" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="6" stroke="none" fill="{color}"/></pattern></defs><rect x="0" y="0" width="20" height="20" fill="{secondaryColor}"/><rect x="0" y="0" width="100" height="100" fill="url(#p)"/></svg>',"diagonal-lines-up":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(18 * {scale})" height="calc(18 * {scale})" viewBox="0 0 6 6"><rect x="0" y="0" width="6" height="6" fill="{secondaryColor}"/><g fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>',"diagonal-lines-down":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(18 * {scale})" height="calc(18 * {scale})" viewBox="0 0 6 6"><rect x="0" y="0" width="6" height="6" fill="{secondaryColor}"/><g transform="rotate(90 3 3)" fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>',"diagonal-stripes-up":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(20 * {scale})" height="calc(20 * {scale})" viewBox="0 0 40 40"><rect x="0" y="0" width="40" height="40" fill="{secondaryColor}"/><g fill="{color}"><path d="M0 40L40 0H20L0 20M40 40V20L20 40"/></g></svg>',"diagonal-stripes-down":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(20 * {scale})" height="calc(20 * {scale})" viewBox="0 0 40 40"><rect x="0" y="0" width="40" height="40" fill="{secondaryColor}"/><g transform="rotate(90 20 20)" fill="{color}"><path d="M0 40L40 0H20L0 20M40 40V20L20 40"/></g></svg>',"grid-lines":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(14 * {scale})" height="calc(14 * {scale})" viewBox="0 0 6 6"><rect x="0" y="0" width="6" height="6" fill="{secondaryColor}"/><g transform="rotate(45 3 3)" fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g><g fill="{color}" transform="rotate(-45 3 3)"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>',"rotated-grid-lines":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(18 * {scale})" height="calc(18 * {scale})" viewBox="0 0 6 6"><rect x="0" y="0" width="6" height="6" fill="{secondaryColor}"/><g transform="rotate(90 3 3)" fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g><g fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>',"rotated-grid-stripes":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(20 * {scale})" height="calc(20 * {scale})" viewBox="0 0 40 40"><rect x="0" y="0" width="40" height="40" fill="{secondaryColor}"/><g transform="rotate(90 20 20)" fill="{color}"><path d="M0 40L40 0H20L0 20M40 40V20L20 40"/></g><g fill="{color}"><path d="M0 40L40 0H20L0 20M40 40V20L20 40"/></g></svg>',"x-fill":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(40 * {scale})" height="calc(40 * {scale})" viewBox="0 0 40 40"><rect x="0" y="0" width="45.3" height="45.3" fill="{secondaryColor}"/><g fill="{color}"><path d="M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41zM20 18.6l2.83-2.83 1.41 1.41L21.41 20l2.83 2.83-1.41 1.41L20 21.41l-2.83 2.83-1.41-1.41L18.59 20l-2.83-2.83 1.41-1.41L20 18.59z"/></g></svg>',dots:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(13 * {scale})" height="calc(13 * {scale})" viewBox="0 0 20 20"><rect x="0" y="0" width="20" height="20" fill="{secondaryColor}"/><g fill="{color}"><circle cx="3" cy="3" r="3"/><circle cx="13" cy="13" r="3"/></g></svg>'},r=window&&window.__extends||(Bt=function(e,t){return(Bt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Bt(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Kt=(l.ControlPosition=void 0,(be=l.ControlPosition||(l.ControlPosition={})).TopLeft="top-left",be.TopRight="top-right",be.BottomLeft="bottom-left",be.BottomRight="bottom-right",be.NonFixed="non-fixed",r(Gt,Ft=ye),Gt);function Gt(){var e=null!==Ft&&Ft.apply(this,arguments)||this;return e.position=l.ControlPosition.NonFixed,e}Wt.prototype.getLuminosity=function(){for(var e=[this.r,this.g,this.b],t=[],o=0;o<e.length;o++){var r=e[o]/255;t[o]=r<=.03928?r/12.92:Math.pow((.055+r)/1.055,2.4)}return.2126*t[0]+.7152*t[1]+.0722*t[2]},Wt.prototype.getRBGA=function(e){var t=document.createElement("canvas").getContext("2d"),e=(t.globalAlpha=1,t.fillStyle=e,t.fillRect(0,0,1,1),t.getImageData(0,0,1,1).data);return[e[0],e[1],e[2],e[3]]};var Yt=Wt;function Wt(e){var t;e&&(t=void 0,3<=(t="string"==typeof e?this.getRBGA(e):e).length)&&(this.r=t[0],this.g=t[1],this.b=t[2],3<t.length)&&(this.a=t[3])}l.ControlStyle=void 0,(o=l.ControlStyle||(l.ControlStyle={})).light="light",o.dark="dark",o.auto="auto";var Zt=Map,Qt=(Vt.prototype._addEventListener=function(e,t,o){this.listeners.has(e)||this.listeners.set(e,new Zt),this.listeners.get(e).set(t,o)},Vt.prototype._removeEventListener=function(e,t){this.listeners.has(e)&&this.listeners.get(e).delete(t)},Vt.prototype._invokeEvent=function(o,r){var n=this;this.listeners.has(o)&&this.listeners.get(o).forEach(function(e,t){e&&n._removeEventListener(o,t);try{t(r)}catch(e){console.error(e)}})},Vt);function Vt(){this.listeners=new Zt}var Jt,Xt,B=Object.freeze({__proto__:null,EventEmitter:Qt}),$t=((window&&window.__extends||(Jt=function(e,t){return(Jt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Jt(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(eo,Xt=Qt),eo.prototype.onRemove=function(){this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.events.remove("stylechanged",this._onStyleChange),delete this._map),this._observer&&(this._observer.disconnect(),delete this._observer),delete this._theme},eo.prototype.buildContainer=function(e,t,o,r){return this._map=e,this._container=document.createElement(r||"div"),this._container.classList.add("azure-maps-control-container"),"string"==typeof o&&this._container.setAttribute("aria-label",o),t.toLowerCase()===l.ControlStyle.auto?this._map&&this._map.events.add("stylechanged",this._onStyleChange):this._container.classList.add(t),this._container},eo.prototype._setTheme=function(e){this._theme!==e&&(this._container.classList.remove(this._theme),this._container.classList.add(e),this._theme=e)},eo.activateClickDelay=100,eo);function eo(){var t=null!==Xt&&Xt.apply(this,arguments)||this;return t._onStyleChange=function(){t._map.getStyle().style.toLowerCase().startsWith("blank")?t._observer||(t._onBackgroundChange(),t._observer=new MutationObserver(t._onBackgroundChange),t._observer.observe(t._map.getMapContainer(),{attributes:!0,attributeFilter:["style"]})):(t._observer&&(t._observer.disconnect(),delete t._observer),t._map.styles.getThemeAsync(t._map.getStyle()).then(function(e){t._setTheme(e)}))},t._onBackgroundChange=function(){var e=new Yt(t._map.getMapContainer().style.backgroundColor).getLuminosity(),e=isNaN(e)||.5<e?l.ControlStyle.light:l.ControlStyle.dark;t._setTheme(e)},t}(window&&window.__extends||(to=function(e,t){return(to=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}to(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(no,oo=ye);var to,oo,ro=no;function no(){var e=null!==oo&&oo.apply(this,arguments)||this;return e.rotationDegreesDelta=15,e.style=l.ControlStyle.light,e.inverted=!1,e}(window&&window.__extends||(io=function(e,t){return(io=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}io(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(co,ao=$t),co.prototype.onAdd=function(e,t){function o(e){e?(n.classList.add("in-use"),a.setAttribute("aria-hidden","false"),a.classList.remove("hidden-accessible-element")):(n.classList.remove("in-use"),a.setAttribute("aria-hidden","true"),a.classList.add("hidden-accessible-element"))}var r=this,n=this.buildContainer(e,this.options.style,"Rotation Control"),i=this.constructRotationButton(e),a=this.constructRotationGrid(e,t),s=jt("Reset to Default Rotation");return n.addEventListener("mouseover",function(e){r.lastActiveTime=r.lastActiveTime||e.timeStamp,r.hasMouse=!0,o(!0)}),n.addEventListener("focusin",function(e){r.lastActiveTime=r.lastActiveTime||e.timeStamp,r.hasFocus=!0,o(!0)}),n.addEventListener("mouseleave",function(){r.hasMouse=!1,r.hasFocus||(delete r.lastActiveTime,o(!1))}),n.addEventListener("focusout",function(e){e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||(r.hasFocus=!1,r.hasMouse)||(delete r.lastActiveTime,o(!1))}),a.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||(e.stopPropagation(),i.focus(),o(!1))}),i.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||null==n||!n.classList.contains("in-use")||"none"!==(null==s?void 0:s.style.display)||(e.stopPropagation(),o(!1))}),t&&co.InvertOrderPositions.includes(t.position)?(n.appendChild(a),n.appendChild(i),n.appendChild(s),Ht(s,i)):(n.appendChild(i),n.appendChild(s),Ht(s,i),n.appendChild(a)),n},co.prototype.constructRotationGrid=function(e,t){var o=document.createElement("div"),r=(o.classList.add("sub-container"),o.classList.add("hidden-accessible-element"),o.setAttribute("aria-hidden","true"),this.constructRightRotationButton(e)),e=this.constructLeftRotationButton(e),n=jt("Rotate Left"),i=jt("Rotate Right");return t&&co.InvertOrderPositions.includes(t.position)?(o.appendChild(r),o.appendChild(i),Ht(i,r),o.appendChild(e),o.appendChild(n),Ht(n,e)):(o.appendChild(e),o.appendChild(n),Ht(n,e),o.appendChild(r),o.appendChild(i),Ht(i,r)),o},co.prototype.constructRotationButton=function(t){var o=this,e=document.createElement("button"),r=(e.classList.add("azure-maps-control-button"),e.classList.add("rotation"),e.setAttribute("aria-label","Reset to Default Rotation"),e.setAttribute("alt","Reset to Default Rotation"),e.setAttribute("type","button"),document.createElement("div"));return e.appendChild(r),e.addEventListener("click",function(e){e.timeStamp-o.lastActiveTime>$t.activateClickDelay&&t.setCamera({bearing:co.DefaultRotation},!0)}),t.events.add("rotate",function(e){r.style.transform="rotate(".concat(-e.map.getCamera().bearing,"deg)")}),e},co.prototype.constructRightRotationButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("rotation-right"),o.setAttribute("aria-label","Rotate Right"),o.setAttribute("alt","Rotate Right"),o.setAttribute("type","button"),o.addEventListener("click",function(){e.setCamera({bearing:e.getCamera().bearing-(t.options.inverted?-1:1)*t.options.rotationDegreesDelta,duration:co.RotationDuration,type:"ease"},!0)}),o},co.prototype.constructLeftRotationButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("rotation-left"),o.setAttribute("aria-label","Rotate Left"),o.setAttribute("alt","Rotate Left"),o.setAttribute("type","button"),o.addEventListener("click",function(){e.setCamera({bearing:e.getCamera().bearing+(t.options.inverted?-1:1)*t.options.rotationDegreesDelta,duration:co.RotationDuration,type:"ease"},!0)}),o},co.DefaultRotation=0,co.RotationDuration=100,co.InvertOrderPositions=[l.ControlPosition.BottomRight,l.ControlPosition.TopRight];var io,ao,so=co;function co(e){var t=ao.call(this)||this;return t.hasMouse=!1,t.hasFocus=!1,t.options=(new ro).merge(e),t}(window&&window.__extends||(uo=function(e,t){return(uo=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}uo(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(po,lo=ye);var uo,lo,ho=po;function po(){var e=null!==lo&&lo.apply(this,arguments)||this;return e.pitchDegreesDelta=10,e.style=l.ControlStyle.light,e.inverted=!1,e}(window&&window.__extends||(fo=function(e,t){return(fo=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}fo(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(mo,go=$t),mo.prototype.onAdd=function(e,t){function o(e){e?(n.classList.add("in-use"),a.setAttribute("aria-hidden","false"),a.classList.remove("hidden-accessible-element")):(n.classList.remove("in-use"),a.setAttribute("aria-hidden","true"),a.classList.add("hidden-accessible-element"))}var r=this,n=this.buildContainer(e,this.options.style,"Pitch Control"),i=this.constructPitchButton(e),a=this.constructPitchGrid(e,t),s=jt("Reset to Default Pitch");return n.addEventListener("mouseover",function(e){r.lastActiveTime=r.lastActiveTime||e.timeStamp,r.hasMouse=!0,o(!0)}),n.addEventListener("focusin",function(e){r.lastActiveTime=r.lastActiveTime||e.timeStamp,r.hasFocus=!0,o(!0)}),n.addEventListener("mouseleave",function(){r.hasMouse=!1,r.hasFocus||(delete r.lastActiveTime,o(!1))}),n.addEventListener("focusout",function(e){e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||(r.hasFocus=!1,r.hasMouse)||(delete r.lastActiveTime,o(!1))}),a.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||(e.stopPropagation(),i.focus(),o(!1))}),i.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||null==n||!n.classList.contains("in-use")||"none"!==(null==s?void 0:s.style.display)||(e.stopPropagation(),o(!1))}),t&&mo.INVERT_ORDER_POSITIONS.includes(t.position)?(n.appendChild(a),n.appendChild(i),n.appendChild(s),Ht(s,n)):(n.appendChild(i),n.appendChild(s),Ht(s,n),n.appendChild(a)),this.map=e,this.container=n,this.pitchButton=i,e.events.add("pitch",this.pitchChanged),this.updatePitchButtonsState(),n},mo.prototype.onRemove=function(){this.container&&(this.container.remove(),this.container=null,this.pitchButton=null,this.pitchIncrementButton=null,this.pitchDecrementButton=null),this.map&&(this.map.events.remove("pitch",this.pitchChanged),this.map=null)},mo.prototype.constructPitchGrid=function(e,t){var o=document.createElement("div"),e=(o.classList.add("sub-container"),o.classList.add("hidden-accessible-element"),o.setAttribute("aria-hidden","true"),this.pitchIncrementButton=this.constructPitchIncrementButton(e),this.pitchDecrementButton=this.constructPitchDecrementButton(e),jt("Increase Pitch")),r=jt("Decrease Pitch");return t&&mo.INVERT_ORDER_POSITIONS.includes(t.position)?(o.appendChild(this.pitchDecrementButton),o.appendChild(r),Ht(r,this.pitchDecrementButton),o.appendChild(this.pitchIncrementButton),o.appendChild(e),Ht(e,this.pitchIncrementButton)):(o.appendChild(this.pitchIncrementButton),o.appendChild(e),Ht(e,this.pitchIncrementButton),o.appendChild(this.pitchDecrementButton),o.appendChild(r),Ht(r,this.pitchDecrementButton)),o},mo.prototype.constructPitchButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("pitch"),o.setAttribute("aria-label","Reset to Default Pitch"),o.setAttribute("alt","Reset to Default Pitch"),o.setAttribute("type","button"),o.addEventListener("click",function(){event.timeStamp-t.lastActiveTime>$t.activateClickDelay&&e.setCamera({pitch:mo.DEFAULT_PITCH},!0)}),o},mo.prototype.constructPitchDecrementButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("pitch-down"),o.setAttribute("aria-label","Decrease Pitch"),o.setAttribute("alt","Decrease Pitch"),o.setAttribute("type","button"),o.addEventListener("click",function(){e.setCamera({pitch:e.getCamera().pitch-(t.options.inverted?-1:1)*t.options.pitchDegreesDelta,duration:mo.PITCH_DURATION_MS,type:"ease"},!0)}),o},mo.prototype.constructPitchIncrementButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("pitch-up"),o.setAttribute("aria-label","Increase Pitch"),o.setAttribute("alt","Increase Pitch"),o.setAttribute("type","button"),o.addEventListener("click",function(){e.setCamera({pitch:e.getCamera().pitch+(t.options.inverted?-1:1)*t.options.pitchDegreesDelta,duration:mo.PITCH_DURATION_MS,type:"ease"},!0)}),o},mo.PITCH_DURATION_MS=100,mo.DEFAULT_PITCH=0,mo.INVERT_ORDER_POSITIONS=[l.ControlPosition.BottomRight,l.ControlPosition.TopRight];var fo,go,t=mo;function mo(e){var o=go.call(this)||this;return o.container=null,o.map=null,o.pitchButton=null,o.pitchIncrementButton=null,o.pitchDecrementButton=null,o.hasMouse=!1,o.hasFocus=!1,o.pitchChanged=function(e){return o.updatePitchButtonsState()},o.updatePitchButtonsState=function(){var e=o.map.getCamera().pitch<=0,t=60<=o.map.getCamera().pitch;o.hasFocus&&o.pitchButton&&(e||t)&&o.pitchButton.focus(),o.options.inverted?(o.pitchIncrementButton&&o.pitchIncrementButton.disabled!=e&&(o.pitchIncrementButton.disabled=e),o.pitchDecrementButton&&o.pitchDecrementButton.disabled!=t&&(o.pitchDecrementButton.disabled=t)):(o.pitchIncrementButton&&o.pitchIncrementButton.disabled!=t&&(o.pitchIncrementButton.disabled=t),o.pitchDecrementButton&&o.pitchDecrementButton.disabled!=e&&(o.pitchDecrementButton.disabled=e))},o.options=(new ho).merge(e),o}(window&&window.__extends||(yo=function(e,t){return(yo=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}yo(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(_o,vo=$t),_o.prototype.onAdd=function(e,t){this.map=e,null!=(o=null==(o=this.map)?void 0:o._getMap())&&o.addControl(this.control);var o=this.buildContainer(e,l.ControlStyle.auto,"Scale Bar");return o.appendChild(null==(e=this.control)?void 0:e._container),o},_o.prototype.onRemove=function(){var e;vo.prototype.onRemove.call(this),null!=(e=null==(e=this.map)?void 0:e._getMap())&&e.removeControl(this.control),this.map=null},_o.prototype.setUnit=function(e){var t;null!=(t=this.control)&&t.setUnit(e)};var yo,vo,be=_o;function _o(e){var t=vo.call(this)||this;return t.map=null,t.control=new D.ScaleControl({maxWidth:null==e?void 0:e.maxWidth,unit:null==e?void 0:e.unit}),t}function wo(e,t){return e===t||e!=e&&t!=t}var bo=wo;function Co(e,t){for(var o=e.length;o--;)if(bo(e[o][0],t))return o;return-1}var Eo=Co,So=Array.prototype.splice;var To=Co;var Io=Co;var ko=Co;function Ao(e){var t=this.__data__;return!((e=Eo(t,e))<0||(e==t.length-1?t.pop():So.call(t,e,1),--this.size,0))}function Po(e){var t=this.__data__;return(e=To(t,e))<0?void 0:t[e][1]}function Oo(e){return-1<Io(this.__data__,e)}function Ro(e,t){var o=this.__data__,r=ko(o,e);return r<0?(++this.size,o.push([e,t])):o[r][1]=t,this}function xo(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}xo.prototype.clear=function(){this.__data__=[],this.size=0},xo.prototype.delete=Ao,xo.prototype.get=Po,xo.prototype.has=Oo,xo.prototype.set=Ro;var r=xo,Mo=r;function No(){this.__data__=new Mo,this.size=0}function Lo(e){var t=this.__data__,e=t.delete(e);return this.size=t.size,e}function Do(e){return this.__data__.get(e)}function qo(e){return this.__data__.has(e)}var o="object"==typeof e&&e&&e.Object===Object&&e,e="object"==typeof self&&self&&self.Object===Object&&self,e=o||e||Function("return this")(),Uo=e.Symbol,n=Object.prototype,jo=n.hasOwnProperty,Ho=n.toString,Bo=Uo?Uo.toStringTag:void 0;var Fo=Object.prototype.toString;var zo=function(e){var t=jo.call(e,Bo),o=e[Bo];try{var r=!(e[Bo]=void 0)}catch(e){}var n=Ho.call(e);return r&&(t?e[Bo]=o:delete e[Bo]),n},Ko=function(e){return Fo.call(e)},Go=Uo?Uo.toStringTag:void 0;function Yo(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(Go&&Go in Object(e)?zo:Ko)(e)}function Wo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var Zo=Yo,Qo=Wo;function Vo(e){return!!Qo(e)&&("[object Function]"==(e=Zo(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}var n=e["__core-js_shared__"],Jo=(n=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";var Xo=Function.prototype.toString;function $o(e){if(null!=e){try{return Xo.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var er=Vo,tr=function(e){return!!Jo&&Jo in e},or=Wo,rr=$o,nr=/^\[object .+?Constructor\]$/,n=Function.prototype,ir=Object.prototype,n=n.toString,ir=ir.hasOwnProperty,ar=RegExp("^"+n.call(ir).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var sr=function(e){return!(!or(e)||tr(e))&&(er(e)?ar:nr).test(rr(e))},cr=function(e,t){return null==e?void 0:e[t]};function ur(e,t){return e=cr(e,t),sr(e)?e:void 0}var n=ur(e,"Map"),ir=ur(Object,"create"),lr=ir;var hr=ir,dr=Object.prototype.hasOwnProperty;var pr=ir,fr=Object.prototype.hasOwnProperty;var gr=ir;function mr(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}function yr(e){var t,o=this.__data__;return hr?"__lodash_hash_undefined__"===(t=o[e])?void 0:t:dr.call(o,e)?o[e]:void 0}function vr(e){var t=this.__data__;return pr?void 0!==t[e]:fr.call(t,e)}function _r(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=gr&&void 0===t?"__lodash_hash_undefined__":t,this}function wr(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}wr.prototype.clear=function(){this.__data__=lr?lr(null):{},this.size=0},wr.prototype.delete=mr,wr.prototype.get=yr,wr.prototype.has=vr,wr.prototype.set=_r;var br=wr,Cr=r,Er=n;var Sr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};function Tr(e,t){return e=e.__data__,Sr(t)?e["string"==typeof t?"string":"hash"]:e.map}var Ir=Tr;var kr=Tr;var Ar=Tr;var Pr=Tr;function Or(e){return e=Ir(this,e).delete(e),this.size-=e?1:0,e}function Rr(e){return kr(this,e).get(e)}function xr(e){return Ar(this,e).has(e)}function Mr(e,t){var o=Pr(this,e),r=o.size;return o.set(e,t),this.size+=o.size==r?0:1,this}function Nr(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}Nr.prototype.clear=function(){this.size=0,this.__data__={hash:new br,map:new(Er||Cr),string:new br}},Nr.prototype.delete=Or,Nr.prototype.get=Rr,Nr.prototype.has=xr,Nr.prototype.set=Mr;var ir=Nr,Lr=r,Dr=n,qr=ir;function Ur(e,t){var o=this.__data__;if(o instanceof Lr){var r=o.__data__;if(!Dr||r.length<199)return r.push([e,t]),this.size=++o.size,this;o=this.__data__=new qr(r)}return o.set(e,t),this.size=o.size,this}var jr=r,r=Lo,Hr=Do,i=qo;function Br(e){e=this.__data__=new jr(e);this.size=e.size}Br.prototype.clear=No,Br.prototype.delete=r,Br.prototype.get=Hr,Br.prototype.has=i,Br.prototype.set=Ur;r=Br;function Fr(e,t){for(var o=-1,r=null==e?0:e.length;++o<r&&!1!==t(e[o],o,e););return e}var zr=ur,Hr=function(){try{var e=zr(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kr=Hr;function Gr(e,t,o){"__proto__"==t&&Kr?Kr(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}var Yr=Gr,Wr=wo,Zr=Object.prototype.hasOwnProperty;function Qr(e,t,o){var r=e[t];Zr.call(e,t)&&Wr(r,o)&&(void 0!==o||t in e)||Yr(e,t,o)}var Vr=Qr,Jr=Gr;function Xr(e,t,o,r){for(var n=!o,i=(o=o||{},-1),a=t.length;++i<a;){var s=t[i],c=r?r(o[s],e[s],s,o,e):void 0;void 0===c&&(c=e[s]),(n?Jr:Vr)(o,s,c)}return o}function $r(e,t){for(var o=-1,r=Array(e);++o<e;)r[o]=t(o);return r}function en(e){return null!=e&&"object"==typeof e}var tn=Yo,on=en;var i=function(e){return on(e)&&"[object Arguments]"==tn(e)},rn=en,nn=Object.prototype,an=nn.hasOwnProperty,sn=nn.propertyIsEnumerable,nn=i(function(){return arguments}())?i:function(e){return rn(e)&&an.call(e,"callee")&&!sn.call(e,"callee")},i=Array.isArray,cn={exports:{}};Cn=(Cn=(bn=cn).exports)&&!Cn.nodeType&&Cn,un=(un=Cn&&bn&&!bn.nodeType&&bn)&&un.exports===Cn?e.Buffer:void 0,Cn=un?un.isBuffer:void 0,bn.exports=Cn||function(){return!1};var un=cn.exports,ln=/^(?:0|[1-9]\d*)$/;function hn(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&ln.test(e))&&-1<e&&e%1==0&&e<t}function dn(e){return"number"==typeof e&&-1<e&&e%1==0&&e<=9007199254740991}var pn=Yo,fn=dn,gn=en,mn={};mn["[object Float32Array]"]=mn["[object Float64Array]"]=mn["[object Int8Array]"]=mn["[object Int16Array]"]=mn["[object Int32Array]"]=mn["[object Uint8Array]"]=mn["[object Uint8ClampedArray]"]=mn["[object Uint16Array]"]=mn["[object Uint32Array]"]=!0,mn["[object Arguments]"]=mn["[object Array]"]=mn["[object ArrayBuffer]"]=mn["[object Boolean]"]=mn["[object DataView]"]=mn["[object Date]"]=mn["[object Error]"]=mn["[object Function]"]=mn["[object Map]"]=mn["[object Number]"]=mn["[object Object]"]=mn["[object RegExp]"]=mn["[object Set]"]=mn["[object String]"]=mn["[object WeakMap]"]=!1;function yn(e){return gn(e)&&fn(e.length)&&!!mn[pn(e)]}function vn(t){return function(e){return t(e)}}var _n,wn,bn={exports:{}},o=(cn=(cn=(Cn=bn).exports)&&!cn.nodeType&&cn,_n=cn&&Cn&&!Cn.nodeType&&Cn,wn=_n&&_n.exports===cn&&o.process,cn=function(){try{var e=_n&&_n.require&&_n.require("util").types;return e?e:wn&&wn.binding&&wn.binding("util")}catch(e){}}(),Cn.exports=cn,bn.exports),Cn=yn,cn=vn,bn=o&&o.isTypedArray,cn=bn?cn(bn):Cn,En=$r,Sn=nn,Tn=i,In=un,kn=hn,An=cn,Pn=Object.prototype.hasOwnProperty;function On(e,t){var o,r=Tn(e),n=!r&&Sn(e),i=!r&&!n&&In(e),a=!r&&!n&&!i&&An(e),s=r||n||i||a,c=s?En(e.length,String):[],u=c.length;for(o in e)!t&&!Pn.call(e,o)||s&&("length"==o||i&&("offset"==o||"parent"==o)||a&&("buffer"==o||"byteLength"==o||"byteOffset"==o)||kn(o,u))||c.push(o);return c}var Rn=Object.prototype;function xn(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Rn)}function Mn(t,o){return function(e){return t(o(e))}}var bn=Mn(Object.keys,Object),Nn=xn,Ln=bn,Dn=Object.prototype.hasOwnProperty;var qn=Vo,Un=dn;function jn(e){return null!=e&&Un(e.length)&&!qn(e)}var Hn=On,Bn=function(e){if(!Nn(e))return Ln(e);var t,o=[];for(t in Object(e))Dn.call(e,t)&&"constructor"!=t&&o.push(t);return o},Fn=jn;function zn(e){return(Fn(e)?Hn:Bn)(e)}var Kn=Xr,Gn=zn;function Yn(e,t){return e&&Kn(t,Gn(t),e)}var Wn=Wo,Zn=xn,Qn=function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t},Vn=Object.prototype.hasOwnProperty;var Jn=On,Xn=function(e){if(!Wn(e))return Qn(e);var t,o=Zn(e),r=[];for(t in e)("constructor"!=t||!o&&Vn.call(e,t))&&r.push(t);return r},$n=jn;function ei(e){return $n(e)?Jn(e,!0):Xn(e)}var ti=Xr,oi=ei;function ri(e,t){return e&&ti(t,oi(t),e)}var ni,Cn={exports:{}},ii=(ii=(ii=(bn=Cn).exports)&&!ii.nodeType&&ii,hi=(hi=ii&&bn&&!bn.nodeType&&bn)&&hi.exports===ii?e.Buffer:void 0,ni=hi?hi.allocUnsafe:void 0,bn.exports=function(e,t){return t?e.slice():(t=e.length,t=ni?ni(t):new e.constructor(t),e.copy(t),t)},Cn.exports);function ai(e,t){var o=-1,r=e.length;for(t=t||Array(r);++o<r;)t[o]=e[o];return t}function si(){return[]}var ci=function(e,t){for(var o=-1,r=null==e?0:e.length,n=0,i=[];++o<r;){var a=e[o];t(a,o,e)&&(i[n++]=a)}return i},ui=Object.prototype.propertyIsEnumerable,li=Object.getOwnPropertySymbols,hi=li?function(t){return null==t?[]:(t=Object(t),ci(li(t),function(e){return ui.call(t,e)}))}:si,di=Xr,pi=hi;function fi(e,t){return di(e,pi(e),t)}function gi(e,t){for(var o=-1,r=t.length,n=e.length;++o<r;)e[n+o]=t[o];return e}var bn=Mn(Object.getPrototypeOf,Object),mi=gi,yi=bn,vi=hi,Cn=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)mi(t,vi(e)),e=yi(e);return t}:si,_i=Xr,wi=Cn;function bi(e,t){return _i(e,wi(e),t)}var Ci=gi,Ei=i;function Si(e,t,o){return t=t(e),Ei(e)?t:Ci(t,o(e))}var Ti=Si,Ii=hi,ki=zn;function Ai(e){return Ti(e,ki,Ii)}var Pi=Si,Oi=Cn,Ri=ei;function xi(e){return Pi(e,Ri,Oi)}var hi=ur(e,"DataView"),Cn=n,n=ur(e,"Promise"),Mi=ur(e,"Set"),Ni=ur(e,"WeakMap"),Li=Yo,Di=$o,qi="[object Map]",Ui="[object Promise]",ji="[object Set]",Hi="[object WeakMap]",Bi="[object DataView]",Fi=Di(hi),zi=Di(Cn),Ki=Di(n),Gi=Di(Mi),Yi=Di(Ni),a=Li,hi=a=hi&&a(new hi(new ArrayBuffer(1)))!=Bi||Cn&&a(new Cn)!=qi||n&&a(n.resolve())!=Ui||Mi&&a(new Mi)!=ji||Ni&&a(new Ni)!=Hi?function(e){var t=Li(e),e="[object Object]"==t?e.constructor:void 0,e=e?Di(e):"";if(e)switch(e){case Fi:return Bi;case zi:return qi;case Ki:return Ui;case Gi:return ji;case Yi:return Hi}return t}:a,Wi=Object.prototype.hasOwnProperty;function Zi(e){var t=e.length,o=new e.constructor(t);return t&&"string"==typeof e[0]&&Wi.call(e,"index")&&(o.index=e.index,o.input=e.input),o}var Cn=e.Uint8Array,Qi=Cn;function Vi(e){var t=new e.constructor(e.byteLength);return new Qi(t).set(new Qi(e)),t}var Ji=Vi;var Xi=/\w*$/;var n=Uo?Uo.prototype:void 0,$i=n?n.valueOf:void 0;var ea=Vi;function ta(e,t){return t=t?ea(e.buffer):e.buffer,new e.constructor(t,e.byteOffset,e.length)}var oa=Vi,ra=function(e,t){return t=t?Ji(e.buffer):e.buffer,new e.constructor(t,e.byteOffset,e.byteLength)},na=function(e){var t=new e.constructor(e.source,Xi.exec(e));return t.lastIndex=e.lastIndex,t},ia=function(e){return $i?Object($i.call(e)):{}},aa=ta;function sa(e,t,o){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return oa(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return ra(e,o);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return aa(e,o);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return na(e);case"[object Set]":return new r;case"[object Symbol]":return ia(e)}}var ca=Wo,ua=Object.create;function la(){}var ha=function(e){if(!ca(e))return{};if(ua)return ua(e);la.prototype=e;e=new la;return la.prototype=void 0,e},da=bn,pa=xn;function fa(e){return"function"!=typeof e.constructor||pa(e)?{}:ha(da(e))}var ga=hi,ma=en;function ya(e){return ma(e)&&"[object Map]"==ga(e)}var Mi=vn,Ni=o&&o.isMap,a=Ni?Mi(Ni):ya,va=hi,_a=en;function wa(e){return _a(e)&&"[object Set]"==va(e)}var e=vn,n=o&&o.isSet,Mi=n?e(n):wa,ba=r,Ca=Fr,Ea=Qr,Sa=Yn,Ta=ri,Ia=ii,ka=ai,Aa=fi,Pa=bi,Oa=Ai,Ra=xi,xa=hi,Ma=Zi,Na=sa,La=fa,Da=i,qa=un,Ua=a,ja=Wo,Ha=Mi,Ba=zn,Fa=ei,za="[object Arguments]",Ka="[object Function]",Ga="[object Object]",Ya={};Ya[za]=Ya["[object Array]"]=Ya["[object ArrayBuffer]"]=Ya["[object DataView]"]=Ya["[object Boolean]"]=Ya["[object Date]"]=Ya["[object Float32Array]"]=Ya["[object Float64Array]"]=Ya["[object Int8Array]"]=Ya["[object Int16Array]"]=Ya["[object Int32Array]"]=Ya["[object Map]"]=Ya["[object Number]"]=Ya[Ga]=Ya["[object RegExp]"]=Ya["[object Set]"]=Ya["[object String]"]=Ya["[object Symbol]"]=Ya["[object Uint8Array]"]=Ya["[object Uint8ClampedArray]"]=Ya["[object Uint16Array]"]=Ya["[object Uint32Array]"]=!0,Ya["[object Error]"]=Ya[Ka]=Ya["[object WeakMap]"]=!1;function Wa(o,r,n,e,t,i){var a,s=1&r,c=2&r,u=4&r;if(void 0===(a=n?t?n(o,e,t,i):n(o):a)){if(!ja(o))return o;if(e=Da(o)){if(a=Ma(o),!s)return ka(o,a)}else{var l=xa(o),h=l==Ka||"[object GeneratorFunction]"==l;if(qa(o))return Ia(o,s);if(l==Ga||l==za||h&&!t){if(a=c||h?{}:La(o),!s)return c?Pa(o,Ta(a,o)):Aa(o,Sa(a,o))}else{if(!Ya[l])return t?o:{};a=Na(o,l,s)}}if(h=(i=i||new ba).get(o))return h;i.set(o,a),Ha(o)?o.forEach(function(e){a.add(Wa(e,r,n,e,o,i))}):Ua(o)&&o.forEach(function(e,t){a.set(t,Wa(e,r,n,t,o,i))});var d=e?void 0:(u?c?Ra:Oa:c?Fa:Ba)(o);Ca(d||o,function(e,t){d&&(e=o[t=e]),Ea(a,t,Wa(e,r,n,t,o,i))})}return a}var Za=Wa;var Qa=q(function(e){return Za(e,5)}),Va=Gr,Ja=wo;function Xa(e,t,o){(void 0===o||Ja(e[t],o))&&(void 0!==o||t in e)||Va(e,t,o)}var Ni=function(c){return function(e,t,o){for(var r=-1,n=Object(e),i=o(e),a=i.length;a--;){var s=i[c?a:++r];if(!1===t(n[s],s,n))break}return e}}(),$a=jn,es=en;function ts(e){return es(e)&&$a(e)}var os=Yo,rs=bn,ns=en,o=Function.prototype,e=Object.prototype,is=o.toString,as=e.hasOwnProperty,ss=is.call(Object);function cs(e){return!(!ns(e)||"[object Object]"!=os(e))&&(null===(e=rs(e))||"function"==typeof(e=as.call(e,"constructor")&&e.constructor)&&e instanceof e&&is.call(e)==ss)}function us(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ls=Xr,hs=ei;var ds=Xa,ps=ii,fs=ta,gs=ai,ms=fa,ys=nn,vs=i,_s=ts,ws=un,bs=Vo,Cs=Wo,Es=cs,Ss=cn,Ts=us,Is=function(e){return ls(e,hs(e))};var ks=r,As=Xa,Ps=Ni,Os=function(e,t,o,r,n,i,a){var s,c,u,l=Ts(e,o),h=Ts(t,o),d=a.get(h);d||((t=void 0===(d=i?i(l,h,o+"",e,t,a):void 0))&&(c=!(s=vs(h))&&ws(h),u=!s&&!c&&Ss(h),d=h,s||c||u?d=vs(l)?l:_s(l)?gs(l):c?ps(h,!(t=!1)):u?fs(h,!(t=!1)):[]:Es(h)||ys(h)?ys(d=l)?d=Is(l):Cs(l)&&!bs(l)||(d=ms(h)):t=!1),t&&(a.set(h,d),n(d,h,r,i,a),a.delete(h))),ds(e,o,d)},Rs=Wo,xs=ei,Ms=us;function Ns(e){return e}var Ls=function(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)},Ds=Math.max;var qs=function(e){return function(){return e}},Us=Hr,js=Date.now;var n=function(o){var r=0,n=0;return function(){var e=js(),t=16-(e-n);if(n=e,0<t){if(800<=++r)return arguments[0]}else r=0;return o.apply(void 0,arguments)}}(Us?function(e,t){return Us(e,"toString",{configurable:!0,enumerable:!1,value:qs(t),writable:!0})}:Ns),Hs=Ns,Bs=function(i,a,s){return a=Ds(void 0===a?i.length-1:a,0),function(){for(var e=arguments,t=-1,o=Ds(e.length-a,0),r=Array(o);++t<o;)r[t]=e[a+t];for(var t=-1,n=Array(a+1);++t<a;)n[t]=e[t];return n[a]=s(r),Ls(i,this,n)}},Fs=n;var zs=wo,Ks=jn,Gs=hn,Ys=Wo;var Ws=function(e,t){return Fs(Bs(e,t,Hs),e+"")},Zs=function(e,t,o){var r;return!!Ys(o)&&!!("number"==(r=typeof t)?Ks(o)&&Gs(t,o.length):"string"==r&&t in o)&&zs(o[t],e)};var Qs,Vs,Js=function r(n,i,a,s,c){n!==i&&Ps(i,function(e,t){var o;c=c||new ks,Rs(e)?Os(n,i,t,a,r,s,c):(o=s?s(Ms(n,t),e,t+"",n,i,c):void 0,As(n,t,o=void 0===o?e:o))},xs)},Xs=q(function(s){return Ws(function(e,t){var o=-1,r=t.length,n=1<r?t[r-1]:void 0,i=2<r?t[2]:void 0,n=3<s.length&&"function"==typeof n?(r--,n):void 0;for(i&&Zs(t[0],t[1],i)&&(n=r<3?void 0:n,r=1),e=Object(e);++o<r;){var a=t[o];a&&s(e,a,o,n)}return e})}(function(e,t,o){Js(e,t,o)})),$s=((window&&window.__extends||(Qs=function(e,t){return(Qs=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Qs(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(ec,Vs=ye),ec);function ec(){var e=null!==Vs&&Vs.apply(this,arguments)||this;return e.layout="icons",e.mapStyles=["road","grayscale_light","grayscale_dark","night","road_shaded_relief"],e.style=l.ControlStyle.light,e.autoSelectionMode=!0,e}var tc,oc,a=window&&window.__extends||(tc=function(e,t){return(tc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}tc(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),rc=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},nc=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},ic=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},Mi=(a(ac,oc=$t),ac.prototype.onAdd=function(e,t){function o(e){e?(n.classList.add(ac.Css.inUse),i.setAttribute("aria-hidden","false"),i.classList.remove("hidden-accessible-element")):(n.classList.remove(ac.Css.inUse),i.setAttribute("aria-hidden","true"),i.classList.add("hidden-accessible-element"))}var r=this,n=(this.map=e,this.buildContainer(e,this.options.style,"Map Style Control")),i=this.buildStyleOpsGrid(),a=(this.styleOpsGrid=i,this.buildCurrStyleBtn()),e=jt("Select Style");return i.classList.add(t&&t.position||"top-right"),n.addEventListener("mouseover",function(){r.hasMouse=!0,o(!0)}),n.addEventListener("focusin",function(){r.hasFocus=!0,o(!0)}),n.addEventListener("mouseleave",function(){r.hasMouse=!1,r.hasFocus||o(!1)}),n.addEventListener("focusout",function(e){e.target===a&&Array.from(i.children).forEach(function(e){return e.removeAttribute("tabIndex")}),e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||(r.hasFocus=!1,r.hasMouse)||o(!1)}),i.addEventListener("keydown",function(e){27===e.keyCode&&(e.stopPropagation(),a.focus(),Array.from(i.children).forEach(function(e){return e.setAttribute("tabIndex","-1")}),n.classList.contains(ac.Css.inUse))&&o(!1)}),a.addEventListener("click",function(e){n.classList.contains(ac.Css.inUse)?o(!1):(o(!0),i.firstElementChild&&i.firstElementChild.focus())}),t&&ac.InvertOrderPositions.includes(t.position)?(n.appendChild(i),n.appendChild(a),n.appendChild(e),Ht(e,a)):(n.appendChild(a),n.appendChild(e),Ht(e,a),n.appendChild(i)),n},ac.prototype.onRemove=function(){oc.prototype.onRemove.call(this),this.styleOpsGrid=null,this.styleButtons.clear(),this.thumbnailCache.response.clear(),this.thumbnailCache.blob.clear(),this.thumbnailCache.assumedConfiguration=void 0,this.map.events.remove("stylechanged",this.onStyleChange),this.map.events.remove("mapconfigurationchanged",this.onMapConfigurationChange)},ac.prototype.setSelectedStyle=function(o){var t,e,r=this;this.styleIcons.has(o)&&(t=this.currStyleImage,e=this.styleIcons.get(o),t.src!==e&&(t.src=e),Object.entries(this.styleButtons).forEach(function(e){var e=ic(e,2),t=e[0];return e[1].setAttribute("aria-current",t===o?"true":"false")}),this.map.styles.definitions().then(function(e){e=r.mapToFriendlyStyleName(o,e);t.alt!==e&&(t.alt=e),t.parentElement.lastChild instanceof Text&&(t.parentElement.lastChild.textContent=e)}))},ac.prototype.disableStyle=function(e){e=this.styleButtons[e];e&&e.setAttribute("disabled","true")},ac.prototype.enableStyle=function(e){e=this.styleButtons[e];e&&e.removeAttribute("disabled")},ac.prototype.buildSelectStyleBtn=function(o,e,t){var r=this,n=document.createElement("button"),i=this.mapToFriendlyStyleName(o,e),a=(n.setAttribute("aria-label",i),n.setAttribute("type","button"),new Image),e=(t.then(function(e){var t;return r.thumbnailCache.blob.has(e.url)?r.thumbnailCache.blob.get(e.url):(t=e.clone().blob(),r.thumbnailCache.blob.set(e.url,t),t)}).then(function(e){e=URL.createObjectURL(e);a.src=e,o===r.map.getStyle().style&&(r.currStyleImage.src=e,r.currStyleImage.alt=i,r.currStyleImage.parentElement.lastChild.nodeType==Node.TEXT_NODE?r.currStyleImage.parentElement.lastChild.textContent=i:r.currStyleImage.parentElement.appendChild(document.createTextNode(i))),r.styleIcons.set(o,e)}),a.setAttribute("aria-hidden","true"),n.appendChild(a),"icons"===this.options.layout?n.classList.add(ac.Css.button):(n.classList.add(ac.Css.listButton),n.classList.add(ac.Css.expanded),n.appendChild(document.createTextNode(i))),n.addEventListener("click",function(){r.hasMouse=!1,r.hasFocus=!1;var e=r.styleButtons[o];e&&!e.hasAttribute("disabled")&&(r._invokeEvent("styleselected",o),r.options.autoSelectionMode&&r.map.setStyle({style:o}),Object.entries(r.styleButtons).forEach(function(e){var e=ic(e,2),t=e[0];return e[1].setAttribute("aria-current",t===o?"true":"false")}))}),document.createElement("div"));return e.classList.add("selected-icon"),n.appendChild(e),n},ac.prototype.buildCurrStyleBtn=function(){var e=document.createElement("button"),t=("icons"==this.options.layout?e.classList.add(ac.Css.button):e.classList.add(ac.Css.listButton),e.classList.add(ac.Css.currentStyle),e.setAttribute("aria-label","Select Style"),e.setAttribute("tabindex","-1"),this.currStyleImage=new Image,e.appendChild(this.currStyleImage),document.createElement("div"));return t.classList.add("icon"),e.appendChild(t),e},ac.prototype.buildStyleOpsGrid=function(){var e=this,t=document.createElement("div");return t.classList.add(ac.Css.styleOptions),"icons"===this.options.layout?t.classList.add(this.options.layout):t.classList.add(ac.Css.dropdown),t.setAttribute("aria-label","Style Options"),t.classList.add("hidden-accessible-element"),t.setAttribute("aria-hidden","true"),this.map.styles.definitions().then(function(t){return rc(e,void 0,void 0,function(){return nc(this,function(e){return this.onMapConfigurationChange(t),this.map.events.add("stylechanged",this.onStyleChange),[2]})})}),this.map.events.add("mapconfigurationchanged",this.onMapConfigurationChange),t},ac.prototype.populateOpsGridFromDefinitions=function(n){var e,o,i=this;this.styleOpsGrid&&(e=n.configurations,(e=Array.isArray(this.options.mapStyles)?e.filter(function(e){return i.options.mapStyles.includes(e.name.split("_indoor")[0])}):e).forEach(function(e){var t,o={url:e.thumbnail},r=(e.thumbnail&&i.map.styles._transformStyleRequest(e.thumbnail,o),i.map.getServiceOptions()),r=(r.transformRequest&&Xs(o,r.transformRequest(o.url,"Thumbnail")),i.thumbnailCache.response.has(o.url)?t=Promise.resolve(i.thumbnailCache.response.get(o.url)):(t=fetch(o.url,{headers:o.headers}),i.thumbnailCache.response.set(o.url,t)),i.buildSelectStyleBtn(e.name,n,t));i.styleOpsGrid.appendChild(r),i.styleButtons[e.name]=r,"icons"===i.options.layout&&(o=jt(i.mapToFriendlyStyleName(e.name,n)),i.styleOpsGrid.appendChild(o),Ht(o,r))}),o=this.map.getStyle().style,Object.entries(this.styleButtons).forEach(function(e){var e=ic(e,2),t=e[0];return e[1].setAttribute("aria-current",t===o?"true":"false")}))},ac.InvertOrderPositions=[l.ControlPosition.TopRight,l.ControlPosition.BottomRight],ac.Css={button:"azure-maps-control-button",listButton:"azure-maps-control-list-button",expanded:"expanded",currentStyle:"curr-style",inUse:"in-use",styleOptions:"style-options",dropdown:"azure-maps-control-dropdown"},ac);function ac(e){var t=oc.call(this)||this;return t.styleOpsGrid=null,t.hasMouse=!1,t.hasFocus=!1,t.styleButtons=new Zt,t.styleIcons=new Zt,t.thumbnailCache={assumedConfiguration:void 0,response:new Zt,blob:new Zt},t.onStyleChange=function(){var e;t.options.autoSelectionMode&&(e=t.map.getStyle().style,t.setSelectedStyle(e))},t.onMapConfigurationChange=function(e){!t.styleOpsGrid||0<t.styleOpsGrid.children.length&&t.thumbnailCache.assumedConfiguration===e||(t.thumbnailCache.assumedConfiguration=e,Array.from(t.styleOpsGrid.children).forEach(function(e){return e.remove()}),t.styleButtons.clear(),t.populateOpsGridFromDefinitions(e))},t.mapToFriendlyStyleName=function(t,e){e=e.configurations.find(function(e){return e.name===t});return(null==e?void 0:e.displayName)||t},t.options=(new $s).merge(Qa(e)),t}(window&&window.__extends||(sc=function(e,t){return(sc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}sc(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(lc,cc=ye);var sc,cc,uc=lc;function lc(){var e=null!==cc&&cc.apply(this,arguments)||this;return e.flow="none",e.incidents=!1,e}(window&&window.__extends||(hc=function(e,t){return(hc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}hc(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(fc,dc=uc);var hc,dc,pc=fc;function fc(){var e=null!==dc&&dc.apply(this,arguments)||this;return e.isActive=!1,e.style=l.ControlStyle.light,e}(window&&window.__extends||(gc=function(e,t){return(gc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gc(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(vc,mc=$t),Object.defineProperty(vc.prototype,"isActive",{get:function(){var e;return!!this.map&&("none"!==(e=this.map.getTraffic()).flow||e.incidents)},set:function(e){this.map&&this.map.setTraffic({flow:e?this.options.flow:"none",incidents:!!e&&this.options.incidents})},enumerable:!1,configurable:!0}),vc.prototype.onAdd=function(e){(this.map=e).getTraffic(),void 0!==this.initIsActive&&(this.isActive=this.initIsActive),this.container=this.buildContainer(e,this.style,"Traffic Control"),this.container.style.flexDirection="column";var e=this.constructTrafficButton(e),t=(this.container.appendChild(e),jt("Toggle Traffic Display"));return this.container.appendChild(t),Ht(t,e),this.container},vc.prototype.onRemove=function(){mc.prototype.onRemove.call(this),this.map=null},vc.prototype.getOptions=function(){return(new pc).merge({isActive:this.isActive,flow:this.options.flow,incidents:this.options.incidents,style:this.style})},vc.prototype.updateButtonState=function(){this.trafficButton&&(this.isActive?(this.container.classList.add("in-use"),this.trafficButton.setAttribute("aria-description","Traffic is displayed")):(this.container.classList.remove("in-use"),this.trafficButton.removeAttribute("aria-description")),this.trafficButton.setAttribute("aria-pressed",this.isActive?"true":"false"))},vc.prototype.constructTrafficButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("traffic"),o.setAttribute("aria-label","Toggle Traffic Display"),o.setAttribute("alt","Toggle Traffic Display"),o.setAttribute("type","button"),this.trafficButton=o,this.updateButtonState(),o.addEventListener("click",function(){t.isActive=!t.isActive}),o};var gc,mc,yc=vc;function vc(e){var t,o=this;return(o=mc.call(this)||this).hasMouse=!1,o.hasFocus=!1,o.options=(new uc).merge({flow:"relative",incidents:!0}),o.style=l.ControlStyle.light,o.container=null,o.trafficButton=null,o.map=null,e&&(o.initIsActive=null!=(t=e.isActive)&&t,o.options.flow=e.flow||"relative",o.options.incidents=null==(t=e.incidents)||t,o.style=e.style||l.ControlStyle.light),o}var _c,wc,bn=window&&window.__extends||(_c=function(e,t){return(_c=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}_c(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),bc=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=(bn(Cc,wc=$t),Cc.prototype.onAdd=function(e){this.map=e;var t=this.buildContainer(e,l.ControlStyle.auto,"Traffic Legend"),e=this.buildTrafficLegendDiv(e);return t.setAttribute("role","definition"),t.appendChild(e),t},Cc.prototype.onRemove=function(){wc.prototype.onRemove.call(this),this.syncHiddenState&&(this.map.events.remove("styledata",this.syncHiddenState),this.syncHiddenState=null),this.map=null},Cc.prototype.buildTrafficLegendDiv=function(t){var o,e,r,n,i=document.createElement("div"),a=(i.classList.add("traffic-legend","hidden"),i.setAttribute("alt","Traffic Legend"),document.createElement("table")),s=document.createElement("tr"),c=document.createElement("td"),u=(c.setAttribute("alt","Traffic"),c.appendChild(document.createTextNode("Traffic")),jt("Traffic")),l=(c.classList.add("traffic-legend-title"),c.colSpan=6,s.appendChild(c),s.appendChild(u),Ht(u,c),a.appendChild(s),document.createElement("tr"));try{for(var h=bc(this.table),d=h.next();!d.done;d=h.next()){var p=d.value,f=document.createElement("td");if("Fast"===p||"Slow"===p)f.setAttribute("alt",p),f.appendChild(document.createTextNode(p)),f.classList.add("traffic-legend-text");else{f.classList.add("traffic-legend-colors"),f.setAttribute("aria-label","Traffic Legend"),f.setAttribute("role","img");try{r=void 0;for(var g=bc(p),m=g.next();!m.done;m=g.next()){var y=m.value,v=document.createElement("div");v.classList.add(y),f.appendChild(v)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}}l.appendChild(f);var _=jt(p instanceof Array?"Traffic Legend":p);l.appendChild(_),Ht(_,f)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(e=h.return)&&e.call(h)}finally{if(o)throw o.error}}return a.appendChild(l),i.appendChild(a),this.syncHiddenState=function(e){"style"===e.dataType&&((e=t.getTraffic()).flow&&"none"!==e.flow?i.classList.remove("hidden"):i.classList.add("hidden"))},this.syncHiddenState({dataType:"style"}),t.events.add("styledata",this.syncHiddenState),i},Cc);function Cc(){var e=wc.call(this)||this;return e.table=["Fast",["green","yellow","red","dark-red"],"Slow"],e.map=null,e.syncHiddenState=null,e}function Ec(e){return this.__data__.has(e)}var Sc=ir;function Tc(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new Sc;++t<o;)this.add(e[t])}Tc.prototype.add=Tc.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Tc.prototype.has=Ec;var Ic=Tc,kc=function(e,t){for(var o=-1,r=null==e?0:e.length;++o<r;)if(t(e[o],o,e))return!0;return!1},Ac=function(e,t){return e.has(t)};function Pc(e,t,o,r,n,i){var a=1&o,s=e.length,c=t.length;if(s!=c&&!(a&&s<c))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var l=-1,h=!0,d=2&o?new Ic:void 0;for(i.set(e,t),i.set(t,e);++l<s;){var p,f=e[l],g=t[l];if(void 0!==(p=r?a?r(g,f,l,t,e,i):r(f,g,l,e,t,i):p)){if(p)continue;h=!1;break}if(d){if(!kc(t,function(e,t){if(!Ac(d,t)&&(f===e||n(f,e,o,r,i)))return d.push(t)})){h=!1;break}}else if(f!==g&&!n(f,g,o,r,i)){h=!1;break}}return i.delete(e),i.delete(t),h}function Oc(e){var o=-1,r=Array(e.size);return e.forEach(function(e,t){r[++o]=[t,e]}),r}function Rc(e){var t=-1,o=Array(e.size);return e.forEach(function(e){o[++t]=e}),o}var xc=Cn,Mc=wo,Nc=Pc,e=Uo?Uo.prototype:void 0,Lc=e?e.valueOf:void 0;var Dc=Ai,qc=Object.prototype.hasOwnProperty;var Uc=r,jc=Pc,Hc=function(e,t,o,r,n,i,a){switch(o){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return e.byteLength==t.byteLength&&i(new xc(e),new xc(t))?!0:!1;case"[object Boolean]":case"[object Date]":case"[object Number]":return Mc(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Oc;case"[object Set]":s=s||Rc;if(e.size!=t.size&&!(1&r))return!1;var c=a.get(e);if(c)return c==t;r|=2,a.set(e,t);c=Nc(s(e),s(t),r,n,i,a);return a.delete(e),c;case"[object Symbol]":if(Lc)return Lc.call(e)==Lc.call(t)}return!1},Bc=function(e,t,o,r,n,i){var a=1&o,s=Dc(e),c=s.length;if(c!=Dc(t).length&&!a)return!1;for(var u=c;u--;){var l=s[u];if(!(a?l in t:qc.call(t,l)))return!1}var h=i.get(e),d=i.get(t);if(h&&d)return h==t&&d==e;for(var p=!0,f=(i.set(e,t),i.set(t,e),a);++u<c;){var g,m=e[l=s[u]],y=t[l];if(!(void 0===(g=r?a?r(y,m,l,t,e,i):r(m,y,l,e,t,i):g)?m===y||n(m,y,o,r,i):g)){p=!1;break}f=f||"constructor"==l}return p&&!f&&(h=e.constructor)!=(d=t.constructor)&&"constructor"in e&&"constructor"in t&&!("function"==typeof h&&h instanceof h&&"function"==typeof d&&d instanceof d)&&(p=!1),i.delete(e),i.delete(t),p},Fc=hi,zc=i,Kc=un,Gc=cn,Yc="[object Arguments]",Wc="[object Array]",Zc="[object Object]",Qc=Object.prototype.hasOwnProperty;var Vc=function(e,t,o,r,n,i){var a=zc(e),s=zc(t),c=a?Wc:Fc(e),s=s?Wc:Fc(t),u=(c=c==Yc?Zc:c)==Zc,l=(s=s==Yc?Zc:s)==Zc;if((s=c==s)&&Kc(e)){if(!Kc(t))return!1;u=!(a=!0)}if(s&&!u)return i=i||new Uc,a||Gc(e)?jc(e,t,o,r,n,i):Hc(e,t,c,o,r,n,i);if(!(1&o)){a=u&&Qc.call(e,"__wrapped__"),c=l&&Qc.call(t,"__wrapped__");if(a||c)return n(a?e.value():e,c?t.value():t,o,r,i=i||new Uc)}return s&&(i=i||new Uc,Bc(e,t,o,r,n,i))},Jc=en;var Xc=function e(t,o,r,n,i){return t===o||(null==t||null==o||!Jc(t)&&!Jc(o)?t!=t&&o!=o:Vc(t,o,r,n,e,i))};var $c=q(function(e,t){return Xc(e,t)}),eu=(tu.TYPE="Feature",tu);function tu(e,t,o,r){this.type="Feature",this.type=tu.TYPE,this.properties=t||{},this.id=o,this.geometry=e,this.bbox=r}var ou,ru,ii=window&&window.__extends||(ou=function(e,t){return(ou=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ou(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),nu=(ru=Array,ii(iu,ru),iu.fromData=function(o){var r=NaN,n=NaN,i=new Set(["y"]),a=new Set(["x"]);return Object.keys(o).forEach(function(e){var t=e.toLowerCase();isNaN(r)&&i.has(t)&&"number"==typeof o[e]?r=o[e]:isNaN(n)&&a.has(t)&&"number"==typeof o[e]&&(n=o[e])}),isNaN(r)||isNaN(n)?null:new iu(r,n)},iu.getX=function(e){return 0<e.length?e[0]:NaN},iu.getY=function(e){return 1<e.length?e[1]:NaN},iu.getDestination=function(e,t,o){return new iu(iu.getX(e)+o*Math.cos((t+270)*Math.PI/180),iu.getY(e)+o*Math.sin((t+270)*Math.PI/180))},iu.getDistance=function(e,t){var o=iu.getX(e)-iu.getX(t),e=iu.getY(e)-iu.getY(t);return Math.sqrt(o*o+e*e)},iu.getHeading=function(e,t){var o=iu.getX(t)-iu.getX(e),e=iu.getY(e)-iu.getY(t);return 180*(2.5*Math.PI-Math.atan2(e,o))/Math.PI%360},iu);function iu(e,t){return ru.call(this,e,t)||this}su.TYPE="Point";var au=su;function su(e){this.type="Point",this.type=su.TYPE,this.coordinates=e}var cu,uu,lu,hu,du,pu=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},fu=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},gu=6378137,mu=Math.PI/180,yu=180/Math.PI,vu=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9],_u=85.0511;function wu(e){return e*mu}function bu(e){return e*yu}function Cu(e,t,o){return Math.min(Math.max(e,t),o)}function Eu(e,t){var o=wu(t[1]-e[1]),r=wu(t[0]-e[0]),o=Math.pow(Math.sin(o/2),2)+Math.cos(wu(e[1]))*Math.cos(wu(t[1]))*Math.pow(Math.sin(r/2),2),e=2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o));return Math.round(gu*e*100)/100}function Su(e){if(e)switch(e.toLowerCase()){case"feet":case"foot":case"ft":return uu.feet;case"kilometers":case"kilometer":case"kilometres":case"kilometre":case"km":case"kms":return uu.kilometers;case"miles":case"mile":case"mi":return uu.miles;case"nauticalmiles":case"nauticalmile":case"nms":case"nm":return uu.nauticalMiles;case"yards":case"yard":case"yds":case"yrd":case"yrds":return uu.yards;default:return uu.meters}return uu.meters}function Tu(e){if(e)switch(e.toLowerCase()){case"milespersecondsquared":case"milepersecondsquared":case"mi/s^2":case"mi/s2":return du.milesPerSecondSquared;case"kilometerspersecondsquared":case"kilometrespersecondsquared":case"kilometerpersecondsquared":case"kilometrepersecondsquared":case"km/s^2":case"km/s2":return du.kilometersPerSecondSquared;case"knotspersecond":case"knotpersecond":case"knts/s":case"kn/s":case"kt/s":return du.knotsPerSecond;case"standardgravity":case"g":return du.standardGravity;case"feetpersecondsquared":case"footpersecondsquared":case"ft/s^2":case"ft/s2":return du.feetPerSecondSquared;case"yardspersecondsquared":case"yardpersecondsquared":case"yds/s^2":case"yds/s2":case"yd/s^2":case"yd/s2":return du.yardsPerSecondSquared;case"milesperhoursecond":case"mileperhoursecond":case"milesperhourseconds":case"mileperhourseconds":case"mi/h/s":return du.milesPerHourSecond;case"kilometersperhoursecond":case"kilometrespersoursecond":case"kilometerperhoursecond":case"kilometrepersoursecond":case"kilometersperhourssecond":case"kilometrespersourssecond":case"kilometerperhourssecond":case"kilometrepersourssecond":case"kmhs":case"km/h/s":return du.kilometersPerHourSecond;default:return du.metersPerSecondSquared}return du.metersPerSecondSquared}function Iu(e){if(e)switch(e){case"acres":case"ac":return cu.acres;case"hectares":case"ha":return cu.hectares;case"squareFeet":case"ft^2":case"ft2":return cu.squareFeet;case"squareYards":case"squareYard":case"yds^2":case"yds2":case"yd^2":case"yd2":return cu.squareYards;case"squareKilometers":case"squareKilometres":case"squareKilometer":case"squareKilometre":case"km^2":case"km2":return cu.squareKilometers;case"squareMiles":case"squareMile":case"mi^2":case"mi2":return cu.squareMiles;default:return cu.squareMeters}return cu.squareMeters}function ku(e){if(e)switch(e.toLowerCase()){case"feetpersecond":case"footsecond":case"ftps":case"ft/s":return hu.feetPerSecond;case"milesperhour":case"mileperhour":case"mph":case"mi/hr":case"mi/h":return hu.milesPerHour;case"knots":case"knot":case"knts":case"knt":case"kn":case"kt":return hu.knots;case"mach":case"m":return hu.mach;case"kilometersperhour":case"kilometresperhour":case"kmperhour":case"kmph":case"km/hr":case"km/h":return hu.kilometersPerHour;default:return hu.metersPerSecond}return hu.metersPerSecond}function Au(e){if(e)switch(e.toLowerCase()){case"milliseconds":case"ms":return lu.ms;case"minutes":case"minute":case"mins":case"min":return lu.minutes;case"hours":case"hour":case"hr":case"h":return lu.hours;case"days":case"day":case"d":return lu.days;default:return lu.seconds}return lu.seconds}function Pu(e){var t=0;if(e&&0<e.length)for(var t=Math.abs(Ou(e[0])),o=1,r=e.length;o<r;o++)t-=Math.abs(Ou(e[o]));return t}function Ou(e){var t=0;if(3<=e.length){for(var o=void 0,r=void 0,n=0,i=e.length;n<i;n++)t+=(wu(e[n===i-2?(o=i-2,r=i-1,0):n===i-1?(o=i-1,r=0,1):(r=(o=n)+1,n+2)][0])-wu(e[o][0]))*Math.sin(wu(e[r][1]));t=t*gu*gu/2}return t}function Ru(e,t,o){return(e[0]-o[0])*(t[1]-o[1])-(e[1]-o[1])*(t[0]-o[0])}function xu(e,t,o){if(2<=o.length){for(var r,n,i,a=1/0,s=null,c=Ju(o,22),u=0,l=c.length-1;u<l;u++)n=function(e,t,o){if(t[0]===o[0]&&t[1]===o[1])return t;var r=e[0]-t[0],e=e[1]-t[1],n=o[0]-t[0],i=o[1]-t[1],r=(n*r+i*e)/(n*n+i*i);return r<0?t:1<r?o:[t[0]+n*r,t[1]+i*r]}(t,c[u],c[u+1]),(r=nu.getDistance(t,n))<a&&(a=r,s=n);if(s)return i=Vu([s],22)[0],new eu(new au(i),{distance:Du(e,i)})}else if(1===o.length)return new eu(new au(o[0]),{distance:Du(e,o[0])});return null}function Mu(e,t){var o;return!isNaN(e)&&"number"==typeof t&&0<=t&&(o=void 0,o=t<vu.length?vu[t]:Math.pow(10,t),e=Math.round(e*o)/o),e}function Nu(e,t,o,r){switch(Su(t)){case uu.meters:e/=1e3;break;case uu.feet:e/=3280.8399;break;case uu.miles:e/=.62137119;break;case uu.yards:e/=1093.6133;break;case uu.nauticalMiles:e/=.5399568;break;case uu.kilometers:}switch(Su(o)){case uu.meters:e*=1e3;break;case uu.feet:e*=3280.8399;break;case uu.miles:e*=.62137119;break;case uu.yards:e*=1093.6133;break;case uu.nauticalMiles:e*=.5399568;break;case uu.kilometers:}return"number"==typeof r&&0<=r&&(t=Math.pow(10,r),e=Math.round(e*t)/t),e}function Lu(e,t,o,r){r=r||"meters",e=sl(e);var r=qu(r),n=wu(e[1]),e=wu(e[0]),t=t*mu,o=o/r,r=Math.asin(Math.sin(n)*Math.cos(o)+Math.cos(n)*Math.sin(o)*Math.cos(t)),e=e+Math.atan2(Math.sin(t)*Math.sin(o)*Math.cos(n),Math.cos(o)-Math.sin(n)*Math.sin(r)),t=Cu(Wu(r*yu),-85,85);return[Zu(e*yu),t]}function Du(e,t,o){e=Eu(e=sl(e),t=sl(t));return"meters"===o?e:Nu(e,"meters",o||"meters")}function qu(e){e=Su(e);return Nu(gu,uu.meters,e)}function Uu(e,t,o){for(var r=[],n=wu(e[1]),i=wu(e[0]),a=wu(t[1]),s=wu(t[0]),c=2*Math.asin(Math.sqrt(Math.pow(Math.sin((n-a)/2),2)+Math.cos(n)*Math.cos(a)*Math.pow(Math.sin((i-s)/2),2))),u=0;u<=o;u++){var l=u/o,h=Math.sin((1-l)*c)/Math.sin(c),l=Math.sin(l*c)/Math.sin(c),d=h*Math.cos(n)*Math.cos(i)+l*Math.cos(a)*Math.cos(s),p=h*Math.cos(n)*Math.sin(i)+l*Math.cos(a)*Math.sin(s),h=h*Math.sin(n)+l*Math.sin(a),l=Math.atan2(h,Math.sqrt(Math.pow(d,2)+Math.pow(p,2))),h=Math.atan2(p,d),l=Cu(l*yu,-85,85);r.push([h*=yu,l])}return r}function ju(e){return(Array.isArray(e)?e:e.coordinates).reduce(function(e,t){var o=0<e.length?e[e.length-1]:null;return o&&180<Math.abs(t[0]-o[0])?(o=o[0]<0?t[0]-360:t[0]+360,e.push([o,t[1]])):e.push(t),e},[])}function Hu(e){for(var t,o,r,n,i,a=Array.isArray(e)?e:e.coordinates,s=[],c=[],u=0;u<a.length;u++)s.push(a[u]),u+1>=a.length||(t=(o=pu(a[u],2))[0],o=o[1],n=(i=pu(a[u+1],2))[0],i=i[1],180<Math.abs(n-t)&&(r=0<t?180:-180,n=Math.abs((0<t?n+360:n-360)-t),i=o+(i-o)*(Math.abs(r-t)/n),s.push([r,i]),c.push(s),s=[[-r,i]]));return c.push(s),c}function Bu(e,t){var o,r;return e=sl(e),t=sl(t),e&&2<=e.length&&t&&2<=t.length?(r=wu(e[1]),o=wu(t[1]),t=wu(t[0]-e[0]),e=Math.sin(t)*Math.cos(o),r=Math.cos(r)*Math.sin(o)-Math.sin(r)*Math.cos(o)*Math.cos(t),(bu(Math.atan2(e,r))+360)%360):NaN}function Fu(e,t){var o,r=0;Array.isArray(e)?o=e:e.type&&"LineString"===e.type&&(o=e.coordinates);for(var n=0,i=o.length-1;n<i;n++)r+=Eu(o[n],o[n+1]);return Nu(r,"meters",t||"meters")}function zu(e,t,o){o=o||"meters";var r,n=0;if(Array.isArray(e)?r=e:e.type&&"LineString"===e.type&&(r=e.coordinates),2<=r.length){for(var i,a,s=r.length,c=1;c<s;c++){if(t<=n+(a=Du(r[c-1],r[c],o)))return i=Bu(r[c-1],r[c]),Lu(r[c-1],i,t-n,o);n+=a}return n<=t?r[s-1]:r[0]}return null}function Ku(e,t,o,r,n){r=r||"meters",n=n||0,e=sl(e);for(var i=[],a=360/o,s=0;s<=o;s++)i.push(Lu(e,(s*a+n)%360,t,r));return i}function Gu(e,t,o,r,n){return ju(Ku(e,t,o,r,n))}function Yu(e,t,o){o=void 0===o?.5:o;var r=Du(e=sl(e),t=sl(t),"kilometers");return Lu(e,Bu(e,t),r*o,"kilometers")}function Wu(e){return 90<e?180<(e=(e+90)%360)?90-(e-180):e-90:e<-90?(e=(e-90)%360)<-180?-90-(e+180):e+90:e}function Zu(e){return 180<e?(e+180)%360-180:e<-180?(e-180)%360+180:e}function Qu(e,t,o){if(0===o)return Object.assign({},e);t=sl(t);for(var r,n,i=[],a=0,s=e.length;a<s;a++)r=Du(t,e[a]),n=Bu(t,e[a]),i.push(Lu(t,n+o,r));return i}function Vu(e,t){for(var o,r,n=512*Math.pow(2,t),i=[],a=0,s=e.length;a<s;a++)o=e[a][0]/n-.5,r=.5-e[a][1]/n,i.push([360*o,90-360*Math.atan(Math.exp(2*-r*Math.PI))/Math.PI]);return i}function Ju(e,t){for(var o,r,n=512*Math.pow(2,t),i=[],a=0,s=e.length;a<s;a++)r=Math.sin(e[a][1]*Math.PI/180),o=(e[a][0]+180)/360,r=.5-Math.log((1+r)/(1-r))/(4*Math.PI),i.push([Math.round(o*n),Math.round(r*n)]);return i}function Xu(e,t,o,r){switch(Tu(t)){case du.kilometersPerHourSecond:e/=3.6;break;case du.milesPerHourSecond:e/=2.236936292054;break;case du.knotsPerSecond:e/=1.943844492441;break;case du.standardGravity:e/=.1019716212978;break;case du.kilometersPerSecondSquared:e/=.001;break;case du.milesPerSecondSquared:e/=.000621371192;break;case du.feetPerSecondSquared:e/=3.280839895012;break;case du.yardsPerSecondSquared:e/=1.093613298338;break;case du.metersPerSecondSquared:}switch(Tu(o)){case du.kilometersPerHourSecond:e*=3.6;break;case du.milesPerHourSecond:e*=2.236936292054;break;case du.knotsPerSecond:e*=1.943844492441;break;case du.standardGravity:e*=.1019716212978;break;case du.kilometersPerSecondSquared:e*=.001;break;case du.milesPerSecondSquared:e*=.000621371192;break;case du.feetPerSecondSquared:e*=3.280839895012;break;case du.yardsPerSecondSquared:e*=1.093613298338;break;case du.metersPerSecondSquared:}return Mu(e,r)}function $u(e,t,o,r){switch(Iu(t)){case cu.acres:e*=4046.8564224;break;case cu.hectares:e*=1e4;break;case cu.squareFeet:e*=.09290304;break;case cu.squareKilometers:e*=1e6;break;case cu.squareMiles:e*=259e4;break;case cu.squareYards:e*=.83612736;break;case cu.squareMeters:}switch(Iu(o)){case cu.acres:e/=4046.8564224;break;case cu.hectares:e/=1e4;break;case cu.squareFeet:e/=.09290304;break;case cu.squareKilometers:e/=1e6;break;case cu.squareMiles:e/=259e4;break;case cu.squareYards:e/=.83612736;break;case cu.squareMeters:}return Mu(e,r)}function el(e,t,o,r){switch(ku(t)){case hu.feetPerSecond:e*=1.09728;break;case hu.milesPerHour:e*=1.6093;break;case hu.knots:e*=1.852;break;case hu.metersPerSecond:e*=3.6;break;case hu.mach:e*=1234.8;break;case hu.kilometersPerHour:}switch(ku(o)){case hu.feetPerSecond:e/=1.09728;break;case hu.milesPerHour:e/=1.6093;break;case hu.knots:e/=1.852;break;case hu.metersPerSecond:e/=3.6;break;case hu.mach:e/=1234.8;break;case hu.kilometersPerHour:}return Mu(e,r)}function tl(e,t,o,r){switch(Au(t)){case lu.ms:e/=1e3;break;case lu.hours:e*=3600;break;case lu.minutes:e*=60;break;case lu.days:e*=86400;break;case lu.seconds:}switch(Au(o)){case lu.ms:e*=1e3;break;case lu.hours:e/=3600;break;case lu.minutes:e/=60;break;case lu.days:e/=86400;break;case lu.seconds:}return Mu(e,r)}function ol(e,t,o,r,n,i,a,s){t=Nu(t,n,uu.meters),n=tl(o,i,lu.seconds);return Xu(2*(t-el(e,r,hu.metersPerSecond)*n)/(n*n),du.metersPerSecondSquared,a,s)}function rl(e,t,o,r,n,i,a){e=el(e,r,hu.metersPerSecond);return Xu((el(t,r,hu.metersPerSecond)-e)/tl(o,n,lu.seconds),du.metersPerSecondSquared,i,a)}function nl(e,t,o,r){e=il(e),t=il(t);return null!=e&&null!=t?tl(t.getTime()-e.getTime(),lu.ms,o,r):NaN}function il(e){if("[object Date]"===Object.prototype.toString.call(e))return e;if("string"==typeof e){var t=Date.parse(e);if(!isNaN(t))return new Date(t);if(0<=e.indexOf("Date("))return t=(t=0)<(e=e.replace("/Date(","").replace(")/","")).indexOf("+")?parseInt(e.substr(0,e.indexOf("+")),10):0<e.indexOf("-")?parseInt(e.substr(0,e.indexOf("-")),10):parseInt(e,10),new Date(t)}else if("number"==typeof e)return new Date(e);return null}function al(e){var t=[],o=null,r=null;if(Array.isArray(e)&&0<e.length)if(Array.isArray(e[0])&&"number"==typeof e[0][0])t=e;else for(var n=e.length,i=0;i<n;i++)t=t.concat(al(e[i]));else if(e.type)switch(e.type){case"Point":t=[e.coordinates];break;case"LineString":t=e.coordinates;break;case"Polygon":o=e.coordinates;break;case"MultiPoint":t=e.coordinates;break;case"MultiLineString":o=e.coordinates;break;case"MultiPolygon":r=e.coordinates;break;case"Feature":var a=e,t=_l._isCircle(a)?_l._getCirclePositions(a):al(a.geometry);break;case"FeatureCollection":t=al(e.features);break;case"GeometryCollection":t=al(e.geometries)}else if(e instanceof _l)return al(e.toJson());if(o)for(n=o.length,i=0;i<n;i++)t=t.concat(o[i]);else if(r)for(var s=r.length,i=0;i<s;i++)for(var c=r[i].length,u=0;u<c;u++)t=t.concat(r[i][u]);return t}function sl(e){if(Array.isArray(e)&&"number"==typeof e[0])return e;if(e.type){if("Point"===e.type)return e.coordinates;if("Feature"===e.type&&"Point"===e.geometry.type)return e.geometry.coordinates}else if(e instanceof _l&&"Point"===e.getType())return e.getCoordinates();return null}function cl(e,t,o){o=o||"meters";var r,n=0;if(Array.isArray(e)?r=e:e.type&&"LineString"===e.type&&(r=e.coordinates),2<=r.length){for(var i,a,s,c=r.length,u=1;u<c;u++){if(t<=n+(s=Du(r[u-1],r[u],o)))return i=Bu(r[u-1],r[u]),a=Lu(r[u-1],i,t-n,o),new eu(new au(a),{heading:i});n+=s}return n<=t?new eu(new au(r[c-1]),{heading:Bu(r[c-2],r[c-1])}):new eu(new au(r[0]),{heading:Bu(r[0],r[1])})}return null}function ul(e,t,o,r){var n=sl(e),i=Ju([n],22)[0],a=null,s=1/0;switch((t=t instanceof _l?t.toJson():t).type){case"Feature":return ul(e,t.geometry,o);case"Point":p=[[t.coordinates]];break;case"MultiPoint":for(var c,u=t.coordinates,l=0,h=u.length;l<h;l++)(c=Du(n,u[l]))<s&&(s=c,a=new eu(new au(u[l]),{distance:c}));break;case"LineString":p=[t.coordinates];break;case"Polygon":case"MultiLineString":p=t.coordinates;break;case"MultiPolygon":var d=t.coordinates;if(0<d.length)for(var p=d[0],l=1,h=d.length;l<h;l++)p=p.concat(d[l])}if(p)for(var f,l=0,h=p.length;l<h;l++)(f=xu(n,i,p[l]))&&f.properties.distance<s&&(s=f.properties.distance,a=f);return a&&(a.properties.distance=Nu(a.properties.distance,"meters",o,r)),a}(nn=cu=cu||{}).squareMeters="squareMeters",nn.acres="acres",nn.hectares="hectares",nn.squareFeet="squareFeet",nn.squareKilometers="squareKilometers",nn.squareMiles="squareMiles",nn.squareYards="squareYards",(Ni=uu=uu||{}).meters="meters",Ni.kilometers="kilometers",Ni.feet="feet",Ni.miles="miles",Ni.nauticalMiles="nauticalMiles",Ni.yards="yards",(Hr=lu=lu||{}).seconds="seconds",Hr.hours="hours",Hr.ms="ms",Hr.minutes="minutes",Hr.days="days",(n=hu=hu||{}).metersPerSecond="metersPerSecond",n.kilometersPerHour="kilometersPerHour",n.feetPerSecond="feetPerSecond",n.milesPerHour="milesPerHour",n.knots="knots",n.mach="mach",(a=du=du||{}).milesPerSecondSquared="milesPerSecondSquared",a.kilometersPerSecondSquared="kilometersPerSecondSquared",a.knotsPerSecond="knotsPerSecond",a.standardGravity="standardGravity",a.feetPerSecondSquared="feetPerSecondSquared",a.yardsPerSecondSquared="yardsPerSecondSquared",a.milesPerHourSecond="milesPerHourSecond",a.kilometersPerHourSecond="kilometersPerHourSecond",a.metersPerSecondSquared="metersPerSecondSquared";var ll,hl,bn=window&&window.__extends||(ll=function(e,t){return(ll=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ll(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),dl=(hl=Array,bn(pl,hl),pl.fromPosition=function(e){return 2===e.length?new pl(e[0],e[1]):2<e.length?new pl(e[0],e[1],e[2]):null},pl.areEqual=function(e,t,o){var r,n;return void 0===o&&(o=6),!!(e&&2<=e.length&&t&&2<=t.length)&&(o=Math.pow(10,o),n=Wu(e[1]),r=Wu(t[1]),e=Zu(e[0]),t=Zu(t[0]),0==Math.round((n-r)*o)/o)&&(0==(n=Math.round((e-t)*o)/o)||360==n)},pl.fromLatLng=function(n,e,t){var i,a,s,c,u,l,o=[];return"number"==typeof n?(o.push(n),"number"==typeof e&&o.push(e),"number"==typeof t&&o.push(t)):Array.isArray(n)?2<=n.length&&"number"==typeof n[0]&&"number"==typeof n[1]&&(3<=n.length&&"number"==typeof n[2]?o.push(n[0],n[1],n[2]):o.push(n[0],n[1])):"object"==typeof n&&(i=["lat","latitude","y"],a=["lng","longitude","lon","x"],s=["elv","elevation","alt","altitude","z"],l=u=c=NaN,Object.keys(n).forEach(function(e,t,o){var r=e.toLowerCase();isNaN(c)&&0<=i.indexOf(r)&&"number"==typeof n[e]?c=n[e]:isNaN(u)&&0<=a.indexOf(r)&&"number"==typeof n[e]?u=n[e]:isNaN(l)&&0<=s.indexOf(r)&&"number"==typeof n[e]&&(l=n[e])}),isNaN(c)||isNaN(u)||(o.push(u,c),isNaN(l))||o.push(l)),2<=o.length?o:null},pl.fromLatLngs=function(e){var t=[];if(Array.isArray(e))for(var o=0,r=e.length;o<r;o++){var n=pl.fromLatLng(e[o]);n&&t.push(n)}return t},pl._getDimensions=function(e){for(var t=0;Array.isArray(e);)e=e[0],t++;return"number"==typeof e&&t--,t},pl);function pl(e,t,o){return o?hl.call(this,e,t,o)||this:hl.call(this,e,t)||this}gl.TYPE="Polygon";var fl=gl;function gl(e,t){this.type="Polygon",this.type=gl.TYPE,1===dl._getDimensions(e)?this.coordinates=[e]:this.coordinates=e,this.bbox=t}var ml,yl,ir=window&&window.__extends||(ml=function(e,t){return(ml=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ml(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),vl=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_l=(ir(wl,yl=Qt),wl.prototype.addProperty=function(e,t){$c(this.data.properties[e],t)||(this.data.properties[e]=Qa(t),"subType"!==e&&"radius"!==e||this._handleCircle(),this.dataSource&&this.dataSource._updateSource(),this._invokeEvent("shapechanged",this))},wl.prototype.getBounds=function(){var t,e,o,r,n,i=this.getCoordinates(),a=this.getType();if("Point"===a)n=this.circlePolygon?(s=this.circlePolygon.geometry.coordinates,f.fromPositions(s[0])):new f(s=i,s);else if("MultiPoint"===a||"LineString"===a){var s=i;n=f.fromPositions(s)}else if("Polygon"===a){s=i;n=f.fromPositions(s[0])}else if("MultiLineString"===a){s=i;try{for(var c=vl(s),u=c.next();!u.done;u=c.next()){var l=u.value;n=f.merge(n,f.fromPositions(l))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}}else if("MultiPolygon"===a){s=i;try{for(var h=vl(s),d=h.next();!d.done;d=h.next()){var p=d.value;n=f.merge(n,f.fromPositions(p[0]))}}catch(e){o={error:e}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(o)throw o.error}}}return n},wl.prototype.getCoordinates=function(){return Qa(this.data.geometry.coordinates)},wl.prototype.getCircleCoordinates=function(){return this.circlePolygon?Qa(this.circlePolygon.geometry.coordinates[0]):null},wl.prototype.getId=function(){return this.data.id},wl.prototype.getProperties=function(){return Qa(this.data.properties)},wl.prototype.getType=function(){return this.data.geometry.type},wl.prototype.isCircle=function(){return wl._isCircle(this.data)},wl.prototype.isRectangle=function(){return wl._isRectangle(this.data)},wl.prototype.setCoordinates=function(e){e="Polygon"===this.getType()&&1===dl._getDimensions(e)?[e]:e;$c(this.data.geometry.coordinates,e)||(this.data.geometry.coordinates=Qa(e),this._handleCircle(),this.dataSource&&this.dataSource._updateSource(),this._invokeEvent("shapechanged",this))},wl.prototype.setProperties=function(e){e[wl._shapeIdPropName]=this.data.id,$c(this.data.properties,e)||(this.data.properties=Qa(e),this._handleCircle(),this.dataSource&&this.dataSource._updateSource(),this._invokeEvent("shapechanged",this))},wl.prototype.toJson=function(){return JSON.parse(JSON.stringify(this.data))},wl.prototype._toJson=function(){return this.circlePolygon||this.data},wl.prototype._setDataSource=function(e){void 0===e||null==e?delete this.dataSource:this.dataSource=e},wl.prototype._handleCircle=function(){var e;this.isCircle()?(e=wl._getCirclePositions(this.data),this.circlePolygon=new eu(new fl([e]),this.data.properties,this.data.id),this.data.properties.subType="Circle"):delete this.circlePolygon},wl._isCircle=function(e){return e&&e.geometry&&"Point"===e.geometry.type&&e.geometry.coordinates&&e.properties&&"string"==typeof e.properties.subType&&"circle"===e.properties.subType.toLowerCase()&&"number"==typeof e.properties.radius},wl._isRectangle=function(e){if("Polygon"===e.geometry.type&&e.geometry.coordinates&&"string"==typeof e.properties.subType&&"rectangle"===e.properties.subType.toLowerCase()){e=e.geometry.coordinates;if(1===e.length){e=e[0];if(5===e.length)return e[0][0]===e[4][0]&&e[0][1]===e[4][1];if(4===e.length)return!0}}return!1},wl._getCirclePositions=function(e){return Gu(e.geometry.coordinates,e.properties.radius,72,"meters")},wl._shapeIdPropName="_azureMapsShapeId",wl);function wl(e,t,o){var r,n,i=yl.call(this)||this;return"Feature"===e.type?(n=Qa((r=e).geometry),o=r.properties?Qa(r.properties):{},t=null==r.id||""===r.id?W():r.id):(n=Qa(e),t=null==t||""===t?W():t,o=o?Qa(o):{}),o[wl._shapeIdPropName]=t,i.data=new eu(n,o,t),i._handleCircle(),i}var bl,Cl,Cn=window&&window.__extends||(bl=function(e,t){return(bl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}bl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),El=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},f=(Cl=Array,Cn(y,Cl),y.fromBoundingBox=function(e){var t=y.getWest(e),o=y.getSouth(e),r=y.getEast(e),e=y.getNorth(e);return new y([t,o,r,e])},y.fromDimensions=function(e,t,o){var r=e[0],e=e[1],n=Math.min(Math.max(e+o/2,-85.5),85.5),e=Math.min(Math.max(e-o/2,-85.5),85.5),o=Zu(r+t/2);return new y([Zu(r-t/2),e,o,n])},y.fromEdges=function(e,t,o,r){return new y([e,t,o,r])},y.containsPosition=function(e,t){var o=y.getCenter(e),r=Math.abs(o[1]-t[1]),o=Math.abs(o[0]-t[0]),t=(180<o&&(o=360-o),y.getHeight(e)),e=y.getWidth(e);return r<=t/2+1e-8&&o<=e/2+1e-8},y.containsBoundingBox=function(e,t){var o=e&&4===e.length,r=t&&4===t.length;return!(!o||!r)&&y.getWest(e)<y.getWest(t)&&y.getWest(t)<y.getEast(e)&&y.getWest(e)<y.getEast(t)&&y.getEast(t)<y.getEast(e)&&y.getSouth(e)<y.getSouth(t)&&y.getSouth(t)<y.getNorth(e)&&y.getSouth(e)<y.getNorth(t)&&y.getNorth(t)<y.getNorth(e)},y.crossesAntimeridian=function(e){return Zu(y.getEast(e))-Zu(y.getWest(e))<0||y.isBoundingBoxWithSixOrMoreElementsLargerThanGlobe(e)||y.isBoundingBoxWithLessThanSixElementsLargerThanGlobe(e)},y.getCenter=function(e){var t=Zu(y.getEast(e)),o=Zu(y.getWest(e)),o=(t<o&&(t+=360),Zu((o+t)/2)),t=Wu(y.getSouth(e)),e=Wu(y.getNorth(e));return[o,Wu((t+e)/2)]},y.getHeight=function(e){e=Wu(y.getNorth(e))-Wu(y.getSouth(e));return isNaN(e)?0:e},y.getWidth=function(e){e=Zu(y.getEast(e))-Zu(y.getWest(e));return isNaN(e)?0:e<0?e+360:e},y.getSouthWest=function(e){var t=this.getSouth(e),e=this.getWest(e);return isNaN(t)||isNaN(e)?null:[e,t]},y.getNorthEast=function(e){var t=this.getNorth(e),e=this.getEast(e);return isNaN(t)||isNaN(e)?null:[e,t]},y.getNorthWest=function(e){var t=this.getNorth(e),e=this.getWest(e);return isNaN(t)||isNaN(e)?null:[e,t]},y.getSouthEast=function(e){var t=this.getSouth(e),e=this.getEast(e);return isNaN(t)||isNaN(e)?null:[e,t]},y.getSouth=function(e){return e&&4<=e.length?Number(e[1]):NaN},y.getWest=function(e){return e&&4<=e.length?Number(e[0]):NaN},y.getNorth=function(e){if(e){if(4===e.length)return Number(e[3]);if(6===e.length)return Number(e[4])}return NaN},y.getEast=function(e){if(e){if(4===e.length)return Number(e[2]);if(6===e.length)return Number(e[3])}return NaN},y.intersect=function(e,t){var o=y.getCenter(e),r=y.getCenter(t),n=Math.abs(o[1]-r[1]),o=Math.abs(o[0]-r[0]),r=(180<o&&(o=360-o),y.getHeight(e)),e=y.getWidth(e),i=y.getHeight(t),t=y.getWidth(t);return n<=r/2+i/2&&o<=e/2+t/2},y.merge=function(e,t){var o=e&&4===e.length,r=t&&4===t.length;if(o&&!r)return e;if(r&&!o)return t;if(!o&&!r)return null;for(var o=Math.max(Wu(y.getNorth(e)),Wu(y.getNorth(t))),r=Math.min(Wu(y.getSouth(e)),Wu(y.getSouth(t))),n=[e,t],i=[],a=0,a=0;a<n.length;a++){var s=n[a],c=Zu(y.getWest(s)),u=Zu(y.getEast(s));y.crossesAntimeridian(s)?(i.push([c,180]),i.push([-180,u])):i.push([c,u])}i.sort(function(e,t){return e[0]===t[0]?e[1]-t[1]:e[0]-t[0]});var l=[],h=i[0];for(a=1;a<i.length;){var d=i[a];h[1]>=d[0]?h[1]=Math.max(h[1],d[1]):(l.push(h),h=d),a++}l.push(h);var p=l.length,f=l[0][0]+360-l[p-1][1],g=[l[p-1][1],l[0][0]];for(a=1;a<p;a++){var m=l[a][0]-l[a-1][1];f<m&&(f=m,g=[l[a-1][1],l[a][0]])}return new y([g[1],r],[g[0],o])},y.fromPositions=function(e){for(var t,o,r=NaN,n=NaN,i=NaN,a=NaN,s=e.length,c=new Array(s),u=0;s--;)(o=e[s])&&2<=o.length&&(t=Wu(o[1]),r=isNaN(r)?t:Math.max(r,t),n=isNaN(n)?t:Math.min(n,t),c[u++]=Zu(o[0]));if(u){c.length=u,c.sort(function(e,t){return e-t});for(var l=c[0]+360-c[u-1],h=0,s=1;s<u;s++){var d=c[s]-c[s-1];l<d&&(l=d,h=s)}i=c[h],a=c[(h||u)-1]}return isNaN(i)||isNaN(n)||isNaN(a)||isNaN(r)?null:new y([i,n,a,r])},y.fromLatLngs=function(e){return y.fromPositions(dl.fromLatLngs(e))},y.fromData=function(e){var t,o,r=null;if(Array.isArray(e)&&0<e.length){try{for(var n=El(e),i=n.next();!i.done;i=n.next()){var a,s=i.value;null!=(a=y.fromData(s))&&(r=null===r?a:y.merge(r,a))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return r}if(e instanceof _l)return e.getBounds();if(e&&e.type){var c=e;if(c.bbox&&4===c.bbox.length)return c.bbox;switch(c.type){case"FeatureCollection":return y.fromData(c.features);case"Feature":return _l._isCircle(c)?y.fromPositions(_l._getCirclePositions(c)):y.fromData(c.geometry);case"GeometryCollection":return y.fromData(c.geometries);case"Point":var u=c.coordinates;if(u&&2<=u.length)return[u[0],u[1],u[0],u[1]];break;case"LineString":case"MultiPoint":return y.fromPositions(c.coordinates);case"Polygon":case"MultiLineString":var l=c.coordinates;if(l&&0<l.length){for(var h=0,d=l.length;h<d;h++)null!=(a=y.fromPositions(l[h]))&&(r=null===r?a:y.merge(r,a));if(null!=r)return r}break;case"MultiPolygon":var p=c.coordinates;if(p&&0<p.length){for(h=0,d=p.length;h<d;h++)for(var f=0,g=p[h].length;f<g;f++)null!=(a=y.fromPositions(p[h][f]))&&(r=null===r?a:y.merge(r,a));return r}}}return null},y.splitOnAntimeridian=function(e){var t,o,r,n,i,a,s=[];return y.isBoundingBoxWithSixOrMoreElementsLargerThanGlobe(e)?[[-180,e[1],e[2],180,e[4],e[5]]]:y.isBoundingBoxWithLessThanSixElementsLargerThanGlobe(e)?[[-180,e[1],180,e[3]]]:(y.crossesAntimeridian(e)?(a=t=void 0,o=Zu(y.getWest(e)),r=Zu(y.getEast(e)),n=Wu(y.getNorth(e)),i=Wu(y.getSouth(e)),a=6<=e.length?(t=[o,i,e[2],180,n,e[5]],[-180,i,e[2],r,n,e[5]]):(t=[o,i,180,n],[-180,i,r,n]),s.push(t,a)):s.push(e),s)},y.isBoundingBoxWithSixOrMoreElementsLargerThanGlobe=function(e){return 6<=e.length&&360<e[3]-e[0]},y.isBoundingBoxWithLessThanSixElementsLargerThanGlobe=function(e){return e.length<6&&360<e[2]-e[0]},y);function y(e,t){var o,r=this;return e&&t?r=(o=e)[2]&&t[2]?Cl.call(this,o[0],o[1],o[2]||0,t[0],t[1],t[2]||0)||this:Cl.call(this,o[0],o[1],t[0],t[1])||this:e&&(o=e)&&(4===o.length?r=Cl.call(this,o[0],o[1],o[2],o[3])||this:6<=o.length&&(r=Cl.call(this,o[0],o[1],o[2],o[3],o[4],o[5])||this)),r}Tl.TYPE="FeatureCollection";var Sl=Tl;function Tl(e,t){this.type="FeatureCollection",this.type=Tl.TYPE,this.features=e,this.bbox=t}Il.TYPE="GeometryCollection";Uo=Il;function Il(e){this.type="GeometryCollection",this.type=Il.TYPE,this.geometries=e}kl.TYPE="LineString";e=kl;function kl(e,t){this.type="LineString",this.type=kl.TYPE,this.coordinates=e,this.bbox=t}Al.TYPE="MultiLineString";r=Al;function Al(e,t){this.type="MultiLineString",this.type=Al.TYPE,this.coordinates=e,this.bbox=t}Pl.TYPE="MultiPoint";hi=Pl;function Pl(e,t){this.type="MultiPoint",this.type=Pl.TYPE,this.coordinates=e,this.bbox=t}Ol.TYPE="MultiPolygon";i=Ol;function Ol(e,t){this.type="MultiPolygon",this.type=Ol.TYPE,this.coordinates=e,this.bbox=t}var Rl,xl,un=window&&window.__extends||(Rl=function(e,t){return(Rl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Rl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),cn=(xl=Array,un(Ml,xl),Ml.fromPosition=function(e){return 2<=e.length?new Ml((180+e[0])/360,Ml._latToMercatorY(e[1]),3<=e.length?Ml._altitudeToMercatorZ(e[2],e[1]):0):[0,0,0]},Ml.fromPositions=function(e){for(var t=[],o=0,r=e.length;o<r;o++)t.push(this.fromPosition(e[o]));return t},Ml.toFloat32Array=function(e){for(var t=new Float32Array(3*e.length),o=0,r=e.length;o<r;o++){var n=3*o,i=e[o];t[n]=(180+i[0])/360,t[1+n]=Ml._latToMercatorY(i[1]),t[2+n]=3<=i.length?Ml._altitudeToMercatorZ(i[2],i[1]):0}return t},Ml.toPosition=function(e){var t;return 2<=e.length?(t=360/Math.PI*Math.atan(Math.exp((180-360*e[1])*Math.PI/180))-90,new dl(360*e[0]-180,t,3<=e.length?Ml._mercatorZToAltitude(e[2],e[1]):0)):[0,0,0]},Ml.toPositions=function(e){for(var t=[],o=0,r=e.length;o<r;o++)t.push(this.toPosition(e[o]));return t},Ml.mercatorScale=function(e){return 1/Math.cos(e*Math.PI/180)},Ml.meterInMercatorUnits=function(e){return 1/Ml.earthCircumference*Ml.mercatorScale(Ml._latToMercatorY(e))},Ml._circumferenceAtLatitude=function(e){return Ml.earthCircumference*Math.cos(e*Math.PI/180)},Ml._altitudeToMercatorZ=function(e,t){return e/Ml._circumferenceAtLatitude(t)},Ml._mercatorZToAltitude=function(e,t){return e*Ml._circumferenceAtLatitude(Ml._latToMercatorY(t))},Ml._latToMercatorY=function(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360},Ml.earthCircumference=2*Math.PI*qu(),Ml);function Ml(e,t,o){return xl.call(this,e,t,o||0)||this}var ii=Object.freeze({__proto__:null,BoundingBox:f,Feature:eu,FeatureCollection:Sl,GeometryCollection:Uo,LineString:e,MercatorPoint:cn,MultiLineString:r,MultiPoint:hi,MultiPolygon:i,Point:au,Polygon:fl,Position:dl});function Nl(e,t){return e*e+t*t}function Ll(e,t){for(var o,r,n,i=e[0],a=[i],s=1,c=e.length;s<c;s++)o=e[s],n=i,Nl((r=o)[0]-n[0],r[1]-n[1])>t&&(a.push(o),i=o);return i!==o&&a.push(o),a}function Dl(e,t,o,r,n){for(var i,a,s,c,u,l,h,d=r,p=t+1;p<o;p++){a=e[p],s=e[t],f=e[o],h=l=u=c=void 0,u=s[0],s=s[1],l=f[0]-u,h=f[1]-s,0==l&&0==h||(1<(c=((a[0]-u)*l+(a[1]-s)*h)/Nl(l,h))?(u=f[0],s=f[1]):0<c&&(u+=l*c,s+=h*c));var f=Nl(a[0]-u,a[1]-s);d<f&&(i=p,d=f)}r<d&&(1<i-t&&Dl(e,t,i,r,n),n.push(e[i]),1<o-i)&&Dl(e,i,o,r,n)}var ql=function(e,t,o){var r,n;return void 0===t&&(t=1),void 0===o&&(o=!1),e.length<=2||(t=t*t,e=o?e:Ll(e,t),r=(o=e).length-1,n=[o[0]],Dl(o,0,r,t,n),n.push(o[r]),e=n),e};var Ul=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},jl=(Hl.prototype.toTarget=function(e,t){return this.transformArray(e,this.M,t)},Hl.prototype.toSource=function(e,t){return this.transformArray(e,this.inverseM,t)},Hl.prototype.transformArray=function(e,t,o){var r,n;if(e&&Array.isArray(e)&&Array.isArray(e[0])){var i=[];try{for(var a=Ul(e),s=a.next();!s.done;s=a.next()){var c=s.value;i.push(this.transform(c,t,o))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}return null},Hl.prototype.transform=function(e,t,o){var r=e[0]*t[0][3]+e[1]*t[1][3]+t[2][3],e=e[0]*t[0][4]+e[1]*t[1][4]+t[2][4];return"number"==typeof o&&0<=o?[Mu(r,o),Mu(e,o)]:[Mu(r,6),Mu(e,6)]},Hl._calculateAffineTransform=function(e,t){if(e.length!==t.length||e.length<1)throw new Error("Error: source and target arrays must have the same length.");var o=Math.min(e[0].length,t[0].length),r=o+1;if(e.length<o)throw new Error("Erorr: At least "+o+" reference points required.");for(var n=[],i=[],a=0;a<r;a++){i[a]=[];for(var s=0;s<r;s++){s<o&&(n[s]=0);for(var c=i[a][s]=0;c<e.length;c++)s<o&&(n[s]+=a<o?e[c][a]*t[c][s]:t[c][s]),i[a][s]+=o<=a&&o<=s?1:o<=a?e[c][s]:o<=s?e[c][a]:e[c][a]*e[c][s]}i[a]=i[a].concat(n)}if(this._gaussJordanElimination(i))return i;throw new Error("Error: Singular matrix. Points are likely coplanar.")},Hl._gaussJordanElimination=function(e){for(var t,o=e.length,r=2*o-1,n=0;n<o;n++){for(var i=n,a=n+1;a<o;a++)Math.abs(e[a][n])>Math.abs(e[i][n])&&(i=a);if(t=e[i],e[i]=e[n],e[n]=t,Math.abs(e[n][n])<=1e-12)return!1;for(var s=n+1;s<o;s++)for(var c=e[s][n]/e[n][n],u=n;u<r;u++)e[s][u]-=e[n][u]*c}for(n=o-1;-1<n;n--){c=e[n][n];for(a=0;a<n;a++)for(var l=r-1;n-1<l;l--)e[a][l]-=e[n][l]*e[a][n]/c;e[n][n]/=c;for(var h=o;h<r;h++)e[n][h]/=c}return!0},Hl);function Hl(e,t){this.M=Hl._calculateAffineTransform(e,t),this.inverseM=Hl._calculateAffineTransform(t,e)}var Bl,Fl,nn=Object.freeze({__proto__:null,get AccelerationUnits(){return du},AffineTransform:jl,get AreaUnits(){return cu},get DistanceUnits(){return uu},get SpeedUnits(){return hu},get TimeUnits(){return lu},WEBMERCATOR_MAXLAT:_u,_precision:Mu,boundingBoxToPolygon:function(e){var t=Zu(f.getWest(e)),o=Zu(f.getEast(e)),r=Wu(f.getNorth(e)),n=Wu(f.getSouth(e)),e=f.getCenter(e),n=[[t,r],[t,n],[e[0],n],[o,n],[o,r],[e[0],r],[t,r]];return new fl([n])},convertAcceleration:Xu,convertArea:$u,convertDistance:Nu,convertSpeed:el,convertTimespan:tl,getAcceleration:ol,getAccelerationFromFeatures:function(e,t,o,r,n,i,a){if("string"==typeof o&&"Feature"===e.type&&"Point"===e.geometry.type&&"Feature"===t.type&&"Point"===t.geometry.type){o=nl(e.properties[o],t.properties[o],lu.seconds);if(!isNaN(o)){var s=0;if(r&&"string"==typeof r){var c=e.properties[r],r=t.properties[r];if("number"==typeof c&&(s=c,"number"==typeof r))return rl(c,r,o,n,lu.seconds,i,a)}return ol(s,Du(e.geometry.coordinates,t.geometry.coordinates,uu.meters),o,n,uu.meters,lu.seconds,i,a)}}return NaN},getAccelerationFromSpeeds:rl,getArea:function e(t,o,r){if(t){var n=0;switch((t=t instanceof _l?t.toJson():t).type){case"Feature":var i=t;if(i.geometry)return e(i.geometry,o,r);break;case"Polygon":(i=t).coordinates&&(n=Pu(i.coordinates));break;case"MultiPolygon":var a=t;if(a.coordinates)for(var s=0,c=a.coordinates.length;s<c;s++)n+=Pu(a.coordinates[s])}return $u(n,cu.squareMeters,o,r)}return 0},getCardinalSpline:function(e,t,o,r){if(!e||e.length<=2)return c;"number"!=typeof t&&(t=.5),("number"!=typeof o||o<=0)&&(o=15);var n,i,a,s=e.length,c=e.slice(0),u=(r?(dl.areEqual(c[0],c[s-1])&&(c.pop(),s--),c.unshift(e[s-1]),c.push(e[0]),c.push(e[1]),s++):(c.unshift(e[0]),c.push(e[s-1])),[]);u.push([1,0,0,0]);for(var l=1;l<o-1;l++)u.push([2*(a=(n=l/o)*(i=n*n))-3*i+1,-2*a+3*i,a-2*i+n,a-i]);u.push([0,1,0,0]);for(var h,d,p,f,g,m,y=[],l=1;l<s;l++)for(h=t*(c[l+1][0]-c[l-1][0]),d=t*(c[l+1][1]-c[l-1][1]),p=t*(c[l+2][0]-c[l][0]),f=t*(c[l+2][1]-c[l][1]),n=0;n<o;n++)m=(g=u[n])[0]*c[l][0]+g[1]*c[l+1][0]+g[2]*h+g[3]*p,g=Cu(g[0]*c[l][1]+g[1]*c[l+1][1]+g[2]*d+g[3]*f,-85,85),y.push([m,g]);return y},getClosestPointOnGeometry:ul,getConvexHull:function(e){var t,o,r=al(e).map(function(e){return[Zu(e[0]),Wu(e[1])]}),n=(r.sort(function(e,t){return e[0]===t[0]?e[1]-t[1]:e[0]-t[0]}),[]);try{for(var i=fu(r),a=i.next();!a.done;a=i.next()){for(var s=a.value;2<=n.length&&Ru(n[n.length-2],n[n.length-1],s)<=0;)n.pop();n.push(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(t)throw t.error}}for(var c=[],u=r.length-1;0<=u;u--){for(;2<=c.length&&Ru(c[c.length-2],c[c.length-1],r[u])<=0;)c.pop();c.push(r[u])}return new fl([n.concat(c)])},getDestination:Lu,getDistanceTo:Du,getEarthRadius:qu,getGeodesicPath:function(e,t){(!t||t<=0)&&(t=15),Array.isArray(e)?o=e:e.type&&"LineString"===e.type&&(o=e.coordinates);for(var o,r=o.length-1,n=[],i=0;i<r;i++)n=n.concat(Uu(o[i],o[i+1],t));return ju(n)},getGeodesicPaths:function(e,t){(!t||t<=0)&&(t=15),Array.isArray(e)?o=e:e.type&&"LineString"===e.type&&(o=e.coordinates);for(var o,r=o.length-1,n=[],i=[],a=0;a<r;a++)for(var s,c,u,l,h,d=Uu(o[a],o[a+1],t),p=0;p<d.length;p++)n.push(d[p]),p+1>=d.length||(s=(c=pu(d[p],2))[0],c=c[1],l=(h=pu(d[p+1],2))[0],h=h[1],180<Math.abs(l-s)&&(u=0<s?180:-180,l=Math.abs((0<s?l+360:l-360)-s),h=c+(h-c)*(Math.abs(u-s)/l),n.push([u,h]),i.push(n),n=[[-u,h]]));return i.push(n),i},getHeading:Bu,getLengthOfPath:Fu,getPathDenormalizedAtAntimerian:ju,getPathSplitByAntimeridian:Hu,getPixelHeading:function(e,t){e=sl(e),t=sl(t);var t=(e=pu(Ju([e,t],21),2))[0],o=(e=e[1])[0]-t[0],t=t[1]-e[1];return(2.5*Math.PI-Math.atan2(t,o))*yu%360},getPointWithHeadingAlongPath:cl,getPointsWithHeadingsAlongPath:function(e,t){if(t<=0)return[];for(var o=[],r=Fu(e,uu.meters)/(t-1),n=0;n<t;n++){var i=cl(e,r*n,uu.meters);null!=i&&o.push(i)}return o},getPosition:sl,getPositionAlongPath:zu,getPositions:al,getPositionsAlongPath:function(e,t){if(t<2)return[];for(var o=[],r=Fu(e,uu.meters)/(t-1),n=0;n<t;n++){var i=zu(e,r*n,uu.meters);null!=i&&o.push(i)}return o},getRegularPolygonPath:Gu,getRegularPolygonPaths:function(e,t,o,r,n){return Hu(Ku(e,t,o,r,n))},getSpeed:function(e,t,o,r,n,i){return e=sl(e),t=sl(t),e&&t?(o=tl(o,r,lu.seconds),el(Du(e,t,uu.meters)/o,hu.metersPerSecond,n,i)):0},getSpeedFromFeatures:function(e,t,o,r,n){if("string"==typeof o&&"Feature"===e.type&&"Point"===e.geometry.type&&"Feature"===t.type&&"Point"===t.geometry.type){o=nl(e.properties[o],t.properties[o],lu.seconds);if(!isNaN(o))return el(Du(e.geometry.coordinates,t.geometry.coordinates,uu.meters)/o,hu.metersPerSecond,r,n)}return NaN},getTimespan:nl,getTravelDistance:function(e,t,o,r,n,i,a,s){return t=tl(t,n,lu.seconds),n=(o=el(o,i,hu.metersPerSecond))*t,"number"==typeof r&&(n+=.5*Xu(r,a,du.metersPerSecondSquared)*t*t),Nu(n,uu.meters,e,s)},interpolate:Yu,mercatorPixelsToPositions:Vu,mercatorPositionsToPixels:Ju,normalizeLatitude:Wu,normalizeLongitude:Zu,parseTimestamp:il,rotatePositions:Qu,simplify:function(e,t){return ql(e,t,!0)}}),zl=((window&&window.__extends||(Bl=function(e,t){return(Bl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Bl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Kl,Fl=ye),Kl);function Kl(){var e=null!==Fl&&Fl.apply(this,arguments)||this;return e.zoomDelta=1,e.style=l.ControlStyle.light,e}(window&&window.__extends||(Gl=function(e,t){return(Gl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Gl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Wl,Yl=$t),Wl.prototype.onAdd=function(e){this.container=this.buildContainer(e,this.options.style,"Zoom Control"),this.container.style.flexDirection="column",this.zoomInButton=this.constructZoomInButton(e),this.zoomOutButton=this.constructZoomOutButton(e);var t=jt("Zoom In"),o=jt("Zoom Out");return this.container.appendChild(this.zoomInButton),this.container.appendChild(t),this.container.appendChild(this.zoomOutButton),this.container.appendChild(o),Ht(t,this.zoomInButton),Ht(o,this.zoomOutButton),e.events.add("zoom",this.zoomChanged),e.events.add("minzoomchanged",this.minZoomChanged),e.events.add("maxzoomchanged",this.maxZoomChanged),this.map=e,this.container},Wl.prototype.onRemove=function(){Yl.prototype.onRemove.call(this),this.map&&(this.map.events.remove("zoom",this.zoomChanged),this.map.events.remove("minzoomchanged",this.minZoomChanged),this.map.events.remove("maxzoomchanged",this.maxZoomChanged),this.map=null),this.container&&(this.container.remove(),this.container=null,this.zoomInButton=null,this.zoomOutButton=null)},Wl.prototype.updateZoomButtonsState=function(){var e=this.map.getCamera().zoom>=this.map._getMap().getMaxZoom(),t=f.getSouth(this.map.getCamera().bounds)<=-_u&&f.getNorth(this.map.getCamera().bounds)>=_u,t=this.map.getCamera().zoom<=this.map._getMap().getMinZoom()||t;this.zoomInButton&&this.zoomInButton.disabled!=e&&(this.zoomInButton.disabled=e,this.zoomInButton.setAttribute("aria-label",e?"Zoom In disabled":"Zoom In")),this.zoomOutButton&&this.zoomOutButton.disabled!=t&&(this.zoomOutButton.disabled=t,this.zoomOutButton.setAttribute("aria-label",e?"Zoom Out disabled":"Zoom Out"))},Wl.prototype.constructZoomInButton=function(t){var o=this,e=document.createElement("button");return e.classList.add("azure-maps-control-button"),e.classList.add("zoom-in"),e.setAttribute("aria-label","Zoom In"),e.setAttribute("alt","Zoom In"),e.setAttribute("type","button"),e.addEventListener("click",function(){var e;t.setCamera({maxBounds:null==(e=t._getMap().getMaxBounds())?void 0:e.toArray().flat(),zoom:t.getCamera().zoom+o.options.zoomDelta,duration:Wl.ZOOM_DURATION_MS,type:"ease"},!0)}),e},Wl.prototype.constructZoomOutButton=function(t){var o=this,e=document.createElement("button");return e.classList.add("azure-maps-control-button"),e.classList.add("zoom-out"),e.setAttribute("aria-label","Zoom Out"),e.setAttribute("alt","Zoom Out"),e.setAttribute("type","button"),e.addEventListener("click",function(){var e;t.setCamera({maxBounds:null==(e=t._getMap().getMaxBounds())?void 0:e.toArray().flat(),zoom:t.getCamera().zoom-o.options.zoomDelta,duration:Wl.ZOOM_DURATION_MS,type:"ease"},!0)}),e},Wl.ZOOM_DURATION_MS=200;var Gl,Yl,Ni=Wl;function Wl(e){var t=Yl.call(this)||this;return t.container=null,t.zoomInButton=null,t.zoomOutButton=null,t.zoomChanged=function(e){return t.updateZoomButtonsState()},t.minZoomChanged=function(e){return t.updateZoomButtonsState()},t.maxZoomChanged=function(e){return t.updateZoomButtonsState()},t.options=(new zl).merge(e),t}var Hr=Object.freeze({__proto__:null,CompassControl:so,ControlBase:$t,PitchControl:t,ScaleControl:be,StyleControl:Mi,TrafficControl:yc,TrafficLegendControl:o,ZoomControl:Ni}),Zl=Wa;var Ql=q(function(e,t){return Zl(e,5,t="function"==typeof t?t:void 0)}),Vl=(Jl.Css={hidden:"hidden-accessible-element"},Jl);function Jl(e){var t=this;this.attach=function(e){t.map!==e&&(t.map&&t.detachFromCurrentMap(),t.map=e,t.map.indicators._getCollectionDiv().appendChild(t.element),t.map.indicators.add(t))},this.remove=function(){t.detachFromCurrentMap(),t.element.remove()},this.getElement=function(){return t.element},this.detachFromCurrentMap=function(){t.map&&(t.map.indicators.remove(t),delete t.map)},this.element=document.createElement("div"),this.element.setAttribute("tabindex","0"),this.element.setAttribute("role","option"),null!=e&&e.setSize&&this.element.setAttribute("aria-setsize",e.setSize.toString()),null!=e&&e.positionInSet&&this.element.setAttribute("aria-posinset",e.positionInSet.toString()),this.element.setAttribute("aria-label","data point"),this.element.classList.add(Jl.Css.hidden)}(window&&window.__extends||(Xl=function(e,t){return(Xl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Xl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(th,$l=ye);var Xl,$l,eh=th;function th(){var e=null!==$l&&$l.apply(this,arguments)||this;return e.buffer=128,e.maxZoom=18,e.cluster=!1,e.clusterRadius=50,e.clusterMaxZoom=void 0,e.clusterProperties=void 0,e.lineMetrics=!1,e.tolerance=.375,e.clusterMinPoints=2,e.generateId=!1,e.promoteId=void 0,e.filter=void 0,e}(window&&window.__extends||(oh=function(e,t){return(oh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}oh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(ih,rh=Qt),ih.prototype.getId=function(){return this.id},ih.prototype._setMap=function(e,t){var o;void 0===t&&(t=!0),null==e||void 0===e?(o=this.map,delete this.map,t&&(this._invokeEvent("sourceremoved",this),o)&&o.events.invoke("sourceremoved",this)):(this.map=e,t&&(this._invokeEvent("sourceadded",this),this.map.events.invoke("sourceadded",this)))};var oh,rh,nh=ih;function ih(e){var t=rh.call(this)||this;return t.id=e||W(),t}var ah,sh,n=window&&window.__extends||(ah=function(e,t){return(ah=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ah(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),ch=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},uh=(n(lh,sh=nh),lh.prototype.add=function(e,t){this._addNoUpdate(e,t),this._updateSource()},lh.prototype.clear=function(){this._clearNoUpdate(),this._updateSource()},lh.prototype.dispose=function(){this.options=null,this.shapes=null,this.shapesMap=null,this.map=null},lh.prototype.getClusterExpansionZoom=function(r){var n=this;return new Promise(function(t,o){var e;n.map?(e=n.map._getMap().getSource(n.getId()))&&"geojson"===e.type&&e.getClusterExpansionZoom(r).then(function(e){"number"==typeof e&&t(e)}).catch(function(e){e&&o(e)}):o("The DataSource hasn't been added to a map.")})},lh.prototype.getClusterChildren=function(r){var n=this;return new Promise(function(t,o){var e;n.map?(e=n.map._getMap().getSource(n.getId()))&&"geojson"===e.type&&e.getClusterChildren(r).then(function(e){e&&t(n.map.sources._mapFeaturesToShapes(e,!1,n))}).catch(function(e){e&&o(e)}):o("The DataSource hasn't been added to a map.")})},lh.prototype.getClusterLeaves=function(r,n,i){var a=this;return new Promise(function(t,o){var e;a.map?(e=a.map._getMap().getSource(a.getId()))&&"geojson"===e.type&&e.getClusterLeaves(r,n,i).then(function(e){e&&t(a.map.sources._mapFeaturesToShapes(e,!1,a))}).catch(function(e){e&&o(e)}):o("The DataSource hasn't been added to a map.")})},lh.prototype.getOptions=function(){return Qa(this.options)},lh.prototype.getShapes=function(){return Array.from(this.shapes)},lh.prototype.importDataFromUrl=function(e){var t=this;return fetch(e,{method:"GET",mode:"cors"}).then(function(e){if(e.ok)return e.json();throw new Error("HTTP ".concat(e.status,": ").concat(e.statusText))}).then(function(e){t.add(e)})},lh.prototype.getShapeById=function(e){return this.shapes[this.shapesMap.get(e)]||null},lh.prototype.remove=function(e){var t,o,e=Array.isArray(e)?e:[e];try{for(var r=ch(e),n=r.next();!n.done;n=r.next()){var i=n.value;"number"==typeof i?this._removeByIndex(i):this._removeById(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}this._updateSource()},lh.prototype.removeById=function(e){var t,o,e=Array.isArray(e)?e:[e];try{for(var r=ch(e),n=r.next();!n.done;n=r.next()){var i=n.value;this._removeById(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}this._updateSource()},lh.prototype.setOptions=function(e){e=(new eh).merge(this.options,Qa(e));$c(this.options,e)||(this._invokeEvent("datasourceupdated",this),this.options=e,this.map&&this.map._rebuildStyle())},lh.prototype.setShapes=function(e){this._clearNoUpdate(),this.add(e)},lh.prototype.toJson=function(){return new Sl(this.shapes.map(function(e){return e.toJson()}))},lh.prototype._toJson=function(){return new Sl(this.shapes.map(function(e){return e._toJson()}))},lh.prototype._buildSource=function(){var e={type:"geojson",data:this._toJson(),maxzoom:this.options.maxZoom,cluster:this.options.cluster,clusterRadius:this.options.clusterRadius,tolerance:this.options.tolerance,lineMetrics:this.options.lineMetrics,clusterProperties:this.options.clusterProperties,buffer:this.options.buffer,clusterMinPoints:this.options.clusterMinPoints,generateId:this.options.generateId,promoteId:this.options.promoteId,filter:this.options.filter};return"number"==typeof this.options.clusterMaxZoom&&(e.clusterMaxZoom=this.options.clusterMaxZoom),e},lh.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this._buildSource(),e=e._buildSource(),t.type===e.type)&&t.maxzoom===e.maxzoom&&t.cluster===e.cluster&&t.clusterRadius===e.clusterRadius&&t.tolerance===e.tolerance&&t.lineMetrics===e.lineMetrics&&JSON.stringify(t.clusterProperties)===JSON.stringify(e.clusterProperties)&&t.buffer===e.buffer&&t.clusterMinPoints===e.clusterMinPoints&&t.generateId===e.generateId&&t.promoteId===e.promoteId&&t.filter===e.filter},lh.prototype._addNoUpdate=function(e,t){var o;e instanceof _l?(this._addToSources(e,t),o=[e]):Array.isArray(e)?(o=e.map(function(e){return e instanceof _l?e:new _l(e)}),this._addToSources(o,t)):"FeatureCollection"===e.type?(o=e.features.map(function(e){return new _l(e)}),this._addToSources(o,t)):"GeometryCollection"===e.type?(o=e.geometries.map(function(e){return new _l(e)}),this._addToSources(o,t)):(e=new _l(e),this._addToSources(e,t),o=[e]),this._invokeEvent("dataadded",o)},lh.prototype._clearNoUpdate=function(){var e=this.shapes;this.shapes=[],this.shapesMap=new Zt,e&&0<e.length&&this._invokeEvent("dataremoved",e)},lh.prototype._updateSource=function(){var e=this;void 0===this.requestId&&(this.requestId=requestAnimationFrame(function(){e._updateMboxSource(),e.requestId=void 0}))},lh.prototype._addToSources=function(e,t){var o,r,n,i;if(e=Array.isArray(e)?e:[e],"number"!=typeof t)try{for(var a=ch(e),s=a.next();!s.done;s=a.next()){var c=s.value;this.shapes.push(c),this.shapesMap.set(c.getId(),this.shapes.length-1)}}catch(e){o={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}else for(var u=e.length-1;0<=u;u--)this.shapes.splice(t,0,e[u]),this._updateShapesMap(t);try{for(var l=ch(e),h=l.next();!h.done;h=l.next())(c=h.value)._setDataSource(this)}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}},lh.prototype._removeById=function(e){var e=e instanceof _l?e.getId():"string"==typeof e||"number"==typeof e?e:e.id,t=this.shapes[this.shapesMap.get(e)];t&&(t._setDataSource(null),this.shapes.splice(this.shapesMap.get(e),1),this._updateShapesMap(this.shapesMap.get(e)),this.shapesMap.delete(e),this._invokeEvent("dataremoved",[t]))},lh.prototype._removeByIndex=function(e){var t;if(e>=this.shapes.length)throw new Error("The specified remove index '".concat(e,"' ")+"is greater than the maximum possible index '".concat(this.shapes.length-1,"'"));t=this.shapes[e],this.shapesMap.delete(t.getId()),t._setDataSource(null),this.shapes.splice(e,1),this._updateShapesMap(e),this._invokeEvent("dataremoved",[t])},lh.prototype._updateShapesMap=function(e){for(var t=e;t<this.shapes.length;t++)this.shapesMap.set(this.shapes[t].getId(),t)},lh.prototype._updateMboxSource=function(){var e;this.map&&this.map._getMap()&&(e=this.map._getMap().getSource(this.getId()))&&"geojson"===e.type&&e.setData(this._toJson())},lh);function lh(e,t){e=sh.call(this,e)||this;return e.requestId=void 0,e.options=(new eh).merge(Qa(t)),e.shapes=[],e.shapesMap=new Zt,e}(window&&window.__extends||(hh=function(e,t){return(hh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}hh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(fh,dh=ye);var hh,dh,ph=fh;function fh(){var e=null!==dh&&dh.apply(this,arguments)||this;return e.bounds=void 0,e.minZoom=0,e.maxZoom=22,e.isTMS=!1,e.tiles=void 0,e.url=void 0,e}(window&&window.__extends||(gh=function(e,t){return(gh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(vh,mh=nh),vh.prototype.getOptions=function(){return Qa(this.options)},vh.prototype.getShape=function(e,t){return this.map._getMap().querySourceFeatures(this.getId(),{sourceLayer:e,filter:t})},vh.prototype._buildSource=function(){var e={type:"vector"};return this.options.bounds&&(e.bounds=this.options.bounds),this.options.tiles?(e.tiles=this.options.tiles,e.minzoom=this.options.minZoom,e.maxzoom=this.options.maxZoom):this.options.url&&(e.url=this.options.url),this.options.isTMS&&(e.scheme="tms"),e},vh.prototype._isDeepEqual=function(e){var t,o;return this.constructor===e.constructor&&(t=this._buildSource(),o=e._buildSource(),t.type===o.type)&&t.url===o.url&&(void 0===t.tiles&&void 0===o.tiles||t.tiles&&o.tiles&&t.tiles.length===o.tiles.length&&t.tiles.every(function(e,t){return e===o.tiles[t]}))&&t.minzoom===o.minzoom&&t.maxzoom===o.maxzoom&&t.bounds===o.bounds&&t.attribution===o.attribution&&t.promoteId===o.promoteId&&t.scheme===o.scheme};var gh,mh,yh=vh;function vh(e,t){e=mh.call(this,e)||this;return e.options=(new ph).merge(Qa(t)),e}(window&&window.__extends||(_h=function(e,t){return(_h=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}_h(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ch,wh=nh),Ch.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this.source,e=e.source,t.type===e.type)&&t.canvas===e.canvas&&JSON.stringify(t.coordinates)===JSON.stringify(e.coordinates)&&t.animate===e.animate},Ch.prototype._buildSource=function(){return this.source};var _h,wh,bh=Ch;function Ch(e,t,o){e=wh.call(this,e)||this;return e.source=t,e}(window&&window.__extends||(Eh=function(e,t){return(Eh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Eh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ih,Sh=nh),Ih.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this.source,e=e.source,t.type===e.type)},Ih.prototype._buildSource=function(){return this.source};var Eh,Sh,Th=Ih;function Ih(e,t,o){e=Sh.call(this,e)||this;return e.source=t,e}(window&&window.__extends||(kh=function(e,t){return(kh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}kh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Oh,Ah=nh),Oh.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this.source,e=e.source,t.type===e.type)&&JSON.stringify(t.coordinates)===JSON.stringify(e.coordinates)&&t.url===e.url},Oh.prototype._buildSource=function(){return this.source};var kh,Ah,Ph=Oh;function Oh(e,t,o){e=Ah.call(this,e)||this;return e.source=t,e}(window&&window.__extends||(Rh=function(e,t){return(Rh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Rh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Nh,xh=nh),Nh.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this.source,e=e.source,t.type===e.type)&&JSON.stringify(t.coordinates)===JSON.stringify(e.coordinates)&&t.urls===e.urls},Nh.prototype._buildSource=function(){return this.source};var Rh,xh,Mh=Nh;function Nh(e,t,o){e=xh.call(this,e)||this;return e.source=t,e}(window&&window.__extends||(Lh=function(e,t){return(Lh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Lh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(qh,Dh=ph);var Lh,Dh,a=qh;function qh(){var e=null!==Dh&&Dh.apply(this,arguments)||this;return e.tileSize=512,e}(window&&window.__extends||(Uh=function(e,t){return(Uh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Uh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Bh,jh=a);var Uh,jh,Hh=Bh;function Bh(){var e=null!==jh&&jh.apply(this,arguments)||this;return e.encoding=void 0,e}var Fh,zh,bn=window&&window.__extends||(Fh=function(e,t){return(Fh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Fh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Kh=window&&window.__assign||function(){return(Kh=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},ir=(bn(Gh,zh=nh),Gh.prototype.getOptions=function(){return Qa(this.options)},Gh.prototype._buildSource=function(){return Kh({type:"raster-dem",bounds:this.options.bounds,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,tileSize:this.options.tileSize,encoding:this.options.encoding},this.options.tiles?{tiles:this.options.tiles}:{url:this.options.url})},Gh.prototype._isDeepEqual=function(e){return this.constructor===e.constructor&&(e=e.getOptions(),this.options.url===e.url)&&this.options.tiles===e.tiles&&this.options.bounds===e.bounds&&this.options.minZoom===e.minZoom&&this.options.maxZoom===e.maxZoom&&this.options.tileSize===e.tileSize&&this.options.encoding===e.encoding},Gh);function Gh(e,t){e=zh.call(this,e)||this;return e.options=(new Hh).merge(Qa(t)),e}var Yh,Wh,Cn=Object.freeze({__proto__:null,CanvasSource:bh,DataSource:uh,ElevationTileSource:ir,ImageSource:Ph,Source:nh,UnknownSource:Th,VectorTileSource:yh,VideoSource:Mh}),Zh=((window&&window.__extends||(Yh=function(e,t){return(Yh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Yh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Qh,Wh=Qt),Qh.prototype.getId=function(){return this.id},Qh.prototype.getMap=function(){return this.map||null},Qh.prototype.onAdd=function(e){this.map=e,this._invokeEvent("layeradded",this),this.map.events.invoke("layeradded",this)},Qh.prototype.onRemove=function(){var e=this.map;delete this.map,this._invokeEvent("layerremoved",this),e&&e.events.invoke("layerremoved",this)},Qh._isMBoxEvent=function(e){return!this.LayerEvents.hasOwnProperty(e)},Qh.prototype._updateBaseProperties=function(e,t){this._updateFilter(e.filter,t.filter),this._updateZoomRange(e.minZoom,t.minZoom,e.maxZoom,t.maxZoom),this._updateLayoutProperty("visibility",e.visible,t.visible,e.visible?"visible":"none")},Qh.prototype._updateFilter=function(e,t){$c(e,t)||this.map._getMap().setFilter(this.id,e)},Qh.prototype._updatePaintProperty=function(e,t,o,r){$c(t,o)||this.map._getMap().setPaintProperty(this.id,e,r||t)},Qh.prototype._updateLayoutProperty=function(e,t,o,r){$c(t,o)||this.map._getMap().setLayoutProperty(this.id,e,r||t)},Qh.prototype._updateZoomRange=function(e,t,o,r){e===t&&r===o||this.map._getMap().setLayerZoomRange(this.id,e,o)},Qh.LayerEvents={layeradded:void 0,layerremoved:void 0,focusin:void 0,focusout:void 0},Qh);function Qh(e){var t=Wh.call(this)||this;return t.id=e||W(),t}(window&&window.__extends||(Vh=function(e,t){return(Vh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Vh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Xh,Jh=ye),Xh._cloneCustomizer=function(e){if(e instanceof nh)return e};var Vh,Jh,un=Xh;function Xh(){var e=null!==Jh&&Jh.apply(this,arguments)||this;return e.filter=void 0,e.minZoom=0,e.maxZoom=24,e.visible=!0,e}(window&&window.__extends||($h=function(e,t){return($h=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}$h(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(od,ed=un);var $h,ed,td=od;function od(){var e=null!==ed&&ed.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.color="#1A73AA",e.blur=0,e.opacity=1,e.strokeColor="#FFFFFF",e.strokeOpacity=1,e.strokeWidth=2,e.pitchAlignment="viewport",e.radius=8,e.createIndicators=!1,e.accessibilityIdKey=void 0,e}var rd,nd,Uo=window&&window.__extends||(rd=function(e,t){return(rd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}rd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),id=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},ad=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},sd=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},cd=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},ud=(Uo(ld,nd=Zh),ld.prototype.getOptions=function(){return Ql(this.options,td._cloneCustomizer)},ld.prototype.getSource=function(){return this.options.source},ld.prototype.setOptions=function(e){e=(new td).merge(this.options,Ql(e,td._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("circle-blur",e.blur,this.options.blur),this._updatePaintProperty("circle-color",e.color,this.options.color),this._updatePaintProperty("circle-opacity",e.opacity,this.options.opacity),this._updatePaintProperty("circle-radius",e.radius,this.options.radius),this._updatePaintProperty("circle-stroke-color",e.strokeColor,this.options.strokeColor),this._updatePaintProperty("circle-stroke-opacity",e.strokeOpacity,this.options.strokeOpacity),this._updatePaintProperty("circle-stroke-width",e.strokeWidth,this.options.strokeWidth),this._updatePaintProperty("circle-pitch-alignment",e.pitchAlignment,this.options.pitchAlignment)}this.options=e},ld.prototype.onAdd=function(t){var e,o,r=this;nd.prototype.onAdd.call(this,t),this.options.createIndicators&&(t.events.addOnce("idle",this._setAccessibleIndicator),t.events.add("moveend",this._setAccessibleIndicator),(e=this._getDataSource())?t.events.add("dataadded",e,function(){t.events.addOnce("idle",r._setAccessibleIndicator)}):(o="string"==typeof this.options.source?this.options.source:this.options.source.getId(),t.events.add("sourcedata",function(e){(null==(e=e.source)?void 0:e.getId())===o&&t._getMap().isSourceLoaded(o)&&(e=r._getSourceDataEventCacheKey())!==r.sourceDataEventCacheKey&&(r._setAccessibleIndicator(),r.sourceDataEventCacheKey=e)})))},ld.prototype.onRemove=function(){var e;this.options.createIndicators&&(this.map.events.remove("idle",this._setAccessibleIndicator),this.map.events.remove("moveend",this._setAccessibleIndicator),(e=this._getDataSource())?this.map.events.remove("dataadded",e,this._setAccessibleIndicator):this.map.events.remove("sourcedata",this._setAccessibleIndicator)),nd.prototype.onRemove.call(this)},ld.prototype._getSourceDataEventCacheKey=function(){var e;if(this.map)return e=this.map.getServiceOptions().mapConfiguration,cd(cd([],sd(this.map.getCamera().bounds),!1),[this.map.getCamera().zoom,this.map.getCamera().pitch,this.map.getStyle().style,e instanceof Object?e.id:e],!1).join(",")},ld.prototype._getDataSource=function(){var e="string"==typeof this.options.source?this.map.sources.getById(this.options.source):this.options.source;if(e instanceof uh)return e},ld.prototype._buildLayers=function(){var e={id:this.id,type:"circle",source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"circle-color":this.options.color,"circle-blur":this.options.blur,"circle-opacity":this.options.opacity,"circle-stroke-color":this.options.strokeColor,"circle-stroke-opacity":this.options.strokeOpacity,"circle-stroke-width":this.options.strokeWidth,"circle-pitch-alignment":this.options.pitchAlignment,"circle-radius":this.options.radius},minzoom:this.options.minZoom,maxzoom:this.options.maxZoom};return this.options.filter&&(e.filter=this.options.filter),this.options.sourceLayer&&(e["source-layer"]=this.options.sourceLayer),[e]},ld.prototype._getLayerIds=function(){return[this.id]},ld.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e},ld.prototype.getFirstCoordinate=function(e){return Array.isArray(e[0])?this.getFirstCoordinate(e[0]):e},ld);function ld(e,t,o){var r=nd.call(this,t)||this;return r.accessibleIndicator=[],r._setAccessibleIndicator=function(){return id(r,void 0,void 0,function(){var t,c,u,l,h,d,p=this;return ad(this,function(e){return this.accessibleIndicator.forEach(function(e){return e.remove()}),this.accessibleIndicator=[],t=this.map.layers.getRenderedShapes(this.map.getCamera().bounds,this),c=this.options.accessibilityIdKey||(this._getDataSource()?_l._shapeIdPropName:void 0),u=function(t,o){var r=t[o],n=r instanceof _l?r.toJson():r,i=new Vl({positionInSet:o+1,setSize:t.length}),a=i.getElement(),s=sd(p.map.positionsToPixels([p.getFirstCoordinate(n.geometry.coordinates)]),1)[0];return a.addEventListener("focusin",function(e){p.accessibleIndicator.filter(function(e){return e!==i}).forEach(function(e){return e.remove()}),0<=o-1&&l(i,u(t,o-1)),o+1<t.length&&d(u(t,o+1)),2<=o&&o==t.length-1&&h(u(t,0)),0==o&&2<=t.length&&d(u(t,t.length-1)),void 0!==c&&p.map._getMap().setPaintProperty(p.id,"circle-stroke-color",["case",["==",["get",c],n.properties[c]],"#000000",p.options.strokeColor]);e={target:a,type:"focusin",map:p.map,shape:r,originalEvent:e,pixel:s};p._invokeEvent("focusin",e)}),a.addEventListener("focusout",function(e){void 0!==c&&p.map._getMap().setPaintProperty(p.id,"circle-stroke-color",["case",["==",["get",c],n.properties[c]],p.options.strokeColor,p.options.strokeColor]);e={target:a,type:"focusout",map:p.map,shape:r,originalEvent:e,pixel:s};p._invokeEvent("focusout",e)}),p.accessibleIndicator.push(i),i},l=function(e,t){t.attach(p.map);t=t.getElement(),e=e.getElement();e.parentElement.insertBefore(t,e)},h=function(e){e.attach(p.map);var e=e.getElement(),t=e.parentElement;t.insertBefore(e,t.firstElementChild)},d=function(e){e.attach(p.map)},0<t.length&&d(u(t,0)),1<t.length&&d(u(t,t.length-1)),[2]})})},r.options=(new td).merge(Ql(o,td._cloneCustomizer)),r.options.source=e||r.options.source,r}(window&&window.__extends||(hd=function(e,t){return(hd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}hd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(fd,dd=un),fd._cloneCustomizer=function(e){if(e instanceof nh)return e};var hd,dd,pd=fd;function fd(){var e=null!==dd&&dd.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.color=["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0, 255,0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],e.intensity=1,e.opacity=1,e.radius=30,e.weight=1,e}(window&&window.__extends||(gd=function(e,t){return(gd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(yd,md=Zh),yd.prototype.getOptions=function(){return Ql(this.options,pd._cloneCustomizer)},yd.prototype.getSource=function(){return this.options.source},yd.prototype.setOptions=function(e){e=(new pd).merge(this.options,Ql(e,pd._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("heatmap-color",e.color,this.options.color),this._updatePaintProperty("heatmap-intensity",e.intensity,this.options.intensity),this._updatePaintProperty("heatmap-opacity",e.opacity,this.options.opacity),this._updatePaintProperty("heatmap-radius",e.radius,this.options.radius),this._updatePaintProperty("heatmap-weight",e.weight,this.options.weight)}this.options=e},yd.prototype._buildLayers=function(){var e={id:this.id,type:"heatmap",source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"heatmap-color":this.options.color,"heatmap-intensity":this.options.intensity,"heatmap-opacity":this.options.opacity,"heatmap-radius":this.options.radius,"heatmap-weight":this.options.weight},minzoom:this.options.minZoom,maxzoom:this.options.maxZoom};return this.options.filter&&(e.filter=this.options.filter),this.options.sourceLayer&&(e["source-layer"]=this.options.sourceLayer),[e]},yd.prototype._getLayerIds=function(){return[this.id]},yd.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e};var gd,md,e=yd;function yd(e,t,o){t=md.call(this,t)||this;return t.options=(new pd).merge(Ql(o,pd._cloneCustomizer)),t.options.source=e||t.options.source,t}(window&&window.__extends||(vd=function(e,t){return(vd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}vd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(wd,_d=un);var vd,_d,cn=wd;function wd(){var e=null!==_d&&_d.apply(this,arguments)||this;return e.contrast=0,e.fadeDuration=300,e.hueRotation=0,e.maxBrightness=1,e.minBrightness=0,e.opacity=1,e.saturation=0,e}(window&&window.__extends||(bd=function(e,t){return(bd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}bd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Sd,Cd=cn),Sd._cloneCustomizer=function(e){if(e instanceof nh)return e};var bd,Cd,Ed=Sd;function Sd(){var e=null!==Cd&&Cd.apply(this,arguments)||this;return e.url=void 0,e.coordinates=void 0,e}(window&&window.__extends||(Td=function(e,t){return(Td=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Td(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ad,Id=Zh),Ad.prototype._getSourceIds=function(){var e=new Set;return e.add(this._getSourceId()),e},Ad.prototype.onAdd=function(e){Id.prototype.onAdd.call(this,e)};var Td,Id,kd=Ad;function Ad(){return null!==Id&&Id.apply(this,arguments)||this}(window&&window.__extends||(Pd=function(e,t){return(Pd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Pd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Rd,Od=kd),Rd.prototype.getOptions=function(){return Ql(this.options,Ed._cloneCustomizer)},Rd.prototype.setOptions=function(e){var t,o=(new Ed).merge(this.options,Ql(e,Ed._cloneCustomizer)),r="string"==typeof e.url&&e.url!==this.getOptions().url,e=void 0!==e.coordinates&&e.coordinates!==this.getOptions().coordinates;this.map&&(this._updateBaseProperties(o,this.options),this._updatePaintProperty("raster-contrast",o.contrast,this.options.contrast),this._updatePaintProperty("raster-fade-duration",o.fadeDuration,this.options.fadeDuration),this._updatePaintProperty("raster-hue-rotate",o.hueRotation,this.options.hueRotation),this._updatePaintProperty("raster-brightness-max",o.maxBrightness,this.options.maxBrightness),this._updatePaintProperty("raster-opacity",o.opacity,this.options.opacity),this._updatePaintProperty("raster-saturation",o.saturation,this.options.saturation),t=this.map._getMap().getSource(this._getSourceId()))&&t.updateImage(o),this.options=o,r?this.reloadImage():e&&this.updateTransform()},Rd.prototype.getPositions=function(t){return this.transform.then(function(e){return e.toTarget(t)})},Rd.prototype.getPixels=function(t){return this.transform.then(function(e){return e.toSource(t)})},Rd.getCoordinatesFromRefPoints=function(e,t,o,r){return new jl(o,r).toTarget([[0,0],[e,0],[e,t],[0,t]])},Rd.getCoordinatesFromEdges=function(e,t,o,r,n){"number"!=typeof n&&(n=0);t=[Math.min(r,o),t,Math.max(r,o),e],r=f.getCenter(t);return Qu([f.getNorthWest(t),f.getNorthEast(t),f.getSouthEast(t),f.getSouthWest(t)],r,n)},Rd.prototype._buildLayers=function(){var e={id:this.id,type:"raster",source:this._getSourceId(),layout:{visibility:this.options.visible?"visible":"none"},paint:{"raster-opacity":this.options.opacity,"raster-hue-rotate":this.options.hueRotation,"raster-brightness-min":this.options.minBrightness,"raster-brightness-max":this.options.maxBrightness,"raster-saturation":this.options.saturation,"raster-contrast":this.options.contrast,"raster-fade-duration":this.options.fadeDuration},minzoom:this.options.minZoom,maxzoom:this.options.maxZoom};return this.options.filter&&(e.filter=this.options.filter),[e]},Rd.prototype._getLayerIds=function(){return[this.id]},Rd.prototype._buildSource=function(){return{type:"image",url:this.options.url,coordinates:this.options.coordinates}},Rd.prototype._getSourceId=function(){return"".concat(this.getId(),"-ImageSource")},Rd.prototype.reloadImage=function(){var o=this;this.options.url&&(this.transform=new Promise(function(t,e){o.img.onload=function(){var e=[[0,0],[o.img.width,0],[o.img.width,o.img.height],[0,o.img.height]];t(new jl(e,o.options.coordinates)),o.isLoading=!1},o.img.onerror=o.img.onabort=function(){e("Failed to load image")},o.isLoading=!0,o.img.src=o.options.url}))},Rd.prototype.updateTransform=function(){var e;this.isLoading||(e=[[0,0],[this.img.width,0],[this.img.width,this.img.height],[0,this.img.height]],this.transform=Promise.resolve(new jl(e,this.options.coordinates)))},Rd.prototype._getSourceWrapper=function(){var e=this._getSourceId(),t=this._buildSource();return new Ph(e,t)};var Pd,Od,r=Rd;function Rd(e,t){t=Od.call(this,t)||this;return t.isLoading=!1,t.options=(new Ed).merge(Ql(e,Ed._cloneCustomizer)),t.img=new Image,t.reloadImage(),t}(window&&window.__extends||(xd=function(e,t){return(xd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}xd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ld,Md=un);var xd,Md,Nd=Ld;function Ld(){var e=null!==Md&&Md.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.lineCap="round",e.lineJoin="round",e.blur=0,e.strokeColor="#1E90FF",e.strokeDashArray=void 0,e.strokeGradient=void 0,e.offset=0,e.strokeOpacity=1,e.translate=new nu(0,0),e.translateAnchor="map",e.strokeWidth=2,e}var Dd,qd,hi=window&&window.__extends||(Dd=function(e,t){return(Dd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Dd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Ud=window&&window.__assign||function(){return(Ud=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},jd=(hi(Hd,qd=Zh),Hd.prototype.getOptions=function(){return Ql(this.options,Nd._cloneCustomizer)},Hd.prototype.getSource=function(){return this.options.source},Hd.prototype.setOptions=function(e){e=(new Nd).merge(this.options,Ql(e,Nd._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("line-blur",e.blur,this.options.blur),this._updateLayoutProperty("line-cap",e.lineCap,this.options.lineCap),this._updateLayoutProperty("line-join",e.lineJoin,this.options.lineJoin),this._updatePaintProperty("line-offset",e.offset,this.options.offset),this._updatePaintProperty("line-color",e.strokeColor,this.options.strokeColor),this._updatePaintProperty("line-dasharray",e.strokeDashArray,this.options.strokeDashArray),this._updatePaintProperty("line-gradient",e.strokeGradient,this.options.strokeGradient),this._updatePaintProperty("line-opacity",e.strokeOpacity,this.options.strokeOpacity),this._updatePaintProperty("line-width",e.strokeWidth,this.options.strokeWidth),this._updatePaintProperty("line-translate",e.translate,this.options.translate),this._updatePaintProperty("line-translate-anchor",e.translateAnchor,this.options.translateAnchor)}this.options=e},Hd.prototype._buildLayers=function(){return[Ud(Ud(Ud(Ud({id:this.id,type:"line"},this.options.sourceLayer&&{"source-layer":this.options.sourceLayer}),{source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none","line-cap":this.options.lineCap,"line-join":this.options.lineJoin},paint:Ud(Ud(Ud({"line-blur":this.options.blur,"line-color":this.options.strokeColor},this.options.strokeDashArray?{"line-dasharray":this.options.strokeDashArray}:{}),this.options.strokeGradient?{"line-gradient":this.options.strokeGradient}:{}),{"line-offset":this.options.offset,"line-opacity":this.options.strokeOpacity,"line-translate":this.options.translate,"line-translate-anchor":this.options.translateAnchor,"line-width":this.options.strokeWidth})}),this.options.filter&&{filter:this.options.filter}),{minzoom:this.options.minZoom,maxzoom:this.options.maxZoom})]},Hd.prototype._getLayerIds=function(){return[this.id]},Hd.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e},Hd);function Hd(e,t,o){t=qd.call(this,t)||this;return t.options=(new Nd).merge(Ql(o,Nd._cloneCustomizer)),t.options.source=e||t.options.source,t}(window&&window.__extends||(Bd=function(e,t){return(Bd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Bd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Kd,Fd=un);var Bd,Fd,zd=Kd;function Kd(){var e=null!==Fd&&Fd.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.base=0,e.fillColor="#1E90FF",e.height=0,e.fillOpacity=1,e.fillPattern=void 0,e.translate=new nu(0,0),e.translateAnchor="map",e.verticalGradient=!0,e}var Gd,Yd,i=window&&window.__extends||(Gd=function(e,t){return(Gd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Gd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Wd=window&&window.__assign||function(){return(Wd=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},t=(i(Zd,Yd=Zh),Zd.prototype.getOptions=function(){return Ql(this.options,zd._cloneCustomizer)},Zd.prototype.getSource=function(){return this.options.source},Zd.prototype.setOptions=function(e){e=(new zd).merge(this.options,Ql(e,zd._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("fill-extrusion-base",e.base,this.options.base),this._updatePaintProperty("fill-extrusion-color",e.fillColor,this.options.fillColor),this._updatePaintProperty("fill-extrusion-height",e.height,this.options.height),this._updatePaintProperty("fill-extrusion-opacity",e.fillOpacity,this.options.fillOpacity),this._updatePaintProperty("fill-extrusion-pattern",e.fillPattern,this.options.fillPattern),this._updatePaintProperty("fill-extrusion-translate",e.translate,this.options.translate),this._updatePaintProperty("fill-extrusion-translate-anchor",e.translateAnchor,this.options.translateAnchor),this._updatePaintProperty("fill-extrusion-vertical-gradient",e.verticalGradient,this.options.verticalGradient)}this.options=e},Zd.prototype._buildLayers=function(){return[Wd(Wd(Wd(Wd({id:this.id,type:"fill-extrusion"},this.options.sourceLayer&&{"source-layer":this.options.sourceLayer}),{source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none"},paint:Wd(Wd({"fill-extrusion-base":this.options.base,"fill-extrusion-height":this.options.height,"fill-extrusion-opacity":this.options.fillOpacity},this.options.fillPattern?{"fill-extrusion-pattern":this.options.fillPattern}:{"fill-extrusion-color":this.options.fillColor}),{"fill-extrusion-translate":this.options.translate,"fill-extrusion-translate-anchor":this.options.translateAnchor,"fill-extrusion-vertical-gradient":this.options.verticalGradient})}),this.options.filter&&{filter:this.options.filter}),{minzoom:this.options.minZoom,maxzoom:this.options.maxZoom})]},Zd.prototype._getLayerIds=function(){return[this.id]},Zd.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e},Zd);function Zd(e,t,o){t=Yd.call(this,t)||this;return t.options=(new zd).merge(Ql(o,zd._cloneCustomizer)),t.options.source=e||t.options.source,t}(window&&window.__extends||(Qd=function(e,t){return(Qd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Qd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Xd,Vd=un);var Qd,Vd,Jd=Xd;function Xd(){var e=null!==Vd&&Vd.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.fillColor="#1E90FF",e.fillOpacity=.5,e.fillPattern=void 0,e.fillAntialias=!0,e}(window&&window.__extends||($d=function(e,t){return($d=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}$d(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(op,ep=Zh),op.prototype.getOptions=function(){return Ql(this.options,Jd._cloneCustomizer)},op.prototype.getSource=function(){return this.options.source},op.prototype.setOptions=function(e){e=(new Jd).merge(this.options,Ql(e,Jd._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("fill-color",e.fillColor,this.options.fillColor),this._updatePaintProperty("fill-opacity",e.fillOpacity,this.options.fillOpacity),this._updatePaintProperty("fill-pattern",e.fillPattern,this.options.fillPattern),this._updatePaintProperty("fill-antialias",e.fillAntialias,this.options.fillAntialias)}this.options=e},op.prototype._buildLayers=function(){var e={id:this.id,type:"fill",source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"fill-opacity":this.options.fillOpacity,"fill-antialias":this.options.fillAntialias},minzoom:this.options.minZoom,maxzoom:this.options.maxZoom};return this.options.filter&&(e.filter=this.options.filter),this.options.sourceLayer&&(e["source-layer"]=this.options.sourceLayer),this.options.fillPattern?e.paint["fill-pattern"]=this.options.fillPattern:e.paint["fill-color"]=this.options.fillColor,[e]},op.prototype._getLayerIds=function(){return[this.id]},op.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e};var $d,ep,tp=op;function op(e,t,o){t=ep.call(this,t)||this;return t.options=(new Jd).merge(Ql(o,Jd._cloneCustomizer)),t.options.source=e||t.options.source,t}(window&&window.__extends||(rp=function(e,t){return(rp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}rp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(ap,np=ye);var rp,np,ip=ap;function ap(){var e=null!==np&&np.apply(this,arguments)||this;return e.allowOverlap=!1,e.anchor="bottom",e.ignorePlacement=!1,e.image="marker-blue",e.offset=new nu(0,0),e.optional=!1,e.padding=2,e.pitchAlignment="auto",e.rotation=0,e.rotationAlignment="auto",e.size=1,e.opacity=1,e}(window&&window.__extends||(sp=function(e,t){return(sp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}sp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(lp,cp=ye);var sp,cp,up=lp;function lp(){var e=null!==cp&&cp.apply(this,arguments)||this;return e.allowOverlap=!1,e.anchor="center",e.textField=void 0,e.font=["StandardFont-Regular"],e.ignorePlacement=!1,e.justify="center",e.offset=new nu(0,0),e.optional=!1,e.padding=2,e.pitchAlignment="auto",e.radialOffset=void 0,e.rotation=0,e.rotationAlignment="auto",e.variableAnchor=void 0,e.size=16,e.color="#000000",e.haloBlur=0,e.haloColor="rgba(0,0,0,0)",e.haloWidth=0,e.opacity=1,e}(window&&window.__extends||(hp=function(e,t){return(hp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}hp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(fp,dp=un);var hp,dp,pp=fp;function fp(){var e=null!==dp&&dp.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.iconOptions=new ip,e.textOptions=new up,e.placement="point",e.sortKey=void 0,e.zOrder="auto",e.lineSpacing=250,e}var gp,mp,be=window&&window.__extends||(gp=function(e,t){return(gp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),yp=window&&window.__assign||function(){return(yp=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},vp=(be(_p,mp=Zh),_p.prototype.getOptions=function(){return Ql(this.options,pp._cloneCustomizer)},_p.prototype.getSource=function(){return this.options.source},_p.prototype.setOptions=function(e){e=(new pp).merge(this.options,Ql(e,pp._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);var t=this.options,o=e.iconOptions,r=t.iconOptions,n=e.textOptions,i=t.textOptions;this._updateBaseProperties(e,t),this._updateLayoutProperty("symbol-spacing",e.lineSpacing,t.lineSpacing),this._updateLayoutProperty("symbol-placement",e.placement,t.placement),this._updateLayoutProperty("symbol-sort-key",e.sortKey,t.sortKey),this._updateLayoutProperty("symbol-z-order",e.zOrder,t.zOrder),this._updateLayoutProperty("icon-allow-overlap",o.allowOverlap,r.allowOverlap),this._updateLayoutProperty("icon-anchor",o.anchor,r.anchor),this._updateLayoutProperty("icon-ignore-placement",o.ignorePlacement,r.ignorePlacement),this._updateLayoutProperty("icon-image",o.image,r.image),this._updateLayoutProperty("icon-offset",o.offset,r.offset),this._updatePaintProperty("icon-opacity",o.opacity,r.opacity),this._updateLayoutProperty("icon-optional",o.optional,r.optional),this._updateLayoutProperty("icon-padding",o.padding,r.padding),this._updateLayoutProperty("icon-pitch-alignment",o.pitchAlignment,r.pitchAlignment),this._updateLayoutProperty("icon-rotate",o.rotation,r.rotation),this._updateLayoutProperty("icon-rotation-alignment",o.rotationAlignment,r.rotationAlignment),this._updateLayoutProperty("icon-size",o.size,r.size),this._updateLayoutProperty("text-allow-overlap",n.allowOverlap,i.allowOverlap),this._updateLayoutProperty("text-anchor",n.anchor,i.anchor),this._updatePaintProperty("text-color",n.color,i.color),this._updateLayoutProperty("text-font",n.font,i.font),this._updateLayoutProperty("text-ignore-placement",n.ignorePlacement,i.ignorePlacement),this._updateLayoutProperty("text-justify",n.justify,i.justify),this._updatePaintProperty("text-halo-blur",n.haloBlur,i.haloBlur),this._updatePaintProperty("text-halo-color",n.haloColor,i.haloColor),this._updatePaintProperty("text-halo-width",n.haloWidth,i.haloWidth),this._updateLayoutProperty("text-offset",n.offset,i.offset),this._updatePaintProperty("text-opacity",n.opacity,i.opacity),this._updateLayoutProperty("text-optional",n.optional,i.optional),this._updateLayoutProperty("text-padding",n.padding,i.padding),this._updateLayoutProperty("text-pitch-alignment",n.pitchAlignment,i.pitchAlignment),this._updateLayoutProperty("text-radial-offset",n.radialOffset,i.radialOffset),this._updateLayoutProperty("text-rotate",n.rotation,i.rotation),this._updateLayoutProperty("text-rotation-alignment",n.rotationAlignment,i.rotationAlignment),this._updateLayoutProperty("text-size",n.size,i.size),this._updateLayoutProperty("text-variable-anchor",n.variableAnchor,i.variableAnchor),this._updateLayoutProperty("text-field",n.textField,i.textField)}this.options=e},_p.prototype._buildLayers=function(){var e=yp(yp(yp(yp({id:this.id,type:"symbol"},this.options.sourceLayer&&{"source-layer":this.options.sourceLayer}),{source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:yp(yp({visibility:this.options.visible?"visible":"none","symbol-placement":this.options.placement,"symbol-spacing":this.options.lineSpacing,"symbol-z-order":this.options.zOrder,"text-allow-overlap":this.options.textOptions.allowOverlap,"text-anchor":this.options.textOptions.anchor},this.options.textOptions.textField&&{"text-field":this.options.textOptions.textField}),{"text-font":this.options.textOptions.font,"text-ignore-placement":this.options.textOptions.ignorePlacement,"text-justify":this.options.textOptions.justify,"text-offset":this.options.textOptions.offset,"text-optional":this.options.textOptions.optional,"text-padding":this.options.textOptions.padding,"text-pitch-alignment":this.options.textOptions.pitchAlignment,"text-rotate":this.options.textOptions.rotation,"text-rotation-alignment":this.options.textOptions.rotationAlignment,"text-size":this.options.textOptions.size,"icon-allow-overlap":this.options.iconOptions.allowOverlap,"icon-anchor":this.options.iconOptions.anchor,"icon-ignore-placement":this.options.iconOptions.ignorePlacement,"icon-image":this.options.iconOptions.image,"icon-offset":this.options.iconOptions.offset,"icon-optional":this.options.iconOptions.optional,"icon-padding":this.options.iconOptions.padding,"icon-pitch-alignment":this.options.iconOptions.pitchAlignment,"icon-rotate":this.options.iconOptions.rotation,"icon-rotation-alignment":this.options.iconOptions.rotationAlignment,"icon-size":this.options.iconOptions.size}),paint:{"text-color":this.options.textOptions.color,"text-halo-blur":this.options.textOptions.haloBlur,"text-halo-color":this.options.textOptions.haloColor,"text-halo-width":this.options.textOptions.haloWidth,"text-opacity":this.options.textOptions.opacity,"icon-opacity":this.options.iconOptions.opacity}}),this.options.filter&&{filter:this.options.filter}),{minzoom:this.options.minZoom,maxzoom:this.options.maxZoom});return void 0!==this.options.sortKey&&(e.layout["symbol-sort-key"]=this.options.sortKey),void 0!==this.options.textOptions.radialOffset&&(e.layout["text-radial-offset"]=this.options.textOptions.radialOffset),void 0!==this.options.textOptions.variableAnchor&&(e.layout["text-variable-anchor"]=this.options.textOptions.variableAnchor),[e]},_p.prototype._getLayerIds=function(){return[this.id]},_p.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e},_p);function _p(e,t,o){t=mp.call(this,t)||this;return t.options=(new pp).merge(Ql(o,pp._cloneCustomizer)),t.options.source=e||t.options.source,t}var wp,bp,Mi=window&&window.__extends||(wp=function(e,t){return(wp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}wp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Cp=window&&window.__assign||function(){return(Cp=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Ep=(Mi(Sp,bp=nh),Sp.prototype._buildSource=function(){return this.source},Sp.prototype._isDeepEqual=function(e){var o,t,r,n;return this.constructor===e.constructor&&(n=this.source,o=e.source,e=n.type===o.type&&n.url===o.url&&(void 0===n.tiles&&void 0===o.tiles||n.tiles&&o.tiles&&n.tiles.length===o.tiles.length&&n.tiles.every(function(e,t){return e===o.tiles[t]}))&&n.minzoom===o.minzoom&&n.maxzoom===o.maxzoom&&n.bounds===o.bounds&&n.attribution===o.attribution,t="raster"!==n.type||"raster"===n.type&&n.type===o.type&&n.tileSize===o.tileSize&&n.scheme===o.scheme,r="raster-dem"!==n.type||"raster-dem"===n.type&&n.type===o.type&&n.tileSize===o.tileSize&&n.encoding===o.encoding,n="vector"!==n.type||"vector"===n.type&&n.type===o.type&&n.promoteId===o.promoteId&&n.scheme===o.scheme,e)&&t&&r&&n},Sp.prototype._modifySource=function(e,t){if("raster"!==e.type&&"raster-dem"!==e.type&&"vector"!==e.type||!e.tiles){if("raster"!==e.type&&"raster-dem"!==e.type&&"vector"!==e.type||!e.url)throw new Error("Source definition must define a TileJSON 'url' or a 'tiles' array.");e.url="string"==typeof e.url?e.url:new Te({domain:te,path:e.url.path,queryParams:Cp(Cp({},t),e.url.queryParams)}).toString()}else{var o=e.tiles.map(function(e){return"string"==typeof e?e:new Te({domain:te,path:e.path,queryParams:Cp(Cp({},t),e.queryParams)}).toString()});e.tiles=o}return e},Sp);function Sp(e,t,o){e=bp.call(this,e)||this;return e.source=e._modifySource(t,o),e}(window&&window.__extends||(Tp=function(e,t){return(Tp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Tp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ap,Ip=cn);var Tp,Ip,kp=Ap;function Ap(){var e=null!==Ip&&Ip.apply(this,arguments)||this;return e.bounds=[-180,-85.0511,180,85.0511],e.minSourceZoom=0,e.maxSourceZoom=22,e.tileSize=512,e.isTMS=!1,e.subdomains=void 0,e.tileUrl=void 0,e}var Pp,Op,o=window&&window.__extends||(Pp=function(e,t){return(Pp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Pp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Rp=window&&window.__assign||function(){return(Rp=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},xp=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Mp=(o(Np,Op=kd),Np.prototype.getOptions=function(){return Ql(this.options,kp._cloneCustomizer)},Np.prototype.setOptions=function(e){e=(new kp).merge(this.options,Ql(e,kp._cloneCustomizer));if(this.map){if(!$c(e.bounds,this.options.bounds)||e.isTMS!==this.options.isTMS||e.maxSourceZoom!==this.options.maxSourceZoom||e.minSourceZoom!==this.options.minSourceZoom||!$c(e.subdomains,this.options.subdomains)||e.tileSize!==this.options.tileSize||e.tileUrl!==this.options.tileUrl)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("raster-contrast",e.contrast,this.options.contrast),this._updatePaintProperty("raster-fade-duration",e.fadeDuration,this.options.fadeDuration),this._updatePaintProperty("raster-hue-rotate",e.hueRotation,this.options.hueRotation),this._updatePaintProperty("raster-brightness-max",e.maxBrightness,this.options.maxBrightness),this._updatePaintProperty("raster-opacity",e.opacity,this.options.opacity),this._updatePaintProperty("raster-saturation",e.saturation,this.options.saturation)}this.options=e},Np.prototype._setOptionsNoUpdate=function(e){this.options=(new kp).merge(this.options,Ql(e,kp._cloneCustomizer))},Np.prototype._buildLayers=function(){return[Rp(Rp({id:this.id,type:"raster",source:this._getSourceId(),layout:{visibility:this.options.visible?"visible":"none"},paint:{"raster-contrast":this.options.contrast,"raster-fade-duration":this.options.fadeDuration,"raster-hue-rotate":this.options.hueRotation,"raster-brightness-max":this.options.maxBrightness,"raster-brightness-min":this.options.minBrightness,"raster-opacity":this.options.opacity,"raster-saturation":this.options.saturation}},this.options.filter&&{filter:this.options.filter}),{minzoom:this.options.minZoom,maxzoom:this.options.maxZoom})]},Np.prototype._getLayerIds=function(){return[this.id]},Np.prototype._buildSource=function(){var t,e;if(this.options.tileUrl){if(-1===this.options.tileUrl.indexOf("{"))return{type:"raster",url:this.options.tileUrl};if(-1!==this.options.tileUrl.indexOf("{subdomain}")){if(!(this.options.subdomains&&0<this.options.subdomains.length))throw new Error("The {subdomain} placeholder was included in the tileUrl but no subdomains were specified");var o=[];try{for(var r=xp(this.options.subdomains),n=r.next();!n.done;n=r.next()){var i=n.value;o.push(this.options.tileUrl.replace(/{subdomain}/g,i))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}e=o}else e=[this.options.tileUrl]}return Rp({type:"raster",bounds:this.options.bounds,maxzoom:this.options.maxSourceZoom,minzoom:this.options.minSourceZoom,scheme:this.options.isTMS?"tms":"xyz",tileSize:this.options.tileSize},e&&{tiles:e})},Np.prototype._getSourceId=function(){return"".concat(this.getId(),"-RasterSource")},Np.prototype._getSourceWrapper=function(){var e=this._getSourceId(),t=this._buildSource();return new Ep(e,{name:e,tiles:t.tiles,type:t.type,url:t.url})},Np);function Np(e,t){t=Op.call(this,t)||this;return e&&t.setOptions(e),t}(window&&window.__extends||(Lp=function(e,t){return(Lp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Lp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Up,Dp=un);var Lp,Dp,qp=Up;function Up(){var e=null!==Dp&&Dp.apply(this,arguments)||this;return e.renderer=void 0,e}(window&&window.__extends||(jp=function(e,t){return(jp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}jp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Fp,Hp=Zh),Fp.prototype.getOptions=function(){return Ql(this.options,qp._cloneCustomizer)},Fp.prototype.setOptions=function(e){e=(new qp).merge(this.options,Ql(e,qp._cloneCustomizer));this.map&&this.map.triggerRepaint(),this.options=e},Fp.prototype.onAdd=function(e){var t,o;Hp.prototype.onAdd.call(this,e),this.map.events.add("stylechanged",this._onStyleChange),this.options.renderer&&this.glContext&&null!=(o=(t=this.options.renderer).onAdd)&&o.call(t,e,this.glContext)},Fp.prototype.onRemove=function(){var e,t;this.options.renderer&&this.glContext&&null!=(t=(e=this.options.renderer).onRemove)&&t.call(e,this.map,this.glContext),this.map.events.remove("stylechanged",this._onStyleChange),this.glContext=null,Hp.prototype.onRemove.call(this)},Fp.prototype._buildLayers=function(){var n=this;if(this.options.renderer)return[{id:this.id,type:"custom",renderingMode:this.options.renderer.renderingMode,onAdd:function(e,t){n.glContext=t},onRemove:function(e,t){},prerender:function(e,t){var o,r;n._shouldRender()&&null!=(r=(o=n.options.renderer).prerender)&&r.call(o,e,t)},render:function(e,t){n._shouldRender()&&n.options.renderer.render(e,t)}}];throw new Error("Cannot build the WebGL layer because renderer was not set.")},Fp.prototype._getLayerIds=function(){return[this.id]},Fp.prototype._getSourceIds=function(){return(new Set).add(this.source.getId())},Fp.prototype._shouldRender=function(){var e;return!!this.map&&(e=this.map.getCamera().zoom,this.options.visible)&&this.options.minZoom<=e&&this.options.maxZoom>e};var jp,Hp,Bp=Fp;function Fp(e,t){var o=Hp.call(this,e)||this;return o._onStyleChange=function(){var e,t;o.map._getMap().getLayer(o.id)||(e=o.map,t=null==(t=o.map.layers._getUserLayers().find(function(e){return e.layer.getId()==o.id}))?void 0:t.before,e.layers.remove(o),e.layers.add(o,t))},o.options=(new qp).merge(Ql(t,qp._cloneCustomizer)),o.source=new uh,o}var Ni=Object.freeze({__proto__:null,BubbleLayer:ud,HeatMapLayer:e,ImageLayer:r,Layer:Zh,LineLayer:jd,PolygonExtrusionLayer:t,PolygonLayer:tp,SymbolLayer:vp,TileLayer:Mp,WebGLLayer:Bp}),zp=(Kp.convertHtmlString=function(e){var t;return"string"==typeof e?((t=document.createElement("div")).innerHTML=e,t):e},Kp.parseWithFilter=function(e,t,o,r){var n=this;if(void 0===t&&(t=function(e){return!0}),void 0===o&&(o=function(e){return e}),void 0===r&&(r=function(){return document.createElement("div")}),"string"==typeof e){var i=(new DOMParser).parseFromString(e,"text/html").body;if(0==i.children.length)return o(i.innerHTML);var a,i=1==i.children.length&&1==i.childNodes.length?i.children[0]:(a=r(),Array.from(i.childNodes).map(function(e){return a.append(e)}),a)}else i=e;return Array.from(i.children).forEach(function(e){return n.parseWithFilter(e,t,o)}),t(i)?o(i):(i.parentNode&&i.parentNode.removeChild(i),null)},Kp);function Kp(){}var Gp=en,Yp=cs;var Wp,Zp,Qp=q(function(e){return Gp(e)&&1===e.nodeType&&!Yp(e)}),Vp=((window&&window.__extends||(Wp=function(e,t){return(Wp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Wp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Jp,Zp=ye),Jp._cloneCustomizer=function(e){if(Qp(e))return e},Jp);function Jp(){var e=null!==Zp&&Zp.apply(this,arguments)||this;return e.anchor="none",e.draggable=!1,e.closeButton=!0,e.content=document.createElement("span"),e.fillColor="#FFFFFF",e.pixelOffset=new nu(0,0),e.position=new dl(0,0),e.showPointer=!0,e}var Xp,$p,n=window&&window.__extends||(Xp=function(e,t){return(Xp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Xp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),ef=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},tf=(n(of,$p=Qt),of.prototype.setPopupOptions=function(e){this.setOptions(e)},of.prototype.setOptions=function(e){var t,e=(new Vp).merge(this.options,Ql(e,Vp._cloneCustomizer));e.content!==this.options.content?(this.htmlContent.remove(),this.htmlContent=this._createHtmlContent(e),this.contentDiv.prepend(this.htmlContent)):e.draggable!==this.options.draggable&&this._setDraggable(this.htmlContent,e.draggable),e.closeButton&&!this.closeBtn?(this.closeBtn=this._createCloseButton(),this.contentDiv.appendChild(this.closeBtn),t=jt("close"),this.contentDiv.appendChild(t),Ht(t,this.closeBtn,!0)):!e.closeButton&&this.closeBtn&&(this.contentDiv.removeChild(this.closeBtn),delete this.closeBtn),e.showPointer&&!this.arrowDiv?(this.arrowDiv=this._createArrowDiv(),this.containerDiv.appendChild(this.arrowDiv)):!e.showPointer&&this.arrowDiv&&(this.containerDiv.removeChild(this.arrowDiv),delete this.arrowDiv),e.fillColor!==this.options.fillColor&&(this.containerDiv.style.borderColor=e.fillColor,this.contentDiv.style.backgroundColor=e.fillColor),this.marker&&(e.anchor!==this.options.anchor?"none"===this.options.anchor?(this.autoAnchor!==e.anchor&&this._replaceMarker(this.map,e),this.map.events.remove("move",this._onMove),delete this.autoAnchor):(this._replaceMarker(this.map,e),"none"===e.anchor&&this.map.events.add("move",this._onMove)):($c(e.position,this.options.position)||this.marker.setLngLat(e.position),$c(e.pixelOffset,this.options.pixelOffset)||this.marker.setOffset(e.pixelOffset))),this.options=e},of.prototype.getPopupOptions=function(){return this.getOptions()},of.prototype.getOptions=function(){return Ql(this.options,Vp._cloneCustomizer)},of.prototype.getPopupContainer=function(){return this.containerDiv},of.prototype._dragToPixel=function(e){this.dragging||(this.dragging=!0,this.contentDiv.style.pointerEvents="none",this._invokeEvent("dragstart",{type:"dragstart",target:this}));e=[e[0]+this.dragOffset[0],e[1]+this.dragOffset[1]],e=ef(this.map.pixelsToPositions([e]),1)[0];this.options.position=e,this.marker.setLngLat(this.options.position),this._invokeEvent("drag",{type:"drag",target:this})},of.prototype._onUp=function(){this.dragging&&(this.contentDiv.style.pointerEvents="",this._invokeEvent("dragend",{type:"dragend",target:this}),"none"===this.options.anchor)&&this._onMove(),delete this.dragOffset,delete this.dragging},of.prototype._createContainerDiv=function(e){var t=this,o=document.createElement("div"),r=(o.classList.add(of.Css.container),o.classList.add(of.Css.hidden),o.style.borderColor=e.fillColor,o.setAttribute("role","dialog"),o.setAttribute("aria-label","Map Information Window"),!1);return o.addEventListener("keydown",function(e){"Tab"!==e.key&&"Escape"!==e.key&&"Esc"!==e.key||(r=!0)}),o.addEventListener("keyup",function(e){"Tab"!==e.key&&"Escape"!==e.key&&"Esc"!==e.key||(r=!1)}),o.addEventListener("focusin",function(e){t.map&&!t.isOpen()&&(t.open(t.map),e.target instanceof HTMLElement)&&e.target.focus()}),o.addEventListener("focusout",function(e){r&&e.relatedTarget instanceof Node&&!o.contains(e.relatedTarget)&&(r=!1,t.isOpen())&&t.close()}),o},of.prototype._createContentDiv=function(e){var t=document.createElement("div");return t.classList.add(of.Css.content),t.style.backgroundColor=e.fillColor,t.setAttribute("tabindex","0"),this.htmlContent=this._createHtmlContent(e),t.appendChild(this.htmlContent),t},of.prototype._createArrowDiv=function(){var e=document.createElement("div");return e.classList.add(of.Css.arrow),e},of.prototype._createCloseButton=function(){var e=document.createElement("button");return e.addEventListener("click",this.close),e.classList.add(of.Css.close),e.setAttribute("aria-label","close"),e.setAttribute("tabindex","0"),e.innerHTML="×",e},of.prototype._createHtmlContent=function(e){var t=zp.convertHtmlString(e.content);return e.draggable&&this._setDraggable(t,e.draggable),t},of.prototype._createMarker=function(e,t){var o=this.marker?this.marker.getLngLat():e.position,t=("none"===e.anchor?(this.autoAnchor=t||"bottom",this.containerDiv.classList.add(this.autoAnchor),new D.Marker({anchor:this.autoAnchor,element:this.containerDiv,offset:e.pixelOffset})):(this.containerDiv.classList.add(e.anchor),new D.Marker({anchor:e.anchor,element:this.containerDiv,offset:e.pixelOffset}))).setLngLat(o);return t},of.prototype._getAutoAnchor=function(e,t){var o,r,n=this.containerDiv.offsetWidth,i=this.containerDiv.offsetHeight,a=[];return(r=this.marker?(o=(r=e._getMap().project(this.marker.getLngLat())).x,r.y):(r=ef(e.positionsToPixels([t.position]),1),o=(t=ef(r[0],2))[0],t[1]))<i?a.push("top"):r>e.getCanvas().offsetHeight-i&&a.push("bottom"),o<n/2?a.push("left"):o>e.getCanvas().offsetWidth-n/2&&a.push("right"),0<a.length?a.join("-"):"bottom"},of.prototype._replaceMarker=function(e,t,o){var r=this.containerDiv.nextElementSibling;this.marker.remove(),this.containerDiv.classList.remove(this.autoAnchor||this.options.anchor),this.marker=this._createMarker(t,o),this.marker.addTo(e._getMap()),e.popups._getCollectionDiv().insertBefore(this.containerDiv,r||null)},of.prototype._setDraggable=function(e,t){t?(e.addEventListener("mousedown",this._onDown),e.addEventListener("touchstart",this._onDown),e.addEventListener("dragstart",this._onDragStart)):(e.removeEventListener("mousedown",this._onDown),e.removeEventListener("touchstart",this._onDown),e.removeEventListener("dragstart",this._onDragStart))},of.Css={arrow:"popup-arrow",close:"popup-close",container:"popup-container",content:"popup-content-container",hidden:"hidden-accessible-element"},of);function of(e){var o=$p.call(this)||this;return o.attach=function(e){o.map!==e&&(o.map&&o.remove(),o.map=e,o.marker=o._createMarker(o.options),o.marker.addTo(o.map._getMap()),o.map.popups._getCollectionDiv().appendChild(o.containerDiv),o.map.popups.add(o))},o.open=function(e){if(!e&&!o.map)throw new Error("Must specify a map to open on or attach to a map in advance");o.attach(e||o.map),o.containerDiv.classList.remove(of.Css.hidden),o.map.events.add("move",o._onMove),o._onMove(),o._invokeEvent("open",{target:o,type:"open"})},o.close=function(){o.map&&o.map.events.remove("move",o._onMove),o.containerDiv.classList.add(of.Css.hidden),o._invokeEvent("close",{target:o,type:"close"})},o.remove=function(){o.map&&(o.marker.remove(),o.containerDiv.classList.remove(o.autoAnchor||o.options.anchor),o.map.events.remove("move",o._onMove),o.map.popups.remove(o),delete o.map,delete o.marker,delete o.autoAnchor)},o.isOpen=function(){return o.map&&!o.containerDiv.classList.contains(of.Css.hidden)},o._onMove=function(){var e=o._getAutoAnchor(o.map,o.options);e!==o.autoAnchor&&(o._replaceMarker(o.map,o.options,e),o.map.events.add("move",o._onMove))},o._onDown=function(e){o.map.popups._addDraggedPopup(o);var t=ef(o.map.positionsToPixels([o.options.position]),1)[0];"mousedown"===e.type?o.dragOffset=[t[0]-e.clientX,t[1]-e.clientY]:"touchstart"===e.type&&(o.dragOffset=[t[0]-e.touches[0].clientX,t[1]-e.touches[0].clientY])},o._onDragStart=function(e){e.preventDefault()},o.options=(new Vp).merge(Ql(e,Vp._cloneCustomizer)),o.containerDiv=o._createContainerDiv(o.options),o.contentDiv=o._createContentDiv(o.options),o.containerDiv.appendChild(o.contentDiv),o.options.showPointer&&(o.arrowDiv=o._createArrowDiv(),o.containerDiv.appendChild(o.arrowDiv)),o.options.closeButton&&(o.closeBtn=o._createCloseButton(),o.contentDiv.appendChild(o.closeBtn),e=jt("close"),o.contentDiv.appendChild(e),Ht(e,o.closeBtn,!0)),o}(window&&window.__extends||(rf=function(e,t){return(rf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}rf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(sf,nf=ye),sf._cloneCustomizer=function(e){if(e instanceof tf||Qp(e))return e};var rf,nf,af=sf;function sf(){var e=null!==nf&&nf.apply(this,arguments)||this;return e.anchor="bottom",e.color="#1A73AA",e.draggable=!1,e.htmlContent='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24.5 36.5" id="marker_'.concat(W(),'" width="24.5" height="36.5" display="block"><path d="M12.25.25a12.2543,12.2543,0,0,0-12,12.4937c0,6.4436,6.4879,12.1093,11.059,22.5641.5493,1.2563,1.3327,1.2563,1.882,0C17.7621,24.8529,24.25,19.1857,24.25,12.7437A12.2543,12.2543,0,0,0,12.25.25Z" fill="{color}" stroke="{secondaryColor}" stroke-width="0.5"/><text style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; fill: white;" text-anchor="middle" x="12" y="18">{text}</text></svg>'),e.pixelOffset=new nu(0,0),e.position=new dl(0,0),e.popup=void 0,e.secondaryColor="white",e.text=void 0,e.visible=!0,e}(window&&window.__extends||(cf=function(e,t){return(cf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}cf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(hf,uf=Qt),hf.prototype.getOptions=function(){return Ql(this.options,af._cloneCustomizer)},hf.prototype.getElement=function(){return this.marker.getElement()},hf.prototype.setOptions=function(e){e=(new af).merge(this.options,Ql(e,af._cloneCustomizer));$c(e.htmlContent,this.options.htmlContent)&&e.anchor===this.options.anchor?("string"!=typeof e.htmlContent||e.color===this.options.color&&e.text===this.options.text&&e.secondaryColor===this.options.secondaryColor||(this.element.innerHTML=this._getSubbedHtmlString(e)||""),e.draggable!==this.options.draggable&&(this._setDraggable(e.draggable),this.marker.setDraggable(e.draggable)),$c(e.pixelOffset,this.options.pixelOffset)||this.marker.setOffset(e.pixelOffset),$c(e.position,this.options.position)||this.marker.setLngLat(e.position),e.visible!==this.options.visible&&(e.visible?this.element.classList.remove(hf.hiddenClass):this.element.classList.add(hf.hiddenClass))):(this.marker.remove(),this._buildMarker(e),this.map&&(this.marker.addTo(this.map._getMap()),this._getCollectionContainer().appendChild(this.element))),this.options=e},hf.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)}},hf.prototype._addToMap=function(e,t){this.map&&this.map!==e&&this._removeFromMap(),t&&(this.options.position=Qa(t),this.marker.setLngLat(this.options.position)),this.map!==e&&(this.map=e,this.marker.addTo(e._getMap()),this._getCollectionContainer().appendChild(this.element))},hf.prototype._removeFromMap=function(){this.map&&(this.marker.remove(),delete this.map)},hf.prototype._getId=function(){if(this.element)return("string"==typeof this.options.htmlContent?this.element.firstChild:this.element).id},hf.prototype._buildMarker=function(e){var t;"string"==typeof e.htmlContent?(t=this._getSubbedHtmlString(e)||"",this.element=zp.convertHtmlString(t)):this.element=e.htmlContent,this.element.classList.add(hf.containerClass),e.draggable&&this._setDraggable(!0),e.visible||this.element.classList.add(hf.hiddenClass),this.marker=new D.Marker({element:this.element,offset:e.pixelOffset,draggable:e.draggable,anchor:e.anchor}).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("keydown",this._bubbleElementEvent),this.element.addEventListener("keypress",this._bubbleElementEvent),this.element.addEventListener("keyup",this._bubbleElementEvent),this.element.addEventListener("mousedown",this._bubbleElementEvent),this.element.addEventListener("mouseenter",this._bubbleElementEvent),this.element.addEventListener("mouseleave",this._bubbleElementEvent),this.element.addEventListener("mousemove",this._bubbleElementEvent),this.element.addEventListener("mouseout",this._bubbleElementEvent),this.element.addEventListener("mouseover",this._bubbleElementEvent),this.element.addEventListener("mouseup",this._bubbleElementEvent)},hf.prototype._getSubbedHtmlString=function(e){return"string"==typeof e.htmlContent?e.htmlContent.replace(/{color}/gi,e.color||"").replace(/{secondaryColor}/gi,e.secondaryColor||"").replace(/{text}/gi,e.text||""):null},hf.prototype._getCollectionContainer=function(){var e=this.map.getCanvasContainer().querySelector(".".concat(hf.collectionContainerClass));return e||((e=document.createElement("div")).classList.add(hf.collectionContainerClass),this.map.getCanvasContainer().appendChild(e)),e},hf.prototype._setDraggable=function(e){e?this.element.addEventListener("dragstart",this._onEleDragStart):this.element.removeEventListener("dragstart",this._onEleDragStart)},hf.collectionContainerClass="marker-collection-container",hf.hiddenClass="hidden-accessible-element",hf.containerClass="marker-container";var cf,uf,lf=hf;function hf(e){var t=uf.call(this)||this;return t._onDrag=function(){var e=t.marker.getLngLat().wrap();t.options.position=new dl(e.lng,e.lat),t._invokeEvent("drag",{type:"drag",target:t})},t._onDragStart=function(){t._invokeEvent("dragstart",{type:"dragstart",target:t})},t._onDragEnd=function(){t._invokeEvent("dragend",{type:"dragend",target:t})},t._bubbleElementEvent=function(e){t._invokeEvent(e.type,{type:e.type,target:t})},t._onEleDragStart=function(e){e.preventDefault()},t.options=(new af).merge(Ql(e,af._cloneCustomizer)),t._buildMarker(t.options),t}pf.getHighContrastMode=function(){return matchMedia("(-ms-high-contrast: white-on-black)").matches?"dark":matchMedia("(-ms-high-contrast: black-on-white)").matches?"light":matchMedia("(-ms-high-contrast: active)").matches?"dark":matchMedia("(inverted-colors: inverted)").matches?"invert":null};var df=pf;function pf(){}(window&&window.__extends||(ff=function(e,t){return(ff=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ff(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(yf,gf=ye);var ff,gf,mf=yf;function yf(){var e=null!==gf&&gf.apply(this,arguments)||this;return e.copyrightMessage=void 0,e.copyrightContent=void 0,e.customAttribution=void 0,e.showFeedbackLink=!0,e.showLogo=!0,e}(window&&window.__extends||(vf=function(e,t){return(vf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}vf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(bf,_f=$t),bf.prototype.onAdd=function(e){return this.map=e,this.container=this.buildContainer(e,l.ControlStyle.auto),this.container.className="map-copyright",this.copyrightDiv=this.buildCopyrightDiv(),this.copyrightDiv.className="azure-map-copyright",this.container.appendChild(this.copyrightDiv),this.options.showLogo&&this.addRemoveLogo(!0),this.options.showFeedbackLink&&this.addRemoveFeedbackDiv(!0),this.container},bf.prototype.onRemove=function(){_f.prototype.onRemove.call(this),delete this.container},bf.prototype.setOptions=function(e){var t,o=this,e=(new mf).merge(this.options,e);e.copyrightMessage===this.options.copyrightMessage&&e.customAttribution===this.options.customAttribution||(this.copyrightDiv.innerText=this.textAttribution(e)),e.copyrightContent!==this.options.copyrightContent&&(this.options.copyrightContent&&(t=Array.from(this.copyrightDiv.children).find(function(e){return e===o.options.copyrightContent}),this.copyrightDiv.removeChild(t)),0<this.copyrightDiv.childNodes.length?this.copyrightDiv.insertBefore(e.copyrightContent,this.copyrightDiv.childNodes[0]):this.copyrightDiv.appendChild(e.copyrightContent),this.options.copyrightContent=e.copyrightContent),!e.showLogo&&this.logoAnchor?this.addRemoveLogo(!1):e.showLogo&&!this.logoAnchor&&this.addRemoveLogo(!0),!e.showFeedbackLink&&this.feedbackAnchor?this.addRemoveFeedbackDiv(!1):e.showFeedbackLink&&!this.feedbackAnchor&&this.addRemoveFeedbackDiv(!0),this.options=e},bf.prototype.getDefaultAttributions=function(){var e=(new Date).getFullYear(),t=["©".concat(e," TomTom")];return this.options.showLogo||t.push("©".concat(e," Microsoft")),t},bf.prototype.buildCopyrightDiv=function(){var e=document.createElement("div");return e.innerText=this.textAttribution(this.options)||"",e},bf.prototype.buildFeedbackLink=function(){var e=document.createElement("a");return e.setAttribute("alt","Provide Map Data Feedback"),e.setAttribute("aria-label","Provide Map Data Feedback"),e.href=bf.feedbackLink,e.target="_blank",e.rel="noopener",e.className="azure-map-feedback",e},bf.prototype.addRemoveFeedbackDiv=function(e){e?(this.feedbackAnchor=this.buildFeedbackLink(),this.tooltip=jt("Provide Map Data Feedback"),this.container.appendChild(this.feedbackAnchor),this.container.appendChild(this.tooltip),Ht(this.tooltip,this.feedbackAnchor),null!=(e=null==(e=this.map)?void 0:e.events)&&e.add("moveend",this.updateFeedbackLink)):(this.feedbackAnchor.remove(),this.tooltip.remove(),delete this.tooltip,delete this.feedbackAnchor,null!=(e=null==(e=this.map)?void 0:e.events)&&e.remove("moveend",this.updateFeedbackLink))},bf.prototype.addRemoveLogo=function(e){e?(this.logoAnchor=document.createElement("a"),this.logoAnchor.className="azure-map-logo",this.logoAnchor.href="https://aka.ms/azuremaps",this.logoAnchor.setAttribute("aria-label","Visit azure.microsoft.com"),this.logoAnchor.setAttribute("target","_blank"),this.container.appendChild(this.logoAnchor),this.logoTooltip=jt("Visit azure.microsoft.com"),this.container.appendChild(this.logoTooltip),Ht(this.logoTooltip,this.logoAnchor)):(this.logoAnchor.remove(),this.logoTooltip.remove(),delete this.logoAnchor)},bf.feedbackLink="https://aka.ms/azuremapsdatafeedback?feedbackep=UrlAzureMapsWebSdk";var vf,_f,wf=bf;function bf(e){var o=_f.call(this)||this;return o.textAttribution=function(e){return[o.options.copyrightMessage,o.options.customAttribution].filter(function(e){return e}).join("")},o.updateFeedbackLink=function(){var e,t;o.feedbackAnchor&&o.map&&(e=(t=o.map.getCamera()).center,t=t.zoom,o.feedbackAnchor.href="".concat(bf.feedbackLink,"&cp=").concat(e[1],"~").concat(e[0],"&lvl=").concat(t+1))},o.options=(new mf).merge(e),o}Ef.throwOnError=function(e,t){function o(e){throw r.off("error",o),e.error}var r=e instanceof gS?e._getMap():e,e=(r.on("error",o),t());return r.off("error",o),e},Ef.tryCatch=function(e,t,o,r){try{return this.throwOnError(e,t)}catch(e){return o(e)}finally{"function"==typeof r&&r()}},Ef.tryFinally=function(e,t,o){try{return this.throwOnError(e,t)}finally{o()}};var Cf=Ef;function Ef(){}var Sf=window&&window.__assign||function(){return(Sf=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Tf=(If.prototype.request=function(e){var t,e={domain:this.map.getServiceOptions().domain,path:"reverseGeocode",queryParams:Sf({"api-version":"2023-06-01",coordinates:"".concat(Zu(e.position[0]),",").concat(Wu(e.position[1]))},e.style.view&&{view:e.style.view}),headers:{"Accept-Language":e.style.language}};return new Te((null==(t=this.map.authentication)?void 0:t.signRequest(e))||e).get()},If);function If(e){this.map=e}Af.prototype.cache=function(e,t,o,r){r="".concat(e,"_").concat(o[0],"_").concat(o[1],"_").concat(r);this._labelIdx[t.labelType]||(this._labelIdx[t.labelType]=[],this._labelCache[t.labelType]=[]),-1===this._labelIdx[t.labelType].indexOf(r)&&(this._labelCache[t.labelType].push({name:e,radius:t.radius,minZoom:t.minZoom,maxZoom:t.maxZoom||24,position:o}),this._labelIdx[t.labelType].push(r))},Af.prototype.getNearestLabel=function(e,t,o){var r=null,n=this._labelCache[e];if(n)for(var i,a=1/0,s=0,c=n.length;s<c;s++)o>=n[s].minZoom&&o<=n[s].maxZoom&&(i=Du(n[s].position,t))<=n[s].radius&&i<=a&&(a=i,r=n[s]);return r},Af.prototype._preloadCache=function(e){if(!this._preloadedCache.has(e)){this._preloadedCache.add(e);var t={source:[],labelType:"water",minZoom:0,radius:395e4,polygonSources:[]},o=e,r=o.indexOf("-");switch(o=-1!==r?o.substr(0,r):o){case"fr":this.cache("Océan Pacifique",t,[-170,32],e),this.cache("Océan Pacifique",t,[-138,-27],e),this.cache("Océan Atlantique",t,[-40,32],e),this.cache("Océan Atlantique",t,[-17,-29],e);break;case"es":this.cache("Océan Pacifique",t,[-170,32],e),this.cache("Océan Pacifique",t,[-138,-27],e),this.cache("Océano Atlántico",t,[-40,32],e),this.cache("Océano Atlántico",t,[-17,-29],e);break;case"pt":this.cache("Oceano Pacífico",t,[-170,32],e),this.cache("Oceano Pacífico",t,[-138,-27],e),this.cache("Oceano Atlântico",t,[-40,32],e),this.cache("Oceano Atlântico",t,[-17,-29],e);break;case"ja":this.cache("太平洋",t,[-170,32],e),this.cache("太平洋",t,[-138,-27],e);break;case"en":this.cache("Pacific Ocean",t,[-170,32],e),this.cache("Pacific Ocean",t,[-138,-27],e),this.cache("Atlantic Ocean",t,[-40,32],e),this.cache("Atlantic Ocean",t,[-17,-29],e),this.cache("Indian Ocean",t,[77,-26],e)}}};var kf=Af;function Af(){this._labelCache={},this._labelIdx={},this._preloadedCache=new Set}var Pf=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},Of=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},Rf=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},xf=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},Mf=(Nf.prototype.dispose=function(){this._disposed=!0;var e=this._map._getMap(),e=(e.off("move",this._onMove),e.off("moveend",this._onMoveEnd),e.off("styledata",this._onStyleData),e.off("rotate",this._onRotate),this._map.getCanvas());e.removeEventListener("mousedown",this._onPointerDown),e.removeEventListener("touchstart",this._onPointerDown),this._map.getMapContainer().removeEventListener("keydown",this._shortcutListener)},Nf.prototype._getEventPos=function(e){var t,o;return"touches"in e?(t=e.touches[0],o=e.target.getBoundingClientRect(),[t.pageX-o.left,t.pageY-o.top]):[e.offsetX,e.offsetY]},Nf.prototype._checkThresholds=function(e,t){return this._checkZoomThreshold(e.zoom,t.zoom)||this._checkPitchThreshold(e.pitch,t.pitch)||this._checkLocThreshold(e.center,t.center)||this._checkHeadingThreshold(e.bearing,t.bearing)},Nf.prototype._checkZoomThreshold=function(e,t){return this._round(e)!==this._round(t)},Nf.prototype._checkPitchThreshold=function(e,t){return Math.abs(e-t)>=this._pitchThreshold},Nf.prototype._checkLocThreshold=function(e,t){e=(t=Rf(this._map.positionsToPixels([t,e]),2))[0],t=t[1];return nu.getDistance(e,t)>=this._moveThreshold},Nf.prototype._checkHeadingThreshold=function(e,t){e<0&&(e+=360),t<0&&(t+=360);e=Math.abs(e-t);return(e=180<e?360-e:e)>=this._headingThreshold},Nf.prototype._getLocDesc=function(h,d,p){return Pf(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c,u,l=this;return Of(this,function(e){switch(e.label){case 0:return"blank"===p?[3,3]:this._map._getMap().loaded()?[3,2]:[4,new Promise(function(e){return l._map._getMap().once("idle",e)})];case 1:e.sent(),e.label=2;case 2:for(t={},o=this._map.positionsToPixels([h.center])[0],Cf.tryCatch(this._map,function(){var t=l._map._getMap();r=t.queryRenderedFeatures(o,{layers:l._polygonStyleLayer.filter(function(e){return t.getLayer(e)}),filter:["==",["geometry-type"],"Polygon"]})},function(){}),n=null,r&&0<r.length&&(n=r[0]),i=null,a=0,s=this._labelConfig.length;a<s;a++)c=this._labelConfig[a],h.zoom>=c.minZoom?c.polygonSources?n&&-1!==c.polygonSources.indexOf(n.layer["source-layer"])?(i=c.labelType,this._getClosestLabel(c,h,d,t,!1)):this._getClosestLabel(c,h,d,t,!0):this._getClosestLabel(c,h,d,t,!1):this._getClosestLabel(c,h,d,t,!0);return 8<=h.zoom&&this._processRoads(t,h,d),this._labelCache.forEach(function(e){!t[e]&&(u=null,u="water"!==e&&"majorPoi"!==e||e===i?Nf._labelCache.getNearestLabel(e,h.center,h.zoom):u)&&(t[e]=u.name)}),[2,this._processLocInfo(h,i,t,!0,this._restFallback)];case 3:return[2,this._processLocInfo(h,null,null,!1,!1)]}})})},Nf.prototype._getHeadingDesc=function(e){var t=e.bearing;switch(t<0&&(t+=360),t=this._round(t,this._headingThreshold)){case 0:case 360:return"north";case 45:return"north east";case 90:return"east";case 135:return"south east";case 180:return"south";case 225:return"south west";case 270:return"west";case 315:return"north west";default:return"".concat(t," degrees")}},Nf.prototype._getClosestLabel=function(e,t,o,r,n){for(var i=e.radius,a=0,s=e.source.length;a<s;a++){var c={sourceLayer:e.source[a],filter:["has","name"]},u=this._map._getMap().querySourceFeatures(this._baseVectorTileSourceId,c),l=null,h=1/0,d=this._labelCache.has(e.labelType);if(!n||d)for(var p=0,f=u.length;p<f;p++){var g,m="Point"===u[p].geometry.type?u[p]:ul(t.center,u[p].geometry);n||(g="Point"===u[p].geometry.type?Du(t.center,m.geometry.coordinates):m.properties.distance)<h&&(h=g,l=u[p]),d&&Nf._labelCache.cache(u[p].properties.name,e,m.geometry.coordinates,o)}n||(c=e.labelType+"Dis",l&&h<=i&&("number"!=typeof r[c]||h<=r[c])&&(r[e.labelType]=l.properties.name,r[c]=h))}},Nf.prototype._processRoads=function(e,t,o,r){var n=this._map._getMap().queryRenderedFeatures(r,{filter:["==",["geometry-type"],"LineString"]});if(n){for(var i,a=void 0,s=void 0,c=void 0,u=void 0,l=0,h=n.length;l<h;l++)this._roadLayers.has(n[l].layer["source-layer"])&&n[l].properties.name&&""!==n[l].properties.name&&(i=ul(t.center,n[l]),!c||i.properties.distance<c.properties.distance)&&(a&&n[l].properties.name===a.properties.name?c=i:a&&n[l].properties.name===a.properties.name?(!u||i.properties.distance<u.properties.distance)&&(u=i,s=n[l]):(u=c,s=a,c=i,a=n[l]));a&&(!e.country&&a.properties.country_code&&(e.country=a.properties.country_code,e.countryDis=0,Nf._labelCache.cache(e.country,{source:[],labelType:"country",radius:5e3,minZoom:0},c.geometry.coordinates,o)),!e.state&&a.properties.country_subdivision&&(e.state=a.properties.country_subdivision,e.stateDis=0,Nf._labelCache.cache(e.state,{source:[],labelType:"state",radius:5e3,minZoom:4},c.geometry.coordinates,o)),15<=t.zoom)&&(r=this._map.positionsToPixels([t.center,c.geometry.coordinates]),(nu.getDistance(r[0],r[1])<this._roadPixelRadius||c.properties.distance<this._minRoadDistance)&&(e.road=a.properties.name),s)&&(o=this._map.positionsToPixels([u.geometry.coordinates]),nu.getDistance(r[0],o[0])<this._minIntersectionPixelDistance||u.properties.distance<this._minRoadDistance)&&(e.secondRoad=s.properties.name,e.secondRoadDis=u.properties.distance)}},Nf.prototype._getActionDesc=function(e){var t,o,r;return this._lastCam&&(t=[],this._checkLocThreshold(e.center,this._lastCam.center)&&(r=["panned"],0===(o=Math.round(Bu(this._lastCam.center,e.center)))||360===o?r.push("north"):o<90?r.push("north east"):90===o?r.push("east"):o<180?r.push("south east"):180===o?r.push("south"):o<270?r.push("south west"):270===o?r.push("west"):o<360&&r.push("north west"),o=Du(this._lastCam.center,e.center,uu.meters),r.push(1e3<o?"".concat(Mu(o/1e3,2)," kilometers"):"".concat(Mu(o,2)," meters")),t.push(r.join(" "))),this._checkZoomThreshold(e.zoom,this._lastCam.zoom)&&((r=["zoomed"]).push(this._lastCam.zoom<e.zoom?"in":"out"),1<=(o=Math.abs(this._lastCam.zoom-e.zoom))&&(o=Math.ceil(o),r.push("".concat(o,1<o?" levels":" level"))),this._getCanonicalZoom(this._lastCam.zoom)!==this._getCanonicalZoom(e.zoom)&&r.push("to ".concat(this._getCanonicalZoom(e.zoom)," level")),e.zoom>=e.maxZoom&&r.push("Zoom In button disabled, maximum zoom level reached"),o=f.getSouth(e.bounds)<=-_u&&f.getNorth(e.bounds)>=_u,(e.zoom<=e.minZoom||o)&&r.push("Zoom Out button disabled, minimum zoom level reached"),t.push(r.join(" "))),this._checkPitchThreshold(e.pitch,this._lastCam.pitch)&&(o=this._round(e.pitch,this._pitchThreshold),t.push("pitched to ".concat(o," degrees")),60!==e.pitch&&0!==e.pitch||(r=60===e.pitch?"maximum":"minimum",t.push("reached ".concat(r," of ").concat(e.pitch," degrees")))),this._checkHeadingThreshold(this._lastCam.bearing,e.bearing)&&t.push("rotated to ".concat(this._getHeadingDesc(e))),t.join(" and "))||null},Nf.prototype._getCanonicalZoom=function(e){return(e=this._round(e))<2?"world":e<5?"country":e<11?"state province":e<15?"city":"street"},Nf.prototype._processLocInfo=function(n,i,a,s,c){var u=this;return new Promise(function(t,e){var o=[];if(s){var r=[];if(a&&(i&&("water"===i&&a.water?r.push(a.water):"majorPoi"===i&&a.majorPoi&&r.push(a.majorPoi)),0===r.length)&&(a.majorPoi&&8<=n.zoom?r.push(a.majorPoi):(a.poi&&14<=n.zoom?r.push(a.poi):a.road&&15<=n.zoom&&(a.secondRoad?r.push(a.road+" & "+a.secondRoad):r.push(a.road)),a.neighbourhood&&12<=n.zoom&&r.push(a.neighbourhood),a.city&&6<=n.zoom&&r.push(a.city)),a.state&&4<=n.zoom&&r.push(a.state),0===r.length?a.water?r.push(a.water):a.country&&r.push(a.country):1===r.length&&a.state&&4<=n.zoom&&a.country&&r.push(a.country)),0<r.length)o.push("<p>Location: ",r.join(", "),".</p>");else if(c&&"water"!==i)return void u._reverseGeocodeDescription(n).then(function(e){t(e)},function(){e("<p>Location: unknown</p>")})}u._returnDetailedDescriptions&&(o.push("<p>Zoom: ",Mu(n.zoom,2),".</p>"),o.push("<p>Latitude: ",Mu(n.center[1],5),".</p>"),o.push("<p>Longitude: ",Mu(n.center[0],5),".</p>")),t(o.join(""))})},Nf.prototype._reverseGeocodeDescription=function(i){var a=this;return new Promise(function(r){var n=a._map.getStyle();a._reverseSearch.request({position:i.center,style:n}).then(function(e){var t,o={};e&&e.features&&0<e.features.length&&null!=(t=null==(t=e.features[0])?void 0:t.properties)&&t.address&&((t=e.features[0].properties.address).countryRegion&&(o.country=t.countryRegion.name,Nf._labelCache.cache(o.country,{source:[],labelType:"country",radius:5e3,minZoom:0},i.center,n.language)),t.adminDistricts&&(o.state=null==(e=t.adminDistricts[0])?void 0:e.shortName,Nf._labelCache.cache(o.state,{source:[],labelType:"state",radius:5e3,minZoom:4},i.center,n.language)),t.locality&&(o.city=t.locality,Nf._labelCache.cache(o.city,{source:[],labelType:"city",radius:1e3,minZoom:10},i.center,n.language)),t.addressLine)&&(o.road=t.addressLine),a._processLocInfo(i,null,o,!0,!1).then(function(e){r(e)})},function(e){a._processLocInfo(i,null,null,!0,!1).then(function(e){r(e)})}).catch(function(e){a._processLocInfo(i,null,null,!0,!1).then(function(e){r(e)})})})},Nf.prototype._round=function(e,t){return void 0===t&&(t=1),Math.round(e/t)*t},Nf._baseVectorTileSourceIds=["microsoft.base","vectorTiles","bing-mvt"],Nf._labelConfigBing=[{source:["water_feature"],labelType:"water",minZoom:0,radius:395e4,polygonSources:["generic_water_fill"]},{source:["water_feature"],labelType:"water",minZoom:3,radius:1e6,polygonSources:["generic_water_fill"]},{source:["country_region"],labelType:"country",minZoom:0,maxZoom:5,radius:3e5},{source:["admin_division1"],labelType:"state",minZoom:4,maxZoom:7,radius:3e5},{source:["populated_place"],labelType:"city",minZoom:8,radius:4e4},{source:["neighborhood"],labelType:"neighbourhood",minZoom:12,radius:6e3},{source:["amusement_park"],labelType:"poi",minZoom:14,radius:2e3,polygonSources:["amusement_park_fill"]},{source:["hospital"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["hospital_fill"]},{source:["shopping_center"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["shopping_center_fill"]},{source:["stadium"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["stadium_fill"]},{source:["higher_education_facility","school"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["higher_education_facility_fill","school_fill"]},{source:["zoo"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["zoo_fill"]},{source:["airport","airport_terminal"],labelType:"majorPoi",minZoom:11,radius:3e3,polygonSources:["airport_terminal_fill","airport_fill-merged7","airport_runway_fill"]},{source:["reserve"],labelType:"majorPoi",minZoom:7,radius:15e3,polygonSources:["generic_reserve_fill","land_cover_forest_fill"]}],Nf._roadLayersBing=new Set(["road"]),Nf);function Nf(e,t){var i=this;this._disposed=!1,this._lastHeadingTime=0,this._actionQueue=[],this._pointerUpdateDelay=3e3,this._camUpdateDelay=1e3,this._headUpdateLimit=1e3,this._controlEventDelay=500,this._moveThreshold=25,this._headingThreshold=5,this._pitchThreshold=5,this._roadPixelRadius=120,this._minRoadDistance=25,this._minIntersectionPixelDistance=50,this._labelConfig=[{source:["Ocean label","Ocean name"],labelType:"water",minZoom:0,radius:395e4,polygonSources:["Ocean","Ocean or sea"]},{source:["Sea label"],labelType:"water",minZoom:3,radius:1e6,polygonSources:["Sea","Ocean or sea"]},{source:["Country name"],labelType:"country",minZoom:0,maxZoom:5,radius:3e5},{source:["State name","State name short"],labelType:"state",minZoom:4,maxZoom:7,radius:3e5},{source:["Capital city","Large city"],labelType:"city",minZoom:8,radius:4e4},{source:["Medium city"],labelType:"city",minZoom:8,radius:3e4},{source:["Small city"],labelType:"city",minZoom:8,radius:2e4},{source:["Island label"],labelType:"city",minZoom:8,radius:1e4},{source:["Town"],labelType:"city",minZoom:10,radius:1e4},{source:["Village"],labelType:"neighbourhood",minZoom:12,radius:6e3},{source:["Amusement area label"],labelType:"poi",minZoom:14,radius:2e3,polygonSources:["Amusement park"]},{source:["Hospital label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["Hospital"]},{source:["Shopping centre label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["Shopping"]},{source:["Stadium label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["Stadium"]},{source:["University/School label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["University"]},{source:["Zoo label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["Zoo"]},{source:["Airport Label","Airport name","Airport POI"],labelType:"majorPoi",minZoom:11,radius:3e3,polygonSources:["Airport","Runway"]},{source:["National park label"],labelType:"majorPoi",minZoom:7,radius:15e3,polygonSources:["National or state park","National park","Forest"]},{source:["Reservation label"],labelType:"majorPoi",minZoom:7,radius:15e3,polygonSources:["Reservation"]}],this._labelCache=new Set(["city","state","country","water","majorPoi"]),this._roadLayers=new Set(["Connecting road","Connecting road tunnel","International road","International road tunnel","Local road","Local road tunnel","Major local road","Major local road tunnel","Major road","Major road tunnel","Minor local road","Minor local road tunnel","Motorway","Motorway tunnel","Secondary road","Secondary road tunnel","Toll connecting road","Toll connecting road tunnel","Toll international road","Toll international road tunnel","Toll local road","Toll local road tunnel","Toll major local road","Toll major local road tunnel","Toll major road","Toll major road tunnel","Toll minor local road","Toll minor local road tunnel","Toll motorway","Toll motorway tunnel","Toll secondary road","Toll secondary road tunnel"]),this._returnDetailedDescriptions=!1,this._shortcutListener=function(n){return Pf(i,void 0,void 0,function(){var t,o,r;return Of(this,function(e){switch(e.label){case 0:return n.altKey&&n.ctrlKey&&68===n.keyCode?(this._returnDetailedDescriptions=!this._returnDetailedDescriptions,r=this._map.getCamera(),o=this._map.getStyle(),t=o.language.toLowerCase(),o=o.style.toLowerCase(),[4,this._getLocDesc(r,t,o)]):[3,2];case 1:r=e.sent(),this._descCallback(r),e.label=2;case 2:return[2]}})})},this._onRotate=function(){i._rotateTimeout||(Date.now()-i._lastHeadingTime>=i._headUpdateLimit?i._rotateTimeout=setTimeout(i._updateHeading,so.RotationDuration+25):i._rotateTimeout=setTimeout(i._updateHeading,i._headUpdateLimit-(Date.now()-i._lastHeadingTime)))},this._onMove=function(){i._moveTimeout&&(clearTimeout(i._moveTimeout),delete i._moveTimeout),i._controlTimeout&&(clearTimeout(i._controlTimeout),delete i._controlTimeout)},this._onMoveEnd=function(e){e.fromControl?i._controlTimeout=setTimeout(i._updateCam,i._controlEventDelay):i._updateCam()},this._onStyleData=function(){setTimeout(i._updateStyle)},this._onPointerDown=function(e){i._lastPointerPos=i._getEventPos(e),i._pointerTimeout=setTimeout(function(){return Pf(i,void 0,void 0,function(){var t,o,r;return Of(this,function(e){switch(e.label){case 0:return o=this._map.getStyle(),t=o.language.toLowerCase(),o=o.style.toLowerCase(),(r=this._map.getCamera()).center=this._map.pixelsToPositions([this._lastPointerPos])[0],[4,this._getLocDesc(r,t,o)];case 1:return r=e.sent(),this._descCallback(r),this._onPointerUp(),[2]}})})},i._pointerUpdateDelay),i._map.getCanvas().addEventListener("mousemove",i._onPointerMove),i._map.getCanvas().addEventListener("touchmove",i._onPointerMove),i._map.getCanvas().addEventListener("mouseup",i._onPointerUp),i._map.getCanvas().addEventListener("touchend",i._onPointerUp)},this._onPointerMove=function(e){var e=i._getEventPos(e),t=i._lastPointerPos[0]-e[0],e=i._lastPointerPos[1]-e[1];Math.sqrt(t*t+e*e)>i._moveThreshold&&i._onPointerUp()},this._onPointerUp=function(){clearTimeout(i._pointerTimeout),delete i._pointerTimeout,i._map.getCanvas().removeEventListener("mousemove",i._onPointerMove),i._map.getCanvas().removeEventListener("touchmove",i._onPointerMove),i._map.getCanvas().removeEventListener("mouseup",i._onPointerUp),i._map.getCanvas().removeEventListener("touchend",i._onPointerUp)},this._updateHeading=function(){var e,t=i._map.getCamera();i._lastHead&&!i._checkHeadingThreshold(t.bearing,i._lastHead)||(e=i._getHeadingDesc(t),i._lastHead=t.bearing,i._descCallback("<p>Map heading ".concat(e,".</p>")),i._lastHeadingTime=Date.now()),delete i._rotateTimeout},this._updateStyle=function(){return Pf(i,void 0,void 0,function(){var t,o,r,n;return Of(this,function(e){switch(e.label){case 0:return(t=this._map.getCamera(),r=this._map.getStyle(),o=r.language.toLowerCase(),r=r.style.toLowerCase(),this._lastLang===o)?[3,2]:(Nf._labelCache._preloadCache(o),[4,this._getLocDesc(t,o,r)]);case 1:return n=e.sent(),[3,4];case 2:return this._lastStyle===r||"blank"!==this._lastStyle?[3,4]:[4,this._getLocDesc(t,o,r)];case 3:n=e.sent(),e.label=4;case 4:return this._lastLang=o,this._lastStyle=r,n&&this._descCallback(n),[2]}})})},this._updateCam=function(e){void 0===e&&(e=!1);var o,r,t,n=i._map.getCamera();(!i._lastCam||0<i._actionQueue.length||i._checkThresholds(n,i._lastCam))&&(t=i._map.getStyle(),o=t.language.toLowerCase(),r=t.style.toLowerCase(),(t=i._getActionDesc(n))&&i._actionQueue.push(t),i._lastCam=n,i._moveTimeout&&(clearTimeout(i._moveTimeout),delete i._moveTimeout),i._moveTimeout=setTimeout(function(){return Pf(i,void 0,void 0,function(){var t;return Of(this,function(e){switch(e.label){case 0:return clearTimeout(this._rotateTimeout),delete this._rotateTimeout,[4,this._getLocDesc(n,o,r)];case 1:return t=e.sent(),0<this._actionQueue.length?(this._descCallback("<p>Map ".concat(this._actionQueue.join(", then "),".</p>").concat(t)),this._actionQueue=[]):this._descCallback(t),[2]}})})},e?0:i._camUpdateDelay))},this._map=e,this._restFallback=e.getServiceOptions().enableAccessibilityLocationFallback,this._descCallback=t,this._reverseSearch=new Tf(e),Nf._labelCache||(Nf._labelCache=new kf),this._lastLang=this._map.getStyle().language.toLowerCase(),Nf._labelCache._preloadCache(this._lastLang),this._map.events.addOnce("idle",function(){var e;i._disposed||(i._updateCam(!0),i._baseVectorTileSourceId=Nf._baseVectorTileSourceIds.find(function(e){return i._map.sources.getById(e)}),"bing-mvt"===i._baseVectorTileSourceId&&(i._labelConfig=Nf._labelConfigBing,i._roadLayers=Nf._roadLayersBing),i._polygonStyleLayer=i._labelConfig.reduce(function(e,t){return t.polygonSources&&e.push.apply(e,xf([],Rf(t.polygonSources),!1)),e},[]),(e=i._map._getMap()).on("move",i._onMove),e.on("moveend",i._onMoveEnd),e.on("styledata",i._onStyleData),e.on("rotate",i._onRotate),(e=i._map.getCanvas()).addEventListener("mousedown",i._onPointerDown),e.addEventListener("touchstart",i._onPointerDown))}),this._map.getMapContainer().addEventListener("keydown",this._shortcutListener)}var Lf,Df,qf,Uf=function(e){var o=this;this.addToMap=function(){null==o.mapViewDesc&&(o.initializeMapLiveStateInfo(),o.initializeMapStyleInfo(),o.createMapKeyBindingInfo(),o.map.getMapContainer().setAttribute("role","application"),o.map.getMapContainer().setAttribute("aria-label","Map Application"),o.map.getCanvasContainer().setAttribute("aria-live","polite"),o.map.getCanvasContainer().setAttribute("aria-describedby","atlas-map-state atlas-map-style"),o.map.getCanvas().setAttribute("aria-label","Interactive Map"),o.map.getCanvas().setAttribute("aria-describedby","atlas-map-shortcuts"),o.map.getCanvas().setAttribute("alt","Interactive Map"))},this.removeFromMap=function(){null!=o.mapViewDesc&&o.mapViewDesc.dispose(),delete o.mapViewDesc,null!=o.atlasMapKeyBindings&&o.map.getCanvasContainer().removeChild(o.atlasMapKeyBindings),delete o.atlasMapKeyBindings,null!=o.atlasMapLiveStateInfo&&o.map.getCanvasContainer().removeChild(o.atlasMapLiveStateInfo),delete o.atlasMapLiveStateInfo,null!=o.atlasMapStyleInfo&&o.map.getCanvasContainer().removeChild(o.atlasMapStyleInfo),delete o.atlasMapStyleInfo,o.map.getMapContainer().removeAttribute("role"),o.map.getMapContainer().removeAttribute("aria-label"),o.map.getCanvasContainer().removeAttribute("aria-live"),o.map.getCanvasContainer().removeAttribute("aria-describedby"),o.map.getCanvas().removeAttribute("aria-label"),o.map.getCanvas().removeAttribute("aria-describedby"),o.map.getCanvas().removeAttribute("alt"),o.map.events.remove("stylechanged",o.updateMapStyle)},this.createMapKeyBindingInfo=function(){o.atlasMapKeyBindings=document.createElement("div"),o.atlasMapKeyBindings.setAttribute("tabindex","-1"),o.atlasMapKeyBindings.setAttribute("aria-hidden","true"),o.atlasMapKeyBindings.id="atlas-map-shortcuts",o.atlasMapKeyBindings.classList.add("hidden-accessible-element"),o.atlasMapKeyBindings.innerHTML=["Map shortcuts:","Zoom out: hyphen.","Zoom in: plus.","Pan right 100 pixels: right arrow.","Pan left 100 pixels: left arrow.","Pan up 100 pixels: up arrow.","Pan down 100 pixels: down arrow.","Rotate 15 degrees clockwise: shift + right arrow.","Rotate 15 degrees counter clockwise: shift + left arrow.","Increase pitch 10 degrees: shift + up arrow.","Decrease pitch 10 degrees: shift + down arrow.","Jump focus to the map: Escape."].join("\n"),o.map.getCanvasContainer().appendChild(o.atlasMapKeyBindings);var e=[189,187,38,37,39,40],t=o.map._getMap()._canvas;null!=t&&t.addEventListener("keyup",function(t){e.find(function(e){return t.keyCode===e})&&(o.atlasMapKeyBindings.innerHTML="")})},this.initializeMapLiveStateInfo=function(){o.mapViewDesc=new Mf(o.map,o.updateMapState),o.atlasMapLiveStateInfo=document.createElement("div"),o.atlasMapLiveStateInfo.setAttribute("tabindex","-1"),o.atlasMapLiveStateInfo.setAttribute("aria-hidden","true"),o.atlasMapLiveStateInfo.id="atlas-map-state",o.atlasMapLiveStateInfo.classList.add("hidden-accessible-element"),o.map.getCanvasContainer().appendChild(o.atlasMapLiveStateInfo)},this.initializeMapStyleInfo=function(){o.atlasMapStyleInfo=document.createElement("div"),o.atlasMapStyleInfo.setAttribute("tabindex","-1"),o.atlasMapStyleInfo.setAttribute("aria-hidden","true"),o.atlasMapStyleInfo.id="atlas-map-style",o.atlasMapStyleInfo.classList.add("hidden-accessible-element"),o.map.events.add("stylechanged",o.updateMapStyle),o.map.getCanvasContainer().appendChild(o.atlasMapStyleInfo)},this.updateMapStyle=function(){o.atlasMapStyleInfo.innerHTML="<p>Map style: ".concat(o.map.getStyle().style,".</p>")},this.updateMapState=function(e){o.atlasMapLiveStateInfo.innerHTML=e},this.map=e},jf=function(e){var o=this;this.listenerEnabled=!1,this.lastFlowMode="none",this.addToMap=function(){if(!o.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.");o.listenerEnabled||(o.map.events.add("styledata",o.addToMap),o.listenerEnabled=!0);var e,t=o.map.getTraffic();"none"!==t.flow&&(e=o.map.layers.getLayerById("traffic_".concat(t.flow)))&&(o.lastFlowMode=t.flow,e._updateLayoutProperty("visibility","visible","none"))},this.removeFromMap=function(){var e;o.map.getTraffic(),"none"!=o.lastFlowMode&&((e=o.map.layers.getLayerById("traffic_".concat(o.lastFlowMode)))&&e._updateLayoutProperty("visibility","none","visible"),o.lastFlowMode="none"),o.listenerEnabled&&(o.map.events.remove("styledata",o.addToMap),o.listenerEnabled=!1)},this.map=e},Hf=((window&&window.__extends||(Lf=function(e,t){return(Lf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Lf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Bf,Df=eu),Bf.getIncidentTypeName=function(e,t){switch(e){case 0:return t.Unknown;case 1:return t.Accident;case 2:return t.Fog;case 3:return t.Danger;case 4:return t.Rain;case 5:return t.Ice;case 6:return t.Jam;case 7:return t.LaneClosed;case 8:return t.RoadClosed;case 9:return t.RoadWorks;case 10:return t.Wind;case 11:return t.Flood;case 12:return t.Detour;default:return t.Unknown}},Bf.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"}},Bf.getSeverityColorName=function(e){switch(e){case 0:return"grey";case 1:return"yellow";case 2:return"orange";case 3:return"red";default:return"grey"}},Bf.getSeverityColorHexCode=function(e){switch(e){case 0:return"#B5B6B7";case 1:return"#F4C951";case 2:return"#F4873F";case 3:return"#F04F4E";default:return"#B5B6B7"}},Bf);function Bf(e,t,o){var r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=e.icon_category_12)?r:e.icon_category_11)?r:e.icon_category_10)?r:e.icon_category_9)?r:e.icon_category_8)?r:e.icon_category_7)?r:e.icon_category_6)?r:e.icon_category_5)?r:e.icon_category_4)?r:e.icon_category_3)?r:e.icon_category_2)?r:e.icon_category_1)?r:e.icon_category_0)?r:e.icon_category,n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=e.description_12)?n:e.description_11)?n:e.description_10)?n:e.description_9)?n:e.description_8)?n:e.description_7)?n:e.description_6)?n:e.description_5)?n:e.description_4)?n:e.description_3)?n:e.description_2)?n:e.description_1)?n:e.description_0)?n:e.description,r={icon:"".concat(Bf.getSeverityColorName(e.magnitude),"-").concat(Bf.getIncidentTypeIconName(r)),incidentType:Bf.getIncidentTypeName(r,o),description:n,delay:e.delay,color:Bf.getSeverityColorHexCode(e.magnitude),id:e.id};return Df.call(this,t,r)||this}(a=qf=qf||{}).DELAY="delay",a.LENGTH="length",a.FROM="from",a.TO="to";zf.build=function(e,t){void 0===t&&(t="en-US");var o,r=document.createElement("div"),n=(r.classList.add("incident-popup-title"),r.classList.add("font-segoeui-b"),r.innerText=e.properties.incidentType,r.setAttribute("aria-label","Incident Type ".concat(e.properties.incidentType)),document.createElement("div")),i=(n.classList.add("incident-popup-subtitle"),n.classList.add("font-segoeui-b"),n.setAttribute("aria-label","Incident Description ".concat(e.properties.description)),n.innerText=e.properties.description,document.createElement("div")),r=(i.classList.add("incident-popup-header"),i.style.backgroundColor=e.properties.color,i.appendChild(r),i.appendChild(n),document.createElement("div")),n=(r.classList.add("incident-popup-body"),e.properties.delay&&(n="".concat(Math.floor(e.properties.delay/60)," min"),n=this.createInfoSection(n,qf.DELAY),r.appendChild(n)),e.properties.length&&(n=new Intl.NumberFormat([t,"en-US"],{maximumFractionDigits:2}),o=void 0,o="en-US"===t?(t=Nu(e.properties.length,"meters","miles"),"".concat(n.format(t)," miles")):(t=Nu(e.properties.length,"meters","kilometers"),"".concat(n.format(t)," km")),n=this.createInfoSection(o,qf.LENGTH),r.appendChild(n)),e.properties.from&&(t=this.createInfoSection(e.properties.from,qf.FROM),r.appendChild(t)),e.properties.to&&(o=this.createInfoSection(e.properties.to,qf.TO),r.appendChild(o)),document.createElement("div"));return n.classList.add("incident-popup-content"),n.appendChild(i),n.appendChild(r),new tf({content:n,position:e.geometry.coordinates})},zf.createInfoSection=function(e,t){var o=document.createElement("div"),r=(o.classList.add("incident-popup-info"),document.createElement("div")),n=(r.classList.add("icon"),r.classList.add(t),document.createElement("span"));return n.classList.add("message"),n.classList.add("font-segoeui"),n.setAttribute("aria-label","Incident ".concat(t," ").concat(e)),n.innerText=e,o.appendChild(r),o.appendChild(n),o};var Ff=zf;function zf(){}var Kf=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},Gf=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},Yf=(Wf.prototype.getIncidentIconImageExpression=function(){return["concat",["let","magnitude",["get","magnitude"],["case",["==",["var","magnitude"],0],"grey",["==",["var","magnitude"],1],"yellow",["==",["var","magnitude"],2],"orange",["==",["var","magnitude"],3],"red",["==",["var","magnitude"],4],"grey","grey"]],"-",["let","category",["coalesce",["get","icon_category_12"],["get","icon_category_11"],["get","icon_category_10"],["get","icon_category_9"],["get","icon_category_8"],["get","icon_category_7"],["get","icon_category_6"],["get","icon_category_5"],["get","icon_category_4"],["get","icon_category_3"],["get","icon_category_2"],["get","icon_category_0"],["get","icon_category"],0],["case",["==",["var","category"],0],"unknown",["==",["var","category"],1],"accident",["==",["var","category"],2],"fog",["==",["var","category"],3],"danger",["==",["var","category"],4],"rain",["==",["var","category"],5],"ice",["==",["var","category"],6],"jam",["==",["var","category"],7],"lane-closed",["==",["var","category"],8],"road-closed",["==",["var","category"],9],"road-work",["==",["var","category"],10],"wind",["==",["var","category"],11],"flood",["==",["var","category"],12],"detour","unknown"]]]},Wf);function Wf(e){var n=this,e=(this.incidentLayerName="incidents",this.incidentSourceName="mapcontrol_traffic_incident",this.addToMap=function(){n.map.sources.getById(n.incidentSourceName)||n.map.sources.add(n.vectorTileSource),n.map.layers.getLayerById(n.incidentLayerName)||n.map.layers.add(n.incidentLayer,"labels"),n.clickPopup=new tf({position:[0,0],pixelOffset:[0,-18]}),n.map.addEventListener("mouseover",n.incidentLayerName,n.cursorToPointer),n.map.addEventListener("mouseleave",n.incidentLayerName,n.cursorToDefault),n.map.addEventListener("click",n.incidentLayerName,n.openIncidentPopup),n.map.events.addOnce("idle",n.setAccessiblePopups),n.map.events.add("moveend",n.setAccessiblePopups)},this.accessiblePopups=[],this.setAccessiblePopups=function(){return Kf(n,void 0,void 0,function(){var t,i,a,s,c,u,l=this;return Gf(this,function(e){switch(e.label){case 0:return this.accessiblePopups.forEach(function(e){return e.remove()}),this.accessiblePopups=[],t=this.map.layers.getRenderedShapes(this.map.getCamera().bounds,this.incidentLayer),[4,this.map._getLocalizedStrings()];case 1:return i=e.sent(),a=function(t,o){var e=t[o],r=e.geometry.coordinates,r=new au(new dl(r[0],r[1])),e=new Hf(e.properties,r,i),n=Ff.build(e,l.incidentLanguage),r=n.getPopupContainer();return r.addEventListener("focusin",function(e){l.clickPopup.remove(),l.accessiblePopups.filter(function(e){return e!==n}).forEach(function(e){return e.remove()}),0<=o-1&&s(n,a(t,o-1)),o+1<t.length&&u(a(t,o+1)),2<=o&&o==t.length-1&&c(a(t,0)),0==o&&2<=t.length&&u(a(t,t.length-1))}),o==t.length-1&&r.addEventListener("focusout",function(e){null===e.relatedTarget&&n.close()}),l.accessiblePopups.push(n),n},s=function(e,t){t.open(l.map),t.close();t=t.getPopupContainer(),e=e.getPopupContainer();e.parentElement.insertBefore(t,e)},c=function(e){e.open(l.map),e.close();var e=e.getPopupContainer(),t=e.parentElement;t.insertBefore(e,t.firstElementChild)},u=function(e){e.open(l.map),e.close()},0<t.length&&u(a(t,0)),1<t.length&&u(a(t,t.length-1)),[2]}})})},this.removeFromMap=function(){var e;n.map.removeEventListener("mouseover",n.incidentLayerName,n.cursorToPointer),n.map.removeEventListener("mouseleave",n.incidentLayerName,n.cursorToDefault),n.map.removeEventListener("click",n.incidentLayerName,n.openIncidentPopup),n.map.events.remove("idle",n.setAccessiblePopups),n.map.events.remove("moveend",n.setAccessiblePopups),n.accessiblePopups.forEach(function(e){return e.remove()}),n.accessiblePopups=[],null!=(e=n.clickPopup)&&e.remove(),null!=n.map.layers.getLayerById(n.incidentLayerName)&&n.map.layers.remove(n.incidentLayerName),null!=n.map.sources.getById(n.incidentSourceName)&&n.map.sources.remove(n.incidentSourceName)},this.cursorToPointer=function(e){n.map.getCanvas().style.cursor="pointer"},this.cursorToDefault=function(e){n.map.getCanvas().style.cursor=""},this.openIncidentPopup=function(e){n.clickPopup.remove(),n.accessiblePopups.forEach(function(e){return e.close()});var o=e.position,r=e.features[0];n.map._getLocalizedStrings().then(function(e){var t=new au(new dl(o[0],o[1])),t=new Hf(r.properties,t,e);n.clickPopup=Ff.build(t,n.incidentLanguage),n.clickPopup.open(n.map),n.clickPopup.getPopupContainer().addEventListener("focusout",function(e){null===e.relatedTarget&&n.clickPopup.close()})})},this.map=e,this.vectorTileSource=new yh(this.incidentSourceName,{maxZoom:22,tiles:["https://".concat(te,"/traffic/incident/tile/pbf?api-version=1.0&zoom={z}&x={x}&y={y}")]}),this.getIncidentIconImageExpression());this.incidentLayer=new vp(this.incidentSourceName,this.incidentLayerName,{sourceLayer:"Traffic incident POI",iconOptions:{ignorePlacement:!0,allowOverlap:!0,image:e,size:.75}})}(window&&window.__extends||(Zf=function(e,t){return(Zf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Zf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Jf,Qf=ye);var Zf,Qf,Vf=Jf;function Jf(){var e=null!==Qf&&Qf.apply(this,arguments)||this;return e.interactive=!0,e.scrollZoomInteraction=!0,e.boxZoomInteraction=!0,e.dragRotateInteraction=!0,e.dragPanInteraction=!0,e.keyboardInteraction=!0,e.dblClickZoomInteraction=!0,e.touchInteraction=!0,e.touchRotate=!0,e.wheelZoomRate=1/450,e}$f.prototype.enable=function(){this.map.getMapContainer().addEventListener("keydown",this._onKeyDown)},$f.prototype.disable=function(){this.map.getMapContainer().removeEventListener("keydown",this._onKeyDown)};var Xf=$f;function $f(e){var t=this;this._onKeyDown=function(e){27===e.keyCode&&t.map.getCanvas().focus()},this.map=e}tg.prototype.enable=function(){this.map.getCanvasContainer().addEventListener("gesturestart",this._onGestureStart),this.map.getCanvasContainer().addEventListener("gesturechange",this._onGestureChange),this.map.getCanvasContainer().addEventListener("touchstart",this._onTouchStart),this.map.getCanvasContainer().addEventListener("touchend",this._onTouchEnd)},tg.prototype.disable=function(){this.map.getCanvasContainer().removeEventListener("gesturestart",this._onGestureStart),this.map.getCanvasContainer().removeEventListener("gesturechange",this._onGestureChange),this.map.getCanvasContainer().removeEventListener("touchstart",this._onTouchStart),this.map.getCanvasContainer().removeEventListener("touchend",this._onTouchEnd)};var eg=tg;function tg(e){var t=this;this._onGestureStart=function(e){t.hasTouch||(e.preventDefault(),t.initZoom=t.map.getCamera().zoom)},this._onGestureChange=function(e){t.hasTouch||(e.preventDefault(),t.map.setCamera({zoom:t.initZoom+e.scale-1}))},this._onTouchStart=function(e){t.hasTouch=!0},this._onTouchEnd=function(e){0===e.touches.length&&(t.hasTouch=!1)},this.map=e}rg.prototype.addToMap=function(){this.added||(this.added=!0,this._setInteractions(this.options))},rg.prototype.removeFromMap=function(){this.added&&(this.added=!1,this._setInteractions({interactive:!1}))},rg.prototype.setOptions=function(e){this.options=(new Vf).merge(this.options,e),this.added&&this._setInteractions(this.options)},rg.prototype.getOptions=function(){return Object.assign({},this.options)},rg.prototype._setInteractions=function(e){var t;e.interactive?(e.boxZoomInteraction?this.map._getMap().boxZoom.enable():this.map._getMap().boxZoom.disable(),e.dblClickZoomInteraction?this.map._getMap().doubleClickZoom.enable():this.map._getMap().doubleClickZoom.disable(),e.dragPanInteraction?this.map._getMap().dragPan.enable():this.map._getMap().dragPan.disable(),e.dragRotateInteraction?this.map._getMap().dragRotate.enable():this.map._getMap().dragRotate.disable(),e.keyboardInteraction?(this.map._getMap().keyboard.enable(),this.focusShortcut.enable()):(this.map._getMap().keyboard.disable(),this.focusShortcut.disable()),e.scrollZoomInteraction?(this.map._getMap().scrollZoom.enable(),this.map._getMap().scrollZoom.setWheelZoomRate(e.wheelZoomRate)):this.map._getMap().scrollZoom.disable(),t=this.map._getMap().touchZoomRotate,e.touchInteraction?(t.enable(),e.touchRotate?t.enableRotation():t.disableRotation()):t.disable(),this.pinchZoom.enable()):(this.map._getMap().boxZoom.disable(),this.map._getMap().doubleClickZoom.disable(),this.map._getMap().dragPan.disable(),this.map._getMap().dragRotate.disable(),this.map._getMap().keyboard.disable(),this.focusShortcut.disable(),this.map._getMap().scrollZoom.disable(),this.map._getMap().touchZoomRotate.disable(),this.pinchZoom.disable())};var og=rg;function rg(e,t){this.added=!1,this.map=e,this.focusShortcut=new Xf(e),this.pinchZoom=new eg(e),this.options=(new Vf).merge(t)}function ng(e,t,o){var r={type:"Feature"};return 0!==(o=void 0===o?{}:o).id&&!o.id||(r.id=o.id),o.bbox&&(r.bbox=o.bbox),r.properties=t||{},r.geometry=e,r}function ig(e){return"Feature"===e.type?e.geometry:e}var ag=q(function(){function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function a(e,t,o){if(t)r(e.prototype,t);if(o)r(e,o);return e}var l=function(){function e(e,t){this.next=null;this.key=e;this.data=t;this.left=null;this.right=null}return e}();function t(e,t){return e>t?1:e<t?-1:0}function s(e,t,o){var r=new l(null,null);var n=r;var i=r;while(true){var a=o(e,t.key);if(a<0){if(t.left===null)break;if(o(e,t.left.key)<0){var s=t.left;t.left=s.right;s.right=t;t=s;if(t.left===null)break}i.left=t;i=t;t=t.left}else if(a>0){if(t.right===null)break;if(o(e,t.right.key)>0){var s=t.right;t.right=s.left;s.left=t;t=s;if(t.right===null)break}n.right=t;n=t;t=t.right}else break}n.right=t.left;i.left=t.right;t.left=r.right;t.right=r.left;return t}function c(e,t,o,r){var n=new l(e,t);if(o===null){n.left=n.right=null;return n}o=s(e,o,r);var i=r(e,o.key);if(i<0){n.left=o.left;n.right=o;o.left=null}else if(i>=0){n.right=o.right;n.left=o;o.right=null}return n}function h(e,t,o){var r=null;var n=null;if(t){t=s(e,t,o);var i=o(t.key,e);if(i===0){r=t.left;n=t.right}else if(i<0){n=t.right;t.right=null;r=t}else{r=t.left;t.left=null;n=t}}return{left:r,right:n}}function d(e,t,o){if(t===null)return e;if(e===null)return t;t=s(e.key,t,o);t.left=e;return t}function p(e,t,o,r,n){if(e){r(""+t+(o?"└── ":"├── ")+n(e)+"\n");var i=t+(o?" ":"│ ");if(e.left)p(e.left,i,false,r,n);if(e.right)p(e.right,i,true,r,n)}}var R=function(){function e(e){if(e===void 0)e=t;this._root=null;this._size=0;this._comparator=e}e.prototype.insert=function(e,t){this._size++;return this._root=c(e,t,this._root,this._comparator)};e.prototype.add=function(e,t){var o=new l(e,t);if(this._root===null){o.left=o.right=null;this._size++;this._root=o}var r=this._comparator;var n=s(e,this._root,r);var i=r(e,n.key);if(i===0)this._root=n;else{if(i<0){o.left=n.left;o.right=n;n.left=null}else if(i>0){o.right=n.right;o.left=n;n.right=null}this._size++;this._root=o}return this._root};e.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)};e.prototype._remove=function(e,t,o){var r;if(t===null)return null;t=s(e,t,o);var n=o(e,t.key);if(n===0){if(t.left===null)r=t.right;else{r=s(e,t.left,o);r.right=t.right}this._size--;return r}return t};e.prototype.pop=function(){var e=this._root;if(e){while(e.left)e=e.left;this._root=s(e.key,this._root,this._comparator);this._root=this._remove(e.key,this._root,this._comparator);return{key:e.key,data:e.data}}return null};e.prototype.findStatic=function(e){var t=this._root;var o=this._comparator;while(t){var r=o(e,t.key);if(r===0)return t;else if(r<0)t=t.left;else t=t.right}return null};e.prototype.find=function(e){if(this._root){this._root=s(e,this._root,this._comparator);if(this._comparator(e,this._root.key)!==0)return null}return this._root};e.prototype.contains=function(e){var t=this._root;var o=this._comparator;while(t){var r=o(e,t.key);if(r===0)return true;else if(r<0)t=t.left;else t=t.right}return false};e.prototype.forEach=function(e,t){var o=this._root;var r=[];var n=false;while(!n)if(o!==null){r.push(o);o=o.left}else if(r.length!==0){o=r.pop();e.call(t,o);o=o.right}else n=true;return this};e.prototype.range=function(e,t,o,r){var n=[];var i=this._comparator;var a=this._root;var s;while(n.length!==0||a)if(a){n.push(a);a=a.left}else{a=n.pop();s=i(a.key,t);if(s>0)break;else if(i(a.key,e)>=0)if(o.call(r,a))return this;a=a.right}return this};e.prototype.keys=function(){var o=[];this.forEach(function(e){var t=e.key;return o.push(t)});return o};e.prototype.values=function(){var o=[];this.forEach(function(e){var t=e.data;return o.push(t)});return o};e.prototype.min=function(){if(this._root)return this.minNode(this._root).key;return null};e.prototype.max=function(){if(this._root)return this.maxNode(this._root).key;return null};e.prototype.minNode=function(e){if(e===void 0)e=this._root;if(e)while(e.left)e=e.left;return e};e.prototype.maxNode=function(e){if(e===void 0)e=this._root;if(e)while(e.right)e=e.right;return e};e.prototype.at=function(e){var t=this._root;var o=false;var r=0;var n=[];while(!o)if(t){n.push(t);t=t.left}else if(n.length>0){t=n.pop();if(r===e)return t;r++;t=t.right}else o=true;return null};e.prototype.next=function(e){var t=this._root;var o=null;if(e.right){o=e.right;while(o.left)o=o.left;return o}var r=this._comparator;while(t){var n=r(e.key,t.key);if(n===0)break;else if(n<0){o=t;t=t.left}else t=t.right}return o};e.prototype.prev=function(e){var t=this._root;var o=null;if(e.left!==null){o=e.left;while(o.right)o=o.right;return o}var r=this._comparator;while(t){var n=r(e.key,t.key);if(n===0)break;else if(n<0)t=t.left;else{o=t;t=t.right}}return o};e.prototype.clear=function(){this._root=null;this._size=0;return this};e.prototype.toList=function(){return o(this._root)};e.prototype.load=function(e,t,o){if(t===void 0)t=[];if(o===void 0)o=false;var r=e.length;var n=this._comparator;if(o)v(e,t,0,r-1,n);if(this._root===null){this._root=f(e,t,0,r);this._size=r}else{var i=y(this.toList(),g(e,t),n);r=this._size+r;this._root=m({head:i},0,r)}return this};e.prototype.isEmpty=function(){return this._root===null};Object.defineProperty(e.prototype,"size",{get:function e(){return this._size},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"root",{get:function e(){return this._root},enumerable:true,configurable:true});e.prototype.toString=function(e){if(e===void 0)e=function e(t){return String(t.key)};var t=[];p(this._root,"",true,function(e){return t.push(e)},e);return t.join("")};e.prototype.update=function(e,t,o){var r=this._comparator;var n=h(e,this._root,r),i=n.left,a=n.right;if(r(e,t)<0)a=c(t,o,a,r);else i=c(t,o,i,r);this._root=d(i,a,r)};e.prototype.split=function(e){return h(e,this._root,this._comparator)};return e}();function f(e,t,o,r){var n=r-o;if(n>0){var i=o+Math.floor(n/2);var a=e[i];var s=t[i];var c=new l(a,s);c.left=f(e,t,o,i);c.right=f(e,t,i+1,r);return c}return null}function g(e,t){var o=new l(null,null);var r=o;for(var n=0;n<e.length;n++)r=r.next=new l(e[n],t[n]);r.next=null;return o.next}function o(e){var t=e;var o=[];var r=false;var n=new l(null,null);var i=n;while(!r)if(t){o.push(t);t=t.left}else if(o.length>0){t=i=i.next=o.pop();t=t.right}else r=true;i.next=null;return n.next}function m(e,t,o){var r=o-t;if(r>0){var n=t+Math.floor(r/2);var i=m(e,t,n);var a=e.head;a.left=i;e.head=e.head.next;a.right=m(e,n+1,o);return a}return null}function y(e,t,o){var r=new l(null,null);var n=r;var i=e;var a=t;while(i!==null&&a!==null){if(o(i.key,a.key)<0){n.next=i;i=i.next}else{n.next=a;a=a.next}n=n.next}if(i!==null)n.next=i;else if(a!==null)n.next=a;return r.next}function v(e,t,o,r,n){if(o>=r)return;var i=e[o+r>>1];var a=o-1;var s=r+1;while(true){do{a++}while(n(e[a],i)<0);do{s--}while(n(e[s],i)>0);if(a>=s)break;var c=e[a];e[a]=e[s];e[s]=c;c=t[a];t[a]=t[s];t[s]=c}v(e,t,o,s,n);v(e,t,s+1,r,n)}var _=function e(t,o){return t.ll.x<=o.x&&o.x<=t.ur.x&&t.ll.y<=o.y&&o.y<=t.ur.y},x=function e(t,o){if(o.ur.x<t.ll.x||t.ur.x<o.ll.x||o.ur.y<t.ll.y||t.ur.y<o.ll.y)return null;var r=t.ll.x<o.ll.x?o.ll.x:t.ll.x;var n=t.ur.x<o.ur.x?t.ur.x:o.ur.x;var i=t.ll.y<o.ll.y?o.ll.y:t.ll.y;var a=t.ur.y<o.ur.y?t.ur.y:o.ur.y;return{ll:{x:r,y:i},ur:{x:n,y:a}}},n=Number.EPSILON;if(n===undefined)n=Math.pow(2,-52);var O=n*n,w=function e(t,o){if(-n<t&&t<n)if(-n<o&&o<n)return 0;var r=t-o;if(r*r<O*t*o)return 0;return t<o?-1:1},e=function(){function e(){u(this,e);this.reset()}a(e,[{key:"reset",value:function e(){this.xRounder=new i;this.yRounder=new i}},{key:"round",value:function e(t,o){return{x:this.xRounder.round(t),y:this.yRounder.round(o)}}}]);return e}(),i=function(){function e(){u(this,e);this.tree=new R;this.round(0)}a(e,[{key:"round",value:function e(t){var o=this.tree.add(t);var r=this.tree.prev(o);if(r!==null&&w(o.key,r.key)===0){this.tree.remove(t);return r.key}var n=this.tree.next(o);if(n!==null&&w(o.key,n.key)===0){this.tree.remove(t);return n.key}return t}}]);return e}(),M=new e,b=function e(t,o){return t.x*o.y-t.y*o.x},C=function e(t,o){return t.x*o.x+t.y*o.y},E=function e(t,o,r){var n={x:o.x-t.x,y:o.y-t.y};var i={x:r.x-t.x,y:r.y-t.y};var a=b(n,i);return w(a,0)},S=function e(t){return Math.sqrt(C(t,t))},U=function e(t,o,r){var n={x:o.x-t.x,y:o.y-t.y};var i={x:r.x-t.x,y:r.y-t.y};return b(i,n)/S(i)/S(n)},j=function e(t,o,r){var n={x:o.x-t.x,y:o.y-t.y};var i={x:r.x-t.x,y:r.y-t.y};return C(i,n)/S(i)/S(n)},T=function e(t,o,r){if(o.y===0)return null;return{x:t.x+o.x/o.y*(r-t.y),y:r}},I=function e(t,o,r){if(o.x===0)return null;return{x:r,y:t.y+o.y/o.x*(r-t.x)}},H=function e(t,o,r,n){if(o.x===0)return I(r,n,t.x);if(n.x===0)return I(t,o,r.x);if(o.y===0)return T(r,n,t.y);if(n.y===0)return T(t,o,r.y);var i=b(o,n);if(i==0)return null;var a={x:r.x-t.x,y:r.y-t.y};var s=b(a,o)/i;var c=b(a,n)/i;var u=t.x+c*o.x,l=r.x+s*n.x;var h=t.y+c*o.y,d=r.y+s*n.y;var p=(u+l)/2;var f=(h+d)/2;return{x:p,y:f}},N=function(){a(n,null,[{key:"compare",value:function e(t,o){var r=n.comparePoints(t.point,o.point);if(r!==0)return r;if(t.point!==o.point)t.link(o);if(t.isLeft!==o.isLeft)return t.isLeft?1:-1;return k.compare(t.segment,o.segment)}},{key:"comparePoints",value:function e(t,o){if(t.x<o.x)return-1;if(t.x>o.x)return 1;if(t.y<o.y)return-1;if(t.y>o.y)return 1;return 0}}]);function n(e,t){u(this,n);if(e.events===undefined)e.events=[this];else e.events.push(this);this.point=e;this.isLeft=t}a(n,[{key:"link",value:function e(t){if(t.point===this.point)throw new Error("Tried to link already linked events");var o=t.point.events;for(var r=0,n=o.length;r<n;r++){var i=o[r];this.point.events.push(i);i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function e(){var t=this.point.events.length;for(var o=0;o<t;o++){var r=this.point.events[o];if(r.segment.consumedBy!==undefined)continue;for(var n=o+1;n<t;n++){var i=this.point.events[n];if(i.consumedBy!==undefined)continue;if(r.otherSE.point.events!==i.otherSE.point.events)continue;r.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function e(){var t=[];for(var o=0,r=this.point.events.length;o<r;o++){var n=this.point.events[o];if(n!==this&&!n.segment.ringOut&&n.segment.isInResult())t.push(n)}return t}},{key:"getLeftmostComparator",value:function e(r){var n=this;var c=new Map;var u=function e(t){var o=t.otherSE;c.set(t,{sine:U(n.point,r.point,o.point),cosine:j(n.point,r.point,o.point)})};return function(e,t){if(!c.has(e))u(e);if(!c.has(t))u(t);var o=c.get(e),r=o.sine,n=o.cosine;var i=c.get(t),a=i.sine,s=i.cosine;if(r>=0&&a>=0){if(n<s)return 1;if(n>s)return-1;return 0}if(r<0&&a<0){if(n<s)return-1;if(n>s)return 1;return 0}if(a<r)return-1;if(a>r)return 1;return 0}}}]);return n}(),B=0,k=function(){a(d,null,[{key:"compare",value:function e(t,o){var r=t.leftSE.point.x;var n=o.leftSE.point.x;var i=t.rightSE.point.x;var a=o.rightSE.point.x;if(a<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y;var c=o.leftSE.point.y;var u=t.rightSE.point.y;var l=o.rightSE.point.y;if(r<n){if(c<s&&c<u)return 1;if(c>s&&c>u)return-1;var h=t.comparePoint(o.leftSE.point);if(h<0)return 1;if(h>0)return-1;var d=o.comparePoint(t.rightSE.point);if(d!==0)return d;return-1}if(r>n){if(s<c&&s<l)return-1;if(s>c&&s>l)return 1;var p=o.comparePoint(t.leftSE.point);if(p!==0)return p;var f=t.comparePoint(o.rightSE.point);if(f<0)return 1;if(f>0)return-1;return 1}if(s<c)return-1;if(s>c)return 1;if(i<a){var g=o.comparePoint(t.rightSE.point);if(g!==0)return g}if(i>a){var m=t.comparePoint(o.rightSE.point);if(m<0)return 1;if(m>0)return-1}if(i!==a){var y=u-s;var v=i-r;var _=l-c;var w=a-n;if(y>v&&_<w)return 1;if(y<v&&_>w)return-1}if(i>a)return 1;if(i<a)return-1;if(u<l)return-1;if(u>l)return 1;if(t.id<o.id)return-1;if(t.id>o.id)return 1;return 0}}]);function d(e,t,o,r){u(this,d);this.id=++B;this.leftSE=e;e.segment=this;e.otherSE=t;this.rightSE=t;t.segment=this;t.otherSE=e;this.rings=o;this.windings=r}a(d,[{key:"replaceRightSE",value:function e(t){this.rightSE=t;this.rightSE.segment=this;this.rightSE.otherSE=this.leftSE;this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function e(){var t=this.leftSE.point.y;var o=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<o?t:o},ur:{x:this.rightSE.point.x,y:t>o?t:o}}}},{key:"vector",value:function e(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function e(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function e(t){if(this.isAnEndpoint(t))return 0;var o=this.leftSE.point;var r=this.rightSE.point;var n=this.vector();if(o.x===r.x){if(t.x===o.x)return 0;return t.x<o.x?1:-1}var i=(t.y-o.y)/n.y;var a=o.x+i*n.x;if(t.x===a)return 0;var s=(t.x-o.x)/n.x;var c=o.y+s*n.y;if(t.y===c)return 0;return t.y<c?-1:1}},{key:"getIntersection",value:function e(t){var o=this.bbox();var r=t.bbox();var n=x(o,r);if(n===null)return null;var i=this.leftSE.point;var a=this.rightSE.point;var s=t.leftSE.point;var c=t.rightSE.point;var u=_(o,s)&&this.comparePoint(s)===0;var l=_(r,i)&&t.comparePoint(i)===0;var h=_(o,c)&&this.comparePoint(c)===0;var d=_(r,a)&&t.comparePoint(a)===0;if(l&&u){if(d&&!h)return a;if(!d&&h)return c;return null}if(l){if(h)if(i.x===c.x&&i.y===c.y)return null;return i}if(u){if(d)if(a.x===s.x&&a.y===s.y)return null;return s}if(d&&h)return null;if(d)return a;if(h)return c;var p=H(i,this.vector(),s,t.vector());if(p===null)return null;if(!_(n,p))return null;return M.round(p.x,p.y)}},{key:"split",value:function e(t){var o=[];var r=t.events!==undefined;var n=new N(t,true);var i=new N(t,false);var a=this.rightSE;this.replaceRightSE(i);o.push(i);o.push(n);var s=new d(n,a,this.rings.slice(),this.windings.slice());if(N.comparePoints(s.leftSE.point,s.rightSE.point)>0)s.swapEvents();if(N.comparePoints(this.leftSE.point,this.rightSE.point)>0)this.swapEvents();if(r){n.checkForConsuming();i.checkForConsuming()}return o}},{key:"swapEvents",value:function e(){var t=this.rightSE;this.rightSE=this.leftSE;this.leftSE=t;this.leftSE.isLeft=true;this.rightSE.isLeft=false;for(var o=0,r=this.windings.length;o<r;o++)this.windings[o]*=-1}},{key:"consume",value:function e(t){var o=this;var r=t;while(o.consumedBy)o=o.consumedBy;while(r.consumedBy)r=r.consumedBy;var n=d.compare(o,r);if(n===0)return;if(n>0){var i=o;o=r;r=i}if(o.prev===r){var a=o;o=r;r=a}for(var s=0,c=r.rings.length;s<c;s++){var u=r.rings[s];var l=r.windings[s];var h=o.rings.indexOf(u);if(h===-1){o.rings.push(u);o.windings.push(l)}else o.windings[h]+=l}r.rings=null;r.windings=null;r.consumedBy=o;r.leftSE.consumedBy=o.leftSE;r.rightSE.consumedBy=o.rightSE}},{key:"prevInResult",value:function e(){if(this._prevInResult!==undefined)return this._prevInResult;if(!this.prev)this._prevInResult=null;else if(this.prev.isInResult())this._prevInResult=this.prev;else this._prevInResult=this.prev.prevInResult();return this._prevInResult}},{key:"beforeState",value:function e(){if(this._beforeState!==undefined)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}},{key:"afterState",value:function e(){if(this._afterState!==undefined)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};var o=this._afterState.rings;var r=this._afterState.windings;var n=this._afterState.multiPolys;for(var i=0,a=this.rings.length;i<a;i++){var s=this.rings[i];var c=this.windings[i];var u=o.indexOf(s);if(u===-1){o.push(s);r.push(c)}else r[u]+=c}var l=[];var h=[];for(var d=0,p=o.length;d<p;d++){if(r[d]===0)continue;var f=o[d];var g=f.poly;if(h.indexOf(g)!==-1)continue;if(f.isExterior)l.push(g);else{if(h.indexOf(g)===-1)h.push(g);var m=l.indexOf(f.poly);if(m!==-1)l.splice(m,1)}}for(var y=0,v=l.length;y<v;y++){var _=l[y].multiPoly;if(n.indexOf(_)===-1)n.push(_)}return this._afterState}},{key:"isInResult",value:function e(){if(this.consumedBy)return false;if(this._isInResult!==undefined)return this._isInResult;var t=this.beforeState().multiPolys;var o=this.afterState().multiPolys;switch(q.type){case"union":{var r=t.length===0;var n=o.length===0;this._isInResult=r!==n;break}case"intersection":{var i;var a;if(t.length<o.length){i=t.length;a=o.length}else{i=o.length;a=t.length}this._isInResult=a===q.numMultiPolys&&i<a;break}case"xor":{var s=Math.abs(t.length-o.length);this._isInResult=s%2===1;break}case"difference":{var c=function e(t){return t.length===1&&t[0].isSubject};this._isInResult=c(t)!==c(o);break}default:throw new Error("Unrecognized operation type found ".concat(q.type))}return this._isInResult}}],[{key:"fromRing",value:function e(t,o,r){var n,i,a;var s=N.comparePoints(t,o);if(s<0){n=t;i=o;a=1}else if(s>0){n=o;i=t;a=-1}else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var c=new N(n,true);var u=new N(i,false);return new d(c,u,[r],[a])}}]);return d}(),A=function(){function c(e,t,o){u(this,c);if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.poly=t;this.isExterior=o;this.segments=[];if(typeof e[0][0]!=="number"||typeof e[0][1]!=="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var r=M.round(e[0][0],e[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};var n=r;for(var i=1,a=e.length;i<a;i++){if(typeof e[i][0]!=="number"||typeof e[i][1]!=="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var s=M.round(e[i][0],e[i][1]);if(s.x===n.x&&s.y===n.y)continue;this.segments.push(k.fromRing(n,s,this));if(s.x<this.bbox.ll.x)this.bbox.ll.x=s.x;if(s.y<this.bbox.ll.y)this.bbox.ll.y=s.y;if(s.x>this.bbox.ur.x)this.bbox.ur.x=s.x;if(s.y>this.bbox.ur.y)this.bbox.ur.y=s.y;n=s}if(r.x!==n.x||r.y!==n.y)this.segments.push(k.fromRing(n,r,this))}a(c,[{key:"getSweepEvents",value:function e(){var t=[];for(var o=0,r=this.segments.length;o<r;o++){var n=this.segments[o];t.push(n.leftSE);t.push(n.rightSE)}return t}}]);return c}(),F=function(){function i(e,t){u(this,i);if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new A(e[0],this,true);this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}};this.interiorRings=[];for(var o=1,r=e.length;o<r;o++){var n=new A(e[o],this,false);if(n.bbox.ll.x<this.bbox.ll.x)this.bbox.ll.x=n.bbox.ll.x;if(n.bbox.ll.y<this.bbox.ll.y)this.bbox.ll.y=n.bbox.ll.y;if(n.bbox.ur.x>this.bbox.ur.x)this.bbox.ur.x=n.bbox.ur.x;if(n.bbox.ur.y>this.bbox.ur.y)this.bbox.ur.y=n.bbox.ur.y;this.interiorRings.push(n)}this.multiPoly=t}a(i,[{key:"getSweepEvents",value:function e(){var t=this.exteriorRing.getSweepEvents();for(var o=0,r=this.interiorRings.length;o<r;o++){var n=this.interiorRings[o].getSweepEvents();for(var i=0,a=n.length;i<a;i++)t.push(n[i])}return t}}]);return i}(),L=function(){function i(e,t){u(this,i);if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{if(typeof e[0][0][0]==="number")e=[e]}catch(e){}this.polys=[];this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var o=0,r=e.length;o<r;o++){var n=new F(e[o],this);if(n.bbox.ll.x<this.bbox.ll.x)this.bbox.ll.x=n.bbox.ll.x;if(n.bbox.ll.y<this.bbox.ll.y)this.bbox.ll.y=n.bbox.ll.y;if(n.bbox.ur.x>this.bbox.ur.x)this.bbox.ur.x=n.bbox.ur.x;if(n.bbox.ur.y>this.bbox.ur.y)this.bbox.ur.y=n.bbox.ur.y;this.polys.push(n)}this.isSubject=t}a(i,[{key:"getSweepEvents",value:function e(){var t=[];for(var o=0,r=this.polys.length;o<r;o++){var n=this.polys[o].getSweepEvents();for(var i=0,a=n.length;i<a;i++)t.push(n[i])}return t}}]);return i}(),z=function(){a(b,null,[{key:"factory",value:function e(t){var o=[];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(!i.isInResult()||i.ringOut)continue;var a=null;var s=i.leftSE;var c=i.rightSE;var u=[s];var l=s.point;var h=[];while(true){a=s;s=c;u.push(s);if(s.point===l)break;while(true){var d=s.getAvailableLinkedEvents();if(d.length===0){var p=u[0].point;var f=u[u.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(f.x,", ").concat(f.y,"]."))}if(d.length===1){c=d[0].otherSE;break}var g=null;for(var m=0,y=h.length;m<y;m++)if(h[m].point===s.point){g=m;break}if(g!==null){var v=h.splice(g)[0];var _=u.splice(v.index);_.unshift(_[0].otherSE);o.push(new b(_.reverse()));continue}h.push({index:u.length,point:s.point});var w=s.getLeftmostComparator(a);c=d.sort(w)[0].otherSE;break}}o.push(new b(u))}return o}}]);function b(e){u(this,b);this.events=e;for(var t=0,o=e.length;t<o;t++)e[t].segment.ringOut=this;this.poly=null}a(b,[{key:"getGeom",value:function e(){var t=this.events[0].point;var o=[t];for(var r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point;var a=this.events[r+1].point;if(E(i,t,a)===0)continue;o.push(i);t=i}if(o.length===1)return null;var s=o[0];var c=o[1];if(E(s,t,c)===0)o.shift();o.push(o[0]);var u=this.isExteriorRing()?1:-1;var l=this.isExteriorRing()?0:o.length-1;var h=this.isExteriorRing()?o.length:-1;var d=[];for(var p=l;p!=h;p+=u)d.push([o[p].x,o[p].y]);return d}},{key:"isExteriorRing",value:function e(){if(this._isExteriorRing===undefined){var t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():true}return this._isExteriorRing}},{key:"enclosingRing",value:function e(){if(this._enclosingRing===undefined)this._enclosingRing=this._calcEnclosingRing();return this._enclosingRing}},{key:"_calcEnclosingRing",value:function e(){var t=this.events[0];for(var o=1,r=this.events.length;o<r;o++){var n=this.events[o];if(N.compare(t,n)>0)t=n}var i=t.segment.prevInResult();var a=i?i.prevInResult():null;while(true){if(!i)return null;if(!a)return i.ringOut;if(a.ringOut!==i.ringOut)if(a.ringOut.enclosingRing()!==i.ringOut)return i.ringOut;else return i.ringOut.enclosingRing();i=a.prevInResult();a=i?i.prevInResult():null}}}]);return b}(),P=function(){function t(e){u(this,t);this.exteriorRing=e;e.poly=this;this.interiorRings=[]}a(t,[{key:"addInterior",value:function e(t){this.interiorRings.push(t);t.poly=this}},{key:"getGeom",value:function e(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var o=0,r=this.interiorRings.length;o<r;o++){var n=this.interiorRings[o].getGeom();if(n===null)continue;t.push(n)}return t}}]);return t}(),K=function(){function t(e){u(this,t);this.rings=e;this.polys=this._composePolys(e)}a(t,[{key:"getGeom",value:function e(){var t=[];for(var o=0,r=this.polys.length;o<r;o++){var n=this.polys[o].getGeom();if(n===null)continue;t.push(n)}return t}},{key:"_composePolys",value:function e(t){var o=[];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(i.poly)continue;if(i.isExteriorRing())o.push(new P(i));else{var a=i.enclosingRing();if(!a.poly)o.push(new P(a));a.poly.addInterior(i)}}return o}}]);return t}(),G=function(){function o(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:k.compare;u(this,o);this.queue=e;this.tree=new R(t);this.segments=[]}a(o,[{key:"process",value:function e(t){var o=t.segment;var r=[];if(t.consumedBy){if(t.isLeft)this.queue.remove(t.otherSE);else this.tree.remove(o);return r}var n=t.isLeft?this.tree.insert(o):this.tree.find(o);if(!n)throw new Error("Unable to find segment #".concat(o.id," ")+"[".concat(o.leftSE.point.x,", ").concat(o.leftSE.point.y,"] -> ")+"[".concat(o.rightSE.point.x,", ").concat(o.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");var i=n;var a=n;var s=undefined;var c=undefined;while(s===undefined){i=this.tree.prev(i);if(i===null)s=null;else if(i.key.consumedBy===undefined)s=i.key}while(c===undefined){a=this.tree.next(a);if(a===null)c=null;else if(a.key.consumedBy===undefined)c=a.key}if(t.isLeft){var u=null;if(s){var l=s.getIntersection(o);if(l!==null){if(!o.isAnEndpoint(l))u=l;if(!s.isAnEndpoint(l)){var h=this._splitSafely(s,l);for(var d=0,p=h.length;d<p;d++)r.push(h[d])}}}var f=null;if(c){var g=c.getIntersection(o);if(g!==null){if(!o.isAnEndpoint(g))f=g;if(!c.isAnEndpoint(g)){var m=this._splitSafely(c,g);for(var y=0,v=m.length;y<v;y++)r.push(m[y])}}}if(u!==null||f!==null){var _=null;if(u===null)_=f;else if(f===null)_=u;else{var w=N.comparePoints(u,f);_=w<=0?u:f}this.queue.remove(o.rightSE);r.push(o.rightSE);var b=o.split(_);for(var C=0,E=b.length;C<E;C++)r.push(b[C])}if(r.length>0){this.tree.remove(o);r.push(t)}else{this.segments.push(o);o.prev=s}}else{if(s&&c){var S=s.getIntersection(c);if(S!==null){if(!s.isAnEndpoint(S)){var T=this._splitSafely(s,S);for(var I=0,k=T.length;I<k;I++)r.push(T[I])}if(!c.isAnEndpoint(S)){var A=this._splitSafely(c,S);for(var P=0,O=A.length;P<O;P++)r.push(A[P])}}}this.tree.remove(o)}return r}},{key:"_splitSafely",value:function e(t,o){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(o);n.push(r);if(t.consumedBy===undefined)this.tree.insert(t);return n}}]);return o}(),D=typeof process!=="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Y=typeof process!=="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,W,q=new(function(){function e(){u(this,e)}a(e,[{key:"run",value:function e(t,o,r){q.type=t;M.reset();var n=[new L(o,true)];for(var i=0,a=r.length;i<a;i++)n.push(new L(r[i],false));q.numMultiPolys=n.length;if(q.type==="difference"){var s=n[0];var c=1;while(c<n.length)if(x(n[c].bbox,s.bbox)!==null)c++;else n.splice(c,1)}if(q.type==="intersection")for(var u=0,l=n.length;u<l;u++){var h=n[u];for(var d=u+1,p=n.length;d<p;d++)if(x(h.bbox,n[d].bbox)===null)return[]}var f=new R(N.compare);for(var g=0,m=n.length;g<m;g++){var y=n[g].getSweepEvents();for(var v=0,_=y.length;v<_;v++){f.insert(y[v]);if(f.size>D)throw new Error("Infinite loop when putting segment endpoints in a priority queue "+"(queue size too big). Please file a bug report.")}}var w=new G(f);var b=f.size;var C=f.pop();while(C){var E=C.key;if(f.size===b){var S=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(S.id," ")+"[".concat(S.leftSE.point.x,", ").concat(S.leftSE.point.y,"] -> ")+"[".concat(S.rightSE.point.x,", ").concat(S.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>D)throw new Error("Infinite loop when passing sweep line over endpoints "+"(queue size too big). Please file a bug report.");if(w.segments.length>Y)throw new Error("Infinite loop when passing sweep line over endpoints "+"(too many sweep line segments). Please file a bug report.");var T=w.process(E);for(var I=0,k=T.length;I<k;I++){var A=T[I];if(A.consumedBy===undefined)f.insert(A)}b=f.size;C=f.pop()}M.reset();var P=z.factory(w.segments);var O=new K(P);return O.getGeom()}}]);return e}()),Z,Q,V,J,X;return{union:function e(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return q.run("union",t,r)},intersection:function e(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return q.run("intersection",t,r)},xor:function e(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return q.run("xor",t,r)},difference:function e(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return q.run("difference",t,r)}}}());function sg(e,t,o){void 0===o&&(o={});var e=ig(e),t=ig(t),e=ag.intersection(e.coordinates,t.coordinates);if(0===e.length)return null;if(1!==e.length)return t=o.properties,ng({type:"MultiPolygon",coordinates:e},t,r=void 0===r?{}:r);var t=e[0],r=o.properties,e=void 0;void 0===e&&(e={});for(var n=0,i=t;n<i.length;n++){var a=i[n];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return ng({type:"Polygon",coordinates:t},r,e)}var cg,bn=window&&window.__decorate||function(e,t,o,r){var n,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;0<=s;s--)(n=e[s])&&(a=(i<3?n(a):3<i?n(t,o,a):n(t,o))||a);return 3<i&&a&&Object.defineProperty(t,o,a),a},ug=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},lg=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},hg=["DIV","SPAN","A"],dg=["data-azure-maps-attribution-minzoom","data-azure-maps-attribution-maxzoom","data-azure-maps-attribution-geometry","data-azure-maps-attribution-tileset","data-azure-maps-attribution-order","data-azure-maps-attribution-dynamic"],pg=lg(["href"],ug(dg),!1),fg=(gg.prototype.equals=function(e){return this.stringRepresentation===e.stringRepresentation},Object.defineProperty(gg.prototype,"stringRepresentation",{get:function(){return[void 0!==this.minZoom?"minzoom=".concat(this.minZoom):"",void 0!==this.maxZoom?"maxzoom=".concat(this.maxZoom):"",void 0!==this.geometry?this.element.attributes.getNamedItem("data-azure-maps-attribution-geometry").value:"",void 0!==this.tilesetId?"tilesetId=".concat(this.tilesetId):"",this.dynamic?"dynamic":""].filter(function(e){return 0<e.length}).join(";")},enumerable:!1,configurable:!0}),gg.applicable=function(e){return Array.from(e.attributes).map(function(e){return dg.includes(e.name)}).reduce(function(e,t){return e||t},!1)},Object.defineProperty(gg.prototype,"minZoom",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-minzoom");return e&&!isNaN(e.value)?parseInt(e.value):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(gg.prototype,"maxZoom",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-maxzoom");return e&&!isNaN(e.value)?parseInt(e.value):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(gg.prototype,"geometry",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-geometry");if(e&&e.value)try{return JSON.parse(e.value)}catch(e){}},enumerable:!1,configurable:!0}),Object.defineProperty(gg.prototype,"tilesetId",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-tileset");return e&&e.value?e.value:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(gg.prototype,"order",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-order");return e&&!isNaN(e.value)?parseInt(e.value):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(gg.prototype,"dynamic",{get:function(){return null!==this.element.attributes.getNamedItem("data-azure-maps-attribution-dynamic")},enumerable:!1,configurable:!0}),Object.defineProperty(gg.prototype,"hidesElement",{get:function(){return"none"==this.element.style.display},enumerable:!1,configurable:!0}),gg.prototype.forceHide=function(){this.element.style.display="none"},gg.prototype.satisfied=function(e){var t=!this.minZoom||!e.zoom||e.zoom>=this.minZoom,o=!this.maxZoom||!e.zoom||e.zoom<=this.maxZoom,r=!0;return this.geometry&&e.bounds&&(r=null!==sg({type:"Feature",geometry:this.geometry,properties:{}},{type:"Feature",geometry:{type:"Polygon",coordinates:[[f.getNorthWest(e.bounds),f.getNorthEast(e.bounds),f.getSouthEast(e.bounds),f.getSouthWest(e.bounds),f.getNorthWest(e.bounds)]]},properties:{}})),t&&o&&r},gg.prototype.apply=function(t,e){var o=this,r=(void 0===e&&(e=null),this.satisfied(t.getCamera())),n=this.dynamic&&this.tilesetId,i=this.hidesElement,e=e&&["dragend","zoomend","pitchend"].includes(e.type);return r||i?r&&(i||n)&&(r&&i&&this.element.style.removeProperty("display"),n)&&(e?t.events.addOnce("idle",function(e){return o.fetchAndApplyDynamicAttribution(t)}):this.fetchAndApplyDynamicAttribution(t)):this.element.style.display="none",r===i},gg.prototype.fetchAndApplyDynamicAttribution=function(r){var t,o,e,n=this,i=r.getCamera();this.lastFetchState&&f.containsBoundingBox(this.lastFetchState.bounds,i.bounds)&&Math.floor(this.lastFetchState.zoom)==Math.floor(i.zoom)||(t=Yu(i.center,f.getSouthWest(i.bounds),gg.viewportBufferExpansionRatio),e=((o=Yu(i.center,f.getNorthEast(i.bounds),gg.viewportBufferExpansionRatio))[0]<t[0]?[[t[0],t[1],180,o[1]],[-180,t[1],o[0],o[1]]]:[[t[0],t[1],o[0],o[1]]]).map(function(e){var e=new URLSearchParams({"api-version":"2.1",tilesetId:n.tilesetId,zoom:void 0!==i.zoom?"".concat(Math.floor(i.zoom)):void 0,bounds:e.join(",")}),t="".concat("https://{{azMapsDomain}}","/map/attribution"),o={url:t,headers:{}},t=(r._substituteDomainLanguageViewAndSignInRequest(t,o),"".concat(o.url).concat(o.url.includes("?")?"&":"?").concat(e.toString()));return r._sendRequest(t,"Attribution",o.headers).then(function(e){return e.json()})}),Promise.all(e).then(function(e){n.applyAttributionResponse(e),n.lastFetchState={bounds:new f([t[0],t[1],o[0],o[1]]),zoom:i.zoom}}).catch(function(e){return console.error(e)}))},gg.prototype.applyAttributionResponse=function(e){var t,o,r,n=this,e=e.map(function(e){return e.copyrights||[]}).reduce(function(e,t){return lg(lg([],ug(e),!1),ug(t),!1)},[]);0!=e.length&&(null===(e=zp.parseWithFilter(e.join(""),function(e){return!0},function(e){return e},function(){return n.element.innerHTML="",n.element}))?console.warn("Dynamic attribution is empty after filtering"):(t="string"==typeof e?((t=document.createElement("span")).innerHTML=e,t):e,r=t===this.element?(o=document.createElement("span"),Array.from(this.element.childNodes).forEach(function(e){return o.appendChild(e)}),o):t,Array.from(this.element.attributes).filter(function(e){return dg.includes(e.name)}).forEach(function(e){return r.attributes.setNamedItem(e.cloneNode())}),r.style.display=this.element.style.display,e=this.element.parentElement,this.element.remove(),e.append(r),this.element=r,this.attributionChangeCallback(this)))},gg.viewportBufferExpansionRatio=2,bn([(cg=1e3,function(e,t,o){var r=o.value,n=new Map;return o.value=function(){var e=this,t=arguments;!n.get(e)&&1&&(r.apply(e,t),n.set(e,!0),setTimeout(function(){return n.delete(e)},cg))},o})],gg.prototype,"fetchAndApplyDynamicAttribution",null),gg);function gg(e,t){var o=this;this.lastFetchState={bounds:null,zoom:null},this.getElement=function(){return o.element},this.element=e,this.attributionChangeCallback=t}var mg=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},yg=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},vg=[/all rights reserved/gi],_g=(wg.prototype.addToMap=function(){this.map.events.add("stylechanged",this.loadAttributionOnceSourcesLoaded),this.map.events.add("dragend",this.applyRules),this.map.events.add("zoomend",this.applyRules),this.map.events.add("pitchend",this.applyRules)},wg.prototype.removeFromMap=function(){this.map.events.remove("stylechanged",this.loadAttributionOnceSourcesLoaded),this.map.events.remove("dragend",this.applyRules),this.map.events.remove("zoomend",this.applyRules),this.map.events.remove("pitchend",this.applyRules)},wg.prototype.getDefaultAttribution=function(){return this.copyrightControl.getDefaultAttributions().map(function(e){return e=e,(t=document.createElement("a")).textContent=e,t;var t})},wg);function wg(e,t,o){var r,s=this;this.rules=[],this.virtualContext=((r=document.createElement("span")).className="azure-map-copyright-context",r),this.renderContext=this.virtualContext.cloneNode(!1),this.addAttributionFromSource=function(e){},this.removeAttributionFromSource=function(e){},this.getMapStyleVisibleSources=function(){var t=s.map._getMap(),o=t.getStyle();return Object.entries(o.sources).filter(function(e){var t=mg(e,1)[0];return o.layers.filter(function(e){return e&&e.source==t}).reduce(function(e,t){return!(t.layout&&"none"===t.layout.visibility||t.paint&&0===t.paint["icon-opacity"]&&0===t.paint["text-opacity"])||e},!1)}).map(function(e){e=mg(e,1)[0];return t.getSource(e)})},this.loadAttributionOnceSourcesLoaded=function(){var e=s.getMapStyleVisibleSources();Promise.all(e.map(function(i){return new Promise(function(o,r){var n;"tiles"in i?o(i):((n=i).on("data",function e(t){"metadata"==t.sourceDataType&&(n.off("data",e),o(i))}),n.on("error",function e(t){n.off("error",e),r(t)}))}).then(function(e){return{status:"fulfilled",value:e}}).catch(function(e){return{status:"rejected",reason:e}})})).then(function(e){s.reloadAttribution()})},this.reloadAttribution=function(){var e=s.getMapStyleVisibleSources(),r=new Set,n={},e=e.filter(function(e){return"attribution"in e&&e.attribution&&"tiles"in e&&e.tiles instanceof Array&&0<e.tiles.length}).map(function(e){return zp.parseWithFilter(null!=(e=e.attribution)?e:"",function(e){return hg.includes(e.tagName)&&Array.from(e.attributes).map(function(e){return pg.includes(e.name)}).reduce(function(e,t){return e&&t},!0)},function(e){var t,o=null;return e instanceof HTMLElement&&fg.applicable(e)&&(o=new fg(e,function(){return s.renderAttribution()}),r.add(o),void 0!==o.order)&&(e.style.order="".concat(o.order)),o&&e instanceof HTMLElement&&(!((t=o.stringRepresentation)in n)||void 0!==o.order&&void 0!==n[t].order&&o.order<n[t].order||void 0!==o.order&&void 0===n[t].order)&&(n[t]=o),e},function(){return document.createElement("span")})}),t=new Set(Object.values(n)),o=new Set(yg([],mg(r),!1).filter(function(e){return!t.has(e)})),i=new Set(yg([],mg(o),!1).map(function(e){return e.getElement()})),o=(yg([],mg(i),!1).filter(function(e){return null!==e.parentElement}).forEach(function(e){return e.parentElement.removeChild(e)}),s.rules=Object.values(n),e.filter(function(e){return"string"==typeof e||!i.has(e)}).map(function(e){return"string"==typeof e?new Text(e):e})),a=document.createElement("span");0<o.length?o.forEach(function(e){return a.appendChild(e)}):s.getDefaultAttribution().forEach(function(e){return a.appendChild(e)}),s.virtualContext=a,s.copyrightControl.setOptions({copyrightContent:s.renderContext}),s.applyRules(),s.renderAttribution()},this.applyRules=function(o){void 0===o&&(o=null),s.rules.reduce(function(e,t){t=t.apply(s.map,o);return e||t},!1)&&s.renderAttribution()},this.renderAttribution=function(){var t=function(e){return Array.from("none"!=e.style.display?e.children:[]).map(function(e){return t(e)}).reduce(function(e,t){return yg(yg([],mg(e),!1),mg(t),!1)},Array.from("none"!=e.style.display?e.childNodes:[]).filter(function(e){return e.nodeType==e.TEXT_NODE}))},e=s.virtualContext.cloneNode(!0),o=t(e);o.forEach(function(e){return e.textContent=yg([],mg(vg),!1).reduce(function(e,t){return e.replace(t,"").trim()},e.textContent)}),o.reduce(function(e,t){return e.has(t.textContent)?(t.textContent="",t.parentElement&&t.parentElement.removeChild(t)):e.add(t.textContent),e},new Set),s.renderContext.innerHTML="",Array.from(e.childNodes).forEach(function(e){return s.renderContext.appendChild(e)})},this.map=e,this.copyrightControl=t,this.options=o}var bg=function(e,t){return(bg=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)};function Cg(e,t){function o(){this.constructor=e}bg(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var v=function(){return(v=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function Eg(e,t){var o={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o}function _(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})}function w(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function Sg(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a}(arguments[t]));return e}var Tg=function(e,t){return(Tg=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)};function Ig(e,t){function o(){this.constructor=e}Tg(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var kg=function(){return(kg=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function b(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})}function C(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function Ag(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r}var Pg,Og,Rg,u,xg,Mg,Ng,Lg,Dg,qg,E,Ug,jg,Hg,S={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",CACHE_PREFIX:"msal",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_RESPONSE_TYPE:"code",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",FRAGMENT_RESPONSE_MODE:"fragment",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",REGIONAL_AUTH_NON_MSI_QUERY_STRING:"allowestsrnonmsi=true",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],TOKEN_RESPONSE_TYPE:"token",ID_TOKEN_RESPONSE_TYPE:"id_token",SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},Bg=[S.OPENID_SCOPE,S.PROFILE_SCOPE,S.OFFLINE_ACCESS_SCOPE],Fg=Ag(Bg,[S.EMAIL_SCOPE]),zg=((ir=Pg=Pg||{}).CONTENT_TYPE="Content-Type",ir.RETRY_AFTER="Retry-After",ir.CCS_HEADER="X-AnchorMailbox",ir.WWWAuthenticate="WWW-Authenticate",ir.AuthenticationInfo="Authentication-Info",ir.X_MS_REQUEST_ID="x-ms-request-id",ir.X_MS_HTTP_VERSION="x-ms-httpver",(Uo=Og=Og||{}).ID_TOKEN="idtoken",Uo.CLIENT_INFO="client.info",Uo.ADAL_ID_TOKEN="adal.idtoken",Uo.ERROR="error",Uo.ERROR_DESC="error.description",Uo.ACTIVE_ACCOUNT="active-account",Uo.ACTIVE_ACCOUNT_FILTERS="active-account-filters",(hi=Rg=Rg||{}).COMMON="common",hi.ORGANIZATIONS="organizations",hi.CONSUMERS="consumers",(i=u=u||{}).CLIENT_ID="client_id",i.REDIRECT_URI="redirect_uri",i.RESPONSE_TYPE="response_type",i.RESPONSE_MODE="response_mode",i.GRANT_TYPE="grant_type",i.CLAIMS="claims",i.SCOPE="scope",i.ERROR="error",i.ERROR_DESCRIPTION="error_description",i.ACCESS_TOKEN="access_token",i.ID_TOKEN="id_token",i.REFRESH_TOKEN="refresh_token",i.EXPIRES_IN="expires_in",i.STATE="state",i.NONCE="nonce",i.PROMPT="prompt",i.SESSION_STATE="session_state",i.CLIENT_INFO="client_info",i.CODE="code",i.CODE_CHALLENGE="code_challenge",i.CODE_CHALLENGE_METHOD="code_challenge_method",i.CODE_VERIFIER="code_verifier",i.CLIENT_REQUEST_ID="client-request-id",i.X_CLIENT_SKU="x-client-SKU",i.X_CLIENT_VER="x-client-VER",i.X_CLIENT_OS="x-client-OS",i.X_CLIENT_CPU="x-client-CPU",i.X_CLIENT_CURR_TELEM="x-client-current-telemetry",i.X_CLIENT_LAST_TELEM="x-client-last-telemetry",i.X_MS_LIB_CAPABILITY="x-ms-lib-capability",i.X_APP_NAME="x-app-name",i.X_APP_VER="x-app-ver",i.POST_LOGOUT_URI="post_logout_redirect_uri",i.ID_TOKEN_HINT="id_token_hint",i.DEVICE_CODE="device_code",i.CLIENT_SECRET="client_secret",i.CLIENT_ASSERTION="client_assertion",i.CLIENT_ASSERTION_TYPE="client_assertion_type",i.TOKEN_TYPE="token_type",i.REQ_CNF="req_cnf",i.OBO_ASSERTION="assertion",i.REQUESTED_TOKEN_USE="requested_token_use",i.ON_BEHALF_OF="on_behalf_of",i.FOCI="foci",i.CCS_HEADER="X-AnchorMailbox",i.RETURN_SPA_CODE="return_spa_code",i.NATIVE_BROKER="nativebroker",i.LOGOUT_HINT="logout_hint",(be=xg=xg||{}).ACCESS_TOKEN="access_token",be.XMS_CC="xms_cc",{LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"}),Kg=((Mi=Mg=Mg||{}).ACCOUNT="account",Mi.SID="sid",Mi.LOGIN_HINT="login_hint",Mi.ID_TOKEN="id_token",Mi.DOMAIN_HINT="domain_hint",Mi.ORGANIZATIONS="organizations",Mi.CONSUMERS="consumers",Mi.ACCOUNT_ID="accountIdentifier",Mi.HOMEACCOUNT_ID="homeAccountIdentifier",{PLAIN:"plain",S256:"S256"}),Gg=((cn=Ng=Ng||{}).QUERY="query",cn.FRAGMENT="fragment",cn.FORM_POST="form_post",(o=Lg=Lg||{}).IMPLICIT_GRANT="implicit",o.AUTHORIZATION_CODE_GRANT="authorization_code",o.CLIENT_CREDENTIALS_GRANT="client_credentials",o.RESOURCE_OWNER_PASSWORD_GRANT="password",o.REFRESH_TOKEN_GRANT="refresh_token",o.DEVICE_CODE_GRANT="device_code",o.JWT_BEARER="urn:ietf:params:oauth:grant-type:jwt-bearer",(un=Dg=Dg||{}).MSSTS_ACCOUNT_TYPE="MSSTS",un.ADFS_ACCOUNT_TYPE="ADFS",un.MSAV1_ACCOUNT_TYPE="MSA",un.GENERIC_ACCOUNT_TYPE="Generic",(e=qg=qg||{}).CACHE_KEY_SEPARATOR="-",e.CLIENT_INFO_SEPARATOR=".",(r=E=E||{}).ID_TOKEN="IdToken",r.ACCESS_TOKEN="AccessToken",r.ACCESS_TOKEN_WITH_AUTH_SCHEME="AccessToken_With_AuthScheme",r.REFRESH_TOKEN="RefreshToken",(t=Ug=Ug||{})[t.ADFS=1001]="ADFS",t[t.MSA=1002]="MSA",t[t.MSSTS=1003]="MSSTS",t[t.GENERIC=1004]="GENERIC",t[t.ACCESS_TOKEN=2001]="ACCESS_TOKEN",t[t.REFRESH_TOKEN=2002]="REFRESH_TOKEN",t[t.ID_TOKEN=2003]="ID_TOKEN",t[t.APP_METADATA=3001]="APP_METADATA",t[t.UNDEFINED=9999]="UNDEFINED","appmetadata"),Yg="authority-metadata",Wg=86400,Zg=((n=jg=jg||{}).CONFIG="config",n.CACHE="cache",n.NETWORK="network",n.HARDCODED_VALUES="hardcoded_values",{SCHEMA_VERSION:5,MAX_CUR_HEADER_BYTES:80,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"});(a=Hg=Hg||{}).BEARER="Bearer",a.POP="pop",a.SSH="ssh-cert";var Qg,Vg,Jg,Xg,$g,em,tm=60,om=3600,rm="throttling",nm="retry-after, h429",im="invalid_grant",am="client_mismatch";(bn=Qg=Qg||{}).username="username",bn.password="password",(ir=Vg=Vg||{})[ir.httpSuccess=200]="httpSuccess",ir[ir.httpBadRequest=400]="httpBadRequest",(Uo=Jg=Jg||{}).FAILED_AUTO_DETECTION="1",Uo.INTERNAL_CACHE="2",Uo.ENVIRONMENT_VARIABLE="3",Uo.IMDS="4",(hi=Xg=Xg||{}).CONFIGURED_MATCHES_DETECTED="1",hi.CONFIGURED_NO_AUTO_DETECTION="2",hi.CONFIGURED_NOT_DETECTED="3",hi.AUTO_DETECTION_REQUESTED_SUCCESSFUL="4",hi.AUTO_DETECTION_REQUESTED_FAILED="5",(i=$g=$g||{}).NO_CACHE_HIT="0",i.FORCE_REFRESH="1",i.NO_CACHED_ACCESS_TOKEN="2",i.CACHED_ACCESS_TOKEN_EXPIRED="3",i.REFRESH_CACHED_ACCESS_TOKEN="4",i.CLAIMS_REQUESTED_CACHE_SKIPPED="5",(be=em=em||{}).Jwt="JWT",be.Jwk="JWK",be.Pop="pop";var sm,cm={code:"unexpected_error",desc:"Unexpected error in authentication."},um={code:"post_request_failed",desc:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."},T=(Ig(lm,sm=Error),lm.prototype.setCorrelationId=function(e){this.correlationId=e},lm.createUnexpectedError=function(e){return new lm(cm.code,cm.desc+": "+e)},lm.createPostRequestFailed=function(e){return new lm(um.code,um.desc+": "+e)},lm);function lm(e,t,o){var r=this,r=sm.call(this,t?e+": "+t:e)||this;return Object.setPrototypeOf(r,lm.prototype),r.errorCode=e||S.EMPTY_STRING,r.errorMessage=t||S.EMPTY_STRING,r.subError=o||S.EMPTY_STRING,r.name="AuthError",r}var hm,dm={createNewGuid:function(){throw T.createUnexpectedError("Crypto interface - createNewGuid() has not been implemented")},base64Decode:function(){throw T.createUnexpectedError("Crypto interface - base64Decode() has not been implemented")},base64Encode:function(){throw T.createUnexpectedError("Crypto interface - base64Encode() has not been implemented")},generatePkceCodes:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - generatePkceCodes() has not been implemented")})})},getPublicKeyThumbprint:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - getPublicKeyThumbprint() has not been implemented")})})},removeTokenBindingKey:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - removeTokenBindingKey() has not been implemented")})})},clearKeystore:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - clearKeystore() has not been implemented")})})},signJwt:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - signJwt() has not been implemented")})})},hashString:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - hashString() has not been implemented")})})}},pm={code:"client_info_decoding_error",desc:"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause."},fm={code:"client_info_empty_error",desc:"The client info was empty. Please review the trace to determine the root cause."},gm={code:"token_parsing_error",desc:"Token cannot be parsed. Please review stack trace to determine root cause."},mm={code:"null_or_empty_token",desc:"The token is null or empty. Please review the trace to determine the root cause."},ym={code:"endpoints_resolution_error",desc:"Error: could not resolve endpoints. Please check network and try again."},vm={code:"network_error",desc:"Network request failed. Please check network trace to determine root cause."},_m={code:"openid_config_error",desc:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints."},wm={code:"hash_not_deserialized",desc:"The hash parameters could not be deserialized. Please review the trace to determine the root cause."},bm={code:"invalid_state",desc:"State was not the expected format. Please check the logs to determine whether the request was sent using ProtocolUtils.setRequestState()."},Cm={code:"state_mismatch",desc:"State mismatch error. Please check your network. Continued requests may cause cache overflow."},Em={code:"state_not_found",desc:"State not found"},Sm={code:"nonce_mismatch",desc:"Nonce mismatch error. This may be caused by a race condition in concurrent requests."},Tm={code:"nonce_not_found",desc:"nonce not found"},Im={code:"auth_time_not_found",desc:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information."},km={code:"max_age_transpired",desc:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication."},Am={code:"multiple_matching_tokens",desc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account."},Pm={code:"multiple_matching_accounts",desc:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account"},Om={code:"multiple_matching_appMetadata",desc:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata"},Rm={code:"request_cannot_be_made",desc:"Token request cannot be made without authorization code or refresh token."},xm={code:"cannot_append_empty_scope",desc:"Cannot append null or empty scope to ScopeSet. Please check the stack trace for more info."},Mm={code:"cannot_remove_empty_scope",desc:"Cannot remove null or empty scope from ScopeSet. Please check the stack trace for more info."},Nm={code:"cannot_append_scopeset",desc:"Cannot append ScopeSet due to error."},Lm={code:"empty_input_scopeset",desc:"Empty input ScopeSet cannot be processed."},Dm={code:"device_code_polling_cancelled",desc:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true."},qm={code:"device_code_expired",desc:"Device code is expired."},Um={code:"device_code_unknown_error",desc:"Device code stopped polling for unknown reasons."},jm={code:"no_account_in_silent_request",desc:"Please pass an account object, silent flow is not supported without account information"},Hm={code:"invalid_cache_record",desc:"Cache record object was null or undefined."},Bm={code:"invalid_cache_environment",desc:"Invalid environment when attempting to create cache entry"},Fm={code:"no_account_found",desc:"No account found in cache for given key."},zm={code:"no cache plugin set on CacheManager",desc:"ICachePlugin needs to be set before using readFromStorage or writeFromStorage"},Km={code:"no_crypto_object",desc:"No crypto object detected. This is required for the following operation: "},Gm={code:"invalid_cache_type",desc:"Invalid cache type"},Ym={code:"unexpected_account_type",desc:"Unexpected account type."},Wm={code:"unexpected_credential_type",desc:"Unexpected credential type."},Zm={code:"invalid_assertion",desc:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515"},Qm={code:"invalid_client_credential",desc:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential"},Vm={code:"token_refresh_required",desc:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired."},Jm={code:"user_timeout_reached",desc:"User defined timeout for device code polling reached"},Xm={code:"token_claims_cnf_required_for_signedjwt",desc:"Cannot generate a POP jwt if the token_claims are not populated"},$m={code:"authorization_code_missing_from_server_response",desc:"Server response does not contain an authorization code to proceed"},ey={code:"binding_key_not_removed",desc:"Could not remove the credential's binding key from storage."},ty={code:"end_session_endpoint_not_supported",desc:"Provided authority does not support logout."},oy={code:"key_id_missing",desc:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key."},ry={code:"no_network_connectivity",desc:"No network connectivity. Check your internet connection."},ny={code:"user_canceled",desc:"User canceled the flow."},I=(Ig(s,hm=T),s.createClientInfoDecodingError=function(e){return new s(pm.code,pm.desc+" Failed with error: "+e)},s.createClientInfoEmptyError=function(){return new s(fm.code,""+fm.desc)},s.createTokenParsingError=function(e){return new s(gm.code,gm.desc+" Failed with error: "+e)},s.createTokenNullOrEmptyError=function(e){return new s(mm.code,mm.desc+" Raw Token Value: "+e)},s.createEndpointDiscoveryIncompleteError=function(e){return new s(ym.code,ym.desc+" Detail: "+e)},s.createNetworkError=function(e,t){return new s(vm.code,vm.desc+" | Fetch client threw: "+t+" | Attempted to reach: "+e.split("?")[0])},s.createUnableToGetOpenidConfigError=function(e){return new s(_m.code,_m.desc+" Attempted to retrieve endpoints from: "+e)},s.createHashNotDeserializedError=function(e){return new s(wm.code,wm.desc+" Given Object: "+e)},s.createInvalidStateError=function(e,t){return new s(bm.code,bm.desc+" Invalid State: "+e+", Root Err: "+t)},s.createStateMismatchError=function(){return new s(Cm.code,Cm.desc)},s.createStateNotFoundError=function(e){return new s(Em.code,Em.desc+": "+e)},s.createNonceMismatchError=function(){return new s(Sm.code,Sm.desc)},s.createAuthTimeNotFoundError=function(){return new s(Im.code,Im.desc)},s.createMaxAgeTranspiredError=function(){return new s(km.code,km.desc)},s.createNonceNotFoundError=function(e){return new s(Tm.code,Tm.desc+": "+e)},s.createMultipleMatchingTokensInCacheError=function(){return new s(Am.code,Am.desc+".")},s.createMultipleMatchingAccountsInCacheError=function(){return new s(Pm.code,Pm.desc)},s.createMultipleMatchingAppMetadataInCacheError=function(){return new s(Om.code,Om.desc)},s.createTokenRequestCannotBeMadeError=function(){return new s(Rm.code,Rm.desc)},s.createAppendEmptyScopeToSetError=function(e){return new s(xm.code,xm.desc+" Given Scope: "+e)},s.createRemoveEmptyScopeFromSetError=function(e){return new s(Mm.code,Mm.desc+" Given Scope: "+e)},s.createAppendScopeSetError=function(e){return new s(Nm.code,Nm.desc+" Detail Error: "+e)},s.createEmptyInputScopeSetError=function(){return new s(Lm.code,""+Lm.desc)},s.createDeviceCodeCancelledError=function(){return new s(Dm.code,""+Dm.desc)},s.createDeviceCodeExpiredError=function(){return new s(qm.code,""+qm.desc)},s.createDeviceCodeUnknownError=function(){return new s(Um.code,""+Um.desc)},s.createNoAccountInSilentRequestError=function(){return new s(jm.code,""+jm.desc)},s.createNullOrUndefinedCacheRecord=function(){return new s(Hm.code,Hm.desc)},s.createInvalidCacheEnvironmentError=function(){return new s(Bm.code,Bm.desc)},s.createNoAccountFoundError=function(){return new s(Fm.code,Fm.desc)},s.createCachePluginError=function(){return new s(zm.code,""+zm.desc)},s.createNoCryptoObjectError=function(e){return new s(Km.code,""+Km.desc+e)},s.createInvalidCacheTypeError=function(){return new s(Gm.code,""+Gm.desc)},s.createUnexpectedAccountTypeError=function(){return new s(Ym.code,""+Ym.desc)},s.createUnexpectedCredentialTypeError=function(){return new s(Wm.code,""+Wm.desc)},s.createInvalidAssertionError=function(){return new s(Zm.code,""+Zm.desc)},s.createInvalidCredentialError=function(){return new s(Qm.code,""+Qm.desc)},s.createRefreshRequiredError=function(){return new s(Vm.code,Vm.desc)},s.createUserTimeoutReachedError=function(){return new s(Jm.code,Jm.desc)},s.createTokenClaimsRequiredError=function(){return new s(Xm.code,Xm.desc)},s.createNoAuthCodeInServerResponseError=function(){return new s($m.code,$m.desc)},s.createBindingKeyNotRemovedError=function(){return new s(ey.code,ey.desc)},s.createLogoutNotSupportedError=function(){return new s(ty.code,ty.desc)},s.createKeyIdMissingError=function(){return new s(oy.code,oy.desc)},s.createNoNetworkConnectivityError=function(){return new s(ry.code,ry.desc)},s.createUserCanceledError=function(){return new s(ny.code,ny.desc)},s);function s(e,t){e=hm.call(this,e,t)||this;return e.name="ClientAuthError",Object.setPrototypeOf(e,s.prototype),e}ay.decodeAuthToken=function(e){if(ay.isEmpty(e))throw I.createTokenNullOrEmptyError(e);var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(e);if(!t||t.length<4)throw I.createTokenParsingError("Given token is malformed: "+JSON.stringify(e));return{header:t[1],JWSPayload:t[2],JWSSig:t[3]}},ay.isEmpty=function(e){return void 0===e||!e||0===e.length},ay.isEmptyObj=function(e){if(e&&!ay.isEmpty(e))try{var t=JSON.parse(e);return 0===Object.keys(t).length}catch(e){}return!0},ay.startsWith=function(e,t){return 0===e.indexOf(t)},ay.endsWith=function(e,t){return e.length>=t.length&&e.lastIndexOf(t)===e.length-t.length},ay.queryStringToObject=function(e){function o(e){return decodeURIComponent(e.replace(/\+/g," "))}var r={},e=e.split("&");return e.forEach(function(e){var t;e.trim()&&(t=(e=e.split(/=(.+)/g,2))[0],e=e[1],t)&&e&&(r[o(t)]=o(e))}),r},ay.trimArrayEntries=function(e){return e.map(function(e){return e.trim()})},ay.removeEmptyStringsFromArray=function(e){return e.filter(function(e){return!ay.isEmpty(e)})},ay.jsonParseHelper=function(e){try{return JSON.parse(e)}catch(e){return null}},ay.matchPattern=function(e,t){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(t)};var iy,k=ay;function ay(){}(Mi=iy=iy||{})[Mi.Error=0]="Error",Mi[Mi.Warning=1]="Warning",Mi[Mi.Info=2]="Info",Mi[Mi.Verbose=3]="Verbose",Mi[Mi.Trace=4]="Trace";cy.createDefaultLoggerOptions=function(){return{loggerCallback:function(){},piiLoggingEnabled:!1,logLevel:iy.Info}},cy.prototype.clone=function(e,t,o){return new cy({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:o||this.correlationId},e,t)},cy.prototype.logMessage=function(e,t){var o;t.logLevel>this.level||!this.piiLoggingEnabled&&t.containsPii||(o=(new Date).toUTCString(),o=(k.isEmpty(t.correlationId)?k.isEmpty(this.correlationId)?"["+o+"]":"["+o+"] : ["+this.correlationId+"]":"["+o+"] : ["+t.correlationId+"]")+" : "+this.packageName+"@"+this.packageVersion+" : "+iy[t.logLevel]+" - "+e,this.executeCallback(t.logLevel,o,t.containsPii||!1))},cy.prototype.executeCallback=function(e,t,o){this.localCallback&&this.localCallback(e,t,o)},cy.prototype.error=function(e,t){this.logMessage(e,{logLevel:iy.Error,containsPii:!1,correlationId:t||S.EMPTY_STRING})},cy.prototype.errorPii=function(e,t){this.logMessage(e,{logLevel:iy.Error,containsPii:!0,correlationId:t||S.EMPTY_STRING})},cy.prototype.warning=function(e,t){this.logMessage(e,{logLevel:iy.Warning,containsPii:!1,correlationId:t||S.EMPTY_STRING})},cy.prototype.warningPii=function(e,t){this.logMessage(e,{logLevel:iy.Warning,containsPii:!0,correlationId:t||S.EMPTY_STRING})},cy.prototype.info=function(e,t){this.logMessage(e,{logLevel:iy.Info,containsPii:!1,correlationId:t||S.EMPTY_STRING})},cy.prototype.infoPii=function(e,t){this.logMessage(e,{logLevel:iy.Info,containsPii:!0,correlationId:t||S.EMPTY_STRING})},cy.prototype.verbose=function(e,t){this.logMessage(e,{logLevel:iy.Verbose,containsPii:!1,correlationId:t||S.EMPTY_STRING})},cy.prototype.verbosePii=function(e,t){this.logMessage(e,{logLevel:iy.Verbose,containsPii:!0,correlationId:t||S.EMPTY_STRING})},cy.prototype.trace=function(e,t){this.logMessage(e,{logLevel:iy.Trace,containsPii:!1,correlationId:t||S.EMPTY_STRING})},cy.prototype.tracePii=function(e,t){this.logMessage(e,{logLevel:iy.Trace,containsPii:!0,correlationId:t||S.EMPTY_STRING})},cy.prototype.isPiiLoggingEnabled=function(){return this.piiLoggingEnabled||!1};var sy=cy;function cy(e,t,o){this.level=iy.Info;e=e||cy.createDefaultLoggerOptions();this.localCallback=e.loggerCallback||function(){},this.piiLoggingEnabled=e.piiLoggingEnabled||!1,this.level="number"==typeof e.logLevel?e.logLevel:iy.Info,this.correlationId=e.correlationId||S.EMPTY_STRING,this.packageName=t||S.EMPTY_STRING,this.packageVersion=o||S.EMPTY_STRING}var uy,ly="@azure/msal-common",hy="13.3.1";(cn=uy=uy||{})[cn.None=0]="None",cn.AzurePublic="https://login.microsoftonline.com",cn.AzurePpe="https://login.windows-ppe.net",cn.AzureChina="https://login.chinacloudapi.cn",cn.AzureGermany="https://login.microsoftonline.de",cn.AzureUsGovernment="https://login.microsoftonline.us";var dy,py={code:"redirect_uri_empty",desc:"A redirect URI is required for all calls, and none has been set."},fy={code:"post_logout_uri_empty",desc:"A post logout redirect has not been set."},gy={code:"claims_request_parsing_error",desc:"Could not parse the given claims request object."},my={code:"authority_uri_insecure",desc:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options"},yy={code:"url_parse_error",desc:"URL could not be parsed into appropriate segments."},vy={code:"empty_url_error",desc:"URL was empty or null."},_y={code:"empty_input_scopes_error",desc:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token."},wy={code:"clientid_input_scopes_error",desc:"Client ID can only be provided as a single scope."},by={code:"invalid_prompt_value",desc:"Supported prompt values are 'login', 'select_account', 'consent', 'create', 'none' and 'no_session'. Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest"},Cy={code:"invalid_claims",desc:"Given claims parameter must be a stringified JSON object."},Ey={code:"token_request_empty",desc:"Token request was empty and not found in cache."},Sy={code:"logout_request_empty",desc:"The logout request was null or undefined."},Ty={code:"invalid_code_challenge_method",desc:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".'},Iy={code:"pkce_params_missing",desc:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request"},ky={code:"invalid_cloud_discovery_metadata",desc:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields"},Ay={code:"invalid_authority_metadata",desc:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields."},Py={code:"untrusted_authority",desc:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."},Oy={code:"invalid_azure_cloud_instance",desc:"Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values"},Ry={code:"missing_ssh_jwk",desc:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme."},xy={code:"missing_ssh_kid",desc:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme."},My={code:"missing_nonce_authentication_header",desc:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce."},Ny={code:"invalid_authentication_header",desc:"Invalid authentication header provided"},Ly={code:"authority_mismatch",desc:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."},Dy=(Ig(c,dy=I),c.createRedirectUriEmptyError=function(){return new c(py.code,py.desc)},c.createPostLogoutRedirectUriEmptyError=function(){return new c(fy.code,fy.desc)},c.createClaimsRequestParsingError=function(e){return new c(gy.code,gy.desc+" Given value: "+e)},c.createInsecureAuthorityUriError=function(e){return new c(my.code,my.desc+" Given URI: "+e)},c.createUrlParseError=function(e){return new c(yy.code,yy.desc+" Given Error: "+e)},c.createUrlEmptyError=function(){return new c(vy.code,vy.desc)},c.createEmptyScopesArrayError=function(){return new c(_y.code,""+_y.desc)},c.createClientIdSingleScopeError=function(e){return new c(wy.code,wy.desc+" Given Scopes: "+e)},c.createInvalidPromptError=function(e){return new c(by.code,by.desc+" Given value: "+e)},c.createInvalidClaimsRequestError=function(){return new c(Cy.code,Cy.desc)},c.createEmptyLogoutRequestError=function(){return new c(Sy.code,Sy.desc)},c.createEmptyTokenRequestError=function(){return new c(Ey.code,Ey.desc)},c.createInvalidCodeChallengeMethodError=function(){return new c(Ty.code,Ty.desc)},c.createInvalidCodeChallengeParamsError=function(){return new c(Iy.code,Iy.desc)},c.createInvalidCloudDiscoveryMetadataError=function(){return new c(ky.code,ky.desc)},c.createInvalidAuthorityMetadataError=function(){return new c(Ay.code,Ay.desc)},c.createUntrustedAuthorityError=function(){return new c(Py.code,Py.desc)},c.createInvalidAzureCloudInstanceError=function(){return new c(Oy.code,Oy.desc)},c.createMissingSshJwkError=function(){return new c(Ry.code,Ry.desc)},c.createMissingSshKidError=function(){return new c(xy.code,xy.desc)},c.createMissingNonceAuthenticationHeadersError=function(){return new c(My.code,My.desc)},c.createInvalidAuthenticationHeaderError=function(e,t){return new c(Ny.code,Ny.desc+". Invalid header: "+e+". Details: "+t)},c.createAuthorityMismatchError=function(){return new c(Ly.code,Ly.desc)},c);function c(e,t){e=dy.call(this,e,t)||this;return e.name="ClientConfigurationError",Object.setPrototypeOf(e,c.prototype),e}jy.fromString=function(e){return new jy((e||S.EMPTY_STRING).split(" "))},jy.createSearchScopes=function(e){e=new jy(e);return e.containsOnlyOIDCScopes()?e.removeScope(S.OFFLINE_ACCESS_SCOPE):e.removeOIDCScopes(),e},jy.prototype.validateInputScopes=function(e){if(!e||e.length<1)throw Dy.createEmptyScopesArrayError()},jy.prototype.containsScope=function(e){var t=new jy(this.printScopesLowerCase().split(" "));return!k.isEmpty(e)&&t.scopes.has(e.toLowerCase())},jy.prototype.containsScopeSet=function(e){var t=this;return!(!e||e.scopes.size<=0)&&this.scopes.size>=e.scopes.size&&e.asArray().every(function(e){return t.containsScope(e)})},jy.prototype.containsOnlyOIDCScopes=function(){var t=this,o=0;return Fg.forEach(function(e){t.containsScope(e)&&(o+=1)}),this.scopes.size===o},jy.prototype.appendScope=function(e){k.isEmpty(e)||this.scopes.add(e.trim())},jy.prototype.appendScopes=function(e){var t=this;try{e.forEach(function(e){return t.appendScope(e)})}catch(e){throw I.createAppendScopeSetError(e)}},jy.prototype.removeScope=function(e){if(k.isEmpty(e))throw I.createRemoveEmptyScopeFromSetError(e);this.scopes.delete(e.trim())},jy.prototype.removeOIDCScopes=function(){var t=this;Fg.forEach(function(e){t.scopes.delete(e)})},jy.prototype.unionScopeSets=function(e){var t;if(e)return t=new Set,e.scopes.forEach(function(e){return t.add(e.toLowerCase())}),this.scopes.forEach(function(e){return t.add(e.toLowerCase())}),t;throw I.createEmptyInputScopeSetError()},jy.prototype.intersectingScopeSets=function(e){if(!e)throw I.createEmptyInputScopeSetError();e.containsOnlyOIDCScopes()||e.removeOIDCScopes();var t=this.unionScopeSets(e),e=e.getScopeCount(),o=this.getScopeCount();return t.size<o+e},jy.prototype.getScopeCount=function(){return this.scopes.size},jy.prototype.asArray=function(){var t=[];return this.scopes.forEach(function(e){return t.push(e)}),t},jy.prototype.printScopes=function(){return this.scopes?this.asArray().join(" "):S.EMPTY_STRING},jy.prototype.printScopesLowerCase=function(){return this.printScopes().toLowerCase()};var qy,Uy=jy;function jy(e){var t=this,e=e?k.trimArrayEntries(Ag(e)):[],e=e?k.removeEmptyStringsFromArray(e):[];this.validateInputScopes(e),this.scopes=new Set,e.forEach(function(e){return t.scopes.add(e)})}function Hy(e,t){if(k.isEmpty(e))throw I.createClientInfoEmptyError();try{var o=t.base64Decode(e);return JSON.parse(o)}catch(e){throw I.createClientInfoDecodingError(e.message)}}function By(e){if(k.isEmpty(e))throw I.createClientInfoDecodingError("Home account ID was empty.");e=e.split(qg.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?S.EMPTY_STRING:e[1]}}(o=qy=qy||{})[o.Default=0]="Default",o[o.Adfs=1]="Adfs",o[o.Dsts=2]="Dsts",o[o.Ciam=3]="Ciam";zy.prototype.generateAccountId=function(){return[this.homeAccountId,this.environment].join(qg.CACHE_KEY_SEPARATOR).toLowerCase()},zy.prototype.generateAccountKey=function(){return zy.generateAccountCacheKey({homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId})},zy.prototype.generateType=function(){switch(this.authorityType){case Dg.ADFS_ACCOUNT_TYPE:return Ug.ADFS;case Dg.MSAV1_ACCOUNT_TYPE:return Ug.MSA;case Dg.MSSTS_ACCOUNT_TYPE:return Ug.MSSTS;case Dg.GENERIC_ACCOUNT_TYPE:return Ug.GENERIC;default:throw I.createUnexpectedAccountTypeError()}},zy.prototype.getAccountInfo=function(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,name:this.name,idTokenClaims:this.idTokenClaims,nativeAccountId:this.nativeAccountId}},zy.generateAccountCacheKey=function(e){return[e.homeAccountId,e.environment||S.EMPTY_STRING,e.tenantId||S.EMPTY_STRING].join(qg.CACHE_KEY_SEPARATOR).toLowerCase()},zy.createAccount=function(e,t,o,r,n,i,a,s){var c=new zy,e=(c.authorityType=Dg.MSSTS_ACCOUNT_TYPE,c.clientInfo=e,c.homeAccountId=t,c.nativeAccountId=s,a||r&&r.getPreferredCache());if(e)return c.environment=e,c.realm=(null==(t=null==o?void 0:o.claims)?void 0:t.tid)||S.EMPTY_STRING,o&&(c.idTokenClaims=o.claims,c.localAccountId=(null==(s=null==o?void 0:o.claims)?void 0:s.oid)||(null==(a=null==o?void 0:o.claims)?void 0:a.sub)||S.EMPTY_STRING,e=null==(r=null==o?void 0:o.claims)?void 0:r.preferred_username,s=null!=(t=null==o?void 0:o.claims)&&t.emails?o.claims.emails[0]:null,c.username=e||s||S.EMPTY_STRING,c.name=null==(a=null==o?void 0:o.claims)?void 0:a.name),c.cloudGraphHostName=n,c.msGraphHost=i,c;throw I.createInvalidCacheEnvironmentError()},zy.createGenericAccount=function(e,t,o,r,n,i){var a=new zy,e=(a.authorityType=o&&o.authorityType===qy.Adfs?Dg.ADFS_ACCOUNT_TYPE:Dg.GENERIC_ACCOUNT_TYPE,a.homeAccountId=e,a.realm=S.EMPTY_STRING,i||o&&o.getPreferredCache());if(e)return t&&(a.localAccountId=(null==(i=null==t?void 0:t.claims)?void 0:i.oid)||(null==(o=null==t?void 0:t.claims)?void 0:o.sub)||S.EMPTY_STRING,a.username=(null==(i=null==t?void 0:t.claims)?void 0:i.upn)||S.EMPTY_STRING,a.name=(null==(o=null==t?void 0:t.claims)?void 0:o.name)||S.EMPTY_STRING,a.idTokenClaims=null==t?void 0:t.claims),a.environment=e,a.cloudGraphHostName=r,a.msGraphHost=n,a;throw I.createInvalidCacheEnvironmentError()},zy.generateHomeAccountId=function(e,t,o,r,n){var i=null!=(i=null==n?void 0:n.claims)&&i.sub?n.claims.sub:S.EMPTY_STRING;if(t!==qy.Adfs&&t!==qy.Dsts){if(e)try{var a=Hy(e,r);if(!k.isEmpty(a.uid)&&!k.isEmpty(a.utid))return""+a.uid+qg.CLIENT_INFO_SEPARATOR+a.utid}catch(e){}o.verbose("No client info in response")}return i},zy.isAccountEntity=function(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType")},zy.accountInfoIsEqual=function(e,t,o){var r,n;return!(!e||!t)&&(n=!0,o&&(o=e.idTokenClaims||{},r=t.idTokenClaims||{},n=o.iat===r.iat&&o.nonce===r.nonce),e.homeAccountId===t.homeAccountId)&&e.localAccountId===t.localAccountId&&e.username===t.username&&e.tenantId===t.tenantId&&e.environment===t.environment&&e.nativeAccountId===t.nativeAccountId&&n};var Fy=zy;function zy(){}Gy.extractTokenClaims=function(e,t){e=k.decodeAuthToken(e);try{var o=e.JWSPayload,r=t.base64Decode(o);return JSON.parse(r)}catch(e){throw I.createTokenParsingError(e)}},Gy.checkMaxAge=function(e,t){if(0===t||Date.now()-3e5>e+t)throw I.createMaxAgeTranspiredError()};var Ky=Gy;function Gy(e,t){if(k.isEmpty(e))throw I.createTokenNullOrEmptyError(e);this.rawToken=e,this.claims=Gy.extractTokenClaims(e,t)}h.prototype.getAllAccounts=function(){var o=this,e=this.getAccountKeys();return e.length<1||(e=e.reduce(function(e,t){t=o.getAccount(t);return t&&e.push(t),e},[])).length<1?[]:e.map(function(e){return o.getAccountInfoFromEntity(e)})},h.prototype.getAccountInfoFilteredBy=function(e){e=this.getAccountsFilteredBy(e);return 0<e.length?this.getAccountInfoFromEntity(e[0]):null},h.prototype.getAccountInfoFromEntity=function(e){var e=e.getAccountInfo(),t=this.getIdToken(e);return t&&(e.idToken=t.secret,e.idTokenClaims=new Ky(t.secret,this.cryptoImpl).claims),e},h.prototype.saveCacheRecord=function(t){return b(this,void 0,void 0,function(){return C(this,function(e){switch(e.label){case 0:if(t)return t.account&&this.setAccount(t.account),t.idToken&&this.setIdTokenCredential(t.idToken),t.accessToken?[4,this.saveAccessToken(t.accessToken)]:[3,2];throw I.createNullOrUndefinedCacheRecord();case 1:e.sent(),e.label=2;case 2:return t.refreshToken&&this.setRefreshTokenCredential(t.refreshToken),t.appMetadata&&this.setAppMetadata(t.appMetadata),[2]}})})},h.prototype.saveAccessToken=function(a){return b(this,void 0,void 0,function(){var o,t,r,n,i=this;return C(this,function(e){switch(e.label){case 0:return o={clientId:a.clientId,credentialType:a.credentialType,environment:a.environment,homeAccountId:a.homeAccountId,realm:a.realm,tokenType:a.tokenType,requestedClaimsHash:a.requestedClaimsHash},t=this.getTokenKeys(),r=Uy.fromString(a.target),n=[],t.accessToken.forEach(function(e){var t;i.accessTokenKeyMatchesFilter(e,o,!1)&&(t=i.getAccessTokenCredential(e))&&i.credentialMatchesFilter(t,o)&&Uy.fromString(t.target).intersectingScopeSets(r)&&n.push(i.removeAccessToken(e))}),[4,Promise.all(n)];case 1:return e.sent(),this.setAccessTokenCredential(a),[2]}})})},h.prototype.getAccountsFilteredBy=function(t){var o=this,e=this.getAccountKeys(),r=[];return e.forEach(function(e){!o.isAccountKey(e,t.homeAccountId,t.realm)||!(e=o.getAccount(e))||t.homeAccountId&&!o.matchHomeAccountId(e,t.homeAccountId)||t.localAccountId&&!o.matchLocalAccountId(e,t.localAccountId)||t.username&&!o.matchUsername(e,t.username)||t.environment&&!o.matchEnvironment(e,t.environment)||t.realm&&!o.matchRealm(e,t.realm)||t.nativeAccountId&&!o.matchNativeAccountId(e,t.nativeAccountId)||r.push(e)}),r},h.prototype.isAccountKey=function(e,t,o){return!(e.split(qg.CACHE_KEY_SEPARATOR).length<3||t&&!e.toLowerCase().includes(t.toLowerCase())||o&&!e.toLowerCase().includes(o.toLowerCase()))},h.prototype.isCredentialKey=function(e){if(e.split(qg.CACHE_KEY_SEPARATOR).length<6)return!1;e=e.toLowerCase();if(-1===e.indexOf(E.ID_TOKEN.toLowerCase())&&-1===e.indexOf(E.ACCESS_TOKEN.toLowerCase())&&-1===e.indexOf(E.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())&&-1===e.indexOf(E.REFRESH_TOKEN.toLowerCase()))return!1;if(-1<e.indexOf(E.REFRESH_TOKEN.toLowerCase())){var t=""+E.REFRESH_TOKEN+qg.CACHE_KEY_SEPARATOR+this.clientId+qg.CACHE_KEY_SEPARATOR,o=""+E.REFRESH_TOKEN+qg.CACHE_KEY_SEPARATOR+"1"+qg.CACHE_KEY_SEPARATOR;if(-1===e.indexOf(t.toLowerCase())&&-1===e.indexOf(o.toLowerCase()))return!1}else if(-1===e.indexOf(this.clientId.toLowerCase()))return!1;return!0},h.prototype.credentialMatchesFilter=function(e,t){if(t.clientId&&!this.matchClientId(e,t.clientId))return!1;if(t.userAssertionHash&&!this.matchUserAssertionHash(e,t.userAssertionHash))return!1;if("string"==typeof t.homeAccountId&&!this.matchHomeAccountId(e,t.homeAccountId))return!1;if(t.environment&&!this.matchEnvironment(e,t.environment))return!1;if(t.realm&&!this.matchRealm(e,t.realm))return!1;if(t.credentialType&&!this.matchCredentialType(e,t.credentialType))return!1;if(t.familyId&&!this.matchFamilyId(e,t.familyId))return!1;if(t.target&&!this.matchTarget(e,t.target))return!1;if((t.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==t.requestedClaimsHash)return!1;if(e.credentialType===E.ACCESS_TOKEN_WITH_AUTH_SCHEME){if(t.tokenType&&!this.matchTokenType(e,t.tokenType))return!1;if(t.tokenType===Hg.SSH&&t.keyId&&!this.matchKeyId(e,t.keyId))return!1}return!0},h.prototype.getAppMetadataFilteredBy=function(e){return this.getAppMetadataFilteredByInternal(e.environment,e.clientId)},h.prototype.getAppMetadataFilteredByInternal=function(o,r){var n=this,e=this.getKeys(),i={};return e.forEach(function(e){var t;!n.isAppMetadata(e)||!(t=n.getAppMetadata(e))||o&&!n.matchEnvironment(t,o)||r&&!n.matchClientId(t,r)||(i[e]=t)}),i},h.prototype.getAuthorityMetadataByAlias=function(t){var o=this,e=this.getAuthorityMetadataKeys(),r=null;return e.forEach(function(e){o.isAuthorityMetadata(e)&&-1!==e.indexOf(o.clientId)&&(e=o.getAuthorityMetadata(e))&&-1!==e.aliases.indexOf(t)&&(r=e)}),r},h.prototype.removeAllAccounts=function(){return b(this,void 0,void 0,function(){var t,o,r=this;return C(this,function(e){switch(e.label){case 0:return t=this.getAccountKeys(),o=[],t.forEach(function(e){o.push(r.removeAccount(e))}),[4,Promise.all(o)];case 1:return e.sent(),[2]}})})},h.prototype.removeAccount=function(o){return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:if(t=this.getAccount(o))return[4,this.removeAccountContext(t)];throw I.createNoAccountFoundError();case 1:return e.sent(),this.removeItem(o),[2]}})})},h.prototype.removeAccountContext=function(i){return b(this,void 0,void 0,function(){var t,o,r,n=this;return C(this,function(e){switch(e.label){case 0:return t=this.getTokenKeys(),o=i.generateAccountId(),r=[],t.idToken.forEach(function(e){0===e.indexOf(o)&&n.removeIdToken(e)}),t.accessToken.forEach(function(e){0===e.indexOf(o)&&r.push(n.removeAccessToken(e))}),t.refreshToken.forEach(function(e){0===e.indexOf(o)&&n.removeRefreshToken(e)}),[4,Promise.all(r)];case 1:return e.sent(),[2]}})})},h.prototype.removeAccessToken=function(o){return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:if(!(t=this.getAccessTokenCredential(o)))return[2];if(t.credentialType.toLowerCase()!==E.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())return[3,4];if(t.tokenType!==Hg.POP)return[3,4];if(!(t=t.keyId))return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.cryptoImpl.removeTokenBindingKey(t)];case 2:return e.sent(),[3,4];case 3:throw e.sent(),I.createBindingKeyNotRemovedError();case 4:return[2,this.removeItem(o)]}})})},h.prototype.removeAppMetadata=function(){var t=this;return this.getKeys().forEach(function(e){t.isAppMetadata(e)&&t.removeItem(e)}),!0},h.prototype.readCacheRecord=function(e,t,o){var r=this.getTokenKeys(),n=this.readAccountFromCache(e),i=this.getIdToken(e,r),t=this.getAccessToken(e,t,r),e=this.getRefreshToken(e,!1,r),r=this.readAppMetadataFromCache(o);return n&&i&&(n.idTokenClaims=new Ky(i.secret,this.cryptoImpl).claims),{account:n,idToken:i,accessToken:t,refreshToken:e,appMetadata:r}},h.prototype.readAccountFromCache=function(e){e=Fy.generateAccountCacheKey(e);return this.getAccount(e)},h.prototype.getIdToken=function(e,t){var o=this,e=(this.commonLogger.trace("CacheManager - getIdToken called"),{homeAccountId:e.homeAccountId,environment:e.environment,credentialType:E.ID_TOKEN,clientId:this.clientId,realm:e.tenantId}),e=this.getIdTokensByFilter(e,t),t=e.length;return t<1?(this.commonLogger.info("CacheManager:getIdToken - No token found"),null):1<t?(this.commonLogger.info("CacheManager:getIdToken - Multiple id tokens found, clearing them"),e.forEach(function(e){o.removeIdToken(e.generateCredentialKey())}),null):(this.commonLogger.info("CacheManager:getIdToken - Returning id token"),e[0])},h.prototype.getIdTokensByFilter=function(t,e){var o=this,e=e&&e.idToken||this.getTokenKeys().idToken,r=[];return e.forEach(function(e){o.idTokenKeyMatchesFilter(e,kg({clientId:o.clientId},t))&&(e=o.getIdTokenCredential(e))&&o.credentialMatchesFilter(e,t)&&r.push(e)}),r},h.prototype.idTokenKeyMatchesFilter=function(e,t){e=e.toLowerCase();return!(t.clientId&&-1===e.indexOf(t.clientId.toLowerCase())||t.homeAccountId&&-1===e.indexOf(t.homeAccountId.toLowerCase()))},h.prototype.removeIdToken=function(e){this.removeItem(e)},h.prototype.removeRefreshToken=function(e){this.removeItem(e)},h.prototype.getAccessToken=function(e,t,o){var r=this,n=(this.commonLogger.trace("CacheManager - getAccessToken called"),Uy.createSearchScopes(t.scopes)),i=t.authenticationScheme||Hg.BEARER,a=i&&i.toLowerCase()!==Hg.BEARER.toLowerCase()?E.ACCESS_TOKEN_WITH_AUTH_SCHEME:E.ACCESS_TOKEN,s={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:a,clientId:this.clientId,realm:e.tenantId,target:n,tokenType:i,keyId:t.sshKid,requestedClaimsHash:t.requestedClaimsHash},a=o&&o.accessToken||this.getTokenKeys().accessToken,c=[],e=(a.forEach(function(e){r.accessTokenKeyMatchesFilter(e,s,!0)&&(e=r.getAccessTokenCredential(e))&&r.credentialMatchesFilter(e,s)&&c.push(e)}),c.length);return e<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found"),null):1<e?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them"),c.forEach(function(e){r.removeAccessToken(e.generateCredentialKey())}),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token"),c[0])},h.prototype.accessTokenKeyMatchesFilter=function(e,t,o){var r=e.toLowerCase();if(t.clientId&&-1===r.indexOf(t.clientId.toLowerCase()))return!1;if(t.homeAccountId&&-1===r.indexOf(t.homeAccountId.toLowerCase()))return!1;if(t.realm&&-1===r.indexOf(t.realm.toLowerCase()))return!1;if(t.requestedClaimsHash&&-1===r.indexOf(t.requestedClaimsHash.toLowerCase()))return!1;if(t.target)for(var n=t.target.asArray(),i=0;i<n.length;i++){if(o&&!r.includes(n[i].toLowerCase()))return!1;if(!o&&r.includes(n[i].toLowerCase()))return!0}return!0},h.prototype.getAccessTokensByFilter=function(t){var o=this,e=this.getTokenKeys(),r=[];return e.accessToken.forEach(function(e){o.accessTokenKeyMatchesFilter(e,t,!0)&&(e=o.getAccessTokenCredential(e))&&o.credentialMatchesFilter(e,t)&&r.push(e)}),r},h.prototype.getRefreshToken=function(e,t,o){var r=this,t=(this.commonLogger.trace("CacheManager - getRefreshToken called"),t?"1":void 0),n={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:E.REFRESH_TOKEN,clientId:this.clientId,familyId:t},e=o&&o.refreshToken||this.getTokenKeys().refreshToken,i=[];return e.forEach(function(e){r.refreshTokenKeyMatchesFilter(e,n)&&(e=r.getRefreshTokenCredential(e))&&r.credentialMatchesFilter(e,n)&&i.push(e)}),i.length<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),i[0])},h.prototype.refreshTokenKeyMatchesFilter=function(e,t){e=e.toLowerCase();return!(t.familyId&&-1===e.indexOf(t.familyId.toLowerCase())||!t.familyId&&t.clientId&&-1===e.indexOf(t.clientId.toLowerCase())||t.homeAccountId&&-1===e.indexOf(t.homeAccountId.toLowerCase()))},h.prototype.readAppMetadataFromCache=function(e){var e={environment:e,clientId:this.clientId},t=this.getAppMetadataFilteredBy(e),e=Object.keys(t).map(function(e){return t[e]}),o=e.length;if(o<1)return null;if(1<o)throw I.createMultipleMatchingAppMetadataInCacheError();return e[0]},h.prototype.isAppMetadataFOCI=function(e){e=this.readAppMetadataFromCache(e);return!(!e||"1"!==e.familyId)},h.prototype.matchHomeAccountId=function(e,t){return!("string"!=typeof e.homeAccountId||t!==e.homeAccountId)},h.prototype.matchLocalAccountId=function(e,t){return!("string"!=typeof e.localAccountId||t!==e.localAccountId)},h.prototype.matchUsername=function(e,t){return!("string"!=typeof e.username||t.toLowerCase()!==e.username.toLowerCase())},h.prototype.matchUserAssertionHash=function(e,t){return!(!e.userAssertionHash||t!==e.userAssertionHash)},h.prototype.matchEnvironment=function(e,t){t=this.getAuthorityMetadataByAlias(t);return!!(t&&-1<t.aliases.indexOf(e.environment))},h.prototype.matchCredentialType=function(e,t){return e.credentialType&&t.toLowerCase()===e.credentialType.toLowerCase()},h.prototype.matchClientId=function(e,t){return!(!e.clientId||t!==e.clientId)},h.prototype.matchFamilyId=function(e,t){return!(!e.familyId||t!==e.familyId)},h.prototype.matchRealm=function(e,t){return!(!e.realm||t!==e.realm)},h.prototype.matchNativeAccountId=function(e,t){return!(!e.nativeAccountId||t!==e.nativeAccountId)},h.prototype.matchTarget=function(e,t){return!(e.credentialType!==E.ACCESS_TOKEN&&e.credentialType!==E.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target)&&Uy.fromString(e.target).containsScopeSet(t)},h.prototype.matchTokenType=function(e,t){return!(!e.tokenType||e.tokenType!==t)},h.prototype.matchKeyId=function(e,t){return!(!e.keyId||e.keyId!==t)},h.prototype.isAppMetadata=function(e){return-1!==e.indexOf(Gg)},h.prototype.isAuthorityMetadata=function(e){return-1!==e.indexOf(Yg)},h.prototype.generateAuthorityMetadataCacheKey=function(e){return Yg+"-"+this.clientId+"-"+e},h.toObject=function(e,t){for(var o in t)e[o]=t[o];return e};var Yy=h;function h(e,t,o){this.clientId=e,this.cryptoImpl=t,this.commonLogger=o.clone(ly,hy)}Ig(Qy,Wy=Yy),Qy.prototype.setAccount=function(){throw T.createUnexpectedError("Storage interface - setAccount() has not been implemented for the cacheStorage interface.")},Qy.prototype.getAccount=function(){throw T.createUnexpectedError("Storage interface - getAccount() has not been implemented for the cacheStorage interface.")},Qy.prototype.setIdTokenCredential=function(){throw T.createUnexpectedError("Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.")},Qy.prototype.getIdTokenCredential=function(){throw T.createUnexpectedError("Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.")},Qy.prototype.setAccessTokenCredential=function(){throw T.createUnexpectedError("Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.")},Qy.prototype.getAccessTokenCredential=function(){throw T.createUnexpectedError("Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.")},Qy.prototype.setRefreshTokenCredential=function(){throw T.createUnexpectedError("Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.")},Qy.prototype.getRefreshTokenCredential=function(){throw T.createUnexpectedError("Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.")},Qy.prototype.setAppMetadata=function(){throw T.createUnexpectedError("Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.")},Qy.prototype.getAppMetadata=function(){throw T.createUnexpectedError("Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.")},Qy.prototype.setServerTelemetry=function(){throw T.createUnexpectedError("Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.")},Qy.prototype.getServerTelemetry=function(){throw T.createUnexpectedError("Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.")},Qy.prototype.setAuthorityMetadata=function(){throw T.createUnexpectedError("Storage interface - setAuthorityMetadata() has not been implemented for the cacheStorage interface.")},Qy.prototype.getAuthorityMetadata=function(){throw T.createUnexpectedError("Storage interface - getAuthorityMetadata() has not been implemented for the cacheStorage interface.")},Qy.prototype.getAuthorityMetadataKeys=function(){throw T.createUnexpectedError("Storage interface - getAuthorityMetadataKeys() has not been implemented for the cacheStorage interface.")},Qy.prototype.setThrottlingCache=function(){throw T.createUnexpectedError("Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.")},Qy.prototype.getThrottlingCache=function(){throw T.createUnexpectedError("Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.")},Qy.prototype.removeItem=function(){throw T.createUnexpectedError("Storage interface - removeItem() has not been implemented for the cacheStorage interface.")},Qy.prototype.containsKey=function(){throw T.createUnexpectedError("Storage interface - containsKey() has not been implemented for the cacheStorage interface.")},Qy.prototype.getKeys=function(){throw T.createUnexpectedError("Storage interface - getKeys() has not been implemented for the cacheStorage interface.")},Qy.prototype.getAccountKeys=function(){throw T.createUnexpectedError("Storage interface - getAccountKeys() has not been implemented for the cacheStorage interface.")},Qy.prototype.getTokenKeys=function(){throw T.createUnexpectedError("Storage interface - getTokenKeys() has not been implemented for the cacheStorage interface.")},Qy.prototype.clear=function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Storage interface - clear() has not been implemented for the cacheStorage interface.")})})},Qy.prototype.updateCredentialCacheKey=function(){throw T.createUnexpectedError("Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.")};var Wy,Zy=Qy;function Qy(){return null!==Wy&&Wy.apply(this,arguments)||this}var Vy={tokenRenewalOffsetSeconds:300,preventCorsPreflight:!1},Jy={loggerCallback:function(){},piiLoggingEnabled:!1,logLevel:iy.Info,correlationId:S.EMPTY_STRING},Xy={claimsBasedCachingEnabled:!0},$y={sendGetRequestAsync:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Network interface - sendGetRequestAsync() has not been implemented")})})},sendPostRequestAsync:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Network interface - sendPostRequestAsync() has not been implemented")})})}},ev={sku:S.SKU,version:hy,cpu:S.EMPTY_STRING,os:S.EMPTY_STRING},tv={clientSecret:S.EMPTY_STRING,clientAssertion:void 0},ov={azureCloudInstance:uy.None,tenant:""+S.DEFAULT_COMMON_TENANT},rv={application:{appName:"",appVersion:""}};function nv(e){var t=e.authOptions,o=e.systemOptions,r=e.loggerOptions,n=e.cacheOptions,i=e.storageInterface,a=e.networkInterface,s=e.cryptoInterface,c=e.clientCredentials,u=e.libraryInfo,l=e.telemetry,h=e.serverTelemetryManager,d=e.persistencePlugin,e=e.serializableCache,r=kg(kg({},Jy),r);return{authOptions:kg({clientCapabilities:[],azureCloudOptions:ov,skipAuthorityMetadataCache:!1},t),systemOptions:kg(kg({},Vy),o),loggerOptions:r,cacheOptions:kg(kg({},Xy),n),storageInterface:i||new Zy(t.clientId,dm,new sy(r)),networkInterface:a||$y,cryptoInterface:s||dm,clientCredentials:c||tv,libraryInfo:kg(kg({},ev),u),telemetry:kg(kg({},rv),l),serverTelemetryManager:h||null,persistencePlugin:d||null,serializableCache:e||null}}Ig(sv,iv=T);var iv,av=sv;function sv(e,t,o){e=iv.call(this,e,t,o)||this;return e.name="ServerError",Object.setPrototypeOf(e,sv.prototype),e}uv.generateThrottlingStorageKey=function(e){return rm+"."+JSON.stringify(e)},uv.preProcess=function(e,t){var o,t=uv.generateThrottlingStorageKey(t),r=e.getThrottlingCache(t);if(r){if(!(r.throttleTime<Date.now()))throw new av((null==(o=r.errorCodes)?void 0:o.join(" "))||S.EMPTY_STRING,r.errorMessage,r.subError);e.removeItem(t)}},uv.postProcess=function(e,t,o){(uv.checkResponseStatus(o)||uv.checkResponseForRetryAfter(o))&&(o={throttleTime:uv.calculateThrottleTime(parseInt(o.headers[Pg.RETRY_AFTER])),error:o.body.error,errorCodes:o.body.error_codes,errorMessage:o.body.error_description,subError:o.body.suberror},e.setThrottlingCache(uv.generateThrottlingStorageKey(t),o))},uv.checkResponseStatus=function(e){return 429===e.status||500<=e.status&&e.status<600},uv.checkResponseForRetryAfter=function(e){return!!e.headers&&e.headers.hasOwnProperty(Pg.RETRY_AFTER)&&(e.status<200||300<=e.status)},uv.calculateThrottleTime=function(e){var e=e<=0?0:e,t=Date.now()/1e3;return Math.floor(1e3*Math.min(t+(e||tm),t+om))},uv.removeThrottle=function(e,t,o,r){t={clientId:t,authority:o.authority,scopes:o.scopes,homeAccountIdentifier:r,claims:o.claims,authenticationScheme:o.authenticationScheme,resourceRequestMethod:o.resourceRequestMethod,resourceRequestUri:o.resourceRequestUri,shrClaims:o.shrClaims,sshKid:o.sshKid},r=this.generateThrottlingStorageKey(t);e.removeItem(r)};var cv=uv;function uv(){}dv.prototype.sendPostRequest=function(r,n,i){return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:cv.preProcess(this.cacheManager,r),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkClient.sendPostRequestAsync(n,i)];case 2:return t=e.sent(),[3,4];case 3:throw(o=e.sent())instanceof T?o:I.createNetworkError(n,o);case 4:return cv.postProcess(this.cacheManager,r,t),[2,t]}})})};var lv,hv=dv;function dv(e,t){this.networkClient=e,this.cacheManager=t}(un=lv=lv||{}).HOME_ACCOUNT_ID="home_account_id",un.UPN="UPN";fv.validateRedirectUri=function(e){if(k.isEmpty(e))throw Dy.createRedirectUriEmptyError()},fv.validatePrompt=function(e){var t,o=[];for(t in zg)o.push(zg[t]);if(o.indexOf(e)<0)throw Dy.createInvalidPromptError(e)},fv.validateClaims=function(e){try{JSON.parse(e)}catch(e){throw Dy.createInvalidClaimsRequestError()}},fv.validateCodeChallengeParams=function(e,t){if(k.isEmpty(e)||k.isEmpty(t))throw Dy.createInvalidCodeChallengeParamsError();this.validateCodeChallengeMethod(t)},fv.validateCodeChallengeMethod=function(e){if([Kg.PLAIN,Kg.S256].indexOf(e)<0)throw Dy.createInvalidCodeChallengeMethodError()},fv.sanitizeEQParams=function(o,e){return o?(e.forEach(function(e,t){o[t]&&delete o[t]}),Object.fromEntries(Object.entries(o).filter(function(e){return""!==e[1]}))):{}};var pv=fv;function fv(){}d.prototype.addResponseTypeCode=function(){this.parameters.set(u.RESPONSE_TYPE,encodeURIComponent(S.CODE_RESPONSE_TYPE))},d.prototype.addResponseTypeForTokenAndIdToken=function(){this.parameters.set(u.RESPONSE_TYPE,encodeURIComponent(S.TOKEN_RESPONSE_TYPE+" "+S.ID_TOKEN_RESPONSE_TYPE))},d.prototype.addResponseMode=function(e){this.parameters.set(u.RESPONSE_MODE,encodeURIComponent(e||Ng.QUERY))},d.prototype.addNativeBroker=function(){this.parameters.set(u.NATIVE_BROKER,encodeURIComponent("1"))},d.prototype.addScopes=function(e,t){t=(t=void 0===t?!0:t)?Ag(e||[],Bg):e||[],e=new Uy(t);this.parameters.set(u.SCOPE,encodeURIComponent(e.printScopes()))},d.prototype.addClientId=function(e){this.parameters.set(u.CLIENT_ID,encodeURIComponent(e))},d.prototype.addRedirectUri=function(e){pv.validateRedirectUri(e),this.parameters.set(u.REDIRECT_URI,encodeURIComponent(e))},d.prototype.addPostLogoutRedirectUri=function(e){pv.validateRedirectUri(e),this.parameters.set(u.POST_LOGOUT_URI,encodeURIComponent(e))},d.prototype.addIdTokenHint=function(e){this.parameters.set(u.ID_TOKEN_HINT,encodeURIComponent(e))},d.prototype.addDomainHint=function(e){this.parameters.set(Mg.DOMAIN_HINT,encodeURIComponent(e))},d.prototype.addLoginHint=function(e){this.parameters.set(Mg.LOGIN_HINT,encodeURIComponent(e))},d.prototype.addCcsUpn=function(e){this.parameters.set(Pg.CCS_HEADER,encodeURIComponent("UPN:"+e))},d.prototype.addCcsOid=function(e){this.parameters.set(Pg.CCS_HEADER,encodeURIComponent("Oid:"+e.uid+"@"+e.utid))},d.prototype.addSid=function(e){this.parameters.set(Mg.SID,encodeURIComponent(e))},d.prototype.addClaims=function(e,t){e=this.addClientCapabilitiesToClaims(e,t);pv.validateClaims(e),this.parameters.set(u.CLAIMS,encodeURIComponent(e))},d.prototype.addCorrelationId=function(e){this.parameters.set(u.CLIENT_REQUEST_ID,encodeURIComponent(e))},d.prototype.addLibraryInfo=function(e){this.parameters.set(u.X_CLIENT_SKU,e.sku),this.parameters.set(u.X_CLIENT_VER,e.version),e.os&&this.parameters.set(u.X_CLIENT_OS,e.os),e.cpu&&this.parameters.set(u.X_CLIENT_CPU,e.cpu)},d.prototype.addApplicationTelemetry=function(e){null!=e&&e.appName&&this.parameters.set(u.X_APP_NAME,e.appName),null!=e&&e.appVersion&&this.parameters.set(u.X_APP_VER,e.appVersion)},d.prototype.addPrompt=function(e){pv.validatePrompt(e),this.parameters.set(""+u.PROMPT,encodeURIComponent(e))},d.prototype.addState=function(e){k.isEmpty(e)||this.parameters.set(u.STATE,encodeURIComponent(e))},d.prototype.addNonce=function(e){this.parameters.set(u.NONCE,encodeURIComponent(e))},d.prototype.addCodeChallengeParams=function(e,t){if(pv.validateCodeChallengeParams(e,t),!e||!t)throw Dy.createInvalidCodeChallengeParamsError();this.parameters.set(u.CODE_CHALLENGE,encodeURIComponent(e)),this.parameters.set(u.CODE_CHALLENGE_METHOD,encodeURIComponent(t))},d.prototype.addAuthorizationCode=function(e){this.parameters.set(u.CODE,encodeURIComponent(e))},d.prototype.addDeviceCode=function(e){this.parameters.set(u.DEVICE_CODE,encodeURIComponent(e))},d.prototype.addRefreshToken=function(e){this.parameters.set(u.REFRESH_TOKEN,encodeURIComponent(e))},d.prototype.addCodeVerifier=function(e){this.parameters.set(u.CODE_VERIFIER,encodeURIComponent(e))},d.prototype.addClientSecret=function(e){this.parameters.set(u.CLIENT_SECRET,encodeURIComponent(e))},d.prototype.addClientAssertion=function(e){k.isEmpty(e)||this.parameters.set(u.CLIENT_ASSERTION,encodeURIComponent(e))},d.prototype.addClientAssertionType=function(e){k.isEmpty(e)||this.parameters.set(u.CLIENT_ASSERTION_TYPE,encodeURIComponent(e))},d.prototype.addOboAssertion=function(e){this.parameters.set(u.OBO_ASSERTION,encodeURIComponent(e))},d.prototype.addRequestTokenUse=function(e){this.parameters.set(u.REQUESTED_TOKEN_USE,encodeURIComponent(e))},d.prototype.addGrantType=function(e){this.parameters.set(u.GRANT_TYPE,encodeURIComponent(e))},d.prototype.addClientInfo=function(){this.parameters.set("client_info","1")},d.prototype.addExtraQueryParameters=function(t){var o=this,e=pv.sanitizeEQParams(t,this.parameters);Object.keys(e).forEach(function(e){o.parameters.set(e,t[e])})},d.prototype.addClientCapabilitiesToClaims=function(e,t){var o;if(e)try{o=JSON.parse(e)}catch(e){throw Dy.createInvalidClaimsRequestError()}else o={};return t&&0<t.length&&(o.hasOwnProperty(xg.ACCESS_TOKEN)||(o[xg.ACCESS_TOKEN]={}),o[xg.ACCESS_TOKEN][xg.XMS_CC]={values:t}),JSON.stringify(o)},d.prototype.addUsername=function(e){this.parameters.set(Qg.username,encodeURIComponent(e))},d.prototype.addPassword=function(e){this.parameters.set(Qg.password,encodeURIComponent(e))},d.prototype.addPopToken=function(e){k.isEmpty(e)||(this.parameters.set(u.TOKEN_TYPE,Hg.POP),this.parameters.set(u.REQ_CNF,encodeURIComponent(e)))},d.prototype.addSshJwk=function(e){k.isEmpty(e)||(this.parameters.set(u.TOKEN_TYPE,Hg.SSH),this.parameters.set(u.REQ_CNF,encodeURIComponent(e)))},d.prototype.addServerTelemetry=function(e){this.parameters.set(u.X_CLIENT_CURR_TELEM,e.generateCurrentRequestHeaderValue()),this.parameters.set(u.X_CLIENT_LAST_TELEM,e.generateLastRequestHeaderValue())},d.prototype.addThrottling=function(){this.parameters.set(u.X_MS_LIB_CAPABILITY,nm)},d.prototype.addLogoutHint=function(e){this.parameters.set(u.LOGOUT_HINT,encodeURIComponent(e))},d.prototype.createQueryString=function(){var o=new Array;return this.parameters.forEach(function(e,t){o.push(t+"="+e)}),o.join("&")};var gv=d;function d(){this.parameters=new Map}mv.prototype.createTokenRequestHeaders=function(e){var t={};if(t[Pg.CONTENT_TYPE]=S.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case lv.HOME_ACCOUNT_ID:try{var o=By(e.credential);t[Pg.CCS_HEADER]="Oid:"+o.uid+"@"+o.utid}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case lv.UPN:t[Pg.CCS_HEADER]="UPN: "+e.credential}return t},mv.prototype.executePostToTokenEndpoint=function(o,r,n,i){return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:return[4,this.networkManager.sendPostRequest(i,o,{body:r,headers:n})];case 1:return t=e.sent(),this.config.serverTelemetryManager&&t.status<500&&429!==t.status&&this.config.serverTelemetryManager.clearTelemetryCache(),[2,t]}})})},mv.prototype.updateAuthority=function(e){if(!e.discoveryComplete())throw I.createEndpointDiscoveryIncompleteError("Updated authority has not completed endpoint discovery.");this.authority=e},mv.prototype.createTokenQueryParameters=function(e){var t=new gv;return e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.createQueryString()};e=mv;function mv(e,t){this.config=nv(e),this.logger=new sy(this.config.loggerOptions,ly,hy),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.networkManager=new hv(this.networkClient,this.cacheManager),this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}yv.prototype.generateAccountId=function(){return yv.generateAccountIdForCacheKey(this.homeAccountId,this.environment)},yv.prototype.generateCredentialId=function(){return yv.generateCredentialIdForCacheKey(this.credentialType,this.clientId,this.realm,this.familyId)},yv.prototype.generateTarget=function(){return yv.generateTargetForCacheKey(this.target)},yv.prototype.generateCredentialKey=function(){return yv.generateCredentialCacheKey(this.homeAccountId,this.environment,this.credentialType,this.clientId,this.realm,this.target,this.familyId,this.tokenType,this.requestedClaimsHash)},yv.prototype.generateType=function(){switch(this.credentialType){case E.ID_TOKEN:return Ug.ID_TOKEN;case E.ACCESS_TOKEN:case E.ACCESS_TOKEN_WITH_AUTH_SCHEME:return Ug.ACCESS_TOKEN;case E.REFRESH_TOKEN:return Ug.REFRESH_TOKEN;default:throw I.createUnexpectedCredentialTypeError()}},yv.generateCredentialCacheKey=function(e,t,o,r,n,i,a,s,c){return[this.generateAccountIdForCacheKey(e,t),this.generateCredentialIdForCacheKey(o,r,n,a),this.generateTargetForCacheKey(i),this.generateClaimsHashForCacheKey(c),this.generateSchemeForCacheKey(s)].join(qg.CACHE_KEY_SEPARATOR).toLowerCase()},yv.generateAccountIdForCacheKey=function(e,t){return[e,t].join(qg.CACHE_KEY_SEPARATOR).toLowerCase()},yv.generateCredentialIdForCacheKey=function(e,t,o,r){return[e,e===E.REFRESH_TOKEN&&r||t,o||S.EMPTY_STRING].join(qg.CACHE_KEY_SEPARATOR).toLowerCase()},yv.generateTargetForCacheKey=function(e){return(e||S.EMPTY_STRING).toLowerCase()},yv.generateClaimsHashForCacheKey=function(e){return(e||S.EMPTY_STRING).toLowerCase()},yv.generateSchemeForCacheKey=function(e){return e&&e.toLowerCase()!==Hg.BEARER.toLowerCase()?e.toLowerCase():S.EMPTY_STRING};r=yv;function yv(){}Ig(wv,vv=r),wv.createIdTokenEntity=function(e,t,o,r,n){var i=new wv;return i.credentialType=E.ID_TOKEN,i.homeAccountId=e,i.environment=t,i.clientId=r,i.secret=o,i.realm=n,i},wv.isIdTokenEntity=function(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.credentialType===E.ID_TOKEN};var vv,_v=wv;function wv(){return null!==vv&&vv.apply(this,arguments)||this}Cv.nowSeconds=function(){return Math.round((new Date).getTime()/1e3)},Cv.isTokenExpired=function(e,t){return(Number(e)||0)<Cv.nowSeconds()+t},Cv.wasClockTurnedBack=function(e){return Number(e)>Cv.nowSeconds()},Cv.delay=function(t,o){return new Promise(function(e){return setTimeout(function(){return e(o)},t)})};var bv=Cv;function Cv(){}Ig(Tv,Ev=r),Tv.createAccessTokenEntity=function(e,t,o,r,n,i,a,s,c,u,l,h,d,p,f){var g,m=new Tv,e=(m.homeAccountId=e,m.credentialType=E.ACCESS_TOKEN,m.secret=o,bv.nowSeconds());if(m.cachedAt=e.toString(),m.expiresOn=a.toString(),m.extendedExpiresOn=s.toString(),u&&(m.refreshOn=u.toString()),m.environment=t,m.clientId=r,m.realm=n,m.target=i,m.userAssertionHash=h,m.tokenType=k.isEmpty(l)?Hg.BEARER:l,p&&(m.requestedClaims=p,m.requestedClaimsHash=f),(null==(e=m.tokenType)?void 0:e.toLowerCase())!==Hg.BEARER.toLowerCase())switch(m.credentialType=E.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case Hg.POP:var y=Ky.extractTokenClaims(o,c);if(null==(g=null==y?void 0:y.cnf)||!g.kid)throw I.createTokenClaimsRequiredError();m.keyId=y.cnf.kid;break;case Hg.SSH:m.keyId=d}return m},Tv.isAccessTokenEntity=function(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.hasOwnProperty("target")&&(e.credentialType===E.ACCESS_TOKEN||e.credentialType===E.ACCESS_TOKEN_WITH_AUTH_SCHEME)};var Ev,Sv=Tv;function Tv(){return null!==Ev&&Ev.apply(this,arguments)||this}Ig(Av,Iv=r),Av.createRefreshTokenEntity=function(e,t,o,r,n,i){var a=new Av;return a.clientId=r,a.credentialType=E.REFRESH_TOKEN,a.environment=t,a.homeAccountId=e,a.secret=o,a.userAssertionHash=i,n&&(a.familyId=n),a},Av.isRefreshTokenEntity=function(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.credentialType===E.REFRESH_TOKEN};var Iv,kv=Av;function Av(){return null!==Iv&&Iv.apply(this,arguments)||this}var Pv,Ov=["interaction_required","consent_required","login_required"],Rv=["message_only","additional_action","basic_action","user_password_expired","consent_required"],xv={code:"no_tokens_found",desc:"No refresh token found in the cache. Please sign-in."},Mv={code:"native_account_unavailable",desc:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API."},Nv=(Ig(Lv,Pv=T),Lv.isInteractionRequiredError=function(e,t,o){var e=!!e&&-1<Ov.indexOf(e),o=!!o&&-1<Rv.indexOf(o),r=!!t&&Ov.some(function(e){return-1<t.indexOf(e)});return e||r||o},Lv.createNoTokensFoundError=function(){return new Lv(xv.code,xv.desc)},Lv.createNativeAccountUnavailableError=function(){return new Lv(Mv.code,Mv.desc)},Lv);function Lv(e,t,o,r,n,i,a){e=Pv.call(this,e,t,o)||this;return Object.setPrototypeOf(e,Lv.prototype),e.timestamp=r||S.EMPTY_STRING,e.traceId=n||S.EMPTY_STRING,e.correlationId=i||S.EMPTY_STRING,e.claims=a||S.EMPTY_STRING,e.name="InteractionRequiredAuthError",e}var Dv=function(e,t,o,r,n){this.account=e||null,this.idToken=t||null,this.accessToken=o||null,this.refreshToken=r||null,this.appMetadata=n||null},qv=(Uv.setRequestState=function(e,t,o){e=Uv.generateLibraryState(e,o);return k.isEmpty(t)?e:""+e+S.RESOURCE_DELIM+t},Uv.generateLibraryState=function(e,t){var o;if(e)return o={id:e.createNewGuid()},t&&(o.meta=t),t=JSON.stringify(o),e.base64Encode(t);throw I.createNoCryptoObjectError("generateLibraryState")},Uv.parseRequestState=function(e,t){if(!e)throw I.createNoCryptoObjectError("parseRequestState");if(k.isEmpty(t))throw I.createInvalidStateError(t,"Null, undefined or empty state");try{var o=t.split(S.RESOURCE_DELIM),r=o[0],n=1<o.length?o.slice(1).join(S.RESOURCE_DELIM):S.EMPTY_STRING,i=e.base64Decode(r),a=JSON.parse(i);return{userRequestState:k.isEmpty(n)?S.EMPTY_STRING:n,libraryState:a}}catch(e){throw I.createInvalidStateError(t,e)}},Uv);function Uv(){}Object.defineProperty(Hv.prototype,"urlString",{get:function(){return this._urlString},enumerable:!1,configurable:!0}),Hv.canonicalizeUri=function(e){var t;return e&&(t=e.toLowerCase(),k.endsWith(t,"?")?t=t.slice(0,-1):k.endsWith(t,"?/")&&(t=t.slice(0,-2)),k.endsWith(t,"/")||(t+="/"),t)},Hv.prototype.validateAsUri=function(){var e;try{e=this.getUrlComponents()}catch(e){throw Dy.createUrlParseError(e)}if(!e.HostNameAndPort||!e.PathSegments)throw Dy.createUrlParseError("Given url string: "+this.urlString);if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw Dy.createInsecureAuthorityUriError(this.urlString)},Hv.appendQueryString=function(e,t){return k.isEmpty(t)?e:e.indexOf("?")<0?e+"?"+t:e+"&"+t},Hv.removeHashFromUrl=function(e){return Hv.canonicalizeUri(e.split("#")[0])},Hv.prototype.replaceTenantPath=function(e){var t=this.getUrlComponents(),o=t.PathSegments;return!e||0===o.length||o[0]!==Rg.COMMON&&o[0]!==Rg.ORGANIZATIONS||(o[0]=e),Hv.constructAuthorityUriFromObject(t)},Hv.prototype.getHash=function(){return Hv.parseHash(this.urlString)},Hv.prototype.getUrlComponents=function(){var e,t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),t=this.urlString.match(t);if(t)return e=(e=(t={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]}).AbsolutePath.split("/")).filter(function(e){return e&&0<e.length}),t.PathSegments=e,!k.isEmpty(t.QueryString)&&t.QueryString.endsWith("/")&&(t.QueryString=t.QueryString.substring(0,t.QueryString.length-1)),t;throw Dy.createUrlParseError("Given url string: "+this.urlString)},Hv.getDomainFromUrl=function(e){var t=RegExp("^([^:/?#]+://)?([^/?#]*)"),t=e.match(t);if(t)return t[2];throw Dy.createUrlParseError("Given url string: "+e)},Hv.getAbsoluteUrl=function(e,t){return e[0]===S.FORWARD_SLASH?(t=new Hv(t).getUrlComponents()).Protocol+"//"+t.HostNameAndPort+e:e},Hv.parseHash=function(e){var t=e.indexOf("#"),o=e.indexOf("#/");return-1<o?e.substring(o+2):-1<t?e.substring(t+1):S.EMPTY_STRING},Hv.parseQueryString=function(e){var t=e.indexOf("?"),o=e.indexOf("/?");return-1<o?e.substring(o+2):-1<t?e.substring(t+1):S.EMPTY_STRING},Hv.constructAuthorityUriFromObject=function(e){return new Hv(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))},Hv.getDeserializedHash=function(e){if(k.isEmpty(e))return{};var t=Hv.parseHash(e),e=k.queryStringToObject(k.isEmpty(t)?e:t);if(e)return e;throw I.createHashNotDeserializedError(JSON.stringify(e))},Hv.getDeserializedQueryString=function(e){if(k.isEmpty(e))return{};var t=Hv.parseQueryString(e),e=k.queryStringToObject(k.isEmpty(t)?e:t);if(e)return e;throw I.createHashNotDeserializedError(JSON.stringify(e))},Hv.hashContainsKnownProperties=function(e){return!(k.isEmpty(e)||e.indexOf("=")<0||!((e=Hv.getDeserializedHash(e)).code||e.error_description||e.error||e.state))};var A,jv,P=Hv;function Hv(e){if(this._urlString=e,k.isEmpty(this._urlString))throw Dy.createUrlEmptyError();k.isEmpty(this.getHash())&&(this._urlString=Hv.canonicalizeUri(e))}(t=A=A||{}).AcquireTokenByCode="acquireTokenByCode",t.AcquireTokenByRefreshToken="acquireTokenByRefreshToken",t.AcquireTokenSilent="acquireTokenSilent",t.AcquireTokenSilentAsync="acquireTokenSilentAsync",t.AcquireTokenPopup="acquireTokenPopup",t.CryptoOptsGetPublicKeyThumbprint="cryptoOptsGetPublicKeyThumbprint",t.CryptoOptsSignJwt="cryptoOptsSignJwt",t.SilentCacheClientAcquireToken="silentCacheClientAcquireToken",t.SilentIframeClientAcquireToken="silentIframeClientAcquireToken",t.SilentRefreshClientAcquireToken="silentRefreshClientAcquireToken",t.SsoSilent="ssoSilent",t.StandardInteractionClientGetDiscoveredAuthority="standardInteractionClientGetDiscoveredAuthority",t.FetchAccountIdWithNativeBroker="fetchAccountIdWithNativeBroker",t.NativeInteractionClientAcquireToken="nativeInteractionClientAcquireToken",t.BaseClientCreateTokenRequestHeaders="baseClientCreateTokenRequestHeaders",t.BrokerHandhshake="brokerHandshake",t.AcquireTokenByRefreshTokenInBroker="acquireTokenByRefreshTokenInBroker",t.AcquireTokenByBroker="acquireTokenByBroker",t.RefreshTokenClientExecuteTokenRequest="refreshTokenClientExecuteTokenRequest",t.RefreshTokenClientAcquireToken="refreshTokenClientAcquireToken",t.RefreshTokenClientAcquireTokenWithCachedRefreshToken="refreshTokenClientAcquireTokenWithCachedRefreshToken",t.RefreshTokenClientAcquireTokenByRefreshToken="refreshTokenClientAcquireTokenByRefreshToken",t.RefreshTokenClientCreateTokenRequestBody="refreshTokenClientCreateTokenRequestBody",t.AcquireTokenFromCache="acquireTokenFromCache",t.AcquireTokenBySilentIframe="acquireTokenBySilentIframe",t.InitializeBaseRequest="initializeBaseRequest",t.InitializeSilentRequest="initializeSilentRequest",t.InitializeClientApplication="initializeClientApplication",t.SilentIframeClientTokenHelper="silentIframeClientTokenHelper",t.SilentHandlerInitiateAuthRequest="silentHandlerInitiateAuthRequest",t.SilentHandlerMonitorIframeForHash="silentHandlerMonitorIframeForHash",t.SilentHandlerLoadFrame="silentHandlerLoadFrame",t.StandardInteractionClientCreateAuthCodeClient="standardInteractionClientCreateAuthCodeClient",t.StandardInteractionClientGetClientConfiguration="standardInteractionClientGetClientConfiguration",t.StandardInteractionClientInitializeAuthorizationRequest="standardInteractionClientInitializeAuthorizationRequest",t.StandardInteractionClientInitializeAuthorizationCodeRequest="standardInteractionClientInitializeAuthorizationCodeRequest",t.GetAuthCodeUrl="getAuthCodeUrl",t.HandleCodeResponseFromServer="handleCodeResponseFromServer",t.HandleCodeResponseFromHash="handleCodeResponseFromHash",t.UpdateTokenEndpointAuthority="updateTokenEndpointAuthority",t.AuthClientAcquireToken="authClientAcquireToken",t.AuthClientExecuteTokenRequest="authClientExecuteTokenRequest",t.AuthClientCreateTokenRequestBody="authClientCreateTokenRequestBody",t.AuthClientCreateQueryString="authClientCreateQueryString",t.PopTokenGenerateCnf="popTokenGenerateCnf",t.PopTokenGenerateKid="popTokenGenerateKid",t.HandleServerTokenResponse="handleServerTokenResponse",t.AuthorityFactoryCreateDiscoveredInstance="authorityFactoryCreateDiscoveredInstance",t.AuthorityResolveEndpointsAsync="authorityResolveEndpointsAsync",t.AuthorityGetCloudDiscoveryMetadataFromNetwork="authorityGetCloudDiscoveryMetadataFromNetwork",t.AuthorityUpdateCloudDiscoveryMetadata="authorityUpdateCloudDiscoveryMetadata",t.AuthorityGetEndpointMetadataFromNetwork="authorityGetEndpointMetadataFromNetwork",t.AuthorityUpdateEndpointMetadata="authorityUpdateEndpointMetadata",t.AuthorityUpdateMetadataWithRegionalInformation="authorityUpdateMetadataWithRegionalInformation",t.RegionDiscoveryDetectRegion="regionDiscoveryDetectRegion",t.RegionDiscoveryGetRegionFromIMDS="regionDiscoveryGetRegionFromIMDS",t.RegionDiscoveryGetCurrentVersion="regionDiscoveryGetCurrentVersion",t.AcquireTokenByCodeAsync="acquireTokenByCodeAsync",t.GetEndpointMetadataFromNetwork="getEndpointMetadataFromNetwork",t.GetCloudDiscoveryMetadataFromNetworkMeasurement="getCloudDiscoveryMetadataFromNetworkMeasurement",t.HandleRedirectPromiseMeasurement="handleRedirectPromiseMeasurement",t.UpdateCloudDiscoveryMetadataMeasurement="updateCloudDiscoveryMetadataMeasurement",t.UsernamePasswordClientAcquireToken="usernamePasswordClientAcquireToken",t.NativeMessageHandlerHandshake="nativeMessageHandlerHandshake",t.ClearTokensAndKeysWithClaims="clearTokensAndKeysWithClaims",(n=jv=jv||{})[n.NotStarted=0]="NotStarted",n[n.InProgress=1]="InProgress",n[n.Completed=2]="Completed";var Bv,Fv=new Set(["accessTokenSize","durationMs","idTokenSize","matsSilentStatus","matsHttpStatus","refreshTokenSize","queuedTimeMs","startTimeMs","status"]),zv=((a=Bv=Bv||{}).SW="sw",a.UHW="uhw",Kv.prototype.generateCnf=function(r){var n;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:return null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.PopTokenGenerateCnf,r.correlationId),null!=(n=this.performanceClient)&&n.setPreQueueTime(A.PopTokenGenerateKid,r.correlationId),[4,this.generateKid(r)];case 1:return o=e.sent(),t=this.cryptoUtils.base64Encode(JSON.stringify(o)),o={kid:o.kid,reqCnfString:t},[4,this.cryptoUtils.hashString(t)];case 2:return[2,(o.reqCnfHash=e.sent(),o)]}})})},Kv.prototype.generateKid=function(t){var o;return b(this,void 0,void 0,function(){return C(this,function(e){switch(e.label){case 0:return null!=(o=this.performanceClient)&&o.addQueueMeasurement(A.PopTokenGenerateKid,t.correlationId),[4,this.cryptoUtils.getPublicKeyThumbprint(t)];case 1:return[2,{kid:e.sent(),xms_ksl:Bv.SW}]}})})},Kv.prototype.signPopToken=function(t,o,r){return b(this,void 0,void 0,function(){return C(this,function(e){return[2,this.signPayload(t,o,r)]})})},Kv.prototype.signPayload=function(i,a,s,c){return b(this,void 0,void 0,function(){var t,o,r,n;return C(this,function(e){switch(e.label){case 0:return t=s.resourceRequestMethod,n=s.resourceRequestUri,o=s.shrClaims,r=s.shrNonce,n=n?new P(n):void 0,n=null==n?void 0:n.getUrlComponents(),[4,this.cryptoUtils.signJwt(kg({at:i,ts:bv.nowSeconds(),m:null==t?void 0:t.toUpperCase(),u:null==n?void 0:n.HostNameAndPort,nonce:r||this.cryptoUtils.createNewGuid(),p:null==n?void 0:n.AbsolutePath,q:null!=n&&n.QueryString?[[],n.QueryString]:void 0,client_claims:o||void 0},c),a,s.correlationId)];case 1:return[2,e.sent()]}})})},Kv);function Kv(e,t){this.cryptoUtils=e,this.performanceClient=t}Yv.prototype.generateAppMetadataKey=function(){return Yv.generateAppMetadataCacheKey(this.environment,this.clientId)},Yv.generateAppMetadataCacheKey=function(e,t){return[Gg,e,t].join(qg.CACHE_KEY_SEPARATOR).toLowerCase()},Yv.createAppMetadataEntity=function(e,t,o){var r=new Yv;return r.clientId=e,r.environment=t,o&&(r.familyId=o),r},Yv.isAppMetadataEntity=function(e,t){return!!t&&0===e.indexOf(Gg)&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("environment")};var Gv=Yv;function Yv(){}Object.defineProperty(Zv.prototype,"cacheHasChanged",{get:function(){return this.hasChanged},enumerable:!1,configurable:!0}),Object.defineProperty(Zv.prototype,"tokenCache",{get:function(){return this.cache},enumerable:!1,configurable:!0});var Wv=Zv;function Zv(e,t){this.cache=e,this.hasChanged=t}Vv.prototype.validateServerAuthorizationCodeResponse=function(e,t,o){if(!e.state||!t)throw e.state?I.createStateNotFoundError("Cached State"):I.createStateNotFoundError("Server State");if(decodeURIComponent(e.state)!==decodeURIComponent(t))throw I.createStateMismatchError();if(e.error||e.error_description||e.suberror){if(Nv.isInteractionRequiredError(e.error,e.error_description,e.suberror))throw new Nv(e.error||S.EMPTY_STRING,e.error_description,e.suberror,e.timestamp||S.EMPTY_STRING,e.trace_id||S.EMPTY_STRING,e.correlation_id||S.EMPTY_STRING,e.claims||S.EMPTY_STRING);throw new av(e.error||S.EMPTY_STRING,e.error_description,e.suberror)}e.client_info&&Hy(e.client_info,o)},Vv.prototype.validateTokenResponse=function(e){if(e.error||e.error_description||e.suberror){if(Nv.isInteractionRequiredError(e.error,e.error_description,e.suberror))throw new Nv(e.error,e.error_description,e.suberror,e.timestamp||S.EMPTY_STRING,e.trace_id||S.EMPTY_STRING,e.correlation_id||S.EMPTY_STRING,e.claims||S.EMPTY_STRING);var t=e.error_codes+" - ["+e.timestamp+"]: "+e.error_description+" - Correlation ID: "+e.correlation_id+" - Trace ID: "+e.trace_id;throw new av(e.error,t,e.suberror)}},Vv.prototype.handleServerTokenResponse=function(a,s,c,u,l,h,d,p,f){var g;return b(this,void 0,void 0,function(){var t,o,r,n,i;return C(this,function(e){switch(e.label){case 0:if(null!=(g=this.performanceClient)&&g.addQueueMeasurement(A.HandleServerTokenResponse,a.correlation_id),a.id_token){if(t=new Ky(a.id_token||S.EMPTY_STRING,this.cryptoObj),l&&!k.isEmpty(l.nonce)&&t.claims.nonce!==l.nonce)throw I.createNonceMismatchError();if(u.maxAge||0===u.maxAge){if(!(r=t.claims.auth_time))throw I.createAuthTimeNotFoundError();Ky.checkMaxAge(r,u.maxAge)}}this.homeAccountIdentifier=Fy.generateHomeAccountId(a.client_info||S.EMPTY_STRING,s.authorityType,this.logger,this.cryptoObj,t),l&&l.state&&(o=qv.parseRequestState(this.cryptoObj,l.state)),a.key_id=a.key_id||u.sshKid||void 0,r=this.generateCacheRecord(a,s,c,u,t,h,l),e.label=1;case 1:return(e.trys.push([1,,5,8]),this.persistencePlugin&&this.serializableCache)?(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),n=new Wv(this.serializableCache,!0),[4,this.persistencePlugin.beforeCacheAccess(n)]):[3,3];case 2:e.sent(),e.label=3;case 3:return!d||p||!r.account||(i=r.account.generateAccountKey(),this.cacheStorage.getAccount(i))?[4,this.cacheStorage.saveCacheRecord(r)]:(this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),[2,Vv.generateAuthenticationResult(this.cryptoObj,s,r,!1,u,t,o,void 0,f)]);case 4:return e.sent(),[3,8];case 5:return this.persistencePlugin&&this.serializableCache&&n?(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),[4,this.persistencePlugin.afterCacheAccess(n)]):[3,7];case 6:e.sent(),e.label=7;case 7:return[7];case 8:return[2,Vv.generateAuthenticationResult(this.cryptoObj,s,r,!1,u,t,o,a,f)]}})})},Vv.prototype.generateCacheRecord=function(e,t,o,r,n,i,a){var s,c,u=t.getPreferredCache();if(k.isEmpty(u))throw I.createInvalidCacheEnvironmentError();!k.isEmpty(e.id_token)&&n&&(s=_v.createIdTokenEntity(this.homeAccountIdentifier,u,e.id_token||S.EMPTY_STRING,this.clientId,n.claims.tid||S.EMPTY_STRING),c=this.generateAccountEntity(e,n,t,a));var l,h,d,a=null,p=(k.isEmpty(e.access_token)||(l=e.scope?Uy.fromString(e.scope):new Uy(r.scopes||[]),d=(h=o+(("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0))+(("string"==typeof e.ext_expires_in?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0),o=(p=("string"==typeof e.refresh_in?parseInt(e.refresh_in,10):e.refresh_in)||void 0)&&0<p?o+p:void 0,a=Sv.createAccessTokenEntity(this.homeAccountIdentifier,u,e.access_token||S.EMPTY_STRING,this.clientId,n?n.claims.tid||S.EMPTY_STRING:t.tenant,l.printScopes(),h,d,this.cryptoObj,o,e.token_type,i,e.key_id,r.claims,r.requestedClaimsHash)),null),n=(k.isEmpty(e.refresh_token)||(p=kv.createRefreshTokenEntity(this.homeAccountIdentifier,u,e.refresh_token||S.EMPTY_STRING,this.clientId,e.foci,i)),null);return k.isEmpty(e.foci)||(n=Gv.createAppMetadataEntity(this.clientId,u,e.foci)),new Dv(c,s,a,p,n)},Vv.prototype.generateAccountEntity=function(e,t,o,r){var n=o.authorityType,i=r?r.cloud_graph_host_name:S.EMPTY_STRING,r=r?r.msgraph_host:S.EMPTY_STRING;if(n===qy.Adfs)return this.logger.verbose("Authority type is ADFS, creating ADFS account"),Fy.createGenericAccount(this.homeAccountIdentifier,t,o,i,r);if(k.isEmpty(e.client_info)&&"AAD"===o.protocolMode)throw I.createClientInfoEmptyError();return e.client_info?Fy.createAccount(e.client_info,this.homeAccountIdentifier,t,o,i,r):Fy.createGenericAccount(this.homeAccountIdentifier,t,o,i,r)},Vv.generateAuthenticationResult=function(u,l,h,d,p,f,g,m,y){var v;return b(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c;return C(this,function(e){switch(e.label){case 0:if(t=S.EMPTY_STRING,o=[],r=null,i=S.EMPTY_STRING,!h.accessToken)return[3,4];if(h.accessToken.tokenType!==Hg.POP)return[3,2];if(s=new zv(u),a=h.accessToken,c=a.secret,a=a.keyId)return[4,s.signPopToken(c,a,p)];throw I.createKeyIdMissingError();case 1:return t=e.sent(),[3,3];case 2:t=h.accessToken.secret,e.label=3;case 3:o=Uy.fromString(h.accessToken.target).asArray(),r=new Date(1e3*Number(h.accessToken.expiresOn)),n=new Date(1e3*Number(h.accessToken.extendedExpiresOn)),e.label=4;case 4:return h.appMetadata&&(i="1"===h.appMetadata.familyId?"1":S.EMPTY_STRING),s=(null==f?void 0:f.claims.oid)||(null==f?void 0:f.claims.sub)||S.EMPTY_STRING,c=(null==f?void 0:f.claims.tid)||S.EMPTY_STRING,null!=m&&m.spa_accountid&&h.account&&(h.account.nativeAccountId=null==m?void 0:m.spa_accountid),[2,{authority:l.canonicalAuthority,uniqueId:s,tenantId:c,scopes:o,account:h.account?h.account.getAccountInfo():null,idToken:f?f.rawToken:S.EMPTY_STRING,idTokenClaims:f?f.claims:{},accessToken:t,fromCache:d,expiresOn:r,correlationId:p.correlationId,requestId:y||S.EMPTY_STRING,extExpiresOn:n,familyId:i,tokenType:(null==(v=h.accessToken)?void 0:v.tokenType)||S.EMPTY_STRING,state:g?g.userRequestState:S.EMPTY_STRING,cloudGraphHostName:(null==(v=h.account)?void 0:v.cloudGraphHostName)||S.EMPTY_STRING,msGraphHost:(null==(v=h.account)?void 0:v.msGraphHost)||S.EMPTY_STRING,code:null==m?void 0:m.spa_code,fromNativeBroker:!1}]}})})};var Qv=Vv;function Vv(e,t,o,r,n,i,a){this.clientId=e,this.cacheStorage=t,this.cryptoObj=o,this.logger=r,this.serializableCache=n,this.persistencePlugin=i,this.performanceClient=a}Ig($v,Jv=e),$v.prototype.getAuthCodeUrl=function(o){var r;return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:return null!=(r=this.performanceClient)&&r.addQueueMeasurement(A.GetAuthCodeUrl,o.correlationId),null!=(r=this.performanceClient)&&r.setPreQueueTime(A.AuthClientCreateQueryString,o.correlationId),[4,this.createAuthCodeUrlQueryString(o)];case 1:return t=e.sent(),[2,P.appendQueryString(this.authority.authorizationEndpoint,t)]}})})},$v.prototype.acquireToken=function(s,c){var u,l;return b(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return C(this,function(e){switch(e.label){case 0:if(s&&s.code)return null!=(u=this.performanceClient)&&u.addQueueMeasurement(A.AuthClientAcquireToken,s.correlationId),t=null==(u=this.performanceClient)?void 0:u.startMeasurement("AuthCodeClientAcquireToken",s.correlationId),this.logger.info("in acquireToken call in auth-code client"),o=bv.nowSeconds(),null!=(u=this.performanceClient)&&u.setPreQueueTime(A.AuthClientExecuteTokenRequest,s.correlationId),[4,this.executeTokenRequest(this.authority,s)];throw I.createTokenRequestCannotBeMadeError();case 1:return r=e.sent(),n=null==(u=r.headers)?void 0:u[Pg.X_MS_REQUEST_ID],(i=null==(l=r.headers)?void 0:l[Pg.X_MS_HTTP_VERSION])&&null!=t&&t.addStaticFields({httpVerAuthority:i}),(i=new Qv(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient)).validateTokenResponse(r.body),null!=(l=this.performanceClient)&&l.setPreQueueTime(A.HandleServerTokenResponse,s.correlationId),[2,i.handleServerTokenResponse(r.body,this.authority,o,s,c,void 0,void 0,void 0,n).then(function(e){return null!=t&&t.endMeasurement({success:!0}),e}).catch(function(e){throw a.logger.verbose("Error in fetching token in ACC",s.correlationId),null!=t&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})]}})})},$v.prototype.handleFragmentResponse=function(e,t){var o=new Qv(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null),e=new P(e),e=P.getDeserializedHash(e.getHash());if(o.validateServerAuthorizationCodeResponse(e,t,this.cryptoUtils),e.code)return kg(kg({},e),{code:e.code});throw I.createNoAuthCodeInServerResponseError()},$v.prototype.getLogoutUri=function(e){if(e)return e=this.createLogoutUrlQueryString(e),P.appendQueryString(this.authority.endSessionEndpoint,e);throw Dy.createEmptyLogoutRequestError()},$v.prototype.executeTokenRequest=function(a,s){var c;return b(this,void 0,void 0,function(){var t,o,r,n,i;return C(this,function(e){switch(e.label){case 0:return null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.AuthClientExecuteTokenRequest,s.correlationId),null!=(c=this.performanceClient)&&c.setPreQueueTime(A.AuthClientCreateTokenRequestBody,s.correlationId),t=this.createTokenQueryParameters(s),t=P.appendQueryString(a.tokenEndpoint,t),[4,this.createTokenRequestBody(s)];case 1:if(o=e.sent(),n=void 0,s.clientInfo)try{r=Hy(s.clientInfo,this.cryptoUtils),n={credential:""+r.uid+qg.CLIENT_INFO_SEPARATOR+r.utid,type:lv.HOME_ACCOUNT_ID}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}return n=this.createTokenRequestHeaders(n||s.ccsCredential),i={clientId:this.config.authOptions.clientId,authority:a.canonicalAuthority,scopes:s.scopes,claims:s.claims,authenticationScheme:s.authenticationScheme,resourceRequestMethod:s.resourceRequestMethod,resourceRequestUri:s.resourceRequestUri,shrClaims:s.shrClaims,sshKid:s.sshKid},[2,this.executePostToTokenEndpoint(t,o,n,i)]}})})},$v.prototype.createTokenRequestBody=function(s){var c;return b(this,void 0,void 0,function(){var t,o,r,n,i,a;return C(this,function(e){switch(e.label){case 0:return(null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.AuthClientCreateTokenRequestBody,s.correlationId),(t=new gv).addClientId(this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(s.redirectUri):pv.validateRedirectUri(s.redirectUri),t.addScopes(s.scopes),t.addAuthorizationCode(s.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&t.addServerTelemetry(this.serverTelemetryManager),s.codeVerifier&&t.addCodeVerifier(s.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion&&(o=this.config.clientCredentials.clientAssertion,t.addClientAssertion(o.assertion),t.addClientAssertionType(o.assertionType)),t.addGrantType(Lg.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),s.authenticationScheme!==Hg.POP)?[3,2]:(o=new zv(this.cryptoUtils,this.performanceClient),null!=(c=this.performanceClient)&&c.setPreQueueTime(A.PopTokenGenerateCnf,s.correlationId),[4,o.generateCnf(s)]);case 1:return r=e.sent(),t.addPopToken(r.reqCnfString),[3,3];case 2:if(s.authenticationScheme===Hg.SSH){if(!s.sshJwk)throw Dy.createMissingSshJwkError();t.addSshJwk(s.sshJwk)}e.label=3;case 3:if(r=s.correlationId||this.config.cryptoInterface.createNewGuid(),t.addCorrelationId(r),(!k.isEmptyObj(s.claims)||this.config.authOptions.clientCapabilities&&0<this.config.authOptions.clientCapabilities.length)&&t.addClaims(s.claims,this.config.authOptions.clientCapabilities),n=void 0,s.clientInfo)try{i=Hy(s.clientInfo,this.cryptoUtils),n={credential:""+i.uid+qg.CLIENT_INFO_SEPARATOR+i.utid,type:lv.HOME_ACCOUNT_ID}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}else n=s.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&n)switch(n.type){case lv.HOME_ACCOUNT_ID:try{i=By(n.credential),t.addCcsOid(i)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case lv.UPN:t.addCcsUpn(n.credential)}return s.tokenBodyParameters&&t.addExtraQueryParameters(s.tokenBodyParameters),!s.enableSpaAuthorizationCode||s.tokenBodyParameters&&s.tokenBodyParameters[u.RETURN_SPA_CODE]||t.addExtraQueryParameters(((a={})[u.RETURN_SPA_CODE]="1",a)),[2,t.createQueryString()]}})})},$v.prototype.createAuthCodeUrlQueryString=function(i){var a;return b(this,void 0,void 0,function(){var t,o,r,n;return C(this,function(e){switch(e.label){case 0:if(null!=(a=this.performanceClient)&&a.addQueueMeasurement(A.AuthClientCreateQueryString,i.correlationId),(t=new gv).addClientId(this.config.authOptions.clientId),o=Ag(i.scopes||[],i.extraScopesToConsent||[]),t.addScopes(o),t.addRedirectUri(i.redirectUri),o=i.correlationId||this.config.cryptoInterface.createNewGuid(),t.addCorrelationId(o),t.addResponseMode(i.responseMode),t.addResponseTypeCode(),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addClientInfo(),i.codeChallenge&&i.codeChallengeMethod&&t.addCodeChallengeParams(i.codeChallenge,i.codeChallengeMethod),i.prompt&&t.addPrompt(i.prompt),i.domainHint&&t.addDomainHint(i.domainHint),i.prompt!==zg.SELECT_ACCOUNT)if(i.sid&&i.prompt===zg.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),t.addSid(i.sid);else if(i.account){if(o=this.extractAccountSid(i.account),n=this.extractLoginHint(i.account)){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),t.addLoginHint(n);try{r=By(i.account.homeAccountId),t.addCcsOid(r)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(o&&i.prompt===zg.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),t.addSid(o);try{r=By(i.account.homeAccountId),t.addCcsOid(r)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(i.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),t.addLoginHint(i.loginHint),t.addCcsUpn(i.loginHint);else if(i.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),t.addLoginHint(i.account.username);try{r=By(i.account.homeAccountId),t.addCcsOid(r)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else i.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),t.addLoginHint(i.loginHint),t.addCcsUpn(i.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return(i.nonce&&t.addNonce(i.nonce),i.state&&t.addState(i.state),(!k.isEmpty(i.claims)||this.config.authOptions.clientCapabilities&&0<this.config.authOptions.clientCapabilities.length)&&t.addClaims(i.claims,this.config.authOptions.clientCapabilities),i.extraQueryParameters&&t.addExtraQueryParameters(i.extraQueryParameters),i.nativeBroker)?(t.addNativeBroker(),i.authenticationScheme!==Hg.POP?[3,2]:[4,new zv(this.cryptoUtils).generateCnf(i)]):[3,2];case 1:n=e.sent(),t.addPopToken(n.reqCnfString),e.label=2;case 2:return[2,t.createQueryString()]}})})},$v.prototype.createLogoutUrlQueryString=function(e){var t=new gv;return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters),t.createQueryString()},$v.prototype.extractAccountSid=function(e){return(null==(e=e.idTokenClaims)?void 0:e.sid)||null},$v.prototype.extractLoginHint=function(e){return(null==(e=e.idTokenClaims)?void 0:e.login_hint)||null};var Jv,Xv=$v;function $v(e,t){e=Jv.call(this,e,t)||this;return e.includeRedirectUri=!0,e}Ig(o_,e_=e),o_.prototype.acquireToken=function(s){var c,u,l;return b(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return C(this,function(e){switch(e.label){case 0:return null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.RefreshTokenClientAcquireToken,s.correlationId),t=null==(c=this.performanceClient)?void 0:c.startMeasurement(A.RefreshTokenClientAcquireToken,s.correlationId),this.logger.verbose("RefreshTokenClientAcquireToken called",s.correlationId),o=bv.nowSeconds(),null!=(c=this.performanceClient)&&c.setPreQueueTime(A.RefreshTokenClientExecuteTokenRequest,s.correlationId),[4,this.executeTokenRequest(s,this.authority)];case 1:return r=e.sent(),n=null==(c=r.headers)?void 0:c[Pg.X_MS_HTTP_VERSION],null!=t&&t.addStaticFields({refreshTokenSize:(null==(u=r.body.refresh_token)?void 0:u.length)||0}),n&&null!=t&&t.addStaticFields({httpVerToken:n}),n=null==(u=r.headers)?void 0:u[Pg.X_MS_REQUEST_ID],(i=new Qv(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin)).validateTokenResponse(r.body),null!=(l=this.performanceClient)&&l.setPreQueueTime(A.HandleServerTokenResponse,s.correlationId),[2,i.handleServerTokenResponse(r.body,this.authority,o,s,void 0,void 0,!0,s.forceCache,n).then(function(e){return null!=t&&t.endMeasurement({success:!0}),e}).catch(function(e){throw a.logger.verbose("Error in fetching refresh token",s.correlationId),null!=t&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})]}})})},o_.prototype.acquireTokenByRefreshToken=function(r){var n,i;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){if(!r)throw Dy.createEmptyTokenRequestError();if(null!=(i=this.performanceClient)&&i.addQueueMeasurement(A.RefreshTokenClientAcquireTokenByRefreshToken,r.correlationId),!r.account)throw I.createNoAccountInSilentRequestError();if(this.cacheManager.isAppMetadataFOCI(r.account.environment))try{return null!=(n=this.performanceClient)&&n.setPreQueueTime(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),[2,this.acquireTokenWithCachedRefreshToken(r,!0)]}catch(e){if(t=e instanceof Nv&&e.errorCode===xv.code,o=e instanceof av&&e.errorCode===im&&e.subError===am,t||o)return null!=(i=this.performanceClient)&&i.setPreQueueTime(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),[2,this.acquireTokenWithCachedRefreshToken(r,!1)];throw e}return null!=(i=this.performanceClient)&&i.setPreQueueTime(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),[2,this.acquireTokenWithCachedRefreshToken(r,!1)]})})},o_.prototype.acquireTokenWithCachedRefreshToken=function(r,n){var i;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){if(null!=(i=this.performanceClient)&&i.addQueueMeasurement(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),t=null==(i=this.performanceClient)?void 0:i.startMeasurement(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called",r.correlationId),o=this.cacheManager.getRefreshToken(r.account,n))return null!=t&&t.endMeasurement({success:!0}),o=kg(kg({},r),{refreshToken:o.secret,authenticationScheme:r.authenticationScheme||Hg.BEARER,ccsCredential:{credential:r.account.homeAccountId,type:lv.HOME_ACCOUNT_ID}}),null!=(i=this.performanceClient)&&i.setPreQueueTime(A.RefreshTokenClientAcquireToken,r.correlationId),[2,this.acquireToken(o)];throw null!=t&&t.discardMeasurement(),Nv.createNoTokensFoundError()})})},o_.prototype.executeTokenRequest=function(a,s){var c;return b(this,void 0,void 0,function(){var t,o,r,n,i;return C(this,function(e){switch(e.label){case 0:return null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.RefreshTokenClientExecuteTokenRequest,a.correlationId),t=null==(c=this.performanceClient)?void 0:c.startMeasurement(A.RefreshTokenClientExecuteTokenRequest,a.correlationId),null!=(c=this.performanceClient)&&c.setPreQueueTime(A.RefreshTokenClientCreateTokenRequestBody,a.correlationId),o=this.createTokenQueryParameters(a),o=P.appendQueryString(s.tokenEndpoint,o),[4,this.createTokenRequestBody(a)];case 1:return r=e.sent(),n=this.createTokenRequestHeaders(a.ccsCredential),i={clientId:this.config.authOptions.clientId,authority:s.canonicalAuthority,scopes:a.scopes,claims:a.claims,authenticationScheme:a.authenticationScheme,resourceRequestMethod:a.resourceRequestMethod,resourceRequestUri:a.resourceRequestUri,shrClaims:a.shrClaims,sshKid:a.sshKid},[2,this.executePostToTokenEndpoint(o,r,n,i).then(function(e){return null!=t&&t.endMeasurement({success:!0}),e}).catch(function(e){throw null!=t&&t.endMeasurement({success:!1}),e})]}})})},o_.prototype.createTokenRequestBody=function(i){var a;return b(this,void 0,void 0,function(){var t,o,r,n;return C(this,function(e){switch(e.label){case 0:return(null!=(a=this.performanceClient)&&a.addQueueMeasurement(A.RefreshTokenClientCreateTokenRequestBody,i.correlationId),r=i.correlationId,t=null==(a=this.performanceClient)?void 0:a.startMeasurement(A.BaseClientCreateTokenRequestHeaders,r),(o=new gv).addClientId(this.config.authOptions.clientId),o.addScopes(i.scopes),o.addGrantType(Lg.REFRESH_TOKEN_GRANT),o.addClientInfo(),o.addLibraryInfo(this.config.libraryInfo),o.addApplicationTelemetry(this.config.telemetry.application),o.addThrottling(),this.serverTelemetryManager&&o.addServerTelemetry(this.serverTelemetryManager),o.addCorrelationId(r),o.addRefreshToken(i.refreshToken),this.config.clientCredentials.clientSecret&&o.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion&&(r=this.config.clientCredentials.clientAssertion,o.addClientAssertion(r.assertion),o.addClientAssertionType(r.assertionType)),i.authenticationScheme!==Hg.POP)?[3,2]:(r=new zv(this.cryptoUtils,this.performanceClient),null!=(a=this.performanceClient)&&a.setPreQueueTime(A.PopTokenGenerateCnf,i.correlationId),[4,r.generateCnf(i)]);case 1:return r=e.sent(),o.addPopToken(r.reqCnfString),[3,3];case 2:if(i.authenticationScheme===Hg.SSH){if(!i.sshJwk)throw null!=t&&t.endMeasurement({success:!1}),Dy.createMissingSshJwkError();o.addSshJwk(i.sshJwk)}e.label=3;case 3:if((!k.isEmptyObj(i.claims)||this.config.authOptions.clientCapabilities&&0<this.config.authOptions.clientCapabilities.length)&&o.addClaims(i.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&i.ccsCredential)switch(i.ccsCredential.type){case lv.HOME_ACCOUNT_ID:try{n=By(i.ccsCredential.credential),o.addCcsOid(n)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case lv.UPN:o.addCcsUpn(i.ccsCredential.credential)}return null!=t&&t.endMeasurement({success:!0}),[2,o.createQueryString()]}})})};var e_,t_=o_;function o_(e,t){return e_.call(this,e,t)||this}Ig(i_,r_=e),i_.prototype.acquireToken=function(o){return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.acquireCachedToken(o)];case 1:return[2,e.sent()];case 2:if((t=e.sent())instanceof I&&t.errorCode===Vm.code)return[2,new t_(this.config,this.performanceClient).acquireTokenByRefreshToken(o)];throw t;case 3:return[2]}})})},i_.prototype.acquireCachedToken=function(o){var r,n,i;return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:if(!o)throw Dy.createEmptyTokenRequestError();if(o.forceRefresh)throw null!=(r=this.serverTelemetryManager)&&r.setCacheOutcome($g.FORCE_REFRESH),this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true."),I.createRefreshRequiredError();if(!this.config.cacheOptions.claimsBasedCachingEnabled&&!k.isEmptyObj(o.claims))throw null!=(r=this.serverTelemetryManager)&&r.setCacheOutcome($g.CLAIMS_REQUESTED_CACHE_SKIPPED),this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims-based caching is disabled and claims were requested."),I.createRefreshRequiredError();if(!o.account)throw I.createNoAccountInSilentRequestError();if(t=o.authority||this.authority.getPreferredCache(),!(t=this.cacheManager.readCacheRecord(o.account,o,t)).accessToken)throw null!=(n=this.serverTelemetryManager)&&n.setCacheOutcome($g.NO_CACHED_ACCESS_TOKEN),this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties."),I.createRefreshRequiredError();if(bv.wasClockTurnedBack(t.accessToken.cachedAt)||bv.isTokenExpired(t.accessToken.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw null!=(n=this.serverTelemetryManager)&&n.setCacheOutcome($g.CACHED_ACCESS_TOKEN_EXPIRED),this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within "+this.config.systemOptions.tokenRenewalOffsetSeconds+" seconds."),I.createRefreshRequiredError();if(t.accessToken.refreshOn&&bv.isTokenExpired(t.accessToken.refreshOn,0))throw null!=(i=this.serverTelemetryManager)&&i.setCacheOutcome($g.REFRESH_CACHED_ACCESS_TOKEN),this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'."),I.createRefreshRequiredError();return this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[4,this.generateResultFromCacheRecord(t,o)];case 1:return[2,e.sent()]}})})},i_.prototype.generateResultFromCacheRecord=function(r,n){return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:if(r.idToken&&(t=new Ky(r.idToken.secret,this.config.cryptoInterface)),n.maxAge||0===n.maxAge){if(!(o=null==t?void 0:t.claims.auth_time))throw I.createAuthTimeNotFoundError();Ky.checkMaxAge(o,n.maxAge)}return[4,Qv.generateAuthenticationResult(this.cryptoUtils,this.authority,r,!0,n,t)];case 1:return[2,e.sent()]}})})};var r_,n_=i_;function i_(e,t){return r_.call(this,e,t)||this}var a_,s_={"https://login.microsoftonline.com/common/":{token_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/common/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/common/":{token_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/common/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/common/":{token_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/common/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"},"https://login.microsoftonline.com/consumers/":{token_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/consumers/":{token_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/consumers/":{token_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"},"https://login.microsoftonline.com/organizations/":{token_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/organizations/":{token_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/organizations/":{token_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"}},c_={"https://login.microsoftonline.com/common/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/common/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/common/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.com/consumers/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/consumers/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/consumers/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.com/organizations/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/organizations/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/organizations/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},u_=((bn=a_=a_||{}).AAD="AAD",bn.OIDC="OIDC",l_.prototype.updateCloudDiscoveryMetadata=function(e,t){this.aliases=e.aliases,this.preferred_cache=e.preferred_cache,this.preferred_network=e.preferred_network,this.aliasesFromNetwork=t},l_.prototype.updateEndpointMetadata=function(e,t){this.authorization_endpoint=e.authorization_endpoint,this.token_endpoint=e.token_endpoint,this.end_session_endpoint=e.end_session_endpoint,this.issuer=e.issuer,this.endpointsFromNetwork=t,this.jwks_uri=e.jwks_uri},l_.prototype.updateCanonicalAuthority=function(e){this.canonical_authority=e},l_.prototype.resetExpiresAt=function(){this.expiresAt=bv.nowSeconds()+Wg},l_.prototype.isExpired=function(){return this.expiresAt<=bv.nowSeconds()},l_.isAuthorityMetadataEntity=function(e,t){return!!t&&0===e.indexOf(Yg)&&t.hasOwnProperty("aliases")&&t.hasOwnProperty("preferred_cache")&&t.hasOwnProperty("preferred_network")&&t.hasOwnProperty("canonical_authority")&&t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("aliasesFromNetwork")&&t.hasOwnProperty("endpointsFromNetwork")&&t.hasOwnProperty("expiresAt")&&t.hasOwnProperty("jwks_uri")},l_);function l_(){this.expiresAt=bv.nowSeconds()+Wg}d_.prototype.detectRegion=function(i,a){var s,c;return b(this,void 0,void 0,function(){var t,o,r,n;return C(this,function(e){switch(e.label){case 0:if(null!=(s=this.performanceClient)&&s.addQueueMeasurement(A.RegionDiscoveryDetectRegion,this.correlationId),t=i)return[3,8];o=d_.IMDS_OPTIONS,e.label=1;case 1:return e.trys.push([1,6,,7]),null!=(s=this.performanceClient)&&s.setPreQueueTime(A.RegionDiscoveryGetRegionFromIMDS,this.correlationId),[4,this.getRegionFromIMDS(S.IMDS_VERSION,o)];case 2:return((r=e.sent()).status===Vg.httpSuccess&&(t=r.body,a.region_source=Jg.IMDS),r.status!==Vg.httpBadRequest)?[3,5]:(null!=(c=this.performanceClient)&&c.setPreQueueTime(A.RegionDiscoveryGetCurrentVersion,this.correlationId),[4,this.getCurrentVersion(o)]);case 3:return(r=e.sent())?(null!=(c=this.performanceClient)&&c.setPreQueueTime(A.RegionDiscoveryGetRegionFromIMDS,this.correlationId),[4,this.getRegionFromIMDS(r,o)]):(a.region_source=Jg.FAILED_AUTO_DETECTION,[2,null]);case 4:(n=e.sent()).status===Vg.httpSuccess&&(t=n.body,a.region_source=Jg.IMDS),e.label=5;case 5:return[3,7];case 6:return e.sent(),a.region_source=Jg.FAILED_AUTO_DETECTION,[2,null];case 7:return[3,9];case 8:a.region_source=Jg.ENVIRONMENT_VARIABLE,e.label=9;case 9:return t||(a.region_source=Jg.FAILED_AUTO_DETECTION),[2,t||null]}})})},d_.prototype.getRegionFromIMDS=function(t,o){var r;return b(this,void 0,void 0,function(){return C(this,function(e){return null!=(r=this.performanceClient)&&r.addQueueMeasurement(A.RegionDiscoveryGetRegionFromIMDS,this.correlationId),[2,this.networkInterface.sendGetRequestAsync(S.IMDS_ENDPOINT+"?api-version="+t+"&format=text",o,S.IMDS_TIMEOUT)]})})},d_.prototype.getCurrentVersion=function(o){var r;return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:null!=(r=this.performanceClient)&&r.addQueueMeasurement(A.RegionDiscoveryGetCurrentVersion,this.correlationId),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkInterface.sendGetRequestAsync(S.IMDS_ENDPOINT+"?format=json",o)];case 2:return(t=e.sent()).status===Vg.httpBadRequest&&t.body&&t.body["newest-versions"]&&0<t.body["newest-versions"].length?[2,t.body["newest-versions"][0]]:[2,null];case 3:return e.sent(),[2,null];case 4:return[2]}})})},d_.IMDS_OPTIONS={headers:{Metadata:"true"}};var h_=d_;function d_(e,t,o){this.networkInterface=e,this.performanceClient=t,this.correlationId=o}p.prototype.getAuthorityType=function(e){if(e.HostNameAndPort.endsWith(S.CIAM_AUTH_URL))return qy.Ciam;e=e.PathSegments;if(e.length)switch(e[0].toLowerCase()){case S.ADFS:return qy.Adfs;case S.DSTS:return qy.Dsts}return qy.Default},Object.defineProperty(p.prototype,"authorityType",{get:function(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"protocolMode",{get:function(){return this.authorityOptions.protocolMode},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"options",{get:function(){return this.authorityOptions},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"canonicalAuthority",{get:function(){return this._canonicalAuthority.urlString},set:function(e){this._canonicalAuthority=new P(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"canonicalAuthorityUrlComponents",{get:function(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"hostnameAndPort",{get:function(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"tenant",{get:function(){return this.canonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"authorizationEndpoint",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"tokenEndpoint",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"deviceCodeEndpoint",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"endSessionEndpoint",{get:function(){if(this.discoveryComplete()){if(this.metadata.end_session_endpoint)return this.replacePath(this.metadata.end_session_endpoint);throw I.createLogoutNotSupportedError()}throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"selfSignedJwtAudience",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"jwksUri",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),p.prototype.canReplaceTenant=function(e){return 1===e.PathSegments.length&&!p.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===qy.Default&&this.protocolMode===a_.AAD},p.prototype.replaceTenant=function(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)},p.prototype.replacePath=function(e){var r=this,n=e,i=new P(this.metadata.canonical_authority).getUrlComponents(),a=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach(function(e,t){var o=a[t];0===t&&r.canReplaceTenant(i)&&o!==(t=new P(r.metadata.authorization_endpoint).getUrlComponents().PathSegments[0])&&(r.logger.verbose("Replacing tenant domain name "+o+" with id "+t),o=t),e!==o&&(n=n.replace("/"+o+"/","/"+e+"/"))}),this.replaceTenant(n)},Object.defineProperty(p.prototype,"defaultOpenIdConfigurationEndpoint",{get:function(){return this.authorityType===qy.Adfs||this.authorityType===qy.Dsts||this.protocolMode===a_.OIDC?this.canonicalAuthority+".well-known/openid-configuration":this.canonicalAuthority+"v2.0/.well-known/openid-configuration"},enumerable:!1,configurable:!0}),p.prototype.discoveryComplete=function(){return!!this.metadata},p.prototype.resolveEndpointsAsync=function(){var n;return b(this,void 0,void 0,function(){var t,o,r;return C(this,function(e){switch(e.label){case 0:return null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.AuthorityResolveEndpointsAsync,this.correlationId),(t=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort))||(t=new u_).updateCanonicalAuthority(this.canonicalAuthority),null!=(n=this.performanceClient)&&n.setPreQueueTime(A.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId),[4,this.updateCloudDiscoveryMetadata(t)];case 1:return o=e.sent(),this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,t.preferred_network),null!=(n=this.performanceClient)&&n.setPreQueueTime(A.AuthorityUpdateEndpointMetadata,this.correlationId),[4,this.updateEndpointMetadata(t)];case 2:return r=e.sent(),o!==jg.CACHE&&r!==jg.CACHE&&(t.resetExpiresAt(),t.updateCanonicalAuthority(this.canonicalAuthority)),r=this.cacheManager.generateAuthorityMetadataCacheKey(t.preferred_cache),this.cacheManager.setAuthorityMetadata(r,t),this.metadata=t,[2]}})})},p.prototype.updateEndpointMetadata=function(r){var n,i,a;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:return(null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.AuthorityUpdateEndpointMetadata,this.correlationId),t=this.getEndpointMetadataFromConfig())?(r.updateEndpointMetadata(t,!1),[2,jg.CONFIG]):this.isAuthoritySameType(r)&&r.endpointsFromNetwork&&!r.isExpired()?[2,jg.CACHE]:(null!=(n=this.performanceClient)&&n.setPreQueueTime(A.AuthorityGetEndpointMetadataFromNetwork,this.correlationId),[4,this.getEndpointMetadataFromNetwork()]);case 1:return(t=e.sent())?null!=(n=this.authorityOptions.azureRegionConfiguration)&&n.azureRegion?(null!=(i=this.performanceClient)&&i.setPreQueueTime(A.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),[4,this.updateMetadataWithRegionalInformation(t)]):[3,3]:[3,4];case 2:t=e.sent(),e.label=3;case 3:return r.updateEndpointMetadata(t,!0),[2,jg.NETWORK];case 4:return!(o=this.getEndpointMetadataFromHardcodedValues())||this.authorityOptions.skipAuthorityMetadataCache?[3,7]:null!=(i=this.authorityOptions.azureRegionConfiguration)&&i.azureRegion?(null!=(a=this.performanceClient)&&a.setPreQueueTime(A.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),[4,this.updateMetadataWithRegionalInformation(o)]):[3,6];case 5:o=e.sent(),e.label=6;case 6:return r.updateEndpointMetadata(o,!1),[2,jg.HARDCODED_VALUES];case 7:throw I.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint)}})})},p.prototype.isAuthoritySameType=function(e){return new P(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length},p.prototype.getEndpointMetadataFromConfig=function(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch(e){throw Dy.createInvalidAuthorityMetadataError()}return null},p.prototype.getEndpointMetadataFromNetwork=function(){var n;return b(this,void 0,void 0,function(){var o,r;return C(this,function(e){switch(e.label){case 0:null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.AuthorityGetEndpointMetadataFromNetwork,this.correlationId),o={},e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint,o)];case 2:return r=e.sent(),[2,(t=r.body).hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")?r.body:null];case 3:return e.sent(),[2,null];case 4:return[2]}var t})})},p.prototype.getEndpointMetadataFromHardcodedValues=function(){return this.canonicalAuthority in s_?s_[this.canonicalAuthority]:null},p.prototype.updateMetadataWithRegionalInformation=function(o){var r;return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:return(null!=(r=this.performanceClient)&&r.addQueueMeasurement(A.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),t=null==(r=this.authorityOptions.azureRegionConfiguration)?void 0:r.azureRegion)?t!==S.AZURE_REGION_AUTO_DISCOVER_FLAG?(this.regionDiscoveryMetadata.region_outcome=Xg.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=t,[2,p.replaceWithRegionalInformation(o,t)]):(null!=(r=this.performanceClient)&&r.setPreQueueTime(A.RegionDiscoveryDetectRegion,this.correlationId),[4,this.regionDiscovery.detectRegion(null==(r=this.authorityOptions.azureRegionConfiguration)?void 0:r.environmentRegion,this.regionDiscoveryMetadata)]):[3,2];case 1:if(t=e.sent())return this.regionDiscoveryMetadata.region_outcome=Xg.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=t,[2,p.replaceWithRegionalInformation(o,t)];this.regionDiscoveryMetadata.region_outcome=Xg.AUTO_DETECTION_REQUESTED_FAILED,e.label=2;case 2:return[2,o]}})})},p.prototype.updateCloudDiscoveryMetadata=function(r){var n;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:return(null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId),this.logger.verbose("Attempting to get cloud discovery metadata in the config"),this.logger.verbosePii("Known Authorities: "+(this.authorityOptions.knownAuthorities||S.NOT_APPLICABLE)),this.logger.verbosePii("Authority Metadata: "+(this.authorityOptions.authorityMetadata||S.NOT_APPLICABLE)),this.logger.verbosePii("Canonical Authority: "+(r.canonical_authority||S.NOT_APPLICABLE)),t=this.getCloudDiscoveryMetadataFromConfig())?(this.logger.verbose("Found cloud discovery metadata in the config."),r.updateCloudDiscoveryMetadata(t,!1),[2,jg.CONFIG]):(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache."),o=r.isExpired(),this.isAuthoritySameType(r)&&r.aliasesFromNetwork&&!o?(this.logger.verbose("Found metadata in the cache."),[2,jg.CACHE]):(o&&this.logger.verbose("The metadata entity is expired."),this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network."),null!=(n=this.performanceClient)&&n.setPreQueueTime(A.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId),[4,this.getCloudDiscoveryMetadataFromNetwork()]));case 1:if(t=e.sent())return this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()"),r.updateCloudDiscoveryMetadata(t,!0),[2,jg.NETWORK];if(this.logger.verbose("Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values."),(o=this.getCloudDiscoveryMetadataFromHarcodedValues())&&!this.options.skipAuthorityMetadataCache)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),r.updateCloudDiscoveryMetadata(o,!1),[2,jg.HARDCODED_VALUES];throw this.logger.error("Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error."),Dy.createUntrustedAuthorityError()}})})},p.prototype.getCloudDiscoveryMetadataFromConfig=function(){if(this.authorityType===qy.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),p.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");var e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),t=p.getCloudDiscoveryMetadataFromNetworkResponse(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),t)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),t;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch(e){throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),Dy.createInvalidCloudDiscoveryMetadataError()}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),p.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null},p.prototype.getCloudDiscoveryMetadataFromNetwork=function(){var c;return b(this,void 0,void 0,function(){var o,r,n,i,a,s;return C(this,function(e){switch(e.label){case 0:null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId),o=""+S.AAD_INSTANCE_DISCOVERY_ENDPT+this.canonicalAuthority+"oauth2/v2.0/authorize",r={},n=null,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkInterface.sendGetRequestAsync(o,r)];case 2:if(s=e.sent(),a=i=void 0,(t=s.body).hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata"))i=s.body,a=i.metadata,this.logger.verbosePii("tenant_discovery_endpoint is: "+i.tenant_discovery_endpoint);else{if(!(t=s.body).hasOwnProperty("error")||!t.hasOwnProperty("error_description"))return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),[2,null];if(this.logger.warning("A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: "+s.status),(i=s.body).error===S.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),[2,null];this.logger.warning("The CloudInstanceDiscoveryErrorResponse error is "+i.error),this.logger.warning("The CloudInstanceDiscoveryErrorResponse error description is "+i.error_description),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),a=[]}return this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),n=p.getCloudDiscoveryMetadataFromNetworkResponse(a,this.hostnameAndPort),[3,4];case 3:return(s=e.sent())instanceof T?this.logger.error("There was a network error while attempting to get the cloud discovery instance metadata.\nError: "+s.errorCode+"\nError Description: "+s.errorMessage):this.logger.error("A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\nError: "+s.name+"\nError Description: "+s.message),[2,null];case 4:return n||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),n=p.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),[2,n]}var t})})},p.prototype.getCloudDiscoveryMetadataFromHarcodedValues=function(){return this.canonicalAuthority in c_?c_[this.canonicalAuthority]:null},p.prototype.isInKnownAuthorities=function(){var t=this;return 0<this.authorityOptions.knownAuthorities.filter(function(e){return P.getDomainFromUrl(e).toLowerCase()===t.hostnameAndPort}).length},p.generateAuthority=function(e,t){var o;return t&&t.azureCloudInstance!==uy.None&&(o=t.tenant||S.DEFAULT_COMMON_TENANT,o=t.azureCloudInstance+"/"+o+"/"),o||e},p.createCloudDiscoveryMetadataFromHost=function(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}},p.getCloudDiscoveryMetadataFromNetworkResponse=function(e,t){for(var o=0;o<e.length;o++){var r=e[o];if(-1<r.aliases.indexOf(t))return r}return null},p.prototype.getPreferredCache=function(){if(this.discoveryComplete())return this.metadata.preferred_cache;throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},p.prototype.isAlias=function(e){return-1<this.metadata.aliases.indexOf(e)},p.isPublicCloudAuthority=function(e){return 0<=S.KNOWN_PUBLIC_CLOUDS.indexOf(e)},p.buildRegionalAuthorityString=function(e,t,o){var e=new P(e),r=(e.validateAsUri(),e.getUrlComponents()),n=t+"."+r.HostNameAndPort,r=(this.isPublicCloudAuthority(r.HostNameAndPort)&&(n=t+"."+S.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX),P.constructAuthorityUriFromObject(kg(kg({},e.getUrlComponents()),{HostNameAndPort:n})).urlString);return o?r+"?"+o:r},p.replaceWithRegionalInformation=function(e,t){return e.authorization_endpoint=p.buildRegionalAuthorityString(e.authorization_endpoint,t),e.token_endpoint=p.buildRegionalAuthorityString(e.token_endpoint,t,S.REGIONAL_AUTH_NON_MSI_QUERY_STRING),e.end_session_endpoint&&(e.end_session_endpoint=p.buildRegionalAuthorityString(e.end_session_endpoint,t)),e},p.transformCIAMAuthority=function(e){var t=e.endsWith(S.FORWARD_SLASH)?e:""+e+S.FORWARD_SLASH,e=new P(e).getUrlComponents();return t=0===e.PathSegments.length&&e.HostNameAndPort.endsWith(S.CIAM_AUTH_URL)?""+t+e.HostNameAndPort.split(".")[0]+S.AAD_TENANT_DOMAIN_SUFFIX:t},p.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Rg.COMMON,Rg.CONSUMERS,Rg.ORGANIZATIONS]);var p_=p;function p(e,t,o,r,n,i,a){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=t,this.cacheManager=o,this.authorityOptions=r,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=n,this.performanceClient=i,this.correlationId=a,this.regionDiscovery=new h_(t,this.performanceClient,this.correlationId)}g_.createDiscoveredInstance=function(r,n,i,a,s,c,u){return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:null!=c&&c.addQueueMeasurement(A.AuthorityFactoryCreateDiscoveredInstance,u),t=p_.transformCIAMAuthority(r),t=g_.createInstance(t,n,i,a,s,c,u),e.label=1;case 1:return e.trys.push([1,3,,4]),null!=c&&c.setPreQueueTime(A.AuthorityResolveEndpointsAsync,u),[4,t.resolveEndpointsAsync()];case 2:return e.sent(),[2,t];case 3:throw o=e.sent(),I.createEndpointDiscoveryIncompleteError(o);case 4:return[2]}})})},g_.createInstance=function(e,t,o,r,n,i,a){if(k.isEmpty(e))throw Dy.createUrlEmptyError();return new p_(e,t,o,r,n,i,a)};var f_=g_;function g_(){}y_.isServerTelemetryEntity=function(e,t){var e=0===e.indexOf(Zg.CACHE_KEY),o=!0;return t&&(o=t.hasOwnProperty("failedRequests")&&t.hasOwnProperty("errors")&&t.hasOwnProperty("cacheHits")),e&&o};var m_=y_;function y_(){this.failedRequests=[],this.errors=[],this.cacheHits=0}__.isThrottlingEntity=function(e,t){var o=!1,e=(e&&(o=0===e.indexOf(rm)),!0);return t&&(e=t.hasOwnProperty("throttleTime")),o&&e};var v_=__;function __(){}var w_,b_={sendGetRequestAsync:function(){return Promise.reject(T.createUnexpectedError("Network interface - sendGetRequestAsync() has not been implemented for the Network interface."))},sendPostRequestAsync:function(){return Promise.reject(T.createUnexpectedError("Network interface - sendPostRequestAsync() has not been implemented for the Network interface."))}},C_={code:"missing_kid_error",desc:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided."},E_={code:"missing_alg_error",desc:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."},S_=(Ig(T_,w_=T),T_.createMissingKidError=function(){return new T_(C_.code,C_.desc)},T_.createMissingAlgError=function(){return new T_(E_.code,E_.desc)},T_);function T_(e,t){e=w_.call(this,e,t)||this;return e.name="JoseHeaderError",Object.setPrototypeOf(e,T_.prototype),e}k_.getShrHeaderString=function(e){if(!e.kid)throw S_.createMissingKidError();if(e.alg)return e=new k_({typ:e.typ||em.Pop,kid:e.kid,alg:e.alg}),JSON.stringify(e);throw S_.createMissingAlgError()};var I_=k_;function k_(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}P_.prototype.generateCurrentRequestHeaderValue=function(){var e=""+this.apiId+Zg.VALUE_SEPARATOR+this.cacheOutcome,t=[this.wrapperSKU,this.wrapperVer].join(Zg.VALUE_SEPARATOR),e=[e,this.getRegionDiscoveryFields()].join(Zg.VALUE_SEPARATOR);return[Zg.SCHEMA_VERSION,e,t].join(Zg.CATEGORY_SEPARATOR)},P_.prototype.generateLastRequestHeaderValue=function(){var e=this.getLastRequests(),t=P_.maxErrorsToSend(e),o=e.failedRequests.slice(0,2*t).join(Zg.VALUE_SEPARATOR),r=e.errors.slice(0,t).join(Zg.VALUE_SEPARATOR),n=e.errors.length,t=[n,t<n?Zg.OVERFLOW_TRUE:Zg.OVERFLOW_FALSE].join(Zg.VALUE_SEPARATOR);return[Zg.SCHEMA_VERSION,e.cacheHits,o,r,t].join(Zg.CATEGORY_SEPARATOR)},P_.prototype.cacheFailedRequest=function(e){var t=this.getLastRequests();t.errors.length>=Zg.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),k.isEmpty(e.subError)?k.isEmpty(e.errorCode)?e&&e.toString()?t.errors.push(e.toString()):t.errors.push(Zg.UNKNOWN_ERROR):t.errors.push(e.errorCode):t.errors.push(e.subError),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)},P_.prototype.incrementCacheHits=function(){var e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits},P_.prototype.getLastRequests=function(){var e=new m_;return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e},P_.prototype.clearTelemetryCache=function(){var e,t=this.getLastRequests(),o=P_.maxErrorsToSend(t);o===t.errors.length?this.cacheManager.removeItem(this.telemetryCacheKey):((e=new m_).failedRequests=t.failedRequests.slice(2*o),e.errors=t.errors.slice(o),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e))},P_.maxErrorsToSend=function(e){for(var t=0,o=0,r=e.errors.length,n=0;n<r;n++){var i=e.failedRequests[2*n]||S.EMPTY_STRING,a=e.failedRequests[2*n+1]||S.EMPTY_STRING,s=e.errors[n]||S.EMPTY_STRING;if(!((o+=i.toString().length+a.toString().length+s.length+3)<Zg.MAX_LAST_HEADER_BYTES))break;t+=1}return t},P_.prototype.getRegionDiscoveryFields=function(){var e=[];return e.push(this.regionUsed||S.EMPTY_STRING),e.push(this.regionSource||S.EMPTY_STRING),e.push(this.regionOutcome||S.EMPTY_STRING),e.join(",")},P_.prototype.updateRegionDiscoveryMetadata=function(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome},P_.prototype.setCacheOutcome=function(e){this.cacheOutcome=e};var A_=P_;function P_(e,t){this.cacheOutcome=$g.NO_CACHE_HIT,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||S.EMPTY_STRING,this.wrapperVer=e.wrapperVer||S.EMPTY_STRING,this.telemetryCacheKey=Zg.CACHE_KEY+qg.CACHE_KEY_SEPARATOR+e.clientId}O_.prototype.startPerformanceMeasurement=function(e,t){return{}},O_.prototype.startPerformanceMeasuremeant=function(e,t){return{}},O_.prototype.getIntFields=function(){return Fv},O_.prototype.getPreQueueTime=function(e,t){var o=this.preQueueTimeByCorrelationId.get(t);if(o){if(o.name===e)return o.time;this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue time found for "+e+", unable to add queue measurement")}else this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: "+t+", unable to add queue measurement")},O_.prototype.calculateQueuedTime=function(e,t){return e<1?(this.logger.trace("PerformanceClient: preQueueTime should be a positive integer and not "+e),0):t<1?(this.logger.trace("PerformanceClient: currentTime should be a positive integer and not "+t),0):t<e?(this.logger.trace("PerformanceClient: currentTime is less than preQueueTime, check how time is being retrieved"),0):t-e},O_.prototype.addQueueMeasurement=function(e,t,o,r){if(t){if(0===o)this.logger.trace("PerformanceClient.addQueueMeasurement: queue time provided for "+e+" is "+o);else if(!o)return void this.logger.trace("PerformanceClient.addQueueMeasurement: no queue time provided for "+e);o={eventName:e,queueTime:o,manuallyCompleted:r},r=this.queueMeasurements.get(t);r?(r.push(o),this.queueMeasurements.set(t,r)):(this.logger.trace("PerformanceClient.addQueueMeasurement: adding correlationId "+t+" to queue measurements"),this.queueMeasurements.set(t,[o])),this.preQueueTimeByCorrelationId.delete(t)}else this.logger.trace("PerformanceClient.addQueueMeasurement: correlationId not provided for "+e+", cannot add queue measurement")},O_.prototype.startMeasurement=function(e,t){var o=this,r=t||this.generateId(),n=(t||this.logger.info("PerformanceClient: No correlation id provided for "+e+", generating",r),this.logger.trace("PerformanceClient: Performance measurement started for "+e,r),this.startPerformanceMeasuremeant(e,r)),i=(n.startMeasurement(),{eventId:this.generateId(),status:jv.InProgress,authority:this.authority,libraryName:this.libraryName,libraryVersion:this.libraryVersion,clientId:this.clientId,name:e,startTimeMs:Date.now(),correlationId:r,appName:null==(t=this.applicationTelemetry)?void 0:t.appName,appVersion:null==(e=this.applicationTelemetry)?void 0:e.appVersion});return this.cacheEventByCorrelationId(i),{endMeasurement:function(e){return o.endMeasurement(kg(kg({},i),e),n)},discardMeasurement:function(){return o.discardMeasurements(i.correlationId)},addStaticFields:function(e){return o.addStaticFields(e,i.correlationId)},increment:function(e){return o.increment(e,i.correlationId)},measurement:n,event:i}},O_.prototype.endMeasurement=function(t,e){var o,r,n,i,a,s=this,c=this.eventsByCorrelationId.get(t.correlationId);return c?(r={totalQueueTime:0,totalQueueCount:0,manuallyCompletedCount:0},(o=t.eventId===c.eventId)?(r=this.getQueueInfo(t.correlationId),this.discardCache(c.correlationId)):null!=(n=c.incompleteSubMeasurements)&&n.delete(t.eventId),null!=e&&e.endMeasurement(),(n=null==e?void 0:e.flushMeasurement())?(this.logger.trace("PerformanceClient: Performance measurement ended for "+t.name+": "+n+" ms",t.correlationId),o?(i=kg(kg({},c),t),a=0,null!=(e=i.incompleteSubMeasurements)&&e.forEach(function(e){s.logger.trace("PerformanceClient: Incomplete submeasurement "+e.name+" found for "+t.name,i.correlationId),a++}),i.incompleteSubMeasurements=void 0,i=kg(kg({},i),{durationMs:Math.round(n),queuedTimeMs:r.totalQueueTime,queuedCount:r.totalQueueCount,queuedManuallyCompletedCount:r.manuallyCompletedCount,status:jv.Completed,incompleteSubsCount:a}),this.truncateIntegralFields(i,this.getIntFields()),this.emitEvents([i],t.correlationId),i):(c[t.name+"DurationMs"]=Math.floor(n),kg({},c))):(this.logger.trace("PerformanceClient: Performance measurement not taken",c.correlationId),null)):(this.logger.trace("PerformanceClient: Measurement not found for "+t.eventId,t.correlationId),null)},O_.prototype.addStaticFields=function(e,t){this.logger.trace("PerformanceClient: Updating static fields");var o=this.eventsByCorrelationId.get(t);o?this.eventsByCorrelationId.set(t,kg(kg({},o),e)):this.logger.trace("PerformanceClient: Event not found for",t)},O_.prototype.increment=function(e,t){this.logger.trace("PerformanceClient: Updating counters");var o=this.eventsByCorrelationId.get(t);if(o)for(var r in e)o.hasOwnProperty(r)||(o[r]=0),o[r]+=e[r];else this.logger.trace("PerformanceClient: Event not found for",t)},O_.prototype.cacheEventByCorrelationId=function(e){var t=this.eventsByCorrelationId.get(e.correlationId);t?(this.logger.trace("PerformanceClient: Performance measurement for "+e.name+" added/updated",e.correlationId),t.incompleteSubMeasurements=t.incompleteSubMeasurements||new Map,t.incompleteSubMeasurements.set(e.eventId,{name:e.name,startTimeMs:e.startTimeMs})):(this.logger.trace("PerformanceClient: Performance measurement for "+e.name+" started",e.correlationId),this.eventsByCorrelationId.set(e.correlationId,kg({},e)))},O_.prototype.getQueueInfo=function(e){var t=this.queueMeasurements.get(e),o=(t||this.logger.trace("PerformanceClient: no queue measurements found for for correlationId: "+e),0),r=0,n=0;return null!=t&&t.forEach(function(e){o+=e.queueTime,r++,n+=e.manuallyCompleted?1:0}),{totalQueueTime:o,totalQueueCount:r,manuallyCompletedCount:n}},O_.prototype.discardMeasurements=function(e){this.logger.trace("PerformanceClient: Performance measurements discarded",e),this.eventsByCorrelationId.delete(e)},O_.prototype.discardCache=function(e){this.discardMeasurements(e),this.logger.trace("PerformanceClient: QueueMeasurements discarded",e),this.queueMeasurements.delete(e),this.logger.trace("PerformanceClient: Pre-queue times discarded",e),this.preQueueTimeByCorrelationId.delete(e)},O_.prototype.addPerformanceCallback=function(e){var t=this.generateId();return this.callbacks.set(t,e),this.logger.verbose("PerformanceClient: Performance callback registered with id: "+t),t},O_.prototype.removePerformanceCallback=function(e){var t=this.callbacks.delete(e);return t?this.logger.verbose("PerformanceClient: Performance callback "+e+" removed."):this.logger.verbose("PerformanceClient: Performance callback "+e+" not removed."),t},O_.prototype.emitEvents=function(o,r){var n=this;this.logger.verbose("PerformanceClient: Emitting performance events",r),this.callbacks.forEach(function(e,t){n.logger.trace("PerformanceClient: Emitting event to callback "+t,r),e.apply(null,[o])})},O_.prototype.truncateIntegralFields=function(t,e){e.forEach(function(e){e in t&&"number"==typeof t[e]&&(t[e]=Math.floor(t[e]))})};ir=O_;function O_(e,t,o,r,n,i){this.authority=t,this.libraryName=r,this.libraryVersion=n,this.applicationTelemetry=i,this.clientId=e,this.logger=o,this.callbacks=new Map,this.eventsByCorrelationId=new Map,this.queueMeasurements=new Map,this.preQueueTimeByCorrelationId=new Map}x_.prototype.startMeasurement=function(){},x_.prototype.endMeasurement=function(){},x_.prototype.flushMeasurement=function(){return null};var R_=x_;function x_(){}Ig(L_,M_=ir),L_.prototype.generateId=function(){return"callback-id"},L_.prototype.startPerformanceMeasuremeant=function(){return new R_},L_.prototype.startPerformanceMeasurement=function(){return new R_},L_.prototype.calculateQueuedTime=function(e,t){return 0},L_.prototype.addQueueMeasurement=function(e,t,o){},L_.prototype.setPreQueueTime=function(e,t){};var M_,N_=L_;function L_(){return null!==M_&&M_.apply(this,arguments)||this}var D_,q_={code:"pkce_not_created",desc:"The PKCE code challenge and verifier could not be generated."},U_={code:"crypto_nonexistent",desc:"The crypto object or function is not available."},j_={code:"http_method_not_implemented",desc:"The HTTP method given has not been implemented in this library."},H_={code:"empty_navigate_uri",desc:"Navigation URI is empty. Please check stack trace for more info."},B_={code:"hash_empty_error",desc:"Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. For more visit: aka.ms/msaljs/browser-errors."},F_={code:"no_state_in_hash",desc:"Hash does not contain state. Please verify that the request originated from msal."},z_={code:"hash_does_not_contain_known_properties",desc:"Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. For more visit: aka.ms/msaljs/browser-errors."},K_={code:"unable_to_parse_state",desc:"Unable to parse state. Please verify that the request originated from msal."},G_={code:"state_interaction_type_mismatch",desc:"Hash contains state but the interaction type does not match the caller."},Y_={code:"interaction_in_progress",desc:"Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. For more visit: aka.ms/msaljs/browser-errors."},W_={code:"popup_window_error",desc:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."},Z_={code:"empty_window_error",desc:"window.open returned null or undefined window object."},Q_={code:"user_cancelled",desc:"User cancelled the flow."},V_={code:"monitor_window_timeout",desc:"Token acquisition in popup failed due to timeout. For more visit: aka.ms/msaljs/browser-errors."},J_={code:"monitor_window_timeout",desc:"Token acquisition in iframe failed due to timeout. For more visit: aka.ms/msaljs/browser-errors."},X_={code:"redirect_in_iframe",desc:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs."},$_={code:"block_iframe_reload",desc:"Request was blocked inside an iframe because MSAL detected an authentication response. For more visit: aka.ms/msaljs/browser-errors"},ew={code:"block_nested_popups",desc:"Request was blocked inside a popup because MSAL detected it was running in a popup."},tw={code:"iframe_closed_prematurely",desc:"The iframe being monitored was closed prematurely."},ow={code:"silent_logout_unsupported",desc:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead."},rw={code:"no_account_error",desc:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request."},nw={code:"silent_prompt_value_error",desc:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'."},iw={code:"no_token_request_cache_error",desc:"No token request found in cache."},aw={code:"unable_to_parse_token_request_cache_error",desc:"The cached token request could not be parsed."},sw={code:"no_cached_authority_error",desc:"No cached authority found."},cw={code:"auth_request_not_set_error",desc:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler"},uw={code:"invalid_cache_type",desc:"Invalid cache type"},lw={code:"non_browser_environment",desc:"Login and token requests are not supported in non-browser environments."},hw={code:"database_not_open",desc:"Database is not open!"},dw={code:"no_network_connectivity",desc:"No network connectivity. Check your internet connection."},pw={code:"post_request_failed",desc:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'"},fw={code:"get_request_failed",desc:"Network request failed. Please check the network trace to determine root cause."},gw={code:"failed_to_parse_response",desc:"Failed to parse network response. Check network trace."},mw={code:"unable_to_load_token",desc:"Error loading token to cache."},yw={code:"crypto_key_not_found",desc:"Cryptographic Key or Keypair not found in browser storage."},vw={code:"auth_code_required",desc:"An authorization code must be provided (as the `code` property on the request) to this flow."},_w={code:"auth_code_or_nativeAccountId_required",desc:"An authorization code or nativeAccountId must be provided to this flow."},ww={code:"spa_code_and_nativeAccountId_present",desc:"Request cannot contain both spa code and native account id."},bw={code:"database_unavailable",desc:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts."},Cw={code:"unable_to_acquire_token_from_native_platform",desc:"Unable to acquire token from native platform. For a list of possible reasons visit aka.ms/msaljs/browser-errors."},Ew={code:"native_handshake_timeout",desc:"Timed out while attempting to establish connection to browser extension"},Sw={code:"native_extension_not_installed",desc:"Native extension is not installed. If you think this is a mistake call the initialize function."},Tw={code:"native_connection_not_established",desc:"Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). For more please visit aka.ms/msaljs/browser-errors."},Iw={code:"native_broker_called_before_initialize",desc:"You must call and await the initialize function before attempting to call any other MSAL API when native brokering is enabled. For more please visit aka.ms/msaljs/browser-errors."},kw={code:"native_prompt_not_supported",desc:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow."},O=(Cg(g,D_=T),g.createPkceNotGeneratedError=function(e){return new g(q_.code,q_.desc+" Detail:"+e)},g.createCryptoNotAvailableError=function(e){return new g(U_.code,U_.desc+" Detail:"+e)},g.createHttpMethodNotImplementedError=function(e){return new g(j_.code,j_.desc+" Given Method: "+e)},g.createEmptyNavigationUriError=function(){return new g(H_.code,H_.desc)},g.createEmptyHashError=function(e){return new g(B_.code,B_.desc+" Given Url: "+e)},g.createHashDoesNotContainStateError=function(){return new g(F_.code,F_.desc)},g.createHashDoesNotContainKnownPropertiesError=function(){return new g(z_.code,z_.desc)},g.createUnableToParseStateError=function(){return new g(K_.code,K_.desc)},g.createStateInteractionTypeMismatchError=function(){return new g(G_.code,G_.desc)},g.createInteractionInProgressError=function(){return new g(Y_.code,Y_.desc)},g.createPopupWindowError=function(e){var t=W_.desc,t=k.isEmpty(e)?t:t+" Details: "+e;return new g(W_.code,t)},g.createEmptyWindowCreatedError=function(){return new g(Z_.code,Z_.desc)},g.createUserCancelledError=function(){return new g(Q_.code,Q_.desc)},g.createMonitorPopupTimeoutError=function(){return new g(V_.code,V_.desc)},g.createMonitorIframeTimeoutError=function(){return new g(J_.code,J_.desc)},g.createRedirectInIframeError=function(e){return new g(X_.code,X_.desc+" (window.parent !== window) => "+e)},g.createBlockReloadInHiddenIframeError=function(){return new g($_.code,$_.desc)},g.createBlockAcquireTokenInPopupsError=function(){return new g(ew.code,ew.desc)},g.createIframeClosedPrematurelyError=function(){return new g(tw.code,tw.desc)},g.createSilentLogoutUnsupportedError=function(){return new g(ow.code,ow.desc)},g.createNoAccountError=function(){return new g(rw.code,rw.desc)},g.createSilentPromptValueError=function(e){return new g(nw.code,nw.desc+" Given value: "+e)},g.createUnableToParseTokenRequestCacheError=function(){return new g(aw.code,aw.desc)},g.createNoTokenRequestCacheError=function(){return new g(iw.code,iw.desc)},g.createAuthRequestNotSetError=function(){return new g(cw.code,cw.desc)},g.createNoCachedAuthorityError=function(){return new g(sw.code,sw.desc)},g.createInvalidCacheTypeError=function(){return new g(uw.code,""+uw.desc)},g.createNonBrowserEnvironmentError=function(){return new g(lw.code,lw.desc)},g.createDatabaseNotOpenError=function(){return new g(hw.code,hw.desc)},g.createNoNetworkConnectivityError=function(){return new g(dw.code,dw.desc)},g.createPostRequestFailedError=function(e,t){return new g(pw.code,pw.desc+" | Network client threw: "+e+" | Attempted to reach: "+t.split("?")[0])},g.createGetRequestFailedError=function(e,t){return new g(fw.code,fw.desc+" | Network client threw: "+e+" | Attempted to reach: "+t.split("?")[0])},g.createFailedToParseNetworkResponseError=function(e){return new g(gw.code,gw.desc+" | Attempted to reach: "+e.split("?")[0])},g.createUnableToLoadTokenError=function(e){return new g(mw.code,mw.desc+" | "+e)},g.createSigningKeyNotFoundInStorageError=function(e){return new g(yw.code,yw.desc+" | No match found for KeyId: "+e)},g.createAuthCodeRequiredError=function(){return new g(vw.code,vw.desc)},g.createAuthCodeOrNativeAccountIdRequiredError=function(){return new g(_w.code,_w.desc)},g.createSpaCodeAndNativeAccountIdPresentError=function(){return new g(ww.code,ww.desc)},g.createDatabaseUnavailableError=function(){return new g(bw.code,bw.desc)},g.createUnableToAcquireTokenFromNativePlatformError=function(){return new g(Cw.code,Cw.desc)},g.createNativeHandshakeTimeoutError=function(){return new g(Ew.code,Ew.desc)},g.createNativeExtensionNotInstalledError=function(){return new g(Sw.code,Sw.desc)},g.createNativeConnectionNotEstablishedError=function(){return new g(Tw.code,Tw.desc)},g.createNativeBrokerCalledBeforeInitialize=function(){return new g(Iw.code,Iw.desc)},g.createNativePromptParameterNotSupportedError=function(){return new g(kw.code,kw.desc)},g);function g(e,t){e=D_.call(this,e,t)||this;return Object.setPrototypeOf(e,g.prototype),e.name="BrowserAuthError",e}var Aw,Pw,Ow,Rw,xw,Mw,Nw,R,un,Lw,Dw={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},qw="53ee284d-920a-4b59-9d30-a60315b26836",Uw="ppnbnpeolgkicgegkbkbjmhlideopiji",jw="MATS",Hw=((Uo=Aw=Aw||{}).HandshakeRequest="Handshake",Uo.HandshakeResponse="HandshakeResponse",Uo.GetToken="GetToken",Uo.Response="Response",(hi=Pw=Pw||{}).LocalStorage="localStorage",hi.SessionStorage="sessionStorage",hi.MemoryStorage="memoryStorage",(i=Ow=Ow||{}).GET="GET",i.POST="POST",(be=Rw=Rw||{}).AUTHORITY="authority",be.ACQUIRE_TOKEN_ACCOUNT="acquireToken.account",be.SESSION_STATE="session.state",be.REQUEST_STATE="request.state",be.NONCE_IDTOKEN="nonce.id_token",be.ORIGIN_URI="request.origin",be.RENEW_STATUS="token.renew.status",be.URL_HASH="urlHash",be.REQUEST_PARAMS="request.params",be.SCOPES="scopes",be.INTERACTION_STATUS_KEY="interaction.status",be.CCS_CREDENTIAL="ccs.credential",be.CORRELATION_ID="request.correlationId",be.NATIVE_REQUEST="request.native",be.REDIRECT_CONTEXT="request.redirect.context",(Mi=xw=xw||{}).ACCOUNT_KEYS="msal.account.keys",Mi.TOKEN_KEYS="msal.token.keys",(cn=Mw=Mw||{}).WRAPPER_SKU="wrapper.sku",cn.WRAPPER_VER="wrapper.version",(o=Nw=Nw||{})[o.acquireTokenRedirect=861]="acquireTokenRedirect",o[o.acquireTokenPopup=862]="acquireTokenPopup",o[o.ssoSilent=863]="ssoSilent",o[o.acquireTokenSilent_authCode=864]="acquireTokenSilent_authCode",o[o.handleRedirectPromise=865]="handleRedirectPromise",o[o.acquireTokenByCode=866]="acquireTokenByCode",o[o.acquireTokenSilent_silentFlow=61]="acquireTokenSilent_silentFlow",o[o.logout=961]="logout",o[o.logoutPopup=962]="logoutPopup",(un=R=R||{}).Redirect="redirect",un.Popup="popup",un.Silent="silent",un.None="none",0,{scopes:Bg}),Bw="jwk",Fw=(0,"msal.db");(r=Lw=Lw||{})[r.Default=0]="Default",r[r.AccessToken=1]="AccessToken",r[r.AccessTokenAndRefreshToken=2]="AccessTokenAndRefreshToken",r[r.RefreshToken=3]="RefreshToken",r[r.RefreshTokenAndNetwork=4]="RefreshTokenAndNetwork",r[r.Skip=5]="Skip";var zw,Kw={code:"redirect_uri_empty",desc:"A redirect URI is required for all calls, and none has been set."},Gw={code:"post_logout_uri_empty",desc:"A post logout redirect has not been set."},Yw={code:"storage_not_supported",desc:"Given storage configuration option was not supported."},Ww={code:"no_redirect_callbacks",desc:"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},Zw={code:"stubbed_public_client_application_called",desc:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors"},Qw={code:"in_mem_redirect_unavailable",desc:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."},Vw={code:"entropy_not_provided",desc:"The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option."},Jw=(Cg(Xw,zw=T),Xw.createRedirectUriEmptyError=function(){return new Xw(Kw.code,Kw.desc)},Xw.createPostLogoutRedirectUriEmptyError=function(){return new Xw(Gw.code,Gw.desc)},Xw.createStorageNotSupportedError=function(e){return new Xw(Yw.code,Yw.desc+" Given Location: "+e)},Xw.createRedirectCallbacksNotSetError=function(){return new Xw(Ww.code,Ww.desc)},Xw.createStubPcaInstanceCalledError=function(){return new Xw(Zw.code,Zw.desc)},Xw.createInMemoryRedirectUnavailableError=function(){return new Xw(Qw.code,Qw.desc)},Xw.createEntropyNotProvided=function(){return new Xw(Vw.code,Vw.desc)},Xw);function Xw(e,t){e=zw.call(this,e,t)||this;return e.name="BrowserConfigurationAuthError",Object.setPrototypeOf(e,Xw.prototype),e}e0.prototype.validateWindowStorage=function(e){if(e!==Pw.LocalStorage&&e!==Pw.SessionStorage)throw Jw.createStorageNotSupportedError(e);if(!!!window[e])throw Jw.createStorageNotSupportedError(e)},e0.prototype.getItem=function(e){return this.windowStorage.getItem(e)},e0.prototype.setItem=function(e,t){this.windowStorage.setItem(e,t)},e0.prototype.removeItem=function(e){this.windowStorage.removeItem(e)},e0.prototype.getKeys=function(){return Object.keys(this.windowStorage)},e0.prototype.containsKey=function(e){return this.windowStorage.hasOwnProperty(e)};var $w=e0;function e0(e){this.validateWindowStorage(e),this.windowStorage=window[e]}o0.prototype.getItem=function(e){return this.cache.get(e)||null},o0.prototype.setItem=function(e,t){this.cache.set(e,t)},o0.prototype.removeItem=function(e){this.cache.delete(e)},o0.prototype.getKeys=function(){var o=[];return this.cache.forEach(function(e,t){o.push(t)}),o},o0.prototype.containsKey=function(e){return this.cache.has(e)},o0.prototype.clear=function(){this.cache.clear()};var t0=o0;function o0(){this.cache=new Map}n0.extractBrowserRequestState=function(e,t){if(k.isEmpty(t))return null;try{return qv.parseRequestState(e,t).libraryState.meta}catch(e){throw I.createInvalidStateError(t,e)}},n0.parseServerResponseFromHash=function(e){return e?(e=new P(e),P.getDeserializedHash(e.getHash())):{}};var r0=n0;function n0(){}Cg(m,i0=Yy),m.prototype.setupBrowserStorage=function(e){switch(e){case Pw.LocalStorage:case Pw.SessionStorage:try{return new $w(e)}catch(e){this.logger.verbose(e);break}}return this.cacheConfig.cacheLocation=Pw.MemoryStorage,new t0},m.prototype.setupTemporaryCacheStorage=function(e,t){switch(t){case Pw.LocalStorage:case Pw.SessionStorage:try{return new $w(e||Pw.SessionStorage)}catch(e){return this.logger.verbose(e),this.internalStorage}case Pw.MemoryStorage:default:return this.internalStorage}},m.prototype.migrateCacheEntries=function(){var o=this,e=S.CACHE_PREFIX+"."+Og.ID_TOKEN,t=S.CACHE_PREFIX+"."+Og.CLIENT_INFO,r=S.CACHE_PREFIX+"."+Og.ERROR,n=S.CACHE_PREFIX+"."+Og.ERROR_DESC,i=[this.browserStorage.getItem(e),this.browserStorage.getItem(t),this.browserStorage.getItem(r),this.browserStorage.getItem(n)];[Og.ID_TOKEN,Og.CLIENT_INFO,Og.ERROR,Og.ERROR_DESC].forEach(function(e,t){return o.migrateCacheEntry(e,i[t])})},m.prototype.migrateCacheEntry=function(e,t){t&&this.setTemporaryCache(e,t,!0)},m.prototype.createKeyMaps=function(){var i=this,e=(this.logger.trace("BrowserCacheManager - createKeyMaps called."),this.getItem(xw.ACCOUNT_KEYS)),t=this.getItem(xw.TOKEN_KEYS+"."+this.clientId);e&&t?this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration."):this.browserStorage.getKeys().forEach(function(e){var t;if(i.isCredentialKey(e)&&(t=i.getItem(e))){var o,r,n=i.validateAndParseJson(t);if(n&&n.hasOwnProperty("credentialType"))switch(n.credentialType){case E.ID_TOKEN:if(_v.isIdTokenEntity(n))return i.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),i.logger.tracePii("BrowserCacheManager:createKeyMaps - idToken with key: "+e+" found, saving key to token key map"),r=Yy.toObject(new _v,n),r=i.updateCredentialCacheKey(e,r),void i.addTokenKey(r,E.ID_TOKEN);i.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),i.logger.tracePii("BrowserCacheManager:createKeyMaps - failed idToken validation on key: "+e);break;case E.ACCESS_TOKEN:case E.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(Sv.isAccessTokenEntity(n))return i.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),i.logger.tracePii("BrowserCacheManager:createKeyMaps - accessToken with key: "+e+" found, saving key to token key map"),o=Yy.toObject(new Sv,n),r=i.updateCredentialCacheKey(e,o),void i.addTokenKey(r,E.ACCESS_TOKEN);i.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),i.logger.tracePii("BrowserCacheManager:createKeyMaps - failed accessToken validation on key: "+e);break;case E.REFRESH_TOKEN:if(kv.isRefreshTokenEntity(n))return i.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),i.logger.tracePii("BrowserCacheManager:createKeyMaps - refreshToken with key: "+e+" found, saving key to token key map"),o=Yy.toObject(new kv,n),r=i.updateCredentialCacheKey(e,o),void i.addTokenKey(r,E.REFRESH_TOKEN);i.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),i.logger.tracePii("BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: "+e)}}i.isAccountKey(e)&&(t=i.getItem(e))&&(t=i.validateAndParseJson(t))&&Fy.isAccountEntity(t)&&(i.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),i.logger.tracePii("BrowserCacheManager:createKeyMaps - account with key: "+e+" found, saving key to account key map"),i.addAccountKeyToMap(e))})},m.prototype.validateAndParseJson=function(e){try{var t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}},m.prototype.getItem=function(e){return this.browserStorage.getItem(e)},m.prototype.setItem=function(e,t){this.browserStorage.setItem(e,t)},m.prototype.getAccount=function(e){this.logger.trace("BrowserCacheManager.getAccount called");var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&Fy.isAccountEntity(t)?Yy.toObject(new Fy,t):(this.removeAccountKeyFromMap(e),null)},m.prototype.setAccount=function(e){this.logger.trace("BrowserCacheManager.setAccount called");var t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)},m.prototype.getAccountKeys=function(){this.logger.trace("BrowserCacheManager.getAccountKeys called");var e=this.getItem(xw.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])},m.prototype.addAccountKeyToMap=function(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii("BrowserCacheManager.addAccountKeyToMap called with key: "+e);var t=this.getAccountKeys();-1===t.indexOf(e)?(t.push(e),this.setItem(xw.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")},m.prototype.removeAccountKeyFromMap=function(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii("BrowserCacheManager.removeAccountKeyFromMap called with key: "+e);var t=this.getAccountKeys(),e=t.indexOf(e);-1<e?(t.splice(e,1),this.setItem(xw.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")},m.prototype.removeAccount=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return i0.prototype.removeAccount.call(this,t),this.removeAccountKeyFromMap(t),[2]})})},m.prototype.removeIdToken=function(e){i0.prototype.removeIdToken.call(this,e),this.removeTokenKey(e,E.ID_TOKEN)},m.prototype.removeAccessToken=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return i0.prototype.removeAccessToken.call(this,t),this.removeTokenKey(t,E.ACCESS_TOKEN),[2]})})},m.prototype.removeRefreshToken=function(e){i0.prototype.removeRefreshToken.call(this,e),this.removeTokenKey(e,E.REFRESH_TOKEN)},m.prototype.getTokenKeys=function(){this.logger.trace("BrowserCacheManager.getTokenKeys called");var e=this.getItem(xw.TOKEN_KEYS+"."+this.clientId);if(e){e=this.validateAndParseJson(e);if(e&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("accessToken")&&e.hasOwnProperty("refreshToken"))return e;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}},m.prototype.addTokenKey=function(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");var o=this.getTokenKeys();switch(t){case E.ID_TOKEN:-1===o.idToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),o.idToken.push(e));break;case E.ACCESS_TOKEN:-1===o.accessToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),o.accessToken.push(e));break;case E.REFRESH_TOKEN:-1===o.refreshToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),o.refreshToken.push(e));break;default:this.logger.error("BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: "+t),I.createUnexpectedCredentialTypeError()}this.setItem(xw.TOKEN_KEYS+"."+this.clientId,JSON.stringify(o))},m.prototype.removeTokenKey=function(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");var o=this.getTokenKeys();switch(t){case E.ID_TOKEN:this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: "+e+" from map");var r=o.idToken.indexOf(e);-1<r?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),o.idToken.splice(r,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case E.ACCESS_TOKEN:this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: "+e+" from map");r=o.accessToken.indexOf(e);-1<r?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),o.accessToken.splice(r,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case E.REFRESH_TOKEN:this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: "+e+" from map");r=o.refreshToken.indexOf(e);-1<r?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),o.refreshToken.splice(r,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:this.logger.error("BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: "+t),I.createUnexpectedCredentialTypeError()}this.setItem(xw.TOKEN_KEYS+"."+this.clientId,JSON.stringify(o))},m.prototype.getIdTokenCredential=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&_v.isIdTokenEntity(t)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),Yy.toObject(new _v,t)):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.ID_TOKEN),null)},m.prototype.setIdTokenCredential=function(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");var t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,E.ID_TOKEN)},m.prototype.getAccessTokenCredential=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&Sv.isAccessTokenEntity(t)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),Yy.toObject(new Sv,t)):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.ACCESS_TOKEN),null)},m.prototype.setAccessTokenCredential=function(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");var t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,E.ACCESS_TOKEN)},m.prototype.getRefreshTokenCredential=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&kv.isRefreshTokenEntity(t)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),Yy.toObject(new kv,t)):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.REFRESH_TOKEN),null)},m.prototype.setRefreshTokenCredential=function(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");var t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,E.REFRESH_TOKEN)},m.prototype.getAppMetadata=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&Gv.isAppMetadataEntity(e,t)?(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),Yy.toObject(new Gv,t)):(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null)},m.prototype.setAppMetadata=function(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");var t=e.generateAppMetadataKey();this.setItem(t,JSON.stringify(e))},m.prototype.getServerTelemetry=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&m_.isServerTelemetryEntity(e,t)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),Yy.toObject(new m_,t)):(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null)},m.prototype.setServerTelemetry=function(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))},m.prototype.getAuthorityMetadata=function(e){var t=this.internalStorage.getItem(e);return t?(t=this.validateAndParseJson(t))&&u_.isAuthorityMetadataEntity(e,t)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),Yy.toObject(new u_,t)):null:(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null)},m.prototype.getAuthorityMetadataKeys=function(){var t=this;return this.internalStorage.getKeys().filter(function(e){return t.isAuthorityMetadata(e)})},m.prototype.setWrapperMetadata=function(e,t){this.internalStorage.setItem(Mw.WRAPPER_SKU,e),this.internalStorage.setItem(Mw.WRAPPER_VER,t)},m.prototype.getWrapperMetadata=function(){return[this.internalStorage.getItem(Mw.WRAPPER_SKU)||S.EMPTY_STRING,this.internalStorage.getItem(Mw.WRAPPER_VER)||S.EMPTY_STRING]},m.prototype.setAuthorityMetadata=function(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))},m.prototype.getActiveAccount=function(){var e=this.generateCacheKey(Og.ACTIVE_ACCOUNT_FILTERS),e=this.getItem(e);return e?(e=this.validateAndParseJson(e))?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoByFilter({homeAccountId:e.homeAccountId,localAccountId:e.localAccountId})[0]||null):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema"),e=this.generateCacheKey(Og.ACTIVE_ACCOUNT),(e=this.getItem(e))?(e=this.getAccountInfoByFilter({localAccountId:e})[0]||null)?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(e),e):null:(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null))},m.prototype.setActiveAccount=function(e){var t,o=this.generateCacheKey(Og.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(Og.ACTIVE_ACCOUNT);e?(this.logger.verbose("setActiveAccount: Active account set"),t={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId},this.browserStorage.setItem(o,JSON.stringify(t)),this.browserStorage.setItem(r,e.localAccountId)):(this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(o),this.browserStorage.removeItem(r))},m.prototype.getAccountInfoByFilter=function(t){var e=this.getAllAccounts();return this.logger.trace("BrowserCacheManager.getAccountInfoByFilter: total "+e.length+" accounts found"),e.filter(function(e){return!(t.username&&t.username.toLowerCase()!==e.username.toLowerCase()||t.homeAccountId&&t.homeAccountId!==e.homeAccountId||t.localAccountId&&t.localAccountId!==e.localAccountId||t.tenantId&&t.tenantId!==e.tenantId||t.environment&&t.environment!==e.environment)})},m.prototype.getAccountInfoByHints=function(o,r){var e=this.getAllAccounts().filter(function(e){var t;return r?(t=e.idTokenClaims&&e.idTokenClaims.sid,r===t):!!o&&o===e.username});if(1===e.length)return e[0];if(1<e.length)throw I.createMultipleMatchingAccountsInCacheError();return null},m.prototype.getThrottlingCache=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&v_.isThrottlingEntity(e,t)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),Yy.toObject(new v_,t)):(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null)},m.prototype.setThrottlingCache=function(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))},m.prototype.getTemporaryCache=function(e,t){t=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){e=this.getItemCookie(t);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),e}e=this.temporaryCacheStorage.getItem(t);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),e;if(this.cacheConfig.cacheLocation===Pw.LocalStorage){e=this.browserStorage.getItem(t);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),e}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null},m.prototype.setTemporaryCache=function(e,t,o){o=o?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.setItemCookie(o,t))},m.prototype.removeItem=function(e){this.browserStorage.removeItem(e),this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.clearItemCookie(e))},m.prototype.containsKey=function(e){return this.browserStorage.containsKey(e)||this.temporaryCacheStorage.containsKey(e)},m.prototype.getKeys=function(){return Sg(this.browserStorage.getKeys(),this.temporaryCacheStorage.getKeys())},m.prototype.clear=function(){return _(this,void 0,void 0,function(){var t=this;return w(this,function(e){switch(e.label){case 0:return[4,this.removeAllAccounts()];case 1:return e.sent(),this.removeAppMetadata(),this.getKeys().forEach(function(e){!t.browserStorage.containsKey(e)&&!t.temporaryCacheStorage.containsKey(e)||-1===e.indexOf(S.CACHE_PREFIX)&&-1===e.indexOf(t.clientId)||t.removeItem(e)}),this.internalStorage.clear(),[2]}})})},m.prototype.clearTokensAndKeysWithClaims=function(){return _(this,void 0,void 0,function(){var t,o,r=this;return w(this,function(e){switch(e.label){case 0:return this.logger.trace("BrowserCacheManager.clearTokensAndKeysWithClaims called"),t=this.getTokenKeys(),o=[],t.accessToken.forEach(function(e){var t=r.getAccessTokenCredential(e);null!=t&&t.requestedClaimsHash&&e.includes(t.requestedClaimsHash.toLowerCase())&&o.push(r.removeAccessToken(e))}),[4,Promise.all(o)];case 1:return e.sent(),0<o.length&&this.logger.warning(o.length+" access tokens with claims in the cache keys have been removed from the cache."),[2]}})})},m.prototype.setItemCookie=function(e,t,o){e=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/;SameSite=Lax;";o&&(e+="expires="+this.getCookieExpirationTime(o)+";"),this.cacheConfig.secureCookies&&(e+="Secure;"),document.cookie=e},m.prototype.getItemCookie=function(e){for(var t=encodeURIComponent(e)+"=",o=document.cookie.split(";"),r=0;r<o.length;r++){for(var n=o[r];" "===n.charAt(0);)n=n.substring(1);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}return S.EMPTY_STRING},m.prototype.clearMsalCookies=function(){var o=this,r=S.CACHE_PREFIX+"."+this.clientId;document.cookie.split(";").forEach(function(e){for(;" "===e.charAt(0);)e=e.substring(1);var t;0===e.indexOf(r)&&(t=e.split("=")[0],o.clearItemCookie(t))})},m.prototype.clearItemCookie=function(e){this.setItemCookie(e,S.EMPTY_STRING,-1)},m.prototype.getCookieExpirationTime=function(e){var t=new Date;return new Date(t.getTime()+e*this.COOKIE_LIFE_MULTIPLIER).toUTCString()},m.prototype.getCache=function(){return this.browserStorage},m.prototype.setCache=function(){},m.prototype.generateCacheKey=function(e){return this.validateAndParseJson(e)?JSON.stringify(e):k.startsWith(e,S.CACHE_PREFIX)||k.startsWith(e,Og.ADAL_ID_TOKEN)?e:S.CACHE_PREFIX+"."+this.clientId+"."+e},m.prototype.generateAuthorityKey=function(e){e=qv.parseRequestState(this.cryptoImpl,e).libraryState.id;return this.generateCacheKey(Rw.AUTHORITY+"."+e)},m.prototype.generateNonceKey=function(e){e=qv.parseRequestState(this.cryptoImpl,e).libraryState.id;return this.generateCacheKey(Rw.NONCE_IDTOKEN+"."+e)},m.prototype.generateStateKey=function(e){e=qv.parseRequestState(this.cryptoImpl,e).libraryState.id;return this.generateCacheKey(Rw.REQUEST_STATE+"."+e)},m.prototype.getCachedAuthority=function(e){var e=this.generateStateKey(e),e=this.getTemporaryCache(e);return e?(e=this.generateAuthorityKey(e),this.getTemporaryCache(e)):null},m.prototype.updateCacheEntries=function(e,t,o,r,n){this.logger.trace("BrowserCacheManager.updateCacheEntries called");var i,a=this.generateStateKey(e),a=(this.setTemporaryCache(a,e,!1),this.generateNonceKey(e)),a=(this.setTemporaryCache(a,t,!1),this.generateAuthorityKey(e));this.setTemporaryCache(a,o,!1),n?(i={credential:n.homeAccountId,type:lv.HOME_ACCOUNT_ID},this.setTemporaryCache(Rw.CCS_CREDENTIAL,JSON.stringify(i),!0)):k.isEmpty(r)||(i={credential:r,type:lv.UPN},this.setTemporaryCache(Rw.CCS_CREDENTIAL,JSON.stringify(i),!0))},m.prototype.resetRequestCache=function(t){var o=this;this.logger.trace("BrowserCacheManager.resetRequestCache called"),k.isEmpty(t)||this.getKeys().forEach(function(e){-1!==e.indexOf(t)&&o.removeItem(e)}),t&&(this.removeItem(this.generateStateKey(t)),this.removeItem(this.generateNonceKey(t)),this.removeItem(this.generateAuthorityKey(t))),this.removeItem(this.generateCacheKey(Rw.REQUEST_PARAMS)),this.removeItem(this.generateCacheKey(Rw.ORIGIN_URI)),this.removeItem(this.generateCacheKey(Rw.URL_HASH)),this.removeItem(this.generateCacheKey(Rw.CORRELATION_ID)),this.removeItem(this.generateCacheKey(Rw.CCS_CREDENTIAL)),this.removeItem(this.generateCacheKey(Rw.NATIVE_REQUEST)),this.setInteractionInProgress(!1)},m.prototype.cleanRequestByState=function(e){this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e&&(e=this.generateStateKey(e),e=this.temporaryCacheStorage.getItem(e),this.logger.infoPii("BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: "+e),this.resetRequestCache(e||S.EMPTY_STRING)),this.clearMsalCookies()},m.prototype.cleanRequestByInteractionType=function(o){var r=this;this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.getKeys().forEach(function(e){var t;-1!==e.indexOf(Rw.REQUEST_STATE)&&(e=r.temporaryCacheStorage.getItem(e))&&(t=r0.extractBrowserRequestState(r.cryptoImpl,e))&&t.interactionType===o&&(r.logger.infoPii("BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: "+e),r.resetRequestCache(e))}),this.clearMsalCookies(),this.setInteractionInProgress(!1)},m.prototype.cacheCodeRequest=function(e,t){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");t=t.base64Encode(JSON.stringify(e));this.setTemporaryCache(Rw.REQUEST_PARAMS,t,!0)},m.prototype.getCachedRequest=function(e,t){this.logger.trace("BrowserCacheManager.getCachedRequest called");var o=this.getTemporaryCache(Rw.REQUEST_PARAMS,!0);if(!o)throw O.createNoTokenRequestCacheError();t=this.validateAndParseJson(t.base64Decode(o));if(!t)throw O.createUnableToParseTokenRequestCacheError();if(this.removeItem(this.generateCacheKey(Rw.REQUEST_PARAMS)),k.isEmpty(t.authority)){o=this.generateAuthorityKey(e),e=this.getTemporaryCache(o);if(!e)throw O.createNoCachedAuthorityError();t.authority=e}return t},m.prototype.getCachedNativeRequest=function(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");var e=this.getTemporaryCache(Rw.NATIVE_REQUEST,!0);return e?this.validateAndParseJson(e)||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null):(this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null)},m.prototype.isInteractionInProgress=function(e){var t=this.getInteractionInProgress();return e?t===this.clientId:!!t},m.prototype.getInteractionInProgress=function(){var e=S.CACHE_PREFIX+"."+Rw.INTERACTION_STATUS_KEY;return this.getTemporaryCache(e,!1)},m.prototype.setInteractionInProgress=function(e){var t=S.CACHE_PREFIX+"."+Rw.INTERACTION_STATUS_KEY;if(e){if(this.getInteractionInProgress())throw O.createInteractionInProgressError();this.setTemporaryCache(t,this.clientId,!1)}else this.getInteractionInProgress()===this.clientId&&this.removeItem(t)},m.prototype.getLegacyLoginHint=function(){var e=this.getTemporaryCache(Og.ADAL_ID_TOKEN),t=(e&&(this.browserStorage.removeItem(Og.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved.")),this.getTemporaryCache(Og.ID_TOKEN,!0)),t=(t&&(this.removeItem(this.generateCacheKey(Og.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved")),t||e);if(t){e=new Ky(t,this.cryptoImpl);if(e.claims&&e.claims.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),e.claims.preferred_username;if(e.claims&&e.claims.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),e.claims.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null},m.prototype.updateCredentialCacheKey=function(e,t){var o=t.generateCredentialKey();if(e!==o){var r=this.getItem(e);if(r)return this.removeItem(e),this.setItem(o,r),this.logger.verbose("Updated an outdated "+t.credentialType+" cache key"),o;this.logger.error("Attempted to update an outdated "+t.credentialType+" cache key but no item matching the outdated key was found in storage")}return e},m.prototype.getRedirectRequestContext=function(){return this.getTemporaryCache(Rw.REDIRECT_CONTEXT,!0)},m.prototype.setRedirectRequestContext=function(e){this.setTemporaryCache(Rw.REDIRECT_CONTEXT,e,!0)};var i0,a0=m;function m(e,t,o,r){e=i0.call(this,e,o,r)||this;return e.COOKIE_LIFE_MULTIPLIER=864e5,e.cacheConfig=t,e.logger=r,e.internalStorage=new t0,e.browserStorage=e.setupBrowserStorage(e.cacheConfig.cacheLocation),e.temporaryCacheStorage=e.setupTemporaryCacheStorage(e.cacheConfig.temporaryCacheLocation,e.cacheConfig.cacheLocation),t.cacheMigrationEnabled&&(e.migrateCacheEntries(),e.createKeyMaps()),e}var s0="@azure/msal-browser",c0="2.38.3",u0=(l0.prototype.sendGetRequestAsync=function(n,i){return _(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,fetch(n,{method:Ow.GET,headers:this.getFetchHeaders(i)})];case 1:return t=e.sent(),[3,3];case 2:throw o=e.sent(),window.navigator.onLine?O.createGetRequestFailedError(o,n):O.createNoNetworkConnectivityError();case 3:return e.trys.push([3,5,,6]),r={headers:this.getHeaderDict(t.headers)},[4,t.json()];case 4:return[2,(r.body=e.sent(),r.status=t.status,r)];case 5:throw e.sent(),O.createFailedToParseNetworkResponseError(n);case 6:return[2]}})})},l0.prototype.sendPostRequestAsync=function(i,a){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:t=a&&a.body||S.EMPTY_STRING,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,fetch(i,{method:Ow.POST,headers:this.getFetchHeaders(a),body:t})];case 2:return o=e.sent(),[3,4];case 3:throw r=e.sent(),window.navigator.onLine?O.createPostRequestFailedError(r,i):O.createNoNetworkConnectivityError();case 4:return e.trys.push([4,6,,7]),n={headers:this.getHeaderDict(o.headers)},[4,o.json()];case 5:return[2,(n.body=e.sent(),n.status=o.status,n)];case 6:throw e.sent(),O.createFailedToParseNetworkResponseError(i);case 7:return[2]}})})},l0.prototype.getFetchHeaders=function(e){var t,o=new Headers;return e&&e.headers&&(t=e.headers,Object.keys(t).forEach(function(e){o.append(e,t[e])})),o},l0.prototype.getHeaderDict=function(e){var o={};return e.forEach(function(e,t){o[t]=e}),o},l0);function l0(){}d0.prototype.sendGetRequestAsync=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.sendRequestAsync(t,Ow.GET,o)]})})},d0.prototype.sendPostRequestAsync=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.sendRequestAsync(t,Ow.POST,o)]})})},d0.prototype.sendRequestAsync=function(i,a,e){var s=this;return new Promise(function(o,r){var n=new XMLHttpRequest;if(n.open(a,i,!0),s.setXhrHeaders(n,e),n.onload=function(){(n.status<200||300<=n.status)&&(a===Ow.POST?r(O.createPostRequestFailedError("Failed with status "+n.status,i)):r(O.createGetRequestFailedError("Failed with status "+n.status,i)));try{var e=JSON.parse(n.responseText),t={headers:s.getHeaderDict(n),body:e,status:n.status};o(t)}catch(e){r(O.createFailedToParseNetworkResponseError(i))}},n.onerror=function(){window.navigator.onLine?a===Ow.POST?r(O.createPostRequestFailedError("Failed with status "+n.status,i)):r(O.createGetRequestFailedError("Failed with status "+n.status,i)):r(O.createNoNetworkConnectivityError())},a===Ow.POST&&e&&e.body)n.send(e.body);else{if(a!==Ow.GET)throw O.createHttpMethodNotImplementedError(a);n.send()}})},d0.prototype.setXhrHeaders=function(t,e){var o;e&&e.headers&&(o=e.headers,Object.keys(o).forEach(function(e){t.setRequestHeader(e,o[e])}))},d0.prototype.getHeaderDict=function(e){var e=e.getAllResponseHeaders().trim().split(/[\r\n]+/),o={};return e.forEach(function(e){var e=e.split(": "),t=e.shift(),e=e.join(": ");t&&e&&(o[t]=e)}),o};var h0=d0;function d0(){}f0.clearHash=function(e){e.location.hash=S.EMPTY_STRING,"function"==typeof e.history.replaceState&&e.history.replaceState(null,S.EMPTY_STRING,""+e.location.origin+e.location.pathname+e.location.search)},f0.replaceHash=function(e){e=e.split("#");e.shift(),window.location.hash=0<e.length?e.join("#"):S.EMPTY_STRING},f0.isInIframe=function(){return window.parent!==window},f0.isInPopup=function(){return"undefined"!=typeof window&&!!window.opener&&window.opener!==window&&"string"==typeof window.name&&0===window.name.indexOf(Dw.POPUP_NAME_PREFIX+".")},f0.getCurrentUri=function(){return window.location.href.split("?")[0].split("#")[0]},f0.getHomepage=function(){var e=new P(window.location.href).getUrlComponents();return e.Protocol+"//"+e.HostNameAndPort+"/"},f0.getBrowserNetworkClient=function(){return new(window.fetch&&window.Headers?u0:h0)},f0.blockReloadInHiddenIframes=function(){if(P.hashContainsKnownProperties(window.location.hash)&&f0.isInIframe())throw O.createBlockReloadInHiddenIframeError()},f0.blockRedirectInIframe=function(e,t){var o=f0.isInIframe();if(e===R.Redirect&&o&&!t)throw O.createRedirectInIframeError(o)},f0.blockAcquireTokenInPopups=function(){if(f0.isInPopup())throw O.createBlockAcquireTokenInPopupsError()},f0.blockNonBrowserEnvironment=function(e){if(!e)throw O.createNonBrowserEnvironmentError()},f0.blockNativeBrokerCalledBeforeInitialized=function(e,t){if(e&&!t)throw O.createNativeBrokerCalledBeforeInitialize()},f0.detectIEOrEdge=function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE "),o=e.indexOf("Trident/"),e=e.indexOf("Edge/");return 0<t||0<o||0<e};var p0=f0;function f0(){}g0.prototype.clearCacheOnLogout=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:if(!t)return[3,5];Fy.accountInfoIsEqual(t,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null)),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.browserStorage.removeAccount(Fy.generateAccountCacheKey(t))];case 2:return e.sent(),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request."),[3,4];case 3:return e.sent(),this.logger.error("Account provided in logout request was not found. Local cache unchanged."),[3,4];case 4:return[3,9];case 5:return e.trys.push([5,8,,9]),this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),[4,this.browserStorage.clear()];case 6:return e.sent(),[4,this.browserCrypto.clearKeystore()];case 7:return e.sent(),[3,9];case 8:return e.sent(),this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged."),[3,9];case 9:return[2]}})})},g0.prototype.initializeBaseRequest=function(n,i){return _(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:return(this.performanceClient.addQueueMeasurement(A.InitializeBaseRequest,n.correlationId),this.logger.verbose("Initializing BaseAuthRequest"),t=n.authority||this.config.auth.authority,i)?[4,this.validateRequestAuthority(t,i)]:[3,2];case 1:e.sent(),e.label=2;case 2:if(o=Sg(n&&n.scopes||[]),(o=v(v({},n),{correlationId:this.correlationId,authority:t,scopes:o})).authenticationScheme){if(o.authenticationScheme===Hg.SSH){if(!n.sshJwk)throw Dy.createMissingSshJwkError();if(!n.sshKid)throw Dy.createMissingSshKidError()}this.logger.verbose('Authentication Scheme set to "'+o.authenticationScheme+'" as configured in Auth request')}else o.authenticationScheme=Hg.BEARER,this.logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');return this.config.cache.claimsBasedCachingEnabled&&n.claims&&!k.isEmptyObj(n.claims)?(r=o,[4,this.browserCrypto.hashString(n.claims)]):[3,4];case 3:r.requestedClaimsHash=e.sent(),e.label=4;case 4:return[2,o]}})})},g0.prototype.getRedirectUri=function(e){this.logger.verbose("getRedirectUri called");e=e||this.config.auth.redirectUri||p0.getCurrentUri();return P.getAbsoluteUrl(e,p0.getCurrentUri())},g0.prototype.validateRequestAuthority=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return[4,this.getDiscoveredAuthority(t)];case 1:if(e.sent().isAlias(o.environment))return[2];throw Dy.createAuthorityMismatchError()}})})},g0.prototype.initializeServerTelemetryManager=function(e,t){this.logger.verbose("initializeServerTelemetryManager called");e={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new A_(e,this.browserStorage)},g0.prototype.getDiscoveredAuthority=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return(this.logger.verbose("getDiscoveredAuthority called"),t={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata},o)?(this.logger.verbose("Creating discovered authority with request authority"),[4,f_.createDiscoveredInstance(o,this.config.system.networkClient,this.browserStorage,t,this.logger)]):[3,2];case 1:return[2,e.sent()];case 2:return this.logger.verbose("Creating discovered authority with configured authority"),[4,f_.createDiscoveredInstance(this.config.auth.authority,this.config.system.networkClient,this.browserStorage,t,this.logger)];case 3:return[2,e.sent()]}})})};t=g0;function g0(e,t,o,r,n,i,a,s,c){this.config=e,this.browserStorage=t,this.browserCrypto=o,this.networkClient=this.config.system.networkClient,this.eventHandler=n,this.navigationClient=i,this.nativeMessageHandler=s,this.correlationId=c||this.browserCrypto.createNewGuid(),this.logger=r.clone(Dw.MSAL_SKU,c0,this.correlationId),this.performanceClient=a}Cg(y0,m0=t),y0.prototype.initializeAuthorizationCodeRequest=function(r){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientInitializeAuthorizationCodeRequest,r.correlationId),this.logger.verbose("initializeAuthorizationRequest called",r.correlationId),[4,this.browserCrypto.generatePkceCodes()];case 1:return t=e.sent(),o=v(v({},r),{redirectUri:r.redirectUri,code:S.EMPTY_STRING,codeVerifier:t.verifier}),r.codeChallenge=t.challenge,r.codeChallengeMethod=S.S256_CODE_CHALLENGE_METHOD,[2,o]}})})},y0.prototype.initializeLogoutRequest=function(e){this.logger.verbose("initializeLogoutRequest called",null==e?void 0:e.correlationId);var t,o=v({correlationId:this.correlationId||this.browserCrypto.createNewGuid()},e);return e?e.logoutHint?this.logger.verbose("logoutHint has already been set in logoutRequest"):e.account?(t=this.getLogoutHintFromIdTokenClaims(e.account))&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),o.logoutHint=t):this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set"):this.logger.verbose("logoutHint will not be set since no logout request was configured"),e&&null===e.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",o.correlationId):e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",o.correlationId),o.postLogoutRedirectUri=P.getAbsoluteUrl(e.postLogoutRedirectUri,p0.getCurrentUri())):null===this.config.auth.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",o.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",o.correlationId),o.postLogoutRedirectUri=P.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,p0.getCurrentUri())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",o.correlationId),o.postLogoutRedirectUri=P.getAbsoluteUrl(p0.getCurrentUri(),p0.getCurrentUri())),o},y0.prototype.getLogoutHintFromIdTokenClaims=function(e){e=e.idTokenClaims;if(e){if(e.login_hint)return e.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null},y0.prototype.createAuthCodeClient=function(o,r,n){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientCreateAuthCodeClient,this.correlationId),this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetClientConfiguration,this.correlationId),[4,this.getClientConfiguration(o,r,n)];case 1:return t=e.sent(),[2,new Xv(t,this.performanceClient)]}})})},y0.prototype.getClientConfiguration=function(r,n,i){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientGetClientConfiguration,this.correlationId),this.logger.verbose("getClientConfiguration called",this.correlationId),this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),[4,this.getDiscoveredAuthority(n,i)];case 1:return t=e.sent(),o=this.config.system.loggerOptions,[2,{authOptions:{clientId:this.config.auth.clientId,authority:t,clientCapabilities:this.config.auth.clientCapabilities},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:o.loggerCallback,piiLoggingEnabled:o.piiLoggingEnabled,logLevel:o.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:r,libraryInfo:{sku:Dw.MSAL_SKU,version:c0,cpu:S.EMPTY_STRING,os:S.EMPTY_STRING},telemetry:this.config.telemetry}]}})})},y0.prototype.validateAndExtractStateFromHash=function(e,t,o){if(this.logger.verbose("validateAndExtractStateFromHash called",o),!e.state)throw O.createHashDoesNotContainStateError();var r=r0.extractBrowserRequestState(this.browserCrypto,e.state);if(!r)throw O.createUnableToParseStateError();if(r.interactionType!==t)throw O.createStateInteractionTypeMismatchError();return this.logger.verbose("Returning state from hash",o),e.state},y0.prototype.getDiscoveredAuthority=function(n,i){var a;return _(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),this.logger.verbose("getDiscoveredAuthority called",this.correlationId),t=null==(a=this.performanceClient)?void 0:a.startMeasurement(A.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),o={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},r=n||this.config.auth.authority,r=p_.generateAuthority(r,i||this.config.auth.azureCloudOptions),this.logger.verbose("Creating discovered authority with configured authority",this.correlationId),this.performanceClient.setPreQueueTime(A.AuthorityFactoryCreateDiscoveredInstance,this.correlationId),[4,f_.createDiscoveredInstance(r,this.config.system.networkClient,this.browserStorage,o,this.logger,this.performanceClient,this.correlationId).then(function(e){return t.endMeasurement({success:!0}),e}).catch(function(e){throw t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})];case 1:return[2,e.sent()]}})})},y0.prototype.initializeAuthorizationRequest=function(a,s){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId),this.logger.verbose("initializeAuthorizationRequest called",this.correlationId),t=this.getRedirectUri(a.redirectUri),o={interactionType:s},o=qv.setRequestState(this.browserCrypto,a&&a.state||S.EMPTY_STRING,o),this.performanceClient.setPreQueueTime(A.InitializeBaseRequest,this.correlationId),n=[{}],[4,this.initializeBaseRequest(a)];case 1:return r=v.apply(void 0,[v.apply(void 0,n.concat([e.sent()])),{redirectUri:t,state:o,nonce:a.nonce||this.browserCrypto.createNewGuid(),responseMode:Ng.FRAGMENT}]),(i=a.account||this.browserStorage.getActiveAccount())&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii("Setting validated request account: "+i.homeAccountId,this.correlationId),r.account=i),k.isEmpty(r.loginHint)&&!i&&(i=this.browserStorage.getLegacyLoginHint())&&(r.loginHint=i),[2,r]}})})};var m0,n=y0;function y0(){return null!==m0&&m0.apply(this,arguments)||this}_0.prototype.handleCodeResponseFromHash=function(r,n,i,a){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){if(this.performanceClient.addQueueMeasurement(A.HandleCodeResponseFromHash,this.authCodeRequest.correlationId),this.logger.verbose("InteractionHandler.handleCodeResponse called"),k.isEmpty(r))throw O.createEmptyHashError(r);if(t=this.browserStorage.generateStateKey(n),!(t=this.browserStorage.getTemporaryCache(t)))throw I.createStateNotFoundError("Cached State");try{o=this.authModule.handleFragmentResponse(r,t)}catch(e){throw e instanceof av&&e.subError===Q_.code?O.createUserCancelledError():e}return this.performanceClient.setPreQueueTime(A.HandleCodeResponseFromServer,this.authCodeRequest.correlationId),[2,this.handleCodeResponseFromServer(o,n,i,a)]})})},_0.prototype.handleCodeResponseFromServer=function(n,i,a,s,c){return void 0===c&&(c=!0),_(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:if(this.performanceClient.addQueueMeasurement(A.HandleCodeResponseFromServer,this.authCodeRequest.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),t=this.browserStorage.generateStateKey(i),t=this.browserStorage.getTemporaryCache(t))return o=this.browserStorage.generateNonceKey(t),o=this.browserStorage.getTemporaryCache(o),this.authCodeRequest.code=n.code,n.cloud_instance_host_name?(this.performanceClient.setPreQueueTime(A.UpdateTokenEndpointAuthority,this.authCodeRequest.correlationId),[4,this.updateTokenEndpointAuthority(n.cloud_instance_host_name,a,s)]):[3,2];throw I.createStateNotFoundError("Cached State");case 1:e.sent(),e.label=2;case 2:return c&&(n.nonce=o||void 0),n.state=t,n.client_info?this.authCodeRequest.clientInfo=n.client_info:(r=this.checkCcsCredentials())&&(this.authCodeRequest.ccsCredential=r),this.performanceClient.setPreQueueTime(A.AuthClientAcquireToken,this.authCodeRequest.correlationId),[4,this.authModule.acquireToken(this.authCodeRequest,n)];case 3:return r=e.sent(),this.browserStorage.cleanRequestByState(i),[2,r]}})})},_0.prototype.updateTokenEndpointAuthority=function(o,r,n){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.UpdateTokenEndpointAuthority,this.authCodeRequest.correlationId),t="https://"+o+"/"+r.tenant+"/",[4,f_.createDiscoveredInstance(t,n,this.browserStorage,r.options,this.logger,this.performanceClient,this.authCodeRequest.correlationId)];case 1:return t=e.sent(),this.authModule.updateAuthority(t),[2]}})})},_0.prototype.checkCcsCredentials=function(){var t=this.browserStorage.getTemporaryCache(Rw.CCS_CREDENTIAL,!0);if(t)try{return JSON.parse(t)}catch(e){this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii("Cache credential could not be parsed: "+t)}return null};var v0=_0;function _0(e,t,o,r,n){this.authModule=e,this.browserStorage=t,this.authCodeRequest=o,this.logger=r,this.performanceClient=n}Cg(E0,w0=v0),E0.prototype.initiateAuthRequest=function(o,r){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),k.isEmpty(o))?[3,7]:(r.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(Rw.ORIGIN_URI,r.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(Rw.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest,this.browserCrypto),this.logger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: "+o),t={apiId:Nw.acquireTokenRedirect,timeout:r.redirectTimeout,noHistory:!1},"function"!=typeof r.onRedirectNavigate?[3,4]:(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),!1===r.onRedirectNavigate(o)?[3,2]:(this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),[4,r.navigationClient.navigateExternal(o,t)])));case 1:return e.sent(),[2];case 2:return this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation"),[2];case 3:return[3,6];case 4:return this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),[4,r.navigationClient.navigateExternal(o,t)];case 5:return e.sent(),[2];case 6:return[3,8];case 7:throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),O.createEmptyNavigationUriError();case 8:return[2]}})})},E0.prototype.handleCodeResponseFromHash=function(i,a,s,c){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.logger.verbose("RedirectHandler.handleCodeResponse called"),k.isEmpty(i))throw O.createEmptyHashError(i);if(this.browserStorage.setInteractionInProgress(!1),t=this.browserStorage.generateStateKey(a),!(t=this.browserStorage.getTemporaryCache(t)))throw I.createStateNotFoundError("Cached State");try{o=this.authModule.handleFragmentResponse(i,t)}catch(e){throw e instanceof av&&e.subError===Q_.code?O.createUserCancelledError():e}return(r=this.browserStorage.generateNonceKey(t),r=this.browserStorage.getTemporaryCache(r),this.authCodeRequest.code=o.code,o.cloud_instance_host_name)?[4,this.updateTokenEndpointAuthority(o.cloud_instance_host_name,s,c)]:[3,2];case 1:e.sent(),e.label=2;case 2:return o.nonce=r||void 0,o.state=t,o.client_info?this.authCodeRequest.clientInfo=o.client_info:(n=this.checkCcsCredentials())&&(this.authCodeRequest.ccsCredential=n),[4,this.authModule.acquireToken(this.authCodeRequest,o)];case 3:return n=e.sent(),this.browserStorage.cleanRequestByState(a),[2,n]}})})};var w0,x,b0,C0=E0;function E0(e,t,o,r,n,i){e=w0.call(this,e,t,o,r,i)||this;return e.browserCrypto=n,e}(a=x=x||{}).INITIALIZE_START="msal:initializeStart",a.INITIALIZE_END="msal:initializeEnd",a.ACCOUNT_ADDED="msal:accountAdded",a.ACCOUNT_REMOVED="msal:accountRemoved",a.LOGIN_START="msal:loginStart",a.LOGIN_SUCCESS="msal:loginSuccess",a.LOGIN_FAILURE="msal:loginFailure",a.ACQUIRE_TOKEN_START="msal:acquireTokenStart",a.ACQUIRE_TOKEN_SUCCESS="msal:acquireTokenSuccess",a.ACQUIRE_TOKEN_FAILURE="msal:acquireTokenFailure",a.ACQUIRE_TOKEN_NETWORK_START="msal:acquireTokenFromNetworkStart",a.SSO_SILENT_START="msal:ssoSilentStart",a.SSO_SILENT_SUCCESS="msal:ssoSilentSuccess",a.SSO_SILENT_FAILURE="msal:ssoSilentFailure",a.ACQUIRE_TOKEN_BY_CODE_START="msal:acquireTokenByCodeStart",a.ACQUIRE_TOKEN_BY_CODE_SUCCESS="msal:acquireTokenByCodeSuccess",a.ACQUIRE_TOKEN_BY_CODE_FAILURE="msal:acquireTokenByCodeFailure",a.HANDLE_REDIRECT_START="msal:handleRedirectStart",a.HANDLE_REDIRECT_END="msal:handleRedirectEnd",a.POPUP_OPENED="msal:popupOpened",a.LOGOUT_START="msal:logoutStart",a.LOGOUT_SUCCESS="msal:logoutSuccess",a.LOGOUT_FAILURE="msal:logoutFailure",a.LOGOUT_END="msal:logoutEnd",a.RESTORE_FROM_BFCACHE="msal:restoreFromBFCache",(e=b0=b0||{}).USER_INTERACTION_REQUIRED="USER_INTERACTION_REQUIRED",e.USER_CANCEL="USER_CANCEL",e.NO_NETWORK="NO_NETWORK",e.TRANSIENT_ERROR="TRANSIENT_ERROR",e.PERSISTENT_ERROR="PERSISTENT_ERROR",e.DISABLED="DISABLED",e.ACCOUNT_UNAVAILABLE="ACCOUNT_UNAVAILABLE";var S0,T0={code:"ContentError"},I0={code:"user_switch",desc:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."},k0={code:"tokens_not_found_in_internal_memory_cache",desc:"Tokens not cached in MSAL JS internal memory, please make the WAM request"},A0=(Cg(P0,S0=T),P0.prototype.isFatal=function(){return!(!this.ext||!this.ext.status||this.ext.status!==b0.PERSISTENT_ERROR&&this.ext.status!==b0.DISABLED)||this.errorCode===T0.code},P0.createError=function(e,t,o){if(o&&o.status)switch(o.status){case b0.ACCOUNT_UNAVAILABLE:return Nv.createNativeAccountUnavailableError();case b0.USER_INTERACTION_REQUIRED:return new Nv(e,t);case b0.USER_CANCEL:return O.createUserCancelledError();case b0.NO_NETWORK:return O.createNoNetworkConnectivityError()}return new P0(e,t,o)},P0.createUserSwitchError=function(){return new P0(I0.code,I0.desc)},P0.createTokensNotFoundInCacheError=function(){return new P0(k0.code,k0.desc)},P0);function P0(e,t,o){e=S0.call(this,e,t)||this;return Object.setPrototypeOf(e,P0.prototype),e.name="NativeAuthError",e.ext=o,e}Cg(x0,O0=n),x0.prototype.acquireToken=function(i){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:return t=this.performanceClient.startMeasurement(A.SilentCacheClientAcquireToken,i.correlationId),r=this.initializeServerTelemetryManager(Nw.acquireTokenSilent_silentFlow),[4,this.createSilentFlowClient(r,i.authority,i.azureCloudOptions)];case 1:o=e.sent(),this.logger.verbose("Silent auth client created"),e.label=2;case 2:return e.trys.push([2,4,,5]),[4,o.acquireCachedToken(i)];case 3:return r=e.sent(),t.endMeasurement({success:!0,fromCache:!0}),[2,r];case 4:throw(n=e.sent())instanceof O&&n.errorCode===yw.code&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),t.endMeasurement({errorCode:n instanceof T&&n.errorCode||void 0,subErrorCode:n instanceof T&&n.subError||void 0,success:!1}),n;case 5:return[2]}})})},x0.prototype.logout=function(){return Promise.reject(O.createSilentLogoutUnsupportedError())},x0.prototype.createSilentFlowClient=function(o,r,n){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetClientConfiguration,this.correlationId),[4,this.getClientConfiguration(o,r,n)];case 1:return t=e.sent(),[2,new n_(t,this.performanceClient)]}})})},x0.prototype.initializeSilentRequest=function(o,r){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.InitializeSilentRequest,this.correlationId),this.performanceClient.setPreQueueTime(A.InitializeBaseRequest,this.correlationId),t=[v({},o)],[4,this.initializeBaseRequest(o,r)];case 1:return[2,v.apply(void 0,[v.apply(void 0,t.concat([e.sent()])),{account:r,forceRefresh:o.forceRefresh||!1}])]}})})};var O0,R0=x0;function x0(){return null!==O0&&O0.apply(this,arguments)||this}Cg(L0,M0=t),L0.prototype.acquireToken=function(a){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:return this.logger.trace("NativeInteractionClient - acquireToken called."),t=this.performanceClient.startMeasurement(A.NativeInteractionClientAcquireToken,a.correlationId),o=bv.nowSeconds(),[4,this.initializeNativeRequest(a)];case 1:r=e.sent(),e.label=2;case 2:return e.trys.push([2,4,,5]),[4,this.acquireTokensFromCache(this.accountId,r)];case 3:return n=e.sent(),t.endMeasurement({success:!0,isNativeBroker:!1,fromCache:!0}),[2,n];case 4:return e.sent(),this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call"),[3,5];case 5:return n={method:Aw.GetToken,request:r},[4,this.nativeMessageHandler.sendMessage(n)];case 6:return i=e.sent(),i=this.validateNativeResponse(i),[2,this.handleNativeResponse(i,r,o).then(function(e){return t.endMeasurement({success:!0,isNativeBroker:!0,requestId:e.requestId}),e}).catch(function(e){throw t.endMeasurement({success:!1,errorCode:e.errorCode,subErrorCode:e.subError,isNativeBroker:!0}),e})]}})})},L0.prototype.createSilentCacheRequest=function(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:Uy.fromString(e.scope).asArray(),account:t,forceRefresh:!1}},L0.prototype.acquireTokensFromCache=function(r,n){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(!r)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),I.createNoAccountFoundError();if(!(t=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:r})))throw I.createNoAccountFoundError();e.label=1;case 1:return e.trys.push([1,3,,4]),o=this.createSilentCacheRequest(n,t),[4,this.silentCacheClient.acquireToken(o)];case 2:return[2,e.sent()];case 3:throw e.sent();case 4:return[2]}})})},L0.prototype.acquireTokenRedirect=function(a){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:return this.logger.trace("NativeInteractionClient - acquireTokenRedirect called."),[4,this.initializeNativeRequest(a)];case 1:t=e.sent(),o={method:Aw.GetToken,request:t},e.label=2;case 2:return e.trys.push([2,4,,5]),[4,this.nativeMessageHandler.sendMessage(o)];case 3:return r=e.sent(),this.validateNativeResponse(r),[3,5];case 4:if((r=e.sent())instanceof A0&&r.isFatal())throw r;return[3,5];case 5:return this.browserStorage.setTemporaryCache(Rw.NATIVE_REQUEST,JSON.stringify(t),!0),n={apiId:Nw.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(a.redirectUri),[4,this.navigationClient.navigateExternal(i,n)];case 6:return e.sent(),[2]}})})},L0.prototype.handleRedirectPromise=function(){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),[2,null];if(!(t=this.browserStorage.getCachedNativeRequest()))return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),[2,null];o=t.prompt,t=Eg(t,["prompt"]),o&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Rw.NATIVE_REQUEST)),o={method:Aw.GetToken,request:t},r=bv.nowSeconds(),e.label=1;case 1:return e.trys.push([1,3,,4]),this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker."),[4,this.nativeMessageHandler.sendMessage(o)];case 2:return n=e.sent(),this.validateNativeResponse(n),n=this.handleNativeResponse(n,t,r),this.browserStorage.setInteractionInProgress(!1),[2,n];case 3:throw n=e.sent(),this.browserStorage.setInteractionInProgress(!1),n;case 4:return[2]}})})},L0.prototype.logout=function(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")},L0.prototype.handleNativeResponse=function(i,a,s){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.logger.trace("NativeInteractionClient - handleNativeResponse called."),i.account.id!==a.accountId)throw A0.createUserSwitchError();return[4,this.getDiscoveredAuthority(a.authority)];case 1:return n=e.sent(),r=n.getPreferredCache(),t=this.createIdTokenObj(i),o=this.createHomeAccountIdentifier(i,t),r=this.createAccountEntity(i,o,t,r),[4,this.generateAuthenticationResult(i,a,t,r,n.canonicalAuthority,s)];case 2:return n=e.sent(),this.cacheAccount(r),this.cacheNativeTokens(i,a,o,r,t,n.accessToken,n.tenantId,s),[2,n]}})})},L0.prototype.createIdTokenObj=function(e){return new Ky(e.id_token||S.EMPTY_STRING,this.browserCrypto)},L0.prototype.createHomeAccountIdentifier=function(e,t){return Fy.generateHomeAccountId(e.client_info||S.EMPTY_STRING,qy.Default,this.logger,this.browserCrypto,t)},L0.prototype.createAccountEntity=function(e,t,o,r){return Fy.createAccount(e.client_info,t,o,void 0,void 0,void 0,r,e.account.id)},L0.prototype.generateScopes=function(e,t){return e.scope?Uy.fromString(e.scope):Uy.fromString(t.scope)},L0.prototype.generatePopAccessToken=function(r,n){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(n.tokenType!==Hg.POP)return[3,2];if(r.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),[2,r.shr];if(t=new zv(this.browserCrypto),o={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce},n.keyId)return[4,t.signPopToken(r.access_token,n.keyId,o)];throw I.createKeyIdMissingError();case 1:return[2,e.sent()];case 2:return[2,r.access_token]}})})},L0.prototype.generateAuthenticationResult=function(s,c,u,l,h,d){return _(this,void 0,void 0,function(){var t,o,r,n,i,a;return w(this,function(e){switch(e.label){case 0:return t=this.addTelemetryFromNativeResponse(s),o=s.scope?Uy.fromString(s.scope):Uy.fromString(c.scope),n=s.account.properties||{},r=n.UID||u.claims.oid||u.claims.sub||S.EMPTY_STRING,n=n.TenantId||u.claims.tid||S.EMPTY_STRING,[4,this.generatePopAccessToken(s,c)];case 1:return i=e.sent(),a=c.tokenType===Hg.POP?Hg.POP:Hg.BEARER,[2,{authority:h,uniqueId:r,tenantId:n,scopes:o.asArray(),account:l.getAccountInfo(),idToken:s.id_token,idTokenClaims:u.claims,accessToken:i,fromCache:!!t&&this.isResponseFromCache(t),expiresOn:new Date(1e3*Number(d+s.expires_in)),tokenType:a,correlationId:this.correlationId,state:s.state,fromNativeBroker:!0}]}})})},L0.prototype.cacheAccount=function(e){var t=this;this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(function(e){t.logger.error("Error occurred while removing account context from browser storage. "+e)})},L0.prototype.cacheNativeTokens=function(e,t,o,r,n,i,a,s){var c=_v.createIdTokenEntity(o,t.authority,e.id_token||S.EMPTY_STRING,t.clientId,n.claims.tid||S.EMPTY_STRING),s=s+(t.tokenType===Hg.POP?S.SHR_NONCE_VALIDITY:("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0),e=this.generateScopes(e,t),o=Sv.createAccessTokenEntity(o,t.authority,i,t.clientId,n?n.claims.tid||S.EMPTY_STRING:a,e.printScopes(),s,0,this.browserCrypto),i=new Dv(r,c,o);this.nativeStorageManager.saveCacheRecord(i)},L0.prototype.addTelemetryFromNativeResponse=function(e){e=this.getMATSFromResponse(e);return e?(this.performanceClient.addStaticFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:e.broker_version,matsAccountJoinOnStart:e.account_join_on_start,matsAccountJoinOnEnd:e.account_join_on_end,matsDeviceJoin:e.device_join,matsPromptBehavior:e.prompt_behavior,matsApiErrorCode:e.api_error_code,matsUiVisible:e.ui_visible,matsSilentCode:e.silent_code,matsSilentBiSubCode:e.silent_bi_sub_code,matsSilentMessage:e.silent_message,matsSilentStatus:e.silent_status,matsHttpStatus:e.http_status,matsHttpEventCount:e.http_event_count},this.correlationId),e):null},L0.prototype.validateNativeResponse=function(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw A0.createUnexpectedError("Response missing expected properties.")},L0.prototype.getMATSFromResponse=function(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch(e){this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null},L0.prototype.isResponseFromCache=function(e){return void 0===e.is_cached?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached},L0.prototype.initializeNativeRequest=function(s){return _(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return w(this,function(e){switch(e.label){case 0:return(this.logger.trace("NativeInteractionClient - initializeNativeRequest called"),t=s.authority||this.config.auth.authority,s.account)?[4,this.validateRequestAuthority(t,s.account)]:[3,2];case 1:e.sent(),e.label=2;case 2:return((n=new P(t)).validateAsUri(),i=s.scopes,r=Eg(s,["scopes"]),(i=new Uy(i||[])).appendScopes(Bg),o=function(){switch(a.apiId){case Nw.ssoSilent:case Nw.acquireTokenSilent_silentFlow:return a.logger.trace("initializeNativeRequest: silent request sets prompt to none"),zg.NONE}if(s.prompt)switch(s.prompt){case zg.NONE:case zg.CONSENT:case zg.LOGIN:return a.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),s.prompt;default:throw a.logger.trace("initializeNativeRequest: prompt = "+s.prompt+" is not compatible with native flow"),O.createNativePromptParameterNotSupportedError()}else a.logger.trace("initializeNativeRequest: prompt was not provided")},r=v(v({},r),{accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:i.printScopes(),redirectUri:this.getRedirectUri(s.redirectUri),prompt:o(),correlationId:this.correlationId,tokenType:s.authenticationScheme,windowTitleSubstring:document.title,extraParameters:v(v(v({},s.extraQueryParameters),s.tokenQueryParameters),{telemetry:jw}),extendedExpiryToken:!1}),s.authenticationScheme!==Hg.POP)?[3,4]:(n={resourceRequestUri:s.resourceRequestUri,resourceRequestMethod:s.resourceRequestMethod,shrClaims:s.shrClaims,shrNonce:s.shrNonce},[4,new zv(this.browserCrypto).generateCnf(n)]);case 3:i=e.sent(),r.reqCnf=i.reqCnfString,r.keyId=i.kid,e.label=4;case 4:return[2,r]}})})};var M0,N0=L0;function L0(e,t,o,r,n,i,a,s,c,u,l,h){t=M0.call(this,e,t,o,r,n,i,s,c,h)||this;return t.apiId=a,t.accountId=u,t.nativeMessageHandler=c,t.nativeStorageManager=l,t.silentCacheClient=new R0(e,t.nativeStorageManager,o,r,n,i,s,c,h),t}q0.prototype.sendMessage=function(t){return _(this,void 0,void 0,function(){var o,r=this;return w(this,function(e){return this.logger.trace("NativeMessageHandler - sendMessage called."),o={channel:qw,extensionId:this.extensionId,responseId:this.responseId++,body:t},this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii("NativeMessageHandler - Sending request to browser extension: "+JSON.stringify(o)),this.messageChannel.port1.postMessage(o),[2,new Promise(function(e,t){r.resolvers.set(o.responseId,{resolve:e,reject:t})})]})})},q0.createProvider=function(r,n,i){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:r.trace("NativeMessageHandler - createProvider called."),e.label=1;case 1:return e.trys.push([1,3,,5]),[4,(t=new q0(r,n,i,Uw)).sendHandshakeRequest()];case 2:return e.sent(),[2,t];case 3:return e.sent(),[4,(o=new q0(r,n,i)).sendHandshakeRequest()];case 4:return e.sent(),[2,o];case 5:return[2]}})})},q0.prototype.sendHandshakeRequest=function(){return _(this,void 0,void 0,function(){var o,r=this;return w(this,function(e){return this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1),o={channel:qw,extensionId:this.extensionId,responseId:this.responseId++,body:{method:Aw.HandshakeRequest}},this.handshakeEvent.addStaticFields({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=function(e){r.onChannelMessage(e)},window.postMessage(o,window.origin,[this.messageChannel.port2]),[2,new Promise(function(e,t){r.handshakeResolvers.set(o.responseId,{resolve:e,reject:t}),r.timeoutId=window.setTimeout(function(){window.removeEventListener("message",r.windowListener,!1),r.messageChannel.port1.close(),r.messageChannel.port2.close(),r.handshakeEvent.endMeasurement({extensionHandshakeTimedOut:!0,success:!1}),t(O.createNativeHandshakeTimeoutError()),r.handshakeResolvers.delete(o.responseId)},r.handshakeTimeoutMs)})]})})},q0.prototype.onWindowMessage=function(e){this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window||!(e=e.data).channel||e.channel!==qw||e.extensionId&&e.extensionId!==this.extensionId||e.body.method===Aw.HandshakeRequest&&(this.logger.verbose(e.extensionId?"Extension with id: "+e.extensionId+" not installed":"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),e=this.handshakeResolvers.get(e.responseId))&&(this.handshakeEvent.endMeasurement({success:!1,extensionInstalled:!1}),e.reject(O.createNativeExtensionNotInstalledError()))},q0.prototype.onChannelMessage=function(t){this.logger.trace("NativeMessageHandler - onChannelMessage called.");var e=t.data,o=this.resolvers.get(e.responseId),r=this.handshakeResolvers.get(e.responseId);try{var n=e.body.method;if(n===Aw.Response){if(o){var i=e.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii("NativeMessageHandler - Received response from browser extension: "+JSON.stringify(i)),"Success"!==i.status)o.reject(A0.createError(i.code,i.description,i.ext));else{if(!i.result)throw T.createUnexpectedError("Event does not contain result.");i.result.code&&i.result.description?o.reject(A0.createError(i.result.code,i.result.description,i.result.ext)):o.resolve(i.result)}this.resolvers.delete(e.responseId)}}else n===Aw.HandshakeResponse&&r&&(clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=e.extensionId,this.extensionVersion=e.body.version,this.logger.verbose("NativeMessageHandler - Received HandshakeResponse from extension: "+this.extensionId),this.handshakeEvent.endMeasurement({extensionInstalled:!0,success:!0}),r.resolve(),this.handshakeResolvers.delete(e.responseId))}catch(e){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii("Error parsing response from WAM Extension: "+e.toString()),this.logger.errorPii("Unable to parse "+t),o?o.reject(e):r&&r.reject(e)}},q0.prototype.getExtensionId=function(){return this.extensionId},q0.prototype.getExtensionVersion=function(){return this.extensionVersion},q0.isNativeAvailable=function(e,t,o,r){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!o)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(r)switch(r){case Hg.BEARER:case Hg.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0};var D0=q0;function q0(e,t,o,r){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=r,this.resolvers=new Map,this.handshakeResolvers=new Map,this.responseId=0,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=o,this.handshakeEvent=o.startMeasurement(A.NativeMessageHandlerHandshake)}Cg(H0,U0=n),H0.prototype.acquireToken=function(u){return _(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c=this;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationRequest,u.correlationId),[4,this.initializeAuthorizationRequest(u,R.Redirect)];case 1:t=e.sent(),this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||S.EMPTY_STRING,t.account||null),o=this.initializeServerTelemetryManager(Nw.acquireTokenRedirect),r=function(e){e.persisted&&(c.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),c.browserStorage.cleanRequestByState(t.state),c.eventHandler.emitEvent(x.RESTORE_FROM_BFCACHE,R.Redirect))},e.label=2;case 2:return e.trys.push([2,7,,8]),this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationCodeRequest,u.correlationId),[4,this.initializeAuthorizationCodeRequest(t)];case 3:return n=e.sent(),this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,u.correlationId),[4,this.createAuthCodeClient(o,t.authority,t.azureCloudOptions)];case 4:return a=e.sent(),this.logger.verbose("Auth code client created"),i=new C0(a,this.browserStorage,n,this.logger,this.browserCrypto,this.performanceClient),[4,a.getAuthCodeUrl(v(v({},t),{nativeBroker:D0.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,u.authenticationScheme)}))];case 5:return a=e.sent(),s=this.getRedirectStartPage(u.redirectStartPage),this.logger.verbosePii("Redirect start page: "+s),window.addEventListener("pageshow",r),[4,i.initiateAuthRequest(a,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:s,onRedirectNavigate:u.onRedirectNavigate})];case 6:return[2,e.sent()];case 7:throw(s=e.sent())instanceof T&&s.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o.cacheFailedRequest(s),this.browserStorage.cleanRequestByState(t.state),s;case 8:return[2]}})})},H0.prototype.handleRedirectPromise=function(h){return _(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c,u,l;return w(this,function(e){switch(e.label){case 0:t=this.initializeServerTelemetryManager(Nw.handleRedirectPromise),e.label=1;case 1:if(e.trys.push([1,10,,11]),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),[2,null];if(!(o=this.getRedirectResponseHash(h||window.location.hash)))return this.logger.info("handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(R.Redirect),[2,null];r=void 0;try{n=P.getDeserializedHash(o),r=this.validateAndExtractStateFromHash(n,R.Redirect),this.logger.verbose("State extracted from hash")}catch(e){return this.logger.info("handleRedirectPromise was unable to extract state due to: "+e),this.browserStorage.cleanRequestByInteractionType(R.Redirect),[2,null]}return(i=this.browserStorage.getTemporaryCache(Rw.ORIGIN_URI,!0)||S.EMPTY_STRING,a=P.removeHashFromUrl(i),u=P.removeHashFromUrl(window.location.href),a===u&&this.config.auth.navigateToLoginRequestUrl)?(this.logger.verbose("Current page is loginRequestUrl, handling hash"),[4,this.handleHash(o,r,t)]):[3,3];case 2:return a=e.sent(),-1<i.indexOf("#")&&p0.replaceHash(i),[2,a];case 3:return this.config.auth.navigateToLoginRequestUrl?[3,4]:(this.logger.verbose("NavigateToLoginRequestUrl set to false, handling hash"),[2,this.handleHash(o,r,t)]);case 4:return p0.isInIframe()&&!this.config.system.allowRedirectInIframe?[3,9]:(this.browserStorage.setTemporaryCache(Rw.URL_HASH,o,!0),s={apiId:Nw.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0},c=!0,i&&"null"!==i?[3,6]:(u=p0.getHomepage(),this.browserStorage.setTemporaryCache(Rw.ORIGIN_URI,u,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),[4,this.navigationClient.navigateInternal(u,s)]));case 5:return c=e.sent(),[3,8];case 6:return this.logger.verbose("Navigating to loginRequestUrl: "+i),[4,this.navigationClient.navigateInternal(i,s)];case 7:c=e.sent(),e.label=8;case 8:if(!c)return[2,this.handleHash(o,r,t)];e.label=9;case 9:return[2,null];case 10:throw(l=e.sent())instanceof T&&l.setCorrelationId(this.correlationId),t.cacheFailedRequest(l),this.browserStorage.cleanRequestByInteractionType(R.Redirect),l;case 11:return[2]}})})},H0.prototype.getRedirectResponseHash=function(e){return this.logger.verbose("getRedirectResponseHash called"),P.hashContainsKnownProperties(e)?(p0.clearHash(window),this.logger.verbose("Hash contains known properties, returning response hash")):(e=this.browserStorage.getTemporaryCache(Rw.URL_HASH,!0),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Rw.URL_HASH)),this.logger.verbose("Hash does not contain known properties, returning cached hash")),e},H0.prototype.handleHash=function(i,a,s){return _(this,void 0,void 0,function(){var t,o,r,n=this;return w(this,function(e){switch(e.label){case 0:if(t=this.browserStorage.getCachedRequest(a,this.browserCrypto),this.logger.verbose("handleHash called, retrieved cached request"),(o=P.getDeserializedHash(i)).accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),this.nativeMessageHandler)return o=new N0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Nw.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,o.accountId,this.nativeStorage,t.correlationId),r=qv.parseRequestState(this.browserCrypto,a).userRequestState,[2,o.acquireToken(v(v({},t),{state:r,prompt:void 0})).finally(function(){n.browserStorage.cleanRequestByState(a)})];throw O.createNativeConnectionNotEstablishedError()}if(o=this.browserStorage.getCachedAuthority(a))return this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,t.correlationId),[4,this.createAuthCodeClient(s,o)];throw O.createNoCachedAuthorityError();case 1:return r=e.sent(),this.logger.verbose("Auth code client created"),cv.removeThrottle(this.browserStorage,this.config.auth.clientId,t),[4,new C0(r,this.browserStorage,t,this.logger,this.browserCrypto,this.performanceClient).handleCodeResponseFromHash(i,a,r.authority,this.networkClient)];case 2:return[2,e.sent()]}})})},H0.prototype.logout=function(a){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:this.logger.verbose("logoutRedirect called"),t=this.initializeLogoutRequest(a),o=this.initializeServerTelemetryManager(Nw.logout),e.label=1;case 1:return e.trys.push([1,10,,11]),this.eventHandler.emitEvent(x.LOGOUT_START,R.Redirect,a),[4,this.clearCacheOnLogout(t.account)];case 2:return e.sent(),r={apiId:Nw.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,t.correlationId),[4,this.createAuthCodeClient(o,a&&a.authority)];case 3:return(n=e.sent(),this.logger.verbose("Auth code client created"),n=n.getLogoutUri(t),this.eventHandler.emitEvent(x.LOGOUT_SUCCESS,R.Redirect,t),a&&"function"==typeof a.onRedirectNavigate)?!1===a.onRedirectNavigate(n)?[3,5]:(this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),[4,this.navigationClient.navigateExternal(n,r)]):[3,7];case 4:return e.sent(),[2];case 5:this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation"),e.label=6;case 6:return[3,9];case 7:return this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),[4,this.navigationClient.navigateExternal(n,r)];case 8:return e.sent(),[2];case 9:return[3,11];case 10:throw(i=e.sent())instanceof T&&i.setCorrelationId(this.correlationId),o.cacheFailedRequest(i),this.eventHandler.emitEvent(x.LOGOUT_FAILURE,R.Redirect,null,i),this.eventHandler.emitEvent(x.LOGOUT_END,R.Redirect),i;case 11:return this.eventHandler.emitEvent(x.LOGOUT_END,R.Redirect),[2]}})})},H0.prototype.getRedirectStartPage=function(e){e=e||window.location.href;return P.getAbsoluteUrl(e,p0.getCurrentUri())};var U0,j0=H0;function H0(e,t,o,r,n,i,a,s,c,u){e=U0.call(this,e,t,o,r,n,i,a,c,u)||this;return e.nativeStorage=s,e}Cg(z0,B0=n),z0.prototype.acquireToken=function(e){try{var t,o=this.generatePopupName(e.scopes||Bg,e.authority||this.config.auth.authority),r=e.popupWindowAttributes||{};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,o,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),t=this.openSizedPopup("about:blank",o,r),this.acquireTokenPopupAsync(e,o,r,t))}catch(e){return Promise.reject(e)}},z0.prototype.logout=function(e){try{this.logger.verbose("logoutPopup called");var t,o=this.initializeLogoutRequest(e),r=this.generateLogoutPopupName(o),n=e&&e.authority,i=e&&e.mainWindowRedirectUri,a=(null==e?void 0:e.popupWindowAttributes)||{};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(o,r,a,n,void 0,i)):(this.logger.verbose("asyncPopup set to false, opening popup"),t=this.openSizedPopup("about:blank",r,a),this.logoutPopupAsync(o,r,a,n,t,i))}catch(e){return Promise.reject(e)}},z0.prototype.acquireTokenPopupAsync=function(p,f,g,m){return _(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c,u,l,h,d=this;return w(this,function(e){switch(e.label){case 0:return this.logger.verbose("acquireTokenPopupAsync called"),t=this.initializeServerTelemetryManager(Nw.acquireTokenPopup),this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationRequest,p.correlationId),[4,this.initializeAuthorizationRequest(p,R.Popup)];case 1:o=e.sent(),this.browserStorage.updateCacheEntries(o.state,o.nonce,o.authority,o.loginHint||S.EMPTY_STRING,o.account||null),e.label=2;case 2:return e.trys.push([2,8,,9]),this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationCodeRequest,p.correlationId),[4,this.initializeAuthorizationCodeRequest(o)];case 3:return r=e.sent(),this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,p.correlationId),[4,this.createAuthCodeClient(t,o.authority,o.azureCloudOptions)];case 4:return n=e.sent(),this.logger.verbose("Auth code client created"),a=D0.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,p.authenticationScheme),i=void 0,a&&(i=this.performanceClient.startMeasurement(A.FetchAccountIdWithNativeBroker,p.correlationId)),[4,n.getAuthCodeUrl(v(v({},o),{nativeBroker:a}))];case 5:return a=e.sent(),s=new v0(n,this.browserStorage,r,this.logger,this.performanceClient),c={popup:m,popupName:f,popupWindowAttributes:g},c=this.initiateAuthRequest(a,c),this.eventHandler.emitEvent(x.POPUP_OPENED,R.Popup,{popupWindow:c},null),[4,this.monitorPopupForHash(c)];case 6:if(c=e.sent(),h=P.getDeserializedHash(c),u=this.validateAndExtractStateFromHash(h,R.Popup,o.correlationId),cv.removeThrottle(this.browserStorage,this.config.auth.clientId,r),h.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),i&&i.endMeasurement({success:!0,isNativeBroker:!0}),this.nativeMessageHandler)return h=new N0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Nw.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,h.accountId,this.nativeStorage,o.correlationId),l=qv.parseRequestState(this.browserCrypto,u).userRequestState,[2,h.acquireToken(v(v({},o),{state:l,prompt:void 0})).finally(function(){d.browserStorage.cleanRequestByState(u)})];throw O.createNativeConnectionNotEstablishedError()}return[4,s.handleCodeResponseFromHash(c,u,n.authority,this.networkClient)];case 7:return[2,e.sent()];case 8:throw h=e.sent(),m&&m.close(),h instanceof T&&h.setCorrelationId(this.correlationId),t.cacheFailedRequest(h),this.browserStorage.cleanRequestByState(o.state),h;case 9:return[2]}})})},z0.prototype.logoutPopupAsync=function(n,i,a,s,c,u){return _(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(x.LOGOUT_START,R.Popup,n),t=this.initializeServerTelemetryManager(Nw.logoutPopup),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,this.clearCacheOnLogout(n.account)];case 2:return e.sent(),this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,n.correlationId),[4,this.createAuthCodeClient(t,s)];case 3:return o=e.sent(),this.logger.verbose("Auth code client created"),o=o.getLogoutUri(n),this.eventHandler.emitEvent(x.LOGOUT_SUCCESS,R.Popup,n),o=this.openPopup(o,{popupName:i,popupWindowAttributes:a,popup:c}),this.eventHandler.emitEvent(x.POPUP_OPENED,R.Popup,{popupWindow:o},null),[4,this.waitForLogoutPopup(o)];case 4:return e.sent(),u?(o={apiId:Nw.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},r=P.getAbsoluteUrl(u,p0.getCurrentUri()),this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii("Redirecting main window to: "+r),this.navigationClient.navigateInternal(r,o)):this.logger.verbose("No main window navigation requested"),[3,6];case 5:throw r=e.sent(),c&&c.close(),r instanceof T&&r.setCorrelationId(this.correlationId),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(x.LOGOUT_FAILURE,R.Popup,null,r),this.eventHandler.emitEvent(x.LOGOUT_END,R.Popup),t.cacheFailedRequest(r),r;case 6:return this.eventHandler.emitEvent(x.LOGOUT_END,R.Popup),[2]}})})},z0.prototype.initiateAuthRequest=function(e,t){if(k.isEmpty(e))throw this.logger.error("Navigate url is empty"),O.createEmptyNavigationUriError();return this.logger.infoPii("Navigate to: "+e),this.openPopup(e,t)},z0.prototype.monitorPopupForHash=function(s){var c=this;return new Promise(function(o,r){var n=c.config.system.windowHashTimeout/c.config.system.pollIntervalMilliseconds,i=0,a=(c.logger.verbose("PopupHandler.monitorPopupForHash - polling started"),setInterval(function(){if(s.closed)c.logger.error("PopupHandler.monitorPopupForHash - window closed"),c.cleanPopup(),clearInterval(a),r(O.createUserCancelledError());else{var e=S.EMPTY_STRING,t=S.EMPTY_STRING;try{e=s.location.href,t=s.location.hash}catch(e){}k.isEmpty(e)||"about:blank"===e||(c.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),i++,t?(c.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url"),clearInterval(a),c.cleanPopup(s),P.hashContainsKnownProperties(t)?(c.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning."),o(t)):(c.logger.error("PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely."),c.logger.errorPii("PopupHandler.monitorPopupForHash - hash found: "+t),r(O.createHashDoesNotContainKnownPropertiesError()))):n<i&&(c.logger.error("PopupHandler.monitorPopupForHash - unable to find hash in url, timing out"),clearInterval(a),r(O.createMonitorPopupTimeoutError())))}},c.config.system.pollIntervalMilliseconds))})},z0.prototype.waitForLogoutPopup=function(r){var n=this;return new Promise(function(t){n.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");var o=setInterval(function(){r.closed&&(n.logger.error("PopupHandler.waitForLogoutPopup - window closed"),n.cleanPopup(),clearInterval(o),t());var e=S.EMPTY_STRING;try{e=r.location.href}catch(e){}k.isEmpty(e)||"about:blank"===e||(n.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing."),clearInterval(o),n.cleanPopup(r),t())},n.config.system.pollIntervalMilliseconds)})},z0.prototype.openPopup=function(e,t){try{var o=void 0;if(t.popup?(o=t.popup,this.logger.verbosePii("Navigating popup window to: "+e),o.location.assign(e)):void 0===t.popup&&(this.logger.verbosePii("Opening popup window to: "+e),o=this.openSizedPopup(e,t.popupName,t.popupWindowAttributes)),o)return o.focus&&o.focus(),this.currentWindow=o,window.addEventListener("beforeunload",this.unloadWindow),o;throw O.createEmptyWindowCreatedError()}catch(e){throw this.logger.error("error opening popup "+e.message),this.browserStorage.setInteractionInProgress(!1),O.createPopupWindowError(e.toString())}},z0.prototype.openSizedPopup=function(e,t,o){var r=window.screenLeft||window.screenX,n=window.screenTop||window.screenY,i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,s=null==(s=o.popupSize)?void 0:s.width,c=null==(c=o.popupSize)?void 0:c.height,u=null==(u=o.popupPosition)?void 0:u.top,o=null==(o=o.popupPosition)?void 0:o.left;return(!s||s<0||i<s)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),s=Dw.POPUP_WIDTH),(!c||c<0||a<c)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),c=Dw.POPUP_HEIGHT),(!u||u<0||a<u)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),u=Math.max(0,a/2-Dw.POPUP_HEIGHT/2+n)),(!o||o<0||i<o)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),o=Math.max(0,i/2-Dw.POPUP_WIDTH/2+r)),window.open(e,t,"width="+s+", height="+c+", top="+u+", left="+o+", scrollbars=yes")},z0.prototype.unloadWindow=function(e){this.browserStorage.cleanRequestByInteractionType(R.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()},z0.prototype.cleanPopup=function(e){e&&e.close(),window.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)},z0.prototype.generatePopupName=function(e,t){return Dw.POPUP_NAME_PREFIX+"."+this.config.auth.clientId+"."+e.join("-")+"."+t+"."+this.correlationId},z0.prototype.generateLogoutPopupName=function(e){e=e.account&&e.account.homeAccountId;return Dw.POPUP_NAME_PREFIX+"."+this.config.auth.clientId+"."+e+"."+this.correlationId};var B0,F0=z0;function z0(e,t,o,r,n,i,a,s,c,u){e=B0.call(this,e,t,o,r,n,i,a,c,u)||this;return e.unloadWindow=e.unloadWindow.bind(e),e.nativeStorage=s,e}G0.prototype.navigateInternal=function(e,t){return G0.defaultNavigateWindow(e,t)},G0.prototype.navigateExternal=function(e,t){return G0.defaultNavigateWindow(e,t)},G0.defaultNavigateWindow=function(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(function(e){setTimeout(function(){e(!0)},t.timeout)})};var K0=G0;function G0(){}var Y0=6e4,W0=6e3,Z0=3e4,Q0=2e3;Cg(X0,V0=v0),X0.prototype.initiateAuthRequest=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:if(this.performanceClient.addQueueMeasurement(A.SilentHandlerInitiateAuthRequest,this.authCodeRequest.correlationId),k.isEmpty(t))throw this.logger.info("Navigate url is empty"),O.createEmptyNavigationUriError();return this.navigateFrameWait?(this.performanceClient.setPreQueueTime(A.SilentHandlerLoadFrame,this.authCodeRequest.correlationId),[4,this.loadFrame(t)]):[3,2];case 1:return[2,e.sent()];case 2:return[2,this.loadFrameSync(t)]}})})},X0.prototype.monitorIframeForHash=function(a,e){var s=this;return this.performanceClient.addQueueMeasurement(A.SilentHandlerMonitorIframeForHash,this.authCodeRequest.correlationId),new Promise(function(o,r){e<W0&&s.logger.warning("system.loadFrameTimeout or system.iframeHashTimeout set to lower ("+e+"ms) than the default ("+W0+"ms). This may result in timeouts.");var n=window.performance.now()+e,i=setInterval(function(){if(window.performance.now()>n)s.removeHiddenIframe(a),clearInterval(i),r(O.createMonitorIframeTimeoutError());else{var e=S.EMPTY_STRING,t=a.contentWindow;try{e=t?t.location.href:S.EMPTY_STRING}catch(e){}k.isEmpty(e)||(e=t?t.location.hash:S.EMPTY_STRING,P.hashContainsKnownProperties(e)&&(s.removeHiddenIframe(a),clearInterval(i),o(e)))}},s.pollIntervalMilliseconds)})},X0.prototype.loadFrame=function(r){var n=this;return this.performanceClient.addQueueMeasurement(A.SilentHandlerLoadFrame,this.authCodeRequest.correlationId),new Promise(function(e,t){var o=n.createHiddenIframe();setTimeout(function(){o?(o.src=r,e(o)):t("Unable to load iframe")},n.navigateFrameWait)})},X0.prototype.loadFrameSync=function(e){var t=this.createHiddenIframe();return t.src=e,t},X0.prototype.createHiddenIframe=function(){var e=document.createElement("iframe");return e.style.visibility="hidden",e.style.position="absolute",e.style.width=e.style.height="0",e.style.border="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.getElementsByTagName("body")[0].appendChild(e),e},X0.prototype.removeHiddenIframe=function(e){document.body===e.parentNode&&document.body.removeChild(e)};var V0,J0=X0;function X0(e,t,o,r,n,i){e=V0.call(this,e,t,o,r,i)||this;return e.navigateFrameWait=n.navigateFrameWait,e.pollIntervalMilliseconds=n.pollIntervalMilliseconds,e}Cg(tb,$0=n),tb.prototype.acquireToken=function(i){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.performanceClient.addQueueMeasurement(A.SilentIframeClientAcquireToken,i.correlationId),this.logger.verbose("acquireTokenByIframe called"),t=this.performanceClient.startMeasurement(A.SilentIframeClientAcquireToken,i.correlationId),k.isEmpty(i.loginHint)&&k.isEmpty(i.sid)&&(!i.account||k.isEmpty(i.account.username))&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request."),i.prompt&&i.prompt!==zg.NONE&&i.prompt!==zg.NO_SESSION)throw t.endMeasurement({success:!1}),O.createSilentPromptValueError(i.prompt);return this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationRequest,i.correlationId),[4,this.initializeAuthorizationRequest(v(v({},i),{prompt:i.prompt||zg.NONE}),R.Silent)];case 1:o=e.sent(),this.browserStorage.updateCacheEntries(o.state,o.nonce,o.authority,o.loginHint||S.EMPTY_STRING,o.account||null),r=this.initializeServerTelemetryManager(this.apiId),e.label=2;case 2:return e.trys.push([2,5,,6]),this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,i.correlationId),[4,this.createAuthCodeClient(r,o.authority,o.azureCloudOptions)];case 3:return n=e.sent(),this.logger.verbose("Auth code client created"),this.performanceClient.setPreQueueTime(A.SilentIframeClientTokenHelper,i.correlationId),[4,this.silentTokenHelper(n,o).then(function(e){return t.endMeasurement({success:!0,fromCache:!1,requestId:e.requestId}),e})];case 4:return[2,e.sent()];case 5:throw(n=e.sent())instanceof T&&n.setCorrelationId(this.correlationId),r.cacheFailedRequest(n),this.browserStorage.cleanRequestByState(o.state),t.endMeasurement({errorCode:n instanceof T&&n.errorCode||void 0,subErrorCode:n instanceof T&&n.subError||void 0,success:!1}),n;case 6:return[2]}})})},tb.prototype.logout=function(){return Promise.reject(O.createSilentLogoutUnsupportedError())},tb.prototype.silentTokenHelper=function(u,l){return _(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c=this;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.SilentIframeClientTokenHelper,l.correlationId),this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationCodeRequest,l.correlationId),[4,this.initializeAuthorizationCodeRequest(l)];case 1:return t=e.sent(),this.performanceClient.setPreQueueTime(A.GetAuthCodeUrl,l.correlationId),[4,u.getAuthCodeUrl(v(v({},l),{nativeBroker:D0.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,l.authenticationScheme)}))];case 2:return r=e.sent(),o=new J0(u,this.browserStorage,t,this.logger,this.config.system,this.performanceClient),this.performanceClient.setPreQueueTime(A.SilentHandlerInitiateAuthRequest,l.correlationId),[4,o.initiateAuthRequest(r)];case 3:return r=e.sent(),this.performanceClient.setPreQueueTime(A.SilentHandlerMonitorIframeForHash,l.correlationId),[4,o.monitorIframeForHash(r,this.config.system.iframeHashTimeout)];case 4:if(n=e.sent(),a=P.getDeserializedHash(n),i=this.validateAndExtractStateFromHash(a,R.Silent,t.correlationId),a.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),this.nativeMessageHandler)return a=new N0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,a.accountId,this.browserStorage,this.correlationId),s=qv.parseRequestState(this.browserCrypto,i).userRequestState,[2,a.acquireToken(v(v({},l),{state:s,prompt:l.prompt||zg.NONE})).finally(function(){c.browserStorage.cleanRequestByState(i)})];throw O.createNativeConnectionNotEstablishedError()}return this.performanceClient.setPreQueueTime(A.HandleCodeResponseFromHash,l.correlationId),[2,o.handleCodeResponseFromHash(n,i,u.authority,this.networkClient)]}})})};var $0,eb=tb;function tb(e,t,o,r,n,i,a,s,c,u,l){e=$0.call(this,e,t,o,r,n,i,s,u,l)||this;return e.apiId=a,e.nativeStorage=c,e}Cg(nb,ob=n),nb.prototype.acquireToken=function(s){return _(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.SilentRefreshClientAcquireToken,s.correlationId),this.performanceClient.setPreQueueTime(A.InitializeBaseRequest,s.correlationId),o=[v({},s)],[4,this.initializeBaseRequest(s,s.account)];case 1:return t=v.apply(void 0,o.concat([e.sent()])),r=this.performanceClient.startMeasurement(A.SilentRefreshClientAcquireToken,t.correlationId),n=this.initializeServerTelemetryManager(Nw.acquireTokenSilent_silentFlow),[4,this.createRefreshTokenClient(n,t.authority,t.azureCloudOptions)];case 2:return i=e.sent(),this.logger.verbose("Refresh token client created"),this.performanceClient.setPreQueueTime(A.RefreshTokenClientAcquireTokenByRefreshToken,s.correlationId),[2,i.acquireTokenByRefreshToken(t).then(function(e){return r.endMeasurement({success:!0,fromCache:e.fromCache,requestId:e.requestId}),e}).catch(function(e){throw e instanceof T&&e.setCorrelationId(a.correlationId),n.cacheFailedRequest(e),r.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})]}})})},nb.prototype.logout=function(){return Promise.reject(O.createSilentLogoutUnsupportedError())},nb.prototype.createRefreshTokenClient=function(o,r,n){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetClientConfiguration,this.correlationId),[4,this.getClientConfiguration(o,r,n)];case 1:return t=e.sent(),[2,new t_(t,this.performanceClient)]}})})};var ob,rb=nb;function nb(){return null!==ob&&ob.apply(this,arguments)||this}ab.prototype.addEventCallback=function(e){var t;return"undefined"!=typeof window?(t=this.browserCrypto.createNewGuid(),this.eventCallbacks.set(t,e),this.logger.verbose("Event callback registered with id: "+t),t):null},ab.prototype.removeEventCallback=function(e){this.eventCallbacks.delete(e),this.logger.verbose("Event callback "+e+" removed.")},ab.prototype.enableAccountStorageEvents=function(){"undefined"!=typeof window&&(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))},ab.prototype.disableAccountStorageEvents=function(){"undefined"!=typeof window&&(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))},ab.prototype.emitEvent=function(o,e,t,r){var n,i=this;"undefined"!=typeof window&&(n={eventType:o,interactionType:e||null,payload:t||null,error:r||null,timestamp:Date.now()},this.logger.info("Emitting event: "+o),this.eventCallbacks.forEach(function(e,t){i.logger.verbose("Emitting event to callback "+t+": "+o),e.apply(null,[n])}))},ab.prototype.handleAccountCacheChange=function(e){try{var t,o,r=e.newValue||e.oldValue;r&&"object"==typeof(t=JSON.parse(r))&&Fy.isAccountEntity(t)&&(o=Yy.toObject(new Fy,t).getAccountInfo(),!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.emitEvent(x.ACCOUNT_ADDED,void 0,o)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.emitEvent(x.ACCOUNT_REMOVED,void 0,o)))}catch(e){}};var ib=ab;function ab(e,t){this.eventCallbacks=new Map,this.logger=e,this.browserCrypto=t,this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}cb.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t};var sb=cb;function cb(){}lb.prototype.generateGuid=function(){try{var e=new Uint8Array(16);return this.cryptoObj.getRandomValues(e),e[6]|=64,e[6]&=79,e[8]|=128,e[8]&=191,sb.decimalToHex(e[0])+sb.decimalToHex(e[1])+sb.decimalToHex(e[2])+sb.decimalToHex(e[3])+"-"+sb.decimalToHex(e[4])+sb.decimalToHex(e[5])+"-"+sb.decimalToHex(e[6])+sb.decimalToHex(e[7])+"-"+sb.decimalToHex(e[8])+sb.decimalToHex(e[9])+"-"+sb.decimalToHex(e[10])+sb.decimalToHex(e[11])+sb.decimalToHex(e[12])+sb.decimalToHex(e[13])+sb.decimalToHex(e[14])+sb.decimalToHex(e[15])}catch(e){for(var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",o="0123456789abcdef",r=0,n=S.EMPTY_STRING,i=0;i<36;i++)"-"!==t[i]&&"4"!==t[i]&&(r=16*Math.random()|0),n+="x"===t[i]?o[r]:"y"===t[i]?o[r=r&3|8]:t[i];return n}},lb.prototype.isGuid=function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)};var ub=lb;function lb(e){this.cryptoObj=e}db.stringToUtf8Arr=function(e){for(var t,o=0,r=e.length,n=0;n<r;n++)o+=(t=e.charCodeAt(n))<128?1:t<2048?2:t<65536?3:t<2097152?4:t<67108864?5:6;for(var i=new Uint8Array(o),a=0,s=0;a<o;s++)(t=e.charCodeAt(s))<128?i[a++]=t:(t<2048?i[a++]=192+(t>>>6):(t<65536?i[a++]=224+(t>>>12):(t<2097152?i[a++]=240+(t>>>18):(t<67108864?i[a++]=248+(t>>>24):(i[a++]=252+(t>>>30),i[a++]=128+(t>>>24&63)),i[a++]=128+(t>>>18&63)),i[a++]=128+(t>>>12&63)),i[a++]=128+(t>>>6&63)),i[a++]=128+(63&t));return i},db.stringToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),r=0;r<e.length;r++)o[r]=e.charCodeAt(r);return t},db.utf8ArrToString=function(e){for(var t,o=S.EMPTY_STRING,r=e.length,n=0;n<r;n++)t=e[n],o+=String.fromCharCode(251<t&&t<254&&n+5<r?1073741824*(t-252)+(e[++n]-128<<24)+(e[++n]-128<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:247<t&&t<252&&n+4<r?(t-248<<24)+(e[++n]-128<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:239<t&&t<248&&n+3<r?(t-240<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:223<t&&t<240&&n+2<r?(t-224<<12)+(e[++n]-128<<6)+e[++n]-128:191<t&&t<224&&n+1<r?(t-192<<6)+e[++n]-128:t);return o},db.getSortedObjectString=function(e){return JSON.stringify(e,Object.keys(e).sort())};var hb=db;function db(){}fb.prototype.urlEncode=function(e){return encodeURIComponent(this.encode(e).replace(/=/g,S.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_"))},fb.prototype.urlEncodeArr=function(e){return this.base64EncArr(e).replace(/=/g,S.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_")},fb.prototype.encode=function(e){e=hb.stringToUtf8Arr(e);return this.base64EncArr(e)},fb.prototype.base64EncArr=function(e){for(var t,o=(3-e.length%3)%3,r=S.EMPTY_STRING,n=e.length,i=0,a=0;a<n;a++)i|=e[a]<<(16>>>(t=a%3)&24),2!=t&&e.length-a!=1||(r+=String.fromCharCode(this.uint6ToB64(i>>>18&63),this.uint6ToB64(i>>>12&63),this.uint6ToB64(i>>>6&63),this.uint6ToB64(63&i)),i=0);return 0==o?r:r.substring(0,r.length-o)+(1==o?"=":"==")},fb.prototype.uint6ToB64=function(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65};var pb=fb;function fb(){}mb.prototype.decode=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Invalid base64 string")}e=this.base64DecToArr(t);return hb.utf8ArrToString(e)},mb.prototype.base64DecToArr=function(e,t){for(var o,r=e.replace(/[^A-Za-z0-9\+\/]/g,S.EMPTY_STRING),n=r.length,i=t?Math.ceil((3*n+1>>>2)/t)*t:3*n+1>>>2,a=new Uint8Array(i),s=void 0,c=0,u=0,l=0;l<n;l++)if(o=3&l,c|=this.b64ToUint6(r.charCodeAt(l))<<18-6*o,3==o||n-l==1){for(s=0;s<3&&u<i;s++,u++)a[u]=c>>>(16>>>s&24)&255;c=0}return a},mb.prototype.b64ToUint6=function(e){return 64<e&&e<91?e-65:96<e&&e<123?e-71:47<e&&e<58?e+4:43===e?62:47===e?63:0};var gb=mb;function mb(){}vb.prototype.generateCodes=function(){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:return t=this.generateCodeVerifier(),[4,this.generateCodeChallengeFromVerifier(t)];case 1:return o=e.sent(),[2,{verifier:t,challenge:o}]}})})},vb.prototype.generateCodeVerifier=function(){try{var e=new Uint8Array(32);return this.cryptoObj.getRandomValues(e),this.base64Encode.urlEncodeArr(e)}catch(e){throw O.createPkceNotGeneratedError(e)}},vb.prototype.generateCodeChallengeFromVerifier=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.cryptoObj.sha256Digest(o)];case 1:return t=e.sent(),[2,this.base64Encode.urlEncodeArr(new Uint8Array(t))];case 2:throw t=e.sent(),O.createPkceNotGeneratedError(t);case 3:return[2]}})})};var yb=vb;function vb(e){this.base64Encode=new pb,this.cryptoObj=e}wb.prototype.getRandomValues=function(e){return window.crypto.getRandomValues(e)},wb.prototype.generateKey=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.generateKey(t,o,r)]})})},wb.prototype.exportKey=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.exportKey(Bw,t)]})})},wb.prototype.importKey=function(t,o,r,n){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.importKey(Bw,t,o,r,n)]})})},wb.prototype.sign=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.sign(t,o,r)]})})},wb.prototype.digest=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.digest(t,o)]})})};var _b=wb;function wb(){}Cb.prototype.initPrng=function(e){return window.msrCrypto.initPrng(Sg(e))},Cb.prototype.getRandomValues=function(e){return window.msrCrypto.getRandomValues(e)},Cb.prototype.generateKey=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.generateKey(t,o,r)]})})},Cb.prototype.exportKey=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.exportKey(Bw,t)]})})},Cb.prototype.importKey=function(t,o,r,n){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.importKey(Bw,t,o,r,n)]})})},Cb.prototype.sign=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.sign(t,o,r)]})})},Cb.prototype.digest=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.digest(t,o)]})})};var bb=Cb;function Cb(){}Sb.prototype.getRandomValues=function(e){return window.msCrypto.getRandomValues(e)},Sb.prototype.generateKey=function(r,n,i){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,new Promise(function(t,o){var e=window.msCrypto.subtle.generateKey(r,n,i);e.addEventListener("complete",function(e){t(e.target.result)}),e.addEventListener("error",function(e){o(e)})})]})})},Sb.prototype.exportKey=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,new Promise(function(o,r){var e=window.msCrypto.subtle.exportKey(Bw,t);e.addEventListener("complete",function(e){var t=e.target.result,t=hb.utf8ArrToString(new Uint8Array(t)).replace(/\r/g,S.EMPTY_STRING).replace(/\n/g,S.EMPTY_STRING).replace(/\t/g,S.EMPTY_STRING).split(" ").join(S.EMPTY_STRING).replace("\0",S.EMPTY_STRING);try{o(JSON.parse(t))}catch(e){r(e)}}),e.addEventListener("error",function(e){r(e)})})]})})},Sb.prototype.importKey=function(o,n,i,a){return _(this,void 0,void 0,function(){var t,r;return w(this,function(e){return t=hb.getSortedObjectString(o),r=hb.stringToArrayBuffer(t),[2,new Promise(function(t,o){var e=window.msCrypto.subtle.importKey(Bw,r,n,i,a);e.addEventListener("complete",function(e){t(e.target.result)}),e.addEventListener("error",function(e){o(e)})})]})})},Sb.prototype.sign=function(r,n,i){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,new Promise(function(t,o){var e=window.msCrypto.subtle.sign(r,n,i);e.addEventListener("complete",function(e){t(e.target.result)}),e.addEventListener("error",function(e){o(e)})})]})})},Sb.prototype.digest=function(r,n){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,new Promise(function(t,o){var e=window.msCrypto.subtle.digest(r,n.buffer);e.addEventListener("complete",function(e){t(e.target.result)}),e.addEventListener("error",function(e){o(e)})})]})})};var Eb=Sb;function Sb(){}var Tb="SHA-256",Ib=new Uint8Array([1,0,1]),kb=(Ab.prototype.hasIECrypto=function(){return"msCrypto"in window},Ab.prototype.hasBrowserCrypto=function(){return"crypto"in window},Ab.prototype.hasMsrCrypto=function(){return"msrCrypto"in window},Ab.prototype.sha256Digest=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return t=hb.stringToUtf8Arr(o),[2,this.subtleCrypto.digest({name:Tb},t)]})})},Ab.prototype.getRandomValues=function(e){return this.subtleCrypto.getRandomValues(e)},Ab.prototype.generateKeyPair=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.subtleCrypto.generateKey(this.keygenAlgorithmOptions,t,o)]})})},Ab.prototype.exportJwk=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.subtleCrypto.exportKey(t)]})})},Ab.prototype.importJwk=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.subtleCrypto.importKey(t,this.keygenAlgorithmOptions,o,r)]})})},Ab.prototype.sign=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.subtleCrypto.sign(this.keygenAlgorithmOptions,t,o)]})})},Ab);function Ab(e,t){if(this.logger=e,this.cryptoOptions=t,this.hasBrowserCrypto())this.logger.verbose("BrowserCrypto: modern crypto interface available"),this.subtleCrypto=new _b;else if(this.hasIECrypto())this.logger.verbose("BrowserCrypto: MS crypto interface available"),this.subtleCrypto=new Eb;else{if(!this.hasMsrCrypto()||null==(e=this.cryptoOptions)||!e.useMsrCrypto)throw this.hasMsrCrypto()&&this.logger.info("BrowserCrypto: MSR Crypto interface available but system.cryptoOptions.useMsrCrypto not enabled"),this.logger.error("BrowserCrypto: No crypto interfaces available."),O.createCryptoNotAvailableError("Browser crypto, msCrypto, or msrCrypto interfaces not available.");this.logger.verbose("BrowserCrypto: MSR crypto interface available"),this.subtleCrypto=new bb}if(this.subtleCrypto.initPrng){if(this.logger.verbose("BrowserCrypto: Interface requires entropy"),null==(t=this.cryptoOptions)||!t.entropy)throw this.logger.error("BrowserCrypto: Interface requires entropy but none provided."),Jw.createEntropyNotProvided();this.logger.verbose("BrowserCrypto: Entropy provided"),this.subtleCrypto.initPrng(this.cryptoOptions.entropy)}this.keygenAlgorithmOptions={name:"RSASSA-PKCS1-v1_5",hash:Tb,modulusLength:2048,publicExponent:Ib}}Ob.prototype.open=function(){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){return[2,new Promise(function(t,e){var o=window.indexedDB.open(r.dbName,r.version);o.addEventListener("upgradeneeded",function(e){e.target.result.createObjectStore(r.tableName)}),o.addEventListener("success",function(e){r.db=e.target.result,r.dbOpen=!0,t()}),o.addEventListener("error",function(){return e(O.createDatabaseUnavailableError())})})]})})},Ob.prototype.closeConnection=function(){var e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)},Ob.prototype.validateDbIsOpen=function(){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return this.dbOpen?[3,2]:[4,this.open()];case 1:return[2,e.sent()];case 2:return[2]}})})},Ob.prototype.getItem=function(n){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(t,o){if(!r.db)return o(O.createDatabaseNotOpenError());var e=r.db.transaction([r.tableName],"readonly").objectStore(r.tableName).get(n);e.addEventListener("success",function(e){r.closeConnection(),t(e.target.result)}),e.addEventListener("error",function(e){r.closeConnection(),o(e)})})]}})})},Ob.prototype.setItem=function(n,i){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(e,t){if(!r.db)return t(O.createDatabaseNotOpenError());var o=r.db.transaction([r.tableName],"readwrite").objectStore(r.tableName).put(i,n);o.addEventListener("success",function(){r.closeConnection(),e()}),o.addEventListener("error",function(e){r.closeConnection(),t(e)})})]}})})},Ob.prototype.removeItem=function(n){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(e,t){if(!r.db)return t(O.createDatabaseNotOpenError());var o=r.db.transaction([r.tableName],"readwrite").objectStore(r.tableName).delete(n);o.addEventListener("success",function(){r.closeConnection(),e()}),o.addEventListener("error",function(e){r.closeConnection(),t(e)})})]}})})},Ob.prototype.getKeys=function(){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(t,o){if(!r.db)return o(O.createDatabaseNotOpenError());var e=r.db.transaction([r.tableName],"readonly").objectStore(r.tableName).getAllKeys();e.addEventListener("success",function(e){r.closeConnection(),t(e.target.result)}),e.addEventListener("error",function(e){r.closeConnection(),o(e)})})]}})})},Ob.prototype.containsKey=function(n){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(t,o){if(!r.db)return o(O.createDatabaseNotOpenError());var e=r.db.transaction([r.tableName],"readonly").objectStore(r.tableName).count(n);e.addEventListener("success",function(e){r.closeConnection(),t(1===e.target.result)}),e.addEventListener("error",function(e){r.closeConnection(),o(e)})})]}})})},Ob.prototype.deleteDatabase=function(){return _(this,void 0,void 0,function(){return w(this,function(e){return this.db&&this.dbOpen&&this.closeConnection(),[2,new Promise(function(e,t){var o=window.indexedDB.deleteDatabase(Fw);o.addEventListener("success",function(){return e(!0)}),o.addEventListener("blocked",function(){return e(!0)}),o.addEventListener("error",function(){return t(!1)})})]})})};var Pb=Ob;function Ob(){this.dbName=Fw,this.version=1,this.tableName="msal.db.keys",this.dbOpen=!1}Mb.prototype.handleDatabaseAccessError=function(e){if(!(e instanceof O&&e.errorCode===bw.code))throw e;this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.")},Mb.prototype.getItem=function(r){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(t=this.inMemoryCache.getItem(r))return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),[4,this.indexedDBCache.getItem(r)];case 2:return[2,e.sent()];case 3:return o=e.sent(),this.handleDatabaseAccessError(o),[3,4];case 4:return[2,t]}})})},Mb.prototype.setItem=function(o,r){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:this.inMemoryCache.setItem(o,r),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.indexedDBCache.setItem(o,r)];case 2:return e.sent(),[3,4];case 3:return t=e.sent(),this.handleDatabaseAccessError(t),[3,4];case 4:return[2]}})})},Mb.prototype.removeItem=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:this.inMemoryCache.removeItem(o),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.indexedDBCache.removeItem(o)];case 2:return e.sent(),[3,4];case 3:return t=e.sent(),this.handleDatabaseAccessError(t),[3,4];case 4:return[2]}})})},Mb.prototype.getKeys=function(){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(0!==(t=this.inMemoryCache.getKeys()).length)return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),this.logger.verbose("In-memory cache is empty, now querying persistent storage."),[4,this.indexedDBCache.getKeys()];case 2:return[2,e.sent()];case 3:return o=e.sent(),this.handleDatabaseAccessError(o),[3,4];case 4:return[2,t]}})})},Mb.prototype.containsKey=function(r){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(t=this.inMemoryCache.containsKey(r))return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),[4,this.indexedDBCache.containsKey(r)];case 2:return[2,e.sent()];case 3:return o=e.sent(),this.handleDatabaseAccessError(o),[3,4];case 4:return[2,t]}})})},Mb.prototype.clearInMemory=function(){this.logger.verbose("Deleting in-memory keystore "+this.storeName),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore "+this.storeName+" deleted")},Mb.prototype.clearPersistent=function(){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.logger.verbose("Deleting persistent keystore"),[4,this.indexedDBCache.deleteDatabase()];case 1:return(t=e.sent())&&this.logger.verbose("Persistent keystore deleted"),[2,t];case 2:return t=e.sent(),this.handleDatabaseAccessError(t),[2,!1];case 3:return[2]}})})};var Rb,xb=Mb;function Mb(e,t){this.inMemoryCache=new t0,this.indexedDBCache=new Pb,this.logger=e,this.storeName=t}(bn=Rb=Rb||{}).asymmetricKeys="asymmetricKeys",bn.symmetricKeys="symmetricKeys";Lb.prototype.clear=function(){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:this.asymmetricKeys.clearInMemory(),this.symmetricKeys.clearInMemory(),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.asymmetricKeys.clearPersistent()];case 2:return e.sent(),[2,!0];case 3:return(t=e.sent())instanceof Error?this.logger.error("Clearing keystore failed with error: "+t.message):this.logger.error("Clearing keystore failed with unknown error"),[2,!1];case 4:return[2]}})})};var Nb=Lb;function Lb(e){this.logger=e,this.asymmetricKeys=new xb(this.logger,Rb.asymmetricKeys),this.symmetricKeys=new xb(this.logger,Rb.symmetricKeys)}qb.prototype.createNewGuid=function(){return this.guidGenerator.generateGuid()},qb.prototype.base64Encode=function(e){return this.b64Encode.encode(e)},qb.prototype.base64Decode=function(e){return this.b64Decode.decode(e)},qb.prototype.generatePkceCodes=function(){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.pkceGenerator.generateCodes()]})})},qb.prototype.getPublicKeyThumbprint=function(a){var s;return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:return t=null==(s=this.performanceClient)?void 0:s.startMeasurement(A.CryptoOptsGetPublicKeyThumbprint,a.correlationId),[4,this.browserCrypto.generateKeyPair(qb.EXTRACTABLE,qb.POP_KEY_USAGES)];case 1:return o=e.sent(),[4,this.browserCrypto.exportJwk(o.publicKey)];case 2:return n=e.sent(),n={e:n.e,kty:n.kty,n:n.n},n=hb.getSortedObjectString(n),[4,this.hashString(n)];case 3:return r=e.sent(),[4,this.browserCrypto.exportJwk(o.privateKey)];case 4:return n=e.sent(),[4,this.browserCrypto.importJwk(n,!1,["sign"])];case 5:return i=e.sent(),[4,this.cache.asymmetricKeys.setItem(r,{privateKey:i,publicKey:o.publicKey,requestMethod:a.resourceRequestMethod,requestUri:a.resourceRequestUri})];case 6:return e.sent(),t&&t.endMeasurement({success:!0}),[2,r]}})})},qb.prototype.removeTokenBindingKey=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return[4,this.cache.asymmetricKeys.removeItem(t)];case 1:return e.sent(),[4,this.cache.asymmetricKeys.containsKey(t)];case 2:return[2,!e.sent()]}})})},qb.prototype.clearKeystore=function(){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return[4,this.cache.clear()];case 1:return[2,e.sent()]}})})},qb.prototype.signJwt=function(s,c,u){var l;return _(this,void 0,void 0,function(){var t,o,r,n,i,a;return w(this,function(e){switch(e.label){case 0:return t=null==(l=this.performanceClient)?void 0:l.startMeasurement(A.CryptoOptsSignJwt,u),[4,this.cache.asymmetricKeys.getItem(c)];case 1:if(o=e.sent())return[4,this.browserCrypto.exportJwk(o.publicKey)];throw O.createSigningKeyNotFoundInStorageError(c);case 2:return i=e.sent(),r=hb.getSortedObjectString(i),n=this.b64Encode.urlEncode(JSON.stringify({kid:c})),n=I_.getShrHeaderString({kid:n,alg:i.alg}),i=this.b64Encode.urlEncode(n),s.cnf={jwk:JSON.parse(r)},n=this.b64Encode.urlEncode(JSON.stringify(s)),r=i+"."+n,i=hb.stringToArrayBuffer(r),[4,this.browserCrypto.sign(o.privateKey,i)];case 3:return n=e.sent(),i=this.b64Encode.urlEncodeArr(new Uint8Array(n)),a=r+"."+i,t&&t.endMeasurement({success:!0}),[2,a]}})})},qb.prototype.hashString=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return[4,this.browserCrypto.sha256Digest(o)];case 1:return t=e.sent(),t=new Uint8Array(t),[2,this.b64Encode.urlEncodeArr(t)]}})})},qb.POP_KEY_USAGES=["sign","verify"],qb.EXTRACTABLE=!0;var Db=qb;function qb(e,t,o){this.logger=e,this.browserCrypto=new kb(this.logger,o),this.b64Encode=new pb,this.b64Decode=new gb,this.guidGenerator=new ub(this.browserCrypto),this.pkceGenerator=new yb(this.browserCrypto),this.cache=new Nb(this.logger),this.performanceClient=t}jb.makeMeasureName=function(e,t){return"msal.measure."+e+"."+t},jb.makeStartMark=function(e,t){return"msal.start."+e+"."+t},jb.makeEndMark=function(e,t){return"msal.end."+e+"."+t},jb.supportsBrowserPerformance=function(){return"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.mark&&"function"==typeof window.performance.measure&&"function"==typeof window.performance.clearMarks&&"function"==typeof window.performance.clearMeasures&&"function"==typeof window.performance.getEntriesByName},jb.flushMeasurements=function(t,e){if(jb.supportsBrowserPerformance())try{e.forEach(function(e){e=jb.makeMeasureName(e.name,t);0<window.performance.getEntriesByName(e,"measure").length&&(window.performance.clearMeasures(e),window.performance.clearMarks(jb.makeStartMark(e,t)),window.performance.clearMarks(jb.makeEndMark(e,t)))})}catch(e){}},jb.prototype.startMeasurement=function(){if(jb.supportsBrowserPerformance())try{window.performance.mark(this.startMark)}catch(e){}},jb.prototype.endMeasurement=function(){if(jb.supportsBrowserPerformance())try{window.performance.mark(this.endMark),window.performance.measure(this.measureName,this.startMark,this.endMark)}catch(e){}},jb.prototype.flushMeasurement=function(){if(jb.supportsBrowserPerformance())try{var e,t=window.performance.getEntriesByName(this.measureName,"measure");if(0<t.length)return e=t[0].duration,window.performance.clearMeasures(this.measureName),window.performance.clearMarks(this.startMark),window.performance.clearMarks(this.endMark),e}catch(e){}return null};var Ub=jb;function jb(e,t){this.correlationId=t,this.measureName=jb.makeMeasureName(e,t),this.startMark=jb.makeStartMark(e,t),this.endMark=jb.makeEndMark(e,t)}Cg(Fb,Hb=ir),Fb.prototype.startPerformanceMeasuremeant=function(e,t){return new Ub(e,t)},Fb.prototype.generateId=function(){return this.guidGenerator.generateGuid()},Fb.prototype.getPageVisibility=function(){var e;return(null==(e=document.visibilityState)?void 0:e.toString())||null},Fb.prototype.deleteIncompleteSubMeasurements=function(e){var t=this.eventsByCorrelationId.get(e.event.correlationId),o=t&&t.eventId===e.event.eventId,r=[];o&&null!=t&&t.incompleteSubMeasurements&&t.incompleteSubMeasurements.forEach(function(e){r.push(v({},e))}),0<r.length&&Ub.flushMeasurements(e.event.correlationId,r)},Fb.prototype.supportsBrowserPerformanceNow=function(){return"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.now},Fb.prototype.startMeasurement=function(e,t){var o=this,r=this.getPageVisibility(),n=Hb.prototype.startMeasurement.call(this,e,t);return v(v({},n),{endMeasurement:function(e){e=n.endMeasurement(v({startPageVisibility:r,endPageVisibility:o.getPageVisibility()},e));return o.deleteIncompleteSubMeasurements(n),e},discardMeasurement:function(){n.discardMeasurement(),o.deleteIncompleteSubMeasurements(n),n.measurement.flushMeasurement()}})},Fb.prototype.setPreQueueTime=function(e,t){var o;this.supportsBrowserPerformanceNow()?t?((o=this.preQueueTimeByCorrelationId.get(t))&&(this.logger.trace("BrowserPerformanceClient: Incomplete pre-queue "+o.name+" found",t),this.addQueueMeasurement(o.name,t,void 0,!0)),this.preQueueTimeByCorrelationId.set(t,{name:e,time:window.performance.now()})):this.logger.trace("BrowserPerformanceClient: correlationId for "+e+" not provided, unable to set telemetry queue time"):this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for "+e)},Fb.prototype.addQueueMeasurement=function(e,t,o,r){if(this.supportsBrowserPerformanceNow())if(t){var n,i=Hb.prototype.getPreQueueTime.call(this,e,t);if(i)return n=window.performance.now(),o=o||Hb.prototype.calculateQueuedTime.call(this,i,n),Hb.prototype.addQueueMeasurement.call(this,e,t,o,r)}else this.logger.trace("BrowserPerformanceClient: correlationId for "+e+" not provided, unable to add queue measurement");else this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to add queue measurement for "+e)};var Hb,Bb=Fb;function Fb(e,t,o,r,n,i,a){e=Hb.call(this,e,t,o,r,n,i)||this;return e.browserCrypto=new kb(e.logger,a),e.guidGenerator=new ub(e.browserCrypto),e}Kb.prototype.loadExternalTokens=function(e,t,o){if(this.logger.info("TokenCache - loadExternalTokens called"),!t.id_token)throw O.createUnableToLoadTokenError("Please ensure server response includes id token.");var r=new Ky(t.id_token,this.cryptoObj);if(e.account)var n=this.loadAccount(r,e.account.environment,void 0,void 0,e.account.homeAccountId),i=new Dv(n,this.loadIdToken(r,n.homeAccountId,e.account.environment,e.account.tenantId),this.loadAccessToken(e,t,n.homeAccountId,e.account.environment,e.account.tenantId,o),this.loadRefreshToken(e,t,n.homeAccountId,e.account.environment));else{if(!e.authority)throw O.createUnableToLoadTokenError("Please provide a request with an account or a request with authority.");var a=p_.generateAuthority(e.authority,e.azureCloudOptions),s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},a=new p_(a,this.config.system.networkClient,this.storage,s,this.logger);if(o.clientInfo){this.logger.trace("TokenCache - homeAccountId from options");n=this.loadAccount(r,a.hostnameAndPort,o.clientInfo,a.authorityType)}else{if(!t.client_info)throw O.createUnableToLoadTokenError("Please provide clientInfo in the response or options.");this.logger.trace("TokenCache - homeAccountId from response");n=this.loadAccount(r,a.hostnameAndPort,t.client_info,a.authorityType)}i=new Dv(n,this.loadIdToken(r,n.homeAccountId,a.hostnameAndPort,a.tenant),this.loadAccessToken(e,t,n.homeAccountId,a.hostnameAndPort,a.tenant,o),this.loadRefreshToken(e,t,n.homeAccountId,a.hostnameAndPort))}return this.generateAuthenticationResult(e,r,i,a)},Kb.prototype.loadAccount=function(e,t,o,r,n){var i;if(n?i=n:void 0!==r&&o&&(i=Fy.generateHomeAccountId(o,r,this.logger,this.cryptoObj,e)),!i)throw O.createUnableToLoadTokenError("Unexpected missing homeAccountId");n=o?Fy.createAccount(o,i,e,void 0,void 0,void 0,t):Fy.createGenericAccount(i,e,void 0,void 0,void 0,t);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading account"),this.storage.setAccount(n),n;throw O.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},Kb.prototype.loadIdToken=function(e,t,o,r){t=_v.createIdTokenEntity(t,o,e.rawToken,this.config.auth.clientId,r);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading id token"),this.storage.setIdTokenCredential(t),t;throw O.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},Kb.prototype.loadAccessToken=function(e,t,o,r,n,i){if(!t.access_token)return this.logger.verbose("TokenCache - No access token provided for caching"),null;if(!t.expires_in)throw O.createUnableToLoadTokenError("Please ensure server response includes expires_in value.");if(!i.extendedExpiresOn)throw O.createUnableToLoadTokenError("Please provide an extendedExpiresOn value in the options.");var e=new Uy(e.scopes).printScopes(),a=i.expiresOn||t.expires_in+(new Date).getTime()/1e3,i=i.extendedExpiresOn,o=Sv.createAccessTokenEntity(o,r,t.access_token,this.config.auth.clientId,n,e,a,i,this.cryptoObj);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading access token"),this.storage.setAccessTokenCredential(o),o;throw O.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},Kb.prototype.loadRefreshToken=function(e,t,o,r){if(!t.refresh_token)return this.logger.verbose("TokenCache - No refresh token provided for caching"),null;o=kv.createRefreshTokenEntity(o,r,t.refresh_token,this.config.auth.clientId);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading refresh token"),this.storage.setRefreshTokenCredential(o),o;throw O.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},Kb.prototype.generateAuthenticationResult=function(e,t,o,r){var n,i=S.EMPTY_STRING,a=[],s=null,c=(null!=o&&o.accessToken&&(i=o.accessToken.secret,a=Uy.fromString(o.accessToken.target).asArray(),s=new Date(1e3*Number(o.accessToken.expiresOn)),n=new Date(1e3*Number(o.accessToken.extendedExpiresOn))),(null==t?void 0:t.claims.oid)||(null==t?void 0:t.claims.sub)||S.EMPTY_STRING),u=(null==t?void 0:t.claims.tid)||S.EMPTY_STRING;return{authority:r?r.canonicalAuthority:S.EMPTY_STRING,uniqueId:c,tenantId:u,scopes:a,account:null!=o&&o.account?o.account.getAccountInfo():null,idToken:t?t.rawToken:S.EMPTY_STRING,idTokenClaims:t?t.claims:{},accessToken:i,fromCache:!0,expiresOn:s,correlationId:e.correlationId||S.EMPTY_STRING,requestId:S.EMPTY_STRING,extExpiresOn:n,familyId:S.EMPTY_STRING,tokenType:(null==(r=null==o?void 0:o.accessToken)?void 0:r.tokenType)||S.EMPTY_STRING,state:S.EMPTY_STRING,cloudGraphHostName:(null==(c=null==o?void 0:o.account)?void 0:c.cloudGraphHostName)||S.EMPTY_STRING,msGraphHost:(null==(u=null==o?void 0:o.account)?void 0:u.msGraphHost)||S.EMPTY_STRING,code:void 0,fromNativeBroker:!1}};var zb=Kb;function Kb(e,t,o,r){this.isBrowserEnvironment="undefined"!=typeof window,this.config=e,this.storage=t,this.logger=o,this.cryptoObj=r}Cg(Wb,Gb=Xv);var Gb,Yb=Wb;function Wb(e){e=Gb.call(this,e)||this;return e.includeRedirectUri=!1,e}Cg(Vb,Zb=n),Vb.prototype.acquireToken=function(i){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.logger.trace("SilentAuthCodeClient.acquireToken called"),i.code)return this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationRequest,i.correlationId),[4,this.initializeAuthorizationRequest(i,R.Silent)];throw O.createAuthCodeRequiredError();case 1:t=e.sent(),this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||S.EMPTY_STRING,t.account||null),o=this.initializeServerTelemetryManager(this.apiId),e.label=2;case 2:return e.trys.push([2,4,,5]),r=v(v({},t),{code:i.code}),this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetClientConfiguration,i.correlationId),[4,this.getClientConfiguration(o,t.authority)];case 3:return n=e.sent(),n=new Yb(n),this.logger.verbose("Auth code client created"),[2,new J0(n,this.browserStorage,r,this.logger,this.config.system,this.performanceClient).handleCodeResponseFromServer({code:i.code,msgraph_host:i.msGraphHost,cloud_graph_host_name:i.cloudGraphHostName,cloud_instance_host_name:i.cloudInstanceHostName},t.state,n.authority,this.networkClient,!1)];case 4:throw(n=e.sent())instanceof T&&n.setCorrelationId(this.correlationId),o.cacheFailedRequest(n),this.browserStorage.cleanRequestByState(t.state),n;case 5:return[2]}})})},Vb.prototype.logout=function(){return Promise.reject(O.createSilentLogoutUnsupportedError())};var Zb,Qb=Vb;function Vb(e,t,o,r,n,i,a,s,c,u){e=Zb.call(this,e,t,o,r,n,i,s,c,u)||this;return e.apiId=a,e}function M(e){this.isBrowserEnvironment="undefined"!=typeof window,this.config=(t=e,o=this.isBrowserEnvironment,i=e.auth,s=e.cache,r=e.system,t=e.telemetry,e={clientId:S.EMPTY_STRING,authority:""+S.DEFAULT_AUTHORITY,knownAuthorities:[],cloudDiscoveryMetadata:S.EMPTY_STRING,authorityMetadata:S.EMPTY_STRING,redirectUri:S.EMPTY_STRING,postLogoutRedirectUri:S.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:a_.AAD,azureCloudOptions:{azureCloudInstance:uy.None,tenant:S.EMPTY_STRING},skipAuthorityMetadataCache:!1},a={cacheLocation:Pw.SessionStorage,temporaryCacheLocation:Pw.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!(!s||s.cacheLocation!==Pw.LocalStorage),claimsBasedCachingEnabled:!0},n={loggerCallback:function(){},logLevel:iy.Info,piiLoggingEnabled:!1},o=v(v({},Vy),{loggerOptions:n,networkClient:o?p0.getBrowserNetworkClient():b_,navigationClient:new K0,loadFrameTimeout:0,windowHashTimeout:(null==r?void 0:r.loadFrameTimeout)||Y0,iframeHashTimeout:(null==r?void 0:r.loadFrameTimeout)||W0,navigateFrameWait:o&&p0.detectIEOrEdge()?500:0,redirectNavigationTimeout:Z0,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(null==r?void 0:r.nativeBrokerHandshakeTimeout)||Q0,pollIntervalMilliseconds:Dw.DEFAULT_POLL_INTERVAL_MS,cryptoOptions:{useMsrCrypto:!1,entropy:void 0}}),r=v(v({},r),{loggerOptions:(null==r?void 0:r.loggerOptions)||n}),n={application:{appName:S.EMPTY_STRING,appVersion:S.EMPTY_STRING}},{auth:v(v({},e),i),cache:v(v({},a),s),system:v(v({},o),r),telemetry:v(v({},n),t)}),this.initialized=!1,this.logger=new sy(this.config.system.loggerOptions,s0,c0),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.isBrowserEnvironment?new Bb(this.config.auth.clientId,this.config.auth.authority,this.logger,s0,c0,this.config.telemetry.application,this.config.system.cryptoOptions):new N_(this.config.auth.clientId,this.config.auth.authority,this.logger,s0,c0,this.config.telemetry.application),this.browserCrypto=this.isBrowserEnvironment?new Db(this.logger,this.performanceClient,this.config.system.cryptoOptions):dm,this.eventHandler=new ib(this.logger,this.browserCrypto),this.browserStorage=this.isBrowserEnvironment?new a0(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger):(e=this.config.auth.clientId,i=this.logger,a={cacheLocation:Pw.MemoryStorage,temporaryCacheLocation:Pw.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!0},new a0(e,a,dm,i));var t,o,r,n,i,a,s={cacheLocation:Pw.MemoryStorage,temporaryCacheLocation:Pw.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!0};this.nativeInternalStorage=new a0(this.config.auth.clientId,s,this.browserCrypto,this.logger),this.tokenCache=new zb(this.config,this.browserStorage,this.logger,this.browserCrypto),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}M.prototype.initialize=function(){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:if(this.logger.trace("initialize called"),this.initialized)return this.logger.info("initialize has already been called, exiting early."),[2];if(t=this.config.system.allowNativeBroker,o=this.performanceClient.startMeasurement(A.InitializeClientApplication),this.eventHandler.emitEvent(x.INITIALIZE_START),!t)return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),r=this,[4,D0.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)];case 2:return r.nativeExtensionProvider=e.sent(),[3,4];case 3:return n=e.sent(),this.logger.verbose(n),[3,4];case 4:return this.config.cache.claimsBasedCachingEnabled?[3,6]:(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),i=this.performanceClient.startMeasurement(A.ClearTokensAndKeysWithClaims),[4,this.browserStorage.clearTokensAndKeysWithClaims()]);case 5:e.sent(),i.endMeasurement({success:!0}),e.label=6;case 6:return this.initialized=!0,this.eventHandler.emitEvent(x.INITIALIZE_END),o.endMeasurement({allowNativeBroker:t,success:!0}),[2]}})})},M.prototype.handleRedirectPromise=function(s){return _(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return w(this,function(e){return this.logger.verbose("handleRedirectPromise called"),p0.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),t=this.getAllAccounts(),this.isBrowserEnvironment?(o=s||S.EMPTY_STRING,void 0===(r=this.redirectResponse.get(o))?(this.eventHandler.emitEvent(x.HANDLE_REDIRECT_START,R.Redirect),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise"),i=this.browserStorage.getCachedNativeRequest(),n=void 0,n=i&&D0.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!s?(this.logger.trace("handleRedirectPromise - acquiring token from native platform"),new N0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Nw.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,i.accountId,this.nativeInternalStorage,i.correlationId).handleRedirectPromise()):(this.logger.trace("handleRedirectPromise - acquiring token from web flow"),i=this.browserStorage.getTemporaryCache(Rw.CORRELATION_ID,!0)||S.EMPTY_STRING,this.createRedirectClient(i).handleRedirectPromise(s)),r=n.then(function(e){return e&&(t.length<a.getAllAccounts().length?(a.eventHandler.emitEvent(x.LOGIN_SUCCESS,R.Redirect,e),a.logger.verbose("handleRedirectResponse returned result, login success")):(a.eventHandler.emitEvent(x.ACQUIRE_TOKEN_SUCCESS,R.Redirect,e),a.logger.verbose("handleRedirectResponse returned result, acquire token success"))),a.eventHandler.emitEvent(x.HANDLE_REDIRECT_END,R.Redirect),e}).catch(function(e){throw 0<t.length?a.eventHandler.emitEvent(x.ACQUIRE_TOKEN_FAILURE,R.Redirect,null,e):a.eventHandler.emitEvent(x.LOGIN_FAILURE,R.Redirect,null,e),a.eventHandler.emitEvent(x.HANDLE_REDIRECT_END,R.Redirect),e}),this.redirectResponse.set(o,r)):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),[2,r]):(this.logger.verbose("handleRedirectPromise returns null, not browser environment"),[2,null])})})},M.prototype.acquireTokenRedirect=function(n){return _(this,void 0,void 0,function(){var t,o,r=this;return w(this,function(e){return t=this.getRequestCorrelationId(n),this.logger.verbose("acquireTokenRedirect called",t),this.preflightBrowserEnvironmentCheck(R.Redirect),(o=0<this.getAllAccounts().length)?this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_START,R.Redirect,n):this.eventHandler.emitEvent(x.LOGIN_START,R.Redirect,n),[2,(this.nativeExtensionProvider&&this.canUseNative(n)?new N0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Nw.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(n),this.nativeInternalStorage,n.correlationId).acquireTokenRedirect(n).catch(function(e){if(e instanceof A0&&e.isFatal())return r.nativeExtensionProvider=void 0,r.createRedirectClient(n.correlationId).acquireToken(n);if(e instanceof Nv)return r.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),r.createRedirectClient(n.correlationId).acquireToken(n);throw r.browserStorage.setInteractionInProgress(!1),e}):this.createRedirectClient(n.correlationId).acquireToken(n)).catch(function(e){throw o?r.eventHandler.emitEvent(x.ACQUIRE_TOKEN_FAILURE,R.Redirect,null,e):r.eventHandler.emitEvent(x.LOGIN_FAILURE,R.Redirect,null,e),e})]})})},M.prototype.acquireTokenPopup=function(t){var o=this,e=this.getRequestCorrelationId(t),r=this.performanceClient.startMeasurement(A.AcquireTokenPopup,e);try{this.logger.verbose("acquireTokenPopup called",e),this.preflightBrowserEnvironmentCheck(R.Popup)}catch(e){return Promise.reject(e)}var n=this.getAllAccounts();return 0<n.length?this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_START,R.Popup,t):this.eventHandler.emitEvent(x.LOGIN_START,R.Popup,t),(this.canUseNative(t)?this.acquireTokenNative(t,Nw.acquireTokenPopup).then(function(e){return o.browserStorage.setInteractionInProgress(!1),r.endMeasurement({success:!0,isNativeBroker:!0,requestId:e.requestId}),e}).catch(function(e){if(e instanceof A0&&e.isFatal())return o.nativeExtensionProvider=void 0,o.createPopupClient(t.correlationId).acquireToken(t);if(e instanceof Nv)return o.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),o.createPopupClient(t.correlationId).acquireToken(t);throw o.browserStorage.setInteractionInProgress(!1),e}):this.createPopupClient(t.correlationId).acquireToken(t)).then(function(e){return n.length<o.getAllAccounts().length?o.eventHandler.emitEvent(x.LOGIN_SUCCESS,R.Popup,e):o.eventHandler.emitEvent(x.ACQUIRE_TOKEN_SUCCESS,R.Popup,e),r.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),r.endMeasurement({success:!0,requestId:e.requestId}),e}).catch(function(e){return 0<n.length?o.eventHandler.emitEvent(x.ACQUIRE_TOKEN_FAILURE,R.Popup,null,e):o.eventHandler.emitEvent(x.LOGIN_FAILURE,R.Popup,null,e),r.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),Promise.reject(e)})},M.prototype.trackPageVisibilityWithMeasurement=function(){var e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))},M.prototype.ssoSilent=function(n){var i;return _(this,void 0,void 0,function(){var t,o,r=this;return w(this,function(e){return t=this.getRequestCorrelationId(n),o=v(v({},n),{prompt:n.prompt,correlationId:t}),this.preflightBrowserEnvironmentCheck(R.Silent),this.ssoSilentMeasurement=this.performanceClient.startMeasurement(A.SsoSilent,t),null!=(i=this.ssoSilentMeasurement)&&i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(x.SSO_SILENT_START,R.Silent,o),[2,(this.canUseNative(o)?this.acquireTokenNative(o,Nw.ssoSilent).catch(function(e){if(e instanceof A0&&e.isFatal())return r.nativeExtensionProvider=void 0,r.createSilentIframeClient(o.correlationId).acquireToken(o);throw e}):this.createSilentIframeClient(o.correlationId).acquireToken(o)).then(function(e){var t;return r.eventHandler.emitEvent(x.SSO_SILENT_SUCCESS,R.Silent,e),null!=(t=r.ssoSilentMeasurement)&&t.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),null!=(t=r.ssoSilentMeasurement)&&t.endMeasurement({success:!0,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e}).catch(function(e){var t;throw r.eventHandler.emitEvent(x.SSO_SILENT_FAILURE,R.Silent,null,e),null!=(t=r.ssoSilentMeasurement)&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}).finally(function(){document.removeEventListener("visibilitychange",r.trackPageVisibilityWithMeasurement)})]})})},M.prototype.acquireTokenByCode=function(a){return _(this,void 0,void 0,function(){var t,o,r,n,i=this;return w(this,function(e){t=this.getRequestCorrelationId(a),this.preflightBrowserEnvironmentCheck(R.Silent),this.logger.trace("acquireTokenByCode called",t),this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_BY_CODE_START,R.Silent,a),o=this.performanceClient.startMeasurement(A.AcquireTokenByCode,a.correlationId);try{if(a.code&&a.nativeAccountId)throw O.createSpaCodeAndNativeAccountIdPresentError();if(a.code)return r=a.code,(n=this.hybridAuthCodeResponses.get(r))?(this.logger.verbose("Existing acquireTokenByCode request found",a.correlationId),o.discardMeasurement()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),n=this.acquireTokenByCodeAsync(v(v({},a),{correlationId:t})).then(function(e){return i.eventHandler.emitEvent(x.ACQUIRE_TOKEN_BY_CODE_SUCCESS,R.Silent,e),i.hybridAuthCodeResponses.delete(r),o.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),o.endMeasurement({success:!0,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e}).catch(function(e){throw i.hybridAuthCodeResponses.delete(r),i.eventHandler.emitEvent(x.ACQUIRE_TOKEN_BY_CODE_FAILURE,R.Silent,null,e),o.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}),this.hybridAuthCodeResponses.set(r,n)),[2,n];if(a.nativeAccountId){if(this.canUseNative(a,a.nativeAccountId))return[2,this.acquireTokenNative(a,Nw.acquireTokenByCode,a.nativeAccountId).catch(function(e){throw e instanceof A0&&e.isFatal()&&(i.nativeExtensionProvider=void 0),e})];throw O.createUnableToAcquireTokenFromNativePlatformError()}throw O.createAuthCodeOrNativeAccountIdRequiredError()}catch(e){throw this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_BY_CODE_FAILURE,R.Silent,null,e),o.endMeasurement({errorCode:e instanceof T&&e.errorCode||void 0,subErrorCode:e instanceof T&&e.subError||void 0,success:!1}),e}return[2]})})},M.prototype.acquireTokenByCodeAsync=function(t){var r;return _(this,void 0,void 0,function(){var o=this;return w(this,function(e){switch(e.label){case 0:return this.logger.trace("acquireTokenByCodeAsync called",t.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(A.AcquireTokenByCodeAsync,t.correlationId),null!=(r=this.acquireTokenByCodeAsyncMeasurement)&&r.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),[4,this.createSilentAuthCodeClient(t.correlationId).acquireToken(t).then(function(e){var t;return null!=(t=o.acquireTokenByCodeAsyncMeasurement)&&t.endMeasurement({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e}).catch(function(e){var t;throw null!=(t=o.acquireTokenByCodeAsyncMeasurement)&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}).finally(function(){document.removeEventListener("visibilitychange",o.trackPageVisibilityWithMeasurement)})];case 1:return[2,e.sent()]}})})},M.prototype.acquireTokenFromCache=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){switch(this.performanceClient.addQueueMeasurement(A.AcquireTokenFromCache,o.correlationId),r.cacheLookupPolicy){case Lw.Default:case Lw.AccessToken:case Lw.AccessTokenAndRefreshToken:return[2,t.acquireToken(o)];default:throw I.createRefreshRequiredError()}return[2]})})},M.prototype.acquireTokenByRefreshToken=function(o,r){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(this.performanceClient.addQueueMeasurement(A.AcquireTokenByRefreshToken,o.correlationId),r.cacheLookupPolicy){case Lw.Default:case Lw.AccessTokenAndRefreshToken:case Lw.RefreshToken:case Lw.RefreshTokenAndNetwork:return t=this.createSilentRefreshClient(o.correlationId),this.performanceClient.setPreQueueTime(A.SilentRefreshClientAcquireToken,o.correlationId),[2,t.acquireToken(o)];default:throw I.createRefreshRequiredError()}return[2]})})},M.prototype.acquireTokenBySilentIframe=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return this.performanceClient.addQueueMeasurement(A.AcquireTokenBySilentIframe,o.correlationId),t=this.createSilentIframeClient(o.correlationId),this.performanceClient.setPreQueueTime(A.SilentIframeClientAcquireToken,o.correlationId),[2,t.acquireToken(o)]})})},M.prototype.logout=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return t=this.getRequestCorrelationId(o),this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),[2,this.logoutRedirect(v({correlationId:t},o))]})})},M.prototype.logoutRedirect=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return t=this.getRequestCorrelationId(o),this.preflightBrowserEnvironmentCheck(R.Redirect),[2,this.createRedirectClient(t).logout(o)]})})},M.prototype.logoutPopup=function(e){try{var t=this.getRequestCorrelationId(e);return this.preflightBrowserEnvironmentCheck(R.Popup),this.createPopupClient(t).logout(e)}catch(e){return Promise.reject(e)}},M.prototype.getAllAccounts=function(){return this.logger.verbose("getAllAccounts called"),this.isBrowserEnvironment?this.browserStorage.getAllAccounts():[]},M.prototype.getAccountByUsername=function(e){var t;return this.logger.trace("getAccountByUsername called"),e?(t=this.browserStorage.getAccountInfoFilteredBy({username:e}))?(this.logger.verbose("getAccountByUsername: Account matching username found, returning"),this.logger.verbosePii("getAccountByUsername: Returning signed-in accounts matching username: "+e),t):(this.logger.verbose("getAccountByUsername: No matching account found, returning null"),null):(this.logger.warning("getAccountByUsername: No username provided"),null)},M.prototype.getAccountByHomeId=function(e){var t;return this.logger.trace("getAccountByHomeId called"),e?(t=this.browserStorage.getAccountInfoFilteredBy({homeAccountId:e}))?(this.logger.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),this.logger.verbosePii("getAccountByHomeId: Returning signed-in accounts matching homeAccountId: "+e),t):(this.logger.verbose("getAccountByHomeId: No matching account found, returning null"),null):(this.logger.warning("getAccountByHomeId: No homeAccountId provided"),null)},M.prototype.getAccountByLocalId=function(e){var t;return this.logger.trace("getAccountByLocalId called"),e?(t=this.browserStorage.getAccountInfoFilteredBy({localAccountId:e}))?(this.logger.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),this.logger.verbosePii("getAccountByLocalId: Returning signed-in accounts matching localAccountId: "+e),t):(this.logger.verbose("getAccountByLocalId: No matching account found, returning null"),null):(this.logger.warning("getAccountByLocalId: No localAccountId provided"),null)},M.prototype.setActiveAccount=function(e){this.browserStorage.setActiveAccount(e)},M.prototype.getActiveAccount=function(){return this.browserStorage.getActiveAccount()},M.prototype.preflightBrowserEnvironmentCheck=function(e,t){if(void 0===t&&(t=!0),this.logger.verbose("preflightBrowserEnvironmentCheck started"),p0.blockNonBrowserEnvironment(this.isBrowserEnvironment),p0.blockRedirectInIframe(e,this.config.system.allowRedirectInIframe),p0.blockReloadInHiddenIframes(),p0.blockAcquireTokenInPopups(),p0.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),e===R.Redirect&&this.config.cache.cacheLocation===Pw.MemoryStorage&&!this.config.cache.storeAuthStateInCookie)throw Jw.createInMemoryRedirectUnavailableError();e!==R.Redirect&&e!==R.Popup||this.preflightInteractiveRequest(t)},M.prototype.preflightInteractiveRequest=function(e){this.logger.verbose("preflightInteractiveRequest called, validating app environment"),p0.blockReloadInHiddenIframes(),e&&this.browserStorage.setInteractionInProgress(!0)},M.prototype.acquireTokenNative=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){if(this.logger.trace("acquireTokenNative called"),this.nativeExtensionProvider)return[2,new N0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,o,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(t),this.nativeInternalStorage,t.correlationId).acquireToken(t)];throw O.createNativeConnectionNotEstablishedError()})})},M.prototype.canUseNative=function(e,t){if(this.logger.trace("canUseNative called"),!D0.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case zg.NONE:case zg.CONSENT:case zg.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace("canUseNative: prompt = "+e.prompt+" is not compatible with native flow, returning false"),!1}return!(!t&&!this.getNativeAccountId(e)&&(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),1))},M.prototype.getNativeAccountId=function(e){e=e.account||this.browserStorage.getAccountInfoByHints(e.loginHint,e.sid)||this.getActiveAccount();return e&&e.nativeAccountId||""},M.prototype.createPopupClient=function(e){return new F0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},M.prototype.createRedirectClient=function(e){return new j0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},M.prototype.createSilentIframeClient=function(e){return new eb(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Nw.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},M.prototype.createSilentCacheClient=function(e){return new R0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)},M.prototype.createSilentRefreshClient=function(e){return new rb(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)},M.prototype.createSilentAuthCodeClient=function(e){return new Qb(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Nw.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)},M.prototype.addEventCallback=function(e){return this.eventHandler.addEventCallback(e)},M.prototype.removeEventCallback=function(e){this.eventHandler.removeEventCallback(e)},M.prototype.addPerformanceCallback=function(e){return this.performanceClient.addPerformanceCallback(e)},M.prototype.removePerformanceCallback=function(e){return this.performanceClient.removePerformanceCallback(e)},M.prototype.enableAccountStorageEvents=function(){this.eventHandler.enableAccountStorageEvents()},M.prototype.disableAccountStorageEvents=function(){this.eventHandler.disableAccountStorageEvents()},M.prototype.getTokenCache=function(){return this.tokenCache},M.prototype.getLogger=function(){return this.logger},M.prototype.setLogger=function(e){this.logger=e},M.prototype.initializeWrapperLibrary=function(e,t){this.browserStorage.setWrapperMetadata(e,t)},M.prototype.setNavigationClient=function(e){this.navigationClient=e},M.prototype.getConfiguration=function(){return this.config},M.prototype.getRequestCorrelationId=function(e){return null!=e&&e.correlationId?e.correlationId:this.isBrowserEnvironment?this.browserCrypto.createNewGuid():S.EMPTY_STRING};Cg($b,Jb=M),$b.prototype.loginRedirect=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return t=this.getRequestCorrelationId(o),this.logger.verbose("loginRedirect called",t),[2,this.acquireTokenRedirect(v({correlationId:t},o||Hw))]})})},$b.prototype.loginPopup=function(e){var t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup(v({correlationId:t},e||Hw))},$b.prototype.acquireTokenSilent=function(s){return _(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return w(this,function(e){if(t=this.getRequestCorrelationId(s),(o=this.performanceClient.startMeasurement(A.AcquireTokenSilent,t)).addStaticFields({cacheLookupPolicy:s.cacheLookupPolicy}),this.preflightBrowserEnvironmentCheck(R.Silent),this.logger.verbose("acquireTokenSilent called",t),i=s.account||this.getActiveAccount())return n={clientId:this.config.auth.clientId,authority:s.authority||S.EMPTY_STRING,scopes:s.scopes,homeAccountIdentifier:i.homeAccountId,claims:s.claims,authenticationScheme:s.authenticationScheme,resourceRequestMethod:s.resourceRequestMethod,resourceRequestUri:s.resourceRequestUri,shrClaims:s.shrClaims,sshKid:s.sshKid},r=JSON.stringify(n),void 0===(n=this.activeSilentTokenRequests.get(r))?(this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t),this.performanceClient.setPreQueueTime(A.AcquireTokenSilentAsync,t),i=this.acquireTokenSilentAsync(v(v({},s),{correlationId:t}),i).then(function(e){return a.activeSilentTokenRequests.delete(r),o.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),o.endMeasurement({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker,cacheLookupPolicy:s.cacheLookupPolicy,requestId:e.requestId}),e}).catch(function(e){throw a.activeSilentTokenRequests.delete(r),o.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}),this.activeSilentTokenRequests.set(r,i),[2,i]):(this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),o.discardMeasurement(),[2,n]);throw O.createNoAccountError()})})},$b.prototype.trackPageVisibility=function(){this.astsAsyncMeasurement&&(this.logger.info("Perf: Visibility change detected"),this.astsAsyncMeasurement.increment({visibilityChangeCount:1}))},$b.prototype.acquireTokenSilentAsync=function(c,r){var n;return _(this,void 0,void 0,function(){var t,o,i,a,s=this;return w(this,function(e){switch(e.label){case 0:return(this.performanceClient.addQueueMeasurement(A.AcquireTokenSilentAsync,c.correlationId),this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_START,R.Silent,c),this.astsAsyncMeasurement=this.performanceClient.startMeasurement(A.AcquireTokenSilentAsync,c.correlationId),null!=(n=this.astsAsyncMeasurement)&&n.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibility),D0.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,c.authenticationScheme)&&r.nativeAccountId)?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),t=v(v({},c),{account:r}),t=this.acquireTokenNative(t,Nw.acquireTokenSilent_silentFlow).catch(function(t){return _(s,void 0,void 0,function(){return w(this,function(e){if(t instanceof A0&&t.isFatal())return this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,[2,this.createSilentIframeClient(c.correlationId).acquireToken(c)];throw t})})}),[3,3]):[3,1];case 1:return this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),o=this.createSilentCacheClient(c.correlationId),this.performanceClient.setPreQueueTime(A.InitializeSilentRequest,c.correlationId),[4,o.initializeSilentRequest(c,r)];case 2:i=e.sent(),a=v(v({},c),{cacheLookupPolicy:c.cacheLookupPolicy||Lw.Default}),this.performanceClient.setPreQueueTime(A.AcquireTokenFromCache,i.correlationId),t=this.acquireTokenFromCache(o,i,a).catch(function(e){if(a.cacheLookupPolicy===Lw.AccessToken)throw e;return p0.blockReloadInHiddenIframes(),s.eventHandler.emitEvent(x.ACQUIRE_TOKEN_NETWORK_START,R.Silent,i),s.performanceClient.setPreQueueTime(A.AcquireTokenByRefreshToken,i.correlationId),s.acquireTokenByRefreshToken(i,a).catch(function(e){var t=e instanceof av,o=e instanceof Nv,r=e.errorCode===xv.code,n=e.errorCode===Dw.INVALID_GRANT_ERROR;if(t&&n&&!o&&a.cacheLookupPolicy!==Lw.AccessTokenAndRefreshToken&&a.cacheLookupPolicy!==Lw.RefreshToken||a.cacheLookupPolicy===Lw.Skip||r)return s.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",c.correlationId),s.performanceClient.setPreQueueTime(A.AcquireTokenBySilentIframe,i.correlationId),s.acquireTokenBySilentIframe(i);throw e})}),e.label=3;case 3:return[2,t.then(function(e){var t;return s.eventHandler.emitEvent(x.ACQUIRE_TOKEN_SUCCESS,R.Silent,e),null!=(t=s.astsAsyncMeasurement)&&t.endMeasurement({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e}).catch(function(e){var t;throw s.eventHandler.emitEvent(x.ACQUIRE_TOKEN_FAILURE,R.Silent,null,e),null!=(t=s.astsAsyncMeasurement)&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}).finally(function(){document.removeEventListener("visibilitychange",s.trackPageVisibility)})]}})})};var Jb,Xb=$b;function $b(e){e=Jb.call(this,e)||this;return e.astsAsyncMeasurement=void 0,e.activeSilentTokenRequests=new Map,e.trackPageVisibility=e.trackPageVisibility.bind(e),e}function eC(e){this.message=e}(eC.prototype=new Error).name="InvalidCharacterError";var tC="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new eC("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,r,n=0,i=0,a="";r=t.charAt(i++);~r&&(o=n%4?64*o+r:r,n++%4)&&(a+=String.fromCharCode(255&o>>(-2*n&6))))r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function oC(e){this.message=e}function rC(e,t){if("string"!=typeof e)throw new oC("Invalid token specified");t=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return decodeURIComponent(tC(t).replace(/(.)/g,function(e,t){t=t.charCodeAt(0).toString(16).toUpperCase();return"%"+(t=t.length<2?"0"+t:t)}))}catch(e){return tC(t)}}(e.split(".")[t]))}catch(e){throw new oC("Invalid token specified: "+e.message)}}(oC.prototype=new Error).name="InvalidTokenError";N.prototype.initialize=function(){var r=this;return this.initPromise||(this.initPromise=new Promise(function(e,t){if(r.options.authType===l.AuthenticationType.subscriptionKey)e();else if(r.options.authType===l.AuthenticationType.aad)r.options.authContext=r.options.authContext||N.getDefaultAuthContext(r.options),r.options.authContext.handleRedirectPromise().then(function(){setTimeout(function(){return r._loginAndAcquireTokenForAAD(e,t)})}).catch(function(e){t(new Error("Error logging in the AAD users: "+e))});else if(r.options.authType===l.AuthenticationType.anonymous)e(r._triggerTokenFetch(!0));else if(r.options.authType===l.AuthenticationType.sas){if(r.options.sasToken){var o=-1;try{o=r._getTokenExpiry(r.options.sasToken)}catch(e){return void t(new Error("An invalid sasToken was provided."))}if(o>N.constants.tokenRefreshClockSkew)return r._storeToken(r.options.sasToken),r._setTimeoutTokenFetch(o-N.constants.tokenRefreshClockSkew),void e()}e(r._triggerTokenFetch())}else t(new Error("An invalid authentication type was specified."))})),this.initPromise},N.prototype.dispose=function(){this.tokenTimeOutHandle&&(clearTimeout(this.tokenTimeOutHandle),this.tokenTimeOutHandle=null)},N.getDefaultAuthContext=function(e){if(!e.aadAppId)throw new Error("No AAD app ID was specified.");if(e.aadTenant)return this.defaultAuthContext||(this.defaultAuthContext=new Xb({auth:{authority:"".concat(e.aadInstance||V).concat(e.aadTenant),clientId:e.aadAppId},cache:{cacheLocation:this.constants.preferredCacheLocation}})),this.defaultAuthContext;throw new Error("No AAD tenant was specified.")},N.prototype._loginAndAcquireTokenForAAD=function(e,t){var o=(null==(o=this.options.authContext)?void 0:o.getAllAccounts())||[];0===o.length?(this.options.authContext.loginRedirect(),e()):(this.options.authContext.setActiveAccount(o[0]),this._acquireTokenForAAD(e,t))},N.prototype._acquireTokenForAAD=function(o,t){var r=this,n={scopes:[fe]};this.options.authContext.acquireTokenSilent(n).then(function(e){r._saveItem(N.constants.storage.tokenKey,e.accessToken);var t={map:r.map,type:N.constants.events.tokenAcquired},t=(r.map.events.invoke(N.constants.events.tokenAcquired,t),clearTimeout(r.tokenTimeOutHandle),new Date(e.expiresOn).getTime()-Date.now());r.tokenTimeOutHandle=setTimeout(function(){return r._acquireTokenForAAD()},t),null!=o&&o()}).catch(function(e){if(e instanceof Nv)return r.options.authContext.acquireTokenRedirect(n),null==o?void 0:o();null!=t&&t(e)})},N.prototype.getAuthType=function(){return this.options.authType},N.prototype.getClientId=function(){return this.options.clientId},N.prototype.getToken=function(){if(this.options.authType===l.AuthenticationType.aad)return this._getItem(N.constants.storage.tokenKey);if(this.options.authType!==l.AuthenticationType.anonymous&&this.options.authType!==l.AuthenticationType.sas)return this.options.authType===l.AuthenticationType.subscriptionKey?this.options.subscriptionKey:void 0;var e=this._getItem(N.constants.storage.tokenKey);if(e){var t=this._getTokenExpiry(e);if(t<300&&0<t)this._triggerTokenFetch();else if(t<=0)throw this._saveItem(N.constants.storage.tokenKey,""),new Error(N.constants.errors.tokenExpired)}else this._triggerTokenFetch();return e},N.prototype._getTokenExpiry=function(e){var e=rC(e).exp,t=this._getCurrentTime();return 0<e-t?e-t:-1},N.prototype._storeToken=function(e){this._saveItem(N.constants.storage.tokenKey,e);e={map:this.map,type:N.constants.events.tokenAcquired};this.map.events.invoke(N.constants.events.tokenAcquired,e)},N.prototype._saveItem=function(e,t){return this._supportsLocalStorage()?localStorage.setItem(e,t):this._supportsSessionStorage()?sessionStorage.setItem(e,t):this.fallbackStorage[e]=t,!0},N.prototype._getItem=function(e){return this._supportsLocalStorage()?localStorage.getItem(e):this._supportsSessionStorage()?sessionStorage.getItem(e):e in this.fallbackStorage?this.fallbackStorage[e]:null},N.prototype._supportsLocalStorage=function(){try{return window.localStorage?(window.localStorage.setItem(N.constants.storage.testStorageKey,"A"),"A"===window.localStorage.getItem(N.constants.storage.testStorageKey)&&(window.localStorage.removeItem(N.constants.storage.testStorageKey),!window.localStorage.getItem(N.constants.storage.testStorageKey))):!1}catch(e){return!1}},N.prototype._supportsSessionStorage=function(){try{return window.sessionStorage?(window.sessionStorage.setItem(N.constants.storage.testStorageKey,"A"),"A"===window.sessionStorage.getItem(N.constants.storage.testStorageKey)&&(window.sessionStorage.removeItem(N.constants.storage.testStorageKey),!window.sessionStorage.getItem(N.constants.storage.testStorageKey))):!1}catch(e){return!1}},N.prototype._getCurrentTime=function(){return Math.round((new Date).getTime()/1e3)},N.prototype.signRequest=function(e){e.headers=e.headers||{},e.headers[ge]=this.sessionId,e.headers[de]=pe,e.headers[le]="MapControl/".concat(Le," (Web)");var t=this.getToken();switch(this.options.authType){case l.AuthenticationType.aad:case l.AuthenticationType.anonymous:e.headers[he]=this.options.clientId,e.headers[X]=$+t;break;case l.AuthenticationType.sas:e.headers[X]=ee+t;break;case l.AuthenticationType.subscriptionKey:e.headers["subscription-key"]=t;break;default:throw new Error("An invalid authentication type was specified")}return e},N.constants={preferredCacheLocation:"localStorage",storage:{tokenKey:"access.token.key",testStorageKey:"testStorage"},events:{tokenAcquired:"tokenacquired"},tokenExpiresIn:3599,tokenRefreshClockSkew:300,errors:{tokenExpired:"Token Expired, Try again"}};var nC=N;function N(e){var n=this,t=(this.fallbackStorage={},this._triggerTokenFetch=function(e){return void 0===e&&(e=!1),new Promise(function(o,r){"function"!=typeof n.options.getToken?r(new Error("Token cannot be ".concat(e?"fetched":"renewed"," because getToken was not set or is not a function."))):n.options.getToken(function(e){try{var t=n._getTokenExpiry(e)-N.constants.tokenRefreshClockSkew;n._storeToken(e),n._setTimeoutTokenFetch(t),o()}catch(e){r(new Error("Invalid token returned by getToken function"))}},function(e){r(e)},n.map)})},this._setTimeoutTokenFetch=function(e){clearTimeout(n.tokenTimeOutHandle),n.tokenTimeOutHandle=setTimeout(n._triggerTokenFetch,Math.min(1e3*e,2147483647))},e.getServiceOptions());this.options=t.authOptions,this.sessionId=t.sessionId,this.map=e}var iC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},aC=(sC.prototype.add=function(e,t){var o,r;if(Array.isArray(e))try{for(var n=iC(e),i=n.next();!i.done;i=n.next()){var a=i.value;this._add(a,t)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}else this._add(e,t)},sC.prototype.getControls=function(){return Array.from(this.controls)},sC.prototype.remove=function(e){var t,o;if(Array.isArray(e))try{for(var r=iC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this._remove(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}else this._remove(e)},sC.prototype._add=function(e,t){this.controls.add(e);var o=(new Kt).merge(t),e=e.onAdd(this.map,t),t=this.controlContainer.getElementsByClassName(o.position);if(!(0<t.length))throw new Error("Control position ".concat(o.position," does not exist."));t.item(0).appendChild(e)},sC.prototype._remove=function(e){e.onRemove(),this.controls.delete(e)},sC);function sC(e){for(var t in this.map=e,this.controlContainer=document.createElement("div"),this.controlContainer.classList.add("atlas-control-container"),l.ControlPosition){var o;l.ControlPosition.hasOwnProperty(t)&&((o=document.createElement("div")).classList.add(l.ControlPosition[t]),o.classList.add("subcontrol-container"),this.controlContainer.appendChild(o))}this.map.getMapContainer().appendChild(this.controlContainer),this.controls=new Set}var cC=window&&window.__assign||function(){return(cC=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},uC=(lC.prototype.addCallback=function(a,s,c,e,u){var t,l,h=this;if(e)t=function(e){var t=e.lngLat?new dl(e.lngLat.lng,e.lngLat.lat):void 0,o=e.point?[e.point.x,e.point.y]:void 0,r=e.features?e.features.map(function(e){return new eu(e.geometry,e.properties,e.id)}):[],e={type:e.type,originalEvent:e.originalEvent,position:t,coordinate:o,features:r};c(e)};else switch(a){case"data":case"sourcedata":case"styledata":t=function(e){e=cC(cC({dataType:e.dataType},"source"===e.dataType&&cC(cC(cC({isSourceLoaded:e.isSourceLoaded},e.sourceDataType&&{sourceDataType:e.sourceDataType}),{source:h.map.sources.getById(e.sourceId)}),e.tile&&{tile:{id:{x:e.tile.tileID.canonical.x,y:e.tile.tileID.canonical.y,z:e.tile.tileID.canonical.z},size:e.tile.tileSize,state:e.tile.state}})),{map:h.map,type:e.type});u&&h.map.events._removeListener(a,s,c),c(e)};break;case"error":t=function(e){e={error:e.error,map:h.map,type:e.type};u&&h.map.events._removeListener(a,s,c),c(e)};break;case"touchstart":case"touchend":case"touchmove":case"touchcancel":t=function(e){if(e.originalEvent){if(e.originalEvent===l)return;l=e.originalEvent}var t=e.point?new nu(e.point.x,e.point.y):void 0,o=e.points?e.points.map(function(e){return new nu(e.x,e.y)}):[],r=e.lngLat?new dl(e.lngLat.lng,e.lngLat.lat):void 0,n=e.lngLats?e.lngLats.map(function(e){return new dl(e.lng,e.lat)}):[],i=r?h.map.layers.getRenderedShapes(new au(r),s?[s]:void 0):[],t={map:h.map,originalEvent:e.originalEvent,pixel:t,pixels:o,position:r,positions:n,shapes:i,layerId:s||void 0,preventDefault:function(){return e.preventDefault()},type:e.type};u&&h.map.events._removeListener(a,s,c),c(t)};break;case"mousedown":case"mouseup":case"mouseover":case"mousemove":case"click":case"dblclick":case"mouseout":case"mouseenter":case"mouseleave":case"contextmenu":t=function(e){if(e.originalEvent){if(e.originalEvent===l)return;l=e.originalEvent}var t=e.lngLat?new dl(e.lngLat.lng,e.lngLat.lat):void 0,o=e.point?new nu(e.point.x,e.point.y):void 0,r=t?h.map.layers.getRenderedShapes(new au(t),s?[s]:void 0):[],t={map:h.map,originalEvent:e.originalEvent,position:t,pixel:o,preventDefault:function(){return e.preventDefault()},shapes:r,layerId:s||void 0,type:e.type};u&&h.map.events._removeListener(a,s,c),c(t)};break;case"styleimagemissing":t=function(e){u&&h.map.events._removeListener(a,s,c),c(e.id)};break;case"wheel":t=function(e){if(e.originalEvent){if(e.originalEvent===l)return;l=e.originalEvent}var t={map:h.map,originalEvent:e.originalEvent,preventDefault:function(){return e.preventDefault()},type:e.type};u&&h.map.events._removeListener(a,s,c),c(t)};break;case"resize":t=function(e){var t,o={map:h.map,type:e.type};for(t in e)"type"!==t&&"target"!==t&&(o[t]=e[t]);u&&h.map.events._removeListener(a,s,c),c(o)};break;default:t=function(e){var t={map:h.map,type:e.type};e.originalEvent&&(t.originalEvent=e.originalEvent),u&&h.map.events._removeListener(a,s,c),c(t)}}this.callbacks.has(s)||this.callbacks.set(s,new Zt),this.callbacks.get(s).has(a)||this.callbacks.get(s).set(a,new Map),this.callbacks.get(s).get(a).set(c,[t,u])},lC.prototype.removeCallback=function(e,t,o){this.callbacks.has(t)&&this.callbacks.get(t).has(e)&&this.callbacks.get(t).get(e).has(o)&&this.callbacks.get(t).get(e).delete(o)},lC.prototype.getModifiedCallback=function(e,t,o){if(this.callbacks.has(t)&&this.callbacks.get(t).has(e)&&this.callbacks.get(t).get(e).has(o))return this.callbacks.get(t).get(e).get(o)[0]},lC.prototype.getLayerCallbacks=function(e){if(this.callbacks.has(e))return this.callbacks.get(e)},lC.prototype.getEventCallbacks=function(e,t){if(this.callbacks.has(t)){t=this.callbacks.get(t);if(t.has(e))return t.get(e)}},lC);function lC(e){this.callbacks=new Zt,this.map=e}var hC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},dC=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},pC=["maxzoomchanged","minzoomchanged","mapconfigurationchanged"],fC=(gC.prototype.add=function(e,t,o){var r,n;if("function"==typeof t)this._addGlobalListener(e,t,!1,!1);else{t=Array.isArray(t)?t:[t];try{for(var i=hC(t),a=i.next();!a.done;a=i.next()){var s=a.value;s instanceof Zh&&Zh._isMBoxEvent(e)?this._addLayerListener(e,s,o,!1,!1):s._addEventListener(e,o,!1)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}},gC.prototype.addOnce=function(e,t,o){"function"==typeof t?this._addGlobalListener(e,t,!1,!0):t instanceof Zh&&Zh._isMBoxEvent(e)?this._addLayerListener(e,t,o,!1,!0):t._addEventListener(e,o,!0)},gC.prototype._addLegacy=function(e,t,o){"function"==typeof t?this._addGlobalListener(e,t,!0,!1):this._addLayerListener(e,t,o,!0,!1)},gC.prototype._addLayerListener=function(e,t,o,r,n){var i,a,s,c,t=t instanceof Zh?t.getId():t,u=this.map.layers.getLayerById(t),l=this.mapCallbackHandler.getModifiedCallback(e,t,o);if(l&&u)try{for(var h=hC(u._getLayerIds()),d=h.next();!d.done;d=h.next()){var p=d.value;this.map._getMap().off(e,p,l)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}if(this.mapCallbackHandler.addCallback(e,t,o,r,n),u){l=this.mapCallbackHandler.getModifiedCallback(e,t,o);try{for(var f=hC(u._getLayerIds()),g=f.next();!g.done;g=f.next()){p=g.value;this.map._getMap().on(e,p,l)}}catch(e){s={error:e}}finally{try{g&&!g.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}}},gC.prototype._addGlobalListener=function(e,t,o,r){var n,i,a,s;pC.includes(e)?this.map._addEventListener(e,t,r):(n=this.mapCallbackHandler.getModifiedCallback(e,"",t),this.mapCallbackHandler.addCallback(e,"",t,o,r),i=this.mapCallbackHandler.getModifiedCallback(e,"",t),"load"===e&&this.map._isLoaded()?(a={type:"load",map:this.map},setTimeout(function(){return i(a)})):"ready"===e?this.map._isReady()&&(s={type:"ready",map:this.map},setTimeout(function(){return i(s)})):(n&&this.map._getMap().off(e,n),this.map._getMap().on(e,i)))},gC.prototype.invoke=function(e,t,o){if(void 0===o)this._invokeListeners(e,"",t);else if(t instanceof Zh&&Zh._isMBoxEvent(e))this._invokeListeners(e,t.getId(),o);else{if(!(t instanceof Qt))throw new Error("The invoke target is invalid.");t._invokeEvent(e,o)}},gC.prototype._invokeListeners=function(o,r,n){var i=this,e=new Zt(this.mapCallbackHandler.getEventCallbacks(o,r));e?e.forEach(function(e,t){e=dC(e,2);e[0],e[1]&&i._removeListener(o,r,t),t(n)}):"error"===o&&console.error("error"in n?n.error:n)},gC.prototype.remove=function(e,t,o){var r,n;if("function"==typeof t)this._removeListener(e,"",t);else{t=Array.isArray(t)?t:[t];try{for(var i=hC(t),a=i.next();!a.done;a=i.next()){var s=a.value;s instanceof Zh&&Zh._isMBoxEvent(e)?this._removeListener(e,s,o):null!=s&&s._removeEventListener(e,o)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}},gC.prototype._removeLegacy=function(e,t,o){"function"==typeof t?this._removeListener(e,"",t):this._removeListener(e,t,o)},gC.prototype._removeListener=function(e,t,o){var r,n;if(pC.includes(e))this.map._removeEventListener(e,o);else{var t=t instanceof Zh?t.getId():t,i=this.mapCallbackHandler.getModifiedCallback(e,t,o);if(i)if(t){var a=this.map.layers.getLayerById(t);if(a)try{for(var s=hC(a._getLayerIds()),c=s.next();!c.done;c=s.next()){var u=c.value;this.map._getMap().off(e,u,i)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}else this.map._getMap().off(e,i);this.mapCallbackHandler.removeCallback(e,t,o)}},gC.prototype._enableLayerEvents=function(c){var u=this,e=this.mapCallbackHandler.getLayerCallbacks(c.getId());e&&e.forEach(function(e,s){e.forEach(function(e){var t,o,r=dC(e,1)[0];try{for(var n=hC(c._getLayerIds()),i=n.next();!i.done;i=n.next()){var a=i.value;u.map._getMap().on(s,a,r)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}})})},gC.prototype._disableLayerEvents=function(c){var u=this,e=this.mapCallbackHandler.getLayerCallbacks(c.getId());e&&e.forEach(function(e,s){e.forEach(function(e){var t,o,r=dC(e,1)[0];try{for(var n=hC(c._getLayerIds()),i=n.next();!i.done;i=n.next()){var a=i.value;u.map._getMap().off(s,a,r)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}})})},gC);function gC(e){this.map=e,this.mapCallbackHandler=new uC(this.map)}var mC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},yC=(vC.prototype.add=function(e,t){var o,r;if(Array.isArray(e))try{for(var n=mC(e),i=n.next();!i.done;i=n.next()){var a=i.value;this._addMarker(a,t)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}else this._addMarker(e,t)},vC.prototype._addMarker=function(e,t){e._addToMap(this.map,t),this.markers.add(e)},vC.prototype.getMarkers=function(){return Array.from(this.markers)},vC.prototype.remove=function(e){var t,o;if(Array.isArray(e))try{for(var r=mC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this._removeMarker(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}else this._removeMarker(e)},vC.prototype._removeMarker=function(t){var o=this;t instanceof lf?(t._removeFromMap(),this.markers.delete(t)):this.markers.forEach(function(e){e._getId()===t&&(e._removeFromMap(),o.markers.delete(e))})},vC.prototype.clear=function(){var t=this;this.markers.forEach(function(e){e._removeFromMap(),t.markers.delete(e)})},vC);function vC(e){this.markers=new Set,this.map=e}wC.prototype.add=function(a,t,s){var c=this;return new Promise(function(o,r){var n,e,i;c.userImages.has(a)?o():t instanceof HTMLImageElement||t instanceof ImageData?(c.map._getMap().addImage(a,t,s),c.userImages.set(a,{image:t,meta:s}),o()):"string"==typeof t&&(e=void 0,e=/<svg/i.test(t)&&!/^data:/i.test(t)?"data:image/svg+xml;base64,"+window.btoa(t):t,i=!1,c.map._sendRequest(e,"Image").then(function(e){return i?void 0:e.blob()}).then(function(e){var t;!i&&e&&(clearTimeout(n),(t=new Image).onload=function(){c.map._getMap().addImage(a,t,s),c.userImages.set(a,{image:t,meta:s}),o()},t.onerror=t.onabort=function(){r("Failed to load image into HTML element.")},t.src=URL.createObjectURL(e))}).catch(function(){i||(clearTimeout(n),r("Failed to load image into HTML element."))}),n=setTimeout(function(){i=!0,r("Failed to load image within specified timeout: ".concat(c.imageLoadTimeout," ms."))},c.imageLoadTimeout))})},wC.prototype.clear=function(){var o=this;this.userImages.forEach(function(e,t){o.map._getMap().removeImage(t)}),this.userImages.clear()},wC.prototype.getImageIds=function(){var o=[];return this.userImages.forEach(function(e,t){o.push(t)}),o},wC.prototype.createFromTemplate=function(e,t,o,r,n){o=o||"#1A73AA",r=r||"#fff";t=(t=Pt(t,n)).replace(/{color}/g,o).replace(/{secondaryColor}/g,r).replace(/{text}/g,"");return this.add(e,t)},wC.prototype.hasImage=function(e){return this.userImages.has(e)},wC.prototype.remove=function(e){this.map._getMap().removeImage(e),this.userImages.delete(e)},wC.prototype._restoreImages=function(){var o=this;this.userImages.forEach(function(e,t){o.map._getMap().hasImage(t)||o.map._getMap().addImage(t,e.image,e.meta)})};var _C=wC;function wC(e){this.userImages=new Zt,this.imageLoadTimeout=5e3,this.map=e}var bC,CC,Uo=window&&window.__extends||(bC=function(e,t){return(bC=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}bC(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),EC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},SC=(Uo(TC,CC=Zh),TC.prototype._buildLayers=function(){return this.layers},TC.prototype._getLayerIds=function(){return this.layers.map(function(e){return e.id})},TC.prototype._getSourceIds=function(){var t,e,o=new Set;try{for(var r=EC(this.layers),n=r.next();!n.done;n=r.next()){var i=n.value;"source"in i&&"string"==typeof i.source?o.add(i.source):"source"in i&&i.source&&o.add(i.id)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return o},TC.prototype._updateLayoutProperty=function(t,o,e,r){var n;$c(o,e)||(n=this.map._getMap(),this.layers.forEach(function(e){n.getLayer(e.id)?n.setLayoutProperty(e.id,t,r||o):console.warn("Could not update layout property ".concat(t," for layer ").concat(e.id," to ").concat(r||o))}))},TC);function TC(e,t){t=CC.call(this,t)||this;return t.layers=e,t}var IC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},kC=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},AC=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},PC=(OC.prototype.add=function(e,t){var o,r,n=t instanceof Zh?t.getId():t;if(Array.isArray(e))try{for(var i=IC(e),a=i.next();!a.done;a=i.next()){var s=a.value;this._addLayer(s,n)}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}else this._addLayer(e,n)},OC.prototype._addLayer=function(t,o){if(!(this.map._isReady()||t instanceof SC))throw new Error("The layer '".concat(t.getId(),"' 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 adding a layer to it.");var e,r,n,i;o!==t.getId()&&this.layerIndex.find(function(e){return o===e.getId()})?this._getMapboxLayerExists(t)?(r=this.layerIndex.findIndex(function(e){return e.getId()===t.getId()}),n=this.userLayers.findIndex(function(e){return e.layer.getId()===t.getId()}),this._removeMapboxLayers(t),this._addMapboxLayers(t,o),(i=this.layerIndex[r])&&this.map.events._disableLayerEvents(i),this.map.events._enableLayerEvents(t),this.layerIndex.splice(r,1),e=this.layerIndex.findIndex(function(e){return e.getId()===o}),this.layerIndex.splice(e,0,t),t instanceof SC||(this.userLayers[n]={layer:t,before:o}),i&&i.onRemove()):(this._addMapboxLayers(t,o),this.map.events._enableLayerEvents(t),e=this.layerIndex.findIndex(function(e){return e.getId()===o}),this.layerIndex.splice(e,0,t),t instanceof SC||this.userLayers.push({layer:t,before:o})):(r=this.layerIndex.findIndex(function(e){return e.getId()===t.getId()}),n=this.userLayers.findIndex(function(e){return e.layer.getId()===t.getId()}),0<=r&&0<=n?(i=this.layerIndex[r],this._removeMapboxLayers(i),this._addMapboxLayers(t,r+1),this.map.events._disableLayerEvents(i),this.map.events._enableLayerEvents(t),(this.layerIndex[r]=t)instanceof SC||(this.userLayers[n]={layer:t,before:void 0}),i.onRemove()):(this._addMapboxLayers(t),this.map.events._enableLayerEvents(t),this.layerIndex.push(t),t instanceof SC||this.userLayers.push({layer:t,before:o}))),t.onAdd(this.map)},OC.prototype._addMapboxLayers=function(e,t){var o,r;if(!(e instanceof Mp)||e.getOptions().tileUrl){if(!(e instanceof SC)){e instanceof kd&&(this.map._getMap().addSource(e._getSourceId(),e._buildSource()),this.map.sources.setSourceState(e._getSourceWrapper()));var n=this._getMapboxBefore(t);try{for(var i=IC(e._buildLayers()),a=i.next();!a.done;a=i.next()){var s=a.value;this.map._getMap().addLayer(s,n)}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}}this.map.events._enableLayerEvents(e)}},OC.prototype._removeMapboxLayers=function(e,t){var o,r;if(e instanceof SC&&!t)this.map.events._disableLayerEvents(e);else{try{for(var n=IC(e._getLayerIds()),i=n.next();!i.done;i=n.next()){var a=i.value;this.map._getMap().getLayer(a)&&this.map._getMap().removeLayer(a)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}this.map.events._disableLayerEvents(e),e instanceof kd&&this.map._getMap().getSource(e._getSourceId())&&this.map._getMap().removeSource(e._getSourceId())}},OC.prototype._getMapboxLayerExists=function(t){var o=this,r=!1;return"string"==typeof t?!!(t=this.layerIndex.find(function(e){return e.getId()===t})):(t._getLayerIds().forEach(function(e){o.map._getMap().getLayer(e)&&(r=!0)}),r)},OC.prototype._getMapboxBefore=function(t){var o,e,r,n;if("string"==typeof t){var i=this.layerIndex.find(function(e){return e.getId()===t});if(!i)return;try{for(var a=IC(i._getLayerIds()),s=a.next();!s.done;s=a.next()){var c=s.value;if(this.map._getMap().getLayer(c))return c}}catch(e){o={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}t=this.layerIndex.findIndex(function(e){return e.getId()===t})+1}for(var u=t;u<this.layerIndex.length;u++)try{r=void 0;for(var l=IC(this.layerIndex[u]._getLayerIds()),h=l.next();!h.done;h=l.next()){c=h.value;if(this.map._getMap().getLayer(c))return c}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}},OC.prototype.clear=function(){for(var e=this.layerIndex.length-1;0<=e;e--){var t=this.layerIndex[e];t&&(this._removeMapboxLayers(t,!0),this.layerIndex.splice(e,1),t.onRemove())}this.userLayers=[]},OC.prototype.getLayerById=function(t){var e=this.layerIndex.find(function(e){return e.getId()===t});if(e)return e},OC.prototype.getLayers=function(){return this.layerIndex.slice(0)},OC.prototype._getSourceIds=function(){var t,e,o=new Set;try{for(var r=IC(this.layerIndex),n=r.next();!n.done;n=r.next())n.value._getSourceIds().forEach(function(e){return o.add(e)})}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return o},OC.prototype._getUserLayers=function(){return Array.from(this.userLayers)},OC.prototype.move=function(e,t){var o=e instanceof Zh?e.getId():e,r=t instanceof Zh?t.getId():t;if(!this.layerIndex.find(function(e){return e.getId()===o}))throw new Error("The layer '".concat(o,"' has not been added to the map and cannot be moved."));t=this.layerIndex.findIndex(function(e){return e.getId()===o}),this._moveMapboxLayers(this.layerIndex[t],r),e=this.layerIndex[t],this.layerIndex.splice(t,1),t=this.layerIndex.findIndex(function(e){return e.getId()===r}),-1<t?this.layerIndex.splice(t,0,e):this.layerIndex.push(e),t=this.userLayers.find(function(e){return e.layer.getId()===o});t&&(t.before=r)},OC.prototype._moveMapboxLayers=function(e,t){var o,r,n=this._getMapboxBefore(t);try{for(var i=IC(e._getLayerIds()),a=i.next();!a.done;a=i.next()){var s=a.value;this.map._getMap().moveLayer(s,n)}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}},OC.prototype.getRenderedShapes=function(e,t,o){var r,n,i,a=this;if(e=e||[-180,-85.0511,180,85.0511],Array.isArray(e)?4===e.length||6===e.length?i=this.map.positionsToPixels([f.getSouthWest(e),f.getNorthEast(e)]):2!==e.length&&3!==e.length||(i=this.map.positionsToPixels([e])[0]):i=this.map.positionsToPixels([e.coordinates])[0],t){t=Array.isArray(t)?t:[t];var s=[],c=this;try{for(var u=IC(t),l=u.next();!l.done;l=u.next())!function(e){var t=e instanceof Zh?e.getId():e,e=c.layerIndex.findIndex(function(e){return e.getId()===t});if(!(-1<e))throw new Error("The layer '".concat(t,"' has not been added to the map ")+"and its rendered features cannot be retrieved.");s.push.apply(s,AC([],kC(c.layerIndex[e]._getLayerIds().filter(function(e){return!!a.map._getMap().getLayer(e)})),!1))}(l.value)}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}e=this.map._getMap().queryRenderedFeatures(i,{layers:s,filter:o});return this.map.sources._mapFeaturesToShapes(e)},OC.prototype.remove=function(e){var t,o;if(Array.isArray(e))try{for(var r=IC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this._removeLayer(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}else this._removeLayer(e)},OC.prototype._removeLayer=function(e){var t=e instanceof Zh?e.getId():e,o=this.layerIndex.findIndex(function(e){return e.getId()===t});if(-1==o)throw new Error("The layer '".concat(t,"' has not been added to the map and cannot be removed."));var r=this.layerIndex[o],o=(this._removeMapboxLayers(r),this.layerIndex.splice(o,1),this.userLayers.findIndex(function(e){return e.layer.getId()===t}));-1!=o&&this.userLayers.splice(o,1),e instanceof kd&&this.map.sources.unsetSourceState(e._getSourceId()),r.onRemove()},OC);function OC(e){this.layerIndex=[],this.userLayers=[],this.map=e}var RC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xC=(MC.prototype.add=function(e){var t,o;e=Array.isArray(e)?e:[e];try{for(var r=RC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this.popups.has(i)||(this.popups.add(i),i.attach(this.map))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},MC.prototype.clear=function(){var t=this;this.popups.forEach(function(e){t.popups.delete(e),e.remove()})},MC.prototype.remove=function(e){var t,o;e=Array.isArray(e)?e:[e];try{for(var r=RC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this.popups.has(i)&&(this.popups.delete(i),i.remove())}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},MC.prototype.getPopups=function(){return Array.from(this.popups)},MC.prototype._getCollectionDiv=function(){var e=this.map.getMapContainer().querySelector(".".concat(MC.Css.collection));return e||((e=document.createElement("div")).classList.add(MC.Css.collection),e.setAttribute("aria-label","Map Information"),this.map.getMapContainer().appendChild(e)),e},MC.prototype._addDraggedPopup=function(e){0===this.draggedPopups.size&&(this.map.getMapContainer().addEventListener("mousemove",this._onDrag),this.map.getMapContainer().addEventListener("touchmove",this._onDrag),this.map.getMapContainer().addEventListener("mouseup",this._onUp),this.map.getMapContainer().addEventListener("touchend",this._onUp)),this.draggedPopups.add(e)},MC.Css={collection:"popup-collection-container"},MC);function MC(e){var r=this;this._onDrag=function(e){var t,o;"mousemove"===e.type?(t=e.clientX,o=e.clientY):"touchmove"===e.type&&(t=e.touches[0].clientX,o=e.touches[0].clientY),r.draggedPopups.forEach(function(e){e._dragToPixel([t,o])})},this._onUp=function(){r.map.getMapContainer().removeEventListener("mousemove",r._onDrag),r.map.getMapContainer().removeEventListener("touchmove",r._onDrag),r.map.getMapContainer().removeEventListener("mouseup",r._onUp),r.map.getMapContainer().removeEventListener("touchend",r._onUp),r.draggedPopups.forEach(function(e){r.draggedPopups.delete(e),e._onUp()})},this.map=e,this.popups=new Set,this.draggedPopups=new Set}var NC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},LC=(DC.prototype.add=function(e,t){var o,r;if(void 0===t&&(t=!0),Array.isArray(e))try{for(var n=NC(e),i=n.next();!i.done;i=n.next()){var a=i.value;this._addSource(a,t)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}else this._addSource(e,t)},DC.prototype.getRenderedShapes=function(e,t,o){e="string"==typeof e?e:e.getId(),o=this.map._getMap().querySourceFeatures(e,{sourceLayer:o,filter:t});return this.map.sources._mapFeaturesToShapes(o,!0,this.sources.get(e))},DC.prototype.getFeatureState=function(e,t,o){e="string"==typeof e?e:e instanceof _l?e.getId():e.id,t="string"==typeof t?t:t.getId();return this.map._getMap().getFeatureState({id:e,source:t,sourceLayer:o})},DC.prototype.removeFeatureState=function(e,t,o,r){e="string"==typeof e?e:e instanceof _l?e.getId():e.id,t="string"==typeof t?t:t.getId();this.map._getMap().removeFeatureState({id:e,source:t,sourceLayer:o},r)},DC.prototype.setFeatureState=function(e,t,o,r){e="string"==typeof e?e:e instanceof _l?e.getId():e.id,t="string"==typeof t?t:t.getId();this.map._getMap().setFeatureState({id:e,source:t,sourceLayer:r},o)},DC.prototype._buildSources=function(){var t={};return this.sources.forEach(function(e){t[e.getId()]=e._buildSource()}),t},DC.prototype.clear=function(){var t=this;this.sources.forEach(function(e){t.remove(e)})},DC.prototype.getById=function(e){return this.sources.get(e)},DC.prototype.getSources=function(){return Array.from(this.sources.values())},DC.prototype.isSourceLoaded=function(e){e=e instanceof nh?e.getId():e;return this.map._getMap().isSourceLoaded(e)},DC.prototype.remove=function(e,t){var o,r;if(void 0===t&&(t=!0),Array.isArray(e))try{for(var n=NC(e),i=n.next();!i.done;i=n.next()){var a=i.value;this._removeSource(a,t)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}else this._removeSource(e,t)},DC.prototype.setSourceState=function(e,t){void 0===t&&(t=!0),this.sources.set(e.getId(),e),e._setMap(this.map,t)},DC.prototype.unsetSourceState=function(e){this.sources.has(e)&&(this.sources.get(e)._setMap(null),this.sources.delete(e))},DC.prototype._removeSource=function(e,t){e=e instanceof nh?e.getId():e;if(!this.sources.has(e))throw new Error("'".concat(e,"' is not added to the map"));if(this.map._getMap().getSource(e)&&t&&this.map._getMap().removeSource(e),this.map._getMap().getSource(e)&&t)throw new Error("One or more layers have a dependency on the source '".concat(e,"'"));this.unsetSourceState(e)},DC.prototype._addSource=function(e,t){if(this.sources.has(e.getId())){if(t)throw new Error("'".concat(e.getId(),"' is already added to the map"));this.unsetSourceState(e.getId())}if(t){if(!this.map._isReady())throw new Error("The source '".concat(e.getId(),"' 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 adding a source to it.");this.map._getMap().addSource(e.getId(),e._buildSource())}this.setSourceState(e)},DC.prototype._mapFeaturesToShapes=function(e,t,o){var r,n,i=[];try{for(var a=NC(e),s=a.next();!s.done;s=a.next()){var c=s.value;if((o||"string"==typeof c.source)&&"string"==typeof c.properties[_l._shapeIdPropName]){var u=o||this.sources.get(c.source);if(u instanceof uh){var l=u.getShapeById(c.properties[_l._shapeIdPropName]);if(l instanceof _l){i.push(l);continue}}}t||i.push(c)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},DC.prototype._syncSources=function(n){var r=this;n?(Object.keys(n).map(function(e){var t,o=n[e];switch(o.type){case"vector":case"raster":case"raster-dem":t=new Ep(e,{name:e,tiles:o.tiles,type:o.type,url:o.url,tileSize:"tileSize"in o?o.tileSize:void 0});break;case"canvas":t=new bh(e,o);break;case"geojson":var r=new uh(e,{maxZoom:o.maxzoom,cluster:o.cluster,clusterRadius:o.clusterRadius,tolerance:o.tolerance,lineMetrics:o.lineMetrics,clusterProperties:o.clusterProperties,buffer:o.buffer,clusterMinPoints:o.clusterMinPoints,generateId:o.generateId,promoteId:o.promoteId,filter:o.filter});"string"!=typeof o.data&&void 0!==o.data&&r._addNoUpdate(o.data),t=r;break;case"image":t=new Ph(e,o);break;case"video":t=new Mh(e,o);break;default:t=new Th(e,o)}return t}).forEach(function(e){var t=r.sources.get(e.getId()),o=t&&e._isDeepEqual(t);!o&&t&&r.unsetSourceState(t.getId()),r.setSourceState(e,!o)}),Array.from(this.sources.keys()).filter(function(e){return!(e in n)}).forEach(function(e){return r.unsetSourceState(e)})):console.warn("syncSources called with no style sources which is unexpected.")},DC);function DC(e){this.map=e,this.sources=new Zt}(window&&window.__extends||(qC=function(e,t){return(qC=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}qC(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(HC,UC=ye);var qC,UC,jC=HC;function HC(){var e=null!==UC&&UC.apply(this,arguments)||this;return e.duration=1e3,e.type="jump",e}(window&&window.__extends||(BC=function(e,t){return(BC=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}BC(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(KC,FC=ye);var BC,FC,zC=KC;function KC(){var e=null!==FC&&FC.apply(this,arguments)||this;return e.bottom=0,e.left=0,e.right=0,e.top=0,e}var GC,YC,hi=window&&window.__extends||(GC=function(e,t){return(GC=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}GC(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),WC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ZC=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},QC=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},VC=(hi(JC,YC=ye),JC.prototype.merge=function(){for(var t,e,o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];try{for(var n=WC(o),i=n.next();!i.done;i=n.next()){var a=i.value;a&&"number"==typeof a.padding&&(a.padding={top:a.padding,bottom:a.padding,left:a.padding,right:a.padding})}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return YC.prototype.merge.apply(this,QC([],ZC(o),!1))},JC);function JC(){var e=null!==YC&&YC.apply(this,arguments)||this;return e.bounds=[-180,-89,180,90],e.maxBounds=void 0,e.maxZoom=20,e.offset=new nu(0,0),e.padding=new zC,e}(window&&window.__extends||(XC=function(e,t){return(XC=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}XC(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(tE,$C=ye);var XC,$C,eE=tE;function tE(){var e=null!==$C&&$C.apply(this,arguments)||this;return e.zoom=1,e.center=new dl(0,0),e.centerOffset=new nu(0,0),e.bearing=0,e.pitch=0,e.minZoom=1,e.maxZoom=20,e.minPitch=0,e.maxPitch=60,e.maxBounds=void 0,e}(window&&window.__extends||(oE=function(e,t){return(oE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}oE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(nE,rE=ye);var oE,rE,i=nE;function nE(){var e=null!==rE&&rE.apply(this,arguments)||this;return e.name=void 0,e.before=void 0,e.minZoom=1,e.maxZoom=20,e.overwrite=!1,e.opacity=1,e}(window&&window.__extends||(iE=function(e,t){return(iE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}iE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(cE,aE=i);var iE,aE,sE=cE;function cE(){var e=null!==aE&&aE.apply(this,arguments)||this;return e.color="rgba(0,0,0,.5)",e.outlineColor="#000",e.radius=1,e.outlineWidth=5,e.name="default-circles",e}(window&&window.__extends||(uE=function(e,t){return(uE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}uE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(dE,lE=i);var uE,lE,hE=dE;function dE(){var e=null!==lE&&lE.apply(this,arguments)||this;return e.cap="butt",e.join="miter",e.name="default-linestrings",e.color="#000",e.width=1,e}(window&&window.__extends||(pE=function(e,t){return(pE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}pE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(mE,fE=i);var pE,fE,gE=mE;function mE(){var e=null!==fE&&fE.apply(this,arguments)||this;return e.iconSize=1,e.fontSize=14,e.fontColor="#000",e.textFont="SegoeUi-Regular",e.cluster=!0,e.clusterIcon=void 0,e.textOffset=[0,0],e.name="default-pins",e.icon="pin-darkblue",e.title="",e}(window&&window.__extends||(yE=function(e,t){return(yE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}yE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(wE,vE=i);var yE,vE,_E=wE;function wE(){var e=null!==vE&&vE.apply(this,arguments)||this;return e.color="rgba(0,0,0,.5)",e.outlineColor="#000",e.name="default-polygons",e}(window&&window.__extends||(bE=function(e,t){return(bE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}bE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(SE,CE=i);var bE,CE,EE=SE;function SE(){var e=null!==CE&&CE.apply(this,arguments)||this;return e.name="default-raster",e}(window&&window.__extends||(TE=function(e,t){return(TE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}TE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(AE,IE=ye);var TE,IE,kE=AE;function AE(){var e=null!==IE&&IE.apply(this,arguments)||this;return e.anchor="map",e.color="#FFFFFF",e.intensity=.5,e.position=[1.15,210,30],e}var PE,OE,be=window&&window.__extends||(PE=function(e,t){return(PE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}PE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),RE=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xE=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},ME=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},NE=(be(LE,OE=ye),LE.prototype.merge=function(){for(var t,e,o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];try{for(var n=RE(o),i=n.next();!i.done;i=n.next()){var a=i.value;a&&(a.hasOwnProperty("view")?a.userRegion=a.view:a.hasOwnProperty("userRegion")&&(a.view=a.userRegion),"string"==typeof a.language)&&(a.language=Re.getCode(a.language))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return OE.prototype.merge.apply(this,ME([],xE(o),!1))},LE);function LE(){var e=null!==OE&&OE.apply(this,arguments)||this;return e.antialias=void 0,e.autoResize=!0,e.language=Ge,e.light=new kE,e.preserveDrawingBuffer=!1,e.progressiveLoading=!1,e.progressiveLoadingInitialLayerGroups=["base"],e.renderWorldCopies=!0,e.showBuildingModels=!1,e.showFeedbackLink=!0,e.showLogo=!0,e.showLabels=!0,e.customAttribution=void 0,e.showTileBoundaries=!1,e.style=void 0,e.view=Ke,e.userRegion=e.view,e.customStyleTransform=void 0,e}function DE(e){return 0==e.length?void 0:e.slice(1).reduce(function(o,r){return function(e,t){e=o(e,t);return jE(jE({},e),r(e.url,t))}},e[0])}var qE,UE,Mi=window&&window.__extends||(qE=function(e,t){return(qE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}qE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),jE=window&&window.__assign||function(){return(jE=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},HE=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},BE=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},FE=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},zE=(Mi(KE,UE=ye),KE.prototype.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.styleDefinitionsVersion;try{for(var r=HE(e),n=r.next();!n.done;n=r.next()){var i=n.value;i&&(i.authOptions?"string"==typeof i.authOptions.subscriptionKey&&(i.subscriptionKey=i["subscription-key"]=i.authOptions.subscriptionKey):"string"==typeof i.subscriptionKey?(i["subscription-key"]=i.subscriptionKey,i.authOptions={authType:l.AuthenticationType.subscriptionKey,subscriptionKey:i.subscriptionKey}):"string"==typeof i["subscription-key"]&&(i.subscriptionKey=i["subscription-key"],i.authOptions={authType:l.AuthenticationType.subscriptionKey,subscriptionKey:i["subscription-key"]}),"string"==typeof i.sessionId?i["session-id"]=i.sessionId:"string"==typeof i["session-id"]&&(i.sessionId=i["session-id"]),"boolean"==typeof i.disableTelemetry?i["disable-telemetry"]=i.disableTelemetry:"boolean"==typeof i["disable-telemetry"]&&(i.disableTelemetry=i["disable-telemetry"]),"boolean"==typeof i.enableAccessibility?i["enable-accessibility"]=i.enableAccessibility:"boolean"==typeof i["enable-accessibility"]&&(i.enableAccessibility=i["enable-accessibility"]))}}catch(e){c={error:e}}finally{try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(c)throw c.error}}var a=this._transformers,s=e?e.filter(function(e){return void 0!==e}).reduce(function(e,t){return FE(FE([],BE(e),!1),BE(t._transformers||[]),!1)},[]):[],c=UE.prototype.merge.apply(this,FE([],BE(e),!1)),s=(c.authOptions.authType!==l.AuthenticationType.subscriptionKey&&(c["subscription-key"]=c.subscriptionKey=void 0),void 0!==c.styleSet&&void 0===c.mapConfiguration&&(c.mapConfiguration=c.styleSet),c.mapConfiguration&&"string"!=typeof c.mapConfiguration&&(c.mapConfiguration=jE(jE({},c.mapConfiguration),{defaultConfiguration:c.mapConfiguration.defaultConfiguration||c.mapConfiguration.defaultStyle,configurations:c.mapConfiguration.configurations||c.mapConfiguration.styles})),this._transformers=FE(FE([],BE(a||[]),!1),BE(s.filter(function(e){return!a.includes(e)})),!1),this.transformRequest&&!this._transformers.includes(this.transformRequest)&&this._transformers.push(this.transformRequest),new Date(Date.UTC(2023,0))),u=new Date(this.styleDefinitionsVersion);return(isNaN(u.getTime())||u.getTime()<s.getTime())&&(console.warn("Style definition version ".concat(this.styleDefinitionsVersion," is invalid or deprecated, style definition version is unchanged (").concat(o,")")),this.styleDefinitionsVersion=o),this.transformRequest=DE(this._transformers),c},KE.prototype.addTransformer=function(e){this._transformers||(this._transformers=[]),this._transformers.push(e),this.transformRequest=DE(this._transformers)},KE.prototype.removeTransformer=function(t){this._transformers&&(this._transformers=this._transformers.filter(function(e){return t!==e}),this.transformRequest=DE(this._transformers))},KE._cloneCustomizer=function(e){if("object"==typeof e)return Object.assign({},e)},KE);function KE(){var e=null!==UE&&UE.apply(this,arguments)||this;return e.authOptions=ct(),e.disableTelemetry="atlas.azure.us"===We,e["disable-telemetry"]=e.disableTelemetry,e.domain=We,e.staticAssetsDomain=Ze,e.styleDefinitionsPath=Qe,e.styleDefinitionsVersion=Ve,e.styleAPIVersion=Je,e.mapConfiguration=void 0,e.styleSet=void 0,e.enableAccessibility=!0,e["enable-accessibility"]=e.enableAccessibility,e.enableAccessibilityLocationFallback=!0,e.maxParallelImageRequests=gt(),e.refreshExpiredTiles=!0,e.subscriptionKey=vt(),e["subscription-key"]=e.subscriptionKey,e.sessionId=Ye,e["session-id"]=e.sessionId,e._transformers=[],e.transformRequest=void 0,e.workerCount=ft(),e.fadeDuration=300,e.localIdeographFontFamily="sans-serif",e.validateStyle=!1,e}YE.getLayerGroup=function(e){return"string"!=typeof e&&e.metadata&&e.metadata["microsoft.maps:layerGroup"]?e.metadata["microsoft.maps:layerGroup"]:(e="string"!=typeof e?e.id:e).startsWith("microsoft.")&&4<=(e=e.split(".")).length?e[3]:void 0};var GE=YE;function YE(){}ZE.resolve=function(e){return new ZE(Promise.resolve(e))},ZE.reject=function(e){return new ZE(Promise.reject(e))},ZE.prototype.then=function(e,t){var o=this;return new Promise(function(e,t){o._resolve=e,o._reject=t,o._thenResolver(e,t)}).then(e,t)},ZE.prototype.catch=function(e){var o=this;return new Promise(function(e,t){o._resolve=e,o._reject=t,o._thenResolver(e,t)}).catch(e)},ZE.prototype.finally=function(e){var o=this;return new Promise(function(e,t){o._resolve=e,o._reject=t,o._thenResolver(e,t)}).finally(e)},ZE.prototype.hijackAndResolve=function(e){this._hijackedToResolve=e,this._resolve&&this._resolve(e)},ZE.prototype.hijackAndReject=function(e){this._hijackedToReject=e,this._reject&&this._reject(e)},ZE.prototype.switchWith=function(e){this.origin=e,this._toResolve=void 0,this._toReject=void 0};var WE=ZE;function ZE(e){var n=this;this.isHijacked=function(){return void 0!==n._hijackedToResolve||void 0!==n._hijackedToReject},this.isResolved=function(){return void 0!==n._hijackedToResolve||void 0!==n._toResolve},this.isRejected=function(){return void 0!==n._hijackedToReject||void 0!==n._toReject},this.resultIfResolved=function(){return n._hijackedToResolve||n._toResolve},this.errorIfRejected=function(){return n._hijackedToReject||n._toReject},this._thenResolver=function(t,o){var r;n._hijackedToResolve?t(n._hijackedToResolve):n._hijackedToReject?o(n._hijackedToReject):(r=n.origin,n.origin.then(function(e){n.isHijacked()||(r!==n.origin?n._thenResolver(t,o):(n._toResolve=e,t(e)))}).catch(function(e){n.isHijacked()||(r!==n.origin?n._thenResolver(t,o):(n._toReject=e,o(e)))}))},this.origin=e,this[Symbol.toStringTag]=this.origin[Symbol.toStringTag]}var QE={road:"Road",satellite:"Satellite",satellite_road_labels:"Hybrid",grayscale_dark:"Grayscale (Dark)",grayscale_light:"Grayscale (Light)",night:"Night",road_shaded_relief:"Terra",blank:"Blank",blank_accessible:"Blank (Accessible)",high_contrast_dark:"High contrast (Dark)",high_contrast_light:"High contrast (Light)"},VE=window&&window.__assign||function(){return(VE=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},JE=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},XE=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},$E=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},eS=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},tS=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},oS=(rS.prototype.updateIndoorState=function(e,t){var o,r,n=this,i=this.map.styles.getMapConfiguration();i?(this.preservedPreindoorMapConfiguration=i,o=this.map.getStyle().style?"".concat(this.map.getStyle().style,"_indoor").concat("dark"===e?"_dark":"","_tileset_").concat(t):void 0,this.map.styles.setMapConfiguration("defaultIndoor_".concat(t),"microsoft-maps:default"===i?o:void 0)):(r=(null==(i=this.indoorState)?void 0:i.tilesetId)!==t,this.indoorState={tilesetId:t,theme:e},this.initStyleset(),this.definitions().then(function(e){var t=(n.map.getStyle().style||e.defaultConfiguration).replace("_indoor_dark","").replace("_indoor",""),o="".concat(t,"_indoor"),t=e.configurations.find(function(e){return e.name.startsWith(o)});t&&n.map.setStyle({style:t.name},!r)}))},rS.prototype.unsetIndoorState=function(){var o=this,e=this.preservedPreindoorMapConfiguration;e?this.map.styles.setMapConfiguration(e):(this.indoorState=void 0,this.initStyleset(),this.definitions().then(function(e){var t=o.map.getStyle().style;t.includes("_indoor")&&t.split("_indoor")[0]?o.map.setStyle({style:t.split("_indoor")[0]}):o.map.setStyle({style:void 0})}))},rS.prototype.initStyleset=function(){var e,o=this;return e=this.serviceOptions.mapConfiguration?"string"==typeof this.serviceOptions.mapConfiguration?(e=this.map.authentication?this.map.authentication.initialize():Promise.resolve(),new WE(e.then(function(){return o._request(o.serviceOptions.domain,"".concat(ue,"/mapconfigurations/metadata/").concat(o.serviceOptions.mapConfiguration),"StyleDefinitions").then(function(e){return VE(VE({},e),{defaultConfiguration:e.defaultConfiguration||e.defaultStyle,configurations:e.configurations||e.styles})})}))):WE.resolve(this.serviceOptions.mapConfiguration):(e=this.map.authentication?this.map.authentication.initialize():Promise.resolve(),new WE(e.then(function(){return o._request(o.serviceOptions.staticAssetsDomain,"".concat(ce,"/").concat(ue),"StyleDefinitions",{version:o.serviceOptions.styleDefinitionsVersion,mcv:Le.replace(/\./g,"")}).then(function(t){return{version:isNaN(t.version)?0:parseFloat(t.version),defaultConfiguration:t.defaultStyle,configurations:t.styles.filter(function(e){return o.indoorState?"auto"===o.indoorState.theme?e.name.endsWith("dark"===e.theme?"_indoor_dark":"_indoor"):e.name.endsWith("dark"===o.indoorState.theme?"_indoor_dark":"_indoor"):!e.name.includes("indoor")}).map(function(e){return{copyright:e.copyright.join(" "),name:e.name,displayName:function(e){e=o.indoorState&&e.includes("_indoor")?e.split("_indoor")[0]:e;return e in QE?QE[e]:e}(e.name),theme:e.theme,thumbnail:new Te({domain:o.serviceOptions.staticAssetsDomain,path:e.thumbnail,protocol:"https"}).toString(),url:new Te({domain:o.serviceOptions.staticAssetsDomain,path:"".concat(ce,"/").concat(ue,"/").concat(e.name),queryParams:{styleVersion:void 0!==t.version&&null!==t.version?t.version:o.serviceOptions.styleDefinitionsVersion,mcv:Le.replace(/\./g,"")},protocol:"https"}).toString()}})}})}))),this.initPromise&&this.initPromise.switchWith(e),this.initPromise=e,this.initPromise.then(function(e){return o.map._invokeEvent("mapconfigurationchanged",e)}),this.initPromise},rS.prototype.getStyle=function(e){e=this._lookUp(e);if(!e)throw Error("Style definition is not available.");if(e.url)return e.url;if(e.style)return e.style;throw Error("Style definition neither contains URL nor style object.")},rS.prototype.deriveNewStyleAndLayerGroups=function(e,t){for(var o,r,n=this.map.getStyle(),i=this.map.getTraffic(),a={},s=0;s<t.layers.length;s++){var c=t.layers[s],u=GE.getLayerGroup(c);u?(a[u]||(a[u]=[]),a[u].push(c),n.showBuildingModels||"fill-extrusion"!==c.type?"fill-extrusion"===c.type&&(c.layout=null!=(o=c.layout)?o:{},c.layout.visibility="visible"):(c.layout=null!=(o=c.layout)?o:{},c.layout.visibility="none"),"none"!==i.flow&&u&&u==="traffic_".concat(i.flow)&&"line"==c.type&&(c.layout=null!=(r=c.layout)?r:{},c.layout.visibility="visible"),"labels"!==u&&"labels_places"!==u&&"labels_indoor"!==u||"symbol"!==c.type||(n.showLabels&&"none"!==(null==(r=c.layout)?void 0:r.visibility)?(c.layout=null!=(u=c.layout)?u:{},c.layout.visibility="visible"):(c.layout=null!=(u=c.layout)?u:{},c.layout.visibility="none"))):a[c.id]=[c]}return[t,a]},rS.prototype.injectUserLayersIntoStyle=function(a,s,c){return a?this.map.layers._getUserLayers().reduce(function(o,t){var r,e,n,i;return t.layer instanceof Bp||(r=(null==(e=null==(e=null==c?void 0:c[t.before])?void 0:e[0])?void 0:e.id)||t.before,e=a.layers.find(function(e){return e.id===t.layer.getId()}),-1<(n=s.layers.findIndex(function(e){return e.id===t.layer.getId()}))&&s.layers.splice(n,1),e&&(n=new Set(Array.from(t.layer._getSourceIds()).map(function(e){return a.sources[e]?{source:a.sources[e],id:e}:void 0}).filter(function(e){return void 0!==e})),-1<(i=r?o.layers.findIndex(function(e){return e.id===r}):-1)?o.layers.splice(i,0,e):o.layers.push(e),n.forEach(function(e){var t=e.source,e=e.id;o.sources[e]=t}))),o},VE({},s)):s},rS.prototype.setStyle=function(n,e){var i=this,t=(void 0===e&&(e=!0),this._lookUp(n));if(!t)throw Error("Style definition ".concat(n.style," is not available."));if(!t.url&&!t.style)throw Error("Style definition neither contains URL nor style object.");var o=function(){return i._onStyleData(t)},a=function(){i.map.events.remove("styledata",o),i.map.events.addOnce("styledata",o)},r=n&&n.customStyleTransform?function(e,t){e=n.customStyleTransform(e,t);return a(),e}:function(e,t){var o=VE(VE({},t),{layers:eS([],$E(t.layers),!1),sources:VE({},t.sources)}),r=n.progressiveLoading&&!i.map._isLoaded(),t=(r&&Array.isArray(null==t?void 0:t.layers)&&((o=VE({},t)).layers=o.layers.map(function(e){var t=VE({},e);return e.layout&&(t.layout=VE({},e.layout)),t})),$E(i.deriveNewStyleAndLayerGroups(e,o),2)),o=t[0],t=t[1],r=(r&&(r=n.progressiveLoadingInitialLayerGroups,Array.isArray(r))&&0<r.length&&i._deferLayerGroupVisibilities(t,r),i.injectUserLayersIntoStyle(e,o,t)),e=Object.entries(t).map(function(e){var e=$E(e,2),t=e[0],e=e[1];return i._buildFundamentalLayerFrom(e,t)}),o=i.map.layers._getUserLayers().reduce(function(e,t){var o=t.before?e.findIndex(function(e){return e.getId()===t.before}):-1;return-1<o?e.splice(o,0,t.layer):e.push(t.layer),e},e);return i.map.layers.layerIndex=o,i.map.sources._syncSources(r.sources),a(),r};this.map._getMap().setStyle(t.url||t.style,{diff:e,validate:this.serviceOptions.validateStyle,transformStyle:r})},rS.prototype.getTheme=function(e){e=this._lookUp(e);if(e)return e.theme.toLowerCase()},rS.prototype.getThemeAsync=function(t){return JE(this,void 0,void 0,function(){return XE(this,function(e){switch(e.label){case 0:return[4,this._lookUpAsync(t)];case 1:return[2,e.sent().theme]}})})},rS.prototype.setMapConfiguration=function(e,o){var r=this;"string"==typeof(this.serviceOptions.mapConfiguration=e)?this.initStyleset():this.initPromise?this.initPromise.hijackAndResolve(e):this.initPromise=WE.resolve(e),this.definitions().then(function(e){var t=e.defaultConfiguration;e.configurations.find(function(e){return e.name===o})&&(t=o),r.map.setStyle({style:t})})},rS.prototype.getMapConfiguration=function(){return this.serviceOptions.mapConfiguration},rS.prototype.setStyleSet=function(e){this.updateIndoorState("indoor_dark"===e?"dark":"light",null)},rS.prototype.getStyleSet=function(){return void 0!==this.indoorState?"dark"===this.indoorState.theme?"indoor_dark":"indoor":"base"},rS.prototype.clearStyleSet=function(){this.unsetIndoorState()},rS.prototype._buildFundamentalLayerFrom=function(e,t){if(e&&0<e.length)return(e=new SC(e,t)).onAdd(this.map),e;throw new Error("Unable to construct fundamental map layer for ID: ".concat(t,"."))},rS.prototype._transformStyleRequest=function(e,t){e.includes(te)&&(t.url=t.url.replace(te,this.serviceOptions.domain)),e.includes(ae)&&(t.url=t.url.replace(ae,ce)),e.includes(se)&&(t.url=t.url.replace(se,ue)),(t.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase())||t.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase()))&&((e=new URL(t.url)).searchParams.get(J)||(e.searchParams.set(J,this.serviceOptions.styleAPIVersion),t.url=e.href),null!=(e=this.map.authentication)&&e.signRequest(t),this._deleteAuthTokenForStaticAssets(t))},rS.prototype._request=function(r,n,i,a){var s;return void 0===a&&(a={}),JE(this,void 0,void 0,function(){var t,o;return XE(this,function(e){switch(e.label){case 0:return o={url:new Te({protocol:"https",domain:r,path:n,queryParams:VE(((o={})[J]=this.serviceOptions.styleAPIVersion,o),a)}).toString()},"function"==typeof this.serviceOptions.transformRequest&&i&&(o=this.serviceOptions.transformRequest(o.url,i)),null!=(s=this.map.authentication)&&s.signRequest(o),this._deleteAuthTokenForStaticAssets(o),t={method:"GET",mode:"cors"},o.credentials&&(t.credentials=o.credentials),o.headers&&(t.headers=o.headers),[4,fetch(o.url,t).then(function(e){if(e.ok)return e.json();throw new Error("HTTP ".concat(e.status,": ").concat(e.statusText," "))})];case 1:return[2,e.sent()]}})})},rS.prototype._deleteAuthTokenForStaticAssets=function(e){e.url.startsWith("https://".concat(this.serviceOptions.staticAssetsDomain,"/").concat(ce))&&(delete e.headers[he],delete e.headers[X])},rS);function rS(e,t){var l=this;this.definitions=function(){var e=l.initPromise||l.initStyleset();return e},this.indoorState=void 0,this.preservedPreindoorMapConfiguration=void 0,this._progressiveLoadingState={mapStyle:void 0,pendingVisibilityChange:void 0},this._deferLayerGroupVisibilities=function(t,e){var o,n,r,i,a=e.filter(function(e){return e in t});0!==a.length&&(o=l.map._getMap(),n=o.getZoom(),r=l.map.getStyle().style,l._progressiveLoadingState.pendingVisibilityChange&&(l.map.events.remove("load",l._progressiveLoadingState.pendingVisibilityChange),l._progressiveLoadingState.pendingVisibilityChange=null),l._progressiveLoadingState.mapStyle=r,(i=Object.entries(t).reduce(function(e,t){var t=$E(t,2),o=t[0],t=t[1],r=a.includes(o);return eS(eS([],$E(e),!1),$E(t.filter(function(e){if("custom"===e.type)return!1;if(r)if("number"==typeof e.maxzoom&&"number"==typeof e.minzoom){if(n<=e.maxzoom&&n>=e.minzoom)return!1}else if("number"==typeof e.minzoom){if(n>=e.minzoom)return!1}else{if("number"!=typeof e.maxzoom)return!1;if(n<=e.maxzoom)return!1}return"none"!==(null==(e=e.layout)?void 0:e.visibility)})),!1)},[])).forEach(function(e){e.layout=e.layout||{},e.layout.visibility="none"}),l._progressiveLoadingState.pendingVisibilityChange=function(){l._progressiveLoadingState.pendingVisibilityChange=null;var e=l.map.getStyle().style;r===e&&(i.forEach(function(e){e.layout.visibility="visible",o.setLayoutProperty(e.id,"visibility","visible")}),null!=(e=l.map.copyrightDelegate))&&e.reloadAttribution()},l.map.events.addOnce("load",l._progressiveLoadingState.pendingVisibilityChange))},this._onStyleData=function(e){l.map.events.invoke("stylechanged",{style:e.name,map:l.map,type:"stylechanged"})},this._lookUp=function(e){var t,o,r=l.definitions(),n=r.errorIfRejected(),i=r.resultIfResolved();if(n||!i)return null;var r=i.configurations,a=void 0;try{for(var s=tS(r),c=s.next();!c.done;c=s.next()){var u=c.value;if(u.name===e.style)return u;u.name===i.defaultConfiguration&&(a=a||u)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(t)throw t.error}}return a=a||r[0]},this._lookUpAsync=function(o){return JE(l,void 0,void 0,function(){var t;return XE(this,function(e){switch(e.label){case 0:return[4,this.definitions()];case 1:return t=e.sent(),[2,t.configurations.find(function(e){return e.name===(o.style||t.defaultConfiguration)})||t.configurations.find(function(e){return e.name===t.defaultConfiguration})||t.configurations[0]]}})})},this.map=e,this.serviceOptions=t}var nS=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},iS=(aS.prototype.add=function(e){var t,o;e=Array.isArray(e)?e:[e];try{for(var r=nS(e),n=r.next();!n.done;n=r.next()){var i=n.value;this.indicators.has(i)||(this.indicators.add(i),i.attach(this.map))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},aS.prototype.clear=function(){var t=this;this.indicators.forEach(function(e){t.indicators.delete(e),e.remove()})},aS.prototype.remove=function(e){var t,o;e=Array.isArray(e)?e:[e];try{for(var r=nS(e),n=r.next();!n.done;n=r.next()){var i=n.value;this.indicators.has(i)&&(this.indicators.delete(i),i.remove())}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},aS.prototype.getIndicators=function(){return Array.from(this.indicators)},aS.prototype._getCollectionDiv=function(){var e=this.map.getMapContainer().querySelector(".".concat(aS.Css.collection));return e||((e=document.createElement("div")).setAttribute("aria-label","map data"),e.setAttribute("role","listbox"),e.classList.add(aS.Css.collection),this.map.getMapContainer().appendChild(e)),e},aS.Css={collection:"accessible-indicator-collection-container"},aS);function aS(e){this.map=e,this.indicators=new Set}var sS,cS,cn=window&&window.__extends||(sS=function(e,t){return(sS=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}sS(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),uS=window&&window.__assign||function(){return(uS=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},lS=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},hS=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},dS=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},pS=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},fS=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},gS=(cn(L,cS=Qt),Object.defineProperty(L.prototype,"isDisposed",{get:function(){return this.removed},enumerable:!1,configurable:!0}),L.prototype.getCanvas=function(){return this.map.getCanvas()},L.prototype.getCanvasContainer=function(){return this.map.getCanvasContainer()},L.prototype.getMapContainer=function(){return this.map.getContainer()},L.prototype.getServiceOptions=function(){return Ql(this.serviceOptions,zE._cloneCustomizer)},L.prototype.setServiceOptions=function(e){this.serviceOptions=(new zE).merge(this.serviceOptions,e),this.serviceOptions["enable-accessibility"]?this.accessibleMapDelegate.addToMap():this.accessibleMapDelegate.removeFromMap();e=this.styles.serviceOptions.mapConfiguration!==this.serviceOptions.mapConfiguration||this.styles.serviceOptions.staticAssetsDomain!==this.serviceOptions.staticAssetsDomain||this.styles.serviceOptions.styleDefinitionsVersion!==this.serviceOptions.styleDefinitionsVersion||this.styles.serviceOptions.domain!==this.serviceOptions.domain||this.styles.serviceOptions.styleAPIVersion!==this.serviceOptions.styleAPIVersion;this.styles.serviceOptions=this.serviceOptions,e&&(this.styles.initPromise=null,this.setStyle({}))},L.prototype.addRequestTransformer=function(e){this.serviceOptions.addTransformer(e)},L.prototype.removeRequestTransformer=function(e){this.serviceOptions.removeTransformer(e)},L.prototype.setCamera=function(e,t){if(void 0===t&&(t=!1),"padding"in e||"offset"in e||"bounds"in e){var o,r=(new VC).merge({maxZoom:this.getCamera().maxZoom},e),n=this._generateSafeBounds(r.bounds),i={padding:r.padding,offset:r.offset,maxZoom:r.maxZoom};if(!(o=this.map.cameraForBounds(n,i)))throw a={message:"The map cannot be fit to the current canvas with the given CameraBoundsOptions.",containerWidth:null==(a=null==(a=this.map)?void 0:a.getContainer())?void 0:a.clientWidth,containerHeight:null==a?void 0:a.clientHeight,safeBounds:n,cameraForBoundsOptions:i},new Error(JSON.stringify(a));"pitch"in e&&(o.pitch=e.pitch),"bearing"in e&&(o.bearing=e.bearing),"minPitch"in e&&this.map.setMinPitch(e.minPitch),"maxPitch"in e&&this.map.setMaxPitch(e.maxPitch),this.map.setMaxZoom(r.maxZoom),this._invokeEvent("maxzoomchanged",this.map.getMaxZoom()),n=this._generateSafeBounds(r.maxBounds)}else{i=(new eE).merge(this.getCamera(),e);i.centerOffset&&2<=i.centerOffset.length&&(a=i.centerOffset,(r=Ju([i.center],i.zoom))[0][0]+=a[0],r[0][1]+=a[1],i.center=Vu(r,i.zoom)[0]),o={center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,around:void 0},i.minZoom<1&&console.warn("Setting minZoom below 1 may result in an empty map when the zoom level is less than 1."),this.map.setMinZoom(i.minZoom),this.map.setMaxZoom(i.maxZoom),i.minPitch&&this.map.setMinPitch(i.minPitch),i.maxPitch&&this.map.setMaxPitch(i.maxPitch),this._invokeEvent("minzoomchanged",this.map.getMinZoom()),this._invokeEvent("maxzoomchanged",this.map.getMaxZoom()),n=this._generateSafeBounds(i.maxBounds)}n?this.map.setMaxBounds(n):this.map.setMaxBounds(null);var a=(new jC).merge(e),r={duration:a.duration,easing:function(e){return e},offset:[0,0],animate:!0},i={fromControl:t};"jump"===a.type?this.map.jumpTo(o,i):"ease"===a.type?this.map.easeTo(uS(uS({},o),r),i):"fly"===a.type&&this.map.flyTo(uS(uS({},o),r),i)},L.prototype.setCameraBounds=function(e){this.setCamera(e)},L.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 f(e,t),minZoom:this.map.getMinZoom(),maxZoom:this.map.getMaxZoom()}},L.prototype.setStyle=function(e,t){void 0===t&&(t=!0),delete e.preserveDrawingBuffer;e=(new NE).merge(this.styleOptions,e),e.autoResize!==this.styleOptions.autoResize&&this._setAutoResize(e.autoResize),e.language!==this.styleOptions.language&&(this.localizedStringsPromise=Re.getStrings(e.language)),e.renderWorldCopies!==this.styleOptions.renderWorldCopies&&this.map.setRenderWorldCopies(e.renderWorldCopies),e.showFeedbackLink!==this.styleOptions.showFeedbackLink&&this.copyrightControl.setOptions({showFeedbackLink:e.showFeedbackLink}),e.customAttribution!==this.styleOptions.customAttribution&&this.copyrightControl.setOptions({customAttribution:e.customAttribution}),e.showLogo!==this.styleOptions.showLogo&&this.copyrightControl.setOptions({showLogo:e.showLogo}),e.showTileBoundaries!==this.styleOptions.showTileBoundaries&&(this.map.showTileBoundaries=e.showTileBoundaries),e.showBuildingModels&&console.warn("showBuildingModels is deprecated."),t=t&&this.styleOptions.language===e.language&&this.styleOptions.view===e.view;this.styleOptions=e,this._setStyleComponents(e,t)},L.prototype.getStyle=function(){return Qa(this.styleOptions)},L.prototype.addIcon=function(e,t){this.imageSprite.add(e,t)},L.prototype.addPins=function(e,t){var t=(new gE).merge(t),o=this.layers.getLayerById(t.name),r=!1;if(o||(r=!0,o=new vp("".concat(t.name,"-source"),t.name,{source:"".concat(t.name,"-source"),minZoom:t.minZoom,maxZoom:t.maxZoom,iconOptions:{anchor:"center",size:t.iconSize,image:["case",["has","icon"],["get","icon"],t.icon],ignorePlacement:!t.cluster,opacity:t.opacity},textOptions:{anchor:"center",textField:["case",["has","point_count"],["to-string",["get","point_count"]],["has","title"],["to-string",["get","title"]],t.title],font:["case",["has","point_count"],["literal",["StandardFontCondensed-Bold"]],["literal",[t.textFont]]],size:["case",["has","point_count"],20,t.fontSize],ignorePlacement:!t.cluster,opacity:t.opacity,offset:["case",["has","point_count"],["literal",[.5,-.45]],["literal",[t.textOffset[0]/16,t.textOffset[1]/16]]],color:t.fontColor}})),!(o instanceof vp))throw new Error("A layer with name '".concat(t.name,"' already exists but it is not a SymbolLayer.")+"A SymbolLayer should be used for rendering pins.");var n=o.getSource(),i=("string"==typeof n?(a=n,n=this.sources.getById(a)):a=n.getId(),!1);if(n||(i=!0,n=new uh(a,{cluster:t.cluster})),!(n instanceof uh))throw new Error("The source with name '".concat(a,"' already exists but it is not a DataSource.")+"New data can only be added to a DataSource.");i&&this.sources.add(n),r&&this.layers.add(o,t.before);var a=new Sl(e);t.overwrite?n.setShapes(a):n.add(a)},L.prototype.addCircles=function(e,t){var t=(new sE).merge(t),o=this.layers.getLayerById(t.name),r=!1;if(o||(r=!0,o=new ud("".concat(t.name,"-source"),t.name,{source:"".concat(t.name,"-source"),minZoom:t.minZoom,maxZoom:t.maxZoom,opacity:t.opacity,radius:["case",["has","radius"],["get","radius"],t.radius],color:["case",["has","color"],["get","color"],t.color],strokeColor:["case",["has","outlineColor"],["get","outlineColor"],t.outlineColor],strokeWidth:["case",["has","outlineWidth"],["get","outlineWidth"],t.outlineWidth]})),!(o instanceof ud))throw new Error("A layer with name '".concat(t.name,"' already exists but it is not a BubbleLayer.")+"A BubbleLayer should be used for rendering circles.");var n=o.getSource(),i=("string"==typeof n?(a=n,n=this.sources.getById(a)):a=n.getId(),!1);if(n||(i=!0,n=new uh(a)),!(n instanceof uh))throw new Error("The source with name '".concat(a,"' already exists but it is not a DataSource.")+"New data can only be added to a DataSource.");i&&this.sources.add(n),r&&this.layers.add(o,t.before);var a=new Sl(e);t.overwrite?n.setShapes(a):n.add(a)},L.prototype.addLinestrings=function(e,t){var t=(new hE).merge(t),o=this.layers.getLayerById(t.name),r=!1;if(o||(r=!0,o=new jd("".concat(t.name,"-source"),t.name,{source:"".concat(t.name,"-source"),minZoom:t.minZoom,maxZoom:t.maxZoom,lineCap:t.cap,lineJoin:t.join,strokeOpacity:t.opacity,strokeColor:["case",["has","color"],["get","color"],t.color],strokeWidth:["case",["has","width"],["get","width"],t.width]})),!(o instanceof jd))throw new Error("A layer with name '".concat(t.name,"' already exists but it is not a LineLayer.")+"A LineLayer should be used for rendering linestrings.");var n=o.getSource(),i=("string"==typeof n?(a=n,n=this.sources.getById(a)):a=n.getId(),!1);if(n||(i=!0,n=new uh(a)),!(n instanceof uh))throw new Error("The source with name '".concat(a,"' already exists but it is not a DataSource.")+"New data can only be added to a DataSource.");i&&this.sources.add(n),r&&this.layers.add(o,t.before);var a=new Sl(e);t.overwrite?n.setShapes(a):n.add(a)},L.prototype.addPolygons=function(e,t){var t=(new _E).merge(t),o=this.layers.getLayerById(t.name),r=!1;if(o||(r=!0,o=new tp("".concat(t.name,"-source"),t.name,{source:"".concat(t.name,"-source"),minZoom:t.minZoom,maxZoom:t.maxZoom,fillOpacity:t.opacity,fillColor:["case",["has","color"],["get","color"],t.color]})),!(o instanceof tp))throw new Error("A layer with name '".concat(t.name,"' already exists but it is not a PolygonLayer.")+"A PolygonLayer should be used for rendering linestrings.");var n=o.getSource(),i=("string"==typeof n?(a=n,n=this.sources.getById(a)):a=n.getId(),!1);if(n||(i=!0,n=new uh(a)),!(n instanceof uh))throw new Error("The source with name '".concat(a,"' already exists but it is not a DataSource.")+"New data can only be added to a DataSource.");i&&this.sources.add(n),r&&this.layers.add(o,t.before);var a=new Sl(e);t.overwrite?n.setShapes(a):n.add(a)},L.prototype.addRaster=function(e,t){var o,t=(new EE).merge(t),r=this.layers.getLayerById(t.name);if(!((r=r||new Mp({maxZoom:t.maxZoom,minZoom:t.minZoom,opacity:t.opacity,tileSize:256,tileUrl:"{subdomain}"},t.name))instanceof Mp))throw new Error("A layer with name '".concat(t.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 '".concat(t.name,"' already exists but was configured ")+"for a single tile url [default for new TileLayer(...)].");(o=!t.overwrite&&r.getOptions().subdomains||[]).push.apply(o,pS([],dS(e),!1)),r._setOptionsNoUpdate({subdomains:o}),this.layers.add(r,t.before)},L.prototype.getLayers=function(){return this.layers.getLayers().map(function(e){return e.getId()})},L.prototype.removeLayers=function(e){var t,o;try{for(var r=fS(e),n=r.next();!n.done;n=r.next()){var i,a=n.value;this.layers.getLayerById(a)&&(this.layers.remove(a),i="".concat(a,"-source"),this.sources.getById(i))&&this.sources.remove(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},L.prototype.addHtml=function(e,t){e.id||(e.id="marker_".concat(W()));var o=new lf({htmlContent:e});return this.markers.add(o,t),e.id},L.prototype.removeHtml=function(e){this.markers.remove(e)},L.prototype.addEventListener=function(e,t,o){this.events._addLegacy(e,t,o)},L.prototype.removeEventListener=function(e,t,o){this.events._removeLegacy(e,t,o)},L.prototype.setUserInteraction=function(e){this.userInteractionDelegate.setOptions(e)},L.prototype.getUserInteraction=function(){return this.userInteractionDelegate.getOptions()},L.prototype.addControl=function(e,t){this.controls.add(e,t)},L.prototype.removeControl=function(e){this.controls.remove(e)},L.prototype.setTraffic=function(e){var t=this.trafficOptions.incidents,o=this.trafficOptions.flow;if(this.trafficOptions=(new uc).merge(this.trafficOptions,e),this.controls.getControls().filter(function(e){return e instanceof yc}).forEach(function(e){return e.updateButtonState()}),this.incidentDelegate&&(this.trafficOptions.incidents?t||this.incidentDelegate.addToMap():this.incidentDelegate.removeFromMap()),this.trafficOptions.flow&&"none"!==this.trafficOptions.flow){["absolute","relative-delay"].includes(this.trafficOptions.flow)&&console.warn("The 'absolute' and 'relative-delay' flow options are deprecated. Please use 'relative' instead.");try{this.trafficOptions.flow!==o&&this.flowDelegate.addToMap()}catch(e){throw this.trafficOptions.flow=o,e}}else this.flowDelegate.removeFromMap()},L.prototype.getTraffic=function(){return Qa(this.trafficOptions)},L.prototype.remove=function(){this.dispose()},L.prototype.clear=function(){this.popups.clear(),this.layers.clear(),this.sources.clear(),this.markers.clear(),this.indicators.clear()},L.prototype.dispose=function(){var e;for(this.clear(),this.map.remove(),null!=(e=this.authentication)&&e.dispose(),this.removed=!0,window.removeEventListener("resize",this._windowResizeCallback);this.getMapContainer().firstChild;){var t=this.getMapContainer().firstChild;this.getMapContainer().removeChild(t)}},L.prototype.resize=function(e,t,o){"number"!=typeof e&&"string"!=typeof e||"number"!=typeof t&&"string"!=typeof t?o=e:(e=e,this.getMapContainer().style.height="number"==typeof e?"".concat(e,"px"):e,this.getMapContainer().style.width="number"==typeof t?"".concat(t,"px"):t);e=this.getMapContainer().style.overflow;this.getMapContainer().style.overflow="hidden",this.map.resize(o),this.getMapContainer().style.overflow=e},L.prototype.pixelsToPositions=function(e){var t,o,r=[];try{for(var n=fS(e),i=n.next();!i.done;i=n.next()){var a=i.value,s=this.map.unproject(a);r.push(new dl(s.lng,s.lat))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return r},L.prototype.positionsToPixels=function(e){var t,o,r=[];try{for(var n=fS(e),i=n.next();!i.done;i=n.next()){var a=i.value,s=this.map.project(a);r.push(new nu(s.x,s.y))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return r},L.prototype.areTilesLoaded=function(){return this.map.areTilesLoaded()},L.prototype.stop=function(){this.map.stop()},L.prototype.triggerRepaint=function(){this.map.triggerRepaint()},L.prototype.enableElevation=function(e,t){this.map.setTerrain("string"==typeof e?{source:e,exaggeration:t}:{source:e.getId(),exaggeration:t})},L.prototype.disableElevation=function(){this.map.setTerrain(null)},L.prototype._getMap=function(){return this.map},L.prototype._rebuildStyle=function(t){return void 0===t&&(t=!0),lS(this,void 0,void 0,function(){return hS(this,function(e){return this.styles.setStyle(this.styleOptions,t),this.imageSprite._restoreImages(),[2]})})},L.prototype._isLoaded=function(){return this.loaded},L.prototype._isReady=function(){return this.ready},L.prototype._getLocalizedStrings=function(){return this.localizedStringsPromise},L.prototype._sendRequest=function(e,t,o){var r;return(r="function"==typeof this.serviceOptions.transformRequest?this.serviceOptions.transformRequest(e,t):r)?fetch(r.url||e,{credentials:r.credentials,headers:uS(uS({},o),r.headers),method:"GET",mode:"cors"}):fetch(e,{headers:o,method:"GET",mode:"cors"})},L.prototype._substituteDomainLanguageViewAndSignInRequest=function(e,t){var o;(e.includes(oe)||e.includes(te))&&(o=new RegExp("[^{]".concat(oe,"[^}]")),e.match(o)&&(t.url=t.url.replace(oe,te)),Te.protoRegEx.test(this.serviceOptions.domain)?(o=t.url.indexOf(te),t.url=this.serviceOptions.domain+t.url.substring(o+te.length)):t.url=t.url.replace(te,this.serviceOptions.domain)),(t.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase())||t.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase()))&&null!=(o=this.authentication)&&o.signRequest(t),e.includes(ie)&&(t.url=t.url.replace(ie,this.styleOptions.language)),e.includes(re)&&(t.url=this.styleOptions.view?t.url.replace(re,this.styleOptions.view):t.url.replace(re,"").replace("&".concat(ne,"="),""))},L.prototype._setAutoResize=function(e){e?window.addEventListener("resize",this._windowResizeCallback):window.removeEventListener("resize",this._windowResizeCallback)},L.prototype._setStyleComponents=function(s,c){var u=this;void 0===c&&(c=!0),this.removed||this.styles.definitions().then(function(e){var t,o,r=!0;if(u.styleOptions.style)try{for(var n=fS(e.configurations),i=n.next();!i.done;i=n.next()){var a=i.value;if(u.styleOptions.style===a.name){r=!1;break}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}r&&(u.styleOptions.style=e.defaultConfiguration),u.styleOptions=s,u._rebuildStyle(c)})},L.prototype._updateGlobalDefaults=function(e){e&&(e.authOptions&&!st&&wt(e.authOptions),e.domain&&!et&&bt(e.domain),e.styleDefinitionsPath&&!tt&&Ct(e.styleDefinitionsPath),e.workerCount&&!rt&&Et(e.workerCount),e.maxParallelImageRequests&&!nt&&St(e.maxParallelImageRequests),!e.subscriptionKey&&!e["subscription-key"]||st||kt(e.subscriptionKey||e["subscription-key"]),!e.sessionId&&!e["session-id"]||at||It(e.sessionId||e["session-id"]),e.language&&!it&&Tt(e.language),!e.userRegion&&!e.view||$e||At(e.userRegion||e.view))},L.prototype._generateSafeBounds=function(e){if(e){var t=f.getSouth(e),o=f.getWest(e),r=f.getNorth(e),n=f.getEast(e);if(!(isFinite(t)&&isFinite(o)&&isFinite(r)&&isFinite(n)))throw new Error("The bounds specified are invalid: [".concat(e,"]"));for(;n<o;)n+=360;return new f([o,t,n,r])}return e},L.prototype._detectHighContrast=function(){var e,t;switch(df.getHighContrastMode()){case"invert":case"light":e=L.Css.hcLight,t="high_contrast_light";break;case"dark":e=L.Css.hcDark,t="high_contrast_dark"}e&&this.map.getContainer().classList.add(e),t&&"road"===this.styleOptions.style&&(this.styleOptions.style=t)},L.Css={canvasContainer:"atlas-map-canvas-container",canvas:"atlas-map-canvas",container:"atlas-map",hcDark:"high-contrast-dark",hcLight:"high-contrast-light"},L);function L(e,t){var o,r,n=cS.call(this)||this;n.removed=!1,n.loaded=!1,n.ready=!1,n._windowResizeCallback=function(){return n.resize()},n._updateGlobalDefaults(t),n.serviceOptions=(new zE).merge(t),n.styleOptions=(new NE).merge(t),n.trafficOptions=new uc,n.styles=new oS(n,n.serviceOptions),n.serviceOptions.authOptions.subscriptionKey&&(n.serviceOptions.authOptions.subscriptionKey=encodeURIComponent(n.serviceOptions.authOptions.subscriptionKey)),o=n.serviceOptions.authOptions.clientId||(n.serviceOptions.authOptions.subscriptionKey?n.serviceOptions.authOptions.subscriptionKey.replace(/.(?=.{3,}$)/g,"*"):"invalid-setting"),n.insights&&n.insights.setAuthenticatedUserContext(n.serviceOptions.sessionId,o),arguments[2]&&"ENVIRONMENT"in window&&window.ENVIRONMENT.hmr?(r=arguments[2],n.ready=!0,n.loaded=!0):(o={antialias:n.styleOptions.antialias,attributionControl:!1,container:e,fadeDuration:n.serviceOptions.fadeDuration,localIdeographFontFamily:n.serviceOptions.localIdeographFontFamily,preserveDrawingBuffer:n.styleOptions.preserveDrawingBuffer,refreshExpiredTiles:n.serviceOptions.refreshExpiredTiles,renderWorldCopies:n.styleOptions.renderWorldCopies,trackResize:!1,transformRequest:function(e,t){var o={url:e};return"Tile"===t||"Source"===t?(e.includes(oe)&&n.insights&&n.insights.trackEvent({name:"TileLoad"}),n._substituteDomainLanguageViewAndSignInRequest(e,o)):"Style"!==t&&"SpriteJSON"!==t&&"SpriteImage"!==t&&"Glyphs"!==t||n.styles._transformStyleRequest(e,o),n.serviceOptions.transformRequest&&Xs(o,n.serviceOptions.transformRequest(o.url,t)),o}},r=new D.Map(o));try{n.map=r,n.authentication=new nC(n),n.controls=new aC(n),n.events=new fC(n),n.imageSprite=new _C(n),n.layers=new PC(n),n.markers=new yC(n),n.sources=new LC(n),n.popups=new xC(n),n.indicators=new iS(n),n.map.getContainer().classList.add(L.Css.container),n.map.getCanvasContainer().classList.add(L.Css.canvasContainer),n.map.getCanvas().classList.add(L.Css.canvas),n._detectHighContrast(),n.copyrightControl=new wf({showFeedbackLink:n.styleOptions.showFeedbackLink,showLogo:n.styleOptions.showLogo,customAttribution:n.styleOptions.customAttribution}),n.controls.add(n.copyrightControl,{position:l.ControlPosition.NonFixed});var i=n.authentication?n.authentication.initialize():Promise.resolve();if(n.removed)return n;var a=function(){n.loaded=!0,n.map.off("load",a)},s=(n.map.on("load",a),function(){n.ready=!0,n.map.off("styledata",s),n.events.invoke("ready",{map:n,type:"ready"})});n.map.on("styledata",s),n._setAutoResize(n.styleOptions.autoResize),n.map.showTileBoundaries=n.styleOptions.showTileBoundaries,n.localizedStringsPromise=Re.getStrings(n.styleOptions.language),i.then(function(){return n.styles.definitions()}).then(function(e){if(!n.removed){if(n.authentication&&!n.authentication.getToken())throw new Error("AuthenticationManager finished initializing, but no token is available");n.serviceOptions["enable-accessibility"]&&n.accessibleMapDelegate.addToMap(),n._setStyleComponents(n.styleOptions),n.copyrightDelegate&&n.copyrightDelegate.addToMap()}}).catch(function(e){e=e instanceof Error?e:new Error(e);n.events.invoke("error",{map:n,type:"error",error:e})}),n.setCamera(uS(uS({minZoom:1},t),{type:"jump",duration:0})),n.incidentDelegate=new Yf(n),n.flowDelegate=new jf(n),n.accessibleMapDelegate=new Uf(n),n.userInteractionDelegate=new og(n,t),n.userInteractionDelegate.addToMap(),n.copyrightDelegate=new _g(n,n.copyrightControl,n.styleOptions)}catch(e){throw e}return n}var mS=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},yS=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},o=(vS.applyTemplate=function(t,o){var r,n,e,i=this,a=document.createElement("div");return a.classList.add(vS.Css.template),t&&("boolean"!=typeof(o=o||{}).singleDescription&&(o.singleDescription=!0),o.sandboxContent="boolean"!=typeof o.sandboxContent||o.sandboxContent,o.title&&"string"==typeof o.content&&(o.content.includes("{title}")||o.content.includes("{name}"))||(t.title?o.title="{title}":t.name&&(o.title="{name}")),"boolean"!=typeof o.detectHyperlinks&&(o.detectHyperlinks=!0),"boolean"!=typeof o.parsePropertyPaths&&(o.parsePropertyPaths=!0),o.textColor&&(a.style.color=o.textColor),o.fillColor&&(a.style.backgroundColor=o.fillColor),o.title&&((e=this._applyStringTemplate(t,o.title,o)).innerText=e.textContent||e.innerText||"",this._appendChild(a,e,vS.Css.title)),(r=document.createElement("div")).classList.add(vS.Css.content),Array.isArray(o.content)?0<o.content.length&&o.content[0].propertyPath?this._appendChild(r,this._generateContent(t,o.content,o),vS.Css.item):o.content.forEach(function(e){i._appendChild(r,i._generateContent(t,e,o),vS.Css.item)}):(n=0,e=void(t.description&&Object.keys(t).forEach(function(e){i._ignoreProperty(e,t[e])||n++})),1===n||o.singleDescription&&t.description||2===n&&t.Snippet?(e=document.createElement("div")).innerHTML=t.description:e=this._generateContent(t,o.content,o),this._appendChild(r,e,vS.Css.item)),""!==r.innerHTML)&&(o.sandboxContent?a.appendChild(vS._createSandboxedIframe(r,o)):a.appendChild(r)),a},vS._createSandboxedIframe=function(e,t){var o=document.createElement("iframe"),e=(o.sandbox.add("allow-popups"),e.innerHTML),r=!1,n=100,i=550,a=10,s=(document.body.scrollWidth<=340&&(i=300,n=50),e.split(/<(tr|div|br|li|h[0-9]|p>)/)),c=Math.max.apply(Math,yS([],mS(s.map(function(e){return e.replace(/<[a-zA-Z0-9\s=\/]+>/g,"").length})),!1))-1,u=Math.ceil(3.5*c),c=(u<i&&(i=u,n=c),e.includes("<img")||e.includes("<video")?(r=!0,o.width="550px"):(u=-1<e.indexOf(vS.Css.table)?25:20,a+=Math.max(.5*s.length*u,Math.ceil(e.replace(/<[a-zA-Z0-9\s=\/]+>/g,"").length/n)*u)),o.width=i+"px",o.height=r||280<a?"280px":a+"px",t.textColor?"color:".concat(t.textColor,";"):""),s=t.fillColor?"background-color:".concat(t.fillColor,";"):"",n='<html><head><title></title><meta charset="utf-8" /><meta http-equiv="x-ua-compatible" content="IE=Edge" />'+'<link rel="stylesheet" href="'.concat(vS._cssUrl,'" type="text/css"/>')+"<style>html, body{margin:0;padding:0;".concat(c).concat(s,"}</style></head>")+'<body><div class="'.concat(vS.Css.template,'" style="padding:0;width:').concat(i-20,'px">').concat(e,"</div></body></html>");return void 0===o.srcdoc?o.src="data:text/html;charset=utf-8,"+encodeURI(n):o.srcdoc=n,o},vS._appendChild=function(e,t,o){t&&(o&&(t.className=(t.className?t.className+" ":"")+o),e.appendChild(t))},vS._generateContent=function(e,t,o){return t?Array.isArray(t)?this._generatePropertyInfoTable(e,t,o):this._applyStringTemplate(e,t,o):(t=this._generateDynamicTableHtml(e,null,o))?((e=document.createElement("div")).innerHTML=t,e):null},vS._applyStringTemplate=function(e,t,o){if(t){for(var r,n,i=t,a=this._placeholderRx.exec(t);a;)2<=a.length&&(r=this._getPropertyValue(e,a[1],o),i=i.replace(a[0],r)),a=this._placeholderRx.exec(t);if(i)return(i=i.trim()).includes("<")&&(i=i.replace(/[\r\n]+/g,"<br/>")),(n=document.createElement("div")).innerHTML=i,n}return null},vS._getPropertyValue=function(e,t,o,r){var n=o.parsePropertyPaths?t.split("/"):[t],i=n.length;if(0<i&&e){var a=n[0],s=e[a];if(o.detectHyperlinks&&"link"===t&&(!r||r.hyperlinkFormat)){var c,u,l,h=[];if(Array.isArray(s)?s.forEach(function(e){e.href?h.push(e):"string"==typeof e&&h.push({href:e})}):s.href&&h.push(s),0<h.length)return r&&r.hyperlinkFormat?c=r.hyperlinkFormat:o&&o.hyperlinkFormat&&(c=o.hyperlinkFormat),u=c&&c.target?c.target:"_blank",l=[],h.forEach(function(e){e.title||c&&c.label||!e.rel||l.push(e.rel," - "),l.push('<a href="',e.href,'" target="',u,'">'),e.title?l.push(e.title):c&&c.label?l.push(c.label):l.push(e.href),l.push("</a>","<br/>")}),l.pop(),l.join("")}if(null!=s){for(var d=void 0,d=1;d<i&&(s=s[n[d]],a=n[d],null!=s);d++);if(d===i&&null!=s){e=void 0;if((e=void 0!==s.value?s.value:s)instanceof Date)return r&&r.dateFormat?e.toLocaleString(void 0,r.dateFormat):o.dateFormat?e.toLocaleString(void 0,o.dateFormat):e.toISOString();if("object"==typeof e)return(p=this._generateDynamicTableHtml(e,n.slice(1),o))||"";if("number"==typeof e){if(r){if(r.dateFormat)return new Date(e).toLocaleString(void 0,r.dateFormat);if(r.numberFormat)return e.toLocaleString(void 0,r.numberFormat)}else if(/(timestamp|date)/gi.test(a))return new Date(e).toISOString();return e.toLocaleString(void 0,o.numberFormat)}if("string"==typeof e&&""!==e&&!/[\n\r<>\s]/g.test(e)&&(o.detectHyperlinks||r&&r.hyperlinkFormat)){var p,e=e.trim(),t=this._isUrlRx.test(e)||r&&r.hyperlinkFormat,f=this._isImageUrlRx.test(e)&&(t||e.startsWith("data:image")),g=this._emailRx.test(e);if(t||f||g)return t=void 0,p=void(r&&r.hyperlinkFormat?t=r.hyperlinkFormat:o&&o.hyperlinkFormat&&(t=o.hyperlinkFormat)),p=t&&t.target?' target="'.concat(t.target,'"'):' target="_blank"',r="".concat(t&&t.label?t.label:e),t&&t.scheme?e=t.scheme+e:g&&(e="mailto:"+e),o=t&&t.label?' alt="'.concat(t.label,'"'):"",(t&&t.isImage||f)&&(r='<img src="'.concat(e,'" style="max-width:100%"').concat(o,'"/>')),'<a href="'.concat(e,'"').concat(p,">").concat(r,"</a>")}return e.toString()}}}return""},vS._generatePropertyInfoTable=function(o,e,r){var n,i;return o&&e&&0<e.length?((n=[]).push('<table class="'.concat((i=this).Css.table,'">')),e.forEach(function(e){var t=i._getPropertyValue(o,e.propertyPath,r,e);e.hideLabel?n.push('<tr><td colspan="2">',t,"</td></tr>"):(e=e.label||e.propertyPath.split("/")[0],n.push("<tr><th>",e,"</th><td>",t,"</td></tr>"))}),n.push("</table>"),(e=document.createElement("div")).innerHTML=n.join(""),e):null},vS._generateDynamicTableHtml=function(t,e,o){var r,n,i,a,s=this;return!t||((r=[]).push('<table class="'.concat((n=this).Css.table,'">')),i=e&&0<e.length?e.join("/")+"/":"",a=0,Object.keys(t).forEach(function(e){s._ignoreProperty(e,t[e])||(r.push("<tr><th>",e,"</th><td>",n._getPropertyValue(t,i+e,o),"</td></tr>"),a++)}),0===a)?null:(r.push("</table>"),r.join(""))},vS._ignoreProperty=function(e,t){switch(e){case"title":case"name":case"base":case"popupTemplate":case"anchor":case"icon":case"image":case"imageUrl":case"rotation":case"color":case"size":case"offset":case"strokeColor":case"strokeWidth":case"strokeOpacity":case"subType":case"fillColor":case"fillOpacity":case"visibility":case"visible":return!0;default:if(0===e.indexOf("_")||null==t||""===t)return!0}return!1},vS._placeholderRx=/\{([a-zA-Z0-9_\/\s]+)\}/gi,vS._isUrlRx=/^(http|https|ftp|tel|mailto):\/\//i,vS._isImageUrlRx=/(^data:image|.png$|.jpg$|.jpeg$|.gif$|.bmp$|.svg|.tif|.tiff$)/i,vS._emailRx=/^[^\.\s@:](?:[^\s@:]*[^\s@:\.])?@[^\.\s@]+(?:\.[^\.\s@]+)*$/,vS._cssUrl=new Te({domain:Q,path:"sdk/javascript/mapcontrol/".concat(De.getEndpointVersion(),"/atlas.min.css")}).toString(),vS.Css={template:"azure-maps-control-popup-template",title:"azure-maps-control-popup-template-title",content:"azure-maps-control-popup-template-content",item:"azure-maps-control-popup-template-content-item",table:"azure-maps-control-popup-template-table"},vS);function vS(){this.detectHyperlinks=!0,this.parsePropertyPaths=!0}Ut(),l.HtmlMarker=lf,l.Map=gS,l.Pixel=nu,l.Popup=tf,l.PopupTemplate=o,l.Shape=_l,l._enableRTLTextPlugin=Ut,l._getAssetDomain=function(){return Z},l._getDomain=function(){return We},l._hasMaxParallelImageRequests=Nt,l._hasSetAuthenticationOptions=Ot,l._hasSetDomain=Rt,l._hasSetLanguage=Lt,l._hasSetSessionId=Dt,l._hasSetStyleDefinitionsPath=xt,l._hasSetStyleDefinitionsVersion=function(){return ot},l._hasSetView=qt,l._hasWorkerCount=Mt,l.addImageTemplate=function(e,t,o){!o&&zt[e.toLowerCase()]||(zt[e.toLowerCase()]=t)},l.clearPrewarmedResources=function(){D.clearPrewarmedResources()},l.control=Hr,l.data=ii,l.getAllImageTemplateNames=function(){return Object.keys(zt)},l.getAuthenticationOptions=ct,l.getDomain=lt,l.getImageTemplate=Pt,l.getLanguage=mt,l.getMaxParallelImageRequests=gt,l.getSessionId=yt,l.getStaticAssetsDomain=ut,l.getStyleAPIVersion=pt,l.getStyleDefinitionsPath=ht,l.getStyleDefinitionsVersion=dt,l.getSubscriptionKey=vt,l.getUserRegion=function(){return Ke},l.getVersion=function(){return De.getFullVersion()},l.getView=_t,l.getWorkerCount=ft,l.internal=B,l.isSupported=function(e){return!Me.isIE()},l.layer=Ni,l.math=nn,l.prewarm=function(){D.prewarm()},l.setAuthenticationOptions=wt,l.setDomain=bt,l.setLanguage=Tt,l.setMaxParallelImageRequests=St,l.setSessionId=It,l.setStyleAPIVersion=function(e){Je=e},l.setStyleDefinitionsPath=Ct,l.setStyleDefinitionsVersion=function(e){Ve=e,ot=!0},l.setSubscriptionKey=kt,l.setUserRegion=At,l.setView=function(e){Ke=e,$e=!0},l.setWorkerCount=Et,l.source=Cn});
|
|
55
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("azuremaps-maplibre-gl")):"function"==typeof define&&define.amd?define(["exports","azuremaps-maplibre-gl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).atlas=e.atlas||{},e.maplibregl)}(this,function(l,D){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function q(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function U(o){var t,r;return o.__esModule?o:("function"==typeof(t=o.default)?(r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)}).prototype=t.prototype:r={},Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(o).forEach(function(e){var t=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(r,e,t.get?t:{enumerable:!0,get:function(){return o[e]}})}),r)}for(var j,H,t={exports:{}},o=U(Object.freeze({__proto__:null,default:{}})),B=t,F=0,z=[],K=0;K<256;K++)z[K]=(K+256).toString(16).substr(1);function G(){e=16,(!j||Y.BUFFER_SIZE<F+e)&&(F=0,j=Y.randomBytes(Y.BUFFER_SIZE));var e=j.slice(F,F+=e);return e[6]=15&e[6]|64,e[8]=63&e[8]|128,e}function Y(){var e=G();return z[e[0]]+z[e[1]]+z[e[2]]+z[e[3]]+"-"+z[e[4]]+z[e[5]]+"-"+z[e[6]]+z[e[7]]+"-"+z[e[8]]+z[e[9]]+"-"+z[e[10]]+z[e[11]]+z[e[12]]+z[e[13]]+z[e[14]]+z[e[15]]}Y.BUFFER_SIZE=4096,Y.bin=G,Y.clearBuffer=function(){j=null,F=0},Y.test=function(e){return"string"==typeof e&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},"undefined"!=typeof crypto?H=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(H=window.msCrypto),H=H||o,(B.exports=Y).randomBytes=function(){if(H){if(H.randomBytes)return H.randomBytes;if(H.getRandomValues)return"function"!=typeof Uint8Array.prototype.slice?function(e){e=new Uint8Array(e);return H.getRandomValues(e),Array.from(e)}:function(e){e=new Uint8Array(e);return H.getRandomValues(e),e}}return function(e){for(var t=[],o=0;o<e;o++)t.push(Math.floor(256*Math.random()));return t}}();var W=q(t.exports),Z="atlas.microsoft.com",Q="atlas.microsoft.com",o="styling",B="2023-01-01",V="https://login.microsoftonline.com/",J="api-version",X="Authorization",$="Bearer ",ee="jwt-sas ",te="{{azMapsDomain}}",oe="{azMapsDomain}",re="{{azMapsView}}",ne="view",ie="{{azMapsLanguage}}",ae="{{azMapsStylingPath}}",se="{{azMapsStylePath}}",ce="styling",ue="styles",t="2.0",le="Map-Agent",he="x-ms-client-id",de="Ms-Am-Request-Origin",pe="MapControl",fe="https://atlas.microsoft.com/.default",ge="Session-Id",me=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ye=(ve.prototype.merge=function(){for(var t,e,o,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var i=me(r),a=i.next();!a.done;a=i.next()){var s=a.value;if(s)for(var c in s)s.hasOwnProperty(c)&&this.hasOwnProperty(c)&&(void 0!==s[c]&&null!=s[c]?this[c]instanceof ve?this[c].merge(s[c]):this[c]=s[c]:(o=o||new(Object.getPrototypeOf(this).constructor),this[c]=o[c]))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return this},ve);function ve(){}var _e,we,be=window&&window.__extends||(_e=function(e,t){return(_e=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}_e(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Ce=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},Ee=(be(Se,we=ye),Se);function Se(){var e=null!==we&&we.apply(this,arguments)||this;return e.domain=void 0,e.headers={},e.path="",e.protocol="https",e.queryParams={},e.subdomain="",e}Ie.prototype.get=function(){return fetch(this.toString(),{method:"GET",mode:"cors",headers:new Headers(this.options.headers)}).then(function(e){if(e.ok)return e.json();throw new Error("HTTP ".concat(e.status,": ").concat(e.statusText))})},Ie.prototype.toString=function(){var e=this,t=Object.entries(e.options.queryParams).map(function(e){var e=Ce(e,2),t=e[0],e=e[1];return"".concat(t,"=").concat(e)}).join("&"),o=[],r=e.options.path||"";return Ie.protoRegEx.test(r)?o.push(r):(e.options.domain&&(Ie.protoRegEx.test(e.options.domain)||(o.push("".concat(e.options.protocol,"://")),o.push(e.options.subdomain?"".concat(e.options.subdomain,"."):"")),o.push(e.options.domain)),o.push(e.options.path?"/".concat(r):"")),o.push(t?"?".concat(t):""),o.join("")},Ie.protoRegEx=new RegExp(/^(((file|http|https):\/\/)|blob:)/i);var Te=Ie;function Ie(e){this.options=(new Ee).merge(e)}Ae.parse=function(e){var t=(e=e.toLowerCase()).lastIndexOf("-");return-1!==t?{code:e,language:e.substring(0,t),region:e.substring(t+1)}:{code:e,language:e}};var ke=Ae;function Ae(){}var Pe={localizationsPath:"locs/mapcontrol/2019-3-12",sensitiveUserRegions:["il","kr","pk","in","cn","ar","bh","eg","jo","sa","kw","om","qa","ma","ae"],locales:{defaultLanguage:{defaultRegion:{code:"NGT",strings:"en/resource.json"},latn:{code:"NGT-Latn",strings:"en/resource.json"}},ar:{defaultRegion:{code:"ar",strings:"ar-sa/resource.json"}},bg:{defaultRegion:{code:"bg-BG",strings:"bg-bg/resource.json"}},cs:{defaultRegion:{code:"cs-CZ",strings:"cs-cz/resource.json"}},da:{defaultRegion:{code:"da-DK",strings:"da-dk/resource.json"}},de:{defaultRegion:{code:"de-DE",strings:"de-de/resource.json"}},el:{defaultRegion:{code:"el-GR",strings:"el-gr/resource.json"}},en:{defaultRegion:{code:"en",strings:"en/resource.json"},us:{code:"en-US",strings:"en/resource.json"},au:{code:"en-AU",strings:"en/resource.json"},gb:{code:"en-GB",strings:"en/resource.json"},nz:{code:"en-NZ",strings:"en/resource.json"}},es:{defaultRegion:{code:"es-ES",strings:"es-es/resource.json"},mx:{code:"es-MX",strings:"es-mx/resource.json"}},fi:{defaultRegion:{code:"fi-FI",strings:"fi-fi/resource.json"}},fr:{defaultRegion:{code:"fr-FR",strings:"fr-fr/resource.json"}},hu:{defaultRegion:{code:"hu-HU",strings:"hu-hu/resource.json"}},id:{defaultRegion:{code:"id-ID",strings:"id-id/resource.json"}},it:{defaultRegion:{code:"it-IT",strings:"it-it/resource.json"}},ko:{defaultRegion:{code:"ko-KR",strings:"ko-kr/resource.json"}},lt:{defaultRegion:{code:"lt-LT",strings:"lt-lt/resource.json"}},ms:{defaultRegion:{code:"ms-MY",strings:"ms-my/resource.json"}},nb:{defaultRegion:{code:"nb-NO",strings:"nb-no/resource.json"}},nl:{defaultRegion:{code:"nl-NL",strings:"nl-nl/resource.json"}},pl:{defaultRegion:{code:"pl-PL",strings:"pl-pl/resource.json"}},pt:{defaultRegion:{code:"pt-PT",strings:"pt-pt/resource.json"},br:{code:"pt-BR",strings:"pt-br/resource.json"}},ru:{defaultRegion:{code:"ru-RU",strings:"ru-ru/resource.json"}},sk:{defaultRegion:{code:"sk-SK",strings:"sk-sk/resource.json"}},sl:{defaultRegion:{code:"sl-SL",strings:"sl-sl/resource.json"}},sv:{defaultRegion:{code:"sv-SE",strings:"sv-se/resource.json"}},th:{defaultRegion:{code:"th-TH",strings:"th-th/resource.json"}},tr:{defaultRegion:{code:"tr-TR",strings:"tr-tr/resource.json"}},zh:{defaultRegion:{code:"zh",strings:"en/resource.json"}},"zh-hans":{defaultRegion:{code:"zh-Hans",strings:"zh-cn/resource.json"},cn:{code:"zh-Hans-CN",strings:"zh-cn/resource.json"}},"zh-hant":{defaultRegion:{code:"zh-Hant",strings:"en/resource.json"},tw:{code:"zh-Hant-TW",strings:"zh-tw/resource.json"}}}},Oe=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"},Re=(xe.getCode=function(e){var t=ke.parse(e);return-1===Pe.sensitiveUserRegions.indexOf(t.region)?this.getLocaleData(t).code:e},xe.getStrings=function(e){e=this.getLocaleData(e);return Pe.locales.defaultLanguage.defaultRegion.code===e.code?new Promise(function(e){e(new Oe)}):new Te({domain:Q,path:"".concat(Pe.localizationsPath,"/").concat(e.strings)}).get().then(function(e){return e},function(){return new Oe})},xe.getLocaleData=function(e){if("string"==typeof e&&(e=ke.parse(e)),Pe.locales[e.code])return Pe.locales[e.code].defaultRegion;var t;if(Pe.locales[e.language])t=Pe.locales[e.language];else{if(-1!==e.language.indexOf("-"))return this.getLocaleData(e.language);t=Pe.locales.defaultLanguage}return e.region&&t[e.region]?t[e.region]:t.defaultRegion},xe);function xe(){}Ne.getEdgeOrIEVersion=function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");return 0<t?parseInt(e.substring(t+5,e.indexOf(".",t)),10):0<e.indexOf("Trident/")?(t=e.indexOf("rv:"),parseInt(e.substring(t+3,e.indexOf(".",t)),10)):0<(t=e.indexOf("Edge/"))?parseInt(e.substring(t+5,e.indexOf(".",t)),10):-1},Ne.isEdgeOrIE=function(){return-1!==this.getEdgeOrIEVersion()},Ne.isIE=function(){var e=this.getEdgeOrIEVersion();return-1!==e&&e<=11};var Me=Ne;function Ne(){}var Le="3.3.0",De=(qe.getFullVersion=function(){return Le},qe.getEndpointVersion=function(){var e=Le.indexOf(".");return-1===(e=Le.indexOf(".",e+1))?Le:Le.substring(0,e)},qe);function qe(){}var Ue,je,be=window&&window.__extends||(Ue=function(e,t){return(Ue=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Ue(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),He=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},Be=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},Fe=(l.AuthenticationType=void 0,(r=l.AuthenticationType||(l.AuthenticationType={})).subscriptionKey="subscriptionKey",r.aad="aad",r.anonymous="anonymous",r.sas="sas",be(ze,je=ye),ze.prototype.setSubscriptionKey=function(e){this.authType=l.AuthenticationType.subscriptionKey,this.subscriptionKey=e},ze.prototype.setAadProperties=function(e,t,o,r,n){this.authType=l.AuthenticationType.aad,this.authContext=n||this.authContext,this.aadInstance=r||this.aadInstance,this.clientId=e,this.aadAppId=t,this.aadTenant=o},ze.prototype.setTokenCallbackFunction=function(e){this.authType=l.AuthenticationType.anonymous,this.getToken=e},ze.prototype.setSasCallbackFunction=function(e){this.authType=l.AuthenticationType.sas,this.getToken=e},ze.prototype.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=je.prototype.merge.apply(this,Be([],He(e),!1));return o.authType===l.AuthenticationType.subscriptionKey?o.authContext=o.aadAppId=o.getToken=void 0:o.authType===l.AuthenticationType.aad?o.subscriptionKey=o.getToken=void 0:o.authType===l.AuthenticationType.anonymous?o.subscriptionKey=o.authContext=o.aadAppId=void 0:o.authType===l.AuthenticationType.sas&&(o.authContext=o.subscriptionKey=o.aadAppId=void 0),o},ze);function ze(){var e=null!==je&&je.apply(this,arguments)||this;return e.authType=void 0,e.subscriptionKey=void 0,e.clientId=void 0,e.aadAppId=void 0,e.aadTenant=void 0,e.aadInstance=void 0,e.getToken=void 0,e.sasToken=void 0,e.authContext=void 0,e}var Ke;var Ge="NGT",Ye=W(),We=Z,Ze=Q,Qe=o,Ve=B,Je=t,Xe=new Fe,$e=!1,et=!1,tt=!1,ot=!1,rt=!1,nt=!1,it=!1,at=!1,st=!1;function ct(){return Object.assign({},Xe)}function ut(){return Ze}function lt(){return We}function ht(){return Qe}function dt(){return Ve}function pt(){return Je}function ft(){return D.getWorkerCount()}function gt(){return D.getMaxParallelImageRequests()}function mt(){return Ge}function yt(){return Ye}function vt(){return Xe.authType===l.AuthenticationType.subscriptionKey?Xe.subscriptionKey:void 0}function _t(){return Ke}function wt(e){Xe=(new Fe).merge(Xe,e),st=!0}function bt(e){We=e,et=!0}function Ct(e){Qe=e,tt=!0}function Et(e){0<e&&(D.setWorkerCount(e),rt=!0)}function St(e){0<e&&(D.setMaxParallelImageRequests(e),nt=!0)}function Tt(e){Ge=Re.getCode(e),it=!0}function It(e){Ye=e,at=!0}function kt(e){Xe.setSubscriptionKey(e),st=!0}function At(e){Ke=e,$e=!0}function Pt(e,t){if(t=Math.abs(t||1),"string"==typeof e&&zt[e.toLowerCase()]){for(var o=zt[e.toLowerCase()],r=/calc\(([0-9.]+)[px]*\s*\*\s*\{scale\}\)/gi,n=o,i=r.exec(o);i;)n=n.replace(i[0],parseFloat(i[1])*t+""),i=r.exec(o);return n=n.replace("{scale}",t+"")}throw new Error("Invalid templateName.")}function Ot(){return st}function Rt(){return et}function xt(){return tt}function Mt(){return rt}function Nt(){return nt}function Lt(){return it}function Dt(){return at}function qt(){return $e}function Ut(){var e=new Te({domain:Q,path:"sdk/javascript/mapcontrol/".concat(De.getEndpointVersion(),"/mapbox-gl-rtl-text.min.js")});D.setRTLTextPlugin(e.toString(),!0).catch(function(e){e&&console.warn(e)})}function jt(e){var t=document.createElement("span");return t.innerText=e,t.classList.add("tooltiptext"),-1!=navigator.userAgent.indexOf("Edg")?t.classList.add("edge"):-1!=navigator.userAgent.indexOf("Chrome")?t.classList.add("chrome"):-1!=navigator.userAgent.indexOf("Safari")?t.classList.add("safari"):-1!=navigator.userAgent.indexOf("Firefox")&&t.classList.add("firefox"),-1!=navigator.userAgent.indexOf("Windows")?t.classList.add("win"):-1!=navigator.userAgent.indexOf("Macintosh")&&t.classList.add("mac"),t}function Ht(n,i,a){function e(e){var t=i.getBoundingClientRect(),o=n.getBoundingClientRect(),r=t.x+o.width>window.innerWidth?window.innerWidth-o.width:t.x,o=t.y+t.height+o.height+4>window.innerHeight?t.y-o.height-4:t.y+t.height+4;a&&i.parentElement&&(t=i.parentElement?i.parentElement.getBoundingClientRect():null,n.style.position="absolute",r-=t.x,o-=t.y),n.style.transform="translate(".concat(r,"px, ").concat(o,"px)"),n.style.display="block"}void 0===a&&(a=!1),i.addEventListener("mouseover",e),i.addEventListener("focusin",e),i.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||"block"!==n.style.display||(e.stopPropagation(),n.style.display="none")})}var Bt,Ft,zt={marker:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(27 * {scale})" height="calc(39 * {scale})" viewBox="-1 -1 26 38"><path d="M12.25.25a12.254 12.254 0 0 0-12 12.494c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z" style="fill:{color};stroke:{secondaryColor};stroke-width:1"/><text x="12.5" y="17.5" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(28 * {scale})" height="calc(39 * {scale})" viewBox="-1 -1 27 38"><path d="M12.25.25a12.254 12.254 0 0 0-12 12.494c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z" style="fill:{color};stroke:{secondaryColor};stroke-width:2"/><text x="12.5" y="18.5" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-circle":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(28 * {scale})" height="calc(39 * {scale})" viewBox="-1 -1 27 38"><path d="M12.25.25a12.254 12.254 0 0 0-12 12.494c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z" style="fill:{color};stroke:{secondaryColor};stroke-width:1"/><circle cx="12.5" cy="12.5" r="9" fill="{secondaryColor}"/><text x="12" y="17.5" style="font-size:14px;fill:#000;text-anchor:middle">{text}</text></svg>',pin:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(24 * {scale})" height="calc(28 * {scale})" viewBox="0 0 24 28"><path d="m11.988 16.615a5.15 5.15 0 0 1-2.268-.525 4.909 4.909 0 0 1-2.805-4.442 5.019 5.019 0 0 1 5.072-4.936h.012a5.03 5.03 0 0 1 5.085 4.961 4.907 4.907 0 0 1-.549 2.224 5.114 5.114 0 0 1-4.548 2.718zm0-8.06a3.173 3.173 0 0 0-3.226 3.099 3.081 3.081 0 0 0 1.77 2.782 3.299 3.299 0 0 0 4.365-1.386 3.049 3.049 0 0 0 .342-1.381 3.184 3.184 0 0 0-3.239-3.114h-.012z" fill="{secondaryColor}"/><path d="m11.999.922a10.908 10.908 0 0 0-11.076 10.732 10.639 10.639 0 0 0 4.418 8.598l6.658 6.464 6.658-6.463a10.537 10.537 0 0 0 2.198-15.041 11.182 11.182 0 0 0-8.856-4.289zm1.873 14.341a4.221 4.221 0 0 1-5.589-1.789 3.945 3.945 0 0 1-.445-1.8 4.164 4.164 0 0 1 8.323-.037 4.028 4.028 0 0 1-2.289 3.626Z" fill="{color}"/><path d="m11.999 28-7.256-7.044a11.611 11.611 0 0 1-4.743-9.303 11.844 11.844 0 0 1 11.988-11.652.102 .102 0 0 1 .02 0 12.164 12.164 0 0 1 9.577 4.647 11.357 11.357 0 0 1 2.299 8.614 11.521 11.521 0 0 1-4.63 7.695zm-.01-26.157a9.997 9.997 0 0 0-10.143 9.812 9.769 9.769 0 0 0 4.04 7.853l.099.083 6.014 5.838 6.113-5.922a9.7 9.7 0 0 0 3.945-6.505 9.533 9.533 0 0 0-1.933-7.229 10.305 10.305 0 0 0-8.116-3.931h-.021zm.021 14.772a5.11 5.11 0 0 1-4.547-2.718 4.868 4.868 0 0 1 .932-5.743 5.118 5.118 0 0 1 3.58-1.46h.024a5.031 5.031 0 0 1 5.084 4.938 4.92 4.92 0 0 1-2.805 4.457h0a5.152 5.152 0 0 1-2.269.525zm-.011-8.079h-.015a3.277 3.277 0 0 0-2.295.933 3.029 3.029 0 0 0-.587 3.58 3.297 3.297 0 0 0 4.364 1.386h0a3.092 3.092 0 0 0 1.772-2.795 3.185 3.185 0 0 0-3.239-3.105z" fill="{secondaryColor}"/><text x="12" y="17" style="font-size:14px;fill:#000;text-anchor:middle">{text}</text></svg>',"pin-round":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(25 * {scale})" height="calc(25 * {scale})" viewBox="0 0 25 25"><g transform="translate(0 1)"><circle cx="12.25" cy="11.5833" r="11" fill="{color}"/><path d="m12.25 23.583a12 12 0 1 1 12-12 12 12 0 0 1-12 12zm0-22a10 10 0 1 0 10 10 10 10 0 0 0-10-10z" fill="{secondaryColor}"/><circle cx="12.25" cy="11.5833" r="4.2386" fill="{secondaryColor}"/></g><text x="12.5" y="17" style="font-size:14px;fill:#000;text-anchor:middle">{text}</text></svg>',"marker-flat":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(27 * {scale})" height="calc(42.8 * {scale})" viewBox="0 0 1600 2570"><g fill="{color}"><path d="M691 2419c-409-575-641-1086-683-1504-10-106-10-136 5-224 31-188 105-330 241-458 129-124 270-190 453-214 69-9 113-10 182-1 373 46 655 326 703 698 40 308-120 801-424 1309-134 224-348 535-369 535-4 0-53-63-108-141z"/></g><g fill="rgba(0,0,0,0.15)" style="transform:scale(-1,1);transform-origin:center"><path d="M691 2419c-407-571-639-1083-682-1498-14-139-3-249 37-371 69-208 254-402 459-481 68-27 217-59 271-59h24v160 180 940 635c0 349-2 635-5 635-2 0-49-63-104-141z"/></g><circle cx="800" cy="800" r="600" fill="{secondaryColor}"/><text x="800" y="1100" style="font-size:800px;fill:#000;text-anchor:middle">{text}</text></svg>',"marker-arrow":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(25.47 * {scale})" height="calc(35.18 * {scale})" viewBox="0 0 4330 5980"><g fill="{color}"><path d="m2080 5969c-49-20-93-63-115-113-25-55-1928-5486-1953-5573-40-138 67-282 210-283 36 0 246 73 987 345 518 190 947 345 955 345 8 0 438-155 955-345 615-226 954-345 979-345 87 0 165 47 204 123 46 91 107-95-957 2942-537 1535-986 2805-997 2823-11 18-43 46-72 62-41 24-62 30-111 29-33 0-71-5-85-10z"/></g><g fill="{secondaryColor}"><path d="m2200 1600c-36 10-83 2-484-84-243-53-451-94-461-91-11 4-22 18-25 31-5 19 114 371 436 1292 244 697 448 1273 454 1281 19 24 50 30 71 12z"/><path d="m2200 1600c-36 10-83 2-484-84-243-53-451-94-461-91-11 4-22 18-25 31-5 19 114 371 436 1292 244 697 448 1273 454 1281 19 24 50 30 71 12z" style="transform:scale(-1,1);transform-origin:center"/></g><g fill="rgba(0,0,0,0.2)" ><path d="m2165 685c8 0 438-155 955-345 615-226 954-345 979-345 87 0 165 47 204 123 46 91 107-95-957 2942-537 1535-986 2805-997 2823-11 18-43 46-72 62-41 24-62 30-111 29z"/></g><text x="2165" y="3300" style="font-size:2500px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-ball-pin":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(15.67 * {scale})" height="calc(33.33 * {scale})" viewBox="0 0 235 452"><g transform="translate(-135 10)"><path fill="{secondaryColor}" d="m256 442 0 0c-13 0-18-11-18-24l-6-323c0-13 11-24 24-24h0c13 0 24 11 24 24l-6 323c0 13-5 24-18 24z"/><circle style="fill:{color};stroke-width:10;stroke:{secondaryColor}" cx="256" cy="112" r="111"/><ellipse transform="matrix(0.834 0.5518 -0.5518 0.834 65.7916 -97.18)" fill="rgba(255,255,255,0.3)" cx="194.399" cy="60.749" rx="19.076" ry="32.428"/></g><text x="117.5" y="160" style="font-size:160px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-square":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(26.67 * {scale})" height="calc(32.27 * {scale})" viewBox="0 0 2000 2420"><g transform="translate(100 100)" style="stroke:{secondaryColor};stroke-width:100;fill:{color}"><path d="M845 2152c-22-37-58-95-80-129-22-35-62-99-90-143l-50-80-312 0-313 0 0-900 0-900 900 0 900 0 0 900 0 900-313 0-313 0-34 58c-19 31-38 59-42 60-5 2-8 8-8 12 0 9-69 123-88 145-5 6-11 15-13 21-16 39-77 123-89 124-8 0-33-31-55-68z"/></g><text x="1000" y="1300" style="font-size:1000px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-square-cluster":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(33.33 * {scale})" height="calc(38.8 * {scale})" viewBox="0 0 2500 2910"><g transform="translate(100 100)" style="stroke:{secondaryColor};stroke-width:100;fill:{color}"><path d="m866 2652c-17-31-37-68-46-82-9-14-32-54-51-90-19-36-50-92-70-125l-36-60-332-3-331-2 0-905 0-905 660 0 660 0 0-38c0-71 50-196 102-258 71-85 189-164 244-164 12 0 26-4 29-10 8-13 222-13 230 0 3 6 17 10 30 10 25 0 117 45 154 76 130 107 191 232 191 392 0 155-63 284-190 386-36 29-129 76-150 76-11 0-22 5-25 10-3 6-31 10-61 10l-54 0 0 660 0 660-332 2-332 3-29 50c-17 28-48 84-70 125-22 41-47 86-56 100-9 14-30 51-46 83-17 32-36 57-45 57-8 0-28-25-44-58z"/></g><text x="1650" y="900" style="font-size:1000px;fill:#fff">+</text><text x="1000" y="1800" style="font-size:1000px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-square-rounded":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(26.8 * {scale})" height="calc(32.27 * {scale})" viewBox="0 0 2010 2410"><g transform="translate(100 100)" style="stroke:{secondaryColor};stroke-width:100;fill:{color}"><path d="M856 2155c-20-30-36-59-36-65 0-5-4-10-10-10-5 0-10-5-10-11 0-5-18-37-40-69-22-32-40-64-40-69 0-6-4-11-10-11-5 0-10-5-10-10 0-6-15-33-32-60l-33-50-127 0c-74 0-129-4-133-10-3-5-17-10-30-10-25 0-116-45-155-76-87-69-142-151-178-265-15-46-17-1075-2-1084 5-3 10-17 10-30 0-13 5-27 10-30 6-3 10-13 10-22 0-22 83-135 122-168 57-46 62-50 112-75l50-25 585 0 586 0 63 34c84 46 169 133 212 218l35 68 0 565 0 565-28 59c-32 69-100 157-139 180-15 9-33 22-40 29-23 22-99 57-123 57-13 0-27 5-30 10-4 6-60 10-135 10l-128 0-128 205c-84 136-133 205-144 205-10 0-33-24-54-55z"/></g><text x="1000" y="1300" style="font-size:1000px;fill:#fff;text-anchor:middle">{text}</text></svg>',"marker-square-rounded-cluster":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(33.33 * {scale})" height="calc(32.13 * {scale})" viewBox="0 0 2500 2900"><g transform="translate(100 100)" style="stroke:{secondaryColor};stroke-width:100;fill:{color}"><path d="m874 2669c-9-18-26-49-37-68-11-20-30-55-43-78-13-24-36-64-51-90-14-27-38-69-52-95l-26-48-142 0c-84 0-144-4-148-10-3-5-17-10-30-10-25 0-118-46-154-76-91-76-136-142-175-254-13-38-16-119-16-554 0-358 3-520 12-545 40-125 106-219 195-278 127-84 116-83 646-83l467 0 0-42c0-46 11-87 45-163 54-121 169-220 306-264 46-14 232-14 278 0 165 53 284 175 340 350 19 61 14 204-10 273-32 91-94 178-169 240-38 31-130 76-155 76-13 0-27 5-30 10-3 6-28 10-56 10l-49 0 0 462c0 446-1 464-21 522-32 91-94 178-169 240-38 31-130 76-155 76-13 0-27 5-30 10-4 6-65 10-149 10-138 0-143 1-154 23-12 23-62 114-112 202-16 28-44 79-63 115-42 77-67 88-93 39z"/></g><text x="1650" y="900" style="font-size:1000px;fill:#fff">+</text><text x="1000" y="1800" style="font-size:1000px;fill:#fff;text-anchor:middle">{text}</text></svg>',flag:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(23.5 * {scale})" height="calc(40 * {scale})" viewBox="34 28 198 308"><path style="stroke:{secondaryColor};stroke-width:15;stroke-linecap:round;" d="M42 327l0 -291"/><path style="fill:{color};stroke:{secondaryColor};stroke-width:10;stroke-linejoin:round;" d="M49 50c70 30 104 28 178 2-21 42-21 74 0 116-72 25-101 25-178 0l0-118z"/><text x="130" y="165" style="font-size:100px;fill:#fff;text-anchor:middle">{text}</text></svg>',"flag-triangle":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(27 * {scale})" height="calc(35.33 * {scale})" viewBox="0 0 40.5 53"><g transform="translate(-31 -20)"><path fill="{secondaryColor}" d="M34.7,73.3V48.4l34.6-10.1c0.7-0.2,1.2-0.8,1.2-1.5s-0.4-1.4-1-1.7L33.7,20.5c-0.5-0.2-1.1-0.2-1.6,0.2 c-0.5,0.3-0.7,0.8-0.7,1.4v51.2H34.7z"/><polygon points="34.7,24.5 66,36.5 34.7,45 34.7,10" fill="{color}"/></g><text x="11" y="21" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"rounded-square":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(34 * {scale})" height="calc(34 * {scale})" viewBox="0 0 34 34"><g transform="translate(2 2)"><rect x="0" y="0" rx="8" ry="8" width="30" height="30" style="stroke:{secondaryColor};stroke-width:2;fill:{color}"/></g><text x="17" y="22" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"rounded-square-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(38 * {scale})" height="calc(38 * {scale})" viewBox="0 0 38 38"><g transform="translate(4 4)"><rect x="0" y="0" rx="8" ry="8" width="30" height="30" style="stroke:{secondaryColor};stroke-width:4;fill:{color}"/></g><text x="19" y="24" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',triangle:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(36 * {scale})" height="calc(36 * {scale})" viewBox="0 0 36 36"><g transform="translate(2 2)"><polygon points="16,0 32,32 0,32 16,0" style="stroke:{secondaryColor};stroke-width:2;fill:{color}"/></g><text x="17.5" y="30" style="font-size:12px;fill:#fff;text-anchor:middle">{text}</text></svg>',"triangle-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(40 * {scale})" height="calc(40 * {scale})" viewBox="0 0 40 40"><g transform="translate(4 4)"><polygon points="16,0 32,32 0,32 16,0" style="stroke:{secondaryColor};stroke-width:4;fill:{color}"/></g><text x="19.5" y="32" style="font-size:12px;fill:#fff;text-anchor:middle">{text}</text></svg>',hexagon:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(35 * {scale})" height="calc(40 * {scale})" viewBox="0 0 35 40"><g transform="translate(2 2)"><path d="M31 9 15.5 0 0 9 0 27 15.5 36 31 27 31 9Z" style="stroke:{secondaryColor};stroke-width:2;fill:{color}"/></g><text x="17.5" y="25" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"hexagon-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(39 * {scale})" height="calc(44 * {scale})" viewBox="0 0 39 44"><g transform="translate(4 4)"><path d="M31 9 15.5 0 0 9 0 27 15.5 36 31 27 31 9Z" style="stroke:{secondaryColor};stroke-width:4;fill:{color}"/></g><text x="19.5" y="27" style="font-size:14px;fill:#fff;text-anchor:middle">{text}</text></svg>',"hexagon-rounded":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(40 * {scale})" height="calc(40 * {scale})" viewBox="0 0 1100 1100"><g transform="translate(50 50)"><path style="stroke:{secondaryColor};stroke-width:50;fill:{color}" d="M881 210 561 25c-33-19-88-19-121 0L119 210c-33 19-61 67-61 105v370c0 39 27 86 61 105l321 185c33 19 88 19 122 0l321-185c33-19 61-67 61-105V315C942 276 915 229 881 210z"/></g><text x="550" y="700" style="font-size:400px;fill:#fff;text-anchor:middle">{text}</text></svg>',"hexagon-rounded-thick":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(40 * {scale})" height="calc(40 * {scale})" viewBox="0 0 1200 1200"><g transform="translate(100 100)"><path style="stroke:{secondaryColor};stroke-width:100;fill:{color}" d="M881 210 561 25c-33-19-88-19-121 0L119 210c-33 19-61 67-61 105v370c0 39 27 86 61 105l321 185c33 19 88 19 122 0l321-185c33-19 61-67 61-105V315C942 276 915 229 881 210z"/></g><text x="600" y="750" style="font-size:400px;fill:#fff;text-anchor:middle">{text}</text></svg>',"triangle-arrow-up":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(28 * {scale})" height="calc(28 * {scale})" viewBox="0 0 28 28"><g transform="translate(2 2)"><polygon points="12,0 0,24 12,17 24,24" stroke-width="2" stroke="{secondaryColor}" fill="{color}"/></g><text x="14" y="17" style="font-size:8px;fill:#fff;text-anchor:middle">{text}</text></svg>',"triangle-arrow-left":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(28 * {scale})" height="calc(28 * {scale})" viewBox="0 0 28 28"><g transform="translate(2 2)"><polygon points="24,12 0,0 7,12 0,24" stroke-width="2" stroke="{secondaryColor}" fill="{color}"/></g><text x="14" y="16.5" style="font-size:8px;fill:#fff;text-anchor:middle">{text}</text></svg>',"arrow-up":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(12.16 * {scale})" height="calc(30.1 * {scale})" viewBox="0 0 902 364"><g fill="{color}" transform="matrix(0,2.4,-2.4,0,897,-930)"><polygon points="902,222 233,222 233,364 0,182 233,0 233,141 902,141 902,222"/></g><text x="450" y="700" style="font-size:900px;fill:#000;text-anchor:middle">{text}</text></svg>',"arrow-up-thin":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(16 * {scale})" height="calc(33.33 * {scale})" viewBox="0 0 12 25"><g transform="translate(-136.91823 -751.91998)"><path fill="{color}" d="m148.271 760.71c-1.641-.547-3.186-1.47-4.633-2.769l0 18.07-1.675 0 0-18.07c-1.447 1.299-2.986 2.222-4.616 2.769l0-1.231c2.325-1.596 4.006-3.812 5.043-6.65l.838 0c1.037 2.838 2.718 5.055 5.043 6.65l0 1.231z"/></g><text x="6" y="20" style="font-size:10px;fill:#000;text-anchor:middle">{text}</text></svg>',car:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(21.93 * {scale})" height="calc(40.9 * {scale})" viewBox="0 0 6580 12270"><g transform="translate(0 12270) rotate(-90)"><path fill="{secondaryColor}" d="M7045 6566c-42-13-105-44-105-51 0-2 23-105 50-228 28-123 50-230 50-236 0-8-241-11-907-11-855 0-1145 6-1513 30-85 6-189 13-230 15-41 3-133 10-205 15-286 21-430 32-705 50-953 63-1459 18-2335-205-304-77-746-209-799-238-131-72-221-408-285-1062-34-345-42-532-48-1130-16-1557 108-2532 336-2649 32-17 469-149 676-205 409-110 819-191 1205-238 116-14 224-18 540-18 395 1 494 5 1140 50 1124 79 1224 82 2496 78l641-3-53-237c-29-131-52-238-51-239 1-1 31-14 66-29 56-23 76-26 142-23 67 3 83 7 120 33 23 17 50 41 61 55 10 14 51 117 91 230l73 205 674 3 675 2 90-39c98-43 198-72 315-93 122-21 829-18 990 5 321 45 626 143 849 270 293 168 516 378 704 662 266 402 416 893 467 1527 15 174 8 882-9 998-6 41-18 127-27 190-69 502-253 969-523 1325-79 105-262 284-381 374-189 142-355 229-574 300-336 110-526 139-952 148-457 9-685-23-887-124l-47-24-678-6-678-6-64 179c-79 224-92 253-121 284-67 70-177 97-274 66zm-2752-5073c-23-2-64-2-90 0-26 2-7 3 42 3 50 0 71-1 48-3zm395 0c-21-2-55-2-75 0-21 2-4 4 37 4 41 0 58-2 38-4z"/><path fill="{color}" d="M7043 6498c-13-6-23-19-23-28 0-9 23-117 50-240 28-123 50-230 50-237 0-22-2126-13-2465 10-132 10-400 28-595 42-661 47-824 55-1160 62-435 7-656-8-1040-73-415-70-865-183-1447-365-168-53-272-556-325-1569-16-319-16-1311 0-1630 45-872 129-1366 257-1518 22-26 51-39 172-77 557-177 1122-310 1563-369 271-36 351-40 690-40 361 1 463 6 1165 54 1122 78 1288 83 2337 79 460-2 840-7 843-11 4-4-17-117-47-252l-55-245 39-16c76-30 180-8 224 47 10 13 54 124 98 246l79 222 709 0 709 0 47-24c74-37 219-83 322-101 122-22 606-32 802-16 374 29 658 102 933 238 124 62 271 155 361 230l61 51 6 100c19 278 103 497 247 643 88 89 173 136 278 152l70 11 41 131c116 369 159 673 168 1170 10 584-38 984-167 1397l-40 126-70 12c-193 33-348 175-441 405-56 139-89 302-89 445 0 43-3 47-58 91-290 235-644 384-1068 450-191 29-796 39-974 16-135-18-263-54-368-102l-75-35-701 0-701 0-79 223c-82 232-102 267-163 293-38 16-138 17-170 2zm-2023-820c332-15 1155-12 1835 6 308 8 563 12 566 8 4-4 10-21 13-38 7-30 6-31-92-77-518-244-1197-396-2112-474-295-25-1282-25-1579 0-231 20-473 46-479 51-6 7 49 110 93 171 160 226 416 335 855 365 142 10 539 5 900-12zm3304-263c525-111 899-887 934-1935 19-557-37-1023-172-1435-186-563-521-900-896-899-81 0-158 14-525 92-426 91-431 92-540 146-195 96-287 207-306 368-12 104-11 2985 1 3078 22 170 135 291 365 389 49 21 191 55 480 115 226 47 419 87 430 89 45 10 164 6 229-8zm-5570-485c112-43 197-156 216-291 12-83 13-2623 1-2706-23-158-125-273-270-304-44-9-100-1-542 75-272 47-514 91-539 98-266 68-487 424-594 958-56 280-70 548-40 800 56 484 207 878 414 1081 115 114 122 116 702 218 277 49 524 90 550 90 26 1 72-8 102-19zm2111-3440c1023-44 1884-213 2462-486l113-53-7-33c-3-18-8-35-10-37-2-3-236 1-521 7-993 24-1271 26-1708 11-541-18-1128-18-1249-1-377 56-588 181-734 437-32 55-41 79-32 84 12 8 246 32 491 51 356 28 815 36 1195 20z"/></g><text x="3250" y="8250" style="font-size:3000px;fill:#fff;text-anchor:middle">{text}</text></svg>',checker:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(16 * {scale})" height="calc(16 * {scale})" viewBox="0 0 16 16"><pattern id="p" x="0" y="0" width="16" height="16" patternUnits="userSpaceOnUse"><rect fill="{color}" x="0" width="8" height="8" y="0"/><rect fill="{color}" x="8" width="8" height="8" y="8"/></pattern><rect x="0" y="0" width="16" height="16" fill="{secondaryColor}"/><rect x="0" y="0" width="16" height="16" fill="url(#p)"/></svg>',"checker-rotated":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(16 * {scale})" height="calc(16 * {scale})" viewBox="0 0 60 60"><rect width="60" height="60" fill="{secondaryColor}"/><rect width="42.42" height="42.42" transform="translate(30 0) rotate(45)" fill="{color}"/></svg>',"zig-zag":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(15 * {scale})" height="calc(15 * {scale})" viewBox="0 0 120 120"><rect x="0" y="0" width="120" height="120" fill="{secondaryColor}"/><polygon fill="{color}" points="120 120 60 120 90 90 120 60 120 0 120 0 60 60 0 0 0 60 30 90 60 120 120 120"/></svg>',"zig-zag-vertical":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(15 * {scale})" height="calc(15 * {scale})" viewBox="0 0 120 120"><rect x="0" y="0" width="120" height="120" fill="{secondaryColor}"/><polygon fill="{color}" points="120 0 120 60 90 30 60 0 0 0 0 0 60 60 0 120 60 120 90 90 120 60 120 0"/></svg>',"circles-spaced":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(20 * {scale})" height="calc(20 * {scale})" viewBox="0 0 20 20"><defs><pattern id="p" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="2" stroke="none" fill="{color}"/></pattern></defs><rect x="0" y="0" width="20" height="20" fill="{secondaryColor}"/><rect x="0" y="0" width="100" height="100" fill="url(#p)"/></svg>',circles:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(7 * {scale})" height="calc(7 * {scale})" viewBox="0 0 20 20"><defs><pattern id="p" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="6" stroke="none" fill="{color}"/></pattern></defs><rect x="0" y="0" width="20" height="20" fill="{secondaryColor}"/><rect x="0" y="0" width="100" height="100" fill="url(#p)"/></svg>',"diagonal-lines-up":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(18 * {scale})" height="calc(18 * {scale})" viewBox="0 0 6 6"><rect x="0" y="0" width="6" height="6" fill="{secondaryColor}"/><g fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>',"diagonal-lines-down":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(18 * {scale})" height="calc(18 * {scale})" viewBox="0 0 6 6"><rect x="0" y="0" width="6" height="6" fill="{secondaryColor}"/><g transform="rotate(90 3 3)" fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>',"diagonal-stripes-up":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(20 * {scale})" height="calc(20 * {scale})" viewBox="0 0 40 40"><rect x="0" y="0" width="40" height="40" fill="{secondaryColor}"/><g fill="{color}"><path d="M0 40L40 0H20L0 20M40 40V20L20 40"/></g></svg>',"diagonal-stripes-down":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(20 * {scale})" height="calc(20 * {scale})" viewBox="0 0 40 40"><rect x="0" y="0" width="40" height="40" fill="{secondaryColor}"/><g transform="rotate(90 20 20)" fill="{color}"><path d="M0 40L40 0H20L0 20M40 40V20L20 40"/></g></svg>',"grid-lines":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(14 * {scale})" height="calc(14 * {scale})" viewBox="0 0 6 6"><rect x="0" y="0" width="6" height="6" fill="{secondaryColor}"/><g transform="rotate(45 3 3)" fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g><g fill="{color}" transform="rotate(-45 3 3)"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>',"rotated-grid-lines":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(18 * {scale})" height="calc(18 * {scale})" viewBox="0 0 6 6"><rect x="0" y="0" width="6" height="6" fill="{secondaryColor}"/><g transform="rotate(90 3 3)" fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g><g fill="{color}"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>',"rotated-grid-stripes":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(20 * {scale})" height="calc(20 * {scale})" viewBox="0 0 40 40"><rect x="0" y="0" width="40" height="40" fill="{secondaryColor}"/><g transform="rotate(90 20 20)" fill="{color}"><path d="M0 40L40 0H20L0 20M40 40V20L20 40"/></g><g fill="{color}"><path d="M0 40L40 0H20L0 20M40 40V20L20 40"/></g></svg>',"x-fill":'<svg xmlns="http://www.w3.org/2000/svg" width="calc(40 * {scale})" height="calc(40 * {scale})" viewBox="0 0 40 40"><rect x="0" y="0" width="45.3" height="45.3" fill="{secondaryColor}"/><g fill="{color}"><path d="M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41zM20 18.6l2.83-2.83 1.41 1.41L21.41 20l2.83 2.83-1.41 1.41L20 21.41l-2.83 2.83-1.41-1.41L18.59 20l-2.83-2.83 1.41-1.41L20 18.59z"/></g></svg>',dots:'<svg xmlns="http://www.w3.org/2000/svg" width="calc(13 * {scale})" height="calc(13 * {scale})" viewBox="0 0 20 20"><rect x="0" y="0" width="20" height="20" fill="{secondaryColor}"/><g fill="{color}"><circle cx="3" cy="3" r="3"/><circle cx="13" cy="13" r="3"/></g></svg>'},r=window&&window.__extends||(Bt=function(e,t){return(Bt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Bt(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Kt=(l.ControlPosition=void 0,(be=l.ControlPosition||(l.ControlPosition={})).TopLeft="top-left",be.TopRight="top-right",be.BottomLeft="bottom-left",be.BottomRight="bottom-right",be.NonFixed="non-fixed",r(Gt,Ft=ye),Gt);function Gt(){var e=null!==Ft&&Ft.apply(this,arguments)||this;return e.position=l.ControlPosition.NonFixed,e}Wt.prototype.getLuminosity=function(){for(var e=[this.r,this.g,this.b],t=[],o=0;o<e.length;o++){var r=e[o]/255;t[o]=r<=.03928?r/12.92:Math.pow((.055+r)/1.055,2.4)}return.2126*t[0]+.7152*t[1]+.0722*t[2]},Wt.prototype.getRBGA=function(e){var t=document.createElement("canvas").getContext("2d"),e=(t.globalAlpha=1,t.fillStyle=e,t.fillRect(0,0,1,1),t.getImageData(0,0,1,1).data);return[e[0],e[1],e[2],e[3]]};var Yt=Wt;function Wt(e){var t;e&&(t=void 0,3<=(t="string"==typeof e?this.getRBGA(e):e).length)&&(this.r=t[0],this.g=t[1],this.b=t[2],3<t.length)&&(this.a=t[3])}l.ControlStyle=void 0,(o=l.ControlStyle||(l.ControlStyle={})).light="light",o.dark="dark",o.auto="auto";var Zt=Map,Qt=(Vt.prototype._addEventListener=function(e,t,o){this.listeners.has(e)||this.listeners.set(e,new Zt),this.listeners.get(e).set(t,o)},Vt.prototype._removeEventListener=function(e,t){this.listeners.has(e)&&this.listeners.get(e).delete(t)},Vt.prototype._invokeEvent=function(o,r){var n=this;this.listeners.has(o)&&this.listeners.get(o).forEach(function(e,t){e&&n._removeEventListener(o,t);try{t(r)}catch(e){console.error(e)}})},Vt);function Vt(){this.listeners=new Zt}var Jt,Xt,B=Object.freeze({__proto__:null,EventEmitter:Qt}),$t=((window&&window.__extends||(Jt=function(e,t){return(Jt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Jt(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(eo,Xt=Qt),eo.prototype.onRemove=function(){this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.events.remove("stylechanged",this._onStyleChange),delete this._map),this._observer&&(this._observer.disconnect(),delete this._observer),delete this._theme},eo.prototype.buildContainer=function(e,t,o,r){return this._map=e,this._container=document.createElement(r||"div"),this._container.classList.add("azure-maps-control-container"),"string"==typeof o&&this._container.setAttribute("aria-label",o),t.toLowerCase()===l.ControlStyle.auto?this._map&&this._map.events.add("stylechanged",this._onStyleChange):this._container.classList.add(t),this._container},eo.prototype._setTheme=function(e){this._theme!==e&&(this._container.classList.remove(this._theme),this._container.classList.add(e),this._theme=e)},eo.activateClickDelay=100,eo);function eo(){var t=null!==Xt&&Xt.apply(this,arguments)||this;return t._onStyleChange=function(){t._map.getStyle().style.toLowerCase().startsWith("blank")?t._observer||(t._onBackgroundChange(),t._observer=new MutationObserver(t._onBackgroundChange),t._observer.observe(t._map.getMapContainer(),{attributes:!0,attributeFilter:["style"]})):(t._observer&&(t._observer.disconnect(),delete t._observer),t._map.styles.getThemeAsync(t._map.getStyle()).then(function(e){t._setTheme(e)}))},t._onBackgroundChange=function(){var e=new Yt(t._map.getMapContainer().style.backgroundColor).getLuminosity(),e=isNaN(e)||.5<e?l.ControlStyle.light:l.ControlStyle.dark;t._setTheme(e)},t}(window&&window.__extends||(to=function(e,t){return(to=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}to(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(no,oo=ye);var to,oo,ro=no;function no(){var e=null!==oo&&oo.apply(this,arguments)||this;return e.rotationDegreesDelta=15,e.style=l.ControlStyle.light,e.inverted=!1,e}(window&&window.__extends||(io=function(e,t){return(io=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}io(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(co,ao=$t),co.prototype.onAdd=function(e,t){function o(e){e?(n.classList.add("in-use"),a.setAttribute("aria-hidden","false"),a.classList.remove("hidden-accessible-element")):(n.classList.remove("in-use"),a.setAttribute("aria-hidden","true"),a.classList.add("hidden-accessible-element"))}var r=this,n=this.buildContainer(e,this.options.style,"Rotation Control"),i=this.constructRotationButton(e),a=this.constructRotationGrid(e,t),s=jt("Reset to Default Rotation");return n.addEventListener("mouseover",function(e){r.lastActiveTime=r.lastActiveTime||e.timeStamp,r.hasMouse=!0,o(!0)}),n.addEventListener("focusin",function(e){r.lastActiveTime=r.lastActiveTime||e.timeStamp,r.hasFocus=!0,o(!0)}),n.addEventListener("mouseleave",function(){r.hasMouse=!1,r.hasFocus||(delete r.lastActiveTime,o(!1))}),n.addEventListener("focusout",function(e){e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||(r.hasFocus=!1,r.hasMouse)||(delete r.lastActiveTime,o(!1))}),a.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||(e.stopPropagation(),i.focus(),o(!1))}),i.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||null==n||!n.classList.contains("in-use")||"none"!==(null==s?void 0:s.style.display)||(e.stopPropagation(),o(!1))}),t&&co.InvertOrderPositions.includes(t.position)?(n.appendChild(a),n.appendChild(i),n.appendChild(s),Ht(s,i)):(n.appendChild(i),n.appendChild(s),Ht(s,i),n.appendChild(a)),n},co.prototype.constructRotationGrid=function(e,t){var o=document.createElement("div"),r=(o.classList.add("sub-container"),o.classList.add("hidden-accessible-element"),o.setAttribute("aria-hidden","true"),this.constructRightRotationButton(e)),e=this.constructLeftRotationButton(e),n=jt("Rotate Left"),i=jt("Rotate Right");return t&&co.InvertOrderPositions.includes(t.position)?(o.appendChild(r),o.appendChild(i),Ht(i,r),o.appendChild(e),o.appendChild(n),Ht(n,e)):(o.appendChild(e),o.appendChild(n),Ht(n,e),o.appendChild(r),o.appendChild(i),Ht(i,r)),o},co.prototype.constructRotationButton=function(t){var o=this,e=document.createElement("button"),r=(e.classList.add("azure-maps-control-button"),e.classList.add("rotation"),e.setAttribute("aria-label","Reset to Default Rotation"),e.setAttribute("alt","Reset to Default Rotation"),e.setAttribute("type","button"),document.createElement("div"));return e.appendChild(r),e.addEventListener("click",function(e){e.timeStamp-o.lastActiveTime>$t.activateClickDelay&&t.setCamera({bearing:co.DefaultRotation},!0)}),t.events.add("rotate",function(e){r.style.transform="rotate(".concat(-e.map.getCamera().bearing,"deg)")}),e},co.prototype.constructRightRotationButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("rotation-right"),o.setAttribute("aria-label","Rotate Right"),o.setAttribute("alt","Rotate Right"),o.setAttribute("type","button"),o.addEventListener("click",function(){e.setCamera({bearing:e.getCamera().bearing-(t.options.inverted?-1:1)*t.options.rotationDegreesDelta,duration:co.RotationDuration,type:"ease"},!0)}),o},co.prototype.constructLeftRotationButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("rotation-left"),o.setAttribute("aria-label","Rotate Left"),o.setAttribute("alt","Rotate Left"),o.setAttribute("type","button"),o.addEventListener("click",function(){e.setCamera({bearing:e.getCamera().bearing+(t.options.inverted?-1:1)*t.options.rotationDegreesDelta,duration:co.RotationDuration,type:"ease"},!0)}),o},co.DefaultRotation=0,co.RotationDuration=100,co.InvertOrderPositions=[l.ControlPosition.BottomRight,l.ControlPosition.TopRight];var io,ao,so=co;function co(e){var t=ao.call(this)||this;return t.hasMouse=!1,t.hasFocus=!1,t.options=(new ro).merge(e),t}(window&&window.__extends||(uo=function(e,t){return(uo=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}uo(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(po,lo=ye);var uo,lo,ho=po;function po(){var e=null!==lo&&lo.apply(this,arguments)||this;return e.pitchDegreesDelta=10,e.style=l.ControlStyle.light,e.inverted=!1,e}(window&&window.__extends||(fo=function(e,t){return(fo=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}fo(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(mo,go=$t),mo.prototype.onAdd=function(e,t){function o(e){e?(n.classList.add("in-use"),a.setAttribute("aria-hidden","false"),a.classList.remove("hidden-accessible-element")):(n.classList.remove("in-use"),a.setAttribute("aria-hidden","true"),a.classList.add("hidden-accessible-element"))}var r=this,n=this.buildContainer(e,this.options.style,"Pitch Control"),i=this.constructPitchButton(e),a=this.constructPitchGrid(e,t),s=jt("Reset to Default Pitch");return n.addEventListener("mouseover",function(e){r.lastActiveTime=r.lastActiveTime||e.timeStamp,r.hasMouse=!0,o(!0)}),n.addEventListener("focusin",function(e){r.lastActiveTime=r.lastActiveTime||e.timeStamp,r.hasFocus=!0,o(!0)}),n.addEventListener("mouseleave",function(){r.hasMouse=!1,r.hasFocus||(delete r.lastActiveTime,o(!1))}),n.addEventListener("focusout",function(e){e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||(r.hasFocus=!1,r.hasMouse)||(delete r.lastActiveTime,o(!1))}),a.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||(e.stopPropagation(),i.focus(),o(!1))}),i.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key||null==n||!n.classList.contains("in-use")||"none"!==(null==s?void 0:s.style.display)||(e.stopPropagation(),o(!1))}),t&&mo.INVERT_ORDER_POSITIONS.includes(t.position)?(n.appendChild(a),n.appendChild(i),n.appendChild(s),Ht(s,n)):(n.appendChild(i),n.appendChild(s),Ht(s,n),n.appendChild(a)),this.map=e,this.container=n,this.pitchButton=i,e.events.add("pitch",this.pitchChanged),this.updatePitchButtonsState(),n},mo.prototype.onRemove=function(){this.container&&(this.container.remove(),this.container=null,this.pitchButton=null,this.pitchIncrementButton=null,this.pitchDecrementButton=null),this.map&&(this.map.events.remove("pitch",this.pitchChanged),this.map=null)},mo.prototype.constructPitchGrid=function(e,t){var o=document.createElement("div"),e=(o.classList.add("sub-container"),o.classList.add("hidden-accessible-element"),o.setAttribute("aria-hidden","true"),this.pitchIncrementButton=this.constructPitchIncrementButton(e),this.pitchDecrementButton=this.constructPitchDecrementButton(e),jt("Increase Pitch")),r=jt("Decrease Pitch");return t&&mo.INVERT_ORDER_POSITIONS.includes(t.position)?(o.appendChild(this.pitchDecrementButton),o.appendChild(r),Ht(r,this.pitchDecrementButton),o.appendChild(this.pitchIncrementButton),o.appendChild(e),Ht(e,this.pitchIncrementButton)):(o.appendChild(this.pitchIncrementButton),o.appendChild(e),Ht(e,this.pitchIncrementButton),o.appendChild(this.pitchDecrementButton),o.appendChild(r),Ht(r,this.pitchDecrementButton)),o},mo.prototype.constructPitchButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("pitch"),o.setAttribute("aria-label","Reset to Default Pitch"),o.setAttribute("alt","Reset to Default Pitch"),o.setAttribute("type","button"),o.addEventListener("click",function(){event.timeStamp-t.lastActiveTime>$t.activateClickDelay&&e.setCamera({pitch:mo.DEFAULT_PITCH},!0)}),o},mo.prototype.constructPitchDecrementButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("pitch-down"),o.setAttribute("aria-label","Decrease Pitch"),o.setAttribute("alt","Decrease Pitch"),o.setAttribute("type","button"),o.addEventListener("click",function(){e.setCamera({pitch:e.getCamera().pitch-(t.options.inverted?-1:1)*t.options.pitchDegreesDelta,duration:mo.PITCH_DURATION_MS,type:"ease"},!0)}),o},mo.prototype.constructPitchIncrementButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("pitch-up"),o.setAttribute("aria-label","Increase Pitch"),o.setAttribute("alt","Increase Pitch"),o.setAttribute("type","button"),o.addEventListener("click",function(){e.setCamera({pitch:e.getCamera().pitch+(t.options.inverted?-1:1)*t.options.pitchDegreesDelta,duration:mo.PITCH_DURATION_MS,type:"ease"},!0)}),o},mo.PITCH_DURATION_MS=100,mo.DEFAULT_PITCH=0,mo.INVERT_ORDER_POSITIONS=[l.ControlPosition.BottomRight,l.ControlPosition.TopRight];var fo,go,t=mo;function mo(e){var o=go.call(this)||this;return o.container=null,o.map=null,o.pitchButton=null,o.pitchIncrementButton=null,o.pitchDecrementButton=null,o.hasMouse=!1,o.hasFocus=!1,o.pitchChanged=function(e){return o.updatePitchButtonsState()},o.updatePitchButtonsState=function(){var e=o.map.getCamera().pitch<=0,t=60<=o.map.getCamera().pitch;o.hasFocus&&o.pitchButton&&(e||t)&&o.pitchButton.focus(),o.options.inverted?(o.pitchIncrementButton&&o.pitchIncrementButton.disabled!=e&&(o.pitchIncrementButton.disabled=e),o.pitchDecrementButton&&o.pitchDecrementButton.disabled!=t&&(o.pitchDecrementButton.disabled=t)):(o.pitchIncrementButton&&o.pitchIncrementButton.disabled!=t&&(o.pitchIncrementButton.disabled=t),o.pitchDecrementButton&&o.pitchDecrementButton.disabled!=e&&(o.pitchDecrementButton.disabled=e))},o.options=(new ho).merge(e),o}(window&&window.__extends||(yo=function(e,t){return(yo=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}yo(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(_o,vo=$t),_o.prototype.onAdd=function(e,t){this.map=e,null!=(o=null==(o=this.map)?void 0:o._getMap())&&o.addControl(this.control);var o=this.buildContainer(e,l.ControlStyle.auto,"Scale Bar");return o.appendChild(null==(e=this.control)?void 0:e._container),o},_o.prototype.onRemove=function(){var e;vo.prototype.onRemove.call(this),null!=(e=null==(e=this.map)?void 0:e._getMap())&&e.removeControl(this.control),this.map=null},_o.prototype.setUnit=function(e){var t;null!=(t=this.control)&&t.setUnit(e)};var yo,vo,be=_o;function _o(e){var t=vo.call(this)||this;return t.map=null,t.control=new D.ScaleControl({maxWidth:null==e?void 0:e.maxWidth,unit:null==e?void 0:e.unit}),t}function wo(e,t){return e===t||e!=e&&t!=t}var bo=wo;function Co(e,t){for(var o=e.length;o--;)if(bo(e[o][0],t))return o;return-1}var Eo=Co,So=Array.prototype.splice;var To=Co;var Io=Co;var ko=Co;function Ao(e){var t=this.__data__;return!((e=Eo(t,e))<0||(e==t.length-1?t.pop():So.call(t,e,1),--this.size,0))}function Po(e){var t=this.__data__;return(e=To(t,e))<0?void 0:t[e][1]}function Oo(e){return-1<Io(this.__data__,e)}function Ro(e,t){var o=this.__data__,r=ko(o,e);return r<0?(++this.size,o.push([e,t])):o[r][1]=t,this}function xo(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}xo.prototype.clear=function(){this.__data__=[],this.size=0},xo.prototype.delete=Ao,xo.prototype.get=Po,xo.prototype.has=Oo,xo.prototype.set=Ro;var r=xo,Mo=r;function No(){this.__data__=new Mo,this.size=0}function Lo(e){var t=this.__data__,e=t.delete(e);return this.size=t.size,e}function Do(e){return this.__data__.get(e)}function qo(e){return this.__data__.has(e)}var o="object"==typeof e&&e&&e.Object===Object&&e,e="object"==typeof self&&self&&self.Object===Object&&self,e=o||e||Function("return this")(),Uo=e.Symbol,n=Object.prototype,jo=n.hasOwnProperty,Ho=n.toString,Bo=Uo?Uo.toStringTag:void 0;var Fo=Object.prototype.toString;var zo=function(e){var t=jo.call(e,Bo),o=e[Bo];try{var r=!(e[Bo]=void 0)}catch(e){}var n=Ho.call(e);return r&&(t?e[Bo]=o:delete e[Bo]),n},Ko=function(e){return Fo.call(e)},Go=Uo?Uo.toStringTag:void 0;function Yo(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(Go&&Go in Object(e)?zo:Ko)(e)}function Wo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var Zo=Yo,Qo=Wo;function Vo(e){return!!Qo(e)&&("[object Function]"==(e=Zo(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}var n=e["__core-js_shared__"],Jo=(n=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";var Xo=Function.prototype.toString;function $o(e){if(null!=e){try{return Xo.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var er=Vo,tr=function(e){return!!Jo&&Jo in e},or=Wo,rr=$o,nr=/^\[object .+?Constructor\]$/,n=Function.prototype,ir=Object.prototype,n=n.toString,ir=ir.hasOwnProperty,ar=RegExp("^"+n.call(ir).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var sr=function(e){return!(!or(e)||tr(e))&&(er(e)?ar:nr).test(rr(e))},cr=function(e,t){return null==e?void 0:e[t]};function ur(e,t){return e=cr(e,t),sr(e)?e:void 0}var n=ur(e,"Map"),ir=ur(Object,"create"),lr=ir;var hr=ir,dr=Object.prototype.hasOwnProperty;var pr=ir,fr=Object.prototype.hasOwnProperty;var gr=ir;function mr(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}function yr(e){var t,o=this.__data__;return hr?"__lodash_hash_undefined__"===(t=o[e])?void 0:t:dr.call(o,e)?o[e]:void 0}function vr(e){var t=this.__data__;return pr?void 0!==t[e]:fr.call(t,e)}function _r(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=gr&&void 0===t?"__lodash_hash_undefined__":t,this}function wr(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}wr.prototype.clear=function(){this.__data__=lr?lr(null):{},this.size=0},wr.prototype.delete=mr,wr.prototype.get=yr,wr.prototype.has=vr,wr.prototype.set=_r;var br=wr,Cr=r,Er=n;var Sr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};function Tr(e,t){return e=e.__data__,Sr(t)?e["string"==typeof t?"string":"hash"]:e.map}var Ir=Tr;var kr=Tr;var Ar=Tr;var Pr=Tr;function Or(e){return e=Ir(this,e).delete(e),this.size-=e?1:0,e}function Rr(e){return kr(this,e).get(e)}function xr(e){return Ar(this,e).has(e)}function Mr(e,t){var o=Pr(this,e),r=o.size;return o.set(e,t),this.size+=o.size==r?0:1,this}function Nr(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var r=e[t];this.set(r[0],r[1])}}Nr.prototype.clear=function(){this.size=0,this.__data__={hash:new br,map:new(Er||Cr),string:new br}},Nr.prototype.delete=Or,Nr.prototype.get=Rr,Nr.prototype.has=xr,Nr.prototype.set=Mr;var ir=Nr,Lr=r,Dr=n,qr=ir;function Ur(e,t){var o=this.__data__;if(o instanceof Lr){var r=o.__data__;if(!Dr||r.length<199)return r.push([e,t]),this.size=++o.size,this;o=this.__data__=new qr(r)}return o.set(e,t),this.size=o.size,this}var jr=r,r=Lo,Hr=Do,i=qo;function Br(e){e=this.__data__=new jr(e);this.size=e.size}Br.prototype.clear=No,Br.prototype.delete=r,Br.prototype.get=Hr,Br.prototype.has=i,Br.prototype.set=Ur;r=Br;function Fr(e,t){for(var o=-1,r=null==e?0:e.length;++o<r&&!1!==t(e[o],o,e););return e}var zr=ur,Hr=function(){try{var e=zr(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kr=Hr;function Gr(e,t,o){"__proto__"==t&&Kr?Kr(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}var Yr=Gr,Wr=wo,Zr=Object.prototype.hasOwnProperty;function Qr(e,t,o){var r=e[t];Zr.call(e,t)&&Wr(r,o)&&(void 0!==o||t in e)||Yr(e,t,o)}var Vr=Qr,Jr=Gr;function Xr(e,t,o,r){for(var n=!o,i=(o=o||{},-1),a=t.length;++i<a;){var s=t[i],c=r?r(o[s],e[s],s,o,e):void 0;void 0===c&&(c=e[s]),(n?Jr:Vr)(o,s,c)}return o}function $r(e,t){for(var o=-1,r=Array(e);++o<e;)r[o]=t(o);return r}function en(e){return null!=e&&"object"==typeof e}var tn=Yo,on=en;var i=function(e){return on(e)&&"[object Arguments]"==tn(e)},rn=en,nn=Object.prototype,an=nn.hasOwnProperty,sn=nn.propertyIsEnumerable,nn=i(function(){return arguments}())?i:function(e){return rn(e)&&an.call(e,"callee")&&!sn.call(e,"callee")},i=Array.isArray,cn={exports:{}};Cn=(Cn=(bn=cn).exports)&&!Cn.nodeType&&Cn,un=(un=Cn&&bn&&!bn.nodeType&&bn)&&un.exports===Cn?e.Buffer:void 0,Cn=un?un.isBuffer:void 0,bn.exports=Cn||function(){return!1};var un=cn.exports,ln=/^(?:0|[1-9]\d*)$/;function hn(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&ln.test(e))&&-1<e&&e%1==0&&e<t}function dn(e){return"number"==typeof e&&-1<e&&e%1==0&&e<=9007199254740991}var pn=Yo,fn=dn,gn=en,mn={};mn["[object Float32Array]"]=mn["[object Float64Array]"]=mn["[object Int8Array]"]=mn["[object Int16Array]"]=mn["[object Int32Array]"]=mn["[object Uint8Array]"]=mn["[object Uint8ClampedArray]"]=mn["[object Uint16Array]"]=mn["[object Uint32Array]"]=!0,mn["[object Arguments]"]=mn["[object Array]"]=mn["[object ArrayBuffer]"]=mn["[object Boolean]"]=mn["[object DataView]"]=mn["[object Date]"]=mn["[object Error]"]=mn["[object Function]"]=mn["[object Map]"]=mn["[object Number]"]=mn["[object Object]"]=mn["[object RegExp]"]=mn["[object Set]"]=mn["[object String]"]=mn["[object WeakMap]"]=!1;function yn(e){return gn(e)&&fn(e.length)&&!!mn[pn(e)]}function vn(t){return function(e){return t(e)}}var _n,wn,bn={exports:{}},o=(cn=(cn=(Cn=bn).exports)&&!cn.nodeType&&cn,_n=cn&&Cn&&!Cn.nodeType&&Cn,wn=_n&&_n.exports===cn&&o.process,cn=function(){try{var e=_n&&_n.require&&_n.require("util").types;return e?e:wn&&wn.binding&&wn.binding("util")}catch(e){}}(),Cn.exports=cn,bn.exports),Cn=yn,cn=vn,bn=o&&o.isTypedArray,cn=bn?cn(bn):Cn,En=$r,Sn=nn,Tn=i,In=un,kn=hn,An=cn,Pn=Object.prototype.hasOwnProperty;function On(e,t){var o,r=Tn(e),n=!r&&Sn(e),i=!r&&!n&&In(e),a=!r&&!n&&!i&&An(e),s=r||n||i||a,c=s?En(e.length,String):[],u=c.length;for(o in e)!t&&!Pn.call(e,o)||s&&("length"==o||i&&("offset"==o||"parent"==o)||a&&("buffer"==o||"byteLength"==o||"byteOffset"==o)||kn(o,u))||c.push(o);return c}var Rn=Object.prototype;function xn(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Rn)}function Mn(t,o){return function(e){return t(o(e))}}var bn=Mn(Object.keys,Object),Nn=xn,Ln=bn,Dn=Object.prototype.hasOwnProperty;var qn=Vo,Un=dn;function jn(e){return null!=e&&Un(e.length)&&!qn(e)}var Hn=On,Bn=function(e){if(!Nn(e))return Ln(e);var t,o=[];for(t in Object(e))Dn.call(e,t)&&"constructor"!=t&&o.push(t);return o},Fn=jn;function zn(e){return(Fn(e)?Hn:Bn)(e)}var Kn=Xr,Gn=zn;function Yn(e,t){return e&&Kn(t,Gn(t),e)}var Wn=Wo,Zn=xn,Qn=function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t},Vn=Object.prototype.hasOwnProperty;var Jn=On,Xn=function(e){if(!Wn(e))return Qn(e);var t,o=Zn(e),r=[];for(t in e)("constructor"!=t||!o&&Vn.call(e,t))&&r.push(t);return r},$n=jn;function ei(e){return $n(e)?Jn(e,!0):Xn(e)}var ti=Xr,oi=ei;function ri(e,t){return e&&ti(t,oi(t),e)}var ni,Cn={exports:{}},ii=(ii=(ii=(bn=Cn).exports)&&!ii.nodeType&&ii,hi=(hi=ii&&bn&&!bn.nodeType&&bn)&&hi.exports===ii?e.Buffer:void 0,ni=hi?hi.allocUnsafe:void 0,bn.exports=function(e,t){return t?e.slice():(t=e.length,t=ni?ni(t):new e.constructor(t),e.copy(t),t)},Cn.exports);function ai(e,t){var o=-1,r=e.length;for(t=t||Array(r);++o<r;)t[o]=e[o];return t}function si(){return[]}var ci=function(e,t){for(var o=-1,r=null==e?0:e.length,n=0,i=[];++o<r;){var a=e[o];t(a,o,e)&&(i[n++]=a)}return i},ui=Object.prototype.propertyIsEnumerable,li=Object.getOwnPropertySymbols,hi=li?function(t){return null==t?[]:(t=Object(t),ci(li(t),function(e){return ui.call(t,e)}))}:si,di=Xr,pi=hi;function fi(e,t){return di(e,pi(e),t)}function gi(e,t){for(var o=-1,r=t.length,n=e.length;++o<r;)e[n+o]=t[o];return e}var bn=Mn(Object.getPrototypeOf,Object),mi=gi,yi=bn,vi=hi,Cn=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)mi(t,vi(e)),e=yi(e);return t}:si,_i=Xr,wi=Cn;function bi(e,t){return _i(e,wi(e),t)}var Ci=gi,Ei=i;function Si(e,t,o){return t=t(e),Ei(e)?t:Ci(t,o(e))}var Ti=Si,Ii=hi,ki=zn;function Ai(e){return Ti(e,ki,Ii)}var Pi=Si,Oi=Cn,Ri=ei;function xi(e){return Pi(e,Ri,Oi)}var hi=ur(e,"DataView"),Cn=n,n=ur(e,"Promise"),Mi=ur(e,"Set"),Ni=ur(e,"WeakMap"),Li=Yo,Di=$o,qi="[object Map]",Ui="[object Promise]",ji="[object Set]",Hi="[object WeakMap]",Bi="[object DataView]",Fi=Di(hi),zi=Di(Cn),Ki=Di(n),Gi=Di(Mi),Yi=Di(Ni),a=Li,hi=a=hi&&a(new hi(new ArrayBuffer(1)))!=Bi||Cn&&a(new Cn)!=qi||n&&a(n.resolve())!=Ui||Mi&&a(new Mi)!=ji||Ni&&a(new Ni)!=Hi?function(e){var t=Li(e),e="[object Object]"==t?e.constructor:void 0,e=e?Di(e):"";if(e)switch(e){case Fi:return Bi;case zi:return qi;case Ki:return Ui;case Gi:return ji;case Yi:return Hi}return t}:a,Wi=Object.prototype.hasOwnProperty;function Zi(e){var t=e.length,o=new e.constructor(t);return t&&"string"==typeof e[0]&&Wi.call(e,"index")&&(o.index=e.index,o.input=e.input),o}var Cn=e.Uint8Array,Qi=Cn;function Vi(e){var t=new e.constructor(e.byteLength);return new Qi(t).set(new Qi(e)),t}var Ji=Vi;var Xi=/\w*$/;var n=Uo?Uo.prototype:void 0,$i=n?n.valueOf:void 0;var ea=Vi;function ta(e,t){return t=t?ea(e.buffer):e.buffer,new e.constructor(t,e.byteOffset,e.length)}var oa=Vi,ra=function(e,t){return t=t?Ji(e.buffer):e.buffer,new e.constructor(t,e.byteOffset,e.byteLength)},na=function(e){var t=new e.constructor(e.source,Xi.exec(e));return t.lastIndex=e.lastIndex,t},ia=function(e){return $i?Object($i.call(e)):{}},aa=ta;function sa(e,t,o){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return oa(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return ra(e,o);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return aa(e,o);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return na(e);case"[object Set]":return new r;case"[object Symbol]":return ia(e)}}var ca=Wo,ua=Object.create;function la(){}var ha=function(e){if(!ca(e))return{};if(ua)return ua(e);la.prototype=e;e=new la;return la.prototype=void 0,e},da=bn,pa=xn;function fa(e){return"function"!=typeof e.constructor||pa(e)?{}:ha(da(e))}var ga=hi,ma=en;function ya(e){return ma(e)&&"[object Map]"==ga(e)}var Mi=vn,Ni=o&&o.isMap,a=Ni?Mi(Ni):ya,va=hi,_a=en;function wa(e){return _a(e)&&"[object Set]"==va(e)}var e=vn,n=o&&o.isSet,Mi=n?e(n):wa,ba=r,Ca=Fr,Ea=Qr,Sa=Yn,Ta=ri,Ia=ii,ka=ai,Aa=fi,Pa=bi,Oa=Ai,Ra=xi,xa=hi,Ma=Zi,Na=sa,La=fa,Da=i,qa=un,Ua=a,ja=Wo,Ha=Mi,Ba=zn,Fa=ei,za="[object Arguments]",Ka="[object Function]",Ga="[object Object]",Ya={};Ya[za]=Ya["[object Array]"]=Ya["[object ArrayBuffer]"]=Ya["[object DataView]"]=Ya["[object Boolean]"]=Ya["[object Date]"]=Ya["[object Float32Array]"]=Ya["[object Float64Array]"]=Ya["[object Int8Array]"]=Ya["[object Int16Array]"]=Ya["[object Int32Array]"]=Ya["[object Map]"]=Ya["[object Number]"]=Ya[Ga]=Ya["[object RegExp]"]=Ya["[object Set]"]=Ya["[object String]"]=Ya["[object Symbol]"]=Ya["[object Uint8Array]"]=Ya["[object Uint8ClampedArray]"]=Ya["[object Uint16Array]"]=Ya["[object Uint32Array]"]=!0,Ya["[object Error]"]=Ya[Ka]=Ya["[object WeakMap]"]=!1;function Wa(o,r,n,e,t,i){var a,s=1&r,c=2&r,u=4&r;if(void 0===(a=n?t?n(o,e,t,i):n(o):a)){if(!ja(o))return o;if(e=Da(o)){if(a=Ma(o),!s)return ka(o,a)}else{var l=xa(o),h=l==Ka||"[object GeneratorFunction]"==l;if(qa(o))return Ia(o,s);if(l==Ga||l==za||h&&!t){if(a=c||h?{}:La(o),!s)return c?Pa(o,Ta(a,o)):Aa(o,Sa(a,o))}else{if(!Ya[l])return t?o:{};a=Na(o,l,s)}}if(h=(i=i||new ba).get(o))return h;i.set(o,a),Ha(o)?o.forEach(function(e){a.add(Wa(e,r,n,e,o,i))}):Ua(o)&&o.forEach(function(e,t){a.set(t,Wa(e,r,n,t,o,i))});var d=e?void 0:(u?c?Ra:Oa:c?Fa:Ba)(o);Ca(d||o,function(e,t){d&&(e=o[t=e]),Ea(a,t,Wa(e,r,n,t,o,i))})}return a}var Za=Wa;var Qa=q(function(e){return Za(e,5)}),Va=Gr,Ja=wo;function Xa(e,t,o){(void 0===o||Ja(e[t],o))&&(void 0!==o||t in e)||Va(e,t,o)}var Ni=function(c){return function(e,t,o){for(var r=-1,n=Object(e),i=o(e),a=i.length;a--;){var s=i[c?a:++r];if(!1===t(n[s],s,n))break}return e}}(),$a=jn,es=en;function ts(e){return es(e)&&$a(e)}var os=Yo,rs=bn,ns=en,o=Function.prototype,e=Object.prototype,is=o.toString,as=e.hasOwnProperty,ss=is.call(Object);function cs(e){return!(!ns(e)||"[object Object]"!=os(e))&&(null===(e=rs(e))||"function"==typeof(e=as.call(e,"constructor")&&e.constructor)&&e instanceof e&&is.call(e)==ss)}function us(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ls=Xr,hs=ei;var ds=Xa,ps=ii,fs=ta,gs=ai,ms=fa,ys=nn,vs=i,_s=ts,ws=un,bs=Vo,Cs=Wo,Es=cs,Ss=cn,Ts=us,Is=function(e){return ls(e,hs(e))};var ks=r,As=Xa,Ps=Ni,Os=function(e,t,o,r,n,i,a){var s,c,u,l=Ts(e,o),h=Ts(t,o),d=a.get(h);d||((t=void 0===(d=i?i(l,h,o+"",e,t,a):void 0))&&(c=!(s=vs(h))&&ws(h),u=!s&&!c&&Ss(h),d=h,s||c||u?d=vs(l)?l:_s(l)?gs(l):c?ps(h,!(t=!1)):u?fs(h,!(t=!1)):[]:Es(h)||ys(h)?ys(d=l)?d=Is(l):Cs(l)&&!bs(l)||(d=ms(h)):t=!1),t&&(a.set(h,d),n(d,h,r,i,a),a.delete(h))),ds(e,o,d)},Rs=Wo,xs=ei,Ms=us;function Ns(e){return e}var Ls=function(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)},Ds=Math.max;var qs=function(e){return function(){return e}},Us=Hr,js=Date.now;var n=function(o){var r=0,n=0;return function(){var e=js(),t=16-(e-n);if(n=e,0<t){if(800<=++r)return arguments[0]}else r=0;return o.apply(void 0,arguments)}}(Us?function(e,t){return Us(e,"toString",{configurable:!0,enumerable:!1,value:qs(t),writable:!0})}:Ns),Hs=Ns,Bs=function(i,a,s){return a=Ds(void 0===a?i.length-1:a,0),function(){for(var e=arguments,t=-1,o=Ds(e.length-a,0),r=Array(o);++t<o;)r[t]=e[a+t];for(var t=-1,n=Array(a+1);++t<a;)n[t]=e[t];return n[a]=s(r),Ls(i,this,n)}},Fs=n;var zs=wo,Ks=jn,Gs=hn,Ys=Wo;var Ws=function(e,t){return Fs(Bs(e,t,Hs),e+"")},Zs=function(e,t,o){var r;return!!Ys(o)&&!!("number"==(r=typeof t)?Ks(o)&&Gs(t,o.length):"string"==r&&t in o)&&zs(o[t],e)};var Qs,Vs,Js=function r(n,i,a,s,c){n!==i&&Ps(i,function(e,t){var o;c=c||new ks,Rs(e)?Os(n,i,t,a,r,s,c):(o=s?s(Ms(n,t),e,t+"",n,i,c):void 0,As(n,t,o=void 0===o?e:o))},xs)},Xs=q(function(s){return Ws(function(e,t){var o=-1,r=t.length,n=1<r?t[r-1]:void 0,i=2<r?t[2]:void 0,n=3<s.length&&"function"==typeof n?(r--,n):void 0;for(i&&Zs(t[0],t[1],i)&&(n=r<3?void 0:n,r=1),e=Object(e);++o<r;){var a=t[o];a&&s(e,a,o,n)}return e})}(function(e,t,o){Js(e,t,o)})),$s=((window&&window.__extends||(Qs=function(e,t){return(Qs=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Qs(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(ec,Vs=ye),ec);function ec(){var e=null!==Vs&&Vs.apply(this,arguments)||this;return e.layout="icons",e.mapStyles=["road","grayscale_light","grayscale_dark","night","road_shaded_relief"],e.style=l.ControlStyle.light,e.autoSelectionMode=!0,e}var tc,oc,a=window&&window.__extends||(tc=function(e,t){return(tc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}tc(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),rc=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},nc=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},ic=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},Mi=(a(ac,oc=$t),ac.prototype.onAdd=function(e,t){function o(e){e?(n.classList.add(ac.Css.inUse),i.setAttribute("aria-hidden","false"),i.classList.remove("hidden-accessible-element")):(n.classList.remove(ac.Css.inUse),i.setAttribute("aria-hidden","true"),i.classList.add("hidden-accessible-element"))}var r=this,n=(this.map=e,this.buildContainer(e,this.options.style,"Map Style Control")),i=this.buildStyleOpsGrid(),a=(this.styleOpsGrid=i,this.buildCurrStyleBtn()),e=jt("Select Style");return i.classList.add(t&&t.position||"top-right"),n.addEventListener("mouseover",function(){r.hasMouse=!0,o(!0)}),n.addEventListener("focusin",function(){r.hasFocus=!0,o(!0)}),n.addEventListener("mouseleave",function(){r.hasMouse=!1,r.hasFocus||o(!1)}),n.addEventListener("focusout",function(e){e.target===a&&Array.from(i.children).forEach(function(e){return e.removeAttribute("tabIndex")}),e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||(r.hasFocus=!1,r.hasMouse)||o(!1)}),i.addEventListener("keydown",function(e){27===e.keyCode&&(e.stopPropagation(),a.focus(),Array.from(i.children).forEach(function(e){return e.setAttribute("tabIndex","-1")}),n.classList.contains(ac.Css.inUse))&&o(!1)}),a.addEventListener("click",function(e){n.classList.contains(ac.Css.inUse)?o(!1):(o(!0),i.firstElementChild&&i.firstElementChild.focus())}),t&&ac.InvertOrderPositions.includes(t.position)?(n.appendChild(i),n.appendChild(a),n.appendChild(e),Ht(e,a)):(n.appendChild(a),n.appendChild(e),Ht(e,a),n.appendChild(i)),n},ac.prototype.onRemove=function(){oc.prototype.onRemove.call(this),this.styleOpsGrid=null,this.styleButtons.clear(),this.thumbnailCache.response.clear(),this.thumbnailCache.blob.clear(),this.thumbnailCache.assumedConfiguration=void 0,this.map.events.remove("stylechanged",this.onStyleChange),this.map.events.remove("mapconfigurationchanged",this.onMapConfigurationChange)},ac.prototype.setSelectedStyle=function(o){var t,e,r=this;this.styleIcons.has(o)&&(t=this.currStyleImage,e=this.styleIcons.get(o),t.src!==e&&(t.src=e),Object.entries(this.styleButtons).forEach(function(e){var e=ic(e,2),t=e[0];return e[1].setAttribute("aria-current",t===o?"true":"false")}),this.map.styles.definitions().then(function(e){e=r.mapToFriendlyStyleName(o,e);t.alt!==e&&(t.alt=e),t.parentElement.lastChild instanceof Text&&(t.parentElement.lastChild.textContent=e)}))},ac.prototype.disableStyle=function(e){e=this.styleButtons[e];e&&e.setAttribute("disabled","true")},ac.prototype.enableStyle=function(e){e=this.styleButtons[e];e&&e.removeAttribute("disabled")},ac.prototype.buildSelectStyleBtn=function(o,e,t){var r=this,n=document.createElement("button"),i=this.mapToFriendlyStyleName(o,e),a=(n.setAttribute("aria-label",i),n.setAttribute("type","button"),new Image),e=(t.then(function(e){var t;return r.thumbnailCache.blob.has(e.url)?r.thumbnailCache.blob.get(e.url):(t=e.clone().blob(),r.thumbnailCache.blob.set(e.url,t),t)}).then(function(e){e=URL.createObjectURL(e);a.src=e,o===r.map.getStyle().style&&(r.currStyleImage.src=e,r.currStyleImage.alt=i,r.currStyleImage.parentElement.lastChild.nodeType==Node.TEXT_NODE?r.currStyleImage.parentElement.lastChild.textContent=i:r.currStyleImage.parentElement.appendChild(document.createTextNode(i))),r.styleIcons.set(o,e)}),a.setAttribute("aria-hidden","true"),n.appendChild(a),"icons"===this.options.layout?n.classList.add(ac.Css.button):(n.classList.add(ac.Css.listButton),n.classList.add(ac.Css.expanded),n.appendChild(document.createTextNode(i))),n.addEventListener("click",function(){r.hasMouse=!1,r.hasFocus=!1;var e=r.styleButtons[o];e&&!e.hasAttribute("disabled")&&(r._invokeEvent("styleselected",o),r.options.autoSelectionMode&&r.map.setStyle({style:o}),Object.entries(r.styleButtons).forEach(function(e){var e=ic(e,2),t=e[0];return e[1].setAttribute("aria-current",t===o?"true":"false")}))}),document.createElement("div"));return e.classList.add("selected-icon"),n.appendChild(e),n},ac.prototype.buildCurrStyleBtn=function(){var e=document.createElement("button"),t=("icons"==this.options.layout?e.classList.add(ac.Css.button):e.classList.add(ac.Css.listButton),e.classList.add(ac.Css.currentStyle),e.setAttribute("aria-label","Select Style"),e.setAttribute("tabindex","-1"),this.currStyleImage=new Image,e.appendChild(this.currStyleImage),document.createElement("div"));return t.classList.add("icon"),e.appendChild(t),e},ac.prototype.buildStyleOpsGrid=function(){var e=this,t=document.createElement("div");return t.classList.add(ac.Css.styleOptions),"icons"===this.options.layout?t.classList.add(this.options.layout):t.classList.add(ac.Css.dropdown),t.setAttribute("aria-label","Style Options"),t.classList.add("hidden-accessible-element"),t.setAttribute("aria-hidden","true"),this.map.styles.definitions().then(function(t){return rc(e,void 0,void 0,function(){return nc(this,function(e){return this.onMapConfigurationChange(t),this.map.events.add("stylechanged",this.onStyleChange),[2]})})}),this.map.events.add("mapconfigurationchanged",this.onMapConfigurationChange),t},ac.prototype.populateOpsGridFromDefinitions=function(n){var e,o,i=this;this.styleOpsGrid&&(e=n.configurations,(e=Array.isArray(this.options.mapStyles)?e.filter(function(e){return i.options.mapStyles.includes(e.name.split("_indoor")[0])}):e).forEach(function(e){var t,o={url:e.thumbnail},r=(e.thumbnail&&i.map.styles._transformStyleRequest(e.thumbnail,o),i.map.getServiceOptions()),r=(r.transformRequest&&Xs(o,r.transformRequest(o.url,"Thumbnail")),i.thumbnailCache.response.has(o.url)?t=Promise.resolve(i.thumbnailCache.response.get(o.url)):(t=fetch(o.url,{headers:o.headers}),i.thumbnailCache.response.set(o.url,t)),i.buildSelectStyleBtn(e.name,n,t));i.styleOpsGrid.appendChild(r),i.styleButtons[e.name]=r,"icons"===i.options.layout&&(o=jt(i.mapToFriendlyStyleName(e.name,n)),i.styleOpsGrid.appendChild(o),Ht(o,r))}),o=this.map.getStyle().style,Object.entries(this.styleButtons).forEach(function(e){var e=ic(e,2),t=e[0];return e[1].setAttribute("aria-current",t===o?"true":"false")}))},ac.InvertOrderPositions=[l.ControlPosition.TopRight,l.ControlPosition.BottomRight],ac.Css={button:"azure-maps-control-button",listButton:"azure-maps-control-list-button",expanded:"expanded",currentStyle:"curr-style",inUse:"in-use",styleOptions:"style-options",dropdown:"azure-maps-control-dropdown"},ac);function ac(e){var t=oc.call(this)||this;return t.styleOpsGrid=null,t.hasMouse=!1,t.hasFocus=!1,t.styleButtons=new Zt,t.styleIcons=new Zt,t.thumbnailCache={assumedConfiguration:void 0,response:new Zt,blob:new Zt},t.onStyleChange=function(){var e;t.options.autoSelectionMode&&(e=t.map.getStyle().style,t.setSelectedStyle(e))},t.onMapConfigurationChange=function(e){!t.styleOpsGrid||0<t.styleOpsGrid.children.length&&t.thumbnailCache.assumedConfiguration===e||(t.thumbnailCache.assumedConfiguration=e,Array.from(t.styleOpsGrid.children).forEach(function(e){return e.remove()}),t.styleButtons.clear(),t.populateOpsGridFromDefinitions(e))},t.mapToFriendlyStyleName=function(t,e){e=e.configurations.find(function(e){return e.name===t});return(null==e?void 0:e.displayName)||t},t.options=(new $s).merge(Qa(e)),t}(window&&window.__extends||(sc=function(e,t){return(sc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}sc(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(lc,cc=ye);var sc,cc,uc=lc;function lc(){var e=null!==cc&&cc.apply(this,arguments)||this;return e.flow="none",e.incidents=!1,e}(window&&window.__extends||(hc=function(e,t){return(hc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}hc(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(fc,dc=uc);var hc,dc,pc=fc;function fc(){var e=null!==dc&&dc.apply(this,arguments)||this;return e.isActive=!1,e.style=l.ControlStyle.light,e}(window&&window.__extends||(gc=function(e,t){return(gc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gc(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(vc,mc=$t),Object.defineProperty(vc.prototype,"isActive",{get:function(){var e;return!!this.map&&("none"!==(e=this.map.getTraffic()).flow||e.incidents)},set:function(e){this.map&&this.map.setTraffic({flow:e?this.options.flow:"none",incidents:!!e&&this.options.incidents})},enumerable:!1,configurable:!0}),vc.prototype.onAdd=function(e){(this.map=e).getTraffic(),void 0!==this.initIsActive&&(this.isActive=this.initIsActive),this.container=this.buildContainer(e,this.style,"Traffic Control"),this.container.style.flexDirection="column";var e=this.constructTrafficButton(e),t=(this.container.appendChild(e),jt("Toggle Traffic Display"));return this.container.appendChild(t),Ht(t,e),this.container},vc.prototype.onRemove=function(){mc.prototype.onRemove.call(this),this.map=null},vc.prototype.getOptions=function(){return(new pc).merge({isActive:this.isActive,flow:this.options.flow,incidents:this.options.incidents,style:this.style})},vc.prototype.updateButtonState=function(){this.trafficButton&&(this.isActive?(this.container.classList.add("in-use"),this.trafficButton.setAttribute("aria-description","Traffic is displayed")):(this.container.classList.remove("in-use"),this.trafficButton.removeAttribute("aria-description")),this.trafficButton.setAttribute("aria-pressed",this.isActive?"true":"false"))},vc.prototype.constructTrafficButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("azure-maps-control-button"),o.classList.add("traffic"),o.setAttribute("aria-label","Toggle Traffic Display"),o.setAttribute("alt","Toggle Traffic Display"),o.setAttribute("type","button"),this.trafficButton=o,this.updateButtonState(),o.addEventListener("click",function(){t.isActive=!t.isActive}),o};var gc,mc,yc=vc;function vc(e){var t,o=this;return(o=mc.call(this)||this).hasMouse=!1,o.hasFocus=!1,o.options=(new uc).merge({flow:"relative",incidents:!0}),o.style=l.ControlStyle.light,o.container=null,o.trafficButton=null,o.map=null,e&&(o.initIsActive=null!=(t=e.isActive)&&t,o.options.flow=e.flow||"relative",o.options.incidents=null==(t=e.incidents)||t,o.style=e.style||l.ControlStyle.light),o}var _c,wc,bn=window&&window.__extends||(_c=function(e,t){return(_c=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}_c(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),bc=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=(bn(Cc,wc=$t),Cc.prototype.onAdd=function(e){this.map=e;var t=this.buildContainer(e,l.ControlStyle.auto,"Traffic Legend"),e=this.buildTrafficLegendDiv(e);return t.setAttribute("role","definition"),t.appendChild(e),t},Cc.prototype.onRemove=function(){wc.prototype.onRemove.call(this),this.syncHiddenState&&(this.map.events.remove("styledata",this.syncHiddenState),this.syncHiddenState=null),this.map=null},Cc.prototype.buildTrafficLegendDiv=function(t){var o,e,r,n,i=document.createElement("div"),a=(i.classList.add("traffic-legend","hidden"),i.setAttribute("alt","Traffic Legend"),document.createElement("table")),s=document.createElement("tr"),c=document.createElement("td"),u=(c.setAttribute("alt","Traffic"),c.appendChild(document.createTextNode("Traffic")),jt("Traffic")),l=(c.classList.add("traffic-legend-title"),c.colSpan=6,s.appendChild(c),s.appendChild(u),Ht(u,c),a.appendChild(s),document.createElement("tr"));try{for(var h=bc(this.table),d=h.next();!d.done;d=h.next()){var p=d.value,f=document.createElement("td");if("Fast"===p||"Slow"===p)f.setAttribute("alt",p),f.appendChild(document.createTextNode(p)),f.classList.add("traffic-legend-text");else{f.classList.add("traffic-legend-colors"),f.setAttribute("aria-label","Traffic Legend"),f.setAttribute("role","img");try{r=void 0;for(var g=bc(p),m=g.next();!m.done;m=g.next()){var y=m.value,v=document.createElement("div");v.classList.add(y),f.appendChild(v)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}}l.appendChild(f);var _=jt(p instanceof Array?"Traffic Legend":p);l.appendChild(_),Ht(_,f)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(e=h.return)&&e.call(h)}finally{if(o)throw o.error}}return a.appendChild(l),i.appendChild(a),this.syncHiddenState=function(e){"style"===e.dataType&&((e=t.getTraffic()).flow&&"none"!==e.flow?i.classList.remove("hidden"):i.classList.add("hidden"))},this.syncHiddenState({dataType:"style"}),t.events.add("styledata",this.syncHiddenState),i},Cc);function Cc(){var e=wc.call(this)||this;return e.table=["Fast",["green","yellow","red","dark-red"],"Slow"],e.map=null,e.syncHiddenState=null,e}function Ec(e){return this.__data__.has(e)}var Sc=ir;function Tc(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new Sc;++t<o;)this.add(e[t])}Tc.prototype.add=Tc.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Tc.prototype.has=Ec;var Ic=Tc,kc=function(e,t){for(var o=-1,r=null==e?0:e.length;++o<r;)if(t(e[o],o,e))return!0;return!1},Ac=function(e,t){return e.has(t)};function Pc(e,t,o,r,n,i){var a=1&o,s=e.length,c=t.length;if(s!=c&&!(a&&s<c))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var l=-1,h=!0,d=2&o?new Ic:void 0;for(i.set(e,t),i.set(t,e);++l<s;){var p,f=e[l],g=t[l];if(void 0!==(p=r?a?r(g,f,l,t,e,i):r(f,g,l,e,t,i):p)){if(p)continue;h=!1;break}if(d){if(!kc(t,function(e,t){if(!Ac(d,t)&&(f===e||n(f,e,o,r,i)))return d.push(t)})){h=!1;break}}else if(f!==g&&!n(f,g,o,r,i)){h=!1;break}}return i.delete(e),i.delete(t),h}function Oc(e){var o=-1,r=Array(e.size);return e.forEach(function(e,t){r[++o]=[t,e]}),r}function Rc(e){var t=-1,o=Array(e.size);return e.forEach(function(e){o[++t]=e}),o}var xc=Cn,Mc=wo,Nc=Pc,e=Uo?Uo.prototype:void 0,Lc=e?e.valueOf:void 0;var Dc=Ai,qc=Object.prototype.hasOwnProperty;var Uc=r,jc=Pc,Hc=function(e,t,o,r,n,i,a){switch(o){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return e.byteLength==t.byteLength&&i(new xc(e),new xc(t))?!0:!1;case"[object Boolean]":case"[object Date]":case"[object Number]":return Mc(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Oc;case"[object Set]":s=s||Rc;if(e.size!=t.size&&!(1&r))return!1;var c=a.get(e);if(c)return c==t;r|=2,a.set(e,t);c=Nc(s(e),s(t),r,n,i,a);return a.delete(e),c;case"[object Symbol]":if(Lc)return Lc.call(e)==Lc.call(t)}return!1},Bc=function(e,t,o,r,n,i){var a=1&o,s=Dc(e),c=s.length;if(c!=Dc(t).length&&!a)return!1;for(var u=c;u--;){var l=s[u];if(!(a?l in t:qc.call(t,l)))return!1}var h=i.get(e),d=i.get(t);if(h&&d)return h==t&&d==e;for(var p=!0,f=(i.set(e,t),i.set(t,e),a);++u<c;){var g,m=e[l=s[u]],y=t[l];if(!(void 0===(g=r?a?r(y,m,l,t,e,i):r(m,y,l,e,t,i):g)?m===y||n(m,y,o,r,i):g)){p=!1;break}f=f||"constructor"==l}return p&&!f&&(h=e.constructor)!=(d=t.constructor)&&"constructor"in e&&"constructor"in t&&!("function"==typeof h&&h instanceof h&&"function"==typeof d&&d instanceof d)&&(p=!1),i.delete(e),i.delete(t),p},Fc=hi,zc=i,Kc=un,Gc=cn,Yc="[object Arguments]",Wc="[object Array]",Zc="[object Object]",Qc=Object.prototype.hasOwnProperty;var Vc=function(e,t,o,r,n,i){var a=zc(e),s=zc(t),c=a?Wc:Fc(e),s=s?Wc:Fc(t),u=(c=c==Yc?Zc:c)==Zc,l=(s=s==Yc?Zc:s)==Zc;if((s=c==s)&&Kc(e)){if(!Kc(t))return!1;u=!(a=!0)}if(s&&!u)return i=i||new Uc,a||Gc(e)?jc(e,t,o,r,n,i):Hc(e,t,c,o,r,n,i);if(!(1&o)){a=u&&Qc.call(e,"__wrapped__"),c=l&&Qc.call(t,"__wrapped__");if(a||c)return n(a?e.value():e,c?t.value():t,o,r,i=i||new Uc)}return s&&(i=i||new Uc,Bc(e,t,o,r,n,i))},Jc=en;var Xc=function e(t,o,r,n,i){return t===o||(null==t||null==o||!Jc(t)&&!Jc(o)?t!=t&&o!=o:Vc(t,o,r,n,e,i))};var $c=q(function(e,t){return Xc(e,t)}),eu=(tu.TYPE="Feature",tu);function tu(e,t,o,r){this.type="Feature",this.type=tu.TYPE,this.properties=t||{},this.id=o,this.geometry=e,this.bbox=r}var ou,ru,ii=window&&window.__extends||(ou=function(e,t){return(ou=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ou(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),nu=(ru=Array,ii(iu,ru),iu.fromData=function(o){var r=NaN,n=NaN,i=new Set(["y"]),a=new Set(["x"]);return Object.keys(o).forEach(function(e){var t=e.toLowerCase();isNaN(r)&&i.has(t)&&"number"==typeof o[e]?r=o[e]:isNaN(n)&&a.has(t)&&"number"==typeof o[e]&&(n=o[e])}),isNaN(r)||isNaN(n)?null:new iu(r,n)},iu.getX=function(e){return 0<e.length?e[0]:NaN},iu.getY=function(e){return 1<e.length?e[1]:NaN},iu.getDestination=function(e,t,o){return new iu(iu.getX(e)+o*Math.cos((t+270)*Math.PI/180),iu.getY(e)+o*Math.sin((t+270)*Math.PI/180))},iu.getDistance=function(e,t){var o=iu.getX(e)-iu.getX(t),e=iu.getY(e)-iu.getY(t);return Math.sqrt(o*o+e*e)},iu.getHeading=function(e,t){var o=iu.getX(t)-iu.getX(e),e=iu.getY(e)-iu.getY(t);return 180*(2.5*Math.PI-Math.atan2(e,o))/Math.PI%360},iu);function iu(e,t){return ru.call(this,e,t)||this}su.TYPE="Point";var au=su;function su(e){this.type="Point",this.type=su.TYPE,this.coordinates=e}var cu,uu,lu,hu,du,pu=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},fu=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},gu=6378137,mu=Math.PI/180,yu=180/Math.PI,vu=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9],_u=85.0511;function wu(e){return e*mu}function bu(e){return e*yu}function Cu(e,t,o){return Math.min(Math.max(e,t),o)}function Eu(e,t){var o=wu(t[1]-e[1]),r=wu(t[0]-e[0]),o=Math.pow(Math.sin(o/2),2)+Math.cos(wu(e[1]))*Math.cos(wu(t[1]))*Math.pow(Math.sin(r/2),2),e=2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o));return Math.round(gu*e*100)/100}function Su(e){if(e)switch(e.toLowerCase()){case"feet":case"foot":case"ft":return uu.feet;case"kilometers":case"kilometer":case"kilometres":case"kilometre":case"km":case"kms":return uu.kilometers;case"miles":case"mile":case"mi":return uu.miles;case"nauticalmiles":case"nauticalmile":case"nms":case"nm":return uu.nauticalMiles;case"yards":case"yard":case"yds":case"yrd":case"yrds":return uu.yards;default:return uu.meters}return uu.meters}function Tu(e){if(e)switch(e.toLowerCase()){case"milespersecondsquared":case"milepersecondsquared":case"mi/s^2":case"mi/s2":return du.milesPerSecondSquared;case"kilometerspersecondsquared":case"kilometrespersecondsquared":case"kilometerpersecondsquared":case"kilometrepersecondsquared":case"km/s^2":case"km/s2":return du.kilometersPerSecondSquared;case"knotspersecond":case"knotpersecond":case"knts/s":case"kn/s":case"kt/s":return du.knotsPerSecond;case"standardgravity":case"g":return du.standardGravity;case"feetpersecondsquared":case"footpersecondsquared":case"ft/s^2":case"ft/s2":return du.feetPerSecondSquared;case"yardspersecondsquared":case"yardpersecondsquared":case"yds/s^2":case"yds/s2":case"yd/s^2":case"yd/s2":return du.yardsPerSecondSquared;case"milesperhoursecond":case"mileperhoursecond":case"milesperhourseconds":case"mileperhourseconds":case"mi/h/s":return du.milesPerHourSecond;case"kilometersperhoursecond":case"kilometrespersoursecond":case"kilometerperhoursecond":case"kilometrepersoursecond":case"kilometersperhourssecond":case"kilometrespersourssecond":case"kilometerperhourssecond":case"kilometrepersourssecond":case"kmhs":case"km/h/s":return du.kilometersPerHourSecond;default:return du.metersPerSecondSquared}return du.metersPerSecondSquared}function Iu(e){if(e)switch(e){case"acres":case"ac":return cu.acres;case"hectares":case"ha":return cu.hectares;case"squareFeet":case"ft^2":case"ft2":return cu.squareFeet;case"squareYards":case"squareYard":case"yds^2":case"yds2":case"yd^2":case"yd2":return cu.squareYards;case"squareKilometers":case"squareKilometres":case"squareKilometer":case"squareKilometre":case"km^2":case"km2":return cu.squareKilometers;case"squareMiles":case"squareMile":case"mi^2":case"mi2":return cu.squareMiles;default:return cu.squareMeters}return cu.squareMeters}function ku(e){if(e)switch(e.toLowerCase()){case"feetpersecond":case"footsecond":case"ftps":case"ft/s":return hu.feetPerSecond;case"milesperhour":case"mileperhour":case"mph":case"mi/hr":case"mi/h":return hu.milesPerHour;case"knots":case"knot":case"knts":case"knt":case"kn":case"kt":return hu.knots;case"mach":case"m":return hu.mach;case"kilometersperhour":case"kilometresperhour":case"kmperhour":case"kmph":case"km/hr":case"km/h":return hu.kilometersPerHour;default:return hu.metersPerSecond}return hu.metersPerSecond}function Au(e){if(e)switch(e.toLowerCase()){case"milliseconds":case"ms":return lu.ms;case"minutes":case"minute":case"mins":case"min":return lu.minutes;case"hours":case"hour":case"hr":case"h":return lu.hours;case"days":case"day":case"d":return lu.days;default:return lu.seconds}return lu.seconds}function Pu(e){var t=0;if(e&&0<e.length)for(var t=Math.abs(Ou(e[0])),o=1,r=e.length;o<r;o++)t-=Math.abs(Ou(e[o]));return t}function Ou(e){var t=0;if(3<=e.length){for(var o=void 0,r=void 0,n=0,i=e.length;n<i;n++)t+=(wu(e[n===i-2?(o=i-2,r=i-1,0):n===i-1?(o=i-1,r=0,1):(r=(o=n)+1,n+2)][0])-wu(e[o][0]))*Math.sin(wu(e[r][1]));t=t*gu*gu/2}return t}function Ru(e,t,o){return(e[0]-o[0])*(t[1]-o[1])-(e[1]-o[1])*(t[0]-o[0])}function xu(e,t,o){if(2<=o.length){for(var r,n,i,a=1/0,s=null,c=Ju(o,22),u=0,l=c.length-1;u<l;u++)n=function(e,t,o){if(t[0]===o[0]&&t[1]===o[1])return t;var r=e[0]-t[0],e=e[1]-t[1],n=o[0]-t[0],i=o[1]-t[1],r=(n*r+i*e)/(n*n+i*i);return r<0?t:1<r?o:[t[0]+n*r,t[1]+i*r]}(t,c[u],c[u+1]),(r=nu.getDistance(t,n))<a&&(a=r,s=n);if(s)return i=Vu([s],22)[0],new eu(new au(i),{distance:Du(e,i)})}else if(1===o.length)return new eu(new au(o[0]),{distance:Du(e,o[0])});return null}function Mu(e,t){var o;return!isNaN(e)&&"number"==typeof t&&0<=t&&(o=void 0,o=t<vu.length?vu[t]:Math.pow(10,t),e=Math.round(e*o)/o),e}function Nu(e,t,o,r){switch(Su(t)){case uu.meters:e/=1e3;break;case uu.feet:e/=3280.8399;break;case uu.miles:e/=.62137119;break;case uu.yards:e/=1093.6133;break;case uu.nauticalMiles:e/=.5399568;break;case uu.kilometers:}switch(Su(o)){case uu.meters:e*=1e3;break;case uu.feet:e*=3280.8399;break;case uu.miles:e*=.62137119;break;case uu.yards:e*=1093.6133;break;case uu.nauticalMiles:e*=.5399568;break;case uu.kilometers:}return"number"==typeof r&&0<=r&&(t=Math.pow(10,r),e=Math.round(e*t)/t),e}function Lu(e,t,o,r){r=r||"meters",e=sl(e);var r=qu(r),n=wu(e[1]),e=wu(e[0]),t=t*mu,o=o/r,r=Math.asin(Math.sin(n)*Math.cos(o)+Math.cos(n)*Math.sin(o)*Math.cos(t)),e=e+Math.atan2(Math.sin(t)*Math.sin(o)*Math.cos(n),Math.cos(o)-Math.sin(n)*Math.sin(r)),t=Cu(Wu(r*yu),-85,85);return[Zu(e*yu),t]}function Du(e,t,o){e=Eu(e=sl(e),t=sl(t));return"meters"===o?e:Nu(e,"meters",o||"meters")}function qu(e){e=Su(e);return Nu(gu,uu.meters,e)}function Uu(e,t,o){for(var r=[],n=wu(e[1]),i=wu(e[0]),a=wu(t[1]),s=wu(t[0]),c=2*Math.asin(Math.sqrt(Math.pow(Math.sin((n-a)/2),2)+Math.cos(n)*Math.cos(a)*Math.pow(Math.sin((i-s)/2),2))),u=0;u<=o;u++){var l=u/o,h=Math.sin((1-l)*c)/Math.sin(c),l=Math.sin(l*c)/Math.sin(c),d=h*Math.cos(n)*Math.cos(i)+l*Math.cos(a)*Math.cos(s),p=h*Math.cos(n)*Math.sin(i)+l*Math.cos(a)*Math.sin(s),h=h*Math.sin(n)+l*Math.sin(a),l=Math.atan2(h,Math.sqrt(Math.pow(d,2)+Math.pow(p,2))),h=Math.atan2(p,d),l=Cu(l*yu,-85,85);r.push([h*=yu,l])}return r}function ju(e){return(Array.isArray(e)?e:e.coordinates).reduce(function(e,t){var o=0<e.length?e[e.length-1]:null;return o&&180<Math.abs(t[0]-o[0])?(o=o[0]<0?t[0]-360:t[0]+360,e.push([o,t[1]])):e.push(t),e},[])}function Hu(e){for(var t,o,r,n,i,a=Array.isArray(e)?e:e.coordinates,s=[],c=[],u=0;u<a.length;u++)s.push(a[u]),u+1>=a.length||(t=(o=pu(a[u],2))[0],o=o[1],n=(i=pu(a[u+1],2))[0],i=i[1],180<Math.abs(n-t)&&(r=0<t?180:-180,n=Math.abs((0<t?n+360:n-360)-t),i=o+(i-o)*(Math.abs(r-t)/n),s.push([r,i]),c.push(s),s=[[-r,i]]));return c.push(s),c}function Bu(e,t){var o,r;return e=sl(e),t=sl(t),e&&2<=e.length&&t&&2<=t.length?(r=wu(e[1]),o=wu(t[1]),t=wu(t[0]-e[0]),e=Math.sin(t)*Math.cos(o),r=Math.cos(r)*Math.sin(o)-Math.sin(r)*Math.cos(o)*Math.cos(t),(bu(Math.atan2(e,r))+360)%360):NaN}function Fu(e,t){var o,r=0;Array.isArray(e)?o=e:e.type&&"LineString"===e.type&&(o=e.coordinates);for(var n=0,i=o.length-1;n<i;n++)r+=Eu(o[n],o[n+1]);return Nu(r,"meters",t||"meters")}function zu(e,t,o){o=o||"meters";var r,n=0;if(Array.isArray(e)?r=e:e.type&&"LineString"===e.type&&(r=e.coordinates),2<=r.length){for(var i,a,s=r.length,c=1;c<s;c++){if(t<=n+(a=Du(r[c-1],r[c],o)))return i=Bu(r[c-1],r[c]),Lu(r[c-1],i,t-n,o);n+=a}return n<=t?r[s-1]:r[0]}return null}function Ku(e,t,o,r,n){r=r||"meters",n=n||0,e=sl(e);for(var i=[],a=360/o,s=0;s<=o;s++)i.push(Lu(e,(s*a+n)%360,t,r));return i}function Gu(e,t,o,r,n){return ju(Ku(e,t,o,r,n))}function Yu(e,t,o){o=void 0===o?.5:o;var r=Du(e=sl(e),t=sl(t),"kilometers");return Lu(e,Bu(e,t),r*o,"kilometers")}function Wu(e){return 90<e?180<(e=(e+90)%360)?90-(e-180):e-90:e<-90?(e=(e-90)%360)<-180?-90-(e+180):e+90:e}function Zu(e){return 180<e?(e+180)%360-180:e<-180?(e-180)%360+180:e}function Qu(e,t,o){if(0===o)return Object.assign({},e);t=sl(t);for(var r,n,i=[],a=0,s=e.length;a<s;a++)r=Du(t,e[a]),n=Bu(t,e[a]),i.push(Lu(t,n+o,r));return i}function Vu(e,t){for(var o,r,n=512*Math.pow(2,t),i=[],a=0,s=e.length;a<s;a++)o=e[a][0]/n-.5,r=.5-e[a][1]/n,i.push([360*o,90-360*Math.atan(Math.exp(2*-r*Math.PI))/Math.PI]);return i}function Ju(e,t){for(var o,r,n=512*Math.pow(2,t),i=[],a=0,s=e.length;a<s;a++)r=Math.sin(e[a][1]*Math.PI/180),o=(e[a][0]+180)/360,r=.5-Math.log((1+r)/(1-r))/(4*Math.PI),i.push([Math.round(o*n),Math.round(r*n)]);return i}function Xu(e,t,o,r){switch(Tu(t)){case du.kilometersPerHourSecond:e/=3.6;break;case du.milesPerHourSecond:e/=2.236936292054;break;case du.knotsPerSecond:e/=1.943844492441;break;case du.standardGravity:e/=.1019716212978;break;case du.kilometersPerSecondSquared:e/=.001;break;case du.milesPerSecondSquared:e/=.000621371192;break;case du.feetPerSecondSquared:e/=3.280839895012;break;case du.yardsPerSecondSquared:e/=1.093613298338;break;case du.metersPerSecondSquared:}switch(Tu(o)){case du.kilometersPerHourSecond:e*=3.6;break;case du.milesPerHourSecond:e*=2.236936292054;break;case du.knotsPerSecond:e*=1.943844492441;break;case du.standardGravity:e*=.1019716212978;break;case du.kilometersPerSecondSquared:e*=.001;break;case du.milesPerSecondSquared:e*=.000621371192;break;case du.feetPerSecondSquared:e*=3.280839895012;break;case du.yardsPerSecondSquared:e*=1.093613298338;break;case du.metersPerSecondSquared:}return Mu(e,r)}function $u(e,t,o,r){switch(Iu(t)){case cu.acres:e*=4046.8564224;break;case cu.hectares:e*=1e4;break;case cu.squareFeet:e*=.09290304;break;case cu.squareKilometers:e*=1e6;break;case cu.squareMiles:e*=259e4;break;case cu.squareYards:e*=.83612736;break;case cu.squareMeters:}switch(Iu(o)){case cu.acres:e/=4046.8564224;break;case cu.hectares:e/=1e4;break;case cu.squareFeet:e/=.09290304;break;case cu.squareKilometers:e/=1e6;break;case cu.squareMiles:e/=259e4;break;case cu.squareYards:e/=.83612736;break;case cu.squareMeters:}return Mu(e,r)}function el(e,t,o,r){switch(ku(t)){case hu.feetPerSecond:e*=1.09728;break;case hu.milesPerHour:e*=1.6093;break;case hu.knots:e*=1.852;break;case hu.metersPerSecond:e*=3.6;break;case hu.mach:e*=1234.8;break;case hu.kilometersPerHour:}switch(ku(o)){case hu.feetPerSecond:e/=1.09728;break;case hu.milesPerHour:e/=1.6093;break;case hu.knots:e/=1.852;break;case hu.metersPerSecond:e/=3.6;break;case hu.mach:e/=1234.8;break;case hu.kilometersPerHour:}return Mu(e,r)}function tl(e,t,o,r){switch(Au(t)){case lu.ms:e/=1e3;break;case lu.hours:e*=3600;break;case lu.minutes:e*=60;break;case lu.days:e*=86400;break;case lu.seconds:}switch(Au(o)){case lu.ms:e*=1e3;break;case lu.hours:e/=3600;break;case lu.minutes:e/=60;break;case lu.days:e/=86400;break;case lu.seconds:}return Mu(e,r)}function ol(e,t,o,r,n,i,a,s){t=Nu(t,n,uu.meters),n=tl(o,i,lu.seconds);return Xu(2*(t-el(e,r,hu.metersPerSecond)*n)/(n*n),du.metersPerSecondSquared,a,s)}function rl(e,t,o,r,n,i,a){e=el(e,r,hu.metersPerSecond);return Xu((el(t,r,hu.metersPerSecond)-e)/tl(o,n,lu.seconds),du.metersPerSecondSquared,i,a)}function nl(e,t,o,r){e=il(e),t=il(t);return null!=e&&null!=t?tl(t.getTime()-e.getTime(),lu.ms,o,r):NaN}function il(e){if("[object Date]"===Object.prototype.toString.call(e))return e;if("string"==typeof e){var t=Date.parse(e);if(!isNaN(t))return new Date(t);if(0<=e.indexOf("Date("))return t=(t=0)<(e=e.replace("/Date(","").replace(")/","")).indexOf("+")?parseInt(e.substr(0,e.indexOf("+")),10):0<e.indexOf("-")?parseInt(e.substr(0,e.indexOf("-")),10):parseInt(e,10),new Date(t)}else if("number"==typeof e)return new Date(e);return null}function al(e){var t=[],o=null,r=null;if(Array.isArray(e)&&0<e.length)if(Array.isArray(e[0])&&"number"==typeof e[0][0])t=e;else for(var n=e.length,i=0;i<n;i++)t=t.concat(al(e[i]));else if(e.type)switch(e.type){case"Point":t=[e.coordinates];break;case"LineString":t=e.coordinates;break;case"Polygon":o=e.coordinates;break;case"MultiPoint":t=e.coordinates;break;case"MultiLineString":o=e.coordinates;break;case"MultiPolygon":r=e.coordinates;break;case"Feature":var a=e,t=_l._isCircle(a)?_l._getCirclePositions(a):al(a.geometry);break;case"FeatureCollection":t=al(e.features);break;case"GeometryCollection":t=al(e.geometries)}else if(e instanceof _l)return al(e.toJson());if(o)for(n=o.length,i=0;i<n;i++)t=t.concat(o[i]);else if(r)for(var s=r.length,i=0;i<s;i++)for(var c=r[i].length,u=0;u<c;u++)t=t.concat(r[i][u]);return t}function sl(e){if(Array.isArray(e)&&"number"==typeof e[0])return e;if(e.type){if("Point"===e.type)return e.coordinates;if("Feature"===e.type&&"Point"===e.geometry.type)return e.geometry.coordinates}else if(e instanceof _l&&"Point"===e.getType())return e.getCoordinates();return null}function cl(e,t,o){o=o||"meters";var r,n=0;if(Array.isArray(e)?r=e:e.type&&"LineString"===e.type&&(r=e.coordinates),2<=r.length){for(var i,a,s,c=r.length,u=1;u<c;u++){if(t<=n+(s=Du(r[u-1],r[u],o)))return i=Bu(r[u-1],r[u]),a=Lu(r[u-1],i,t-n,o),new eu(new au(a),{heading:i});n+=s}return n<=t?new eu(new au(r[c-1]),{heading:Bu(r[c-2],r[c-1])}):new eu(new au(r[0]),{heading:Bu(r[0],r[1])})}return null}function ul(e,t,o,r){var n=sl(e),i=Ju([n],22)[0],a=null,s=1/0;switch((t=t instanceof _l?t.toJson():t).type){case"Feature":return ul(e,t.geometry,o);case"Point":p=[[t.coordinates]];break;case"MultiPoint":for(var c,u=t.coordinates,l=0,h=u.length;l<h;l++)(c=Du(n,u[l]))<s&&(s=c,a=new eu(new au(u[l]),{distance:c}));break;case"LineString":p=[t.coordinates];break;case"Polygon":case"MultiLineString":p=t.coordinates;break;case"MultiPolygon":var d=t.coordinates;if(0<d.length)for(var p=d[0],l=1,h=d.length;l<h;l++)p=p.concat(d[l])}if(p)for(var f,l=0,h=p.length;l<h;l++)(f=xu(n,i,p[l]))&&f.properties.distance<s&&(s=f.properties.distance,a=f);return a&&(a.properties.distance=Nu(a.properties.distance,"meters",o,r)),a}(nn=cu=cu||{}).squareMeters="squareMeters",nn.acres="acres",nn.hectares="hectares",nn.squareFeet="squareFeet",nn.squareKilometers="squareKilometers",nn.squareMiles="squareMiles",nn.squareYards="squareYards",(Ni=uu=uu||{}).meters="meters",Ni.kilometers="kilometers",Ni.feet="feet",Ni.miles="miles",Ni.nauticalMiles="nauticalMiles",Ni.yards="yards",(Hr=lu=lu||{}).seconds="seconds",Hr.hours="hours",Hr.ms="ms",Hr.minutes="minutes",Hr.days="days",(n=hu=hu||{}).metersPerSecond="metersPerSecond",n.kilometersPerHour="kilometersPerHour",n.feetPerSecond="feetPerSecond",n.milesPerHour="milesPerHour",n.knots="knots",n.mach="mach",(a=du=du||{}).milesPerSecondSquared="milesPerSecondSquared",a.kilometersPerSecondSquared="kilometersPerSecondSquared",a.knotsPerSecond="knotsPerSecond",a.standardGravity="standardGravity",a.feetPerSecondSquared="feetPerSecondSquared",a.yardsPerSecondSquared="yardsPerSecondSquared",a.milesPerHourSecond="milesPerHourSecond",a.kilometersPerHourSecond="kilometersPerHourSecond",a.metersPerSecondSquared="metersPerSecondSquared";var ll,hl,bn=window&&window.__extends||(ll=function(e,t){return(ll=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ll(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),dl=(hl=Array,bn(pl,hl),pl.fromPosition=function(e){return 2===e.length?new pl(e[0],e[1]):2<e.length?new pl(e[0],e[1],e[2]):null},pl.areEqual=function(e,t,o){var r,n;return void 0===o&&(o=6),!!(e&&2<=e.length&&t&&2<=t.length)&&(o=Math.pow(10,o),n=Wu(e[1]),r=Wu(t[1]),e=Zu(e[0]),t=Zu(t[0]),0==Math.round((n-r)*o)/o)&&(0==(n=Math.round((e-t)*o)/o)||360==n)},pl.fromLatLng=function(n,e,t){var i,a,s,c,u,l,o=[];return"number"==typeof n?("number"==typeof e&&o.push(e),o.push(n),"number"==typeof t&&o.push(t)):Array.isArray(n)?2<=n.length&&"number"==typeof n[0]&&"number"==typeof n[1]&&(3<=n.length&&"number"==typeof n[2]?o.push(n[1],n[0],n[2]):o.push(n[1],n[0])):"object"==typeof n&&(i=["lat","latitude","y"],a=["lng","longitude","lon","x"],s=["elv","elevation","alt","altitude","z"],l=u=c=NaN,Object.keys(n).forEach(function(e,t,o){var r=e.toLowerCase();isNaN(c)&&0<=i.indexOf(r)&&"number"==typeof n[e]?c=n[e]:isNaN(u)&&0<=a.indexOf(r)&&"number"==typeof n[e]?u=n[e]:isNaN(l)&&0<=s.indexOf(r)&&"number"==typeof n[e]&&(l=n[e])}),isNaN(c)||isNaN(u)||(o.push(u,c),isNaN(l))||o.push(l)),2<=o.length?o:null},pl.fromLatLngs=function(e){var t=[];if(Array.isArray(e))for(var o=0,r=e.length;o<r;o++){var n=pl.fromLatLng(e[o]);n&&t.push(n)}return t},pl._getDimensions=function(e){for(var t=0;Array.isArray(e);)e=e[0],t++;return"number"==typeof e&&t--,t},pl);function pl(e,t,o){return o?hl.call(this,e,t,o)||this:hl.call(this,e,t)||this}gl.TYPE="Polygon";var fl=gl;function gl(e,t){this.type="Polygon",this.type=gl.TYPE,1===dl._getDimensions(e)?this.coordinates=[e]:this.coordinates=e,this.bbox=t}var ml,yl,ir=window&&window.__extends||(ml=function(e,t){return(ml=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ml(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),vl=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_l=(ir(wl,yl=Qt),wl.prototype.addProperty=function(e,t){$c(this.data.properties[e],t)||(this.data.properties[e]=Qa(t),"subType"!==e&&"radius"!==e||this._handleCircle(),this.dataSource&&this.dataSource._updateSource(),this._invokeEvent("shapechanged",this))},wl.prototype.getBounds=function(){var t,e,o,r,n,i=this.getCoordinates(),a=this.getType();if("Point"===a)n=this.circlePolygon?(s=this.circlePolygon.geometry.coordinates,f.fromPositions(s[0])):new f(s=i,s);else if("MultiPoint"===a||"LineString"===a){var s=i;n=f.fromPositions(s)}else if("Polygon"===a){s=i;n=f.fromPositions(s[0])}else if("MultiLineString"===a){s=i;try{for(var c=vl(s),u=c.next();!u.done;u=c.next()){var l=u.value;n=f.merge(n,f.fromPositions(l))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}}else if("MultiPolygon"===a){s=i;try{for(var h=vl(s),d=h.next();!d.done;d=h.next()){var p=d.value;n=f.merge(n,f.fromPositions(p[0]))}}catch(e){o={error:e}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(o)throw o.error}}}return n},wl.prototype.getCoordinates=function(){return Qa(this.data.geometry.coordinates)},wl.prototype.getCircleCoordinates=function(){return this.circlePolygon?Qa(this.circlePolygon.geometry.coordinates[0]):null},wl.prototype.getId=function(){return this.data.id},wl.prototype.getProperties=function(){return Qa(this.data.properties)},wl.prototype.getType=function(){return this.data.geometry.type},wl.prototype.isCircle=function(){return wl._isCircle(this.data)},wl.prototype.isRectangle=function(){return wl._isRectangle(this.data)},wl.prototype.setCoordinates=function(e){e="Polygon"===this.getType()&&1===dl._getDimensions(e)?[e]:e;$c(this.data.geometry.coordinates,e)||(this.data.geometry.coordinates=Qa(e),this._handleCircle(),this.dataSource&&this.dataSource._updateSource(),this._invokeEvent("shapechanged",this))},wl.prototype.setProperties=function(e){e[wl._shapeIdPropName]=this.data.id,$c(this.data.properties,e)||(this.data.properties=Qa(e),this._handleCircle(),this.dataSource&&this.dataSource._updateSource(),this._invokeEvent("shapechanged",this))},wl.prototype.toJson=function(){return JSON.parse(JSON.stringify(this.data))},wl.prototype._toJson=function(){return this.circlePolygon||this.data},wl.prototype._setDataSource=function(e){void 0===e||null==e?delete this.dataSource:this.dataSource=e},wl.prototype._handleCircle=function(){var e;this.isCircle()?(e=wl._getCirclePositions(this.data),this.circlePolygon=new eu(new fl([e]),this.data.properties,this.data.id),this.data.properties.subType="Circle"):delete this.circlePolygon},wl._isCircle=function(e){return e&&e.geometry&&"Point"===e.geometry.type&&e.geometry.coordinates&&e.properties&&"string"==typeof e.properties.subType&&"circle"===e.properties.subType.toLowerCase()&&"number"==typeof e.properties.radius},wl._isRectangle=function(e){if("Polygon"===e.geometry.type&&e.geometry.coordinates&&"string"==typeof e.properties.subType&&"rectangle"===e.properties.subType.toLowerCase()){e=e.geometry.coordinates;if(1===e.length){e=e[0];if(5===e.length)return e[0][0]===e[4][0]&&e[0][1]===e[4][1];if(4===e.length)return!0}}return!1},wl._getCirclePositions=function(e){return Gu(e.geometry.coordinates,e.properties.radius,72,"meters")},wl._shapeIdPropName="_azureMapsShapeId",wl);function wl(e,t,o){var r,n,i=yl.call(this)||this;return"Feature"===e.type?(n=Qa((r=e).geometry),o=r.properties?Qa(r.properties):{},t=null==r.id||""===r.id?W():r.id):(n=Qa(e),t=null==t||""===t?W():t,o=o?Qa(o):{}),o[wl._shapeIdPropName]=t,i.data=new eu(n,o,t),i._handleCircle(),i}var bl,Cl,Cn=window&&window.__extends||(bl=function(e,t){return(bl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}bl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),El=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},f=(Cl=Array,Cn(y,Cl),y.fromBoundingBox=function(e){var t=y.getWest(e),o=y.getSouth(e),r=y.getEast(e),e=y.getNorth(e);return new y([t,o,r,e])},y.fromDimensions=function(e,t,o){var r=e[0],e=e[1],n=Math.min(Math.max(e+o/2,-85.5),85.5),e=Math.min(Math.max(e-o/2,-85.5),85.5),o=Zu(r+t/2);return new y([Zu(r-t/2),e,o,n])},y.fromEdges=function(e,t,o,r){return new y([e,t,o,r])},y.containsPosition=function(e,t){var o=y.getCenter(e),r=Math.abs(o[1]-t[1]),o=Math.abs(o[0]-t[0]),t=(180<o&&(o=360-o),y.getHeight(e)),e=y.getWidth(e);return r<=t/2+1e-8&&o<=e/2+1e-8},y.containsBoundingBox=function(e,t){var o=e&&4===e.length,r=t&&4===t.length;return!(!o||!r)&&y.getWest(e)<y.getWest(t)&&y.getWest(t)<y.getEast(e)&&y.getWest(e)<y.getEast(t)&&y.getEast(t)<y.getEast(e)&&y.getSouth(e)<y.getSouth(t)&&y.getSouth(t)<y.getNorth(e)&&y.getSouth(e)<y.getNorth(t)&&y.getNorth(t)<y.getNorth(e)},y.crossesAntimeridian=function(e){return Zu(y.getEast(e))-Zu(y.getWest(e))<0||y.isBoundingBoxWithSixOrMoreElementsLargerThanGlobe(e)||y.isBoundingBoxWithLessThanSixElementsLargerThanGlobe(e)},y.getCenter=function(e){var t=Zu(y.getEast(e)),o=Zu(y.getWest(e)),o=(t<o&&(t+=360),Zu((o+t)/2)),t=Wu(y.getSouth(e)),e=Wu(y.getNorth(e));return[o,Wu((t+e)/2)]},y.getHeight=function(e){e=Wu(y.getNorth(e))-Wu(y.getSouth(e));return isNaN(e)?0:e},y.getWidth=function(e){e=Zu(y.getEast(e))-Zu(y.getWest(e));return isNaN(e)?0:e<0?e+360:e},y.getSouthWest=function(e){var t=this.getSouth(e),e=this.getWest(e);return isNaN(t)||isNaN(e)?null:[e,t]},y.getNorthEast=function(e){var t=this.getNorth(e),e=this.getEast(e);return isNaN(t)||isNaN(e)?null:[e,t]},y.getNorthWest=function(e){var t=this.getNorth(e),e=this.getWest(e);return isNaN(t)||isNaN(e)?null:[e,t]},y.getSouthEast=function(e){var t=this.getSouth(e),e=this.getEast(e);return isNaN(t)||isNaN(e)?null:[e,t]},y.getSouth=function(e){return e&&4<=e.length?Number(e[1]):NaN},y.getWest=function(e){return e&&4<=e.length?Number(e[0]):NaN},y.getNorth=function(e){if(e){if(4===e.length)return Number(e[3]);if(6===e.length)return Number(e[4])}return NaN},y.getEast=function(e){if(e){if(4===e.length)return Number(e[2]);if(6===e.length)return Number(e[3])}return NaN},y.intersect=function(e,t){var o=y.getCenter(e),r=y.getCenter(t),n=Math.abs(o[1]-r[1]),o=Math.abs(o[0]-r[0]),r=(180<o&&(o=360-o),y.getHeight(e)),e=y.getWidth(e),i=y.getHeight(t),t=y.getWidth(t);return n<=r/2+i/2&&o<=e/2+t/2},y.merge=function(e,t){var o=e&&4===e.length,r=t&&4===t.length;if(o&&!r)return e;if(r&&!o)return t;if(!o&&!r)return null;for(var o=Math.max(Wu(y.getNorth(e)),Wu(y.getNorth(t))),r=Math.min(Wu(y.getSouth(e)),Wu(y.getSouth(t))),n=[e,t],i=[],a=0,a=0;a<n.length;a++){var s=n[a],c=Zu(y.getWest(s)),u=Zu(y.getEast(s));y.crossesAntimeridian(s)?(i.push([c,180]),i.push([-180,u])):i.push([c,u])}i.sort(function(e,t){return e[0]===t[0]?e[1]-t[1]:e[0]-t[0]});var l=[],h=i[0];for(a=1;a<i.length;){var d=i[a];h[1]>=d[0]?h[1]=Math.max(h[1],d[1]):(l.push(h),h=d),a++}l.push(h);var p=l.length,f=l[0][0]+360-l[p-1][1],g=[l[p-1][1],l[0][0]];for(a=1;a<p;a++){var m=l[a][0]-l[a-1][1];f<m&&(f=m,g=[l[a-1][1],l[a][0]])}return new y([g[1],r],[g[0],o])},y.fromPositions=function(e){for(var t,o,r=NaN,n=NaN,i=NaN,a=NaN,s=e.length,c=new Array(s),u=0;s--;)(o=e[s])&&2<=o.length&&(t=Wu(o[1]),r=isNaN(r)?t:Math.max(r,t),n=isNaN(n)?t:Math.min(n,t),c[u++]=Zu(o[0]));if(u){c.length=u,c.sort(function(e,t){return e-t});for(var l=c[0]+360-c[u-1],h=0,s=1;s<u;s++){var d=c[s]-c[s-1];l<d&&(l=d,h=s)}i=c[h],a=c[(h||u)-1]}return isNaN(i)||isNaN(n)||isNaN(a)||isNaN(r)?null:new y([i,n,a,r])},y.fromLatLngs=function(e){return y.fromPositions(dl.fromLatLngs(e))},y.fromData=function(e){var t,o,r=null;if(Array.isArray(e)&&0<e.length){try{for(var n=El(e),i=n.next();!i.done;i=n.next()){var a,s=i.value;null!=(a=y.fromData(s))&&(r=null===r?a:y.merge(r,a))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return r}if(e instanceof _l)return e.getBounds();if(e&&e.type){var c=e;if(c.bbox&&4===c.bbox.length)return c.bbox;switch(c.type){case"FeatureCollection":return y.fromData(c.features);case"Feature":return _l._isCircle(c)?y.fromPositions(_l._getCirclePositions(c)):y.fromData(c.geometry);case"GeometryCollection":return y.fromData(c.geometries);case"Point":var u=c.coordinates;if(u&&2<=u.length)return[u[0],u[1],u[0],u[1]];break;case"LineString":case"MultiPoint":return y.fromPositions(c.coordinates);case"Polygon":case"MultiLineString":var l=c.coordinates;if(l&&0<l.length){for(var h=0,d=l.length;h<d;h++)null!=(a=y.fromPositions(l[h]))&&(r=null===r?a:y.merge(r,a));if(null!=r)return r}break;case"MultiPolygon":var p=c.coordinates;if(p&&0<p.length){for(h=0,d=p.length;h<d;h++)for(var f=0,g=p[h].length;f<g;f++)null!=(a=y.fromPositions(p[h][f]))&&(r=null===r?a:y.merge(r,a));return r}}}return null},y.splitOnAntimeridian=function(e){var t,o,r,n,i,a,s=[];return y.isBoundingBoxWithSixOrMoreElementsLargerThanGlobe(e)?[[-180,e[1],e[2],180,e[4],e[5]]]:y.isBoundingBoxWithLessThanSixElementsLargerThanGlobe(e)?[[-180,e[1],180,e[3]]]:(y.crossesAntimeridian(e)?(a=t=void 0,o=Zu(y.getWest(e)),r=Zu(y.getEast(e)),n=Wu(y.getNorth(e)),i=Wu(y.getSouth(e)),a=6<=e.length?(t=[o,i,e[2],180,n,e[5]],[-180,i,e[2],r,n,e[5]]):(t=[o,i,180,n],[-180,i,r,n]),s.push(t,a)):s.push(e),s)},y.isBoundingBoxWithSixOrMoreElementsLargerThanGlobe=function(e){return 6<=e.length&&360<e[3]-e[0]},y.isBoundingBoxWithLessThanSixElementsLargerThanGlobe=function(e){return e.length<6&&360<e[2]-e[0]},y);function y(e,t){var o,r=this;return e&&t?r=(o=e)[2]&&t[2]?Cl.call(this,o[0],o[1],o[2]||0,t[0],t[1],t[2]||0)||this:Cl.call(this,o[0],o[1],t[0],t[1])||this:e&&(o=e)&&(4===o.length?r=Cl.call(this,o[0],o[1],o[2],o[3])||this:6<=o.length&&(r=Cl.call(this,o[0],o[1],o[2],o[3],o[4],o[5])||this)),r}Tl.TYPE="FeatureCollection";var Sl=Tl;function Tl(e,t){this.type="FeatureCollection",this.type=Tl.TYPE,this.features=e,this.bbox=t}Il.TYPE="GeometryCollection";Uo=Il;function Il(e){this.type="GeometryCollection",this.type=Il.TYPE,this.geometries=e}kl.TYPE="LineString";e=kl;function kl(e,t){this.type="LineString",this.type=kl.TYPE,this.coordinates=e,this.bbox=t}Al.TYPE="MultiLineString";r=Al;function Al(e,t){this.type="MultiLineString",this.type=Al.TYPE,this.coordinates=e,this.bbox=t}Pl.TYPE="MultiPoint";hi=Pl;function Pl(e,t){this.type="MultiPoint",this.type=Pl.TYPE,this.coordinates=e,this.bbox=t}Ol.TYPE="MultiPolygon";i=Ol;function Ol(e,t){this.type="MultiPolygon",this.type=Ol.TYPE,this.coordinates=e,this.bbox=t}var Rl,xl,un=window&&window.__extends||(Rl=function(e,t){return(Rl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Rl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),cn=(xl=Array,un(Ml,xl),Ml.fromPosition=function(e){return 2<=e.length?new Ml((180+e[0])/360,Ml._latToMercatorY(e[1]),3<=e.length?Ml._altitudeToMercatorZ(e[2],e[1]):0):[0,0,0]},Ml.fromPositions=function(e){for(var t=[],o=0,r=e.length;o<r;o++)t.push(this.fromPosition(e[o]));return t},Ml.toFloat32Array=function(e){for(var t=new Float32Array(3*e.length),o=0,r=e.length;o<r;o++){var n=3*o,i=e[o];t[n]=(180+i[0])/360,t[1+n]=Ml._latToMercatorY(i[1]),t[2+n]=3<=i.length?Ml._altitudeToMercatorZ(i[2],i[1]):0}return t},Ml.toPosition=function(e){var t;return 2<=e.length?(t=360/Math.PI*Math.atan(Math.exp((180-360*e[1])*Math.PI/180))-90,new dl(360*e[0]-180,t,3<=e.length?Ml._mercatorZToAltitude(e[2],e[1]):0)):[0,0,0]},Ml.toPositions=function(e){for(var t=[],o=0,r=e.length;o<r;o++)t.push(this.toPosition(e[o]));return t},Ml.mercatorScale=function(e){return 1/Math.cos(e*Math.PI/180)},Ml.meterInMercatorUnits=function(e){return 1/Ml.earthCircumference*Ml.mercatorScale(Ml._latToMercatorY(e))},Ml._circumferenceAtLatitude=function(e){return Ml.earthCircumference*Math.cos(e*Math.PI/180)},Ml._altitudeToMercatorZ=function(e,t){return e/Ml._circumferenceAtLatitude(t)},Ml._mercatorZToAltitude=function(e,t){return e*Ml._circumferenceAtLatitude(Ml._latToMercatorY(t))},Ml._latToMercatorY=function(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360},Ml.earthCircumference=2*Math.PI*qu(),Ml);function Ml(e,t,o){return xl.call(this,e,t,o||0)||this}var ii=Object.freeze({__proto__:null,BoundingBox:f,Feature:eu,FeatureCollection:Sl,GeometryCollection:Uo,LineString:e,MercatorPoint:cn,MultiLineString:r,MultiPoint:hi,MultiPolygon:i,Point:au,Polygon:fl,Position:dl});function Nl(e,t){return e*e+t*t}function Ll(e,t){for(var o,r,n,i=e[0],a=[i],s=1,c=e.length;s<c;s++)o=e[s],n=i,Nl((r=o)[0]-n[0],r[1]-n[1])>t&&(a.push(o),i=o);return i!==o&&a.push(o),a}function Dl(e,t,o,r,n){for(var i,a,s,c,u,l,h,d=r,p=t+1;p<o;p++){a=e[p],s=e[t],f=e[o],h=l=u=c=void 0,u=s[0],s=s[1],l=f[0]-u,h=f[1]-s,0==l&&0==h||(1<(c=((a[0]-u)*l+(a[1]-s)*h)/Nl(l,h))?(u=f[0],s=f[1]):0<c&&(u+=l*c,s+=h*c));var f=Nl(a[0]-u,a[1]-s);d<f&&(i=p,d=f)}r<d&&(1<i-t&&Dl(e,t,i,r,n),n.push(e[i]),1<o-i)&&Dl(e,i,o,r,n)}var ql=function(e,t,o){var r,n;return void 0===t&&(t=1),void 0===o&&(o=!1),e.length<=2||(t=t*t,e=o?e:Ll(e,t),r=(o=e).length-1,n=[o[0]],Dl(o,0,r,t,n),n.push(o[r]),e=n),e};var Ul=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},jl=(Hl.prototype.toTarget=function(e,t){return this.transformArray(e,this.M,t)},Hl.prototype.toSource=function(e,t){return this.transformArray(e,this.inverseM,t)},Hl.prototype.transformArray=function(e,t,o){var r,n;if(e&&Array.isArray(e)&&Array.isArray(e[0])){var i=[];try{for(var a=Ul(e),s=a.next();!s.done;s=a.next()){var c=s.value;i.push(this.transform(c,t,o))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}return null},Hl.prototype.transform=function(e,t,o){var r=e[0]*t[0][3]+e[1]*t[1][3]+t[2][3],e=e[0]*t[0][4]+e[1]*t[1][4]+t[2][4];return"number"==typeof o&&0<=o?[Mu(r,o),Mu(e,o)]:[Mu(r,6),Mu(e,6)]},Hl._calculateAffineTransform=function(e,t){if(e.length!==t.length||e.length<1)throw new Error("Error: source and target arrays must have the same length.");var o=Math.min(e[0].length,t[0].length),r=o+1;if(e.length<o)throw new Error("Erorr: At least "+o+" reference points required.");for(var n=[],i=[],a=0;a<r;a++){i[a]=[];for(var s=0;s<r;s++){s<o&&(n[s]=0);for(var c=i[a][s]=0;c<e.length;c++)s<o&&(n[s]+=a<o?e[c][a]*t[c][s]:t[c][s]),i[a][s]+=o<=a&&o<=s?1:o<=a?e[c][s]:o<=s?e[c][a]:e[c][a]*e[c][s]}i[a]=i[a].concat(n)}if(this._gaussJordanElimination(i))return i;throw new Error("Error: Singular matrix. Points are likely coplanar.")},Hl._gaussJordanElimination=function(e){for(var t,o=e.length,r=2*o-1,n=0;n<o;n++){for(var i=n,a=n+1;a<o;a++)Math.abs(e[a][n])>Math.abs(e[i][n])&&(i=a);if(t=e[i],e[i]=e[n],e[n]=t,Math.abs(e[n][n])<=1e-12)return!1;for(var s=n+1;s<o;s++)for(var c=e[s][n]/e[n][n],u=n;u<r;u++)e[s][u]-=e[n][u]*c}for(n=o-1;-1<n;n--){c=e[n][n];for(a=0;a<n;a++)for(var l=r-1;n-1<l;l--)e[a][l]-=e[n][l]*e[a][n]/c;e[n][n]/=c;for(var h=o;h<r;h++)e[n][h]/=c}return!0},Hl);function Hl(e,t){this.M=Hl._calculateAffineTransform(e,t),this.inverseM=Hl._calculateAffineTransform(t,e)}var Bl,Fl,nn=Object.freeze({__proto__:null,get AccelerationUnits(){return du},AffineTransform:jl,get AreaUnits(){return cu},get DistanceUnits(){return uu},get SpeedUnits(){return hu},get TimeUnits(){return lu},WEBMERCATOR_MAXLAT:_u,_precision:Mu,boundingBoxToPolygon:function(e){var t=Zu(f.getWest(e)),o=Zu(f.getEast(e)),r=Wu(f.getNorth(e)),n=Wu(f.getSouth(e)),e=f.getCenter(e),n=[[t,r],[t,n],[e[0],n],[o,n],[o,r],[e[0],r],[t,r]];return new fl([n])},convertAcceleration:Xu,convertArea:$u,convertDistance:Nu,convertSpeed:el,convertTimespan:tl,getAcceleration:ol,getAccelerationFromFeatures:function(e,t,o,r,n,i,a){if("string"==typeof o&&"Feature"===e.type&&"Point"===e.geometry.type&&"Feature"===t.type&&"Point"===t.geometry.type){o=nl(e.properties[o],t.properties[o],lu.seconds);if(!isNaN(o)){var s=0;if(r&&"string"==typeof r){var c=e.properties[r],r=t.properties[r];if("number"==typeof c&&(s=c,"number"==typeof r))return rl(c,r,o,n,lu.seconds,i,a)}return ol(s,Du(e.geometry.coordinates,t.geometry.coordinates,uu.meters),o,n,uu.meters,lu.seconds,i,a)}}return NaN},getAccelerationFromSpeeds:rl,getArea:function e(t,o,r){if(t){var n=0;switch((t=t instanceof _l?t.toJson():t).type){case"Feature":var i=t;if(i.geometry)return e(i.geometry,o,r);break;case"Polygon":(i=t).coordinates&&(n=Pu(i.coordinates));break;case"MultiPolygon":var a=t;if(a.coordinates)for(var s=0,c=a.coordinates.length;s<c;s++)n+=Pu(a.coordinates[s])}return $u(n,cu.squareMeters,o,r)}return 0},getCardinalSpline:function(e,t,o,r){if(!e||e.length<=2)return c;"number"!=typeof t&&(t=.5),("number"!=typeof o||o<=0)&&(o=15);var n,i,a,s=e.length,c=e.slice(0),u=(r?(dl.areEqual(c[0],c[s-1])&&(c.pop(),s--),c.unshift(e[s-1]),c.push(e[0]),c.push(e[1]),s++):(c.unshift(e[0]),c.push(e[s-1])),[]);u.push([1,0,0,0]);for(var l=1;l<o-1;l++)u.push([2*(a=(n=l/o)*(i=n*n))-3*i+1,-2*a+3*i,a-2*i+n,a-i]);u.push([0,1,0,0]);for(var h,d,p,f,g,m,y=[],l=1;l<s;l++)for(h=t*(c[l+1][0]-c[l-1][0]),d=t*(c[l+1][1]-c[l-1][1]),p=t*(c[l+2][0]-c[l][0]),f=t*(c[l+2][1]-c[l][1]),n=0;n<o;n++)m=(g=u[n])[0]*c[l][0]+g[1]*c[l+1][0]+g[2]*h+g[3]*p,g=Cu(g[0]*c[l][1]+g[1]*c[l+1][1]+g[2]*d+g[3]*f,-85,85),y.push([m,g]);return y},getClosestPointOnGeometry:ul,getConvexHull:function(e){var t,o,r=al(e).map(function(e){return[Zu(e[0]),Wu(e[1])]}),n=(r.sort(function(e,t){return e[0]===t[0]?e[1]-t[1]:e[0]-t[0]}),[]);try{for(var i=fu(r),a=i.next();!a.done;a=i.next()){for(var s=a.value;2<=n.length&&Ru(n[n.length-2],n[n.length-1],s)<=0;)n.pop();n.push(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(t)throw t.error}}for(var c=[],u=r.length-1;0<=u;u--){for(;2<=c.length&&Ru(c[c.length-2],c[c.length-1],r[u])<=0;)c.pop();c.push(r[u])}return new fl([n.concat(c)])},getDestination:Lu,getDistanceTo:Du,getEarthRadius:qu,getGeodesicPath:function(e,t){(!t||t<=0)&&(t=15),Array.isArray(e)?o=e:e.type&&"LineString"===e.type&&(o=e.coordinates);for(var o,r=o.length-1,n=[],i=0;i<r;i++)n=n.concat(Uu(o[i],o[i+1],t));return ju(n)},getGeodesicPaths:function(e,t){(!t||t<=0)&&(t=15),Array.isArray(e)?o=e:e.type&&"LineString"===e.type&&(o=e.coordinates);for(var o,r=o.length-1,n=[],i=[],a=0;a<r;a++)for(var s,c,u,l,h,d=Uu(o[a],o[a+1],t),p=0;p<d.length;p++)n.push(d[p]),p+1>=d.length||(s=(c=pu(d[p],2))[0],c=c[1],l=(h=pu(d[p+1],2))[0],h=h[1],180<Math.abs(l-s)&&(u=0<s?180:-180,l=Math.abs((0<s?l+360:l-360)-s),h=c+(h-c)*(Math.abs(u-s)/l),n.push([u,h]),i.push(n),n=[[-u,h]]));return i.push(n),i},getHeading:Bu,getLengthOfPath:Fu,getPathDenormalizedAtAntimerian:ju,getPathSplitByAntimeridian:Hu,getPixelHeading:function(e,t){e=sl(e),t=sl(t);var t=(e=pu(Ju([e,t],21),2))[0],o=(e=e[1])[0]-t[0],t=t[1]-e[1];return(2.5*Math.PI-Math.atan2(t,o))*yu%360},getPointWithHeadingAlongPath:cl,getPointsWithHeadingsAlongPath:function(e,t){if(t<=0)return[];for(var o=[],r=Fu(e,uu.meters)/(t-1),n=0;n<t;n++){var i=cl(e,r*n,uu.meters);null!=i&&o.push(i)}return o},getPosition:sl,getPositionAlongPath:zu,getPositions:al,getPositionsAlongPath:function(e,t){if(t<2)return[];for(var o=[],r=Fu(e,uu.meters)/(t-1),n=0;n<t;n++){var i=zu(e,r*n,uu.meters);null!=i&&o.push(i)}return o},getRegularPolygonPath:Gu,getRegularPolygonPaths:function(e,t,o,r,n){return Hu(Ku(e,t,o,r,n))},getSpeed:function(e,t,o,r,n,i){return e=sl(e),t=sl(t),e&&t?(o=tl(o,r,lu.seconds),el(Du(e,t,uu.meters)/o,hu.metersPerSecond,n,i)):0},getSpeedFromFeatures:function(e,t,o,r,n){if("string"==typeof o&&"Feature"===e.type&&"Point"===e.geometry.type&&"Feature"===t.type&&"Point"===t.geometry.type){o=nl(e.properties[o],t.properties[o],lu.seconds);if(!isNaN(o))return el(Du(e.geometry.coordinates,t.geometry.coordinates,uu.meters)/o,hu.metersPerSecond,r,n)}return NaN},getTimespan:nl,getTravelDistance:function(e,t,o,r,n,i,a,s){return t=tl(t,n,lu.seconds),n=(o=el(o,i,hu.metersPerSecond))*t,"number"==typeof r&&(n+=.5*Xu(r,a,du.metersPerSecondSquared)*t*t),Nu(n,uu.meters,e,s)},interpolate:Yu,mercatorPixelsToPositions:Vu,mercatorPositionsToPixels:Ju,normalizeLatitude:Wu,normalizeLongitude:Zu,parseTimestamp:il,rotatePositions:Qu,simplify:function(e,t){return ql(e,t,!0)}}),zl=((window&&window.__extends||(Bl=function(e,t){return(Bl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Bl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Kl,Fl=ye),Kl);function Kl(){var e=null!==Fl&&Fl.apply(this,arguments)||this;return e.zoomDelta=1,e.style=l.ControlStyle.light,e}(window&&window.__extends||(Gl=function(e,t){return(Gl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Gl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Wl,Yl=$t),Wl.prototype.onAdd=function(e){this.container=this.buildContainer(e,this.options.style,"Zoom Control"),this.container.style.flexDirection="column",this.zoomInButton=this.constructZoomInButton(e),this.zoomOutButton=this.constructZoomOutButton(e);var t=jt("Zoom In"),o=jt("Zoom Out");return this.container.appendChild(this.zoomInButton),this.container.appendChild(t),this.container.appendChild(this.zoomOutButton),this.container.appendChild(o),Ht(t,this.zoomInButton),Ht(o,this.zoomOutButton),e.events.add("zoom",this.zoomChanged),e.events.add("minzoomchanged",this.minZoomChanged),e.events.add("maxzoomchanged",this.maxZoomChanged),this.map=e,this.container},Wl.prototype.onRemove=function(){Yl.prototype.onRemove.call(this),this.map&&(this.map.events.remove("zoom",this.zoomChanged),this.map.events.remove("minzoomchanged",this.minZoomChanged),this.map.events.remove("maxzoomchanged",this.maxZoomChanged),this.map=null),this.container&&(this.container.remove(),this.container=null,this.zoomInButton=null,this.zoomOutButton=null)},Wl.prototype.updateZoomButtonsState=function(){var e=this.map.getCamera().zoom>=this.map._getMap().getMaxZoom(),t=f.getSouth(this.map.getCamera().bounds)<=-_u&&f.getNorth(this.map.getCamera().bounds)>=_u,t=this.map.getCamera().zoom<=this.map._getMap().getMinZoom()||t;this.zoomInButton&&this.zoomInButton.disabled!=e&&(this.zoomInButton.disabled=e,this.zoomInButton.setAttribute("aria-label",e?"Zoom In disabled":"Zoom In")),this.zoomOutButton&&this.zoomOutButton.disabled!=t&&(this.zoomOutButton.disabled=t,this.zoomOutButton.setAttribute("aria-label",e?"Zoom Out disabled":"Zoom Out"))},Wl.prototype.constructZoomInButton=function(t){var o=this,e=document.createElement("button");return e.classList.add("azure-maps-control-button"),e.classList.add("zoom-in"),e.setAttribute("aria-label","Zoom In"),e.setAttribute("alt","Zoom In"),e.setAttribute("type","button"),e.addEventListener("click",function(){var e;t.setCamera({maxBounds:null==(e=t._getMap().getMaxBounds())?void 0:e.toArray().flat(),zoom:t.getCamera().zoom+o.options.zoomDelta,duration:Wl.ZOOM_DURATION_MS,type:"ease"},!0)}),e},Wl.prototype.constructZoomOutButton=function(t){var o=this,e=document.createElement("button");return e.classList.add("azure-maps-control-button"),e.classList.add("zoom-out"),e.setAttribute("aria-label","Zoom Out"),e.setAttribute("alt","Zoom Out"),e.setAttribute("type","button"),e.addEventListener("click",function(){var e;t.setCamera({maxBounds:null==(e=t._getMap().getMaxBounds())?void 0:e.toArray().flat(),zoom:t.getCamera().zoom-o.options.zoomDelta,duration:Wl.ZOOM_DURATION_MS,type:"ease"},!0)}),e},Wl.ZOOM_DURATION_MS=200;var Gl,Yl,Ni=Wl;function Wl(e){var t=Yl.call(this)||this;return t.container=null,t.zoomInButton=null,t.zoomOutButton=null,t.zoomChanged=function(e){return t.updateZoomButtonsState()},t.minZoomChanged=function(e){return t.updateZoomButtonsState()},t.maxZoomChanged=function(e){return t.updateZoomButtonsState()},t.options=(new zl).merge(e),t}var Hr=Object.freeze({__proto__:null,CompassControl:so,ControlBase:$t,PitchControl:t,ScaleControl:be,StyleControl:Mi,TrafficControl:yc,TrafficLegendControl:o,ZoomControl:Ni}),Zl=Wa;var Ql=q(function(e,t){return Zl(e,5,t="function"==typeof t?t:void 0)}),Vl=(Jl.Css={hidden:"hidden-accessible-element"},Jl);function Jl(e){var t=this;this.attach=function(e){t.map!==e&&(t.map&&t.detachFromCurrentMap(),t.map=e,t.map.indicators._getCollectionDiv().appendChild(t.element),t.map.indicators.add(t))},this.remove=function(){t.detachFromCurrentMap(),t.element.remove()},this.getElement=function(){return t.element},this.detachFromCurrentMap=function(){t.map&&(t.map.indicators.remove(t),delete t.map)},this.element=document.createElement("div"),this.element.setAttribute("tabindex","0"),this.element.setAttribute("role","option"),null!=e&&e.setSize&&this.element.setAttribute("aria-setsize",e.setSize.toString()),null!=e&&e.positionInSet&&this.element.setAttribute("aria-posinset",e.positionInSet.toString()),this.element.setAttribute("aria-label","data point"),this.element.classList.add(Jl.Css.hidden)}(window&&window.__extends||(Xl=function(e,t){return(Xl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Xl(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(th,$l=ye);var Xl,$l,eh=th;function th(){var e=null!==$l&&$l.apply(this,arguments)||this;return e.buffer=128,e.maxZoom=18,e.cluster=!1,e.clusterRadius=50,e.clusterMaxZoom=void 0,e.clusterProperties=void 0,e.lineMetrics=!1,e.tolerance=.375,e.clusterMinPoints=2,e.generateId=!1,e.promoteId=void 0,e.filter=void 0,e}(window&&window.__extends||(oh=function(e,t){return(oh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}oh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(ih,rh=Qt),ih.prototype.getId=function(){return this.id},ih.prototype._setMap=function(e,t){var o;void 0===t&&(t=!0),null==e||void 0===e?(o=this.map,delete this.map,t&&(this._invokeEvent("sourceremoved",this),o)&&o.events.invoke("sourceremoved",this)):(this.map=e,t&&(this._invokeEvent("sourceadded",this),this.map.events.invoke("sourceadded",this)))};var oh,rh,nh=ih;function ih(e){var t=rh.call(this)||this;return t.id=e||W(),t}var ah,sh,n=window&&window.__extends||(ah=function(e,t){return(ah=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ah(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),ch=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},uh=(n(lh,sh=nh),lh.prototype.add=function(e,t){this._addNoUpdate(e,t),this._updateSource()},lh.prototype.clear=function(){this._clearNoUpdate(),this._updateSource()},lh.prototype.dispose=function(){this.options=null,this.shapes=null,this.shapesMap=null,this.map=null},lh.prototype.getClusterExpansionZoom=function(r){var n=this;return new Promise(function(t,o){var e;n.map?(e=n.map._getMap().getSource(n.getId()))&&"geojson"===e.type&&e.getClusterExpansionZoom(r).then(function(e){"number"==typeof e&&t(e)}).catch(function(e){e&&o(e)}):o("The DataSource hasn't been added to a map.")})},lh.prototype.getClusterChildren=function(r){var n=this;return new Promise(function(t,o){var e;n.map?(e=n.map._getMap().getSource(n.getId()))&&"geojson"===e.type&&e.getClusterChildren(r).then(function(e){e&&t(n.map.sources._mapFeaturesToShapes(e,!1,n))}).catch(function(e){e&&o(e)}):o("The DataSource hasn't been added to a map.")})},lh.prototype.getClusterLeaves=function(r,n,i){var a=this;return new Promise(function(t,o){var e;a.map?(e=a.map._getMap().getSource(a.getId()))&&"geojson"===e.type&&e.getClusterLeaves(r,n,i).then(function(e){e&&t(a.map.sources._mapFeaturesToShapes(e,!1,a))}).catch(function(e){e&&o(e)}):o("The DataSource hasn't been added to a map.")})},lh.prototype.getOptions=function(){return Qa(this.options)},lh.prototype.getShapes=function(){return Array.from(this.shapes)},lh.prototype.importDataFromUrl=function(e){var t=this;return fetch(e,{method:"GET",mode:"cors"}).then(function(e){if(e.ok)return e.json();throw new Error("HTTP ".concat(e.status,": ").concat(e.statusText))}).then(function(e){t.add(e)})},lh.prototype.getShapeById=function(e){return this.shapes[this.shapesMap.get(e)]||null},lh.prototype.remove=function(e){var t,o,e=Array.isArray(e)?e:[e];try{for(var r=ch(e),n=r.next();!n.done;n=r.next()){var i=n.value;"number"==typeof i?this._removeByIndex(i):this._removeById(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}this._updateSource()},lh.prototype.removeById=function(e){var t,o,e=Array.isArray(e)?e:[e];try{for(var r=ch(e),n=r.next();!n.done;n=r.next()){var i=n.value;this._removeById(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}this._updateSource()},lh.prototype.setOptions=function(e){e=(new eh).merge(this.options,Qa(e));$c(this.options,e)||(this._invokeEvent("datasourceupdated",this),this.options=e,this.map&&this.map._rebuildStyle())},lh.prototype.setShapes=function(e){this._clearNoUpdate(),this.add(e)},lh.prototype.toJson=function(){return new Sl(this.shapes.map(function(e){return e.toJson()}))},lh.prototype._toJson=function(){return new Sl(this.shapes.map(function(e){return e._toJson()}))},lh.prototype._buildSource=function(){var e={type:"geojson",data:this._toJson(),maxzoom:this.options.maxZoom,cluster:this.options.cluster,clusterRadius:this.options.clusterRadius,tolerance:this.options.tolerance,lineMetrics:this.options.lineMetrics,clusterProperties:this.options.clusterProperties,buffer:this.options.buffer,clusterMinPoints:this.options.clusterMinPoints,generateId:this.options.generateId,promoteId:this.options.promoteId,filter:this.options.filter};return"number"==typeof this.options.clusterMaxZoom&&(e.clusterMaxZoom=this.options.clusterMaxZoom),e},lh.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this._buildSource(),e=e._buildSource(),t.type===e.type)&&t.maxzoom===e.maxzoom&&t.cluster===e.cluster&&t.clusterRadius===e.clusterRadius&&t.tolerance===e.tolerance&&t.lineMetrics===e.lineMetrics&&JSON.stringify(t.clusterProperties)===JSON.stringify(e.clusterProperties)&&t.buffer===e.buffer&&t.clusterMinPoints===e.clusterMinPoints&&t.generateId===e.generateId&&t.promoteId===e.promoteId&&t.filter===e.filter},lh.prototype._addNoUpdate=function(e,t){var o;e instanceof _l?(this._addToSources(e,t),o=[e]):Array.isArray(e)?(o=e.map(function(e){return e instanceof _l?e:new _l(e)}),this._addToSources(o,t)):"FeatureCollection"===e.type?(o=e.features.map(function(e){return new _l(e)}),this._addToSources(o,t)):"GeometryCollection"===e.type?(o=e.geometries.map(function(e){return new _l(e)}),this._addToSources(o,t)):(e=new _l(e),this._addToSources(e,t),o=[e]),this._invokeEvent("dataadded",o)},lh.prototype._clearNoUpdate=function(){var e=this.shapes;this.shapes=[],this.shapesMap=new Zt,e&&0<e.length&&this._invokeEvent("dataremoved",e)},lh.prototype._updateSource=function(){var e=this;void 0===this.requestId&&(this.requestId=requestAnimationFrame(function(){e._updateMboxSource(),e.requestId=void 0}))},lh.prototype._addToSources=function(e,t){var o,r,n,i;if(e=Array.isArray(e)?e:[e],"number"!=typeof t)try{for(var a=ch(e),s=a.next();!s.done;s=a.next()){var c=s.value;this.shapes.push(c),this.shapesMap.set(c.getId(),this.shapes.length-1)}}catch(e){o={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}else for(var u=e.length-1;0<=u;u--)this.shapes.splice(t,0,e[u]),this._updateShapesMap(t);try{for(var l=ch(e),h=l.next();!h.done;h=l.next())(c=h.value)._setDataSource(this)}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}},lh.prototype._removeById=function(e){var e=e instanceof _l?e.getId():"string"==typeof e||"number"==typeof e?e:e.id,t=this.shapes[this.shapesMap.get(e)];t&&(t._setDataSource(null),this.shapes.splice(this.shapesMap.get(e),1),this._updateShapesMap(this.shapesMap.get(e)),this.shapesMap.delete(e),this._invokeEvent("dataremoved",[t]))},lh.prototype._removeByIndex=function(e){var t;if(e>=this.shapes.length)throw new Error("The specified remove index '".concat(e,"' ")+"is greater than the maximum possible index '".concat(this.shapes.length-1,"'"));t=this.shapes[e],this.shapesMap.delete(t.getId()),t._setDataSource(null),this.shapes.splice(e,1),this._updateShapesMap(e),this._invokeEvent("dataremoved",[t])},lh.prototype._updateShapesMap=function(e){for(var t=e;t<this.shapes.length;t++)this.shapesMap.set(this.shapes[t].getId(),t)},lh.prototype._updateMboxSource=function(){var e;this.map&&this.map._getMap()&&(e=this.map._getMap().getSource(this.getId()))&&"geojson"===e.type&&e.setData(this._toJson())},lh);function lh(e,t){e=sh.call(this,e)||this;return e.requestId=void 0,e.options=(new eh).merge(Qa(t)),e.shapes=[],e.shapesMap=new Zt,e}(window&&window.__extends||(hh=function(e,t){return(hh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}hh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(fh,dh=ye);var hh,dh,ph=fh;function fh(){var e=null!==dh&&dh.apply(this,arguments)||this;return e.bounds=void 0,e.minZoom=0,e.maxZoom=22,e.isTMS=!1,e.tiles=void 0,e.url=void 0,e}(window&&window.__extends||(gh=function(e,t){return(gh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(vh,mh=nh),vh.prototype.getOptions=function(){return Qa(this.options)},vh.prototype.getShape=function(e,t){return this.map._getMap().querySourceFeatures(this.getId(),{sourceLayer:e,filter:t})},vh.prototype._buildSource=function(){var e={type:"vector"};return this.options.bounds&&(e.bounds=this.options.bounds),this.options.tiles?(e.tiles=this.options.tiles,e.minzoom=this.options.minZoom,e.maxzoom=this.options.maxZoom):this.options.url&&(e.url=this.options.url),this.options.isTMS&&(e.scheme="tms"),e},vh.prototype._isDeepEqual=function(e){var t,o;return this.constructor===e.constructor&&(t=this._buildSource(),o=e._buildSource(),t.type===o.type)&&t.url===o.url&&(void 0===t.tiles&&void 0===o.tiles||t.tiles&&o.tiles&&t.tiles.length===o.tiles.length&&t.tiles.every(function(e,t){return e===o.tiles[t]}))&&t.minzoom===o.minzoom&&t.maxzoom===o.maxzoom&&t.bounds===o.bounds&&t.attribution===o.attribution&&t.promoteId===o.promoteId&&t.scheme===o.scheme};var gh,mh,yh=vh;function vh(e,t){e=mh.call(this,e)||this;return e.options=(new ph).merge(Qa(t)),e}(window&&window.__extends||(_h=function(e,t){return(_h=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}_h(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ch,wh=nh),Ch.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this.source,e=e.source,t.type===e.type)&&t.canvas===e.canvas&&JSON.stringify(t.coordinates)===JSON.stringify(e.coordinates)&&t.animate===e.animate},Ch.prototype._buildSource=function(){return this.source};var _h,wh,bh=Ch;function Ch(e,t,o){e=wh.call(this,e)||this;return e.source=t,e}(window&&window.__extends||(Eh=function(e,t){return(Eh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Eh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ih,Sh=nh),Ih.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this.source,e=e.source,t.type===e.type)},Ih.prototype._buildSource=function(){return this.source};var Eh,Sh,Th=Ih;function Ih(e,t,o){e=Sh.call(this,e)||this;return e.source=t,e}(window&&window.__extends||(kh=function(e,t){return(kh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}kh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Oh,Ah=nh),Oh.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this.source,e=e.source,t.type===e.type)&&JSON.stringify(t.coordinates)===JSON.stringify(e.coordinates)&&t.url===e.url},Oh.prototype._buildSource=function(){return this.source};var kh,Ah,Ph=Oh;function Oh(e,t,o){e=Ah.call(this,e)||this;return e.source=t,e}(window&&window.__extends||(Rh=function(e,t){return(Rh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Rh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Nh,xh=nh),Nh.prototype._isDeepEqual=function(e){var t;return this.constructor===e.constructor&&(t=this.source,e=e.source,t.type===e.type)&&JSON.stringify(t.coordinates)===JSON.stringify(e.coordinates)&&t.urls===e.urls},Nh.prototype._buildSource=function(){return this.source};var Rh,xh,Mh=Nh;function Nh(e,t,o){e=xh.call(this,e)||this;return e.source=t,e}(window&&window.__extends||(Lh=function(e,t){return(Lh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Lh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(qh,Dh=ph);var Lh,Dh,a=qh;function qh(){var e=null!==Dh&&Dh.apply(this,arguments)||this;return e.tileSize=512,e}(window&&window.__extends||(Uh=function(e,t){return(Uh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Uh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Bh,jh=a);var Uh,jh,Hh=Bh;function Bh(){var e=null!==jh&&jh.apply(this,arguments)||this;return e.encoding=void 0,e}var Fh,zh,bn=window&&window.__extends||(Fh=function(e,t){return(Fh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Fh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Kh=window&&window.__assign||function(){return(Kh=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},ir=(bn(Gh,zh=nh),Gh.prototype.getOptions=function(){return Qa(this.options)},Gh.prototype._buildSource=function(){return Kh({type:"raster-dem",bounds:this.options.bounds,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,tileSize:this.options.tileSize,encoding:this.options.encoding},this.options.tiles?{tiles:this.options.tiles}:{url:this.options.url})},Gh.prototype._isDeepEqual=function(e){return this.constructor===e.constructor&&(e=e.getOptions(),this.options.url===e.url)&&this.options.tiles===e.tiles&&this.options.bounds===e.bounds&&this.options.minZoom===e.minZoom&&this.options.maxZoom===e.maxZoom&&this.options.tileSize===e.tileSize&&this.options.encoding===e.encoding},Gh);function Gh(e,t){e=zh.call(this,e)||this;return e.options=(new Hh).merge(Qa(t)),e}var Yh,Wh,Cn=Object.freeze({__proto__:null,CanvasSource:bh,DataSource:uh,ElevationTileSource:ir,ImageSource:Ph,Source:nh,UnknownSource:Th,VectorTileSource:yh,VideoSource:Mh}),Zh=((window&&window.__extends||(Yh=function(e,t){return(Yh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Yh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Qh,Wh=Qt),Qh.prototype.getId=function(){return this.id},Qh.prototype.getMap=function(){return this.map||null},Qh.prototype.onAdd=function(e){this.map=e,this._invokeEvent("layeradded",this),this.map.events.invoke("layeradded",this)},Qh.prototype.onRemove=function(){var e=this.map;delete this.map,this._invokeEvent("layerremoved",this),e&&e.events.invoke("layerremoved",this)},Qh._isMBoxEvent=function(e){return!this.LayerEvents.hasOwnProperty(e)},Qh.prototype._updateBaseProperties=function(e,t){this._updateFilter(e.filter,t.filter),this._updateZoomRange(e.minZoom,t.minZoom,e.maxZoom,t.maxZoom),this._updateLayoutProperty("visibility",e.visible,t.visible,e.visible?"visible":"none")},Qh.prototype._updateFilter=function(e,t){$c(e,t)||this.map._getMap().setFilter(this.id,e)},Qh.prototype._updatePaintProperty=function(e,t,o,r){$c(t,o)||this.map._getMap().setPaintProperty(this.id,e,r||t)},Qh.prototype._updateLayoutProperty=function(e,t,o,r){$c(t,o)||this.map._getMap().setLayoutProperty(this.id,e,r||t)},Qh.prototype._updateZoomRange=function(e,t,o,r){e===t&&r===o||this.map._getMap().setLayerZoomRange(this.id,e,o)},Qh.LayerEvents={layeradded:void 0,layerremoved:void 0,focusin:void 0,focusout:void 0},Qh);function Qh(e){var t=Wh.call(this)||this;return t.id=e||W(),t}(window&&window.__extends||(Vh=function(e,t){return(Vh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Vh(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Xh,Jh=ye),Xh._cloneCustomizer=function(e){if(e instanceof nh)return e};var Vh,Jh,un=Xh;function Xh(){var e=null!==Jh&&Jh.apply(this,arguments)||this;return e.filter=void 0,e.minZoom=0,e.maxZoom=24,e.visible=!0,e}(window&&window.__extends||($h=function(e,t){return($h=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}$h(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(od,ed=un);var $h,ed,td=od;function od(){var e=null!==ed&&ed.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.color="#1A73AA",e.blur=0,e.opacity=1,e.strokeColor="#FFFFFF",e.strokeOpacity=1,e.strokeWidth=2,e.pitchAlignment="viewport",e.radius=8,e.createIndicators=!1,e.accessibilityIdKey=void 0,e}var rd,nd,Uo=window&&window.__extends||(rd=function(e,t){return(rd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}rd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),id=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},ad=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},sd=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},cd=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},ud=(Uo(ld,nd=Zh),ld.prototype.getOptions=function(){return Ql(this.options,td._cloneCustomizer)},ld.prototype.getSource=function(){return this.options.source},ld.prototype.setOptions=function(e){e=(new td).merge(this.options,Ql(e,td._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("circle-blur",e.blur,this.options.blur),this._updatePaintProperty("circle-color",e.color,this.options.color),this._updatePaintProperty("circle-opacity",e.opacity,this.options.opacity),this._updatePaintProperty("circle-radius",e.radius,this.options.radius),this._updatePaintProperty("circle-stroke-color",e.strokeColor,this.options.strokeColor),this._updatePaintProperty("circle-stroke-opacity",e.strokeOpacity,this.options.strokeOpacity),this._updatePaintProperty("circle-stroke-width",e.strokeWidth,this.options.strokeWidth),this._updatePaintProperty("circle-pitch-alignment",e.pitchAlignment,this.options.pitchAlignment)}this.options=e},ld.prototype.onAdd=function(t){var e,o,r=this;nd.prototype.onAdd.call(this,t),this.options.createIndicators&&(t.events.addOnce("idle",this._setAccessibleIndicator),t.events.add("moveend",this._setAccessibleIndicator),(e=this._getDataSource())?t.events.add("dataadded",e,function(){t.events.addOnce("idle",r._setAccessibleIndicator)}):(o="string"==typeof this.options.source?this.options.source:this.options.source.getId(),t.events.add("sourcedata",function(e){(null==(e=e.source)?void 0:e.getId())===o&&t._getMap().isSourceLoaded(o)&&(e=r._getSourceDataEventCacheKey())!==r.sourceDataEventCacheKey&&(r._setAccessibleIndicator(),r.sourceDataEventCacheKey=e)})))},ld.prototype.onRemove=function(){var e;this.options.createIndicators&&(this.map.events.remove("idle",this._setAccessibleIndicator),this.map.events.remove("moveend",this._setAccessibleIndicator),(e=this._getDataSource())?this.map.events.remove("dataadded",e,this._setAccessibleIndicator):this.map.events.remove("sourcedata",this._setAccessibleIndicator)),nd.prototype.onRemove.call(this)},ld.prototype._getSourceDataEventCacheKey=function(){var e;if(this.map)return e=this.map.getServiceOptions().mapConfiguration,cd(cd([],sd(this.map.getCamera().bounds),!1),[this.map.getCamera().zoom,this.map.getCamera().pitch,this.map.getStyle().style,e instanceof Object?e.id:e],!1).join(",")},ld.prototype._getDataSource=function(){var e="string"==typeof this.options.source?this.map.sources.getById(this.options.source):this.options.source;if(e instanceof uh)return e},ld.prototype._buildLayers=function(){var e={id:this.id,type:"circle",source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"circle-color":this.options.color,"circle-blur":this.options.blur,"circle-opacity":this.options.opacity,"circle-stroke-color":this.options.strokeColor,"circle-stroke-opacity":this.options.strokeOpacity,"circle-stroke-width":this.options.strokeWidth,"circle-pitch-alignment":this.options.pitchAlignment,"circle-radius":this.options.radius},minzoom:this.options.minZoom,maxzoom:this.options.maxZoom};return this.options.filter&&(e.filter=this.options.filter),this.options.sourceLayer&&(e["source-layer"]=this.options.sourceLayer),[e]},ld.prototype._getLayerIds=function(){return[this.id]},ld.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e},ld.prototype.getFirstCoordinate=function(e){return Array.isArray(e[0])?this.getFirstCoordinate(e[0]):e},ld);function ld(e,t,o){var r=nd.call(this,t)||this;return r.accessibleIndicator=[],r._setAccessibleIndicator=function(){return id(r,void 0,void 0,function(){var t,c,u,l,h,d,p=this;return ad(this,function(e){return this.accessibleIndicator.forEach(function(e){return e.remove()}),this.accessibleIndicator=[],t=this.map.layers.getRenderedShapes(this.map.getCamera().bounds,this),c=this.options.accessibilityIdKey||(this._getDataSource()?_l._shapeIdPropName:void 0),u=function(t,o){var r=t[o],n=r instanceof _l?r.toJson():r,i=new Vl({positionInSet:o+1,setSize:t.length}),a=i.getElement(),s=sd(p.map.positionsToPixels([p.getFirstCoordinate(n.geometry.coordinates)]),1)[0];return a.addEventListener("focusin",function(e){p.accessibleIndicator.filter(function(e){return e!==i}).forEach(function(e){return e.remove()}),0<=o-1&&l(i,u(t,o-1)),o+1<t.length&&d(u(t,o+1)),2<=o&&o==t.length-1&&h(u(t,0)),0==o&&2<=t.length&&d(u(t,t.length-1)),void 0!==c&&p.map._getMap().setPaintProperty(p.id,"circle-stroke-color",["case",["==",["get",c],n.properties[c]],"#000000",p.options.strokeColor]);e={target:a,type:"focusin",map:p.map,shape:r,originalEvent:e,pixel:s};p._invokeEvent("focusin",e)}),a.addEventListener("focusout",function(e){void 0!==c&&p.map._getMap().setPaintProperty(p.id,"circle-stroke-color",["case",["==",["get",c],n.properties[c]],p.options.strokeColor,p.options.strokeColor]);e={target:a,type:"focusout",map:p.map,shape:r,originalEvent:e,pixel:s};p._invokeEvent("focusout",e)}),p.accessibleIndicator.push(i),i},l=function(e,t){t.attach(p.map);t=t.getElement(),e=e.getElement();e.parentElement.insertBefore(t,e)},h=function(e){e.attach(p.map);var e=e.getElement(),t=e.parentElement;t.insertBefore(e,t.firstElementChild)},d=function(e){e.attach(p.map)},0<t.length&&d(u(t,0)),1<t.length&&d(u(t,t.length-1)),[2]})})},r.options=(new td).merge(Ql(o,td._cloneCustomizer)),r.options.source=e||r.options.source,r}(window&&window.__extends||(hd=function(e,t){return(hd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}hd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(fd,dd=un),fd._cloneCustomizer=function(e){if(e instanceof nh)return e};var hd,dd,pd=fd;function fd(){var e=null!==dd&&dd.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.color=["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0, 255,0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],e.intensity=1,e.opacity=1,e.radius=30,e.weight=1,e}(window&&window.__extends||(gd=function(e,t){return(gd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(yd,md=Zh),yd.prototype.getOptions=function(){return Ql(this.options,pd._cloneCustomizer)},yd.prototype.getSource=function(){return this.options.source},yd.prototype.setOptions=function(e){e=(new pd).merge(this.options,Ql(e,pd._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("heatmap-color",e.color,this.options.color),this._updatePaintProperty("heatmap-intensity",e.intensity,this.options.intensity),this._updatePaintProperty("heatmap-opacity",e.opacity,this.options.opacity),this._updatePaintProperty("heatmap-radius",e.radius,this.options.radius),this._updatePaintProperty("heatmap-weight",e.weight,this.options.weight)}this.options=e},yd.prototype._buildLayers=function(){var e={id:this.id,type:"heatmap",source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"heatmap-color":this.options.color,"heatmap-intensity":this.options.intensity,"heatmap-opacity":this.options.opacity,"heatmap-radius":this.options.radius,"heatmap-weight":this.options.weight},minzoom:this.options.minZoom,maxzoom:this.options.maxZoom};return this.options.filter&&(e.filter=this.options.filter),this.options.sourceLayer&&(e["source-layer"]=this.options.sourceLayer),[e]},yd.prototype._getLayerIds=function(){return[this.id]},yd.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e};var gd,md,e=yd;function yd(e,t,o){t=md.call(this,t)||this;return t.options=(new pd).merge(Ql(o,pd._cloneCustomizer)),t.options.source=e||t.options.source,t}(window&&window.__extends||(vd=function(e,t){return(vd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}vd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(wd,_d=un);var vd,_d,cn=wd;function wd(){var e=null!==_d&&_d.apply(this,arguments)||this;return e.contrast=0,e.fadeDuration=300,e.hueRotation=0,e.maxBrightness=1,e.minBrightness=0,e.opacity=1,e.saturation=0,e}(window&&window.__extends||(bd=function(e,t){return(bd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}bd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Sd,Cd=cn),Sd._cloneCustomizer=function(e){if(e instanceof nh)return e};var bd,Cd,Ed=Sd;function Sd(){var e=null!==Cd&&Cd.apply(this,arguments)||this;return e.url=void 0,e.coordinates=void 0,e}(window&&window.__extends||(Td=function(e,t){return(Td=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Td(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ad,Id=Zh),Ad.prototype._getSourceIds=function(){var e=new Set;return e.add(this._getSourceId()),e},Ad.prototype.onAdd=function(e){Id.prototype.onAdd.call(this,e)};var Td,Id,kd=Ad;function Ad(){return null!==Id&&Id.apply(this,arguments)||this}(window&&window.__extends||(Pd=function(e,t){return(Pd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Pd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Rd,Od=kd),Rd.prototype.getOptions=function(){return Ql(this.options,Ed._cloneCustomizer)},Rd.prototype.setOptions=function(e){var t,o=(new Ed).merge(this.options,Ql(e,Ed._cloneCustomizer)),r="string"==typeof e.url&&e.url!==this.getOptions().url,e=void 0!==e.coordinates&&e.coordinates!==this.getOptions().coordinates;this.map&&(this._updateBaseProperties(o,this.options),this._updatePaintProperty("raster-contrast",o.contrast,this.options.contrast),this._updatePaintProperty("raster-fade-duration",o.fadeDuration,this.options.fadeDuration),this._updatePaintProperty("raster-hue-rotate",o.hueRotation,this.options.hueRotation),this._updatePaintProperty("raster-brightness-max",o.maxBrightness,this.options.maxBrightness),this._updatePaintProperty("raster-opacity",o.opacity,this.options.opacity),this._updatePaintProperty("raster-saturation",o.saturation,this.options.saturation),t=this.map._getMap().getSource(this._getSourceId()))&&t.updateImage(o),this.options=o,r?this.reloadImage():e&&this.updateTransform()},Rd.prototype.getPositions=function(t){return this.transform.then(function(e){return e.toTarget(t)})},Rd.prototype.getPixels=function(t){return this.transform.then(function(e){return e.toSource(t)})},Rd.getCoordinatesFromRefPoints=function(e,t,o,r){return new jl(o,r).toTarget([[0,0],[e,0],[e,t],[0,t]])},Rd.getCoordinatesFromEdges=function(e,t,o,r,n){"number"!=typeof n&&(n=0);t=[Math.min(r,o),t,Math.max(r,o),e],r=f.getCenter(t);return Qu([f.getNorthWest(t),f.getNorthEast(t),f.getSouthEast(t),f.getSouthWest(t)],r,n)},Rd.prototype._buildLayers=function(){var e={id:this.id,type:"raster",source:this._getSourceId(),layout:{visibility:this.options.visible?"visible":"none"},paint:{"raster-opacity":this.options.opacity,"raster-hue-rotate":this.options.hueRotation,"raster-brightness-min":this.options.minBrightness,"raster-brightness-max":this.options.maxBrightness,"raster-saturation":this.options.saturation,"raster-contrast":this.options.contrast,"raster-fade-duration":this.options.fadeDuration},minzoom:this.options.minZoom,maxzoom:this.options.maxZoom};return this.options.filter&&(e.filter=this.options.filter),[e]},Rd.prototype._getLayerIds=function(){return[this.id]},Rd.prototype._buildSource=function(){return{type:"image",url:this.options.url,coordinates:this.options.coordinates}},Rd.prototype._getSourceId=function(){return"".concat(this.getId(),"-ImageSource")},Rd.prototype.reloadImage=function(){var o=this;this.options.url&&(this.transform=new Promise(function(t,e){o.img.onload=function(){var e=[[0,0],[o.img.width,0],[o.img.width,o.img.height],[0,o.img.height]];t(new jl(e,o.options.coordinates)),o.isLoading=!1},o.img.onerror=o.img.onabort=function(){e("Failed to load image")},o.isLoading=!0,o.img.src=o.options.url}))},Rd.prototype.updateTransform=function(){var e;this.isLoading||(e=[[0,0],[this.img.width,0],[this.img.width,this.img.height],[0,this.img.height]],this.transform=Promise.resolve(new jl(e,this.options.coordinates)))},Rd.prototype._getSourceWrapper=function(){var e=this._getSourceId(),t=this._buildSource();return new Ph(e,t)};var Pd,Od,r=Rd;function Rd(e,t){t=Od.call(this,t)||this;return t.isLoading=!1,t.options=(new Ed).merge(Ql(e,Ed._cloneCustomizer)),t.img=new Image,t.reloadImage(),t}(window&&window.__extends||(xd=function(e,t){return(xd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}xd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ld,Md=un);var xd,Md,Nd=Ld;function Ld(){var e=null!==Md&&Md.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.lineCap="round",e.lineJoin="round",e.blur=0,e.strokeColor="#1E90FF",e.strokeDashArray=void 0,e.strokeGradient=void 0,e.offset=0,e.strokeOpacity=1,e.translate=new nu(0,0),e.translateAnchor="map",e.strokeWidth=2,e}var Dd,qd,hi=window&&window.__extends||(Dd=function(e,t){return(Dd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Dd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Ud=window&&window.__assign||function(){return(Ud=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},jd=(hi(Hd,qd=Zh),Hd.prototype.getOptions=function(){return Ql(this.options,Nd._cloneCustomizer)},Hd.prototype.getSource=function(){return this.options.source},Hd.prototype.setOptions=function(e){e=(new Nd).merge(this.options,Ql(e,Nd._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("line-blur",e.blur,this.options.blur),this._updateLayoutProperty("line-cap",e.lineCap,this.options.lineCap),this._updateLayoutProperty("line-join",e.lineJoin,this.options.lineJoin),this._updatePaintProperty("line-offset",e.offset,this.options.offset),this._updatePaintProperty("line-color",e.strokeColor,this.options.strokeColor),this._updatePaintProperty("line-dasharray",e.strokeDashArray,this.options.strokeDashArray),this._updatePaintProperty("line-gradient",e.strokeGradient,this.options.strokeGradient),this._updatePaintProperty("line-opacity",e.strokeOpacity,this.options.strokeOpacity),this._updatePaintProperty("line-width",e.strokeWidth,this.options.strokeWidth),this._updatePaintProperty("line-translate",e.translate,this.options.translate),this._updatePaintProperty("line-translate-anchor",e.translateAnchor,this.options.translateAnchor)}this.options=e},Hd.prototype._buildLayers=function(){return[Ud(Ud(Ud(Ud({id:this.id,type:"line"},this.options.sourceLayer&&{"source-layer":this.options.sourceLayer}),{source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none","line-cap":this.options.lineCap,"line-join":this.options.lineJoin},paint:Ud(Ud(Ud({"line-blur":this.options.blur,"line-color":this.options.strokeColor},this.options.strokeDashArray?{"line-dasharray":this.options.strokeDashArray}:{}),this.options.strokeGradient?{"line-gradient":this.options.strokeGradient}:{}),{"line-offset":this.options.offset,"line-opacity":this.options.strokeOpacity,"line-translate":this.options.translate,"line-translate-anchor":this.options.translateAnchor,"line-width":this.options.strokeWidth})}),this.options.filter&&{filter:this.options.filter}),{minzoom:this.options.minZoom,maxzoom:this.options.maxZoom})]},Hd.prototype._getLayerIds=function(){return[this.id]},Hd.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e},Hd);function Hd(e,t,o){t=qd.call(this,t)||this;return t.options=(new Nd).merge(Ql(o,Nd._cloneCustomizer)),t.options.source=e||t.options.source,t}(window&&window.__extends||(Bd=function(e,t){return(Bd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Bd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Kd,Fd=un);var Bd,Fd,zd=Kd;function Kd(){var e=null!==Fd&&Fd.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.base=0,e.fillColor="#1E90FF",e.height=0,e.fillOpacity=1,e.fillPattern=void 0,e.translate=new nu(0,0),e.translateAnchor="map",e.verticalGradient=!0,e}var Gd,Yd,i=window&&window.__extends||(Gd=function(e,t){return(Gd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Gd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Wd=window&&window.__assign||function(){return(Wd=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},t=(i(Zd,Yd=Zh),Zd.prototype.getOptions=function(){return Ql(this.options,zd._cloneCustomizer)},Zd.prototype.getSource=function(){return this.options.source},Zd.prototype.setOptions=function(e){e=(new zd).merge(this.options,Ql(e,zd._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("fill-extrusion-base",e.base,this.options.base),this._updatePaintProperty("fill-extrusion-color",e.fillColor,this.options.fillColor),this._updatePaintProperty("fill-extrusion-height",e.height,this.options.height),this._updatePaintProperty("fill-extrusion-opacity",e.fillOpacity,this.options.fillOpacity),this._updatePaintProperty("fill-extrusion-pattern",e.fillPattern,this.options.fillPattern),this._updatePaintProperty("fill-extrusion-translate",e.translate,this.options.translate),this._updatePaintProperty("fill-extrusion-translate-anchor",e.translateAnchor,this.options.translateAnchor),this._updatePaintProperty("fill-extrusion-vertical-gradient",e.verticalGradient,this.options.verticalGradient)}this.options=e},Zd.prototype._buildLayers=function(){return[Wd(Wd(Wd(Wd({id:this.id,type:"fill-extrusion"},this.options.sourceLayer&&{"source-layer":this.options.sourceLayer}),{source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none"},paint:Wd(Wd({"fill-extrusion-base":this.options.base,"fill-extrusion-height":this.options.height,"fill-extrusion-opacity":this.options.fillOpacity},this.options.fillPattern?{"fill-extrusion-pattern":this.options.fillPattern}:{"fill-extrusion-color":this.options.fillColor}),{"fill-extrusion-translate":this.options.translate,"fill-extrusion-translate-anchor":this.options.translateAnchor,"fill-extrusion-vertical-gradient":this.options.verticalGradient})}),this.options.filter&&{filter:this.options.filter}),{minzoom:this.options.minZoom,maxzoom:this.options.maxZoom})]},Zd.prototype._getLayerIds=function(){return[this.id]},Zd.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e},Zd);function Zd(e,t,o){t=Yd.call(this,t)||this;return t.options=(new zd).merge(Ql(o,zd._cloneCustomizer)),t.options.source=e||t.options.source,t}(window&&window.__extends||(Qd=function(e,t){return(Qd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Qd(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Xd,Vd=un);var Qd,Vd,Jd=Xd;function Xd(){var e=null!==Vd&&Vd.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.fillColor="#1E90FF",e.fillOpacity=.5,e.fillPattern=void 0,e.fillAntialias=!0,e}(window&&window.__extends||($d=function(e,t){return($d=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}$d(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(op,ep=Zh),op.prototype.getOptions=function(){return Ql(this.options,Jd._cloneCustomizer)},op.prototype.getSource=function(){return this.options.source},op.prototype.setOptions=function(e){e=(new Jd).merge(this.options,Ql(e,Jd._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("fill-color",e.fillColor,this.options.fillColor),this._updatePaintProperty("fill-opacity",e.fillOpacity,this.options.fillOpacity),this._updatePaintProperty("fill-pattern",e.fillPattern,this.options.fillPattern),this._updatePaintProperty("fill-antialias",e.fillAntialias,this.options.fillAntialias)}this.options=e},op.prototype._buildLayers=function(){var e={id:this.id,type:"fill",source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:{visibility:this.options.visible?"visible":"none"},paint:{"fill-opacity":this.options.fillOpacity,"fill-antialias":this.options.fillAntialias},minzoom:this.options.minZoom,maxzoom:this.options.maxZoom};return this.options.filter&&(e.filter=this.options.filter),this.options.sourceLayer&&(e["source-layer"]=this.options.sourceLayer),this.options.fillPattern?e.paint["fill-pattern"]=this.options.fillPattern:e.paint["fill-color"]=this.options.fillColor,[e]},op.prototype._getLayerIds=function(){return[this.id]},op.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e};var $d,ep,tp=op;function op(e,t,o){t=ep.call(this,t)||this;return t.options=(new Jd).merge(Ql(o,Jd._cloneCustomizer)),t.options.source=e||t.options.source,t}(window&&window.__extends||(rp=function(e,t){return(rp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}rp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(ap,np=ye);var rp,np,ip=ap;function ap(){var e=null!==np&&np.apply(this,arguments)||this;return e.allowOverlap=!1,e.anchor="bottom",e.ignorePlacement=!1,e.image="marker-blue",e.offset=new nu(0,0),e.optional=!1,e.padding=2,e.pitchAlignment="auto",e.rotation=0,e.rotationAlignment="auto",e.size=1,e.opacity=1,e}(window&&window.__extends||(sp=function(e,t){return(sp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}sp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(lp,cp=ye);var sp,cp,up=lp;function lp(){var e=null!==cp&&cp.apply(this,arguments)||this;return e.allowOverlap=!1,e.anchor="center",e.textField=void 0,e.font=["StandardFont-Regular"],e.ignorePlacement=!1,e.justify="center",e.offset=new nu(0,0),e.optional=!1,e.padding=2,e.pitchAlignment="auto",e.radialOffset=void 0,e.rotation=0,e.rotationAlignment="auto",e.variableAnchor=void 0,e.size=16,e.color="#000000",e.haloBlur=0,e.haloColor="rgba(0,0,0,0)",e.haloWidth=0,e.opacity=1,e}(window&&window.__extends||(hp=function(e,t){return(hp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}hp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(fp,dp=un);var hp,dp,pp=fp;function fp(){var e=null!==dp&&dp.apply(this,arguments)||this;return e.source=void 0,e.sourceLayer=void 0,e.iconOptions=new ip,e.textOptions=new up,e.placement="point",e.sortKey=void 0,e.zOrder="auto",e.lineSpacing=250,e}var gp,mp,be=window&&window.__extends||(gp=function(e,t){return(gp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),yp=window&&window.__assign||function(){return(yp=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},vp=(be(_p,mp=Zh),_p.prototype.getOptions=function(){return Ql(this.options,pp._cloneCustomizer)},_p.prototype.getSource=function(){return this.options.source},_p.prototype.setOptions=function(e){e=(new pp).merge(this.options,Ql(e,pp._cloneCustomizer));if(this.map){if(e.source!==this.options.source||e.sourceLayer!==this.options.sourceLayer)return this.options=e,void this.map.layers.add(this);var t=this.options,o=e.iconOptions,r=t.iconOptions,n=e.textOptions,i=t.textOptions;this._updateBaseProperties(e,t),this._updateLayoutProperty("symbol-spacing",e.lineSpacing,t.lineSpacing),this._updateLayoutProperty("symbol-placement",e.placement,t.placement),this._updateLayoutProperty("symbol-sort-key",e.sortKey,t.sortKey),this._updateLayoutProperty("symbol-z-order",e.zOrder,t.zOrder),this._updateLayoutProperty("icon-allow-overlap",o.allowOverlap,r.allowOverlap),this._updateLayoutProperty("icon-anchor",o.anchor,r.anchor),this._updateLayoutProperty("icon-ignore-placement",o.ignorePlacement,r.ignorePlacement),this._updateLayoutProperty("icon-image",o.image,r.image),this._updateLayoutProperty("icon-offset",o.offset,r.offset),this._updatePaintProperty("icon-opacity",o.opacity,r.opacity),this._updateLayoutProperty("icon-optional",o.optional,r.optional),this._updateLayoutProperty("icon-padding",o.padding,r.padding),this._updateLayoutProperty("icon-pitch-alignment",o.pitchAlignment,r.pitchAlignment),this._updateLayoutProperty("icon-rotate",o.rotation,r.rotation),this._updateLayoutProperty("icon-rotation-alignment",o.rotationAlignment,r.rotationAlignment),this._updateLayoutProperty("icon-size",o.size,r.size),this._updateLayoutProperty("text-allow-overlap",n.allowOverlap,i.allowOverlap),this._updateLayoutProperty("text-anchor",n.anchor,i.anchor),this._updatePaintProperty("text-color",n.color,i.color),this._updateLayoutProperty("text-font",n.font,i.font),this._updateLayoutProperty("text-ignore-placement",n.ignorePlacement,i.ignorePlacement),this._updateLayoutProperty("text-justify",n.justify,i.justify),this._updatePaintProperty("text-halo-blur",n.haloBlur,i.haloBlur),this._updatePaintProperty("text-halo-color",n.haloColor,i.haloColor),this._updatePaintProperty("text-halo-width",n.haloWidth,i.haloWidth),this._updateLayoutProperty("text-offset",n.offset,i.offset),this._updatePaintProperty("text-opacity",n.opacity,i.opacity),this._updateLayoutProperty("text-optional",n.optional,i.optional),this._updateLayoutProperty("text-padding",n.padding,i.padding),this._updateLayoutProperty("text-pitch-alignment",n.pitchAlignment,i.pitchAlignment),this._updateLayoutProperty("text-radial-offset",n.radialOffset,i.radialOffset),this._updateLayoutProperty("text-rotate",n.rotation,i.rotation),this._updateLayoutProperty("text-rotation-alignment",n.rotationAlignment,i.rotationAlignment),this._updateLayoutProperty("text-size",n.size,i.size),this._updateLayoutProperty("text-variable-anchor",n.variableAnchor,i.variableAnchor),this._updateLayoutProperty("text-field",n.textField,i.textField)}this.options=e},_p.prototype._buildLayers=function(){var e=yp(yp(yp(yp({id:this.id,type:"symbol"},this.options.sourceLayer&&{"source-layer":this.options.sourceLayer}),{source:this.options.source instanceof nh?this.options.source.getId():this.options.source,layout:yp(yp({visibility:this.options.visible?"visible":"none","symbol-placement":this.options.placement,"symbol-spacing":this.options.lineSpacing,"symbol-z-order":this.options.zOrder,"text-allow-overlap":this.options.textOptions.allowOverlap,"text-anchor":this.options.textOptions.anchor},this.options.textOptions.textField&&{"text-field":this.options.textOptions.textField}),{"text-font":this.options.textOptions.font,"text-ignore-placement":this.options.textOptions.ignorePlacement,"text-justify":this.options.textOptions.justify,"text-offset":this.options.textOptions.offset,"text-optional":this.options.textOptions.optional,"text-padding":this.options.textOptions.padding,"text-pitch-alignment":this.options.textOptions.pitchAlignment,"text-rotate":this.options.textOptions.rotation,"text-rotation-alignment":this.options.textOptions.rotationAlignment,"text-size":this.options.textOptions.size,"icon-allow-overlap":this.options.iconOptions.allowOverlap,"icon-anchor":this.options.iconOptions.anchor,"icon-ignore-placement":this.options.iconOptions.ignorePlacement,"icon-image":this.options.iconOptions.image,"icon-offset":this.options.iconOptions.offset,"icon-optional":this.options.iconOptions.optional,"icon-padding":this.options.iconOptions.padding,"icon-pitch-alignment":this.options.iconOptions.pitchAlignment,"icon-rotate":this.options.iconOptions.rotation,"icon-rotation-alignment":this.options.iconOptions.rotationAlignment,"icon-size":this.options.iconOptions.size}),paint:{"text-color":this.options.textOptions.color,"text-halo-blur":this.options.textOptions.haloBlur,"text-halo-color":this.options.textOptions.haloColor,"text-halo-width":this.options.textOptions.haloWidth,"text-opacity":this.options.textOptions.opacity,"icon-opacity":this.options.iconOptions.opacity}}),this.options.filter&&{filter:this.options.filter}),{minzoom:this.options.minZoom,maxzoom:this.options.maxZoom});return void 0!==this.options.sortKey&&(e.layout["symbol-sort-key"]=this.options.sortKey),void 0!==this.options.textOptions.radialOffset&&(e.layout["text-radial-offset"]=this.options.textOptions.radialOffset),void 0!==this.options.textOptions.variableAnchor&&(e.layout["text-variable-anchor"]=this.options.textOptions.variableAnchor),[e]},_p.prototype._getLayerIds=function(){return[this.id]},_p.prototype._getSourceIds=function(){var e=new Set;return this.options.source instanceof nh?e.add(this.options.source.getId()):e.add(this.options.source),e},_p);function _p(e,t,o){t=mp.call(this,t)||this;return t.options=(new pp).merge(Ql(o,pp._cloneCustomizer)),t.options.source=e||t.options.source,t}var wp,bp,Mi=window&&window.__extends||(wp=function(e,t){return(wp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}wp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Cp=window&&window.__assign||function(){return(Cp=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Ep=(Mi(Sp,bp=nh),Sp.prototype._buildSource=function(){return this.source},Sp.prototype._isDeepEqual=function(e){var o,t,r,n;return this.constructor===e.constructor&&(n=this.source,o=e.source,e=n.type===o.type&&n.url===o.url&&(void 0===n.tiles&&void 0===o.tiles||n.tiles&&o.tiles&&n.tiles.length===o.tiles.length&&n.tiles.every(function(e,t){return e===o.tiles[t]}))&&n.minzoom===o.minzoom&&n.maxzoom===o.maxzoom&&n.bounds===o.bounds&&n.attribution===o.attribution,t="raster"!==n.type||"raster"===n.type&&n.type===o.type&&n.tileSize===o.tileSize&&n.scheme===o.scheme,r="raster-dem"!==n.type||"raster-dem"===n.type&&n.type===o.type&&n.tileSize===o.tileSize&&n.encoding===o.encoding,n="vector"!==n.type||"vector"===n.type&&n.type===o.type&&n.promoteId===o.promoteId&&n.scheme===o.scheme,e)&&t&&r&&n},Sp.prototype._modifySource=function(e,t){if("raster"!==e.type&&"raster-dem"!==e.type&&"vector"!==e.type||!e.tiles){if("raster"!==e.type&&"raster-dem"!==e.type&&"vector"!==e.type||!e.url)throw new Error("Source definition must define a TileJSON 'url' or a 'tiles' array.");e.url="string"==typeof e.url?e.url:new Te({domain:te,path:e.url.path,queryParams:Cp(Cp({},t),e.url.queryParams)}).toString()}else{var o=e.tiles.map(function(e){return"string"==typeof e?e:new Te({domain:te,path:e.path,queryParams:Cp(Cp({},t),e.queryParams)}).toString()});e.tiles=o}return e},Sp);function Sp(e,t,o){e=bp.call(this,e)||this;return e.source=e._modifySource(t,o),e}(window&&window.__extends||(Tp=function(e,t){return(Tp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Tp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Ap,Ip=cn);var Tp,Ip,kp=Ap;function Ap(){var e=null!==Ip&&Ip.apply(this,arguments)||this;return e.bounds=[-180,-85.0511,180,85.0511],e.minSourceZoom=0,e.maxSourceZoom=22,e.tileSize=512,e.isTMS=!1,e.subdomains=void 0,e.tileUrl=void 0,e}var Pp,Op,o=window&&window.__extends||(Pp=function(e,t){return(Pp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Pp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),Rp=window&&window.__assign||function(){return(Rp=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},xp=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Mp=(o(Np,Op=kd),Np.prototype.getOptions=function(){return Ql(this.options,kp._cloneCustomizer)},Np.prototype.setOptions=function(e){e=(new kp).merge(this.options,Ql(e,kp._cloneCustomizer));if(this.map){if(!$c(e.bounds,this.options.bounds)||e.isTMS!==this.options.isTMS||e.maxSourceZoom!==this.options.maxSourceZoom||e.minSourceZoom!==this.options.minSourceZoom||!$c(e.subdomains,this.options.subdomains)||e.tileSize!==this.options.tileSize||e.tileUrl!==this.options.tileUrl)return this.options=e,void this.map.layers.add(this);this._updateBaseProperties(e,this.options),this._updatePaintProperty("raster-contrast",e.contrast,this.options.contrast),this._updatePaintProperty("raster-fade-duration",e.fadeDuration,this.options.fadeDuration),this._updatePaintProperty("raster-hue-rotate",e.hueRotation,this.options.hueRotation),this._updatePaintProperty("raster-brightness-max",e.maxBrightness,this.options.maxBrightness),this._updatePaintProperty("raster-opacity",e.opacity,this.options.opacity),this._updatePaintProperty("raster-saturation",e.saturation,this.options.saturation)}this.options=e},Np.prototype._setOptionsNoUpdate=function(e){this.options=(new kp).merge(this.options,Ql(e,kp._cloneCustomizer))},Np.prototype._buildLayers=function(){return[Rp(Rp({id:this.id,type:"raster",source:this._getSourceId(),layout:{visibility:this.options.visible?"visible":"none"},paint:{"raster-contrast":this.options.contrast,"raster-fade-duration":this.options.fadeDuration,"raster-hue-rotate":this.options.hueRotation,"raster-brightness-max":this.options.maxBrightness,"raster-brightness-min":this.options.minBrightness,"raster-opacity":this.options.opacity,"raster-saturation":this.options.saturation}},this.options.filter&&{filter:this.options.filter}),{minzoom:this.options.minZoom,maxzoom:this.options.maxZoom})]},Np.prototype._getLayerIds=function(){return[this.id]},Np.prototype._buildSource=function(){var t,e;if(this.options.tileUrl){if(-1===this.options.tileUrl.indexOf("{"))return{type:"raster",url:this.options.tileUrl};if(-1!==this.options.tileUrl.indexOf("{subdomain}")){if(!(this.options.subdomains&&0<this.options.subdomains.length))throw new Error("The {subdomain} placeholder was included in the tileUrl but no subdomains were specified");var o=[];try{for(var r=xp(this.options.subdomains),n=r.next();!n.done;n=r.next()){var i=n.value;o.push(this.options.tileUrl.replace(/{subdomain}/g,i))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}e=o}else e=[this.options.tileUrl]}return Rp({type:"raster",bounds:this.options.bounds,maxzoom:this.options.maxSourceZoom,minzoom:this.options.minSourceZoom,scheme:this.options.isTMS?"tms":"xyz",tileSize:this.options.tileSize},e&&{tiles:e})},Np.prototype._getSourceId=function(){return"".concat(this.getId(),"-RasterSource")},Np.prototype._getSourceWrapper=function(){var e=this._getSourceId(),t=this._buildSource();return new Ep(e,{name:e,tiles:t.tiles,type:t.type,url:t.url})},Np);function Np(e,t){t=Op.call(this,t)||this;return e&&t.setOptions(e),t}(window&&window.__extends||(Lp=function(e,t){return(Lp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Lp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Up,Dp=un);var Lp,Dp,qp=Up;function Up(){var e=null!==Dp&&Dp.apply(this,arguments)||this;return e.renderer=void 0,e}(window&&window.__extends||(jp=function(e,t){return(jp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}jp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Fp,Hp=Zh),Fp.prototype.getOptions=function(){return Ql(this.options,qp._cloneCustomizer)},Fp.prototype.setOptions=function(e){e=(new qp).merge(this.options,Ql(e,qp._cloneCustomizer));this.map&&this.map.triggerRepaint(),this.options=e},Fp.prototype.onAdd=function(e){var t,o;Hp.prototype.onAdd.call(this,e),this.map.events.add("stylechanged",this._onStyleChange),this.options.renderer&&this.glContext&&null!=(o=(t=this.options.renderer).onAdd)&&o.call(t,e,this.glContext)},Fp.prototype.onRemove=function(){var e,t;this.options.renderer&&this.glContext&&null!=(t=(e=this.options.renderer).onRemove)&&t.call(e,this.map,this.glContext),this.map.events.remove("stylechanged",this._onStyleChange),this.glContext=null,Hp.prototype.onRemove.call(this)},Fp.prototype._buildLayers=function(){var n=this;if(this.options.renderer)return[{id:this.id,type:"custom",renderingMode:this.options.renderer.renderingMode,onAdd:function(e,t){n.glContext=t},onRemove:function(e,t){},prerender:function(e,t){var o,r;n._shouldRender()&&null!=(r=(o=n.options.renderer).prerender)&&r.call(o,e,t)},render:function(e,t){n._shouldRender()&&n.options.renderer.render(e,t)}}];throw new Error("Cannot build the WebGL layer because renderer was not set.")},Fp.prototype._getLayerIds=function(){return[this.id]},Fp.prototype._getSourceIds=function(){return(new Set).add(this.source.getId())},Fp.prototype._shouldRender=function(){var e;return!!this.map&&(e=this.map.getCamera().zoom,this.options.visible)&&this.options.minZoom<=e&&this.options.maxZoom>e};var jp,Hp,Bp=Fp;function Fp(e,t){var o=Hp.call(this,e)||this;return o._onStyleChange=function(){var e,t;o.map._getMap().getLayer(o.id)||(e=o.map,t=null==(t=o.map.layers._getUserLayers().find(function(e){return e.layer.getId()==o.id}))?void 0:t.before,e.layers.remove(o),e.layers.add(o,t))},o.options=(new qp).merge(Ql(t,qp._cloneCustomizer)),o.source=new uh,o}var Ni=Object.freeze({__proto__:null,BubbleLayer:ud,HeatMapLayer:e,ImageLayer:r,Layer:Zh,LineLayer:jd,PolygonExtrusionLayer:t,PolygonLayer:tp,SymbolLayer:vp,TileLayer:Mp,WebGLLayer:Bp}),zp=(Kp.convertHtmlString=function(e){var t;return"string"==typeof e?((t=document.createElement("div")).innerHTML=e,t):e},Kp.parseWithFilter=function(e,t,o,r){var n=this;if(void 0===t&&(t=function(e){return!0}),void 0===o&&(o=function(e){return e}),void 0===r&&(r=function(){return document.createElement("div")}),"string"==typeof e){var i=(new DOMParser).parseFromString(e,"text/html").body;if(0==i.children.length)return o(i.innerHTML);var a,i=1==i.children.length&&1==i.childNodes.length?i.children[0]:(a=r(),Array.from(i.childNodes).map(function(e){return a.append(e)}),a)}else i=e;return Array.from(i.children).forEach(function(e){return n.parseWithFilter(e,t,o)}),t(i)?o(i):(i.parentNode&&i.parentNode.removeChild(i),null)},Kp);function Kp(){}var Gp=en,Yp=cs;var Wp,Zp,Qp=q(function(e){return Gp(e)&&1===e.nodeType&&!Yp(e)}),Vp=((window&&window.__extends||(Wp=function(e,t){return(Wp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Wp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Jp,Zp=ye),Jp._cloneCustomizer=function(e){if(Qp(e))return e},Jp);function Jp(){var e=null!==Zp&&Zp.apply(this,arguments)||this;return e.anchor="none",e.draggable=!1,e.closeButton=!0,e.content=document.createElement("span"),e.fillColor="#FFFFFF",e.pixelOffset=new nu(0,0),e.position=new dl(0,0),e.showPointer=!0,e}var Xp,$p,n=window&&window.__extends||(Xp=function(e,t){return(Xp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Xp(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),ef=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},tf=(n(of,$p=Qt),of.prototype.setPopupOptions=function(e){this.setOptions(e)},of.prototype.setOptions=function(e){var t,e=(new Vp).merge(this.options,Ql(e,Vp._cloneCustomizer));e.content!==this.options.content?(this.htmlContent.remove(),this.htmlContent=this._createHtmlContent(e),this.contentDiv.prepend(this.htmlContent)):e.draggable!==this.options.draggable&&this._setDraggable(this.htmlContent,e.draggable),e.closeButton&&!this.closeBtn?(this.closeBtn=this._createCloseButton(),this.contentDiv.appendChild(this.closeBtn),t=jt("close"),this.contentDiv.appendChild(t),Ht(t,this.closeBtn,!0)):!e.closeButton&&this.closeBtn&&(this.contentDiv.removeChild(this.closeBtn),delete this.closeBtn),e.showPointer&&!this.arrowDiv?(this.arrowDiv=this._createArrowDiv(),this.containerDiv.appendChild(this.arrowDiv)):!e.showPointer&&this.arrowDiv&&(this.containerDiv.removeChild(this.arrowDiv),delete this.arrowDiv),e.fillColor!==this.options.fillColor&&(this.containerDiv.style.borderColor=e.fillColor,this.contentDiv.style.backgroundColor=e.fillColor),this.marker&&(e.anchor!==this.options.anchor?"none"===this.options.anchor?(this.autoAnchor!==e.anchor&&this._replaceMarker(this.map,e),this.map.events.remove("move",this._onMove),delete this.autoAnchor):(this._replaceMarker(this.map,e),"none"===e.anchor&&this.map.events.add("move",this._onMove)):($c(e.position,this.options.position)||this.marker.setLngLat(e.position),$c(e.pixelOffset,this.options.pixelOffset)||this.marker.setOffset(e.pixelOffset))),this.options=e},of.prototype.getPopupOptions=function(){return this.getOptions()},of.prototype.getOptions=function(){return Ql(this.options,Vp._cloneCustomizer)},of.prototype.getPopupContainer=function(){return this.containerDiv},of.prototype._dragToPixel=function(e){this.dragging||(this.dragging=!0,this.contentDiv.style.pointerEvents="none",this._invokeEvent("dragstart",{type:"dragstart",target:this}));e=[e[0]+this.dragOffset[0],e[1]+this.dragOffset[1]],e=ef(this.map.pixelsToPositions([e]),1)[0];this.options.position=e,this.marker.setLngLat(this.options.position),this._invokeEvent("drag",{type:"drag",target:this})},of.prototype._onUp=function(){this.dragging&&(this.contentDiv.style.pointerEvents="",this._invokeEvent("dragend",{type:"dragend",target:this}),"none"===this.options.anchor)&&this._onMove(),delete this.dragOffset,delete this.dragging},of.prototype._createContainerDiv=function(e){var t=this,o=document.createElement("div"),r=(o.classList.add(of.Css.container),o.classList.add(of.Css.hidden),o.style.borderColor=e.fillColor,o.setAttribute("role","dialog"),o.setAttribute("aria-label","Map Information Window"),!1);return o.addEventListener("keydown",function(e){"Tab"!==e.key&&"Escape"!==e.key&&"Esc"!==e.key||(r=!0)}),o.addEventListener("keyup",function(e){"Tab"!==e.key&&"Escape"!==e.key&&"Esc"!==e.key||(r=!1)}),o.addEventListener("focusin",function(e){t.map&&!t.isOpen()&&(t.open(t.map),e.target instanceof HTMLElement)&&e.target.focus()}),o.addEventListener("focusout",function(e){r&&e.relatedTarget instanceof Node&&!o.contains(e.relatedTarget)&&(r=!1,t.isOpen())&&t.close()}),o},of.prototype._createContentDiv=function(e){var t=document.createElement("div");return t.classList.add(of.Css.content),t.style.backgroundColor=e.fillColor,t.setAttribute("tabindex","0"),this.htmlContent=this._createHtmlContent(e),t.appendChild(this.htmlContent),t},of.prototype._createArrowDiv=function(){var e=document.createElement("div");return e.classList.add(of.Css.arrow),e},of.prototype._createCloseButton=function(){var e=document.createElement("button");return e.addEventListener("click",this.close),e.classList.add(of.Css.close),e.setAttribute("aria-label","close"),e.setAttribute("tabindex","0"),e.innerHTML="×",e},of.prototype._createHtmlContent=function(e){var t=zp.convertHtmlString(e.content);return e.draggable&&this._setDraggable(t,e.draggable),t},of.prototype._createMarker=function(e,t){var o=this.marker?this.marker.getLngLat():e.position,t=("none"===e.anchor?(this.autoAnchor=t||"bottom",this.containerDiv.classList.add(this.autoAnchor),new D.Marker({anchor:this.autoAnchor,element:this.containerDiv,offset:e.pixelOffset})):(this.containerDiv.classList.add(e.anchor),new D.Marker({anchor:e.anchor,element:this.containerDiv,offset:e.pixelOffset}))).setLngLat(o);return t},of.prototype._getAutoAnchor=function(e,t){var o,r,n=this.containerDiv.offsetWidth,i=this.containerDiv.offsetHeight,a=[];return(r=this.marker?(o=(r=e._getMap().project(this.marker.getLngLat())).x,r.y):(r=ef(e.positionsToPixels([t.position]),1),o=(t=ef(r[0],2))[0],t[1]))<i?a.push("top"):r>e.getCanvas().offsetHeight-i&&a.push("bottom"),o<n/2?a.push("left"):o>e.getCanvas().offsetWidth-n/2&&a.push("right"),0<a.length?a.join("-"):"bottom"},of.prototype._replaceMarker=function(e,t,o){var r=this.containerDiv.nextElementSibling;this.marker.remove(),this.containerDiv.classList.remove(this.autoAnchor||this.options.anchor),this.marker=this._createMarker(t,o),this.marker.addTo(e._getMap()),e.popups._getCollectionDiv().insertBefore(this.containerDiv,r||null)},of.prototype._setDraggable=function(e,t){t?(e.addEventListener("mousedown",this._onDown),e.addEventListener("touchstart",this._onDown),e.addEventListener("dragstart",this._onDragStart)):(e.removeEventListener("mousedown",this._onDown),e.removeEventListener("touchstart",this._onDown),e.removeEventListener("dragstart",this._onDragStart))},of.Css={arrow:"popup-arrow",close:"popup-close",container:"popup-container",content:"popup-content-container",hidden:"hidden-accessible-element"},of);function of(e){var o=$p.call(this)||this;return o.attach=function(e){o.map!==e&&(o.map&&o.remove(),o.map=e,o.marker=o._createMarker(o.options),o.marker.addTo(o.map._getMap()),o.map.popups._getCollectionDiv().appendChild(o.containerDiv),o.map.popups.add(o))},o.open=function(e){if(!e&&!o.map)throw new Error("Must specify a map to open on or attach to a map in advance");o.attach(e||o.map),o.containerDiv.classList.remove(of.Css.hidden),o.map.events.add("move",o._onMove),o._onMove(),o._invokeEvent("open",{target:o,type:"open"})},o.close=function(){o.map&&o.map.events.remove("move",o._onMove),o.containerDiv.classList.add(of.Css.hidden),o._invokeEvent("close",{target:o,type:"close"})},o.remove=function(){o.map&&(o.marker.remove(),o.containerDiv.classList.remove(o.autoAnchor||o.options.anchor),o.map.events.remove("move",o._onMove),o.map.popups.remove(o),delete o.map,delete o.marker,delete o.autoAnchor)},o.isOpen=function(){return o.map&&!o.containerDiv.classList.contains(of.Css.hidden)},o._onMove=function(){var e=o._getAutoAnchor(o.map,o.options);e!==o.autoAnchor&&(o._replaceMarker(o.map,o.options,e),o.map.events.add("move",o._onMove))},o._onDown=function(e){o.map.popups._addDraggedPopup(o);var t=ef(o.map.positionsToPixels([o.options.position]),1)[0];"mousedown"===e.type?o.dragOffset=[t[0]-e.clientX,t[1]-e.clientY]:"touchstart"===e.type&&(o.dragOffset=[t[0]-e.touches[0].clientX,t[1]-e.touches[0].clientY])},o._onDragStart=function(e){e.preventDefault()},o.options=(new Vp).merge(Ql(e,Vp._cloneCustomizer)),o.containerDiv=o._createContainerDiv(o.options),o.contentDiv=o._createContentDiv(o.options),o.containerDiv.appendChild(o.contentDiv),o.options.showPointer&&(o.arrowDiv=o._createArrowDiv(),o.containerDiv.appendChild(o.arrowDiv)),o.options.closeButton&&(o.closeBtn=o._createCloseButton(),o.contentDiv.appendChild(o.closeBtn),e=jt("close"),o.contentDiv.appendChild(e),Ht(e,o.closeBtn,!0)),o}(window&&window.__extends||(rf=function(e,t){return(rf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}rf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(sf,nf=ye),sf._cloneCustomizer=function(e){if(e instanceof tf||Qp(e))return e};var rf,nf,af=sf;function sf(){var e=null!==nf&&nf.apply(this,arguments)||this;return e.anchor="bottom",e.color="#1A73AA",e.draggable=!1,e.htmlContent='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24.5 36.5" id="marker_'.concat(W(),'" width="24.5" height="36.5" display="block"><path d="M12.25.25a12.2543,12.2543,0,0,0-12,12.4937c0,6.4436,6.4879,12.1093,11.059,22.5641.5493,1.2563,1.3327,1.2563,1.882,0C17.7621,24.8529,24.25,19.1857,24.25,12.7437A12.2543,12.2543,0,0,0,12.25.25Z" fill="{color}" stroke="{secondaryColor}" stroke-width="0.5"/><text style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; fill: white;" text-anchor="middle" x="12" y="18">{text}</text></svg>'),e.pixelOffset=new nu(0,0),e.position=new dl(0,0),e.popup=void 0,e.secondaryColor="white",e.text=void 0,e.visible=!0,e}(window&&window.__extends||(cf=function(e,t){return(cf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}cf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(hf,uf=Qt),hf.prototype.getOptions=function(){return Ql(this.options,af._cloneCustomizer)},hf.prototype.getElement=function(){return this.marker.getElement()},hf.prototype.setOptions=function(e){e=(new af).merge(this.options,Ql(e,af._cloneCustomizer));$c(e.htmlContent,this.options.htmlContent)&&e.anchor===this.options.anchor?("string"!=typeof e.htmlContent||e.color===this.options.color&&e.text===this.options.text&&e.secondaryColor===this.options.secondaryColor||(this.element.innerHTML=this._getSubbedHtmlString(e)||""),e.draggable!==this.options.draggable&&(this._setDraggable(e.draggable),this.marker.setDraggable(e.draggable)),$c(e.pixelOffset,this.options.pixelOffset)||this.marker.setOffset(e.pixelOffset),$c(e.position,this.options.position)||this.marker.setLngLat(e.position),e.visible!==this.options.visible&&(e.visible?this.element.classList.remove(hf.hiddenClass):this.element.classList.add(hf.hiddenClass))):(this.marker.remove(),this._buildMarker(e),this.map&&(this.marker.addTo(this.map._getMap()),this._getCollectionContainer().appendChild(this.element))),this.options=e},hf.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)}},hf.prototype._addToMap=function(e,t){this.map&&this.map!==e&&this._removeFromMap(),t&&(this.options.position=Qa(t),this.marker.setLngLat(this.options.position)),this.map!==e&&(this.map=e,this.marker.addTo(e._getMap()),this._getCollectionContainer().appendChild(this.element))},hf.prototype._removeFromMap=function(){this.map&&(this.marker.remove(),delete this.map)},hf.prototype._getId=function(){if(this.element)return("string"==typeof this.options.htmlContent?this.element.firstChild:this.element).id},hf.prototype._buildMarker=function(e){var t;"string"==typeof e.htmlContent?(t=this._getSubbedHtmlString(e)||"",this.element=zp.convertHtmlString(t)):this.element=e.htmlContent,this.element.classList.add(hf.containerClass),e.draggable&&this._setDraggable(!0),e.visible||this.element.classList.add(hf.hiddenClass),this.marker=new D.Marker({element:this.element,offset:e.pixelOffset,draggable:e.draggable,anchor:e.anchor}).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("keydown",this._bubbleElementEvent),this.element.addEventListener("keypress",this._bubbleElementEvent),this.element.addEventListener("keyup",this._bubbleElementEvent),this.element.addEventListener("mousedown",this._bubbleElementEvent),this.element.addEventListener("mouseenter",this._bubbleElementEvent),this.element.addEventListener("mouseleave",this._bubbleElementEvent),this.element.addEventListener("mousemove",this._bubbleElementEvent),this.element.addEventListener("mouseout",this._bubbleElementEvent),this.element.addEventListener("mouseover",this._bubbleElementEvent),this.element.addEventListener("mouseup",this._bubbleElementEvent)},hf.prototype._getSubbedHtmlString=function(e){return"string"==typeof e.htmlContent?e.htmlContent.replace(/{color}/gi,e.color||"").replace(/{secondaryColor}/gi,e.secondaryColor||"").replace(/{text}/gi,e.text||""):null},hf.prototype._getCollectionContainer=function(){var e=this.map.getCanvasContainer().querySelector(".".concat(hf.collectionContainerClass));return e||((e=document.createElement("div")).classList.add(hf.collectionContainerClass),this.map.getCanvasContainer().appendChild(e)),e},hf.prototype._setDraggable=function(e){e?this.element.addEventListener("dragstart",this._onEleDragStart):this.element.removeEventListener("dragstart",this._onEleDragStart)},hf.collectionContainerClass="marker-collection-container",hf.hiddenClass="hidden-accessible-element",hf.containerClass="marker-container";var cf,uf,lf=hf;function hf(e){var t=uf.call(this)||this;return t._onDrag=function(){var e=t.marker.getLngLat().wrap();t.options.position=new dl(e.lng,e.lat),t._invokeEvent("drag",{type:"drag",target:t})},t._onDragStart=function(){t._invokeEvent("dragstart",{type:"dragstart",target:t})},t._onDragEnd=function(){t._invokeEvent("dragend",{type:"dragend",target:t})},t._bubbleElementEvent=function(e){t._invokeEvent(e.type,{type:e.type,target:t})},t._onEleDragStart=function(e){e.preventDefault()},t.options=(new af).merge(Ql(e,af._cloneCustomizer)),t._buildMarker(t.options),t}pf.getHighContrastMode=function(){return matchMedia("(-ms-high-contrast: white-on-black)").matches?"dark":matchMedia("(-ms-high-contrast: black-on-white)").matches?"light":matchMedia("(-ms-high-contrast: active)").matches?"dark":matchMedia("(inverted-colors: inverted)").matches?"invert":null};var df=pf;function pf(){}(window&&window.__extends||(ff=function(e,t){return(ff=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ff(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(yf,gf=ye);var ff,gf,mf=yf;function yf(){var e=null!==gf&&gf.apply(this,arguments)||this;return e.copyrightMessage=void 0,e.copyrightContent=void 0,e.customAttribution=void 0,e.showFeedbackLink=!0,e.showLogo=!0,e}(window&&window.__extends||(vf=function(e,t){return(vf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}vf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(bf,_f=$t),bf.prototype.onAdd=function(e){return this.map=e,this.container=this.buildContainer(e,l.ControlStyle.auto),this.container.className="map-copyright without-bg",this.copyrightDiv=this.buildCopyrightDiv(),this.copyrightDiv.className="azure-map-copyright",this.container.appendChild(this.copyrightDiv),this.options.showFeedbackLink&&this.addRemoveFeedbackDiv(!0),this.container},bf.prototype.onRemove=function(){_f.prototype.onRemove.call(this),delete this.container},bf.prototype.setOptions=function(e){var t,o=this,e=(new mf).merge(this.options,e);e.copyrightMessage===this.options.copyrightMessage&&e.customAttribution===this.options.customAttribution||(this.copyrightDiv.innerText=this.textAttribution(e)),e.copyrightContent!==this.options.copyrightContent&&(this.options.copyrightContent&&(t=Array.from(this.copyrightDiv.children).find(function(e){return e===o.options.copyrightContent}),this.copyrightDiv.removeChild(t)),0<this.copyrightDiv.childNodes.length?this.copyrightDiv.insertBefore(e.copyrightContent,this.copyrightDiv.childNodes[0]):this.copyrightDiv.appendChild(e.copyrightContent),this.options.copyrightContent=e.copyrightContent),!e.showFeedbackLink&&this.feedbackAnchor?this.addRemoveFeedbackDiv(!1):e.showFeedbackLink&&!this.feedbackAnchor&&this.addRemoveFeedbackDiv(!0),this.options=e},bf.prototype.getDefaultAttributions=function(){var e=(new Date).getFullYear(),t=["©".concat(e," TomTom")];return this.options.showLogo||t.push("©".concat(e," Microsoft")),t},bf.prototype.buildCopyrightDiv=function(){var e=document.createElement("div");return e.innerText=this.textAttribution(this.options)||"",e},bf.prototype.buildFeedbackLink=function(){var e=document.createElement("a");return e.setAttribute("alt","Provide Map Data Feedback"),e.setAttribute("aria-label","Provide Map Data Feedback"),e.innerText="Feedback",e.href=bf.feedbackLink,e.target="_blank",e.rel="noopener",e.className="azure-map-feedback-text",e},bf.prototype.addRemoveFeedbackDiv=function(e){e?(this.feedbackAnchor=this.buildFeedbackLink(),this.feedbackTooltip=jt("Provide Map Data Feedback"),this.container.appendChild(this.feedbackAnchor),this.container.appendChild(this.feedbackTooltip),Ht(this.feedbackTooltip,this.feedbackAnchor),null!=(e=null==(e=this.map)?void 0:e.events)&&e.add("moveend",this.updateFeedbackLink)):(this.feedbackAnchor.remove(),this.feedbackTooltip.remove(),delete this.feedbackTooltip,delete this.feedbackAnchor,null!=(e=null==(e=this.map)?void 0:e.events)&&e.remove("moveend",this.updateFeedbackLink))},bf.feedbackLink="https://aka.ms/azuremaps-feedback?feedbackep=UrlAzureMapsWebSdk";var vf,_f,wf=bf;function bf(e){var o=_f.call(this)||this;return o.textAttribution=function(e){return[o.options.copyrightMessage,o.options.customAttribution].filter(function(e){return e}).join("")},o.updateFeedbackLink=function(){var e,t;o.feedbackAnchor&&o.map&&(e=(t=o.map.getCamera()).center,t=t.zoom,o.feedbackAnchor.href="".concat(bf.feedbackLink,"&cp=").concat(e[1],"~").concat(e[0],"&lvl=").concat(t+1))},o.options=(new mf).merge(e),o}(window&&window.__extends||(Cf=function(e,t){return(Cf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}Cf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Tf,Ef=ye);var Cf,Ef,Sf=Tf;function Tf(){var e=null!==Ef&&Ef.apply(this,arguments)||this;return e.showLogo=!0,e}(window&&window.__extends||(If=function(e,t){return(If=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}If(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Pf,kf=$t),Pf.prototype.onAdd=function(e){return this.map=e,this.container=this.buildContainer(e,l.ControlStyle.auto),this.container.className="map-logo-control",null!=(e=this.map)&&e.events.add("resize",this._onResize),this._addRemoveLogo(this.options.showLogo),this.container},Pf.prototype.onRemove=function(){var e;kf.prototype.onRemove.call(this),null!=(e=this.map)&&e.events.remove("resize",this._onResize),this.map=null,delete this.container},Pf.prototype.setOptions=function(e){e=(new Sf).merge(this.options,e);!e.showLogo&&this.logoAnchor?this._addRemoveLogo(!1):e.showLogo&&!this.logoAnchor&&this._addRemoveLogo(!0),this.options=e},Pf.prototype._addRemoveLogo=function(e){e?(this.logoAnchor=document.createElement("a"),this.logoAnchor.className="azure-map-logo",this.logoAnchor.href="https://aka.ms/azuremaps",this.logoAnchor.setAttribute("aria-label","Visit azure.microsoft.com"),this.logoAnchor.setAttribute("target","_blank"),this.container.appendChild(this.logoAnchor),this.logoTooltip=jt("Visit azure.microsoft.com"),this.container.appendChild(this.logoTooltip),Ht(this.logoTooltip,this.logoAnchor),this._setVisiblity(!0)):(null!=(e=this.logoAnchor)&&e.remove(),null!=(e=this.logoTooltip)&&e.remove(),delete this.logoAnchor,this._setVisiblity(!1))},Pf.prototype._setVisiblity=function(e){this.container&&(this.container.style.display=e?"flex":"none")},Pf.CONTAINER_MIN_WIDTH=480;var If,kf,Af=Pf;function Pf(e){var t=kf.call(this)||this;return t.map=null,t._onResize=function(){var e=(null==(e=null==(e=t.map)?void 0:e.getMapContainer())?void 0:e.clientWidth)||0;t._setVisiblity(t.options.showLogo&&Pf.CONTAINER_MIN_WIDTH<=e)},t.options=(new Sf).merge(e),t}Rf.throwOnError=function(e,t){function o(e){throw r.off("error",o),e.error}var r=e instanceof ES?e._getMap():e,e=(r.on("error",o),t());return r.off("error",o),e},Rf.tryCatch=function(e,t,o,r){try{return this.throwOnError(e,t)}catch(e){return o(e)}finally{"function"==typeof r&&r()}},Rf.tryFinally=function(e,t,o){try{return this.throwOnError(e,t)}finally{o()}};var Of=Rf;function Rf(){}var xf=window&&window.__assign||function(){return(xf=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Mf=(Nf.prototype.request=function(e){var t,e={domain:this.map.getServiceOptions().domain,path:"reverseGeocode",queryParams:xf({"api-version":"2023-06-01",coordinates:"".concat(Zu(e.position[0]),",").concat(Wu(e.position[1]))},e.style.view&&{view:e.style.view}),headers:{"Accept-Language":e.style.language}};return new Te((null==(t=this.map.authentication)?void 0:t.signRequest(e))||e).get()},Nf);function Nf(e){this.map=e}Df.prototype.cache=function(e,t,o,r){r="".concat(e,"_").concat(o[0],"_").concat(o[1],"_").concat(r);this._labelIdx[t.labelType]||(this._labelIdx[t.labelType]=[],this._labelCache[t.labelType]=[]),-1===this._labelIdx[t.labelType].indexOf(r)&&(this._labelCache[t.labelType].push({name:e,radius:t.radius,minZoom:t.minZoom,maxZoom:t.maxZoom||24,position:o}),this._labelIdx[t.labelType].push(r))},Df.prototype.getNearestLabel=function(e,t,o){var r=null,n=this._labelCache[e];if(n)for(var i,a=1/0,s=0,c=n.length;s<c;s++)o>=n[s].minZoom&&o<=n[s].maxZoom&&(i=Du(n[s].position,t))<=n[s].radius&&i<=a&&(a=i,r=n[s]);return r},Df.prototype._preloadCache=function(e){if(!this._preloadedCache.has(e)){this._preloadedCache.add(e);var t={source:[],labelType:"water",minZoom:0,radius:395e4,polygonSources:[]},o=e,r=o.indexOf("-");switch(o=-1!==r?o.substr(0,r):o){case"fr":this.cache("Océan Pacifique",t,[-170,32],e),this.cache("Océan Pacifique",t,[-138,-27],e),this.cache("Océan Atlantique",t,[-40,32],e),this.cache("Océan Atlantique",t,[-17,-29],e);break;case"es":this.cache("Océan Pacifique",t,[-170,32],e),this.cache("Océan Pacifique",t,[-138,-27],e),this.cache("Océano Atlántico",t,[-40,32],e),this.cache("Océano Atlántico",t,[-17,-29],e);break;case"pt":this.cache("Oceano Pacífico",t,[-170,32],e),this.cache("Oceano Pacífico",t,[-138,-27],e),this.cache("Oceano Atlântico",t,[-40,32],e),this.cache("Oceano Atlântico",t,[-17,-29],e);break;case"ja":this.cache("太平洋",t,[-170,32],e),this.cache("太平洋",t,[-138,-27],e);break;case"en":this.cache("Pacific Ocean",t,[-170,32],e),this.cache("Pacific Ocean",t,[-138,-27],e),this.cache("Atlantic Ocean",t,[-40,32],e),this.cache("Atlantic Ocean",t,[-17,-29],e),this.cache("Indian Ocean",t,[77,-26],e)}}};var Lf=Df;function Df(){this._labelCache={},this._labelIdx={},this._preloadedCache=new Set}var qf=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},Uf=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},jf=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},Hf=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},Bf=(Ff.prototype.dispose=function(){this._disposed=!0;var e=this._map._getMap(),e=(e.off("move",this._onMove),e.off("moveend",this._onMoveEnd),e.off("styledata",this._onStyleData),e.off("rotate",this._onRotate),this._map.getCanvas());e.removeEventListener("mousedown",this._onPointerDown),e.removeEventListener("touchstart",this._onPointerDown),this._map.getMapContainer().removeEventListener("keydown",this._shortcutListener)},Ff.prototype._getEventPos=function(e){var t,o;return"touches"in e?(t=e.touches[0],o=e.target.getBoundingClientRect(),[t.pageX-o.left,t.pageY-o.top]):[e.offsetX,e.offsetY]},Ff.prototype._checkThresholds=function(e,t){return this._checkZoomThreshold(e.zoom,t.zoom)||this._checkPitchThreshold(e.pitch,t.pitch)||this._checkLocThreshold(e.center,t.center)||this._checkHeadingThreshold(e.bearing,t.bearing)},Ff.prototype._checkZoomThreshold=function(e,t){return this._round(e)!==this._round(t)},Ff.prototype._checkPitchThreshold=function(e,t){return Math.abs(e-t)>=this._pitchThreshold},Ff.prototype._checkLocThreshold=function(e,t){e=(t=jf(this._map.positionsToPixels([t,e]),2))[0],t=t[1];return nu.getDistance(e,t)>=this._moveThreshold},Ff.prototype._checkHeadingThreshold=function(e,t){e<0&&(e+=360),t<0&&(t+=360);e=Math.abs(e-t);return(e=180<e?360-e:e)>=this._headingThreshold},Ff.prototype._getLocDesc=function(h,d,p){return qf(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c,u,l=this;return Uf(this,function(e){switch(e.label){case 0:return"blank"===p?[3,3]:this._map._getMap().loaded()?[3,2]:[4,new Promise(function(e){return l._map._getMap().once("idle",e)})];case 1:e.sent(),e.label=2;case 2:for(t={},o=this._map.positionsToPixels([h.center])[0],Of.tryCatch(this._map,function(){var t=l._map._getMap();r=t.queryRenderedFeatures(o,{layers:l._polygonStyleLayer.filter(function(e){return t.getLayer(e)}),filter:["==",["geometry-type"],"Polygon"]})},function(){}),n=null,r&&0<r.length&&(n=r[0]),i=null,a=0,s=this._labelConfig.length;a<s;a++)c=this._labelConfig[a],h.zoom>=c.minZoom?c.polygonSources?n&&-1!==c.polygonSources.indexOf(n.layer["source-layer"])?(i=c.labelType,this._getClosestLabel(c,h,d,t,!1)):this._getClosestLabel(c,h,d,t,!0):this._getClosestLabel(c,h,d,t,!1):this._getClosestLabel(c,h,d,t,!0);return 8<=h.zoom&&this._processRoads(t,h,d),this._labelCache.forEach(function(e){!t[e]&&(u=null,u="water"!==e&&"majorPoi"!==e||e===i?Ff._labelCache.getNearestLabel(e,h.center,h.zoom):u)&&(t[e]=u.name)}),[2,this._processLocInfo(h,i,t,!0,this._restFallback)];case 3:return[2,this._processLocInfo(h,null,null,!1,!1)]}})})},Ff.prototype._getHeadingDesc=function(e){var t=e.bearing;switch(t<0&&(t+=360),t=this._round(t,this._headingThreshold)){case 0:case 360:return"north";case 45:return"north east";case 90:return"east";case 135:return"south east";case 180:return"south";case 225:return"south west";case 270:return"west";case 315:return"north west";default:return"".concat(t," degrees")}},Ff.prototype._getClosestLabel=function(e,t,o,r,n){for(var i=e.radius,a=0,s=e.source.length;a<s;a++){var c={sourceLayer:e.source[a],filter:["has","name"]},u=this._map._getMap().querySourceFeatures(this._baseVectorTileSourceId,c),l=null,h=1/0,d=this._labelCache.has(e.labelType);if(!n||d)for(var p=0,f=u.length;p<f;p++){var g,m="Point"===u[p].geometry.type?u[p]:ul(t.center,u[p].geometry);n||(g="Point"===u[p].geometry.type?Du(t.center,m.geometry.coordinates):m.properties.distance)<h&&(h=g,l=u[p]),d&&Ff._labelCache.cache(u[p].properties.name,e,m.geometry.coordinates,o)}n||(c=e.labelType+"Dis",l&&h<=i&&("number"!=typeof r[c]||h<=r[c])&&(r[e.labelType]=l.properties.name,r[c]=h))}},Ff.prototype._processRoads=function(e,t,o,r){var n=this._map._getMap().queryRenderedFeatures(r,{filter:["==",["geometry-type"],"LineString"]});if(n){for(var i,a=void 0,s=void 0,c=void 0,u=void 0,l=0,h=n.length;l<h;l++)this._roadLayers.has(n[l].layer["source-layer"])&&n[l].properties.name&&""!==n[l].properties.name&&(i=ul(t.center,n[l]),!c||i.properties.distance<c.properties.distance)&&(a&&n[l].properties.name===a.properties.name?c=i:a&&n[l].properties.name===a.properties.name?(!u||i.properties.distance<u.properties.distance)&&(u=i,s=n[l]):(u=c,s=a,c=i,a=n[l]));a&&(!e.country&&a.properties.country_code&&(e.country=a.properties.country_code,e.countryDis=0,Ff._labelCache.cache(e.country,{source:[],labelType:"country",radius:5e3,minZoom:0},c.geometry.coordinates,o)),!e.state&&a.properties.country_subdivision&&(e.state=a.properties.country_subdivision,e.stateDis=0,Ff._labelCache.cache(e.state,{source:[],labelType:"state",radius:5e3,minZoom:4},c.geometry.coordinates,o)),15<=t.zoom)&&(r=this._map.positionsToPixels([t.center,c.geometry.coordinates]),(nu.getDistance(r[0],r[1])<this._roadPixelRadius||c.properties.distance<this._minRoadDistance)&&(e.road=a.properties.name),s)&&(o=this._map.positionsToPixels([u.geometry.coordinates]),nu.getDistance(r[0],o[0])<this._minIntersectionPixelDistance||u.properties.distance<this._minRoadDistance)&&(e.secondRoad=s.properties.name,e.secondRoadDis=u.properties.distance)}},Ff.prototype._getActionDesc=function(e){var t,o,r;return this._lastCam&&(t=[],this._checkLocThreshold(e.center,this._lastCam.center)&&(r=["panned"],0===(o=Math.round(Bu(this._lastCam.center,e.center)))||360===o?r.push("north"):o<90?r.push("north east"):90===o?r.push("east"):o<180?r.push("south east"):180===o?r.push("south"):o<270?r.push("south west"):270===o?r.push("west"):o<360&&r.push("north west"),o=Du(this._lastCam.center,e.center,uu.meters),r.push(1e3<o?"".concat(Mu(o/1e3,2)," kilometers"):"".concat(Mu(o,2)," meters")),t.push(r.join(" "))),this._checkZoomThreshold(e.zoom,this._lastCam.zoom)&&((r=["zoomed"]).push(this._lastCam.zoom<e.zoom?"in":"out"),1<=(o=Math.abs(this._lastCam.zoom-e.zoom))&&(o=Math.ceil(o),r.push("".concat(o,1<o?" levels":" level"))),this._getCanonicalZoom(this._lastCam.zoom)!==this._getCanonicalZoom(e.zoom)&&r.push("to ".concat(this._getCanonicalZoom(e.zoom)," level")),e.zoom>=e.maxZoom&&r.push("Zoom In button disabled, maximum zoom level reached"),o=f.getSouth(e.bounds)<=-_u&&f.getNorth(e.bounds)>=_u,(e.zoom<=e.minZoom||o)&&r.push("Zoom Out button disabled, minimum zoom level reached"),t.push(r.join(" "))),this._checkPitchThreshold(e.pitch,this._lastCam.pitch)&&(o=this._round(e.pitch,this._pitchThreshold),t.push("pitched to ".concat(o," degrees")),60!==e.pitch&&0!==e.pitch||(r=60===e.pitch?"maximum":"minimum",t.push("reached ".concat(r," of ").concat(e.pitch," degrees")))),this._checkHeadingThreshold(this._lastCam.bearing,e.bearing)&&t.push("rotated to ".concat(this._getHeadingDesc(e))),t.join(" and "))||null},Ff.prototype._getCanonicalZoom=function(e){return(e=this._round(e))<2?"world":e<5?"country":e<11?"state province":e<15?"city":"street"},Ff.prototype._processLocInfo=function(n,i,a,s,c){var u=this;return new Promise(function(t,e){var o=[];if(s){var r=[];if(a&&(i&&("water"===i&&a.water?r.push(a.water):"majorPoi"===i&&a.majorPoi&&r.push(a.majorPoi)),0===r.length)&&(a.majorPoi&&8<=n.zoom?r.push(a.majorPoi):(a.poi&&14<=n.zoom?r.push(a.poi):a.road&&15<=n.zoom&&(a.secondRoad?r.push(a.road+" & "+a.secondRoad):r.push(a.road)),a.neighbourhood&&12<=n.zoom&&r.push(a.neighbourhood),a.city&&6<=n.zoom&&r.push(a.city)),a.state&&4<=n.zoom&&r.push(a.state),0===r.length?a.water?r.push(a.water):a.country&&r.push(a.country):1===r.length&&a.state&&4<=n.zoom&&a.country&&r.push(a.country)),0<r.length)o.push("<p>Location: ",r.join(", "),".</p>");else if(c&&"water"!==i)return void u._reverseGeocodeDescription(n).then(function(e){t(e)},function(){e("<p>Location: unknown</p>")})}u._returnDetailedDescriptions&&(o.push("<p>Zoom: ",Mu(n.zoom,2),".</p>"),o.push("<p>Latitude: ",Mu(n.center[1],5),".</p>"),o.push("<p>Longitude: ",Mu(n.center[0],5),".</p>")),t(o.join(""))})},Ff.prototype._reverseGeocodeDescription=function(i){var a=this;return new Promise(function(r){var n=a._map.getStyle();a._reverseSearch.request({position:i.center,style:n}).then(function(e){var t,o={};e&&e.features&&0<e.features.length&&null!=(t=null==(t=e.features[0])?void 0:t.properties)&&t.address&&((t=e.features[0].properties.address).countryRegion&&(o.country=t.countryRegion.name,Ff._labelCache.cache(o.country,{source:[],labelType:"country",radius:5e3,minZoom:0},i.center,n.language)),t.adminDistricts&&(o.state=null==(e=t.adminDistricts[0])?void 0:e.shortName,Ff._labelCache.cache(o.state,{source:[],labelType:"state",radius:5e3,minZoom:4},i.center,n.language)),t.locality&&(o.city=t.locality,Ff._labelCache.cache(o.city,{source:[],labelType:"city",radius:1e3,minZoom:10},i.center,n.language)),t.addressLine)&&(o.road=t.addressLine),a._processLocInfo(i,null,o,!0,!1).then(function(e){r(e)})},function(e){a._processLocInfo(i,null,null,!0,!1).then(function(e){r(e)})}).catch(function(e){a._processLocInfo(i,null,null,!0,!1).then(function(e){r(e)})})})},Ff.prototype._round=function(e,t){return void 0===t&&(t=1),Math.round(e/t)*t},Ff._baseVectorTileSourceIds=["microsoft.base","vectorTiles","bing-mvt"],Ff._labelConfigBing=[{source:["water_feature"],labelType:"water",minZoom:0,radius:395e4,polygonSources:["generic_water_fill"]},{source:["water_feature"],labelType:"water",minZoom:3,radius:1e6,polygonSources:["generic_water_fill"]},{source:["country_region"],labelType:"country",minZoom:0,maxZoom:5,radius:3e5},{source:["admin_division1"],labelType:"state",minZoom:4,maxZoom:7,radius:3e5},{source:["populated_place"],labelType:"city",minZoom:8,radius:4e4},{source:["neighborhood"],labelType:"neighbourhood",minZoom:12,radius:6e3},{source:["amusement_park"],labelType:"poi",minZoom:14,radius:2e3,polygonSources:["amusement_park_fill"]},{source:["hospital"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["hospital_fill"]},{source:["shopping_center"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["shopping_center_fill"]},{source:["stadium"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["stadium_fill"]},{source:["higher_education_facility","school"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["higher_education_facility_fill","school_fill"]},{source:["zoo"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["zoo_fill"]},{source:["airport","airport_terminal"],labelType:"majorPoi",minZoom:11,radius:3e3,polygonSources:["airport_terminal_fill","airport_fill-merged7","airport_runway_fill"]},{source:["reserve"],labelType:"majorPoi",minZoom:7,radius:15e3,polygonSources:["generic_reserve_fill","land_cover_forest_fill"]}],Ff._roadLayersBing=new Set(["road"]),Ff);function Ff(e,t){var i=this;this._disposed=!1,this._lastHeadingTime=0,this._actionQueue=[],this._pointerUpdateDelay=3e3,this._camUpdateDelay=1e3,this._headUpdateLimit=1e3,this._controlEventDelay=500,this._moveThreshold=25,this._headingThreshold=5,this._pitchThreshold=5,this._roadPixelRadius=120,this._minRoadDistance=25,this._minIntersectionPixelDistance=50,this._labelConfig=[{source:["Ocean label","Ocean name"],labelType:"water",minZoom:0,radius:395e4,polygonSources:["Ocean","Ocean or sea"]},{source:["Sea label"],labelType:"water",minZoom:3,radius:1e6,polygonSources:["Sea","Ocean or sea"]},{source:["Country name"],labelType:"country",minZoom:0,maxZoom:5,radius:3e5},{source:["State name","State name short"],labelType:"state",minZoom:4,maxZoom:7,radius:3e5},{source:["Capital city","Large city"],labelType:"city",minZoom:8,radius:4e4},{source:["Medium city"],labelType:"city",minZoom:8,radius:3e4},{source:["Small city"],labelType:"city",minZoom:8,radius:2e4},{source:["Island label"],labelType:"city",minZoom:8,radius:1e4},{source:["Town"],labelType:"city",minZoom:10,radius:1e4},{source:["Village"],labelType:"neighbourhood",minZoom:12,radius:6e3},{source:["Amusement area label"],labelType:"poi",minZoom:14,radius:2e3,polygonSources:["Amusement park"]},{source:["Hospital label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["Hospital"]},{source:["Shopping centre label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["Shopping"]},{source:["Stadium label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["Stadium"]},{source:["University/School label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["University"]},{source:["Zoo label"],labelType:"poi",minZoom:14,radius:1e3,polygonSources:["Zoo"]},{source:["Airport Label","Airport name","Airport POI"],labelType:"majorPoi",minZoom:11,radius:3e3,polygonSources:["Airport","Runway"]},{source:["National park label"],labelType:"majorPoi",minZoom:7,radius:15e3,polygonSources:["National or state park","National park","Forest"]},{source:["Reservation label"],labelType:"majorPoi",minZoom:7,radius:15e3,polygonSources:["Reservation"]}],this._labelCache=new Set(["city","state","country","water","majorPoi"]),this._roadLayers=new Set(["Connecting road","Connecting road tunnel","International road","International road tunnel","Local road","Local road tunnel","Major local road","Major local road tunnel","Major road","Major road tunnel","Minor local road","Minor local road tunnel","Motorway","Motorway tunnel","Secondary road","Secondary road tunnel","Toll connecting road","Toll connecting road tunnel","Toll international road","Toll international road tunnel","Toll local road","Toll local road tunnel","Toll major local road","Toll major local road tunnel","Toll major road","Toll major road tunnel","Toll minor local road","Toll minor local road tunnel","Toll motorway","Toll motorway tunnel","Toll secondary road","Toll secondary road tunnel"]),this._returnDetailedDescriptions=!1,this._shortcutListener=function(n){return qf(i,void 0,void 0,function(){var t,o,r;return Uf(this,function(e){switch(e.label){case 0:return n.altKey&&n.ctrlKey&&68===n.keyCode?(this._returnDetailedDescriptions=!this._returnDetailedDescriptions,r=this._map.getCamera(),o=this._map.getStyle(),t=o.language.toLowerCase(),o=o.style.toLowerCase(),[4,this._getLocDesc(r,t,o)]):[3,2];case 1:r=e.sent(),this._descCallback(r),e.label=2;case 2:return[2]}})})},this._onRotate=function(){i._rotateTimeout||(Date.now()-i._lastHeadingTime>=i._headUpdateLimit?i._rotateTimeout=setTimeout(i._updateHeading,so.RotationDuration+25):i._rotateTimeout=setTimeout(i._updateHeading,i._headUpdateLimit-(Date.now()-i._lastHeadingTime)))},this._onMove=function(){i._moveTimeout&&(clearTimeout(i._moveTimeout),delete i._moveTimeout),i._controlTimeout&&(clearTimeout(i._controlTimeout),delete i._controlTimeout)},this._onMoveEnd=function(e){e.fromControl?i._controlTimeout=setTimeout(i._updateCam,i._controlEventDelay):i._updateCam()},this._onStyleData=function(){setTimeout(i._updateStyle)},this._onPointerDown=function(e){i._lastPointerPos=i._getEventPos(e),i._pointerTimeout=setTimeout(function(){return qf(i,void 0,void 0,function(){var t,o,r;return Uf(this,function(e){switch(e.label){case 0:return o=this._map.getStyle(),t=o.language.toLowerCase(),o=o.style.toLowerCase(),(r=this._map.getCamera()).center=this._map.pixelsToPositions([this._lastPointerPos])[0],[4,this._getLocDesc(r,t,o)];case 1:return r=e.sent(),this._descCallback(r),this._onPointerUp(),[2]}})})},i._pointerUpdateDelay),i._map.getCanvas().addEventListener("mousemove",i._onPointerMove),i._map.getCanvas().addEventListener("touchmove",i._onPointerMove),i._map.getCanvas().addEventListener("mouseup",i._onPointerUp),i._map.getCanvas().addEventListener("touchend",i._onPointerUp)},this._onPointerMove=function(e){var e=i._getEventPos(e),t=i._lastPointerPos[0]-e[0],e=i._lastPointerPos[1]-e[1];Math.sqrt(t*t+e*e)>i._moveThreshold&&i._onPointerUp()},this._onPointerUp=function(){clearTimeout(i._pointerTimeout),delete i._pointerTimeout,i._map.getCanvas().removeEventListener("mousemove",i._onPointerMove),i._map.getCanvas().removeEventListener("touchmove",i._onPointerMove),i._map.getCanvas().removeEventListener("mouseup",i._onPointerUp),i._map.getCanvas().removeEventListener("touchend",i._onPointerUp)},this._updateHeading=function(){var e,t=i._map.getCamera();i._lastHead&&!i._checkHeadingThreshold(t.bearing,i._lastHead)||(e=i._getHeadingDesc(t),i._lastHead=t.bearing,i._descCallback("<p>Map heading ".concat(e,".</p>")),i._lastHeadingTime=Date.now()),delete i._rotateTimeout},this._updateStyle=function(){return qf(i,void 0,void 0,function(){var t,o,r,n;return Uf(this,function(e){switch(e.label){case 0:return(t=this._map.getCamera(),r=this._map.getStyle(),o=r.language.toLowerCase(),r=r.style.toLowerCase(),this._lastLang===o)?[3,2]:(Ff._labelCache._preloadCache(o),[4,this._getLocDesc(t,o,r)]);case 1:return n=e.sent(),[3,4];case 2:return this._lastStyle===r||"blank"!==this._lastStyle?[3,4]:[4,this._getLocDesc(t,o,r)];case 3:n=e.sent(),e.label=4;case 4:return this._lastLang=o,this._lastStyle=r,n&&this._descCallback(n),[2]}})})},this._updateCam=function(e){void 0===e&&(e=!1);var o,r,t,n=i._map.getCamera();(!i._lastCam||0<i._actionQueue.length||i._checkThresholds(n,i._lastCam))&&(t=i._map.getStyle(),o=t.language.toLowerCase(),r=t.style.toLowerCase(),(t=i._getActionDesc(n))&&i._actionQueue.push(t),i._lastCam=n,i._moveTimeout&&(clearTimeout(i._moveTimeout),delete i._moveTimeout),i._moveTimeout=setTimeout(function(){return qf(i,void 0,void 0,function(){var t;return Uf(this,function(e){switch(e.label){case 0:return clearTimeout(this._rotateTimeout),delete this._rotateTimeout,[4,this._getLocDesc(n,o,r)];case 1:return t=e.sent(),0<this._actionQueue.length?(this._descCallback("<p>Map ".concat(this._actionQueue.join(", then "),".</p>").concat(t)),this._actionQueue=[]):this._descCallback(t),[2]}})})},e?0:i._camUpdateDelay))},this._map=e,this._restFallback=e.getServiceOptions().enableAccessibilityLocationFallback,this._descCallback=t,this._reverseSearch=new Mf(e),Ff._labelCache||(Ff._labelCache=new Lf),this._lastLang=this._map.getStyle().language.toLowerCase(),Ff._labelCache._preloadCache(this._lastLang),this._map.events.addOnce("idle",function(){var e;i._disposed||(i._updateCam(!0),i._baseVectorTileSourceId=Ff._baseVectorTileSourceIds.find(function(e){return i._map.sources.getById(e)}),"bing-mvt"===i._baseVectorTileSourceId&&(i._labelConfig=Ff._labelConfigBing,i._roadLayers=Ff._roadLayersBing),i._polygonStyleLayer=i._labelConfig.reduce(function(e,t){return t.polygonSources&&e.push.apply(e,Hf([],jf(t.polygonSources),!1)),e},[]),(e=i._map._getMap()).on("move",i._onMove),e.on("moveend",i._onMoveEnd),e.on("styledata",i._onStyleData),e.on("rotate",i._onRotate),(e=i._map.getCanvas()).addEventListener("mousedown",i._onPointerDown),e.addEventListener("touchstart",i._onPointerDown))}),this._map.getMapContainer().addEventListener("keydown",this._shortcutListener)}var zf,Kf,Gf,Yf=function(e){var o=this;this.addToMap=function(){null==o.mapViewDesc&&(o.initializeMapLiveStateInfo(),o.initializeMapStyleInfo(),o.createMapKeyBindingInfo(),o.map.getMapContainer().setAttribute("role","application"),o.map.getMapContainer().setAttribute("aria-label","Map Application"),o.map.getCanvasContainer().setAttribute("aria-live","polite"),o.map.getCanvasContainer().setAttribute("aria-describedby","atlas-map-state atlas-map-style"),o.map.getCanvas().setAttribute("aria-label","Interactive Map"),o.map.getCanvas().setAttribute("aria-describedby","atlas-map-shortcuts"),o.map.getCanvas().setAttribute("alt","Interactive Map"))},this.removeFromMap=function(){null!=o.mapViewDesc&&o.mapViewDesc.dispose(),delete o.mapViewDesc,null!=o.atlasMapKeyBindings&&o.map.getCanvasContainer().removeChild(o.atlasMapKeyBindings),delete o.atlasMapKeyBindings,null!=o.atlasMapLiveStateInfo&&o.map.getCanvasContainer().removeChild(o.atlasMapLiveStateInfo),delete o.atlasMapLiveStateInfo,null!=o.atlasMapStyleInfo&&o.map.getCanvasContainer().removeChild(o.atlasMapStyleInfo),delete o.atlasMapStyleInfo,o.map.getMapContainer().removeAttribute("role"),o.map.getMapContainer().removeAttribute("aria-label"),o.map.getCanvasContainer().removeAttribute("aria-live"),o.map.getCanvasContainer().removeAttribute("aria-describedby"),o.map.getCanvas().removeAttribute("aria-label"),o.map.getCanvas().removeAttribute("aria-describedby"),o.map.getCanvas().removeAttribute("alt"),o.map.events.remove("stylechanged",o.updateMapStyle)},this.createMapKeyBindingInfo=function(){o.atlasMapKeyBindings=document.createElement("div"),o.atlasMapKeyBindings.setAttribute("tabindex","-1"),o.atlasMapKeyBindings.setAttribute("aria-hidden","true"),o.atlasMapKeyBindings.id="atlas-map-shortcuts",o.atlasMapKeyBindings.classList.add("hidden-accessible-element"),o.atlasMapKeyBindings.innerHTML=["Map shortcuts:","Zoom out: hyphen.","Zoom in: plus.","Pan right 100 pixels: right arrow.","Pan left 100 pixels: left arrow.","Pan up 100 pixels: up arrow.","Pan down 100 pixels: down arrow.","Rotate 15 degrees clockwise: shift + right arrow.","Rotate 15 degrees counter clockwise: shift + left arrow.","Increase pitch 10 degrees: shift + up arrow.","Decrease pitch 10 degrees: shift + down arrow.","Jump focus to the map: Escape."].join("\n"),o.map.getCanvasContainer().appendChild(o.atlasMapKeyBindings);var e=[189,187,38,37,39,40],t=o.map._getMap()._canvas;null!=t&&t.addEventListener("keyup",function(t){e.find(function(e){return t.keyCode===e})&&(o.atlasMapKeyBindings.innerHTML="")})},this.initializeMapLiveStateInfo=function(){o.mapViewDesc=new Bf(o.map,o.updateMapState),o.atlasMapLiveStateInfo=document.createElement("div"),o.atlasMapLiveStateInfo.setAttribute("tabindex","-1"),o.atlasMapLiveStateInfo.setAttribute("aria-hidden","true"),o.atlasMapLiveStateInfo.id="atlas-map-state",o.atlasMapLiveStateInfo.classList.add("hidden-accessible-element"),o.map.getCanvasContainer().appendChild(o.atlasMapLiveStateInfo)},this.initializeMapStyleInfo=function(){o.atlasMapStyleInfo=document.createElement("div"),o.atlasMapStyleInfo.setAttribute("tabindex","-1"),o.atlasMapStyleInfo.setAttribute("aria-hidden","true"),o.atlasMapStyleInfo.id="atlas-map-style",o.atlasMapStyleInfo.classList.add("hidden-accessible-element"),o.map.events.add("stylechanged",o.updateMapStyle),o.map.getCanvasContainer().appendChild(o.atlasMapStyleInfo)},this.updateMapStyle=function(){o.atlasMapStyleInfo.innerHTML="<p>Map style: ".concat(o.map.getStyle().style,".</p>")},this.updateMapState=function(e){o.atlasMapLiveStateInfo.innerHTML=e},this.map=e},Wf=function(e){var o=this;this.listenerEnabled=!1,this.lastFlowMode="none",this.addToMap=function(){if(!o.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.");o.listenerEnabled||(o.map.events.add("styledata",o.addToMap),o.listenerEnabled=!0);var e,t=o.map.getTraffic();"none"!==t.flow&&(e=o.map.layers.getLayerById("traffic_".concat(t.flow)))&&(o.lastFlowMode=t.flow,e._updateLayoutProperty("visibility","visible","none"))},this.removeFromMap=function(){var e;o.map.getTraffic(),"none"!=o.lastFlowMode&&((e=o.map.layers.getLayerById("traffic_".concat(o.lastFlowMode)))&&e._updateLayoutProperty("visibility","none","visible"),o.lastFlowMode="none"),o.listenerEnabled&&(o.map.events.remove("styledata",o.addToMap),o.listenerEnabled=!1)},this.map=e},Zf=((window&&window.__extends||(zf=function(e,t){return(zf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}zf(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(Qf,Kf=eu),Qf.getIncidentTypeName=function(e,t){switch(e){case 0:return t.Unknown;case 1:return t.Accident;case 2:return t.Fog;case 3:return t.Danger;case 4:return t.Rain;case 5:return t.Ice;case 6:return t.Jam;case 7:return t.LaneClosed;case 8:return t.RoadClosed;case 9:return t.RoadWorks;case 10:return t.Wind;case 11:return t.Flood;case 12:return t.Detour;default:return t.Unknown}},Qf.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"}},Qf.getSeverityColorName=function(e){switch(e){case 0:return"grey";case 1:return"yellow";case 2:return"orange";case 3:return"red";default:return"grey"}},Qf.getSeverityColorHexCode=function(e){switch(e){case 0:return"#B5B6B7";case 1:return"#F4C951";case 2:return"#F4873F";case 3:return"#F04F4E";default:return"#B5B6B7"}},Qf);function Qf(e,t,o){var r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=null!=(r=e.icon_category_12)?r:e.icon_category_11)?r:e.icon_category_10)?r:e.icon_category_9)?r:e.icon_category_8)?r:e.icon_category_7)?r:e.icon_category_6)?r:e.icon_category_5)?r:e.icon_category_4)?r:e.icon_category_3)?r:e.icon_category_2)?r:e.icon_category_1)?r:e.icon_category_0)?r:e.icon_category,n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=e.description_12)?n:e.description_11)?n:e.description_10)?n:e.description_9)?n:e.description_8)?n:e.description_7)?n:e.description_6)?n:e.description_5)?n:e.description_4)?n:e.description_3)?n:e.description_2)?n:e.description_1)?n:e.description_0)?n:e.description,r={icon:"".concat(Qf.getSeverityColorName(e.magnitude),"-").concat(Qf.getIncidentTypeIconName(r)),incidentType:Qf.getIncidentTypeName(r,o),description:n,delay:e.delay,color:Qf.getSeverityColorHexCode(e.magnitude),id:e.id};return Kf.call(this,t,r)||this}(a=Gf=Gf||{}).DELAY="delay",a.LENGTH="length",a.FROM="from",a.TO="to";Jf.build=function(e,t){void 0===t&&(t="en-US");var o,r=document.createElement("div"),n=(r.classList.add("incident-popup-title"),r.classList.add("font-segoeui-b"),r.innerText=e.properties.incidentType,r.setAttribute("aria-label","Incident Type ".concat(e.properties.incidentType)),document.createElement("div")),i=(n.classList.add("incident-popup-subtitle"),n.classList.add("font-segoeui-b"),n.setAttribute("aria-label","Incident Description ".concat(e.properties.description)),n.innerText=e.properties.description,document.createElement("div")),r=(i.classList.add("incident-popup-header"),i.style.backgroundColor=e.properties.color,i.appendChild(r),i.appendChild(n),document.createElement("div")),n=(r.classList.add("incident-popup-body"),e.properties.delay&&(n="".concat(Math.floor(e.properties.delay/60)," min"),n=this.createInfoSection(n,Gf.DELAY),r.appendChild(n)),e.properties.length&&(n=new Intl.NumberFormat([t,"en-US"],{maximumFractionDigits:2}),o=void 0,o="en-US"===t?(t=Nu(e.properties.length,"meters","miles"),"".concat(n.format(t)," miles")):(t=Nu(e.properties.length,"meters","kilometers"),"".concat(n.format(t)," km")),n=this.createInfoSection(o,Gf.LENGTH),r.appendChild(n)),e.properties.from&&(t=this.createInfoSection(e.properties.from,Gf.FROM),r.appendChild(t)),e.properties.to&&(o=this.createInfoSection(e.properties.to,Gf.TO),r.appendChild(o)),document.createElement("div"));return n.classList.add("incident-popup-content"),n.appendChild(i),n.appendChild(r),new tf({content:n,position:e.geometry.coordinates})},Jf.createInfoSection=function(e,t){var o=document.createElement("div"),r=(o.classList.add("incident-popup-info"),document.createElement("div")),n=(r.classList.add("icon"),r.classList.add(t),document.createElement("span"));return n.classList.add("message"),n.classList.add("font-segoeui"),n.setAttribute("aria-label","Incident ".concat(t," ").concat(e)),n.innerText=e,o.appendChild(r),o.appendChild(n),o};var Vf=Jf;function Jf(){}var Xf=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},$f=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},eg=(tg.prototype.getIncidentIconImageExpression=function(){return["concat",["let","magnitude",["get","magnitude"],["case",["==",["var","magnitude"],0],"grey",["==",["var","magnitude"],1],"yellow",["==",["var","magnitude"],2],"orange",["==",["var","magnitude"],3],"red",["==",["var","magnitude"],4],"grey","grey"]],"-",["let","category",["coalesce",["get","icon_category_12"],["get","icon_category_11"],["get","icon_category_10"],["get","icon_category_9"],["get","icon_category_8"],["get","icon_category_7"],["get","icon_category_6"],["get","icon_category_5"],["get","icon_category_4"],["get","icon_category_3"],["get","icon_category_2"],["get","icon_category_0"],["get","icon_category"],0],["case",["==",["var","category"],0],"unknown",["==",["var","category"],1],"accident",["==",["var","category"],2],"fog",["==",["var","category"],3],"danger",["==",["var","category"],4],"rain",["==",["var","category"],5],"ice",["==",["var","category"],6],"jam",["==",["var","category"],7],"lane-closed",["==",["var","category"],8],"road-closed",["==",["var","category"],9],"road-work",["==",["var","category"],10],"wind",["==",["var","category"],11],"flood",["==",["var","category"],12],"detour","unknown"]]]},tg);function tg(e){var n=this,e=(this.incidentLayerName="incidents",this.incidentSourceName="mapcontrol_traffic_incident",this.addToMap=function(){n.map.sources.getById(n.incidentSourceName)||n.map.sources.add(n.vectorTileSource),n.map.layers.getLayerById(n.incidentLayerName)||n.map.layers.add(n.incidentLayer,"labels"),n.clickPopup=new tf({position:[0,0],pixelOffset:[0,-18]}),n.map.addEventListener("mouseover",n.incidentLayerName,n.cursorToPointer),n.map.addEventListener("mouseleave",n.incidentLayerName,n.cursorToDefault),n.map.addEventListener("click",n.incidentLayerName,n.openIncidentPopup),n.map.events.addOnce("idle",n.setAccessiblePopups),n.map.events.add("moveend",n.setAccessiblePopups)},this.accessiblePopups=[],this.setAccessiblePopups=function(){return Xf(n,void 0,void 0,function(){var t,i,a,s,c,u,l=this;return $f(this,function(e){switch(e.label){case 0:return this.accessiblePopups.forEach(function(e){return e.remove()}),this.accessiblePopups=[],t=this.map.layers.getRenderedShapes(this.map.getCamera().bounds,this.incidentLayer),[4,this.map._getLocalizedStrings()];case 1:return i=e.sent(),a=function(t,o){var e=t[o],r=e.geometry.coordinates,r=new au(new dl(r[0],r[1])),e=new Zf(e.properties,r,i),n=Vf.build(e,l.incidentLanguage),r=n.getPopupContainer();return r.addEventListener("focusin",function(e){l.clickPopup.remove(),l.accessiblePopups.filter(function(e){return e!==n}).forEach(function(e){return e.remove()}),0<=o-1&&s(n,a(t,o-1)),o+1<t.length&&u(a(t,o+1)),2<=o&&o==t.length-1&&c(a(t,0)),0==o&&2<=t.length&&u(a(t,t.length-1))}),o==t.length-1&&r.addEventListener("focusout",function(e){null===e.relatedTarget&&n.close()}),l.accessiblePopups.push(n),n},s=function(e,t){t.open(l.map),t.close();t=t.getPopupContainer(),e=e.getPopupContainer();e.parentElement.insertBefore(t,e)},c=function(e){e.open(l.map),e.close();var e=e.getPopupContainer(),t=e.parentElement;t.insertBefore(e,t.firstElementChild)},u=function(e){e.open(l.map),e.close()},0<t.length&&u(a(t,0)),1<t.length&&u(a(t,t.length-1)),[2]}})})},this.removeFromMap=function(){var e;n.map.removeEventListener("mouseover",n.incidentLayerName,n.cursorToPointer),n.map.removeEventListener("mouseleave",n.incidentLayerName,n.cursorToDefault),n.map.removeEventListener("click",n.incidentLayerName,n.openIncidentPopup),n.map.events.remove("idle",n.setAccessiblePopups),n.map.events.remove("moveend",n.setAccessiblePopups),n.accessiblePopups.forEach(function(e){return e.remove()}),n.accessiblePopups=[],null!=(e=n.clickPopup)&&e.remove(),null!=n.map.layers.getLayerById(n.incidentLayerName)&&n.map.layers.remove(n.incidentLayerName),null!=n.map.sources.getById(n.incidentSourceName)&&n.map.sources.remove(n.incidentSourceName)},this.cursorToPointer=function(e){n.map.getCanvas().style.cursor="pointer"},this.cursorToDefault=function(e){n.map.getCanvas().style.cursor=""},this.openIncidentPopup=function(e){n.clickPopup.remove(),n.accessiblePopups.forEach(function(e){return e.close()});var o=e.position,r=e.features[0];n.map._getLocalizedStrings().then(function(e){var t=new au(new dl(o[0],o[1])),t=new Zf(r.properties,t,e);n.clickPopup=Vf.build(t,n.incidentLanguage),n.clickPopup.open(n.map),n.clickPopup.getPopupContainer().addEventListener("focusout",function(e){null===e.relatedTarget&&n.clickPopup.close()})})},this.map=e,this.vectorTileSource=new yh(this.incidentSourceName,{maxZoom:22,tiles:["https://".concat(te,"/traffic/incident/tile/pbf?api-version=1.0&zoom={z}&x={x}&y={y}")]}),this.getIncidentIconImageExpression());this.incidentLayer=new vp(this.incidentSourceName,this.incidentLayerName,{sourceLayer:"Traffic incident POI",iconOptions:{ignorePlacement:!0,allowOverlap:!0,image:e,size:.75}})}(window&&window.__extends||(og=function(e,t){return(og=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}og(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(ig,rg=ye);var og,rg,ng=ig;function ig(){var e=null!==rg&&rg.apply(this,arguments)||this;return e.interactive=!0,e.scrollZoomInteraction=!0,e.boxZoomInteraction=!0,e.dragRotateInteraction=!0,e.dragPanInteraction=!0,e.keyboardInteraction=!0,e.dblClickZoomInteraction=!0,e.touchInteraction=!0,e.touchRotate=!0,e.wheelZoomRate=1/450,e}sg.prototype.enable=function(){this.map.getMapContainer().addEventListener("keydown",this._onKeyDown)},sg.prototype.disable=function(){this.map.getMapContainer().removeEventListener("keydown",this._onKeyDown)};var ag=sg;function sg(e){var t=this;this._onKeyDown=function(e){27===e.keyCode&&t.map.getCanvas().focus()},this.map=e}ug.prototype.enable=function(){this.map.getCanvasContainer().addEventListener("gesturestart",this._onGestureStart),this.map.getCanvasContainer().addEventListener("gesturechange",this._onGestureChange),this.map.getCanvasContainer().addEventListener("touchstart",this._onTouchStart),this.map.getCanvasContainer().addEventListener("touchend",this._onTouchEnd)},ug.prototype.disable=function(){this.map.getCanvasContainer().removeEventListener("gesturestart",this._onGestureStart),this.map.getCanvasContainer().removeEventListener("gesturechange",this._onGestureChange),this.map.getCanvasContainer().removeEventListener("touchstart",this._onTouchStart),this.map.getCanvasContainer().removeEventListener("touchend",this._onTouchEnd)};var cg=ug;function ug(e){var t=this;this._onGestureStart=function(e){t.hasTouch||(e.preventDefault(),t.initZoom=t.map.getCamera().zoom)},this._onGestureChange=function(e){t.hasTouch||(e.preventDefault(),t.map.setCamera({zoom:t.initZoom+e.scale-1}))},this._onTouchStart=function(e){t.hasTouch=!0},this._onTouchEnd=function(e){0===e.touches.length&&(t.hasTouch=!1)},this.map=e}hg.prototype.addToMap=function(){this.added||(this.added=!0,this._setInteractions(this.options))},hg.prototype.removeFromMap=function(){this.added&&(this.added=!1,this._setInteractions({interactive:!1}))},hg.prototype.setOptions=function(e){this.options=(new ng).merge(this.options,e),this.added&&this._setInteractions(this.options)},hg.prototype.getOptions=function(){return Object.assign({},this.options)},hg.prototype._setInteractions=function(e){var t;e.interactive?(e.boxZoomInteraction?this.map._getMap().boxZoom.enable():this.map._getMap().boxZoom.disable(),e.dblClickZoomInteraction?this.map._getMap().doubleClickZoom.enable():this.map._getMap().doubleClickZoom.disable(),e.dragPanInteraction?this.map._getMap().dragPan.enable():this.map._getMap().dragPan.disable(),e.dragRotateInteraction?this.map._getMap().dragRotate.enable():this.map._getMap().dragRotate.disable(),e.keyboardInteraction?(this.map._getMap().keyboard.enable(),this.focusShortcut.enable()):(this.map._getMap().keyboard.disable(),this.focusShortcut.disable()),e.scrollZoomInteraction?(this.map._getMap().scrollZoom.enable(),this.map._getMap().scrollZoom.setWheelZoomRate(e.wheelZoomRate)):this.map._getMap().scrollZoom.disable(),t=this.map._getMap().touchZoomRotate,e.touchInteraction?(t.enable(),e.touchRotate?t.enableRotation():t.disableRotation()):t.disable(),this.pinchZoom.enable()):(this.map._getMap().boxZoom.disable(),this.map._getMap().doubleClickZoom.disable(),this.map._getMap().dragPan.disable(),this.map._getMap().dragRotate.disable(),this.map._getMap().keyboard.disable(),this.focusShortcut.disable(),this.map._getMap().scrollZoom.disable(),this.map._getMap().touchZoomRotate.disable(),this.pinchZoom.disable())};var lg=hg;function hg(e,t){this.added=!1,this.map=e,this.focusShortcut=new ag(e),this.pinchZoom=new cg(e),this.options=(new ng).merge(t)}function dg(e,t,o){var r={type:"Feature"};return 0!==(o=void 0===o?{}:o).id&&!o.id||(r.id=o.id),o.bbox&&(r.bbox=o.bbox),r.properties=t||{},r.geometry=e,r}function pg(e){return"Feature"===e.type?e.geometry:e}var fg=q(function(){function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function a(e,t,o){if(t)r(e.prototype,t);if(o)r(e,o);return e}var l=function(){function e(e,t){this.next=null;this.key=e;this.data=t;this.left=null;this.right=null}return e}();function t(e,t){return e>t?1:e<t?-1:0}function s(e,t,o){var r=new l(null,null);var n=r;var i=r;while(true){var a=o(e,t.key);if(a<0){if(t.left===null)break;if(o(e,t.left.key)<0){var s=t.left;t.left=s.right;s.right=t;t=s;if(t.left===null)break}i.left=t;i=t;t=t.left}else if(a>0){if(t.right===null)break;if(o(e,t.right.key)>0){var s=t.right;t.right=s.left;s.left=t;t=s;if(t.right===null)break}n.right=t;n=t;t=t.right}else break}n.right=t.left;i.left=t.right;t.left=r.right;t.right=r.left;return t}function c(e,t,o,r){var n=new l(e,t);if(o===null){n.left=n.right=null;return n}o=s(e,o,r);var i=r(e,o.key);if(i<0){n.left=o.left;n.right=o;o.left=null}else if(i>=0){n.right=o.right;n.left=o;o.right=null}return n}function h(e,t,o){var r=null;var n=null;if(t){t=s(e,t,o);var i=o(t.key,e);if(i===0){r=t.left;n=t.right}else if(i<0){n=t.right;t.right=null;r=t}else{r=t.left;t.left=null;n=t}}return{left:r,right:n}}function d(e,t,o){if(t===null)return e;if(e===null)return t;t=s(e.key,t,o);t.left=e;return t}function p(e,t,o,r,n){if(e){r(""+t+(o?"└── ":"├── ")+n(e)+"\n");var i=t+(o?" ":"│ ");if(e.left)p(e.left,i,false,r,n);if(e.right)p(e.right,i,true,r,n)}}var R=function(){function e(e){if(e===void 0)e=t;this._root=null;this._size=0;this._comparator=e}e.prototype.insert=function(e,t){this._size++;return this._root=c(e,t,this._root,this._comparator)};e.prototype.add=function(e,t){var o=new l(e,t);if(this._root===null){o.left=o.right=null;this._size++;this._root=o}var r=this._comparator;var n=s(e,this._root,r);var i=r(e,n.key);if(i===0)this._root=n;else{if(i<0){o.left=n.left;o.right=n;n.left=null}else if(i>0){o.right=n.right;o.left=n;n.right=null}this._size++;this._root=o}return this._root};e.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)};e.prototype._remove=function(e,t,o){var r;if(t===null)return null;t=s(e,t,o);var n=o(e,t.key);if(n===0){if(t.left===null)r=t.right;else{r=s(e,t.left,o);r.right=t.right}this._size--;return r}return t};e.prototype.pop=function(){var e=this._root;if(e){while(e.left)e=e.left;this._root=s(e.key,this._root,this._comparator);this._root=this._remove(e.key,this._root,this._comparator);return{key:e.key,data:e.data}}return null};e.prototype.findStatic=function(e){var t=this._root;var o=this._comparator;while(t){var r=o(e,t.key);if(r===0)return t;else if(r<0)t=t.left;else t=t.right}return null};e.prototype.find=function(e){if(this._root){this._root=s(e,this._root,this._comparator);if(this._comparator(e,this._root.key)!==0)return null}return this._root};e.prototype.contains=function(e){var t=this._root;var o=this._comparator;while(t){var r=o(e,t.key);if(r===0)return true;else if(r<0)t=t.left;else t=t.right}return false};e.prototype.forEach=function(e,t){var o=this._root;var r=[];var n=false;while(!n)if(o!==null){r.push(o);o=o.left}else if(r.length!==0){o=r.pop();e.call(t,o);o=o.right}else n=true;return this};e.prototype.range=function(e,t,o,r){var n=[];var i=this._comparator;var a=this._root;var s;while(n.length!==0||a)if(a){n.push(a);a=a.left}else{a=n.pop();s=i(a.key,t);if(s>0)break;else if(i(a.key,e)>=0)if(o.call(r,a))return this;a=a.right}return this};e.prototype.keys=function(){var o=[];this.forEach(function(e){var t=e.key;return o.push(t)});return o};e.prototype.values=function(){var o=[];this.forEach(function(e){var t=e.data;return o.push(t)});return o};e.prototype.min=function(){if(this._root)return this.minNode(this._root).key;return null};e.prototype.max=function(){if(this._root)return this.maxNode(this._root).key;return null};e.prototype.minNode=function(e){if(e===void 0)e=this._root;if(e)while(e.left)e=e.left;return e};e.prototype.maxNode=function(e){if(e===void 0)e=this._root;if(e)while(e.right)e=e.right;return e};e.prototype.at=function(e){var t=this._root;var o=false;var r=0;var n=[];while(!o)if(t){n.push(t);t=t.left}else if(n.length>0){t=n.pop();if(r===e)return t;r++;t=t.right}else o=true;return null};e.prototype.next=function(e){var t=this._root;var o=null;if(e.right){o=e.right;while(o.left)o=o.left;return o}var r=this._comparator;while(t){var n=r(e.key,t.key);if(n===0)break;else if(n<0){o=t;t=t.left}else t=t.right}return o};e.prototype.prev=function(e){var t=this._root;var o=null;if(e.left!==null){o=e.left;while(o.right)o=o.right;return o}var r=this._comparator;while(t){var n=r(e.key,t.key);if(n===0)break;else if(n<0)t=t.left;else{o=t;t=t.right}}return o};e.prototype.clear=function(){this._root=null;this._size=0;return this};e.prototype.toList=function(){return o(this._root)};e.prototype.load=function(e,t,o){if(t===void 0)t=[];if(o===void 0)o=false;var r=e.length;var n=this._comparator;if(o)v(e,t,0,r-1,n);if(this._root===null){this._root=f(e,t,0,r);this._size=r}else{var i=y(this.toList(),g(e,t),n);r=this._size+r;this._root=m({head:i},0,r)}return this};e.prototype.isEmpty=function(){return this._root===null};Object.defineProperty(e.prototype,"size",{get:function e(){return this._size},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"root",{get:function e(){return this._root},enumerable:true,configurable:true});e.prototype.toString=function(e){if(e===void 0)e=function e(t){return String(t.key)};var t=[];p(this._root,"",true,function(e){return t.push(e)},e);return t.join("")};e.prototype.update=function(e,t,o){var r=this._comparator;var n=h(e,this._root,r),i=n.left,a=n.right;if(r(e,t)<0)a=c(t,o,a,r);else i=c(t,o,i,r);this._root=d(i,a,r)};e.prototype.split=function(e){return h(e,this._root,this._comparator)};return e}();function f(e,t,o,r){var n=r-o;if(n>0){var i=o+Math.floor(n/2);var a=e[i];var s=t[i];var c=new l(a,s);c.left=f(e,t,o,i);c.right=f(e,t,i+1,r);return c}return null}function g(e,t){var o=new l(null,null);var r=o;for(var n=0;n<e.length;n++)r=r.next=new l(e[n],t[n]);r.next=null;return o.next}function o(e){var t=e;var o=[];var r=false;var n=new l(null,null);var i=n;while(!r)if(t){o.push(t);t=t.left}else if(o.length>0){t=i=i.next=o.pop();t=t.right}else r=true;i.next=null;return n.next}function m(e,t,o){var r=o-t;if(r>0){var n=t+Math.floor(r/2);var i=m(e,t,n);var a=e.head;a.left=i;e.head=e.head.next;a.right=m(e,n+1,o);return a}return null}function y(e,t,o){var r=new l(null,null);var n=r;var i=e;var a=t;while(i!==null&&a!==null){if(o(i.key,a.key)<0){n.next=i;i=i.next}else{n.next=a;a=a.next}n=n.next}if(i!==null)n.next=i;else if(a!==null)n.next=a;return r.next}function v(e,t,o,r,n){if(o>=r)return;var i=e[o+r>>1];var a=o-1;var s=r+1;while(true){do{a++}while(n(e[a],i)<0);do{s--}while(n(e[s],i)>0);if(a>=s)break;var c=e[a];e[a]=e[s];e[s]=c;c=t[a];t[a]=t[s];t[s]=c}v(e,t,o,s,n);v(e,t,s+1,r,n)}var _=function e(t,o){return t.ll.x<=o.x&&o.x<=t.ur.x&&t.ll.y<=o.y&&o.y<=t.ur.y},x=function e(t,o){if(o.ur.x<t.ll.x||t.ur.x<o.ll.x||o.ur.y<t.ll.y||t.ur.y<o.ll.y)return null;var r=t.ll.x<o.ll.x?o.ll.x:t.ll.x;var n=t.ur.x<o.ur.x?t.ur.x:o.ur.x;var i=t.ll.y<o.ll.y?o.ll.y:t.ll.y;var a=t.ur.y<o.ur.y?t.ur.y:o.ur.y;return{ll:{x:r,y:i},ur:{x:n,y:a}}},n=Number.EPSILON;if(n===undefined)n=Math.pow(2,-52);var O=n*n,w=function e(t,o){if(-n<t&&t<n)if(-n<o&&o<n)return 0;var r=t-o;if(r*r<O*t*o)return 0;return t<o?-1:1},e=function(){function e(){u(this,e);this.reset()}a(e,[{key:"reset",value:function e(){this.xRounder=new i;this.yRounder=new i}},{key:"round",value:function e(t,o){return{x:this.xRounder.round(t),y:this.yRounder.round(o)}}}]);return e}(),i=function(){function e(){u(this,e);this.tree=new R;this.round(0)}a(e,[{key:"round",value:function e(t){var o=this.tree.add(t);var r=this.tree.prev(o);if(r!==null&&w(o.key,r.key)===0){this.tree.remove(t);return r.key}var n=this.tree.next(o);if(n!==null&&w(o.key,n.key)===0){this.tree.remove(t);return n.key}return t}}]);return e}(),M=new e,b=function e(t,o){return t.x*o.y-t.y*o.x},C=function e(t,o){return t.x*o.x+t.y*o.y},E=function e(t,o,r){var n={x:o.x-t.x,y:o.y-t.y};var i={x:r.x-t.x,y:r.y-t.y};var a=b(n,i);return w(a,0)},S=function e(t){return Math.sqrt(C(t,t))},U=function e(t,o,r){var n={x:o.x-t.x,y:o.y-t.y};var i={x:r.x-t.x,y:r.y-t.y};return b(i,n)/S(i)/S(n)},j=function e(t,o,r){var n={x:o.x-t.x,y:o.y-t.y};var i={x:r.x-t.x,y:r.y-t.y};return C(i,n)/S(i)/S(n)},T=function e(t,o,r){if(o.y===0)return null;return{x:t.x+o.x/o.y*(r-t.y),y:r}},I=function e(t,o,r){if(o.x===0)return null;return{x:r,y:t.y+o.y/o.x*(r-t.x)}},H=function e(t,o,r,n){if(o.x===0)return I(r,n,t.x);if(n.x===0)return I(t,o,r.x);if(o.y===0)return T(r,n,t.y);if(n.y===0)return T(t,o,r.y);var i=b(o,n);if(i==0)return null;var a={x:r.x-t.x,y:r.y-t.y};var s=b(a,o)/i;var c=b(a,n)/i;var u=t.x+c*o.x,l=r.x+s*n.x;var h=t.y+c*o.y,d=r.y+s*n.y;var p=(u+l)/2;var f=(h+d)/2;return{x:p,y:f}},N=function(){a(n,null,[{key:"compare",value:function e(t,o){var r=n.comparePoints(t.point,o.point);if(r!==0)return r;if(t.point!==o.point)t.link(o);if(t.isLeft!==o.isLeft)return t.isLeft?1:-1;return k.compare(t.segment,o.segment)}},{key:"comparePoints",value:function e(t,o){if(t.x<o.x)return-1;if(t.x>o.x)return 1;if(t.y<o.y)return-1;if(t.y>o.y)return 1;return 0}}]);function n(e,t){u(this,n);if(e.events===undefined)e.events=[this];else e.events.push(this);this.point=e;this.isLeft=t}a(n,[{key:"link",value:function e(t){if(t.point===this.point)throw new Error("Tried to link already linked events");var o=t.point.events;for(var r=0,n=o.length;r<n;r++){var i=o[r];this.point.events.push(i);i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function e(){var t=this.point.events.length;for(var o=0;o<t;o++){var r=this.point.events[o];if(r.segment.consumedBy!==undefined)continue;for(var n=o+1;n<t;n++){var i=this.point.events[n];if(i.consumedBy!==undefined)continue;if(r.otherSE.point.events!==i.otherSE.point.events)continue;r.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function e(){var t=[];for(var o=0,r=this.point.events.length;o<r;o++){var n=this.point.events[o];if(n!==this&&!n.segment.ringOut&&n.segment.isInResult())t.push(n)}return t}},{key:"getLeftmostComparator",value:function e(r){var n=this;var c=new Map;var u=function e(t){var o=t.otherSE;c.set(t,{sine:U(n.point,r.point,o.point),cosine:j(n.point,r.point,o.point)})};return function(e,t){if(!c.has(e))u(e);if(!c.has(t))u(t);var o=c.get(e),r=o.sine,n=o.cosine;var i=c.get(t),a=i.sine,s=i.cosine;if(r>=0&&a>=0){if(n<s)return 1;if(n>s)return-1;return 0}if(r<0&&a<0){if(n<s)return-1;if(n>s)return 1;return 0}if(a<r)return-1;if(a>r)return 1;return 0}}}]);return n}(),B=0,k=function(){a(d,null,[{key:"compare",value:function e(t,o){var r=t.leftSE.point.x;var n=o.leftSE.point.x;var i=t.rightSE.point.x;var a=o.rightSE.point.x;if(a<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y;var c=o.leftSE.point.y;var u=t.rightSE.point.y;var l=o.rightSE.point.y;if(r<n){if(c<s&&c<u)return 1;if(c>s&&c>u)return-1;var h=t.comparePoint(o.leftSE.point);if(h<0)return 1;if(h>0)return-1;var d=o.comparePoint(t.rightSE.point);if(d!==0)return d;return-1}if(r>n){if(s<c&&s<l)return-1;if(s>c&&s>l)return 1;var p=o.comparePoint(t.leftSE.point);if(p!==0)return p;var f=t.comparePoint(o.rightSE.point);if(f<0)return 1;if(f>0)return-1;return 1}if(s<c)return-1;if(s>c)return 1;if(i<a){var g=o.comparePoint(t.rightSE.point);if(g!==0)return g}if(i>a){var m=t.comparePoint(o.rightSE.point);if(m<0)return 1;if(m>0)return-1}if(i!==a){var y=u-s;var v=i-r;var _=l-c;var w=a-n;if(y>v&&_<w)return 1;if(y<v&&_>w)return-1}if(i>a)return 1;if(i<a)return-1;if(u<l)return-1;if(u>l)return 1;if(t.id<o.id)return-1;if(t.id>o.id)return 1;return 0}}]);function d(e,t,o,r){u(this,d);this.id=++B;this.leftSE=e;e.segment=this;e.otherSE=t;this.rightSE=t;t.segment=this;t.otherSE=e;this.rings=o;this.windings=r}a(d,[{key:"replaceRightSE",value:function e(t){this.rightSE=t;this.rightSE.segment=this;this.rightSE.otherSE=this.leftSE;this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function e(){var t=this.leftSE.point.y;var o=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<o?t:o},ur:{x:this.rightSE.point.x,y:t>o?t:o}}}},{key:"vector",value:function e(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function e(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function e(t){if(this.isAnEndpoint(t))return 0;var o=this.leftSE.point;var r=this.rightSE.point;var n=this.vector();if(o.x===r.x){if(t.x===o.x)return 0;return t.x<o.x?1:-1}var i=(t.y-o.y)/n.y;var a=o.x+i*n.x;if(t.x===a)return 0;var s=(t.x-o.x)/n.x;var c=o.y+s*n.y;if(t.y===c)return 0;return t.y<c?-1:1}},{key:"getIntersection",value:function e(t){var o=this.bbox();var r=t.bbox();var n=x(o,r);if(n===null)return null;var i=this.leftSE.point;var a=this.rightSE.point;var s=t.leftSE.point;var c=t.rightSE.point;var u=_(o,s)&&this.comparePoint(s)===0;var l=_(r,i)&&t.comparePoint(i)===0;var h=_(o,c)&&this.comparePoint(c)===0;var d=_(r,a)&&t.comparePoint(a)===0;if(l&&u){if(d&&!h)return a;if(!d&&h)return c;return null}if(l){if(h)if(i.x===c.x&&i.y===c.y)return null;return i}if(u){if(d)if(a.x===s.x&&a.y===s.y)return null;return s}if(d&&h)return null;if(d)return a;if(h)return c;var p=H(i,this.vector(),s,t.vector());if(p===null)return null;if(!_(n,p))return null;return M.round(p.x,p.y)}},{key:"split",value:function e(t){var o=[];var r=t.events!==undefined;var n=new N(t,true);var i=new N(t,false);var a=this.rightSE;this.replaceRightSE(i);o.push(i);o.push(n);var s=new d(n,a,this.rings.slice(),this.windings.slice());if(N.comparePoints(s.leftSE.point,s.rightSE.point)>0)s.swapEvents();if(N.comparePoints(this.leftSE.point,this.rightSE.point)>0)this.swapEvents();if(r){n.checkForConsuming();i.checkForConsuming()}return o}},{key:"swapEvents",value:function e(){var t=this.rightSE;this.rightSE=this.leftSE;this.leftSE=t;this.leftSE.isLeft=true;this.rightSE.isLeft=false;for(var o=0,r=this.windings.length;o<r;o++)this.windings[o]*=-1}},{key:"consume",value:function e(t){var o=this;var r=t;while(o.consumedBy)o=o.consumedBy;while(r.consumedBy)r=r.consumedBy;var n=d.compare(o,r);if(n===0)return;if(n>0){var i=o;o=r;r=i}if(o.prev===r){var a=o;o=r;r=a}for(var s=0,c=r.rings.length;s<c;s++){var u=r.rings[s];var l=r.windings[s];var h=o.rings.indexOf(u);if(h===-1){o.rings.push(u);o.windings.push(l)}else o.windings[h]+=l}r.rings=null;r.windings=null;r.consumedBy=o;r.leftSE.consumedBy=o.leftSE;r.rightSE.consumedBy=o.rightSE}},{key:"prevInResult",value:function e(){if(this._prevInResult!==undefined)return this._prevInResult;if(!this.prev)this._prevInResult=null;else if(this.prev.isInResult())this._prevInResult=this.prev;else this._prevInResult=this.prev.prevInResult();return this._prevInResult}},{key:"beforeState",value:function e(){if(this._beforeState!==undefined)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}},{key:"afterState",value:function e(){if(this._afterState!==undefined)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};var o=this._afterState.rings;var r=this._afterState.windings;var n=this._afterState.multiPolys;for(var i=0,a=this.rings.length;i<a;i++){var s=this.rings[i];var c=this.windings[i];var u=o.indexOf(s);if(u===-1){o.push(s);r.push(c)}else r[u]+=c}var l=[];var h=[];for(var d=0,p=o.length;d<p;d++){if(r[d]===0)continue;var f=o[d];var g=f.poly;if(h.indexOf(g)!==-1)continue;if(f.isExterior)l.push(g);else{if(h.indexOf(g)===-1)h.push(g);var m=l.indexOf(f.poly);if(m!==-1)l.splice(m,1)}}for(var y=0,v=l.length;y<v;y++){var _=l[y].multiPoly;if(n.indexOf(_)===-1)n.push(_)}return this._afterState}},{key:"isInResult",value:function e(){if(this.consumedBy)return false;if(this._isInResult!==undefined)return this._isInResult;var t=this.beforeState().multiPolys;var o=this.afterState().multiPolys;switch(q.type){case"union":{var r=t.length===0;var n=o.length===0;this._isInResult=r!==n;break}case"intersection":{var i;var a;if(t.length<o.length){i=t.length;a=o.length}else{i=o.length;a=t.length}this._isInResult=a===q.numMultiPolys&&i<a;break}case"xor":{var s=Math.abs(t.length-o.length);this._isInResult=s%2===1;break}case"difference":{var c=function e(t){return t.length===1&&t[0].isSubject};this._isInResult=c(t)!==c(o);break}default:throw new Error("Unrecognized operation type found ".concat(q.type))}return this._isInResult}}],[{key:"fromRing",value:function e(t,o,r){var n,i,a;var s=N.comparePoints(t,o);if(s<0){n=t;i=o;a=1}else if(s>0){n=o;i=t;a=-1}else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var c=new N(n,true);var u=new N(i,false);return new d(c,u,[r],[a])}}]);return d}(),A=function(){function c(e,t,o){u(this,c);if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.poly=t;this.isExterior=o;this.segments=[];if(typeof e[0][0]!=="number"||typeof e[0][1]!=="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var r=M.round(e[0][0],e[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};var n=r;for(var i=1,a=e.length;i<a;i++){if(typeof e[i][0]!=="number"||typeof e[i][1]!=="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var s=M.round(e[i][0],e[i][1]);if(s.x===n.x&&s.y===n.y)continue;this.segments.push(k.fromRing(n,s,this));if(s.x<this.bbox.ll.x)this.bbox.ll.x=s.x;if(s.y<this.bbox.ll.y)this.bbox.ll.y=s.y;if(s.x>this.bbox.ur.x)this.bbox.ur.x=s.x;if(s.y>this.bbox.ur.y)this.bbox.ur.y=s.y;n=s}if(r.x!==n.x||r.y!==n.y)this.segments.push(k.fromRing(n,r,this))}a(c,[{key:"getSweepEvents",value:function e(){var t=[];for(var o=0,r=this.segments.length;o<r;o++){var n=this.segments[o];t.push(n.leftSE);t.push(n.rightSE)}return t}}]);return c}(),F=function(){function i(e,t){u(this,i);if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new A(e[0],this,true);this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}};this.interiorRings=[];for(var o=1,r=e.length;o<r;o++){var n=new A(e[o],this,false);if(n.bbox.ll.x<this.bbox.ll.x)this.bbox.ll.x=n.bbox.ll.x;if(n.bbox.ll.y<this.bbox.ll.y)this.bbox.ll.y=n.bbox.ll.y;if(n.bbox.ur.x>this.bbox.ur.x)this.bbox.ur.x=n.bbox.ur.x;if(n.bbox.ur.y>this.bbox.ur.y)this.bbox.ur.y=n.bbox.ur.y;this.interiorRings.push(n)}this.multiPoly=t}a(i,[{key:"getSweepEvents",value:function e(){var t=this.exteriorRing.getSweepEvents();for(var o=0,r=this.interiorRings.length;o<r;o++){var n=this.interiorRings[o].getSweepEvents();for(var i=0,a=n.length;i<a;i++)t.push(n[i])}return t}}]);return i}(),L=function(){function i(e,t){u(this,i);if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{if(typeof e[0][0][0]==="number")e=[e]}catch(e){}this.polys=[];this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var o=0,r=e.length;o<r;o++){var n=new F(e[o],this);if(n.bbox.ll.x<this.bbox.ll.x)this.bbox.ll.x=n.bbox.ll.x;if(n.bbox.ll.y<this.bbox.ll.y)this.bbox.ll.y=n.bbox.ll.y;if(n.bbox.ur.x>this.bbox.ur.x)this.bbox.ur.x=n.bbox.ur.x;if(n.bbox.ur.y>this.bbox.ur.y)this.bbox.ur.y=n.bbox.ur.y;this.polys.push(n)}this.isSubject=t}a(i,[{key:"getSweepEvents",value:function e(){var t=[];for(var o=0,r=this.polys.length;o<r;o++){var n=this.polys[o].getSweepEvents();for(var i=0,a=n.length;i<a;i++)t.push(n[i])}return t}}]);return i}(),z=function(){a(b,null,[{key:"factory",value:function e(t){var o=[];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(!i.isInResult()||i.ringOut)continue;var a=null;var s=i.leftSE;var c=i.rightSE;var u=[s];var l=s.point;var h=[];while(true){a=s;s=c;u.push(s);if(s.point===l)break;while(true){var d=s.getAvailableLinkedEvents();if(d.length===0){var p=u[0].point;var f=u[u.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(f.x,", ").concat(f.y,"]."))}if(d.length===1){c=d[0].otherSE;break}var g=null;for(var m=0,y=h.length;m<y;m++)if(h[m].point===s.point){g=m;break}if(g!==null){var v=h.splice(g)[0];var _=u.splice(v.index);_.unshift(_[0].otherSE);o.push(new b(_.reverse()));continue}h.push({index:u.length,point:s.point});var w=s.getLeftmostComparator(a);c=d.sort(w)[0].otherSE;break}}o.push(new b(u))}return o}}]);function b(e){u(this,b);this.events=e;for(var t=0,o=e.length;t<o;t++)e[t].segment.ringOut=this;this.poly=null}a(b,[{key:"getGeom",value:function e(){var t=this.events[0].point;var o=[t];for(var r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point;var a=this.events[r+1].point;if(E(i,t,a)===0)continue;o.push(i);t=i}if(o.length===1)return null;var s=o[0];var c=o[1];if(E(s,t,c)===0)o.shift();o.push(o[0]);var u=this.isExteriorRing()?1:-1;var l=this.isExteriorRing()?0:o.length-1;var h=this.isExteriorRing()?o.length:-1;var d=[];for(var p=l;p!=h;p+=u)d.push([o[p].x,o[p].y]);return d}},{key:"isExteriorRing",value:function e(){if(this._isExteriorRing===undefined){var t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():true}return this._isExteriorRing}},{key:"enclosingRing",value:function e(){if(this._enclosingRing===undefined)this._enclosingRing=this._calcEnclosingRing();return this._enclosingRing}},{key:"_calcEnclosingRing",value:function e(){var t=this.events[0];for(var o=1,r=this.events.length;o<r;o++){var n=this.events[o];if(N.compare(t,n)>0)t=n}var i=t.segment.prevInResult();var a=i?i.prevInResult():null;while(true){if(!i)return null;if(!a)return i.ringOut;if(a.ringOut!==i.ringOut)if(a.ringOut.enclosingRing()!==i.ringOut)return i.ringOut;else return i.ringOut.enclosingRing();i=a.prevInResult();a=i?i.prevInResult():null}}}]);return b}(),P=function(){function t(e){u(this,t);this.exteriorRing=e;e.poly=this;this.interiorRings=[]}a(t,[{key:"addInterior",value:function e(t){this.interiorRings.push(t);t.poly=this}},{key:"getGeom",value:function e(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var o=0,r=this.interiorRings.length;o<r;o++){var n=this.interiorRings[o].getGeom();if(n===null)continue;t.push(n)}return t}}]);return t}(),K=function(){function t(e){u(this,t);this.rings=e;this.polys=this._composePolys(e)}a(t,[{key:"getGeom",value:function e(){var t=[];for(var o=0,r=this.polys.length;o<r;o++){var n=this.polys[o].getGeom();if(n===null)continue;t.push(n)}return t}},{key:"_composePolys",value:function e(t){var o=[];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(i.poly)continue;if(i.isExteriorRing())o.push(new P(i));else{var a=i.enclosingRing();if(!a.poly)o.push(new P(a));a.poly.addInterior(i)}}return o}}]);return t}(),G=function(){function o(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:k.compare;u(this,o);this.queue=e;this.tree=new R(t);this.segments=[]}a(o,[{key:"process",value:function e(t){var o=t.segment;var r=[];if(t.consumedBy){if(t.isLeft)this.queue.remove(t.otherSE);else this.tree.remove(o);return r}var n=t.isLeft?this.tree.insert(o):this.tree.find(o);if(!n)throw new Error("Unable to find segment #".concat(o.id," ")+"[".concat(o.leftSE.point.x,", ").concat(o.leftSE.point.y,"] -> ")+"[".concat(o.rightSE.point.x,", ").concat(o.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");var i=n;var a=n;var s=undefined;var c=undefined;while(s===undefined){i=this.tree.prev(i);if(i===null)s=null;else if(i.key.consumedBy===undefined)s=i.key}while(c===undefined){a=this.tree.next(a);if(a===null)c=null;else if(a.key.consumedBy===undefined)c=a.key}if(t.isLeft){var u=null;if(s){var l=s.getIntersection(o);if(l!==null){if(!o.isAnEndpoint(l))u=l;if(!s.isAnEndpoint(l)){var h=this._splitSafely(s,l);for(var d=0,p=h.length;d<p;d++)r.push(h[d])}}}var f=null;if(c){var g=c.getIntersection(o);if(g!==null){if(!o.isAnEndpoint(g))f=g;if(!c.isAnEndpoint(g)){var m=this._splitSafely(c,g);for(var y=0,v=m.length;y<v;y++)r.push(m[y])}}}if(u!==null||f!==null){var _=null;if(u===null)_=f;else if(f===null)_=u;else{var w=N.comparePoints(u,f);_=w<=0?u:f}this.queue.remove(o.rightSE);r.push(o.rightSE);var b=o.split(_);for(var C=0,E=b.length;C<E;C++)r.push(b[C])}if(r.length>0){this.tree.remove(o);r.push(t)}else{this.segments.push(o);o.prev=s}}else{if(s&&c){var S=s.getIntersection(c);if(S!==null){if(!s.isAnEndpoint(S)){var T=this._splitSafely(s,S);for(var I=0,k=T.length;I<k;I++)r.push(T[I])}if(!c.isAnEndpoint(S)){var A=this._splitSafely(c,S);for(var P=0,O=A.length;P<O;P++)r.push(A[P])}}}this.tree.remove(o)}return r}},{key:"_splitSafely",value:function e(t,o){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(o);n.push(r);if(t.consumedBy===undefined)this.tree.insert(t);return n}}]);return o}(),D=typeof process!=="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Y=typeof process!=="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,W,q=new(function(){function e(){u(this,e)}a(e,[{key:"run",value:function e(t,o,r){q.type=t;M.reset();var n=[new L(o,true)];for(var i=0,a=r.length;i<a;i++)n.push(new L(r[i],false));q.numMultiPolys=n.length;if(q.type==="difference"){var s=n[0];var c=1;while(c<n.length)if(x(n[c].bbox,s.bbox)!==null)c++;else n.splice(c,1)}if(q.type==="intersection")for(var u=0,l=n.length;u<l;u++){var h=n[u];for(var d=u+1,p=n.length;d<p;d++)if(x(h.bbox,n[d].bbox)===null)return[]}var f=new R(N.compare);for(var g=0,m=n.length;g<m;g++){var y=n[g].getSweepEvents();for(var v=0,_=y.length;v<_;v++){f.insert(y[v]);if(f.size>D)throw new Error("Infinite loop when putting segment endpoints in a priority queue "+"(queue size too big). Please file a bug report.")}}var w=new G(f);var b=f.size;var C=f.pop();while(C){var E=C.key;if(f.size===b){var S=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(S.id," ")+"[".concat(S.leftSE.point.x,", ").concat(S.leftSE.point.y,"] -> ")+"[".concat(S.rightSE.point.x,", ").concat(S.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>D)throw new Error("Infinite loop when passing sweep line over endpoints "+"(queue size too big). Please file a bug report.");if(w.segments.length>Y)throw new Error("Infinite loop when passing sweep line over endpoints "+"(too many sweep line segments). Please file a bug report.");var T=w.process(E);for(var I=0,k=T.length;I<k;I++){var A=T[I];if(A.consumedBy===undefined)f.insert(A)}b=f.size;C=f.pop()}M.reset();var P=z.factory(w.segments);var O=new K(P);return O.getGeom()}}]);return e}()),Z,Q,V,J,X;return{union:function e(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return q.run("union",t,r)},intersection:function e(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return q.run("intersection",t,r)},xor:function e(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return q.run("xor",t,r)},difference:function e(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return q.run("difference",t,r)}}}());function gg(e,t,o){void 0===o&&(o={});var e=pg(e),t=pg(t),e=fg.intersection(e.coordinates,t.coordinates);if(0===e.length)return null;if(1!==e.length)return t=o.properties,dg({type:"MultiPolygon",coordinates:e},t,r=void 0===r?{}:r);var t=e[0],r=o.properties,e=void 0;void 0===e&&(e={});for(var n=0,i=t;n<i.length;n++){var a=i[n];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return dg({type:"Polygon",coordinates:t},r,e)}var mg,bn=window&&window.__decorate||function(e,t,o,r){var n,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;0<=s;s--)(n=e[s])&&(a=(i<3?n(a):3<i?n(t,o,a):n(t,o))||a);return 3<i&&a&&Object.defineProperty(t,o,a),a},yg=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},vg=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},_g=["DIV","SPAN","A"],wg=["data-azure-maps-attribution-minzoom","data-azure-maps-attribution-maxzoom","data-azure-maps-attribution-geometry","data-azure-maps-attribution-tileset","data-azure-maps-attribution-order","data-azure-maps-attribution-dynamic"],bg=vg(["href"],yg(wg),!1),Cg=(Eg.prototype.equals=function(e){return this.stringRepresentation===e.stringRepresentation},Object.defineProperty(Eg.prototype,"stringRepresentation",{get:function(){return[void 0!==this.minZoom?"minzoom=".concat(this.minZoom):"",void 0!==this.maxZoom?"maxzoom=".concat(this.maxZoom):"",void 0!==this.geometry?this.element.attributes.getNamedItem("data-azure-maps-attribution-geometry").value:"",void 0!==this.tilesetId?"tilesetId=".concat(this.tilesetId):"",this.dynamic?"dynamic":""].filter(function(e){return 0<e.length}).join(";")},enumerable:!1,configurable:!0}),Eg.applicable=function(e){return Array.from(e.attributes).map(function(e){return wg.includes(e.name)}).reduce(function(e,t){return e||t},!1)},Object.defineProperty(Eg.prototype,"minZoom",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-minzoom");return e&&!isNaN(e.value)?parseInt(e.value):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(Eg.prototype,"maxZoom",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-maxzoom");return e&&!isNaN(e.value)?parseInt(e.value):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(Eg.prototype,"geometry",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-geometry");if(e&&e.value)try{return JSON.parse(e.value)}catch(e){}},enumerable:!1,configurable:!0}),Object.defineProperty(Eg.prototype,"tilesetId",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-tileset");return e&&e.value?e.value:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(Eg.prototype,"order",{get:function(){var e=this.element.attributes.getNamedItem("data-azure-maps-attribution-order");return e&&!isNaN(e.value)?parseInt(e.value):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(Eg.prototype,"dynamic",{get:function(){return null!==this.element.attributes.getNamedItem("data-azure-maps-attribution-dynamic")},enumerable:!1,configurable:!0}),Object.defineProperty(Eg.prototype,"hidesElement",{get:function(){return"none"==this.element.style.display},enumerable:!1,configurable:!0}),Eg.prototype.forceHide=function(){this.element.style.display="none"},Eg.prototype.satisfied=function(e){var t=!this.minZoom||!e.zoom||e.zoom>=this.minZoom,o=!this.maxZoom||!e.zoom||e.zoom<=this.maxZoom,r=!0;return this.geometry&&e.bounds&&(r=null!==gg({type:"Feature",geometry:this.geometry,properties:{}},{type:"Feature",geometry:{type:"Polygon",coordinates:[[f.getNorthWest(e.bounds),f.getNorthEast(e.bounds),f.getSouthEast(e.bounds),f.getSouthWest(e.bounds),f.getNorthWest(e.bounds)]]},properties:{}})),t&&o&&r},Eg.prototype.apply=function(t,e){var o=this,r=(void 0===e&&(e=null),this.satisfied(t.getCamera())),n=this.dynamic&&this.tilesetId,i=this.hidesElement,e=e&&["dragend","zoomend","pitchend"].includes(e.type);return r||i?r&&(i||n)&&(r&&i&&this.element.style.removeProperty("display"),n)&&(e?t.events.addOnce("idle",function(e){return o.fetchAndApplyDynamicAttribution(t)}):this.fetchAndApplyDynamicAttribution(t)):this.element.style.display="none",r===i},Eg.prototype.fetchAndApplyDynamicAttribution=function(r){var t,o,e,n=this,i=r.getCamera();this.lastFetchState&&f.containsBoundingBox(this.lastFetchState.bounds,i.bounds)&&Math.floor(this.lastFetchState.zoom)==Math.floor(i.zoom)||(t=Yu(i.center,f.getSouthWest(i.bounds),Eg.viewportBufferExpansionRatio),e=((o=Yu(i.center,f.getNorthEast(i.bounds),Eg.viewportBufferExpansionRatio))[0]<t[0]?[[t[0],t[1],180,o[1]],[-180,t[1],o[0],o[1]]]:[[t[0],t[1],o[0],o[1]]]).map(function(e){var e=new URLSearchParams({"api-version":"2.1",tilesetId:n.tilesetId,zoom:void 0!==i.zoom?"".concat(Math.floor(i.zoom)):void 0,bounds:e.join(",")}),t="".concat("https://{{azMapsDomain}}","/map/attribution"),o={url:t,headers:{}},t=(r._substituteDomainLanguageViewAndSignInRequest(t,o),"".concat(o.url).concat(o.url.includes("?")?"&":"?").concat(e.toString()));return r._sendRequest(t,"Attribution",o.headers).then(function(e){return e.json()})}),Promise.all(e).then(function(e){n.applyAttributionResponse(e),n.lastFetchState={bounds:new f([t[0],t[1],o[0],o[1]]),zoom:i.zoom}}).catch(function(e){return console.error(e)}))},Eg.prototype.applyAttributionResponse=function(e){var t,o,r,n=this,e=e.map(function(e){return e.copyrights||[]}).reduce(function(e,t){return vg(vg([],yg(e),!1),yg(t),!1)},[]);0!=e.length&&(null===(e=zp.parseWithFilter(e.join(""),function(e){return!0},function(e){return e},function(){return n.element.innerHTML="",n.element}))?console.warn("Dynamic attribution is empty after filtering"):(t="string"==typeof e?((t=document.createElement("span")).innerHTML=e,t):e,r=t===this.element?(o=document.createElement("span"),Array.from(this.element.childNodes).forEach(function(e){return o.appendChild(e)}),o):t,Array.from(this.element.attributes).filter(function(e){return wg.includes(e.name)}).forEach(function(e){return r.attributes.setNamedItem(e.cloneNode())}),r.style.display=this.element.style.display,e=this.element.parentElement,this.element.remove(),e.append(r),this.element=r,this.attributionChangeCallback(this)))},Eg.viewportBufferExpansionRatio=2,bn([(mg=1e3,function(e,t,o){var r=o.value,n=new Map;return o.value=function(){var e=this,t=arguments;!n.get(e)&&1&&(r.apply(e,t),n.set(e,!0),setTimeout(function(){return n.delete(e)},mg))},o})],Eg.prototype,"fetchAndApplyDynamicAttribution",null),Eg);function Eg(e,t){var o=this;this.lastFetchState={bounds:null,zoom:null},this.getElement=function(){return o.element},this.element=e,this.attributionChangeCallback=t}var Sg=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},Tg=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},Ig=[/all rights reserved/gi],kg=(Ag.prototype.addToMap=function(){this.map.events.add("stylechanged",this.loadAttributionOnceSourcesLoaded),this.map.events.add("dragend",this.applyRules),this.map.events.add("zoomend",this.applyRules),this.map.events.add("pitchend",this.applyRules)},Ag.prototype.removeFromMap=function(){this.map.events.remove("stylechanged",this.loadAttributionOnceSourcesLoaded),this.map.events.remove("dragend",this.applyRules),this.map.events.remove("zoomend",this.applyRules),this.map.events.remove("pitchend",this.applyRules)},Ag.prototype.getDefaultAttribution=function(){return this.copyrightControl.getDefaultAttributions().map(function(e){return e=e,(t=document.createElement("a")).textContent=e,t;var t})},Ag);function Ag(e,t,o){var r,s=this;this.rules=[],this.virtualContext=((r=document.createElement("span")).className="azure-map-copyright-context",r),this.renderContext=this.virtualContext.cloneNode(!1),this.addAttributionFromSource=function(e){},this.removeAttributionFromSource=function(e){},this.getMapStyleVisibleSources=function(){var t=s.map._getMap(),o=t.getStyle();return Object.entries(o.sources).filter(function(e){var t=Sg(e,1)[0];return o.layers.filter(function(e){return e&&e.source==t}).reduce(function(e,t){return!(t.layout&&"none"===t.layout.visibility||t.paint&&0===t.paint["icon-opacity"]&&0===t.paint["text-opacity"])||e},!1)}).map(function(e){e=Sg(e,1)[0];return t.getSource(e)})},this.loadAttributionOnceSourcesLoaded=function(){var e=s.getMapStyleVisibleSources();Promise.all(e.map(function(i){return new Promise(function(o,r){var n;"tiles"in i?o(i):((n=i).on("data",function e(t){"metadata"==t.sourceDataType&&(n.off("data",e),o(i))}),n.on("error",function e(t){n.off("error",e),r(t)}))}).then(function(e){return{status:"fulfilled",value:e}}).catch(function(e){return{status:"rejected",reason:e}})})).then(function(e){s.reloadAttribution()})},this.reloadAttribution=function(){var e=s.getMapStyleVisibleSources(),r=new Set,n={},e=e.filter(function(e){return"attribution"in e&&e.attribution&&"tiles"in e&&e.tiles instanceof Array&&0<e.tiles.length}).map(function(e){return zp.parseWithFilter(null!=(e=e.attribution)?e:"",function(e){return _g.includes(e.tagName)&&Array.from(e.attributes).map(function(e){return bg.includes(e.name)}).reduce(function(e,t){return e&&t},!0)},function(e){var t,o=null;return e instanceof HTMLElement&&Cg.applicable(e)&&(o=new Cg(e,function(){return s.renderAttribution()}),r.add(o),void 0!==o.order)&&(e.style.order="".concat(o.order)),o&&e instanceof HTMLElement&&(!((t=o.stringRepresentation)in n)||void 0!==o.order&&void 0!==n[t].order&&o.order<n[t].order||void 0!==o.order&&void 0===n[t].order)&&(n[t]=o),e},function(){return document.createElement("span")})}),t=new Set(Object.values(n)),o=new Set(Tg([],Sg(r),!1).filter(function(e){return!t.has(e)})),i=new Set(Tg([],Sg(o),!1).map(function(e){return e.getElement()})),o=(Tg([],Sg(i),!1).filter(function(e){return null!==e.parentElement}).forEach(function(e){return e.parentElement.removeChild(e)}),s.rules=Object.values(n),e.filter(function(e){return"string"==typeof e||!i.has(e)}).map(function(e){return"string"==typeof e?new Text(e):e})),a=document.createElement("span");0<o.length?o.forEach(function(e){return a.appendChild(e)}):s.getDefaultAttribution().forEach(function(e){return a.appendChild(e)}),s.virtualContext=a,s.copyrightControl.setOptions({copyrightContent:s.renderContext}),s.applyRules(),s.renderAttribution()},this.applyRules=function(o){void 0===o&&(o=null),s.rules.reduce(function(e,t){t=t.apply(s.map,o);return e||t},!1)&&s.renderAttribution()},this.renderAttribution=function(){var t=function(e){return Array.from("none"!=e.style.display?e.children:[]).map(function(e){return t(e)}).reduce(function(e,t){return Tg(Tg([],Sg(e),!1),Sg(t),!1)},Array.from("none"!=e.style.display?e.childNodes:[]).filter(function(e){return e.nodeType==e.TEXT_NODE}))},e=s.virtualContext.cloneNode(!0),o=t(e);o.forEach(function(e){return e.textContent=Tg([],Sg(Ig),!1).reduce(function(e,t){return e.replace(t,"").trim()},e.textContent)}),o.reduce(function(e,t){return e.has(t.textContent)?(t.textContent="",t.parentElement&&t.parentElement.removeChild(t)):e.add(t.textContent),e},new Set),s.renderContext.innerHTML="",Array.from(e.childNodes).forEach(function(e){return s.renderContext.appendChild(e)})},this.map=e,this.copyrightControl=t,this.options=o}var Pg=function(e,t){return(Pg=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)};function Og(e,t){function o(){this.constructor=e}Pg(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var v=function(){return(v=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function Rg(e,t){var o={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o}function _(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})}function w(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function xg(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a}(arguments[t]));return e}var Mg=function(e,t){return(Mg=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)};function Ng(e,t){function o(){this.constructor=e}Mg(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var Lg=function(){return(Lg=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function b(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})}function C(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function Dg(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r}var qg,Ug,jg,u,Hg,Bg,Fg,zg,Kg,Gg,E,Yg,Wg,Zg,S={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",CACHE_PREFIX:"msal",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_RESPONSE_TYPE:"code",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",FRAGMENT_RESPONSE_MODE:"fragment",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",REGIONAL_AUTH_NON_MSI_QUERY_STRING:"allowestsrnonmsi=true",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],TOKEN_RESPONSE_TYPE:"token",ID_TOKEN_RESPONSE_TYPE:"id_token",SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},Qg=[S.OPENID_SCOPE,S.PROFILE_SCOPE,S.OFFLINE_ACCESS_SCOPE],Vg=Dg(Qg,[S.EMAIL_SCOPE]),Jg=((ir=qg=qg||{}).CONTENT_TYPE="Content-Type",ir.RETRY_AFTER="Retry-After",ir.CCS_HEADER="X-AnchorMailbox",ir.WWWAuthenticate="WWW-Authenticate",ir.AuthenticationInfo="Authentication-Info",ir.X_MS_REQUEST_ID="x-ms-request-id",ir.X_MS_HTTP_VERSION="x-ms-httpver",(Uo=Ug=Ug||{}).ID_TOKEN="idtoken",Uo.CLIENT_INFO="client.info",Uo.ADAL_ID_TOKEN="adal.idtoken",Uo.ERROR="error",Uo.ERROR_DESC="error.description",Uo.ACTIVE_ACCOUNT="active-account",Uo.ACTIVE_ACCOUNT_FILTERS="active-account-filters",(hi=jg=jg||{}).COMMON="common",hi.ORGANIZATIONS="organizations",hi.CONSUMERS="consumers",(i=u=u||{}).CLIENT_ID="client_id",i.REDIRECT_URI="redirect_uri",i.RESPONSE_TYPE="response_type",i.RESPONSE_MODE="response_mode",i.GRANT_TYPE="grant_type",i.CLAIMS="claims",i.SCOPE="scope",i.ERROR="error",i.ERROR_DESCRIPTION="error_description",i.ACCESS_TOKEN="access_token",i.ID_TOKEN="id_token",i.REFRESH_TOKEN="refresh_token",i.EXPIRES_IN="expires_in",i.STATE="state",i.NONCE="nonce",i.PROMPT="prompt",i.SESSION_STATE="session_state",i.CLIENT_INFO="client_info",i.CODE="code",i.CODE_CHALLENGE="code_challenge",i.CODE_CHALLENGE_METHOD="code_challenge_method",i.CODE_VERIFIER="code_verifier",i.CLIENT_REQUEST_ID="client-request-id",i.X_CLIENT_SKU="x-client-SKU",i.X_CLIENT_VER="x-client-VER",i.X_CLIENT_OS="x-client-OS",i.X_CLIENT_CPU="x-client-CPU",i.X_CLIENT_CURR_TELEM="x-client-current-telemetry",i.X_CLIENT_LAST_TELEM="x-client-last-telemetry",i.X_MS_LIB_CAPABILITY="x-ms-lib-capability",i.X_APP_NAME="x-app-name",i.X_APP_VER="x-app-ver",i.POST_LOGOUT_URI="post_logout_redirect_uri",i.ID_TOKEN_HINT="id_token_hint",i.DEVICE_CODE="device_code",i.CLIENT_SECRET="client_secret",i.CLIENT_ASSERTION="client_assertion",i.CLIENT_ASSERTION_TYPE="client_assertion_type",i.TOKEN_TYPE="token_type",i.REQ_CNF="req_cnf",i.OBO_ASSERTION="assertion",i.REQUESTED_TOKEN_USE="requested_token_use",i.ON_BEHALF_OF="on_behalf_of",i.FOCI="foci",i.CCS_HEADER="X-AnchorMailbox",i.RETURN_SPA_CODE="return_spa_code",i.NATIVE_BROKER="nativebroker",i.LOGOUT_HINT="logout_hint",(be=Hg=Hg||{}).ACCESS_TOKEN="access_token",be.XMS_CC="xms_cc",{LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"}),Xg=((Mi=Bg=Bg||{}).ACCOUNT="account",Mi.SID="sid",Mi.LOGIN_HINT="login_hint",Mi.ID_TOKEN="id_token",Mi.DOMAIN_HINT="domain_hint",Mi.ORGANIZATIONS="organizations",Mi.CONSUMERS="consumers",Mi.ACCOUNT_ID="accountIdentifier",Mi.HOMEACCOUNT_ID="homeAccountIdentifier",{PLAIN:"plain",S256:"S256"}),$g=((cn=Fg=Fg||{}).QUERY="query",cn.FRAGMENT="fragment",cn.FORM_POST="form_post",(o=zg=zg||{}).IMPLICIT_GRANT="implicit",o.AUTHORIZATION_CODE_GRANT="authorization_code",o.CLIENT_CREDENTIALS_GRANT="client_credentials",o.RESOURCE_OWNER_PASSWORD_GRANT="password",o.REFRESH_TOKEN_GRANT="refresh_token",o.DEVICE_CODE_GRANT="device_code",o.JWT_BEARER="urn:ietf:params:oauth:grant-type:jwt-bearer",(un=Kg=Kg||{}).MSSTS_ACCOUNT_TYPE="MSSTS",un.ADFS_ACCOUNT_TYPE="ADFS",un.MSAV1_ACCOUNT_TYPE="MSA",un.GENERIC_ACCOUNT_TYPE="Generic",(e=Gg=Gg||{}).CACHE_KEY_SEPARATOR="-",e.CLIENT_INFO_SEPARATOR=".",(r=E=E||{}).ID_TOKEN="IdToken",r.ACCESS_TOKEN="AccessToken",r.ACCESS_TOKEN_WITH_AUTH_SCHEME="AccessToken_With_AuthScheme",r.REFRESH_TOKEN="RefreshToken",(t=Yg=Yg||{})[t.ADFS=1001]="ADFS",t[t.MSA=1002]="MSA",t[t.MSSTS=1003]="MSSTS",t[t.GENERIC=1004]="GENERIC",t[t.ACCESS_TOKEN=2001]="ACCESS_TOKEN",t[t.REFRESH_TOKEN=2002]="REFRESH_TOKEN",t[t.ID_TOKEN=2003]="ID_TOKEN",t[t.APP_METADATA=3001]="APP_METADATA",t[t.UNDEFINED=9999]="UNDEFINED","appmetadata"),em="authority-metadata",tm=86400,om=((n=Wg=Wg||{}).CONFIG="config",n.CACHE="cache",n.NETWORK="network",n.HARDCODED_VALUES="hardcoded_values",{SCHEMA_VERSION:5,MAX_CUR_HEADER_BYTES:80,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"});(a=Zg=Zg||{}).BEARER="Bearer",a.POP="pop",a.SSH="ssh-cert";var rm,nm,im,am,sm,cm,um=60,lm=3600,hm="throttling",dm="retry-after, h429",pm="invalid_grant",fm="client_mismatch";(bn=rm=rm||{}).username="username",bn.password="password",(ir=nm=nm||{})[ir.httpSuccess=200]="httpSuccess",ir[ir.httpBadRequest=400]="httpBadRequest",(Uo=im=im||{}).FAILED_AUTO_DETECTION="1",Uo.INTERNAL_CACHE="2",Uo.ENVIRONMENT_VARIABLE="3",Uo.IMDS="4",(hi=am=am||{}).CONFIGURED_MATCHES_DETECTED="1",hi.CONFIGURED_NO_AUTO_DETECTION="2",hi.CONFIGURED_NOT_DETECTED="3",hi.AUTO_DETECTION_REQUESTED_SUCCESSFUL="4",hi.AUTO_DETECTION_REQUESTED_FAILED="5",(i=sm=sm||{}).NO_CACHE_HIT="0",i.FORCE_REFRESH="1",i.NO_CACHED_ACCESS_TOKEN="2",i.CACHED_ACCESS_TOKEN_EXPIRED="3",i.REFRESH_CACHED_ACCESS_TOKEN="4",i.CLAIMS_REQUESTED_CACHE_SKIPPED="5",(be=cm=cm||{}).Jwt="JWT",be.Jwk="JWK",be.Pop="pop";var gm,mm={code:"unexpected_error",desc:"Unexpected error in authentication."},ym={code:"post_request_failed",desc:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."},T=(Ng(vm,gm=Error),vm.prototype.setCorrelationId=function(e){this.correlationId=e},vm.createUnexpectedError=function(e){return new vm(mm.code,mm.desc+": "+e)},vm.createPostRequestFailed=function(e){return new vm(ym.code,ym.desc+": "+e)},vm);function vm(e,t,o){var r=this,r=gm.call(this,t?e+": "+t:e)||this;return Object.setPrototypeOf(r,vm.prototype),r.errorCode=e||S.EMPTY_STRING,r.errorMessage=t||S.EMPTY_STRING,r.subError=o||S.EMPTY_STRING,r.name="AuthError",r}var _m,wm={createNewGuid:function(){throw T.createUnexpectedError("Crypto interface - createNewGuid() has not been implemented")},base64Decode:function(){throw T.createUnexpectedError("Crypto interface - base64Decode() has not been implemented")},base64Encode:function(){throw T.createUnexpectedError("Crypto interface - base64Encode() has not been implemented")},generatePkceCodes:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - generatePkceCodes() has not been implemented")})})},getPublicKeyThumbprint:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - getPublicKeyThumbprint() has not been implemented")})})},removeTokenBindingKey:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - removeTokenBindingKey() has not been implemented")})})},clearKeystore:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - clearKeystore() has not been implemented")})})},signJwt:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - signJwt() has not been implemented")})})},hashString:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Crypto interface - hashString() has not been implemented")})})}},bm={code:"client_info_decoding_error",desc:"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause."},Cm={code:"client_info_empty_error",desc:"The client info was empty. Please review the trace to determine the root cause."},Em={code:"token_parsing_error",desc:"Token cannot be parsed. Please review stack trace to determine root cause."},Sm={code:"null_or_empty_token",desc:"The token is null or empty. Please review the trace to determine the root cause."},Tm={code:"endpoints_resolution_error",desc:"Error: could not resolve endpoints. Please check network and try again."},Im={code:"network_error",desc:"Network request failed. Please check network trace to determine root cause."},km={code:"openid_config_error",desc:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints."},Am={code:"hash_not_deserialized",desc:"The hash parameters could not be deserialized. Please review the trace to determine the root cause."},Pm={code:"invalid_state",desc:"State was not the expected format. Please check the logs to determine whether the request was sent using ProtocolUtils.setRequestState()."},Om={code:"state_mismatch",desc:"State mismatch error. Please check your network. Continued requests may cause cache overflow."},Rm={code:"state_not_found",desc:"State not found"},xm={code:"nonce_mismatch",desc:"Nonce mismatch error. This may be caused by a race condition in concurrent requests."},Mm={code:"nonce_not_found",desc:"nonce not found"},Nm={code:"auth_time_not_found",desc:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information."},Lm={code:"max_age_transpired",desc:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication."},Dm={code:"multiple_matching_tokens",desc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account."},qm={code:"multiple_matching_accounts",desc:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account"},Um={code:"multiple_matching_appMetadata",desc:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata"},jm={code:"request_cannot_be_made",desc:"Token request cannot be made without authorization code or refresh token."},Hm={code:"cannot_append_empty_scope",desc:"Cannot append null or empty scope to ScopeSet. Please check the stack trace for more info."},Bm={code:"cannot_remove_empty_scope",desc:"Cannot remove null or empty scope from ScopeSet. Please check the stack trace for more info."},Fm={code:"cannot_append_scopeset",desc:"Cannot append ScopeSet due to error."},zm={code:"empty_input_scopeset",desc:"Empty input ScopeSet cannot be processed."},Km={code:"device_code_polling_cancelled",desc:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true."},Gm={code:"device_code_expired",desc:"Device code is expired."},Ym={code:"device_code_unknown_error",desc:"Device code stopped polling for unknown reasons."},Wm={code:"no_account_in_silent_request",desc:"Please pass an account object, silent flow is not supported without account information"},Zm={code:"invalid_cache_record",desc:"Cache record object was null or undefined."},Qm={code:"invalid_cache_environment",desc:"Invalid environment when attempting to create cache entry"},Vm={code:"no_account_found",desc:"No account found in cache for given key."},Jm={code:"no cache plugin set on CacheManager",desc:"ICachePlugin needs to be set before using readFromStorage or writeFromStorage"},Xm={code:"no_crypto_object",desc:"No crypto object detected. This is required for the following operation: "},$m={code:"invalid_cache_type",desc:"Invalid cache type"},ey={code:"unexpected_account_type",desc:"Unexpected account type."},ty={code:"unexpected_credential_type",desc:"Unexpected credential type."},oy={code:"invalid_assertion",desc:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515"},ry={code:"invalid_client_credential",desc:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential"},ny={code:"token_refresh_required",desc:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired."},iy={code:"user_timeout_reached",desc:"User defined timeout for device code polling reached"},ay={code:"token_claims_cnf_required_for_signedjwt",desc:"Cannot generate a POP jwt if the token_claims are not populated"},sy={code:"authorization_code_missing_from_server_response",desc:"Server response does not contain an authorization code to proceed"},cy={code:"binding_key_not_removed",desc:"Could not remove the credential's binding key from storage."},uy={code:"end_session_endpoint_not_supported",desc:"Provided authority does not support logout."},ly={code:"key_id_missing",desc:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key."},hy={code:"no_network_connectivity",desc:"No network connectivity. Check your internet connection."},dy={code:"user_canceled",desc:"User canceled the flow."},I=(Ng(s,_m=T),s.createClientInfoDecodingError=function(e){return new s(bm.code,bm.desc+" Failed with error: "+e)},s.createClientInfoEmptyError=function(){return new s(Cm.code,""+Cm.desc)},s.createTokenParsingError=function(e){return new s(Em.code,Em.desc+" Failed with error: "+e)},s.createTokenNullOrEmptyError=function(e){return new s(Sm.code,Sm.desc+" Raw Token Value: "+e)},s.createEndpointDiscoveryIncompleteError=function(e){return new s(Tm.code,Tm.desc+" Detail: "+e)},s.createNetworkError=function(e,t){return new s(Im.code,Im.desc+" | Fetch client threw: "+t+" | Attempted to reach: "+e.split("?")[0])},s.createUnableToGetOpenidConfigError=function(e){return new s(km.code,km.desc+" Attempted to retrieve endpoints from: "+e)},s.createHashNotDeserializedError=function(e){return new s(Am.code,Am.desc+" Given Object: "+e)},s.createInvalidStateError=function(e,t){return new s(Pm.code,Pm.desc+" Invalid State: "+e+", Root Err: "+t)},s.createStateMismatchError=function(){return new s(Om.code,Om.desc)},s.createStateNotFoundError=function(e){return new s(Rm.code,Rm.desc+": "+e)},s.createNonceMismatchError=function(){return new s(xm.code,xm.desc)},s.createAuthTimeNotFoundError=function(){return new s(Nm.code,Nm.desc)},s.createMaxAgeTranspiredError=function(){return new s(Lm.code,Lm.desc)},s.createNonceNotFoundError=function(e){return new s(Mm.code,Mm.desc+": "+e)},s.createMultipleMatchingTokensInCacheError=function(){return new s(Dm.code,Dm.desc+".")},s.createMultipleMatchingAccountsInCacheError=function(){return new s(qm.code,qm.desc)},s.createMultipleMatchingAppMetadataInCacheError=function(){return new s(Um.code,Um.desc)},s.createTokenRequestCannotBeMadeError=function(){return new s(jm.code,jm.desc)},s.createAppendEmptyScopeToSetError=function(e){return new s(Hm.code,Hm.desc+" Given Scope: "+e)},s.createRemoveEmptyScopeFromSetError=function(e){return new s(Bm.code,Bm.desc+" Given Scope: "+e)},s.createAppendScopeSetError=function(e){return new s(Fm.code,Fm.desc+" Detail Error: "+e)},s.createEmptyInputScopeSetError=function(){return new s(zm.code,""+zm.desc)},s.createDeviceCodeCancelledError=function(){return new s(Km.code,""+Km.desc)},s.createDeviceCodeExpiredError=function(){return new s(Gm.code,""+Gm.desc)},s.createDeviceCodeUnknownError=function(){return new s(Ym.code,""+Ym.desc)},s.createNoAccountInSilentRequestError=function(){return new s(Wm.code,""+Wm.desc)},s.createNullOrUndefinedCacheRecord=function(){return new s(Zm.code,Zm.desc)},s.createInvalidCacheEnvironmentError=function(){return new s(Qm.code,Qm.desc)},s.createNoAccountFoundError=function(){return new s(Vm.code,Vm.desc)},s.createCachePluginError=function(){return new s(Jm.code,""+Jm.desc)},s.createNoCryptoObjectError=function(e){return new s(Xm.code,""+Xm.desc+e)},s.createInvalidCacheTypeError=function(){return new s($m.code,""+$m.desc)},s.createUnexpectedAccountTypeError=function(){return new s(ey.code,""+ey.desc)},s.createUnexpectedCredentialTypeError=function(){return new s(ty.code,""+ty.desc)},s.createInvalidAssertionError=function(){return new s(oy.code,""+oy.desc)},s.createInvalidCredentialError=function(){return new s(ry.code,""+ry.desc)},s.createRefreshRequiredError=function(){return new s(ny.code,ny.desc)},s.createUserTimeoutReachedError=function(){return new s(iy.code,iy.desc)},s.createTokenClaimsRequiredError=function(){return new s(ay.code,ay.desc)},s.createNoAuthCodeInServerResponseError=function(){return new s(sy.code,sy.desc)},s.createBindingKeyNotRemovedError=function(){return new s(cy.code,cy.desc)},s.createLogoutNotSupportedError=function(){return new s(uy.code,uy.desc)},s.createKeyIdMissingError=function(){return new s(ly.code,ly.desc)},s.createNoNetworkConnectivityError=function(){return new s(hy.code,hy.desc)},s.createUserCanceledError=function(){return new s(dy.code,dy.desc)},s);function s(e,t){e=_m.call(this,e,t)||this;return e.name="ClientAuthError",Object.setPrototypeOf(e,s.prototype),e}fy.decodeAuthToken=function(e){if(fy.isEmpty(e))throw I.createTokenNullOrEmptyError(e);var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(e);if(!t||t.length<4)throw I.createTokenParsingError("Given token is malformed: "+JSON.stringify(e));return{header:t[1],JWSPayload:t[2],JWSSig:t[3]}},fy.isEmpty=function(e){return void 0===e||!e||0===e.length},fy.isEmptyObj=function(e){if(e&&!fy.isEmpty(e))try{var t=JSON.parse(e);return 0===Object.keys(t).length}catch(e){}return!0},fy.startsWith=function(e,t){return 0===e.indexOf(t)},fy.endsWith=function(e,t){return e.length>=t.length&&e.lastIndexOf(t)===e.length-t.length},fy.queryStringToObject=function(e){function o(e){return decodeURIComponent(e.replace(/\+/g," "))}var r={},e=e.split("&");return e.forEach(function(e){var t;e.trim()&&(t=(e=e.split(/=(.+)/g,2))[0],e=e[1],t)&&e&&(r[o(t)]=o(e))}),r},fy.trimArrayEntries=function(e){return e.map(function(e){return e.trim()})},fy.removeEmptyStringsFromArray=function(e){return e.filter(function(e){return!fy.isEmpty(e)})},fy.jsonParseHelper=function(e){try{return JSON.parse(e)}catch(e){return null}},fy.matchPattern=function(e,t){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(t)};var py,k=fy;function fy(){}(Mi=py=py||{})[Mi.Error=0]="Error",Mi[Mi.Warning=1]="Warning",Mi[Mi.Info=2]="Info",Mi[Mi.Verbose=3]="Verbose",Mi[Mi.Trace=4]="Trace";my.createDefaultLoggerOptions=function(){return{loggerCallback:function(){},piiLoggingEnabled:!1,logLevel:py.Info}},my.prototype.clone=function(e,t,o){return new my({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:o||this.correlationId},e,t)},my.prototype.logMessage=function(e,t){var o;t.logLevel>this.level||!this.piiLoggingEnabled&&t.containsPii||(o=(new Date).toUTCString(),o=(k.isEmpty(t.correlationId)?k.isEmpty(this.correlationId)?"["+o+"]":"["+o+"] : ["+this.correlationId+"]":"["+o+"] : ["+t.correlationId+"]")+" : "+this.packageName+"@"+this.packageVersion+" : "+py[t.logLevel]+" - "+e,this.executeCallback(t.logLevel,o,t.containsPii||!1))},my.prototype.executeCallback=function(e,t,o){this.localCallback&&this.localCallback(e,t,o)},my.prototype.error=function(e,t){this.logMessage(e,{logLevel:py.Error,containsPii:!1,correlationId:t||S.EMPTY_STRING})},my.prototype.errorPii=function(e,t){this.logMessage(e,{logLevel:py.Error,containsPii:!0,correlationId:t||S.EMPTY_STRING})},my.prototype.warning=function(e,t){this.logMessage(e,{logLevel:py.Warning,containsPii:!1,correlationId:t||S.EMPTY_STRING})},my.prototype.warningPii=function(e,t){this.logMessage(e,{logLevel:py.Warning,containsPii:!0,correlationId:t||S.EMPTY_STRING})},my.prototype.info=function(e,t){this.logMessage(e,{logLevel:py.Info,containsPii:!1,correlationId:t||S.EMPTY_STRING})},my.prototype.infoPii=function(e,t){this.logMessage(e,{logLevel:py.Info,containsPii:!0,correlationId:t||S.EMPTY_STRING})},my.prototype.verbose=function(e,t){this.logMessage(e,{logLevel:py.Verbose,containsPii:!1,correlationId:t||S.EMPTY_STRING})},my.prototype.verbosePii=function(e,t){this.logMessage(e,{logLevel:py.Verbose,containsPii:!0,correlationId:t||S.EMPTY_STRING})},my.prototype.trace=function(e,t){this.logMessage(e,{logLevel:py.Trace,containsPii:!1,correlationId:t||S.EMPTY_STRING})},my.prototype.tracePii=function(e,t){this.logMessage(e,{logLevel:py.Trace,containsPii:!0,correlationId:t||S.EMPTY_STRING})},my.prototype.isPiiLoggingEnabled=function(){return this.piiLoggingEnabled||!1};var gy=my;function my(e,t,o){this.level=py.Info;e=e||my.createDefaultLoggerOptions();this.localCallback=e.loggerCallback||function(){},this.piiLoggingEnabled=e.piiLoggingEnabled||!1,this.level="number"==typeof e.logLevel?e.logLevel:py.Info,this.correlationId=e.correlationId||S.EMPTY_STRING,this.packageName=t||S.EMPTY_STRING,this.packageVersion=o||S.EMPTY_STRING}var yy,vy="@azure/msal-common",_y="13.3.1";(cn=yy=yy||{})[cn.None=0]="None",cn.AzurePublic="https://login.microsoftonline.com",cn.AzurePpe="https://login.windows-ppe.net",cn.AzureChina="https://login.chinacloudapi.cn",cn.AzureGermany="https://login.microsoftonline.de",cn.AzureUsGovernment="https://login.microsoftonline.us";var wy,by={code:"redirect_uri_empty",desc:"A redirect URI is required for all calls, and none has been set."},Cy={code:"post_logout_uri_empty",desc:"A post logout redirect has not been set."},Ey={code:"claims_request_parsing_error",desc:"Could not parse the given claims request object."},Sy={code:"authority_uri_insecure",desc:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options"},Ty={code:"url_parse_error",desc:"URL could not be parsed into appropriate segments."},Iy={code:"empty_url_error",desc:"URL was empty or null."},ky={code:"empty_input_scopes_error",desc:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token."},Ay={code:"clientid_input_scopes_error",desc:"Client ID can only be provided as a single scope."},Py={code:"invalid_prompt_value",desc:"Supported prompt values are 'login', 'select_account', 'consent', 'create', 'none' and 'no_session'. Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest"},Oy={code:"invalid_claims",desc:"Given claims parameter must be a stringified JSON object."},Ry={code:"token_request_empty",desc:"Token request was empty and not found in cache."},xy={code:"logout_request_empty",desc:"The logout request was null or undefined."},My={code:"invalid_code_challenge_method",desc:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".'},Ny={code:"pkce_params_missing",desc:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request"},Ly={code:"invalid_cloud_discovery_metadata",desc:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields"},Dy={code:"invalid_authority_metadata",desc:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields."},qy={code:"untrusted_authority",desc:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."},Uy={code:"invalid_azure_cloud_instance",desc:"Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values"},jy={code:"missing_ssh_jwk",desc:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme."},Hy={code:"missing_ssh_kid",desc:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme."},By={code:"missing_nonce_authentication_header",desc:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce."},Fy={code:"invalid_authentication_header",desc:"Invalid authentication header provided"},zy={code:"authority_mismatch",desc:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."},Ky=(Ng(c,wy=I),c.createRedirectUriEmptyError=function(){return new c(by.code,by.desc)},c.createPostLogoutRedirectUriEmptyError=function(){return new c(Cy.code,Cy.desc)},c.createClaimsRequestParsingError=function(e){return new c(Ey.code,Ey.desc+" Given value: "+e)},c.createInsecureAuthorityUriError=function(e){return new c(Sy.code,Sy.desc+" Given URI: "+e)},c.createUrlParseError=function(e){return new c(Ty.code,Ty.desc+" Given Error: "+e)},c.createUrlEmptyError=function(){return new c(Iy.code,Iy.desc)},c.createEmptyScopesArrayError=function(){return new c(ky.code,""+ky.desc)},c.createClientIdSingleScopeError=function(e){return new c(Ay.code,Ay.desc+" Given Scopes: "+e)},c.createInvalidPromptError=function(e){return new c(Py.code,Py.desc+" Given value: "+e)},c.createInvalidClaimsRequestError=function(){return new c(Oy.code,Oy.desc)},c.createEmptyLogoutRequestError=function(){return new c(xy.code,xy.desc)},c.createEmptyTokenRequestError=function(){return new c(Ry.code,Ry.desc)},c.createInvalidCodeChallengeMethodError=function(){return new c(My.code,My.desc)},c.createInvalidCodeChallengeParamsError=function(){return new c(Ny.code,Ny.desc)},c.createInvalidCloudDiscoveryMetadataError=function(){return new c(Ly.code,Ly.desc)},c.createInvalidAuthorityMetadataError=function(){return new c(Dy.code,Dy.desc)},c.createUntrustedAuthorityError=function(){return new c(qy.code,qy.desc)},c.createInvalidAzureCloudInstanceError=function(){return new c(Uy.code,Uy.desc)},c.createMissingSshJwkError=function(){return new c(jy.code,jy.desc)},c.createMissingSshKidError=function(){return new c(Hy.code,Hy.desc)},c.createMissingNonceAuthenticationHeadersError=function(){return new c(By.code,By.desc)},c.createInvalidAuthenticationHeaderError=function(e,t){return new c(Fy.code,Fy.desc+". Invalid header: "+e+". Details: "+t)},c.createAuthorityMismatchError=function(){return new c(zy.code,zy.desc)},c);function c(e,t){e=wy.call(this,e,t)||this;return e.name="ClientConfigurationError",Object.setPrototypeOf(e,c.prototype),e}Wy.fromString=function(e){return new Wy((e||S.EMPTY_STRING).split(" "))},Wy.createSearchScopes=function(e){e=new Wy(e);return e.containsOnlyOIDCScopes()?e.removeScope(S.OFFLINE_ACCESS_SCOPE):e.removeOIDCScopes(),e},Wy.prototype.validateInputScopes=function(e){if(!e||e.length<1)throw Ky.createEmptyScopesArrayError()},Wy.prototype.containsScope=function(e){var t=new Wy(this.printScopesLowerCase().split(" "));return!k.isEmpty(e)&&t.scopes.has(e.toLowerCase())},Wy.prototype.containsScopeSet=function(e){var t=this;return!(!e||e.scopes.size<=0)&&this.scopes.size>=e.scopes.size&&e.asArray().every(function(e){return t.containsScope(e)})},Wy.prototype.containsOnlyOIDCScopes=function(){var t=this,o=0;return Vg.forEach(function(e){t.containsScope(e)&&(o+=1)}),this.scopes.size===o},Wy.prototype.appendScope=function(e){k.isEmpty(e)||this.scopes.add(e.trim())},Wy.prototype.appendScopes=function(e){var t=this;try{e.forEach(function(e){return t.appendScope(e)})}catch(e){throw I.createAppendScopeSetError(e)}},Wy.prototype.removeScope=function(e){if(k.isEmpty(e))throw I.createRemoveEmptyScopeFromSetError(e);this.scopes.delete(e.trim())},Wy.prototype.removeOIDCScopes=function(){var t=this;Vg.forEach(function(e){t.scopes.delete(e)})},Wy.prototype.unionScopeSets=function(e){var t;if(e)return t=new Set,e.scopes.forEach(function(e){return t.add(e.toLowerCase())}),this.scopes.forEach(function(e){return t.add(e.toLowerCase())}),t;throw I.createEmptyInputScopeSetError()},Wy.prototype.intersectingScopeSets=function(e){if(!e)throw I.createEmptyInputScopeSetError();e.containsOnlyOIDCScopes()||e.removeOIDCScopes();var t=this.unionScopeSets(e),e=e.getScopeCount(),o=this.getScopeCount();return t.size<o+e},Wy.prototype.getScopeCount=function(){return this.scopes.size},Wy.prototype.asArray=function(){var t=[];return this.scopes.forEach(function(e){return t.push(e)}),t},Wy.prototype.printScopes=function(){return this.scopes?this.asArray().join(" "):S.EMPTY_STRING},Wy.prototype.printScopesLowerCase=function(){return this.printScopes().toLowerCase()};var Gy,Yy=Wy;function Wy(e){var t=this,e=e?k.trimArrayEntries(Dg(e)):[],e=e?k.removeEmptyStringsFromArray(e):[];this.validateInputScopes(e),this.scopes=new Set,e.forEach(function(e){return t.scopes.add(e)})}function Zy(e,t){if(k.isEmpty(e))throw I.createClientInfoEmptyError();try{var o=t.base64Decode(e);return JSON.parse(o)}catch(e){throw I.createClientInfoDecodingError(e.message)}}function Qy(e){if(k.isEmpty(e))throw I.createClientInfoDecodingError("Home account ID was empty.");e=e.split(Gg.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?S.EMPTY_STRING:e[1]}}(o=Gy=Gy||{})[o.Default=0]="Default",o[o.Adfs=1]="Adfs",o[o.Dsts=2]="Dsts",o[o.Ciam=3]="Ciam";Jy.prototype.generateAccountId=function(){return[this.homeAccountId,this.environment].join(Gg.CACHE_KEY_SEPARATOR).toLowerCase()},Jy.prototype.generateAccountKey=function(){return Jy.generateAccountCacheKey({homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId})},Jy.prototype.generateType=function(){switch(this.authorityType){case Kg.ADFS_ACCOUNT_TYPE:return Yg.ADFS;case Kg.MSAV1_ACCOUNT_TYPE:return Yg.MSA;case Kg.MSSTS_ACCOUNT_TYPE:return Yg.MSSTS;case Kg.GENERIC_ACCOUNT_TYPE:return Yg.GENERIC;default:throw I.createUnexpectedAccountTypeError()}},Jy.prototype.getAccountInfo=function(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,name:this.name,idTokenClaims:this.idTokenClaims,nativeAccountId:this.nativeAccountId}},Jy.generateAccountCacheKey=function(e){return[e.homeAccountId,e.environment||S.EMPTY_STRING,e.tenantId||S.EMPTY_STRING].join(Gg.CACHE_KEY_SEPARATOR).toLowerCase()},Jy.createAccount=function(e,t,o,r,n,i,a,s){var c=new Jy,e=(c.authorityType=Kg.MSSTS_ACCOUNT_TYPE,c.clientInfo=e,c.homeAccountId=t,c.nativeAccountId=s,a||r&&r.getPreferredCache());if(e)return c.environment=e,c.realm=(null==(t=null==o?void 0:o.claims)?void 0:t.tid)||S.EMPTY_STRING,o&&(c.idTokenClaims=o.claims,c.localAccountId=(null==(s=null==o?void 0:o.claims)?void 0:s.oid)||(null==(a=null==o?void 0:o.claims)?void 0:a.sub)||S.EMPTY_STRING,e=null==(r=null==o?void 0:o.claims)?void 0:r.preferred_username,s=null!=(t=null==o?void 0:o.claims)&&t.emails?o.claims.emails[0]:null,c.username=e||s||S.EMPTY_STRING,c.name=null==(a=null==o?void 0:o.claims)?void 0:a.name),c.cloudGraphHostName=n,c.msGraphHost=i,c;throw I.createInvalidCacheEnvironmentError()},Jy.createGenericAccount=function(e,t,o,r,n,i){var a=new Jy,e=(a.authorityType=o&&o.authorityType===Gy.Adfs?Kg.ADFS_ACCOUNT_TYPE:Kg.GENERIC_ACCOUNT_TYPE,a.homeAccountId=e,a.realm=S.EMPTY_STRING,i||o&&o.getPreferredCache());if(e)return t&&(a.localAccountId=(null==(i=null==t?void 0:t.claims)?void 0:i.oid)||(null==(o=null==t?void 0:t.claims)?void 0:o.sub)||S.EMPTY_STRING,a.username=(null==(i=null==t?void 0:t.claims)?void 0:i.upn)||S.EMPTY_STRING,a.name=(null==(o=null==t?void 0:t.claims)?void 0:o.name)||S.EMPTY_STRING,a.idTokenClaims=null==t?void 0:t.claims),a.environment=e,a.cloudGraphHostName=r,a.msGraphHost=n,a;throw I.createInvalidCacheEnvironmentError()},Jy.generateHomeAccountId=function(e,t,o,r,n){var i=null!=(i=null==n?void 0:n.claims)&&i.sub?n.claims.sub:S.EMPTY_STRING;if(t!==Gy.Adfs&&t!==Gy.Dsts){if(e)try{var a=Zy(e,r);if(!k.isEmpty(a.uid)&&!k.isEmpty(a.utid))return""+a.uid+Gg.CLIENT_INFO_SEPARATOR+a.utid}catch(e){}o.verbose("No client info in response")}return i},Jy.isAccountEntity=function(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType")},Jy.accountInfoIsEqual=function(e,t,o){var r,n;return!(!e||!t)&&(n=!0,o&&(o=e.idTokenClaims||{},r=t.idTokenClaims||{},n=o.iat===r.iat&&o.nonce===r.nonce),e.homeAccountId===t.homeAccountId)&&e.localAccountId===t.localAccountId&&e.username===t.username&&e.tenantId===t.tenantId&&e.environment===t.environment&&e.nativeAccountId===t.nativeAccountId&&n};var Vy=Jy;function Jy(){}$y.extractTokenClaims=function(e,t){e=k.decodeAuthToken(e);try{var o=e.JWSPayload,r=t.base64Decode(o);return JSON.parse(r)}catch(e){throw I.createTokenParsingError(e)}},$y.checkMaxAge=function(e,t){if(0===t||Date.now()-3e5>e+t)throw I.createMaxAgeTranspiredError()};var Xy=$y;function $y(e,t){if(k.isEmpty(e))throw I.createTokenNullOrEmptyError(e);this.rawToken=e,this.claims=$y.extractTokenClaims(e,t)}h.prototype.getAllAccounts=function(){var o=this,e=this.getAccountKeys();return e.length<1||(e=e.reduce(function(e,t){t=o.getAccount(t);return t&&e.push(t),e},[])).length<1?[]:e.map(function(e){return o.getAccountInfoFromEntity(e)})},h.prototype.getAccountInfoFilteredBy=function(e){e=this.getAccountsFilteredBy(e);return 0<e.length?this.getAccountInfoFromEntity(e[0]):null},h.prototype.getAccountInfoFromEntity=function(e){var e=e.getAccountInfo(),t=this.getIdToken(e);return t&&(e.idToken=t.secret,e.idTokenClaims=new Xy(t.secret,this.cryptoImpl).claims),e},h.prototype.saveCacheRecord=function(t){return b(this,void 0,void 0,function(){return C(this,function(e){switch(e.label){case 0:if(t)return t.account&&this.setAccount(t.account),t.idToken&&this.setIdTokenCredential(t.idToken),t.accessToken?[4,this.saveAccessToken(t.accessToken)]:[3,2];throw I.createNullOrUndefinedCacheRecord();case 1:e.sent(),e.label=2;case 2:return t.refreshToken&&this.setRefreshTokenCredential(t.refreshToken),t.appMetadata&&this.setAppMetadata(t.appMetadata),[2]}})})},h.prototype.saveAccessToken=function(a){return b(this,void 0,void 0,function(){var o,t,r,n,i=this;return C(this,function(e){switch(e.label){case 0:return o={clientId:a.clientId,credentialType:a.credentialType,environment:a.environment,homeAccountId:a.homeAccountId,realm:a.realm,tokenType:a.tokenType,requestedClaimsHash:a.requestedClaimsHash},t=this.getTokenKeys(),r=Yy.fromString(a.target),n=[],t.accessToken.forEach(function(e){var t;i.accessTokenKeyMatchesFilter(e,o,!1)&&(t=i.getAccessTokenCredential(e))&&i.credentialMatchesFilter(t,o)&&Yy.fromString(t.target).intersectingScopeSets(r)&&n.push(i.removeAccessToken(e))}),[4,Promise.all(n)];case 1:return e.sent(),this.setAccessTokenCredential(a),[2]}})})},h.prototype.getAccountsFilteredBy=function(t){var o=this,e=this.getAccountKeys(),r=[];return e.forEach(function(e){!o.isAccountKey(e,t.homeAccountId,t.realm)||!(e=o.getAccount(e))||t.homeAccountId&&!o.matchHomeAccountId(e,t.homeAccountId)||t.localAccountId&&!o.matchLocalAccountId(e,t.localAccountId)||t.username&&!o.matchUsername(e,t.username)||t.environment&&!o.matchEnvironment(e,t.environment)||t.realm&&!o.matchRealm(e,t.realm)||t.nativeAccountId&&!o.matchNativeAccountId(e,t.nativeAccountId)||r.push(e)}),r},h.prototype.isAccountKey=function(e,t,o){return!(e.split(Gg.CACHE_KEY_SEPARATOR).length<3||t&&!e.toLowerCase().includes(t.toLowerCase())||o&&!e.toLowerCase().includes(o.toLowerCase()))},h.prototype.isCredentialKey=function(e){if(e.split(Gg.CACHE_KEY_SEPARATOR).length<6)return!1;e=e.toLowerCase();if(-1===e.indexOf(E.ID_TOKEN.toLowerCase())&&-1===e.indexOf(E.ACCESS_TOKEN.toLowerCase())&&-1===e.indexOf(E.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())&&-1===e.indexOf(E.REFRESH_TOKEN.toLowerCase()))return!1;if(-1<e.indexOf(E.REFRESH_TOKEN.toLowerCase())){var t=""+E.REFRESH_TOKEN+Gg.CACHE_KEY_SEPARATOR+this.clientId+Gg.CACHE_KEY_SEPARATOR,o=""+E.REFRESH_TOKEN+Gg.CACHE_KEY_SEPARATOR+"1"+Gg.CACHE_KEY_SEPARATOR;if(-1===e.indexOf(t.toLowerCase())&&-1===e.indexOf(o.toLowerCase()))return!1}else if(-1===e.indexOf(this.clientId.toLowerCase()))return!1;return!0},h.prototype.credentialMatchesFilter=function(e,t){if(t.clientId&&!this.matchClientId(e,t.clientId))return!1;if(t.userAssertionHash&&!this.matchUserAssertionHash(e,t.userAssertionHash))return!1;if("string"==typeof t.homeAccountId&&!this.matchHomeAccountId(e,t.homeAccountId))return!1;if(t.environment&&!this.matchEnvironment(e,t.environment))return!1;if(t.realm&&!this.matchRealm(e,t.realm))return!1;if(t.credentialType&&!this.matchCredentialType(e,t.credentialType))return!1;if(t.familyId&&!this.matchFamilyId(e,t.familyId))return!1;if(t.target&&!this.matchTarget(e,t.target))return!1;if((t.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==t.requestedClaimsHash)return!1;if(e.credentialType===E.ACCESS_TOKEN_WITH_AUTH_SCHEME){if(t.tokenType&&!this.matchTokenType(e,t.tokenType))return!1;if(t.tokenType===Zg.SSH&&t.keyId&&!this.matchKeyId(e,t.keyId))return!1}return!0},h.prototype.getAppMetadataFilteredBy=function(e){return this.getAppMetadataFilteredByInternal(e.environment,e.clientId)},h.prototype.getAppMetadataFilteredByInternal=function(o,r){var n=this,e=this.getKeys(),i={};return e.forEach(function(e){var t;!n.isAppMetadata(e)||!(t=n.getAppMetadata(e))||o&&!n.matchEnvironment(t,o)||r&&!n.matchClientId(t,r)||(i[e]=t)}),i},h.prototype.getAuthorityMetadataByAlias=function(t){var o=this,e=this.getAuthorityMetadataKeys(),r=null;return e.forEach(function(e){o.isAuthorityMetadata(e)&&-1!==e.indexOf(o.clientId)&&(e=o.getAuthorityMetadata(e))&&-1!==e.aliases.indexOf(t)&&(r=e)}),r},h.prototype.removeAllAccounts=function(){return b(this,void 0,void 0,function(){var t,o,r=this;return C(this,function(e){switch(e.label){case 0:return t=this.getAccountKeys(),o=[],t.forEach(function(e){o.push(r.removeAccount(e))}),[4,Promise.all(o)];case 1:return e.sent(),[2]}})})},h.prototype.removeAccount=function(o){return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:if(t=this.getAccount(o))return[4,this.removeAccountContext(t)];throw I.createNoAccountFoundError();case 1:return e.sent(),this.removeItem(o),[2]}})})},h.prototype.removeAccountContext=function(i){return b(this,void 0,void 0,function(){var t,o,r,n=this;return C(this,function(e){switch(e.label){case 0:return t=this.getTokenKeys(),o=i.generateAccountId(),r=[],t.idToken.forEach(function(e){0===e.indexOf(o)&&n.removeIdToken(e)}),t.accessToken.forEach(function(e){0===e.indexOf(o)&&r.push(n.removeAccessToken(e))}),t.refreshToken.forEach(function(e){0===e.indexOf(o)&&n.removeRefreshToken(e)}),[4,Promise.all(r)];case 1:return e.sent(),[2]}})})},h.prototype.removeAccessToken=function(o){return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:if(!(t=this.getAccessTokenCredential(o)))return[2];if(t.credentialType.toLowerCase()!==E.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())return[3,4];if(t.tokenType!==Zg.POP)return[3,4];if(!(t=t.keyId))return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.cryptoImpl.removeTokenBindingKey(t)];case 2:return e.sent(),[3,4];case 3:throw e.sent(),I.createBindingKeyNotRemovedError();case 4:return[2,this.removeItem(o)]}})})},h.prototype.removeAppMetadata=function(){var t=this;return this.getKeys().forEach(function(e){t.isAppMetadata(e)&&t.removeItem(e)}),!0},h.prototype.readCacheRecord=function(e,t,o){var r=this.getTokenKeys(),n=this.readAccountFromCache(e),i=this.getIdToken(e,r),t=this.getAccessToken(e,t,r),e=this.getRefreshToken(e,!1,r),r=this.readAppMetadataFromCache(o);return n&&i&&(n.idTokenClaims=new Xy(i.secret,this.cryptoImpl).claims),{account:n,idToken:i,accessToken:t,refreshToken:e,appMetadata:r}},h.prototype.readAccountFromCache=function(e){e=Vy.generateAccountCacheKey(e);return this.getAccount(e)},h.prototype.getIdToken=function(e,t){var o=this,e=(this.commonLogger.trace("CacheManager - getIdToken called"),{homeAccountId:e.homeAccountId,environment:e.environment,credentialType:E.ID_TOKEN,clientId:this.clientId,realm:e.tenantId}),e=this.getIdTokensByFilter(e,t),t=e.length;return t<1?(this.commonLogger.info("CacheManager:getIdToken - No token found"),null):1<t?(this.commonLogger.info("CacheManager:getIdToken - Multiple id tokens found, clearing them"),e.forEach(function(e){o.removeIdToken(e.generateCredentialKey())}),null):(this.commonLogger.info("CacheManager:getIdToken - Returning id token"),e[0])},h.prototype.getIdTokensByFilter=function(t,e){var o=this,e=e&&e.idToken||this.getTokenKeys().idToken,r=[];return e.forEach(function(e){o.idTokenKeyMatchesFilter(e,Lg({clientId:o.clientId},t))&&(e=o.getIdTokenCredential(e))&&o.credentialMatchesFilter(e,t)&&r.push(e)}),r},h.prototype.idTokenKeyMatchesFilter=function(e,t){e=e.toLowerCase();return!(t.clientId&&-1===e.indexOf(t.clientId.toLowerCase())||t.homeAccountId&&-1===e.indexOf(t.homeAccountId.toLowerCase()))},h.prototype.removeIdToken=function(e){this.removeItem(e)},h.prototype.removeRefreshToken=function(e){this.removeItem(e)},h.prototype.getAccessToken=function(e,t,o){var r=this,n=(this.commonLogger.trace("CacheManager - getAccessToken called"),Yy.createSearchScopes(t.scopes)),i=t.authenticationScheme||Zg.BEARER,a=i&&i.toLowerCase()!==Zg.BEARER.toLowerCase()?E.ACCESS_TOKEN_WITH_AUTH_SCHEME:E.ACCESS_TOKEN,s={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:a,clientId:this.clientId,realm:e.tenantId,target:n,tokenType:i,keyId:t.sshKid,requestedClaimsHash:t.requestedClaimsHash},a=o&&o.accessToken||this.getTokenKeys().accessToken,c=[],e=(a.forEach(function(e){r.accessTokenKeyMatchesFilter(e,s,!0)&&(e=r.getAccessTokenCredential(e))&&r.credentialMatchesFilter(e,s)&&c.push(e)}),c.length);return e<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found"),null):1<e?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them"),c.forEach(function(e){r.removeAccessToken(e.generateCredentialKey())}),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token"),c[0])},h.prototype.accessTokenKeyMatchesFilter=function(e,t,o){var r=e.toLowerCase();if(t.clientId&&-1===r.indexOf(t.clientId.toLowerCase()))return!1;if(t.homeAccountId&&-1===r.indexOf(t.homeAccountId.toLowerCase()))return!1;if(t.realm&&-1===r.indexOf(t.realm.toLowerCase()))return!1;if(t.requestedClaimsHash&&-1===r.indexOf(t.requestedClaimsHash.toLowerCase()))return!1;if(t.target)for(var n=t.target.asArray(),i=0;i<n.length;i++){if(o&&!r.includes(n[i].toLowerCase()))return!1;if(!o&&r.includes(n[i].toLowerCase()))return!0}return!0},h.prototype.getAccessTokensByFilter=function(t){var o=this,e=this.getTokenKeys(),r=[];return e.accessToken.forEach(function(e){o.accessTokenKeyMatchesFilter(e,t,!0)&&(e=o.getAccessTokenCredential(e))&&o.credentialMatchesFilter(e,t)&&r.push(e)}),r},h.prototype.getRefreshToken=function(e,t,o){var r=this,t=(this.commonLogger.trace("CacheManager - getRefreshToken called"),t?"1":void 0),n={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:E.REFRESH_TOKEN,clientId:this.clientId,familyId:t},e=o&&o.refreshToken||this.getTokenKeys().refreshToken,i=[];return e.forEach(function(e){r.refreshTokenKeyMatchesFilter(e,n)&&(e=r.getRefreshTokenCredential(e))&&r.credentialMatchesFilter(e,n)&&i.push(e)}),i.length<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),i[0])},h.prototype.refreshTokenKeyMatchesFilter=function(e,t){e=e.toLowerCase();return!(t.familyId&&-1===e.indexOf(t.familyId.toLowerCase())||!t.familyId&&t.clientId&&-1===e.indexOf(t.clientId.toLowerCase())||t.homeAccountId&&-1===e.indexOf(t.homeAccountId.toLowerCase()))},h.prototype.readAppMetadataFromCache=function(e){var e={environment:e,clientId:this.clientId},t=this.getAppMetadataFilteredBy(e),e=Object.keys(t).map(function(e){return t[e]}),o=e.length;if(o<1)return null;if(1<o)throw I.createMultipleMatchingAppMetadataInCacheError();return e[0]},h.prototype.isAppMetadataFOCI=function(e){e=this.readAppMetadataFromCache(e);return!(!e||"1"!==e.familyId)},h.prototype.matchHomeAccountId=function(e,t){return!("string"!=typeof e.homeAccountId||t!==e.homeAccountId)},h.prototype.matchLocalAccountId=function(e,t){return!("string"!=typeof e.localAccountId||t!==e.localAccountId)},h.prototype.matchUsername=function(e,t){return!("string"!=typeof e.username||t.toLowerCase()!==e.username.toLowerCase())},h.prototype.matchUserAssertionHash=function(e,t){return!(!e.userAssertionHash||t!==e.userAssertionHash)},h.prototype.matchEnvironment=function(e,t){t=this.getAuthorityMetadataByAlias(t);return!!(t&&-1<t.aliases.indexOf(e.environment))},h.prototype.matchCredentialType=function(e,t){return e.credentialType&&t.toLowerCase()===e.credentialType.toLowerCase()},h.prototype.matchClientId=function(e,t){return!(!e.clientId||t!==e.clientId)},h.prototype.matchFamilyId=function(e,t){return!(!e.familyId||t!==e.familyId)},h.prototype.matchRealm=function(e,t){return!(!e.realm||t!==e.realm)},h.prototype.matchNativeAccountId=function(e,t){return!(!e.nativeAccountId||t!==e.nativeAccountId)},h.prototype.matchTarget=function(e,t){return!(e.credentialType!==E.ACCESS_TOKEN&&e.credentialType!==E.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target)&&Yy.fromString(e.target).containsScopeSet(t)},h.prototype.matchTokenType=function(e,t){return!(!e.tokenType||e.tokenType!==t)},h.prototype.matchKeyId=function(e,t){return!(!e.keyId||e.keyId!==t)},h.prototype.isAppMetadata=function(e){return-1!==e.indexOf($g)},h.prototype.isAuthorityMetadata=function(e){return-1!==e.indexOf(em)},h.prototype.generateAuthorityMetadataCacheKey=function(e){return em+"-"+this.clientId+"-"+e},h.toObject=function(e,t){for(var o in t)e[o]=t[o];return e};var ev=h;function h(e,t,o){this.clientId=e,this.cryptoImpl=t,this.commonLogger=o.clone(vy,_y)}Ng(rv,tv=ev),rv.prototype.setAccount=function(){throw T.createUnexpectedError("Storage interface - setAccount() has not been implemented for the cacheStorage interface.")},rv.prototype.getAccount=function(){throw T.createUnexpectedError("Storage interface - getAccount() has not been implemented for the cacheStorage interface.")},rv.prototype.setIdTokenCredential=function(){throw T.createUnexpectedError("Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.")},rv.prototype.getIdTokenCredential=function(){throw T.createUnexpectedError("Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.")},rv.prototype.setAccessTokenCredential=function(){throw T.createUnexpectedError("Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.")},rv.prototype.getAccessTokenCredential=function(){throw T.createUnexpectedError("Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.")},rv.prototype.setRefreshTokenCredential=function(){throw T.createUnexpectedError("Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.")},rv.prototype.getRefreshTokenCredential=function(){throw T.createUnexpectedError("Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.")},rv.prototype.setAppMetadata=function(){throw T.createUnexpectedError("Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.")},rv.prototype.getAppMetadata=function(){throw T.createUnexpectedError("Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.")},rv.prototype.setServerTelemetry=function(){throw T.createUnexpectedError("Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.")},rv.prototype.getServerTelemetry=function(){throw T.createUnexpectedError("Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.")},rv.prototype.setAuthorityMetadata=function(){throw T.createUnexpectedError("Storage interface - setAuthorityMetadata() has not been implemented for the cacheStorage interface.")},rv.prototype.getAuthorityMetadata=function(){throw T.createUnexpectedError("Storage interface - getAuthorityMetadata() has not been implemented for the cacheStorage interface.")},rv.prototype.getAuthorityMetadataKeys=function(){throw T.createUnexpectedError("Storage interface - getAuthorityMetadataKeys() has not been implemented for the cacheStorage interface.")},rv.prototype.setThrottlingCache=function(){throw T.createUnexpectedError("Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.")},rv.prototype.getThrottlingCache=function(){throw T.createUnexpectedError("Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.")},rv.prototype.removeItem=function(){throw T.createUnexpectedError("Storage interface - removeItem() has not been implemented for the cacheStorage interface.")},rv.prototype.containsKey=function(){throw T.createUnexpectedError("Storage interface - containsKey() has not been implemented for the cacheStorage interface.")},rv.prototype.getKeys=function(){throw T.createUnexpectedError("Storage interface - getKeys() has not been implemented for the cacheStorage interface.")},rv.prototype.getAccountKeys=function(){throw T.createUnexpectedError("Storage interface - getAccountKeys() has not been implemented for the cacheStorage interface.")},rv.prototype.getTokenKeys=function(){throw T.createUnexpectedError("Storage interface - getTokenKeys() has not been implemented for the cacheStorage interface.")},rv.prototype.clear=function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Storage interface - clear() has not been implemented for the cacheStorage interface.")})})},rv.prototype.updateCredentialCacheKey=function(){throw T.createUnexpectedError("Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.")};var tv,ov=rv;function rv(){return null!==tv&&tv.apply(this,arguments)||this}var nv={tokenRenewalOffsetSeconds:300,preventCorsPreflight:!1},iv={loggerCallback:function(){},piiLoggingEnabled:!1,logLevel:py.Info,correlationId:S.EMPTY_STRING},av={claimsBasedCachingEnabled:!0},sv={sendGetRequestAsync:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Network interface - sendGetRequestAsync() has not been implemented")})})},sendPostRequestAsync:function(){return b(this,void 0,void 0,function(){return C(this,function(e){throw T.createUnexpectedError("Network interface - sendPostRequestAsync() has not been implemented")})})}},cv={sku:S.SKU,version:_y,cpu:S.EMPTY_STRING,os:S.EMPTY_STRING},uv={clientSecret:S.EMPTY_STRING,clientAssertion:void 0},lv={azureCloudInstance:yy.None,tenant:""+S.DEFAULT_COMMON_TENANT},hv={application:{appName:"",appVersion:""}};function dv(e){var t=e.authOptions,o=e.systemOptions,r=e.loggerOptions,n=e.cacheOptions,i=e.storageInterface,a=e.networkInterface,s=e.cryptoInterface,c=e.clientCredentials,u=e.libraryInfo,l=e.telemetry,h=e.serverTelemetryManager,d=e.persistencePlugin,e=e.serializableCache,r=Lg(Lg({},iv),r);return{authOptions:Lg({clientCapabilities:[],azureCloudOptions:lv,skipAuthorityMetadataCache:!1},t),systemOptions:Lg(Lg({},nv),o),loggerOptions:r,cacheOptions:Lg(Lg({},av),n),storageInterface:i||new ov(t.clientId,wm,new gy(r)),networkInterface:a||sv,cryptoInterface:s||wm,clientCredentials:c||uv,libraryInfo:Lg(Lg({},cv),u),telemetry:Lg(Lg({},hv),l),serverTelemetryManager:h||null,persistencePlugin:d||null,serializableCache:e||null}}Ng(gv,pv=T);var pv,fv=gv;function gv(e,t,o){e=pv.call(this,e,t,o)||this;return e.name="ServerError",Object.setPrototypeOf(e,gv.prototype),e}yv.generateThrottlingStorageKey=function(e){return hm+"."+JSON.stringify(e)},yv.preProcess=function(e,t){var o,t=yv.generateThrottlingStorageKey(t),r=e.getThrottlingCache(t);if(r){if(!(r.throttleTime<Date.now()))throw new fv((null==(o=r.errorCodes)?void 0:o.join(" "))||S.EMPTY_STRING,r.errorMessage,r.subError);e.removeItem(t)}},yv.postProcess=function(e,t,o){(yv.checkResponseStatus(o)||yv.checkResponseForRetryAfter(o))&&(o={throttleTime:yv.calculateThrottleTime(parseInt(o.headers[qg.RETRY_AFTER])),error:o.body.error,errorCodes:o.body.error_codes,errorMessage:o.body.error_description,subError:o.body.suberror},e.setThrottlingCache(yv.generateThrottlingStorageKey(t),o))},yv.checkResponseStatus=function(e){return 429===e.status||500<=e.status&&e.status<600},yv.checkResponseForRetryAfter=function(e){return!!e.headers&&e.headers.hasOwnProperty(qg.RETRY_AFTER)&&(e.status<200||300<=e.status)},yv.calculateThrottleTime=function(e){var e=e<=0?0:e,t=Date.now()/1e3;return Math.floor(1e3*Math.min(t+(e||um),t+lm))},yv.removeThrottle=function(e,t,o,r){t={clientId:t,authority:o.authority,scopes:o.scopes,homeAccountIdentifier:r,claims:o.claims,authenticationScheme:o.authenticationScheme,resourceRequestMethod:o.resourceRequestMethod,resourceRequestUri:o.resourceRequestUri,shrClaims:o.shrClaims,sshKid:o.sshKid},r=this.generateThrottlingStorageKey(t);e.removeItem(r)};var mv=yv;function yv(){}wv.prototype.sendPostRequest=function(r,n,i){return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:mv.preProcess(this.cacheManager,r),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkClient.sendPostRequestAsync(n,i)];case 2:return t=e.sent(),[3,4];case 3:throw(o=e.sent())instanceof T?o:I.createNetworkError(n,o);case 4:return mv.postProcess(this.cacheManager,r,t),[2,t]}})})};var vv,_v=wv;function wv(e,t){this.networkClient=e,this.cacheManager=t}(un=vv=vv||{}).HOME_ACCOUNT_ID="home_account_id",un.UPN="UPN";Cv.validateRedirectUri=function(e){if(k.isEmpty(e))throw Ky.createRedirectUriEmptyError()},Cv.validatePrompt=function(e){var t,o=[];for(t in Jg)o.push(Jg[t]);if(o.indexOf(e)<0)throw Ky.createInvalidPromptError(e)},Cv.validateClaims=function(e){try{JSON.parse(e)}catch(e){throw Ky.createInvalidClaimsRequestError()}},Cv.validateCodeChallengeParams=function(e,t){if(k.isEmpty(e)||k.isEmpty(t))throw Ky.createInvalidCodeChallengeParamsError();this.validateCodeChallengeMethod(t)},Cv.validateCodeChallengeMethod=function(e){if([Xg.PLAIN,Xg.S256].indexOf(e)<0)throw Ky.createInvalidCodeChallengeMethodError()},Cv.sanitizeEQParams=function(o,e){return o?(e.forEach(function(e,t){o[t]&&delete o[t]}),Object.fromEntries(Object.entries(o).filter(function(e){return""!==e[1]}))):{}};var bv=Cv;function Cv(){}d.prototype.addResponseTypeCode=function(){this.parameters.set(u.RESPONSE_TYPE,encodeURIComponent(S.CODE_RESPONSE_TYPE))},d.prototype.addResponseTypeForTokenAndIdToken=function(){this.parameters.set(u.RESPONSE_TYPE,encodeURIComponent(S.TOKEN_RESPONSE_TYPE+" "+S.ID_TOKEN_RESPONSE_TYPE))},d.prototype.addResponseMode=function(e){this.parameters.set(u.RESPONSE_MODE,encodeURIComponent(e||Fg.QUERY))},d.prototype.addNativeBroker=function(){this.parameters.set(u.NATIVE_BROKER,encodeURIComponent("1"))},d.prototype.addScopes=function(e,t){t=(t=void 0===t?!0:t)?Dg(e||[],Qg):e||[],e=new Yy(t);this.parameters.set(u.SCOPE,encodeURIComponent(e.printScopes()))},d.prototype.addClientId=function(e){this.parameters.set(u.CLIENT_ID,encodeURIComponent(e))},d.prototype.addRedirectUri=function(e){bv.validateRedirectUri(e),this.parameters.set(u.REDIRECT_URI,encodeURIComponent(e))},d.prototype.addPostLogoutRedirectUri=function(e){bv.validateRedirectUri(e),this.parameters.set(u.POST_LOGOUT_URI,encodeURIComponent(e))},d.prototype.addIdTokenHint=function(e){this.parameters.set(u.ID_TOKEN_HINT,encodeURIComponent(e))},d.prototype.addDomainHint=function(e){this.parameters.set(Bg.DOMAIN_HINT,encodeURIComponent(e))},d.prototype.addLoginHint=function(e){this.parameters.set(Bg.LOGIN_HINT,encodeURIComponent(e))},d.prototype.addCcsUpn=function(e){this.parameters.set(qg.CCS_HEADER,encodeURIComponent("UPN:"+e))},d.prototype.addCcsOid=function(e){this.parameters.set(qg.CCS_HEADER,encodeURIComponent("Oid:"+e.uid+"@"+e.utid))},d.prototype.addSid=function(e){this.parameters.set(Bg.SID,encodeURIComponent(e))},d.prototype.addClaims=function(e,t){e=this.addClientCapabilitiesToClaims(e,t);bv.validateClaims(e),this.parameters.set(u.CLAIMS,encodeURIComponent(e))},d.prototype.addCorrelationId=function(e){this.parameters.set(u.CLIENT_REQUEST_ID,encodeURIComponent(e))},d.prototype.addLibraryInfo=function(e){this.parameters.set(u.X_CLIENT_SKU,e.sku),this.parameters.set(u.X_CLIENT_VER,e.version),e.os&&this.parameters.set(u.X_CLIENT_OS,e.os),e.cpu&&this.parameters.set(u.X_CLIENT_CPU,e.cpu)},d.prototype.addApplicationTelemetry=function(e){null!=e&&e.appName&&this.parameters.set(u.X_APP_NAME,e.appName),null!=e&&e.appVersion&&this.parameters.set(u.X_APP_VER,e.appVersion)},d.prototype.addPrompt=function(e){bv.validatePrompt(e),this.parameters.set(""+u.PROMPT,encodeURIComponent(e))},d.prototype.addState=function(e){k.isEmpty(e)||this.parameters.set(u.STATE,encodeURIComponent(e))},d.prototype.addNonce=function(e){this.parameters.set(u.NONCE,encodeURIComponent(e))},d.prototype.addCodeChallengeParams=function(e,t){if(bv.validateCodeChallengeParams(e,t),!e||!t)throw Ky.createInvalidCodeChallengeParamsError();this.parameters.set(u.CODE_CHALLENGE,encodeURIComponent(e)),this.parameters.set(u.CODE_CHALLENGE_METHOD,encodeURIComponent(t))},d.prototype.addAuthorizationCode=function(e){this.parameters.set(u.CODE,encodeURIComponent(e))},d.prototype.addDeviceCode=function(e){this.parameters.set(u.DEVICE_CODE,encodeURIComponent(e))},d.prototype.addRefreshToken=function(e){this.parameters.set(u.REFRESH_TOKEN,encodeURIComponent(e))},d.prototype.addCodeVerifier=function(e){this.parameters.set(u.CODE_VERIFIER,encodeURIComponent(e))},d.prototype.addClientSecret=function(e){this.parameters.set(u.CLIENT_SECRET,encodeURIComponent(e))},d.prototype.addClientAssertion=function(e){k.isEmpty(e)||this.parameters.set(u.CLIENT_ASSERTION,encodeURIComponent(e))},d.prototype.addClientAssertionType=function(e){k.isEmpty(e)||this.parameters.set(u.CLIENT_ASSERTION_TYPE,encodeURIComponent(e))},d.prototype.addOboAssertion=function(e){this.parameters.set(u.OBO_ASSERTION,encodeURIComponent(e))},d.prototype.addRequestTokenUse=function(e){this.parameters.set(u.REQUESTED_TOKEN_USE,encodeURIComponent(e))},d.prototype.addGrantType=function(e){this.parameters.set(u.GRANT_TYPE,encodeURIComponent(e))},d.prototype.addClientInfo=function(){this.parameters.set("client_info","1")},d.prototype.addExtraQueryParameters=function(t){var o=this,e=bv.sanitizeEQParams(t,this.parameters);Object.keys(e).forEach(function(e){o.parameters.set(e,t[e])})},d.prototype.addClientCapabilitiesToClaims=function(e,t){var o;if(e)try{o=JSON.parse(e)}catch(e){throw Ky.createInvalidClaimsRequestError()}else o={};return t&&0<t.length&&(o.hasOwnProperty(Hg.ACCESS_TOKEN)||(o[Hg.ACCESS_TOKEN]={}),o[Hg.ACCESS_TOKEN][Hg.XMS_CC]={values:t}),JSON.stringify(o)},d.prototype.addUsername=function(e){this.parameters.set(rm.username,encodeURIComponent(e))},d.prototype.addPassword=function(e){this.parameters.set(rm.password,encodeURIComponent(e))},d.prototype.addPopToken=function(e){k.isEmpty(e)||(this.parameters.set(u.TOKEN_TYPE,Zg.POP),this.parameters.set(u.REQ_CNF,encodeURIComponent(e)))},d.prototype.addSshJwk=function(e){k.isEmpty(e)||(this.parameters.set(u.TOKEN_TYPE,Zg.SSH),this.parameters.set(u.REQ_CNF,encodeURIComponent(e)))},d.prototype.addServerTelemetry=function(e){this.parameters.set(u.X_CLIENT_CURR_TELEM,e.generateCurrentRequestHeaderValue()),this.parameters.set(u.X_CLIENT_LAST_TELEM,e.generateLastRequestHeaderValue())},d.prototype.addThrottling=function(){this.parameters.set(u.X_MS_LIB_CAPABILITY,dm)},d.prototype.addLogoutHint=function(e){this.parameters.set(u.LOGOUT_HINT,encodeURIComponent(e))},d.prototype.createQueryString=function(){var o=new Array;return this.parameters.forEach(function(e,t){o.push(t+"="+e)}),o.join("&")};var Ev=d;function d(){this.parameters=new Map}Sv.prototype.createTokenRequestHeaders=function(e){var t={};if(t[qg.CONTENT_TYPE]=S.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case vv.HOME_ACCOUNT_ID:try{var o=Qy(e.credential);t[qg.CCS_HEADER]="Oid:"+o.uid+"@"+o.utid}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case vv.UPN:t[qg.CCS_HEADER]="UPN: "+e.credential}return t},Sv.prototype.executePostToTokenEndpoint=function(o,r,n,i){return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:return[4,this.networkManager.sendPostRequest(i,o,{body:r,headers:n})];case 1:return t=e.sent(),this.config.serverTelemetryManager&&t.status<500&&429!==t.status&&this.config.serverTelemetryManager.clearTelemetryCache(),[2,t]}})})},Sv.prototype.updateAuthority=function(e){if(!e.discoveryComplete())throw I.createEndpointDiscoveryIncompleteError("Updated authority has not completed endpoint discovery.");this.authority=e},Sv.prototype.createTokenQueryParameters=function(e){var t=new Ev;return e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.createQueryString()};e=Sv;function Sv(e,t){this.config=dv(e),this.logger=new gy(this.config.loggerOptions,vy,_y),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.networkManager=new _v(this.networkClient,this.cacheManager),this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}Tv.prototype.generateAccountId=function(){return Tv.generateAccountIdForCacheKey(this.homeAccountId,this.environment)},Tv.prototype.generateCredentialId=function(){return Tv.generateCredentialIdForCacheKey(this.credentialType,this.clientId,this.realm,this.familyId)},Tv.prototype.generateTarget=function(){return Tv.generateTargetForCacheKey(this.target)},Tv.prototype.generateCredentialKey=function(){return Tv.generateCredentialCacheKey(this.homeAccountId,this.environment,this.credentialType,this.clientId,this.realm,this.target,this.familyId,this.tokenType,this.requestedClaimsHash)},Tv.prototype.generateType=function(){switch(this.credentialType){case E.ID_TOKEN:return Yg.ID_TOKEN;case E.ACCESS_TOKEN:case E.ACCESS_TOKEN_WITH_AUTH_SCHEME:return Yg.ACCESS_TOKEN;case E.REFRESH_TOKEN:return Yg.REFRESH_TOKEN;default:throw I.createUnexpectedCredentialTypeError()}},Tv.generateCredentialCacheKey=function(e,t,o,r,n,i,a,s,c){return[this.generateAccountIdForCacheKey(e,t),this.generateCredentialIdForCacheKey(o,r,n,a),this.generateTargetForCacheKey(i),this.generateClaimsHashForCacheKey(c),this.generateSchemeForCacheKey(s)].join(Gg.CACHE_KEY_SEPARATOR).toLowerCase()},Tv.generateAccountIdForCacheKey=function(e,t){return[e,t].join(Gg.CACHE_KEY_SEPARATOR).toLowerCase()},Tv.generateCredentialIdForCacheKey=function(e,t,o,r){return[e,e===E.REFRESH_TOKEN&&r||t,o||S.EMPTY_STRING].join(Gg.CACHE_KEY_SEPARATOR).toLowerCase()},Tv.generateTargetForCacheKey=function(e){return(e||S.EMPTY_STRING).toLowerCase()},Tv.generateClaimsHashForCacheKey=function(e){return(e||S.EMPTY_STRING).toLowerCase()},Tv.generateSchemeForCacheKey=function(e){return e&&e.toLowerCase()!==Zg.BEARER.toLowerCase()?e.toLowerCase():S.EMPTY_STRING};r=Tv;function Tv(){}Ng(Av,Iv=r),Av.createIdTokenEntity=function(e,t,o,r,n){var i=new Av;return i.credentialType=E.ID_TOKEN,i.homeAccountId=e,i.environment=t,i.clientId=r,i.secret=o,i.realm=n,i},Av.isIdTokenEntity=function(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.credentialType===E.ID_TOKEN};var Iv,kv=Av;function Av(){return null!==Iv&&Iv.apply(this,arguments)||this}Ov.nowSeconds=function(){return Math.round((new Date).getTime()/1e3)},Ov.isTokenExpired=function(e,t){return(Number(e)||0)<Ov.nowSeconds()+t},Ov.wasClockTurnedBack=function(e){return Number(e)>Ov.nowSeconds()},Ov.delay=function(t,o){return new Promise(function(e){return setTimeout(function(){return e(o)},t)})};var Pv=Ov;function Ov(){}Ng(Mv,Rv=r),Mv.createAccessTokenEntity=function(e,t,o,r,n,i,a,s,c,u,l,h,d,p,f){var g,m=new Mv,e=(m.homeAccountId=e,m.credentialType=E.ACCESS_TOKEN,m.secret=o,Pv.nowSeconds());if(m.cachedAt=e.toString(),m.expiresOn=a.toString(),m.extendedExpiresOn=s.toString(),u&&(m.refreshOn=u.toString()),m.environment=t,m.clientId=r,m.realm=n,m.target=i,m.userAssertionHash=h,m.tokenType=k.isEmpty(l)?Zg.BEARER:l,p&&(m.requestedClaims=p,m.requestedClaimsHash=f),(null==(e=m.tokenType)?void 0:e.toLowerCase())!==Zg.BEARER.toLowerCase())switch(m.credentialType=E.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case Zg.POP:var y=Xy.extractTokenClaims(o,c);if(null==(g=null==y?void 0:y.cnf)||!g.kid)throw I.createTokenClaimsRequiredError();m.keyId=y.cnf.kid;break;case Zg.SSH:m.keyId=d}return m},Mv.isAccessTokenEntity=function(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.hasOwnProperty("target")&&(e.credentialType===E.ACCESS_TOKEN||e.credentialType===E.ACCESS_TOKEN_WITH_AUTH_SCHEME)};var Rv,xv=Mv;function Mv(){return null!==Rv&&Rv.apply(this,arguments)||this}Ng(Dv,Nv=r),Dv.createRefreshTokenEntity=function(e,t,o,r,n,i){var a=new Dv;return a.clientId=r,a.credentialType=E.REFRESH_TOKEN,a.environment=t,a.homeAccountId=e,a.secret=o,a.userAssertionHash=i,n&&(a.familyId=n),a},Dv.isRefreshTokenEntity=function(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.credentialType===E.REFRESH_TOKEN};var Nv,Lv=Dv;function Dv(){return null!==Nv&&Nv.apply(this,arguments)||this}var qv,Uv=["interaction_required","consent_required","login_required"],jv=["message_only","additional_action","basic_action","user_password_expired","consent_required"],Hv={code:"no_tokens_found",desc:"No refresh token found in the cache. Please sign-in."},Bv={code:"native_account_unavailable",desc:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API."},Fv=(Ng(zv,qv=T),zv.isInteractionRequiredError=function(e,t,o){var e=!!e&&-1<Uv.indexOf(e),o=!!o&&-1<jv.indexOf(o),r=!!t&&Uv.some(function(e){return-1<t.indexOf(e)});return e||r||o},zv.createNoTokensFoundError=function(){return new zv(Hv.code,Hv.desc)},zv.createNativeAccountUnavailableError=function(){return new zv(Bv.code,Bv.desc)},zv);function zv(e,t,o,r,n,i,a){e=qv.call(this,e,t,o)||this;return Object.setPrototypeOf(e,zv.prototype),e.timestamp=r||S.EMPTY_STRING,e.traceId=n||S.EMPTY_STRING,e.correlationId=i||S.EMPTY_STRING,e.claims=a||S.EMPTY_STRING,e.name="InteractionRequiredAuthError",e}var Kv=function(e,t,o,r,n){this.account=e||null,this.idToken=t||null,this.accessToken=o||null,this.refreshToken=r||null,this.appMetadata=n||null},Gv=(Yv.setRequestState=function(e,t,o){e=Yv.generateLibraryState(e,o);return k.isEmpty(t)?e:""+e+S.RESOURCE_DELIM+t},Yv.generateLibraryState=function(e,t){var o;if(e)return o={id:e.createNewGuid()},t&&(o.meta=t),t=JSON.stringify(o),e.base64Encode(t);throw I.createNoCryptoObjectError("generateLibraryState")},Yv.parseRequestState=function(e,t){if(!e)throw I.createNoCryptoObjectError("parseRequestState");if(k.isEmpty(t))throw I.createInvalidStateError(t,"Null, undefined or empty state");try{var o=t.split(S.RESOURCE_DELIM),r=o[0],n=1<o.length?o.slice(1).join(S.RESOURCE_DELIM):S.EMPTY_STRING,i=e.base64Decode(r),a=JSON.parse(i);return{userRequestState:k.isEmpty(n)?S.EMPTY_STRING:n,libraryState:a}}catch(e){throw I.createInvalidStateError(t,e)}},Yv);function Yv(){}Object.defineProperty(Zv.prototype,"urlString",{get:function(){return this._urlString},enumerable:!1,configurable:!0}),Zv.canonicalizeUri=function(e){var t;return e&&(t=e.toLowerCase(),k.endsWith(t,"?")?t=t.slice(0,-1):k.endsWith(t,"?/")&&(t=t.slice(0,-2)),k.endsWith(t,"/")||(t+="/"),t)},Zv.prototype.validateAsUri=function(){var e;try{e=this.getUrlComponents()}catch(e){throw Ky.createUrlParseError(e)}if(!e.HostNameAndPort||!e.PathSegments)throw Ky.createUrlParseError("Given url string: "+this.urlString);if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw Ky.createInsecureAuthorityUriError(this.urlString)},Zv.appendQueryString=function(e,t){return k.isEmpty(t)?e:e.indexOf("?")<0?e+"?"+t:e+"&"+t},Zv.removeHashFromUrl=function(e){return Zv.canonicalizeUri(e.split("#")[0])},Zv.prototype.replaceTenantPath=function(e){var t=this.getUrlComponents(),o=t.PathSegments;return!e||0===o.length||o[0]!==jg.COMMON&&o[0]!==jg.ORGANIZATIONS||(o[0]=e),Zv.constructAuthorityUriFromObject(t)},Zv.prototype.getHash=function(){return Zv.parseHash(this.urlString)},Zv.prototype.getUrlComponents=function(){var e,t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),t=this.urlString.match(t);if(t)return e=(e=(t={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]}).AbsolutePath.split("/")).filter(function(e){return e&&0<e.length}),t.PathSegments=e,!k.isEmpty(t.QueryString)&&t.QueryString.endsWith("/")&&(t.QueryString=t.QueryString.substring(0,t.QueryString.length-1)),t;throw Ky.createUrlParseError("Given url string: "+this.urlString)},Zv.getDomainFromUrl=function(e){var t=RegExp("^([^:/?#]+://)?([^/?#]*)"),t=e.match(t);if(t)return t[2];throw Ky.createUrlParseError("Given url string: "+e)},Zv.getAbsoluteUrl=function(e,t){return e[0]===S.FORWARD_SLASH?(t=new Zv(t).getUrlComponents()).Protocol+"//"+t.HostNameAndPort+e:e},Zv.parseHash=function(e){var t=e.indexOf("#"),o=e.indexOf("#/");return-1<o?e.substring(o+2):-1<t?e.substring(t+1):S.EMPTY_STRING},Zv.parseQueryString=function(e){var t=e.indexOf("?"),o=e.indexOf("/?");return-1<o?e.substring(o+2):-1<t?e.substring(t+1):S.EMPTY_STRING},Zv.constructAuthorityUriFromObject=function(e){return new Zv(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))},Zv.getDeserializedHash=function(e){if(k.isEmpty(e))return{};var t=Zv.parseHash(e),e=k.queryStringToObject(k.isEmpty(t)?e:t);if(e)return e;throw I.createHashNotDeserializedError(JSON.stringify(e))},Zv.getDeserializedQueryString=function(e){if(k.isEmpty(e))return{};var t=Zv.parseQueryString(e),e=k.queryStringToObject(k.isEmpty(t)?e:t);if(e)return e;throw I.createHashNotDeserializedError(JSON.stringify(e))},Zv.hashContainsKnownProperties=function(e){return!(k.isEmpty(e)||e.indexOf("=")<0||!((e=Zv.getDeserializedHash(e)).code||e.error_description||e.error||e.state))};var A,Wv,P=Zv;function Zv(e){if(this._urlString=e,k.isEmpty(this._urlString))throw Ky.createUrlEmptyError();k.isEmpty(this.getHash())&&(this._urlString=Zv.canonicalizeUri(e))}(t=A=A||{}).AcquireTokenByCode="acquireTokenByCode",t.AcquireTokenByRefreshToken="acquireTokenByRefreshToken",t.AcquireTokenSilent="acquireTokenSilent",t.AcquireTokenSilentAsync="acquireTokenSilentAsync",t.AcquireTokenPopup="acquireTokenPopup",t.CryptoOptsGetPublicKeyThumbprint="cryptoOptsGetPublicKeyThumbprint",t.CryptoOptsSignJwt="cryptoOptsSignJwt",t.SilentCacheClientAcquireToken="silentCacheClientAcquireToken",t.SilentIframeClientAcquireToken="silentIframeClientAcquireToken",t.SilentRefreshClientAcquireToken="silentRefreshClientAcquireToken",t.SsoSilent="ssoSilent",t.StandardInteractionClientGetDiscoveredAuthority="standardInteractionClientGetDiscoveredAuthority",t.FetchAccountIdWithNativeBroker="fetchAccountIdWithNativeBroker",t.NativeInteractionClientAcquireToken="nativeInteractionClientAcquireToken",t.BaseClientCreateTokenRequestHeaders="baseClientCreateTokenRequestHeaders",t.BrokerHandhshake="brokerHandshake",t.AcquireTokenByRefreshTokenInBroker="acquireTokenByRefreshTokenInBroker",t.AcquireTokenByBroker="acquireTokenByBroker",t.RefreshTokenClientExecuteTokenRequest="refreshTokenClientExecuteTokenRequest",t.RefreshTokenClientAcquireToken="refreshTokenClientAcquireToken",t.RefreshTokenClientAcquireTokenWithCachedRefreshToken="refreshTokenClientAcquireTokenWithCachedRefreshToken",t.RefreshTokenClientAcquireTokenByRefreshToken="refreshTokenClientAcquireTokenByRefreshToken",t.RefreshTokenClientCreateTokenRequestBody="refreshTokenClientCreateTokenRequestBody",t.AcquireTokenFromCache="acquireTokenFromCache",t.AcquireTokenBySilentIframe="acquireTokenBySilentIframe",t.InitializeBaseRequest="initializeBaseRequest",t.InitializeSilentRequest="initializeSilentRequest",t.InitializeClientApplication="initializeClientApplication",t.SilentIframeClientTokenHelper="silentIframeClientTokenHelper",t.SilentHandlerInitiateAuthRequest="silentHandlerInitiateAuthRequest",t.SilentHandlerMonitorIframeForHash="silentHandlerMonitorIframeForHash",t.SilentHandlerLoadFrame="silentHandlerLoadFrame",t.StandardInteractionClientCreateAuthCodeClient="standardInteractionClientCreateAuthCodeClient",t.StandardInteractionClientGetClientConfiguration="standardInteractionClientGetClientConfiguration",t.StandardInteractionClientInitializeAuthorizationRequest="standardInteractionClientInitializeAuthorizationRequest",t.StandardInteractionClientInitializeAuthorizationCodeRequest="standardInteractionClientInitializeAuthorizationCodeRequest",t.GetAuthCodeUrl="getAuthCodeUrl",t.HandleCodeResponseFromServer="handleCodeResponseFromServer",t.HandleCodeResponseFromHash="handleCodeResponseFromHash",t.UpdateTokenEndpointAuthority="updateTokenEndpointAuthority",t.AuthClientAcquireToken="authClientAcquireToken",t.AuthClientExecuteTokenRequest="authClientExecuteTokenRequest",t.AuthClientCreateTokenRequestBody="authClientCreateTokenRequestBody",t.AuthClientCreateQueryString="authClientCreateQueryString",t.PopTokenGenerateCnf="popTokenGenerateCnf",t.PopTokenGenerateKid="popTokenGenerateKid",t.HandleServerTokenResponse="handleServerTokenResponse",t.AuthorityFactoryCreateDiscoveredInstance="authorityFactoryCreateDiscoveredInstance",t.AuthorityResolveEndpointsAsync="authorityResolveEndpointsAsync",t.AuthorityGetCloudDiscoveryMetadataFromNetwork="authorityGetCloudDiscoveryMetadataFromNetwork",t.AuthorityUpdateCloudDiscoveryMetadata="authorityUpdateCloudDiscoveryMetadata",t.AuthorityGetEndpointMetadataFromNetwork="authorityGetEndpointMetadataFromNetwork",t.AuthorityUpdateEndpointMetadata="authorityUpdateEndpointMetadata",t.AuthorityUpdateMetadataWithRegionalInformation="authorityUpdateMetadataWithRegionalInformation",t.RegionDiscoveryDetectRegion="regionDiscoveryDetectRegion",t.RegionDiscoveryGetRegionFromIMDS="regionDiscoveryGetRegionFromIMDS",t.RegionDiscoveryGetCurrentVersion="regionDiscoveryGetCurrentVersion",t.AcquireTokenByCodeAsync="acquireTokenByCodeAsync",t.GetEndpointMetadataFromNetwork="getEndpointMetadataFromNetwork",t.GetCloudDiscoveryMetadataFromNetworkMeasurement="getCloudDiscoveryMetadataFromNetworkMeasurement",t.HandleRedirectPromiseMeasurement="handleRedirectPromiseMeasurement",t.UpdateCloudDiscoveryMetadataMeasurement="updateCloudDiscoveryMetadataMeasurement",t.UsernamePasswordClientAcquireToken="usernamePasswordClientAcquireToken",t.NativeMessageHandlerHandshake="nativeMessageHandlerHandshake",t.ClearTokensAndKeysWithClaims="clearTokensAndKeysWithClaims",(n=Wv=Wv||{})[n.NotStarted=0]="NotStarted",n[n.InProgress=1]="InProgress",n[n.Completed=2]="Completed";var Qv,Vv=new Set(["accessTokenSize","durationMs","idTokenSize","matsSilentStatus","matsHttpStatus","refreshTokenSize","queuedTimeMs","startTimeMs","status"]),Jv=((a=Qv=Qv||{}).SW="sw",a.UHW="uhw",Xv.prototype.generateCnf=function(r){var n;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:return null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.PopTokenGenerateCnf,r.correlationId),null!=(n=this.performanceClient)&&n.setPreQueueTime(A.PopTokenGenerateKid,r.correlationId),[4,this.generateKid(r)];case 1:return o=e.sent(),t=this.cryptoUtils.base64Encode(JSON.stringify(o)),o={kid:o.kid,reqCnfString:t},[4,this.cryptoUtils.hashString(t)];case 2:return[2,(o.reqCnfHash=e.sent(),o)]}})})},Xv.prototype.generateKid=function(t){var o;return b(this,void 0,void 0,function(){return C(this,function(e){switch(e.label){case 0:return null!=(o=this.performanceClient)&&o.addQueueMeasurement(A.PopTokenGenerateKid,t.correlationId),[4,this.cryptoUtils.getPublicKeyThumbprint(t)];case 1:return[2,{kid:e.sent(),xms_ksl:Qv.SW}]}})})},Xv.prototype.signPopToken=function(t,o,r){return b(this,void 0,void 0,function(){return C(this,function(e){return[2,this.signPayload(t,o,r)]})})},Xv.prototype.signPayload=function(i,a,s,c){return b(this,void 0,void 0,function(){var t,o,r,n;return C(this,function(e){switch(e.label){case 0:return t=s.resourceRequestMethod,n=s.resourceRequestUri,o=s.shrClaims,r=s.shrNonce,n=n?new P(n):void 0,n=null==n?void 0:n.getUrlComponents(),[4,this.cryptoUtils.signJwt(Lg({at:i,ts:Pv.nowSeconds(),m:null==t?void 0:t.toUpperCase(),u:null==n?void 0:n.HostNameAndPort,nonce:r||this.cryptoUtils.createNewGuid(),p:null==n?void 0:n.AbsolutePath,q:null!=n&&n.QueryString?[[],n.QueryString]:void 0,client_claims:o||void 0},c),a,s.correlationId)];case 1:return[2,e.sent()]}})})},Xv);function Xv(e,t){this.cryptoUtils=e,this.performanceClient=t}e_.prototype.generateAppMetadataKey=function(){return e_.generateAppMetadataCacheKey(this.environment,this.clientId)},e_.generateAppMetadataCacheKey=function(e,t){return[$g,e,t].join(Gg.CACHE_KEY_SEPARATOR).toLowerCase()},e_.createAppMetadataEntity=function(e,t,o){var r=new e_;return r.clientId=e,r.environment=t,o&&(r.familyId=o),r},e_.isAppMetadataEntity=function(e,t){return!!t&&0===e.indexOf($g)&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("environment")};var $v=e_;function e_(){}Object.defineProperty(o_.prototype,"cacheHasChanged",{get:function(){return this.hasChanged},enumerable:!1,configurable:!0}),Object.defineProperty(o_.prototype,"tokenCache",{get:function(){return this.cache},enumerable:!1,configurable:!0});var t_=o_;function o_(e,t){this.cache=e,this.hasChanged=t}n_.prototype.validateServerAuthorizationCodeResponse=function(e,t,o){if(!e.state||!t)throw e.state?I.createStateNotFoundError("Cached State"):I.createStateNotFoundError("Server State");if(decodeURIComponent(e.state)!==decodeURIComponent(t))throw I.createStateMismatchError();if(e.error||e.error_description||e.suberror){if(Fv.isInteractionRequiredError(e.error,e.error_description,e.suberror))throw new Fv(e.error||S.EMPTY_STRING,e.error_description,e.suberror,e.timestamp||S.EMPTY_STRING,e.trace_id||S.EMPTY_STRING,e.correlation_id||S.EMPTY_STRING,e.claims||S.EMPTY_STRING);throw new fv(e.error||S.EMPTY_STRING,e.error_description,e.suberror)}e.client_info&&Zy(e.client_info,o)},n_.prototype.validateTokenResponse=function(e){if(e.error||e.error_description||e.suberror){if(Fv.isInteractionRequiredError(e.error,e.error_description,e.suberror))throw new Fv(e.error,e.error_description,e.suberror,e.timestamp||S.EMPTY_STRING,e.trace_id||S.EMPTY_STRING,e.correlation_id||S.EMPTY_STRING,e.claims||S.EMPTY_STRING);var t=e.error_codes+" - ["+e.timestamp+"]: "+e.error_description+" - Correlation ID: "+e.correlation_id+" - Trace ID: "+e.trace_id;throw new fv(e.error,t,e.suberror)}},n_.prototype.handleServerTokenResponse=function(a,s,c,u,l,h,d,p,f){var g;return b(this,void 0,void 0,function(){var t,o,r,n,i;return C(this,function(e){switch(e.label){case 0:if(null!=(g=this.performanceClient)&&g.addQueueMeasurement(A.HandleServerTokenResponse,a.correlation_id),a.id_token){if(t=new Xy(a.id_token||S.EMPTY_STRING,this.cryptoObj),l&&!k.isEmpty(l.nonce)&&t.claims.nonce!==l.nonce)throw I.createNonceMismatchError();if(u.maxAge||0===u.maxAge){if(!(r=t.claims.auth_time))throw I.createAuthTimeNotFoundError();Xy.checkMaxAge(r,u.maxAge)}}this.homeAccountIdentifier=Vy.generateHomeAccountId(a.client_info||S.EMPTY_STRING,s.authorityType,this.logger,this.cryptoObj,t),l&&l.state&&(o=Gv.parseRequestState(this.cryptoObj,l.state)),a.key_id=a.key_id||u.sshKid||void 0,r=this.generateCacheRecord(a,s,c,u,t,h,l),e.label=1;case 1:return(e.trys.push([1,,5,8]),this.persistencePlugin&&this.serializableCache)?(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),n=new t_(this.serializableCache,!0),[4,this.persistencePlugin.beforeCacheAccess(n)]):[3,3];case 2:e.sent(),e.label=3;case 3:return!d||p||!r.account||(i=r.account.generateAccountKey(),this.cacheStorage.getAccount(i))?[4,this.cacheStorage.saveCacheRecord(r)]:(this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),[2,n_.generateAuthenticationResult(this.cryptoObj,s,r,!1,u,t,o,void 0,f)]);case 4:return e.sent(),[3,8];case 5:return this.persistencePlugin&&this.serializableCache&&n?(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),[4,this.persistencePlugin.afterCacheAccess(n)]):[3,7];case 6:e.sent(),e.label=7;case 7:return[7];case 8:return[2,n_.generateAuthenticationResult(this.cryptoObj,s,r,!1,u,t,o,a,f)]}})})},n_.prototype.generateCacheRecord=function(e,t,o,r,n,i,a){var s,c,u=t.getPreferredCache();if(k.isEmpty(u))throw I.createInvalidCacheEnvironmentError();!k.isEmpty(e.id_token)&&n&&(s=kv.createIdTokenEntity(this.homeAccountIdentifier,u,e.id_token||S.EMPTY_STRING,this.clientId,n.claims.tid||S.EMPTY_STRING),c=this.generateAccountEntity(e,n,t,a));var l,h,d,a=null,p=(k.isEmpty(e.access_token)||(l=e.scope?Yy.fromString(e.scope):new Yy(r.scopes||[]),d=(h=o+(("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0))+(("string"==typeof e.ext_expires_in?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0),o=(p=("string"==typeof e.refresh_in?parseInt(e.refresh_in,10):e.refresh_in)||void 0)&&0<p?o+p:void 0,a=xv.createAccessTokenEntity(this.homeAccountIdentifier,u,e.access_token||S.EMPTY_STRING,this.clientId,n?n.claims.tid||S.EMPTY_STRING:t.tenant,l.printScopes(),h,d,this.cryptoObj,o,e.token_type,i,e.key_id,r.claims,r.requestedClaimsHash)),null),n=(k.isEmpty(e.refresh_token)||(p=Lv.createRefreshTokenEntity(this.homeAccountIdentifier,u,e.refresh_token||S.EMPTY_STRING,this.clientId,e.foci,i)),null);return k.isEmpty(e.foci)||(n=$v.createAppMetadataEntity(this.clientId,u,e.foci)),new Kv(c,s,a,p,n)},n_.prototype.generateAccountEntity=function(e,t,o,r){var n=o.authorityType,i=r?r.cloud_graph_host_name:S.EMPTY_STRING,r=r?r.msgraph_host:S.EMPTY_STRING;if(n===Gy.Adfs)return this.logger.verbose("Authority type is ADFS, creating ADFS account"),Vy.createGenericAccount(this.homeAccountIdentifier,t,o,i,r);if(k.isEmpty(e.client_info)&&"AAD"===o.protocolMode)throw I.createClientInfoEmptyError();return e.client_info?Vy.createAccount(e.client_info,this.homeAccountIdentifier,t,o,i,r):Vy.createGenericAccount(this.homeAccountIdentifier,t,o,i,r)},n_.generateAuthenticationResult=function(u,l,h,d,p,f,g,m,y){var v;return b(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c;return C(this,function(e){switch(e.label){case 0:if(t=S.EMPTY_STRING,o=[],r=null,i=S.EMPTY_STRING,!h.accessToken)return[3,4];if(h.accessToken.tokenType!==Zg.POP)return[3,2];if(s=new Jv(u),a=h.accessToken,c=a.secret,a=a.keyId)return[4,s.signPopToken(c,a,p)];throw I.createKeyIdMissingError();case 1:return t=e.sent(),[3,3];case 2:t=h.accessToken.secret,e.label=3;case 3:o=Yy.fromString(h.accessToken.target).asArray(),r=new Date(1e3*Number(h.accessToken.expiresOn)),n=new Date(1e3*Number(h.accessToken.extendedExpiresOn)),e.label=4;case 4:return h.appMetadata&&(i="1"===h.appMetadata.familyId?"1":S.EMPTY_STRING),s=(null==f?void 0:f.claims.oid)||(null==f?void 0:f.claims.sub)||S.EMPTY_STRING,c=(null==f?void 0:f.claims.tid)||S.EMPTY_STRING,null!=m&&m.spa_accountid&&h.account&&(h.account.nativeAccountId=null==m?void 0:m.spa_accountid),[2,{authority:l.canonicalAuthority,uniqueId:s,tenantId:c,scopes:o,account:h.account?h.account.getAccountInfo():null,idToken:f?f.rawToken:S.EMPTY_STRING,idTokenClaims:f?f.claims:{},accessToken:t,fromCache:d,expiresOn:r,correlationId:p.correlationId,requestId:y||S.EMPTY_STRING,extExpiresOn:n,familyId:i,tokenType:(null==(v=h.accessToken)?void 0:v.tokenType)||S.EMPTY_STRING,state:g?g.userRequestState:S.EMPTY_STRING,cloudGraphHostName:(null==(v=h.account)?void 0:v.cloudGraphHostName)||S.EMPTY_STRING,msGraphHost:(null==(v=h.account)?void 0:v.msGraphHost)||S.EMPTY_STRING,code:null==m?void 0:m.spa_code,fromNativeBroker:!1}]}})})};var r_=n_;function n_(e,t,o,r,n,i,a){this.clientId=e,this.cacheStorage=t,this.cryptoObj=o,this.logger=r,this.serializableCache=n,this.persistencePlugin=i,this.performanceClient=a}Ng(s_,i_=e),s_.prototype.getAuthCodeUrl=function(o){var r;return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:return null!=(r=this.performanceClient)&&r.addQueueMeasurement(A.GetAuthCodeUrl,o.correlationId),null!=(r=this.performanceClient)&&r.setPreQueueTime(A.AuthClientCreateQueryString,o.correlationId),[4,this.createAuthCodeUrlQueryString(o)];case 1:return t=e.sent(),[2,P.appendQueryString(this.authority.authorizationEndpoint,t)]}})})},s_.prototype.acquireToken=function(s,c){var u,l;return b(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return C(this,function(e){switch(e.label){case 0:if(s&&s.code)return null!=(u=this.performanceClient)&&u.addQueueMeasurement(A.AuthClientAcquireToken,s.correlationId),t=null==(u=this.performanceClient)?void 0:u.startMeasurement("AuthCodeClientAcquireToken",s.correlationId),this.logger.info("in acquireToken call in auth-code client"),o=Pv.nowSeconds(),null!=(u=this.performanceClient)&&u.setPreQueueTime(A.AuthClientExecuteTokenRequest,s.correlationId),[4,this.executeTokenRequest(this.authority,s)];throw I.createTokenRequestCannotBeMadeError();case 1:return r=e.sent(),n=null==(u=r.headers)?void 0:u[qg.X_MS_REQUEST_ID],(i=null==(l=r.headers)?void 0:l[qg.X_MS_HTTP_VERSION])&&null!=t&&t.addStaticFields({httpVerAuthority:i}),(i=new r_(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient)).validateTokenResponse(r.body),null!=(l=this.performanceClient)&&l.setPreQueueTime(A.HandleServerTokenResponse,s.correlationId),[2,i.handleServerTokenResponse(r.body,this.authority,o,s,c,void 0,void 0,void 0,n).then(function(e){return null!=t&&t.endMeasurement({success:!0}),e}).catch(function(e){throw a.logger.verbose("Error in fetching token in ACC",s.correlationId),null!=t&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})]}})})},s_.prototype.handleFragmentResponse=function(e,t){var o=new r_(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null),e=new P(e),e=P.getDeserializedHash(e.getHash());if(o.validateServerAuthorizationCodeResponse(e,t,this.cryptoUtils),e.code)return Lg(Lg({},e),{code:e.code});throw I.createNoAuthCodeInServerResponseError()},s_.prototype.getLogoutUri=function(e){if(e)return e=this.createLogoutUrlQueryString(e),P.appendQueryString(this.authority.endSessionEndpoint,e);throw Ky.createEmptyLogoutRequestError()},s_.prototype.executeTokenRequest=function(a,s){var c;return b(this,void 0,void 0,function(){var t,o,r,n,i;return C(this,function(e){switch(e.label){case 0:return null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.AuthClientExecuteTokenRequest,s.correlationId),null!=(c=this.performanceClient)&&c.setPreQueueTime(A.AuthClientCreateTokenRequestBody,s.correlationId),t=this.createTokenQueryParameters(s),t=P.appendQueryString(a.tokenEndpoint,t),[4,this.createTokenRequestBody(s)];case 1:if(o=e.sent(),n=void 0,s.clientInfo)try{r=Zy(s.clientInfo,this.cryptoUtils),n={credential:""+r.uid+Gg.CLIENT_INFO_SEPARATOR+r.utid,type:vv.HOME_ACCOUNT_ID}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}return n=this.createTokenRequestHeaders(n||s.ccsCredential),i={clientId:this.config.authOptions.clientId,authority:a.canonicalAuthority,scopes:s.scopes,claims:s.claims,authenticationScheme:s.authenticationScheme,resourceRequestMethod:s.resourceRequestMethod,resourceRequestUri:s.resourceRequestUri,shrClaims:s.shrClaims,sshKid:s.sshKid},[2,this.executePostToTokenEndpoint(t,o,n,i)]}})})},s_.prototype.createTokenRequestBody=function(s){var c;return b(this,void 0,void 0,function(){var t,o,r,n,i,a;return C(this,function(e){switch(e.label){case 0:return(null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.AuthClientCreateTokenRequestBody,s.correlationId),(t=new Ev).addClientId(this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(s.redirectUri):bv.validateRedirectUri(s.redirectUri),t.addScopes(s.scopes),t.addAuthorizationCode(s.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&t.addServerTelemetry(this.serverTelemetryManager),s.codeVerifier&&t.addCodeVerifier(s.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion&&(o=this.config.clientCredentials.clientAssertion,t.addClientAssertion(o.assertion),t.addClientAssertionType(o.assertionType)),t.addGrantType(zg.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),s.authenticationScheme!==Zg.POP)?[3,2]:(o=new Jv(this.cryptoUtils,this.performanceClient),null!=(c=this.performanceClient)&&c.setPreQueueTime(A.PopTokenGenerateCnf,s.correlationId),[4,o.generateCnf(s)]);case 1:return r=e.sent(),t.addPopToken(r.reqCnfString),[3,3];case 2:if(s.authenticationScheme===Zg.SSH){if(!s.sshJwk)throw Ky.createMissingSshJwkError();t.addSshJwk(s.sshJwk)}e.label=3;case 3:if(r=s.correlationId||this.config.cryptoInterface.createNewGuid(),t.addCorrelationId(r),(!k.isEmptyObj(s.claims)||this.config.authOptions.clientCapabilities&&0<this.config.authOptions.clientCapabilities.length)&&t.addClaims(s.claims,this.config.authOptions.clientCapabilities),n=void 0,s.clientInfo)try{i=Zy(s.clientInfo,this.cryptoUtils),n={credential:""+i.uid+Gg.CLIENT_INFO_SEPARATOR+i.utid,type:vv.HOME_ACCOUNT_ID}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}else n=s.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&n)switch(n.type){case vv.HOME_ACCOUNT_ID:try{i=Qy(n.credential),t.addCcsOid(i)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case vv.UPN:t.addCcsUpn(n.credential)}return s.tokenBodyParameters&&t.addExtraQueryParameters(s.tokenBodyParameters),!s.enableSpaAuthorizationCode||s.tokenBodyParameters&&s.tokenBodyParameters[u.RETURN_SPA_CODE]||t.addExtraQueryParameters(((a={})[u.RETURN_SPA_CODE]="1",a)),[2,t.createQueryString()]}})})},s_.prototype.createAuthCodeUrlQueryString=function(i){var a;return b(this,void 0,void 0,function(){var t,o,r,n;return C(this,function(e){switch(e.label){case 0:if(null!=(a=this.performanceClient)&&a.addQueueMeasurement(A.AuthClientCreateQueryString,i.correlationId),(t=new Ev).addClientId(this.config.authOptions.clientId),o=Dg(i.scopes||[],i.extraScopesToConsent||[]),t.addScopes(o),t.addRedirectUri(i.redirectUri),o=i.correlationId||this.config.cryptoInterface.createNewGuid(),t.addCorrelationId(o),t.addResponseMode(i.responseMode),t.addResponseTypeCode(),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addClientInfo(),i.codeChallenge&&i.codeChallengeMethod&&t.addCodeChallengeParams(i.codeChallenge,i.codeChallengeMethod),i.prompt&&t.addPrompt(i.prompt),i.domainHint&&t.addDomainHint(i.domainHint),i.prompt!==Jg.SELECT_ACCOUNT)if(i.sid&&i.prompt===Jg.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),t.addSid(i.sid);else if(i.account){if(o=this.extractAccountSid(i.account),n=this.extractLoginHint(i.account)){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),t.addLoginHint(n);try{r=Qy(i.account.homeAccountId),t.addCcsOid(r)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(o&&i.prompt===Jg.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),t.addSid(o);try{r=Qy(i.account.homeAccountId),t.addCcsOid(r)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(i.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),t.addLoginHint(i.loginHint),t.addCcsUpn(i.loginHint);else if(i.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),t.addLoginHint(i.account.username);try{r=Qy(i.account.homeAccountId),t.addCcsOid(r)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else i.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),t.addLoginHint(i.loginHint),t.addCcsUpn(i.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return(i.nonce&&t.addNonce(i.nonce),i.state&&t.addState(i.state),(!k.isEmpty(i.claims)||this.config.authOptions.clientCapabilities&&0<this.config.authOptions.clientCapabilities.length)&&t.addClaims(i.claims,this.config.authOptions.clientCapabilities),i.extraQueryParameters&&t.addExtraQueryParameters(i.extraQueryParameters),i.nativeBroker)?(t.addNativeBroker(),i.authenticationScheme!==Zg.POP?[3,2]:[4,new Jv(this.cryptoUtils).generateCnf(i)]):[3,2];case 1:n=e.sent(),t.addPopToken(n.reqCnfString),e.label=2;case 2:return[2,t.createQueryString()]}})})},s_.prototype.createLogoutUrlQueryString=function(e){var t=new Ev;return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters),t.createQueryString()},s_.prototype.extractAccountSid=function(e){return(null==(e=e.idTokenClaims)?void 0:e.sid)||null},s_.prototype.extractLoginHint=function(e){return(null==(e=e.idTokenClaims)?void 0:e.login_hint)||null};var i_,a_=s_;function s_(e,t){e=i_.call(this,e,t)||this;return e.includeRedirectUri=!0,e}Ng(l_,c_=e),l_.prototype.acquireToken=function(s){var c,u,l;return b(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return C(this,function(e){switch(e.label){case 0:return null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.RefreshTokenClientAcquireToken,s.correlationId),t=null==(c=this.performanceClient)?void 0:c.startMeasurement(A.RefreshTokenClientAcquireToken,s.correlationId),this.logger.verbose("RefreshTokenClientAcquireToken called",s.correlationId),o=Pv.nowSeconds(),null!=(c=this.performanceClient)&&c.setPreQueueTime(A.RefreshTokenClientExecuteTokenRequest,s.correlationId),[4,this.executeTokenRequest(s,this.authority)];case 1:return r=e.sent(),n=null==(c=r.headers)?void 0:c[qg.X_MS_HTTP_VERSION],null!=t&&t.addStaticFields({refreshTokenSize:(null==(u=r.body.refresh_token)?void 0:u.length)||0}),n&&null!=t&&t.addStaticFields({httpVerToken:n}),n=null==(u=r.headers)?void 0:u[qg.X_MS_REQUEST_ID],(i=new r_(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin)).validateTokenResponse(r.body),null!=(l=this.performanceClient)&&l.setPreQueueTime(A.HandleServerTokenResponse,s.correlationId),[2,i.handleServerTokenResponse(r.body,this.authority,o,s,void 0,void 0,!0,s.forceCache,n).then(function(e){return null!=t&&t.endMeasurement({success:!0}),e}).catch(function(e){throw a.logger.verbose("Error in fetching refresh token",s.correlationId),null!=t&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})]}})})},l_.prototype.acquireTokenByRefreshToken=function(r){var n,i;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){if(!r)throw Ky.createEmptyTokenRequestError();if(null!=(i=this.performanceClient)&&i.addQueueMeasurement(A.RefreshTokenClientAcquireTokenByRefreshToken,r.correlationId),!r.account)throw I.createNoAccountInSilentRequestError();if(this.cacheManager.isAppMetadataFOCI(r.account.environment))try{return null!=(n=this.performanceClient)&&n.setPreQueueTime(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),[2,this.acquireTokenWithCachedRefreshToken(r,!0)]}catch(e){if(t=e instanceof Fv&&e.errorCode===Hv.code,o=e instanceof fv&&e.errorCode===pm&&e.subError===fm,t||o)return null!=(i=this.performanceClient)&&i.setPreQueueTime(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),[2,this.acquireTokenWithCachedRefreshToken(r,!1)];throw e}return null!=(i=this.performanceClient)&&i.setPreQueueTime(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),[2,this.acquireTokenWithCachedRefreshToken(r,!1)]})})},l_.prototype.acquireTokenWithCachedRefreshToken=function(r,n){var i;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){if(null!=(i=this.performanceClient)&&i.addQueueMeasurement(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),t=null==(i=this.performanceClient)?void 0:i.startMeasurement(A.RefreshTokenClientAcquireTokenWithCachedRefreshToken,r.correlationId),this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called",r.correlationId),o=this.cacheManager.getRefreshToken(r.account,n))return null!=t&&t.endMeasurement({success:!0}),o=Lg(Lg({},r),{refreshToken:o.secret,authenticationScheme:r.authenticationScheme||Zg.BEARER,ccsCredential:{credential:r.account.homeAccountId,type:vv.HOME_ACCOUNT_ID}}),null!=(i=this.performanceClient)&&i.setPreQueueTime(A.RefreshTokenClientAcquireToken,r.correlationId),[2,this.acquireToken(o)];throw null!=t&&t.discardMeasurement(),Fv.createNoTokensFoundError()})})},l_.prototype.executeTokenRequest=function(a,s){var c;return b(this,void 0,void 0,function(){var t,o,r,n,i;return C(this,function(e){switch(e.label){case 0:return null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.RefreshTokenClientExecuteTokenRequest,a.correlationId),t=null==(c=this.performanceClient)?void 0:c.startMeasurement(A.RefreshTokenClientExecuteTokenRequest,a.correlationId),null!=(c=this.performanceClient)&&c.setPreQueueTime(A.RefreshTokenClientCreateTokenRequestBody,a.correlationId),o=this.createTokenQueryParameters(a),o=P.appendQueryString(s.tokenEndpoint,o),[4,this.createTokenRequestBody(a)];case 1:return r=e.sent(),n=this.createTokenRequestHeaders(a.ccsCredential),i={clientId:this.config.authOptions.clientId,authority:s.canonicalAuthority,scopes:a.scopes,claims:a.claims,authenticationScheme:a.authenticationScheme,resourceRequestMethod:a.resourceRequestMethod,resourceRequestUri:a.resourceRequestUri,shrClaims:a.shrClaims,sshKid:a.sshKid},[2,this.executePostToTokenEndpoint(o,r,n,i).then(function(e){return null!=t&&t.endMeasurement({success:!0}),e}).catch(function(e){throw null!=t&&t.endMeasurement({success:!1}),e})]}})})},l_.prototype.createTokenRequestBody=function(i){var a;return b(this,void 0,void 0,function(){var t,o,r,n;return C(this,function(e){switch(e.label){case 0:return(null!=(a=this.performanceClient)&&a.addQueueMeasurement(A.RefreshTokenClientCreateTokenRequestBody,i.correlationId),r=i.correlationId,t=null==(a=this.performanceClient)?void 0:a.startMeasurement(A.BaseClientCreateTokenRequestHeaders,r),(o=new Ev).addClientId(this.config.authOptions.clientId),o.addScopes(i.scopes),o.addGrantType(zg.REFRESH_TOKEN_GRANT),o.addClientInfo(),o.addLibraryInfo(this.config.libraryInfo),o.addApplicationTelemetry(this.config.telemetry.application),o.addThrottling(),this.serverTelemetryManager&&o.addServerTelemetry(this.serverTelemetryManager),o.addCorrelationId(r),o.addRefreshToken(i.refreshToken),this.config.clientCredentials.clientSecret&&o.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion&&(r=this.config.clientCredentials.clientAssertion,o.addClientAssertion(r.assertion),o.addClientAssertionType(r.assertionType)),i.authenticationScheme!==Zg.POP)?[3,2]:(r=new Jv(this.cryptoUtils,this.performanceClient),null!=(a=this.performanceClient)&&a.setPreQueueTime(A.PopTokenGenerateCnf,i.correlationId),[4,r.generateCnf(i)]);case 1:return r=e.sent(),o.addPopToken(r.reqCnfString),[3,3];case 2:if(i.authenticationScheme===Zg.SSH){if(!i.sshJwk)throw null!=t&&t.endMeasurement({success:!1}),Ky.createMissingSshJwkError();o.addSshJwk(i.sshJwk)}e.label=3;case 3:if((!k.isEmptyObj(i.claims)||this.config.authOptions.clientCapabilities&&0<this.config.authOptions.clientCapabilities.length)&&o.addClaims(i.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&i.ccsCredential)switch(i.ccsCredential.type){case vv.HOME_ACCOUNT_ID:try{n=Qy(i.ccsCredential.credential),o.addCcsOid(n)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case vv.UPN:o.addCcsUpn(i.ccsCredential.credential)}return null!=t&&t.endMeasurement({success:!0}),[2,o.createQueryString()]}})})};var c_,u_=l_;function l_(e,t){return c_.call(this,e,t)||this}Ng(p_,h_=e),p_.prototype.acquireToken=function(o){return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.acquireCachedToken(o)];case 1:return[2,e.sent()];case 2:if((t=e.sent())instanceof I&&t.errorCode===ny.code)return[2,new u_(this.config,this.performanceClient).acquireTokenByRefreshToken(o)];throw t;case 3:return[2]}})})},p_.prototype.acquireCachedToken=function(o){var r,n,i;return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:if(!o)throw Ky.createEmptyTokenRequestError();if(o.forceRefresh)throw null!=(r=this.serverTelemetryManager)&&r.setCacheOutcome(sm.FORCE_REFRESH),this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true."),I.createRefreshRequiredError();if(!this.config.cacheOptions.claimsBasedCachingEnabled&&!k.isEmptyObj(o.claims))throw null!=(r=this.serverTelemetryManager)&&r.setCacheOutcome(sm.CLAIMS_REQUESTED_CACHE_SKIPPED),this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims-based caching is disabled and claims were requested."),I.createRefreshRequiredError();if(!o.account)throw I.createNoAccountInSilentRequestError();if(t=o.authority||this.authority.getPreferredCache(),!(t=this.cacheManager.readCacheRecord(o.account,o,t)).accessToken)throw null!=(n=this.serverTelemetryManager)&&n.setCacheOutcome(sm.NO_CACHED_ACCESS_TOKEN),this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties."),I.createRefreshRequiredError();if(Pv.wasClockTurnedBack(t.accessToken.cachedAt)||Pv.isTokenExpired(t.accessToken.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw null!=(n=this.serverTelemetryManager)&&n.setCacheOutcome(sm.CACHED_ACCESS_TOKEN_EXPIRED),this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within "+this.config.systemOptions.tokenRenewalOffsetSeconds+" seconds."),I.createRefreshRequiredError();if(t.accessToken.refreshOn&&Pv.isTokenExpired(t.accessToken.refreshOn,0))throw null!=(i=this.serverTelemetryManager)&&i.setCacheOutcome(sm.REFRESH_CACHED_ACCESS_TOKEN),this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'."),I.createRefreshRequiredError();return this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[4,this.generateResultFromCacheRecord(t,o)];case 1:return[2,e.sent()]}})})},p_.prototype.generateResultFromCacheRecord=function(r,n){return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:if(r.idToken&&(t=new Xy(r.idToken.secret,this.config.cryptoInterface)),n.maxAge||0===n.maxAge){if(!(o=null==t?void 0:t.claims.auth_time))throw I.createAuthTimeNotFoundError();Xy.checkMaxAge(o,n.maxAge)}return[4,r_.generateAuthenticationResult(this.cryptoUtils,this.authority,r,!0,n,t)];case 1:return[2,e.sent()]}})})};var h_,d_=p_;function p_(e,t){return h_.call(this,e,t)||this}var f_,g_={"https://login.microsoftonline.com/common/":{token_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/common/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/common/":{token_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/common/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/common/":{token_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/common/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"},"https://login.microsoftonline.com/consumers/":{token_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/consumers/":{token_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/consumers/":{token_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"},"https://login.microsoftonline.com/organizations/":{token_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/organizations/":{token_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/organizations/":{token_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"}},m_={"https://login.microsoftonline.com/common/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/common/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/common/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.com/consumers/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/consumers/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/consumers/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.com/organizations/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/organizations/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/organizations/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},y_=((bn=f_=f_||{}).AAD="AAD",bn.OIDC="OIDC",v_.prototype.updateCloudDiscoveryMetadata=function(e,t){this.aliases=e.aliases,this.preferred_cache=e.preferred_cache,this.preferred_network=e.preferred_network,this.aliasesFromNetwork=t},v_.prototype.updateEndpointMetadata=function(e,t){this.authorization_endpoint=e.authorization_endpoint,this.token_endpoint=e.token_endpoint,this.end_session_endpoint=e.end_session_endpoint,this.issuer=e.issuer,this.endpointsFromNetwork=t,this.jwks_uri=e.jwks_uri},v_.prototype.updateCanonicalAuthority=function(e){this.canonical_authority=e},v_.prototype.resetExpiresAt=function(){this.expiresAt=Pv.nowSeconds()+tm},v_.prototype.isExpired=function(){return this.expiresAt<=Pv.nowSeconds()},v_.isAuthorityMetadataEntity=function(e,t){return!!t&&0===e.indexOf(em)&&t.hasOwnProperty("aliases")&&t.hasOwnProperty("preferred_cache")&&t.hasOwnProperty("preferred_network")&&t.hasOwnProperty("canonical_authority")&&t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("aliasesFromNetwork")&&t.hasOwnProperty("endpointsFromNetwork")&&t.hasOwnProperty("expiresAt")&&t.hasOwnProperty("jwks_uri")},v_);function v_(){this.expiresAt=Pv.nowSeconds()+tm}w_.prototype.detectRegion=function(i,a){var s,c;return b(this,void 0,void 0,function(){var t,o,r,n;return C(this,function(e){switch(e.label){case 0:if(null!=(s=this.performanceClient)&&s.addQueueMeasurement(A.RegionDiscoveryDetectRegion,this.correlationId),t=i)return[3,8];o=w_.IMDS_OPTIONS,e.label=1;case 1:return e.trys.push([1,6,,7]),null!=(s=this.performanceClient)&&s.setPreQueueTime(A.RegionDiscoveryGetRegionFromIMDS,this.correlationId),[4,this.getRegionFromIMDS(S.IMDS_VERSION,o)];case 2:return((r=e.sent()).status===nm.httpSuccess&&(t=r.body,a.region_source=im.IMDS),r.status!==nm.httpBadRequest)?[3,5]:(null!=(c=this.performanceClient)&&c.setPreQueueTime(A.RegionDiscoveryGetCurrentVersion,this.correlationId),[4,this.getCurrentVersion(o)]);case 3:return(r=e.sent())?(null!=(c=this.performanceClient)&&c.setPreQueueTime(A.RegionDiscoveryGetRegionFromIMDS,this.correlationId),[4,this.getRegionFromIMDS(r,o)]):(a.region_source=im.FAILED_AUTO_DETECTION,[2,null]);case 4:(n=e.sent()).status===nm.httpSuccess&&(t=n.body,a.region_source=im.IMDS),e.label=5;case 5:return[3,7];case 6:return e.sent(),a.region_source=im.FAILED_AUTO_DETECTION,[2,null];case 7:return[3,9];case 8:a.region_source=im.ENVIRONMENT_VARIABLE,e.label=9;case 9:return t||(a.region_source=im.FAILED_AUTO_DETECTION),[2,t||null]}})})},w_.prototype.getRegionFromIMDS=function(t,o){var r;return b(this,void 0,void 0,function(){return C(this,function(e){return null!=(r=this.performanceClient)&&r.addQueueMeasurement(A.RegionDiscoveryGetRegionFromIMDS,this.correlationId),[2,this.networkInterface.sendGetRequestAsync(S.IMDS_ENDPOINT+"?api-version="+t+"&format=text",o,S.IMDS_TIMEOUT)]})})},w_.prototype.getCurrentVersion=function(o){var r;return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:null!=(r=this.performanceClient)&&r.addQueueMeasurement(A.RegionDiscoveryGetCurrentVersion,this.correlationId),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkInterface.sendGetRequestAsync(S.IMDS_ENDPOINT+"?format=json",o)];case 2:return(t=e.sent()).status===nm.httpBadRequest&&t.body&&t.body["newest-versions"]&&0<t.body["newest-versions"].length?[2,t.body["newest-versions"][0]]:[2,null];case 3:return e.sent(),[2,null];case 4:return[2]}})})},w_.IMDS_OPTIONS={headers:{Metadata:"true"}};var __=w_;function w_(e,t,o){this.networkInterface=e,this.performanceClient=t,this.correlationId=o}p.prototype.getAuthorityType=function(e){if(e.HostNameAndPort.endsWith(S.CIAM_AUTH_URL))return Gy.Ciam;e=e.PathSegments;if(e.length)switch(e[0].toLowerCase()){case S.ADFS:return Gy.Adfs;case S.DSTS:return Gy.Dsts}return Gy.Default},Object.defineProperty(p.prototype,"authorityType",{get:function(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"protocolMode",{get:function(){return this.authorityOptions.protocolMode},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"options",{get:function(){return this.authorityOptions},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"canonicalAuthority",{get:function(){return this._canonicalAuthority.urlString},set:function(e){this._canonicalAuthority=new P(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"canonicalAuthorityUrlComponents",{get:function(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"hostnameAndPort",{get:function(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"tenant",{get:function(){return this.canonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"authorizationEndpoint",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"tokenEndpoint",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"deviceCodeEndpoint",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"endSessionEndpoint",{get:function(){if(this.discoveryComplete()){if(this.metadata.end_session_endpoint)return this.replacePath(this.metadata.end_session_endpoint);throw I.createLogoutNotSupportedError()}throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"selfSignedJwtAudience",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"jwksUri",{get:function(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},enumerable:!1,configurable:!0}),p.prototype.canReplaceTenant=function(e){return 1===e.PathSegments.length&&!p.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===Gy.Default&&this.protocolMode===f_.AAD},p.prototype.replaceTenant=function(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)},p.prototype.replacePath=function(e){var r=this,n=e,i=new P(this.metadata.canonical_authority).getUrlComponents(),a=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach(function(e,t){var o=a[t];0===t&&r.canReplaceTenant(i)&&o!==(t=new P(r.metadata.authorization_endpoint).getUrlComponents().PathSegments[0])&&(r.logger.verbose("Replacing tenant domain name "+o+" with id "+t),o=t),e!==o&&(n=n.replace("/"+o+"/","/"+e+"/"))}),this.replaceTenant(n)},Object.defineProperty(p.prototype,"defaultOpenIdConfigurationEndpoint",{get:function(){return this.authorityType===Gy.Adfs||this.authorityType===Gy.Dsts||this.protocolMode===f_.OIDC?this.canonicalAuthority+".well-known/openid-configuration":this.canonicalAuthority+"v2.0/.well-known/openid-configuration"},enumerable:!1,configurable:!0}),p.prototype.discoveryComplete=function(){return!!this.metadata},p.prototype.resolveEndpointsAsync=function(){var n;return b(this,void 0,void 0,function(){var t,o,r;return C(this,function(e){switch(e.label){case 0:return null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.AuthorityResolveEndpointsAsync,this.correlationId),(t=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort))||(t=new y_).updateCanonicalAuthority(this.canonicalAuthority),null!=(n=this.performanceClient)&&n.setPreQueueTime(A.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId),[4,this.updateCloudDiscoveryMetadata(t)];case 1:return o=e.sent(),this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,t.preferred_network),null!=(n=this.performanceClient)&&n.setPreQueueTime(A.AuthorityUpdateEndpointMetadata,this.correlationId),[4,this.updateEndpointMetadata(t)];case 2:return r=e.sent(),o!==Wg.CACHE&&r!==Wg.CACHE&&(t.resetExpiresAt(),t.updateCanonicalAuthority(this.canonicalAuthority)),r=this.cacheManager.generateAuthorityMetadataCacheKey(t.preferred_cache),this.cacheManager.setAuthorityMetadata(r,t),this.metadata=t,[2]}})})},p.prototype.updateEndpointMetadata=function(r){var n,i,a;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:return(null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.AuthorityUpdateEndpointMetadata,this.correlationId),t=this.getEndpointMetadataFromConfig())?(r.updateEndpointMetadata(t,!1),[2,Wg.CONFIG]):this.isAuthoritySameType(r)&&r.endpointsFromNetwork&&!r.isExpired()?[2,Wg.CACHE]:(null!=(n=this.performanceClient)&&n.setPreQueueTime(A.AuthorityGetEndpointMetadataFromNetwork,this.correlationId),[4,this.getEndpointMetadataFromNetwork()]);case 1:return(t=e.sent())?null!=(n=this.authorityOptions.azureRegionConfiguration)&&n.azureRegion?(null!=(i=this.performanceClient)&&i.setPreQueueTime(A.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),[4,this.updateMetadataWithRegionalInformation(t)]):[3,3]:[3,4];case 2:t=e.sent(),e.label=3;case 3:return r.updateEndpointMetadata(t,!0),[2,Wg.NETWORK];case 4:return!(o=this.getEndpointMetadataFromHardcodedValues())||this.authorityOptions.skipAuthorityMetadataCache?[3,7]:null!=(i=this.authorityOptions.azureRegionConfiguration)&&i.azureRegion?(null!=(a=this.performanceClient)&&a.setPreQueueTime(A.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),[4,this.updateMetadataWithRegionalInformation(o)]):[3,6];case 5:o=e.sent(),e.label=6;case 6:return r.updateEndpointMetadata(o,!1),[2,Wg.HARDCODED_VALUES];case 7:throw I.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint)}})})},p.prototype.isAuthoritySameType=function(e){return new P(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length},p.prototype.getEndpointMetadataFromConfig=function(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch(e){throw Ky.createInvalidAuthorityMetadataError()}return null},p.prototype.getEndpointMetadataFromNetwork=function(){var n;return b(this,void 0,void 0,function(){var o,r;return C(this,function(e){switch(e.label){case 0:null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.AuthorityGetEndpointMetadataFromNetwork,this.correlationId),o={},e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint,o)];case 2:return r=e.sent(),[2,(t=r.body).hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")?r.body:null];case 3:return e.sent(),[2,null];case 4:return[2]}var t})})},p.prototype.getEndpointMetadataFromHardcodedValues=function(){return this.canonicalAuthority in g_?g_[this.canonicalAuthority]:null},p.prototype.updateMetadataWithRegionalInformation=function(o){var r;return b(this,void 0,void 0,function(){var t;return C(this,function(e){switch(e.label){case 0:return(null!=(r=this.performanceClient)&&r.addQueueMeasurement(A.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),t=null==(r=this.authorityOptions.azureRegionConfiguration)?void 0:r.azureRegion)?t!==S.AZURE_REGION_AUTO_DISCOVER_FLAG?(this.regionDiscoveryMetadata.region_outcome=am.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=t,[2,p.replaceWithRegionalInformation(o,t)]):(null!=(r=this.performanceClient)&&r.setPreQueueTime(A.RegionDiscoveryDetectRegion,this.correlationId),[4,this.regionDiscovery.detectRegion(null==(r=this.authorityOptions.azureRegionConfiguration)?void 0:r.environmentRegion,this.regionDiscoveryMetadata)]):[3,2];case 1:if(t=e.sent())return this.regionDiscoveryMetadata.region_outcome=am.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=t,[2,p.replaceWithRegionalInformation(o,t)];this.regionDiscoveryMetadata.region_outcome=am.AUTO_DETECTION_REQUESTED_FAILED,e.label=2;case 2:return[2,o]}})})},p.prototype.updateCloudDiscoveryMetadata=function(r){var n;return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:return(null!=(n=this.performanceClient)&&n.addQueueMeasurement(A.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId),this.logger.verbose("Attempting to get cloud discovery metadata in the config"),this.logger.verbosePii("Known Authorities: "+(this.authorityOptions.knownAuthorities||S.NOT_APPLICABLE)),this.logger.verbosePii("Authority Metadata: "+(this.authorityOptions.authorityMetadata||S.NOT_APPLICABLE)),this.logger.verbosePii("Canonical Authority: "+(r.canonical_authority||S.NOT_APPLICABLE)),t=this.getCloudDiscoveryMetadataFromConfig())?(this.logger.verbose("Found cloud discovery metadata in the config."),r.updateCloudDiscoveryMetadata(t,!1),[2,Wg.CONFIG]):(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache."),o=r.isExpired(),this.isAuthoritySameType(r)&&r.aliasesFromNetwork&&!o?(this.logger.verbose("Found metadata in the cache."),[2,Wg.CACHE]):(o&&this.logger.verbose("The metadata entity is expired."),this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network."),null!=(n=this.performanceClient)&&n.setPreQueueTime(A.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId),[4,this.getCloudDiscoveryMetadataFromNetwork()]));case 1:if(t=e.sent())return this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()"),r.updateCloudDiscoveryMetadata(t,!0),[2,Wg.NETWORK];if(this.logger.verbose("Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values."),(o=this.getCloudDiscoveryMetadataFromHarcodedValues())&&!this.options.skipAuthorityMetadataCache)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),r.updateCloudDiscoveryMetadata(o,!1),[2,Wg.HARDCODED_VALUES];throw this.logger.error("Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error."),Ky.createUntrustedAuthorityError()}})})},p.prototype.getCloudDiscoveryMetadataFromConfig=function(){if(this.authorityType===Gy.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),p.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");var e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),t=p.getCloudDiscoveryMetadataFromNetworkResponse(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),t)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),t;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch(e){throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),Ky.createInvalidCloudDiscoveryMetadataError()}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),p.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null},p.prototype.getCloudDiscoveryMetadataFromNetwork=function(){var c;return b(this,void 0,void 0,function(){var o,r,n,i,a,s;return C(this,function(e){switch(e.label){case 0:null!=(c=this.performanceClient)&&c.addQueueMeasurement(A.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId),o=""+S.AAD_INSTANCE_DISCOVERY_ENDPT+this.canonicalAuthority+"oauth2/v2.0/authorize",r={},n=null,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkInterface.sendGetRequestAsync(o,r)];case 2:if(s=e.sent(),a=i=void 0,(t=s.body).hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata"))i=s.body,a=i.metadata,this.logger.verbosePii("tenant_discovery_endpoint is: "+i.tenant_discovery_endpoint);else{if(!(t=s.body).hasOwnProperty("error")||!t.hasOwnProperty("error_description"))return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),[2,null];if(this.logger.warning("A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: "+s.status),(i=s.body).error===S.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),[2,null];this.logger.warning("The CloudInstanceDiscoveryErrorResponse error is "+i.error),this.logger.warning("The CloudInstanceDiscoveryErrorResponse error description is "+i.error_description),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),a=[]}return this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),n=p.getCloudDiscoveryMetadataFromNetworkResponse(a,this.hostnameAndPort),[3,4];case 3:return(s=e.sent())instanceof T?this.logger.error("There was a network error while attempting to get the cloud discovery instance metadata.\nError: "+s.errorCode+"\nError Description: "+s.errorMessage):this.logger.error("A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\nError: "+s.name+"\nError Description: "+s.message),[2,null];case 4:return n||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),n=p.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),[2,n]}var t})})},p.prototype.getCloudDiscoveryMetadataFromHarcodedValues=function(){return this.canonicalAuthority in m_?m_[this.canonicalAuthority]:null},p.prototype.isInKnownAuthorities=function(){var t=this;return 0<this.authorityOptions.knownAuthorities.filter(function(e){return P.getDomainFromUrl(e).toLowerCase()===t.hostnameAndPort}).length},p.generateAuthority=function(e,t){var o;return t&&t.azureCloudInstance!==yy.None&&(o=t.tenant||S.DEFAULT_COMMON_TENANT,o=t.azureCloudInstance+"/"+o+"/"),o||e},p.createCloudDiscoveryMetadataFromHost=function(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}},p.getCloudDiscoveryMetadataFromNetworkResponse=function(e,t){for(var o=0;o<e.length;o++){var r=e[o];if(-1<r.aliases.indexOf(t))return r}return null},p.prototype.getPreferredCache=function(){if(this.discoveryComplete())return this.metadata.preferred_cache;throw I.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},p.prototype.isAlias=function(e){return-1<this.metadata.aliases.indexOf(e)},p.isPublicCloudAuthority=function(e){return 0<=S.KNOWN_PUBLIC_CLOUDS.indexOf(e)},p.buildRegionalAuthorityString=function(e,t,o){var e=new P(e),r=(e.validateAsUri(),e.getUrlComponents()),n=t+"."+r.HostNameAndPort,r=(this.isPublicCloudAuthority(r.HostNameAndPort)&&(n=t+"."+S.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX),P.constructAuthorityUriFromObject(Lg(Lg({},e.getUrlComponents()),{HostNameAndPort:n})).urlString);return o?r+"?"+o:r},p.replaceWithRegionalInformation=function(e,t){return e.authorization_endpoint=p.buildRegionalAuthorityString(e.authorization_endpoint,t),e.token_endpoint=p.buildRegionalAuthorityString(e.token_endpoint,t,S.REGIONAL_AUTH_NON_MSI_QUERY_STRING),e.end_session_endpoint&&(e.end_session_endpoint=p.buildRegionalAuthorityString(e.end_session_endpoint,t)),e},p.transformCIAMAuthority=function(e){var t=e.endsWith(S.FORWARD_SLASH)?e:""+e+S.FORWARD_SLASH,e=new P(e).getUrlComponents();return t=0===e.PathSegments.length&&e.HostNameAndPort.endsWith(S.CIAM_AUTH_URL)?""+t+e.HostNameAndPort.split(".")[0]+S.AAD_TENANT_DOMAIN_SUFFIX:t},p.reservedTenantDomains=new Set(["{tenant}","{tenantid}",jg.COMMON,jg.CONSUMERS,jg.ORGANIZATIONS]);var b_=p;function p(e,t,o,r,n,i,a){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=t,this.cacheManager=o,this.authorityOptions=r,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=n,this.performanceClient=i,this.correlationId=a,this.regionDiscovery=new __(t,this.performanceClient,this.correlationId)}E_.createDiscoveredInstance=function(r,n,i,a,s,c,u){return b(this,void 0,void 0,function(){var t,o;return C(this,function(e){switch(e.label){case 0:null!=c&&c.addQueueMeasurement(A.AuthorityFactoryCreateDiscoveredInstance,u),t=b_.transformCIAMAuthority(r),t=E_.createInstance(t,n,i,a,s,c,u),e.label=1;case 1:return e.trys.push([1,3,,4]),null!=c&&c.setPreQueueTime(A.AuthorityResolveEndpointsAsync,u),[4,t.resolveEndpointsAsync()];case 2:return e.sent(),[2,t];case 3:throw o=e.sent(),I.createEndpointDiscoveryIncompleteError(o);case 4:return[2]}})})},E_.createInstance=function(e,t,o,r,n,i,a){if(k.isEmpty(e))throw Ky.createUrlEmptyError();return new b_(e,t,o,r,n,i,a)};var C_=E_;function E_(){}T_.isServerTelemetryEntity=function(e,t){var e=0===e.indexOf(om.CACHE_KEY),o=!0;return t&&(o=t.hasOwnProperty("failedRequests")&&t.hasOwnProperty("errors")&&t.hasOwnProperty("cacheHits")),e&&o};var S_=T_;function T_(){this.failedRequests=[],this.errors=[],this.cacheHits=0}k_.isThrottlingEntity=function(e,t){var o=!1,e=(e&&(o=0===e.indexOf(hm)),!0);return t&&(e=t.hasOwnProperty("throttleTime")),o&&e};var I_=k_;function k_(){}var A_,P_={sendGetRequestAsync:function(){return Promise.reject(T.createUnexpectedError("Network interface - sendGetRequestAsync() has not been implemented for the Network interface."))},sendPostRequestAsync:function(){return Promise.reject(T.createUnexpectedError("Network interface - sendPostRequestAsync() has not been implemented for the Network interface."))}},O_={code:"missing_kid_error",desc:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided."},R_={code:"missing_alg_error",desc:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."},x_=(Ng(M_,A_=T),M_.createMissingKidError=function(){return new M_(O_.code,O_.desc)},M_.createMissingAlgError=function(){return new M_(R_.code,R_.desc)},M_);function M_(e,t){e=A_.call(this,e,t)||this;return e.name="JoseHeaderError",Object.setPrototypeOf(e,M_.prototype),e}L_.getShrHeaderString=function(e){if(!e.kid)throw x_.createMissingKidError();if(e.alg)return e=new L_({typ:e.typ||cm.Pop,kid:e.kid,alg:e.alg}),JSON.stringify(e);throw x_.createMissingAlgError()};var N_=L_;function L_(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}q_.prototype.generateCurrentRequestHeaderValue=function(){var e=""+this.apiId+om.VALUE_SEPARATOR+this.cacheOutcome,t=[this.wrapperSKU,this.wrapperVer].join(om.VALUE_SEPARATOR),e=[e,this.getRegionDiscoveryFields()].join(om.VALUE_SEPARATOR);return[om.SCHEMA_VERSION,e,t].join(om.CATEGORY_SEPARATOR)},q_.prototype.generateLastRequestHeaderValue=function(){var e=this.getLastRequests(),t=q_.maxErrorsToSend(e),o=e.failedRequests.slice(0,2*t).join(om.VALUE_SEPARATOR),r=e.errors.slice(0,t).join(om.VALUE_SEPARATOR),n=e.errors.length,t=[n,t<n?om.OVERFLOW_TRUE:om.OVERFLOW_FALSE].join(om.VALUE_SEPARATOR);return[om.SCHEMA_VERSION,e.cacheHits,o,r,t].join(om.CATEGORY_SEPARATOR)},q_.prototype.cacheFailedRequest=function(e){var t=this.getLastRequests();t.errors.length>=om.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),k.isEmpty(e.subError)?k.isEmpty(e.errorCode)?e&&e.toString()?t.errors.push(e.toString()):t.errors.push(om.UNKNOWN_ERROR):t.errors.push(e.errorCode):t.errors.push(e.subError),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)},q_.prototype.incrementCacheHits=function(){var e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits},q_.prototype.getLastRequests=function(){var e=new S_;return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e},q_.prototype.clearTelemetryCache=function(){var e,t=this.getLastRequests(),o=q_.maxErrorsToSend(t);o===t.errors.length?this.cacheManager.removeItem(this.telemetryCacheKey):((e=new S_).failedRequests=t.failedRequests.slice(2*o),e.errors=t.errors.slice(o),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e))},q_.maxErrorsToSend=function(e){for(var t=0,o=0,r=e.errors.length,n=0;n<r;n++){var i=e.failedRequests[2*n]||S.EMPTY_STRING,a=e.failedRequests[2*n+1]||S.EMPTY_STRING,s=e.errors[n]||S.EMPTY_STRING;if(!((o+=i.toString().length+a.toString().length+s.length+3)<om.MAX_LAST_HEADER_BYTES))break;t+=1}return t},q_.prototype.getRegionDiscoveryFields=function(){var e=[];return e.push(this.regionUsed||S.EMPTY_STRING),e.push(this.regionSource||S.EMPTY_STRING),e.push(this.regionOutcome||S.EMPTY_STRING),e.join(",")},q_.prototype.updateRegionDiscoveryMetadata=function(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome},q_.prototype.setCacheOutcome=function(e){this.cacheOutcome=e};var D_=q_;function q_(e,t){this.cacheOutcome=sm.NO_CACHE_HIT,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||S.EMPTY_STRING,this.wrapperVer=e.wrapperVer||S.EMPTY_STRING,this.telemetryCacheKey=om.CACHE_KEY+Gg.CACHE_KEY_SEPARATOR+e.clientId}U_.prototype.startPerformanceMeasurement=function(e,t){return{}},U_.prototype.startPerformanceMeasuremeant=function(e,t){return{}},U_.prototype.getIntFields=function(){return Vv},U_.prototype.getPreQueueTime=function(e,t){var o=this.preQueueTimeByCorrelationId.get(t);if(o){if(o.name===e)return o.time;this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue time found for "+e+", unable to add queue measurement")}else this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: "+t+", unable to add queue measurement")},U_.prototype.calculateQueuedTime=function(e,t){return e<1?(this.logger.trace("PerformanceClient: preQueueTime should be a positive integer and not "+e),0):t<1?(this.logger.trace("PerformanceClient: currentTime should be a positive integer and not "+t),0):t<e?(this.logger.trace("PerformanceClient: currentTime is less than preQueueTime, check how time is being retrieved"),0):t-e},U_.prototype.addQueueMeasurement=function(e,t,o,r){if(t){if(0===o)this.logger.trace("PerformanceClient.addQueueMeasurement: queue time provided for "+e+" is "+o);else if(!o)return void this.logger.trace("PerformanceClient.addQueueMeasurement: no queue time provided for "+e);o={eventName:e,queueTime:o,manuallyCompleted:r},r=this.queueMeasurements.get(t);r?(r.push(o),this.queueMeasurements.set(t,r)):(this.logger.trace("PerformanceClient.addQueueMeasurement: adding correlationId "+t+" to queue measurements"),this.queueMeasurements.set(t,[o])),this.preQueueTimeByCorrelationId.delete(t)}else this.logger.trace("PerformanceClient.addQueueMeasurement: correlationId not provided for "+e+", cannot add queue measurement")},U_.prototype.startMeasurement=function(e,t){var o=this,r=t||this.generateId(),n=(t||this.logger.info("PerformanceClient: No correlation id provided for "+e+", generating",r),this.logger.trace("PerformanceClient: Performance measurement started for "+e,r),this.startPerformanceMeasuremeant(e,r)),i=(n.startMeasurement(),{eventId:this.generateId(),status:Wv.InProgress,authority:this.authority,libraryName:this.libraryName,libraryVersion:this.libraryVersion,clientId:this.clientId,name:e,startTimeMs:Date.now(),correlationId:r,appName:null==(t=this.applicationTelemetry)?void 0:t.appName,appVersion:null==(e=this.applicationTelemetry)?void 0:e.appVersion});return this.cacheEventByCorrelationId(i),{endMeasurement:function(e){return o.endMeasurement(Lg(Lg({},i),e),n)},discardMeasurement:function(){return o.discardMeasurements(i.correlationId)},addStaticFields:function(e){return o.addStaticFields(e,i.correlationId)},increment:function(e){return o.increment(e,i.correlationId)},measurement:n,event:i}},U_.prototype.endMeasurement=function(t,e){var o,r,n,i,a,s=this,c=this.eventsByCorrelationId.get(t.correlationId);return c?(r={totalQueueTime:0,totalQueueCount:0,manuallyCompletedCount:0},(o=t.eventId===c.eventId)?(r=this.getQueueInfo(t.correlationId),this.discardCache(c.correlationId)):null!=(n=c.incompleteSubMeasurements)&&n.delete(t.eventId),null!=e&&e.endMeasurement(),(n=null==e?void 0:e.flushMeasurement())?(this.logger.trace("PerformanceClient: Performance measurement ended for "+t.name+": "+n+" ms",t.correlationId),o?(i=Lg(Lg({},c),t),a=0,null!=(e=i.incompleteSubMeasurements)&&e.forEach(function(e){s.logger.trace("PerformanceClient: Incomplete submeasurement "+e.name+" found for "+t.name,i.correlationId),a++}),i.incompleteSubMeasurements=void 0,i=Lg(Lg({},i),{durationMs:Math.round(n),queuedTimeMs:r.totalQueueTime,queuedCount:r.totalQueueCount,queuedManuallyCompletedCount:r.manuallyCompletedCount,status:Wv.Completed,incompleteSubsCount:a}),this.truncateIntegralFields(i,this.getIntFields()),this.emitEvents([i],t.correlationId),i):(c[t.name+"DurationMs"]=Math.floor(n),Lg({},c))):(this.logger.trace("PerformanceClient: Performance measurement not taken",c.correlationId),null)):(this.logger.trace("PerformanceClient: Measurement not found for "+t.eventId,t.correlationId),null)},U_.prototype.addStaticFields=function(e,t){this.logger.trace("PerformanceClient: Updating static fields");var o=this.eventsByCorrelationId.get(t);o?this.eventsByCorrelationId.set(t,Lg(Lg({},o),e)):this.logger.trace("PerformanceClient: Event not found for",t)},U_.prototype.increment=function(e,t){this.logger.trace("PerformanceClient: Updating counters");var o=this.eventsByCorrelationId.get(t);if(o)for(var r in e)o.hasOwnProperty(r)||(o[r]=0),o[r]+=e[r];else this.logger.trace("PerformanceClient: Event not found for",t)},U_.prototype.cacheEventByCorrelationId=function(e){var t=this.eventsByCorrelationId.get(e.correlationId);t?(this.logger.trace("PerformanceClient: Performance measurement for "+e.name+" added/updated",e.correlationId),t.incompleteSubMeasurements=t.incompleteSubMeasurements||new Map,t.incompleteSubMeasurements.set(e.eventId,{name:e.name,startTimeMs:e.startTimeMs})):(this.logger.trace("PerformanceClient: Performance measurement for "+e.name+" started",e.correlationId),this.eventsByCorrelationId.set(e.correlationId,Lg({},e)))},U_.prototype.getQueueInfo=function(e){var t=this.queueMeasurements.get(e),o=(t||this.logger.trace("PerformanceClient: no queue measurements found for for correlationId: "+e),0),r=0,n=0;return null!=t&&t.forEach(function(e){o+=e.queueTime,r++,n+=e.manuallyCompleted?1:0}),{totalQueueTime:o,totalQueueCount:r,manuallyCompletedCount:n}},U_.prototype.discardMeasurements=function(e){this.logger.trace("PerformanceClient: Performance measurements discarded",e),this.eventsByCorrelationId.delete(e)},U_.prototype.discardCache=function(e){this.discardMeasurements(e),this.logger.trace("PerformanceClient: QueueMeasurements discarded",e),this.queueMeasurements.delete(e),this.logger.trace("PerformanceClient: Pre-queue times discarded",e),this.preQueueTimeByCorrelationId.delete(e)},U_.prototype.addPerformanceCallback=function(e){var t=this.generateId();return this.callbacks.set(t,e),this.logger.verbose("PerformanceClient: Performance callback registered with id: "+t),t},U_.prototype.removePerformanceCallback=function(e){var t=this.callbacks.delete(e);return t?this.logger.verbose("PerformanceClient: Performance callback "+e+" removed."):this.logger.verbose("PerformanceClient: Performance callback "+e+" not removed."),t},U_.prototype.emitEvents=function(o,r){var n=this;this.logger.verbose("PerformanceClient: Emitting performance events",r),this.callbacks.forEach(function(e,t){n.logger.trace("PerformanceClient: Emitting event to callback "+t,r),e.apply(null,[o])})},U_.prototype.truncateIntegralFields=function(t,e){e.forEach(function(e){e in t&&"number"==typeof t[e]&&(t[e]=Math.floor(t[e]))})};ir=U_;function U_(e,t,o,r,n,i){this.authority=t,this.libraryName=r,this.libraryVersion=n,this.applicationTelemetry=i,this.clientId=e,this.logger=o,this.callbacks=new Map,this.eventsByCorrelationId=new Map,this.queueMeasurements=new Map,this.preQueueTimeByCorrelationId=new Map}H_.prototype.startMeasurement=function(){},H_.prototype.endMeasurement=function(){},H_.prototype.flushMeasurement=function(){return null};var j_=H_;function H_(){}Ng(z_,B_=ir),z_.prototype.generateId=function(){return"callback-id"},z_.prototype.startPerformanceMeasuremeant=function(){return new j_},z_.prototype.startPerformanceMeasurement=function(){return new j_},z_.prototype.calculateQueuedTime=function(e,t){return 0},z_.prototype.addQueueMeasurement=function(e,t,o){},z_.prototype.setPreQueueTime=function(e,t){};var B_,F_=z_;function z_(){return null!==B_&&B_.apply(this,arguments)||this}var K_,G_={code:"pkce_not_created",desc:"The PKCE code challenge and verifier could not be generated."},Y_={code:"crypto_nonexistent",desc:"The crypto object or function is not available."},W_={code:"http_method_not_implemented",desc:"The HTTP method given has not been implemented in this library."},Z_={code:"empty_navigate_uri",desc:"Navigation URI is empty. Please check stack trace for more info."},Q_={code:"hash_empty_error",desc:"Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. For more visit: aka.ms/msaljs/browser-errors."},V_={code:"no_state_in_hash",desc:"Hash does not contain state. Please verify that the request originated from msal."},J_={code:"hash_does_not_contain_known_properties",desc:"Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. For more visit: aka.ms/msaljs/browser-errors."},X_={code:"unable_to_parse_state",desc:"Unable to parse state. Please verify that the request originated from msal."},$_={code:"state_interaction_type_mismatch",desc:"Hash contains state but the interaction type does not match the caller."},ew={code:"interaction_in_progress",desc:"Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. For more visit: aka.ms/msaljs/browser-errors."},tw={code:"popup_window_error",desc:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."},ow={code:"empty_window_error",desc:"window.open returned null or undefined window object."},rw={code:"user_cancelled",desc:"User cancelled the flow."},nw={code:"monitor_window_timeout",desc:"Token acquisition in popup failed due to timeout. For more visit: aka.ms/msaljs/browser-errors."},iw={code:"monitor_window_timeout",desc:"Token acquisition in iframe failed due to timeout. For more visit: aka.ms/msaljs/browser-errors."},aw={code:"redirect_in_iframe",desc:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs."},sw={code:"block_iframe_reload",desc:"Request was blocked inside an iframe because MSAL detected an authentication response. For more visit: aka.ms/msaljs/browser-errors"},cw={code:"block_nested_popups",desc:"Request was blocked inside a popup because MSAL detected it was running in a popup."},uw={code:"iframe_closed_prematurely",desc:"The iframe being monitored was closed prematurely."},lw={code:"silent_logout_unsupported",desc:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead."},hw={code:"no_account_error",desc:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request."},dw={code:"silent_prompt_value_error",desc:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'."},pw={code:"no_token_request_cache_error",desc:"No token request found in cache."},fw={code:"unable_to_parse_token_request_cache_error",desc:"The cached token request could not be parsed."},gw={code:"no_cached_authority_error",desc:"No cached authority found."},mw={code:"auth_request_not_set_error",desc:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler"},yw={code:"invalid_cache_type",desc:"Invalid cache type"},vw={code:"non_browser_environment",desc:"Login and token requests are not supported in non-browser environments."},_w={code:"database_not_open",desc:"Database is not open!"},ww={code:"no_network_connectivity",desc:"No network connectivity. Check your internet connection."},bw={code:"post_request_failed",desc:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'"},Cw={code:"get_request_failed",desc:"Network request failed. Please check the network trace to determine root cause."},Ew={code:"failed_to_parse_response",desc:"Failed to parse network response. Check network trace."},Sw={code:"unable_to_load_token",desc:"Error loading token to cache."},Tw={code:"crypto_key_not_found",desc:"Cryptographic Key or Keypair not found in browser storage."},Iw={code:"auth_code_required",desc:"An authorization code must be provided (as the `code` property on the request) to this flow."},kw={code:"auth_code_or_nativeAccountId_required",desc:"An authorization code or nativeAccountId must be provided to this flow."},Aw={code:"spa_code_and_nativeAccountId_present",desc:"Request cannot contain both spa code and native account id."},Pw={code:"database_unavailable",desc:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts."},Ow={code:"unable_to_acquire_token_from_native_platform",desc:"Unable to acquire token from native platform. For a list of possible reasons visit aka.ms/msaljs/browser-errors."},Rw={code:"native_handshake_timeout",desc:"Timed out while attempting to establish connection to browser extension"},xw={code:"native_extension_not_installed",desc:"Native extension is not installed. If you think this is a mistake call the initialize function."},Mw={code:"native_connection_not_established",desc:"Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). For more please visit aka.ms/msaljs/browser-errors."},Nw={code:"native_broker_called_before_initialize",desc:"You must call and await the initialize function before attempting to call any other MSAL API when native brokering is enabled. For more please visit aka.ms/msaljs/browser-errors."},Lw={code:"native_prompt_not_supported",desc:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow."},O=(Og(g,K_=T),g.createPkceNotGeneratedError=function(e){return new g(G_.code,G_.desc+" Detail:"+e)},g.createCryptoNotAvailableError=function(e){return new g(Y_.code,Y_.desc+" Detail:"+e)},g.createHttpMethodNotImplementedError=function(e){return new g(W_.code,W_.desc+" Given Method: "+e)},g.createEmptyNavigationUriError=function(){return new g(Z_.code,Z_.desc)},g.createEmptyHashError=function(e){return new g(Q_.code,Q_.desc+" Given Url: "+e)},g.createHashDoesNotContainStateError=function(){return new g(V_.code,V_.desc)},g.createHashDoesNotContainKnownPropertiesError=function(){return new g(J_.code,J_.desc)},g.createUnableToParseStateError=function(){return new g(X_.code,X_.desc)},g.createStateInteractionTypeMismatchError=function(){return new g($_.code,$_.desc)},g.createInteractionInProgressError=function(){return new g(ew.code,ew.desc)},g.createPopupWindowError=function(e){var t=tw.desc,t=k.isEmpty(e)?t:t+" Details: "+e;return new g(tw.code,t)},g.createEmptyWindowCreatedError=function(){return new g(ow.code,ow.desc)},g.createUserCancelledError=function(){return new g(rw.code,rw.desc)},g.createMonitorPopupTimeoutError=function(){return new g(nw.code,nw.desc)},g.createMonitorIframeTimeoutError=function(){return new g(iw.code,iw.desc)},g.createRedirectInIframeError=function(e){return new g(aw.code,aw.desc+" (window.parent !== window) => "+e)},g.createBlockReloadInHiddenIframeError=function(){return new g(sw.code,sw.desc)},g.createBlockAcquireTokenInPopupsError=function(){return new g(cw.code,cw.desc)},g.createIframeClosedPrematurelyError=function(){return new g(uw.code,uw.desc)},g.createSilentLogoutUnsupportedError=function(){return new g(lw.code,lw.desc)},g.createNoAccountError=function(){return new g(hw.code,hw.desc)},g.createSilentPromptValueError=function(e){return new g(dw.code,dw.desc+" Given value: "+e)},g.createUnableToParseTokenRequestCacheError=function(){return new g(fw.code,fw.desc)},g.createNoTokenRequestCacheError=function(){return new g(pw.code,pw.desc)},g.createAuthRequestNotSetError=function(){return new g(mw.code,mw.desc)},g.createNoCachedAuthorityError=function(){return new g(gw.code,gw.desc)},g.createInvalidCacheTypeError=function(){return new g(yw.code,""+yw.desc)},g.createNonBrowserEnvironmentError=function(){return new g(vw.code,vw.desc)},g.createDatabaseNotOpenError=function(){return new g(_w.code,_w.desc)},g.createNoNetworkConnectivityError=function(){return new g(ww.code,ww.desc)},g.createPostRequestFailedError=function(e,t){return new g(bw.code,bw.desc+" | Network client threw: "+e+" | Attempted to reach: "+t.split("?")[0])},g.createGetRequestFailedError=function(e,t){return new g(Cw.code,Cw.desc+" | Network client threw: "+e+" | Attempted to reach: "+t.split("?")[0])},g.createFailedToParseNetworkResponseError=function(e){return new g(Ew.code,Ew.desc+" | Attempted to reach: "+e.split("?")[0])},g.createUnableToLoadTokenError=function(e){return new g(Sw.code,Sw.desc+" | "+e)},g.createSigningKeyNotFoundInStorageError=function(e){return new g(Tw.code,Tw.desc+" | No match found for KeyId: "+e)},g.createAuthCodeRequiredError=function(){return new g(Iw.code,Iw.desc)},g.createAuthCodeOrNativeAccountIdRequiredError=function(){return new g(kw.code,kw.desc)},g.createSpaCodeAndNativeAccountIdPresentError=function(){return new g(Aw.code,Aw.desc)},g.createDatabaseUnavailableError=function(){return new g(Pw.code,Pw.desc)},g.createUnableToAcquireTokenFromNativePlatformError=function(){return new g(Ow.code,Ow.desc)},g.createNativeHandshakeTimeoutError=function(){return new g(Rw.code,Rw.desc)},g.createNativeExtensionNotInstalledError=function(){return new g(xw.code,xw.desc)},g.createNativeConnectionNotEstablishedError=function(){return new g(Mw.code,Mw.desc)},g.createNativeBrokerCalledBeforeInitialize=function(){return new g(Nw.code,Nw.desc)},g.createNativePromptParameterNotSupportedError=function(){return new g(Lw.code,Lw.desc)},g);function g(e,t){e=K_.call(this,e,t)||this;return Object.setPrototypeOf(e,g.prototype),e.name="BrowserAuthError",e}var Dw,qw,Uw,jw,Hw,Bw,Fw,R,un,zw,Kw={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},Gw="53ee284d-920a-4b59-9d30-a60315b26836",Yw="ppnbnpeolgkicgegkbkbjmhlideopiji",Ww="MATS",Zw=((Uo=Dw=Dw||{}).HandshakeRequest="Handshake",Uo.HandshakeResponse="HandshakeResponse",Uo.GetToken="GetToken",Uo.Response="Response",(hi=qw=qw||{}).LocalStorage="localStorage",hi.SessionStorage="sessionStorage",hi.MemoryStorage="memoryStorage",(i=Uw=Uw||{}).GET="GET",i.POST="POST",(be=jw=jw||{}).AUTHORITY="authority",be.ACQUIRE_TOKEN_ACCOUNT="acquireToken.account",be.SESSION_STATE="session.state",be.REQUEST_STATE="request.state",be.NONCE_IDTOKEN="nonce.id_token",be.ORIGIN_URI="request.origin",be.RENEW_STATUS="token.renew.status",be.URL_HASH="urlHash",be.REQUEST_PARAMS="request.params",be.SCOPES="scopes",be.INTERACTION_STATUS_KEY="interaction.status",be.CCS_CREDENTIAL="ccs.credential",be.CORRELATION_ID="request.correlationId",be.NATIVE_REQUEST="request.native",be.REDIRECT_CONTEXT="request.redirect.context",(Mi=Hw=Hw||{}).ACCOUNT_KEYS="msal.account.keys",Mi.TOKEN_KEYS="msal.token.keys",(cn=Bw=Bw||{}).WRAPPER_SKU="wrapper.sku",cn.WRAPPER_VER="wrapper.version",(o=Fw=Fw||{})[o.acquireTokenRedirect=861]="acquireTokenRedirect",o[o.acquireTokenPopup=862]="acquireTokenPopup",o[o.ssoSilent=863]="ssoSilent",o[o.acquireTokenSilent_authCode=864]="acquireTokenSilent_authCode",o[o.handleRedirectPromise=865]="handleRedirectPromise",o[o.acquireTokenByCode=866]="acquireTokenByCode",o[o.acquireTokenSilent_silentFlow=61]="acquireTokenSilent_silentFlow",o[o.logout=961]="logout",o[o.logoutPopup=962]="logoutPopup",(un=R=R||{}).Redirect="redirect",un.Popup="popup",un.Silent="silent",un.None="none",0,{scopes:Qg}),Qw="jwk",Vw=(0,"msal.db");(r=zw=zw||{})[r.Default=0]="Default",r[r.AccessToken=1]="AccessToken",r[r.AccessTokenAndRefreshToken=2]="AccessTokenAndRefreshToken",r[r.RefreshToken=3]="RefreshToken",r[r.RefreshTokenAndNetwork=4]="RefreshTokenAndNetwork",r[r.Skip=5]="Skip";var Jw,Xw={code:"redirect_uri_empty",desc:"A redirect URI is required for all calls, and none has been set."},$w={code:"post_logout_uri_empty",desc:"A post logout redirect has not been set."},e0={code:"storage_not_supported",desc:"Given storage configuration option was not supported."},t0={code:"no_redirect_callbacks",desc:"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},o0={code:"stubbed_public_client_application_called",desc:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors"},r0={code:"in_mem_redirect_unavailable",desc:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."},n0={code:"entropy_not_provided",desc:"The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option."},i0=(Og(a0,Jw=T),a0.createRedirectUriEmptyError=function(){return new a0(Xw.code,Xw.desc)},a0.createPostLogoutRedirectUriEmptyError=function(){return new a0($w.code,$w.desc)},a0.createStorageNotSupportedError=function(e){return new a0(e0.code,e0.desc+" Given Location: "+e)},a0.createRedirectCallbacksNotSetError=function(){return new a0(t0.code,t0.desc)},a0.createStubPcaInstanceCalledError=function(){return new a0(o0.code,o0.desc)},a0.createInMemoryRedirectUnavailableError=function(){return new a0(r0.code,r0.desc)},a0.createEntropyNotProvided=function(){return new a0(n0.code,n0.desc)},a0);function a0(e,t){e=Jw.call(this,e,t)||this;return e.name="BrowserConfigurationAuthError",Object.setPrototypeOf(e,a0.prototype),e}c0.prototype.validateWindowStorage=function(e){if(e!==qw.LocalStorage&&e!==qw.SessionStorage)throw i0.createStorageNotSupportedError(e);if(!!!window[e])throw i0.createStorageNotSupportedError(e)},c0.prototype.getItem=function(e){return this.windowStorage.getItem(e)},c0.prototype.setItem=function(e,t){this.windowStorage.setItem(e,t)},c0.prototype.removeItem=function(e){this.windowStorage.removeItem(e)},c0.prototype.getKeys=function(){return Object.keys(this.windowStorage)},c0.prototype.containsKey=function(e){return this.windowStorage.hasOwnProperty(e)};var s0=c0;function c0(e){this.validateWindowStorage(e),this.windowStorage=window[e]}l0.prototype.getItem=function(e){return this.cache.get(e)||null},l0.prototype.setItem=function(e,t){this.cache.set(e,t)},l0.prototype.removeItem=function(e){this.cache.delete(e)},l0.prototype.getKeys=function(){var o=[];return this.cache.forEach(function(e,t){o.push(t)}),o},l0.prototype.containsKey=function(e){return this.cache.has(e)},l0.prototype.clear=function(){this.cache.clear()};var u0=l0;function l0(){this.cache=new Map}d0.extractBrowserRequestState=function(e,t){if(k.isEmpty(t))return null;try{return Gv.parseRequestState(e,t).libraryState.meta}catch(e){throw I.createInvalidStateError(t,e)}},d0.parseServerResponseFromHash=function(e){return e?(e=new P(e),P.getDeserializedHash(e.getHash())):{}};var h0=d0;function d0(){}Og(m,p0=ev),m.prototype.setupBrowserStorage=function(e){switch(e){case qw.LocalStorage:case qw.SessionStorage:try{return new s0(e)}catch(e){this.logger.verbose(e);break}}return this.cacheConfig.cacheLocation=qw.MemoryStorage,new u0},m.prototype.setupTemporaryCacheStorage=function(e,t){switch(t){case qw.LocalStorage:case qw.SessionStorage:try{return new s0(e||qw.SessionStorage)}catch(e){return this.logger.verbose(e),this.internalStorage}case qw.MemoryStorage:default:return this.internalStorage}},m.prototype.migrateCacheEntries=function(){var o=this,e=S.CACHE_PREFIX+"."+Ug.ID_TOKEN,t=S.CACHE_PREFIX+"."+Ug.CLIENT_INFO,r=S.CACHE_PREFIX+"."+Ug.ERROR,n=S.CACHE_PREFIX+"."+Ug.ERROR_DESC,i=[this.browserStorage.getItem(e),this.browserStorage.getItem(t),this.browserStorage.getItem(r),this.browserStorage.getItem(n)];[Ug.ID_TOKEN,Ug.CLIENT_INFO,Ug.ERROR,Ug.ERROR_DESC].forEach(function(e,t){return o.migrateCacheEntry(e,i[t])})},m.prototype.migrateCacheEntry=function(e,t){t&&this.setTemporaryCache(e,t,!0)},m.prototype.createKeyMaps=function(){var i=this,e=(this.logger.trace("BrowserCacheManager - createKeyMaps called."),this.getItem(Hw.ACCOUNT_KEYS)),t=this.getItem(Hw.TOKEN_KEYS+"."+this.clientId);e&&t?this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration."):this.browserStorage.getKeys().forEach(function(e){var t;if(i.isCredentialKey(e)&&(t=i.getItem(e))){var o,r,n=i.validateAndParseJson(t);if(n&&n.hasOwnProperty("credentialType"))switch(n.credentialType){case E.ID_TOKEN:if(kv.isIdTokenEntity(n))return i.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),i.logger.tracePii("BrowserCacheManager:createKeyMaps - idToken with key: "+e+" found, saving key to token key map"),r=ev.toObject(new kv,n),r=i.updateCredentialCacheKey(e,r),void i.addTokenKey(r,E.ID_TOKEN);i.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),i.logger.tracePii("BrowserCacheManager:createKeyMaps - failed idToken validation on key: "+e);break;case E.ACCESS_TOKEN:case E.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(xv.isAccessTokenEntity(n))return i.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),i.logger.tracePii("BrowserCacheManager:createKeyMaps - accessToken with key: "+e+" found, saving key to token key map"),o=ev.toObject(new xv,n),r=i.updateCredentialCacheKey(e,o),void i.addTokenKey(r,E.ACCESS_TOKEN);i.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),i.logger.tracePii("BrowserCacheManager:createKeyMaps - failed accessToken validation on key: "+e);break;case E.REFRESH_TOKEN:if(Lv.isRefreshTokenEntity(n))return i.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),i.logger.tracePii("BrowserCacheManager:createKeyMaps - refreshToken with key: "+e+" found, saving key to token key map"),o=ev.toObject(new Lv,n),r=i.updateCredentialCacheKey(e,o),void i.addTokenKey(r,E.REFRESH_TOKEN);i.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),i.logger.tracePii("BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: "+e)}}i.isAccountKey(e)&&(t=i.getItem(e))&&(t=i.validateAndParseJson(t))&&Vy.isAccountEntity(t)&&(i.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),i.logger.tracePii("BrowserCacheManager:createKeyMaps - account with key: "+e+" found, saving key to account key map"),i.addAccountKeyToMap(e))})},m.prototype.validateAndParseJson=function(e){try{var t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}},m.prototype.getItem=function(e){return this.browserStorage.getItem(e)},m.prototype.setItem=function(e,t){this.browserStorage.setItem(e,t)},m.prototype.getAccount=function(e){this.logger.trace("BrowserCacheManager.getAccount called");var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&Vy.isAccountEntity(t)?ev.toObject(new Vy,t):(this.removeAccountKeyFromMap(e),null)},m.prototype.setAccount=function(e){this.logger.trace("BrowserCacheManager.setAccount called");var t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)},m.prototype.getAccountKeys=function(){this.logger.trace("BrowserCacheManager.getAccountKeys called");var e=this.getItem(Hw.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])},m.prototype.addAccountKeyToMap=function(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii("BrowserCacheManager.addAccountKeyToMap called with key: "+e);var t=this.getAccountKeys();-1===t.indexOf(e)?(t.push(e),this.setItem(Hw.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")},m.prototype.removeAccountKeyFromMap=function(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii("BrowserCacheManager.removeAccountKeyFromMap called with key: "+e);var t=this.getAccountKeys(),e=t.indexOf(e);-1<e?(t.splice(e,1),this.setItem(Hw.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")},m.prototype.removeAccount=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return p0.prototype.removeAccount.call(this,t),this.removeAccountKeyFromMap(t),[2]})})},m.prototype.removeIdToken=function(e){p0.prototype.removeIdToken.call(this,e),this.removeTokenKey(e,E.ID_TOKEN)},m.prototype.removeAccessToken=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return p0.prototype.removeAccessToken.call(this,t),this.removeTokenKey(t,E.ACCESS_TOKEN),[2]})})},m.prototype.removeRefreshToken=function(e){p0.prototype.removeRefreshToken.call(this,e),this.removeTokenKey(e,E.REFRESH_TOKEN)},m.prototype.getTokenKeys=function(){this.logger.trace("BrowserCacheManager.getTokenKeys called");var e=this.getItem(Hw.TOKEN_KEYS+"."+this.clientId);if(e){e=this.validateAndParseJson(e);if(e&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("accessToken")&&e.hasOwnProperty("refreshToken"))return e;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}},m.prototype.addTokenKey=function(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");var o=this.getTokenKeys();switch(t){case E.ID_TOKEN:-1===o.idToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),o.idToken.push(e));break;case E.ACCESS_TOKEN:-1===o.accessToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),o.accessToken.push(e));break;case E.REFRESH_TOKEN:-1===o.refreshToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),o.refreshToken.push(e));break;default:this.logger.error("BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: "+t),I.createUnexpectedCredentialTypeError()}this.setItem(Hw.TOKEN_KEYS+"."+this.clientId,JSON.stringify(o))},m.prototype.removeTokenKey=function(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");var o=this.getTokenKeys();switch(t){case E.ID_TOKEN:this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: "+e+" from map");var r=o.idToken.indexOf(e);-1<r?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),o.idToken.splice(r,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case E.ACCESS_TOKEN:this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: "+e+" from map");r=o.accessToken.indexOf(e);-1<r?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),o.accessToken.splice(r,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case E.REFRESH_TOKEN:this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: "+e+" from map");r=o.refreshToken.indexOf(e);-1<r?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),o.refreshToken.splice(r,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:this.logger.error("BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: "+t),I.createUnexpectedCredentialTypeError()}this.setItem(Hw.TOKEN_KEYS+"."+this.clientId,JSON.stringify(o))},m.prototype.getIdTokenCredential=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&kv.isIdTokenEntity(t)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),ev.toObject(new kv,t)):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.ID_TOKEN),null)},m.prototype.setIdTokenCredential=function(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");var t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,E.ID_TOKEN)},m.prototype.getAccessTokenCredential=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&xv.isAccessTokenEntity(t)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),ev.toObject(new xv,t)):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.ACCESS_TOKEN),null)},m.prototype.setAccessTokenCredential=function(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");var t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,E.ACCESS_TOKEN)},m.prototype.getRefreshTokenCredential=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&Lv.isRefreshTokenEntity(t)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),ev.toObject(new Lv,t)):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.REFRESH_TOKEN),null)},m.prototype.setRefreshTokenCredential=function(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");var t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,E.REFRESH_TOKEN)},m.prototype.getAppMetadata=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&$v.isAppMetadataEntity(e,t)?(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),ev.toObject(new $v,t)):(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null)},m.prototype.setAppMetadata=function(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");var t=e.generateAppMetadataKey();this.setItem(t,JSON.stringify(e))},m.prototype.getServerTelemetry=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&S_.isServerTelemetryEntity(e,t)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),ev.toObject(new S_,t)):(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null)},m.prototype.setServerTelemetry=function(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))},m.prototype.getAuthorityMetadata=function(e){var t=this.internalStorage.getItem(e);return t?(t=this.validateAndParseJson(t))&&y_.isAuthorityMetadataEntity(e,t)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),ev.toObject(new y_,t)):null:(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null)},m.prototype.getAuthorityMetadataKeys=function(){var t=this;return this.internalStorage.getKeys().filter(function(e){return t.isAuthorityMetadata(e)})},m.prototype.setWrapperMetadata=function(e,t){this.internalStorage.setItem(Bw.WRAPPER_SKU,e),this.internalStorage.setItem(Bw.WRAPPER_VER,t)},m.prototype.getWrapperMetadata=function(){return[this.internalStorage.getItem(Bw.WRAPPER_SKU)||S.EMPTY_STRING,this.internalStorage.getItem(Bw.WRAPPER_VER)||S.EMPTY_STRING]},m.prototype.setAuthorityMetadata=function(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))},m.prototype.getActiveAccount=function(){var e=this.generateCacheKey(Ug.ACTIVE_ACCOUNT_FILTERS),e=this.getItem(e);return e?(e=this.validateAndParseJson(e))?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoByFilter({homeAccountId:e.homeAccountId,localAccountId:e.localAccountId})[0]||null):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema"),e=this.generateCacheKey(Ug.ACTIVE_ACCOUNT),(e=this.getItem(e))?(e=this.getAccountInfoByFilter({localAccountId:e})[0]||null)?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(e),e):null:(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null))},m.prototype.setActiveAccount=function(e){var t,o=this.generateCacheKey(Ug.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(Ug.ACTIVE_ACCOUNT);e?(this.logger.verbose("setActiveAccount: Active account set"),t={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId},this.browserStorage.setItem(o,JSON.stringify(t)),this.browserStorage.setItem(r,e.localAccountId)):(this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(o),this.browserStorage.removeItem(r))},m.prototype.getAccountInfoByFilter=function(t){var e=this.getAllAccounts();return this.logger.trace("BrowserCacheManager.getAccountInfoByFilter: total "+e.length+" accounts found"),e.filter(function(e){return!(t.username&&t.username.toLowerCase()!==e.username.toLowerCase()||t.homeAccountId&&t.homeAccountId!==e.homeAccountId||t.localAccountId&&t.localAccountId!==e.localAccountId||t.tenantId&&t.tenantId!==e.tenantId||t.environment&&t.environment!==e.environment)})},m.prototype.getAccountInfoByHints=function(o,r){var e=this.getAllAccounts().filter(function(e){var t;return r?(t=e.idTokenClaims&&e.idTokenClaims.sid,r===t):!!o&&o===e.username});if(1===e.length)return e[0];if(1<e.length)throw I.createMultipleMatchingAccountsInCacheError();return null},m.prototype.getThrottlingCache=function(e){var t=this.getItem(e);return(t=t&&this.validateAndParseJson(t))&&I_.isThrottlingEntity(e,t)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),ev.toObject(new I_,t)):(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null)},m.prototype.setThrottlingCache=function(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))},m.prototype.getTemporaryCache=function(e,t){t=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){e=this.getItemCookie(t);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),e}e=this.temporaryCacheStorage.getItem(t);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),e;if(this.cacheConfig.cacheLocation===qw.LocalStorage){e=this.browserStorage.getItem(t);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),e}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null},m.prototype.setTemporaryCache=function(e,t,o){o=o?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.setItemCookie(o,t))},m.prototype.removeItem=function(e){this.browserStorage.removeItem(e),this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.clearItemCookie(e))},m.prototype.containsKey=function(e){return this.browserStorage.containsKey(e)||this.temporaryCacheStorage.containsKey(e)},m.prototype.getKeys=function(){return xg(this.browserStorage.getKeys(),this.temporaryCacheStorage.getKeys())},m.prototype.clear=function(){return _(this,void 0,void 0,function(){var t=this;return w(this,function(e){switch(e.label){case 0:return[4,this.removeAllAccounts()];case 1:return e.sent(),this.removeAppMetadata(),this.getKeys().forEach(function(e){!t.browserStorage.containsKey(e)&&!t.temporaryCacheStorage.containsKey(e)||-1===e.indexOf(S.CACHE_PREFIX)&&-1===e.indexOf(t.clientId)||t.removeItem(e)}),this.internalStorage.clear(),[2]}})})},m.prototype.clearTokensAndKeysWithClaims=function(){return _(this,void 0,void 0,function(){var t,o,r=this;return w(this,function(e){switch(e.label){case 0:return this.logger.trace("BrowserCacheManager.clearTokensAndKeysWithClaims called"),t=this.getTokenKeys(),o=[],t.accessToken.forEach(function(e){var t=r.getAccessTokenCredential(e);null!=t&&t.requestedClaimsHash&&e.includes(t.requestedClaimsHash.toLowerCase())&&o.push(r.removeAccessToken(e))}),[4,Promise.all(o)];case 1:return e.sent(),0<o.length&&this.logger.warning(o.length+" access tokens with claims in the cache keys have been removed from the cache."),[2]}})})},m.prototype.setItemCookie=function(e,t,o){e=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/;SameSite=Lax;";o&&(e+="expires="+this.getCookieExpirationTime(o)+";"),this.cacheConfig.secureCookies&&(e+="Secure;"),document.cookie=e},m.prototype.getItemCookie=function(e){for(var t=encodeURIComponent(e)+"=",o=document.cookie.split(";"),r=0;r<o.length;r++){for(var n=o[r];" "===n.charAt(0);)n=n.substring(1);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}return S.EMPTY_STRING},m.prototype.clearMsalCookies=function(){var o=this,r=S.CACHE_PREFIX+"."+this.clientId;document.cookie.split(";").forEach(function(e){for(;" "===e.charAt(0);)e=e.substring(1);var t;0===e.indexOf(r)&&(t=e.split("=")[0],o.clearItemCookie(t))})},m.prototype.clearItemCookie=function(e){this.setItemCookie(e,S.EMPTY_STRING,-1)},m.prototype.getCookieExpirationTime=function(e){var t=new Date;return new Date(t.getTime()+e*this.COOKIE_LIFE_MULTIPLIER).toUTCString()},m.prototype.getCache=function(){return this.browserStorage},m.prototype.setCache=function(){},m.prototype.generateCacheKey=function(e){return this.validateAndParseJson(e)?JSON.stringify(e):k.startsWith(e,S.CACHE_PREFIX)||k.startsWith(e,Ug.ADAL_ID_TOKEN)?e:S.CACHE_PREFIX+"."+this.clientId+"."+e},m.prototype.generateAuthorityKey=function(e){e=Gv.parseRequestState(this.cryptoImpl,e).libraryState.id;return this.generateCacheKey(jw.AUTHORITY+"."+e)},m.prototype.generateNonceKey=function(e){e=Gv.parseRequestState(this.cryptoImpl,e).libraryState.id;return this.generateCacheKey(jw.NONCE_IDTOKEN+"."+e)},m.prototype.generateStateKey=function(e){e=Gv.parseRequestState(this.cryptoImpl,e).libraryState.id;return this.generateCacheKey(jw.REQUEST_STATE+"."+e)},m.prototype.getCachedAuthority=function(e){var e=this.generateStateKey(e),e=this.getTemporaryCache(e);return e?(e=this.generateAuthorityKey(e),this.getTemporaryCache(e)):null},m.prototype.updateCacheEntries=function(e,t,o,r,n){this.logger.trace("BrowserCacheManager.updateCacheEntries called");var i,a=this.generateStateKey(e),a=(this.setTemporaryCache(a,e,!1),this.generateNonceKey(e)),a=(this.setTemporaryCache(a,t,!1),this.generateAuthorityKey(e));this.setTemporaryCache(a,o,!1),n?(i={credential:n.homeAccountId,type:vv.HOME_ACCOUNT_ID},this.setTemporaryCache(jw.CCS_CREDENTIAL,JSON.stringify(i),!0)):k.isEmpty(r)||(i={credential:r,type:vv.UPN},this.setTemporaryCache(jw.CCS_CREDENTIAL,JSON.stringify(i),!0))},m.prototype.resetRequestCache=function(t){var o=this;this.logger.trace("BrowserCacheManager.resetRequestCache called"),k.isEmpty(t)||this.getKeys().forEach(function(e){-1!==e.indexOf(t)&&o.removeItem(e)}),t&&(this.removeItem(this.generateStateKey(t)),this.removeItem(this.generateNonceKey(t)),this.removeItem(this.generateAuthorityKey(t))),this.removeItem(this.generateCacheKey(jw.REQUEST_PARAMS)),this.removeItem(this.generateCacheKey(jw.ORIGIN_URI)),this.removeItem(this.generateCacheKey(jw.URL_HASH)),this.removeItem(this.generateCacheKey(jw.CORRELATION_ID)),this.removeItem(this.generateCacheKey(jw.CCS_CREDENTIAL)),this.removeItem(this.generateCacheKey(jw.NATIVE_REQUEST)),this.setInteractionInProgress(!1)},m.prototype.cleanRequestByState=function(e){this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e&&(e=this.generateStateKey(e),e=this.temporaryCacheStorage.getItem(e),this.logger.infoPii("BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: "+e),this.resetRequestCache(e||S.EMPTY_STRING)),this.clearMsalCookies()},m.prototype.cleanRequestByInteractionType=function(o){var r=this;this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.getKeys().forEach(function(e){var t;-1!==e.indexOf(jw.REQUEST_STATE)&&(e=r.temporaryCacheStorage.getItem(e))&&(t=h0.extractBrowserRequestState(r.cryptoImpl,e))&&t.interactionType===o&&(r.logger.infoPii("BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: "+e),r.resetRequestCache(e))}),this.clearMsalCookies(),this.setInteractionInProgress(!1)},m.prototype.cacheCodeRequest=function(e,t){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");t=t.base64Encode(JSON.stringify(e));this.setTemporaryCache(jw.REQUEST_PARAMS,t,!0)},m.prototype.getCachedRequest=function(e,t){this.logger.trace("BrowserCacheManager.getCachedRequest called");var o=this.getTemporaryCache(jw.REQUEST_PARAMS,!0);if(!o)throw O.createNoTokenRequestCacheError();t=this.validateAndParseJson(t.base64Decode(o));if(!t)throw O.createUnableToParseTokenRequestCacheError();if(this.removeItem(this.generateCacheKey(jw.REQUEST_PARAMS)),k.isEmpty(t.authority)){o=this.generateAuthorityKey(e),e=this.getTemporaryCache(o);if(!e)throw O.createNoCachedAuthorityError();t.authority=e}return t},m.prototype.getCachedNativeRequest=function(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");var e=this.getTemporaryCache(jw.NATIVE_REQUEST,!0);return e?this.validateAndParseJson(e)||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null):(this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null)},m.prototype.isInteractionInProgress=function(e){var t=this.getInteractionInProgress();return e?t===this.clientId:!!t},m.prototype.getInteractionInProgress=function(){var e=S.CACHE_PREFIX+"."+jw.INTERACTION_STATUS_KEY;return this.getTemporaryCache(e,!1)},m.prototype.setInteractionInProgress=function(e){var t=S.CACHE_PREFIX+"."+jw.INTERACTION_STATUS_KEY;if(e){if(this.getInteractionInProgress())throw O.createInteractionInProgressError();this.setTemporaryCache(t,this.clientId,!1)}else this.getInteractionInProgress()===this.clientId&&this.removeItem(t)},m.prototype.getLegacyLoginHint=function(){var e=this.getTemporaryCache(Ug.ADAL_ID_TOKEN),t=(e&&(this.browserStorage.removeItem(Ug.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved.")),this.getTemporaryCache(Ug.ID_TOKEN,!0)),t=(t&&(this.removeItem(this.generateCacheKey(Ug.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved")),t||e);if(t){e=new Xy(t,this.cryptoImpl);if(e.claims&&e.claims.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),e.claims.preferred_username;if(e.claims&&e.claims.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),e.claims.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null},m.prototype.updateCredentialCacheKey=function(e,t){var o=t.generateCredentialKey();if(e!==o){var r=this.getItem(e);if(r)return this.removeItem(e),this.setItem(o,r),this.logger.verbose("Updated an outdated "+t.credentialType+" cache key"),o;this.logger.error("Attempted to update an outdated "+t.credentialType+" cache key but no item matching the outdated key was found in storage")}return e},m.prototype.getRedirectRequestContext=function(){return this.getTemporaryCache(jw.REDIRECT_CONTEXT,!0)},m.prototype.setRedirectRequestContext=function(e){this.setTemporaryCache(jw.REDIRECT_CONTEXT,e,!0)};var p0,f0=m;function m(e,t,o,r){e=p0.call(this,e,o,r)||this;return e.COOKIE_LIFE_MULTIPLIER=864e5,e.cacheConfig=t,e.logger=r,e.internalStorage=new u0,e.browserStorage=e.setupBrowserStorage(e.cacheConfig.cacheLocation),e.temporaryCacheStorage=e.setupTemporaryCacheStorage(e.cacheConfig.temporaryCacheLocation,e.cacheConfig.cacheLocation),t.cacheMigrationEnabled&&(e.migrateCacheEntries(),e.createKeyMaps()),e}var g0="@azure/msal-browser",m0="2.38.3",y0=(v0.prototype.sendGetRequestAsync=function(n,i){return _(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,fetch(n,{method:Uw.GET,headers:this.getFetchHeaders(i)})];case 1:return t=e.sent(),[3,3];case 2:throw o=e.sent(),window.navigator.onLine?O.createGetRequestFailedError(o,n):O.createNoNetworkConnectivityError();case 3:return e.trys.push([3,5,,6]),r={headers:this.getHeaderDict(t.headers)},[4,t.json()];case 4:return[2,(r.body=e.sent(),r.status=t.status,r)];case 5:throw e.sent(),O.createFailedToParseNetworkResponseError(n);case 6:return[2]}})})},v0.prototype.sendPostRequestAsync=function(i,a){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:t=a&&a.body||S.EMPTY_STRING,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,fetch(i,{method:Uw.POST,headers:this.getFetchHeaders(a),body:t})];case 2:return o=e.sent(),[3,4];case 3:throw r=e.sent(),window.navigator.onLine?O.createPostRequestFailedError(r,i):O.createNoNetworkConnectivityError();case 4:return e.trys.push([4,6,,7]),n={headers:this.getHeaderDict(o.headers)},[4,o.json()];case 5:return[2,(n.body=e.sent(),n.status=o.status,n)];case 6:throw e.sent(),O.createFailedToParseNetworkResponseError(i);case 7:return[2]}})})},v0.prototype.getFetchHeaders=function(e){var t,o=new Headers;return e&&e.headers&&(t=e.headers,Object.keys(t).forEach(function(e){o.append(e,t[e])})),o},v0.prototype.getHeaderDict=function(e){var o={};return e.forEach(function(e,t){o[t]=e}),o},v0);function v0(){}w0.prototype.sendGetRequestAsync=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.sendRequestAsync(t,Uw.GET,o)]})})},w0.prototype.sendPostRequestAsync=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.sendRequestAsync(t,Uw.POST,o)]})})},w0.prototype.sendRequestAsync=function(i,a,e){var s=this;return new Promise(function(o,r){var n=new XMLHttpRequest;if(n.open(a,i,!0),s.setXhrHeaders(n,e),n.onload=function(){(n.status<200||300<=n.status)&&(a===Uw.POST?r(O.createPostRequestFailedError("Failed with status "+n.status,i)):r(O.createGetRequestFailedError("Failed with status "+n.status,i)));try{var e=JSON.parse(n.responseText),t={headers:s.getHeaderDict(n),body:e,status:n.status};o(t)}catch(e){r(O.createFailedToParseNetworkResponseError(i))}},n.onerror=function(){window.navigator.onLine?a===Uw.POST?r(O.createPostRequestFailedError("Failed with status "+n.status,i)):r(O.createGetRequestFailedError("Failed with status "+n.status,i)):r(O.createNoNetworkConnectivityError())},a===Uw.POST&&e&&e.body)n.send(e.body);else{if(a!==Uw.GET)throw O.createHttpMethodNotImplementedError(a);n.send()}})},w0.prototype.setXhrHeaders=function(t,e){var o;e&&e.headers&&(o=e.headers,Object.keys(o).forEach(function(e){t.setRequestHeader(e,o[e])}))},w0.prototype.getHeaderDict=function(e){var e=e.getAllResponseHeaders().trim().split(/[\r\n]+/),o={};return e.forEach(function(e){var e=e.split(": "),t=e.shift(),e=e.join(": ");t&&e&&(o[t]=e)}),o};var _0=w0;function w0(){}C0.clearHash=function(e){e.location.hash=S.EMPTY_STRING,"function"==typeof e.history.replaceState&&e.history.replaceState(null,S.EMPTY_STRING,""+e.location.origin+e.location.pathname+e.location.search)},C0.replaceHash=function(e){e=e.split("#");e.shift(),window.location.hash=0<e.length?e.join("#"):S.EMPTY_STRING},C0.isInIframe=function(){return window.parent!==window},C0.isInPopup=function(){return"undefined"!=typeof window&&!!window.opener&&window.opener!==window&&"string"==typeof window.name&&0===window.name.indexOf(Kw.POPUP_NAME_PREFIX+".")},C0.getCurrentUri=function(){return window.location.href.split("?")[0].split("#")[0]},C0.getHomepage=function(){var e=new P(window.location.href).getUrlComponents();return e.Protocol+"//"+e.HostNameAndPort+"/"},C0.getBrowserNetworkClient=function(){return new(window.fetch&&window.Headers?y0:_0)},C0.blockReloadInHiddenIframes=function(){if(P.hashContainsKnownProperties(window.location.hash)&&C0.isInIframe())throw O.createBlockReloadInHiddenIframeError()},C0.blockRedirectInIframe=function(e,t){var o=C0.isInIframe();if(e===R.Redirect&&o&&!t)throw O.createRedirectInIframeError(o)},C0.blockAcquireTokenInPopups=function(){if(C0.isInPopup())throw O.createBlockAcquireTokenInPopupsError()},C0.blockNonBrowserEnvironment=function(e){if(!e)throw O.createNonBrowserEnvironmentError()},C0.blockNativeBrokerCalledBeforeInitialized=function(e,t){if(e&&!t)throw O.createNativeBrokerCalledBeforeInitialize()},C0.detectIEOrEdge=function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE "),o=e.indexOf("Trident/"),e=e.indexOf("Edge/");return 0<t||0<o||0<e};var b0=C0;function C0(){}E0.prototype.clearCacheOnLogout=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:if(!t)return[3,5];Vy.accountInfoIsEqual(t,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null)),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.browserStorage.removeAccount(Vy.generateAccountCacheKey(t))];case 2:return e.sent(),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request."),[3,4];case 3:return e.sent(),this.logger.error("Account provided in logout request was not found. Local cache unchanged."),[3,4];case 4:return[3,9];case 5:return e.trys.push([5,8,,9]),this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),[4,this.browserStorage.clear()];case 6:return e.sent(),[4,this.browserCrypto.clearKeystore()];case 7:return e.sent(),[3,9];case 8:return e.sent(),this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged."),[3,9];case 9:return[2]}})})},E0.prototype.initializeBaseRequest=function(n,i){return _(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:return(this.performanceClient.addQueueMeasurement(A.InitializeBaseRequest,n.correlationId),this.logger.verbose("Initializing BaseAuthRequest"),t=n.authority||this.config.auth.authority,i)?[4,this.validateRequestAuthority(t,i)]:[3,2];case 1:e.sent(),e.label=2;case 2:if(o=xg(n&&n.scopes||[]),(o=v(v({},n),{correlationId:this.correlationId,authority:t,scopes:o})).authenticationScheme){if(o.authenticationScheme===Zg.SSH){if(!n.sshJwk)throw Ky.createMissingSshJwkError();if(!n.sshKid)throw Ky.createMissingSshKidError()}this.logger.verbose('Authentication Scheme set to "'+o.authenticationScheme+'" as configured in Auth request')}else o.authenticationScheme=Zg.BEARER,this.logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');return this.config.cache.claimsBasedCachingEnabled&&n.claims&&!k.isEmptyObj(n.claims)?(r=o,[4,this.browserCrypto.hashString(n.claims)]):[3,4];case 3:r.requestedClaimsHash=e.sent(),e.label=4;case 4:return[2,o]}})})},E0.prototype.getRedirectUri=function(e){this.logger.verbose("getRedirectUri called");e=e||this.config.auth.redirectUri||b0.getCurrentUri();return P.getAbsoluteUrl(e,b0.getCurrentUri())},E0.prototype.validateRequestAuthority=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return[4,this.getDiscoveredAuthority(t)];case 1:if(e.sent().isAlias(o.environment))return[2];throw Ky.createAuthorityMismatchError()}})})},E0.prototype.initializeServerTelemetryManager=function(e,t){this.logger.verbose("initializeServerTelemetryManager called");e={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new D_(e,this.browserStorage)},E0.prototype.getDiscoveredAuthority=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return(this.logger.verbose("getDiscoveredAuthority called"),t={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata},o)?(this.logger.verbose("Creating discovered authority with request authority"),[4,C_.createDiscoveredInstance(o,this.config.system.networkClient,this.browserStorage,t,this.logger)]):[3,2];case 1:return[2,e.sent()];case 2:return this.logger.verbose("Creating discovered authority with configured authority"),[4,C_.createDiscoveredInstance(this.config.auth.authority,this.config.system.networkClient,this.browserStorage,t,this.logger)];case 3:return[2,e.sent()]}})})};t=E0;function E0(e,t,o,r,n,i,a,s,c){this.config=e,this.browserStorage=t,this.browserCrypto=o,this.networkClient=this.config.system.networkClient,this.eventHandler=n,this.navigationClient=i,this.nativeMessageHandler=s,this.correlationId=c||this.browserCrypto.createNewGuid(),this.logger=r.clone(Kw.MSAL_SKU,m0,this.correlationId),this.performanceClient=a}Og(T0,S0=t),T0.prototype.initializeAuthorizationCodeRequest=function(r){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientInitializeAuthorizationCodeRequest,r.correlationId),this.logger.verbose("initializeAuthorizationRequest called",r.correlationId),[4,this.browserCrypto.generatePkceCodes()];case 1:return t=e.sent(),o=v(v({},r),{redirectUri:r.redirectUri,code:S.EMPTY_STRING,codeVerifier:t.verifier}),r.codeChallenge=t.challenge,r.codeChallengeMethod=S.S256_CODE_CHALLENGE_METHOD,[2,o]}})})},T0.prototype.initializeLogoutRequest=function(e){this.logger.verbose("initializeLogoutRequest called",null==e?void 0:e.correlationId);var t,o=v({correlationId:this.correlationId||this.browserCrypto.createNewGuid()},e);return e?e.logoutHint?this.logger.verbose("logoutHint has already been set in logoutRequest"):e.account?(t=this.getLogoutHintFromIdTokenClaims(e.account))&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),o.logoutHint=t):this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set"):this.logger.verbose("logoutHint will not be set since no logout request was configured"),e&&null===e.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",o.correlationId):e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",o.correlationId),o.postLogoutRedirectUri=P.getAbsoluteUrl(e.postLogoutRedirectUri,b0.getCurrentUri())):null===this.config.auth.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",o.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",o.correlationId),o.postLogoutRedirectUri=P.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,b0.getCurrentUri())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",o.correlationId),o.postLogoutRedirectUri=P.getAbsoluteUrl(b0.getCurrentUri(),b0.getCurrentUri())),o},T0.prototype.getLogoutHintFromIdTokenClaims=function(e){e=e.idTokenClaims;if(e){if(e.login_hint)return e.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null},T0.prototype.createAuthCodeClient=function(o,r,n){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientCreateAuthCodeClient,this.correlationId),this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetClientConfiguration,this.correlationId),[4,this.getClientConfiguration(o,r,n)];case 1:return t=e.sent(),[2,new a_(t,this.performanceClient)]}})})},T0.prototype.getClientConfiguration=function(r,n,i){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientGetClientConfiguration,this.correlationId),this.logger.verbose("getClientConfiguration called",this.correlationId),this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),[4,this.getDiscoveredAuthority(n,i)];case 1:return t=e.sent(),o=this.config.system.loggerOptions,[2,{authOptions:{clientId:this.config.auth.clientId,authority:t,clientCapabilities:this.config.auth.clientCapabilities},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:o.loggerCallback,piiLoggingEnabled:o.piiLoggingEnabled,logLevel:o.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:r,libraryInfo:{sku:Kw.MSAL_SKU,version:m0,cpu:S.EMPTY_STRING,os:S.EMPTY_STRING},telemetry:this.config.telemetry}]}})})},T0.prototype.validateAndExtractStateFromHash=function(e,t,o){if(this.logger.verbose("validateAndExtractStateFromHash called",o),!e.state)throw O.createHashDoesNotContainStateError();var r=h0.extractBrowserRequestState(this.browserCrypto,e.state);if(!r)throw O.createUnableToParseStateError();if(r.interactionType!==t)throw O.createStateInteractionTypeMismatchError();return this.logger.verbose("Returning state from hash",o),e.state},T0.prototype.getDiscoveredAuthority=function(n,i){var a;return _(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),this.logger.verbose("getDiscoveredAuthority called",this.correlationId),t=null==(a=this.performanceClient)?void 0:a.startMeasurement(A.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),o={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},r=n||this.config.auth.authority,r=b_.generateAuthority(r,i||this.config.auth.azureCloudOptions),this.logger.verbose("Creating discovered authority with configured authority",this.correlationId),this.performanceClient.setPreQueueTime(A.AuthorityFactoryCreateDiscoveredInstance,this.correlationId),[4,C_.createDiscoveredInstance(r,this.config.system.networkClient,this.browserStorage,o,this.logger,this.performanceClient,this.correlationId).then(function(e){return t.endMeasurement({success:!0}),e}).catch(function(e){throw t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})];case 1:return[2,e.sent()]}})})},T0.prototype.initializeAuthorizationRequest=function(a,s){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId),this.logger.verbose("initializeAuthorizationRequest called",this.correlationId),t=this.getRedirectUri(a.redirectUri),o={interactionType:s},o=Gv.setRequestState(this.browserCrypto,a&&a.state||S.EMPTY_STRING,o),this.performanceClient.setPreQueueTime(A.InitializeBaseRequest,this.correlationId),n=[{}],[4,this.initializeBaseRequest(a)];case 1:return r=v.apply(void 0,[v.apply(void 0,n.concat([e.sent()])),{redirectUri:t,state:o,nonce:a.nonce||this.browserCrypto.createNewGuid(),responseMode:Fg.FRAGMENT}]),(i=a.account||this.browserStorage.getActiveAccount())&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii("Setting validated request account: "+i.homeAccountId,this.correlationId),r.account=i),k.isEmpty(r.loginHint)&&!i&&(i=this.browserStorage.getLegacyLoginHint())&&(r.loginHint=i),[2,r]}})})};var S0,n=T0;function T0(){return null!==S0&&S0.apply(this,arguments)||this}k0.prototype.handleCodeResponseFromHash=function(r,n,i,a){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){if(this.performanceClient.addQueueMeasurement(A.HandleCodeResponseFromHash,this.authCodeRequest.correlationId),this.logger.verbose("InteractionHandler.handleCodeResponse called"),k.isEmpty(r))throw O.createEmptyHashError(r);if(t=this.browserStorage.generateStateKey(n),!(t=this.browserStorage.getTemporaryCache(t)))throw I.createStateNotFoundError("Cached State");try{o=this.authModule.handleFragmentResponse(r,t)}catch(e){throw e instanceof fv&&e.subError===rw.code?O.createUserCancelledError():e}return this.performanceClient.setPreQueueTime(A.HandleCodeResponseFromServer,this.authCodeRequest.correlationId),[2,this.handleCodeResponseFromServer(o,n,i,a)]})})},k0.prototype.handleCodeResponseFromServer=function(n,i,a,s,c){return void 0===c&&(c=!0),_(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:if(this.performanceClient.addQueueMeasurement(A.HandleCodeResponseFromServer,this.authCodeRequest.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),t=this.browserStorage.generateStateKey(i),t=this.browserStorage.getTemporaryCache(t))return o=this.browserStorage.generateNonceKey(t),o=this.browserStorage.getTemporaryCache(o),this.authCodeRequest.code=n.code,n.cloud_instance_host_name?(this.performanceClient.setPreQueueTime(A.UpdateTokenEndpointAuthority,this.authCodeRequest.correlationId),[4,this.updateTokenEndpointAuthority(n.cloud_instance_host_name,a,s)]):[3,2];throw I.createStateNotFoundError("Cached State");case 1:e.sent(),e.label=2;case 2:return c&&(n.nonce=o||void 0),n.state=t,n.client_info?this.authCodeRequest.clientInfo=n.client_info:(r=this.checkCcsCredentials())&&(this.authCodeRequest.ccsCredential=r),this.performanceClient.setPreQueueTime(A.AuthClientAcquireToken,this.authCodeRequest.correlationId),[4,this.authModule.acquireToken(this.authCodeRequest,n)];case 3:return r=e.sent(),this.browserStorage.cleanRequestByState(i),[2,r]}})})},k0.prototype.updateTokenEndpointAuthority=function(o,r,n){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.UpdateTokenEndpointAuthority,this.authCodeRequest.correlationId),t="https://"+o+"/"+r.tenant+"/",[4,C_.createDiscoveredInstance(t,n,this.browserStorage,r.options,this.logger,this.performanceClient,this.authCodeRequest.correlationId)];case 1:return t=e.sent(),this.authModule.updateAuthority(t),[2]}})})},k0.prototype.checkCcsCredentials=function(){var t=this.browserStorage.getTemporaryCache(jw.CCS_CREDENTIAL,!0);if(t)try{return JSON.parse(t)}catch(e){this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii("Cache credential could not be parsed: "+t)}return null};var I0=k0;function k0(e,t,o,r,n){this.authModule=e,this.browserStorage=t,this.authCodeRequest=o,this.logger=r,this.performanceClient=n}Og(R0,A0=I0),R0.prototype.initiateAuthRequest=function(o,r){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),k.isEmpty(o))?[3,7]:(r.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(jw.ORIGIN_URI,r.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(jw.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest,this.browserCrypto),this.logger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: "+o),t={apiId:Fw.acquireTokenRedirect,timeout:r.redirectTimeout,noHistory:!1},"function"!=typeof r.onRedirectNavigate?[3,4]:(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),!1===r.onRedirectNavigate(o)?[3,2]:(this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),[4,r.navigationClient.navigateExternal(o,t)])));case 1:return e.sent(),[2];case 2:return this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation"),[2];case 3:return[3,6];case 4:return this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),[4,r.navigationClient.navigateExternal(o,t)];case 5:return e.sent(),[2];case 6:return[3,8];case 7:throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),O.createEmptyNavigationUriError();case 8:return[2]}})})},R0.prototype.handleCodeResponseFromHash=function(i,a,s,c){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.logger.verbose("RedirectHandler.handleCodeResponse called"),k.isEmpty(i))throw O.createEmptyHashError(i);if(this.browserStorage.setInteractionInProgress(!1),t=this.browserStorage.generateStateKey(a),!(t=this.browserStorage.getTemporaryCache(t)))throw I.createStateNotFoundError("Cached State");try{o=this.authModule.handleFragmentResponse(i,t)}catch(e){throw e instanceof fv&&e.subError===rw.code?O.createUserCancelledError():e}return(r=this.browserStorage.generateNonceKey(t),r=this.browserStorage.getTemporaryCache(r),this.authCodeRequest.code=o.code,o.cloud_instance_host_name)?[4,this.updateTokenEndpointAuthority(o.cloud_instance_host_name,s,c)]:[3,2];case 1:e.sent(),e.label=2;case 2:return o.nonce=r||void 0,o.state=t,o.client_info?this.authCodeRequest.clientInfo=o.client_info:(n=this.checkCcsCredentials())&&(this.authCodeRequest.ccsCredential=n),[4,this.authModule.acquireToken(this.authCodeRequest,o)];case 3:return n=e.sent(),this.browserStorage.cleanRequestByState(a),[2,n]}})})};var A0,x,P0,O0=R0;function R0(e,t,o,r,n,i){e=A0.call(this,e,t,o,r,i)||this;return e.browserCrypto=n,e}(a=x=x||{}).INITIALIZE_START="msal:initializeStart",a.INITIALIZE_END="msal:initializeEnd",a.ACCOUNT_ADDED="msal:accountAdded",a.ACCOUNT_REMOVED="msal:accountRemoved",a.LOGIN_START="msal:loginStart",a.LOGIN_SUCCESS="msal:loginSuccess",a.LOGIN_FAILURE="msal:loginFailure",a.ACQUIRE_TOKEN_START="msal:acquireTokenStart",a.ACQUIRE_TOKEN_SUCCESS="msal:acquireTokenSuccess",a.ACQUIRE_TOKEN_FAILURE="msal:acquireTokenFailure",a.ACQUIRE_TOKEN_NETWORK_START="msal:acquireTokenFromNetworkStart",a.SSO_SILENT_START="msal:ssoSilentStart",a.SSO_SILENT_SUCCESS="msal:ssoSilentSuccess",a.SSO_SILENT_FAILURE="msal:ssoSilentFailure",a.ACQUIRE_TOKEN_BY_CODE_START="msal:acquireTokenByCodeStart",a.ACQUIRE_TOKEN_BY_CODE_SUCCESS="msal:acquireTokenByCodeSuccess",a.ACQUIRE_TOKEN_BY_CODE_FAILURE="msal:acquireTokenByCodeFailure",a.HANDLE_REDIRECT_START="msal:handleRedirectStart",a.HANDLE_REDIRECT_END="msal:handleRedirectEnd",a.POPUP_OPENED="msal:popupOpened",a.LOGOUT_START="msal:logoutStart",a.LOGOUT_SUCCESS="msal:logoutSuccess",a.LOGOUT_FAILURE="msal:logoutFailure",a.LOGOUT_END="msal:logoutEnd",a.RESTORE_FROM_BFCACHE="msal:restoreFromBFCache",(e=P0=P0||{}).USER_INTERACTION_REQUIRED="USER_INTERACTION_REQUIRED",e.USER_CANCEL="USER_CANCEL",e.NO_NETWORK="NO_NETWORK",e.TRANSIENT_ERROR="TRANSIENT_ERROR",e.PERSISTENT_ERROR="PERSISTENT_ERROR",e.DISABLED="DISABLED",e.ACCOUNT_UNAVAILABLE="ACCOUNT_UNAVAILABLE";var x0,M0={code:"ContentError"},N0={code:"user_switch",desc:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."},L0={code:"tokens_not_found_in_internal_memory_cache",desc:"Tokens not cached in MSAL JS internal memory, please make the WAM request"},D0=(Og(q0,x0=T),q0.prototype.isFatal=function(){return!(!this.ext||!this.ext.status||this.ext.status!==P0.PERSISTENT_ERROR&&this.ext.status!==P0.DISABLED)||this.errorCode===M0.code},q0.createError=function(e,t,o){if(o&&o.status)switch(o.status){case P0.ACCOUNT_UNAVAILABLE:return Fv.createNativeAccountUnavailableError();case P0.USER_INTERACTION_REQUIRED:return new Fv(e,t);case P0.USER_CANCEL:return O.createUserCancelledError();case P0.NO_NETWORK:return O.createNoNetworkConnectivityError()}return new q0(e,t,o)},q0.createUserSwitchError=function(){return new q0(N0.code,N0.desc)},q0.createTokensNotFoundInCacheError=function(){return new q0(L0.code,L0.desc)},q0);function q0(e,t,o){e=x0.call(this,e,t)||this;return Object.setPrototypeOf(e,q0.prototype),e.name="NativeAuthError",e.ext=o,e}Og(H0,U0=n),H0.prototype.acquireToken=function(i){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:return t=this.performanceClient.startMeasurement(A.SilentCacheClientAcquireToken,i.correlationId),r=this.initializeServerTelemetryManager(Fw.acquireTokenSilent_silentFlow),[4,this.createSilentFlowClient(r,i.authority,i.azureCloudOptions)];case 1:o=e.sent(),this.logger.verbose("Silent auth client created"),e.label=2;case 2:return e.trys.push([2,4,,5]),[4,o.acquireCachedToken(i)];case 3:return r=e.sent(),t.endMeasurement({success:!0,fromCache:!0}),[2,r];case 4:throw(n=e.sent())instanceof O&&n.errorCode===Tw.code&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),t.endMeasurement({errorCode:n instanceof T&&n.errorCode||void 0,subErrorCode:n instanceof T&&n.subError||void 0,success:!1}),n;case 5:return[2]}})})},H0.prototype.logout=function(){return Promise.reject(O.createSilentLogoutUnsupportedError())},H0.prototype.createSilentFlowClient=function(o,r,n){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetClientConfiguration,this.correlationId),[4,this.getClientConfiguration(o,r,n)];case 1:return t=e.sent(),[2,new d_(t,this.performanceClient)]}})})},H0.prototype.initializeSilentRequest=function(o,r){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.InitializeSilentRequest,this.correlationId),this.performanceClient.setPreQueueTime(A.InitializeBaseRequest,this.correlationId),t=[v({},o)],[4,this.initializeBaseRequest(o,r)];case 1:return[2,v.apply(void 0,[v.apply(void 0,t.concat([e.sent()])),{account:r,forceRefresh:o.forceRefresh||!1}])]}})})};var U0,j0=H0;function H0(){return null!==U0&&U0.apply(this,arguments)||this}Og(z0,B0=t),z0.prototype.acquireToken=function(a){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:return this.logger.trace("NativeInteractionClient - acquireToken called."),t=this.performanceClient.startMeasurement(A.NativeInteractionClientAcquireToken,a.correlationId),o=Pv.nowSeconds(),[4,this.initializeNativeRequest(a)];case 1:r=e.sent(),e.label=2;case 2:return e.trys.push([2,4,,5]),[4,this.acquireTokensFromCache(this.accountId,r)];case 3:return n=e.sent(),t.endMeasurement({success:!0,isNativeBroker:!1,fromCache:!0}),[2,n];case 4:return e.sent(),this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call"),[3,5];case 5:return n={method:Dw.GetToken,request:r},[4,this.nativeMessageHandler.sendMessage(n)];case 6:return i=e.sent(),i=this.validateNativeResponse(i),[2,this.handleNativeResponse(i,r,o).then(function(e){return t.endMeasurement({success:!0,isNativeBroker:!0,requestId:e.requestId}),e}).catch(function(e){throw t.endMeasurement({success:!1,errorCode:e.errorCode,subErrorCode:e.subError,isNativeBroker:!0}),e})]}})})},z0.prototype.createSilentCacheRequest=function(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:Yy.fromString(e.scope).asArray(),account:t,forceRefresh:!1}},z0.prototype.acquireTokensFromCache=function(r,n){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(!r)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),I.createNoAccountFoundError();if(!(t=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:r})))throw I.createNoAccountFoundError();e.label=1;case 1:return e.trys.push([1,3,,4]),o=this.createSilentCacheRequest(n,t),[4,this.silentCacheClient.acquireToken(o)];case 2:return[2,e.sent()];case 3:throw e.sent();case 4:return[2]}})})},z0.prototype.acquireTokenRedirect=function(a){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:return this.logger.trace("NativeInteractionClient - acquireTokenRedirect called."),[4,this.initializeNativeRequest(a)];case 1:t=e.sent(),o={method:Dw.GetToken,request:t},e.label=2;case 2:return e.trys.push([2,4,,5]),[4,this.nativeMessageHandler.sendMessage(o)];case 3:return r=e.sent(),this.validateNativeResponse(r),[3,5];case 4:if((r=e.sent())instanceof D0&&r.isFatal())throw r;return[3,5];case 5:return this.browserStorage.setTemporaryCache(jw.NATIVE_REQUEST,JSON.stringify(t),!0),n={apiId:Fw.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(a.redirectUri),[4,this.navigationClient.navigateExternal(i,n)];case 6:return e.sent(),[2]}})})},z0.prototype.handleRedirectPromise=function(){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),[2,null];if(!(t=this.browserStorage.getCachedNativeRequest()))return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),[2,null];o=t.prompt,t=Rg(t,["prompt"]),o&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(jw.NATIVE_REQUEST)),o={method:Dw.GetToken,request:t},r=Pv.nowSeconds(),e.label=1;case 1:return e.trys.push([1,3,,4]),this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker."),[4,this.nativeMessageHandler.sendMessage(o)];case 2:return n=e.sent(),this.validateNativeResponse(n),n=this.handleNativeResponse(n,t,r),this.browserStorage.setInteractionInProgress(!1),[2,n];case 3:throw n=e.sent(),this.browserStorage.setInteractionInProgress(!1),n;case 4:return[2]}})})},z0.prototype.logout=function(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")},z0.prototype.handleNativeResponse=function(i,a,s){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.logger.trace("NativeInteractionClient - handleNativeResponse called."),i.account.id!==a.accountId)throw D0.createUserSwitchError();return[4,this.getDiscoveredAuthority(a.authority)];case 1:return n=e.sent(),r=n.getPreferredCache(),t=this.createIdTokenObj(i),o=this.createHomeAccountIdentifier(i,t),r=this.createAccountEntity(i,o,t,r),[4,this.generateAuthenticationResult(i,a,t,r,n.canonicalAuthority,s)];case 2:return n=e.sent(),this.cacheAccount(r),this.cacheNativeTokens(i,a,o,r,t,n.accessToken,n.tenantId,s),[2,n]}})})},z0.prototype.createIdTokenObj=function(e){return new Xy(e.id_token||S.EMPTY_STRING,this.browserCrypto)},z0.prototype.createHomeAccountIdentifier=function(e,t){return Vy.generateHomeAccountId(e.client_info||S.EMPTY_STRING,Gy.Default,this.logger,this.browserCrypto,t)},z0.prototype.createAccountEntity=function(e,t,o,r){return Vy.createAccount(e.client_info,t,o,void 0,void 0,void 0,r,e.account.id)},z0.prototype.generateScopes=function(e,t){return e.scope?Yy.fromString(e.scope):Yy.fromString(t.scope)},z0.prototype.generatePopAccessToken=function(r,n){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(n.tokenType!==Zg.POP)return[3,2];if(r.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),[2,r.shr];if(t=new Jv(this.browserCrypto),o={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce},n.keyId)return[4,t.signPopToken(r.access_token,n.keyId,o)];throw I.createKeyIdMissingError();case 1:return[2,e.sent()];case 2:return[2,r.access_token]}})})},z0.prototype.generateAuthenticationResult=function(s,c,u,l,h,d){return _(this,void 0,void 0,function(){var t,o,r,n,i,a;return w(this,function(e){switch(e.label){case 0:return t=this.addTelemetryFromNativeResponse(s),o=s.scope?Yy.fromString(s.scope):Yy.fromString(c.scope),n=s.account.properties||{},r=n.UID||u.claims.oid||u.claims.sub||S.EMPTY_STRING,n=n.TenantId||u.claims.tid||S.EMPTY_STRING,[4,this.generatePopAccessToken(s,c)];case 1:return i=e.sent(),a=c.tokenType===Zg.POP?Zg.POP:Zg.BEARER,[2,{authority:h,uniqueId:r,tenantId:n,scopes:o.asArray(),account:l.getAccountInfo(),idToken:s.id_token,idTokenClaims:u.claims,accessToken:i,fromCache:!!t&&this.isResponseFromCache(t),expiresOn:new Date(1e3*Number(d+s.expires_in)),tokenType:a,correlationId:this.correlationId,state:s.state,fromNativeBroker:!0}]}})})},z0.prototype.cacheAccount=function(e){var t=this;this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(function(e){t.logger.error("Error occurred while removing account context from browser storage. "+e)})},z0.prototype.cacheNativeTokens=function(e,t,o,r,n,i,a,s){var c=kv.createIdTokenEntity(o,t.authority,e.id_token||S.EMPTY_STRING,t.clientId,n.claims.tid||S.EMPTY_STRING),s=s+(t.tokenType===Zg.POP?S.SHR_NONCE_VALIDITY:("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0),e=this.generateScopes(e,t),o=xv.createAccessTokenEntity(o,t.authority,i,t.clientId,n?n.claims.tid||S.EMPTY_STRING:a,e.printScopes(),s,0,this.browserCrypto),i=new Kv(r,c,o);this.nativeStorageManager.saveCacheRecord(i)},z0.prototype.addTelemetryFromNativeResponse=function(e){e=this.getMATSFromResponse(e);return e?(this.performanceClient.addStaticFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:e.broker_version,matsAccountJoinOnStart:e.account_join_on_start,matsAccountJoinOnEnd:e.account_join_on_end,matsDeviceJoin:e.device_join,matsPromptBehavior:e.prompt_behavior,matsApiErrorCode:e.api_error_code,matsUiVisible:e.ui_visible,matsSilentCode:e.silent_code,matsSilentBiSubCode:e.silent_bi_sub_code,matsSilentMessage:e.silent_message,matsSilentStatus:e.silent_status,matsHttpStatus:e.http_status,matsHttpEventCount:e.http_event_count},this.correlationId),e):null},z0.prototype.validateNativeResponse=function(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw D0.createUnexpectedError("Response missing expected properties.")},z0.prototype.getMATSFromResponse=function(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch(e){this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null},z0.prototype.isResponseFromCache=function(e){return void 0===e.is_cached?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached},z0.prototype.initializeNativeRequest=function(s){return _(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return w(this,function(e){switch(e.label){case 0:return(this.logger.trace("NativeInteractionClient - initializeNativeRequest called"),t=s.authority||this.config.auth.authority,s.account)?[4,this.validateRequestAuthority(t,s.account)]:[3,2];case 1:e.sent(),e.label=2;case 2:return((n=new P(t)).validateAsUri(),i=s.scopes,r=Rg(s,["scopes"]),(i=new Yy(i||[])).appendScopes(Qg),o=function(){switch(a.apiId){case Fw.ssoSilent:case Fw.acquireTokenSilent_silentFlow:return a.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Jg.NONE}if(s.prompt)switch(s.prompt){case Jg.NONE:case Jg.CONSENT:case Jg.LOGIN:return a.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),s.prompt;default:throw a.logger.trace("initializeNativeRequest: prompt = "+s.prompt+" is not compatible with native flow"),O.createNativePromptParameterNotSupportedError()}else a.logger.trace("initializeNativeRequest: prompt was not provided")},r=v(v({},r),{accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:i.printScopes(),redirectUri:this.getRedirectUri(s.redirectUri),prompt:o(),correlationId:this.correlationId,tokenType:s.authenticationScheme,windowTitleSubstring:document.title,extraParameters:v(v(v({},s.extraQueryParameters),s.tokenQueryParameters),{telemetry:Ww}),extendedExpiryToken:!1}),s.authenticationScheme!==Zg.POP)?[3,4]:(n={resourceRequestUri:s.resourceRequestUri,resourceRequestMethod:s.resourceRequestMethod,shrClaims:s.shrClaims,shrNonce:s.shrNonce},[4,new Jv(this.browserCrypto).generateCnf(n)]);case 3:i=e.sent(),r.reqCnf=i.reqCnfString,r.keyId=i.kid,e.label=4;case 4:return[2,r]}})})};var B0,F0=z0;function z0(e,t,o,r,n,i,a,s,c,u,l,h){t=B0.call(this,e,t,o,r,n,i,s,c,h)||this;return t.apiId=a,t.accountId=u,t.nativeMessageHandler=c,t.nativeStorageManager=l,t.silentCacheClient=new j0(e,t.nativeStorageManager,o,r,n,i,s,c,h),t}G0.prototype.sendMessage=function(t){return _(this,void 0,void 0,function(){var o,r=this;return w(this,function(e){return this.logger.trace("NativeMessageHandler - sendMessage called."),o={channel:Gw,extensionId:this.extensionId,responseId:this.responseId++,body:t},this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii("NativeMessageHandler - Sending request to browser extension: "+JSON.stringify(o)),this.messageChannel.port1.postMessage(o),[2,new Promise(function(e,t){r.resolvers.set(o.responseId,{resolve:e,reject:t})})]})})},G0.createProvider=function(r,n,i){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:r.trace("NativeMessageHandler - createProvider called."),e.label=1;case 1:return e.trys.push([1,3,,5]),[4,(t=new G0(r,n,i,Yw)).sendHandshakeRequest()];case 2:return e.sent(),[2,t];case 3:return e.sent(),[4,(o=new G0(r,n,i)).sendHandshakeRequest()];case 4:return e.sent(),[2,o];case 5:return[2]}})})},G0.prototype.sendHandshakeRequest=function(){return _(this,void 0,void 0,function(){var o,r=this;return w(this,function(e){return this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1),o={channel:Gw,extensionId:this.extensionId,responseId:this.responseId++,body:{method:Dw.HandshakeRequest}},this.handshakeEvent.addStaticFields({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=function(e){r.onChannelMessage(e)},window.postMessage(o,window.origin,[this.messageChannel.port2]),[2,new Promise(function(e,t){r.handshakeResolvers.set(o.responseId,{resolve:e,reject:t}),r.timeoutId=window.setTimeout(function(){window.removeEventListener("message",r.windowListener,!1),r.messageChannel.port1.close(),r.messageChannel.port2.close(),r.handshakeEvent.endMeasurement({extensionHandshakeTimedOut:!0,success:!1}),t(O.createNativeHandshakeTimeoutError()),r.handshakeResolvers.delete(o.responseId)},r.handshakeTimeoutMs)})]})})},G0.prototype.onWindowMessage=function(e){this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window||!(e=e.data).channel||e.channel!==Gw||e.extensionId&&e.extensionId!==this.extensionId||e.body.method===Dw.HandshakeRequest&&(this.logger.verbose(e.extensionId?"Extension with id: "+e.extensionId+" not installed":"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),e=this.handshakeResolvers.get(e.responseId))&&(this.handshakeEvent.endMeasurement({success:!1,extensionInstalled:!1}),e.reject(O.createNativeExtensionNotInstalledError()))},G0.prototype.onChannelMessage=function(t){this.logger.trace("NativeMessageHandler - onChannelMessage called.");var e=t.data,o=this.resolvers.get(e.responseId),r=this.handshakeResolvers.get(e.responseId);try{var n=e.body.method;if(n===Dw.Response){if(o){var i=e.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii("NativeMessageHandler - Received response from browser extension: "+JSON.stringify(i)),"Success"!==i.status)o.reject(D0.createError(i.code,i.description,i.ext));else{if(!i.result)throw T.createUnexpectedError("Event does not contain result.");i.result.code&&i.result.description?o.reject(D0.createError(i.result.code,i.result.description,i.result.ext)):o.resolve(i.result)}this.resolvers.delete(e.responseId)}}else n===Dw.HandshakeResponse&&r&&(clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=e.extensionId,this.extensionVersion=e.body.version,this.logger.verbose("NativeMessageHandler - Received HandshakeResponse from extension: "+this.extensionId),this.handshakeEvent.endMeasurement({extensionInstalled:!0,success:!0}),r.resolve(),this.handshakeResolvers.delete(e.responseId))}catch(e){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii("Error parsing response from WAM Extension: "+e.toString()),this.logger.errorPii("Unable to parse "+t),o?o.reject(e):r&&r.reject(e)}},G0.prototype.getExtensionId=function(){return this.extensionId},G0.prototype.getExtensionVersion=function(){return this.extensionVersion},G0.isNativeAvailable=function(e,t,o,r){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!o)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(r)switch(r){case Zg.BEARER:case Zg.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0};var K0=G0;function G0(e,t,o,r){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=r,this.resolvers=new Map,this.handshakeResolvers=new Map,this.responseId=0,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=o,this.handshakeEvent=o.startMeasurement(A.NativeMessageHandlerHandshake)}Og(Z0,Y0=n),Z0.prototype.acquireToken=function(u){return _(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c=this;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationRequest,u.correlationId),[4,this.initializeAuthorizationRequest(u,R.Redirect)];case 1:t=e.sent(),this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||S.EMPTY_STRING,t.account||null),o=this.initializeServerTelemetryManager(Fw.acquireTokenRedirect),r=function(e){e.persisted&&(c.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),c.browserStorage.cleanRequestByState(t.state),c.eventHandler.emitEvent(x.RESTORE_FROM_BFCACHE,R.Redirect))},e.label=2;case 2:return e.trys.push([2,7,,8]),this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationCodeRequest,u.correlationId),[4,this.initializeAuthorizationCodeRequest(t)];case 3:return n=e.sent(),this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,u.correlationId),[4,this.createAuthCodeClient(o,t.authority,t.azureCloudOptions)];case 4:return a=e.sent(),this.logger.verbose("Auth code client created"),i=new O0(a,this.browserStorage,n,this.logger,this.browserCrypto,this.performanceClient),[4,a.getAuthCodeUrl(v(v({},t),{nativeBroker:K0.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,u.authenticationScheme)}))];case 5:return a=e.sent(),s=this.getRedirectStartPage(u.redirectStartPage),this.logger.verbosePii("Redirect start page: "+s),window.addEventListener("pageshow",r),[4,i.initiateAuthRequest(a,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:s,onRedirectNavigate:u.onRedirectNavigate})];case 6:return[2,e.sent()];case 7:throw(s=e.sent())instanceof T&&s.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o.cacheFailedRequest(s),this.browserStorage.cleanRequestByState(t.state),s;case 8:return[2]}})})},Z0.prototype.handleRedirectPromise=function(h){return _(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c,u,l;return w(this,function(e){switch(e.label){case 0:t=this.initializeServerTelemetryManager(Fw.handleRedirectPromise),e.label=1;case 1:if(e.trys.push([1,10,,11]),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),[2,null];if(!(o=this.getRedirectResponseHash(h||window.location.hash)))return this.logger.info("handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(R.Redirect),[2,null];r=void 0;try{n=P.getDeserializedHash(o),r=this.validateAndExtractStateFromHash(n,R.Redirect),this.logger.verbose("State extracted from hash")}catch(e){return this.logger.info("handleRedirectPromise was unable to extract state due to: "+e),this.browserStorage.cleanRequestByInteractionType(R.Redirect),[2,null]}return(i=this.browserStorage.getTemporaryCache(jw.ORIGIN_URI,!0)||S.EMPTY_STRING,a=P.removeHashFromUrl(i),u=P.removeHashFromUrl(window.location.href),a===u&&this.config.auth.navigateToLoginRequestUrl)?(this.logger.verbose("Current page is loginRequestUrl, handling hash"),[4,this.handleHash(o,r,t)]):[3,3];case 2:return a=e.sent(),-1<i.indexOf("#")&&b0.replaceHash(i),[2,a];case 3:return this.config.auth.navigateToLoginRequestUrl?[3,4]:(this.logger.verbose("NavigateToLoginRequestUrl set to false, handling hash"),[2,this.handleHash(o,r,t)]);case 4:return b0.isInIframe()&&!this.config.system.allowRedirectInIframe?[3,9]:(this.browserStorage.setTemporaryCache(jw.URL_HASH,o,!0),s={apiId:Fw.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0},c=!0,i&&"null"!==i?[3,6]:(u=b0.getHomepage(),this.browserStorage.setTemporaryCache(jw.ORIGIN_URI,u,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),[4,this.navigationClient.navigateInternal(u,s)]));case 5:return c=e.sent(),[3,8];case 6:return this.logger.verbose("Navigating to loginRequestUrl: "+i),[4,this.navigationClient.navigateInternal(i,s)];case 7:c=e.sent(),e.label=8;case 8:if(!c)return[2,this.handleHash(o,r,t)];e.label=9;case 9:return[2,null];case 10:throw(l=e.sent())instanceof T&&l.setCorrelationId(this.correlationId),t.cacheFailedRequest(l),this.browserStorage.cleanRequestByInteractionType(R.Redirect),l;case 11:return[2]}})})},Z0.prototype.getRedirectResponseHash=function(e){return this.logger.verbose("getRedirectResponseHash called"),P.hashContainsKnownProperties(e)?(b0.clearHash(window),this.logger.verbose("Hash contains known properties, returning response hash")):(e=this.browserStorage.getTemporaryCache(jw.URL_HASH,!0),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(jw.URL_HASH)),this.logger.verbose("Hash does not contain known properties, returning cached hash")),e},Z0.prototype.handleHash=function(i,a,s){return _(this,void 0,void 0,function(){var t,o,r,n=this;return w(this,function(e){switch(e.label){case 0:if(t=this.browserStorage.getCachedRequest(a,this.browserCrypto),this.logger.verbose("handleHash called, retrieved cached request"),(o=P.getDeserializedHash(i)).accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),this.nativeMessageHandler)return o=new F0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Fw.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,o.accountId,this.nativeStorage,t.correlationId),r=Gv.parseRequestState(this.browserCrypto,a).userRequestState,[2,o.acquireToken(v(v({},t),{state:r,prompt:void 0})).finally(function(){n.browserStorage.cleanRequestByState(a)})];throw O.createNativeConnectionNotEstablishedError()}if(o=this.browserStorage.getCachedAuthority(a))return this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,t.correlationId),[4,this.createAuthCodeClient(s,o)];throw O.createNoCachedAuthorityError();case 1:return r=e.sent(),this.logger.verbose("Auth code client created"),mv.removeThrottle(this.browserStorage,this.config.auth.clientId,t),[4,new O0(r,this.browserStorage,t,this.logger,this.browserCrypto,this.performanceClient).handleCodeResponseFromHash(i,a,r.authority,this.networkClient)];case 2:return[2,e.sent()]}})})},Z0.prototype.logout=function(a){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:this.logger.verbose("logoutRedirect called"),t=this.initializeLogoutRequest(a),o=this.initializeServerTelemetryManager(Fw.logout),e.label=1;case 1:return e.trys.push([1,10,,11]),this.eventHandler.emitEvent(x.LOGOUT_START,R.Redirect,a),[4,this.clearCacheOnLogout(t.account)];case 2:return e.sent(),r={apiId:Fw.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,t.correlationId),[4,this.createAuthCodeClient(o,a&&a.authority)];case 3:return(n=e.sent(),this.logger.verbose("Auth code client created"),n=n.getLogoutUri(t),this.eventHandler.emitEvent(x.LOGOUT_SUCCESS,R.Redirect,t),a&&"function"==typeof a.onRedirectNavigate)?!1===a.onRedirectNavigate(n)?[3,5]:(this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),[4,this.navigationClient.navigateExternal(n,r)]):[3,7];case 4:return e.sent(),[2];case 5:this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation"),e.label=6;case 6:return[3,9];case 7:return this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),[4,this.navigationClient.navigateExternal(n,r)];case 8:return e.sent(),[2];case 9:return[3,11];case 10:throw(i=e.sent())instanceof T&&i.setCorrelationId(this.correlationId),o.cacheFailedRequest(i),this.eventHandler.emitEvent(x.LOGOUT_FAILURE,R.Redirect,null,i),this.eventHandler.emitEvent(x.LOGOUT_END,R.Redirect),i;case 11:return this.eventHandler.emitEvent(x.LOGOUT_END,R.Redirect),[2]}})})},Z0.prototype.getRedirectStartPage=function(e){e=e||window.location.href;return P.getAbsoluteUrl(e,b0.getCurrentUri())};var Y0,W0=Z0;function Z0(e,t,o,r,n,i,a,s,c,u){e=Y0.call(this,e,t,o,r,n,i,a,c,u)||this;return e.nativeStorage=s,e}Og(J0,Q0=n),J0.prototype.acquireToken=function(e){try{var t,o=this.generatePopupName(e.scopes||Qg,e.authority||this.config.auth.authority),r=e.popupWindowAttributes||{};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,o,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),t=this.openSizedPopup("about:blank",o,r),this.acquireTokenPopupAsync(e,o,r,t))}catch(e){return Promise.reject(e)}},J0.prototype.logout=function(e){try{this.logger.verbose("logoutPopup called");var t,o=this.initializeLogoutRequest(e),r=this.generateLogoutPopupName(o),n=e&&e.authority,i=e&&e.mainWindowRedirectUri,a=(null==e?void 0:e.popupWindowAttributes)||{};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(o,r,a,n,void 0,i)):(this.logger.verbose("asyncPopup set to false, opening popup"),t=this.openSizedPopup("about:blank",r,a),this.logoutPopupAsync(o,r,a,n,t,i))}catch(e){return Promise.reject(e)}},J0.prototype.acquireTokenPopupAsync=function(p,f,g,m){return _(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c,u,l,h,d=this;return w(this,function(e){switch(e.label){case 0:return this.logger.verbose("acquireTokenPopupAsync called"),t=this.initializeServerTelemetryManager(Fw.acquireTokenPopup),this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationRequest,p.correlationId),[4,this.initializeAuthorizationRequest(p,R.Popup)];case 1:o=e.sent(),this.browserStorage.updateCacheEntries(o.state,o.nonce,o.authority,o.loginHint||S.EMPTY_STRING,o.account||null),e.label=2;case 2:return e.trys.push([2,8,,9]),this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationCodeRequest,p.correlationId),[4,this.initializeAuthorizationCodeRequest(o)];case 3:return r=e.sent(),this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,p.correlationId),[4,this.createAuthCodeClient(t,o.authority,o.azureCloudOptions)];case 4:return n=e.sent(),this.logger.verbose("Auth code client created"),a=K0.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,p.authenticationScheme),i=void 0,a&&(i=this.performanceClient.startMeasurement(A.FetchAccountIdWithNativeBroker,p.correlationId)),[4,n.getAuthCodeUrl(v(v({},o),{nativeBroker:a}))];case 5:return a=e.sent(),s=new I0(n,this.browserStorage,r,this.logger,this.performanceClient),c={popup:m,popupName:f,popupWindowAttributes:g},c=this.initiateAuthRequest(a,c),this.eventHandler.emitEvent(x.POPUP_OPENED,R.Popup,{popupWindow:c},null),[4,this.monitorPopupForHash(c)];case 6:if(c=e.sent(),h=P.getDeserializedHash(c),u=this.validateAndExtractStateFromHash(h,R.Popup,o.correlationId),mv.removeThrottle(this.browserStorage,this.config.auth.clientId,r),h.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),i&&i.endMeasurement({success:!0,isNativeBroker:!0}),this.nativeMessageHandler)return h=new F0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Fw.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,h.accountId,this.nativeStorage,o.correlationId),l=Gv.parseRequestState(this.browserCrypto,u).userRequestState,[2,h.acquireToken(v(v({},o),{state:l,prompt:void 0})).finally(function(){d.browserStorage.cleanRequestByState(u)})];throw O.createNativeConnectionNotEstablishedError()}return[4,s.handleCodeResponseFromHash(c,u,n.authority,this.networkClient)];case 7:return[2,e.sent()];case 8:throw h=e.sent(),m&&m.close(),h instanceof T&&h.setCorrelationId(this.correlationId),t.cacheFailedRequest(h),this.browserStorage.cleanRequestByState(o.state),h;case 9:return[2]}})})},J0.prototype.logoutPopupAsync=function(n,i,a,s,c,u){return _(this,void 0,void 0,function(){var t,o,r;return w(this,function(e){switch(e.label){case 0:this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(x.LOGOUT_START,R.Popup,n),t=this.initializeServerTelemetryManager(Fw.logoutPopup),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,this.clearCacheOnLogout(n.account)];case 2:return e.sent(),this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,n.correlationId),[4,this.createAuthCodeClient(t,s)];case 3:return o=e.sent(),this.logger.verbose("Auth code client created"),o=o.getLogoutUri(n),this.eventHandler.emitEvent(x.LOGOUT_SUCCESS,R.Popup,n),o=this.openPopup(o,{popupName:i,popupWindowAttributes:a,popup:c}),this.eventHandler.emitEvent(x.POPUP_OPENED,R.Popup,{popupWindow:o},null),[4,this.waitForLogoutPopup(o)];case 4:return e.sent(),u?(o={apiId:Fw.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},r=P.getAbsoluteUrl(u,b0.getCurrentUri()),this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii("Redirecting main window to: "+r),this.navigationClient.navigateInternal(r,o)):this.logger.verbose("No main window navigation requested"),[3,6];case 5:throw r=e.sent(),c&&c.close(),r instanceof T&&r.setCorrelationId(this.correlationId),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(x.LOGOUT_FAILURE,R.Popup,null,r),this.eventHandler.emitEvent(x.LOGOUT_END,R.Popup),t.cacheFailedRequest(r),r;case 6:return this.eventHandler.emitEvent(x.LOGOUT_END,R.Popup),[2]}})})},J0.prototype.initiateAuthRequest=function(e,t){if(k.isEmpty(e))throw this.logger.error("Navigate url is empty"),O.createEmptyNavigationUriError();return this.logger.infoPii("Navigate to: "+e),this.openPopup(e,t)},J0.prototype.monitorPopupForHash=function(s){var c=this;return new Promise(function(o,r){var n=c.config.system.windowHashTimeout/c.config.system.pollIntervalMilliseconds,i=0,a=(c.logger.verbose("PopupHandler.monitorPopupForHash - polling started"),setInterval(function(){if(s.closed)c.logger.error("PopupHandler.monitorPopupForHash - window closed"),c.cleanPopup(),clearInterval(a),r(O.createUserCancelledError());else{var e=S.EMPTY_STRING,t=S.EMPTY_STRING;try{e=s.location.href,t=s.location.hash}catch(e){}k.isEmpty(e)||"about:blank"===e||(c.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),i++,t?(c.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url"),clearInterval(a),c.cleanPopup(s),P.hashContainsKnownProperties(t)?(c.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning."),o(t)):(c.logger.error("PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely."),c.logger.errorPii("PopupHandler.monitorPopupForHash - hash found: "+t),r(O.createHashDoesNotContainKnownPropertiesError()))):n<i&&(c.logger.error("PopupHandler.monitorPopupForHash - unable to find hash in url, timing out"),clearInterval(a),r(O.createMonitorPopupTimeoutError())))}},c.config.system.pollIntervalMilliseconds))})},J0.prototype.waitForLogoutPopup=function(r){var n=this;return new Promise(function(t){n.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");var o=setInterval(function(){r.closed&&(n.logger.error("PopupHandler.waitForLogoutPopup - window closed"),n.cleanPopup(),clearInterval(o),t());var e=S.EMPTY_STRING;try{e=r.location.href}catch(e){}k.isEmpty(e)||"about:blank"===e||(n.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing."),clearInterval(o),n.cleanPopup(r),t())},n.config.system.pollIntervalMilliseconds)})},J0.prototype.openPopup=function(e,t){try{var o=void 0;if(t.popup?(o=t.popup,this.logger.verbosePii("Navigating popup window to: "+e),o.location.assign(e)):void 0===t.popup&&(this.logger.verbosePii("Opening popup window to: "+e),o=this.openSizedPopup(e,t.popupName,t.popupWindowAttributes)),o)return o.focus&&o.focus(),this.currentWindow=o,window.addEventListener("beforeunload",this.unloadWindow),o;throw O.createEmptyWindowCreatedError()}catch(e){throw this.logger.error("error opening popup "+e.message),this.browserStorage.setInteractionInProgress(!1),O.createPopupWindowError(e.toString())}},J0.prototype.openSizedPopup=function(e,t,o){var r=window.screenLeft||window.screenX,n=window.screenTop||window.screenY,i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,s=null==(s=o.popupSize)?void 0:s.width,c=null==(c=o.popupSize)?void 0:c.height,u=null==(u=o.popupPosition)?void 0:u.top,o=null==(o=o.popupPosition)?void 0:o.left;return(!s||s<0||i<s)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),s=Kw.POPUP_WIDTH),(!c||c<0||a<c)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),c=Kw.POPUP_HEIGHT),(!u||u<0||a<u)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),u=Math.max(0,a/2-Kw.POPUP_HEIGHT/2+n)),(!o||o<0||i<o)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),o=Math.max(0,i/2-Kw.POPUP_WIDTH/2+r)),window.open(e,t,"width="+s+", height="+c+", top="+u+", left="+o+", scrollbars=yes")},J0.prototype.unloadWindow=function(e){this.browserStorage.cleanRequestByInteractionType(R.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()},J0.prototype.cleanPopup=function(e){e&&e.close(),window.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)},J0.prototype.generatePopupName=function(e,t){return Kw.POPUP_NAME_PREFIX+"."+this.config.auth.clientId+"."+e.join("-")+"."+t+"."+this.correlationId},J0.prototype.generateLogoutPopupName=function(e){e=e.account&&e.account.homeAccountId;return Kw.POPUP_NAME_PREFIX+"."+this.config.auth.clientId+"."+e+"."+this.correlationId};var Q0,V0=J0;function J0(e,t,o,r,n,i,a,s,c,u){e=Q0.call(this,e,t,o,r,n,i,a,c,u)||this;return e.unloadWindow=e.unloadWindow.bind(e),e.nativeStorage=s,e}$0.prototype.navigateInternal=function(e,t){return $0.defaultNavigateWindow(e,t)},$0.prototype.navigateExternal=function(e,t){return $0.defaultNavigateWindow(e,t)},$0.defaultNavigateWindow=function(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(function(e){setTimeout(function(){e(!0)},t.timeout)})};var X0=$0;function $0(){}var eb=6e4,tb=6e3,ob=3e4,rb=2e3;Og(ab,nb=I0),ab.prototype.initiateAuthRequest=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:if(this.performanceClient.addQueueMeasurement(A.SilentHandlerInitiateAuthRequest,this.authCodeRequest.correlationId),k.isEmpty(t))throw this.logger.info("Navigate url is empty"),O.createEmptyNavigationUriError();return this.navigateFrameWait?(this.performanceClient.setPreQueueTime(A.SilentHandlerLoadFrame,this.authCodeRequest.correlationId),[4,this.loadFrame(t)]):[3,2];case 1:return[2,e.sent()];case 2:return[2,this.loadFrameSync(t)]}})})},ab.prototype.monitorIframeForHash=function(a,e){var s=this;return this.performanceClient.addQueueMeasurement(A.SilentHandlerMonitorIframeForHash,this.authCodeRequest.correlationId),new Promise(function(o,r){e<tb&&s.logger.warning("system.loadFrameTimeout or system.iframeHashTimeout set to lower ("+e+"ms) than the default ("+tb+"ms). This may result in timeouts.");var n=window.performance.now()+e,i=setInterval(function(){if(window.performance.now()>n)s.removeHiddenIframe(a),clearInterval(i),r(O.createMonitorIframeTimeoutError());else{var e=S.EMPTY_STRING,t=a.contentWindow;try{e=t?t.location.href:S.EMPTY_STRING}catch(e){}k.isEmpty(e)||(e=t?t.location.hash:S.EMPTY_STRING,P.hashContainsKnownProperties(e)&&(s.removeHiddenIframe(a),clearInterval(i),o(e)))}},s.pollIntervalMilliseconds)})},ab.prototype.loadFrame=function(r){var n=this;return this.performanceClient.addQueueMeasurement(A.SilentHandlerLoadFrame,this.authCodeRequest.correlationId),new Promise(function(e,t){var o=n.createHiddenIframe();setTimeout(function(){o?(o.src=r,e(o)):t("Unable to load iframe")},n.navigateFrameWait)})},ab.prototype.loadFrameSync=function(e){var t=this.createHiddenIframe();return t.src=e,t},ab.prototype.createHiddenIframe=function(){var e=document.createElement("iframe");return e.style.visibility="hidden",e.style.position="absolute",e.style.width=e.style.height="0",e.style.border="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.getElementsByTagName("body")[0].appendChild(e),e},ab.prototype.removeHiddenIframe=function(e){document.body===e.parentNode&&document.body.removeChild(e)};var nb,ib=ab;function ab(e,t,o,r,n,i){e=nb.call(this,e,t,o,r,i)||this;return e.navigateFrameWait=n.navigateFrameWait,e.pollIntervalMilliseconds=n.pollIntervalMilliseconds,e}Og(ub,sb=n),ub.prototype.acquireToken=function(i){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.performanceClient.addQueueMeasurement(A.SilentIframeClientAcquireToken,i.correlationId),this.logger.verbose("acquireTokenByIframe called"),t=this.performanceClient.startMeasurement(A.SilentIframeClientAcquireToken,i.correlationId),k.isEmpty(i.loginHint)&&k.isEmpty(i.sid)&&(!i.account||k.isEmpty(i.account.username))&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request."),i.prompt&&i.prompt!==Jg.NONE&&i.prompt!==Jg.NO_SESSION)throw t.endMeasurement({success:!1}),O.createSilentPromptValueError(i.prompt);return this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationRequest,i.correlationId),[4,this.initializeAuthorizationRequest(v(v({},i),{prompt:i.prompt||Jg.NONE}),R.Silent)];case 1:o=e.sent(),this.browserStorage.updateCacheEntries(o.state,o.nonce,o.authority,o.loginHint||S.EMPTY_STRING,o.account||null),r=this.initializeServerTelemetryManager(this.apiId),e.label=2;case 2:return e.trys.push([2,5,,6]),this.performanceClient.setPreQueueTime(A.StandardInteractionClientCreateAuthCodeClient,i.correlationId),[4,this.createAuthCodeClient(r,o.authority,o.azureCloudOptions)];case 3:return n=e.sent(),this.logger.verbose("Auth code client created"),this.performanceClient.setPreQueueTime(A.SilentIframeClientTokenHelper,i.correlationId),[4,this.silentTokenHelper(n,o).then(function(e){return t.endMeasurement({success:!0,fromCache:!1,requestId:e.requestId}),e})];case 4:return[2,e.sent()];case 5:throw(n=e.sent())instanceof T&&n.setCorrelationId(this.correlationId),r.cacheFailedRequest(n),this.browserStorage.cleanRequestByState(o.state),t.endMeasurement({errorCode:n instanceof T&&n.errorCode||void 0,subErrorCode:n instanceof T&&n.subError||void 0,success:!1}),n;case 6:return[2]}})})},ub.prototype.logout=function(){return Promise.reject(O.createSilentLogoutUnsupportedError())},ub.prototype.silentTokenHelper=function(u,l){return _(this,void 0,void 0,function(){var t,o,r,n,i,a,s,c=this;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.SilentIframeClientTokenHelper,l.correlationId),this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationCodeRequest,l.correlationId),[4,this.initializeAuthorizationCodeRequest(l)];case 1:return t=e.sent(),this.performanceClient.setPreQueueTime(A.GetAuthCodeUrl,l.correlationId),[4,u.getAuthCodeUrl(v(v({},l),{nativeBroker:K0.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,l.authenticationScheme)}))];case 2:return r=e.sent(),o=new ib(u,this.browserStorage,t,this.logger,this.config.system,this.performanceClient),this.performanceClient.setPreQueueTime(A.SilentHandlerInitiateAuthRequest,l.correlationId),[4,o.initiateAuthRequest(r)];case 3:return r=e.sent(),this.performanceClient.setPreQueueTime(A.SilentHandlerMonitorIframeForHash,l.correlationId),[4,o.monitorIframeForHash(r,this.config.system.iframeHashTimeout)];case 4:if(n=e.sent(),a=P.getDeserializedHash(n),i=this.validateAndExtractStateFromHash(a,R.Silent,t.correlationId),a.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),this.nativeMessageHandler)return a=new F0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,a.accountId,this.browserStorage,this.correlationId),s=Gv.parseRequestState(this.browserCrypto,i).userRequestState,[2,a.acquireToken(v(v({},l),{state:s,prompt:l.prompt||Jg.NONE})).finally(function(){c.browserStorage.cleanRequestByState(i)})];throw O.createNativeConnectionNotEstablishedError()}return this.performanceClient.setPreQueueTime(A.HandleCodeResponseFromHash,l.correlationId),[2,o.handleCodeResponseFromHash(n,i,u.authority,this.networkClient)]}})})};var sb,cb=ub;function ub(e,t,o,r,n,i,a,s,c,u,l){e=sb.call(this,e,t,o,r,n,i,s,u,l)||this;return e.apiId=a,e.nativeStorage=c,e}Og(db,lb=n),db.prototype.acquireToken=function(s){return _(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.addQueueMeasurement(A.SilentRefreshClientAcquireToken,s.correlationId),this.performanceClient.setPreQueueTime(A.InitializeBaseRequest,s.correlationId),o=[v({},s)],[4,this.initializeBaseRequest(s,s.account)];case 1:return t=v.apply(void 0,o.concat([e.sent()])),r=this.performanceClient.startMeasurement(A.SilentRefreshClientAcquireToken,t.correlationId),n=this.initializeServerTelemetryManager(Fw.acquireTokenSilent_silentFlow),[4,this.createRefreshTokenClient(n,t.authority,t.azureCloudOptions)];case 2:return i=e.sent(),this.logger.verbose("Refresh token client created"),this.performanceClient.setPreQueueTime(A.RefreshTokenClientAcquireTokenByRefreshToken,s.correlationId),[2,i.acquireTokenByRefreshToken(t).then(function(e){return r.endMeasurement({success:!0,fromCache:e.fromCache,requestId:e.requestId}),e}).catch(function(e){throw e instanceof T&&e.setCorrelationId(a.correlationId),n.cacheFailedRequest(e),r.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})]}})})},db.prototype.logout=function(){return Promise.reject(O.createSilentLogoutUnsupportedError())},db.prototype.createRefreshTokenClient=function(o,r,n){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetClientConfiguration,this.correlationId),[4,this.getClientConfiguration(o,r,n)];case 1:return t=e.sent(),[2,new u_(t,this.performanceClient)]}})})};var lb,hb=db;function db(){return null!==lb&&lb.apply(this,arguments)||this}fb.prototype.addEventCallback=function(e){var t;return"undefined"!=typeof window?(t=this.browserCrypto.createNewGuid(),this.eventCallbacks.set(t,e),this.logger.verbose("Event callback registered with id: "+t),t):null},fb.prototype.removeEventCallback=function(e){this.eventCallbacks.delete(e),this.logger.verbose("Event callback "+e+" removed.")},fb.prototype.enableAccountStorageEvents=function(){"undefined"!=typeof window&&(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))},fb.prototype.disableAccountStorageEvents=function(){"undefined"!=typeof window&&(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))},fb.prototype.emitEvent=function(o,e,t,r){var n,i=this;"undefined"!=typeof window&&(n={eventType:o,interactionType:e||null,payload:t||null,error:r||null,timestamp:Date.now()},this.logger.info("Emitting event: "+o),this.eventCallbacks.forEach(function(e,t){i.logger.verbose("Emitting event to callback "+t+": "+o),e.apply(null,[n])}))},fb.prototype.handleAccountCacheChange=function(e){try{var t,o,r=e.newValue||e.oldValue;r&&"object"==typeof(t=JSON.parse(r))&&Vy.isAccountEntity(t)&&(o=ev.toObject(new Vy,t).getAccountInfo(),!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.emitEvent(x.ACCOUNT_ADDED,void 0,o)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.emitEvent(x.ACCOUNT_REMOVED,void 0,o)))}catch(e){}};var pb=fb;function fb(e,t){this.eventCallbacks=new Map,this.logger=e,this.browserCrypto=t,this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}mb.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t};var gb=mb;function mb(){}vb.prototype.generateGuid=function(){try{var e=new Uint8Array(16);return this.cryptoObj.getRandomValues(e),e[6]|=64,e[6]&=79,e[8]|=128,e[8]&=191,gb.decimalToHex(e[0])+gb.decimalToHex(e[1])+gb.decimalToHex(e[2])+gb.decimalToHex(e[3])+"-"+gb.decimalToHex(e[4])+gb.decimalToHex(e[5])+"-"+gb.decimalToHex(e[6])+gb.decimalToHex(e[7])+"-"+gb.decimalToHex(e[8])+gb.decimalToHex(e[9])+"-"+gb.decimalToHex(e[10])+gb.decimalToHex(e[11])+gb.decimalToHex(e[12])+gb.decimalToHex(e[13])+gb.decimalToHex(e[14])+gb.decimalToHex(e[15])}catch(e){for(var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",o="0123456789abcdef",r=0,n=S.EMPTY_STRING,i=0;i<36;i++)"-"!==t[i]&&"4"!==t[i]&&(r=16*Math.random()|0),n+="x"===t[i]?o[r]:"y"===t[i]?o[r=r&3|8]:t[i];return n}},vb.prototype.isGuid=function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)};var yb=vb;function vb(e){this.cryptoObj=e}wb.stringToUtf8Arr=function(e){for(var t,o=0,r=e.length,n=0;n<r;n++)o+=(t=e.charCodeAt(n))<128?1:t<2048?2:t<65536?3:t<2097152?4:t<67108864?5:6;for(var i=new Uint8Array(o),a=0,s=0;a<o;s++)(t=e.charCodeAt(s))<128?i[a++]=t:(t<2048?i[a++]=192+(t>>>6):(t<65536?i[a++]=224+(t>>>12):(t<2097152?i[a++]=240+(t>>>18):(t<67108864?i[a++]=248+(t>>>24):(i[a++]=252+(t>>>30),i[a++]=128+(t>>>24&63)),i[a++]=128+(t>>>18&63)),i[a++]=128+(t>>>12&63)),i[a++]=128+(t>>>6&63)),i[a++]=128+(63&t));return i},wb.stringToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),r=0;r<e.length;r++)o[r]=e.charCodeAt(r);return t},wb.utf8ArrToString=function(e){for(var t,o=S.EMPTY_STRING,r=e.length,n=0;n<r;n++)t=e[n],o+=String.fromCharCode(251<t&&t<254&&n+5<r?1073741824*(t-252)+(e[++n]-128<<24)+(e[++n]-128<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:247<t&&t<252&&n+4<r?(t-248<<24)+(e[++n]-128<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:239<t&&t<248&&n+3<r?(t-240<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:223<t&&t<240&&n+2<r?(t-224<<12)+(e[++n]-128<<6)+e[++n]-128:191<t&&t<224&&n+1<r?(t-192<<6)+e[++n]-128:t);return o},wb.getSortedObjectString=function(e){return JSON.stringify(e,Object.keys(e).sort())};var _b=wb;function wb(){}Cb.prototype.urlEncode=function(e){return encodeURIComponent(this.encode(e).replace(/=/g,S.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_"))},Cb.prototype.urlEncodeArr=function(e){return this.base64EncArr(e).replace(/=/g,S.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_")},Cb.prototype.encode=function(e){e=_b.stringToUtf8Arr(e);return this.base64EncArr(e)},Cb.prototype.base64EncArr=function(e){for(var t,o=(3-e.length%3)%3,r=S.EMPTY_STRING,n=e.length,i=0,a=0;a<n;a++)i|=e[a]<<(16>>>(t=a%3)&24),2!=t&&e.length-a!=1||(r+=String.fromCharCode(this.uint6ToB64(i>>>18&63),this.uint6ToB64(i>>>12&63),this.uint6ToB64(i>>>6&63),this.uint6ToB64(63&i)),i=0);return 0==o?r:r.substring(0,r.length-o)+(1==o?"=":"==")},Cb.prototype.uint6ToB64=function(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65};var bb=Cb;function Cb(){}Sb.prototype.decode=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Invalid base64 string")}e=this.base64DecToArr(t);return _b.utf8ArrToString(e)},Sb.prototype.base64DecToArr=function(e,t){for(var o,r=e.replace(/[^A-Za-z0-9\+\/]/g,S.EMPTY_STRING),n=r.length,i=t?Math.ceil((3*n+1>>>2)/t)*t:3*n+1>>>2,a=new Uint8Array(i),s=void 0,c=0,u=0,l=0;l<n;l++)if(o=3&l,c|=this.b64ToUint6(r.charCodeAt(l))<<18-6*o,3==o||n-l==1){for(s=0;s<3&&u<i;s++,u++)a[u]=c>>>(16>>>s&24)&255;c=0}return a},Sb.prototype.b64ToUint6=function(e){return 64<e&&e<91?e-65:96<e&&e<123?e-71:47<e&&e<58?e+4:43===e?62:47===e?63:0};var Eb=Sb;function Sb(){}Ib.prototype.generateCodes=function(){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:return t=this.generateCodeVerifier(),[4,this.generateCodeChallengeFromVerifier(t)];case 1:return o=e.sent(),[2,{verifier:t,challenge:o}]}})})},Ib.prototype.generateCodeVerifier=function(){try{var e=new Uint8Array(32);return this.cryptoObj.getRandomValues(e),this.base64Encode.urlEncodeArr(e)}catch(e){throw O.createPkceNotGeneratedError(e)}},Ib.prototype.generateCodeChallengeFromVerifier=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.cryptoObj.sha256Digest(o)];case 1:return t=e.sent(),[2,this.base64Encode.urlEncodeArr(new Uint8Array(t))];case 2:throw t=e.sent(),O.createPkceNotGeneratedError(t);case 3:return[2]}})})};var Tb=Ib;function Ib(e){this.base64Encode=new bb,this.cryptoObj=e}Ab.prototype.getRandomValues=function(e){return window.crypto.getRandomValues(e)},Ab.prototype.generateKey=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.generateKey(t,o,r)]})})},Ab.prototype.exportKey=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.exportKey(Qw,t)]})})},Ab.prototype.importKey=function(t,o,r,n){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.importKey(Qw,t,o,r,n)]})})},Ab.prototype.sign=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.sign(t,o,r)]})})},Ab.prototype.digest=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.crypto.subtle.digest(t,o)]})})};var kb=Ab;function Ab(){}Ob.prototype.initPrng=function(e){return window.msrCrypto.initPrng(xg(e))},Ob.prototype.getRandomValues=function(e){return window.msrCrypto.getRandomValues(e)},Ob.prototype.generateKey=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.generateKey(t,o,r)]})})},Ob.prototype.exportKey=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.exportKey(Qw,t)]})})},Ob.prototype.importKey=function(t,o,r,n){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.importKey(Qw,t,o,r,n)]})})},Ob.prototype.sign=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.sign(t,o,r)]})})},Ob.prototype.digest=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,window.msrCrypto.subtle.digest(t,o)]})})};var Pb=Ob;function Ob(){}xb.prototype.getRandomValues=function(e){return window.msCrypto.getRandomValues(e)},xb.prototype.generateKey=function(r,n,i){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,new Promise(function(t,o){var e=window.msCrypto.subtle.generateKey(r,n,i);e.addEventListener("complete",function(e){t(e.target.result)}),e.addEventListener("error",function(e){o(e)})})]})})},xb.prototype.exportKey=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,new Promise(function(o,r){var e=window.msCrypto.subtle.exportKey(Qw,t);e.addEventListener("complete",function(e){var t=e.target.result,t=_b.utf8ArrToString(new Uint8Array(t)).replace(/\r/g,S.EMPTY_STRING).replace(/\n/g,S.EMPTY_STRING).replace(/\t/g,S.EMPTY_STRING).split(" ").join(S.EMPTY_STRING).replace("\0",S.EMPTY_STRING);try{o(JSON.parse(t))}catch(e){r(e)}}),e.addEventListener("error",function(e){r(e)})})]})})},xb.prototype.importKey=function(o,n,i,a){return _(this,void 0,void 0,function(){var t,r;return w(this,function(e){return t=_b.getSortedObjectString(o),r=_b.stringToArrayBuffer(t),[2,new Promise(function(t,o){var e=window.msCrypto.subtle.importKey(Qw,r,n,i,a);e.addEventListener("complete",function(e){t(e.target.result)}),e.addEventListener("error",function(e){o(e)})})]})})},xb.prototype.sign=function(r,n,i){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,new Promise(function(t,o){var e=window.msCrypto.subtle.sign(r,n,i);e.addEventListener("complete",function(e){t(e.target.result)}),e.addEventListener("error",function(e){o(e)})})]})})},xb.prototype.digest=function(r,n){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,new Promise(function(t,o){var e=window.msCrypto.subtle.digest(r,n.buffer);e.addEventListener("complete",function(e){t(e.target.result)}),e.addEventListener("error",function(e){o(e)})})]})})};var Rb=xb;function xb(){}var Mb="SHA-256",Nb=new Uint8Array([1,0,1]),Lb=(Db.prototype.hasIECrypto=function(){return"msCrypto"in window},Db.prototype.hasBrowserCrypto=function(){return"crypto"in window},Db.prototype.hasMsrCrypto=function(){return"msrCrypto"in window},Db.prototype.sha256Digest=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return t=_b.stringToUtf8Arr(o),[2,this.subtleCrypto.digest({name:Mb},t)]})})},Db.prototype.getRandomValues=function(e){return this.subtleCrypto.getRandomValues(e)},Db.prototype.generateKeyPair=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.subtleCrypto.generateKey(this.keygenAlgorithmOptions,t,o)]})})},Db.prototype.exportJwk=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.subtleCrypto.exportKey(t)]})})},Db.prototype.importJwk=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.subtleCrypto.importKey(t,this.keygenAlgorithmOptions,o,r)]})})},Db.prototype.sign=function(t,o){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.subtleCrypto.sign(this.keygenAlgorithmOptions,t,o)]})})},Db);function Db(e,t){if(this.logger=e,this.cryptoOptions=t,this.hasBrowserCrypto())this.logger.verbose("BrowserCrypto: modern crypto interface available"),this.subtleCrypto=new kb;else if(this.hasIECrypto())this.logger.verbose("BrowserCrypto: MS crypto interface available"),this.subtleCrypto=new Rb;else{if(!this.hasMsrCrypto()||null==(e=this.cryptoOptions)||!e.useMsrCrypto)throw this.hasMsrCrypto()&&this.logger.info("BrowserCrypto: MSR Crypto interface available but system.cryptoOptions.useMsrCrypto not enabled"),this.logger.error("BrowserCrypto: No crypto interfaces available."),O.createCryptoNotAvailableError("Browser crypto, msCrypto, or msrCrypto interfaces not available.");this.logger.verbose("BrowserCrypto: MSR crypto interface available"),this.subtleCrypto=new Pb}if(this.subtleCrypto.initPrng){if(this.logger.verbose("BrowserCrypto: Interface requires entropy"),null==(t=this.cryptoOptions)||!t.entropy)throw this.logger.error("BrowserCrypto: Interface requires entropy but none provided."),i0.createEntropyNotProvided();this.logger.verbose("BrowserCrypto: Entropy provided"),this.subtleCrypto.initPrng(this.cryptoOptions.entropy)}this.keygenAlgorithmOptions={name:"RSASSA-PKCS1-v1_5",hash:Mb,modulusLength:2048,publicExponent:Nb}}Ub.prototype.open=function(){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){return[2,new Promise(function(t,e){var o=window.indexedDB.open(r.dbName,r.version);o.addEventListener("upgradeneeded",function(e){e.target.result.createObjectStore(r.tableName)}),o.addEventListener("success",function(e){r.db=e.target.result,r.dbOpen=!0,t()}),o.addEventListener("error",function(){return e(O.createDatabaseUnavailableError())})})]})})},Ub.prototype.closeConnection=function(){var e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)},Ub.prototype.validateDbIsOpen=function(){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return this.dbOpen?[3,2]:[4,this.open()];case 1:return[2,e.sent()];case 2:return[2]}})})},Ub.prototype.getItem=function(n){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(t,o){if(!r.db)return o(O.createDatabaseNotOpenError());var e=r.db.transaction([r.tableName],"readonly").objectStore(r.tableName).get(n);e.addEventListener("success",function(e){r.closeConnection(),t(e.target.result)}),e.addEventListener("error",function(e){r.closeConnection(),o(e)})})]}})})},Ub.prototype.setItem=function(n,i){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(e,t){if(!r.db)return t(O.createDatabaseNotOpenError());var o=r.db.transaction([r.tableName],"readwrite").objectStore(r.tableName).put(i,n);o.addEventListener("success",function(){r.closeConnection(),e()}),o.addEventListener("error",function(e){r.closeConnection(),t(e)})})]}})})},Ub.prototype.removeItem=function(n){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(e,t){if(!r.db)return t(O.createDatabaseNotOpenError());var o=r.db.transaction([r.tableName],"readwrite").objectStore(r.tableName).delete(n);o.addEventListener("success",function(){r.closeConnection(),e()}),o.addEventListener("error",function(e){r.closeConnection(),t(e)})})]}})})},Ub.prototype.getKeys=function(){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(t,o){if(!r.db)return o(O.createDatabaseNotOpenError());var e=r.db.transaction([r.tableName],"readonly").objectStore(r.tableName).getAllKeys();e.addEventListener("success",function(e){r.closeConnection(),t(e.target.result)}),e.addEventListener("error",function(e){r.closeConnection(),o(e)})})]}})})},Ub.prototype.containsKey=function(n){return _(this,void 0,void 0,function(){var r=this;return w(this,function(e){switch(e.label){case 0:return[4,this.validateDbIsOpen()];case 1:return e.sent(),[2,new Promise(function(t,o){if(!r.db)return o(O.createDatabaseNotOpenError());var e=r.db.transaction([r.tableName],"readonly").objectStore(r.tableName).count(n);e.addEventListener("success",function(e){r.closeConnection(),t(1===e.target.result)}),e.addEventListener("error",function(e){r.closeConnection(),o(e)})})]}})})},Ub.prototype.deleteDatabase=function(){return _(this,void 0,void 0,function(){return w(this,function(e){return this.db&&this.dbOpen&&this.closeConnection(),[2,new Promise(function(e,t){var o=window.indexedDB.deleteDatabase(Vw);o.addEventListener("success",function(){return e(!0)}),o.addEventListener("blocked",function(){return e(!0)}),o.addEventListener("error",function(){return t(!1)})})]})})};var qb=Ub;function Ub(){this.dbName=Vw,this.version=1,this.tableName="msal.db.keys",this.dbOpen=!1}Bb.prototype.handleDatabaseAccessError=function(e){if(!(e instanceof O&&e.errorCode===Pw.code))throw e;this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.")},Bb.prototype.getItem=function(r){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(t=this.inMemoryCache.getItem(r))return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),[4,this.indexedDBCache.getItem(r)];case 2:return[2,e.sent()];case 3:return o=e.sent(),this.handleDatabaseAccessError(o),[3,4];case 4:return[2,t]}})})},Bb.prototype.setItem=function(o,r){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:this.inMemoryCache.setItem(o,r),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.indexedDBCache.setItem(o,r)];case 2:return e.sent(),[3,4];case 3:return t=e.sent(),this.handleDatabaseAccessError(t),[3,4];case 4:return[2]}})})},Bb.prototype.removeItem=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:this.inMemoryCache.removeItem(o),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.indexedDBCache.removeItem(o)];case 2:return e.sent(),[3,4];case 3:return t=e.sent(),this.handleDatabaseAccessError(t),[3,4];case 4:return[2]}})})},Bb.prototype.getKeys=function(){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(0!==(t=this.inMemoryCache.getKeys()).length)return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),this.logger.verbose("In-memory cache is empty, now querying persistent storage."),[4,this.indexedDBCache.getKeys()];case 2:return[2,e.sent()];case 3:return o=e.sent(),this.handleDatabaseAccessError(o),[3,4];case 4:return[2,t]}})})},Bb.prototype.containsKey=function(r){return _(this,void 0,void 0,function(){var t,o;return w(this,function(e){switch(e.label){case 0:if(t=this.inMemoryCache.containsKey(r))return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),[4,this.indexedDBCache.containsKey(r)];case 2:return[2,e.sent()];case 3:return o=e.sent(),this.handleDatabaseAccessError(o),[3,4];case 4:return[2,t]}})})},Bb.prototype.clearInMemory=function(){this.logger.verbose("Deleting in-memory keystore "+this.storeName),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore "+this.storeName+" deleted")},Bb.prototype.clearPersistent=function(){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.logger.verbose("Deleting persistent keystore"),[4,this.indexedDBCache.deleteDatabase()];case 1:return(t=e.sent())&&this.logger.verbose("Persistent keystore deleted"),[2,t];case 2:return t=e.sent(),this.handleDatabaseAccessError(t),[2,!1];case 3:return[2]}})})};var jb,Hb=Bb;function Bb(e,t){this.inMemoryCache=new u0,this.indexedDBCache=new qb,this.logger=e,this.storeName=t}(bn=jb=jb||{}).asymmetricKeys="asymmetricKeys",bn.symmetricKeys="symmetricKeys";zb.prototype.clear=function(){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:this.asymmetricKeys.clearInMemory(),this.symmetricKeys.clearInMemory(),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.asymmetricKeys.clearPersistent()];case 2:return e.sent(),[2,!0];case 3:return(t=e.sent())instanceof Error?this.logger.error("Clearing keystore failed with error: "+t.message):this.logger.error("Clearing keystore failed with unknown error"),[2,!1];case 4:return[2]}})})};var Fb=zb;function zb(e){this.logger=e,this.asymmetricKeys=new Hb(this.logger,jb.asymmetricKeys),this.symmetricKeys=new Hb(this.logger,jb.symmetricKeys)}Gb.prototype.createNewGuid=function(){return this.guidGenerator.generateGuid()},Gb.prototype.base64Encode=function(e){return this.b64Encode.encode(e)},Gb.prototype.base64Decode=function(e){return this.b64Decode.decode(e)},Gb.prototype.generatePkceCodes=function(){return _(this,void 0,void 0,function(){return w(this,function(e){return[2,this.pkceGenerator.generateCodes()]})})},Gb.prototype.getPublicKeyThumbprint=function(a){var s;return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:return t=null==(s=this.performanceClient)?void 0:s.startMeasurement(A.CryptoOptsGetPublicKeyThumbprint,a.correlationId),[4,this.browserCrypto.generateKeyPair(Gb.EXTRACTABLE,Gb.POP_KEY_USAGES)];case 1:return o=e.sent(),[4,this.browserCrypto.exportJwk(o.publicKey)];case 2:return n=e.sent(),n={e:n.e,kty:n.kty,n:n.n},n=_b.getSortedObjectString(n),[4,this.hashString(n)];case 3:return r=e.sent(),[4,this.browserCrypto.exportJwk(o.privateKey)];case 4:return n=e.sent(),[4,this.browserCrypto.importJwk(n,!1,["sign"])];case 5:return i=e.sent(),[4,this.cache.asymmetricKeys.setItem(r,{privateKey:i,publicKey:o.publicKey,requestMethod:a.resourceRequestMethod,requestUri:a.resourceRequestUri})];case 6:return e.sent(),t&&t.endMeasurement({success:!0}),[2,r]}})})},Gb.prototype.removeTokenBindingKey=function(t){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return[4,this.cache.asymmetricKeys.removeItem(t)];case 1:return e.sent(),[4,this.cache.asymmetricKeys.containsKey(t)];case 2:return[2,!e.sent()]}})})},Gb.prototype.clearKeystore=function(){return _(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return[4,this.cache.clear()];case 1:return[2,e.sent()]}})})},Gb.prototype.signJwt=function(s,c,u){var l;return _(this,void 0,void 0,function(){var t,o,r,n,i,a;return w(this,function(e){switch(e.label){case 0:return t=null==(l=this.performanceClient)?void 0:l.startMeasurement(A.CryptoOptsSignJwt,u),[4,this.cache.asymmetricKeys.getItem(c)];case 1:if(o=e.sent())return[4,this.browserCrypto.exportJwk(o.publicKey)];throw O.createSigningKeyNotFoundInStorageError(c);case 2:return i=e.sent(),r=_b.getSortedObjectString(i),n=this.b64Encode.urlEncode(JSON.stringify({kid:c})),n=N_.getShrHeaderString({kid:n,alg:i.alg}),i=this.b64Encode.urlEncode(n),s.cnf={jwk:JSON.parse(r)},n=this.b64Encode.urlEncode(JSON.stringify(s)),r=i+"."+n,i=_b.stringToArrayBuffer(r),[4,this.browserCrypto.sign(o.privateKey,i)];case 3:return n=e.sent(),i=this.b64Encode.urlEncodeArr(new Uint8Array(n)),a=r+"."+i,t&&t.endMeasurement({success:!0}),[2,a]}})})},Gb.prototype.hashString=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return[4,this.browserCrypto.sha256Digest(o)];case 1:return t=e.sent(),t=new Uint8Array(t),[2,this.b64Encode.urlEncodeArr(t)]}})})},Gb.POP_KEY_USAGES=["sign","verify"],Gb.EXTRACTABLE=!0;var Kb=Gb;function Gb(e,t,o){this.logger=e,this.browserCrypto=new Lb(this.logger,o),this.b64Encode=new bb,this.b64Decode=new Eb,this.guidGenerator=new yb(this.browserCrypto),this.pkceGenerator=new Tb(this.browserCrypto),this.cache=new Fb(this.logger),this.performanceClient=t}Wb.makeMeasureName=function(e,t){return"msal.measure."+e+"."+t},Wb.makeStartMark=function(e,t){return"msal.start."+e+"."+t},Wb.makeEndMark=function(e,t){return"msal.end."+e+"."+t},Wb.supportsBrowserPerformance=function(){return"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.mark&&"function"==typeof window.performance.measure&&"function"==typeof window.performance.clearMarks&&"function"==typeof window.performance.clearMeasures&&"function"==typeof window.performance.getEntriesByName},Wb.flushMeasurements=function(t,e){if(Wb.supportsBrowserPerformance())try{e.forEach(function(e){e=Wb.makeMeasureName(e.name,t);0<window.performance.getEntriesByName(e,"measure").length&&(window.performance.clearMeasures(e),window.performance.clearMarks(Wb.makeStartMark(e,t)),window.performance.clearMarks(Wb.makeEndMark(e,t)))})}catch(e){}},Wb.prototype.startMeasurement=function(){if(Wb.supportsBrowserPerformance())try{window.performance.mark(this.startMark)}catch(e){}},Wb.prototype.endMeasurement=function(){if(Wb.supportsBrowserPerformance())try{window.performance.mark(this.endMark),window.performance.measure(this.measureName,this.startMark,this.endMark)}catch(e){}},Wb.prototype.flushMeasurement=function(){if(Wb.supportsBrowserPerformance())try{var e,t=window.performance.getEntriesByName(this.measureName,"measure");if(0<t.length)return e=t[0].duration,window.performance.clearMeasures(this.measureName),window.performance.clearMarks(this.startMark),window.performance.clearMarks(this.endMark),e}catch(e){}return null};var Yb=Wb;function Wb(e,t){this.correlationId=t,this.measureName=Wb.makeMeasureName(e,t),this.startMark=Wb.makeStartMark(e,t),this.endMark=Wb.makeEndMark(e,t)}Og(Vb,Zb=ir),Vb.prototype.startPerformanceMeasuremeant=function(e,t){return new Yb(e,t)},Vb.prototype.generateId=function(){return this.guidGenerator.generateGuid()},Vb.prototype.getPageVisibility=function(){var e;return(null==(e=document.visibilityState)?void 0:e.toString())||null},Vb.prototype.deleteIncompleteSubMeasurements=function(e){var t=this.eventsByCorrelationId.get(e.event.correlationId),o=t&&t.eventId===e.event.eventId,r=[];o&&null!=t&&t.incompleteSubMeasurements&&t.incompleteSubMeasurements.forEach(function(e){r.push(v({},e))}),0<r.length&&Yb.flushMeasurements(e.event.correlationId,r)},Vb.prototype.supportsBrowserPerformanceNow=function(){return"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.now},Vb.prototype.startMeasurement=function(e,t){var o=this,r=this.getPageVisibility(),n=Zb.prototype.startMeasurement.call(this,e,t);return v(v({},n),{endMeasurement:function(e){e=n.endMeasurement(v({startPageVisibility:r,endPageVisibility:o.getPageVisibility()},e));return o.deleteIncompleteSubMeasurements(n),e},discardMeasurement:function(){n.discardMeasurement(),o.deleteIncompleteSubMeasurements(n),n.measurement.flushMeasurement()}})},Vb.prototype.setPreQueueTime=function(e,t){var o;this.supportsBrowserPerformanceNow()?t?((o=this.preQueueTimeByCorrelationId.get(t))&&(this.logger.trace("BrowserPerformanceClient: Incomplete pre-queue "+o.name+" found",t),this.addQueueMeasurement(o.name,t,void 0,!0)),this.preQueueTimeByCorrelationId.set(t,{name:e,time:window.performance.now()})):this.logger.trace("BrowserPerformanceClient: correlationId for "+e+" not provided, unable to set telemetry queue time"):this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for "+e)},Vb.prototype.addQueueMeasurement=function(e,t,o,r){if(this.supportsBrowserPerformanceNow())if(t){var n,i=Zb.prototype.getPreQueueTime.call(this,e,t);if(i)return n=window.performance.now(),o=o||Zb.prototype.calculateQueuedTime.call(this,i,n),Zb.prototype.addQueueMeasurement.call(this,e,t,o,r)}else this.logger.trace("BrowserPerformanceClient: correlationId for "+e+" not provided, unable to add queue measurement");else this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to add queue measurement for "+e)};var Zb,Qb=Vb;function Vb(e,t,o,r,n,i,a){e=Zb.call(this,e,t,o,r,n,i)||this;return e.browserCrypto=new Lb(e.logger,a),e.guidGenerator=new yb(e.browserCrypto),e}Xb.prototype.loadExternalTokens=function(e,t,o){if(this.logger.info("TokenCache - loadExternalTokens called"),!t.id_token)throw O.createUnableToLoadTokenError("Please ensure server response includes id token.");var r=new Xy(t.id_token,this.cryptoObj);if(e.account)var n=this.loadAccount(r,e.account.environment,void 0,void 0,e.account.homeAccountId),i=new Kv(n,this.loadIdToken(r,n.homeAccountId,e.account.environment,e.account.tenantId),this.loadAccessToken(e,t,n.homeAccountId,e.account.environment,e.account.tenantId,o),this.loadRefreshToken(e,t,n.homeAccountId,e.account.environment));else{if(!e.authority)throw O.createUnableToLoadTokenError("Please provide a request with an account or a request with authority.");var a=b_.generateAuthority(e.authority,e.azureCloudOptions),s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},a=new b_(a,this.config.system.networkClient,this.storage,s,this.logger);if(o.clientInfo){this.logger.trace("TokenCache - homeAccountId from options");n=this.loadAccount(r,a.hostnameAndPort,o.clientInfo,a.authorityType)}else{if(!t.client_info)throw O.createUnableToLoadTokenError("Please provide clientInfo in the response or options.");this.logger.trace("TokenCache - homeAccountId from response");n=this.loadAccount(r,a.hostnameAndPort,t.client_info,a.authorityType)}i=new Kv(n,this.loadIdToken(r,n.homeAccountId,a.hostnameAndPort,a.tenant),this.loadAccessToken(e,t,n.homeAccountId,a.hostnameAndPort,a.tenant,o),this.loadRefreshToken(e,t,n.homeAccountId,a.hostnameAndPort))}return this.generateAuthenticationResult(e,r,i,a)},Xb.prototype.loadAccount=function(e,t,o,r,n){var i;if(n?i=n:void 0!==r&&o&&(i=Vy.generateHomeAccountId(o,r,this.logger,this.cryptoObj,e)),!i)throw O.createUnableToLoadTokenError("Unexpected missing homeAccountId");n=o?Vy.createAccount(o,i,e,void 0,void 0,void 0,t):Vy.createGenericAccount(i,e,void 0,void 0,void 0,t);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading account"),this.storage.setAccount(n),n;throw O.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},Xb.prototype.loadIdToken=function(e,t,o,r){t=kv.createIdTokenEntity(t,o,e.rawToken,this.config.auth.clientId,r);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading id token"),this.storage.setIdTokenCredential(t),t;throw O.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},Xb.prototype.loadAccessToken=function(e,t,o,r,n,i){if(!t.access_token)return this.logger.verbose("TokenCache - No access token provided for caching"),null;if(!t.expires_in)throw O.createUnableToLoadTokenError("Please ensure server response includes expires_in value.");if(!i.extendedExpiresOn)throw O.createUnableToLoadTokenError("Please provide an extendedExpiresOn value in the options.");var e=new Yy(e.scopes).printScopes(),a=i.expiresOn||t.expires_in+(new Date).getTime()/1e3,i=i.extendedExpiresOn,o=xv.createAccessTokenEntity(o,r,t.access_token,this.config.auth.clientId,n,e,a,i,this.cryptoObj);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading access token"),this.storage.setAccessTokenCredential(o),o;throw O.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},Xb.prototype.loadRefreshToken=function(e,t,o,r){if(!t.refresh_token)return this.logger.verbose("TokenCache - No refresh token provided for caching"),null;o=Lv.createRefreshTokenEntity(o,r,t.refresh_token,this.config.auth.clientId);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading refresh token"),this.storage.setRefreshTokenCredential(o),o;throw O.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},Xb.prototype.generateAuthenticationResult=function(e,t,o,r){var n,i=S.EMPTY_STRING,a=[],s=null,c=(null!=o&&o.accessToken&&(i=o.accessToken.secret,a=Yy.fromString(o.accessToken.target).asArray(),s=new Date(1e3*Number(o.accessToken.expiresOn)),n=new Date(1e3*Number(o.accessToken.extendedExpiresOn))),(null==t?void 0:t.claims.oid)||(null==t?void 0:t.claims.sub)||S.EMPTY_STRING),u=(null==t?void 0:t.claims.tid)||S.EMPTY_STRING;return{authority:r?r.canonicalAuthority:S.EMPTY_STRING,uniqueId:c,tenantId:u,scopes:a,account:null!=o&&o.account?o.account.getAccountInfo():null,idToken:t?t.rawToken:S.EMPTY_STRING,idTokenClaims:t?t.claims:{},accessToken:i,fromCache:!0,expiresOn:s,correlationId:e.correlationId||S.EMPTY_STRING,requestId:S.EMPTY_STRING,extExpiresOn:n,familyId:S.EMPTY_STRING,tokenType:(null==(r=null==o?void 0:o.accessToken)?void 0:r.tokenType)||S.EMPTY_STRING,state:S.EMPTY_STRING,cloudGraphHostName:(null==(c=null==o?void 0:o.account)?void 0:c.cloudGraphHostName)||S.EMPTY_STRING,msGraphHost:(null==(u=null==o?void 0:o.account)?void 0:u.msGraphHost)||S.EMPTY_STRING,code:void 0,fromNativeBroker:!1}};var Jb=Xb;function Xb(e,t,o,r){this.isBrowserEnvironment="undefined"!=typeof window,this.config=e,this.storage=t,this.logger=o,this.cryptoObj=r}Og(tC,$b=a_);var $b,eC=tC;function tC(e){e=$b.call(this,e)||this;return e.includeRedirectUri=!1,e}Og(nC,oC=n),nC.prototype.acquireToken=function(i){return _(this,void 0,void 0,function(){var t,o,r,n;return w(this,function(e){switch(e.label){case 0:if(this.logger.trace("SilentAuthCodeClient.acquireToken called"),i.code)return this.performanceClient.setPreQueueTime(A.StandardInteractionClientInitializeAuthorizationRequest,i.correlationId),[4,this.initializeAuthorizationRequest(i,R.Silent)];throw O.createAuthCodeRequiredError();case 1:t=e.sent(),this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||S.EMPTY_STRING,t.account||null),o=this.initializeServerTelemetryManager(this.apiId),e.label=2;case 2:return e.trys.push([2,4,,5]),r=v(v({},t),{code:i.code}),this.performanceClient.setPreQueueTime(A.StandardInteractionClientGetClientConfiguration,i.correlationId),[4,this.getClientConfiguration(o,t.authority)];case 3:return n=e.sent(),n=new eC(n),this.logger.verbose("Auth code client created"),[2,new ib(n,this.browserStorage,r,this.logger,this.config.system,this.performanceClient).handleCodeResponseFromServer({code:i.code,msgraph_host:i.msGraphHost,cloud_graph_host_name:i.cloudGraphHostName,cloud_instance_host_name:i.cloudInstanceHostName},t.state,n.authority,this.networkClient,!1)];case 4:throw(n=e.sent())instanceof T&&n.setCorrelationId(this.correlationId),o.cacheFailedRequest(n),this.browserStorage.cleanRequestByState(t.state),n;case 5:return[2]}})})},nC.prototype.logout=function(){return Promise.reject(O.createSilentLogoutUnsupportedError())};var oC,rC=nC;function nC(e,t,o,r,n,i,a,s,c,u){e=oC.call(this,e,t,o,r,n,i,s,c,u)||this;return e.apiId=a,e}function M(e){this.isBrowserEnvironment="undefined"!=typeof window,this.config=(t=e,o=this.isBrowserEnvironment,i=e.auth,s=e.cache,r=e.system,t=e.telemetry,e={clientId:S.EMPTY_STRING,authority:""+S.DEFAULT_AUTHORITY,knownAuthorities:[],cloudDiscoveryMetadata:S.EMPTY_STRING,authorityMetadata:S.EMPTY_STRING,redirectUri:S.EMPTY_STRING,postLogoutRedirectUri:S.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:f_.AAD,azureCloudOptions:{azureCloudInstance:yy.None,tenant:S.EMPTY_STRING},skipAuthorityMetadataCache:!1},a={cacheLocation:qw.SessionStorage,temporaryCacheLocation:qw.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!(!s||s.cacheLocation!==qw.LocalStorage),claimsBasedCachingEnabled:!0},n={loggerCallback:function(){},logLevel:py.Info,piiLoggingEnabled:!1},o=v(v({},nv),{loggerOptions:n,networkClient:o?b0.getBrowserNetworkClient():P_,navigationClient:new X0,loadFrameTimeout:0,windowHashTimeout:(null==r?void 0:r.loadFrameTimeout)||eb,iframeHashTimeout:(null==r?void 0:r.loadFrameTimeout)||tb,navigateFrameWait:o&&b0.detectIEOrEdge()?500:0,redirectNavigationTimeout:ob,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(null==r?void 0:r.nativeBrokerHandshakeTimeout)||rb,pollIntervalMilliseconds:Kw.DEFAULT_POLL_INTERVAL_MS,cryptoOptions:{useMsrCrypto:!1,entropy:void 0}}),r=v(v({},r),{loggerOptions:(null==r?void 0:r.loggerOptions)||n}),n={application:{appName:S.EMPTY_STRING,appVersion:S.EMPTY_STRING}},{auth:v(v({},e),i),cache:v(v({},a),s),system:v(v({},o),r),telemetry:v(v({},n),t)}),this.initialized=!1,this.logger=new gy(this.config.system.loggerOptions,g0,m0),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.isBrowserEnvironment?new Qb(this.config.auth.clientId,this.config.auth.authority,this.logger,g0,m0,this.config.telemetry.application,this.config.system.cryptoOptions):new F_(this.config.auth.clientId,this.config.auth.authority,this.logger,g0,m0,this.config.telemetry.application),this.browserCrypto=this.isBrowserEnvironment?new Kb(this.logger,this.performanceClient,this.config.system.cryptoOptions):wm,this.eventHandler=new pb(this.logger,this.browserCrypto),this.browserStorage=this.isBrowserEnvironment?new f0(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger):(e=this.config.auth.clientId,i=this.logger,a={cacheLocation:qw.MemoryStorage,temporaryCacheLocation:qw.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!0},new f0(e,a,wm,i));var t,o,r,n,i,a,s={cacheLocation:qw.MemoryStorage,temporaryCacheLocation:qw.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!0};this.nativeInternalStorage=new f0(this.config.auth.clientId,s,this.browserCrypto,this.logger),this.tokenCache=new Jb(this.config,this.browserStorage,this.logger,this.browserCrypto),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}M.prototype.initialize=function(){return _(this,void 0,void 0,function(){var t,o,r,n,i;return w(this,function(e){switch(e.label){case 0:if(this.logger.trace("initialize called"),this.initialized)return this.logger.info("initialize has already been called, exiting early."),[2];if(t=this.config.system.allowNativeBroker,o=this.performanceClient.startMeasurement(A.InitializeClientApplication),this.eventHandler.emitEvent(x.INITIALIZE_START),!t)return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),r=this,[4,K0.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)];case 2:return r.nativeExtensionProvider=e.sent(),[3,4];case 3:return n=e.sent(),this.logger.verbose(n),[3,4];case 4:return this.config.cache.claimsBasedCachingEnabled?[3,6]:(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),i=this.performanceClient.startMeasurement(A.ClearTokensAndKeysWithClaims),[4,this.browserStorage.clearTokensAndKeysWithClaims()]);case 5:e.sent(),i.endMeasurement({success:!0}),e.label=6;case 6:return this.initialized=!0,this.eventHandler.emitEvent(x.INITIALIZE_END),o.endMeasurement({allowNativeBroker:t,success:!0}),[2]}})})},M.prototype.handleRedirectPromise=function(s){return _(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return w(this,function(e){return this.logger.verbose("handleRedirectPromise called"),b0.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),t=this.getAllAccounts(),this.isBrowserEnvironment?(o=s||S.EMPTY_STRING,void 0===(r=this.redirectResponse.get(o))?(this.eventHandler.emitEvent(x.HANDLE_REDIRECT_START,R.Redirect),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise"),i=this.browserStorage.getCachedNativeRequest(),n=void 0,n=i&&K0.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!s?(this.logger.trace("handleRedirectPromise - acquiring token from native platform"),new F0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Fw.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,i.accountId,this.nativeInternalStorage,i.correlationId).handleRedirectPromise()):(this.logger.trace("handleRedirectPromise - acquiring token from web flow"),i=this.browserStorage.getTemporaryCache(jw.CORRELATION_ID,!0)||S.EMPTY_STRING,this.createRedirectClient(i).handleRedirectPromise(s)),r=n.then(function(e){return e&&(t.length<a.getAllAccounts().length?(a.eventHandler.emitEvent(x.LOGIN_SUCCESS,R.Redirect,e),a.logger.verbose("handleRedirectResponse returned result, login success")):(a.eventHandler.emitEvent(x.ACQUIRE_TOKEN_SUCCESS,R.Redirect,e),a.logger.verbose("handleRedirectResponse returned result, acquire token success"))),a.eventHandler.emitEvent(x.HANDLE_REDIRECT_END,R.Redirect),e}).catch(function(e){throw 0<t.length?a.eventHandler.emitEvent(x.ACQUIRE_TOKEN_FAILURE,R.Redirect,null,e):a.eventHandler.emitEvent(x.LOGIN_FAILURE,R.Redirect,null,e),a.eventHandler.emitEvent(x.HANDLE_REDIRECT_END,R.Redirect),e}),this.redirectResponse.set(o,r)):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),[2,r]):(this.logger.verbose("handleRedirectPromise returns null, not browser environment"),[2,null])})})},M.prototype.acquireTokenRedirect=function(n){return _(this,void 0,void 0,function(){var t,o,r=this;return w(this,function(e){return t=this.getRequestCorrelationId(n),this.logger.verbose("acquireTokenRedirect called",t),this.preflightBrowserEnvironmentCheck(R.Redirect),(o=0<this.getAllAccounts().length)?this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_START,R.Redirect,n):this.eventHandler.emitEvent(x.LOGIN_START,R.Redirect,n),[2,(this.nativeExtensionProvider&&this.canUseNative(n)?new F0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Fw.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(n),this.nativeInternalStorage,n.correlationId).acquireTokenRedirect(n).catch(function(e){if(e instanceof D0&&e.isFatal())return r.nativeExtensionProvider=void 0,r.createRedirectClient(n.correlationId).acquireToken(n);if(e instanceof Fv)return r.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),r.createRedirectClient(n.correlationId).acquireToken(n);throw r.browserStorage.setInteractionInProgress(!1),e}):this.createRedirectClient(n.correlationId).acquireToken(n)).catch(function(e){throw o?r.eventHandler.emitEvent(x.ACQUIRE_TOKEN_FAILURE,R.Redirect,null,e):r.eventHandler.emitEvent(x.LOGIN_FAILURE,R.Redirect,null,e),e})]})})},M.prototype.acquireTokenPopup=function(t){var o=this,e=this.getRequestCorrelationId(t),r=this.performanceClient.startMeasurement(A.AcquireTokenPopup,e);try{this.logger.verbose("acquireTokenPopup called",e),this.preflightBrowserEnvironmentCheck(R.Popup)}catch(e){return Promise.reject(e)}var n=this.getAllAccounts();return 0<n.length?this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_START,R.Popup,t):this.eventHandler.emitEvent(x.LOGIN_START,R.Popup,t),(this.canUseNative(t)?this.acquireTokenNative(t,Fw.acquireTokenPopup).then(function(e){return o.browserStorage.setInteractionInProgress(!1),r.endMeasurement({success:!0,isNativeBroker:!0,requestId:e.requestId}),e}).catch(function(e){if(e instanceof D0&&e.isFatal())return o.nativeExtensionProvider=void 0,o.createPopupClient(t.correlationId).acquireToken(t);if(e instanceof Fv)return o.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),o.createPopupClient(t.correlationId).acquireToken(t);throw o.browserStorage.setInteractionInProgress(!1),e}):this.createPopupClient(t.correlationId).acquireToken(t)).then(function(e){return n.length<o.getAllAccounts().length?o.eventHandler.emitEvent(x.LOGIN_SUCCESS,R.Popup,e):o.eventHandler.emitEvent(x.ACQUIRE_TOKEN_SUCCESS,R.Popup,e),r.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),r.endMeasurement({success:!0,requestId:e.requestId}),e}).catch(function(e){return 0<n.length?o.eventHandler.emitEvent(x.ACQUIRE_TOKEN_FAILURE,R.Popup,null,e):o.eventHandler.emitEvent(x.LOGIN_FAILURE,R.Popup,null,e),r.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),Promise.reject(e)})},M.prototype.trackPageVisibilityWithMeasurement=function(){var e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))},M.prototype.ssoSilent=function(n){var i;return _(this,void 0,void 0,function(){var t,o,r=this;return w(this,function(e){return t=this.getRequestCorrelationId(n),o=v(v({},n),{prompt:n.prompt,correlationId:t}),this.preflightBrowserEnvironmentCheck(R.Silent),this.ssoSilentMeasurement=this.performanceClient.startMeasurement(A.SsoSilent,t),null!=(i=this.ssoSilentMeasurement)&&i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(x.SSO_SILENT_START,R.Silent,o),[2,(this.canUseNative(o)?this.acquireTokenNative(o,Fw.ssoSilent).catch(function(e){if(e instanceof D0&&e.isFatal())return r.nativeExtensionProvider=void 0,r.createSilentIframeClient(o.correlationId).acquireToken(o);throw e}):this.createSilentIframeClient(o.correlationId).acquireToken(o)).then(function(e){var t;return r.eventHandler.emitEvent(x.SSO_SILENT_SUCCESS,R.Silent,e),null!=(t=r.ssoSilentMeasurement)&&t.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),null!=(t=r.ssoSilentMeasurement)&&t.endMeasurement({success:!0,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e}).catch(function(e){var t;throw r.eventHandler.emitEvent(x.SSO_SILENT_FAILURE,R.Silent,null,e),null!=(t=r.ssoSilentMeasurement)&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}).finally(function(){document.removeEventListener("visibilitychange",r.trackPageVisibilityWithMeasurement)})]})})},M.prototype.acquireTokenByCode=function(a){return _(this,void 0,void 0,function(){var t,o,r,n,i=this;return w(this,function(e){t=this.getRequestCorrelationId(a),this.preflightBrowserEnvironmentCheck(R.Silent),this.logger.trace("acquireTokenByCode called",t),this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_BY_CODE_START,R.Silent,a),o=this.performanceClient.startMeasurement(A.AcquireTokenByCode,a.correlationId);try{if(a.code&&a.nativeAccountId)throw O.createSpaCodeAndNativeAccountIdPresentError();if(a.code)return r=a.code,(n=this.hybridAuthCodeResponses.get(r))?(this.logger.verbose("Existing acquireTokenByCode request found",a.correlationId),o.discardMeasurement()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),n=this.acquireTokenByCodeAsync(v(v({},a),{correlationId:t})).then(function(e){return i.eventHandler.emitEvent(x.ACQUIRE_TOKEN_BY_CODE_SUCCESS,R.Silent,e),i.hybridAuthCodeResponses.delete(r),o.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),o.endMeasurement({success:!0,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e}).catch(function(e){throw i.hybridAuthCodeResponses.delete(r),i.eventHandler.emitEvent(x.ACQUIRE_TOKEN_BY_CODE_FAILURE,R.Silent,null,e),o.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}),this.hybridAuthCodeResponses.set(r,n)),[2,n];if(a.nativeAccountId){if(this.canUseNative(a,a.nativeAccountId))return[2,this.acquireTokenNative(a,Fw.acquireTokenByCode,a.nativeAccountId).catch(function(e){throw e instanceof D0&&e.isFatal()&&(i.nativeExtensionProvider=void 0),e})];throw O.createUnableToAcquireTokenFromNativePlatformError()}throw O.createAuthCodeOrNativeAccountIdRequiredError()}catch(e){throw this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_BY_CODE_FAILURE,R.Silent,null,e),o.endMeasurement({errorCode:e instanceof T&&e.errorCode||void 0,subErrorCode:e instanceof T&&e.subError||void 0,success:!1}),e}return[2]})})},M.prototype.acquireTokenByCodeAsync=function(t){var r;return _(this,void 0,void 0,function(){var o=this;return w(this,function(e){switch(e.label){case 0:return this.logger.trace("acquireTokenByCodeAsync called",t.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(A.AcquireTokenByCodeAsync,t.correlationId),null!=(r=this.acquireTokenByCodeAsyncMeasurement)&&r.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),[4,this.createSilentAuthCodeClient(t.correlationId).acquireToken(t).then(function(e){var t;return null!=(t=o.acquireTokenByCodeAsyncMeasurement)&&t.endMeasurement({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e}).catch(function(e){var t;throw null!=(t=o.acquireTokenByCodeAsyncMeasurement)&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}).finally(function(){document.removeEventListener("visibilitychange",o.trackPageVisibilityWithMeasurement)})];case 1:return[2,e.sent()]}})})},M.prototype.acquireTokenFromCache=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){switch(this.performanceClient.addQueueMeasurement(A.AcquireTokenFromCache,o.correlationId),r.cacheLookupPolicy){case zw.Default:case zw.AccessToken:case zw.AccessTokenAndRefreshToken:return[2,t.acquireToken(o)];default:throw I.createRefreshRequiredError()}return[2]})})},M.prototype.acquireTokenByRefreshToken=function(o,r){return _(this,void 0,void 0,function(){var t;return w(this,function(e){switch(this.performanceClient.addQueueMeasurement(A.AcquireTokenByRefreshToken,o.correlationId),r.cacheLookupPolicy){case zw.Default:case zw.AccessTokenAndRefreshToken:case zw.RefreshToken:case zw.RefreshTokenAndNetwork:return t=this.createSilentRefreshClient(o.correlationId),this.performanceClient.setPreQueueTime(A.SilentRefreshClientAcquireToken,o.correlationId),[2,t.acquireToken(o)];default:throw I.createRefreshRequiredError()}return[2]})})},M.prototype.acquireTokenBySilentIframe=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return this.performanceClient.addQueueMeasurement(A.AcquireTokenBySilentIframe,o.correlationId),t=this.createSilentIframeClient(o.correlationId),this.performanceClient.setPreQueueTime(A.SilentIframeClientAcquireToken,o.correlationId),[2,t.acquireToken(o)]})})},M.prototype.logout=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return t=this.getRequestCorrelationId(o),this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),[2,this.logoutRedirect(v({correlationId:t},o))]})})},M.prototype.logoutRedirect=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return t=this.getRequestCorrelationId(o),this.preflightBrowserEnvironmentCheck(R.Redirect),[2,this.createRedirectClient(t).logout(o)]})})},M.prototype.logoutPopup=function(e){try{var t=this.getRequestCorrelationId(e);return this.preflightBrowserEnvironmentCheck(R.Popup),this.createPopupClient(t).logout(e)}catch(e){return Promise.reject(e)}},M.prototype.getAllAccounts=function(){return this.logger.verbose("getAllAccounts called"),this.isBrowserEnvironment?this.browserStorage.getAllAccounts():[]},M.prototype.getAccountByUsername=function(e){var t;return this.logger.trace("getAccountByUsername called"),e?(t=this.browserStorage.getAccountInfoFilteredBy({username:e}))?(this.logger.verbose("getAccountByUsername: Account matching username found, returning"),this.logger.verbosePii("getAccountByUsername: Returning signed-in accounts matching username: "+e),t):(this.logger.verbose("getAccountByUsername: No matching account found, returning null"),null):(this.logger.warning("getAccountByUsername: No username provided"),null)},M.prototype.getAccountByHomeId=function(e){var t;return this.logger.trace("getAccountByHomeId called"),e?(t=this.browserStorage.getAccountInfoFilteredBy({homeAccountId:e}))?(this.logger.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),this.logger.verbosePii("getAccountByHomeId: Returning signed-in accounts matching homeAccountId: "+e),t):(this.logger.verbose("getAccountByHomeId: No matching account found, returning null"),null):(this.logger.warning("getAccountByHomeId: No homeAccountId provided"),null)},M.prototype.getAccountByLocalId=function(e){var t;return this.logger.trace("getAccountByLocalId called"),e?(t=this.browserStorage.getAccountInfoFilteredBy({localAccountId:e}))?(this.logger.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),this.logger.verbosePii("getAccountByLocalId: Returning signed-in accounts matching localAccountId: "+e),t):(this.logger.verbose("getAccountByLocalId: No matching account found, returning null"),null):(this.logger.warning("getAccountByLocalId: No localAccountId provided"),null)},M.prototype.setActiveAccount=function(e){this.browserStorage.setActiveAccount(e)},M.prototype.getActiveAccount=function(){return this.browserStorage.getActiveAccount()},M.prototype.preflightBrowserEnvironmentCheck=function(e,t){if(void 0===t&&(t=!0),this.logger.verbose("preflightBrowserEnvironmentCheck started"),b0.blockNonBrowserEnvironment(this.isBrowserEnvironment),b0.blockRedirectInIframe(e,this.config.system.allowRedirectInIframe),b0.blockReloadInHiddenIframes(),b0.blockAcquireTokenInPopups(),b0.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),e===R.Redirect&&this.config.cache.cacheLocation===qw.MemoryStorage&&!this.config.cache.storeAuthStateInCookie)throw i0.createInMemoryRedirectUnavailableError();e!==R.Redirect&&e!==R.Popup||this.preflightInteractiveRequest(t)},M.prototype.preflightInteractiveRequest=function(e){this.logger.verbose("preflightInteractiveRequest called, validating app environment"),b0.blockReloadInHiddenIframes(),e&&this.browserStorage.setInteractionInProgress(!0)},M.prototype.acquireTokenNative=function(t,o,r){return _(this,void 0,void 0,function(){return w(this,function(e){if(this.logger.trace("acquireTokenNative called"),this.nativeExtensionProvider)return[2,new F0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,o,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(t),this.nativeInternalStorage,t.correlationId).acquireToken(t)];throw O.createNativeConnectionNotEstablishedError()})})},M.prototype.canUseNative=function(e,t){if(this.logger.trace("canUseNative called"),!K0.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case Jg.NONE:case Jg.CONSENT:case Jg.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace("canUseNative: prompt = "+e.prompt+" is not compatible with native flow, returning false"),!1}return!(!t&&!this.getNativeAccountId(e)&&(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),1))},M.prototype.getNativeAccountId=function(e){e=e.account||this.browserStorage.getAccountInfoByHints(e.loginHint,e.sid)||this.getActiveAccount();return e&&e.nativeAccountId||""},M.prototype.createPopupClient=function(e){return new V0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},M.prototype.createRedirectClient=function(e){return new W0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},M.prototype.createSilentIframeClient=function(e){return new cb(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Fw.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},M.prototype.createSilentCacheClient=function(e){return new j0(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)},M.prototype.createSilentRefreshClient=function(e){return new hb(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)},M.prototype.createSilentAuthCodeClient=function(e){return new rC(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Fw.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)},M.prototype.addEventCallback=function(e){return this.eventHandler.addEventCallback(e)},M.prototype.removeEventCallback=function(e){this.eventHandler.removeEventCallback(e)},M.prototype.addPerformanceCallback=function(e){return this.performanceClient.addPerformanceCallback(e)},M.prototype.removePerformanceCallback=function(e){return this.performanceClient.removePerformanceCallback(e)},M.prototype.enableAccountStorageEvents=function(){this.eventHandler.enableAccountStorageEvents()},M.prototype.disableAccountStorageEvents=function(){this.eventHandler.disableAccountStorageEvents()},M.prototype.getTokenCache=function(){return this.tokenCache},M.prototype.getLogger=function(){return this.logger},M.prototype.setLogger=function(e){this.logger=e},M.prototype.initializeWrapperLibrary=function(e,t){this.browserStorage.setWrapperMetadata(e,t)},M.prototype.setNavigationClient=function(e){this.navigationClient=e},M.prototype.getConfiguration=function(){return this.config},M.prototype.getRequestCorrelationId=function(e){return null!=e&&e.correlationId?e.correlationId:this.isBrowserEnvironment?this.browserCrypto.createNewGuid():S.EMPTY_STRING};Og(sC,iC=M),sC.prototype.loginRedirect=function(o){return _(this,void 0,void 0,function(){var t;return w(this,function(e){return t=this.getRequestCorrelationId(o),this.logger.verbose("loginRedirect called",t),[2,this.acquireTokenRedirect(v({correlationId:t},o||Zw))]})})},sC.prototype.loginPopup=function(e){var t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup(v({correlationId:t},e||Zw))},sC.prototype.acquireTokenSilent=function(s){return _(this,void 0,void 0,function(){var t,o,r,n,i,a=this;return w(this,function(e){if(t=this.getRequestCorrelationId(s),(o=this.performanceClient.startMeasurement(A.AcquireTokenSilent,t)).addStaticFields({cacheLookupPolicy:s.cacheLookupPolicy}),this.preflightBrowserEnvironmentCheck(R.Silent),this.logger.verbose("acquireTokenSilent called",t),i=s.account||this.getActiveAccount())return n={clientId:this.config.auth.clientId,authority:s.authority||S.EMPTY_STRING,scopes:s.scopes,homeAccountIdentifier:i.homeAccountId,claims:s.claims,authenticationScheme:s.authenticationScheme,resourceRequestMethod:s.resourceRequestMethod,resourceRequestUri:s.resourceRequestUri,shrClaims:s.shrClaims,sshKid:s.sshKid},r=JSON.stringify(n),void 0===(n=this.activeSilentTokenRequests.get(r))?(this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t),this.performanceClient.setPreQueueTime(A.AcquireTokenSilentAsync,t),i=this.acquireTokenSilentAsync(v(v({},s),{correlationId:t}),i).then(function(e){return a.activeSilentTokenRequests.delete(r),o.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),o.endMeasurement({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker,cacheLookupPolicy:s.cacheLookupPolicy,requestId:e.requestId}),e}).catch(function(e){throw a.activeSilentTokenRequests.delete(r),o.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}),this.activeSilentTokenRequests.set(r,i),[2,i]):(this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),o.discardMeasurement(),[2,n]);throw O.createNoAccountError()})})},sC.prototype.trackPageVisibility=function(){this.astsAsyncMeasurement&&(this.logger.info("Perf: Visibility change detected"),this.astsAsyncMeasurement.increment({visibilityChangeCount:1}))},sC.prototype.acquireTokenSilentAsync=function(c,r){var n;return _(this,void 0,void 0,function(){var t,o,i,a,s=this;return w(this,function(e){switch(e.label){case 0:return(this.performanceClient.addQueueMeasurement(A.AcquireTokenSilentAsync,c.correlationId),this.eventHandler.emitEvent(x.ACQUIRE_TOKEN_START,R.Silent,c),this.astsAsyncMeasurement=this.performanceClient.startMeasurement(A.AcquireTokenSilentAsync,c.correlationId),null!=(n=this.astsAsyncMeasurement)&&n.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibility),K0.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,c.authenticationScheme)&&r.nativeAccountId)?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),t=v(v({},c),{account:r}),t=this.acquireTokenNative(t,Fw.acquireTokenSilent_silentFlow).catch(function(t){return _(s,void 0,void 0,function(){return w(this,function(e){if(t instanceof D0&&t.isFatal())return this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,[2,this.createSilentIframeClient(c.correlationId).acquireToken(c)];throw t})})}),[3,3]):[3,1];case 1:return this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),o=this.createSilentCacheClient(c.correlationId),this.performanceClient.setPreQueueTime(A.InitializeSilentRequest,c.correlationId),[4,o.initializeSilentRequest(c,r)];case 2:i=e.sent(),a=v(v({},c),{cacheLookupPolicy:c.cacheLookupPolicy||zw.Default}),this.performanceClient.setPreQueueTime(A.AcquireTokenFromCache,i.correlationId),t=this.acquireTokenFromCache(o,i,a).catch(function(e){if(a.cacheLookupPolicy===zw.AccessToken)throw e;return b0.blockReloadInHiddenIframes(),s.eventHandler.emitEvent(x.ACQUIRE_TOKEN_NETWORK_START,R.Silent,i),s.performanceClient.setPreQueueTime(A.AcquireTokenByRefreshToken,i.correlationId),s.acquireTokenByRefreshToken(i,a).catch(function(e){var t=e instanceof fv,o=e instanceof Fv,r=e.errorCode===Hv.code,n=e.errorCode===Kw.INVALID_GRANT_ERROR;if(t&&n&&!o&&a.cacheLookupPolicy!==zw.AccessTokenAndRefreshToken&&a.cacheLookupPolicy!==zw.RefreshToken||a.cacheLookupPolicy===zw.Skip||r)return s.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",c.correlationId),s.performanceClient.setPreQueueTime(A.AcquireTokenBySilentIframe,i.correlationId),s.acquireTokenBySilentIframe(i);throw e})}),e.label=3;case 3:return[2,t.then(function(e){var t;return s.eventHandler.emitEvent(x.ACQUIRE_TOKEN_SUCCESS,R.Silent,e),null!=(t=s.astsAsyncMeasurement)&&t.endMeasurement({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e}).catch(function(e){var t;throw s.eventHandler.emitEvent(x.ACQUIRE_TOKEN_FAILURE,R.Silent,null,e),null!=(t=s.astsAsyncMeasurement)&&t.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}).finally(function(){document.removeEventListener("visibilitychange",s.trackPageVisibility)})]}})})};var iC,aC=sC;function sC(e){e=iC.call(this,e)||this;return e.astsAsyncMeasurement=void 0,e.activeSilentTokenRequests=new Map,e.trackPageVisibility=e.trackPageVisibility.bind(e),e}function cC(e){this.message=e}(cC.prototype=new Error).name="InvalidCharacterError";var uC="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new cC("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,r,n=0,i=0,a="";r=t.charAt(i++);~r&&(o=n%4?64*o+r:r,n++%4)&&(a+=String.fromCharCode(255&o>>(-2*n&6))))r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function lC(e){this.message=e}function hC(e,t){if("string"!=typeof e)throw new lC("Invalid token specified");t=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return decodeURIComponent(uC(t).replace(/(.)/g,function(e,t){t=t.charCodeAt(0).toString(16).toUpperCase();return"%"+(t=t.length<2?"0"+t:t)}))}catch(e){return uC(t)}}(e.split(".")[t]))}catch(e){throw new lC("Invalid token specified: "+e.message)}}(lC.prototype=new Error).name="InvalidTokenError";N.prototype.initialize=function(){var r=this;return this.initPromise||(this.initPromise=new Promise(function(e,t){if(r.options.authType===l.AuthenticationType.subscriptionKey)e();else if(r.options.authType===l.AuthenticationType.aad)r.options.authContext=r.options.authContext||N.getDefaultAuthContext(r.options),r.options.authContext.handleRedirectPromise().then(function(){setTimeout(function(){return r._loginAndAcquireTokenForAAD(e,t)})}).catch(function(e){t(new Error("Error logging in the AAD users: "+e))});else if(r.options.authType===l.AuthenticationType.anonymous)e(r._triggerTokenFetch(!0));else if(r.options.authType===l.AuthenticationType.sas){if(r.options.sasToken){var o=-1;try{o=r._getTokenExpiry(r.options.sasToken)}catch(e){return void t(new Error("An invalid sasToken was provided."))}if(o>N.constants.tokenRefreshClockSkew)return r._storeToken(r.options.sasToken),r._setTimeoutTokenFetch(o-N.constants.tokenRefreshClockSkew),void e()}e(r._triggerTokenFetch())}else t(new Error("An invalid authentication type was specified."))})),this.initPromise},N.prototype.dispose=function(){this.tokenTimeOutHandle&&(clearTimeout(this.tokenTimeOutHandle),this.tokenTimeOutHandle=null)},N.getDefaultAuthContext=function(e){if(!e.aadAppId)throw new Error("No AAD app ID was specified.");if(e.aadTenant)return this.defaultAuthContext||(this.defaultAuthContext=new aC({auth:{authority:"".concat(e.aadInstance||V).concat(e.aadTenant),clientId:e.aadAppId},cache:{cacheLocation:this.constants.preferredCacheLocation}})),this.defaultAuthContext;throw new Error("No AAD tenant was specified.")},N.prototype._loginAndAcquireTokenForAAD=function(e,t){var o=(null==(o=this.options.authContext)?void 0:o.getAllAccounts())||[];0===o.length?(this.options.authContext.loginRedirect(),e()):(this.options.authContext.setActiveAccount(o[0]),this._acquireTokenForAAD(e,t))},N.prototype._acquireTokenForAAD=function(o,t){var r=this,n={scopes:[fe]};this.options.authContext.acquireTokenSilent(n).then(function(e){r._saveItem(N.constants.storage.tokenKey,e.accessToken);var t={map:r.map,type:N.constants.events.tokenAcquired},t=(r.map.events.invoke(N.constants.events.tokenAcquired,t),clearTimeout(r.tokenTimeOutHandle),new Date(e.expiresOn).getTime()-Date.now());r.tokenTimeOutHandle=setTimeout(function(){return r._acquireTokenForAAD()},t),null!=o&&o()}).catch(function(e){if(e instanceof Fv)return r.options.authContext.acquireTokenRedirect(n),null==o?void 0:o();null!=t&&t(e)})},N.prototype.getAuthType=function(){return this.options.authType},N.prototype.getClientId=function(){return this.options.clientId},N.prototype.getToken=function(){if(this.options.authType===l.AuthenticationType.aad)return this._getItem(N.constants.storage.tokenKey);if(this.options.authType!==l.AuthenticationType.anonymous&&this.options.authType!==l.AuthenticationType.sas)return this.options.authType===l.AuthenticationType.subscriptionKey?this.options.subscriptionKey:void 0;var e=this._getItem(N.constants.storage.tokenKey);if(e){var t=this._getTokenExpiry(e);if(t<300&&0<t)this._triggerTokenFetch();else if(t<=0)throw this._saveItem(N.constants.storage.tokenKey,""),new Error(N.constants.errors.tokenExpired)}else this._triggerTokenFetch();return e},N.prototype._getTokenExpiry=function(e){var e=hC(e).exp,t=this._getCurrentTime();return 0<e-t?e-t:-1},N.prototype._storeToken=function(e){this._saveItem(N.constants.storage.tokenKey,e);e={map:this.map,type:N.constants.events.tokenAcquired};this.map.events.invoke(N.constants.events.tokenAcquired,e)},N.prototype._saveItem=function(e,t){return this._supportsLocalStorage()?localStorage.setItem(e,t):this._supportsSessionStorage()?sessionStorage.setItem(e,t):this.fallbackStorage[e]=t,!0},N.prototype._getItem=function(e){return this._supportsLocalStorage()?localStorage.getItem(e):this._supportsSessionStorage()?sessionStorage.getItem(e):e in this.fallbackStorage?this.fallbackStorage[e]:null},N.prototype._supportsLocalStorage=function(){try{return window.localStorage?(window.localStorage.setItem(N.constants.storage.testStorageKey,"A"),"A"===window.localStorage.getItem(N.constants.storage.testStorageKey)&&(window.localStorage.removeItem(N.constants.storage.testStorageKey),!window.localStorage.getItem(N.constants.storage.testStorageKey))):!1}catch(e){return!1}},N.prototype._supportsSessionStorage=function(){try{return window.sessionStorage?(window.sessionStorage.setItem(N.constants.storage.testStorageKey,"A"),"A"===window.sessionStorage.getItem(N.constants.storage.testStorageKey)&&(window.sessionStorage.removeItem(N.constants.storage.testStorageKey),!window.sessionStorage.getItem(N.constants.storage.testStorageKey))):!1}catch(e){return!1}},N.prototype._getCurrentTime=function(){return Math.round((new Date).getTime()/1e3)},N.prototype.signRequest=function(e){e.headers=e.headers||{},e.headers[ge]=this.sessionId,e.headers[de]=pe,e.headers[le]="MapControl/".concat(Le," (Web)");var t=this.getToken();switch(this.options.authType){case l.AuthenticationType.aad:case l.AuthenticationType.anonymous:e.headers[he]=this.options.clientId,e.headers[X]=$+t;break;case l.AuthenticationType.sas:e.headers[X]=ee+t;break;case l.AuthenticationType.subscriptionKey:e.headers["subscription-key"]=t;break;default:throw new Error("An invalid authentication type was specified")}return e},N.constants={preferredCacheLocation:"localStorage",storage:{tokenKey:"access.token.key",testStorageKey:"testStorage"},events:{tokenAcquired:"tokenacquired"},tokenExpiresIn:3599,tokenRefreshClockSkew:300,errors:{tokenExpired:"Token Expired, Try again"}};var dC=N;function N(e){var n=this,t=(this.fallbackStorage={},this._triggerTokenFetch=function(e){return void 0===e&&(e=!1),new Promise(function(o,r){"function"!=typeof n.options.getToken?r(new Error("Token cannot be ".concat(e?"fetched":"renewed"," because getToken was not set or is not a function."))):n.options.getToken(function(e){try{var t=n._getTokenExpiry(e)-N.constants.tokenRefreshClockSkew;n._storeToken(e),n._setTimeoutTokenFetch(t),o()}catch(e){r(new Error("Invalid token returned by getToken function"))}},function(e){r(e)},n.map)})},this._setTimeoutTokenFetch=function(e){clearTimeout(n.tokenTimeOutHandle),n.tokenTimeOutHandle=setTimeout(n._triggerTokenFetch,Math.min(1e3*e,2147483647))},e.getServiceOptions());this.options=t.authOptions,this.sessionId=t.sessionId,this.map=e}var pC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},fC=(gC.prototype.add=function(e,t){var o,r;if(Array.isArray(e))try{for(var n=pC(e),i=n.next();!i.done;i=n.next()){var a=i.value;this._add(a,t)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}else this._add(e,t)},gC.prototype.getControls=function(){return Array.from(this.controls)},gC.prototype.remove=function(e){var t,o;if(Array.isArray(e))try{for(var r=pC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this._remove(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}else this._remove(e)},gC.prototype._add=function(e,t){this.controls.add(e);var o=(new Kt).merge(t),e=e.onAdd(this.map,t),t=this.controlContainer.getElementsByClassName(o.position);if(!(0<t.length))throw new Error("Control position ".concat(o.position," does not exist."));t.item(0).appendChild(e)},gC.prototype._remove=function(e){e.onRemove(),this.controls.delete(e)},gC);function gC(e){for(var t in this.map=e,this.controlContainer=document.createElement("div"),this.controlContainer.classList.add("atlas-control-container"),l.ControlPosition){var o;l.ControlPosition.hasOwnProperty(t)&&((o=document.createElement("div")).classList.add(l.ControlPosition[t]),o.classList.add("subcontrol-container"),this.controlContainer.appendChild(o))}this.map.getMapContainer().appendChild(this.controlContainer),this.controls=new Set}var mC=window&&window.__assign||function(){return(mC=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},yC=(vC.prototype.addCallback=function(a,s,c,e,u){var t,l,h=this;if(e)t=function(e){var t=e.lngLat?new dl(e.lngLat.lng,e.lngLat.lat):void 0,o=e.point?[e.point.x,e.point.y]:void 0,r=e.features?e.features.map(function(e){return new eu(e.geometry,e.properties,e.id)}):[],e={type:e.type,originalEvent:e.originalEvent,position:t,coordinate:o,features:r};c(e)};else switch(a){case"data":case"sourcedata":case"styledata":t=function(e){e=mC(mC({dataType:e.dataType},"source"===e.dataType&&mC(mC(mC({isSourceLoaded:e.isSourceLoaded},e.sourceDataType&&{sourceDataType:e.sourceDataType}),{source:h.map.sources.getById(e.sourceId)}),e.tile&&{tile:{id:{x:e.tile.tileID.canonical.x,y:e.tile.tileID.canonical.y,z:e.tile.tileID.canonical.z},size:e.tile.tileSize,state:e.tile.state}})),{map:h.map,type:e.type});u&&h.map.events._removeListener(a,s,c),c(e)};break;case"error":t=function(e){e={error:e.error,map:h.map,type:e.type};u&&h.map.events._removeListener(a,s,c),c(e)};break;case"touchstart":case"touchend":case"touchmove":case"touchcancel":t=function(e){if(e.originalEvent){if(e.originalEvent===l)return;l=e.originalEvent}var t=e.point?new nu(e.point.x,e.point.y):void 0,o=e.points?e.points.map(function(e){return new nu(e.x,e.y)}):[],r=e.lngLat?new dl(e.lngLat.lng,e.lngLat.lat):void 0,n=e.lngLats?e.lngLats.map(function(e){return new dl(e.lng,e.lat)}):[],i=r?h.map.layers.getRenderedShapes(new au(r),s?[s]:void 0):[],t={map:h.map,originalEvent:e.originalEvent,pixel:t,pixels:o,position:r,positions:n,shapes:i,layerId:s||void 0,preventDefault:function(){return e.preventDefault()},type:e.type};u&&h.map.events._removeListener(a,s,c),c(t)};break;case"mousedown":case"mouseup":case"mouseover":case"mousemove":case"click":case"dblclick":case"mouseout":case"mouseenter":case"mouseleave":case"contextmenu":t=function(e){if(e.originalEvent){if(e.originalEvent===l)return;l=e.originalEvent}var t=e.lngLat?new dl(e.lngLat.lng,e.lngLat.lat):void 0,o=e.point?new nu(e.point.x,e.point.y):void 0,r=t?h.map.layers.getRenderedShapes(new au(t),s?[s]:void 0):[],t={map:h.map,originalEvent:e.originalEvent,position:t,pixel:o,preventDefault:function(){return e.preventDefault()},shapes:r,layerId:s||void 0,type:e.type};u&&h.map.events._removeListener(a,s,c),c(t)};break;case"styleimagemissing":t=function(e){u&&h.map.events._removeListener(a,s,c),c(e.id)};break;case"wheel":t=function(e){if(e.originalEvent){if(e.originalEvent===l)return;l=e.originalEvent}var t={map:h.map,originalEvent:e.originalEvent,preventDefault:function(){return e.preventDefault()},type:e.type};u&&h.map.events._removeListener(a,s,c),c(t)};break;case"resize":t=function(e){var t,o={map:h.map,type:e.type};for(t in e)"type"!==t&&"target"!==t&&(o[t]=e[t]);u&&h.map.events._removeListener(a,s,c),c(o)};break;default:t=function(e){var t={map:h.map,type:e.type};e.originalEvent&&(t.originalEvent=e.originalEvent),u&&h.map.events._removeListener(a,s,c),c(t)}}this.callbacks.has(s)||this.callbacks.set(s,new Zt),this.callbacks.get(s).has(a)||this.callbacks.get(s).set(a,new Map),this.callbacks.get(s).get(a).set(c,[t,u])},vC.prototype.removeCallback=function(e,t,o){this.callbacks.has(t)&&this.callbacks.get(t).has(e)&&this.callbacks.get(t).get(e).has(o)&&this.callbacks.get(t).get(e).delete(o)},vC.prototype.getModifiedCallback=function(e,t,o){if(this.callbacks.has(t)&&this.callbacks.get(t).has(e)&&this.callbacks.get(t).get(e).has(o))return this.callbacks.get(t).get(e).get(o)[0]},vC.prototype.getLayerCallbacks=function(e){if(this.callbacks.has(e))return this.callbacks.get(e)},vC.prototype.getEventCallbacks=function(e,t){if(this.callbacks.has(t)){t=this.callbacks.get(t);if(t.has(e))return t.get(e)}},vC);function vC(e){this.callbacks=new Zt,this.map=e}var _C=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},wC=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},bC=["maxzoomchanged","minzoomchanged","mapconfigurationchanged"],CC=(EC.prototype.add=function(e,t,o){var r,n;if("function"==typeof t)this._addGlobalListener(e,t,!1,!1);else{t=Array.isArray(t)?t:[t];try{for(var i=_C(t),a=i.next();!a.done;a=i.next()){var s=a.value;s instanceof Zh&&Zh._isMBoxEvent(e)?this._addLayerListener(e,s,o,!1,!1):s._addEventListener(e,o,!1)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}},EC.prototype.addOnce=function(e,t,o){"function"==typeof t?this._addGlobalListener(e,t,!1,!0):t instanceof Zh&&Zh._isMBoxEvent(e)?this._addLayerListener(e,t,o,!1,!0):t._addEventListener(e,o,!0)},EC.prototype._addLegacy=function(e,t,o){"function"==typeof t?this._addGlobalListener(e,t,!0,!1):this._addLayerListener(e,t,o,!0,!1)},EC.prototype._addLayerListener=function(e,t,o,r,n){var i,a,s,c,t=t instanceof Zh?t.getId():t,u=this.map.layers.getLayerById(t),l=this.mapCallbackHandler.getModifiedCallback(e,t,o);if(l&&u)try{for(var h=_C(u._getLayerIds()),d=h.next();!d.done;d=h.next()){var p=d.value;this.map._getMap().off(e,p,l)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}if(this.mapCallbackHandler.addCallback(e,t,o,r,n),u){l=this.mapCallbackHandler.getModifiedCallback(e,t,o);try{for(var f=_C(u._getLayerIds()),g=f.next();!g.done;g=f.next()){p=g.value;this.map._getMap().on(e,p,l)}}catch(e){s={error:e}}finally{try{g&&!g.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}}},EC.prototype._addGlobalListener=function(e,t,o,r){var n,i,a,s;bC.includes(e)?this.map._addEventListener(e,t,r):(n=this.mapCallbackHandler.getModifiedCallback(e,"",t),this.mapCallbackHandler.addCallback(e,"",t,o,r),i=this.mapCallbackHandler.getModifiedCallback(e,"",t),"load"===e&&this.map._isLoaded()?(a={type:"load",map:this.map},setTimeout(function(){return i(a)})):"ready"===e?this.map._isReady()&&(s={type:"ready",map:this.map},setTimeout(function(){return i(s)})):(n&&this.map._getMap().off(e,n),this.map._getMap().on(e,i)))},EC.prototype.invoke=function(e,t,o){if(void 0===o)this._invokeListeners(e,"",t);else if(t instanceof Zh&&Zh._isMBoxEvent(e))this._invokeListeners(e,t.getId(),o);else{if(!(t instanceof Qt))throw new Error("The invoke target is invalid.");t._invokeEvent(e,o)}},EC.prototype._invokeListeners=function(o,r,n){var i=this,e=new Zt(this.mapCallbackHandler.getEventCallbacks(o,r));e?e.forEach(function(e,t){e=wC(e,2);e[0],e[1]&&i._removeListener(o,r,t),t(n)}):"error"===o&&console.error("error"in n?n.error:n)},EC.prototype.remove=function(e,t,o){var r,n;if("function"==typeof t)this._removeListener(e,"",t);else{t=Array.isArray(t)?t:[t];try{for(var i=_C(t),a=i.next();!a.done;a=i.next()){var s=a.value;s instanceof Zh&&Zh._isMBoxEvent(e)?this._removeListener(e,s,o):null!=s&&s._removeEventListener(e,o)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}},EC.prototype._removeLegacy=function(e,t,o){"function"==typeof t?this._removeListener(e,"",t):this._removeListener(e,t,o)},EC.prototype._removeListener=function(e,t,o){var r,n;if(bC.includes(e))this.map._removeEventListener(e,o);else{var t=t instanceof Zh?t.getId():t,i=this.mapCallbackHandler.getModifiedCallback(e,t,o);if(i)if(t){var a=this.map.layers.getLayerById(t);if(a)try{for(var s=_C(a._getLayerIds()),c=s.next();!c.done;c=s.next()){var u=c.value;this.map._getMap().off(e,u,i)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}else this.map._getMap().off(e,i);this.mapCallbackHandler.removeCallback(e,t,o)}},EC.prototype._enableLayerEvents=function(c){var u=this,e=this.mapCallbackHandler.getLayerCallbacks(c.getId());e&&e.forEach(function(e,s){e.forEach(function(e){var t,o,r=wC(e,1)[0];try{for(var n=_C(c._getLayerIds()),i=n.next();!i.done;i=n.next()){var a=i.value;u.map._getMap().on(s,a,r)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}})})},EC.prototype._disableLayerEvents=function(c){var u=this,e=this.mapCallbackHandler.getLayerCallbacks(c.getId());e&&e.forEach(function(e,s){e.forEach(function(e){var t,o,r=wC(e,1)[0];try{for(var n=_C(c._getLayerIds()),i=n.next();!i.done;i=n.next()){var a=i.value;u.map._getMap().off(s,a,r)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}})})},EC);function EC(e){this.map=e,this.mapCallbackHandler=new yC(this.map)}var SC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},TC=(IC.prototype.add=function(e,t){var o,r;if(Array.isArray(e))try{for(var n=SC(e),i=n.next();!i.done;i=n.next()){var a=i.value;this._addMarker(a,t)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}else this._addMarker(e,t)},IC.prototype._addMarker=function(e,t){e._addToMap(this.map,t),this.markers.add(e)},IC.prototype.getMarkers=function(){return Array.from(this.markers)},IC.prototype.remove=function(e){var t,o;if(Array.isArray(e))try{for(var r=SC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this._removeMarker(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}else this._removeMarker(e)},IC.prototype._removeMarker=function(t){var o=this;t instanceof lf?(t._removeFromMap(),this.markers.delete(t)):this.markers.forEach(function(e){e._getId()===t&&(e._removeFromMap(),o.markers.delete(e))})},IC.prototype.clear=function(){var t=this;this.markers.forEach(function(e){e._removeFromMap(),t.markers.delete(e)})},IC);function IC(e){this.markers=new Set,this.map=e}AC.prototype.add=function(a,t,s){var c=this;return new Promise(function(o,r){var n,e,i;c.userImages.has(a)?o():t instanceof HTMLImageElement||t instanceof ImageData?(c.map._getMap().addImage(a,t,s),c.userImages.set(a,{image:t,meta:s}),o()):"string"==typeof t&&(e=void 0,e=/<svg/i.test(t)&&!/^data:/i.test(t)?"data:image/svg+xml;base64,"+window.btoa(t):t,i=!1,c.map._sendRequest(e,"Image").then(function(e){return i?void 0:e.blob()}).then(function(e){var t;!i&&e&&(clearTimeout(n),(t=new Image).onload=function(){c.map._getMap().addImage(a,t,s),c.userImages.set(a,{image:t,meta:s}),o()},t.onerror=t.onabort=function(){r("Failed to load image into HTML element.")},t.src=URL.createObjectURL(e))}).catch(function(){i||(clearTimeout(n),r("Failed to load image into HTML element."))}),n=setTimeout(function(){i=!0,r("Failed to load image within specified timeout: ".concat(c.imageLoadTimeout," ms."))},c.imageLoadTimeout))})},AC.prototype.clear=function(){var o=this;this.userImages.forEach(function(e,t){o.map._getMap().removeImage(t)}),this.userImages.clear()},AC.prototype.getImageIds=function(){var o=[];return this.userImages.forEach(function(e,t){o.push(t)}),o},AC.prototype.createFromTemplate=function(e,t,o,r,n){o=o||"#1A73AA",r=r||"#fff";t=(t=Pt(t,n)).replace(/{color}/g,o).replace(/{secondaryColor}/g,r).replace(/{text}/g,"");return this.add(e,t)},AC.prototype.hasImage=function(e){return this.userImages.has(e)},AC.prototype.remove=function(e){this.map._getMap().removeImage(e),this.userImages.delete(e)},AC.prototype._restoreImages=function(){var o=this;this.userImages.forEach(function(e,t){o.map._getMap().hasImage(t)||o.map._getMap().addImage(t,e.image,e.meta)})};var kC=AC;function AC(e){this.userImages=new Zt,this.imageLoadTimeout=5e3,this.map=e}var PC,OC,Uo=window&&window.__extends||(PC=function(e,t){return(PC=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}PC(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),RC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xC=(Uo(MC,OC=Zh),MC.prototype.getOptions=function(){return{}},MC.prototype.setOptions=function(e){},MC.prototype._buildLayers=function(){return this.layers},MC.prototype._getLayerIds=function(){return this.layers.map(function(e){return e.id})},MC.prototype._getSourceIds=function(){var t,e,o=new Set;try{for(var r=RC(this.layers),n=r.next();!n.done;n=r.next()){var i=n.value;"source"in i&&"string"==typeof i.source?o.add(i.source):"source"in i&&i.source&&o.add(i.id)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return o},MC.prototype._updateLayoutProperty=function(t,o,e,r){var n;$c(o,e)||(n=this.map._getMap(),this.layers.forEach(function(e){n.getLayer(e.id)?n.setLayoutProperty(e.id,t,r||o):console.warn("Could not update layout property ".concat(t," for layer ").concat(e.id," to ").concat(r||o))}))},MC);function MC(e,t){t=OC.call(this,t)||this;return t.layers=e,t}var NC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},LC=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},DC=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},qC=(UC.prototype.add=function(e,t){var o,r,n=t instanceof Zh?t.getId():t;if(Array.isArray(e))try{for(var i=NC(e),a=i.next();!a.done;a=i.next()){var s=a.value;this._addLayer(s,n)}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}else this._addLayer(e,n)},UC.prototype._addLayer=function(t,o){if(!(this.map._isReady()||t instanceof xC))throw new Error("The layer '".concat(t.getId(),"' 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 adding a layer to it.");var e,r,n,i;o!==t.getId()&&this.layerIndex.find(function(e){return o===e.getId()})?this._getMapboxLayerExists(t)?(r=this.layerIndex.findIndex(function(e){return e.getId()===t.getId()}),n=this.userLayers.findIndex(function(e){return e.layer.getId()===t.getId()}),this._removeMapboxLayers(t),this._addMapboxLayers(t,o),(i=this.layerIndex[r])&&this.map.events._disableLayerEvents(i),this.map.events._enableLayerEvents(t),this.layerIndex.splice(r,1),e=this.layerIndex.findIndex(function(e){return e.getId()===o}),this.layerIndex.splice(e,0,t),t instanceof xC||(this.userLayers[n]={layer:t,before:o}),i&&i.onRemove()):(this._addMapboxLayers(t,o),this.map.events._enableLayerEvents(t),e=this.layerIndex.findIndex(function(e){return e.getId()===o}),this.layerIndex.splice(e,0,t),t instanceof xC||this.userLayers.push({layer:t,before:o})):(r=this.layerIndex.findIndex(function(e){return e.getId()===t.getId()}),n=this.userLayers.findIndex(function(e){return e.layer.getId()===t.getId()}),0<=r&&0<=n?(i=this.layerIndex[r],this._removeMapboxLayers(i),this._addMapboxLayers(t,r+1),this.map.events._disableLayerEvents(i),this.map.events._enableLayerEvents(t),(this.layerIndex[r]=t)instanceof xC||(this.userLayers[n]={layer:t,before:void 0}),i.onRemove()):(this._addMapboxLayers(t),this.map.events._enableLayerEvents(t),this.layerIndex.push(t),t instanceof xC||this.userLayers.push({layer:t,before:o}))),t.onAdd(this.map)},UC.prototype._addMapboxLayers=function(e,t){var o,r;if(!(e instanceof Mp)||e.getOptions().tileUrl){if(!(e instanceof xC)){e instanceof kd&&(this.map._getMap().addSource(e._getSourceId(),e._buildSource()),this.map.sources.setSourceState(e._getSourceWrapper()));var n=this._getMapboxBefore(t);try{for(var i=NC(e._buildLayers()),a=i.next();!a.done;a=i.next()){var s=a.value;this.map._getMap().addLayer(s,n)}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}}this.map.events._enableLayerEvents(e)}},UC.prototype._removeMapboxLayers=function(e,t){var o,r;if(e instanceof xC&&!t)this.map.events._disableLayerEvents(e);else{try{for(var n=NC(e._getLayerIds()),i=n.next();!i.done;i=n.next()){var a=i.value;this.map._getMap().getLayer(a)&&this.map._getMap().removeLayer(a)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}this.map.events._disableLayerEvents(e),e instanceof kd&&this.map._getMap().getSource(e._getSourceId())&&this.map._getMap().removeSource(e._getSourceId())}},UC.prototype._getMapboxLayerExists=function(t){var o=this,r=!1;return"string"==typeof t?!!(t=this.layerIndex.find(function(e){return e.getId()===t})):(t._getLayerIds().forEach(function(e){o.map._getMap().getLayer(e)&&(r=!0)}),r)},UC.prototype._getMapboxBefore=function(t){var o,e,r,n;if("string"==typeof t){var i=this.layerIndex.find(function(e){return e.getId()===t});if(!i)return;try{for(var a=NC(i._getLayerIds()),s=a.next();!s.done;s=a.next()){var c=s.value;if(this.map._getMap().getLayer(c))return c}}catch(e){o={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}t=this.layerIndex.findIndex(function(e){return e.getId()===t})+1}for(var u=t;u<this.layerIndex.length;u++)try{r=void 0;for(var l=NC(this.layerIndex[u]._getLayerIds()),h=l.next();!h.done;h=l.next()){c=h.value;if(this.map._getMap().getLayer(c))return c}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}},UC.prototype.clear=function(){for(var e=this.layerIndex.length-1;0<=e;e--){var t=this.layerIndex[e];t&&(this._removeMapboxLayers(t,!0),this.layerIndex.splice(e,1),t.onRemove())}this.userLayers=[]},UC.prototype.getLayerById=function(t){var e=this.layerIndex.find(function(e){return e.getId()===t});if(e)return e},UC.prototype.getLayers=function(){return this.layerIndex.slice(0)},UC.prototype._getSourceIds=function(){var t,e,o=new Set;try{for(var r=NC(this.layerIndex),n=r.next();!n.done;n=r.next())n.value._getSourceIds().forEach(function(e){return o.add(e)})}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return o},UC.prototype._getUserLayers=function(){return Array.from(this.userLayers)},UC.prototype.move=function(e,t){var o=e instanceof Zh?e.getId():e,r=t instanceof Zh?t.getId():t;if(!this.layerIndex.find(function(e){return e.getId()===o}))throw new Error("The layer '".concat(o,"' has not been added to the map and cannot be moved."));t=this.layerIndex.findIndex(function(e){return e.getId()===o}),this._moveMapboxLayers(this.layerIndex[t],r),e=this.layerIndex[t],this.layerIndex.splice(t,1),t=this.layerIndex.findIndex(function(e){return e.getId()===r}),-1<t?this.layerIndex.splice(t,0,e):this.layerIndex.push(e),t=this.userLayers.find(function(e){return e.layer.getId()===o});t&&(t.before=r)},UC.prototype._moveMapboxLayers=function(e,t){var o,r,n=this._getMapboxBefore(t);try{for(var i=NC(e._getLayerIds()),a=i.next();!a.done;a=i.next()){var s=a.value;this.map._getMap().moveLayer(s,n)}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}},UC.prototype.getRenderedShapes=function(e,t,o){var r,n,i,a=this;if(e=e||[-180,-85.0511,180,85.0511],Array.isArray(e)?4===e.length||6===e.length?i=this.map.positionsToPixels([f.getSouthWest(e),f.getNorthEast(e)]):2!==e.length&&3!==e.length||(i=this.map.positionsToPixels([e])[0]):i=this.map.positionsToPixels([e.coordinates])[0],t){t=Array.isArray(t)?t:[t];var s=[],c=this;try{for(var u=NC(t),l=u.next();!l.done;l=u.next())!function(e){var t=e instanceof Zh?e.getId():e,e=c.layerIndex.findIndex(function(e){return e.getId()===t});if(!(-1<e))throw new Error("The layer '".concat(t,"' has not been added to the map ")+"and its rendered features cannot be retrieved.");s.push.apply(s,DC([],LC(c.layerIndex[e]._getLayerIds().filter(function(e){return!!a.map._getMap().getLayer(e)})),!1))}(l.value)}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}e=this.map._getMap().queryRenderedFeatures(i,{layers:s,filter:o});return this.map.sources._mapFeaturesToShapes(e)},UC.prototype.remove=function(e){var t,o;if(Array.isArray(e))try{for(var r=NC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this._removeLayer(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}else this._removeLayer(e)},UC.prototype._removeLayer=function(e){var t=e instanceof Zh?e.getId():e,o=this.layerIndex.findIndex(function(e){return e.getId()===t});if(-1==o)throw new Error("The layer '".concat(t,"' has not been added to the map and cannot be removed."));var r=this.layerIndex[o],o=(this._removeMapboxLayers(r),this.layerIndex.splice(o,1),this.userLayers.findIndex(function(e){return e.layer.getId()===t}));-1!=o&&this.userLayers.splice(o,1),e instanceof kd&&this.map.sources.unsetSourceState(e._getSourceId()),r.onRemove()},UC);function UC(e){this.layerIndex=[],this.userLayers=[],this.map=e}var jC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},HC=(BC.prototype.add=function(e){var t,o;e=Array.isArray(e)?e:[e];try{for(var r=jC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this.popups.has(i)||(this.popups.add(i),i.attach(this.map))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},BC.prototype.clear=function(){var t=this;this.popups.forEach(function(e){t.popups.delete(e),e.remove()})},BC.prototype.remove=function(e){var t,o;e=Array.isArray(e)?e:[e];try{for(var r=jC(e),n=r.next();!n.done;n=r.next()){var i=n.value;this.popups.has(i)&&(this.popups.delete(i),i.remove())}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},BC.prototype.getPopups=function(){return Array.from(this.popups)},BC.prototype._getCollectionDiv=function(){var e=this.map.getMapContainer().querySelector(".".concat(BC.Css.collection));return e||((e=document.createElement("div")).classList.add(BC.Css.collection),e.setAttribute("aria-label","Map Information"),this.map.getMapContainer().appendChild(e)),e},BC.prototype._addDraggedPopup=function(e){0===this.draggedPopups.size&&(this.map.getMapContainer().addEventListener("mousemove",this._onDrag),this.map.getMapContainer().addEventListener("touchmove",this._onDrag),this.map.getMapContainer().addEventListener("mouseup",this._onUp),this.map.getMapContainer().addEventListener("touchend",this._onUp)),this.draggedPopups.add(e)},BC.Css={collection:"popup-collection-container"},BC);function BC(e){var r=this;this._onDrag=function(e){var t,o;"mousemove"===e.type?(t=e.clientX,o=e.clientY):"touchmove"===e.type&&(t=e.touches[0].clientX,o=e.touches[0].clientY),r.draggedPopups.forEach(function(e){e._dragToPixel([t,o])})},this._onUp=function(){r.map.getMapContainer().removeEventListener("mousemove",r._onDrag),r.map.getMapContainer().removeEventListener("touchmove",r._onDrag),r.map.getMapContainer().removeEventListener("mouseup",r._onUp),r.map.getMapContainer().removeEventListener("touchend",r._onUp),r.draggedPopups.forEach(function(e){r.draggedPopups.delete(e),e._onUp()})},this.map=e,this.popups=new Set,this.draggedPopups=new Set}var FC=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},zC=(KC.prototype.add=function(e,t){var o,r;if(void 0===t&&(t=!0),Array.isArray(e))try{for(var n=FC(e),i=n.next();!i.done;i=n.next()){var a=i.value;this._addSource(a,t)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}else this._addSource(e,t)},KC.prototype.getRenderedShapes=function(e,t,o){e="string"==typeof e?e:e.getId(),o=this.map._getMap().querySourceFeatures(e,{sourceLayer:o,filter:t});return this.map.sources._mapFeaturesToShapes(o,!0,this.sources.get(e))},KC.prototype.getFeatureState=function(e,t,o){e="string"==typeof e?e:e instanceof _l?e.getId():e.id,t="string"==typeof t?t:t.getId();return this.map._getMap().getFeatureState({id:e,source:t,sourceLayer:o})},KC.prototype.removeFeatureState=function(e,t,o,r){e="string"==typeof e?e:e instanceof _l?e.getId():e.id,t="string"==typeof t?t:t.getId();this.map._getMap().removeFeatureState({id:e,source:t,sourceLayer:o},r)},KC.prototype.setFeatureState=function(e,t,o,r){e="string"==typeof e?e:e instanceof _l?e.getId():e.id,t="string"==typeof t?t:t.getId();this.map._getMap().setFeatureState({id:e,source:t,sourceLayer:r},o)},KC.prototype._buildSources=function(){var t={};return this.sources.forEach(function(e){t[e.getId()]=e._buildSource()}),t},KC.prototype.clear=function(){var t=this;this.sources.forEach(function(e){t.remove(e)})},KC.prototype.getById=function(e){return this.sources.get(e)},KC.prototype.getSources=function(){return Array.from(this.sources.values())},KC.prototype.isSourceLoaded=function(e){e=e instanceof nh?e.getId():e;return this.map._getMap().isSourceLoaded(e)},KC.prototype.remove=function(e,t){var o,r;if(void 0===t&&(t=!0),Array.isArray(e))try{for(var n=FC(e),i=n.next();!i.done;i=n.next()){var a=i.value;this._removeSource(a,t)}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}else this._removeSource(e,t)},KC.prototype.setSourceState=function(e,t){void 0===t&&(t=!0),this.sources.set(e.getId(),e),e._setMap(this.map,t)},KC.prototype.unsetSourceState=function(e){this.sources.has(e)&&(this.sources.get(e)._setMap(null),this.sources.delete(e))},KC.prototype._removeSource=function(e,t){e=e instanceof nh?e.getId():e;if(!this.sources.has(e))throw new Error("'".concat(e,"' is not added to the map"));if(this.map._getMap().getSource(e)&&t&&this.map._getMap().removeSource(e),this.map._getMap().getSource(e)&&t)throw new Error("One or more layers have a dependency on the source '".concat(e,"'"));this.unsetSourceState(e)},KC.prototype._addSource=function(e,t){if(this.sources.has(e.getId())){if(t)throw new Error("'".concat(e.getId(),"' is already added to the map"));this.unsetSourceState(e.getId())}if(t){if(!this.map._isReady())throw new Error("The source '".concat(e.getId(),"' 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 adding a source to it.");this.map._getMap().addSource(e.getId(),e._buildSource())}this.setSourceState(e)},KC.prototype._mapFeaturesToShapes=function(e,t,o){var r,n,i=[];try{for(var a=FC(e),s=a.next();!s.done;s=a.next()){var c=s.value;if((o||"string"==typeof c.source)&&"string"==typeof c.properties[_l._shapeIdPropName]){var u=o||this.sources.get(c.source);if(u instanceof uh){var l=u.getShapeById(c.properties[_l._shapeIdPropName]);if(l instanceof _l){i.push(l);continue}}}t||i.push(c)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},KC.prototype._syncSources=function(n){var r=this;n?(Object.keys(n).map(function(e){var t,o=n[e];switch(o.type){case"vector":case"raster":case"raster-dem":t=new Ep(e,{name:e,tiles:o.tiles,type:o.type,url:o.url,tileSize:"tileSize"in o?o.tileSize:void 0});break;case"canvas":t=new bh(e,o);break;case"geojson":var r=new uh(e,{maxZoom:o.maxzoom,cluster:o.cluster,clusterRadius:o.clusterRadius,tolerance:o.tolerance,lineMetrics:o.lineMetrics,clusterProperties:o.clusterProperties,buffer:o.buffer,clusterMinPoints:o.clusterMinPoints,generateId:o.generateId,promoteId:o.promoteId,filter:o.filter});"string"!=typeof o.data&&void 0!==o.data&&r._addNoUpdate(o.data),t=r;break;case"image":t=new Ph(e,o);break;case"video":t=new Mh(e,o);break;default:t=new Th(e,o)}return t}).forEach(function(e){var t=r.sources.get(e.getId()),o=t&&e._isDeepEqual(t);!o&&t&&r.unsetSourceState(t.getId()),r.setSourceState(e,!o)}),Array.from(this.sources.keys()).filter(function(e){return!(e in n)}).forEach(function(e){return r.unsetSourceState(e)})):console.warn("syncSources called with no style sources which is unexpected.")},KC);function KC(e){this.map=e,this.sources=new Zt}(window&&window.__extends||(GC=function(e,t){return(GC=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}GC(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(ZC,YC=ye);var GC,YC,WC=ZC;function ZC(){var e=null!==YC&&YC.apply(this,arguments)||this;return e.duration=1e3,e.type="jump",e}(window&&window.__extends||(QC=function(e,t){return(QC=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}QC(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(XC,VC=ye);var QC,VC,JC=XC;function XC(){var e=null!==VC&&VC.apply(this,arguments)||this;return e.bottom=0,e.left=0,e.right=0,e.top=0,e}var $C,eE,hi=window&&window.__extends||($C=function(e,t){return($C=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}$C(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),tE=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},oE=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},rE=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},nE=(hi(iE,eE=ye),iE.prototype.merge=function(){for(var t,e,o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];try{for(var n=tE(o),i=n.next();!i.done;i=n.next()){var a=i.value;a&&"number"==typeof a.padding&&(a.padding={top:a.padding,bottom:a.padding,left:a.padding,right:a.padding})}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return eE.prototype.merge.apply(this,rE([],oE(o),!1))},iE);function iE(){var e=null!==eE&&eE.apply(this,arguments)||this;return e.bounds=[-180,-89,180,90],e.maxBounds=void 0,e.maxZoom=20,e.offset=new nu(0,0),e.padding=new JC,e}(window&&window.__extends||(aE=function(e,t){return(aE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}aE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(uE,sE=ye);var aE,sE,cE=uE;function uE(){var e=null!==sE&&sE.apply(this,arguments)||this;return e.zoom=1,e.center=new dl(0,0),e.centerOffset=new nu(0,0),e.bearing=0,e.pitch=0,e.minZoom=1,e.maxZoom=20,e.minPitch=0,e.maxPitch=60,e.maxBounds=void 0,e}(window&&window.__extends||(lE=function(e,t){return(lE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}lE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(dE,hE=ye);var lE,hE,i=dE;function dE(){var e=null!==hE&&hE.apply(this,arguments)||this;return e.name=void 0,e.before=void 0,e.minZoom=1,e.maxZoom=20,e.overwrite=!1,e.opacity=1,e}(window&&window.__extends||(pE=function(e,t){return(pE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}pE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(mE,fE=i);var pE,fE,gE=mE;function mE(){var e=null!==fE&&fE.apply(this,arguments)||this;return e.color="rgba(0,0,0,.5)",e.outlineColor="#000",e.radius=1,e.outlineWidth=5,e.name="default-circles",e}(window&&window.__extends||(yE=function(e,t){return(yE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}yE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(wE,vE=i);var yE,vE,_E=wE;function wE(){var e=null!==vE&&vE.apply(this,arguments)||this;return e.cap="butt",e.join="miter",e.name="default-linestrings",e.color="#000",e.width=1,e}(window&&window.__extends||(bE=function(e,t){return(bE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}bE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(SE,CE=i);var bE,CE,EE=SE;function SE(){var e=null!==CE&&CE.apply(this,arguments)||this;return e.iconSize=1,e.fontSize=14,e.fontColor="#000",e.textFont="SegoeUi-Regular",e.cluster=!0,e.clusterIcon=void 0,e.textOffset=[0,0],e.name="default-pins",e.icon="pin-darkblue",e.title="",e}(window&&window.__extends||(TE=function(e,t){return(TE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}TE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(AE,IE=i);var TE,IE,kE=AE;function AE(){var e=null!==IE&&IE.apply(this,arguments)||this;return e.color="rgba(0,0,0,.5)",e.outlineColor="#000",e.name="default-polygons",e}(window&&window.__extends||(PE=function(e,t){return(PE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}PE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(xE,OE=i);var PE,OE,RE=xE;function xE(){var e=null!==OE&&OE.apply(this,arguments)||this;return e.name="default-raster",e}(window&&window.__extends||(ME=function(e,t){return(ME=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}ME(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}))(DE,NE=ye);var ME,NE,LE=DE;function DE(){var e=null!==NE&&NE.apply(this,arguments)||this;return e.anchor="map",e.color="#FFFFFF",e.intensity=.5,e.position=[1.15,210,30],e}var qE,UE,be=window&&window.__extends||(qE=function(e,t){return(qE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}qE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),jE=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},HE=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},BE=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},FE=(be(zE,UE=ye),zE.prototype.merge=function(){for(var t,e,o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];try{for(var n=jE(o),i=n.next();!i.done;i=n.next()){var a=i.value;a&&(a.hasOwnProperty("view")?a.userRegion=a.view:a.hasOwnProperty("userRegion")&&(a.view=a.userRegion),"string"==typeof a.language)&&(a.language=Re.getCode(a.language))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return UE.prototype.merge.apply(this,BE([],HE(o),!1))},zE);function zE(){var e=null!==UE&&UE.apply(this,arguments)||this;return e.antialias=void 0,e.autoResize=!0,e.language=Ge,e.light=new LE,e.preserveDrawingBuffer=!1,e.progressiveLoading=!1,e.progressiveLoadingInitialLayerGroups=["base"],e.renderWorldCopies=!0,e.showBuildingModels=!1,e.showFeedbackLink=!0,e.showLogo=!0,e.showLabels=!0,e.customAttribution=void 0,e.showTileBoundaries=!1,e.style=void 0,e.view=Ke,e.userRegion=e.view,e.customStyleTransform=void 0,e}function KE(e){return 0==e.length?void 0:e.slice(1).reduce(function(o,r){return function(e,t){e=o(e,t);return WE(WE({},e),r(e.url,t))}},e[0])}var GE,YE,Mi=window&&window.__extends||(GE=function(e,t){return(GE=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}GE(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),WE=window&&window.__assign||function(){return(WE=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},ZE=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},QE=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},VE=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},JE=(Mi(XE,YE=ye),XE.prototype.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.styleDefinitionsVersion;try{for(var r=ZE(e),n=r.next();!n.done;n=r.next()){var i=n.value;i&&(i.authOptions?"string"==typeof i.authOptions.subscriptionKey&&(i.subscriptionKey=i["subscription-key"]=i.authOptions.subscriptionKey):"string"==typeof i.subscriptionKey?(i["subscription-key"]=i.subscriptionKey,i.authOptions={authType:l.AuthenticationType.subscriptionKey,subscriptionKey:i.subscriptionKey}):"string"==typeof i["subscription-key"]&&(i.subscriptionKey=i["subscription-key"],i.authOptions={authType:l.AuthenticationType.subscriptionKey,subscriptionKey:i["subscription-key"]}),"string"==typeof i.sessionId?i["session-id"]=i.sessionId:"string"==typeof i["session-id"]&&(i.sessionId=i["session-id"]),"boolean"==typeof i.disableTelemetry?i["disable-telemetry"]=i.disableTelemetry:"boolean"==typeof i["disable-telemetry"]&&(i.disableTelemetry=i["disable-telemetry"]),"boolean"==typeof i.enableAccessibility?i["enable-accessibility"]=i.enableAccessibility:"boolean"==typeof i["enable-accessibility"]&&(i.enableAccessibility=i["enable-accessibility"]))}}catch(e){c={error:e}}finally{try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(c)throw c.error}}var a=this._transformers,s=e?e.filter(function(e){return void 0!==e}).reduce(function(e,t){return VE(VE([],QE(e),!1),QE(t._transformers||[]),!1)},[]):[],c=YE.prototype.merge.apply(this,VE([],QE(e),!1)),s=(c.authOptions.authType!==l.AuthenticationType.subscriptionKey&&(c["subscription-key"]=c.subscriptionKey=void 0),void 0!==c.styleSet&&void 0===c.mapConfiguration&&(c.mapConfiguration=c.styleSet),c.mapConfiguration&&"string"!=typeof c.mapConfiguration&&(c.mapConfiguration=WE(WE({},c.mapConfiguration),{defaultConfiguration:c.mapConfiguration.defaultConfiguration||c.mapConfiguration.defaultStyle,configurations:c.mapConfiguration.configurations||c.mapConfiguration.styles})),this._transformers=VE(VE([],QE(a||[]),!1),QE(s.filter(function(e){return!a.includes(e)})),!1),this.transformRequest&&!this._transformers.includes(this.transformRequest)&&this._transformers.push(this.transformRequest),new Date(Date.UTC(2023,0))),u=new Date(this.styleDefinitionsVersion);return(isNaN(u.getTime())||u.getTime()<s.getTime())&&(console.warn("Style definition version ".concat(this.styleDefinitionsVersion," is invalid or deprecated, style definition version is unchanged (").concat(o,")")),this.styleDefinitionsVersion=o),this.transformRequest=KE(this._transformers),c},XE.prototype.addTransformer=function(e){this._transformers||(this._transformers=[]),this._transformers.push(e),this.transformRequest=KE(this._transformers)},XE.prototype.removeTransformer=function(t){this._transformers&&(this._transformers=this._transformers.filter(function(e){return t!==e}),this.transformRequest=KE(this._transformers))},XE._cloneCustomizer=function(e){if("object"==typeof e)return Object.assign({},e)},XE);function XE(){var e=null!==YE&&YE.apply(this,arguments)||this;return e.authOptions=ct(),e.disableTelemetry="atlas.azure.us"===We,e["disable-telemetry"]=e.disableTelemetry,e.domain=We,e.staticAssetsDomain=Ze,e.styleDefinitionsPath=Qe,e.styleDefinitionsVersion=Ve,e.styleAPIVersion=Je,e.mapConfiguration=void 0,e.styleSet=void 0,e.enableAccessibility=!0,e["enable-accessibility"]=e.enableAccessibility,e.enableAccessibilityLocationFallback=!0,e.maxParallelImageRequests=gt(),e.refreshExpiredTiles=!0,e.subscriptionKey=vt(),e["subscription-key"]=e.subscriptionKey,e.sessionId=Ye,e["session-id"]=e.sessionId,e._transformers=[],e.transformRequest=void 0,e.workerCount=ft(),e.fadeDuration=300,e.localIdeographFontFamily="sans-serif",e.validateStyle=!1,e}eS.getLayerGroup=function(e){return"string"!=typeof e&&e.metadata&&e.metadata["microsoft.maps:layerGroup"]?e.metadata["microsoft.maps:layerGroup"]:(e="string"!=typeof e?e.id:e).startsWith("microsoft.")&&4<=(e=e.split(".")).length?e[3]:void 0};var $E=eS;function eS(){}oS.resolve=function(e){return new oS(Promise.resolve(e))},oS.reject=function(e){return new oS(Promise.reject(e))},oS.prototype.then=function(e,t){var o=this;return new Promise(function(e,t){o._resolve=e,o._reject=t,o._thenResolver(e,t)}).then(e,t)},oS.prototype.catch=function(e){var o=this;return new Promise(function(e,t){o._resolve=e,o._reject=t,o._thenResolver(e,t)}).catch(e)},oS.prototype.finally=function(e){var o=this;return new Promise(function(e,t){o._resolve=e,o._reject=t,o._thenResolver(e,t)}).finally(e)},oS.prototype.hijackAndResolve=function(e){this._hijackedToResolve=e,this._resolve&&this._resolve(e)},oS.prototype.hijackAndReject=function(e){this._hijackedToReject=e,this._reject&&this._reject(e)},oS.prototype.switchWith=function(e){this.origin=e,this._toResolve=void 0,this._toReject=void 0};var tS=oS;function oS(e){var n=this;this.isHijacked=function(){return void 0!==n._hijackedToResolve||void 0!==n._hijackedToReject},this.isResolved=function(){return void 0!==n._hijackedToResolve||void 0!==n._toResolve},this.isRejected=function(){return void 0!==n._hijackedToReject||void 0!==n._toReject},this.resultIfResolved=function(){return n._hijackedToResolve||n._toResolve},this.errorIfRejected=function(){return n._hijackedToReject||n._toReject},this._thenResolver=function(t,o){var r;n._hijackedToResolve?t(n._hijackedToResolve):n._hijackedToReject?o(n._hijackedToReject):(r=n.origin,n.origin.then(function(e){n.isHijacked()||(r!==n.origin?n._thenResolver(t,o):(n._toResolve=e,t(e)))}).catch(function(e){n.isHijacked()||(r!==n.origin?n._thenResolver(t,o):(n._toReject=e,o(e)))}))},this.origin=e,this[Symbol.toStringTag]=this.origin[Symbol.toStringTag]}var rS={road:"Road",satellite:"Satellite",satellite_road_labels:"Hybrid",grayscale_dark:"Grayscale (Dark)",grayscale_light:"Grayscale (Light)",night:"Night",road_shaded_relief:"Terra",blank:"Blank",blank_accessible:"Blank (Accessible)",high_contrast_dark:"High contrast (Dark)",high_contrast_light:"High contrast (Light)"},nS=window&&window.__assign||function(){return(nS=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},iS=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},aS=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},sS=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},cS=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},uS=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},lS=(hS.prototype.updateIndoorState=function(e,t){var o,r,n=this,i=this.map.styles.getMapConfiguration();i?(this.preservedPreindoorMapConfiguration=i,o=this.map.getStyle().style?"".concat(this.map.getStyle().style,"_indoor").concat("dark"===e?"_dark":"","_tileset_").concat(t):void 0,this.map.styles.setMapConfiguration("defaultIndoor_".concat(t),"microsoft-maps:default"===i?o:void 0)):(r=(null==(i=this.indoorState)?void 0:i.tilesetId)!==t,this.indoorState={tilesetId:t,theme:e},this.initStyleset(),this.definitions().then(function(e){var t=(n.map.getStyle().style||e.defaultConfiguration).replace("_indoor_dark","").replace("_indoor",""),o="".concat(t,"_indoor"),t=e.configurations.find(function(e){return e.name.startsWith(o)});t&&n.map.setStyle({style:t.name},!r)}))},hS.prototype.unsetIndoorState=function(){var o=this,e=this.preservedPreindoorMapConfiguration;e?this.map.styles.setMapConfiguration(e):(this.indoorState=void 0,this.initStyleset(),this.definitions().then(function(e){var t=o.map.getStyle().style;t.includes("_indoor")&&t.split("_indoor")[0]?o.map.setStyle({style:t.split("_indoor")[0]}):o.map.setStyle({style:void 0})}))},hS.prototype.initStyleset=function(){var e,o=this;return e=this.serviceOptions.mapConfiguration?"string"==typeof this.serviceOptions.mapConfiguration?(e=this.map.authentication?this.map.authentication.initialize():Promise.resolve(),new tS(e.then(function(){return o._request(o.serviceOptions.domain,"".concat(ue,"/mapconfigurations/metadata/").concat(o.serviceOptions.mapConfiguration),"StyleDefinitions").then(function(e){return nS(nS({},e),{defaultConfiguration:e.defaultConfiguration||e.defaultStyle,configurations:e.configurations||e.styles})})}))):tS.resolve(this.serviceOptions.mapConfiguration):(e=this.map.authentication?this.map.authentication.initialize():Promise.resolve(),new tS(e.then(function(){return o._request(o.serviceOptions.staticAssetsDomain,"".concat(ce,"/").concat(ue),"StyleDefinitions",{version:o.serviceOptions.styleDefinitionsVersion,mcv:Le.replace(/\./g,"")}).then(function(t){return{version:isNaN(t.version)?0:parseFloat(t.version),defaultConfiguration:t.defaultStyle,configurations:t.styles.filter(function(e){return o.indoorState?"auto"===o.indoorState.theme?e.name.endsWith("dark"===e.theme?"_indoor_dark":"_indoor"):e.name.endsWith("dark"===o.indoorState.theme?"_indoor_dark":"_indoor"):!e.name.includes("indoor")}).map(function(e){return{copyright:e.copyright.join(" "),name:e.name,displayName:function(e){e=o.indoorState&&e.includes("_indoor")?e.split("_indoor")[0]:e;return e in rS?rS[e]:e}(e.name),theme:e.theme,thumbnail:new Te({domain:o.serviceOptions.staticAssetsDomain,path:e.thumbnail,protocol:"https"}).toString(),url:new Te({domain:o.serviceOptions.staticAssetsDomain,path:"".concat(ce,"/").concat(ue,"/").concat(e.name),queryParams:{styleVersion:void 0!==t.version&&null!==t.version?t.version:o.serviceOptions.styleDefinitionsVersion,mcv:Le.replace(/\./g,"")},protocol:"https"}).toString()}})}})}))),this.initPromise&&this.initPromise.switchWith(e),this.initPromise=e,this.initPromise.then(function(e){return o.map._invokeEvent("mapconfigurationchanged",e)}),this.initPromise},hS.prototype.getStyle=function(e){e=this._lookUp(e);if(!e)throw Error("Style definition is not available.");if(e.url)return e.url;if(e.style)return e.style;throw Error("Style definition neither contains URL nor style object.")},hS.prototype.deriveNewStyleAndLayerGroups=function(e,t){for(var o,r,n=this.map.getStyle(),i=this.map.getTraffic(),a={},s=0;s<t.layers.length;s++){var c=t.layers[s],u=$E.getLayerGroup(c);u?(a[u]||(a[u]=[]),a[u].push(c),n.showBuildingModels||"fill-extrusion"!==c.type?"fill-extrusion"===c.type&&(c.layout=null!=(o=c.layout)?o:{},c.layout.visibility="visible"):(c.layout=null!=(o=c.layout)?o:{},c.layout.visibility="none"),"none"!==i.flow&&u&&u==="traffic_".concat(i.flow)&&"line"==c.type&&(c.layout=null!=(r=c.layout)?r:{},c.layout.visibility="visible"),"labels"!==u&&"labels_places"!==u&&"labels_indoor"!==u||"symbol"!==c.type||(n.showLabels&&"none"!==(null==(r=c.layout)?void 0:r.visibility)?(c.layout=null!=(u=c.layout)?u:{},c.layout.visibility="visible"):(c.layout=null!=(u=c.layout)?u:{},c.layout.visibility="none"))):a[c.id]=[c]}return[t,a]},hS.prototype.injectUserLayersIntoStyle=function(a,s,c){return a?this.map.layers._getUserLayers().reduce(function(o,t){var r,e,n,i;return t.layer instanceof Bp||(r=(null==(e=null==(e=null==c?void 0:c[t.before])?void 0:e[0])?void 0:e.id)||t.before,e=a.layers.find(function(e){return e.id===t.layer.getId()}),-1<(n=s.layers.findIndex(function(e){return e.id===t.layer.getId()}))&&s.layers.splice(n,1),e&&(n=new Set(Array.from(t.layer._getSourceIds()).map(function(e){var t;return!o.sources[e]&&(t=a.sources[e])?{source:t,id:e}:void 0}).filter(function(e){return void 0!==e})),-1<(i=r?o.layers.findIndex(function(e){return e.id===r}):-1)?o.layers.splice(i,0,e):o.layers.push(e),n.forEach(function(e){var t=e.source,e=e.id;o.sources[e]=t}))),o},nS({},s)):s},hS.prototype.setStyle=function(n,e){var i=this,t=(void 0===e&&(e=!0),this._lookUp(n));if(!t)throw Error("Style definition ".concat(n.style," is not available."));if(!t.url&&!t.style)throw Error("Style definition neither contains URL nor style object.");var o=function(){return i._onStyleData(t)},a=function(){i.map.events.remove("styledata",o),i.map.events.addOnce("styledata",o)},r=n&&n.customStyleTransform?function(e,t){e=n.customStyleTransform(e,t);return a(),e}:function(e,t){var o=nS(nS({},t),{layers:cS([],sS(t.layers),!1),sources:nS({},t.sources)}),r=n.progressiveLoading&&!i.map._isLoaded(),t=(r&&Array.isArray(null==t?void 0:t.layers)&&((o=nS({},t)).layers=o.layers.map(function(e){var t=nS({},e);return e.layout&&(t.layout=nS({},e.layout)),t})),sS(i.deriveNewStyleAndLayerGroups(e,o),2)),o=t[0],t=t[1],r=(r&&(r=n.progressiveLoadingInitialLayerGroups,Array.isArray(r))&&0<r.length&&i._deferLayerGroupVisibilities(t,r),i.injectUserLayersIntoStyle(e,o,t)),e=Object.entries(t).map(function(e){var e=sS(e,2),t=e[0],e=e[1];return i._buildFundamentalLayerFrom(e,t)}),o=i.map.layers._getUserLayers().reduce(function(e,t){var o=t.before?e.findIndex(function(e){return e.getId()===t.before}):-1;return-1<o?e.splice(o,0,t.layer):e.push(t.layer),e},e);return i.map.layers.layerIndex=o,i.map.sources._syncSources(r.sources),a(),r};this.map._getMap().setStyle(t.url||t.style,{diff:e,validate:this.serviceOptions.validateStyle,transformStyle:r})},hS.prototype.getTheme=function(e){e=this._lookUp(e);if(e)return e.theme.toLowerCase()},hS.prototype.getThemeAsync=function(t){return iS(this,void 0,void 0,function(){return aS(this,function(e){switch(e.label){case 0:return[4,this._lookUpAsync(t)];case 1:return[2,e.sent().theme]}})})},hS.prototype.setMapConfiguration=function(e,o){var r=this;"string"==typeof(this.serviceOptions.mapConfiguration=e)?this.initStyleset():this.initPromise?this.initPromise.hijackAndResolve(e):this.initPromise=tS.resolve(e),this.definitions().then(function(e){var t=e.defaultConfiguration;e.configurations.find(function(e){return e.name===o})&&(t=o),r.map.setStyle({style:t})})},hS.prototype.getMapConfiguration=function(){return this.serviceOptions.mapConfiguration},hS.prototype.setStyleSet=function(e){this.updateIndoorState("indoor_dark"===e?"dark":"light",null)},hS.prototype.getStyleSet=function(){return void 0!==this.indoorState?"dark"===this.indoorState.theme?"indoor_dark":"indoor":"base"},hS.prototype.clearStyleSet=function(){this.unsetIndoorState()},hS.prototype._buildFundamentalLayerFrom=function(e,t){if(e&&0<e.length)return(e=new xC(e,t)).onAdd(this.map),e;throw new Error("Unable to construct fundamental map layer for ID: ".concat(t,"."))},hS.prototype._transformStyleRequest=function(e,t){e.includes(te)&&(t.url=t.url.replace(te,this.serviceOptions.domain)),e.includes(ae)&&(t.url=t.url.replace(ae,ce)),e.includes(se)&&(t.url=t.url.replace(se,ue)),(t.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase())||t.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase()))&&((e=new URL(t.url)).searchParams.get(J)||(e.searchParams.set(J,this.serviceOptions.styleAPIVersion),t.url=e.href),null!=(e=this.map.authentication)&&e.signRequest(t),this._deleteAuthTokenForStaticAssets(t))},hS.prototype._request=function(r,n,i,a){var s;return void 0===a&&(a={}),iS(this,void 0,void 0,function(){var t,o;return aS(this,function(e){switch(e.label){case 0:return o={url:new Te({protocol:"https",domain:r,path:n,queryParams:nS(((o={})[J]=this.serviceOptions.styleAPIVersion,o),a)}).toString()},"function"==typeof this.serviceOptions.transformRequest&&i&&(o=this.serviceOptions.transformRequest(o.url,i)),null!=(s=this.map.authentication)&&s.signRequest(o),this._deleteAuthTokenForStaticAssets(o),t={method:"GET",mode:"cors"},o.credentials&&(t.credentials=o.credentials),o.headers&&(t.headers=o.headers),[4,fetch(o.url,t).then(function(e){if(e.ok)return e.json();throw new Error("HTTP ".concat(e.status,": ").concat(e.statusText," "))})];case 1:return[2,e.sent()]}})})},hS.prototype._deleteAuthTokenForStaticAssets=function(e){e.url.startsWith("https://".concat(this.serviceOptions.staticAssetsDomain,"/").concat(ce))&&(delete e.headers[he],delete e.headers[X])},hS);function hS(e,t){var l=this;this.definitions=function(){var e=l.initPromise||l.initStyleset();return e},this.indoorState=void 0,this.preservedPreindoorMapConfiguration=void 0,this._progressiveLoadingState={mapStyle:void 0,pendingVisibilityChange:void 0},this._deferLayerGroupVisibilities=function(t,e){var o,n,r,i,a=e.filter(function(e){return e in t});0!==a.length&&(o=l.map._getMap(),n=o.getZoom(),r=l.map.getStyle().style,l._progressiveLoadingState.pendingVisibilityChange&&(l.map.events.remove("load",l._progressiveLoadingState.pendingVisibilityChange),l._progressiveLoadingState.pendingVisibilityChange=null),l._progressiveLoadingState.mapStyle=r,(i=Object.entries(t).reduce(function(e,t){var t=sS(t,2),o=t[0],t=t[1],r=a.includes(o);return cS(cS([],sS(e),!1),sS(t.filter(function(e){if("custom"===e.type)return!1;if(r)if("number"==typeof e.maxzoom&&"number"==typeof e.minzoom){if(n<=e.maxzoom&&n>=e.minzoom)return!1}else if("number"==typeof e.minzoom){if(n>=e.minzoom)return!1}else{if("number"!=typeof e.maxzoom)return!1;if(n<=e.maxzoom)return!1}return"none"!==(null==(e=e.layout)?void 0:e.visibility)})),!1)},[])).forEach(function(e){e.layout=e.layout||{},e.layout.visibility="none"}),l._progressiveLoadingState.pendingVisibilityChange=function(){l._progressiveLoadingState.pendingVisibilityChange=null;var e=l.map.getStyle().style;r===e&&(i.forEach(function(e){e.layout.visibility="visible",o.setLayoutProperty(e.id,"visibility","visible")}),null!=(e=l.map.copyrightDelegate))&&e.reloadAttribution()},l.map.events.addOnce("load",l._progressiveLoadingState.pendingVisibilityChange))},this._onStyleData=function(e){l.map.events.invoke("stylechanged",{style:e.name,map:l.map,type:"stylechanged"})},this._lookUp=function(e){var t,o,r=l.definitions(),n=r.errorIfRejected(),i=r.resultIfResolved();if(n||!i)return null;var r=i.configurations,a=void 0;try{for(var s=uS(r),c=s.next();!c.done;c=s.next()){var u=c.value;if(u.name===e.style)return u;u.name===i.defaultConfiguration&&(a=a||u)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(t)throw t.error}}return a=a||r[0]},this._lookUpAsync=function(o){return iS(l,void 0,void 0,function(){var t;return aS(this,function(e){switch(e.label){case 0:return[4,this.definitions()];case 1:return t=e.sent(),[2,t.configurations.find(function(e){return e.name===(o.style||t.defaultConfiguration)})||t.configurations.find(function(e){return e.name===t.defaultConfiguration})||t.configurations[0]]}})})},this.map=e,this.serviceOptions=t}var dS=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},pS=(fS.prototype.add=function(e){var t,o;e=Array.isArray(e)?e:[e];try{for(var r=dS(e),n=r.next();!n.done;n=r.next()){var i=n.value;this.indicators.has(i)||(this.indicators.add(i),i.attach(this.map))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},fS.prototype.clear=function(){var t=this;this.indicators.forEach(function(e){t.indicators.delete(e),e.remove()})},fS.prototype.remove=function(e){var t,o;e=Array.isArray(e)?e:[e];try{for(var r=dS(e),n=r.next();!n.done;n=r.next()){var i=n.value;this.indicators.has(i)&&(this.indicators.delete(i),i.remove())}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},fS.prototype.getIndicators=function(){return Array.from(this.indicators)},fS.prototype._getCollectionDiv=function(){var e=this.map.getMapContainer().querySelector(".".concat(fS.Css.collection));return e||((e=document.createElement("div")).setAttribute("aria-label","map data"),e.setAttribute("role","listbox"),e.classList.add(fS.Css.collection),this.map.getMapContainer().appendChild(e)),e},fS.Css={collection:"accessible-indicator-collection-container"},fS);function fS(e){this.map=e,this.indicators=new Set}var gS,mS,cn=window&&window.__extends||(gS=function(e,t){return(gS=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}gS(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),yS=window&&window.__assign||function(){return(yS=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},vS=window&&window.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(o,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?o(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,n)}i((c=c.apply(e,a||[])).next())})},_S=window&&window.__generator||function(r,n){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function e(o){return function(e){var t=[o,e];if(i)throw new TypeError("Generator is already executing.");for(;c=u&&t[u=0]?0:c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=n.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},wS=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},bS=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},CS=window&&window.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],r=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ES=(cn(L,mS=Qt),Object.defineProperty(L.prototype,"isDisposed",{get:function(){return this.removed},enumerable:!1,configurable:!0}),L.prototype.getCanvas=function(){return this.map.getCanvas()},L.prototype.getCanvasContainer=function(){return this.map.getCanvasContainer()},L.prototype.getMapContainer=function(){return this.map.getContainer()},L.prototype.getServiceOptions=function(){return Ql(this.serviceOptions,JE._cloneCustomizer)},L.prototype.setServiceOptions=function(e){this.serviceOptions=(new JE).merge(this.serviceOptions,e),this.serviceOptions["enable-accessibility"]?this.accessibleMapDelegate.addToMap():this.accessibleMapDelegate.removeFromMap();e=this.styles.serviceOptions.mapConfiguration!==this.serviceOptions.mapConfiguration||this.styles.serviceOptions.staticAssetsDomain!==this.serviceOptions.staticAssetsDomain||this.styles.serviceOptions.styleDefinitionsVersion!==this.serviceOptions.styleDefinitionsVersion||this.styles.serviceOptions.domain!==this.serviceOptions.domain||this.styles.serviceOptions.styleAPIVersion!==this.serviceOptions.styleAPIVersion;this.styles.serviceOptions=this.serviceOptions,e&&(this.styles.initPromise=null,this.setStyle({}))},L.prototype.addRequestTransformer=function(e){this.serviceOptions.addTransformer(e)},L.prototype.removeRequestTransformer=function(e){this.serviceOptions.removeTransformer(e)},L.prototype.setCamera=function(e,t){if(void 0===t&&(t=!1),"padding"in e||"offset"in e||"bounds"in e){var o,r=(new nE).merge({maxZoom:this.getCamera().maxZoom},e),n=this._generateSafeBounds(r.bounds),i={padding:r.padding,offset:r.offset,maxZoom:r.maxZoom};if(!(o=this.map.cameraForBounds(n,i)))throw a={message:"The map cannot be fit to the current canvas with the given CameraBoundsOptions.",containerWidth:null==(a=null==(a=this.map)?void 0:a.getContainer())?void 0:a.clientWidth,containerHeight:null==a?void 0:a.clientHeight,safeBounds:n,cameraForBoundsOptions:i},new Error(JSON.stringify(a));"pitch"in e&&(o.pitch=e.pitch),"bearing"in e&&(o.bearing=e.bearing),"minPitch"in e&&this.map.setMinPitch(e.minPitch),"maxPitch"in e&&this.map.setMaxPitch(e.maxPitch),this.map.setMaxZoom(r.maxZoom),this._invokeEvent("maxzoomchanged",this.map.getMaxZoom()),n=this._generateSafeBounds(r.maxBounds)}else{i=(new cE).merge(this.getCamera(),e);i.centerOffset&&2<=i.centerOffset.length&&(a=i.centerOffset,(r=Ju([i.center],i.zoom))[0][0]+=a[0],r[0][1]+=a[1],i.center=Vu(r,i.zoom)[0]),o={center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,around:void 0},i.minZoom<1&&console.warn("Setting minZoom below 1 may result in an empty map when the zoom level is less than 1."),this.map.setMinZoom(i.minZoom),this.map.setMaxZoom(i.maxZoom),i.minPitch&&this.map.setMinPitch(i.minPitch),i.maxPitch&&this.map.setMaxPitch(i.maxPitch),this._invokeEvent("minzoomchanged",this.map.getMinZoom()),this._invokeEvent("maxzoomchanged",this.map.getMaxZoom()),n=this._generateSafeBounds(i.maxBounds)}n?this.map.setMaxBounds(n):this.map.setMaxBounds(null);var a=(new WC).merge(e),r={duration:a.duration,easing:function(e){return e},offset:[0,0],animate:!0},i={fromControl:t};"jump"===a.type?this.map.jumpTo(o,i):"ease"===a.type?this.map.easeTo(yS(yS({},o),r),i):"fly"===a.type&&this.map.flyTo(yS(yS({},o),r),i)},L.prototype.setCameraBounds=function(e){this.setCamera(e)},L.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 f(e,t),minZoom:this.map.getMinZoom(),maxZoom:this.map.getMaxZoom()}},L.prototype.setStyle=function(e,t){void 0===t&&(t=!0),delete e.preserveDrawingBuffer;e=(new FE).merge(this.styleOptions,e),e.autoResize!==this.styleOptions.autoResize&&this._setAutoResize(e.autoResize),e.language!==this.styleOptions.language&&(this.localizedStringsPromise=Re.getStrings(e.language)),e.renderWorldCopies!==this.styleOptions.renderWorldCopies&&this.map.setRenderWorldCopies(e.renderWorldCopies),e.showFeedbackLink!==this.styleOptions.showFeedbackLink&&this.copyrightControl.setOptions({showFeedbackLink:e.showFeedbackLink}),e.customAttribution!==this.styleOptions.customAttribution&&this.copyrightControl.setOptions({customAttribution:e.customAttribution}),e.showLogo!==this.styleOptions.showLogo&&(this.copyrightControl.setOptions({showLogo:e.showLogo}),this.logoControl.setOptions({showLogo:e.showLogo})),e.showTileBoundaries!==this.styleOptions.showTileBoundaries&&(this.map.showTileBoundaries=e.showTileBoundaries),e.showBuildingModels&&console.warn("showBuildingModels is deprecated."),t=t&&this.styleOptions.language===e.language&&this.styleOptions.view===e.view;this.styleOptions=e,this._setStyleComponents(e,t)},L.prototype.getStyle=function(){return Qa(this.styleOptions)},L.prototype.addIcon=function(e,t){this.imageSprite.add(e,t)},L.prototype.addPins=function(e,t){var t=(new EE).merge(t),o=this.layers.getLayerById(t.name),r=!1;if(o||(r=!0,o=new vp("".concat(t.name,"-source"),t.name,{source:"".concat(t.name,"-source"),minZoom:t.minZoom,maxZoom:t.maxZoom,iconOptions:{anchor:"center",size:t.iconSize,image:["case",["has","icon"],["get","icon"],t.icon],ignorePlacement:!t.cluster,opacity:t.opacity},textOptions:{anchor:"center",textField:["case",["has","point_count"],["to-string",["get","point_count"]],["has","title"],["to-string",["get","title"]],t.title],font:["case",["has","point_count"],["literal",["StandardFontCondensed-Bold"]],["literal",[t.textFont]]],size:["case",["has","point_count"],20,t.fontSize],ignorePlacement:!t.cluster,opacity:t.opacity,offset:["case",["has","point_count"],["literal",[.5,-.45]],["literal",[t.textOffset[0]/16,t.textOffset[1]/16]]],color:t.fontColor}})),!(o instanceof vp))throw new Error("A layer with name '".concat(t.name,"' already exists but it is not a SymbolLayer.")+"A SymbolLayer should be used for rendering pins.");var n=o.getSource(),i=("string"==typeof n?(a=n,n=this.sources.getById(a)):a=n.getId(),!1);if(n||(i=!0,n=new uh(a,{cluster:t.cluster})),!(n instanceof uh))throw new Error("The source with name '".concat(a,"' already exists but it is not a DataSource.")+"New data can only be added to a DataSource.");i&&this.sources.add(n),r&&this.layers.add(o,t.before);var a=new Sl(e);t.overwrite?n.setShapes(a):n.add(a)},L.prototype.addCircles=function(e,t){var t=(new gE).merge(t),o=this.layers.getLayerById(t.name),r=!1;if(o||(r=!0,o=new ud("".concat(t.name,"-source"),t.name,{source:"".concat(t.name,"-source"),minZoom:t.minZoom,maxZoom:t.maxZoom,opacity:t.opacity,radius:["case",["has","radius"],["get","radius"],t.radius],color:["case",["has","color"],["get","color"],t.color],strokeColor:["case",["has","outlineColor"],["get","outlineColor"],t.outlineColor],strokeWidth:["case",["has","outlineWidth"],["get","outlineWidth"],t.outlineWidth]})),!(o instanceof ud))throw new Error("A layer with name '".concat(t.name,"' already exists but it is not a BubbleLayer.")+"A BubbleLayer should be used for rendering circles.");var n=o.getSource(),i=("string"==typeof n?(a=n,n=this.sources.getById(a)):a=n.getId(),!1);if(n||(i=!0,n=new uh(a)),!(n instanceof uh))throw new Error("The source with name '".concat(a,"' already exists but it is not a DataSource.")+"New data can only be added to a DataSource.");i&&this.sources.add(n),r&&this.layers.add(o,t.before);var a=new Sl(e);t.overwrite?n.setShapes(a):n.add(a)},L.prototype.addLinestrings=function(e,t){var t=(new _E).merge(t),o=this.layers.getLayerById(t.name),r=!1;if(o||(r=!0,o=new jd("".concat(t.name,"-source"),t.name,{source:"".concat(t.name,"-source"),minZoom:t.minZoom,maxZoom:t.maxZoom,lineCap:t.cap,lineJoin:t.join,strokeOpacity:t.opacity,strokeColor:["case",["has","color"],["get","color"],t.color],strokeWidth:["case",["has","width"],["get","width"],t.width]})),!(o instanceof jd))throw new Error("A layer with name '".concat(t.name,"' already exists but it is not a LineLayer.")+"A LineLayer should be used for rendering linestrings.");var n=o.getSource(),i=("string"==typeof n?(a=n,n=this.sources.getById(a)):a=n.getId(),!1);if(n||(i=!0,n=new uh(a)),!(n instanceof uh))throw new Error("The source with name '".concat(a,"' already exists but it is not a DataSource.")+"New data can only be added to a DataSource.");i&&this.sources.add(n),r&&this.layers.add(o,t.before);var a=new Sl(e);t.overwrite?n.setShapes(a):n.add(a)},L.prototype.addPolygons=function(e,t){var t=(new kE).merge(t),o=this.layers.getLayerById(t.name),r=!1;if(o||(r=!0,o=new tp("".concat(t.name,"-source"),t.name,{source:"".concat(t.name,"-source"),minZoom:t.minZoom,maxZoom:t.maxZoom,fillOpacity:t.opacity,fillColor:["case",["has","color"],["get","color"],t.color]})),!(o instanceof tp))throw new Error("A layer with name '".concat(t.name,"' already exists but it is not a PolygonLayer.")+"A PolygonLayer should be used for rendering linestrings.");var n=o.getSource(),i=("string"==typeof n?(a=n,n=this.sources.getById(a)):a=n.getId(),!1);if(n||(i=!0,n=new uh(a)),!(n instanceof uh))throw new Error("The source with name '".concat(a,"' already exists but it is not a DataSource.")+"New data can only be added to a DataSource.");i&&this.sources.add(n),r&&this.layers.add(o,t.before);var a=new Sl(e);t.overwrite?n.setShapes(a):n.add(a)},L.prototype.addRaster=function(e,t){var o,t=(new RE).merge(t),r=this.layers.getLayerById(t.name);if(!((r=r||new Mp({maxZoom:t.maxZoom,minZoom:t.minZoom,opacity:t.opacity,tileSize:256,tileUrl:"{subdomain}"},t.name))instanceof Mp))throw new Error("A layer with name '".concat(t.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 '".concat(t.name,"' already exists but was configured ")+"for a single tile url [default for new TileLayer(...)].");(o=!t.overwrite&&r.getOptions().subdomains||[]).push.apply(o,bS([],wS(e),!1)),r._setOptionsNoUpdate({subdomains:o}),this.layers.add(r,t.before)},L.prototype.getLayers=function(){return this.layers.getLayers().map(function(e){return e.getId()})},L.prototype.removeLayers=function(e){var t,o;try{for(var r=CS(e),n=r.next();!n.done;n=r.next()){var i,a=n.value;this.layers.getLayerById(a)&&(this.layers.remove(a),i="".concat(a,"-source"),this.sources.getById(i))&&this.sources.remove(i)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}},L.prototype.addHtml=function(e,t){e.id||(e.id="marker_".concat(W()));var o=new lf({htmlContent:e});return this.markers.add(o,t),e.id},L.prototype.removeHtml=function(e){this.markers.remove(e)},L.prototype.addEventListener=function(e,t,o){this.events._addLegacy(e,t,o)},L.prototype.removeEventListener=function(e,t,o){this.events._removeLegacy(e,t,o)},L.prototype.setUserInteraction=function(e){this.userInteractionDelegate.setOptions(e)},L.prototype.getUserInteraction=function(){return this.userInteractionDelegate.getOptions()},L.prototype.addControl=function(e,t){this.controls.add(e,t)},L.prototype.removeControl=function(e){this.controls.remove(e)},L.prototype.setTraffic=function(e){var t=this.trafficOptions.incidents,o=this.trafficOptions.flow;if(this.trafficOptions=(new uc).merge(this.trafficOptions,e),this.controls.getControls().filter(function(e){return e instanceof yc}).forEach(function(e){return e.updateButtonState()}),this.incidentDelegate&&(this.trafficOptions.incidents?t||this.incidentDelegate.addToMap():this.incidentDelegate.removeFromMap()),this.trafficOptions.flow&&"none"!==this.trafficOptions.flow){["absolute","relative-delay"].includes(this.trafficOptions.flow)&&console.warn("The 'absolute' and 'relative-delay' flow options are deprecated. Please use 'relative' instead.");try{this.trafficOptions.flow!==o&&this.flowDelegate.addToMap()}catch(e){throw this.trafficOptions.flow=o,e}}else this.flowDelegate.removeFromMap()},L.prototype.getTraffic=function(){return Qa(this.trafficOptions)},L.prototype.remove=function(){this.dispose()},L.prototype.clear=function(){this.popups.clear(),this.layers.clear(),this.sources.clear(),this.markers.clear(),this.indicators.clear()},L.prototype.dispose=function(){var e;for(this.clear(),this.map.remove(),null!=(e=this.authentication)&&e.dispose(),this.removed=!0,window.removeEventListener("resize",this._windowResizeCallback);this.getMapContainer().firstChild;){var t=this.getMapContainer().firstChild;this.getMapContainer().removeChild(t)}},L.prototype.resize=function(e,t,o){"number"!=typeof e&&"string"!=typeof e||"number"!=typeof t&&"string"!=typeof t?o=e:(e=e,this.getMapContainer().style.height="number"==typeof e?"".concat(e,"px"):e,this.getMapContainer().style.width="number"==typeof t?"".concat(t,"px"):t);e=this.getMapContainer().style.overflow;this.getMapContainer().style.overflow="hidden",this.map.resize(o),this.getMapContainer().style.overflow=e},L.prototype.pixelsToPositions=function(e){var t,o,r=[];try{for(var n=CS(e),i=n.next();!i.done;i=n.next()){var a=i.value,s=this.map.unproject(a);r.push(new dl(s.lng,s.lat))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return r},L.prototype.positionsToPixels=function(e){var t,o,r=[];try{for(var n=CS(e),i=n.next();!i.done;i=n.next()){var a=i.value,s=this.map.project(a);r.push(new nu(s.x,s.y))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return r},L.prototype.areTilesLoaded=function(){return this.map.areTilesLoaded()},L.prototype.stop=function(){this.map.stop()},L.prototype.triggerRepaint=function(){this.map.triggerRepaint()},L.prototype.enableElevation=function(e,t){this.map.setTerrain("string"==typeof e?{source:e,exaggeration:t}:{source:e.getId(),exaggeration:t})},L.prototype.disableElevation=function(){this.map.setTerrain(null)},L.prototype._getMap=function(){return this.map},L.prototype._rebuildStyle=function(t){return void 0===t&&(t=!0),vS(this,void 0,void 0,function(){return _S(this,function(e){return this.styles.setStyle(this.styleOptions,t),this.imageSprite._restoreImages(),[2]})})},L.prototype._isLoaded=function(){return this.loaded},L.prototype._isReady=function(){return this.ready},L.prototype._getLocalizedStrings=function(){return this.localizedStringsPromise},L.prototype._sendRequest=function(e,t,o){var r;return(r="function"==typeof this.serviceOptions.transformRequest?this.serviceOptions.transformRequest(e,t):r)?fetch(r.url||e,{credentials:r.credentials,headers:yS(yS({},o),r.headers),method:"GET",mode:"cors"}):fetch(e,{headers:o,method:"GET",mode:"cors"})},L.prototype._substituteDomainLanguageViewAndSignInRequest=function(e,t){var o;(e.includes(oe)||e.includes(te))&&(o=new RegExp("[^{]".concat(oe,"[^}]")),e.match(o)&&(t.url=t.url.replace(oe,te)),Te.protoRegEx.test(this.serviceOptions.domain)?(o=t.url.indexOf(te),t.url=this.serviceOptions.domain+t.url.substring(o+te.length)):t.url=t.url.replace(te,this.serviceOptions.domain)),(t.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase())||t.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase()))&&null!=(o=this.authentication)&&o.signRequest(t),e.includes(ie)&&(t.url=t.url.replace(ie,this.styleOptions.language)),e.includes(re)&&(t.url=this.styleOptions.view?t.url.replace(re,this.styleOptions.view):t.url.replace(re,"").replace("&".concat(ne,"="),""))},L.prototype._setAutoResize=function(e){e?window.addEventListener("resize",this._windowResizeCallback):window.removeEventListener("resize",this._windowResizeCallback)},L.prototype._setStyleComponents=function(s,c){var u=this;void 0===c&&(c=!0),this.removed||this.styles.definitions().then(function(e){var t,o,r=!0;if(u.styleOptions.style)try{for(var n=CS(e.configurations),i=n.next();!i.done;i=n.next()){var a=i.value;if(u.styleOptions.style===a.name){r=!1;break}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}r&&(u.styleOptions.style=e.defaultConfiguration),u.styleOptions=s,u._rebuildStyle(c)})},L.prototype._updateGlobalDefaults=function(e){e&&(e.authOptions&&!st&&wt(e.authOptions),e.domain&&!et&&bt(e.domain),e.styleDefinitionsPath&&!tt&&Ct(e.styleDefinitionsPath),e.workerCount&&!rt&&Et(e.workerCount),e.maxParallelImageRequests&&!nt&&St(e.maxParallelImageRequests),!e.subscriptionKey&&!e["subscription-key"]||st||kt(e.subscriptionKey||e["subscription-key"]),!e.sessionId&&!e["session-id"]||at||It(e.sessionId||e["session-id"]),e.language&&!it&&Tt(e.language),!e.userRegion&&!e.view||$e||At(e.userRegion||e.view))},L.prototype._generateSafeBounds=function(e){if(e){var t=f.getSouth(e),o=f.getWest(e),r=f.getNorth(e),n=f.getEast(e);if(!(isFinite(t)&&isFinite(o)&&isFinite(r)&&isFinite(n)))throw new Error("The bounds specified are invalid: [".concat(e,"]"));for(;n<o;)n+=360;return new f([o,t,n,r])}return e},L.prototype._detectHighContrast=function(){var e,t;switch(df.getHighContrastMode()){case"invert":case"light":e=L.Css.hcLight,t="high_contrast_light";break;case"dark":e=L.Css.hcDark,t="high_contrast_dark"}e&&this.map.getContainer().classList.add(e),t&&"road"===this.styleOptions.style&&(this.styleOptions.style=t)},L.Css={canvasContainer:"atlas-map-canvas-container",canvas:"atlas-map-canvas",container:"atlas-map",hcDark:"high-contrast-dark",hcLight:"high-contrast-light"},L);function L(e,t){var o,r,n=mS.call(this)||this;n.removed=!1,n.loaded=!1,n.ready=!1,n._windowResizeCallback=function(){return n.resize()},n._updateGlobalDefaults(t),n.serviceOptions=(new JE).merge(t),n.styleOptions=(new FE).merge(t),n.trafficOptions=new uc,n.styles=new lS(n,n.serviceOptions),n.serviceOptions.authOptions.subscriptionKey&&(n.serviceOptions.authOptions.subscriptionKey=encodeURIComponent(n.serviceOptions.authOptions.subscriptionKey)),o=n.serviceOptions.authOptions.clientId||(n.serviceOptions.authOptions.subscriptionKey?n.serviceOptions.authOptions.subscriptionKey.replace(/.(?=.{3,}$)/g,"*"):"invalid-setting"),n.insights&&n.insights.setAuthenticatedUserContext(n.serviceOptions.sessionId,o),arguments[2]&&"ENVIRONMENT"in window&&window.ENVIRONMENT.hmr?(r=arguments[2],n.ready=!0,n.loaded=!0):(o={antialias:n.styleOptions.antialias,attributionControl:!1,container:e,fadeDuration:n.serviceOptions.fadeDuration,localIdeographFontFamily:n.serviceOptions.localIdeographFontFamily,preserveDrawingBuffer:n.styleOptions.preserveDrawingBuffer,refreshExpiredTiles:n.serviceOptions.refreshExpiredTiles,renderWorldCopies:n.styleOptions.renderWorldCopies,trackResize:!1,transformRequest:function(e,t){var o={url:e};return"Tile"===t||"Source"===t?(e.includes(oe)&&n.insights&&n.insights.trackEvent({name:"TileLoad"}),n._substituteDomainLanguageViewAndSignInRequest(e,o)):"Style"!==t&&"SpriteJSON"!==t&&"SpriteImage"!==t&&"Glyphs"!==t||n.styles._transformStyleRequest(e,o),n.serviceOptions.transformRequest&&Xs(o,n.serviceOptions.transformRequest(o.url,t)),o}},r=new D.Map(o));try{n.map=r,n.authentication=new dC(n),n.controls=new fC(n),n.events=new CC(n),n.imageSprite=new kC(n),n.layers=new qC(n),n.markers=new TC(n),n.sources=new zC(n),n.popups=new HC(n),n.indicators=new pS(n),n.map.getContainer().classList.add(L.Css.container),n.map.getCanvasContainer().classList.add(L.Css.canvasContainer),n.map.getCanvas().classList.add(L.Css.canvas),n._detectHighContrast(),n.copyrightControl=new wf({showFeedbackLink:n.styleOptions.showFeedbackLink,showLogo:n.styleOptions.showLogo,customAttribution:n.styleOptions.customAttribution}),n.controls.add(n.copyrightControl,{position:l.ControlPosition.NonFixed}),n.logoControl=new Af({showLogo:n.styleOptions.showLogo}),n.controls.add(n.logoControl,{position:l.ControlPosition.BottomLeft});var i=n.authentication?n.authentication.initialize():Promise.resolve();if(n.removed)return n;var a=function(){n.loaded=!0,n.map.off("load",a)},s=(n.map.on("load",a),function(){n.ready=!0,n.map.off("styledata",s),n.events.invoke("ready",{map:n,type:"ready"})});n.map.on("styledata",s),n._setAutoResize(n.styleOptions.autoResize),n.map.showTileBoundaries=n.styleOptions.showTileBoundaries,n.localizedStringsPromise=Re.getStrings(n.styleOptions.language),i.then(function(){return n.styles.definitions()}).then(function(e){if(!n.removed){if(n.authentication&&!n.authentication.getToken())throw new Error("AuthenticationManager finished initializing, but no token is available");n.serviceOptions["enable-accessibility"]&&n.accessibleMapDelegate.addToMap(),n._setStyleComponents(n.styleOptions),n.copyrightDelegate&&n.copyrightDelegate.addToMap()}}).catch(function(e){e=e instanceof Error?e:new Error(e);n.events.invoke("error",{map:n,type:"error",error:e})}),n.setCamera(yS(yS({minZoom:1},t),{type:"jump",duration:0})),n.incidentDelegate=new eg(n),n.flowDelegate=new Wf(n),n.accessibleMapDelegate=new Yf(n),n.userInteractionDelegate=new lg(n,t),n.userInteractionDelegate.addToMap(),n.copyrightDelegate=new kg(n,n.copyrightControl,n.styleOptions)}catch(e){throw e}return n}var SS=window&&window.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,i=o.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},TS=window&&window.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||((r=r||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))},o=(IS.applyTemplate=function(t,o){var r,n,e,i=this,a=document.createElement("div");return a.classList.add(IS.Css.template),t&&("boolean"!=typeof(o=o||{}).singleDescription&&(o.singleDescription=!0),o.sandboxContent="boolean"!=typeof o.sandboxContent||o.sandboxContent,o.title&&"string"==typeof o.content&&(o.content.includes("{title}")||o.content.includes("{name}"))||(t.title?o.title="{title}":t.name&&(o.title="{name}")),"boolean"!=typeof o.detectHyperlinks&&(o.detectHyperlinks=!0),"boolean"!=typeof o.parsePropertyPaths&&(o.parsePropertyPaths=!0),o.textColor&&(a.style.color=o.textColor),o.fillColor&&(a.style.backgroundColor=o.fillColor),o.title&&((e=this._applyStringTemplate(t,o.title,o)).innerText=e.textContent||e.innerText||"",this._appendChild(a,e,IS.Css.title)),(r=document.createElement("div")).classList.add(IS.Css.content),Array.isArray(o.content)?0<o.content.length&&o.content[0].propertyPath?this._appendChild(r,this._generateContent(t,o.content,o),IS.Css.item):o.content.forEach(function(e){i._appendChild(r,i._generateContent(t,e,o),IS.Css.item)}):(n=0,e=void(t.description&&Object.keys(t).forEach(function(e){i._ignoreProperty(e,t[e])||n++})),1===n||o.singleDescription&&t.description||2===n&&t.Snippet?(e=document.createElement("div")).innerHTML=t.description:e=this._generateContent(t,o.content,o),this._appendChild(r,e,IS.Css.item)),""!==r.innerHTML)&&(o.sandboxContent?a.appendChild(IS._createSandboxedIframe(r,o)):a.appendChild(r)),a},IS._createSandboxedIframe=function(e,t){var o=document.createElement("iframe"),e=(o.sandbox.add("allow-popups"),e.innerHTML),r=!1,n=100,i=550,a=10,s=(document.body.scrollWidth<=340&&(i=300,n=50),e.split(/<(tr|div|br|li|h[0-9]|p>)/)),c=Math.max.apply(Math,TS([],SS(s.map(function(e){return e.replace(/<[a-zA-Z0-9\s=\/]+>/g,"").length})),!1))-1,u=Math.ceil(3.5*c),c=(u<i&&(i=u,n=c),e.includes("<img")||e.includes("<video")?(r=!0,o.width="550px"):(u=-1<e.indexOf(IS.Css.table)?25:20,a+=Math.max(.5*s.length*u,Math.ceil(e.replace(/<[a-zA-Z0-9\s=\/]+>/g,"").length/n)*u)),o.width=i+"px",o.height=r||280<a?"280px":a+"px",t.textColor?"color:".concat(t.textColor,";"):""),s=t.fillColor?"background-color:".concat(t.fillColor,";"):"",n='<html><head><title></title><meta charset="utf-8" /><meta http-equiv="x-ua-compatible" content="IE=Edge" />'+'<link rel="stylesheet" href="'.concat(IS._cssUrl,'" type="text/css"/>')+"<style>html, body{margin:0;padding:0;".concat(c).concat(s,"}</style></head>")+'<body><div class="'.concat(IS.Css.template,'" style="padding:0;width:').concat(i-20,'px">').concat(e,"</div></body></html>");return void 0===o.srcdoc?o.src="data:text/html;charset=utf-8,"+encodeURI(n):o.srcdoc=n,o},IS._appendChild=function(e,t,o){t&&(o&&(t.className=(t.className?t.className+" ":"")+o),e.appendChild(t))},IS._generateContent=function(e,t,o){return t?Array.isArray(t)?this._generatePropertyInfoTable(e,t,o):this._applyStringTemplate(e,t,o):(t=this._generateDynamicTableHtml(e,null,o))?((e=document.createElement("div")).innerHTML=t,e):null},IS._applyStringTemplate=function(e,t,o){if(t){for(var r,n,i=t,a=this._placeholderRx.exec(t);a;)2<=a.length&&(r=this._getPropertyValue(e,a[1],o),i=i.replace(a[0],r)),a=this._placeholderRx.exec(t);if(i)return(i=i.trim()).includes("<")&&(i=i.replace(/[\r\n]+/g,"<br/>")),(n=document.createElement("div")).innerHTML=i,n}return null},IS._getPropertyValue=function(e,t,o,r){var n=o.parsePropertyPaths?t.split("/"):[t],i=n.length;if(0<i&&e){var a=n[0],s=e[a];if(o.detectHyperlinks&&"link"===t&&(!r||r.hyperlinkFormat)){var c,u,l,h=[];if(Array.isArray(s)?s.forEach(function(e){e.href?h.push(e):"string"==typeof e&&h.push({href:e})}):s.href&&h.push(s),0<h.length)return r&&r.hyperlinkFormat?c=r.hyperlinkFormat:o&&o.hyperlinkFormat&&(c=o.hyperlinkFormat),u=c&&c.target?c.target:"_blank",l=[],h.forEach(function(e){e.title||c&&c.label||!e.rel||l.push(e.rel," - "),l.push('<a href="',e.href,'" target="',u,'">'),e.title?l.push(e.title):c&&c.label?l.push(c.label):l.push(e.href),l.push("</a>","<br/>")}),l.pop(),l.join("")}if(null!=s){for(var d=void 0,d=1;d<i&&(s=s[n[d]],a=n[d],null!=s);d++);if(d===i&&null!=s){e=void 0;if((e=void 0!==s.value?s.value:s)instanceof Date)return r&&r.dateFormat?e.toLocaleString(void 0,r.dateFormat):o.dateFormat?e.toLocaleString(void 0,o.dateFormat):e.toISOString();if("object"==typeof e)return(p=this._generateDynamicTableHtml(e,n.slice(1),o))||"";if("number"==typeof e){if(r){if(r.dateFormat)return new Date(e).toLocaleString(void 0,r.dateFormat);if(r.numberFormat)return e.toLocaleString(void 0,r.numberFormat)}else if(/(timestamp|date)/gi.test(a))return new Date(e).toISOString();return e.toLocaleString(void 0,o.numberFormat)}if("string"==typeof e&&""!==e&&!/[\n\r<>\s]/g.test(e)&&(o.detectHyperlinks||r&&r.hyperlinkFormat)){var p,e=e.trim(),t=this._isUrlRx.test(e)||r&&r.hyperlinkFormat,f=this._isImageUrlRx.test(e)&&(t||e.startsWith("data:image")),g=this._emailRx.test(e);if(t||f||g)return t=void 0,p=void(r&&r.hyperlinkFormat?t=r.hyperlinkFormat:o&&o.hyperlinkFormat&&(t=o.hyperlinkFormat)),p=t&&t.target?' target="'.concat(t.target,'"'):' target="_blank"',r="".concat(t&&t.label?t.label:e),t&&t.scheme?e=t.scheme+e:g&&(e="mailto:"+e),o=t&&t.label?' alt="'.concat(t.label,'"'):"",(t&&t.isImage||f)&&(r='<img src="'.concat(e,'" style="max-width:100%"').concat(o,'"/>')),'<a href="'.concat(e,'"').concat(p,">").concat(r,"</a>")}return e.toString()}}}return""},IS._generatePropertyInfoTable=function(o,e,r){var n,i;return o&&e&&0<e.length?((n=[]).push('<table class="'.concat((i=this).Css.table,'">')),e.forEach(function(e){var t=i._getPropertyValue(o,e.propertyPath,r,e);e.hideLabel?n.push('<tr><td colspan="2">',t,"</td></tr>"):(e=e.label||e.propertyPath.split("/")[0],n.push("<tr><th>",e,"</th><td>",t,"</td></tr>"))}),n.push("</table>"),(e=document.createElement("div")).innerHTML=n.join(""),e):null},IS._generateDynamicTableHtml=function(t,e,o){var r,n,i,a,s=this;return!t||((r=[]).push('<table class="'.concat((n=this).Css.table,'">')),i=e&&0<e.length?e.join("/")+"/":"",a=0,Object.keys(t).forEach(function(e){s._ignoreProperty(e,t[e])||(r.push("<tr><th>",e,"</th><td>",n._getPropertyValue(t,i+e,o),"</td></tr>"),a++)}),0===a)?null:(r.push("</table>"),r.join(""))},IS._ignoreProperty=function(e,t){switch(e){case"title":case"name":case"base":case"popupTemplate":case"anchor":case"icon":case"image":case"imageUrl":case"rotation":case"color":case"size":case"offset":case"strokeColor":case"strokeWidth":case"strokeOpacity":case"subType":case"fillColor":case"fillOpacity":case"visibility":case"visible":return!0;default:if(0===e.indexOf("_")||null==t||""===t)return!0}return!1},IS._placeholderRx=/\{([a-zA-Z0-9_\/\s]+)\}/gi,IS._isUrlRx=/^(http|https|ftp|tel|mailto):\/\//i,IS._isImageUrlRx=/(^data:image|.png$|.jpg$|.jpeg$|.gif$|.bmp$|.svg|.tif|.tiff$)/i,IS._emailRx=/^[^\.\s@:](?:[^\s@:]*[^\s@:\.])?@[^\.\s@]+(?:\.[^\.\s@]+)*$/,IS._cssUrl=new Te({domain:Q,path:"sdk/javascript/mapcontrol/".concat(De.getEndpointVersion(),"/atlas.min.css")}).toString(),IS.Css={template:"azure-maps-control-popup-template",title:"azure-maps-control-popup-template-title",content:"azure-maps-control-popup-template-content",item:"azure-maps-control-popup-template-content-item",table:"azure-maps-control-popup-template-table"},IS);function IS(){this.detectHyperlinks=!0,this.parsePropertyPaths=!0}Ut(),l.HtmlMarker=lf,l.Map=ES,l.Pixel=nu,l.Popup=tf,l.PopupTemplate=o,l.Shape=_l,l._enableRTLTextPlugin=Ut,l._getAssetDomain=function(){return Z},l._getDomain=function(){return We},l._hasMaxParallelImageRequests=Nt,l._hasSetAuthenticationOptions=Ot,l._hasSetDomain=Rt,l._hasSetLanguage=Lt,l._hasSetSessionId=Dt,l._hasSetStyleDefinitionsPath=xt,l._hasSetStyleDefinitionsVersion=function(){return ot},l._hasSetView=qt,l._hasWorkerCount=Mt,l.addImageTemplate=function(e,t,o){!o&&zt[e.toLowerCase()]||(zt[e.toLowerCase()]=t)},l.clearPrewarmedResources=function(){D.clearPrewarmedResources()},l.control=Hr,l.data=ii,l.getAllImageTemplateNames=function(){return Object.keys(zt)},l.getAuthenticationOptions=ct,l.getDomain=lt,l.getImageTemplate=Pt,l.getLanguage=mt,l.getMaxParallelImageRequests=gt,l.getSessionId=yt,l.getStaticAssetsDomain=ut,l.getStyleAPIVersion=pt,l.getStyleDefinitionsPath=ht,l.getStyleDefinitionsVersion=dt,l.getSubscriptionKey=vt,l.getUserRegion=function(){return Ke},l.getVersion=function(){return De.getFullVersion()},l.getView=_t,l.getWorkerCount=ft,l.internal=B,l.isSupported=function(e){return!Me.isIE()},l.layer=Ni,l.math=nn,l.prewarm=function(){D.prewarm()},l.setAuthenticationOptions=wt,l.setDomain=bt,l.setLanguage=Tt,l.setMaxParallelImageRequests=St,l.setSessionId=It,l.setStyleAPIVersion=function(e){Je=e},l.setStyleDefinitionsPath=Ct,l.setStyleDefinitionsVersion=function(e){Ve=e,ot=!0},l.setSubscriptionKey=kt,l.setUserRegion=At,l.setView=function(e){Ke=e,$e=!0},l.setWorkerCount=Et,l.source=Cn});
|