oidc-spa 4.13.2 → 4.13.3

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.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- (()=>{var e={480:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.jwt_decode=t.jwt_decode_ns=void 0,s(r(517),t);var u=o(r(935));t.jwt_decode_ns=u;var c=a(r(935));t.jwt_decode=c.default},11:function(e,t,r){var n,i,s,o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}o=function(){var e=e||function(e){var t;if("undefined"!=typeof window&&window.crypto&&(t=window.crypto),"undefined"!=typeof self&&self.crypto&&(t=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(t=globalThis.crypto),!t&&"undefined"!=typeof window&&window.msCrypto&&(t=window.msCrypto),!t&&void 0!==r.g&&r.g.crypto&&(t=r.g.crypto),!t)try{t=r(477)}catch(e){}var n=function(){if(t){if("function"==typeof t.getRandomValues)try{return t.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof t.randomBytes)try{return t.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},o=s.lib={},a=o.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var s=0;s<i;s++){var o=r[s>>>2]>>>24-s%4*8&255;t[n+s>>>2]|=o<<24-(n+s)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new u.init(t,e)}}),c=s.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var s=t[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},d=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var s=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},h=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,s=n.sigBytes,o=this.blockSize,a=s/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,l=e.min(4*c,s);if(c){for(var d=0;d<c;d+=o)this._doProcessBlock(i,d);r=i.splice(0,c),n.sigBytes-=l}return new u.init(r,l)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(o.Hasher=p.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),s.algo={});return s}(Math);return e},"object"===a(t)?e.exports=t=o():(i=[],void 0===(s="function"==typeof(n=o)?n.apply(t,i):n)||(e.exports=s))},304:function(e,t,r){var n,i,s,o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}o=function(e){var t,r;return r=(t=e).lib.WordArray,t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],s=0;s<r;s+=3)for(var o=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a<r;a++)i.push(n.charAt(o>>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var s=0;s<n.length;s++)i[n.charCodeAt(s)]=s}var o=n.charAt(64);if(o){var a=e.indexOf(o);-1!==a&&(t=a)}return function(e,t,n){for(var i=[],s=0,o=0;o<t;o++)if(o%4){var a=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;i[s>>>2]|=a<<24-s%4*8,s++}return r.create(i,s)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.enc.Base64},"object"===a(t)?e.exports=t=o(r(11)):(i=[r(11)],void 0===(s="function"==typeof(n=o)?n.apply(t,i):n)||(e.exports=s))},728:function(e,t,r){var n,i,s,o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}o=function(e){return e.enc.Utf8},"object"===a(t)?e.exports=t=o(r(11)):(i=[r(11)],void 0===(s="function"==typeof(n=o)?n.apply(t,i):n)||(e.exports=s))},519:function(e,t,r){var n,i,s,o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}o=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,s=n.Hasher,o=r.algo,a=[],u=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(a[i]=r(t.pow(n,.5))),u[i]=r(t.pow(n,1/3)),i++),n++}();var c=[],l=o.SHA256=s.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],o=r[3],a=r[4],l=r[5],d=r[6],h=r[7],p=0;p<64;p++){if(p<16)c[p]=0|e[t+p];else{var f=c[p-15],g=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,_=c[p-2],v=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;c[p]=g+c[p-7]+v+c[p-16]}var y=n&i^n&s^i&s,w=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),m=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&d)+u[p]+c[p];h=d,d=l,l=a,a=o+m|0,o=s,s=i,i=n,n=m+(w+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+d|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(l),r.HmacSHA256=s._createHmacHelper(l)}(Math),e.SHA256},"object"===a(t)?e.exports=t=o(r(11)):(i=[r(11)],void 0===(s="function"==typeof(n=o)?n.apply(t,i):n)||(e.exports=s))},935:(e,t,r)=>{"use strict";function n(e){this.message=e}r.r(t),r.d(t,{InvalidTokenError:()=>o,default:()=>a}),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var i="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,s=0,o=0,a="";i=t.charAt(o++);~i&&(r=s%4?64*r+i:i,s++%4)?a+=String.fromCharCode(255&r>>(-2*s&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};function s(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(i(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return i(t)}}function o(e){this.message=e}o.prototype=new Error,o.prototype.name="InvalidTokenError";const a=function(e,t){if("string"!=typeof e)throw new o("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(s(e.split(".")[r]))}catch(e){throw new o("Invalid token specified: "+e.message)}}},517:(e,t,r)=>{"use strict";var n=["timeoutInSeconds"],i=["grant_type","redirect_uri","client_id","client_secret"],s=["grant_type","client_id","client_secret","scope"],o=["grant_type","client_id","client_secret","timeoutInSeconds"],a=["url","authority","client_id","redirect_uri","response_type","scope","state_data","response_mode","request_type","client_secret","nonce","url_state","resource","skipUserInfo","extraQueryParams","extraTokenParams","disablePKCE"],u=["redirectMethod"],c=["popupWindowFeatures","popupWindowTarget"],l=["silentRequestTimeoutInSeconds","resource"],d=["silentRequestTimeoutInSeconds"],h=["redirectMethod"],p=["popupWindowFeatures","popupWindowTarget"],f=["silentRequestTimeoutInSeconds"];function g(){g=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var s=t&&t.prototype instanceof y?t:y,o=Object.create(s.prototype),a=new C(n||[]);return i(o,"_invoke",{value:I(e,r,a)}),o}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",p="suspendedYield",f="executing",_="completed",v={};function y(){}function w(){}function m(){}var k={};c(k,o,(function(){return this}));var b=Object.getPrototypeOf,S=b&&b(b(j([])));S&&S!==r&&n.call(S,o)&&(k=S);var x=m.prototype=y.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(i,s,o,a){var u=d(e[i],e,s);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==H(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,a)}),(function(e){r("throw",e,o,a)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return r("throw",e,o,a)}))}a(u.arg)}var s;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return s=s?s.then(i,i):i()}})}function I(t,r,n){var i=h;return function(s,o){if(i===f)throw Error("Generator is already running");if(i===_){if("throw"===s)throw o;return{value:e,done:!0}}for(n.method=s,n.arg=o;;){var a=n.delegate;if(a){var u=O(a,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=_,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=f;var c=d(t,r,n);if("normal"===c.type){if(i=n.done?_:p,c.arg===v)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=_,n.method="throw",n.arg=c.arg)}}}function O(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,O(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var s=d(i,t.iterator,r.arg);if("throw"===s.type)return r.method="throw",r.arg=s.arg,r.delegate=null,v;var o=s.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function j(t){if(t||""===t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return s.next=s}}throw new TypeError(H(t)+" is not iterable")}return w.prototype=m,i(x,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:w,configurable:!0}),w.displayName=c(m,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,u,"GeneratorFunction")),e.prototype=Object.create(x),e},t.awrap=function(e){return{__await:e}},E(T.prototype),c(T.prototype,a,(function(){return this})),t.AsyncIterator=T,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var o=new T(l(e,r,n,i),s);return t.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},E(x),c(x,u,"Generator"),c(x,o,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=j,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return a.type="throw",a.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,v):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:j(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function y(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function m(e,t,r,n,i,s,o){try{var a=e[s](o),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function k(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var s=e.apply(t,r);function o(e){m(s,n,i,o,a,"next",e)}function a(e){m(s,n,i,o,a,"throw",e)}o(void 0)}))}}function b(e){var t="function"==typeof Map?new Map:void 0;return b=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return function(e,t,r){if(x())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var i=new(e.bind.apply(e,n));return r&&T(i,r.prototype),i}(e,arguments,O(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),T(r,e)},b(e)}function S(e,t,r){return t=O(t),function(e,t){if(t&&("object"==H(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,x()?Reflect.construct(t,r||[],O(e).constructor):t.apply(e,r))}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(x=function(){return!!e})()}function E(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T(e,t)}function T(e,t){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},T(e,t)}function I(){return I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=O(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},I.apply(null,arguments)}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function P(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,s,o,a=[],u=!0,c=!1;try{if(s=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=s.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}(e,t)||M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},R.apply(null,arguments)}function C(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function U(e,t,r){return t&&j(e.prototype,t),r&&j(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function A(e){var t=function(e){if("object"!=H(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=H(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==H(t)?t:t+""}function q(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=M(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw s}}}}function M(e,t){if(e){if("string"==typeof e)return N(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(e,t):void 0}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}var L,W=Object.create,F=Object.defineProperty,B=Object.getOwnPropertyDescriptor,z=Object.getOwnPropertyNames,K=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty,D=function(e,t,r,n){if(t&&"object"===H(t)||"function"==typeof t){var i,s=q(z(t));try{var o=function(){var s=i.value;J.call(e,s)||s===r||F(e,s,{get:function(){return t[s]},enumerable:!(n=B(t,s))||n.enumerable})};for(s.s();!(i=s.n()).done;)o()}catch(e){s.e(e)}finally{s.f()}}return e},G=function(e,t,r){return r=null!=e?W(K(e)):{},D(!t&&e&&e.__esModule?r:F(r,"default",{value:e,enumerable:!0}),e)},Q={};!function(e,t){for(var r in t)F(e,r,{get:t[r],enumerable:!0})}(Q,{AccessTokenEvents:function(){return fe},CheckSessionIFrame:function(){return ge},ErrorResponse:function(){return he},ErrorTimeout:function(){return pe},InMemoryWebStorage:function(){return _e},Log:function(){return ne},Logger:function(){return ie},MetadataService:function(){return ye},OidcClient:function(){return Ue},OidcClientSettingsStore:function(){return me},SessionMonitor:function(){return Ae},SigninResponse:function(){return Ie},SigninState:function(){return Ee},SignoutResponse:function(){return Pe},State:function(){return xe},User:function(){return qe},UserManager:function(){return Ve},UserManagerSettingsStore:function(){return We},Version:function(){return Ye},WebStorageStateStore:function(){return we}}),e.exports=(L=Q,D(F({},"__esModule",{value:!0}),L));var V,Y,$,X=G(r(11)),Z=G(r(519)),ee=G(r(304)),te=G(r(728)),re={debug:function(){},info:function(){},warn:function(){},error:function(){}},ne=function(e){return e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e}(ne||{});($=ne||(ne={})).reset=function(){V=3,Y=re},$.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");V=e},$.setLogger=function(e){Y=e};var ie=function(){function e(t){C(this,e),this._name=t}return U(e,[{key:"debug",value:function(){if(V>=4){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=Y).debug.apply(t,[e._format(this._name,this._method)].concat(n))}}},{key:"info",value:function(){if(V>=3){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=Y).info.apply(t,[e._format(this._name,this._method)].concat(n))}}},{key:"warn",value:function(){if(V>=2){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=Y).warn.apply(t,[e._format(this._name,this._method)].concat(n))}}},{key:"error",value:function(){if(V>=1){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=Y).error.apply(t,[e._format(this._name,this._method)].concat(n))}}},{key:"throw",value:function(e){throw this.error(e),e}},{key:"create",value:function(e){var t=Object.create(this);return t._method=e,t.debug("begin"),t}}],[{key:"createStatic",value:function(t,r){var n=new e("".concat(t,".").concat(r));return n.debug("begin"),n}},{key:"_format",value:function(e,t){var r="[".concat(e,"]");return t?"".concat(r," ").concat(t,":"):r}},{key:"debug",value:function(t){if(V>=4){for(var r,n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];(r=Y).debug.apply(r,[e._format(t)].concat(i))}}},{key:"info",value:function(t){if(V>=3){for(var r,n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];(r=Y).info.apply(r,[e._format(t)].concat(i))}}},{key:"warn",value:function(t){if(V>=2){for(var r,n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];(r=Y).warn.apply(r,[e._format(t)].concat(i))}}},{key:"error",value:function(t){if(V>=1){for(var r,n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];(r=Y).error.apply(r,[e._format(t)].concat(i))}}}])}();ne.reset();var se=function(){function e(){C(this,e)}return U(e,null,[{key:"_randomWord",value:function(){return X.default.lib.WordArray.random(1).words[0]}},{key:"generateUUIDv4",value:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(function(t){return(+t^e._randomWord()&15>>+t/4).toString(16)})).replace(/-/g,"")}},{key:"generateCodeVerifier",value:function(){return e.generateUUIDv4()+e.generateUUIDv4()+e.generateUUIDv4()}},{key:"generateCodeChallenge",value:function(e){try{var t=(0,Z.default)(e);return ee.default.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw ie.error("CryptoUtils.generateCodeChallenge",e),e}}},{key:"generateBasicAuth",value:function(e,t){var r=te.default.parse([e,t].join(":"));return ee.default.stringify(r)}}])}(),oe=function(){return U((function e(t){C(this,e),this._name=t,this._logger=new ie("Event('".concat(this._name,"')")),this._callbacks=[]}),[{key:"addHandler",value:function(e){var t=this;return this._callbacks.push(e),function(){return t.removeHandler(e)}}},{key:"removeHandler",value:function(e){var t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}},{key:"raise",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=this._logger).debug.apply(e,["raise:"].concat(r));var i,s=q(this._callbacks);try{for(s.s();!(i=s.n()).done;)i.value.apply(void 0,r)}catch(e){s.e(e)}finally{s.f()}}}])}(),ae=G(r(935)),ue=function(){return U((function e(){C(this,e)}),null,[{key:"decode",value:function(e){try{return(0,ae.default)(e)}catch(e){throw ie.error("JwtUtils.decode",e),e}}}])}(),ce=function(){return U((function e(){C(this,e)}),null,[{key:"center",value:function(e){var t,r=R({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e),e));return null==r.width&&(r.width=null!=(t=[800,720,600,480].find((function(e){return e<=window.outerWidth/1.618})))?t:360),null!=r.left||(r.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-r.width)/2))),null!=r.height&&(null!=r.top||(r.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-r.height)/2)))),r}},{key:"serialize",value:function(e){return Object.entries(e).filter((function(e){return null!=P(e,2)[1]})).map((function(e){var t=P(e,2),r=t[0],n=t[1];return"".concat(r,"=").concat("boolean"!=typeof n?n:n?"yes":"no")})).join(",")}}])}(),le=function(e){function t(){var e;return C(this,t),(e=S(this,t,arguments))._logger=new ie("Timer('".concat(e._name,"')")),e._timerHandle=null,e._expiration=0,e._callback=function(){var r=e._expiration-t.getEpochTime();e._logger.debug("timer completes in",r),e._expiration<=t.getEpochTime()&&(e.cancel(),I(O(t.prototype),"raise",e).call(e))},e}return E(t,e),U(t,[{key:"init",value:function(e){var r=this._logger.create("init");e=Math.max(Math.floor(e),1);var n=t.getEpochTime()+e;if(this.expiration===n&&this._timerHandle)r.debug("skipping since already initialized for expiration at",this.expiration);else{this.cancel(),r.debug("using duration",e),this._expiration=n;var i=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*i)}}},{key:"expiration",get:function(){return this._expiration}},{key:"cancel",value:function(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}}],[{key:"getEpochTime",value:function(){return Math.floor(Date.now()/1e3)}}])}(oe),de=function(){return U((function e(){C(this,e)}),null,[{key:"readParams",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"query";if(!e)throw new TypeError("Invalid URL");var r=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(r.slice(1))}}])}(),he=function(e){function t(e,r){var n,i,s,o;if(C(this,t),(n=S(this,t,[e.error_description||e.error||""])).form=r,n.name="ErrorResponse",!e.error)throw ie.error("ErrorResponse","No error passed"),new Error("No error passed");return n.error=e.error,n.error_description=null!=(i=e.error_description)?i:null,n.error_uri=null!=(s=e.error_uri)?s:null,n.state=e.userState,n.session_state=null!=(o=e.session_state)?o:null,n.url_state=e.url_state,n}return E(t,e),U(t)}(b(Error)),pe=function(e){function t(e){var r;return C(this,t),(r=S(this,t,[e])).name="ErrorTimeout",r}return E(t,e),U(t)}(b(Error)),fe=function(){return U((function e(t){C(this,e),this._logger=new ie("AccessTokenEvents"),this._expiringTimer=new le("Access token expiring"),this._expiredTimer=new le("Access token expired"),this._expiringNotificationTimeInSeconds=t.expiringNotificationTimeInSeconds}),[{key:"load",value:function(e){var t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){var r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){var n=r-this._expiringNotificationTimeInSeconds;n<=0&&(n=1),t.debug("registering expiring timer, raising in",n,"seconds"),this._expiringTimer.init(n)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();var i=r+1;t.debug("registering expired timer, raising in",i,"seconds"),this._expiredTimer.init(i)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}},{key:"unload",value:function(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}},{key:"addAccessTokenExpiring",value:function(e){return this._expiringTimer.addHandler(e)}},{key:"removeAccessTokenExpiring",value:function(e){this._expiringTimer.removeHandler(e)}},{key:"addAccessTokenExpired",value:function(e){return this._expiredTimer.addHandler(e)}},{key:"removeAccessTokenExpired",value:function(e){this._expiredTimer.removeHandler(e)}}])}(),ge=function(){return U((function e(t,r,n,i,s){var o=this;C(this,e),this._callback=t,this._client_id=r,this._intervalInSeconds=i,this._stopOnError=s,this._logger=new ie("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=function(e){e.origin===o._frame_origin&&e.source===o._frame.contentWindow&&("error"===e.data?(o._logger.error("error message from check session op iframe"),o._stopOnError&&o.stop()):"changed"===e.data?(o._logger.debug("changed message from check session op iframe"),o.stop(),o._callback()):o._logger.debug(e.data+" message from check session op iframe"))};var a=new URL(n);this._frame_origin=a.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=a.href}),[{key:"load",value:function(){var e=this;return new Promise((function(t){e._frame.onload=function(){t()},window.document.body.appendChild(e._frame),window.addEventListener("message",e._message,!1)}))}},{key:"start",value:function(e){var t=this;if(this._session_state!==e){this._logger.create("start"),this.stop(),this._session_state=e;var r=function(){t._frame.contentWindow&&t._session_state&&t._frame.contentWindow.postMessage(t._client_id+" "+t._session_state,t._frame_origin)};r(),this._timer=setInterval(r,1e3*this._intervalInSeconds)}}},{key:"stop",value:function(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}])}(),_e=function(){return U((function e(){C(this,e),this._logger=new ie("InMemoryWebStorage"),this._data={}}),[{key:"clear",value:function(){this._logger.create("clear"),this._data={}}},{key:"getItem",value:function(e){return this._logger.create("getItem('".concat(e,"')")),this._data[e]}},{key:"setItem",value:function(e,t){this._logger.create("setItem('".concat(e,"')")),this._data[e]=t}},{key:"removeItem",value:function(e){this._logger.create("removeItem('".concat(e,"')")),delete this._data[e]}},{key:"length",get:function(){return Object.getOwnPropertyNames(this._data).length}},{key:"key",value:function(e){return Object.getOwnPropertyNames(this._data)[e]}}])}(),ve=function(){return U((function e(){var t,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};C(this,e),this._jwtHandler=i,this._extraHeaders=s,this._logger=new ie("JsonService"),this._contentTypes=[],(t=this._contentTypes).push.apply(t,(r=n,function(e){if(Array.isArray(e))return N(e)}(r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||M(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat(["application/json"])),i&&this._contentTypes.push("application/jwt")}),[{key:"fetchWithTimeout",value:(r=k(g().mark((function e(t){var r,i,s,o,a,u,c=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=(r=c.length>1&&void 0!==c[1]?c[1]:{}).timeoutInSeconds,s=w(r,n),i){e.next=6;break}return e.next=5,fetch(t,s);case 5:return e.abrupt("return",e.sent);case 6:return o=new AbortController,a=setTimeout((function(){return o.abort()}),1e3*i),e.prev=8,e.next=11,fetch(t,v(v({},r),{},{signal:o.signal}));case 11:return u=e.sent,e.abrupt("return",u);case 15:if(e.prev=15,e.t0=e.catch(8),!(e.t0 instanceof DOMException&&"AbortError"===e.t0.name)){e.next=19;break}throw new pe("Network timed out");case 19:throw e.t0;case 20:return e.prev=20,clearTimeout(a),e.finish(20);case 23:case"end":return e.stop()}}),e,null,[[8,15,20,23]])}))),function(e){return r.apply(this,arguments)})},{key:"getJson",value:(t=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(r=l.length>1&&void 0!==l[1]?l[1]:{}).token,i=r.credentials,s=this._logger.create("getJson"),o={Accept:this._contentTypes.join(", ")},n&&(s.debug("token passed, setting Authorization header"),o.Authorization="Bearer "+n),this.appendExtraHeaders(o),e.prev=5,s.debug("url:",t),e.next=9,this.fetchWithTimeout(t,{method:"GET",headers:o,credentials:i});case 9:a=e.sent,e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(5),s.error("Network Error"),e.t0;case 16:if(s.debug("HTTP response received, status",a.status),(u=a.headers.get("Content-Type"))&&!this._contentTypes.find((function(e){return u.startsWith(e)}))&&s.throw(new Error("Invalid response Content-Type: ".concat(null!=u?u:"undefined",", from URL: ").concat(t))),!(a.ok&&this._jwtHandler&&(null==u?void 0:u.startsWith("application/jwt")))){e.next=27;break}return e.t1=this,e.next=23,a.text();case 23:return e.t2=e.sent,e.next=26,e.t1._jwtHandler.call(e.t1,e.t2);case 26:return e.abrupt("return",e.sent);case 27:return e.prev=27,e.next=30,a.json();case 30:c=e.sent,e.next=39;break;case 33:if(e.prev=33,e.t3=e.catch(27),s.error("Error parsing JSON response",e.t3),!a.ok){e.next=38;break}throw e.t3;case 38:throw new Error("".concat(a.statusText," (").concat(a.status,")"));case 39:if(a.ok){e.next=44;break}if(s.error("Error from server:",c),!c.error){e.next=43;break}throw new he(c);case 43:throw new Error("".concat(a.statusText," (").concat(a.status,"): ").concat(JSON.stringify(c)));case 44:return e.abrupt("return",c);case 45:case"end":return e.stop()}}),e,this,[[5,12],[27,33]])}))),function(e){return t.apply(this,arguments)})},{key:"postForm",value:(e=k(g().mark((function e(t,r){var n,i,s,o,a,u,c,l,d,h;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.body,i=r.basicAuth,s=r.timeoutInSeconds,o=r.initCredentials,a=this._logger.create("postForm"),u={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"},void 0!==i&&(u.Authorization="Basic "+i),this.appendExtraHeaders(u),e.prev=5,a.debug("url:",t),e.next=9,this.fetchWithTimeout(t,{method:"POST",headers:u,body:n,timeoutInSeconds:s,credentials:o});case 9:c=e.sent,e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(5),a.error("Network error"),e.t0;case 16:if(a.debug("HTTP response received, status",c.status),!(l=c.headers.get("Content-Type"))||this._contentTypes.find((function(e){return l.startsWith(e)}))){e.next=20;break}throw new Error("Invalid response Content-Type: ".concat(null!=l?l:"undefined",", from URL: ").concat(t));case 20:return e.next=22,c.text();case 22:if(d=e.sent,h={},!d){e.next=35;break}e.prev=25,h=JSON.parse(d),e.next=35;break;case 29:if(e.prev=29,e.t1=e.catch(25),a.error("Error parsing JSON response",e.t1),!c.ok){e.next=34;break}throw e.t1;case 34:throw new Error("".concat(c.statusText," (").concat(c.status,")"));case 35:if(c.ok){e.next=40;break}if(a.error("Error from server:",h),!h.error){e.next=39;break}throw new he(h,n);case 39:throw new Error("".concat(c.statusText," (").concat(c.status,"): ").concat(JSON.stringify(h)));case 40:return e.abrupt("return",h);case 41:case"end":return e.stop()}}),e,this,[[5,12],[25,29]])}))),function(t,r){return e.apply(this,arguments)})},{key:"appendExtraHeaders",value:function(e){var t=this,r=this._logger.create("appendExtraHeaders"),n=Object.keys(this._extraHeaders),i=["authorization","accept","content-type"];0!==n.length&&n.forEach((function(n){if(i.includes(n.toLocaleLowerCase()))r.warn("Protected header could not be overridden",n,i);else{var s="function"==typeof t._extraHeaders[n]?t._extraHeaders[n]():t._extraHeaders[n];s&&""!==s&&(e[n]=s)}}))}}]);var e,t,r}(),ye=function(){return U((function e(t){C(this,e),this._settings=t,this._logger=new ie("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new ve(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}),[{key:"resetSigningKeys",value:function(){this._signingKeys=null}},{key:"getMetadata",value:(r=k(g().mark((function e(){var t,r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._logger.create("getMetadata"),!this._metadata){e.next=4;break}return t.debug("using cached values"),e.abrupt("return",this._metadata);case 4:if(this._metadataUrl){e.next=7;break}throw t.throw(new Error("No authority or metadataUrl configured on settings")),null;case 7:return t.debug("getting metadata from",this._metadataUrl),e.next=10,this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});case 10:return r=e.sent,t.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,r),e.abrupt("return",this._metadata);case 14:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getIssuer",value:function(){return this._getMetadataProperty("issuer")}},{key:"getAuthorizationEndpoint",value:function(){return this._getMetadataProperty("authorization_endpoint")}},{key:"getUserInfoEndpoint",value:function(){return this._getMetadataProperty("userinfo_endpoint")}},{key:"getTokenEndpoint",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("token_endpoint",e)}},{key:"getCheckSessionIframe",value:function(){return this._getMetadataProperty("check_session_iframe",!0)}},{key:"getEndSessionEndpoint",value:function(){return this._getMetadataProperty("end_session_endpoint",!0)}},{key:"getRevocationEndpoint",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("revocation_endpoint",e)}},{key:"getKeysEndpoint",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("jwks_uri",e)}},{key:"_getMetadataProperty",value:(t=k(g().mark((function e(t){var r,n,i,s=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]&&s[1],n=this._logger.create("_getMetadataProperty('".concat(t,"')")),e.next=4,this.getMetadata();case 4:if(i=e.sent,n.debug("resolved"),void 0!==i[t]){e.next=11;break}if(!0!==r){e.next=10;break}return n.warn("Metadata does not contain optional property"),e.abrupt("return",void 0);case 10:n.throw(new Error("Metadata does not contain property "+t));case 11:return e.abrupt("return",i[t]);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getSigningKeys",value:(e=k(g().mark((function e(){var t,r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._logger.create("getSigningKeys"),!this._signingKeys){e.next=4;break}return t.debug("returning signingKeys from cache"),e.abrupt("return",this._signingKeys);case 4:return e.next=6,this.getKeysEndpoint(!1);case 6:return r=e.sent,t.debug("got jwks_uri",r),e.next=10,this._jsonService.getJson(r);case 10:if(n=e.sent,t.debug("got key set",n),Array.isArray(n.keys)){e.next=15;break}throw t.throw(new Error("Missing keys on keyset")),null;case 15:return this._signingKeys=n.keys,e.abrupt("return",this._signingKeys);case 17:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e,t,r}(),we=function(){return U((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.prefix,n=void 0===r?"oidc.":r,i=t.store,s=void 0===i?localStorage:i;C(this,e),this._logger=new ie("WebStorageStateStore"),this._store=s,this._prefix=n}),[{key:"set",value:(n=k(g().mark((function e(t,r){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("set('".concat(t,"')")),t=this._prefix+t,e.next=4,this._store.setItem(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"get",value:(r=k(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("get('".concat(t,"')")),t=this._prefix+t,e.next=4,this._store.getItem(t);case 4:return r=e.sent,e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"remove",value:(t=k(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("remove('".concat(t,"')")),t=this._prefix+t,e.next=4,this._store.getItem(t);case 4:return r=e.sent,e.next=7,this._store.removeItem(t);case 7:return e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getAllKeys",value:(e=k(g().mark((function e(){var t,r,n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("getAllKeys"),e.next=3,this._store.length;case 3:t=e.sent,r=[],n=0;case 6:if(!(n<t)){e.next=14;break}return e.next=9,this._store.key(n);case 9:(i=e.sent)&&0===i.indexOf(this._prefix)&&r.push(i.substr(this._prefix.length));case 11:n++,e.next=6;break;case 14:return e.abrupt("return",r);case 15:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e,t,r,n}(),me=U((function e(t){var r=t.authority,n=t.metadataUrl,i=t.metadata,s=t.signingKeys,o=t.metadataSeed,a=t.client_id,u=t.client_secret,c=t.response_type,l=void 0===c?"code":c,d=t.scope,h=void 0===d?"openid":d,p=t.redirect_uri,f=t.post_logout_redirect_uri,g=t.client_authentication,_=void 0===g?"client_secret_post":g,v=t.prompt,y=t.display,w=t.max_age,m=t.ui_locales,k=t.acr_values,b=t.resource,S=t.response_mode,x=void 0===S?"query":S,E=t.filterProtocolClaims,T=void 0===E||E,I=t.loadUserInfo,O=void 0!==I&&I,P=t.staleStateAgeInSeconds,R=void 0===P?900:P,j=t.clockSkewInSeconds,U=void 0===j?300:j,A=t.userInfoJwtIssuer,q=void 0===A?"OP":A,M=t.mergeClaims,N=void 0!==M&&M,H=t.disablePKCE,L=void 0!==H&&H,W=t.stateStore,F=t.refreshTokenCredentials,B=t.revokeTokenAdditionalContentTypes,z=t.fetchRequestCredentials,K=t.refreshTokenAllowedScope,J=t.extraQueryParams,D=void 0===J?{}:J,G=t.extraTokenParams,Q=void 0===G?{}:G,V=t.extraHeaders,Y=void 0===V?{}:V;if(C(this,e),this.authority=r,n?this.metadataUrl=n:(this.metadataUrl=r,r&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=i,this.metadataSeed=o,this.signingKeys=s,this.client_id=a,this.client_secret=u,this.response_type=l,this.scope=h,this.redirect_uri=p,this.post_logout_redirect_uri=f,this.client_authentication=_,this.prompt=v,this.display=y,this.max_age=w,this.ui_locales=m,this.acr_values=k,this.resource=b,this.response_mode=x,this.filterProtocolClaims=null==T||T,this.loadUserInfo=!!O,this.staleStateAgeInSeconds=R,this.clockSkewInSeconds=U,this.userInfoJwtIssuer=q,this.mergeClaims=!!N,this.disablePKCE=!!L,this.revokeTokenAdditionalContentTypes=B,z&&F&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=z||F||"same-origin",W)this.stateStore=W;else{var $="undefined"!=typeof window?window.localStorage:new _e;this.stateStore=new we({store:$})}this.refreshTokenAllowedScope=K,this.extraQueryParams=D,this.extraTokenParams=Q,this.extraHeaders=Y})),ke=function(){return U((function e(t,r){var n=this;C(this,e),this._settings=t,this._metadataService=r,this._logger=new ie("UserInfoService"),this._getClaimsFromJwt=function(){var e=k(g().mark((function e(t){var r,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n._logger.create("_getClaimsFromJwt"),e.prev=1,i=ue.decode(t),r.debug("JWT decoding successful"),e.abrupt("return",i);case 7:throw e.prev=7,e.t0=e.catch(1),r.error("Error parsing JWT response"),e.t0;case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}(),this._jsonService=new ve(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}),[{key:"getClaims",value:(e=k(g().mark((function e(t){var r,n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._logger.create("getClaims"),t||this._logger.throw(new Error("No token passed")),e.next=4,this._metadataService.getUserInfoEndpoint();case 4:return n=e.sent,r.debug("got userinfo url",n),e.next=8,this._jsonService.getJson(n,{token:t,credentials:this._settings.fetchRequestCredentials});case 8:return i=e.sent,r.debug("got claims",i),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e}(),be=function(){return U((function e(t,r){C(this,e),this._settings=t,this._metadataService=r,this._logger=new ie("TokenClient"),this._jsonService=new ve(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}),[{key:"exchangeCode",value:(n=k(g().mark((function e(t){var r,n,s,o,a,u,c,l,d,h,p,f,_,v,y,m,k,b,S;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.grant_type,n=void 0===r?"authorization_code":r,s=t.redirect_uri,o=void 0===s?this._settings.redirect_uri:s,a=t.client_id,u=void 0===a?this._settings.client_id:a,c=t.client_secret,l=void 0===c?this._settings.client_secret:c,d=w(t,i),h=this._logger.create("exchangeCode"),u||h.throw(new Error("A client_id is required")),o||h.throw(new Error("A redirect_uri is required")),d.code||h.throw(new Error("A code is required")),p=new URLSearchParams({grant_type:n,redirect_uri:o}),f=0,_=Object.entries(d);f<_.length;f++)v=P(_[f],2),y=v[0],null!=(m=v[1])&&p.set(y,m);e.t0=this._settings.client_authentication,e.next="client_secret_basic"===e.t0?10:"client_secret_post"===e.t0?15:18;break;case 10:if(l){e.next=13;break}throw h.throw(new Error("A client_secret is required")),null;case 13:return k=se.generateBasicAuth(u,l),e.abrupt("break",18);case 15:return p.append("client_id",u),l&&p.append("client_secret",l),e.abrupt("break",18);case 18:return e.next=20,this._metadataService.getTokenEndpoint(!1);case 20:return b=e.sent,h.debug("got token endpoint"),e.next=24,this._jsonService.postForm(b,{body:p,basicAuth:k,initCredentials:this._settings.fetchRequestCredentials});case 24:return S=e.sent,h.debug("got response"),e.abrupt("return",S);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"exchangeCredentials",value:(r=k(g().mark((function e(t){var r,n,i,o,a,u,c,l,d,h,p,f,_,v,y,m,k,b,S;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.grant_type,n=void 0===r?"password":r,i=t.client_id,o=void 0===i?this._settings.client_id:i,a=t.client_secret,u=void 0===a?this._settings.client_secret:a,c=t.scope,l=void 0===c?this._settings.scope:c,d=w(t,s),h=this._logger.create("exchangeCredentials"),o||h.throw(new Error("A client_id is required")),p=new URLSearchParams({grant_type:n,scope:l}),f=0,_=Object.entries(d);f<_.length;f++)v=P(_[f],2),y=v[0],null!=(m=v[1])&&p.set(y,m);e.t0=this._settings.client_authentication,e.next="client_secret_basic"===e.t0?8:"client_secret_post"===e.t0?13:16;break;case 8:if(u){e.next=11;break}throw h.throw(new Error("A client_secret is required")),null;case 11:return k=se.generateBasicAuth(o,u),e.abrupt("break",16);case 13:return p.append("client_id",o),u&&p.append("client_secret",u),e.abrupt("break",16);case 16:return e.next=18,this._metadataService.getTokenEndpoint(!1);case 18:return b=e.sent,h.debug("got token endpoint"),e.next=22,this._jsonService.postForm(b,{body:p,basicAuth:k,initCredentials:this._settings.fetchRequestCredentials});case 22:return S=e.sent,h.debug("got response"),e.abrupt("return",S);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"exchangeRefreshToken",value:(t=k(g().mark((function e(t){var r,n,i,s,a,u,c,l,d,h,p,f,_,v,y,m;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.grant_type,n=void 0===r?"refresh_token":r,i=t.client_id,s=void 0===i?this._settings.client_id:i,a=t.client_secret,u=void 0===a?this._settings.client_secret:a,c=t.timeoutInSeconds,l=w(t,o),d=this._logger.create("exchangeRefreshToken"),s||d.throw(new Error("A client_id is required")),l.refresh_token||d.throw(new Error("A refresh_token is required")),h=new URLSearchParams({grant_type:n}),p=g().mark((function e(){var t,r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=P(_[f],2),r=t[0],n=t[1],Array.isArray(n)?n.forEach((function(e){return h.append(r,e)})):null!=n&&h.set(r,n);case 2:case"end":return e.stop()}}),e)})),f=0,_=Object.entries(l);case 7:if(!(f<_.length)){e.next=12;break}return e.delegateYield(p(),"t0",9);case 9:f++,e.next=7;break;case 12:e.t1=this._settings.client_authentication,e.next="client_secret_basic"===e.t1?15:"client_secret_post"===e.t1?20:23;break;case 15:if(u){e.next=18;break}throw d.throw(new Error("A client_secret is required")),null;case 18:return v=se.generateBasicAuth(s,u),e.abrupt("break",23);case 20:return h.append("client_id",s),u&&h.append("client_secret",u),e.abrupt("break",23);case 23:return e.next=25,this._metadataService.getTokenEndpoint(!1);case 25:return y=e.sent,d.debug("got token endpoint"),e.next=29,this._jsonService.postForm(y,{body:h,basicAuth:v,timeoutInSeconds:c,initCredentials:this._settings.fetchRequestCredentials});case 29:return m=e.sent,d.debug("got response"),e.abrupt("return",m);case 32:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"revoke",value:(e=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("revoke"),t.token||n.throw(new Error("A token is required")),e.next=4,this._metadataService.getRevocationEndpoint(!1);case 4:for(i=e.sent,n.debug("got revocation endpoint, revoking ".concat(null!=(r=t.token_type_hint)?r:"default token type")),s=new URLSearchParams,o=0,a=Object.entries(t);o<a.length;o++)u=P(a[o],2),c=u[0],null!=(l=u[1])&&s.set(c,l);return s.set("client_id",this._settings.client_id),this._settings.client_secret&&s.set("client_secret",this._settings.client_secret),e.next=12,this._jsonService.postForm(i,{body:s});case 12:n.debug("got response");case 13:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e,t,r,n}(),Se=function(){return U((function e(t,r,n){C(this,e),this._settings=t,this._metadataService=r,this._claimsService=n,this._logger=new ie("ResponseValidator"),this._userInfoService=new ke(this._settings,this._metadataService),this._tokenClient=new be(this._settings,this._metadataService)}),[{key:"validateSigninResponse",value:(i=k(g().mark((function e(t,r){var n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("validateSigninResponse"),this._processSigninState(t,r),n.debug("state processed"),e.next=5,this._processCode(t,r);case 5:return n.debug("code processed"),t.isOpenId&&this._validateIdTokenAttributes(t),n.debug("tokens validated"),e.next=10,this._processClaims(t,null==r?void 0:r.skipUserInfo,t.isOpenId);case 10:n.debug("claims processed");case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"validateCredentialsResponse",value:(n=k(g().mark((function e(t,r){var n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("validateCredentialsResponse"),t.isOpenId&&t.id_token&&this._validateIdTokenAttributes(t),n.debug("tokens validated"),e.next=5,this._processClaims(t,r,t.isOpenId);case 5:n.debug("claims processed");case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"validateRefreshResponse",value:(r=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("validateRefreshResponse"),t.userState=r.data,null!=t.session_state||(t.session_state=r.session_state),null!=t.scope||(t.scope=r.scope),t.isOpenId&&t.id_token&&(this._validateIdTokenAttributes(t,r.id_token),n.debug("ID Token validated")),t.id_token||(t.id_token=r.id_token,t.profile=r.profile),i=t.isOpenId&&!!t.id_token,e.next=9,this._processClaims(t,!1,i);case 9:n.debug("claims processed");case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"validateSignoutResponse",value:function(e,t){var r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new he(e)}},{key:"_processSigninState",value:function(e,t){var r=this._logger.create("_processSigninState");if(t.id!==e.state&&r.throw(new Error("State does not match")),t.client_id||r.throw(new Error("No client_id on state")),t.authority||r.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,null!=e.scope||(e.scope=t.scope),e.error)throw r.warn("Response was error",e.error),new he(e);t.code_verifier&&!e.code&&r.throw(new Error("Expected code in response"))}},{key:"_processClaims",value:(t=k(g().mark((function e(t){var r,n,i,s,o=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=o.length>1&&void 0!==o[1]&&o[1],n=!(o.length>2&&void 0!==o[2])||o[2],i=this._logger.create("_processClaims"),t.profile=this._claimsService.filterProtocolClaims(t.profile),!r&&this._settings.loadUserInfo&&t.access_token){e.next=7;break}return i.debug("not loading user info"),e.abrupt("return");case 7:return i.debug("loading user info"),e.next=10,this._userInfoService.getClaims(t.access_token);case 10:s=e.sent,i.debug("user info claims received from user info endpoint"),n&&s.sub!==t.profile.sub&&i.throw(new Error("subject from UserInfo response does not match subject in ID Token")),t.profile=this._claimsService.mergeClaims(t.profile,this._claimsService.filterProtocolClaims(s)),i.debug("user info claims received, updated profile:",t.profile);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_processCode",value:(e=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._logger.create("_processCode"),!t.code){e.next=9;break}return n.debug("Validating code"),e.next=5,this._tokenClient.exchangeCode(v({client_id:r.client_id,client_secret:r.client_secret,code:t.code,redirect_uri:r.redirect_uri,code_verifier:r.code_verifier},r.extraTokenParams));case 5:i=e.sent,Object.assign(t,i),e.next=10;break;case 9:n.debug("No code to process");case 10:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})},{key:"_validateIdTokenAttributes",value:function(e,t){var r,n=this._logger.create("_validateIdTokenAttributes");n.debug("decoding ID Token JWT");var i=ue.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){var s=ue.decode(t);i.sub!==s.sub&&n.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==s.auth_time&&n.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==s.azp&&n.throw(new Error("azp in id_token does not match original azp")),!i.azp&&s.azp&&n.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}}]);var e,t,r,n,i}(),xe=function(){function e(t){C(this,e),this.id=t.id||se.generateUUIDv4(),this.data=t.data,t.created&&t.created>0?this.created=t.created:this.created=le.getEpochTime(),this.request_type=t.request_type,this.url_state=t.url_state}return U(e,[{key:"toStorageString",value:function(){return new ie("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}}],[{key:"fromStorageString",value:function(t){return ie.createStatic("State","fromStorageString"),new e(JSON.parse(t))}},{key:"clearStaleState",value:(t=k(g().mark((function t(r,n){var i,s,o,a,u,c,l,d;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=ie.createStatic("State","clearStaleState"),s=le.getEpochTime()-n,t.next=4,r.getAllKeys();case 4:o=t.sent,i.debug("got keys",o),a=0;case 7:if(!(a<o.length)){t.next=18;break}return u=o[a],t.next=11,r.get(u);case 11:if(c=t.sent,l=!1,c)try{d=e.fromStorageString(c),i.debug("got item from key:",u,d.created),d.created<=s&&(l=!0)}catch(e){i.error("Error parsing state for key:",u,e),l=!0}else i.debug("no item in storage for key:",u),l=!0;l&&(i.debug("removed item for key:",u),r.remove(u));case 15:a++,t.next=7;break;case 18:case"end":return t.stop()}}),t)}))),function(e,r){return t.apply(this,arguments)})}]);var t}(),Ee=function(e){function t(e){var r;return C(this,t),r=S(this,t,[e]),!0===e.code_verifier?r.code_verifier=se.generateCodeVerifier():e.code_verifier&&(r.code_verifier=e.code_verifier),r.code_verifier&&(r.code_challenge=se.generateCodeChallenge(r.code_verifier)),r.authority=e.authority,r.client_id=e.client_id,r.redirect_uri=e.redirect_uri,r.scope=e.scope,r.client_secret=e.client_secret,r.extraTokenParams=e.extraTokenParams,r.response_mode=e.response_mode,r.skipUserInfo=e.skipUserInfo,r}return E(t,e),U(t,[{key:"toStorageString",value:function(){return new ie("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}}],[{key:"fromStorageString",value:function(e){return ie.createStatic("SigninState","fromStorageString"),new t(JSON.parse(e))}}])}(xe),Te=U((function e(t){var r=t.url,n=t.authority,i=t.client_id,s=t.redirect_uri,o=t.response_type,u=t.scope,c=t.state_data,l=t.response_mode,d=t.request_type,h=t.client_secret,p=t.nonce,f=t.url_state,g=t.resource,_=t.skipUserInfo,y=t.extraQueryParams,m=t.extraTokenParams,k=t.disablePKCE,b=w(t,a);if(C(this,e),this._logger=new ie("SigninRequest"),!r)throw this._logger.error("ctor: No url passed"),new Error("url");if(!i)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!s)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!o)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!u)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!n)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new Ee({data:c,request_type:d,url_state:f,code_verifier:!k,client_id:i,authority:n,redirect_uri:s,response_mode:l,client_secret:h,scope:u,extraTokenParams:m,skipUserInfo:_});var S=new URL(r);S.searchParams.append("client_id",i),S.searchParams.append("redirect_uri",s),S.searchParams.append("response_type",o),S.searchParams.append("scope",u),p&&S.searchParams.append("nonce",p);var x=this.state.id;f&&(x="".concat(x).concat(";").concat(f)),S.searchParams.append("state",x),this.state.code_challenge&&(S.searchParams.append("code_challenge",this.state.code_challenge),S.searchParams.append("code_challenge_method","S256")),g&&(Array.isArray(g)?g:[g]).forEach((function(e){return S.searchParams.append("resource",e)}));for(var E=0,T=Object.entries(v(v({response_mode:l},b),y));E<T.length;E++){var I=P(T[E],2),O=I[0],R=I[1];null!=R&&S.searchParams.append(O,R.toString())}this.url=S.href})),Ie=function(){return U((function e(t){if(C(this,e),this.access_token="",this.token_type="",this.profile={},this.state=t.get("state"),this.session_state=t.get("session_state"),this.state){var r=decodeURIComponent(this.state).split(";");this.state=r[0],r.length>1&&(this.url_state=r.slice(1).join(";"))}this.error=t.get("error"),this.error_description=t.get("error_description"),this.error_uri=t.get("error_uri"),this.code=t.get("code")}),[{key:"expires_in",get:function(){if(void 0!==this.expires_at)return this.expires_at-le.getEpochTime()},set:function(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+le.getEpochTime())}},{key:"isOpenId",get:function(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}}])}(),Oe=U((function e(t){var r=t.url,n=t.state_data,i=t.id_token_hint,s=t.post_logout_redirect_uri,o=t.extraQueryParams,a=t.request_type,u=t.client_id;if(C(this,e),this._logger=new ie("SignoutRequest"),!r)throw this._logger.error("ctor: No url passed"),new Error("url");var c=new URL(r);i&&c.searchParams.append("id_token_hint",i),u&&c.searchParams.append("client_id",u),s&&(c.searchParams.append("post_logout_redirect_uri",s),n&&(this.state=new xe({data:n,request_type:a}),c.searchParams.append("state",this.state.id)));for(var l=0,d=Object.entries(v({},o));l<d.length;l++){var h=P(d[l],2),p=h[0],f=h[1];null!=f&&c.searchParams.append(p,f.toString())}this.url=c.href})),Pe=U((function e(t){C(this,e),this.state=t.get("state"),this.error=t.get("error"),this.error_description=t.get("error_description"),this.error_uri=t.get("error_uri")})),Re=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],Ce=["sub","iss","aud","exp","iat"],je=function(){return U((function e(t){C(this,e),this._settings=t,this._logger=new ie("ClaimsService")}),[{key:"filterProtocolClaims",value:function(e){var t=v({},e);if(this._settings.filterProtocolClaims){var r,n=q(Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:Re);try{for(n.s();!(r=n.n()).done;){var i=r.value;Ce.includes(i)||delete t[i]}}catch(e){n.e(e)}finally{n.f()}}return t}},{key:"mergeClaims",value:function(e,t){for(var r=v({},e),n=0,i=Object.entries(t);n<i.length;n++){var s,o=P(i[n],2),a=o[0],u=o[1],c=q(Array.isArray(u)?u:[u]);try{for(c.s();!(s=c.n()).done;){var l=s.value,d=r[a];void 0===d?r[a]=l:Array.isArray(d)?d.includes(l)||d.push(l):r[a]!==l&&("object"===H(l)&&this._settings.mergeClaims?r[a]=this.mergeClaims(d,l):r[a]=[d,l])}}catch(e){c.e(e)}finally{c.f()}}return r}}])}(),Ue=function(){return U((function e(t,r){C(this,e),this._logger=new ie("OidcClient"),this.settings=t instanceof me?t:new me(t),this.metadataService=null!=r?r:new ye(this.settings),this._claimsService=new je(this.settings),this._validator=new Se(this.settings,this.metadataService,this._claimsService),this._tokenClient=new be(this.settings,this.metadataService)}),[{key:"createSigninRequest",value:(u=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l,d,h,p,f,_,v,y,w,m,k,b,S,x,E,T,I,O,P,R,C,j,U,A,q,M,N,H,L;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.state,n=t.request,i=t.request_uri,s=t.request_type,o=t.id_token_hint,a=t.login_hint,u=t.skipUserInfo,c=t.nonce,l=t.url_state,d=t.response_type,h=void 0===d?this.settings.response_type:d,p=t.scope,f=void 0===p?this.settings.scope:p,_=t.redirect_uri,v=void 0===_?this.settings.redirect_uri:_,y=t.prompt,w=void 0===y?this.settings.prompt:y,m=t.display,k=void 0===m?this.settings.display:m,b=t.max_age,S=void 0===b?this.settings.max_age:b,x=t.ui_locales,E=void 0===x?this.settings.ui_locales:x,T=t.acr_values,I=void 0===T?this.settings.acr_values:T,O=t.resource,P=void 0===O?this.settings.resource:O,R=t.response_mode,C=void 0===R?this.settings.response_mode:R,j=t.extraQueryParams,U=void 0===j?this.settings.extraQueryParams:j,A=t.extraTokenParams,q=void 0===A?this.settings.extraTokenParams:A,M=this._logger.create("createSigninRequest"),"code"===h){e.next=4;break}throw new Error("Only the Authorization Code flow (with PKCE) is supported");case 4:return e.next=6,this.metadataService.getAuthorizationEndpoint();case 6:return N=e.sent,M.debug("Received authorization endpoint",N),H=new Te({url:N,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:v,response_type:h,scope:f,state_data:r,url_state:l,prompt:w,display:k,max_age:S,ui_locales:E,id_token_hint:o,login_hint:a,acr_values:I,resource:P,request:n,request_uri:i,extraQueryParams:U,extraTokenParams:q,request_type:s,response_mode:C,client_secret:this.settings.client_secret,skipUserInfo:u,nonce:c,disablePKCE:this.settings.disablePKCE}),e.next=11,this.clearStaleState();case 11:return L=H.state,e.next=14,this.settings.stateStore.set(L.id,L.toStorageString());case 14:return e.abrupt("return",H);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"readSigninResponseState",value:(a=k(g().mark((function e(t){var r,n,i,s,o,a=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>1&&void 0!==a[1]&&a[1],n=this._logger.create("readSigninResponseState"),(i=new Ie(de.readParams(t,this.settings.response_mode))).state){e.next=6;break}throw n.throw(new Error("No state in response")),null;case 6:return e.next=8,this.settings.stateStore[r?"remove":"get"](i.state);case 8:if(s=e.sent){e.next=12;break}throw n.throw(new Error("No matching state found in storage")),null;case 12:return o=Ee.fromStorageString(s),e.abrupt("return",{state:o,response:i});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"processSigninResponse",value:(o=k(g().mark((function e(t){var r,n,i,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._logger.create("processSigninResponse"),e.next=3,this.readSigninResponseState(t,!0);case 3:return n=e.sent,i=n.state,s=n.response,r.debug("received state from storage; validating response"),e.next=9,this._validator.validateSigninResponse(s,i);case 9:return e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"processResourceOwnerPasswordCredentials",value:(s=k(g().mark((function e(t){var r,n,i,s,o,a,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.username,n=t.password,i=t.skipUserInfo,s=void 0!==i&&i,o=t.extraTokenParams,a=void 0===o?{}:o,e.next=3,this._tokenClient.exchangeCredentials(v({username:r,password:n},a));case 3:return u=e.sent,c=new Ie(new URLSearchParams),Object.assign(c,u),e.next=8,this._validator.validateCredentialsResponse(c,s);case 8:return e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"useRefreshToken",value:(i=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.state,n=t.timeoutInSeconds,s=this._logger.create("useRefreshToken"),void 0===this.settings.refreshTokenAllowedScope?o=r.scope:(a=this.settings.refreshTokenAllowedScope.split(" "),u=(null==(i=r.scope)?void 0:i.split(" "))||[],o=u.filter((function(e){return a.includes(e)})).join(" ")),e.next=5,this._tokenClient.exchangeRefreshToken({refresh_token:r.refresh_token,resource:r.resource,scope:o,timeoutInSeconds:n});case 5:return c=e.sent,l=new Ie(new URLSearchParams),Object.assign(l,c),s.debug("validating response",l),e.next=11,this._validator.validateRefreshResponse(l,v(v({},r),{},{scope:o}));case 11:return e.abrupt("return",l);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"createSignoutRequest",value:(n=k(g().mark((function e(){var t,r,n,i,s,o,a,u,c,l,d,h,p,f=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=(t=f.length>0&&void 0!==f[0]?f[0]:{}).state,n=t.id_token_hint,i=t.client_id,s=t.request_type,o=t.post_logout_redirect_uri,a=void 0===o?this.settings.post_logout_redirect_uri:o,u=t.extraQueryParams,c=void 0===u?this.settings.extraQueryParams:u,l=this._logger.create("createSignoutRequest"),e.next=4,this.metadataService.getEndSessionEndpoint();case 4:if(d=e.sent){e.next=8;break}throw l.throw(new Error("No end session endpoint")),null;case 8:return l.debug("Received end session endpoint",d),i||!a||n||(i=this.settings.client_id),h=new Oe({url:d,id_token_hint:n,client_id:i,post_logout_redirect_uri:a,state_data:r,extraQueryParams:c,request_type:s}),e.next=13,this.clearStaleState();case 13:if(!(p=h.state)){e.next=18;break}return l.debug("Signout request has state to persist"),e.next=18,this.settings.stateStore.set(p.id,p.toStorageString());case 18:return e.abrupt("return",h);case 19:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"readSignoutResponseState",value:(r=k(g().mark((function e(t){var r,n,i,s,o,a=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>1&&void 0!==a[1]&&a[1],n=this._logger.create("readSignoutResponseState"),(i=new Pe(de.readParams(t,this.settings.response_mode))).state){e.next=9;break}if(n.debug("No state in response"),!i.error){e.next=8;break}throw n.warn("Response was error:",i.error),new he(i);case 8:return e.abrupt("return",{state:void 0,response:i});case 9:return e.next=11,this.settings.stateStore[r?"remove":"get"](i.state);case 11:if(s=e.sent){e.next=15;break}throw n.throw(new Error("No matching state found in storage")),null;case 15:return o=xe.fromStorageString(s),e.abrupt("return",{state:o,response:i});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"processSignoutResponse",value:(t=k(g().mark((function e(t){var r,n,i,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._logger.create("processSignoutResponse"),e.next=3,this.readSignoutResponseState(t,!0);case 3:return n=e.sent,i=n.state,s=n.response,i?(r.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(s,i)):r.debug("No state from storage; skipping response validation"),e.abrupt("return",s);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"clearStaleState",value:function(){return this._logger.create("clearStaleState"),xe.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}},{key:"revokeToken",value:(e=k(g().mark((function e(t,r){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("revokeToken"),e.next=3,this._tokenClient.revoke({token:t,token_type_hint:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})}]);var e,t,r,n,i,s,o,a,u}(),Ae=function(){return U((function e(t){var r=this;C(this,e),this._userManager=t,this._logger=new ie("SessionMonitor"),this._start=function(){var e=k(g().mark((function e(t){var n,i,s,o,a,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.session_state){e.next=3;break}return e.abrupt("return");case 3:if(i=r._logger.create("_start"),t.profile?(r._sub=t.profile.sub,r._sid=t.profile.sid,i.debug("session_state",n,", sub",r._sub)):(r._sub=void 0,r._sid=void 0,i.debug("session_state",n,", anonymous user")),!r._checkSessionIFrame){e.next=8;break}return r._checkSessionIFrame.start(n),e.abrupt("return");case 8:return e.prev=8,e.next=11,r._userManager.metadataService.getCheckSessionIframe();case 11:if(!(s=e.sent)){e.next=24;break}return i.debug("initializing check session iframe"),o=r._userManager.settings.client_id,a=r._userManager.settings.checkSessionIntervalInSeconds,u=r._userManager.settings.stopCheckSessionOnError,c=new ge(r._callback,o,s,a,u),e.next=20,c.load();case 20:r._checkSessionIFrame=c,c.start(n),e.next=25;break;case 24:i.warn("no check session iframe found in the metadata");case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(8),i.error("Error from getCheckSessionIframe:",e.t0 instanceof Error?e.t0.message:e.t0);case 30:case"end":return e.stop()}}),e,null,[[8,27]])})));return function(t){return e.apply(this,arguments)}}(),this._stop=function(){var e=r._logger.create("_stop");if(r._sub=void 0,r._sid=void 0,r._checkSessionIFrame&&r._checkSessionIFrame.stop(),r._userManager.settings.monitorAnonymousSession)var t=setInterval(k(g().mark((function n(){var i,s;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return clearInterval(t),n.prev=1,n.next=4,r._userManager.querySessionStatus();case 4:(i=n.sent)&&(s={session_state:i.session_state,profile:i.sub&&i.sid?{sub:i.sub,sid:i.sid}:null},r._start(s)),n.next=11;break;case 8:n.prev=8,n.t0=n.catch(1),e.error("error from querySessionStatus",n.t0 instanceof Error?n.t0.message:n.t0);case 11:case"end":return n.stop()}}),n,null,[[1,8]])}))),1e3)},this._callback=k(g().mark((function e(){var t,n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r._logger.create("_callback"),e.prev=1,e.next=4,r._userManager.querySessionStatus();case 4:n=e.sent,i=!0,n&&r._checkSessionIFrame?n.sub===r._sub?(i=!1,r._checkSessionIFrame.start(n.session_state),n.sid===r._sid?t.debug("same sub still logged in at OP, restarting check session iframe; session_state",n.session_state):(t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",n.session_state),r._userManager.events._raiseUserSessionChanged())):t.debug("different subject signed into OP",n.sub):t.debug("subject no longer signed into OP"),i?r._sub?r._userManager.events._raiseUserSignedOut():r._userManager.events._raiseUserSignedIn():t.debug("no change in session detected, no event to raise"),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(1),r._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",e.t0),r._userManager.events._raiseUserSignedOut());case 13:case"end":return e.stop()}}),e,null,[[1,10]])}))),t||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((function(e){r._logger.error(e)}))}),[{key:"_init",value:(e=k(g().mark((function e(){var t,r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("_init"),e.next=3,this._userManager.getUser();case 3:if(!(t=e.sent)){e.next=8;break}this._start(t),e.next=13;break;case 8:if(!this._userManager.settings.monitorAnonymousSession){e.next=13;break}return e.next=11,this._userManager.querySessionStatus();case 11:(r=e.sent)&&(n={session_state:r.session_state,profile:r.sub&&r.sid?{sub:r.sub,sid:r.sid}:null},this._start(n));case 13:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e}(),qe=function(){function e(t){var r;C(this,e),this.id_token=t.id_token,this.session_state=null!=(r=t.session_state)?r:null,this.access_token=t.access_token,this.refresh_token=t.refresh_token,this.token_type=t.token_type,this.scope=t.scope,this.profile=t.profile,this.expires_at=t.expires_at,this.state=t.userState,this.url_state=t.url_state}return U(e,[{key:"expires_in",get:function(){if(void 0!==this.expires_at)return this.expires_at-le.getEpochTime()},set:function(e){void 0!==e&&(this.expires_at=Math.floor(e)+le.getEpochTime())}},{key:"expired",get:function(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:"scopes",get:function(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}},{key:"toStorageString",value:function(){return new ie("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}}],[{key:"fromStorageString",value:function(t){return ie.createStatic("User","fromStorageString"),new e(JSON.parse(t))}}])}(),Me="oidc-client",Ne=function(){return U((function e(){C(this,e),this._abort=new oe("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}),[{key:"navigate",value:(e=k(g().mark((function e(t){var r,n,i,s,o=this;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._logger.create("navigate"),this._window){e.next=3;break}throw new Error("Attempted to navigate on a disposed window");case 3:return r.debug("setting URL in window"),this._window.location.replace(t.url),e.next=7,new Promise((function(e,n){var i=function(i){var s,a=i.data,u=null!=(s=t.scriptOrigin)?s:window.location.origin;if(i.origin===u&&(null==a?void 0:a.source)===Me){try{var c=de.readParams(a.url,t.response_mode).get("state");if(c||r.warn("no state found in response url"),i.source!==o._window&&c!==t.state)return}catch(e){o._dispose(),n(new Error("Invalid response from window"))}e(a)}};window.addEventListener("message",i,!1),o._disposeHandlers.add((function(){return window.removeEventListener("message",i,!1)})),o._disposeHandlers.add(o._abort.addHandler((function(e){o._dispose(),n(e)})))}));case 7:return n=e.sent,i=n.url,s=n.keepOpen,r.debug("got response from window"),this._dispose(),s||this.close(),e.abrupt("return",{url:i});case 14:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"_dispose",value:function(){this._logger.create("_dispose");var e,t=q(this._disposeHandlers);try{for(t.s();!(e=t.n()).done;)(0,e.value)()}catch(e){t.e(e)}finally{t.f()}this._disposeHandlers.clear()}}],[{key:"_notifyParent",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window.location.origin;e.postMessage({source:Me,url:t,keepOpen:r},n)}}]);var e}(),He={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Le="_blank",We=function(e){function t(e){var r;C(this,t);var n=e.popup_redirect_uri,i=void 0===n?e.redirect_uri:n,s=e.popup_post_logout_redirect_uri,o=void 0===s?e.post_logout_redirect_uri:s,a=e.popupWindowFeatures,u=void 0===a?He:a,c=e.popupWindowTarget,l=void 0===c?Le:c,d=e.redirectMethod,h=void 0===d?"assign":d,p=e.redirectTarget,f=void 0===p?"self":p,g=e.iframeNotifyParentOrigin,_=void 0===g?e.iframeNotifyParentOrigin:g,v=e.iframeScriptOrigin,y=void 0===v?e.iframeScriptOrigin:v,w=e.silent_redirect_uri,m=void 0===w?e.redirect_uri:w,k=e.silentRequestTimeoutInSeconds,b=void 0===k?10:k,x=e.automaticSilentRenew,E=void 0===x||x,T=e.validateSubOnSilentRenew,I=void 0===T||T,O=e.includeIdTokenInSilentRenew,P=void 0!==O&&O,R=e.monitorSession,j=void 0!==R&&R,U=e.monitorAnonymousSession,A=void 0!==U&&U,q=e.checkSessionIntervalInSeconds,M=void 0===q?2:q,N=e.query_status_response_type,H=void 0===N?"code":N,L=e.stopCheckSessionOnError,W=void 0===L||L,F=e.revokeTokenTypes,B=void 0===F?["access_token","refresh_token"]:F,z=e.revokeTokensOnSignout,K=void 0!==z&&z,J=e.includeIdTokenInSilentSignout,D=void 0!==J&&J,G=e.accessTokenExpiringNotificationTimeInSeconds,Q=void 0===G?60:G,V=e.userStore;if((r=S(this,t,[e])).popup_redirect_uri=i,r.popup_post_logout_redirect_uri=o,r.popupWindowFeatures=u,r.popupWindowTarget=l,r.redirectMethod=h,r.redirectTarget=f,r.iframeNotifyParentOrigin=_,r.iframeScriptOrigin=y,r.silent_redirect_uri=m,r.silentRequestTimeoutInSeconds=b,r.automaticSilentRenew=E,r.validateSubOnSilentRenew=I,r.includeIdTokenInSilentRenew=P,r.monitorSession=j,r.monitorAnonymousSession=A,r.checkSessionIntervalInSeconds=M,r.stopCheckSessionOnError=W,r.query_status_response_type=H,r.revokeTokenTypes=B,r.revokeTokensOnSignout=K,r.includeIdTokenInSilentSignout=D,r.accessTokenExpiringNotificationTimeInSeconds=Q,V)r.userStore=V;else{var Y="undefined"!=typeof window?window.sessionStorage:new _e;r.userStore=new we({store:Y})}return r}return E(t,e),U(t)}(me),Fe=function(e){function t(e){var r,n=e.silentRequestTimeoutInSeconds,i=void 0===n?10:n;return C(this,t),(r=S(this,t))._logger=new ie("IFrameWindow"),r._timeoutInSeconds=i,r._frame=t.createHiddenIframe(),r._window=r._frame.contentWindow,r}return E(t,e),U(t,[{key:"navigate",value:(r=k(g().mark((function e(r){var n,i=this;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds),n=setTimeout((function(){return i._abort.raise(new pe("IFrame timed out without a response"))}),1e3*this._timeoutInSeconds),this._disposeHandlers.add((function(){return clearTimeout(n)})),e.next=5,I(O(t.prototype),"navigate",this).call(this,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"close",value:function(){var e,t=this;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(function(e){var r,n=e.target;null==(r=n.parentNode)||r.removeChild(n),t._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}}],[{key:"createHiddenIframe",value:function(){var e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",window.document.body.appendChild(e),e}},{key:"notifyParent",value:function(e,r){return I(O(t),"_notifyParent",this).call(this,window.parent,e,!1,r)}}]);var r}(Ne),Be=function(){return U((function e(t){C(this,e),this._settings=t,this._logger=new ie("IFrameNavigator")}),[{key:"prepare",value:(t=k(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.silentRequestTimeoutInSeconds,n=void 0===r?this._settings.silentRequestTimeoutInSeconds:r,e.abrupt("return",new Fe({silentRequestTimeoutInSeconds:n}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"callback",value:(e=k(g().mark((function e(t){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._logger.create("callback"),Fe.notifyParent(t,this._settings.iframeNotifyParentOrigin);case 2:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e,t}(),ze=function(e){function t(e){var r,n=e.popupWindowTarget,i=void 0===n?Le:n,s=e.popupWindowFeatures,o=void 0===s?{}:s;C(this,t),(r=S(this,t))._logger=new ie("PopupWindow");var a=ce.center(v(v({},He),o));return r._window=window.open(void 0,i,ce.serialize(a)),o.closePopupWindowAfterInSeconds&&o.closePopupWindowAfterInSeconds>0&&setTimeout((function(){r._window&&"boolean"==typeof r._window.closed&&!r._window.closed?r.close():r._abort.raise(new Error("Popup blocked by user"))}),1e3*o.closePopupWindowAfterInSeconds),r}return E(t,e),U(t,[{key:"navigate",value:(r=k(g().mark((function e(r){var n,i,s=this;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==(n=this._window)||n.focus(),i=setInterval((function(){s._window&&!s._window.closed||s._abort.raise(new Error("Popup closed by user"))}),500),this._disposeHandlers.add((function(){return clearInterval(i)})),e.next=5,I(O(t.prototype),"navigate",this).call(this,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"close",value:function(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}}],[{key:"notifyOpener",value:function(e,r){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return I(O(t),"_notifyParent",this).call(this,window.opener,e,r)}}]);var r}(Ne),Ke=function(){return U((function e(t){C(this,e),this._settings=t,this._logger=new ie("PopupNavigator")}),[{key:"prepare",value:(t=k(g().mark((function e(t){var r,n,i,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.popupWindowFeatures,n=void 0===r?this._settings.popupWindowFeatures:r,i=t.popupWindowTarget,s=void 0===i?this._settings.popupWindowTarget:i,e.abrupt("return",new ze({popupWindowFeatures:n,popupWindowTarget:s}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"callback",value:(e=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=r.keepOpen,i=void 0!==n&&n,this._logger.create("callback"),ze.notifyOpener(t,i);case 3:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})}]);var e,t}(),Je=function(){return U((function e(t){C(this,e),this._settings=t,this._logger=new ie("RedirectNavigator")}),[{key:"prepare",value:(t=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l=this;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.redirectMethod,n=void 0===r?this._settings.redirectMethod:r,i=t.redirectTarget,s=void 0===i?this._settings.redirectTarget:i,this._logger.create("prepare"),a=window.self,"top"===s&&(a=null!=(o=window.top)?o:window.self),u=a.location[n].bind(a.location),e.abrupt("return",{navigate:function(){var e=k(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l._logger.create("navigate"),r=new Promise((function(e,t){c=t})),u(t.url),e.next=5,r;case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),close:function(){l._logger.create("close"),null==c||c(new Error("Redirect aborted")),a.stop()}});case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"callback",value:(e=k(g().mark((function e(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return");case 1:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})}]);var e,t}(),De=function(e){function t(e){var r;return C(this,t),(r=S(this,t,[{expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}]))._logger=new ie("UserManagerEvents"),r._userLoaded=new oe("User loaded"),r._userUnloaded=new oe("User unloaded"),r._silentRenewError=new oe("Silent renew error"),r._userSignedIn=new oe("User signed in"),r._userSignedOut=new oe("User signed out"),r._userSessionChanged=new oe("User session changed"),r}return E(t,e),U(t,[{key:"load",value:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];I(O(t.prototype),"load",this).call(this,e),r&&this._userLoaded.raise(e)}},{key:"unload",value:function(){I(O(t.prototype),"unload",this).call(this),this._userUnloaded.raise()}},{key:"addUserLoaded",value:function(e){return this._userLoaded.addHandler(e)}},{key:"removeUserLoaded",value:function(e){return this._userLoaded.removeHandler(e)}},{key:"addUserUnloaded",value:function(e){return this._userUnloaded.addHandler(e)}},{key:"removeUserUnloaded",value:function(e){return this._userUnloaded.removeHandler(e)}},{key:"addSilentRenewError",value:function(e){return this._silentRenewError.addHandler(e)}},{key:"removeSilentRenewError",value:function(e){return this._silentRenewError.removeHandler(e)}},{key:"_raiseSilentRenewError",value:function(e){this._silentRenewError.raise(e)}},{key:"addUserSignedIn",value:function(e){return this._userSignedIn.addHandler(e)}},{key:"removeUserSignedIn",value:function(e){this._userSignedIn.removeHandler(e)}},{key:"_raiseUserSignedIn",value:function(){this._userSignedIn.raise()}},{key:"addUserSignedOut",value:function(e){return this._userSignedOut.addHandler(e)}},{key:"removeUserSignedOut",value:function(e){this._userSignedOut.removeHandler(e)}},{key:"_raiseUserSignedOut",value:function(){this._userSignedOut.raise()}},{key:"addUserSessionChanged",value:function(e){return this._userSessionChanged.addHandler(e)}},{key:"removeUserSessionChanged",value:function(e){this._userSessionChanged.removeHandler(e)}},{key:"_raiseUserSessionChanged",value:function(){this._userSessionChanged.raise()}}])}(fe),Ge=function(){return U((function e(t){var r=this;C(this,e),this._userManager=t,this._logger=new ie("SilentRenewService"),this._isStarted=!1,this._retryTimer=new le("Retry Silent Renew"),this._tokenExpiring=k(g().mark((function e(){var t;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r._logger.create("_tokenExpiring"),e.prev=1,e.next=4,r._userManager.signinSilent();case 4:t.debug("silent token renewal successful"),e.next=15;break;case 7:if(e.prev=7,e.t0=e.catch(1),!(e.t0 instanceof pe)){e.next=13;break}return t.warn("ErrorTimeout from signinSilent:",e.t0,"retry in 5s"),r._retryTimer.init(5),e.abrupt("return");case 13:t.error("Error from signinSilent:",e.t0),r._userManager.events._raiseSilentRenewError(e.t0);case 15:case"end":return e.stop()}}),e,null,[[1,7]])})))}),[{key:"start",value:(e=k(g().mark((function e(){var t;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._logger.create("start"),this._isStarted){e.next=13;break}return this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring),e.prev=5,e.next=8,this._userManager.getUser();case 8:e.next=13;break;case 10:e.prev=10,e.t0=e.catch(5),t.error("getUser error",e.t0);case 13:case"end":return e.stop()}}),e,this,[[5,10]])}))),function(){return e.apply(this,arguments)})},{key:"stop",value:function(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}]);var e}(),Qe=U((function e(t,r){C(this,e),this.refresh_token=t.refresh_token,this.id_token=t.id_token,this.session_state=t.session_state,this.scope=t.scope,this.profile=t.profile,this.resource=r,this.data=t.state})),Ve=function(){return U((function e(t,r,n,i){C(this,e),this._logger=new ie("UserManager"),this.settings=new We(t),this._client=new Ue(t),this._redirectNavigator=null!=r?r:new Je(this.settings),this._popupNavigator=null!=n?n:new Ke(this.settings),this._iframeNavigator=null!=i?i:new Be(this.settings),this._events=new De(this.settings),this._silentRenewService=new Ge(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new Ae(this))}),[{key:"events",get:function(){return this._events}},{key:"metadataService",get:function(){return this._client.metadataService}},{key:"getUser",value:(K=k(g().mark((function e(){var t,r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._logger.create("getUser"),e.next=3,this._loadUser();case 3:if(!(r=e.sent)){e.next=8;break}return t.info("user loaded"),this._events.load(r,!1),e.abrupt("return",r);case 8:return t.info("user not found in storage"),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,this)}))),function(){return K.apply(this,arguments)})},{key:"removeUser",value:(z=k(g().mark((function e(){var t;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._logger.create("removeUser"),e.next=3,this.storeUser(null);case 3:t.info("user removed from storage"),this._events.unload();case 5:case"end":return e.stop()}}),e,this)}))),function(){return z.apply(this,arguments)})},{key:"signinRedirect",value:(B=k(g().mark((function e(){var t,r,n,i,s=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},this._logger.create("signinRedirect"),r=t.redirectMethod,n=w(t,u),e.next=5,this._redirectNavigator.prepare({redirectMethod:r});case 5:return i=e.sent,e.next=8,this._signinStart(v({request_type:"si:r"},n),i);case 8:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"signinRedirectCallback",value:(F=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,r=this._logger.create("signinRedirectCallback"),e.next=4,this._signinEnd(t);case 4:return(n=e.sent).profile&&n.profile.sub?r.info("success, signed in subject",n.profile.sub):r.info("no subject"),e.abrupt("return",n);case 7:case"end":return e.stop()}}),e,this)}))),function(){return F.apply(this,arguments)})},{key:"signinResourceOwnerCredentials",value:(W=k(g().mark((function e(t){var r,n,i,s,o,a,u;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.username,n=t.password,i=t.skipUserInfo,s=void 0!==i&&i,o=this._logger.create("signinResourceOwnerCredential"),e.next=4,this._client.processResourceOwnerPasswordCredentials({username:r,password:n,skipUserInfo:s,extraTokenParams:this.settings.extraTokenParams});case 4:return a=e.sent,o.debug("got signin response"),e.next=8,this._buildUser(a);case 8:return(u=e.sent).profile&&u.profile.sub?o.info("success, signed in subject",u.profile.sub):o.info("no subject"),e.abrupt("return",u);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return W.apply(this,arguments)})},{key:"signinPopup",value:(L=k(g().mark((function e(){var t,r,n,i,s,o,a,u,l=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:{},r=this._logger.create("signinPopup"),n=t.popupWindowFeatures,i=t.popupWindowTarget,s=w(t,c),(o=this.settings.popup_redirect_uri)||r.throw(new Error("No popup_redirect_uri configured")),e.next=7,this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:i});case 7:return a=e.sent,e.next=10,this._signin(v({request_type:"si:p",redirect_uri:o,display:"popup"},s),a);case 10:return(u=e.sent)&&(u.profile&&u.profile.sub?r.info("success, signed in subject",u.profile.sub):r.info("no subject")),e.abrupt("return",u);case 13:case"end":return e.stop()}}),e,this)}))),function(){return L.apply(this,arguments)})},{key:"signinPopupCallback",value:(H=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,r=i.length>1&&void 0!==i[1]&&i[1],n=this._logger.create("signinPopupCallback"),e.next=5,this._popupNavigator.callback(t,{keepOpen:r});case 5:n.info("success");case 6:case"end":return e.stop()}}),e,this)}))),function(){return H.apply(this,arguments)})},{key:"signinSilent",value:(N=k(g().mark((function e(){var t,r,n,i,s,o,a,u,c,d,h,p=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},n=this._logger.create("signinSilent"),i=t.silentRequestTimeoutInSeconds,s=t.resource,o=w(t,l),e.next=5,this._loadUser();case 5:if(!(null==(a=e.sent)?void 0:a.refresh_token)){e.next=12;break}return n.debug("using refresh token"),u=new Qe(a,s),e.next=11,this._useRefreshToken(u);case 11:return e.abrupt("return",e.sent);case 12:return(c=this.settings.silent_redirect_uri)||n.throw(new Error("No silent_redirect_uri configured")),a&&this.settings.validateSubOnSilentRenew&&(n.debug("subject prior to silent renew:",a.profile.sub),d=a.profile.sub),e.next=17,this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:i});case 17:return h=e.sent,e.next=20,this._signin(v({request_type:"si:s",redirect_uri:c,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0},o),h,d);case 20:return(a=e.sent)&&((null==(r=a.profile)?void 0:r.sub)?n.info("success, signed in subject",a.profile.sub):n.info("no subject")),e.abrupt("return",a);case 23:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"_useRefreshToken",value:(M=k(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._client.useRefreshToken({state:t,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds});case 2:return r=e.sent,n=new qe(v(v({},t),r)),e.next=6,this.storeUser(n);case 6:return this._events.load(n),e.abrupt("return",n);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"signinSilentCallback",value:(A=k(g().mark((function e(){var t,r,n=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:window.location.href,r=this._logger.create("signinSilentCallback"),e.next=4,this._iframeNavigator.callback(t);case 4:r.info("success");case 5:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"signinCallback",value:(j=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,e.next=3,this._client.readSigninResponseState(t);case 3:r=e.sent,n=r.state,e.t0=n.request_type,e.next="si:r"===e.t0?8:"si:p"===e.t0?11:"si:s"===e.t0?14:17;break;case 8:return e.next=10,this.signinRedirectCallback(t);case 10:case 13:case 16:return e.abrupt("return",e.sent);case 11:return e.next=13,this.signinPopupCallback(t);case 14:return e.next=16,this.signinSilentCallback(t);case 17:throw new Error("invalid response_type in state");case 18:case"end":return e.stop()}}),e,this)}))),function(){return j.apply(this,arguments)})},{key:"signoutCallback",value:(R=k(g().mark((function e(){var t,r,n,i,s=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:window.location.href,r=s.length>1&&void 0!==s[1]&&s[1],e.next=4,this._client.readSignoutResponseState(t);case 4:if(n=e.sent,i=n.state){e.next=8;break}return e.abrupt("return");case 8:e.t0=i.request_type,e.next="so:r"===e.t0?11:"so:p"===e.t0?14:"so:s"===e.t0?17:20;break;case 11:return e.next=13,this.signoutRedirectCallback(t);case 13:case 16:case 19:return e.abrupt("break",21);case 14:return e.next=16,this.signoutPopupCallback(t,r);case 17:return e.next=19,this.signoutSilentCallback(t);case 20:throw new Error("invalid response_type in state");case 21:case"end":return e.stop()}}),e,this)}))),function(){return R.apply(this,arguments)})},{key:"querySessionStatus",value:(P=k(g().mark((function e(){var t,r,n,i,s,o,a,u,c,l=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:{},r=this._logger.create("querySessionStatus"),n=t.silentRequestTimeoutInSeconds,i=w(t,d),(s=this.settings.silent_redirect_uri)||r.throw(new Error("No silent_redirect_uri configured")),e.next=7,this._loadUser();case 7:return o=e.sent,e.next=10,this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});case 10:return a=e.sent,e.next=13,this._signinStart(v({request_type:"si:s",redirect_uri:s,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==o?void 0:o.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0},i),a);case 13:return u=e.sent,e.prev=14,e.next=17,this._client.processSigninResponse(u.url);case 17:if(c=e.sent,r.debug("got signin response"),!c.session_state||!c.profile.sub){e.next=22;break}return r.info("success for subject",c.profile.sub),e.abrupt("return",{session_state:c.session_state,sub:c.profile.sub,sid:c.profile.sid});case 22:return r.info("success, user not authenticated"),e.abrupt("return",null);case 26:if(e.prev=26,e.t0=e.catch(14),!(this.settings.monitorAnonymousSession&&e.t0 instanceof he)){e.next=34;break}e.t1=e.t0.error,e.next="login_required"===e.t1||"consent_required"===e.t1||"interaction_required"===e.t1||"account_selection_required"===e.t1?32:34;break;case 32:return r.info("success for anonymous user"),e.abrupt("return",{session_state:e.t0.session_state});case 34:throw e.t0;case 35:case"end":return e.stop()}}),e,this,[[14,26]])}))),function(){return P.apply(this,arguments)})},{key:"_signin",value:(O=k(g().mark((function e(t,r,n){var i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._signinStart(t,r);case 2:return i=e.sent,e.next=5,this._signinEnd(i.url,n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return O.apply(this,arguments)})},{key:"_signinStart",value:(I=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("_signinStart"),e.prev=1,e.next=4,this._client.createSigninRequest(t);case 4:return i=e.sent,n.debug("got signin request"),e.next=8,r.navigate({url:i.url,state:i.state.id,response_mode:i.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin});case 8:return e.abrupt("return",e.sent);case 11:throw e.prev=11,e.t0=e.catch(1),n.debug("error after preparing navigator, closing navigator window"),r.close(),e.t0;case 16:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(e,t){return I.apply(this,arguments)})},{key:"_signinEnd",value:(T=k(g().mark((function e(t,r){var n,i,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("_signinEnd"),e.next=3,this._client.processSigninResponse(t);case 3:return i=e.sent,n.debug("got signin response"),e.next=7,this._buildUser(i,r);case 7:return s=e.sent,e.abrupt("return",s);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"_buildUser",value:(E=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._logger.create("_buildUser"),i=new qe(t),!r){e.next=7;break}if(r===i.profile.sub){e.next=6;break}throw n.debug("current user does not match user returned from signin. sub from signin:",i.profile.sub),new he(v(v({},t),{},{error:"login_required"}));case 6:n.debug("current user matches user returned from signin");case 7:return e.next=9,this.storeUser(i);case 9:return n.debug("user stored"),this._events.load(i),e.abrupt("return",i);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"signoutRedirect",value:(x=k(g().mark((function e(){var t,r,n,i,s,o=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},r=this._logger.create("signoutRedirect"),n=t.redirectMethod,i=w(t,h),e.next=5,this._redirectNavigator.prepare({redirectMethod:n});case 5:return s=e.sent,e.next=8,this._signoutStart(v({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri},i),s);case 8:r.info("success");case 9:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"signoutRedirectCallback",value:(S=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,r=this._logger.create("signoutRedirectCallback"),e.next=4,this._signoutEnd(t);case 4:return n=e.sent,r.info("success"),e.abrupt("return",n);case 7:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"signoutPopup",value:(b=k(g().mark((function e(){var t,r,n,i,s,o,a,u=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:{},r=this._logger.create("signoutPopup"),n=t.popupWindowFeatures,i=t.popupWindowTarget,s=w(t,p),o=this.settings.popup_post_logout_redirect_uri,e.next=6,this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:i});case 6:return a=e.sent,e.next=9,this._signout(v({request_type:"so:p",post_logout_redirect_uri:o,state:null==o?void 0:{}},s),a);case 9:r.info("success");case 10:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"signoutPopupCallback",value:(m=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,r=i.length>1&&void 0!==i[1]&&i[1],n=this._logger.create("signoutPopupCallback"),e.next=5,this._popupNavigator.callback(t,{keepOpen:r});case 5:n.info("success");case 6:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"_signout",value:(y=k(g().mark((function e(t,r){var n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._signoutStart(t,r);case 2:return n=e.sent,e.next=5,this._signoutEnd(n.url);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"_signoutStart",value:(_=k(g().mark((function e(){var t,r,n,i,s,o,a,u=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:{},r=u.length>1?u[1]:void 0,i=this._logger.create("_signoutStart"),e.prev=3,e.next=6,this._loadUser();case 6:if(s=e.sent,i.debug("loaded current user from storage"),!this.settings.revokeTokensOnSignout){e.next=11;break}return e.next=11,this._revokeInternal(s);case 11:return(o=t.id_token_hint||s&&s.id_token)&&(i.debug("setting id_token_hint in signout request"),t.id_token_hint=o),e.next=15,this.removeUser();case 15:return i.debug("user removed, creating signout request"),e.next=18,this._client.createSignoutRequest(t);case 18:return a=e.sent,i.debug("got signout request"),e.next=22,r.navigate({url:a.url,state:null==(n=a.state)?void 0:n.id,scriptOrigin:this.settings.iframeScriptOrigin});case 22:return e.abrupt("return",e.sent);case 25:throw e.prev=25,e.t0=e.catch(3),i.debug("error after preparing navigator, closing navigator window"),r.close(),e.t0;case 30:case"end":return e.stop()}}),e,this,[[3,25]])}))),function(){return _.apply(this,arguments)})},{key:"_signoutEnd",value:(a=k(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._logger.create("_signoutEnd"),e.next=3,this._client.processSignoutResponse(t);case 3:return n=e.sent,r.debug("got signout response"),e.abrupt("return",n);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"signoutSilent",value:(o=k(g().mark((function e(){var t,r,n,i,s,o,a,u,c=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:{},n=this._logger.create("signoutSilent"),i=t.silentRequestTimeoutInSeconds,s=w(t,f),!this.settings.includeIdTokenInSilentSignout){e.next=15;break}return e.next=6,this._loadUser();case 6:if(e.t1=r=e.sent,null!=e.t1){e.next=11;break}e.t2=void 0,e.next=12;break;case 11:e.t2=r.id_token;case 12:e.t0=e.t2,e.next=16;break;case 15:e.t0=void 0;case 16:return o=e.t0,a=this.settings.popup_post_logout_redirect_uri,e.next=20,this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:i});case 20:return u=e.sent,e.next=23,this._signout(v({request_type:"so:s",post_logout_redirect_uri:a,id_token_hint:o},s),u);case 23:n.info("success");case 24:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"signoutSilentCallback",value:(s=k(g().mark((function e(){var t,r,n=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:window.location.href,r=this._logger.create("signoutSilentCallback"),e.next=4,this._iframeNavigator.callback(t);case 4:r.info("success");case 5:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"revokeTokens",value:(i=k(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._loadUser();case 2:return r=e.sent,e.next=5,this._revokeInternal(r,t);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_revokeInternal",value:(n=k(g().mark((function e(t){var r,n,i,s,o,a,u=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:this.settings.revokeTokenTypes,n=this._logger.create("_revokeInternal"),t){e.next=4;break}return e.abrupt("return");case 4:if(i=r.filter((function(e){return"string"==typeof t[e]})),i.length){e.next=8;break}return n.debug("no need to revoke due to no token(s)"),e.abrupt("return");case 8:s=q(i),e.prev=9,s.s();case 11:if((o=s.n()).done){e.next=19;break}return a=o.value,e.next=15,this._client.revokeToken(t[a],a);case 15:n.info("".concat(a," revoked successfully")),"access_token"!==a&&(t[a]=null);case 17:e.next=11;break;case 19:e.next=24;break;case 21:e.prev=21,e.t0=e.catch(9),s.e(e.t0);case 24:return e.prev=24,s.f(),e.finish(24);case 27:return e.next=29,this.storeUser(t);case 29:n.debug("user stored"),this._events.load(t);case 31:case"end":return e.stop()}}),e,this,[[9,21,24,27]])}))),function(e){return n.apply(this,arguments)})},{key:"startSilentRenew",value:function(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}},{key:"stopSilentRenew",value:function(){this._silentRenewService.stop()}},{key:"_userStoreKey",get:function(){return"user:".concat(this.settings.authority,":").concat(this.settings.client_id)}},{key:"_loadUser",value:(r=k(g().mark((function e(){var t,r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._logger.create("_loadUser"),e.next=3,this.settings.userStore.get(this._userStoreKey);case 3:if(!(r=e.sent)){e.next=7;break}return t.debug("user storageString loaded"),e.abrupt("return",qe.fromStorageString(r));case 7:return t.debug("no user storageString"),e.abrupt("return",null);case 9:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"storeUser",value:(t=k(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._logger.create("storeUser"),!t){e.next=8;break}return r.debug("storing user"),n=t.toStorageString(),e.next=6,this.settings.userStore.set(this._userStoreKey,n);case 6:e.next=11;break;case 8:return this._logger.debug("removing user"),e.next=11,this.settings.userStore.remove(this._userStoreKey);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"clearStaleState",value:(e=k(g().mark((function e(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._client.clearStaleState();case 2:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e,t,r,n,i,s,o,a,_,y,m,b,S,x,E,T,I,O,P,R,j,A,M,N,H,L,W,F,B,z,K}(),Ye="2.4.0"},477:()=>{}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r(480);module.exports=n})();
2
+ (()=>{var e={480:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.jwt_decode=t.jwt_decode_ns=void 0,s(r(517),t);var u=o(r(935));t.jwt_decode_ns=u;var c=a(r(935));t.jwt_decode=c.default},11:function(e,t,r){var n,i,s,o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}o=function(){var e=e||function(e){var t;if("undefined"!=typeof window&&window.crypto&&(t=window.crypto),"undefined"!=typeof self&&self.crypto&&(t=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(t=globalThis.crypto),!t&&"undefined"!=typeof window&&window.msCrypto&&(t=window.msCrypto),!t&&void 0!==r.g&&r.g.crypto&&(t=r.g.crypto),!t)try{t=r(477)}catch(e){}var n=function(){if(t){if("function"==typeof t.getRandomValues)try{return t.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof t.randomBytes)try{return t.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},o=s.lib={},a=o.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var s=0;s<i;s++){var o=r[s>>>2]>>>24-s%4*8&255;t[n+s>>>2]|=o<<24-(n+s)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new u.init(t,e)}}),c=s.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var s=t[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},d=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var s=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},h=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,s=n.sigBytes,o=this.blockSize,a=s/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,l=e.min(4*c,s);if(c){for(var d=0;d<c;d+=o)this._doProcessBlock(i,d);r=i.splice(0,c),n.sigBytes-=l}return new u.init(r,l)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(o.Hasher=p.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),s.algo={});return s}(Math);return e},"object"===a(t)?e.exports=t=o():(i=[],void 0===(s="function"==typeof(n=o)?n.apply(t,i):n)||(e.exports=s))},304:function(e,t,r){var n,i,s,o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}o=function(e){var t,r;return r=(t=e).lib.WordArray,t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],s=0;s<r;s+=3)for(var o=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a<r;a++)i.push(n.charAt(o>>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var s=0;s<n.length;s++)i[n.charCodeAt(s)]=s}var o=n.charAt(64);if(o){var a=e.indexOf(o);-1!==a&&(t=a)}return function(e,t,n){for(var i=[],s=0,o=0;o<t;o++)if(o%4){var a=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;i[s>>>2]|=a<<24-s%4*8,s++}return r.create(i,s)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.enc.Base64},"object"===a(t)?e.exports=t=o(r(11)):(i=[r(11)],void 0===(s="function"==typeof(n=o)?n.apply(t,i):n)||(e.exports=s))},728:function(e,t,r){var n,i,s,o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}o=function(e){return e.enc.Utf8},"object"===a(t)?e.exports=t=o(r(11)):(i=[r(11)],void 0===(s="function"==typeof(n=o)?n.apply(t,i):n)||(e.exports=s))},519:function(e,t,r){var n,i,s,o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}o=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,s=n.Hasher,o=r.algo,a=[],u=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(a[i]=r(t.pow(n,.5))),u[i]=r(t.pow(n,1/3)),i++),n++}();var c=[],l=o.SHA256=s.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],o=r[3],a=r[4],l=r[5],d=r[6],h=r[7],p=0;p<64;p++){if(p<16)c[p]=0|e[t+p];else{var f=c[p-15],g=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,_=c[p-2],v=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;c[p]=g+c[p-7]+v+c[p-16]}var y=n&i^n&s^i&s,w=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),m=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&d)+u[p]+c[p];h=d,d=l,l=a,a=o+m|0,o=s,s=i,i=n,n=m+(w+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+d|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(l),r.HmacSHA256=s._createHmacHelper(l)}(Math),e.SHA256},"object"===a(t)?e.exports=t=o(r(11)):(i=[r(11)],void 0===(s="function"==typeof(n=o)?n.apply(t,i):n)||(e.exports=s))},935:(e,t,r)=>{"use strict";function n(e){this.message=e}r.r(t),r.d(t,{InvalidTokenError:()=>o,default:()=>a}),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var i="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,s=0,o=0,a="";i=t.charAt(o++);~i&&(r=s%4?64*r+i:i,s++%4)?a+=String.fromCharCode(255&r>>(-2*s&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};function s(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(i(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return i(t)}}function o(e){this.message=e}o.prototype=new Error,o.prototype.name="InvalidTokenError";const a=function(e,t){if("string"!=typeof e)throw new o("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(s(e.split(".")[r]))}catch(e){throw new o("Invalid token specified: "+e.message)}}},517:(e,t,r)=>{"use strict";var n=["timeoutInSeconds"],i=["grant_type","redirect_uri","client_id","client_secret"],s=["grant_type","client_id","client_secret","scope"],o=["grant_type","client_id","client_secret","timeoutInSeconds"],a=["url","authority","client_id","redirect_uri","response_type","scope","state_data","response_mode","request_type","client_secret","nonce","url_state","resource","skipUserInfo","extraQueryParams","extraTokenParams","disablePKCE"],u=["redirectMethod"],c=["popupWindowFeatures","popupWindowTarget"],l=["silentRequestTimeoutInSeconds","resource"],d=["silentRequestTimeoutInSeconds"],h=["redirectMethod"],p=["popupWindowFeatures","popupWindowTarget"],f=["silentRequestTimeoutInSeconds"];function g(){g=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var s=t&&t.prototype instanceof y?t:y,o=Object.create(s.prototype),a=new C(n||[]);return i(o,"_invoke",{value:I(e,r,a)}),o}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",p="suspendedYield",f="executing",_="completed",v={};function y(){}function w(){}function m(){}var k={};c(k,o,(function(){return this}));var b=Object.getPrototypeOf,S=b&&b(b(j([])));S&&S!==r&&n.call(S,o)&&(k=S);var x=m.prototype=y.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(i,s,o,a){var u=d(e[i],e,s);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==L(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,a)}),(function(e){r("throw",e,o,a)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return r("throw",e,o,a)}))}a(u.arg)}var s;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return s=s?s.then(i,i):i()}})}function I(t,r,n){var i=h;return function(s,o){if(i===f)throw Error("Generator is already running");if(i===_){if("throw"===s)throw o;return{value:e,done:!0}}for(n.method=s,n.arg=o;;){var a=n.delegate;if(a){var u=O(a,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=_,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=f;var c=d(t,r,n);if("normal"===c.type){if(i=n.done?_:p,c.arg===v)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=_,n.method="throw",n.arg=c.arg)}}}function O(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,O(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var s=d(i,t.iterator,r.arg);if("throw"===s.type)return r.method="throw",r.arg=s.arg,r.delegate=null,v;var o=s.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function j(t){if(t||""===t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return s.next=s}}throw new TypeError(L(t)+" is not iterable")}return w.prototype=m,i(x,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:w,configurable:!0}),w.displayName=c(m,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,u,"GeneratorFunction")),e.prototype=Object.create(x),e},t.awrap=function(e){return{__await:e}},E(T.prototype),c(T.prototype,a,(function(){return this})),t.AsyncIterator=T,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var o=new T(l(e,r,n,i),s);return t.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},E(x),c(x,u,"Generator"),c(x,o,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=j,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return a.type="throw",a.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,v):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:j(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function y(e,t,r){return(t=q(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function m(e,t,r,n,i,s,o){try{var a=e[s](o),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function k(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var s=e.apply(t,r);function o(e){m(s,n,i,o,a,"next",e)}function a(e){m(s,n,i,o,a,"throw",e)}o(void 0)}))}}function b(e){var t="function"==typeof Map?new Map:void 0;return b=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return function(e,t,r){if(x())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var i=new(e.bind.apply(e,n));return r&&T(i,r.prototype),i}(e,arguments,P(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),T(r,e)},b(e)}function S(e,t,r){return t=P(t),function(e,t){if(t&&("object"==L(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,x()?Reflect.construct(t,r||[],P(e).constructor):t.apply(e,r))}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(x=function(){return!!e})()}function E(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T(e,t)}function T(e,t){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},T(e,t)}function I(e,t,r,n){var i=O(P(1&n?e.prototype:e),t,r);return 2&n?function(e){return i.apply(r,e)}:i}function O(){return O="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=P(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},O.apply(null,arguments)}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,s,o,a=[],u=!0,c=!1;try{if(s=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=s.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}(e,t)||N(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},C.apply(null,arguments)}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,q(n.key),n)}}function A(e,t,r){return t&&U(e.prototype,t),r&&U(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function q(e){var t=function(e){if("object"!=L(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=L(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==L(t)?t:t+""}function M(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=N(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw s}}}}function N(e,t){if(e){if("string"==typeof e)return H(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?H(e,t):void 0}}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}var W,F=Object.create,B=Object.defineProperty,z=Object.getOwnPropertyDescriptor,K=Object.getOwnPropertyNames,J=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,G=function(e,t,r,n){if(t&&"object"===L(t)||"function"==typeof t){var i,s=M(K(t));try{var o=function(){var s=i.value;D.call(e,s)||s===r||B(e,s,{get:function(){return t[s]},enumerable:!(n=z(t,s))||n.enumerable})};for(s.s();!(i=s.n()).done;)o()}catch(e){s.e(e)}finally{s.f()}}return e},Q=function(e,t,r){return r=null!=e?F(J(e)):{},G(!t&&e&&e.__esModule?r:B(r,"default",{value:e,enumerable:!0}),e)},V={};!function(e,t){for(var r in t)B(e,r,{get:t[r],enumerable:!0})}(V,{AccessTokenEvents:function(){return ge},CheckSessionIFrame:function(){return _e},ErrorResponse:function(){return pe},ErrorTimeout:function(){return fe},InMemoryWebStorage:function(){return ve},Log:function(){return ie},Logger:function(){return se},MetadataService:function(){return we},OidcClient:function(){return Ae},OidcClientSettingsStore:function(){return ke},SessionMonitor:function(){return qe},SigninResponse:function(){return Oe},SigninState:function(){return Te},SignoutResponse:function(){return Re},State:function(){return Ee},User:function(){return Me},UserManager:function(){return Ye},UserManagerSettingsStore:function(){return Fe},Version:function(){return $e},WebStorageStateStore:function(){return me}}),e.exports=(W=V,G(B({},"__esModule",{value:!0}),W));var Y,$,X,Z=Q(r(11)),ee=Q(r(519)),te=Q(r(304)),re=Q(r(728)),ne={debug:function(){},info:function(){},warn:function(){},error:function(){}},ie=function(e){return e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e}(ie||{});(X=ie||(ie={})).reset=function(){Y=3,$=ne},X.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");Y=e},X.setLogger=function(e){$=e};var se=function(){return A((function e(t){j(this,e),this._name=t}),[{key:"debug",value:function(){if(Y>=4){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=$).debug.apply(e,[se._format(this._name,this._method)].concat(r))}}},{key:"info",value:function(){if(Y>=3){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=$).info.apply(e,[se._format(this._name,this._method)].concat(r))}}},{key:"warn",value:function(){if(Y>=2){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=$).warn.apply(e,[se._format(this._name,this._method)].concat(r))}}},{key:"error",value:function(){if(Y>=1){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=$).error.apply(e,[se._format(this._name,this._method)].concat(r))}}},{key:"throw",value:function(e){throw this.error(e),e}},{key:"create",value:function(e){var t=Object.create(this);return t._method=e,t.debug("begin"),t}}],[{key:"createStatic",value:function(e,t){var r=new se("".concat(e,".").concat(t));return r.debug("begin"),r}},{key:"_format",value:function(e,t){var r="[".concat(e,"]");return t?"".concat(r," ").concat(t,":"):r}},{key:"debug",value:function(e){if(Y>=4){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];(t=$).debug.apply(t,[se._format(e)].concat(n))}}},{key:"info",value:function(e){if(Y>=3){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];(t=$).info.apply(t,[se._format(e)].concat(n))}}},{key:"warn",value:function(e){if(Y>=2){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];(t=$).warn.apply(t,[se._format(e)].concat(n))}}},{key:"error",value:function(e){if(Y>=1){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];(t=$).error.apply(t,[se._format(e)].concat(n))}}}])}();ie.reset();var oe=function(){return A((function e(){j(this,e)}),null,[{key:"_randomWord",value:function(){return Z.default.lib.WordArray.random(1).words[0]}},{key:"generateUUIDv4",value:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(function(e){return(+e^oe._randomWord()&15>>+e/4).toString(16)})).replace(/-/g,"")}},{key:"generateCodeVerifier",value:function(){return oe.generateUUIDv4()+oe.generateUUIDv4()+oe.generateUUIDv4()}},{key:"generateCodeChallenge",value:function(e){try{var t=(0,ee.default)(e);return te.default.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw se.error("CryptoUtils.generateCodeChallenge",e),e}}},{key:"generateBasicAuth",value:function(e,t){var r=re.default.parse([e,t].join(":"));return te.default.stringify(r)}}])}(),ae=function(){return A((function e(t){j(this,e),this._name=t,this._logger=new se("Event('".concat(this._name,"')")),this._callbacks=[]}),[{key:"addHandler",value:function(e){var t=this;return this._callbacks.push(e),function(){return t.removeHandler(e)}}},{key:"removeHandler",value:function(e){var t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}},{key:"raise",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=this._logger).debug.apply(e,["raise:"].concat(r));var i,s=M(this._callbacks);try{for(s.s();!(i=s.n()).done;)i.value.apply(void 0,r)}catch(e){s.e(e)}finally{s.f()}}}])}(),ue=Q(r(935)),ce=function(){return A((function e(){j(this,e)}),null,[{key:"decode",value:function(e){try{return(0,ue.default)(e)}catch(e){throw se.error("JwtUtils.decode",e),e}}}])}(),le=function(){return A((function e(){j(this,e)}),null,[{key:"center",value:function(e){var t,r=C({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e),e));return null==r.width&&(r.width=null!=(t=[800,720,600,480].find((function(e){return e<=window.outerWidth/1.618})))?t:360),null!=r.left||(r.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-r.width)/2))),null!=r.height&&(null!=r.top||(r.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-r.height)/2)))),r}},{key:"serialize",value:function(e){return Object.entries(e).filter((function(e){return null!=R(e,2)[1]})).map((function(e){var t=R(e,2),r=t[0],n=t[1];return"".concat(r,"=").concat("boolean"!=typeof n?n:n?"yes":"no")})).join(",")}}])}(),de=function(e){function t(){var e;return j(this,t),(e=S(this,t,arguments))._logger=new se("Timer('".concat(e._name,"')")),e._timerHandle=null,e._expiration=0,e._callback=function(){var r=e._expiration-de.getEpochTime();e._logger.debug("timer completes in",r),e._expiration<=de.getEpochTime()&&(e.cancel(),I(t,"raise",e,3)([]))},e}return E(t,e),A(t,[{key:"init",value:function(e){var t=this._logger.create("init");e=Math.max(Math.floor(e),1);var r=de.getEpochTime()+e;if(this.expiration===r&&this._timerHandle)t.debug("skipping since already initialized for expiration at",this.expiration);else{this.cancel(),t.debug("using duration",e),this._expiration=r;var n=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*n)}}},{key:"expiration",get:function(){return this._expiration}},{key:"cancel",value:function(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}}],[{key:"getEpochTime",value:function(){return Math.floor(Date.now()/1e3)}}])}(ae),he=function(){return A((function e(){j(this,e)}),null,[{key:"readParams",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"query";if(!e)throw new TypeError("Invalid URL");var r=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(r.slice(1))}}])}(),pe=function(e){function t(e,r){var n,i,s,o;if(j(this,t),(n=S(this,t,[e.error_description||e.error||""])).form=r,n.name="ErrorResponse",!e.error)throw se.error("ErrorResponse","No error passed"),new Error("No error passed");return n.error=e.error,n.error_description=null!=(i=e.error_description)?i:null,n.error_uri=null!=(s=e.error_uri)?s:null,n.state=e.userState,n.session_state=null!=(o=e.session_state)?o:null,n.url_state=e.url_state,n}return E(t,e),A(t)}(b(Error)),fe=function(e){function t(e){var r;return j(this,t),(r=S(this,t,[e])).name="ErrorTimeout",r}return E(t,e),A(t)}(b(Error)),ge=function(){return A((function e(t){j(this,e),this._logger=new se("AccessTokenEvents"),this._expiringTimer=new de("Access token expiring"),this._expiredTimer=new de("Access token expired"),this._expiringNotificationTimeInSeconds=t.expiringNotificationTimeInSeconds}),[{key:"load",value:function(e){var t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){var r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){var n=r-this._expiringNotificationTimeInSeconds;n<=0&&(n=1),t.debug("registering expiring timer, raising in",n,"seconds"),this._expiringTimer.init(n)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();var i=r+1;t.debug("registering expired timer, raising in",i,"seconds"),this._expiredTimer.init(i)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}},{key:"unload",value:function(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}},{key:"addAccessTokenExpiring",value:function(e){return this._expiringTimer.addHandler(e)}},{key:"removeAccessTokenExpiring",value:function(e){this._expiringTimer.removeHandler(e)}},{key:"addAccessTokenExpired",value:function(e){return this._expiredTimer.addHandler(e)}},{key:"removeAccessTokenExpired",value:function(e){this._expiredTimer.removeHandler(e)}}])}(),_e=function(){return A((function e(t,r,n,i,s){var o=this;j(this,e),this._callback=t,this._client_id=r,this._intervalInSeconds=i,this._stopOnError=s,this._logger=new se("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=function(e){e.origin===o._frame_origin&&e.source===o._frame.contentWindow&&("error"===e.data?(o._logger.error("error message from check session op iframe"),o._stopOnError&&o.stop()):"changed"===e.data?(o._logger.debug("changed message from check session op iframe"),o.stop(),o._callback()):o._logger.debug(e.data+" message from check session op iframe"))};var a=new URL(n);this._frame_origin=a.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=a.href}),[{key:"load",value:function(){var e=this;return new Promise((function(t){e._frame.onload=function(){t()},window.document.body.appendChild(e._frame),window.addEventListener("message",e._message,!1)}))}},{key:"start",value:function(e){var t=this;if(this._session_state!==e){this._logger.create("start"),this.stop(),this._session_state=e;var r=function(){t._frame.contentWindow&&t._session_state&&t._frame.contentWindow.postMessage(t._client_id+" "+t._session_state,t._frame_origin)};r(),this._timer=setInterval(r,1e3*this._intervalInSeconds)}}},{key:"stop",value:function(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}])}(),ve=function(){return A((function e(){j(this,e),this._logger=new se("InMemoryWebStorage"),this._data={}}),[{key:"clear",value:function(){this._logger.create("clear"),this._data={}}},{key:"getItem",value:function(e){return this._logger.create("getItem('".concat(e,"')")),this._data[e]}},{key:"setItem",value:function(e,t){this._logger.create("setItem('".concat(e,"')")),this._data[e]=t}},{key:"removeItem",value:function(e){this._logger.create("removeItem('".concat(e,"')")),delete this._data[e]}},{key:"length",get:function(){return Object.getOwnPropertyNames(this._data).length}},{key:"key",value:function(e){return Object.getOwnPropertyNames(this._data)[e]}}])}(),ye=function(){return A((function e(){var t,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};j(this,e),this._jwtHandler=i,this._extraHeaders=s,this._logger=new se("JsonService"),this._contentTypes=[],(t=this._contentTypes).push.apply(t,(r=n,function(e){if(Array.isArray(e))return H(e)}(r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||N(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat(["application/json"])),i&&this._contentTypes.push("application/jwt")}),[{key:"fetchWithTimeout",value:(r=k(g().mark((function e(t){var r,i,s,o,a,u,c=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=(r=c.length>1&&void 0!==c[1]?c[1]:{}).timeoutInSeconds,s=w(r,n),i){e.next=6;break}return e.next=5,fetch(t,s);case 5:return e.abrupt("return",e.sent);case 6:return o=new AbortController,a=setTimeout((function(){return o.abort()}),1e3*i),e.prev=8,e.next=11,fetch(t,v(v({},r),{},{signal:o.signal}));case 11:return u=e.sent,e.abrupt("return",u);case 15:if(e.prev=15,e.t0=e.catch(8),!(e.t0 instanceof DOMException&&"AbortError"===e.t0.name)){e.next=19;break}throw new fe("Network timed out");case 19:throw e.t0;case 20:return e.prev=20,clearTimeout(a),e.finish(20);case 23:case"end":return e.stop()}}),e,null,[[8,15,20,23]])}))),function(e){return r.apply(this,arguments)})},{key:"getJson",value:(t=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(r=l.length>1&&void 0!==l[1]?l[1]:{}).token,i=r.credentials,s=this._logger.create("getJson"),o={Accept:this._contentTypes.join(", ")},n&&(s.debug("token passed, setting Authorization header"),o.Authorization="Bearer "+n),this.appendExtraHeaders(o),e.prev=5,s.debug("url:",t),e.next=9,this.fetchWithTimeout(t,{method:"GET",headers:o,credentials:i});case 9:a=e.sent,e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(5),s.error("Network Error"),e.t0;case 16:if(s.debug("HTTP response received, status",a.status),(u=a.headers.get("Content-Type"))&&!this._contentTypes.find((function(e){return u.startsWith(e)}))&&s.throw(new Error("Invalid response Content-Type: ".concat(null!=u?u:"undefined",", from URL: ").concat(t))),!(a.ok&&this._jwtHandler&&(null==u?void 0:u.startsWith("application/jwt")))){e.next=27;break}return e.t1=this,e.next=23,a.text();case 23:return e.t2=e.sent,e.next=26,e.t1._jwtHandler.call(e.t1,e.t2);case 26:return e.abrupt("return",e.sent);case 27:return e.prev=27,e.next=30,a.json();case 30:c=e.sent,e.next=39;break;case 33:if(e.prev=33,e.t3=e.catch(27),s.error("Error parsing JSON response",e.t3),!a.ok){e.next=38;break}throw e.t3;case 38:throw new Error("".concat(a.statusText," (").concat(a.status,")"));case 39:if(a.ok){e.next=44;break}if(s.error("Error from server:",c),!c.error){e.next=43;break}throw new pe(c);case 43:throw new Error("".concat(a.statusText," (").concat(a.status,"): ").concat(JSON.stringify(c)));case 44:return e.abrupt("return",c);case 45:case"end":return e.stop()}}),e,this,[[5,12],[27,33]])}))),function(e){return t.apply(this,arguments)})},{key:"postForm",value:(e=k(g().mark((function e(t,r){var n,i,s,o,a,u,c,l,d,h;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.body,i=r.basicAuth,s=r.timeoutInSeconds,o=r.initCredentials,a=this._logger.create("postForm"),u={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"},void 0!==i&&(u.Authorization="Basic "+i),this.appendExtraHeaders(u),e.prev=5,a.debug("url:",t),e.next=9,this.fetchWithTimeout(t,{method:"POST",headers:u,body:n,timeoutInSeconds:s,credentials:o});case 9:c=e.sent,e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(5),a.error("Network error"),e.t0;case 16:if(a.debug("HTTP response received, status",c.status),!(l=c.headers.get("Content-Type"))||this._contentTypes.find((function(e){return l.startsWith(e)}))){e.next=20;break}throw new Error("Invalid response Content-Type: ".concat(null!=l?l:"undefined",", from URL: ").concat(t));case 20:return e.next=22,c.text();case 22:if(d=e.sent,h={},!d){e.next=35;break}e.prev=25,h=JSON.parse(d),e.next=35;break;case 29:if(e.prev=29,e.t1=e.catch(25),a.error("Error parsing JSON response",e.t1),!c.ok){e.next=34;break}throw e.t1;case 34:throw new Error("".concat(c.statusText," (").concat(c.status,")"));case 35:if(c.ok){e.next=40;break}if(a.error("Error from server:",h),!h.error){e.next=39;break}throw new pe(h,n);case 39:throw new Error("".concat(c.statusText," (").concat(c.status,"): ").concat(JSON.stringify(h)));case 40:return e.abrupt("return",h);case 41:case"end":return e.stop()}}),e,this,[[5,12],[25,29]])}))),function(t,r){return e.apply(this,arguments)})},{key:"appendExtraHeaders",value:function(e){var t=this,r=this._logger.create("appendExtraHeaders"),n=Object.keys(this._extraHeaders),i=["authorization","accept","content-type"];0!==n.length&&n.forEach((function(n){if(i.includes(n.toLocaleLowerCase()))r.warn("Protected header could not be overridden",n,i);else{var s="function"==typeof t._extraHeaders[n]?t._extraHeaders[n]():t._extraHeaders[n];s&&""!==s&&(e[n]=s)}}))}}]);var e,t,r}(),we=function(){return A((function e(t){j(this,e),this._settings=t,this._logger=new se("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new ye(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}),[{key:"resetSigningKeys",value:function(){this._signingKeys=null}},{key:"getMetadata",value:(r=k(g().mark((function e(){var t,r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._logger.create("getMetadata"),!this._metadata){e.next=4;break}return t.debug("using cached values"),e.abrupt("return",this._metadata);case 4:if(this._metadataUrl){e.next=7;break}throw t.throw(new Error("No authority or metadataUrl configured on settings")),null;case 7:return t.debug("getting metadata from",this._metadataUrl),e.next=10,this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});case 10:return r=e.sent,t.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,r),e.abrupt("return",this._metadata);case 14:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getIssuer",value:function(){return this._getMetadataProperty("issuer")}},{key:"getAuthorizationEndpoint",value:function(){return this._getMetadataProperty("authorization_endpoint")}},{key:"getUserInfoEndpoint",value:function(){return this._getMetadataProperty("userinfo_endpoint")}},{key:"getTokenEndpoint",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("token_endpoint",e)}},{key:"getCheckSessionIframe",value:function(){return this._getMetadataProperty("check_session_iframe",!0)}},{key:"getEndSessionEndpoint",value:function(){return this._getMetadataProperty("end_session_endpoint",!0)}},{key:"getRevocationEndpoint",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("revocation_endpoint",e)}},{key:"getKeysEndpoint",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("jwks_uri",e)}},{key:"_getMetadataProperty",value:(t=k(g().mark((function e(t){var r,n,i,s=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]&&s[1],n=this._logger.create("_getMetadataProperty('".concat(t,"')")),e.next=4,this.getMetadata();case 4:if(i=e.sent,n.debug("resolved"),void 0!==i[t]){e.next=11;break}if(!0!==r){e.next=10;break}return n.warn("Metadata does not contain optional property"),e.abrupt("return",void 0);case 10:n.throw(new Error("Metadata does not contain property "+t));case 11:return e.abrupt("return",i[t]);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getSigningKeys",value:(e=k(g().mark((function e(){var t,r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._logger.create("getSigningKeys"),!this._signingKeys){e.next=4;break}return t.debug("returning signingKeys from cache"),e.abrupt("return",this._signingKeys);case 4:return e.next=6,this.getKeysEndpoint(!1);case 6:return r=e.sent,t.debug("got jwks_uri",r),e.next=10,this._jsonService.getJson(r);case 10:if(n=e.sent,t.debug("got key set",n),Array.isArray(n.keys)){e.next=15;break}throw t.throw(new Error("Missing keys on keyset")),null;case 15:return this._signingKeys=n.keys,e.abrupt("return",this._signingKeys);case 17:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e,t,r}(),me=function(){return A((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.prefix,n=void 0===r?"oidc.":r,i=t.store,s=void 0===i?localStorage:i;j(this,e),this._logger=new se("WebStorageStateStore"),this._store=s,this._prefix=n}),[{key:"set",value:(n=k(g().mark((function e(t,r){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("set('".concat(t,"')")),t=this._prefix+t,e.next=4,this._store.setItem(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"get",value:(r=k(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("get('".concat(t,"')")),t=this._prefix+t,e.next=4,this._store.getItem(t);case 4:return r=e.sent,e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"remove",value:(t=k(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("remove('".concat(t,"')")),t=this._prefix+t,e.next=4,this._store.getItem(t);case 4:return r=e.sent,e.next=7,this._store.removeItem(t);case 7:return e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getAllKeys",value:(e=k(g().mark((function e(){var t,r,n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("getAllKeys"),e.next=3,this._store.length;case 3:t=e.sent,r=[],n=0;case 6:if(!(n<t)){e.next=14;break}return e.next=9,this._store.key(n);case 9:(i=e.sent)&&0===i.indexOf(this._prefix)&&r.push(i.substr(this._prefix.length));case 11:n++,e.next=6;break;case 14:return e.abrupt("return",r);case 15:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e,t,r,n}(),ke=A((function e(t){var r=t.authority,n=t.metadataUrl,i=t.metadata,s=t.signingKeys,o=t.metadataSeed,a=t.client_id,u=t.client_secret,c=t.response_type,l=void 0===c?"code":c,d=t.scope,h=void 0===d?"openid":d,p=t.redirect_uri,f=t.post_logout_redirect_uri,g=t.client_authentication,_=void 0===g?"client_secret_post":g,v=t.prompt,y=t.display,w=t.max_age,m=t.ui_locales,k=t.acr_values,b=t.resource,S=t.response_mode,x=void 0===S?"query":S,E=t.filterProtocolClaims,T=void 0===E||E,I=t.loadUserInfo,O=void 0!==I&&I,P=t.staleStateAgeInSeconds,R=void 0===P?900:P,C=t.clockSkewInSeconds,U=void 0===C?300:C,A=t.userInfoJwtIssuer,q=void 0===A?"OP":A,M=t.mergeClaims,N=void 0!==M&&M,H=t.disablePKCE,L=void 0!==H&&H,W=t.stateStore,F=t.refreshTokenCredentials,B=t.revokeTokenAdditionalContentTypes,z=t.fetchRequestCredentials,K=t.refreshTokenAllowedScope,J=t.extraQueryParams,D=void 0===J?{}:J,G=t.extraTokenParams,Q=void 0===G?{}:G,V=t.extraHeaders,Y=void 0===V?{}:V;if(j(this,e),this.authority=r,n?this.metadataUrl=n:(this.metadataUrl=r,r&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=i,this.metadataSeed=o,this.signingKeys=s,this.client_id=a,this.client_secret=u,this.response_type=l,this.scope=h,this.redirect_uri=p,this.post_logout_redirect_uri=f,this.client_authentication=_,this.prompt=v,this.display=y,this.max_age=w,this.ui_locales=m,this.acr_values=k,this.resource=b,this.response_mode=x,this.filterProtocolClaims=null==T||T,this.loadUserInfo=!!O,this.staleStateAgeInSeconds=R,this.clockSkewInSeconds=U,this.userInfoJwtIssuer=q,this.mergeClaims=!!N,this.disablePKCE=!!L,this.revokeTokenAdditionalContentTypes=B,z&&F&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=z||F||"same-origin",W)this.stateStore=W;else{var $="undefined"!=typeof window?window.localStorage:new ve;this.stateStore=new me({store:$})}this.refreshTokenAllowedScope=K,this.extraQueryParams=D,this.extraTokenParams=Q,this.extraHeaders=Y})),be=function(){return A((function e(t,r){var n=this;j(this,e),this._settings=t,this._metadataService=r,this._logger=new se("UserInfoService"),this._getClaimsFromJwt=function(){var e=k(g().mark((function e(t){var r,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n._logger.create("_getClaimsFromJwt"),e.prev=1,i=ce.decode(t),r.debug("JWT decoding successful"),e.abrupt("return",i);case 7:throw e.prev=7,e.t0=e.catch(1),r.error("Error parsing JWT response"),e.t0;case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}(),this._jsonService=new ye(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}),[{key:"getClaims",value:(e=k(g().mark((function e(t){var r,n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._logger.create("getClaims"),t||this._logger.throw(new Error("No token passed")),e.next=4,this._metadataService.getUserInfoEndpoint();case 4:return n=e.sent,r.debug("got userinfo url",n),e.next=8,this._jsonService.getJson(n,{token:t,credentials:this._settings.fetchRequestCredentials});case 8:return i=e.sent,r.debug("got claims",i),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e}(),Se=function(){return A((function e(t,r){j(this,e),this._settings=t,this._metadataService=r,this._logger=new se("TokenClient"),this._jsonService=new ye(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}),[{key:"exchangeCode",value:(n=k(g().mark((function e(t){var r,n,s,o,a,u,c,l,d,h,p,f,_,v,y,m,k,b,S;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.grant_type,n=void 0===r?"authorization_code":r,s=t.redirect_uri,o=void 0===s?this._settings.redirect_uri:s,a=t.client_id,u=void 0===a?this._settings.client_id:a,c=t.client_secret,l=void 0===c?this._settings.client_secret:c,d=w(t,i),h=this._logger.create("exchangeCode"),u||h.throw(new Error("A client_id is required")),o||h.throw(new Error("A redirect_uri is required")),d.code||h.throw(new Error("A code is required")),p=new URLSearchParams({grant_type:n,redirect_uri:o}),f=0,_=Object.entries(d);f<_.length;f++)v=R(_[f],2),y=v[0],null!=(m=v[1])&&p.set(y,m);e.t0=this._settings.client_authentication,e.next="client_secret_basic"===e.t0?10:"client_secret_post"===e.t0?15:18;break;case 10:if(l){e.next=13;break}throw h.throw(new Error("A client_secret is required")),null;case 13:return k=oe.generateBasicAuth(u,l),e.abrupt("break",18);case 15:return p.append("client_id",u),l&&p.append("client_secret",l),e.abrupt("break",18);case 18:return e.next=20,this._metadataService.getTokenEndpoint(!1);case 20:return b=e.sent,h.debug("got token endpoint"),e.next=24,this._jsonService.postForm(b,{body:p,basicAuth:k,initCredentials:this._settings.fetchRequestCredentials});case 24:return S=e.sent,h.debug("got response"),e.abrupt("return",S);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"exchangeCredentials",value:(r=k(g().mark((function e(t){var r,n,i,o,a,u,c,l,d,h,p,f,_,v,y,m,k,b,S;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.grant_type,n=void 0===r?"password":r,i=t.client_id,o=void 0===i?this._settings.client_id:i,a=t.client_secret,u=void 0===a?this._settings.client_secret:a,c=t.scope,l=void 0===c?this._settings.scope:c,d=w(t,s),h=this._logger.create("exchangeCredentials"),o||h.throw(new Error("A client_id is required")),p=new URLSearchParams({grant_type:n,scope:l}),f=0,_=Object.entries(d);f<_.length;f++)v=R(_[f],2),y=v[0],null!=(m=v[1])&&p.set(y,m);e.t0=this._settings.client_authentication,e.next="client_secret_basic"===e.t0?8:"client_secret_post"===e.t0?13:16;break;case 8:if(u){e.next=11;break}throw h.throw(new Error("A client_secret is required")),null;case 11:return k=oe.generateBasicAuth(o,u),e.abrupt("break",16);case 13:return p.append("client_id",o),u&&p.append("client_secret",u),e.abrupt("break",16);case 16:return e.next=18,this._metadataService.getTokenEndpoint(!1);case 18:return b=e.sent,h.debug("got token endpoint"),e.next=22,this._jsonService.postForm(b,{body:p,basicAuth:k,initCredentials:this._settings.fetchRequestCredentials});case 22:return S=e.sent,h.debug("got response"),e.abrupt("return",S);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"exchangeRefreshToken",value:(t=k(g().mark((function e(t){var r,n,i,s,a,u,c,l,d,h,p,f,_,v,y,m;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.grant_type,n=void 0===r?"refresh_token":r,i=t.client_id,s=void 0===i?this._settings.client_id:i,a=t.client_secret,u=void 0===a?this._settings.client_secret:a,c=t.timeoutInSeconds,l=w(t,o),d=this._logger.create("exchangeRefreshToken"),s||d.throw(new Error("A client_id is required")),l.refresh_token||d.throw(new Error("A refresh_token is required")),h=new URLSearchParams({grant_type:n}),p=g().mark((function e(){var t,r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=R(_[f],2),r=t[0],n=t[1],Array.isArray(n)?n.forEach((function(e){return h.append(r,e)})):null!=n&&h.set(r,n);case 2:case"end":return e.stop()}}),e)})),f=0,_=Object.entries(l);case 7:if(!(f<_.length)){e.next=12;break}return e.delegateYield(p(),"t0",9);case 9:f++,e.next=7;break;case 12:e.t1=this._settings.client_authentication,e.next="client_secret_basic"===e.t1?15:"client_secret_post"===e.t1?20:23;break;case 15:if(u){e.next=18;break}throw d.throw(new Error("A client_secret is required")),null;case 18:return v=oe.generateBasicAuth(s,u),e.abrupt("break",23);case 20:return h.append("client_id",s),u&&h.append("client_secret",u),e.abrupt("break",23);case 23:return e.next=25,this._metadataService.getTokenEndpoint(!1);case 25:return y=e.sent,d.debug("got token endpoint"),e.next=29,this._jsonService.postForm(y,{body:h,basicAuth:v,timeoutInSeconds:c,initCredentials:this._settings.fetchRequestCredentials});case 29:return m=e.sent,d.debug("got response"),e.abrupt("return",m);case 32:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"revoke",value:(e=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("revoke"),t.token||n.throw(new Error("A token is required")),e.next=4,this._metadataService.getRevocationEndpoint(!1);case 4:for(i=e.sent,n.debug("got revocation endpoint, revoking ".concat(null!=(r=t.token_type_hint)?r:"default token type")),s=new URLSearchParams,o=0,a=Object.entries(t);o<a.length;o++)u=R(a[o],2),c=u[0],null!=(l=u[1])&&s.set(c,l);return s.set("client_id",this._settings.client_id),this._settings.client_secret&&s.set("client_secret",this._settings.client_secret),e.next=12,this._jsonService.postForm(i,{body:s});case 12:n.debug("got response");case 13:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e,t,r,n}(),xe=function(){return A((function e(t,r,n){j(this,e),this._settings=t,this._metadataService=r,this._claimsService=n,this._logger=new se("ResponseValidator"),this._userInfoService=new be(this._settings,this._metadataService),this._tokenClient=new Se(this._settings,this._metadataService)}),[{key:"validateSigninResponse",value:(i=k(g().mark((function e(t,r){var n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("validateSigninResponse"),this._processSigninState(t,r),n.debug("state processed"),e.next=5,this._processCode(t,r);case 5:return n.debug("code processed"),t.isOpenId&&this._validateIdTokenAttributes(t),n.debug("tokens validated"),e.next=10,this._processClaims(t,null==r?void 0:r.skipUserInfo,t.isOpenId);case 10:n.debug("claims processed");case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"validateCredentialsResponse",value:(n=k(g().mark((function e(t,r){var n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("validateCredentialsResponse"),t.isOpenId&&t.id_token&&this._validateIdTokenAttributes(t),n.debug("tokens validated"),e.next=5,this._processClaims(t,r,t.isOpenId);case 5:n.debug("claims processed");case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"validateRefreshResponse",value:(r=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("validateRefreshResponse"),t.userState=r.data,null!=t.session_state||(t.session_state=r.session_state),null!=t.scope||(t.scope=r.scope),t.isOpenId&&t.id_token&&(this._validateIdTokenAttributes(t,r.id_token),n.debug("ID Token validated")),t.id_token||(t.id_token=r.id_token,t.profile=r.profile),i=t.isOpenId&&!!t.id_token,e.next=9,this._processClaims(t,!1,i);case 9:n.debug("claims processed");case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"validateSignoutResponse",value:function(e,t){var r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new pe(e)}},{key:"_processSigninState",value:function(e,t){var r=this._logger.create("_processSigninState");if(t.id!==e.state&&r.throw(new Error("State does not match")),t.client_id||r.throw(new Error("No client_id on state")),t.authority||r.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,null!=e.scope||(e.scope=t.scope),e.error)throw r.warn("Response was error",e.error),new pe(e);t.code_verifier&&!e.code&&r.throw(new Error("Expected code in response"))}},{key:"_processClaims",value:(t=k(g().mark((function e(t){var r,n,i,s,o=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=o.length>1&&void 0!==o[1]&&o[1],n=!(o.length>2&&void 0!==o[2])||o[2],i=this._logger.create("_processClaims"),t.profile=this._claimsService.filterProtocolClaims(t.profile),!r&&this._settings.loadUserInfo&&t.access_token){e.next=7;break}return i.debug("not loading user info"),e.abrupt("return");case 7:return i.debug("loading user info"),e.next=10,this._userInfoService.getClaims(t.access_token);case 10:s=e.sent,i.debug("user info claims received from user info endpoint"),n&&s.sub!==t.profile.sub&&i.throw(new Error("subject from UserInfo response does not match subject in ID Token")),t.profile=this._claimsService.mergeClaims(t.profile,this._claimsService.filterProtocolClaims(s)),i.debug("user info claims received, updated profile:",t.profile);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_processCode",value:(e=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._logger.create("_processCode"),!t.code){e.next=9;break}return n.debug("Validating code"),e.next=5,this._tokenClient.exchangeCode(v({client_id:r.client_id,client_secret:r.client_secret,code:t.code,redirect_uri:r.redirect_uri,code_verifier:r.code_verifier},r.extraTokenParams));case 5:i=e.sent,Object.assign(t,i),e.next=10;break;case 9:n.debug("No code to process");case 10:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})},{key:"_validateIdTokenAttributes",value:function(e,t){var r,n=this._logger.create("_validateIdTokenAttributes");n.debug("decoding ID Token JWT");var i=ce.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){var s=ce.decode(t);i.sub!==s.sub&&n.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==s.auth_time&&n.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==s.azp&&n.throw(new Error("azp in id_token does not match original azp")),!i.azp&&s.azp&&n.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}}]);var e,t,r,n,i}(),Ee=function(){return A((function e(t){j(this,e),this.id=t.id||oe.generateUUIDv4(),this.data=t.data,t.created&&t.created>0?this.created=t.created:this.created=de.getEpochTime(),this.request_type=t.request_type,this.url_state=t.url_state}),[{key:"toStorageString",value:function(){return new se("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}}],[{key:"fromStorageString",value:function(e){return se.createStatic("State","fromStorageString"),new Ee(JSON.parse(e))}},{key:"clearStaleState",value:(e=k(g().mark((function e(t,r){var n,i,s,o,a,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=se.createStatic("State","clearStaleState"),i=de.getEpochTime()-r,e.next=4,t.getAllKeys();case 4:s=e.sent,n.debug("got keys",s),o=0;case 7:if(!(o<s.length)){e.next=18;break}return a=s[o],e.next=11,t.get(a);case 11:if(u=e.sent,c=!1,u)try{l=Ee.fromStorageString(u),n.debug("got item from key:",a,l.created),l.created<=i&&(c=!0)}catch(e){n.error("Error parsing state for key:",a,e),c=!0}else n.debug("no item in storage for key:",a),c=!0;c&&(n.debug("removed item for key:",a),t.remove(a));case 15:o++,e.next=7;break;case 18:case"end":return e.stop()}}),e)}))),function(t,r){return e.apply(this,arguments)})}]);var e}(),Te=function(e){function t(e){var r;return j(this,t),r=S(this,t,[e]),!0===e.code_verifier?r.code_verifier=oe.generateCodeVerifier():e.code_verifier&&(r.code_verifier=e.code_verifier),r.code_verifier&&(r.code_challenge=oe.generateCodeChallenge(r.code_verifier)),r.authority=e.authority,r.client_id=e.client_id,r.redirect_uri=e.redirect_uri,r.scope=e.scope,r.client_secret=e.client_secret,r.extraTokenParams=e.extraTokenParams,r.response_mode=e.response_mode,r.skipUserInfo=e.skipUserInfo,r}return E(t,e),A(t,[{key:"toStorageString",value:function(){return new se("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}}],[{key:"fromStorageString",value:function(e){se.createStatic("SigninState","fromStorageString");var t=JSON.parse(e);return new Te(t)}}])}(Ee),Ie=A((function e(t){var r=t.url,n=t.authority,i=t.client_id,s=t.redirect_uri,o=t.response_type,u=t.scope,c=t.state_data,l=t.response_mode,d=t.request_type,h=t.client_secret,p=t.nonce,f=t.url_state,g=t.resource,_=t.skipUserInfo,y=t.extraQueryParams,m=t.extraTokenParams,k=t.disablePKCE,b=w(t,a);if(j(this,e),this._logger=new se("SigninRequest"),!r)throw this._logger.error("ctor: No url passed"),new Error("url");if(!i)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!s)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!o)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!u)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!n)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new Te({data:c,request_type:d,url_state:f,code_verifier:!k,client_id:i,authority:n,redirect_uri:s,response_mode:l,client_secret:h,scope:u,extraTokenParams:m,skipUserInfo:_});var S=new URL(r);S.searchParams.append("client_id",i),S.searchParams.append("redirect_uri",s),S.searchParams.append("response_type",o),S.searchParams.append("scope",u),p&&S.searchParams.append("nonce",p);var x=this.state.id;f&&(x="".concat(x).concat(";").concat(f)),S.searchParams.append("state",x),this.state.code_challenge&&(S.searchParams.append("code_challenge",this.state.code_challenge),S.searchParams.append("code_challenge_method","S256")),g&&(Array.isArray(g)?g:[g]).forEach((function(e){return S.searchParams.append("resource",e)}));for(var E=0,T=Object.entries(v(v({response_mode:l},b),y));E<T.length;E++){var I=R(T[E],2),O=I[0],P=I[1];null!=P&&S.searchParams.append(O,P.toString())}this.url=S.href})),Oe=function(){return A((function e(t){if(j(this,e),this.access_token="",this.token_type="",this.profile={},this.state=t.get("state"),this.session_state=t.get("session_state"),this.state){var r=decodeURIComponent(this.state).split(";");this.state=r[0],r.length>1&&(this.url_state=r.slice(1).join(";"))}this.error=t.get("error"),this.error_description=t.get("error_description"),this.error_uri=t.get("error_uri"),this.code=t.get("code")}),[{key:"expires_in",get:function(){if(void 0!==this.expires_at)return this.expires_at-de.getEpochTime()},set:function(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+de.getEpochTime())}},{key:"isOpenId",get:function(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}}])}(),Pe=A((function e(t){var r=t.url,n=t.state_data,i=t.id_token_hint,s=t.post_logout_redirect_uri,o=t.extraQueryParams,a=t.request_type,u=t.client_id;if(j(this,e),this._logger=new se("SignoutRequest"),!r)throw this._logger.error("ctor: No url passed"),new Error("url");var c=new URL(r);i&&c.searchParams.append("id_token_hint",i),u&&c.searchParams.append("client_id",u),s&&(c.searchParams.append("post_logout_redirect_uri",s),n&&(this.state=new Ee({data:n,request_type:a}),c.searchParams.append("state",this.state.id)));for(var l=0,d=Object.entries(v({},o));l<d.length;l++){var h=R(d[l],2),p=h[0],f=h[1];null!=f&&c.searchParams.append(p,f.toString())}this.url=c.href})),Re=A((function e(t){j(this,e),this.state=t.get("state"),this.error=t.get("error"),this.error_description=t.get("error_description"),this.error_uri=t.get("error_uri")})),Ce=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],je=["sub","iss","aud","exp","iat"],Ue=function(){return A((function e(t){j(this,e),this._settings=t,this._logger=new se("ClaimsService")}),[{key:"filterProtocolClaims",value:function(e){var t=v({},e);if(this._settings.filterProtocolClaims){var r,n=M(Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:Ce);try{for(n.s();!(r=n.n()).done;){var i=r.value;je.includes(i)||delete t[i]}}catch(e){n.e(e)}finally{n.f()}}return t}},{key:"mergeClaims",value:function(e,t){for(var r=v({},e),n=0,i=Object.entries(t);n<i.length;n++){var s,o=R(i[n],2),a=o[0],u=o[1],c=M(Array.isArray(u)?u:[u]);try{for(c.s();!(s=c.n()).done;){var l=s.value,d=r[a];void 0===d?r[a]=l:Array.isArray(d)?d.includes(l)||d.push(l):r[a]!==l&&("object"===L(l)&&this._settings.mergeClaims?r[a]=this.mergeClaims(d,l):r[a]=[d,l])}}catch(e){c.e(e)}finally{c.f()}}return r}}])}(),Ae=function(){return A((function e(t,r){j(this,e),this._logger=new se("OidcClient"),this.settings=t instanceof ke?t:new ke(t),this.metadataService=null!=r?r:new we(this.settings),this._claimsService=new Ue(this.settings),this._validator=new xe(this.settings,this.metadataService,this._claimsService),this._tokenClient=new Se(this.settings,this.metadataService)}),[{key:"createSigninRequest",value:(u=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l,d,h,p,f,_,v,y,w,m,k,b,S,x,E,T,I,O,P,R,C,j,U,A,q,M,N,H,L;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.state,n=t.request,i=t.request_uri,s=t.request_type,o=t.id_token_hint,a=t.login_hint,u=t.skipUserInfo,c=t.nonce,l=t.url_state,d=t.response_type,h=void 0===d?this.settings.response_type:d,p=t.scope,f=void 0===p?this.settings.scope:p,_=t.redirect_uri,v=void 0===_?this.settings.redirect_uri:_,y=t.prompt,w=void 0===y?this.settings.prompt:y,m=t.display,k=void 0===m?this.settings.display:m,b=t.max_age,S=void 0===b?this.settings.max_age:b,x=t.ui_locales,E=void 0===x?this.settings.ui_locales:x,T=t.acr_values,I=void 0===T?this.settings.acr_values:T,O=t.resource,P=void 0===O?this.settings.resource:O,R=t.response_mode,C=void 0===R?this.settings.response_mode:R,j=t.extraQueryParams,U=void 0===j?this.settings.extraQueryParams:j,A=t.extraTokenParams,q=void 0===A?this.settings.extraTokenParams:A,M=this._logger.create("createSigninRequest"),"code"===h){e.next=4;break}throw new Error("Only the Authorization Code flow (with PKCE) is supported");case 4:return e.next=6,this.metadataService.getAuthorizationEndpoint();case 6:return N=e.sent,M.debug("Received authorization endpoint",N),H=new Ie({url:N,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:v,response_type:h,scope:f,state_data:r,url_state:l,prompt:w,display:k,max_age:S,ui_locales:E,id_token_hint:o,login_hint:a,acr_values:I,resource:P,request:n,request_uri:i,extraQueryParams:U,extraTokenParams:q,request_type:s,response_mode:C,client_secret:this.settings.client_secret,skipUserInfo:u,nonce:c,disablePKCE:this.settings.disablePKCE}),e.next=11,this.clearStaleState();case 11:return L=H.state,e.next=14,this.settings.stateStore.set(L.id,L.toStorageString());case 14:return e.abrupt("return",H);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"readSigninResponseState",value:(a=k(g().mark((function e(t){var r,n,i,s,o,a=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>1&&void 0!==a[1]&&a[1],n=this._logger.create("readSigninResponseState"),(i=new Oe(he.readParams(t,this.settings.response_mode))).state){e.next=6;break}throw n.throw(new Error("No state in response")),null;case 6:return e.next=8,this.settings.stateStore[r?"remove":"get"](i.state);case 8:if(s=e.sent){e.next=12;break}throw n.throw(new Error("No matching state found in storage")),null;case 12:return o=Te.fromStorageString(s),e.abrupt("return",{state:o,response:i});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"processSigninResponse",value:(o=k(g().mark((function e(t){var r,n,i,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._logger.create("processSigninResponse"),e.next=3,this.readSigninResponseState(t,!0);case 3:return n=e.sent,i=n.state,s=n.response,r.debug("received state from storage; validating response"),e.next=9,this._validator.validateSigninResponse(s,i);case 9:return e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"processResourceOwnerPasswordCredentials",value:(s=k(g().mark((function e(t){var r,n,i,s,o,a,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.username,n=t.password,i=t.skipUserInfo,s=void 0!==i&&i,o=t.extraTokenParams,a=void 0===o?{}:o,e.next=3,this._tokenClient.exchangeCredentials(v({username:r,password:n},a));case 3:return u=e.sent,c=new Oe(new URLSearchParams),Object.assign(c,u),e.next=8,this._validator.validateCredentialsResponse(c,s);case 8:return e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"useRefreshToken",value:(i=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.state,n=t.timeoutInSeconds,s=this._logger.create("useRefreshToken"),void 0===this.settings.refreshTokenAllowedScope?o=r.scope:(a=this.settings.refreshTokenAllowedScope.split(" "),u=(null==(i=r.scope)?void 0:i.split(" "))||[],o=u.filter((function(e){return a.includes(e)})).join(" ")),e.next=5,this._tokenClient.exchangeRefreshToken({refresh_token:r.refresh_token,resource:r.resource,scope:o,timeoutInSeconds:n});case 5:return c=e.sent,l=new Oe(new URLSearchParams),Object.assign(l,c),s.debug("validating response",l),e.next=11,this._validator.validateRefreshResponse(l,v(v({},r),{},{scope:o}));case 11:return e.abrupt("return",l);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"createSignoutRequest",value:(n=k(g().mark((function e(){var t,r,n,i,s,o,a,u,c,l,d,h,p,f=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=(t=f.length>0&&void 0!==f[0]?f[0]:{}).state,n=t.id_token_hint,i=t.client_id,s=t.request_type,o=t.post_logout_redirect_uri,a=void 0===o?this.settings.post_logout_redirect_uri:o,u=t.extraQueryParams,c=void 0===u?this.settings.extraQueryParams:u,l=this._logger.create("createSignoutRequest"),e.next=4,this.metadataService.getEndSessionEndpoint();case 4:if(d=e.sent){e.next=8;break}throw l.throw(new Error("No end session endpoint")),null;case 8:return l.debug("Received end session endpoint",d),i||!a||n||(i=this.settings.client_id),h=new Pe({url:d,id_token_hint:n,client_id:i,post_logout_redirect_uri:a,state_data:r,extraQueryParams:c,request_type:s}),e.next=13,this.clearStaleState();case 13:if(!(p=h.state)){e.next=18;break}return l.debug("Signout request has state to persist"),e.next=18,this.settings.stateStore.set(p.id,p.toStorageString());case 18:return e.abrupt("return",h);case 19:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"readSignoutResponseState",value:(r=k(g().mark((function e(t){var r,n,i,s,o,a=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>1&&void 0!==a[1]&&a[1],n=this._logger.create("readSignoutResponseState"),(i=new Re(he.readParams(t,this.settings.response_mode))).state){e.next=9;break}if(n.debug("No state in response"),!i.error){e.next=8;break}throw n.warn("Response was error:",i.error),new pe(i);case 8:return e.abrupt("return",{state:void 0,response:i});case 9:return e.next=11,this.settings.stateStore[r?"remove":"get"](i.state);case 11:if(s=e.sent){e.next=15;break}throw n.throw(new Error("No matching state found in storage")),null;case 15:return o=Ee.fromStorageString(s),e.abrupt("return",{state:o,response:i});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"processSignoutResponse",value:(t=k(g().mark((function e(t){var r,n,i,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._logger.create("processSignoutResponse"),e.next=3,this.readSignoutResponseState(t,!0);case 3:return n=e.sent,i=n.state,s=n.response,i?(r.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(s,i)):r.debug("No state from storage; skipping response validation"),e.abrupt("return",s);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"clearStaleState",value:function(){return this._logger.create("clearStaleState"),Ee.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}},{key:"revokeToken",value:(e=k(g().mark((function e(t,r){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("revokeToken"),e.next=3,this._tokenClient.revoke({token:t,token_type_hint:r});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})}]);var e,t,r,n,i,s,o,a,u}(),qe=function(){return A((function e(t){var r=this;j(this,e),this._userManager=t,this._logger=new se("SessionMonitor"),this._start=function(){var e=k(g().mark((function e(t){var n,i,s,o,a,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.session_state){e.next=3;break}return e.abrupt("return");case 3:if(i=r._logger.create("_start"),t.profile?(r._sub=t.profile.sub,r._sid=t.profile.sid,i.debug("session_state",n,", sub",r._sub)):(r._sub=void 0,r._sid=void 0,i.debug("session_state",n,", anonymous user")),!r._checkSessionIFrame){e.next=8;break}return r._checkSessionIFrame.start(n),e.abrupt("return");case 8:return e.prev=8,e.next=11,r._userManager.metadataService.getCheckSessionIframe();case 11:if(!(s=e.sent)){e.next=24;break}return i.debug("initializing check session iframe"),o=r._userManager.settings.client_id,a=r._userManager.settings.checkSessionIntervalInSeconds,u=r._userManager.settings.stopCheckSessionOnError,c=new _e(r._callback,o,s,a,u),e.next=20,c.load();case 20:r._checkSessionIFrame=c,c.start(n),e.next=25;break;case 24:i.warn("no check session iframe found in the metadata");case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(8),i.error("Error from getCheckSessionIframe:",e.t0 instanceof Error?e.t0.message:e.t0);case 30:case"end":return e.stop()}}),e,null,[[8,27]])})));return function(t){return e.apply(this,arguments)}}(),this._stop=function(){var e=r._logger.create("_stop");if(r._sub=void 0,r._sid=void 0,r._checkSessionIFrame&&r._checkSessionIFrame.stop(),r._userManager.settings.monitorAnonymousSession)var t=setInterval(k(g().mark((function n(){var i,s;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return clearInterval(t),n.prev=1,n.next=4,r._userManager.querySessionStatus();case 4:(i=n.sent)&&(s={session_state:i.session_state,profile:i.sub&&i.sid?{sub:i.sub,sid:i.sid}:null},r._start(s)),n.next=11;break;case 8:n.prev=8,n.t0=n.catch(1),e.error("error from querySessionStatus",n.t0 instanceof Error?n.t0.message:n.t0);case 11:case"end":return n.stop()}}),n,null,[[1,8]])}))),1e3)},this._callback=k(g().mark((function e(){var t,n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r._logger.create("_callback"),e.prev=1,e.next=4,r._userManager.querySessionStatus();case 4:n=e.sent,i=!0,n&&r._checkSessionIFrame?n.sub===r._sub?(i=!1,r._checkSessionIFrame.start(n.session_state),n.sid===r._sid?t.debug("same sub still logged in at OP, restarting check session iframe; session_state",n.session_state):(t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",n.session_state),r._userManager.events._raiseUserSessionChanged())):t.debug("different subject signed into OP",n.sub):t.debug("subject no longer signed into OP"),i?r._sub?r._userManager.events._raiseUserSignedOut():r._userManager.events._raiseUserSignedIn():t.debug("no change in session detected, no event to raise"),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(1),r._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",e.t0),r._userManager.events._raiseUserSignedOut());case 13:case"end":return e.stop()}}),e,null,[[1,10]])}))),t||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((function(e){r._logger.error(e)}))}),[{key:"_init",value:(e=k(g().mark((function e(){var t,r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.create("_init"),e.next=3,this._userManager.getUser();case 3:if(!(t=e.sent)){e.next=8;break}this._start(t),e.next=13;break;case 8:if(!this._userManager.settings.monitorAnonymousSession){e.next=13;break}return e.next=11,this._userManager.querySessionStatus();case 11:(r=e.sent)&&(n={session_state:r.session_state,profile:r.sub&&r.sid?{sub:r.sub,sid:r.sid}:null},this._start(n));case 13:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e}(),Me=function(){return A((function e(t){var r;j(this,e),this.id_token=t.id_token,this.session_state=null!=(r=t.session_state)?r:null,this.access_token=t.access_token,this.refresh_token=t.refresh_token,this.token_type=t.token_type,this.scope=t.scope,this.profile=t.profile,this.expires_at=t.expires_at,this.state=t.userState,this.url_state=t.url_state}),[{key:"expires_in",get:function(){if(void 0!==this.expires_at)return this.expires_at-de.getEpochTime()},set:function(e){void 0!==e&&(this.expires_at=Math.floor(e)+de.getEpochTime())}},{key:"expired",get:function(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:"scopes",get:function(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}},{key:"toStorageString",value:function(){return new se("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}}],[{key:"fromStorageString",value:function(e){return se.createStatic("User","fromStorageString"),new Me(JSON.parse(e))}}])}(),Ne="oidc-client",He=function(){return A((function e(){j(this,e),this._abort=new ae("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}),[{key:"navigate",value:(e=k(g().mark((function e(t){var r,n,i,s,o=this;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._logger.create("navigate"),this._window){e.next=3;break}throw new Error("Attempted to navigate on a disposed window");case 3:return r.debug("setting URL in window"),this._window.location.replace(t.url),e.next=7,new Promise((function(e,n){var i=function(i){var s,a=i.data,u=null!=(s=t.scriptOrigin)?s:window.location.origin;if(i.origin===u&&(null==a?void 0:a.source)===Ne){try{var c=he.readParams(a.url,t.response_mode).get("state");if(c||r.warn("no state found in response url"),i.source!==o._window&&c!==t.state)return}catch(e){o._dispose(),n(new Error("Invalid response from window"))}e(a)}};window.addEventListener("message",i,!1),o._disposeHandlers.add((function(){return window.removeEventListener("message",i,!1)})),o._disposeHandlers.add(o._abort.addHandler((function(e){o._dispose(),n(e)})))}));case 7:return n=e.sent,i=n.url,s=n.keepOpen,r.debug("got response from window"),this._dispose(),s||this.close(),e.abrupt("return",{url:i});case 14:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"_dispose",value:function(){this._logger.create("_dispose");var e,t=M(this._disposeHandlers);try{for(t.s();!(e=t.n()).done;)(0,e.value)()}catch(e){t.e(e)}finally{t.f()}this._disposeHandlers.clear()}}],[{key:"_notifyParent",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window.location.origin;e.postMessage({source:Ne,url:t,keepOpen:r},n)}}]);var e}(),Le={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},We="_blank",Fe=function(e){function t(e){var r;j(this,t);var n=e.popup_redirect_uri,i=void 0===n?e.redirect_uri:n,s=e.popup_post_logout_redirect_uri,o=void 0===s?e.post_logout_redirect_uri:s,a=e.popupWindowFeatures,u=void 0===a?Le:a,c=e.popupWindowTarget,l=void 0===c?We:c,d=e.redirectMethod,h=void 0===d?"assign":d,p=e.redirectTarget,f=void 0===p?"self":p,g=e.iframeNotifyParentOrigin,_=void 0===g?e.iframeNotifyParentOrigin:g,v=e.iframeScriptOrigin,y=void 0===v?e.iframeScriptOrigin:v,w=e.silent_redirect_uri,m=void 0===w?e.redirect_uri:w,k=e.silentRequestTimeoutInSeconds,b=void 0===k?10:k,x=e.automaticSilentRenew,E=void 0===x||x,T=e.validateSubOnSilentRenew,I=void 0===T||T,O=e.includeIdTokenInSilentRenew,P=void 0!==O&&O,R=e.monitorSession,C=void 0!==R&&R,U=e.monitorAnonymousSession,A=void 0!==U&&U,q=e.checkSessionIntervalInSeconds,M=void 0===q?2:q,N=e.query_status_response_type,H=void 0===N?"code":N,L=e.stopCheckSessionOnError,W=void 0===L||L,F=e.revokeTokenTypes,B=void 0===F?["access_token","refresh_token"]:F,z=e.revokeTokensOnSignout,K=void 0!==z&&z,J=e.includeIdTokenInSilentSignout,D=void 0!==J&&J,G=e.accessTokenExpiringNotificationTimeInSeconds,Q=void 0===G?60:G,V=e.userStore;if((r=S(this,t,[e])).popup_redirect_uri=i,r.popup_post_logout_redirect_uri=o,r.popupWindowFeatures=u,r.popupWindowTarget=l,r.redirectMethod=h,r.redirectTarget=f,r.iframeNotifyParentOrigin=_,r.iframeScriptOrigin=y,r.silent_redirect_uri=m,r.silentRequestTimeoutInSeconds=b,r.automaticSilentRenew=E,r.validateSubOnSilentRenew=I,r.includeIdTokenInSilentRenew=P,r.monitorSession=C,r.monitorAnonymousSession=A,r.checkSessionIntervalInSeconds=M,r.stopCheckSessionOnError=W,r.query_status_response_type=H,r.revokeTokenTypes=B,r.revokeTokensOnSignout=K,r.includeIdTokenInSilentSignout=D,r.accessTokenExpiringNotificationTimeInSeconds=Q,V)r.userStore=V;else{var Y="undefined"!=typeof window?window.sessionStorage:new ve;r.userStore=new me({store:Y})}return r}return E(t,e),A(t)}(ke),Be=function(e){function t(e){var r,n=e.silentRequestTimeoutInSeconds,i=void 0===n?10:n;return j(this,t),(r=S(this,t))._logger=new se("IFrameWindow"),r._timeoutInSeconds=i,r._frame=Be.createHiddenIframe(),r._window=r._frame.contentWindow,r}return E(t,e),A(t,[{key:"navigate",value:(r=k(g().mark((function e(r){var n,i=this;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds),n=setTimeout((function(){return i._abort.raise(new fe("IFrame timed out without a response"))}),1e3*this._timeoutInSeconds),this._disposeHandlers.add((function(){return clearTimeout(n)})),e.next=5,I(t,"navigate",this,3)([r]);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"close",value:function(){var e,t=this;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(function(e){var r,n=e.target;null==(r=n.parentNode)||r.removeChild(n),t._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}}],[{key:"createHiddenIframe",value:function(){var e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",window.document.body.appendChild(e),e}},{key:"notifyParent",value:function(e,r){return I(t,"_notifyParent",this,2)([window.parent,e,!1,r])}}]);var r}(He),ze=function(){return A((function e(t){j(this,e),this._settings=t,this._logger=new se("IFrameNavigator")}),[{key:"prepare",value:(t=k(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.silentRequestTimeoutInSeconds,n=void 0===r?this._settings.silentRequestTimeoutInSeconds:r,e.abrupt("return",new Be({silentRequestTimeoutInSeconds:n}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"callback",value:(e=k(g().mark((function e(t){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._logger.create("callback"),Be.notifyParent(t,this._settings.iframeNotifyParentOrigin);case 2:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e,t}(),Ke=function(e){function t(e){var r,n=e.popupWindowTarget,i=void 0===n?We:n,s=e.popupWindowFeatures,o=void 0===s?{}:s;j(this,t),(r=S(this,t))._logger=new se("PopupWindow");var a=le.center(v(v({},Le),o));return r._window=window.open(void 0,i,le.serialize(a)),o.closePopupWindowAfterInSeconds&&o.closePopupWindowAfterInSeconds>0&&setTimeout((function(){r._window&&"boolean"==typeof r._window.closed&&!r._window.closed?r.close():r._abort.raise(new Error("Popup blocked by user"))}),1e3*o.closePopupWindowAfterInSeconds),r}return E(t,e),A(t,[{key:"navigate",value:(r=k(g().mark((function e(r){var n,i,s=this;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==(n=this._window)||n.focus(),i=setInterval((function(){s._window&&!s._window.closed||s._abort.raise(new Error("Popup closed by user"))}),500),this._disposeHandlers.add((function(){return clearInterval(i)})),e.next=5,I(t,"navigate",this,3)([r]);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"close",value:function(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}}],[{key:"notifyOpener",value:function(e,r){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return I(t,"_notifyParent",this,2)([window.opener,e,r])}}]);var r}(He),Je=function(){return A((function e(t){j(this,e),this._settings=t,this._logger=new se("PopupNavigator")}),[{key:"prepare",value:(t=k(g().mark((function e(t){var r,n,i,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.popupWindowFeatures,n=void 0===r?this._settings.popupWindowFeatures:r,i=t.popupWindowTarget,s=void 0===i?this._settings.popupWindowTarget:i,e.abrupt("return",new Ke({popupWindowFeatures:n,popupWindowTarget:s}));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"callback",value:(e=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=r.keepOpen,i=void 0!==n&&n,this._logger.create("callback"),Ke.notifyOpener(t,i);case 3:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})}]);var e,t}(),De=function(){return A((function e(t){j(this,e),this._settings=t,this._logger=new se("RedirectNavigator")}),[{key:"prepare",value:(t=k(g().mark((function e(t){var r,n,i,s,o,a,u,c,l=this;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.redirectMethod,n=void 0===r?this._settings.redirectMethod:r,i=t.redirectTarget,s=void 0===i?this._settings.redirectTarget:i,this._logger.create("prepare"),a=window.self,"top"===s&&(a=null!=(o=window.top)?o:window.self),u=a.location[n].bind(a.location),e.abrupt("return",{navigate:function(){var e=k(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l._logger.create("navigate"),r=new Promise((function(e,t){c=t})),u(t.url),e.next=5,r;case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),close:function(){l._logger.create("close"),null==c||c(new Error("Redirect aborted")),a.stop()}});case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"callback",value:(e=k(g().mark((function e(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return");case 1:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})}]);var e,t}(),Ge=function(e){function t(e){var r;return j(this,t),(r=S(this,t,[{expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}]))._logger=new se("UserManagerEvents"),r._userLoaded=new ae("User loaded"),r._userUnloaded=new ae("User unloaded"),r._silentRenewError=new ae("Silent renew error"),r._userSignedIn=new ae("User signed in"),r._userSignedOut=new ae("User signed out"),r._userSessionChanged=new ae("User session changed"),r}return E(t,e),A(t,[{key:"load",value:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];I(t,"load",this,3)([e]),r&&this._userLoaded.raise(e)}},{key:"unload",value:function(){I(t,"unload",this,3)([]),this._userUnloaded.raise()}},{key:"addUserLoaded",value:function(e){return this._userLoaded.addHandler(e)}},{key:"removeUserLoaded",value:function(e){return this._userLoaded.removeHandler(e)}},{key:"addUserUnloaded",value:function(e){return this._userUnloaded.addHandler(e)}},{key:"removeUserUnloaded",value:function(e){return this._userUnloaded.removeHandler(e)}},{key:"addSilentRenewError",value:function(e){return this._silentRenewError.addHandler(e)}},{key:"removeSilentRenewError",value:function(e){return this._silentRenewError.removeHandler(e)}},{key:"_raiseSilentRenewError",value:function(e){this._silentRenewError.raise(e)}},{key:"addUserSignedIn",value:function(e){return this._userSignedIn.addHandler(e)}},{key:"removeUserSignedIn",value:function(e){this._userSignedIn.removeHandler(e)}},{key:"_raiseUserSignedIn",value:function(){this._userSignedIn.raise()}},{key:"addUserSignedOut",value:function(e){return this._userSignedOut.addHandler(e)}},{key:"removeUserSignedOut",value:function(e){this._userSignedOut.removeHandler(e)}},{key:"_raiseUserSignedOut",value:function(){this._userSignedOut.raise()}},{key:"addUserSessionChanged",value:function(e){return this._userSessionChanged.addHandler(e)}},{key:"removeUserSessionChanged",value:function(e){this._userSessionChanged.removeHandler(e)}},{key:"_raiseUserSessionChanged",value:function(){this._userSessionChanged.raise()}}])}(ge),Qe=function(){return A((function e(t){var r=this;j(this,e),this._userManager=t,this._logger=new se("SilentRenewService"),this._isStarted=!1,this._retryTimer=new de("Retry Silent Renew"),this._tokenExpiring=k(g().mark((function e(){var t;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r._logger.create("_tokenExpiring"),e.prev=1,e.next=4,r._userManager.signinSilent();case 4:t.debug("silent token renewal successful"),e.next=15;break;case 7:if(e.prev=7,e.t0=e.catch(1),!(e.t0 instanceof fe)){e.next=13;break}return t.warn("ErrorTimeout from signinSilent:",e.t0,"retry in 5s"),r._retryTimer.init(5),e.abrupt("return");case 13:t.error("Error from signinSilent:",e.t0),r._userManager.events._raiseSilentRenewError(e.t0);case 15:case"end":return e.stop()}}),e,null,[[1,7]])})))}),[{key:"start",value:(e=k(g().mark((function e(){var t;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._logger.create("start"),this._isStarted){e.next=13;break}return this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring),e.prev=5,e.next=8,this._userManager.getUser();case 8:e.next=13;break;case 10:e.prev=10,e.t0=e.catch(5),t.error("getUser error",e.t0);case 13:case"end":return e.stop()}}),e,this,[[5,10]])}))),function(){return e.apply(this,arguments)})},{key:"stop",value:function(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}]);var e}(),Ve=A((function e(t,r){j(this,e),this.refresh_token=t.refresh_token,this.id_token=t.id_token,this.session_state=t.session_state,this.scope=t.scope,this.profile=t.profile,this.resource=r,this.data=t.state})),Ye=function(){return A((function e(t,r,n,i){j(this,e),this._logger=new se("UserManager"),this.settings=new Fe(t),this._client=new Ae(t),this._redirectNavigator=null!=r?r:new De(this.settings),this._popupNavigator=null!=n?n:new Je(this.settings),this._iframeNavigator=null!=i?i:new ze(this.settings),this._events=new Ge(this.settings),this._silentRenewService=new Qe(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new qe(this))}),[{key:"events",get:function(){return this._events}},{key:"metadataService",get:function(){return this._client.metadataService}},{key:"getUser",value:(K=k(g().mark((function e(){var t,r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._logger.create("getUser"),e.next=3,this._loadUser();case 3:if(!(r=e.sent)){e.next=8;break}return t.info("user loaded"),this._events.load(r,!1),e.abrupt("return",r);case 8:return t.info("user not found in storage"),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,this)}))),function(){return K.apply(this,arguments)})},{key:"removeUser",value:(z=k(g().mark((function e(){var t;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._logger.create("removeUser"),e.next=3,this.storeUser(null);case 3:t.info("user removed from storage"),this._events.unload();case 5:case"end":return e.stop()}}),e,this)}))),function(){return z.apply(this,arguments)})},{key:"signinRedirect",value:(B=k(g().mark((function e(){var t,r,n,i,s=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},this._logger.create("signinRedirect"),r=t.redirectMethod,n=w(t,u),e.next=5,this._redirectNavigator.prepare({redirectMethod:r});case 5:return i=e.sent,e.next=8,this._signinStart(v({request_type:"si:r"},n),i);case 8:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"signinRedirectCallback",value:(F=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,r=this._logger.create("signinRedirectCallback"),e.next=4,this._signinEnd(t);case 4:return(n=e.sent).profile&&n.profile.sub?r.info("success, signed in subject",n.profile.sub):r.info("no subject"),e.abrupt("return",n);case 7:case"end":return e.stop()}}),e,this)}))),function(){return F.apply(this,arguments)})},{key:"signinResourceOwnerCredentials",value:(W=k(g().mark((function e(t){var r,n,i,s,o,a,u;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.username,n=t.password,i=t.skipUserInfo,s=void 0!==i&&i,o=this._logger.create("signinResourceOwnerCredential"),e.next=4,this._client.processResourceOwnerPasswordCredentials({username:r,password:n,skipUserInfo:s,extraTokenParams:this.settings.extraTokenParams});case 4:return a=e.sent,o.debug("got signin response"),e.next=8,this._buildUser(a);case 8:return(u=e.sent).profile&&u.profile.sub?o.info("success, signed in subject",u.profile.sub):o.info("no subject"),e.abrupt("return",u);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return W.apply(this,arguments)})},{key:"signinPopup",value:(L=k(g().mark((function e(){var t,r,n,i,s,o,a,u,l=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:{},r=this._logger.create("signinPopup"),n=t.popupWindowFeatures,i=t.popupWindowTarget,s=w(t,c),(o=this.settings.popup_redirect_uri)||r.throw(new Error("No popup_redirect_uri configured")),e.next=7,this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:i});case 7:return a=e.sent,e.next=10,this._signin(v({request_type:"si:p",redirect_uri:o,display:"popup"},s),a);case 10:return(u=e.sent)&&(u.profile&&u.profile.sub?r.info("success, signed in subject",u.profile.sub):r.info("no subject")),e.abrupt("return",u);case 13:case"end":return e.stop()}}),e,this)}))),function(){return L.apply(this,arguments)})},{key:"signinPopupCallback",value:(H=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,r=i.length>1&&void 0!==i[1]&&i[1],n=this._logger.create("signinPopupCallback"),e.next=5,this._popupNavigator.callback(t,{keepOpen:r});case 5:n.info("success");case 6:case"end":return e.stop()}}),e,this)}))),function(){return H.apply(this,arguments)})},{key:"signinSilent",value:(N=k(g().mark((function e(){var t,r,n,i,s,o,a,u,c,d,h,p=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},n=this._logger.create("signinSilent"),i=t.silentRequestTimeoutInSeconds,s=t.resource,o=w(t,l),e.next=5,this._loadUser();case 5:if(!(null==(a=e.sent)?void 0:a.refresh_token)){e.next=12;break}return n.debug("using refresh token"),u=new Ve(a,s),e.next=11,this._useRefreshToken(u);case 11:return e.abrupt("return",e.sent);case 12:return(c=this.settings.silent_redirect_uri)||n.throw(new Error("No silent_redirect_uri configured")),a&&this.settings.validateSubOnSilentRenew&&(n.debug("subject prior to silent renew:",a.profile.sub),d=a.profile.sub),e.next=17,this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:i});case 17:return h=e.sent,e.next=20,this._signin(v({request_type:"si:s",redirect_uri:c,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0},o),h,d);case 20:return(a=e.sent)&&((null==(r=a.profile)?void 0:r.sub)?n.info("success, signed in subject",a.profile.sub):n.info("no subject")),e.abrupt("return",a);case 23:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"_useRefreshToken",value:(q=k(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._client.useRefreshToken({state:t,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds});case 2:return r=e.sent,n=new Me(v(v({},t),r)),e.next=6,this.storeUser(n);case 6:return this._events.load(n),e.abrupt("return",n);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return q.apply(this,arguments)})},{key:"signinSilentCallback",value:(U=k(g().mark((function e(){var t,r,n=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:window.location.href,r=this._logger.create("signinSilentCallback"),e.next=4,this._iframeNavigator.callback(t);case 4:r.info("success");case 5:case"end":return e.stop()}}),e,this)}))),function(){return U.apply(this,arguments)})},{key:"signinCallback",value:(C=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,e.next=3,this._client.readSigninResponseState(t);case 3:r=e.sent,n=r.state,e.t0=n.request_type,e.next="si:r"===e.t0?8:"si:p"===e.t0?11:"si:s"===e.t0?14:17;break;case 8:return e.next=10,this.signinRedirectCallback(t);case 10:case 13:case 16:return e.abrupt("return",e.sent);case 11:return e.next=13,this.signinPopupCallback(t);case 14:return e.next=16,this.signinSilentCallback(t);case 17:throw new Error("invalid response_type in state");case 18:case"end":return e.stop()}}),e,this)}))),function(){return C.apply(this,arguments)})},{key:"signoutCallback",value:(R=k(g().mark((function e(){var t,r,n,i,s=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:window.location.href,r=s.length>1&&void 0!==s[1]&&s[1],e.next=4,this._client.readSignoutResponseState(t);case 4:if(n=e.sent,i=n.state){e.next=8;break}return e.abrupt("return");case 8:e.t0=i.request_type,e.next="so:r"===e.t0?11:"so:p"===e.t0?14:"so:s"===e.t0?17:20;break;case 11:return e.next=13,this.signoutRedirectCallback(t);case 13:case 16:case 19:return e.abrupt("break",21);case 14:return e.next=16,this.signoutPopupCallback(t,r);case 17:return e.next=19,this.signoutSilentCallback(t);case 20:throw new Error("invalid response_type in state");case 21:case"end":return e.stop()}}),e,this)}))),function(){return R.apply(this,arguments)})},{key:"querySessionStatus",value:(P=k(g().mark((function e(){var t,r,n,i,s,o,a,u,c,l=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:{},r=this._logger.create("querySessionStatus"),n=t.silentRequestTimeoutInSeconds,i=w(t,d),(s=this.settings.silent_redirect_uri)||r.throw(new Error("No silent_redirect_uri configured")),e.next=7,this._loadUser();case 7:return o=e.sent,e.next=10,this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});case 10:return a=e.sent,e.next=13,this._signinStart(v({request_type:"si:s",redirect_uri:s,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==o?void 0:o.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0},i),a);case 13:return u=e.sent,e.prev=14,e.next=17,this._client.processSigninResponse(u.url);case 17:if(c=e.sent,r.debug("got signin response"),!c.session_state||!c.profile.sub){e.next=22;break}return r.info("success for subject",c.profile.sub),e.abrupt("return",{session_state:c.session_state,sub:c.profile.sub,sid:c.profile.sid});case 22:return r.info("success, user not authenticated"),e.abrupt("return",null);case 26:if(e.prev=26,e.t0=e.catch(14),!(this.settings.monitorAnonymousSession&&e.t0 instanceof pe)){e.next=34;break}e.t1=e.t0.error,e.next="login_required"===e.t1||"consent_required"===e.t1||"interaction_required"===e.t1||"account_selection_required"===e.t1?32:34;break;case 32:return r.info("success for anonymous user"),e.abrupt("return",{session_state:e.t0.session_state});case 34:throw e.t0;case 35:case"end":return e.stop()}}),e,this,[[14,26]])}))),function(){return P.apply(this,arguments)})},{key:"_signin",value:(O=k(g().mark((function e(t,r,n){var i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._signinStart(t,r);case 2:return i=e.sent,e.next=5,this._signinEnd(i.url,n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return O.apply(this,arguments)})},{key:"_signinStart",value:(I=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("_signinStart"),e.prev=1,e.next=4,this._client.createSigninRequest(t);case 4:return i=e.sent,n.debug("got signin request"),e.next=8,r.navigate({url:i.url,state:i.state.id,response_mode:i.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin});case 8:return e.abrupt("return",e.sent);case 11:throw e.prev=11,e.t0=e.catch(1),n.debug("error after preparing navigator, closing navigator window"),r.close(),e.t0;case 16:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(e,t){return I.apply(this,arguments)})},{key:"_signinEnd",value:(T=k(g().mark((function e(t,r){var n,i,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._logger.create("_signinEnd"),e.next=3,this._client.processSigninResponse(t);case 3:return i=e.sent,n.debug("got signin response"),e.next=7,this._buildUser(i,r);case 7:return s=e.sent,e.abrupt("return",s);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"_buildUser",value:(E=k(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._logger.create("_buildUser"),i=new Me(t),!r){e.next=7;break}if(r===i.profile.sub){e.next=6;break}throw n.debug("current user does not match user returned from signin. sub from signin:",i.profile.sub),new pe(v(v({},t),{},{error:"login_required"}));case 6:n.debug("current user matches user returned from signin");case 7:return e.next=9,this.storeUser(i);case 9:return n.debug("user stored"),this._events.load(i),e.abrupt("return",i);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"signoutRedirect",value:(x=k(g().mark((function e(){var t,r,n,i,s,o=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},r=this._logger.create("signoutRedirect"),n=t.redirectMethod,i=w(t,h),e.next=5,this._redirectNavigator.prepare({redirectMethod:n});case 5:return s=e.sent,e.next=8,this._signoutStart(v({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri},i),s);case 8:r.info("success");case 9:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"signoutRedirectCallback",value:(S=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,r=this._logger.create("signoutRedirectCallback"),e.next=4,this._signoutEnd(t);case 4:return n=e.sent,r.info("success"),e.abrupt("return",n);case 7:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"signoutPopup",value:(b=k(g().mark((function e(){var t,r,n,i,s,o,a,u=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:{},r=this._logger.create("signoutPopup"),n=t.popupWindowFeatures,i=t.popupWindowTarget,s=w(t,p),o=this.settings.popup_post_logout_redirect_uri,e.next=6,this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:i});case 6:return a=e.sent,e.next=9,this._signout(v({request_type:"so:p",post_logout_redirect_uri:o,state:null==o?void 0:{}},s),a);case 9:r.info("success");case 10:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"signoutPopupCallback",value:(m=k(g().mark((function e(){var t,r,n,i=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:window.location.href,r=i.length>1&&void 0!==i[1]&&i[1],n=this._logger.create("signoutPopupCallback"),e.next=5,this._popupNavigator.callback(t,{keepOpen:r});case 5:n.info("success");case 6:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"_signout",value:(y=k(g().mark((function e(t,r){var n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._signoutStart(t,r);case 2:return n=e.sent,e.next=5,this._signoutEnd(n.url);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"_signoutStart",value:(_=k(g().mark((function e(){var t,r,n,i,s,o,a,u=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:{},r=u.length>1?u[1]:void 0,i=this._logger.create("_signoutStart"),e.prev=3,e.next=6,this._loadUser();case 6:if(s=e.sent,i.debug("loaded current user from storage"),!this.settings.revokeTokensOnSignout){e.next=11;break}return e.next=11,this._revokeInternal(s);case 11:return(o=t.id_token_hint||s&&s.id_token)&&(i.debug("setting id_token_hint in signout request"),t.id_token_hint=o),e.next=15,this.removeUser();case 15:return i.debug("user removed, creating signout request"),e.next=18,this._client.createSignoutRequest(t);case 18:return a=e.sent,i.debug("got signout request"),e.next=22,r.navigate({url:a.url,state:null==(n=a.state)?void 0:n.id,scriptOrigin:this.settings.iframeScriptOrigin});case 22:return e.abrupt("return",e.sent);case 25:throw e.prev=25,e.t0=e.catch(3),i.debug("error after preparing navigator, closing navigator window"),r.close(),e.t0;case 30:case"end":return e.stop()}}),e,this,[[3,25]])}))),function(){return _.apply(this,arguments)})},{key:"_signoutEnd",value:(a=k(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._logger.create("_signoutEnd"),e.next=3,this._client.processSignoutResponse(t);case 3:return n=e.sent,r.debug("got signout response"),e.abrupt("return",n);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"signoutSilent",value:(o=k(g().mark((function e(){var t,r,n,i,s,o,a,u,c=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:{},n=this._logger.create("signoutSilent"),i=t.silentRequestTimeoutInSeconds,s=w(t,f),!this.settings.includeIdTokenInSilentSignout){e.next=15;break}return e.next=6,this._loadUser();case 6:if(e.t1=r=e.sent,null!=e.t1){e.next=11;break}e.t2=void 0,e.next=12;break;case 11:e.t2=r.id_token;case 12:e.t0=e.t2,e.next=16;break;case 15:e.t0=void 0;case 16:return o=e.t0,a=this.settings.popup_post_logout_redirect_uri,e.next=20,this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:i});case 20:return u=e.sent,e.next=23,this._signout(v({request_type:"so:s",post_logout_redirect_uri:a,id_token_hint:o},s),u);case 23:n.info("success");case 24:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"signoutSilentCallback",value:(s=k(g().mark((function e(){var t,r,n=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:window.location.href,r=this._logger.create("signoutSilentCallback"),e.next=4,this._iframeNavigator.callback(t);case 4:r.info("success");case 5:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"revokeTokens",value:(i=k(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._loadUser();case 2:return r=e.sent,e.next=5,this._revokeInternal(r,t);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_revokeInternal",value:(n=k(g().mark((function e(t){var r,n,i,s,o,a,u=arguments;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:this.settings.revokeTokenTypes,n=this._logger.create("_revokeInternal"),t){e.next=4;break}return e.abrupt("return");case 4:if(i=r.filter((function(e){return"string"==typeof t[e]})),i.length){e.next=8;break}return n.debug("no need to revoke due to no token(s)"),e.abrupt("return");case 8:s=M(i),e.prev=9,s.s();case 11:if((o=s.n()).done){e.next=19;break}return a=o.value,e.next=15,this._client.revokeToken(t[a],a);case 15:n.info("".concat(a," revoked successfully")),"access_token"!==a&&(t[a]=null);case 17:e.next=11;break;case 19:e.next=24;break;case 21:e.prev=21,e.t0=e.catch(9),s.e(e.t0);case 24:return e.prev=24,s.f(),e.finish(24);case 27:return e.next=29,this.storeUser(t);case 29:n.debug("user stored"),this._events.load(t);case 31:case"end":return e.stop()}}),e,this,[[9,21,24,27]])}))),function(e){return n.apply(this,arguments)})},{key:"startSilentRenew",value:function(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}},{key:"stopSilentRenew",value:function(){this._silentRenewService.stop()}},{key:"_userStoreKey",get:function(){return"user:".concat(this.settings.authority,":").concat(this.settings.client_id)}},{key:"_loadUser",value:(r=k(g().mark((function e(){var t,r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._logger.create("_loadUser"),e.next=3,this.settings.userStore.get(this._userStoreKey);case 3:if(!(r=e.sent)){e.next=7;break}return t.debug("user storageString loaded"),e.abrupt("return",Me.fromStorageString(r));case 7:return t.debug("no user storageString"),e.abrupt("return",null);case 9:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"storeUser",value:(t=k(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._logger.create("storeUser"),!t){e.next=8;break}return r.debug("storing user"),n=t.toStorageString(),e.next=6,this.settings.userStore.set(this._userStoreKey,n);case 6:e.next=11;break;case 8:return this._logger.debug("removing user"),e.next=11,this.settings.userStore.remove(this._userStoreKey);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"clearStaleState",value:(e=k(g().mark((function e(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._client.clearStaleState();case 2:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e,t,r,n,i,s,o,a,_,y,m,b,S,x,E,T,I,O,P,R,C,U,q,N,H,L,W,F,B,z,K}(),$e="2.4.0"},477:()=>{}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r(480);module.exports=n})();
3
3
  exports.__oidcSpaBundle = true;