@azure/identity 1.0.0-preview.1 → 1.0.0-preview.2
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.
Potentially problematic release.
This version of @azure/identity might be problematic. Click here for more details.
- package/CHANGELOG.md +24 -0
- package/README.md +50 -23
- package/browser/identity.js +9828 -0
- package/browser/identity.js.map +1 -0
- package/browser/identity.min.js +2 -0
- package/browser/identity.min.js.map +1 -0
- package/dist/index.js +475 -205
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/errors.d.ts +1 -1
- package/dist-esm/src/client/errors.d.ts.map +1 -1
- package/dist-esm/src/client/errors.js +9 -1
- package/dist-esm/src/client/errors.js.map +1 -1
- package/dist-esm/src/client/identityClient.d.ts +20 -17
- package/dist-esm/src/client/identityClient.d.ts.map +1 -1
- package/dist-esm/src/client/identityClient.js +42 -206
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.browser.d.ts +7 -0
- package/dist-esm/src/credentials/clientCertificateCredential.browser.d.ts.map +1 -0
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js +12 -0
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/clientCertificateCredential.d.ts +5 -5
- package/dist-esm/src/credentials/clientCertificateCredential.d.ts.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js +59 -5
- package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.d.ts +3 -3
- package/dist-esm/src/credentials/clientSecretCredential.d.ts.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.js +27 -4
- package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.browser.d.ts +7 -0
- package/dist-esm/src/credentials/deviceCodeCredential.browser.d.ts.map +1 -0
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js +12 -0
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/deviceCodeCredential.d.ts +67 -0
- package/dist-esm/src/credentials/deviceCodeCredential.d.ts.map +1 -0
- package/dist-esm/src/credentials/deviceCodeCredential.js +139 -0
- package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -0
- package/dist-esm/src/credentials/environmentCredential.browser.d.ts +7 -0
- package/dist-esm/src/credentials/environmentCredential.browser.d.ts.map +1 -0
- package/dist-esm/src/credentials/environmentCredential.browser.js +12 -0
- package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/environmentCredential.d.ts.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.js +0 -4
- package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.d.ts +32 -0
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.d.ts.map +1 -0
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +112 -0
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/interactiveBrowserCredential.d.ts +12 -0
- package/dist-esm/src/credentials/interactiveBrowserCredential.d.ts.map +1 -0
- package/dist-esm/src/credentials/interactiveBrowserCredential.js +17 -0
- package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -0
- package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.d.ts +24 -0
- package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -0
- package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js +3 -0
- package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential.browser.d.ts +7 -0
- package/dist-esm/src/credentials/managedIdentityCredential.browser.d.ts.map +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential.browser.js +15 -0
- package/dist-esm/src/credentials/managedIdentityCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential.d.ts +10 -1
- package/dist-esm/src/credentials/managedIdentityCredential.d.ts.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential.js +144 -2
- package/dist-esm/src/credentials/managedIdentityCredential.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.d.ts +39 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.d.ts.map +1 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.js +67 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -0
- package/dist-esm/src/index.d.ts +4 -0
- package/dist-esm/src/index.d.ts.map +1 -1
- package/dist-esm/src/index.js +3 -0
- package/dist-esm/src/index.js.map +1 -1
- package/package.json +32 -14
- package/src/client/errors.ts +11 -3
- package/src/client/identityClient.ts +64 -246
- package/src/credentials/clientCertificateCredential.browser.ts +27 -0
- package/src/credentials/clientCertificateCredential.ts +72 -22
- package/src/credentials/clientSecretCredential.ts +32 -17
- package/src/credentials/deviceCodeCredential.browser.ts +27 -0
- package/src/credentials/deviceCodeCredential.ts +203 -0
- package/src/credentials/environmentCredential.browser.ts +19 -0
- package/src/credentials/environmentCredential.ts +5 -9
- package/src/credentials/interactiveBrowserCredential.browser.ts +134 -0
- package/src/credentials/interactiveBrowserCredential.ts +31 -0
- package/src/credentials/interactiveBrowserCredentialOptions.ts +30 -0
- package/src/credentials/managedIdentityCredential.browser.ts +22 -0
- package/src/credentials/managedIdentityCredential.ts +179 -8
- package/src/credentials/usernamePasswordCredential.ts +83 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).Azure=e.Azure||{},e.Azure.Identity={}))}(this,function(exports){"use strict";var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __decorate(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}c((n=n.apply(e,t||[])).next())})}function __generator(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function isErrorResponse(e){return e&&"string"==typeof e.error&&"string"==typeof e.error_description}class AuthenticationError extends Error{constructor(e,t){let r={error:"unknown",error_description:"An unknown error occurred and no additional details are available."};if(isErrorResponse(t))r=t;else if("string"==typeof t)try{r=JSON.parse(t)}catch(n){r=400===e?{error:"authority_not_found",error_description:"The specified authority URL was not found."}:{error:"unknown_error",error_description:`An unknown error has occurred. Response body:\n\n${t}`}}else r={error:"unknown_error",error_description:"An unknown error occurred and no additional details are available."};super(`An error was returned while authenticating to Azure Active Directory (status code ${e}).\n\nMore details:\n\n${JSON.stringify(r,null," ")}`),this.statusCode=e,this.errorResponse=r,this.name="AuthenticationError"}}class AggregateAuthenticationError extends Error{constructor(e){super("Authentication failed to complete due to errors"),this.errors=e,this.name="AggregateAuthenticationError"}}class ChainedTokenCredential{constructor(...e){this._sources=[],this._sources=e}getToken(e,t){return __awaiter(this,void 0,void 0,function*(){let r=null;const n=[];for(let o=0;o<this._sources.length&&null===r;o++)try{r=yield this._sources[o].getToken(e,t)}catch(e){n.push(e)}if(!r&&n.length>0)throw new AggregateAuthenticationError(n);return r})}}const BrowserNotSupportedError=new Error("EnvironmentCredential is not supported in the browser.");class EnvironmentCredential{constructor(e){throw BrowserNotSupportedError}getToken(e,t){throw BrowserNotSupportedError}}const BrowserNotSupportedError$1=new Error("ManagedIdentityCredential is not supported in the browser.");class ManagedIdentityCredential{constructor(e,t){throw BrowserNotSupportedError$1}getToken(e,t){return __awaiter(this,void 0,void 0,function*(){throw BrowserNotSupportedError$1})}}class DefaultAzureCredential extends ChainedTokenCredential{constructor(e){super(new EnvironmentCredential(e),new ManagedIdentityCredential(void 0,e))}}var has=Object.prototype.hasOwnProperty,isArray=Array.isArray,hexTable=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),compactQueue=function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(isArray(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}},arrayToObject=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},merge=function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(isArray(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!has.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var o=t;return isArray(t)&&!isArray(r)&&(o=arrayToObject(t,n)),isArray(t)&&isArray(r)?(r.forEach(function(r,o){if(has.call(t,o)){var i=t[o];i&&"object"==typeof i&&r&&"object"==typeof r?t[o]=e(i,r,n):t.push(r)}else t[o]=r}),t):Object.keys(r).reduce(function(t,o){var i=r[o];return has.call(t,o)?t[o]=e(t[o],i,n):t[o]=i,t},o)},assign=function(e,t){return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},decode=function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode=function(e,t,r){if(0===e.length)return e;var n="string"==typeof e?e:String(e);if("iso-8859-1"===r)return escape(n).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var o="",i=0;i<n.length;++i){var a=n.charCodeAt(i);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?o+=n.charAt(i):a<128?o+=hexTable[a]:a<2048?o+=hexTable[192|a>>6]+hexTable[128|63&a]:a<55296||a>=57344?o+=hexTable[224|a>>12]+hexTable[128|a>>6&63]+hexTable[128|63&a]:(i+=1,a=65536+((1023&a)<<10|1023&n.charCodeAt(i)),o+=hexTable[240|a>>18]+hexTable[128|a>>12&63]+hexTable[128|a>>6&63]+hexTable[128|63&a])}return o},compact=function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],i=o.obj[o.prop],a=Object.keys(i),s=0;s<a.length;++s){var c=a[s],u=i[c];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:i,prop:c}),r.push(u))}return compactQueue(t),e},isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},combine=function(e,t){return[].concat(e,t)},utils={arrayToObject:arrayToObject,assign:assign,combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isRegExp:isRegExp,merge:merge},replace=String.prototype.replace,percentTwenties=/%20/g,formats={default:"RFC3986",formatters:{RFC1738:function(e){return replace.call(e,percentTwenties,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"},has$1=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},isArray$1=Array.isArray,push=Array.prototype.push,pushToArray=function(e,t){push.apply(e,isArray$1(t)?t:[t])},toISO=Date.prototype.toISOString,defaults={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:utils.encode,encodeValuesOnly:!1,formatter:formats.formatters[formats.default],indices:!1,serializeDate:function(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},stringify=function e(t,r,n,o,i,a,s,c,u,l,d,p,h){var f=t;if("function"==typeof s?f=s(r,f):f instanceof Date?f=l(f):"comma"===n&&isArray$1(f)&&(f=f.join(",")),null===f){if(o)return a&&!p?a(r,defaults.encoder,h):r;f=""}if("string"==typeof f||"number"==typeof f||"boolean"==typeof f||utils.isBuffer(f))return a?[d(p?r:a(r,defaults.encoder,h))+"="+d(a(f,defaults.encoder,h))]:[d(r)+"="+d(String(f))];var g,y=[];if(void 0===f)return y;if(isArray$1(s))g=s;else{var m=Object.keys(f);g=c?m.sort(c):m}for(var v=0;v<g.length;++v){var C=g[v];i&&null===f[C]||(isArray$1(f)?pushToArray(y,e(f[C],"function"==typeof n?n(r,C):r,n,o,i,a,s,c,u,l,d,p,h)):pushToArray(y,e(f[C],r+(u?"."+C:"["+C+"]"),n,o,i,a,s,c,u,l,d,p,h)))}return y},normalizeStringifyOptions=function(e){if(!e)return defaults;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||defaults.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=formats.default;if(void 0!==e.format){if(!has$1.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=formats.formatters[r],o=defaults.filter;return("function"==typeof e.filter||isArray$1(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:void 0===e.allowDots?defaults.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:o,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}},stringify_1=function(e,t){var r,n=e,o=normalizeStringifyOptions(t);"function"==typeof o.filter?n=(0,o.filter)("",n):isArray$1(o.filter)&&(r=o.filter);var i,a=[];if("object"!=typeof n||null===n)return"";i=t&&t.arrayFormat in arrayPrefixGenerators?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var s=arrayPrefixGenerators[i];r||(r=Object.keys(n)),o.sort&&r.sort(o.sort);for(var c=0;c<r.length;++c){var u=r[c];o.skipNulls&&null===n[u]||pushToArray(a,stringify(n[u],u,s,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.formatter,o.encodeValuesOnly,o.charset))}var l=a.join(o.delimiter),d=!0===o.addQueryPrefix?"?":"";return o.charsetSentinel&&("iso-8859-1"===o.charset?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),l.length>0?d+l:""},has$2=Object.prototype.hasOwnProperty,defaults$1={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:utils.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function(e,t){var r,n={},o=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=o.split(t.delimiter,i),s=-1,c=t.charset;if(t.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&(a[r]===charsetSentinel?c="utf-8":a[r]===isoSentinel&&(c="iso-8859-1"),s=r,r=a.length);for(r=0;r<a.length;++r)if(r!==s){var u,l,d=a[r],p=d.indexOf("]="),h=-1===p?d.indexOf("="):p+1;-1===h?(u=t.decoder(d,defaults$1.decoder,c),l=t.strictNullHandling?null:""):(u=t.decoder(d.slice(0,h),defaults$1.decoder,c),l=t.decoder(d.slice(h+1),defaults$1.decoder,c)),l&&t.interpretNumericEntities&&"iso-8859-1"===c&&(l=interpretNumericEntities(l)),l&&t.comma&&l.indexOf(",")>-1&&(l=l.split(",")),has$2.call(n,u)?n[u]=utils.combine(n[u],l):n[u]=l}return n},parseObject=function(e,t,r){for(var n=t,o=e.length-1;o>=0;--o){var i,a=e[o];if("[]"===a&&r.parseArrays)i=[].concat(n);else{i=r.plainObjects?Object.create(null):{};var s="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,c=parseInt(s,10);r.parseArrays||""!==s?!isNaN(c)&&a!==s&&String(c)===s&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(i=[])[c]=n:i[s]=n:i={0:n}}n=i}return n},parseKeys=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,i=/(\[[^[\]]*])/.exec(n),a=i?n.slice(0,i.index):n,s=[];if(a){if(!r.plainObjects&&has$2.call(Object.prototype,a)&&!r.allowPrototypes)return;s.push(a)}for(var c=0;null!==(i=o.exec(n))&&c<r.depth;){if(c+=1,!r.plainObjects&&has$2.call(Object.prototype,i[1].slice(1,-1))&&!r.allowPrototypes)return;s.push(i[1])}return i&&s.push("["+n.slice(i.index)+"]"),parseObject(s,t,r)}},normalizeParseOptions=function(e){if(!e)return defaults$1;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?defaults$1.charset:e.charset;return{allowDots:void 0===e.allowDots?defaults$1.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults$1.allowPrototypes,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults$1.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults$1.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:defaults$1.comma,decoder:"function"==typeof e.decoder?e.decoder:defaults$1.decoder,delimiter:"string"==typeof e.delimiter||utils.isRegExp(e.delimiter)?e.delimiter:defaults$1.delimiter,depth:"number"==typeof e.depth?e.depth:defaults$1.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:defaults$1.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:defaults$1.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:defaults$1.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults$1.strictNullHandling}},parse=function(e,t){var r=normalizeParseOptions(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var n="string"==typeof e?parseValues(e,r):e,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],c=parseKeys(s,n[s],r);o=utils.merge(o,c,r)}return utils.compact(o)},lib={formats:formats,parse:parse,stringify:stringify_1};function getHeaderKey(e){return e.toLowerCase()}var HttpHeaders=function(){function e(e){if(this._headersMap={},e)for(var t in e)this.set(t,e[t])}return e.prototype.set=function(e,t){this._headersMap[getHeaderKey(e)]={name:e,value:t.toString()}},e.prototype.get=function(e){var t=this._headersMap[getHeaderKey(e)];return t?t.value:void 0},e.prototype.contains=function(e){return!!this._headersMap[getHeaderKey(e)]},e.prototype.remove=function(e){var t=this.contains(e);return delete this._headersMap[getHeaderKey(e)],t},e.prototype.rawHeaders=function(){var e={};for(var t in this._headersMap){var r=this._headersMap[t];e[r.name.toLowerCase()]=r.value}return e},e.prototype.headersArray=function(){var e=[];for(var t in this._headersMap)e.push(this._headersMap[t]);return e},e.prototype.headerNames=function(){for(var e=[],t=this.headersArray(),r=0;r<t.length;++r)e.push(t[r].name);return e},e.prototype.headerValues=function(){for(var e=[],t=this.headersArray(),r=0;r<t.length;++r)e.push(t[r].value);return e},e.prototype.toJson=function(){return this.rawHeaders()},e.prototype.toString=function(){return JSON.stringify(this.toJson())},e.prototype.clone=function(){return new e(this.rawHeaders())},e}();function encodeByteArray(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function decodeString(e){for(var t=atob(e),r=new Uint8Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}for(var rngBrowser=createCommonjsModule(function(e){var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}}),byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);function bytesToUuid(e,t){var r=t||0,n=byteToHex;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}var bytesToUuid_1=bytesToUuid;function v4(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||rngBrowser)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[n+i]=o[i];return t||bytesToUuid_1(o)}var v4_1=v4,Constants={coreHttpVersion:"1.0.0-preview.1",HTTP:"http:",HTTPS:"https:",HTTP_PROXY:"HTTP_PROXY",HTTPS_PROXY:"HTTPS_PROXY",HttpConstants:{HttpVerbs:{PUT:"PUT",GET:"GET",DELETE:"DELETE",POST:"POST",MERGE:"MERGE",HEAD:"HEAD",PATCH:"PATCH"},StatusCodes:{TooManyRequests:429}},HeaderConstants:{AUTHORIZATION:"authorization",AUTHORIZATION_SCHEME:"Bearer",RETRY_AFTER:"Retry-After",USER_AGENT:"User-Agent"}},isNode="undefined"!=typeof process&&!!process.version&&!!process.versions&&!!process.versions.node;function stripResponse(e){var t={};return t.body=e.bodyAsText,t.headers=e.headers,t.status=e.status,t}function stripRequest(e){var t=e.clone();return t.headers&&t.headers.remove("authorization"),t}function isValidUuid(e){return new RegExp("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","ig").test(e)}function generateUuid(){return v4_1()}function delay(e,t){return new Promise(function(r){return setTimeout(function(){return r(t)},e)})}function prepareXMLRootList(e,t){var r;return Array.isArray(e)||(e=[e]),(r={})[t]=e,r}var validateISODuration=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function isDuration(e){return validateISODuration.test(e)}function replaceAll(e,t,r){return e&&t?e.split(t).join(r||""):e}var Serializer=function(){function e(e,t){void 0===e&&(e={}),this.modelMappers=e,this.isXML=t}return e.prototype.validateConstraints=function(e,t,r){var n=function(e,n){throw new Error('"'+r+'" with value "'+t+'" should satisfy the constraint "'+e+'": '+n+".")};if(e.constraints&&null!=t){var o=e.constraints,i=o.ExclusiveMaximum,a=o.ExclusiveMinimum,s=o.InclusiveMaximum,c=o.InclusiveMinimum,u=o.MaxItems,l=o.MaxLength,d=o.MinItems,p=o.MinLength,h=o.MultipleOf,f=o.Pattern,g=o.UniqueItems;null!=i&&t>=i&&n("ExclusiveMaximum",i),null!=a&&t<=a&&n("ExclusiveMinimum",a),null!=s&&t>s&&n("InclusiveMaximum",s),null!=c&&t<c&&n("InclusiveMinimum",c),null!=u&&t.length>u&&n("MaxItems",u),null!=l&&t.length>l&&n("MaxLength",l),null!=d&&t.length<d&&n("MinItems",d),null!=p&&t.length<p&&n("MinLength",p),null!=h&&t%h!=0&&n("MultipleOf",h),f&&null===t.match(f)&&n("Pattern",f),g&&t.some(function(e,t,r){return r.indexOf(e)!==t})&&n("UniqueItems",g)}},e.prototype.serialize=function(e,t,r){var n={},o=e.type.name;r||(r=e.serializedName),null!==o.match(/^Sequence$/gi)&&(n=[]),null!=t||null==e.defaultValue&&!e.isConstant||(t=e.defaultValue);var i=e.required,a=e.nullable;if(i&&a&&void 0===t)throw new Error(r+" cannot be undefined.");if(i&&!a&&null==t)throw new Error(r+" cannot be null or undefined.");if(!i&&!1===a&&null===t)throw new Error(r+" cannot be null.");if(null==t)n=t;else if(this.validateConstraints(e,t,r),null!==o.match(/^any$/gi))n=t;else if(null!==o.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/gi))n=serializeBasicTypes(o,r,t);else if(null!==o.match(/^Enum$/gi)){n=serializeEnumType(r,e.type.allowedValues,t)}else null!==o.match(/^(Date|DateTime|TimeSpan|DateTimeRfc1123|UnixTime)$/gi)?n=serializeDateTypes(o,t,r):null!==o.match(/^ByteArray$/gi)?n=serializeByteArrayType(r,t):null!==o.match(/^Base64Url$/gi)?n=serializeBase64UrlType(r,t):null!==o.match(/^Sequence$/gi)?n=serializeSequenceType(this,e,t,r):null!==o.match(/^Dictionary$/gi)?n=serializeDictionaryType(this,e,t,r):null!==o.match(/^Composite$/gi)&&(n=serializeCompositeType(this,e,t,r));return n},e.prototype.deserialize=function(e,t,r){if(null==t)return this.isXML&&"Sequence"===e.type.name&&!e.xmlIsWrapped&&(t=[]),t;var n,o=e.type.name;return r||(r=e.serializedName),null!==o.match(/^Composite$/gi)?n=deserializeCompositeType(this,e,t,r):(this.isXML&&null!=t.$&&null!=t._&&(t=t._),null!==o.match(/^Number$/gi)?(n=parseFloat(t),isNaN(n)&&(n=t)):null!==o.match(/^Boolean$/gi)?n="true"===t||"false"!==t&&t:null!==o.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/gi)?n=t:null!==o.match(/^(Date|DateTime|DateTimeRfc1123)$/gi)?n=new Date(t):null!==o.match(/^UnixTime$/gi)?n=unixTimeToDate(t):null!==o.match(/^ByteArray$/gi)?n=decodeString(t):null!==o.match(/^Base64Url$/gi)?n=base64UrlToByteArray(t):null!==o.match(/^Sequence$/gi)?n=deserializeSequenceType(this,e,t,r):null!==o.match(/^Dictionary$/gi)&&(n=deserializeDictionaryType(this,e,t,r))),e.isConstant&&(n=e.defaultValue),n},e}();function trimEnd(e,t){for(var r=e.length;r-1>=0&&e[r-1]===t;)--r;return e.substr(0,r)}function bufferToBase64Url(e){if(e){if(!(e instanceof Uint8Array))throw new Error("Please provide an input of type Uint8Array for converting to Base64Url.");return trimEnd(encodeByteArray(e),"=").replace(/\+/g,"-").replace(/\//g,"_")}}function base64UrlToByteArray(e){if(e){if(e&&"string"!=typeof e.valueOf())throw new Error("Please provide an input of type string for converting to Uint8Array");return decodeString(e=e.replace(/\-/g,"+").replace(/\_/g,"/"))}}function splitSerializeName(e){var t=[],r="";if(e)for(var n=0,o=e.split(".");n<o.length;n++){var i=o[n];"\\"===i.charAt(i.length-1)?r+=i.substr(0,i.length-1)+".":(r+=i,t.push(r),r="")}return t}function dateToUnixTime(e){if(e)return"string"==typeof e.valueOf()&&(e=new Date(e)),Math.floor(e.getTime()/1e3)}function unixTimeToDate(e){if(e)return new Date(1e3*e)}function serializeBasicTypes(e,t,r){if(null!=r)if(null!==e.match(/^Number$/gi)){if("number"!=typeof r)throw new Error(t+" with value "+r+" must be of type number.")}else if(null!==e.match(/^String$/gi)){if("string"!=typeof r.valueOf())throw new Error(t+' with value "'+r+'" must be of type string.')}else if(null!==e.match(/^Uuid$/gi)){if("string"!=typeof r.valueOf()||!isValidUuid(r))throw new Error(t+' with value "'+r+'" must be of type string and a valid uuid.')}else if(null!==e.match(/^Boolean$/gi)){if("boolean"!=typeof r)throw new Error(t+" with value "+r+" must be of type boolean.")}else if(null!==e.match(/^Stream$/gi)){var n=typeof r;if(!("string"===n||"function"===n||r instanceof ArrayBuffer||ArrayBuffer.isView(r)||"function"==typeof Blob&&r instanceof Blob))throw new Error(t+" must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.")}return r}function serializeEnumType(e,t,r){if(!t)throw new Error("Please provide a set of allowedValues to validate "+e+" as an Enum Type.");if(!t.some(function(e){return"string"==typeof e.valueOf()?e.toLowerCase()===r.toLowerCase():e===r}))throw new Error(r+" is not a valid value for "+e+". The valid values are: "+JSON.stringify(t)+".");return r}function serializeByteArrayType(e,t){if(null!=t){if(!(t instanceof Uint8Array))throw new Error(e+" must be of type Uint8Array.");t=encodeByteArray(t)}return t}function serializeBase64UrlType(e,t){if(null!=t){if(!(t instanceof Uint8Array))throw new Error(e+" must be of type Uint8Array.");t=bufferToBase64Url(t)}return t}function serializeDateTypes(e,t,r){if(null!=t)if(null!==e.match(/^Date$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in ISO8601 format.");t=t instanceof Date?t.toISOString().substring(0,10):new Date(t).toISOString().substring(0,10)}else if(null!==e.match(/^DateTime$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in ISO8601 format.");t=t instanceof Date?t.toISOString():new Date(t).toISOString()}else if(null!==e.match(/^DateTimeRfc1123$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in RFC-1123 format.");t=t instanceof Date?t.toUTCString():new Date(t).toUTCString()}else if(null!==e.match(/^UnixTime$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in RFC-1123/ISO8601 format for it to be serialized in UnixTime/Epoch format.");t=dateToUnixTime(t)}else if(null!==e.match(/^TimeSpan$/gi)){if(!isDuration(t))throw new Error(r+' must be a string in ISO 8601 format. Instead was "'+t+'".');t=t}return t}function serializeSequenceType(e,t,r,n){if(!Array.isArray(r))throw new Error(n+" must be of type Array.");var o=t.type.element;if(!o||"object"!=typeof o)throw new Error('element" metadata for an Array must be defined in the mapper and it must of type "object" in '+n+".");for(var i=[],a=0;a<r.length;a++)i[a]=e.serialize(o,r[a],n);return i}function serializeDictionaryType(e,t,r,n){if("object"!=typeof r)throw new Error(n+" must be of type object.");var o=t.type.value;if(!o||"object"!=typeof o)throw new Error('"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in '+n+".");for(var i={},a=0,s=Object.keys(r);a<s.length;a++){var c=s[a];i[c]=e.serialize(o,r[c],n+"."+c)}return i}function resolveModelProperties(e,t,r){var n=t.type.modelProperties;if(!n){var o=t.type.className;if(!o)throw new Error('Class name for model "'+r+'" is not provided in the mapper "'+JSON.stringify(t,void 0,2)+'".');var i=e.modelMappers[o];if(!i)throw new Error('mapper() cannot be null or undefined for model "'+o+'".');if(!(n=i.type.modelProperties))throw new Error('modelProperties cannot be null or undefined in the mapper "'+JSON.stringify(i)+'" of type "'+o+'" for object "'+r+'".')}return n}function serializeCompositeType(e,t,r,n){var o;if(getPolymorphicDiscriminatorRecursively(e,t)&&(t=getPolymorphicMapper(e,t,r,"clientName")),null!=r){for(var i={},a=resolveModelProperties(e,t,n),s=0,c=Object.keys(a);s<c.length;s++){var u=c[s],l=a[u];if(!l.readOnly){var d=void 0,p=i;if(e.isXML)d=l.xmlIsWrapped?l.xmlName:l.xmlElementName||l.xmlName;else{var h=splitSerializeName(l.serializedName);d=h.pop();for(var f=0,g=h;f<g.length;f++){var y=g[f];null==p[y]&&null!=r[u]&&(p[y]={}),p=p[y]}}if(null!=p){var m=""!==l.serializedName?n+"."+l.serializedName:n,v=r[u],C=getPolymorphicDiscriminatorRecursively(e,t);C&&C.clientName===u&&null==v&&(v=t.serializedName);var b=e.serialize(l,v,m);void 0!==b&&null!=d&&(l.xmlIsAttribute?(p.$=p.$||{},p.$[d]=b):l.xmlIsWrapped?p[d]=((o={})[l.xmlElementName]=b,o):p[d]=b)}}}var w=t.type.additionalProperties;if(w){var E=Object.keys(a),T=function(t){E.every(function(e){return e!==t})&&(i[t]=e.serialize(w,r[t],n+'["'+t+'"]'))};for(var S in r)T(S)}return i}return r}function isSpecialXmlProperty(e){return["$","_"].includes(e)}function deserializeCompositeType(e,t,r,n){getPolymorphicDiscriminatorRecursively(e,t)&&(t=getPolymorphicMapper(e,t,r,"serializedName"));for(var o=resolveModelProperties(e,t,n),i={},a=[],s=0,c=Object.keys(o);s<c.length;s++){var u=c[s],l=o[u],d=splitSerializeName(o[u].serializedName);a.push(d[0]);var p=l.serializedName,h=l.xmlName,f=l.xmlElementName,g=n;""!==p&&void 0!==p&&(g=n+"."+p);var y=l.headerCollectionPrefix;if(y){for(var m={},v=0,C=Object.keys(r);v<C.length;v++){var b=C[v];b.startsWith(y)&&(m[b.substring(y.length)]=e.deserialize(l.type.value,r[b],g)),a.push(b)}i[u]=m}else if(e.isXML)if(l.xmlIsAttribute&&r.$)i[u]=e.deserialize(l,r.$[h],g);else{var w=r[f||h||p];if(l.xmlIsWrapped)void 0===(w=(w=r[h])&&w[f])&&(w=[]);i[u]=e.deserialize(l,w,g)}else{for(var E=void 0,T=r,S=0,A=d;S<A.length;S++){var I=A[S];if(!T)break;T=T[I]}E=T;var R=t.type.polymorphicDiscriminator;R&&l.serializedName===R.serializedName&&null==E&&(E=t.serializedName);var k=void 0;Array.isArray(r[u])&&""===o[u].serializedName?(E=r[u],i=e.deserialize(l,E,g)):void 0!==E&&(k=e.deserialize(l,E,g),i[u]=k)}}var P=t.type.additionalProperties;if(P){var _=function(e){for(var t in o){if(splitSerializeName(o[t].serializedName)[0]===e)return!1}return!0};for(var O in r)_(O)&&(i[O]=e.deserialize(P,r[O],n+'["'+O+'"]'))}else if(r)for(var U=0,x=Object.keys(r);U<x.length;U++){void 0!==i[u=x[U]]||a.includes(u)||isSpecialXmlProperty(u)||(i[u]=r[u])}return i}function deserializeDictionaryType(e,t,r,n){var o=t.type.value;if(!o||"object"!=typeof o)throw new Error('"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in '+n);if(r){for(var i={},a=0,s=Object.keys(r);a<s.length;a++){var c=s[a];i[c]=e.deserialize(o,r[c],n)}return i}return r}function deserializeSequenceType(e,t,r,n){var o=t.type.element;if(!o||"object"!=typeof o)throw new Error('element" metadata for an Array must be defined in the mapper and it must of type "object" in '+n);if(r){Array.isArray(r)||(r=[r]);for(var i=[],a=0;a<r.length;a++)i[a]=e.deserialize(o,r[a],n+"["+a+"]");return i}return r}function getPolymorphicMapper(e,t,r,n){var o=getPolymorphicDiscriminatorRecursively(e,t);if(o){var i=o[n];if(null!=i){var a=r[i];if(null!=a){var s=t.type.uberParent||t.type.className,c=a===s?a:s+"."+a,u=e.modelMappers.discriminators[c];u&&(t=u)}}}return t}function getPolymorphicDiscriminatorRecursively(e,t){return t.type.polymorphicDiscriminator||getPolymorphicDiscriminatorSafely(e,t.type.uberParent)||getPolymorphicDiscriminatorSafely(e,t.type.className)}function getPolymorphicDiscriminatorSafely(e,t){return t&&e.modelMappers[t]&&e.modelMappers[t].type.polymorphicDiscriminator}function strEnum(e){for(var t={},r=0,n=e;r<n.length;r++){var o=n[r];t[o]=o}return t}var MapperType=strEnum(["Base64Url","Boolean","ByteArray","Composite","Date","DateTime","DateTimeRfc1123","Dictionary","Enum","Number","Object","Sequence","String","Stream","TimeSpan","UnixTime"]),WebResource=function(){function e(e,t,r,n,o,i,a,s,c,u,l,d){this.streamResponseBody=i,this.url=e||"",this.method=t||"GET",this.headers=o instanceof HttpHeaders?o:new HttpHeaders(o),this.body=r,this.query=n,this.formData=void 0,this.withCredentials=a||!1,this.abortSignal=s,this.timeout=c||0,this.onUploadProgress=u,this.onDownloadProgress=l,this.proxySettings=d}return e.prototype.validateRequestProperties=function(){if(!this.method)throw new Error("WebResource.method is required.");if(!this.url)throw new Error("WebResource.url is required.")},e.prototype.prepare=function(e){if(!e)throw new Error("options object is required");if(null==e.method||"string"!=typeof e.method.valueOf())throw new Error("options.method must be a string.");if(e.url&&e.pathTemplate)throw new Error("options.url and options.pathTemplate are mutually exclusive. Please provide exactly one of them.");if(!(null!=e.pathTemplate&&"string"==typeof e.pathTemplate.valueOf()||null!=e.url&&"string"==typeof e.url.valueOf()))throw new Error("Please provide exactly one of options.pathTemplate or options.url.");if(e.url){if("string"!=typeof e.url)throw new Error('options.url must be of type "string".');this.url=e.url}if(e.method){var t=["GET","PUT","HEAD","DELETE","OPTIONS","POST","PATCH","TRACE"];if(-1===t.indexOf(e.method.toUpperCase()))throw new Error('The provided method "'+e.method+'" is invalid. Supported HTTP methods are: '+JSON.stringify(t))}if(this.method=e.method.toUpperCase(),e.pathTemplate){var r=e.pathTemplate,n=e.pathParameters;if("string"!=typeof r)throw new Error('options.pathTemplate must be of type "string".');e.baseUrl||(e.baseUrl="https://management.azure.com");var o=e.baseUrl,i=o+(o.endsWith("/")?"":"/")+(r.startsWith("/")?r.slice(1):r),a=i.match(/({\w*\s*\w*})/gi);if(a&&a.length){if(!n)throw new Error("pathTemplate: "+r+" has been provided. Hence, options.pathParameters must also be provided.");a.forEach(function(e){var t=e.slice(1,-1),o=n[t];if(null==o||"string"!=typeof o&&"object"!=typeof o)throw new Error("pathTemplate: "+r+" contains the path parameter "+t+" however, it is not present in "+n+" - "+JSON.stringify(n,void 0,2)+'.The value of the path parameter can either be a "string" of the form { '+t+': "some sample value" } or it can be an "object" of the form { "'+t+'": { value: "some sample value", skipUrlEncoding: true } }.');if("string"==typeof o.valueOf()&&(i=i.replace(e,encodeURIComponent(o))),"object"==typeof o.valueOf()){if(!o.value)throw new Error("options.pathParameters["+t+'] is of type "object" but it does not contain a "value" property.');i=o.skipUrlEncoding?i.replace(e,o.value):i.replace(e,encodeURIComponent(o.value))}})}this.url=i}if(e.queryParameters){var s=e.queryParameters;if("object"!=typeof s)throw new Error('options.queryParameters must be of type object. It should be a JSON object of "query-parameter-name" as the key and the "query-parameter-value" as the value. The "query-parameter-value" may be fo type "string" or an "object" of the form { value: "query-parameter-value", skipUrlEncoding: true }.');this.url&&-1===this.url.indexOf("?")&&(this.url+="?");var c=[];for(var u in this.query={},s){var l=s[u];if(l)if("string"==typeof l)c.push(u+"="+encodeURIComponent(l)),this.query[u]=encodeURIComponent(l);else if("object"==typeof l){if(!l.value)throw new Error("options.queryParameters["+u+'] is of type "object" but it does not contain a "value" property.');l.skipUrlEncoding?(c.push(u+"="+l.value),this.query[u]=l.value):(c.push(u+"="+encodeURIComponent(l.value)),this.query[u]=encodeURIComponent(l.value))}}this.url+=c.join("&")}if(e.headers)for(var d=e.headers,p=0,h=Object.keys(e.headers);p<h.length;p++){var f=h[p];this.headers.set(f,d[f])}return this.headers.get("accept-language")||this.headers.set("accept-language","en-US"),this.headers.get("x-ms-client-request-id")||e.disableClientRequestId||this.headers.set("x-ms-client-request-id",generateUuid()),this.headers.get("Content-Type")||this.headers.set("Content-Type","application/json; charset=utf-8"),this.body=e.body,null!=e.body&&(e.bodyIsStream?(this.headers.get("Transfer-Encoding")||this.headers.set("Transfer-Encoding","chunked"),"application/octet-stream"!==this.headers.get("Content-Type")&&this.headers.set("Content-Type","application/octet-stream")):(e.serializationMapper&&(this.body=new Serializer(e.mappers).serialize(e.serializationMapper,e.body,"requestBody")),e.disableJsonStringifyOnBody||(this.body=JSON.stringify(e.body)))),this.abortSignal=e.abortSignal,this.onDownloadProgress=e.onDownloadProgress,this.onUploadProgress=e.onUploadProgress,this},e.prototype.clone=function(){var t=new e(this.url,this.method,this.body,this.query,this.headers&&this.headers.clone(),this.streamResponseBody,this.withCredentials,this.abortSignal,this.timeout,this.onUploadProgress,this.onDownloadProgress);return this.formData&&(t.formData=this.formData),this.operationSpec&&(t.operationSpec=this.operationSpec),this.shouldDeserialize&&(t.shouldDeserialize=this.shouldDeserialize),this.operationResponseGetter&&(t.operationResponseGetter=this.operationResponseGetter),t},e}(),RestError=function(e){function t(r,n,o,i,a,s){var c=e.call(this,r)||this;return c.code=n,c.statusCode=o,c.request=i,c.response=a,c.body=s,Object.setPrototypeOf(c,t.prototype),c}return __extends(t,e),t.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR",t.REQUEST_ABORTED_ERROR="REQUEST_ABORTED_ERROR",t.PARSE_ERROR="PARSE_ERROR",t}(Error),XhrHttpClient=function(){function e(){}return e.prototype.sendRequest=function(e){var t=new XMLHttpRequest;if(e.proxySettings)throw new Error("HTTP proxy is not supported in browser environment");var r=e.abortSignal;if(r){var n=function(){t.abort()};r.addEventListener("abort",n),t.addEventListener("readystatechange",function(){t.readyState===XMLHttpRequest.DONE&&r.removeEventListener("abort",n)})}if(addProgressListener(t.upload,e.onUploadProgress),addProgressListener(t,e.onDownloadProgress),e.formData){for(var o=e.formData,i=new FormData,a=function(e,t){t&&t.hasOwnProperty("value")&&t.hasOwnProperty("options")?i.append(e,t.value,t.options):i.append(e,t)},s=0,c=Object.keys(o);s<c.length;s++){var u=c[s],l=o[u];if(Array.isArray(l))for(var d=0;d<l.length;d++)a(u,l[d]);else a(u,l)}e.body=i,e.formData=void 0;var p=e.headers.get("Content-Type");p&&-1!==p.indexOf("multipart/form-data")&&e.headers.remove("Content-Type")}t.open(e.method,e.url),t.timeout=e.timeout,t.withCredentials=e.withCredentials;for(var h=0,f=e.headers.headersArray();h<f.length;h++){var g=f[h];t.setRequestHeader(g.name,g.value)}return t.responseType=e.streamResponseBody?"blob":"text",t.send(void 0===e.body?null:e.body),e.streamResponseBody?new Promise(function(r,n){t.addEventListener("readystatechange",function(){if(t.readyState===XMLHttpRequest.HEADERS_RECEIVED){var n=new Promise(function(r,n){t.addEventListener("load",function(){r(t.response)}),rejectOnTerminalEvent(e,t,n)});r({request:e,status:t.status,headers:parseHeaders(t),blobBody:n})}}),rejectOnTerminalEvent(e,t,n)}):new Promise(function(r,n){t.addEventListener("load",function(){return r({request:e,status:t.status,headers:parseHeaders(t),bodyAsText:t.responseText})}),rejectOnTerminalEvent(e,t,n)})},e}(),HttpPipelineLogLevel;function addProgressListener(e,t){t&&e.addEventListener("progress",function(e){return t({loadedBytes:e.loaded})})}function parseHeaders(e){for(var t=new HttpHeaders,r=0,n=e.getAllResponseHeaders().trim().split(/[\r\n]+/);r<n.length;r++){var o=n[r],i=o.indexOf(":"),a=o.slice(0,i),s=o.slice(i+2);t.set(a,s)}return t}function rejectOnTerminalEvent(e,t,r){t.addEventListener("error",function(){return r(new RestError("Failed to send request to "+e.url,RestError.REQUEST_SEND_ERROR,void 0,e))}),t.addEventListener("abort",function(){return r(new RestError("The request was aborted",RestError.REQUEST_ABORTED_ERROR,void 0,e))}),t.addEventListener("timeout",function(){return r(new RestError("timeout of "+t.timeout+"ms exceeded",RestError.REQUEST_SEND_ERROR,void 0,e))})}function isTokenCredential(e){return e&&"function"==typeof e.getToken&&(void 0===e.signRequest||e.getToken.length>0)}function getPathStringFromParameter(e){return getPathStringFromParameterPath(e.parameterPath,e.mapper)}function getPathStringFromParameterPath(e,t){return"string"==typeof e?e:Array.isArray(e)?e.join("."):t.serializedName}function isStreamOperation(e){var t=!1;for(var r in e.responses){var n=e.responses[r];if(n.bodyMapper&&n.bodyMapper.type.name===MapperType.Stream){t=!0;break}}return t}!function(e){e[e.OFF=0]="OFF",e[e.ERROR=1]="ERROR",e[e.WARNING=2]="WARNING",e[e.INFO=3]="INFO"}(HttpPipelineLogLevel||(HttpPipelineLogLevel={}));var parser=new DOMParser;function parseXML(e){try{var t=parser.parseFromString(e,"application/xml");throwIfError(t);var r=domToObject(t.childNodes[0]);return Promise.resolve(r)}catch(e){return Promise.reject(e)}}var errorNS="";try{errorNS=parser.parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI}catch(e){}function throwIfError(e){if(errorNS){var t=e.getElementsByTagNameNS(errorNS,"parsererror");if(t.length)throw new Error(t.item(0).innerHTML)}}function isElement(e){return!!e.attributes}function asElementWithAttributes(e){return isElement(e)&&e.hasAttributes()?e:void 0}function domToObject(e){var t={},r=e.childNodes.length,n=e.childNodes[0],o=n&&1===r&&n.nodeType===Node.TEXT_NODE&&n.nodeValue||void 0,i=asElementWithAttributes(e);if(i){t.$={};for(var a=0;a<i.attributes.length;a++){var s=i.attributes[a];t.$[s.nodeName]=s.nodeValue}o&&(t._=o)}else 0===r?t="":o&&(t=o);if(!o)for(a=0;a<r;a++){var c=e.childNodes[a];if(c.nodeType!==Node.TEXT_NODE){var u=domToObject(c);t[c.nodeName]?Array.isArray(t[c.nodeName])?t[c.nodeName].push(u):t[c.nodeName]=[t[c.nodeName],u]:t[c.nodeName]=u}}return t}var doc=document.implementation.createDocument(null,null,null),serializer=new XMLSerializer;function stringifyXML(e,t){var r=buildNode(e,t&&t.rootName||"root")[0];return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+serializer.serializeToString(r)}function buildAttributes(e){for(var t=[],r=0,n=Object.keys(e);r<n.length;r++){var o=n[r],i=doc.createAttribute(o);i.value=e[o].toString(),t.push(i)}return t}function buildNode(e,t){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return(c=doc.createElement(t)).textContent=e.toString(),[c];if(Array.isArray(e)){for(var r=[],n=0,o=e;n<o.length;n++)for(var i=0,a=buildNode(o[n],t);i<a.length;i++){var s=a[i];r.push(s)}return r}if("object"==typeof e){for(var c=doc.createElement(t),u=0,l=Object.keys(e);u<l.length;u++){var d=l[u];if("$"===d)for(var p=0,h=buildAttributes(e[d]);p<h.length;p++){var f=h[p];c.attributes.setNamedItem(f)}else for(var g=0,y=buildNode(e[d],d);g<y.length;g++){s=y[g];c.appendChild(s)}}return[c]}throw new Error("Illegal value passed to buildObject: "+e)}var BaseRequestPolicy=function(){function e(e,t){this._nextPolicy=e,this._options=t}return e.prototype.shouldLog=function(e){return this._options.shouldLog(e)},e.prototype.log=function(e,t){this._options.log(e,t)},e}(),RequestPolicyOptions=function(){function e(e){this._logger=e}return e.prototype.shouldLog=function(e){return!!this._logger&&e!==HttpPipelineLogLevel.OFF&&e<=this._logger.minimumLogLevel},e.prototype.log=function(e,t){this._logger&&this.shouldLog(e)&&this._logger.log(e,t)},e}();function deserializationPolicy(e){return{create:function(t,r){return new DeserializationPolicy(t,e,r)}}}var defaultJsonContentTypes=["application/json","text/json"],defaultXmlContentTypes=["application/xml","application/atom+xml"],DeserializationPolicy=function(e){function t(t,r,n){var o=e.call(this,t,n)||this;return o.jsonContentTypes=r&&r.json||defaultJsonContentTypes,o.xmlContentTypes=r&&r.xml||defaultXmlContentTypes,o}return __extends(t,e),t.prototype.sendRequest=function(e){return __awaiter(this,void 0,void 0,function(){var t=this;return __generator(this,function(r){return[2,this._nextPolicy.sendRequest(e).then(function(e){return deserializeResponseBody(t.jsonContentTypes,t.xmlContentTypes,e)})]})})},t}(BaseRequestPolicy);function getOperationResponse(e){var t,r=e.request,n=r.operationSpec;if(n){var o=r.operationResponseGetter;t=o?o(n,e):n.responses[e.status]}return t}function shouldDeserializeResponse(e){var t=e.request.shouldDeserialize;return void 0===t||("boolean"==typeof t?t:t(e))}function deserializeResponseBody(e,t,r){return parse$1(e,t,r).then(function(e){if(shouldDeserializeResponse(e)){var t=e.request.operationSpec;if(t&&t.responses){var n=e.status,o=Object.keys(t.responses),i=0===o.length||1===o.length&&"default"===o[0],a=getOperationResponse(e);if(i?200<=n&&n<300:!!a){if(a){if(a.bodyMapper){f=e.parsedBody;t.isXML&&a.bodyMapper.type.name===MapperType.Sequence&&(f="object"==typeof f?f[a.bodyMapper.xmlElementName]:[]);try{e.parsedBody=t.serializer.deserialize(a.bodyMapper,f,"operationRes.parsedBody")}catch(l){var s=new RestError("Error "+l+" occurred in deserializing the responseBody - "+e.bodyAsText);return s.request=stripRequest(e.request),s.response=stripResponse(e),Promise.reject(s)}}else"HEAD"===t.httpMethod&&(e.parsedBody=r.status>=200&&r.status<300);a.headersMapper&&(e.parsedHeaders=t.serializer.deserialize(a.headersMapper,e.headers.rawHeaders(),"operationRes.parsedHeaders"))}}else{var c=t.responses.default;if(c){var u=isStreamOperation(t)?"Unexpected status code: "+n:e.bodyAsText,l=new RestError(u);l.statusCode=n,l.request=stripRequest(e.request),l.response=stripResponse(e);var d=e.parsedBody;try{if(d){var p=c.bodyMapper;if(p&&"CloudError"===p.serializedName)d.error&&(d=d.error),d.code&&(l.code=d.code),d.message&&(l.message=d.message);else{var h=d;d.error&&(h=d.error),l.code=h.code,h.message&&(l.message=h.message)}if(p){var f=d;t.isXML&&p.type.name===MapperType.Sequence&&(f="object"==typeof d?d[p.xmlElementName]:[]),l.body=t.serializer.deserialize(p,f,"error.body")}}}catch(t){l.message='Error "'+t.message+'" occurred in deserializing the responseBody - "'+e.bodyAsText+'" for the default response.'}return Promise.reject(l)}}}}return Promise.resolve(e)})}function parse$1(e,t,r){var n=function(e){var t='Error "'+e+'" occurred while parsing the response body - '+r.bodyAsText+".",n=e.code||RestError.PARSE_ERROR,o=new RestError(t,n,r.status,r.request,r,r.bodyAsText);return Promise.reject(o)};if(!r.request.streamResponseBody&&r.bodyAsText){var o=r.bodyAsText,i=r.headers.get("Content-Type")||"",a=i?i.split(";").map(function(e){return e.toLowerCase()}):[];if(0===a.length||a.some(function(t){return-1!==e.indexOf(t)}))return new Promise(function(e){r.parsedBody=JSON.parse(o),e(r)}).catch(n);if(a.some(function(e){return-1!==t.indexOf(e)}))return parseXML(o).then(function(e){return r.parsedBody=e,r}).catch(n)}return Promise.resolve(r)}function exponentialRetryPolicy(e,t,r,n){return{create:function(o,i){return new ExponentialRetryPolicy(o,i,e,t,r,n)}}}var DEFAULT_CLIENT_RETRY_INTERVAL=3e4,DEFAULT_CLIENT_RETRY_COUNT=3,DEFAULT_CLIENT_MAX_RETRY_INTERVAL=9e4,DEFAULT_CLIENT_MIN_RETRY_INTERVAL=3e3,ExponentialRetryPolicy=function(e){function t(t,r,n,o,i,a){var s=e.call(this,t,r)||this;function c(e){return"number"==typeof e}return s.retryCount=c(n)?n:DEFAULT_CLIENT_RETRY_COUNT,s.retryInterval=c(o)?o:DEFAULT_CLIENT_RETRY_INTERVAL,s.minRetryInterval=c(i)?i:DEFAULT_CLIENT_MIN_RETRY_INTERVAL,s.maxRetryInterval=c(a)?a:DEFAULT_CLIENT_MAX_RETRY_INTERVAL,s}return __extends(t,e),t.prototype.sendRequest=function(e){var t=this;return this._nextPolicy.sendRequest(e.clone()).then(function(r){return retry(t,e,r)}).catch(function(r){return retry(t,e,r.response,void 0,r)})},t}(BaseRequestPolicy);function shouldRetry(e,t,r){if(null==t||t<500&&408!==t||501===t||505===t)return!1;if(!r)throw new Error("retryData for the ExponentialRetryPolicyFilter cannot be null.");return(r&&r.retryCount)<e.retryCount}function updateRetryData(e,t,r){t||(t={retryCount:0,retryInterval:0}),r&&(t.error&&(r.innerError=t.error),t.error=r),t.retryCount++;var n=Math.pow(2,t.retryCount)-1;return n*=.8*e.retryInterval+Math.floor(Math.random()*(1.2*e.retryInterval-.8*e.retryInterval)),t.retryInterval=Math.min(e.minRetryInterval+n,e.maxRetryInterval),t}function retry(e,t,r,n,o){n=updateRetryData(e,n,o);var i=t.abortSignal&&t.abortSignal.aborted;if(!i&&shouldRetry(e,r&&r.status,n))return delay(n.retryInterval).then(function(){return e._nextPolicy.sendRequest(t.clone())}).then(function(r){return retry(e,t,r,n,void 0)}).catch(function(o){return retry(e,t,r,n,o)});if(i||o||!r){var a=n.error||new RestError("Failed to send the request.",RestError.REQUEST_SEND_ERROR,r&&r.status,r&&r.request,r);return Promise.reject(a)}return Promise.resolve(r)}function generateClientRequestIdPolicy(e){return void 0===e&&(e="x-ms-client-request-id"),{create:function(t,r){return new GenerateClientRequestIdPolicy(t,r,e)}}}var GenerateClientRequestIdPolicy=function(e){function t(t,r,n){var o=e.call(this,t,r)||this;return o._requestIdHeaderName=n,o}return __extends(t,e),t.prototype.sendRequest=function(e){return e.headers.contains(this._requestIdHeaderName)||e.headers.set(this._requestIdHeaderName,generateUuid()),this._nextPolicy.sendRequest(e)},t}(BaseRequestPolicy);function getDefaultUserAgentKey(){return"x-ms-command-name"}function getPlatformSpecificData(){var e=window.navigator;return[{key:"OS",value:(e.oscpu||e.platform).replace(" ","")}]}function getRuntimeInfo(){return[{key:"core-http",value:Constants.coreHttpVersion}]}function getUserAgentString(e,t,r){return void 0===t&&(t=" "),void 0===r&&(r="/"),e.map(function(e){var t=e.value?""+r+e.value:"";return""+e.key+t}).join(t)}var getDefaultUserAgentHeaderName=getDefaultUserAgentKey;function getDefaultUserAgentValue(){var e=getRuntimeInfo(),t=getPlatformSpecificData();return getUserAgentString(e.concat(t))}function userAgentPolicy(e){var t=e&&null!=e.key?e.key:getDefaultUserAgentKey(),r=e&&null!=e.value?e.value:getDefaultUserAgentValue();return{create:function(e,n){return new UserAgentPolicy(e,n,t,r)}}}var UserAgentPolicy=function(e){function t(t,r,n,o){var i=e.call(this,t,r)||this;return i._nextPolicy=t,i._options=r,i.headerKey=n,i.headerValue=o,i}return __extends(t,e),t.prototype.sendRequest=function(e){return this.addUserAgentHeader(e),this._nextPolicy.sendRequest(e)},t.prototype.addUserAgentHeader=function(e){e.headers||(e.headers=new HttpHeaders),!e.headers.get(this.headerKey)&&this.headerValue&&e.headers.set(this.headerKey,this.headerValue)},t}(BaseRequestPolicy),URLQuery=function(){function e(){this._rawQuery={}}return e.prototype.any=function(){return Object.keys(this._rawQuery).length>0},e.prototype.set=function(e,t){if(e)if(null!=t){var r=Array.isArray(t)?t:t.toString();this._rawQuery[e]=r}else delete this._rawQuery[e]},e.prototype.get=function(e){return e?this._rawQuery[e]:void 0},e.prototype.toString=function(){var e="";for(var t in this._rawQuery){e&&(e+="&");var r=this._rawQuery[t];if(Array.isArray(r)){for(var n=[],o=0,i=r;o<i.length;o++){var a=i[o];n.push(t+"="+a)}e+=n.join("&")}else e+=t+"="+r}return e},e.parse=function(t){var r=new e;if(t){t.startsWith("?")&&(t=t.substring(1));for(var n="ParameterName",o="",i="",a=0;a<t.length;++a){var s=t[a];switch(n){case"ParameterName":switch(s){case"=":n="ParameterValue";break;case"&":o="",i="";break;default:o+=s}break;case"ParameterValue":switch(s){case"=":o="",i="",n="Invalid";break;case"&":r.set(o,i),o="",i="",n="ParameterName";break;default:i+=s}break;case"Invalid":"&"===s&&(n="ParameterName");break;default:throw new Error("Unrecognized URLQuery parse state: "+n)}}"ParameterValue"===n&&r.set(o,i)}return r},e}(),URLBuilder=function(){function e(){}return e.prototype.setScheme=function(e){e?this.set(e,"SCHEME"):this._scheme=void 0},e.prototype.getScheme=function(){return this._scheme},e.prototype.setHost=function(e){e?this.set(e,"SCHEME_OR_HOST"):this._host=void 0},e.prototype.getHost=function(){return this._host},e.prototype.setPort=function(e){null==e||""===e?this._port=void 0:this.set(e.toString(),"PORT")},e.prototype.getPort=function(){return this._port},e.prototype.setPath=function(e){e?-1!==e.indexOf("://")?this.set(e,"SCHEME"):this.set(e,"PATH"):this._path=void 0},e.prototype.appendPath=function(e){if(e){var t=this.getPath();t&&(t.endsWith("/")||(t+="/"),e.startsWith("/")&&(e=e.substring(1)),e=t+e),this.set(e,"PATH")}},e.prototype.getPath=function(){return this._path},e.prototype.setQuery=function(e){this._query=e?URLQuery.parse(e):void 0},e.prototype.setQueryParameter=function(e,t){e&&(this._query||(this._query=new URLQuery),this._query.set(e,t))},e.prototype.getQueryParameterValue=function(e){return this._query?this._query.get(e):void 0},e.prototype.getQuery=function(){return this._query?this._query.toString():void 0},e.prototype.set=function(e,t){for(var r=new URLTokenizer(e,t);r.next();){var n=r.current();if(n)switch(n.type){case"SCHEME":this._scheme=n.text||void 0;break;case"HOST":this._host=n.text||void 0;break;case"PORT":this._port=n.text||void 0;break;case"PATH":var o=n.text||void 0;this._path&&"/"!==this._path&&"/"===o||(this._path=o);break;case"QUERY":this._query=URLQuery.parse(n.text);break;default:throw new Error("Unrecognized URLTokenType: "+n.type)}}},e.prototype.toString=function(){var e="";return this._scheme&&(e+=this._scheme+"://"),this._host&&(e+=this._host),this._port&&(e+=":"+this._port),this._path&&(this._path.startsWith("/")||(e+="/"),e+=this._path),this._query&&this._query.any()&&(e+="?"+this._query.toString()),e},e.prototype.replaceAll=function(e,t){e&&(this.setScheme(replaceAll(this.getScheme(),e,t)),this.setHost(replaceAll(this.getHost(),e,t)),this.setPort(replaceAll(this.getPort(),e,t)),this.setPath(replaceAll(this.getPath(),e,t)),this.setQuery(replaceAll(this.getQuery(),e,t)))},e.parse=function(t){var r=new e;return r.set(t,"SCHEME_OR_HOST"),r},e}(),URLToken=function(){function e(e,t){this.text=e,this.type=t}return e.scheme=function(t){return new e(t,"SCHEME")},e.host=function(t){return new e(t,"HOST")},e.port=function(t){return new e(t,"PORT")},e.path=function(t){return new e(t,"PATH")},e.query=function(t){return new e(t,"QUERY")},e}();function isAlphaNumericCharacter(e){var t=e.charCodeAt(0);return 48<=t&&t<=57||65<=t&&t<=90||97<=t&&t<=122}var URLTokenizer=function(){function e(e,t){this._text=e,this._textLength=e?e.length:0,this._currentState=null!=t?t:"SCHEME_OR_HOST",this._currentIndex=0}return e.prototype.current=function(){return this._currentToken},e.prototype.next=function(){if(hasCurrentCharacter(this))switch(this._currentState){case"SCHEME":nextScheme(this);break;case"SCHEME_OR_HOST":nextSchemeOrHost(this);break;case"HOST":nextHost(this);break;case"PORT":nextPort(this);break;case"PATH":nextPath(this);break;case"QUERY":nextQuery(this);break;default:throw new Error("Unrecognized URLTokenizerState: "+this._currentState)}else this._currentToken=void 0;return!!this._currentToken},e}();function readRemaining(e){var t="";return e._currentIndex<e._textLength&&(t=e._text.substring(e._currentIndex),e._currentIndex=e._textLength),t}function hasCurrentCharacter(e){return e._currentIndex<e._textLength}function getCurrentCharacter(e){return e._text[e._currentIndex]}function nextCharacter(e,t){hasCurrentCharacter(e)&&(t||(t=1),e._currentIndex+=t)}function peekCharacters(e,t){var r=e._currentIndex+t;return e._textLength<r&&(r=e._textLength),e._text.substring(e._currentIndex,r)}function readWhile(e,t){for(var r="";hasCurrentCharacter(e);){var n=getCurrentCharacter(e);if(!t(n))break;r+=n,nextCharacter(e)}return r}function readWhileLetterOrDigit(e){return readWhile(e,function(e){return isAlphaNumericCharacter(e)})}function readUntilCharacter(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return readWhile(e,function(e){return-1===t.indexOf(e)})}function nextScheme(e){var t=readWhileLetterOrDigit(e);e._currentToken=URLToken.scheme(t),hasCurrentCharacter(e)?e._currentState="HOST":e._currentState="DONE"}function nextSchemeOrHost(e){var t=readUntilCharacter(e,":","/","?");hasCurrentCharacter(e)?":"===getCurrentCharacter(e)?"://"===peekCharacters(e,3)?(e._currentToken=URLToken.scheme(t),e._currentState="HOST"):(e._currentToken=URLToken.host(t),e._currentState="PORT"):(e._currentToken=URLToken.host(t),"/"===getCurrentCharacter(e)?e._currentState="PATH":e._currentState="QUERY"):(e._currentToken=URLToken.host(t),e._currentState="DONE")}function nextHost(e){"://"===peekCharacters(e,3)&&nextCharacter(e,3);var t=readUntilCharacter(e,":","/","?");e._currentToken=URLToken.host(t),hasCurrentCharacter(e)?":"===getCurrentCharacter(e)?e._currentState="PORT":"/"===getCurrentCharacter(e)?e._currentState="PATH":e._currentState="QUERY":e._currentState="DONE"}function nextPort(e){":"===getCurrentCharacter(e)&&nextCharacter(e);var t=readUntilCharacter(e,"/","?");e._currentToken=URLToken.port(t),hasCurrentCharacter(e)?"/"===getCurrentCharacter(e)?e._currentState="PATH":e._currentState="QUERY":e._currentState="DONE"}function nextPath(e){var t=readUntilCharacter(e,"?");e._currentToken=URLToken.path(t),hasCurrentCharacter(e)?e._currentState="QUERY":e._currentState="DONE"}function nextQuery(e){"?"===getCurrentCharacter(e)&&nextCharacter(e);var t=readRemaining(e);e._currentToken=URLToken.query(t),e._currentState="DONE"}function redirectPolicy(e){return void 0===e&&(e=20),{create:function(t,r){return new RedirectPolicy(t,r,e)}}}var RedirectPolicy=function(e){function t(t,r,n){void 0===n&&(n=20);var o=e.call(this,t,r)||this;return o.maxRetries=n,o}return __extends(t,e),t.prototype.sendRequest=function(e){var t=this;return this._nextPolicy.sendRequest(e).then(function(e){return handleRedirect(t,e,0)})},t}(BaseRequestPolicy);function handleRedirect(e,t,r){var n=t.request,o=t.status,i=t.headers.get("location");if(i&&(300===o||307===o||303===o&&"POST"===n.method)&&(!e.maxRetries||r<e.maxRetries)){var a=URLBuilder.parse(n.url);return a.setPath(i),n.url=a.toString(),303===o&&(n.method="GET"),e._nextPolicy.sendRequest(n).then(function(t){return handleRedirect(e,t,r+1)})}return Promise.resolve(t)}function rpRegistrationPolicy(e){return void 0===e&&(e=30),{create:function(t,r){return new RPRegistrationPolicy(t,r,e)}}}var RPRegistrationPolicy=function(e){function t(t,r,n){void 0===n&&(n=30);var o=e.call(this,t,r)||this;return o._retryTimeout=n,o}return __extends(t,e),t.prototype.sendRequest=function(e){var t=this;return this._nextPolicy.sendRequest(e.clone()).then(function(r){return registerIfNeeded(t,e,r)})},t}(BaseRequestPolicy);function registerIfNeeded(e,t,r){if(409===r.status){var n=checkRPNotRegisteredError(r.bodyAsText);if(n){var o=extractSubscriptionUrl(t.url);return registerRP(e,o,n,t).catch(function(){return!1}).then(function(n){return n?(t.headers.set("x-ms-client-request-id",generateUuid()),e._nextPolicy.sendRequest(t.clone())):r})}}return Promise.resolve(r)}function getRequestEssentials(e,t){void 0===t&&(t=!1);var r=e.clone();return t&&(r.url=e.url),r.headers.set("x-ms-client-request-id",generateUuid()),r.headers.set("Content-Type","application/json; charset=utf-8"),r}function checkRPNotRegisteredError(e){var t,r;if(e){try{r=JSON.parse(e)}catch(e){}if(r&&r.error&&r.error.message&&r.error.code&&"MissingSubscriptionRegistration"===r.error.code){var n=r.error.message.match(/.*'(.*)'/i);n&&(t=n.pop())}}return t}function extractSubscriptionUrl(e){var t=e.match(/.*\/subscriptions\/[a-f0-9-]+\//gi);if(!t||!t[0])throw new Error("Unable to extract subscriptionId from the given url - "+e+".");return t[0]}function registerRP(e,t,r,n){var o=t+"providers/"+r+"/register?api-version=2016-02-01",i=t+"providers/"+r+"?api-version=2016-02-01",a=getRequestEssentials(n);return a.method="POST",a.url=o,e._nextPolicy.sendRequest(a).then(function(t){if(200!==t.status)throw new Error("Autoregistration of "+r+" failed. Please try registering manually.");return getRegistrationStatus(e,i,n)})}function getRegistrationStatus(e,t,r){var n=getRequestEssentials(r);return n.url=t,n.method="GET",e._nextPolicy.sendRequest(n).then(function(n){var o=n.parsedBody;return!(!n.parsedBody||!o.registrationState||"Registered"!==o.registrationState)||delay(1e3*e._retryTimeout).then(function(){return getRegistrationStatus(e,t,r)})})}var TokenRefreshBufferMs=12e4,ExpiringAccessTokenCache=function(){function e(e){void 0===e&&(e=TokenRefreshBufferMs),this.cachedToken=void 0,this.tokenRefreshBufferMs=e}return e.prototype.setCachedToken=function(e){this.cachedToken=e},e.prototype.getCachedToken=function(){return this.cachedToken&&Date.now()+this.tokenRefreshBufferMs>=this.cachedToken.expiresOnTimestamp&&(this.cachedToken=void 0),this.cachedToken},e}();function bearerTokenAuthenticationPolicy(e,t){var r=new ExpiringAccessTokenCache;return{create:function(n,o){return new BearerTokenAuthenticationPolicy(n,o,e,t,r)}}}var BearerTokenAuthenticationPolicy=function(e){function t(t,r,n,o,i){var a=e.call(this,t,r)||this;return a.credential=n,a.scopes=o,a.tokenCache=i,a}return __extends(t,e),t.prototype.sendRequest=function(e){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(r){switch(r.label){case 0:return e.headers||(e.headers=new HttpHeaders),[4,this.getToken({abortSignal:e.abortSignal})];case 1:return t=r.sent(),e.headers.set(Constants.HeaderConstants.AUTHORIZATION,"Bearer "+t),[2,this._nextPolicy.sendRequest(e)]}})})},t.prototype.getToken=function(e){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(r){switch(r.label){case 0:return void 0!==(t=this.tokenCache.getCachedToken())?[3,2]:[4,this.credential.getToken(this.scopes,e)];case 1:t=r.sent()||void 0,this.tokenCache.setCachedToken(t),r.label=2;case 2:return[2,t?t.token:void 0]}})})},t}(BaseRequestPolicy);function systemErrorRetryPolicy(e,t,r,n){return{create:function(o,i){return new SystemErrorRetryPolicy(o,i,e,t,r,n)}}}var SystemErrorRetryPolicy=function(e){function t(t,r,n,o,i,a){var s=e.call(this,t,r)||this;return s.DEFAULT_CLIENT_RETRY_INTERVAL=3e4,s.DEFAULT_CLIENT_RETRY_COUNT=3,s.DEFAULT_CLIENT_MAX_RETRY_INTERVAL=9e4,s.DEFAULT_CLIENT_MIN_RETRY_INTERVAL=3e3,s.retryCount="number"==typeof n?n:s.DEFAULT_CLIENT_RETRY_COUNT,s.retryInterval="number"==typeof o?o:s.DEFAULT_CLIENT_RETRY_INTERVAL,s.minRetryInterval="number"==typeof i?i:s.DEFAULT_CLIENT_MIN_RETRY_INTERVAL,s.maxRetryInterval="number"==typeof a?a:s.DEFAULT_CLIENT_MAX_RETRY_INTERVAL,s}return __extends(t,e),t.prototype.sendRequest=function(e){var t=this;return this._nextPolicy.sendRequest(e.clone()).then(function(r){return retry$1(t,e,r)})},t}(BaseRequestPolicy),QueryCollectionFormat;function shouldRetry$1(e,t){if(!t)throw new Error("retryData for the SystemErrorRetryPolicyFilter cannot be null.");return(t&&t.retryCount)<e.retryCount}function updateRetryData$1(e,t,r){t||(t={retryCount:0,retryInterval:0}),r&&(t.error&&(r.innerError=t.error),t.error=r),t.retryCount++;var n=Math.pow(2,t.retryCount)-1;return n*=.8*e.retryInterval+Math.floor(Math.random()*(1.2*e.retryInterval-.8*e.retryInterval)),t.retryInterval=Math.min(e.minRetryInterval+n,e.maxRetryInterval),t}function retry$1(e,t,r,n,o){return n=updateRetryData$1(e,n,o),o&&o.code&&shouldRetry$1(e,n)&&("ETIMEDOUT"===o.code||"ESOCKETTIMEDOUT"===o.code||"ECONNREFUSED"===o.code||"ECONNRESET"===o.code||"ENOENT"===o.code)?delay(n.retryInterval).then(function(){return e._nextPolicy.sendRequest(t.clone())}).then(function(r){return retry$1(e,t,r,n,o)}).catch(function(o){return retry$1(e,t,r,n,o)}):null!=o?(o=n.error,Promise.reject(o)):Promise.resolve(r)}!function(e){e.Csv=",",e.Ssv=" ",e.Tsv="\t",e.Pipes="|",e.Multi="Multi"}(QueryCollectionFormat||(QueryCollectionFormat={}));var proxyNotSupportedInBrowser=new Error("ProxyPolicy is not supported in browser environment");function getDefaultProxySettings(e){}function proxyPolicy(e){return{create:function(e,t){throw proxyNotSupportedInBrowser}}}var ProxyPolicy=function(e){function t(t,r){e.call(this,t,r);throw proxyNotSupportedInBrowser}return __extends(t,e),t.prototype.sendRequest=function(e){throw proxyNotSupportedInBrowser},t}(BaseRequestPolicy),StatusCodes=Constants.HttpConstants.StatusCodes;function throttlingRetryPolicy(){return{create:function(e,t){return new ThrottlingRetryPolicy(e,t)}}}var ThrottlingRetryPolicy=function(e){function t(t,r,n){var o=e.call(this,t,r)||this;return o._handleResponse=n||o._defaultResponseHandler,o}return __extends(t,e),t.prototype.sendRequest=function(e){return __awaiter(this,void 0,void 0,function(){var t=this;return __generator(this,function(r){return[2,this._nextPolicy.sendRequest(e.clone()).then(function(r){return r.status!==StatusCodes.TooManyRequests?r:t._handleResponse(e,r)})]})})},t.prototype._defaultResponseHandler=function(e,r){return __awaiter(this,void 0,void 0,function(){var n,o,i=this;return __generator(this,function(a){return(n=r.headers.get(Constants.HeaderConstants.RETRY_AFTER))&&(o=t.parseRetryAfterHeader(n))?[2,delay(o).then(function(t){return i._nextPolicy.sendRequest(e)})]:[2,r]})})},t.parseRetryAfterHeader=function(e){var r=Number(e);return Number.isNaN(r)?t.parseDateRetryAfterHeader(e):1e3*r},t.parseDateRetryAfterHeader=function(e){try{var t=Date.now(),r=Date.parse(e)-t;return Number.isNaN(r)?void 0:r}catch(e){return}},t}(BaseRequestPolicy),ServiceClient=function(){function e(e,t){var r,n,o,i=this;if(t||(t={}),this._withCredentials=t.withCredentials||!1,this._httpClient=t.httpClient||new XhrHttpClient,this._requestPolicyOptions=new RequestPolicyOptions(t.httpPipelineLogger),Array.isArray(t.requestPolicyFactories))r=t.requestPolicyFactories;else{var a=void 0;if(isTokenCredential(e)){n=void 0,o=i,a={create:function(t,r){return void 0===n&&(n=bearerTokenAuthenticationPolicy(e,(o.baseUri||"")+"/.default")),n.create(t,r)}}}else if(void 0!==e)throw new Error("The credentials argument must implement the TokenCredential interface");if(r=createDefaultRequestPolicyFactories(a,t),t.requestPolicyFactories){var s=t.requestPolicyFactories(r);s&&(r=s)}}this._requestPolicyFactories=r}return e.prototype.sendRequest=function(e){if(null==e||"object"!=typeof e)throw new Error("options cannot be null or undefined and it must be of type object.");var t;try{e instanceof WebResource?(e.validateRequestProperties(),t=e):t=(t=new WebResource).prepare(e)}catch(e){return Promise.reject(e)}var r=this._httpClient;if(this._requestPolicyFactories&&this._requestPolicyFactories.length>0)for(var n=this._requestPolicyFactories.length-1;n>=0;--n)r=this._requestPolicyFactories[n].create(r,this._requestPolicyOptions);return r.sendRequest(t)},e.prototype.sendOperationRequest=function(e,t,r){"function"==typeof e.options&&(r=e.options,e.options=void 0);var n,o=new WebResource;try{var i=t.baseUrl||this.baseUri;if(!i)throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use.");o.method=t.httpMethod,o.operationSpec=t;var a=URLBuilder.parse(i);if(t.path&&a.appendPath(t.path),t.urlParameters&&t.urlParameters.length>0)for(var s=0,c=t.urlParameters;s<c.length;s++){var u=c[s],l=getOperationArgumentValueFromParameter(this,e,u,t.serializer);l=t.serializer.serialize(u.mapper,l,getPathStringFromParameter(u)),u.skipEncoding||(l=encodeURIComponent(l)),a.replaceAll("{"+(u.mapper.serializedName||getPathStringFromParameter(u))+"}",l)}if(t.queryParameters&&t.queryParameters.length>0)for(var d=0,p=t.queryParameters;d<p.length;d++){var h=p[d],f=getOperationArgumentValueFromParameter(this,e,h,t.serializer);if(null!=f){if(f=t.serializer.serialize(h.mapper,f,getPathStringFromParameter(h)),null!=h.collectionFormat)if(h.collectionFormat===QueryCollectionFormat.Multi)if(0===f.length)f="";else for(var g in f){var y=f[g];f[g]=null==y?"":y.toString()}else f=f.join(h.collectionFormat);if(!h.skipEncoding)if(Array.isArray(f))for(var g in f)f[g]=encodeURIComponent(f[g]);else f=encodeURIComponent(f);a.setQueryParameter(h.mapper.serializedName||getPathStringFromParameter(h),f)}}o.url=a.toString();var m=t.contentType||this.requestContentType;if(m&&o.headers.set("Content-Type",m),t.headerParameters)for(var v=0,C=t.headerParameters;v<C.length;v++){var b=C[v],w=getOperationArgumentValueFromParameter(this,e,b,t.serializer);if(null!=w){w=t.serializer.serialize(b.mapper,w,getPathStringFromParameter(b));var E=b.mapper.headerCollectionPrefix;if(E)for(var T=0,S=Object.keys(w);T<S.length;T++){var A=S[T];o.headers.set(E+A,w[A])}else o.headers.set(b.mapper.serializedName||getPathStringFromParameter(b),w)}}var I=e.options;if(I){if(I.customHeaders)for(var R in I.customHeaders)o.headers.set(R,I.customHeaders[R]);I.abortSignal&&(o.abortSignal=I.abortSignal),I.timeout&&(o.timeout=I.timeout),I.onUploadProgress&&(o.onUploadProgress=I.onUploadProgress),I.onDownloadProgress&&(o.onDownloadProgress=I.onDownloadProgress)}o.withCredentials=this._withCredentials,serializeRequestBody(this,o,e,t),null==o.streamResponseBody&&(o.streamResponseBody=isStreamOperation(t)),n=this.sendRequest(o).then(function(e){return flattenResponse(e,t.responses[e.status])})}catch(e){n=Promise.reject(e)}var k=r;return k&&n.then(function(e){return k(null,e._response.parsedBody,e._response.request,e._response)}).catch(function(e){return k(e)}),n},e}();function serializeRequestBody(e,t,r,n){if(n.requestBody&&n.requestBody.mapper){t.body=getOperationArgumentValueFromParameter(e,r,n.requestBody,n.serializer);var o=n.requestBody.mapper,i=o.required,a=o.xmlName,s=o.xmlElementName,c=o.serializedName,u=o.type.name;try{if(null!=t.body||i){var l=getPathStringFromParameter(n.requestBody);t.body=n.serializer.serialize(o,t.body,l);var d=u===MapperType.Stream;n.isXML?u===MapperType.Sequence?t.body=stringifyXML(prepareXMLRootList(t.body,s||a||c),{rootName:a||c}):d||(t.body=stringifyXML(t.body,{rootName:a||c})):d||(t.body=JSON.stringify(t.body))}}catch(e){throw new Error('Error "'+e.message+'" occurred in serializing the payload - '+JSON.stringify(c,void 0," ")+".")}}else if(n.formDataParameters&&n.formDataParameters.length>0){t.formData={};for(var p=0,h=n.formDataParameters;p<h.length;p++){var f=h[p],g=getOperationArgumentValueFromParameter(e,r,f,n.serializer);if(null!=g){var y=f.mapper.serializedName||getPathStringFromParameter(f);t.formData[y]=n.serializer.serialize(f.mapper,g,getPathStringFromParameter(f))}}}}function getValueOrFunctionResult(e,t){var r;return"string"==typeof e?r=e:(r=t(),"function"==typeof e&&(r=e(r))),r}function createDefaultRequestPolicyFactories(e,t){var r=[];t.generateClientRequestIdHeader&&r.push(generateClientRequestIdPolicy(t.clientRequestIdHeaderName)),e&&r.push(e);var n=getValueOrFunctionResult(t.userAgentHeaderName,getDefaultUserAgentHeaderName),o=getValueOrFunctionResult(t.userAgent,getDefaultUserAgentValue);return n&&o&&r.push(userAgentPolicy({key:n,value:o})),r.push(redirectPolicy()),r.push(rpRegistrationPolicy(t.rpRegistrationRetryTimeout)),t.noRetryPolicy||(r.push(exponentialRetryPolicy()),r.push(systemErrorRetryPolicy()),r.push(throttlingRetryPolicy())),r.push(deserializationPolicy(t.deserializationContentTypes)),(t.proxySettings||getDefaultProxySettings())&&r.push(proxyPolicy()),r}function getOperationArgumentValueFromParameter(e,t,r,n){return getOperationArgumentValueFromParameterPath(e,t,r.parameterPath,r.mapper,n)}function getOperationArgumentValueFromParameterPath(e,t,r,n,o){var i;if("string"==typeof r&&(r=[r]),Array.isArray(r)){if(r.length>0){if(n.isConstant)i=n.defaultValue;else{var a=getPropertyFromParameterPath(t,r);a.propertyFound||(a=getPropertyFromParameterPath(e,r));var s=!1;a.propertyFound||(s=n.required||"options"===r[0]&&2===r.length),i=s?n.defaultValue:a.propertyValue}var c=getPathStringFromParameterPath(r,n);o.serialize(n,i,c)}}else for(var u in n.required&&(i={}),r){var l=n.type.modelProperties[u],d=r[u],p=getOperationArgumentValueFromParameterPath(e,t,d,l,o),h=getPathStringFromParameterPath(d,l);o.serialize(l,p,h),void 0!==p&&(i||(i={}),i[u]=p)}return i}function getPropertyFromParameterPath(e,t){for(var r={propertyFound:!1},n=0;n<t.length;++n){var o=t[n];if(!(null!=e&&o in e))break;e=e[o]}return n===t.length&&(r.propertyValue=e,r.propertyFound=!0),r}function flattenResponse(e,t){var r=e.parsedHeaders,n=t&&t.bodyMapper,o=function(t){return Object.defineProperty(t,"_response",{value:e})};if(n){var i=n.type.name;if("Stream"===i)return o(__assign({},r,{blobBody:e.blobBody,readableStreamBody:e.readableStreamBody}));var a="Composite"===i&&n.type.modelProperties||{},s=Object.keys(a).some(function(e){return""===a[e].serializedName});if("Sequence"===i||s){for(var c=(e.parsedBody||[]).slice(),u=0,l=Object.keys(a);u<l.length;u++){var d=l[u];a[d].serializedName&&(c[d]=e.parsedBody[d])}if(r)for(var p=0,h=Object.keys(r);p<h.length;p++){c[d=h[p]]=r[d]}return o(c),c}if("Composite"===i||"Dictionary"===i)return o(__assign({},r,e.parsedBody))}return n||"HEAD"===e.request.method?o(__assign({},r,{body:e.parsedBody})):o(__assign({},r,e.parsedBody))}const DefaultAuthorityHost="https://login.microsoftonline.com";class IdentityClient extends ServiceClient{constructor(e){if(super(void 0,e=e||IdentityClient.getDefaultOptions()),this.baseUri=this.authorityHost=e.authorityHost||DefaultAuthorityHost,!this.baseUri.startsWith("https:"))throw new Error("The authorityHost address must use the 'https' protocol.")}createWebResource(e){const t=new WebResource;return t.prepare(e),t}sendTokenRequest(e,t){return __awaiter(this,void 0,void 0,function*(){const r=yield this.sendRequest(e);if(t=t||(e=>Date.now()+1e3*e.expires_in),200===r.status||201===r.status)return{accessToken:{token:r.parsedBody.access_token,expiresOnTimestamp:t(r.parsedBody)},refreshToken:r.parsedBody.refresh_token};throw new AuthenticationError(r.status,r.parsedBody||r.bodyAsText)})}refreshAccessToken(e,t,r,n,o,i,a){return __awaiter(this,void 0,void 0,function*(){if(void 0===n)return null;const s={grant_type:"refresh_token",client_id:t,refresh_token:n,scope:r};void 0!==o&&(s.client_secret=o);const c=this.createWebResource({url:`${this.authorityHost}/${e}/oauth2/v2.0/token`,method:"POST",disableJsonStringifyOnBody:!0,deserializationMapper:void 0,body:lib.stringify(s),headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},abortSignal:a&&a.abortSignal});try{return yield this.sendTokenRequest(c,i)}catch(e){if(e instanceof AuthenticationError&&"interaction_required"===e.errorResponse.error)return null;throw e}})}static getDefaultOptions(){return{authorityHost:DefaultAuthorityHost}}}class ClientSecretCredential{constructor(e,t,r,n){this.identityClient=new IdentityClient(n),this.tenantId=e,this.clientId=t,this.clientSecret=r}getToken(e,t){return __awaiter(this,void 0,void 0,function*(){const r=this.identityClient.createWebResource({url:`${this.identityClient.authorityHost}/${this.tenantId}/oauth2/v2.0/token`,method:"POST",disableJsonStringifyOnBody:!0,deserializationMapper:void 0,body:lib.stringify({response_type:"token",grant_type:"client_credentials",client_id:this.clientId,client_secret:this.clientSecret,scope:"string"==typeof e?e:e.join(" ")}),headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},abortSignal:t&&t.abortSignal}),n=yield this.identityClient.sendTokenRequest(r);return n&&n.accessToken||null})}}const BrowserNotSupportedError$2=new Error("ClientCertificateCredential is not supported in the browser.");class ClientCertificateCredential{constructor(e,t,r,n){throw BrowserNotSupportedError$2}getToken(e,t){throw BrowserNotSupportedError$2}}var Constants$1=function(){function e(){}return Object.defineProperty(e,"errorDescription",{get:function(){return"error_description"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"error",{get:function(){return"error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"scope",{get:function(){return"scope"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"clientInfo",{get:function(){return"client_info"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"clientId",{get:function(){return"clientId"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"idToken",{get:function(){return"id_token"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"adalIdToken",{get:function(){return"adal.idtoken"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"accessToken",{get:function(){return"access_token"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"expiresIn",{get:function(){return"expires_in"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"sessionState",{get:function(){return"session_state"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"claims",{get:function(){return"claims"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msalClientInfo",{get:function(){return"msal.client.info"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msalError",{get:function(){return"msal.error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msalErrorDescription",{get:function(){return"msal.error.description"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msalSessionState",{get:function(){return"msal.session.state"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"tokenKeys",{get:function(){return"msal.token.keys"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"accessTokenKey",{get:function(){return"msal.access.token.key"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"expirationKey",{get:function(){return"msal.expiration.key"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"stateLogin",{get:function(){return"msal.state.login"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"stateAcquireToken",{get:function(){return"msal.state.acquireToken"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"stateRenew",{get:function(){return"msal.state.renew"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"nonceIdToken",{get:function(){return"msal.nonce.idtoken"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"userName",{get:function(){return"msal.username"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"idTokenKey",{get:function(){return"msal.idtoken"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"loginRequest",{get:function(){return"msal.login.request"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"loginError",{get:function(){return"msal.login.error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"renewStatus",{get:function(){return"msal.token.renew.status"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"urlHash",{get:function(){return"msal.urlHash"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"angularLoginRequest",{get:function(){return"msal.angular.login.request"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msal",{get:function(){return"msal"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"no_account",{get:function(){return"NO_ACCOUNT"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"consumersUtid",{get:function(){return"9188040d-6c67-4c5b-b112-36a304b66dad"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"upn",{get:function(){return"upn"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"prompt_select_account",{get:function(){return"&prompt=select_account"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"prompt_none",{get:function(){return"&prompt=none"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"prompt",{get:function(){return"prompt"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"response_mode_fragment",{get:function(){return"&response_mode=fragment"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"resourceDelimiter",{get:function(){return"|"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"tokenRenewStatusCancelled",{get:function(){return"Canceled"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"tokenRenewStatusCompleted",{get:function(){return"Completed"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"tokenRenewStatusInProgress",{get:function(){return"In Progress"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"popUpWidth",{get:function(){return this._popUpWidth},set:function(e){this._popUpWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"popUpHeight",{get:function(){return this._popUpHeight},set:function(e){this._popUpHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"login",{get:function(){return"LOGIN"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"renewToken",{get:function(){return"RENEW_TOKEN"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unknown",{get:function(){return"UNKNOWN"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"homeAccountIdentifier",{get:function(){return"homeAccountIdentifier"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"common",{get:function(){return"common"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"openidScope",{get:function(){return"openid"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"profileScope",{get:function(){return"profile"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"cacheLocationLocal",{get:function(){return"localStorage"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"cacheLocationSession",{get:function(){return"sessionStorage"},enumerable:!0,configurable:!0}),e._popUpWidth=483,e._popUpHeight=600,e}(),CacheKeys={AUTHORITY:"msal.authority",ACQUIRE_TOKEN_ACCOUNT:"msal.acquireTokenAccount"},SSOTypes={ACCOUNT:"account",SID:"sid",LOGIN_HINT:"login_hint",ID_TOKEN:"id_token",DOMAIN_HINT:"domain_hint",ORGANIZATIONS:"organizations",CONSUMERS:"consumers",ACCOUNT_ID:"accountIdentifier",HOMEACCOUNT_ID:"homeAccountIdentifier",LOGIN_REQ:"login_req",DOMAIN_REQ:"domain_req"},PromptState={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none"},Library={version:"1.0.2"},AuthErrorMessage={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."}},AuthError=function(e){function t(r,n){var o=e.call(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o.errorCode=r,o.errorMessage=n,o.name="AuthError",o}return __extends(t,e),t.createUnexpectedError=function(e){return new t(AuthErrorMessage.unexpectedError.code,AuthErrorMessage.unexpectedError.desc+": "+e)},t}(Error),ClientAuthErrorMessage={multipleMatchingTokens:{code:"multiple_matching_tokens",desc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority."},multipleCacheAuthorities:{code:"multiple_authorities",desc:"Multiple authorities found in the cache. Pass authority in the API overload."},endpointResolutionError:{code:"endpoints_resolution_error",desc:"Error: could not resolve endpoints. Please check network and try again."},popUpWindowError:{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."},tokenRenewalError:{code:"token_renewal_error",desc:"Token renewal operation failed due to timeout."},invalidIdToken:{code:"invalid_id_token",desc:"Invalid ID token format."},invalidStateError:{code:"invalid_state_error",desc:"Invalid state."},nonceMismatchError:{code:"nonce_mismatch_error",desc:"Nonce is not matching, Nonce received: "},loginProgressError:{code:"login_progress_error",desc:"Login_In_Progress: Error during login call - login is already in progress."},acquireTokenProgressError:{code:"acquiretoken_progress_error",desc:"AcquireToken_In_Progress: Error during login call - login is already in progress."},userCancelledError:{code:"user_cancelled",desc:"User cancelled the flow."},callbackError:{code:"callback_error",desc:"Error occurred in token received callback function."},userLoginRequiredError:{code:"user_login_error",desc:"User login is required."},userDoesNotExistError:{code:"user_non_existent",desc:"User object does not exist. Please call a login API."},clientInfoDecodingError:{code:"client_info_decoding_error",desc:"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause."},clientInfoNotPopulatedError:{code:"client_info_not_populated_error",desc:"The service did not populate client_info in the response, Please verify with the service team"},nullOrEmptyIdToken:{code:"null_or_empty_id_token",desc:"The idToken is null or empty. Please review the trace to determine the root cause."},idTokenNotParsed:{code:"id_token_parsing_error",desc:"ID token cannot be parsed. Please review stack trace to determine root cause."},tokenEncodingError:{code:"token_encoding_error",desc:"The token to be decoded is not encoded correctly."}},ClientAuthError=function(e){function t(r,n){var o=e.call(this,r,n)||this;return o.name="ClientAuthError",Object.setPrototypeOf(o,t.prototype),o}return __extends(t,e),t.createEndpointResolutionError=function(e){var r=ClientAuthErrorMessage.endpointResolutionError.desc;return e&&!Utils.isEmpty(e)&&(r+=" Details: "+e),new t(ClientAuthErrorMessage.endpointResolutionError.code,r)},t.createMultipleMatchingTokensInCacheError=function(e){return new t(ClientAuthErrorMessage.multipleMatchingTokens.code,"Cache error for scope "+e+": "+ClientAuthErrorMessage.multipleMatchingTokens.desc+".")},t.createMultipleAuthoritiesInCacheError=function(e){return new t(ClientAuthErrorMessage.multipleCacheAuthorities.code,"Cache error for scope "+e+": "+ClientAuthErrorMessage.multipleCacheAuthorities.desc+".")},t.createPopupWindowError=function(e){var r=ClientAuthErrorMessage.popUpWindowError.desc;return e&&!Utils.isEmpty(e)&&(r+=" Details: "+e),new t(ClientAuthErrorMessage.popUpWindowError.code,r)},t.createTokenRenewalTimeoutError=function(){return new t(ClientAuthErrorMessage.tokenRenewalError.code,ClientAuthErrorMessage.tokenRenewalError.desc)},t.createInvalidIdTokenError=function(e){return new t(ClientAuthErrorMessage.invalidIdToken.code,ClientAuthErrorMessage.invalidIdToken.desc+" Given token: "+e)},t.createInvalidStateError=function(e,r){return new t(ClientAuthErrorMessage.invalidStateError.code,ClientAuthErrorMessage.invalidStateError.desc+" "+e+", state expected : "+r+".")},t.createNonceMismatchError=function(e,r){return new t(ClientAuthErrorMessage.nonceMismatchError.code,ClientAuthErrorMessage.nonceMismatchError.desc+" "+e+", nonce expected : "+r+".")},t.createLoginInProgressError=function(){return new t(ClientAuthErrorMessage.loginProgressError.code,ClientAuthErrorMessage.loginProgressError.desc)},t.createAcquireTokenInProgressError=function(){return new t(ClientAuthErrorMessage.acquireTokenProgressError.code,ClientAuthErrorMessage.acquireTokenProgressError.desc)},t.createUserCancelledError=function(){return new t(ClientAuthErrorMessage.userCancelledError.code,ClientAuthErrorMessage.userCancelledError.desc)},t.createErrorInCallbackFunction=function(e){return new t(ClientAuthErrorMessage.callbackError.code,ClientAuthErrorMessage.callbackError.desc+" "+e+".")},t.createUserLoginRequiredError=function(){return new t(ClientAuthErrorMessage.userLoginRequiredError.code,ClientAuthErrorMessage.userLoginRequiredError.desc)},t.createUserDoesNotExistError=function(){return new t(ClientAuthErrorMessage.userDoesNotExistError.code,ClientAuthErrorMessage.userDoesNotExistError.desc)},t.createClientInfoDecodingError=function(e){return new t(ClientAuthErrorMessage.clientInfoDecodingError.code,ClientAuthErrorMessage.clientInfoDecodingError.desc+" Failed with error: "+e)},t.createClientInfoNotPopulatedError=function(e){return new t(ClientAuthErrorMessage.clientInfoNotPopulatedError.code,ClientAuthErrorMessage.clientInfoNotPopulatedError.desc+" Failed with error: "+e)},t.createIdTokenNullOrEmptyError=function(e){return new t(ClientAuthErrorMessage.nullOrEmptyIdToken.code,ClientAuthErrorMessage.nullOrEmptyIdToken.desc+" Raw ID Token Value: "+e)},t.createIdTokenParsingError=function(e){return new t(ClientAuthErrorMessage.idTokenNotParsed.code,ClientAuthErrorMessage.idTokenNotParsed.desc+" Failed with error: "+e)},t.createTokenEncodingError=function(e){return new t(ClientAuthErrorMessage.tokenEncodingError.code,ClientAuthErrorMessage.tokenEncodingError.desc+" Attempted to decode: "+e)},t}(AuthError),base64=createCommonjsModule(function(module,exports){!function(e,t){module.exports=t(e)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:commonjsGlobal,function(global){global=global||{};var _Base64=global.Base64,version="2.5.1",buffer;if(module.exports)try{buffer=eval("require('buffer').Buffer")}catch(e){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(e){for(var t={},r=0,n=e.length;r<n;r++)t[e.charAt(r)]=r;return t}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?fromCharCode(192|t>>>6)+fromCharCode(128|63&t):fromCharCode(224|t>>>12&15)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|t>>>18&7)+fromCharCode(128|t>>>12&63)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[b64chars.charAt(r>>>18),b64chars.charAt(r>>>12&63),t>=2?"=":b64chars.charAt(r>>>6&63),t>=1?"=":b64chars.charAt(63&r)].join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e)).toString("base64")}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e)).toString("base64")}:function(e){return btoa(utob(e))},encode=function(e,t){return t?_encode(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):_encode(String(e))},encodeURI=function(e){return encode(e,!0)},re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),cb_btou=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return fromCharCode(55296+(t>>>10))+fromCharCode(56320+(1023&t));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var t=e.length,r=t%4,n=(t>0?b64tab[e.charAt(0)]<<18:0)|(t>1?b64tab[e.charAt(1)]<<12:0)|(t>2?b64tab[e.charAt(2)]<<6:0)|(t>3?b64tab[e.charAt(3)]:0),o=[fromCharCode(n>>>16),fromCharCode(n>>>8&255),fromCharCode(255&n)];return o.length-=[0,0,2,1][r],o.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"==typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(e){return encode(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),module.exports&&(module.exports.Base64=global.Base64),{Base64:global.Base64}})}),base64_1=base64.Base64,Utils=function(){function e(){}return e.compareAccounts=function(e,t){return!(!e||!t)&&!(!e.homeAccountIdentifier||!t.homeAccountIdentifier||e.homeAccountIdentifier!==t.homeAccountIdentifier)},e.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},e.getLibraryVersion=function(){return Library.version},e.createNewGuid=function(){var t=window.crypto;if(t&&t.getRandomValues){var r=new Uint8Array(16);return t.getRandomValues(r),r[6]|=64,r[6]&=79,r[8]|=128,r[8]&=191,e.decimalToHex(r[0])+e.decimalToHex(r[1])+e.decimalToHex(r[2])+e.decimalToHex(r[3])+"-"+e.decimalToHex(r[4])+e.decimalToHex(r[5])+"-"+e.decimalToHex(r[6])+e.decimalToHex(r[7])+"-"+e.decimalToHex(r[8])+e.decimalToHex(r[9])+"-"+e.decimalToHex(r[10])+e.decimalToHex(r[11])+e.decimalToHex(r[12])+e.decimalToHex(r[13])+e.decimalToHex(r[14])+e.decimalToHex(r[15])}for(var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",o="0123456789abcdef",i=0,a="",s=0;s<36;s++)"-"!==n[s]&&"4"!==n[s]&&(i=16*Math.random()|0),"x"===n[s]?a+=o[i]:"y"===n[s]?(i&=3,a+=o[i|=8]):a+=n[s];return a},e.expiresIn=function(e){return e||(e="3599"),this.now()+parseInt(e,10)},e.now=function(){return Math.round((new Date).getTime()/1e3)},e.isEmpty=function(e){return void 0===e||!e||0===e.length},e.decodeJwt=function(e){if(this.isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(e);return!t||t.length<4?null:{header:t[1],JWSPayload:t[2],JWSSig:t[3]}},e.extractIdToken=function(e){var t=this.decodeJwt(e);if(!t)return null;try{var r=t.JWSPayload,n=this.base64DecodeStringUrlSafe(r);return n?JSON.parse(n):null}catch(e){}return null},e.base64EncodeStringUrlSafe=function(e){return base64_1.encode(e)},e.base64DecodeStringUrlSafe=function(e){return e=e.replace(/-/g,"+").replace(/_/g,"/"),decodeURIComponent(encodeURIComponent(base64_1.decode(e)))},e.encode=function(e){var t,r,n,o,i,a,s,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",l=0;for(e=this.utf8Encode(e);l<e.length;)o=(t=e.charCodeAt(l++))>>2,i=(3&t)<<4|(r=e.charCodeAt(l++))>>4,a=(15&r)<<2|(n=e.charCodeAt(l++))>>6,s=63&n,isNaN(r)?a=s=64:isNaN(n)&&(s=64),u=u+c.charAt(o)+c.charAt(i)+c.charAt(a)+c.charAt(s);return u.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},e.utf8Encode=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):n>127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t},e.decode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=(e=String(e).replace(/=+$/,"")).length;if(r%4==1)throw ClientAuthError.createTokenEncodingError(e);for(var n,o,i,a,s,c,u,l,d="",p=0;p<r;p+=4){if(n=t.indexOf(e.charAt(p)),o=t.indexOf(e.charAt(p+1)),i=t.indexOf(e.charAt(p+2)),a=t.indexOf(e.charAt(p+3)),p+2===r-1){c=(s=n<<18|o<<12|i<<6)>>16&255,u=s>>8&255,d+=String.fromCharCode(c,u);break}if(p+1===r-1){c=(s=n<<18|o<<12)>>16&255,d+=String.fromCharCode(c);break}c=(s=n<<18|o<<12|i<<6|a)>>16&255,u=s>>8&255,l=255&s,d+=String.fromCharCode(c,u,l)}return d},e.deserialize=function(e){var t,r=/\+/g,n=/([^&=]+)=([^&]*)/g,o=function(e){return decodeURIComponent(e.replace(r," "))},i={};for(t=n.exec(e);t;)i[o(t[1])]=o(t[2]),t=n.exec(e);return i},e.isIntersectingScopes=function(e,t){e=this.convertToLowerCase(e);for(var r=0;r<t.length;r++)if(e.indexOf(t[r].toLowerCase())>-1)return!0;return!1},e.containsScope=function(e,t){return e=this.convertToLowerCase(e),t.every(function(t){return e.indexOf(t.toString().toLowerCase())>=0})},e.convertToLowerCase=function(e){return e.map(function(e){return e.toLowerCase()})},e.removeElement=function(e,t){return e.filter(function(e){return e!==t})},e.getDefaultRedirectUri=function(){return window.location.href.split("?")[0].split("#")[0]},e.replaceTenantPath=function(e,t){e=e.toLowerCase();var r=this.GetUrlComponents(e),n=r.PathSegments;return!t||0===n.length||n[0]!==Constants$1.common&&n[0]!==SSOTypes.ORGANIZATIONS||(n[0]=t),this.constructAuthorityUriFromObject(r,n)},e.constructAuthorityUriFromObject=function(e,t){return this.CanonicalizeUri(e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/"))},e.GetUrlComponents=function(e){if(!e)throw"Url required";var t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),r=e.match(t);if(!r||r.length<6)throw"Valid url required";var n={Protocol:r[1],HostNameAndPort:r[4],AbsolutePath:r[5]},o=n.AbsolutePath.split("/");return o=o.filter(function(e){return e&&e.length>0}),n.PathSegments=o,n},e.CanonicalizeUri=function(t){return t&&(t=t.toLowerCase()),t&&!e.endsWith(t,"/")&&(t+="/"),t},e.endsWith=function(e,t){return!(!e||!t)&&-1!==e.indexOf(t,e.length-t.length)},e.urlRemoveQueryStringParameter=function(e,t){if(this.isEmpty(e))return e;var r=new RegExp("(\\&"+t+"=)[^&]+");return e=e.replace(r,""),r=new RegExp("("+t+"=)[^&]+&"),e=e.replace(r,""),r=new RegExp("("+t+"=)[^&]+"),e=e.replace(r,"")},e.constructUnifiedCacheQueryParameter=function(e,t){var r,n,o={};if(e)if(e.account){var i=e.account;i.sid?(r=SSOTypes.SID,n=i.sid):i.userName&&(r=SSOTypes.LOGIN_HINT,n=i.userName)}else e.sid?(r=SSOTypes.SID,n=e.sid):e.loginHint&&(r=SSOTypes.LOGIN_HINT,n=e.loginHint);else t&&(t.hasOwnProperty(Constants$1.upn)?(r=SSOTypes.ID_TOKEN,n=t.upn):(r=SSOTypes.ORGANIZATIONS,n=null));return o=this.addSSOParameter(r,n),e&&e.account&&e.account.homeAccountIdentifier&&(o=this.addSSOParameter(SSOTypes.HOMEACCOUNT_ID,e.account.homeAccountIdentifier,o)),o},e.addSSOParameter=function(t,r,n){if(n||(n={}),!r)return n;switch(t){case SSOTypes.SID:n[SSOTypes.SID]=r;break;case SSOTypes.ID_TOKEN:n[SSOTypes.LOGIN_HINT]=r,n[SSOTypes.DOMAIN_HINT]=SSOTypes.ORGANIZATIONS;break;case SSOTypes.LOGIN_HINT:n[SSOTypes.LOGIN_HINT]=r;break;case SSOTypes.ORGANIZATIONS:n[SSOTypes.DOMAIN_HINT]=SSOTypes.ORGANIZATIONS;break;case SSOTypes.CONSUMERS:n[SSOTypes.DOMAIN_HINT]=SSOTypes.CONSUMERS;break;case SSOTypes.HOMEACCOUNT_ID:var o=r.split("."),i=e.base64DecodeStringUrlSafe(o[0]),a=e.base64DecodeStringUrlSafe(o[1]);n[SSOTypes.LOGIN_REQ]=i,n[SSOTypes.DOMAIN_REQ]=a,a===Constants$1.consumersUtid?n[SSOTypes.DOMAIN_HINT]=SSOTypes.CONSUMERS:n[SSOTypes.DOMAIN_HINT]=SSOTypes.ORGANIZATIONS;break;case SSOTypes.LOGIN_REQ:n[SSOTypes.LOGIN_REQ]=r;break;case SSOTypes.DOMAIN_REQ:n[SSOTypes.DOMAIN_REQ]=r}return n},e.generateQueryParametersString=function(e){var t=null;return e&&Object.keys(e).forEach(function(r){null==t?t=r+"="+encodeURIComponent(e[r]):t+="&"+r+"="+encodeURIComponent(e[r])}),t},e.isSSOParam=function(e){return e&&(e.account||e.sid||e.loginHint)},e.setResponseIdToken=function(e,t){var r=__assign({},e);return r.idToken=t,r.idToken.objectId?r.uniqueId=r.idToken.objectId:r.uniqueId=r.idToken.subject,r.tenantId=r.idToken.tenantId,r},e}(),AccessTokenKey=function(e,t,r,n,o){this.authority=Utils.CanonicalizeUri(e),this.clientId=t,this.scopes=r,this.homeAccountIdentifier=Utils.base64EncodeStringUrlSafe(n)+"."+Utils.base64EncodeStringUrlSafe(o)},AccessTokenValue=function(e,t,r,n){this.accessToken=e,this.idToken=t,this.expiresIn=r,this.homeAccountIdentifier=n},ServerRequestParameters=function(){function e(e,t,r,n,o,i){this.authorityInstance=e,this.clientId=t,this.scopes=r,this.nonce=Utils.createNewGuid(),this.state=i&&!Utils.isEmpty(i)?Utils.createNewGuid()+"|"+i:Utils.createNewGuid(),this.correlationId=Utils.createNewGuid(),this.xClientSku="MSAL.JS",this.xClientVer=Utils.getLibraryVersion(),this.responseType=n,this.redirectUri=o}return Object.defineProperty(e.prototype,"authority",{get:function(){return this.authorityInstance?this.authorityInstance.CanonicalAuthority:null},enumerable:!0,configurable:!0}),e.prototype.createNavigateUrl=function(e){var t=this.createNavigationUrlString(e),r=this.authorityInstance.AuthorizationEndpoint;return r.indexOf("?")<0?r+="?":r+="&",""+r+t.join("&")},e.prototype.createNavigationUrlString=function(e){e||(e=[this.clientId]),-1===e.indexOf(this.clientId)&&e.push(this.clientId);var t=[];return t.push("response_type="+this.responseType),this.translateclientIdUsedInScope(e),t.push("scope="+encodeURIComponent(this.parseScope(e))),t.push("client_id="+encodeURIComponent(this.clientId)),t.push("redirect_uri="+encodeURIComponent(this.redirectUri)),t.push("state="+encodeURIComponent(this.state)),t.push("nonce="+encodeURIComponent(this.nonce)),t.push("client_info=1"),t.push("x-client-SKU="+this.xClientSku),t.push("x-client-Ver="+this.xClientVer),this.promptValue&&t.push("prompt="+encodeURIComponent(this.promptValue)),this.claimsValue&&t.push("claims="+encodeURIComponent(this.claimsValue)),this.queryParameters&&t.push(this.queryParameters),this.extraQueryParameters&&t.push(this.extraQueryParameters),t.push("client-request-id="+encodeURIComponent(this.correlationId)),t},e.prototype.translateclientIdUsedInScope=function(e){var t=e.indexOf(this.clientId);t>=0&&(e.splice(t,1),-1===e.indexOf("openid")&&e.push("openid"),-1===e.indexOf("profile")&&e.push("profile"))},e.prototype.parseScope=function(e){var t="";if(e)for(var r=0;r<e.length;++r)t+=r!==e.length-1?e[r]+" ":e[r];return t},e}(),ClientInfo=function(){function e(e){if(!e||Utils.isEmpty(e))return this.uid="",void(this.utid="");try{var t=Utils.base64DecodeStringUrlSafe(e),r=JSON.parse(t);r&&(r.hasOwnProperty("uid")&&(this.uid=r.uid),r.hasOwnProperty("utid")&&(this.utid=r.utid))}catch(e){throw ClientAuthError.createClientInfoDecodingError(e)}}return Object.defineProperty(e.prototype,"uid",{get:function(){return this._uid?this._uid:""},set:function(e){this._uid=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"utid",{get:function(){return this._utid?this._utid:""},set:function(e){this._utid=e},enumerable:!0,configurable:!0}),e}(),IdToken=function(e){if(Utils.isEmpty(e))throw ClientAuthError.createIdTokenNullOrEmptyError(e);try{this.rawIdToken=e,this.decodedIdToken=Utils.extractIdToken(e),this.decodedIdToken&&(this.decodedIdToken.hasOwnProperty("iss")&&(this.issuer=this.decodedIdToken.iss),this.decodedIdToken.hasOwnProperty("oid")&&(this.objectId=this.decodedIdToken.oid),this.decodedIdToken.hasOwnProperty("sub")&&(this.subject=this.decodedIdToken.sub),this.decodedIdToken.hasOwnProperty("tid")&&(this.tenantId=this.decodedIdToken.tid),this.decodedIdToken.hasOwnProperty("ver")&&(this.version=this.decodedIdToken.ver),this.decodedIdToken.hasOwnProperty("preferred_username")&&(this.preferredName=this.decodedIdToken.preferred_username),this.decodedIdToken.hasOwnProperty("name")&&(this.name=this.decodedIdToken.name),this.decodedIdToken.hasOwnProperty("nonce")&&(this.nonce=this.decodedIdToken.nonce),this.decodedIdToken.hasOwnProperty("exp")&&(this.expiration=this.decodedIdToken.exp),this.decodedIdToken.hasOwnProperty("home_oid")&&(this.homeObjectId=this.decodedIdToken.home_oid),this.decodedIdToken.hasOwnProperty("sid")&&(this.sid=this.decodedIdToken.sid))}catch(e){throw ClientAuthError.createIdTokenParsingError(e)}},AccessTokenCacheItem=function(e,t){this.key=e,this.value=t},ClientConfigurationErrorMessage={configurationNotSet:{code:"no_config_set",desc:"Configuration has not been set. Please call the UserAgentApplication constructor with a valid Configuration object."},invalidCacheLocation:{code:"invalid_cache_location",desc:"The cache location provided is not valid."},noStorageSupported:{code:"browser_storage_not_supported",desc:"localStorage and sessionStorage are not supported."},noRedirectCallbacksSet:{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."},invalidCallbackObject:{code:"invalid_callback_object",desc:"The object passed for the callback was invalid. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},scopesRequired:{code:"scopes_required",desc:"Scopes are required to obtain an access token."},emptyScopes:{code:"empty_input_scopes_error",desc:"Scopes cannot be passed as empty array."},nonArrayScopes:{code:"nonarray_input_scopes_error",desc:"Scopes cannot be passed as non-array."},clientScope:{code:"clientid_input_scopes_error",desc:"Client ID can only be provided as a single scope."},invalidPrompt:{code:"invalid_prompt_value",desc:"Supported prompt values are 'login', 'select_account', 'consent' and 'none'"},invalidAuthorityType:{code:"invalid_authority_type",desc:"The given authority is not a valid type of authority supported by MSAL. Please see here for valid authorities: <insert URL here>."},authorityUriInsecure:{code:"authority_uri_insecure",desc:"Authority URIs must use https."},authorityUriInvalidPath:{code:"authority_uri_invalid_path",desc:"Given authority URI is invalid."},unsupportedAuthorityValidation:{code:"unsupported_authority_validation",desc:"The authority validation is not supported for this authority type."},b2cAuthorityUriInvalidPath:{code:"b2c_authority_uri_invalid_path",desc:"The given URI for the B2C authority is invalid."},claimsRequestParsingError:{code:"claims_request_parsing_error",desc:"Could not parse the given claims request object."}},ClientConfigurationError=function(e){function t(r,n){var o=e.call(this,r,n)||this;return o.name="ClientConfigurationError",Object.setPrototypeOf(o,t.prototype),o}return __extends(t,e),t.createNoSetConfigurationError=function(){return new t(ClientConfigurationErrorMessage.configurationNotSet.code,""+ClientConfigurationErrorMessage.configurationNotSet.desc)},t.createInvalidCacheLocationConfigError=function(e){return new t(ClientConfigurationErrorMessage.invalidCacheLocation.code,ClientConfigurationErrorMessage.invalidCacheLocation.desc+" Provided value: "+e+". Possible values are: "+Constants$1.cacheLocationLocal+", "+Constants$1.cacheLocationSession+".")},t.createNoStorageSupportedError=function(){return new t(ClientConfigurationErrorMessage.noStorageSupported.code,ClientConfigurationErrorMessage.noStorageSupported.desc)},t.createRedirectCallbacksNotSetError=function(){return new t(ClientConfigurationErrorMessage.noRedirectCallbacksSet.code,ClientConfigurationErrorMessage.noRedirectCallbacksSet.desc)},t.createInvalidCallbackObjectError=function(e){return new t(ClientConfigurationErrorMessage.invalidCallbackObject.code,ClientConfigurationErrorMessage.invalidCallbackObject.desc+" Given value for callback function: "+e)},t.createEmptyScopesArrayError=function(e){return new t(ClientConfigurationErrorMessage.emptyScopes.code,ClientConfigurationErrorMessage.emptyScopes.desc+" Given value: "+e+".")},t.createScopesNonArrayError=function(e){return new t(ClientConfigurationErrorMessage.nonArrayScopes.code,ClientConfigurationErrorMessage.nonArrayScopes.desc+" Given value: "+e+".")},t.createClientIdSingleScopeError=function(e){return new t(ClientConfigurationErrorMessage.clientScope.code,ClientConfigurationErrorMessage.clientScope.desc+" Given value: "+e+".")},t.createScopesRequiredError=function(e){return new t(ClientConfigurationErrorMessage.scopesRequired.code,ClientConfigurationErrorMessage.scopesRequired.desc+" Given value: "+e)},t.createInvalidPromptError=function(e){return new t(ClientConfigurationErrorMessage.invalidPrompt.code,ClientConfigurationErrorMessage.invalidPrompt.desc+" Given value: "+e)},t.createClaimsRequestParsingError=function(e){return new t(ClientConfigurationErrorMessage.claimsRequestParsingError.code,ClientConfigurationErrorMessage.claimsRequestParsingError.desc+" Given value: "+e)},t}(ClientAuthError),Storage=function(){function e(t){if(e.instance)return e.instance;if(this.cacheLocation=t,this.localStorageSupported=void 0!==window[this.cacheLocation]&&null!=window[this.cacheLocation],this.sessionStorageSupported=void 0!==window[t]&&null!=window[t],e.instance=this,!this.localStorageSupported&&!this.sessionStorageSupported)throw ClientConfigurationError.createNoStorageSupportedError();return e.instance}return e.prototype.setItem=function(e,t,r){window[this.cacheLocation]&&window[this.cacheLocation].setItem(e,t),r&&this.setItemCookie(e,t)},e.prototype.getItem=function(e,t){return t&&this.getItemCookie(e)?this.getItemCookie(e):window[this.cacheLocation]?window[this.cacheLocation].getItem(e):null},e.prototype.removeItem=function(e){if(window[this.cacheLocation])return window[this.cacheLocation].removeItem(e)},e.prototype.clear=function(){if(window[this.cacheLocation])return window[this.cacheLocation].clear()},e.prototype.getAllAccessTokens=function(e,t){var r,n=[],o=window[this.cacheLocation];if(o){var i=void 0;for(i in o)if(o.hasOwnProperty(i)&&i.match(e)&&i.match(t)){var a=this.getItem(i);a&&(r=new AccessTokenCacheItem(JSON.parse(i),JSON.parse(a)),n.push(r))}}return n},e.prototype.removeAcquireTokenEntries=function(e){var t=window[this.cacheLocation];if(t){var r=void 0;for(r in t)if(t.hasOwnProperty(r)&&!(-1===r.indexOf(CacheKeys.AUTHORITY)&&1===r.indexOf(CacheKeys.ACQUIRE_TOKEN_ACCOUNT)||e&&-1===r.indexOf(e))){var n=r.split(Constants$1.resourceDelimiter),o=void 0;n.length>1&&(o=n[1]),o&&!this.tokenRenewalInProgress(o)&&(this.removeItem(r),this.removeItem(Constants$1.renewStatus+o),this.removeItem(Constants$1.stateLogin),this.removeItem(Constants$1.stateAcquireToken),this.setItemCookie(r,"",-1))}}this.clearCookie()},e.prototype.tokenRenewalInProgress=function(e){var t=window[this.cacheLocation][Constants$1.renewStatus+e];return!(!t||t!==Constants$1.tokenRenewStatusInProgress)},e.prototype.resetCacheItems=function(){var e=window[this.cacheLocation];if(e){var t=void 0;for(t in e)e.hasOwnProperty(t)&&-1!==t.indexOf(Constants$1.msal)&&this.removeItem(t);this.removeAcquireTokenEntries()}},e.prototype.setItemCookie=function(e,t,r){var n=e+"="+t+";";r&&(n+="expires="+this.getCookieExpirationTime(r)+";");document.cookie=n},e.prototype.getItemCookie=function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var o=r[n];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""},e.prototype.getCookieExpirationTime=function(e){var t=new Date;return new Date(t.getTime()+24*e*60*60*1e3).toUTCString()},e.prototype.clearCookie=function(){this.setItemCookie(Constants$1.nonceIdToken,"",-1),this.setItemCookie(Constants$1.stateLogin,"",-1),this.setItemCookie(Constants$1.loginRequest,"",-1),this.setItemCookie(Constants$1.stateAcquireToken,"",-1)},e.generateAcquireTokenAccountKey=function(e,t){return CacheKeys.ACQUIRE_TOKEN_ACCOUNT+Constants$1.resourceDelimiter+""+e+Constants$1.resourceDelimiter+t},e.generateAuthorityKey=function(e){return CacheKeys.AUTHORITY+Constants$1.resourceDelimiter+""+e},e}(),Account=function(){function e(e,t,r,n,o,i,a){this.accountIdentifier=e,this.homeAccountIdentifier=t,this.userName=r,this.name=n,this.idToken=o,this.sid=i,this.environment=a}return e.createAccount=function(t,r){var n,o=t.objectId||t.subject,i=r?r.uid:"",a=r?r.utid:"";return Utils.isEmpty(i)||Utils.isEmpty(a)||(n=Utils.base64EncodeStringUrlSafe(i)+"."+Utils.base64EncodeStringUrlSafe(a)),new e(o,n,t.preferredName,t.name,t.decodedIdToken,t.sid,t.issuer)},e}(),XhrClient=function(){function e(){}return e.prototype.sendRequestAsync=function(e,t,r){var n=this;return new Promise(function(r,o){var i=new XMLHttpRequest;if(i.open(t,e,!0),i.onload=function(e){(i.status<200||i.status>=300)&&o(n.handleError(i.responseText));try{var t=JSON.parse(i.responseText)}catch(e){o(n.handleError(i.responseText))}r(t)},i.onerror=function(e){o(i.status)},"GET"!==t)throw"not implemented";i.send()})},e.prototype.handleError=function(e){var t;try{if((t=JSON.parse(e)).error)return t.error;throw e}catch(t){return e}},e}(),AuthorityType;!function(e){e[e.Aad=0]="Aad",e[e.Adfs=1]="Adfs",e[e.B2C=2]="B2C"}(AuthorityType||(AuthorityType={}));var Authority=function(){function e(e,t){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri()}return Object.defineProperty(e.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),e.prototype.validateResolved=function(){if(!this.tenantDiscoveryResponse)throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(e.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=Utils.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=Utils.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.CanonicalAuthority+"v2.0/.well-known/openid-configuration"},enumerable:!0,configurable:!0}),e.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch(e){throw ClientConfigurationErrorMessage.invalidAuthorityType}if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw ClientConfigurationErrorMessage.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw ClientConfigurationErrorMessage.authorityUriInvalidPath},e.prototype.DiscoverEndpoints=function(e){return(new XhrClient).sendRequestAsync(e,"GET",!0).then(function(e){return{AuthorizationEndpoint:e.authorization_endpoint,EndSessionEndpoint:e.end_session_endpoint,Issuer:e.issuer}})},e.prototype.resolveEndpointsAsync=function(){var e=this,t="";return this.GetOpenIdConfigurationEndpointAsync().then(function(r){return t=r,e.DiscoverEndpoints(t)}).then(function(t){return e.tenantDiscoveryResponse=t,e})},e}(),AadAuthority=function(e){function t(t,r){return e.call(this,t,r)||this}return __extends(t,e),Object.defineProperty(t.prototype,"AadInstanceDiscoveryEndpointUrl",{get:function(){return t.AadInstanceDiscoveryEndpoint+"?api-version=1.0&authorization_endpoint="+this.CanonicalAuthority+"oauth2/v2.0/authorize"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"AuthorityType",{get:function(){return AuthorityType.Aad},enumerable:!0,configurable:!0}),t.prototype.GetOpenIdConfigurationEndpointAsync=function(){var e=this,t=new Promise(function(t,r){return t(e.DefaultOpenIdConfigurationEndpoint)});if(!this.IsValidationEnabled)return t;var r=this.CanonicalAuthorityUrlComponents.HostNameAndPort;return this.IsInTrustedHostList(r)?t:(new XhrClient).sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl,"GET",!0).then(function(e){return e.tenant_discovery_endpoint})},t.prototype.IsInTrustedHostList=function(e){return t.TrustedHostList[e.toLowerCase()]},t.AadInstanceDiscoveryEndpoint="https://login.microsoftonline.com/common/discovery/instance",t.TrustedHostList={"login.windows.net":"login.windows.net","login.chinacloudapi.cn":"login.chinacloudapi.cn","login.cloudgovapi.us":"login.cloudgovapi.us","login.microsoftonline.com":"login.microsoftonline.com","login.microsoftonline.de":"login.microsoftonline.de","login.microsoftonline.us":"login.microsoftonline.us"},t}(Authority),B2cAuthority=function(e){function t(t,r){var n=e.call(this,t,r)||this,o=Utils.GetUrlComponents(t),i=o.PathSegments;if(i.length<3)throw ClientConfigurationErrorMessage.b2cAuthorityUriInvalidPath;return n.CanonicalAuthority="https://"+o.HostNameAndPort+"/"+i[0]+"/"+i[1]+"/"+i[2]+"/",n}return __extends(t,e),Object.defineProperty(t.prototype,"AuthorityType",{get:function(){return AuthorityType.B2C},enumerable:!0,configurable:!0}),t.prototype.GetOpenIdConfigurationEndpointAsync=function(){var e=this,t=new Promise(function(t,r){return t(e.DefaultOpenIdConfigurationEndpoint)});return this.IsValidationEnabled?this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)?t:new Promise(function(e,t){return t(ClientConfigurationErrorMessage.unsupportedAuthorityValidation)}):t},t}(AadAuthority),AuthorityFactory=function(){function e(){}return e.DetectAuthorityFromUrl=function(e){switch(e=Utils.CanonicalizeUri(e),Utils.GetUrlComponents(e).PathSegments[0]){case"tfp":return AuthorityType.B2C;case"adfs":return AuthorityType.Adfs;default:return AuthorityType.Aad}},e.CreateInstance=function(t,r){if(Utils.isEmpty(t))return null;switch(e.DetectAuthorityFromUrl(t)){case AuthorityType.B2C:return new B2cAuthority(t,r);case AuthorityType.Aad:return new AadAuthority(t,r);default:throw ClientConfigurationErrorMessage.invalidAuthorityType}},e}(),LogLevel;!function(e){e[e.Error=0]="Error",e[e.Warning=1]="Warning",e[e.Info=2]="Info",e[e.Verbose=3]="Verbose"}(LogLevel||(LogLevel={}));var Logger=function(){function e(e,t){void 0===t&&(t={}),this.level=LogLevel.Info;var r=t.correlationId,n=void 0===r?"":r,o=t.level,i=void 0===o?LogLevel.Info:o,a=t.piiLoggingEnabled,s=void 0!==a&&a;this.localCallback=e,this.correlationId=n,this.level=i,this.piiLoggingEnabled=s}return e.prototype.logMessage=function(e,t,r){if(!(e>this.level||!this.piiLoggingEnabled&&r)){var n,o=(new Date).toUTCString();n=Utils.isEmpty(this.correlationId)?o+":"+Utils.getLibraryVersion()+"-"+LogLevel[e]+" "+t:o+":"+this.correlationId+"-"+Utils.getLibraryVersion()+"-"+LogLevel[e]+" "+t,this.executeCallback(e,n,r)}},e.prototype.executeCallback=function(e,t,r){this.localCallback&&this.localCallback(e,t,r)},e.prototype.error=function(e){this.logMessage(LogLevel.Error,e,!1)},e.prototype.errorPii=function(e){this.logMessage(LogLevel.Error,e,!0)},e.prototype.warning=function(e){this.logMessage(LogLevel.Warning,e,!1)},e.prototype.warningPii=function(e){this.logMessage(LogLevel.Warning,e,!0)},e.prototype.info=function(e){this.logMessage(LogLevel.Info,e,!1)},e.prototype.infoPii=function(e){this.logMessage(LogLevel.Info,e,!0)},e.prototype.verbose=function(e){this.logMessage(LogLevel.Verbose,e,!1)},e.prototype.verbosePii=function(e){this.logMessage(LogLevel.Verbose,e,!0)},e}(),FRAME_TIMEOUT=6e3,OFFSET=300,NAVIGATE_FRAME_WAIT=500,DEFAULT_AUTH_OPTIONS={clientId:"",authority:null,validateAuthority:!0,redirectUri:function(){return Utils.getDefaultRedirectUri()},postLogoutRedirectUri:function(){return Utils.getDefaultRedirectUri()},navigateToLoginRequestUrl:!0},DEFAULT_CACHE_OPTIONS={cacheLocation:"sessionStorage",storeAuthStateInCookie:!1},DEFAULT_SYSTEM_OPTIONS={logger:new Logger(null),loadFrameTimeout:FRAME_TIMEOUT,tokenRenewalOffsetSeconds:OFFSET,navigateFrameWait:NAVIGATE_FRAME_WAIT},DEFAULT_FRAMEWORK_OPTIONS={isAngular:!1,unprotectedResources:new Array,protectedResourceMap:new Map};function buildConfiguration(e){var t=e.auth,r=e.cache,n=void 0===r?{}:r,o=e.system,i=void 0===o?{}:o,a=e.framework,s=void 0===a?{}:a;return{auth:__assign({},DEFAULT_AUTH_OPTIONS,t),cache:__assign({},DEFAULT_CACHE_OPTIONS,n),system:__assign({},DEFAULT_SYSTEM_OPTIONS,i),framework:__assign({},DEFAULT_FRAMEWORK_OPTIONS,s)}}function validateClaimsRequest(e){if(e.claimsRequest)try{JSON.parse(e.claimsRequest)}catch(e){throw ClientConfigurationError.createClaimsRequestParsingError(e)}}var ServerErrorMessage={serverUnavailable:{code:"server_unavailable",desc:"Server is temporarily unavailable."},unknownServerError:{code:"unknown_server_error"}},ServerError=function(e){function t(r,n){var o=e.call(this,r,n)||this;return o.name="ServerError",Object.setPrototypeOf(o,t.prototype),o}return __extends(t,e),t.createServerUnavailableError=function(){return new t(ServerErrorMessage.serverUnavailable.code,ServerErrorMessage.serverUnavailable.desc)},t.createUnknownServerError=function(e){return new t(ServerErrorMessage.unknownServerError.code,e)},t}(AuthError),InteractionRequiredAuthErrorMessage={loginRequired:{code:"login_required"},interactionRequired:{code:"interaction_required"},consentRequired:{code:"consent_required"}},InteractionRequiredAuthError=function(e){function t(r,n){var o=e.call(this,r,n)||this;return o.name="InteractionRequiredAuthError",Object.setPrototypeOf(o,t.prototype),o}return __extends(t,e),t.createLoginRequiredAuthError=function(e){return new t(InteractionRequiredAuthErrorMessage.loginRequired.code,e)},t.createInteractionRequiredAuthError=function(e){return new t(InteractionRequiredAuthErrorMessage.interactionRequired.code,e)},t.createConsentRequiredAuthError=function(e){return new t(InteractionRequiredAuthErrorMessage.consentRequired.code,e)},t}(ServerError);function buildResponseStateOnly(e){return{uniqueId:"",tenantId:"",tokenType:"",idToken:null,accessToken:"",scopes:null,expiresOn:null,account:null,accountState:e}}var DEFAULT_AUTHORITY="https://login.microsoftonline.com/common",ResponseTypes={id_token:"id_token",token:"token",id_token_token:"id_token token"},resolveTokenOnlyIfOutOfIframe=function(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.isInIframe()?new Promise(function(){}):n.apply(this,e)},r},UserAgentApplication=function(){function e(e){this.authResponseCallback=null,this.tokenReceivedCallback=null,this.errorReceivedCallback=null,this.config=buildConfiguration(e),this.redirectCallbacksSet=!1,this.logger=this.config.system.logger,this.clientId=this.config.auth.clientId,this.inCookie=this.config.cache.storeAuthStateInCookie,this.authority=this.config.auth.authority||DEFAULT_AUTHORITY,this.loginInProgress=!1,this.acquireTokenInProgress=!1;try{this.cacheStorage=new Storage(this.config.cache.cacheLocation)}catch(e){throw ClientConfigurationError.createInvalidCacheLocationConfigError(this.config.cache.cacheLocation)}window.openedWindows=[],window.activeRenewals={},window.renewStates=[],window.callbackMappedToRenewStates={},window.promiseMappedToRenewStates={},window.msal=this;var t=window.location.hash,r=this.isCallback(t);this.config.framework.isAngular||r&&this.handleAuthenticationResponse(t)}return Object.defineProperty(e.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},set:function(e){this.authorityInstance=AuthorityFactory.CreateInstance(e,this.config.auth.validateAuthority)},enumerable:!0,configurable:!0}),e.prototype.getAuthorityInstance=function(){return this.authorityInstance},e.prototype.handleRedirectCallback=function(e,t){if(!e)throw this.redirectCallbacksSet=!1,ClientConfigurationError.createInvalidCallbackObjectError(e);if(t?(this.tokenReceivedCallback=e,this.errorReceivedCallback=t,this.logger.warning("This overload for callback is deprecated - please change the format of the callbacks to a single callback as shown: (err: AuthError, response: AuthResponse).")):this.authResponseCallback=e,this.redirectCallbacksSet=!0,!this.config.framework.isAngular){var r=this.cacheStorage.getItem(Constants$1.urlHash);r&&this.processCallBack(r,null)}},e.prototype.redirectSuccessHandler=function(e){this.errorReceivedCallback?this.tokenReceivedCallback(e):this.authResponseCallback&&this.authResponseCallback(null,e)},e.prototype.redirectErrorHandler=function(e,t){this.errorReceivedCallback?this.errorReceivedCallback(e,t.accountState):this.authResponseCallback(e,t)},e.prototype.loginRedirect=function(e){var t=this;if(!this.redirectCallbacksSet)throw ClientConfigurationError.createRedirectCallbacksNotSetError();if(this.loginInProgress)this.redirectErrorHandler(ClientAuthError.createLoginInProgressError(),buildResponseStateOnly(e&&e.state));else{var r=this.appendScopes(e);this.validateInputScope(r,!1);var n=this.getAccount();if(Utils.isSSOParam(e))this.loginRedirectHelper(n,e,r);else if(this.extractADALIdToken()&&!r){this.logger.info("ADAL's idToken exists. Extracting login information from ADAL's idToken ");var o=this.buildIDTokenRequest(e);this.silentLogin=!0,this.acquireTokenSilent(o).then(function(e){t.silentLogin=!1,t.logger.info("Unified cache call is successful"),t.redirectCallbacksSet&&t.redirectSuccessHandler(e)},function(n){t.silentLogin=!1,t.logger.error("Error occurred during unified cache ATS"),t.loginRedirectHelper(null,e,r)})}else this.loginRedirectHelper(null,e,r)}},e.prototype.loginRedirectHelper=function(e,t,r){var n=this;this.loginInProgress=!0,this.authorityInstance.resolveEndpointsAsync().then(function(){var o=new ServerRequestParameters(n.authorityInstance,n.clientId,r,ResponseTypes.id_token,n.getRedirectUri(),t&&t.state);o=n.populateQueryParams(e,t,o);var i=n.cacheStorage.getItem(Constants$1.angularLoginRequest);i&&""!==i?n.cacheStorage.setItem(Constants$1.angularLoginRequest,""):i=window.location.href,n.updateCacheEntries(o,e,i);var a=o.createNavigateUrl(r)+Constants$1.response_mode_fragment;n.promptUser(a)}).catch(function(e){n.logger.warning("could not resolve endpoints"),n.redirectErrorHandler(ClientAuthError.createEndpointResolutionError(e.toString),buildResponseStateOnly(t&&t.state))})},e.prototype.acquireTokenRedirect=function(e){var t=this;if(!this.redirectCallbacksSet)throw ClientConfigurationError.createRedirectCallbacksNotSetError();this.validateInputScope(e.scopes,!0);var r=e.account||this.getAccount();if(this.acquireTokenInProgress)this.redirectErrorHandler(ClientAuthError.createAcquireTokenInProgressError(),buildResponseStateOnly(this.getAccountState(e.state)));else{if(!r&&!e.sid&&!e.loginHint)throw this.logger.info("User login is required"),ClientAuthError.createUserLoginRequiredError();var n,o=e.authority?AuthorityFactory.CreateInstance(e.authority,this.config.auth.validateAuthority):this.authorityInstance;this.acquireTokenInProgress=!0,o.resolveEndpointsAsync().then(function(){var i=t.getTokenType(r,e.scopes,!1);n=new ServerRequestParameters(o,t.clientId,e.scopes,i,t.getRedirectUri(),e.state),t.updateCacheEntries(n,r);var a=(n=t.populateQueryParams(r,e,n)).createNavigateUrl(e.scopes)+Constants$1.response_mode_fragment;a&&(t.cacheStorage.setItem(Constants$1.stateAcquireToken,n.state,t.inCookie),window.location.replace(a))}).catch(function(r){t.logger.warning("could not resolve endpoints"),t.redirectErrorHandler(ClientAuthError.createEndpointResolutionError(r.toString),buildResponseStateOnly(e.state))})}},e.prototype.isCallback=function(e){e=this.getHash(e);var t=Utils.deserialize(e);return t.hasOwnProperty(Constants$1.errorDescription)||t.hasOwnProperty(Constants$1.error)||t.hasOwnProperty(Constants$1.accessToken)||t.hasOwnProperty(Constants$1.idToken)},e.prototype.loginPopup=function(e){var t=this;return new Promise(function(r,n){if(t.loginInProgress)return n(ClientAuthError.createLoginInProgressError());var o=t.appendScopes(e);t.validateInputScope(o,!1);var i=t.getAccount();if(Utils.isSSOParam(e))t.loginPopupHelper(i,r,n,e,o);else if(t.extractADALIdToken()&&!o){t.logger.info("ADAL's idToken exists. Extracting login information from ADAL's idToken ");var a=t.buildIDTokenRequest(e);t.silentLogin=!0,t.acquireTokenSilent(a).then(function(e){t.silentLogin=!1,t.logger.info("Unified cache call is successful"),r(e)},function(i){t.silentLogin=!1,t.logger.error("Error occurred during unified cache ATS"),t.loginPopupHelper(null,r,n,e,o)})}else t.loginPopupHelper(null,r,n,e,o)})},e.prototype.loginPopupHelper=function(e,t,r,n,o){var i=this;o||(o=[this.clientId]);var a=o.join(" ").toLowerCase(),s=this.openWindow("about:blank","_blank",1,this,t,r);s&&(this.loginInProgress=!0,this.authorityInstance.resolveEndpointsAsync().then(function(){var c=new ServerRequestParameters(i.authorityInstance,i.clientId,o,ResponseTypes.id_token,i.getRedirectUri(),n&&n.state);c=i.populateQueryParams(e,n,c),i.updateCacheEntries(c,e,window.location.href),i.cacheStorage.setItem(Constants$1.loginRequest,window.location.href,i.inCookie),i.cacheStorage.setItem(Constants$1.loginError,""),i.cacheStorage.setItem(Constants$1.nonceIdToken,c.nonce,i.inCookie),i.cacheStorage.setItem(Constants$1.msalError,""),i.cacheStorage.setItem(Constants$1.msalErrorDescription,""),i.setAuthorityCache(c.state,i.authority);var u=c.createNavigateUrl(o)+Constants$1.response_mode_fragment;window.renewStates.push(c.state),window.requestType=Constants$1.login,i.registerCallback(c.state,a,t,r),s&&(i.logger.infoPii("Navigated Popup window to:"+u),s.location.href=u)},function(){i.logger.info(ClientAuthErrorMessage.endpointResolutionError.code+":"+ClientAuthErrorMessage.endpointResolutionError.desc),i.cacheStorage.setItem(Constants$1.msalError,ClientAuthErrorMessage.endpointResolutionError.code),i.cacheStorage.setItem(Constants$1.msalErrorDescription,ClientAuthErrorMessage.endpointResolutionError.desc),r&&r(ClientAuthError.createEndpointResolutionError()),s&&s.close()}).catch(function(e){i.logger.warning("could not resolve endpoints"),r(ClientAuthError.createEndpointResolutionError(e.toString))}))},e.prototype.acquireTokenPopup=function(e){var t=this;return new Promise(function(r,n){t.validateInputScope(e.scopes,!0);var o,i=e.scopes.join(" ").toLowerCase(),a=e.account||t.getAccount();if(t.acquireTokenInProgress)return n(ClientAuthError.createAcquireTokenInProgressError());if(!a&&!e.sid&&!e.loginHint)return t.logger.info("User login is required"),n(ClientAuthError.createUserLoginRequiredError());t.acquireTokenInProgress=!0;var s=e.authority?AuthorityFactory.CreateInstance(e.authority,t.config.auth.validateAuthority):t.authorityInstance,c=t.openWindow("about:blank","_blank",1,t,r,n);c&&s.resolveEndpointsAsync().then(function(){var u=t.getTokenType(a,e.scopes,!1);o=new ServerRequestParameters(s,t.clientId,e.scopes,u,t.getRedirectUri(),e.state),o=t.populateQueryParams(a,e,o),t.updateCacheEntries(o,a);var l=o.createNavigateUrl(e.scopes)+Constants$1.response_mode_fragment;window.renewStates.push(o.state),window.requestType=Constants$1.renewToken,t.registerCallback(o.state,i,r,n),c&&(c.location.href=l)},function(){t.logger.info(ClientAuthErrorMessage.endpointResolutionError.code+":"+ClientAuthErrorMessage.endpointResolutionError.desc),t.cacheStorage.setItem(Constants$1.msalError,ClientAuthErrorMessage.endpointResolutionError.code),t.cacheStorage.setItem(Constants$1.msalErrorDescription,ClientAuthErrorMessage.endpointResolutionError.desc),n&&n(ClientAuthError.createEndpointResolutionError()),c&&c.close()}).catch(function(e){t.logger.warning("could not resolve endpoints"),n(ClientAuthError.createEndpointResolutionError(e.toString()))})})},e.prototype.openWindow=function(e,t,r,n,o,i){var a,s=this;try{a=this.openPopup(e,t,Constants$1.popUpWidth,Constants$1.popUpHeight)}catch(e){return n.loginInProgress=!1,n.acquireTokenInProgress=!1,this.logger.info(ClientAuthErrorMessage.popUpWindowError.code+":"+ClientAuthErrorMessage.popUpWindowError.desc),this.cacheStorage.setItem(Constants$1.msalError,ClientAuthErrorMessage.popUpWindowError.code),this.cacheStorage.setItem(Constants$1.msalErrorDescription,ClientAuthErrorMessage.popUpWindowError.desc),i&&i(ClientAuthError.createPopupWindowError()),null}window.openedWindows.push(a);var c=window.setInterval(function(){if(a&&a.closed&&(n.loginInProgress||n.acquireTokenInProgress)){if(i&&i(ClientAuthError.createUserCancelledError()),window.clearInterval(c),s.config.framework.isAngular)return void s.broadcast("msal:popUpClosed",ClientAuthErrorMessage.userCancelledError.code+Constants$1.resourceDelimiter+ClientAuthErrorMessage.userCancelledError.desc);n.loginInProgress=!1,n.acquireTokenInProgress=!1}try{var e=a.location;if(-1!==e.href.indexOf(s.getRedirectUri())&&(window.clearInterval(c),n.loginInProgress=!1,n.acquireTokenInProgress=!1,s.logger.info("Closing popup window"),s.config.framework.isAngular)){s.broadcast("msal:popUpHashChanged",e.hash);for(var t=0;t<window.openedWindows.length;t++)window.openedWindows[t].close()}}catch(e){}},r);return a},e.prototype.openPopup=function(e,t,r,n){try{var o=window.screenLeft?window.screenLeft:window.screenX,i=window.screenTop?window.screenTop:window.screenY,a=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,s=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,c=a/2-r/2+o,u=s/2-n/2+i,l=window.open(e,t,"width="+r+", height="+n+", top="+u+", left="+c);if(!l)throw ClientAuthError.createPopupWindowError();return l.focus&&l.focus(),l}catch(e){throw this.logger.error("error opening popup "+e.message),this.loginInProgress=!1,this.acquireTokenInProgress=!1,ClientAuthError.createPopupWindowError(e.toString())}},e.prototype.acquireTokenSilent=function(e){var t=this;return new Promise(function(r,n){t.validateInputScope(e.scopes,!0);var o=e.scopes.join(" ").toLowerCase(),i=e.account||t.getAccount(),a=t.cacheStorage.getItem(Constants$1.adalIdToken);if(!i&&!e.sid&&!e.loginHint&&Utils.isEmpty(a))return t.logger.info("User login is required"),n(ClientAuthError.createUserLoginRequiredError());var s=t.getTokenType(i,e.scopes,!0),c=new ServerRequestParameters(AuthorityFactory.CreateInstance(e.authority,t.config.auth.validateAuthority),t.clientId,e.scopes,s,t.getRedirectUri(),e&&e.state);if(Utils.isSSOParam(e)||i)c=t.populateQueryParams(i,e,c);else if(!i&&!Utils.isEmpty(a)){var u=Utils.extractIdToken(a);t.logger.verbose("ADAL's idToken exists. Extracting login information from ADAL's idToken "),c=t.populateQueryParams(i,null,c,u)}var l,d,p=e.claimsRequest||c.claimsValue;if(!p)try{d=t.getCachedToken(c,i)}catch(e){l=e}return d?(t.logger.info("Token is already in cache for scope:"+o),r(d),null):l?(t.logger.infoPii(l.errorCode+":"+l.errorMessage),n(l),null):(p?t.logger.verbose("Skipped cache lookup since claims were given."):t.logger.verbose("Token is not in cache for scope:"+o),c.authorityInstance||(c.authorityInstance=e.authority?AuthorityFactory.CreateInstance(e.authority,t.config.auth.validateAuthority):t.authorityInstance),c.authorityInstance.resolveEndpointsAsync().then(function(){window.activeRenewals[o]?(t.logger.verbose("Renew token for scope: "+o+" is in progress. Registering callback"),t.registerCallback(window.activeRenewals[o],o,r,n)):e.scopes&&e.scopes.indexOf(t.clientId)>-1&&1===e.scopes.length?(t.logger.verbose("renewing idToken"),t.renewIdToken(e.scopes,r,n,i,c)):(t.logger.verbose("renewing accesstoken"),t.renewToken(e.scopes,r,n,i,c))}).catch(function(e){return t.logger.warning("could not resolve endpoints"),n(ClientAuthError.createEndpointResolutionError(e.toString())),null}))})},e.prototype.isInIframe=function(){return window.parent!==window},e.prototype.parentIsMsal=function(){return window.parent!==window&&window.parent.msal},e.prototype.isInteractionRequired=function(e){return-1!==e.indexOf("interaction_required")||-1!==e.indexOf("consent_required")||-1!==e.indexOf("login_required")},e.prototype.loadIframeTimeout=function(e,t,r){var n=this,o=window.activeRenewals[r];this.logger.verbose("Set loading state to pending for: "+r+":"+o),this.cacheStorage.setItem(Constants$1.renewStatus+o,Constants$1.tokenRenewStatusInProgress),this.loadFrame(e,t),setTimeout(function(){n.cacheStorage.getItem(Constants$1.renewStatus+o)===Constants$1.tokenRenewStatusInProgress&&(n.logger.verbose("Loading frame has timed out after: "+n.config.system.loadFrameTimeout/1e3+" seconds for scope "+r+":"+o),o&&window.callbackMappedToRenewStates[o]&&window.callbackMappedToRenewStates[o](null,ClientAuthError.createTokenRenewalTimeoutError()),n.cacheStorage.setItem(Constants$1.renewStatus+o,Constants$1.tokenRenewStatusCancelled))},this.config.system.loadFrameTimeout)},e.prototype.loadFrame=function(e,t){var r=this;this.logger.info("LoadFrame: "+t);var n=t;setTimeout(function(){var o=r.addHiddenIFrame(n);""!==o.src&&"about:blank"!==o.src||(o.src=e,r.logger.infoPii("Frame Name : "+t+" Navigated to: "+e))},this.config.system.navigateFrameWait)},e.prototype.addHiddenIFrame=function(e){if(void 0===e)return null;this.logger.info("Add msal frame to document:"+e);var t=document.getElementById(e);if(!t){if(document.createElement&&document.documentElement&&-1===window.navigator.userAgent.indexOf("MSIE 5.0")){var r=document.createElement("iframe");r.setAttribute("id",e),r.style.visibility="hidden",r.style.position="absolute",r.style.width=r.style.height="0",r.style.border="0",t=document.getElementsByTagName("body")[0].appendChild(r)}else document.body&&document.body.insertAdjacentHTML&&document.body.insertAdjacentHTML("beforeend","<iframe name='"+e+"' id='"+e+"' style='display:none'></iframe>");window.frames&&window.frames[e]&&(t=window.frames[e])}return t},e.prototype.addHintParameters=function(e,t,r){var n=e||this.getAccount();if(n&&!t[SSOTypes.SID]){if(!t[SSOTypes.LOGIN_HINT]&&n.sid&&r.promptValue===PromptState.NONE)t=Utils.addSSOParameter(SSOTypes.SID,n.sid,t);else!t[SSOTypes.LOGIN_HINT]&&n.userName&&!Utils.isEmpty(n.userName)&&(t=Utils.addSSOParameter(SSOTypes.LOGIN_HINT,n.userName,t));!t[SSOTypes.DOMAIN_REQ]&&!t[SSOTypes.LOGIN_REQ]&&(t=Utils.addSSOParameter(SSOTypes.HOMEACCOUNT_ID,n.homeAccountIdentifier,t))}return t},e.prototype.promptUser=function(e){if(!e||Utils.isEmpty(e))throw this.logger.info("Navigate url is empty"),AuthError.createUnexpectedError("Navigate url is empty");this.logger.infoPii("Navigate to:"+e),window.location.replace(e)},e.prototype.registerCallback=function(e,t,r,n){var o=this;window.activeRenewals[t]=e,window.promiseMappedToRenewStates[e]||(window.promiseMappedToRenewStates[e]=[]),window.promiseMappedToRenewStates[e].push({resolve:r,reject:n}),window.callbackMappedToRenewStates[e]||(window.callbackMappedToRenewStates[e]=function(r,n){window.activeRenewals[t]=null;for(var i=0;i<window.promiseMappedToRenewStates[e].length;++i)try{if(n)window.promiseMappedToRenewStates[e][i].reject(n);else{if(!r)throw AuthError.createUnexpectedError("Error and response are both null");window.promiseMappedToRenewStates[e][i].resolve(r)}}catch(e){o.logger.warning(e)}window.promiseMappedToRenewStates[e]=null,window.callbackMappedToRenewStates[e]=null})},e.prototype.logout=function(){var e=this;this.clearCache(),this.account=null;var t="";this.getPostLogoutRedirectUri()&&(t="post_logout_redirect_uri="+encodeURIComponent(this.getPostLogoutRedirectUri())),this.authorityInstance.resolveEndpointsAsync().then(function(r){var n=r.EndSessionEndpoint?r.EndSessionEndpoint+"?"+t:e.authority+"oauth2/v2.0/logout?"+t;e.promptUser(n)})},e.prototype.clearCache=function(){window.renewStates=[];for(var e=this.cacheStorage.getAllAccessTokens(Constants$1.clientId,Constants$1.homeAccountIdentifier),t=0;t<e.length;t++)this.cacheStorage.removeItem(JSON.stringify(e[t].key));this.cacheStorage.resetCacheItems(),this.cacheStorage.clearCookie()},e.prototype.clearCacheForScope=function(e){for(var t=this.cacheStorage.getAllAccessTokens(Constants$1.clientId,Constants$1.homeAccountIdentifier),r=0;r<t.length;r++){var n=t[r];n.value.accessToken===e&&this.cacheStorage.removeItem(JSON.stringify(n.key))}},e.prototype.processCallBack=function(e,t,r){var n,o;this.logger.info("Processing the callback from redirect response"),t||(t=this.getResponseState(e));try{n=this.saveTokenFromHash(e,t)}catch(e){o=e}this.cacheStorage.removeItem(Constants$1.urlHash);try{this.cacheStorage.clearCookie();var i=this.getAccountState(t.state);if(n){if(t.requestType===Constants$1.renewToken||n.accessToken?(window.parent!==window?this.logger.verbose("Window is in iframe, acquiring token silently"):this.logger.verbose("acquiring token interactive in progress"),n.tokenType=Constants$1.accessToken):t.requestType===Constants$1.login&&(n.tokenType=Constants$1.idToken),!r)return void this.redirectSuccessHandler(n)}else if(!r)return void this.redirectErrorHandler(o,buildResponseStateOnly(i));r(n,o)}catch(e){throw this.logger.error("Error occurred in token received callback function: "+e),ClientAuthError.createErrorInCallbackFunction(e.toString())}},e.prototype.handleAuthenticationResponse=function(e){null==e&&(e=window.location.hash);var t=null,r=!1,n=!1;try{n=window.opener&&window.opener.msal&&window.opener.msal!==window.msal}catch(e){n=!1}n?(t=window.opener.msal,r=!0):window.parent&&window.parent.msal&&(t=window.parent.msal);var o=t.getResponseState(e),i=null;if(t.logger.info("Returned from redirect url"),this.parentIsMsal())i=window.parent.callbackMappedToRenewStates[o.state];else if(n)i=window.opener.callbackMappedToRenewStates[o.state];else{if(i=null,t.config.auth.navigateToLoginRequestUrl)return t.cacheStorage.setItem(Constants$1.urlHash,e),void(window.parent!==window||r||(window.location.href=t.cacheStorage.getItem(Constants$1.loginRequest,t.inCookie)));if(window.location.hash="",!this.redirectCallbacksSet)return void t.cacheStorage.setItem(Constants$1.urlHash,e)}if(t.processCallBack(e,o,i),n)for(var a=0;a<window.opener.openedWindows.length;a++)window.opener.openedWindows[a].close()},e.prototype.deserializeHash=function(e){return e=this.getHash(e),Utils.deserialize(e)},e.prototype.getResponseState=function(e){var t,r=this.deserializeHash(e);if(!r)throw AuthError.createUnexpectedError("Hash was not parsed correctly.");if(!r.hasOwnProperty("state"))throw AuthError.createUnexpectedError("Hash does not contain state.");if((t={requestType:Constants$1.unknown,state:r.state,stateMatch:!1}).state===this.cacheStorage.getItem(Constants$1.stateLogin,this.inCookie)||t.state===this.silentAuthenticationState)return t.requestType=Constants$1.login,t.stateMatch=!0,t;if(t.state===this.cacheStorage.getItem(Constants$1.stateAcquireToken,this.inCookie))return t.requestType=Constants$1.renewToken,t.stateMatch=!0,t;if(!t.stateMatch){t.requestType=window.requestType;for(var n=window.renewStates,o=0;o<n.length;o++)if(n[o]===t.state){t.stateMatch=!0;break}}return t},e.prototype.getCachedToken=function(e,t){var r=null,n=e.scopes,o=this.cacheStorage.getAllAccessTokens(this.clientId,t?t.homeAccountIdentifier:null);if(0===o.length)return null;var i=[];if(e.authority){for(a=0;a<o.length;a++){c=(s=o[a]).key.scopes.split(" ");Utils.containsScope(c,n)&&Utils.CanonicalizeUri(s.key.authority)===e.authority&&i.push(s)}if(0===i.length)return null;if(1!==i.length)throw ClientAuthError.createMultipleMatchingTokensInCacheError(n.toString());r=i[0]}else{for(var a=0;a<o.length;a++){var s,c=(s=o[a]).key.scopes.split(" ");Utils.containsScope(c,n)&&i.push(s)}if(1===i.length)r=i[0],e.authorityInstance=AuthorityFactory.CreateInstance(r.key.authority,this.config.auth.validateAuthority);else{if(i.length>1)throw ClientAuthError.createMultipleMatchingTokensInCacheError(n.toString());var u=this.getUniqueAuthority(o,"authority");if(u.length>1)throw ClientAuthError.createMultipleAuthoritiesInCacheError(n.toString());e.authorityInstance=AuthorityFactory.CreateInstance(u[0],this.config.auth.validateAuthority)}}if(null!=r){var l=Number(r.value.expiresIn),d=this.config.system.tokenRenewalOffsetSeconds||300;if(l&&l>Utils.now()+d){var p=new IdToken(r.value.idToken);if(!t&&!(t=this.getAccount()))throw AuthError.createUnexpectedError("Account should not be null here.");var h=this.getAccountState(e.state),f={uniqueId:"",tenantId:"",tokenType:r.value.idToken===r.value.accessToken?Constants$1.idToken:Constants$1.accessToken,idToken:p,accessToken:r.value.accessToken,scopes:r.key.scopes.split(" "),expiresOn:new Date(1e3*l),account:t,accountState:h};return Utils.setResponseIdToken(f,p),f}return this.cacheStorage.removeItem(JSON.stringify(i[0].key)),null}return null},e.prototype.getUniqueAuthority=function(e,t){var r=[],n=[];return e.forEach(function(e){e.key.hasOwnProperty(t)&&-1===n.indexOf(e.key[t])&&(n.push(e.key[t]),r.push(e.key[t]))}),r},e.prototype.extractADALIdToken=function(){var e=this.cacheStorage.getItem(Constants$1.adalIdToken);return Utils.isEmpty(e)?null:Utils.extractIdToken(e)},e.prototype.renewToken=function(e,t,r,n,o){var i=e.join(" ").toLowerCase();this.logger.verbose("renewToken is called for scope:"+i);var a=this.addHiddenIFrame("msalRenewFrame"+i);this.updateCacheEntries(o,n),this.logger.verbose("Renew token Expected state: "+o.state);var s=Utils.urlRemoveQueryStringParameter(o.createNavigateUrl(e),Constants$1.prompt)+Constants$1.prompt_none;window.renewStates.push(o.state),window.requestType=Constants$1.renewToken,this.registerCallback(o.state,i,t,r),this.logger.infoPii("Navigate to:"+s),a.src="about:blank",this.loadIframeTimeout(s,"msalRenewFrame"+i,i)},e.prototype.renewIdToken=function(e,t,r,n,o){this.logger.info("renewidToken is called");var i=this.addHiddenIFrame("msalIdTokenFrame");this.updateCacheEntries(o,n),this.logger.verbose("Renew Idtoken Expected state: "+o.state);var a=Utils.urlRemoveQueryStringParameter(o.createNavigateUrl(e),Constants$1.prompt)+Constants$1.prompt_none;this.silentLogin?(window.requestType=Constants$1.login,this.silentAuthenticationState=o.state):(window.requestType=Constants$1.renewToken,window.renewStates.push(o.state)),this.registerCallback(o.state,this.clientId,t,r),this.logger.infoPii("Navigate to:"+a),i.src="about:blank",this.loadIframeTimeout(a,"msalIdTokenFrame",this.clientId)},e.prototype.saveAccessToken=function(e,t,r,n){var o,i=__assign({},e),a=new ClientInfo(n);if(r.hasOwnProperty("scope")){for(var s=(o=r.scope).split(" "),c=this.cacheStorage.getAllAccessTokens(this.clientId,t),u=0;u<c.length;u++){var l=c[u];if(l.key.homeAccountIdentifier===e.account.homeAccountIdentifier){var d=l.key.scopes.split(" ");Utils.isIntersectingScopes(d,s)&&this.cacheStorage.removeItem(JSON.stringify(l.key))}}var p=Utils.expiresIn(r[Constants$1.expiresIn]).toString(),h=new AccessTokenKey(t,this.clientId,o,a.uid,a.utid),f=new AccessTokenValue(r[Constants$1.accessToken],e.idToken.rawIdToken,p,n);this.cacheStorage.setItem(JSON.stringify(h),JSON.stringify(f)),i.accessToken=r[Constants$1.accessToken],i.scopes=s,(g=Number(p))?i.expiresOn=new Date(1e3*(Utils.now()+g)):this.logger.error("Could not parse expiresIn parameter. Given value: "+p)}else{o=this.clientId;var g;h=new AccessTokenKey(t,this.clientId,o,a.uid,a.utid),f=new AccessTokenValue(r[Constants$1.idToken],r[Constants$1.idToken],e.idToken.expiration,n);this.cacheStorage.setItem(JSON.stringify(h),JSON.stringify(f)),i.scopes=[o],i.accessToken=r[Constants$1.idToken],(g=Number(e.idToken.expiration))?i.expiresOn=new Date(1e3*g):this.logger.error("Could not parse expiresIn parameter")}return i},e.prototype.saveTokenFromHash=function(e,t){this.logger.info("State status:"+t.stateMatch+"; Request type:"+t.requestType),this.cacheStorage.setItem(Constants$1.msalError,""),this.cacheStorage.setItem(Constants$1.msalErrorDescription,"");var r,n={uniqueId:"",tenantId:"",tokenType:"",idToken:null,accessToken:null,scopes:[],expiresOn:null,account:null,accountState:""},o=this.deserializeHash(e),i="",a="";if(o.hasOwnProperty(Constants$1.errorDescription)||o.hasOwnProperty(Constants$1.error)){if(this.logger.infoPii("Error :"+o[Constants$1.error]+"; Error description:"+o[Constants$1.errorDescription]),this.cacheStorage.setItem(Constants$1.msalError,o[Constants$1.error]),this.cacheStorage.setItem(Constants$1.msalErrorDescription,o[Constants$1.errorDescription]),t.requestType===Constants$1.login&&(this.loginInProgress=!1,this.cacheStorage.setItem(Constants$1.loginError,o[Constants$1.errorDescription]+":"+o[Constants$1.error]),i=Storage.generateAuthorityKey(t.state)),t.requestType===Constants$1.renewToken){this.acquireTokenInProgress=!1,i=Storage.generateAuthorityKey(t.state);var s=this.getAccount(),c=void 0;c=s&&!Utils.isEmpty(s.homeAccountIdentifier)?s.homeAccountIdentifier:Constants$1.no_account,a=Storage.generateAcquireTokenAccountKey(c,t.state)}r=this.isInteractionRequired(o[Constants$1.error])||this.isInteractionRequired(o[Constants$1.errorDescription])?new InteractionRequiredAuthError(o[Constants$1.error],o[Constants$1.errorDescription]):new ServerError(o[Constants$1.error],o[Constants$1.errorDescription])}else if(t.stateMatch){this.logger.info("State is right"),o.hasOwnProperty(Constants$1.sessionState)&&this.cacheStorage.setItem(Constants$1.msalSessionState,o[Constants$1.sessionState]),n.accountState=this.getAccountState(t.state);var u="";if(o.hasOwnProperty(Constants$1.accessToken)){this.logger.info("Fragment has access token"),this.acquireTokenInProgress=!1,o.hasOwnProperty(Constants$1.idToken)?n.idToken=new IdToken(o[Constants$1.idToken]):n=Utils.setResponseIdToken(n,new IdToken(this.cacheStorage.getItem(Constants$1.idTokenKey)));var l=Storage.generateAuthorityKey(t.state),d=this.cacheStorage.getItem(l,this.inCookie);if(Utils.isEmpty(d)||(d=Utils.replaceTenantPath(d,n.tenantId)),!o.hasOwnProperty(Constants$1.clientInfo))throw this.logger.warning("ClientInfo not received in the response from AAD"),ClientAuthError.createClientInfoNotPopulatedError("ClientInfo not received in the response from the server");u=o[Constants$1.clientInfo],n.account=Account.createAccount(n.idToken,new ClientInfo(u));var p=void 0;p=n.account&&!Utils.isEmpty(n.account.homeAccountIdentifier)?n.account.homeAccountIdentifier:Constants$1.no_account,a=Storage.generateAcquireTokenAccountKey(p,t.state);var h=Storage.generateAcquireTokenAccountKey(Constants$1.no_account,t.state),f=this.cacheStorage.getItem(a),g=void 0;Utils.isEmpty(f)?Utils.isEmpty(this.cacheStorage.getItem(h))||(n=this.saveAccessToken(n,d,o,u)):(g=JSON.parse(f),n.account&&g&&Utils.compareAccounts(n.account,g)?(n=this.saveAccessToken(n,d,o,u),this.logger.info("The user object received in the response is the same as the one passed in the acquireToken request")):this.logger.warning("The account object created from the response is not the same as the one passed in the acquireToken request"))}if(o.hasOwnProperty(Constants$1.idToken)){this.logger.info("Fragment has id token"),this.loginInProgress=!1,n=Utils.setResponseIdToken(n,new IdToken(o[Constants$1.idToken])),o.hasOwnProperty(Constants$1.clientInfo)?u=o[Constants$1.clientInfo]:this.logger.warning("ClientInfo not received in the response from AAD"),i=Storage.generateAuthorityKey(t.state);d=this.cacheStorage.getItem(i,this.inCookie);Utils.isEmpty(d)||(d=Utils.replaceTenantPath(d,n.idToken.tenantId)),this.account=Account.createAccount(n.idToken,new ClientInfo(u)),n.account=this.account,n.idToken&&n.idToken.nonce?n.idToken.nonce!==this.cacheStorage.getItem(Constants$1.nonceIdToken,this.inCookie)?(this.account=null,this.cacheStorage.setItem(Constants$1.loginError,"Nonce Mismatch. Expected Nonce: "+this.cacheStorage.getItem(Constants$1.nonceIdToken,this.inCookie)+",Actual Nonce: "+n.idToken.nonce),this.logger.error("Nonce Mismatch.Expected Nonce: "+this.cacheStorage.getItem(Constants$1.nonceIdToken,this.inCookie)+",Actual Nonce: "+n.idToken.nonce),r=ClientAuthError.createNonceMismatchError(this.cacheStorage.getItem(Constants$1.nonceIdToken,this.inCookie),n.idToken.nonce)):(this.cacheStorage.setItem(Constants$1.idTokenKey,o[Constants$1.idToken]),this.cacheStorage.setItem(Constants$1.msalClientInfo,u),this.saveAccessToken(n,d,o,u)):(i=t.state,a=t.state,this.logger.error("Invalid id_token received in the response"),r=ClientAuthError.createInvalidIdTokenError(n.idToken),this.cacheStorage.setItem(Constants$1.msalError,r.errorCode),this.cacheStorage.setItem(Constants$1.msalErrorDescription,r.errorMessage))}}else{i=t.state,a=t.state;var y=this.cacheStorage.getItem(Constants$1.stateLogin,this.inCookie);this.logger.error("State Mismatch.Expected State: "+y+",Actual State: "+t.state),r=ClientAuthError.createInvalidStateError(t.state,y),this.cacheStorage.setItem(Constants$1.msalError,r.errorCode),this.cacheStorage.setItem(Constants$1.msalErrorDescription,r.errorMessage)}if(this.cacheStorage.setItem(Constants$1.renewStatus+t.state,Constants$1.tokenRenewStatusCompleted),this.cacheStorage.removeAcquireTokenEntries(t.state),this.inCookie&&(this.cacheStorage.setItemCookie(i,"",-1),this.cacheStorage.clearCookie()),r)throw r;if(!n)throw AuthError.createUnexpectedError("Response is null");return n},e.prototype.getAccount=function(){if(this.account)return this.account;var e=this.cacheStorage.getItem(Constants$1.idTokenKey),t=this.cacheStorage.getItem(Constants$1.msalClientInfo);if(!Utils.isEmpty(e)&&!Utils.isEmpty(t)){var r=new IdToken(e),n=new ClientInfo(t);return this.account=Account.createAccount(r,n),this.account}return null},e.prototype.getAccountState=function(e){if(e){var t=e.indexOf("|");if(t>-1&&t+1<e.length)return e.substring(t+1)}return e},e.prototype.getAllAccounts=function(){for(var e=[],t=this.cacheStorage.getAllAccessTokens(Constants$1.clientId,Constants$1.homeAccountIdentifier),r=0;r<t.length;r++){var n=new IdToken(t[r].value.idToken),o=new ClientInfo(t[r].value.homeAccountIdentifier),i=Account.createAccount(n,o);e.push(i)}return this.getUniqueAccounts(e)},e.prototype.getUniqueAccounts=function(e){if(!e||e.length<=1)return e;for(var t=[],r=[],n=0;n<e.length;++n)e[n].homeAccountIdentifier&&-1===t.indexOf(e[n].homeAccountIdentifier)&&(t.push(e[n].homeAccountIdentifier),r.push(e[n]));return r},e.prototype.validateInputScope=function(e,t){if(e){if(!Array.isArray(e))throw ClientConfigurationError.createScopesNonArrayError(e);if(e.length<1)throw ClientConfigurationError.createEmptyScopesArrayError(e.toString());if(e.indexOf(this.clientId)>-1&&e.length>1)throw ClientConfigurationError.createClientIdSingleScopeError(e.toString())}else if(t)throw ClientConfigurationError.createScopesRequiredError(e)},e.prototype.getScopeFromState=function(e){if(e){var t=e.indexOf("|");if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},e.prototype.appendScopes=function(e){var t;return e&&e.scopes&&(t=e.extraScopesToConsent?e.scopes.concat(e.extraScopesToConsent):e.scopes),t},e.prototype.broadcast=function(e,t){var r=new CustomEvent(e,{detail:t});window.dispatchEvent(r)},e.prototype.getCachedTokenInternal=function(e,t,r){var n=t||this.getAccount();if(!n)return null;var o=this.authorityInstance?this.authorityInstance:AuthorityFactory.CreateInstance(this.authority,this.config.auth.validateAuthority),i=this.getTokenType(n,e,!0),a=new ServerRequestParameters(o,this.clientId,e,i,this.getRedirectUri(),r);return this.getCachedToken(a,t)},e.prototype.getScopesForEndpoint=function(e){if(this.config.framework.unprotectedResources.length>0)for(var t=0;t<this.config.framework.unprotectedResources.length;t++)if(e.indexOf(this.config.framework.unprotectedResources[t])>-1)return null;if(this.config.framework.protectedResourceMap.size>0)for(var r=0,n=Array.from(this.config.framework.protectedResourceMap.keys());r<n.length;r++){var o=n[r];if(e.indexOf(o)>-1)return this.config.framework.protectedResourceMap.get(o)}return e.indexOf("http://")>-1||e.indexOf("https://")>-1?this.getHostFromUri(e)===this.getHostFromUri(this.getRedirectUri())?new Array(this.clientId):null:new Array(this.clientId)},e.prototype.getLoginInProgress=function(){return!!this.cacheStorage.getItem(Constants$1.urlHash)||this.loginInProgress},e.prototype.setloginInProgress=function(e){this.loginInProgress=e},e.prototype.getAcquireTokenInProgress=function(){return this.acquireTokenInProgress},e.prototype.setAcquireTokenInProgress=function(e){this.acquireTokenInProgress=e},e.prototype.getLogger=function(){return this.config.system.logger},e.prototype.getRedirectUri=function(){return"function"==typeof this.config.auth.redirectUri?this.config.auth.redirectUri():this.config.auth.redirectUri},e.prototype.getPostLogoutRedirectUri=function(){return"function"==typeof this.config.auth.postLogoutRedirectUri?this.config.auth.postLogoutRedirectUri():this.config.auth.postLogoutRedirectUri},e.prototype.getCurrentConfiguration=function(){if(!this.config)throw ClientConfigurationError.createNoSetConfigurationError();return this.config},e.prototype.getHash=function(e){return e.indexOf("#/")>-1?e=e.substring(e.indexOf("#/")+2):e.indexOf("#")>-1&&(e=e.substring(1)),e},e.prototype.getHostFromUri=function(e){var t=String(e).replace(/^(https?:)\/\//,"");return t=t.split("/")[0]},e.prototype.getTokenType=function(e,t,r){return r?Utils.compareAccounts(e,this.getAccount())?t.indexOf(this.config.auth.clientId)>-1?ResponseTypes.id_token:ResponseTypes.token:t.indexOf(this.config.auth.clientId)>-1?ResponseTypes.id_token:ResponseTypes.id_token_token:Utils.compareAccounts(e,this.getAccount())?t.indexOf(this.clientId)>-1?ResponseTypes.id_token:ResponseTypes.token:ResponseTypes.id_token_token},e.prototype.setAccountCache=function(e,t){var r=e?this.getAccountId(e):Constants$1.no_account,n=Storage.generateAcquireTokenAccountKey(r,t);this.cacheStorage.setItem(n,JSON.stringify(e))},e.prototype.setAuthorityCache=function(e,t){var r=Storage.generateAuthorityKey(e);this.cacheStorage.setItem(r,Utils.CanonicalizeUri(t),this.inCookie)},e.prototype.updateCacheEntries=function(e,t,r){r?(this.cacheStorage.setItem(Constants$1.loginRequest,r,this.inCookie),this.cacheStorage.setItem(Constants$1.loginError,""),this.cacheStorage.setItem(Constants$1.stateLogin,e.state,this.inCookie),this.cacheStorage.setItem(Constants$1.nonceIdToken,e.nonce,this.inCookie),this.cacheStorage.setItem(Constants$1.msalError,""),this.cacheStorage.setItem(Constants$1.msalErrorDescription,"")):this.setAccountCache(t,e.state),this.setAuthorityCache(e.state,e.authority),this.cacheStorage.setItem(Constants$1.nonceIdToken,e.nonce,this.inCookie)},e.prototype.getAccountId=function(e){return Utils.isEmpty(e.homeAccountIdentifier)?Constants$1.no_account:e.homeAccountIdentifier},e.prototype.buildIDTokenRequest=function(e){return{scopes:[this.clientId],authority:this.authority,account:this.getAccount(),extraQueryParameters:e.extraQueryParameters}},e.prototype.populateQueryParams=function(e,t,r,n){var o,i={};return t&&(t.prompt&&(this.validatePromptParameter(t.prompt),r.promptValue=t.prompt),t.claimsRequest&&(validateClaimsRequest(t),r.claimsValue=t.claimsRequest),Utils.isSSOParam(t)&&(i=Utils.constructUnifiedCacheQueryParameter(t,null))),n&&(i=Utils.constructUnifiedCacheQueryParameter(null,n)),this.logger.verbose("Calling addHint parameters"),i=this.addHintParameters(e,i,r),t&&(o=this.sanitizeEQParams(t)),r.queryParameters=Utils.generateQueryParametersString(i),r.extraQueryParameters=Utils.generateQueryParametersString(o),r},e.prototype.validatePromptParameter=function(e){if(!([PromptState.LOGIN,PromptState.SELECT_ACCOUNT,PromptState.CONSENT,PromptState.NONE].indexOf(e)>=0))throw ClientConfigurationError.createInvalidPromptError(e)},e.prototype.sanitizeEQParams=function(e){var t=e.extraQueryParameters;return t?(e.claimsRequest&&(this.logger.warning("Removed duplicate claims from extraQueryParameters. Please use either the claimsRequest field OR pass as extraQueryParameter - not both."),delete t[Constants$1.claims]),delete t[SSOTypes.SID],delete t[SSOTypes.LOGIN_HINT],t):null},__decorate([resolveTokenOnlyIfOutOfIframe],e.prototype,"acquireTokenSilent",null),e}();class InteractiveBrowserCredential{constructor(e,t,r){if(r=Object.assign({},IdentityClient.getDefaultOptions(),r),this.loginStyle=r.loginStyle||"popup",-1===["redirect","popup"].indexOf(this.loginStyle))throw new Error(`Invalid loginStyle: ${r.loginStyle}`);this.msalConfig={auth:Object.assign({clientId:t,authority:`${r.authorityHost}/${e}`},r.redirectUri&&{redirectUri:r.redirectUri},r.postLogoutRedirectUri&&{redirectUri:r.postLogoutRedirectUri}),cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!0}},this.msalObject=new UserAgentApplication(this.msalConfig)}login(){switch(this.loginStyle){case"redirect":{const e=new Promise((e,t)=>{this.msalObject.handleRedirectCallback(e,t)});return this.msalObject.loginRedirect(),e}case"popup":return this.msalObject.loginPopup()}}acquireToken(e){return __awaiter(this,void 0,void 0,function*(){let t,r;try{t=yield this.msalObject.acquireTokenSilent(e)}catch(e){if(e instanceof AuthError)switch(e.errorCode){case"consent_required":case"interaction_required":case"login_required":break;default:throw e}}if(void 0===t){switch(this.loginStyle){case"redirect":r=new Promise((e,t)=>{this.msalObject.handleRedirectCallback(e,t)}),this.msalObject.acquireTokenRedirect(e);break;case"popup":r=this.msalObject.acquireTokenPopup(e)}t=r&&(yield r)}return t})}getToken(e,t){return __awaiter(this,void 0,void 0,function*(){this.msalObject.getAccount()||(yield this.login());const t=yield this.acquireToken({scopes:Array.isArray(e)?e:e.split(",")});return t?{token:t.accessToken,expiresOnTimestamp:t.expiresOn.getTime()}:null})}}const BrowserNotSupportedError$3=new Error("DeviceCodeCredential is not supported in the browser.");class DeviceCodeCredential{constructor(e,t,r,n){throw BrowserNotSupportedError$3}getToken(e,t){throw BrowserNotSupportedError$3}}class UsernamePasswordCredential{constructor(e,t,r,n,o){this.identityClient=new IdentityClient(o),this.tenantId=e,this.clientId=t,this.username=r,this.password=n}getToken(e,t){return __awaiter(this,void 0,void 0,function*(){const r=this.identityClient.createWebResource({url:`${this.identityClient.authorityHost}/${this.tenantId}/oauth2/v2.0/token`,method:"POST",disableJsonStringifyOnBody:!0,deserializationMapper:void 0,body:lib.stringify({response_type:"token",grant_type:"password",client_id:this.clientId,username:this.username,password:this.password,scope:"string"==typeof e?e:e.join(" ")}),headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},abortSignal:t&&t.abortSignal}),n=yield this.identityClient.sendTokenRequest(r);return n&&n.accessToken||null})}}function getDefaultAzureCredential(){return new DefaultAzureCredential}exports.AggregateAuthenticationError=AggregateAuthenticationError,exports.AuthenticationError=AuthenticationError,exports.ChainedTokenCredential=ChainedTokenCredential,exports.ClientCertificateCredential=ClientCertificateCredential,exports.ClientSecretCredential=ClientSecretCredential,exports.DefaultAzureCredential=DefaultAzureCredential,exports.DeviceCodeCredential=DeviceCodeCredential,exports.EnvironmentCredential=EnvironmentCredential,exports.InteractiveBrowserCredential=InteractiveBrowserCredential,exports.ManagedIdentityCredential=ManagedIdentityCredential,exports.UsernamePasswordCredential=UsernamePasswordCredential,exports.getDefaultAzureCredential=getDefaultAzureCredential,Object.defineProperty(exports,"__esModule",{value:!0})});
|
|
2
|
+
//# sourceMappingURL=identity.min.js.map
|