/** * ------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ var MSGraphAuthCodeMSALBrowserAuthProvider=function(t,e){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:String(e)}function i(t,e){for(var r=0;r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=c.call(i,"catchLoc"),s=c.call(i,"finallyLoc");if(u&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&c.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),R(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;R(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:C(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),g}},o}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}(u);var l=(0,u.exports)(),p=l;try{regeneratorRuntime=l}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=l:Function("r","regeneratorRuntime = r")(l)}var h=a(p);function y(t,e,r,n){return new(r||(r=Promise))((function(o,i){function c(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(c,a)}u((n=n.apply(t,e||[])).next())}))}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function m(t,e,r){return m=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&d(o,r.prototype),o},m.apply(null,arguments)}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return m(t,arguments,b(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)},g(t)}function w(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,o=b(t);if(e){var i=b(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return v(t)}(this,r)}}"function"==typeof SuppressedError&&SuppressedError;var x=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(n,t);var e=w(n);function n(t){var o;return r(this,n),o=e.call(this,t),Object.setPrototypeOf(v(o),n.prototype),o}return c(n,null,[{key:"setGraphClientError",value:function(t){var e;return t instanceof Error?e=t:(e=new n).customError=t,e}}]),n}(g(Error)),E=function(){function t(e,n){if(r(this,t),this.publicClientApplication=e,this.options=n,!n||!e)throw new x("Please pass valid PublicClientApplication instance and AuthCodeMSALBrowserAuthenticationProviderOptions instance to instantiate MSALBrowserAuthenticationProvider")}return c(t,[{key:"getAccessToken",value:function(){return y(this,void 0,void 0,h.mark((function t(){var r,n,o,i,c;return h.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.options&&this.options.scopes,n=this.options&&this.options.account,o=new x,r&&0!==r.length){t.next=7;break}throw o.name="Empty Scopes",o.message="Scopes cannot be empty, Please provide scopes",o;case 7:return t.prev=7,t.next=10,this.publicClientApplication.acquireTokenSilent({scopes:r,account:n});case 10:if((i=t.sent)&&i.accessToken){t.next=15;break}throw o.name="Access token is undefined",o.message="Received empty access token from PublicClientApplication",o;case 15:return t.abrupt("return",i.accessToken);case 18:if(t.prev=18,t.t0=t.catch(7),!(t.t0 instanceof e.InteractionRequiredAuthError)){t.next=32;break}if(this.options.interactionType!==e.InteractionType.Redirect){t.next=25;break}this.publicClientApplication.acquireTokenRedirect({scopes:r}),t.next=30;break;case 25:if(this.options.interactionType!==e.InteractionType.Popup){t.next=30;break}return t.next=28,this.publicClientApplication.acquireTokenPopup({scopes:r});case 28:return c=t.sent,t.abrupt("return",c.accessToken);case 30:t.next=33;break;case 32:throw t.t0;case 33:case"end":return t.stop()}}),t,this,[[7,18]])})))}}]),t}();return t.AuthCodeMSALBrowserAuthenticationProvider=E,t}({},msal);