@touchtech/web-auth 3.0.2 → 3.0.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationRequest=void 0;var n=r(537),o=r(96),i=function(){function e(t,r,o){void 0===r&&(r=new n.DefaultCrypto),void 0===o&&(o=!0),this.crypto=r,this.usePkce=o,this.clientId=t.client_id,this.redirectUri=t.redirect_uri,this.scope=t.scope,this.responseType=t.response_type||e.RESPONSE_TYPE_CODE,this.state=t.state||function(e){return e.generateRandom(10)}(r),this.extras=t.extras,this.internal=t.internal}return e.prototype.setupCodeVerifier=function(){var e=this;if(this.usePkce){var t=this.crypto.generateRandom(128);return this.crypto.deriveChallenge(t).catch((function(e){o.log("Unable to generate PKCE challenge. Not using PKCE",e)})).then((function(r){r&&(e.internal=e.internal||{},e.internal.code_verifier=t,e.extras=e.extras||{},e.extras.code_challenge=r,e.extras.code_challenge_method="S256")}))}return Promise.resolve()},e.prototype.toJson=function(){var e=this;return this.setupCodeVerifier().then((function(){return{response_type:e.responseType,client_id:e.clientId,redirect_uri:e.redirectUri,scope:e.scope,state:e.state,extras:e.extras,internal:e.internal}}))},e.RESPONSE_TYPE_TOKEN="token",e.RESPONSE_TYPE_CODE="code",e}();t.AuthorizationRequest=i},960:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationRequestHandler=t.BUILT_IN_PARAMETERS=t.AuthorizationNotifier=void 0;var n=r(96),o=function(){function e(){this.listener=null}return e.prototype.setAuthorizationListener=function(e){this.listener=e},e.prototype.onAuthorizationComplete=function(e,t,r){this.listener&&this.listener(e,t,r)},e}();t.AuthorizationNotifier=o,t.BUILT_IN_PARAMETERS=["redirect_uri","client_id","response_type","state","scope"];var i=function(){function e(e,t){this.utils=e,this.crypto=t,this.notifier=null}return e.prototype.buildRequestUrl=function(e,r){var n={redirect_uri:r.redirectUri,client_id:r.clientId,response_type:r.responseType,state:r.state,scope:r.scope};if(r.extras)for(var o in r.extras)r.extras.hasOwnProperty(o)&&t.BUILT_IN_PARAMETERS.indexOf(o)<0&&(n[o]=r.extras[o]);var i=this.utils.stringify(n);return e.authorizationEndpoint+"?"+i},e.prototype.completeAuthorizationRequestIfPossible=function(){var e=this;return n.log("Checking to see if there is an authorization response to be delivered."),this.notifier||n.log("Notifier is not present on AuthorizationRequest handler.\n No delivery of result will be possible"),this.completeAuthorizationRequest().then((function(t){t||n.log("No result is available yet."),t&&e.notifier&&e.notifier.onAuthorizationComplete(t.request,t.response,t.error)}))},e.prototype.setAuthorizationNotifier=function(e){return this.notifier=e,this},e}();t.AuthorizationRequestHandler=i},208:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationError=t.AuthorizationResponse=void 0;var r=function(){function e(e){this.code=e.code,this.state=e.state}return e.prototype.toJson=function(){return{code:this.code,state:this.state}},e}();t.AuthorizationResponse=r;var n=function(){function e(e){this.error=e.error,this.errorDescription=e.error_description,this.errorUri=e.error_uri,this.state=e.state}return e.prototype.toJson=function(){return{error:this.error,error_description:this.errorDescription,error_uri:this.errorUri,state:this.state}},e}();t.AuthorizationError=n},373:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationServiceConfiguration=void 0;var n=r(157),o=function(){function e(e){this.authorizationEndpoint=e.authorization_endpoint,this.tokenEndpoint=e.token_endpoint,this.revocationEndpoint=e.revocation_endpoint,this.userInfoEndpoint=e.userinfo_endpoint,this.endSessionEndpoint=e.end_session_endpoint}return e.prototype.toJson=function(){return{authorization_endpoint:this.authorizationEndpoint,token_endpoint:this.tokenEndpoint,revocation_endpoint:this.revocationEndpoint,end_session_endpoint:this.endSessionEndpoint,userinfo_endpoint:this.userInfoEndpoint}},e.fetchFromIssuer=function(t,r){var o=t+"/.well-known/openid-configuration";return(r||new n.JQueryRequestor).xhr({url:o,dataType:"json",method:"GET"}).then((function(t){return new e(t)}))},e}();t.AuthorizationServiceConfiguration=o},537:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultCrypto=t.textEncodeLite=t.urlSafe=t.bufferToString=void 0;var n=r(742),o=r(3),i="undefined"!=typeof window&&!!window.crypto,s=i&&!!window.crypto.subtle,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function u(e){for(var t=[],r=0;r<e.byteLength;r+=1){var n=e[r]%a.length;t.push(a[n])}return t.join("")}function c(e){return n.fromByteArray(new Uint8Array(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function l(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}t.bufferToString=u,t.urlSafe=c,t.textEncodeLite=l;var p=function(){function e(){}return e.prototype.generateRandom=function(e){var t=new Uint8Array(e);if(i)window.crypto.getRandomValues(t);else for(var r=0;r<e;r+=1)t[r]=Math.random()*a.length|0;return u(t)},e.prototype.deriveChallenge=function(e){return e.length<43||e.length>128?Promise.reject(new o.AppAuthError("Invalid code length.")):s?new Promise((function(t,r){crypto.subtle.digest("SHA-256",l(e)).then((function(e){return t(c(new Uint8Array(e)))}),(function(e){return r(e)}))})):Promise.reject(new o.AppAuthError("window.crypto.subtle is unavailable."))},e}();t.DefaultCrypto=p},3:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppAuthError=void 0;t.AppAuthError=function(e,t){this.message=e,this.extras=t}},577:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IS_PROFILE=t.IS_LOG=void 0,t.IS_LOG=!0,t.IS_PROFILE=!1},865:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(438),t),o(r(960),t),o(r(208),t),o(r(373),t),o(r(537),t),o(r(3),t),o(r(577),t),o(r(96),t),o(r(629),t),o(r(417),t),o(r(33),t),o(r(480),t),o(r(892),t),o(r(551),t),o(r(298),t),o(r(53),t),o(r(157),t)},96:function(e,t,r){"use strict";var n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.profile=t.log=void 0;var o=r(577);function i(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(o.IS_LOG){var i=t?t.length:0;i>0?console.log.apply(console,n([e],t)):console.log(e)}}t.log=i;var s="undefined"!=typeof window&&!!window.performance&&!!console.profile;t.profile=function(e,t,r){return o.IS_PROFILE?function(e,t,r){var o=r.value,a=o.name;return a||(a="anonymous function"),r.value=s?function(e){console.profile(a);var t=window.performance.now(),r=o.call.apply(o,n([this||window],e)),i=window.performance.now()-t;return console.log(a+" took "+i+" ms"),console.profileEnd(),r}:function(e){i("Profile start "+a);var t=Date.now(),r=o.call.apply(o,n([this||window],e)),s=Date.now()-t;return i("Profile end "+a+" took "+s+" ms."),r},r}(0,0,r):r}},629:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BasicQueryStringUtils=void 0;var r=function(){function e(){}return e.prototype.parse=function(e,t){return t?this.parseQueryString(e.hash):this.parseQueryString(e.search)},e.prototype.parseQueryString=function(e){for(var t={},r=(e=e.trim().replace(/^(\?|#|&)/,"")).split("&"),n=0;n<r.length;n+=1){var o=r[n].split("=");if(o.length>=2){var i=decodeURIComponent(o.shift()),s=o.length>0?o.join("="):null;s&&(t[i]=decodeURIComponent(s))}}return t},e.prototype.stringify=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&e[r]&&t.push(encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t.join("&")},e}();t.BasicQueryStringUtils=r},417:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.RedirectRequestHandler=void 0;var i=r(438),s=r(960),a=r(208),u=r(537),c=r(96),l=r(629),p=r(480),f=function(e){return e+"_appauth_authorization_request"},d=function(e){return e+"_appauth_authorization_service_configuration"},h="appauth_current_authorization_request",y=function(e){function t(t,r,n,o){void 0===t&&(t=new p.LocalStorageBackend),void 0===r&&(r=new l.BasicQueryStringUtils),void 0===n&&(n=window.location),void 0===o&&(o=new u.DefaultCrypto);var i=e.call(this,r,o)||this;return i.storageBackend=t,i.locationLike=n,i}return o(t,e),t.prototype.performAuthorizationRequest=function(e,t){var r=this,n=this.crypto.generateRandom(10);Promise.all([this.storageBackend.setItem(h,n),t.toJson().then((function(e){return r.storageBackend.setItem(f(n),JSON.stringify(e))})),this.storageBackend.setItem(d(n),JSON.stringify(e.toJson()))]).then((function(){var n=r.buildRequestUrl(e,t);c.log("Making a request to ",t,n),r.locationLike.assign(n)}))},t.prototype.completeAuthorizationRequest=function(){var e=this;return this.storageBackend.getItem(h).then((function(t){return t?e.storageBackend.getItem(f(t)).then((function(e){return JSON.parse(e)})).then((function(e){return new i.AuthorizationRequest(e)})).then((function(r){var n=""+e.locationLike.origin+e.locationLike.pathname,o=e.utils.parse(e.locationLike,!0),i=o.state,s=o.code,u=o.error;c.log("Potential authorization request ",n,o,i,s,u);var l=i===r.state,p=null,y=null;if(l){if(u){var g=o.error_uri,v=o.error_description;y=new a.AuthorizationError({error:u,error_description:v,error_uri:g,state:i})}else p=new a.AuthorizationResponse({code:s,state:i});return Promise.all([e.storageBackend.removeItem(h),e.storageBackend.removeItem(f(t)),e.storageBackend.removeItem(d(t))]).then((function(){return c.log("Delivering authorization response"),{request:r,response:p,error:y}}))}return c.log("Mismatched request (state and request_uri) dont match."),Promise.resolve(null)})):null}))},t}(s.AuthorizationRequestHandler);t.RedirectRequestHandler=y},33:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RevokeTokenRequest=void 0;var r=function(){function e(e){this.token=e.token,this.tokenTypeHint=e.token_type_hint,this.clientId=e.client_id,this.clientSecret=e.client_secret}return e.prototype.toJson=function(){var e={token:this.token};return this.tokenTypeHint&&(e.token_type_hint=this.tokenTypeHint),this.clientId&&(e.client_id=this.clientId),this.clientSecret&&(e.client_secret=this.clientSecret),e},e.prototype.toStringMap=function(){return this.toJson()},e}();t.RevokeTokenRequest=r},480:function(e,t){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStorageBackend=t.StorageBackend=void 0;var o=function(){};t.StorageBackend=o;var i=function(e){function t(t){var r=e.call(this)||this;return r.storage=t||window.localStorage,r}return n(t,e),t.prototype.getItem=function(e){var t=this;return new Promise((function(r,n){r(t.storage.getItem(e)||null)}))},t.prototype.removeItem=function(e){var t=this;return new Promise((function(r,n){t.storage.removeItem(e),r()}))},t.prototype.clear=function(){var e=this;return new Promise((function(t,r){e.storage.clear(),t()}))},t.prototype.setItem=function(e,t){var r=this;return new Promise((function(n,o){r.storage.setItem(e,t),n()}))},t}(o);t.LocalStorageBackend=i},892:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenRequest=t.GRANT_TYPE_REFRESH_TOKEN=t.GRANT_TYPE_AUTHORIZATION_CODE=void 0,t.GRANT_TYPE_AUTHORIZATION_CODE="authorization_code",t.GRANT_TYPE_REFRESH_TOKEN="refresh_token";var r=function(){function e(e){this.clientId=e.client_id,this.redirectUri=e.redirect_uri,this.grantType=e.grant_type,this.code=e.code,this.refreshToken=e.refresh_token,this.extras=e.extras}return e.prototype.toJson=function(){return{grant_type:this.grantType,code:this.code,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,client_id:this.clientId,extras:this.extras}},e.prototype.toStringMap=function(){var e={grant_type:this.grantType,client_id:this.clientId,redirect_uri:this.redirectUri};if(this.code&&(e.code=this.code),this.refreshToken&&(e.refresh_token=this.refreshToken),this.extras)for(var t in this.extras)this.extras.hasOwnProperty(t)&&!e.hasOwnProperty(t)&&(e[t]=this.extras[t]);return e},e}();t.TokenRequest=r},551:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTokenRequestHandler=void 0;var n=r(3),o=r(629),i=r(298),s=r(157),a=function(){function e(e,t){void 0===e&&(e=new s.JQueryRequestor),void 0===t&&(t=new o.BasicQueryStringUtils),this.requestor=e,this.utils=t}return e.prototype.isTokenResponse=function(e){return void 0===e.error},e.prototype.performRevokeTokenRequest=function(e,t){return this.requestor.xhr({url:e.revocationEndpoint,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:this.utils.stringify(t.toStringMap())}).then((function(e){return!0}))},e.prototype.performTokenRequest=function(e,t){var r=this;return this.requestor.xhr({url:e.tokenEndpoint,method:"POST",dataType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:this.utils.stringify(t.toStringMap())}).then((function(e){return r.isTokenResponse(e)?new i.TokenResponse(e):Promise.reject(new n.AppAuthError(e.error,new i.TokenError(e)))}))},e}();t.BaseTokenRequestHandler=a},298:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenError=t.TokenResponse=t.nowInSeconds=void 0,t.nowInSeconds=function(){return Math.round((new Date).getTime()/1e3)};var r=function(){function e(e){this.accessToken=e.access_token,this.tokenType=e.token_type||"bearer",e.expires_in&&(this.expiresIn=parseInt(e.expires_in,10)),this.refreshToken=e.refresh_token,this.scope=e.scope,this.idToken=e.id_token,this.issuedAt=e.issued_at||t.nowInSeconds()}return e.prototype.toJson=function(){var e;return{access_token:this.accessToken,id_token:this.idToken,refresh_token:this.refreshToken,scope:this.scope,token_type:this.tokenType,issued_at:this.issuedAt,expires_in:null===(e=this.expiresIn)||void 0===e?void 0:e.toString()}},e.prototype.isValid=function(e){return void 0===e&&(e=-600),!this.expiresIn||t.nowInSeconds()<this.issuedAt+this.expiresIn+e},e}();t.TokenResponse=r;var n=function(){function e(e){this.error=e.error,this.errorDescription=e.error_description,this.errorUri=e.error_uri}return e.prototype.toJson=function(){return{error:this.error,error_description:this.errorDescription,error_uri:this.errorUri}},e}();t.TokenError=n},53:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},157:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.TestRequestor=t.FetchRequestor=t.JQueryRequestor=t.Requestor=void 0;var i=r(3),s=function(){};t.Requestor=s;var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.xhr=function(e){var t=$.ajax(e);return new Promise((function(e,r){t.then((function(t,r,n){e(t)}),(function(e,t,n){r(new i.AppAuthError(n))}))}))},t}(s);t.JQueryRequestor=a;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.xhr=function(e){if(!e.url)return Promise.reject(new i.AppAuthError("A URL must be provided."));var t=new URL(e.url),r={};if(r.method=e.method,r.mode="cors",e.data&&(e.method&&"POST"===e.method.toUpperCase()?r.body=e.data:new URLSearchParams(e.data).forEach((function(e,r){t.searchParams.append(r,e)}))),r.headers={},e.headers)for(var n in e.headers)e.headers.hasOwnProperty(n)&&(r.headers[n]=e.headers[n]);var o=e.dataType&&"json"===e.dataType.toLowerCase();return o&&(r.headers.Accept="application/json, text/javascript, */*; q=0.01"),fetch(t.toString(),r).then((function(e){if(e.status>=200&&e.status<300){var t=e.headers.get("content-type");return o||t&&-1!==t.indexOf("application/json")?e.json():e.text()}return Promise.reject(new i.AppAuthError(e.status.toString(),e.statusText))}))},t}(s);t.FetchRequestor=u;var c=function(e){function t(t){var r=e.call(this)||this;return r.promise=t,r}return o(t,e),t.prototype.xhr=function(e){return this.promise},t}(s);t.TestRequestor=c},742:(e,t)=>{"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=u(e),s=i[0],a=i[1],c=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,p=a>0?s-4:s;for(r=0;r<p;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,a=0,u=n-o;a<u;a+=s)i.push(c(e,a,a+s>u?u:a+s));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=i.length;s<a;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var o,i,s=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},924:(e,t,r)=>{"use strict";var n=r(210),o=r(559),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},559:(e,t,r)=>{"use strict";var n=r(612),o=r(210),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||n.call(s,i),u=o("%Object.getOwnPropertyDescriptor%",!0),c=o("%Object.defineProperty%",!0),l=o("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var t=a(n,s,arguments);if(u&&c){var r=u(t,"length");r.configurable&&c(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(n,i,arguments)};c?c(e.exports,"apply",{value:p}):e.exports.apply=p},187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}y(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var o,i,s,c;if(a(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),s=i[t]),void 0===s)s=i[t]=r,++e._eventsCount;else if("function"==typeof s?s=i[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=u(e))>0&&s.length>o&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,c=l,console&&console.warn&&console.warn(c)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function f(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return u(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var c=u.length,l=h(u,c);for(r=0;r<c;++r)n(l[r],this,t)}return!0},i.prototype.addListener=function(e,t){return c(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return c(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,p(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,p(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,o,i,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},i.prototype.listenerCount=d,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(t+i);for(var s,a=r.call(arguments,1),u=function(){if(this instanceof s){var t=i.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return i.apply(e,a.concat(r.call(arguments)))},c=Math.max(0,i.length-a.length),l=[],p=0;p<c;p++)l.push("$"+p);if(s=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(u),i.prototype){var f=function(){};f.prototype=i.prototype,s.prototype=new f,f.prototype=null}return s}},612:(e,t,r)=>{"use strict";var n=r(648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,o=SyntaxError,i=Function,s=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(e){u=null}var c=function(){throw new s},l=u?function(){try{return c}catch(e){try{return u(arguments,"callee").get}catch(e){return c}}}():c,p=r(405)(),f=Object.getPrototypeOf||function(e){return e.__proto__},d={},h="undefined"==typeof Uint8Array?n:f(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":p?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?f(""[Symbol.iterator]()):n,"%Symbol%":p?Symbol:n,"%SyntaxError%":o,"%ThrowTypeError%":l,"%TypedArray%":h,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},g=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=f(o.prototype))}return y[t]=r,r},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(612),_=r(642),S=m.call(Function.call,Array.prototype.concat),b=m.call(Function.apply,Array.prototype.splice),w=m.call(Function.call,String.prototype.replace),O=m.call(Function.call,String.prototype.slice),A=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E=/\\(\\)?/g,P=function(e){var t=O(e,0,1),r=O(e,-1);if("%"===t&&"%"!==r)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var n=[];return w(e,A,(function(e,t,r,o){n[n.length]=r?w(o,E,"$1"):t||e})),n},k=function(e,t){var r,n=e;if(_(v,n)&&(n="%"+(r=v[n])[0]+"%"),_(y,n)){var i=y[n];if(i===d&&(i=g(n)),void 0===i&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var r=P(e),n=r.length>0?r[0]:"",i=k("%"+n+"%",t),a=i.name,c=i.value,l=!1,p=i.alias;p&&(n=p[0],b(r,S([0,1],p)));for(var f=1,d=!0;f<r.length;f+=1){var h=r[f],g=O(h,0,1),v=O(h,-1);if(('"'===g||"'"===g||"`"===g||'"'===v||"'"===v||"`"===v)&&g!==v)throw new o("property names with quotes must have matching quotes");if("constructor"!==h&&d||(l=!0),_(y,a="%"+(n+="."+h)+"%"))c=y[a];else if(null!=c){if(!(h in c)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(u&&f+1>=r.length){var m=u(c,h);c=(d=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:c[h]}else d=_(c,h),c=c[h];d&&!l&&(y[a]=c)}}return c}},405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},642:(e,t,r)=>{"use strict";var n=r(612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},631:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=n&&o&&"function"==typeof o.get?o.get:null,s=n&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,u=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=a&&u&&"function"==typeof u.get?u.get:null,l=a&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,f="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,g=Function.prototype.toString,v=String.prototype.match,m=String.prototype.slice,_=String.prototype.replace,S=String.prototype.toUpperCase,b=String.prototype.toLowerCase,w=RegExp.prototype.test,O=Array.prototype.concat,A=Array.prototype.join,E=Array.prototype.slice,P=Math.floor,k="function"==typeof BigInt?BigInt.prototype.valueOf:null,R=Object.getOwnPropertySymbols,I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,j="function"==typeof Symbol&&"object"==typeof Symbol.iterator,x="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,T=Object.prototype.propertyIsEnumerable,C=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function N(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-P(-e):P(e);if(n!==e){var o=String(n),i=m.call(t,o.length+1);return _.call(o,r,"$&_")+"."+_.call(_.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(t,r,"$&_")}var U=r(654).custom,L=U&&q(U)?U:null;function M(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function F(e){return _.call(String(e),/"/g,""")}function z(e){return!("[object Array]"!==H(e)||x&&"object"==typeof e&&x in e)}function q(e){if(j)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!I)return!1;try{return I.call(e),!0}catch(e){}return!1}e.exports=function e(t,r,n,o){var a=r||{};if(B(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(B(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!B(a,"customInspect")||a.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(B(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(B(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var y=a.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return W(t,a);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var S=String(t);return y?N(t,S):S}if("bigint"==typeof t){var w=String(t)+"n";return y?N(t,w):w}var P=void 0===a.depth?5:a.depth;if(void 0===n&&(n=0),n>=P&&P>0&&"object"==typeof t)return z(t)?"[Array]":"[Object]";var R,U=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=A.call(Array(e.indent+1)," ")}return{base:r,prev:A.call(Array(t+1),r)}}(a,n);if(void 0===o)o=[];else if(G(o,t)>=0)return"[Circular]";function D(t,r,i){if(r&&(o=E.call(o)).push(r),i){var s={depth:a.depth};return B(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,n+1,o)}return e(t,a,n+1,o)}if("function"==typeof t){var J=function(e){if(e.name)return e.name;var t=v.call(g.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),X=Q(t,D);return"[Function"+(J?": "+J:" (anonymous)")+"]"+(X.length>0?" { "+A.call(X,", ")+" }":"")}if(q(t)){var Z=j?_.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):I.call(t);return"object"!=typeof t||j?Z:$(Z)}if((R=t)&&"object"==typeof R&&("undefined"!=typeof HTMLElement&&R instanceof HTMLElement||"string"==typeof R.nodeName&&"function"==typeof R.getAttribute)){for(var ee="<"+b.call(String(t.nodeName)),te=t.attributes||[],re=0;re<te.length;re++)ee+=" "+te[re].name+"="+M(F(te[re].value),"double",a);return ee+=">",t.childNodes&&t.childNodes.length&&(ee+="..."),ee+"</"+b.call(String(t.nodeName))+">"}if(z(t)){if(0===t.length)return"[]";var ne=Q(t,D);return U&&!function(e){for(var t=0;t<e.length;t++)if(G(e[t],"\n")>=0)return!1;return!0}(ne)?"["+K(ne,U)+"]":"[ "+A.call(ne,", ")+" ]"}if(function(e){return!("[object Error]"!==H(e)||x&&"object"==typeof e&&x in e)}(t)){var oe=Q(t,D);return"cause"in t&&!T.call(t,"cause")?"{ ["+String(t)+"] "+A.call(O.call("[cause]: "+D(t.cause),oe),", ")+" }":0===oe.length?"["+String(t)+"]":"{ ["+String(t)+"] "+A.call(oe,", ")+" }"}if("object"==typeof t&&u){if(L&&"function"==typeof t[L])return t[L]();if("symbol"!==u&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{c.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ie=[];return s.call(t,(function(e,r){ie.push(D(r,t,!0)+" => "+D(e,t))})),Y("Map",i.call(t),ie,U)}if(function(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var se=[];return l.call(t,(function(e){se.push(D(e,t))})),Y("Set",c.call(t),se,U)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return V("WeakMap");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return V("WeakSet");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{return d.call(e),!0}catch(e){}return!1}(t))return V("WeakRef");if(function(e){return!("[object Number]"!==H(e)||x&&"object"==typeof e&&x in e)}(t))return $(D(Number(t)));if(function(e){if(!e||"object"!=typeof e||!k)return!1;try{return k.call(e),!0}catch(e){}return!1}(t))return $(D(k.call(t)));if(function(e){return!("[object Boolean]"!==H(e)||x&&"object"==typeof e&&x in e)}(t))return $(h.call(t));if(function(e){return!("[object String]"!==H(e)||x&&"object"==typeof e&&x in e)}(t))return $(D(String(t)));if(!function(e){return!("[object Date]"!==H(e)||x&&"object"==typeof e&&x in e)}(t)&&!function(e){return!("[object RegExp]"!==H(e)||x&&"object"==typeof e&&x in e)}(t)){var ae=Q(t,D),ue=C?C(t)===Object.prototype:t instanceof Object||t.constructor===Object,ce=t instanceof Object?"":"null prototype",le=!ue&&x&&Object(t)===t&&x in t?m.call(H(t),8,-1):ce?"Object":"",pe=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(le||ce?"["+A.call(O.call([],le||[],ce||[]),": ")+"] ":"");return 0===ae.length?pe+"{}":U?pe+"{"+K(ae,U)+"}":pe+"{ "+A.call(ae,", ")+" }"}return String(t)};var D=Object.prototype.hasOwnProperty||function(e){return e in this};function B(e,t){return D.call(e,t)}function H(e){return y.call(e)}function G(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function W(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return W(m.call(e,0,t.maxStringLength),t)+n}return M(_.call(_.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,J),"single",t)}function J(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+S.call(t.toString(16))}function $(e){return"Object("+e+")"}function V(e){return e+" { ? }"}function Y(e,t,r,n){return e+" ("+t+") {"+(n?K(r,n):A.call(r,", "))+"}"}function K(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+A.call(e,","+r)+"\n"+t.prev}function Q(e,t){var r=z(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=B(e,o)?t(e[o],e):""}var i,s="function"==typeof R?R(e):[];if(j){i={};for(var a=0;a<s.length;a++)i["$"+s[a]]=s[a]}for(var u in e)B(e,u)&&(r&&String(Number(u))===u&&u<e.length||j&&i["$"+u]instanceof Symbol||(w.call(/[^\w$]/,u)?n.push(t(u,e)+": "+t(e[u],e)):n.push(u+": "+t(e[u],e))));if("function"==typeof R)for(var c=0;c<s.length;c++)T.call(e,s[c])&&n.push("["+t(s[c])+"]: "+t(e[s[c]],e));return n}},798:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC3986";e.exports={default:n,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:n}},129:(e,t,r)=>{"use strict";var n=r(261),o=r(235),i=r(798);e.exports={formats:i,parse:o,stringify:n}},235:(e,t,r)=>{"use strict";var n=r(769),o=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},u=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},c=function(e,t,r,n){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(i),c=a?i.slice(0,a.index):i,l=[];if(c){if(!r.plainObjects&&o.call(Object.prototype,c)&&!r.allowPrototypes)return;l.push(c)}for(var p=0;r.depth>0&&null!==(a=s.exec(i))&&p<r.depth;){if(p+=1,!r.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;l.push(a[1])}return a&&l.push("["+i.slice(a.index)+"]"),function(e,t,r,n){for(var o=n?t:u(t,r),i=e.length-1;i>=0;--i){var s,a=e[i];if("[]"===a&&r.parseArrays)s=[].concat(o);else{s=r.plainObjects?Object.create(null):{};var c="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,l=parseInt(c,10);r.parseArrays||""!==c?!isNaN(l)&&a!==c&&String(l)===c&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(s=[])[l]=o:"__proto__"!==c&&(s[c]=o):s={0:o}}o=s}return o}(l,t,r,n)}};e.exports=function(e,t){var r=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function(e,t){var r,c={},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,f=l.split(t.delimiter,p),d=-1,h=t.charset;if(t.charsetSentinel)for(r=0;r<f.length;++r)0===f[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===f[r]?h="utf-8":"utf8=%26%2310003%3B"===f[r]&&(h="iso-8859-1"),d=r,r=f.length);for(r=0;r<f.length;++r)if(r!==d){var y,g,v=f[r],m=v.indexOf("]="),_=-1===m?v.indexOf("="):m+1;-1===_?(y=t.decoder(v,s.decoder,h,"key"),g=t.strictNullHandling?null:""):(y=t.decoder(v.slice(0,_),s.decoder,h,"key"),g=n.maybeMap(u(v.slice(_+1),t),(function(e){return t.decoder(e,s.decoder,h,"value")}))),g&&t.interpretNumericEntities&&"iso-8859-1"===h&&(g=a(g)),v.indexOf("[]=")>-1&&(g=i(g)?[g]:g),o.call(c,y)?c[y]=n.combine(c[y],g):c[y]=g}return c}(e,r):e,p=r.plainObjects?Object.create(null):{},f=Object.keys(l),d=0;d<f.length;++d){var h=f[d],y=c(h,l[h],r,"string"==typeof e);p=n.merge(p,y,r)}return!0===r.allowSparse?p:n.compact(p)}},261:(e,t,r)=>{"use strict";var n=r(478),o=r(769),i=r(798),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},u=Array.isArray,c=String.prototype.split,l=Array.prototype.push,p=function(e,t){l.apply(e,u(t)?t:[t])},f=Date.prototype.toISOString,d=i.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:o.encode,encodeValuesOnly:!1,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return f.call(e)},skipNulls:!1,strictNullHandling:!1},y={},g=function e(t,r,i,s,a,l,f,d,g,v,m,_,S,b,w){for(var O,A=t,E=w,P=0,k=!1;void 0!==(E=E.get(y))&&!k;){var R=E.get(t);if(P+=1,void 0!==R){if(R===P)throw new RangeError("Cyclic object value");k=!0}void 0===E.get(y)&&(P=0)}if("function"==typeof f?A=f(r,A):A instanceof Date?A=v(A):"comma"===i&&u(A)&&(A=o.maybeMap(A,(function(e){return e instanceof Date?v(e):e}))),null===A){if(s)return l&&!S?l(r,h.encoder,b,"key",m):r;A=""}if("string"==typeof(O=A)||"number"==typeof O||"boolean"==typeof O||"symbol"==typeof O||"bigint"==typeof O||o.isBuffer(A)){if(l){var I=S?r:l(r,h.encoder,b,"key",m);if("comma"===i&&S){for(var j=c.call(String(A),","),x="",T=0;T<j.length;++T)x+=(0===T?"":",")+_(l(j[T],h.encoder,b,"value",m));return[_(I)+"="+x]}return[_(I)+"="+_(l(A,h.encoder,b,"value",m))]}return[_(r)+"="+_(String(A))]}var C,N=[];if(void 0===A)return N;if("comma"===i&&u(A))C=[{value:A.length>0?A.join(",")||null:void 0}];else if(u(f))C=f;else{var U=Object.keys(A);C=d?U.sort(d):U}for(var L=0;L<C.length;++L){var M=C[L],F="object"==typeof M&&void 0!==M.value?M.value:A[M];if(!a||null!==F){var z=u(A)?"function"==typeof i?i(r,M):r:r+(g?"."+M:"["+M+"]");w.set(t,P);var q=n();q.set(y,w),p(N,e(F,z,i,s,a,l,f,d,g,v,m,_,S,b,q))}}return N};e.exports=function(e,t){var r,o=e,c=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i.default;if(void 0!==e.format){if(!s.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=i.formatters[r],o=h.filter;return("function"==typeof e.filter||u(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof c.filter?o=(0,c.filter)("",o):u(c.filter)&&(r=c.filter);var l,f=[];if("object"!=typeof o||null===o)return"";l=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var d=a[l];r||(r=Object.keys(o)),c.sort&&r.sort(c.sort);for(var y=n(),v=0;v<r.length;++v){var m=r[v];c.skipNulls&&null===o[m]||p(f,g(o[m],m,d,c.strictNullHandling,c.skipNulls,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,y))}var _=f.join(c.delimiter),S=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?S+="utf8=%26%2310003%3B&":S+="utf8=%E2%9C%93&"),_.length>0?S+_:""}},769:(e,t,r)=>{"use strict";var n=r(798),o=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],s=o.obj[o.prop],a=Object.keys(s),u=0;u<a.length;++u){var c=a[u],l=s[c];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(t.push({obj:s,prop:c}),r.push(l))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,o,i){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===r)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var u="",c=0;c<a.length;++c){var l=a.charCodeAt(c);45===l||46===l||95===l||126===l||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===n.RFC1738&&(40===l||41===l)?u+=a.charAt(c):l<128?u+=s[l]:l<2048?u+=s[192|l>>6]+s[128|63&l]:l<55296||l>=57344?u+=s[224|l>>12]+s[128|l>>6&63]+s[128|63&l]:(c+=1,l=65536+((1023&l)<<10|1023&a.charCodeAt(c)),u+=s[240|l>>18]+s[128|l>>12&63]+s[128|l>>6&63]+s[128|63&l])}return u},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(i(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return i(t)&&!i(r)&&(s=a(t,n)),i(t)&&i(r)?(r.forEach((function(r,i){if(o.call(t,i)){var s=t[i];s&&"object"==typeof s&&r&&"object"==typeof r?t[i]=e(s,r,n):t.push(r)}else t[i]=r})),t):Object.keys(r).reduce((function(t,i){var s=r[i];return o.call(t,i)?t[i]=e(t[i],s,n):t[i]=s,t}),s)}}},478:(e,t,r)=>{"use strict";var n=r(210),o=r(924),i=r(631),s=n("%TypeError%"),a=n("%WeakMap%",!0),u=n("%Map%",!0),c=o("WeakMap.prototype.get",!0),l=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),f=o("Map.prototype.get",!0),d=o("Map.prototype.set",!0),h=o("Map.prototype.has",!0),y=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new s("Side channel does not contain "+i(e))},get:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return c(e,n)}else if(u){if(t)return f(t,n)}else if(r)return function(e,t){var r=y(e,t);return r&&r.value}(r,n)},has:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return p(e,n)}else if(u){if(t)return h(t,n)}else if(r)return function(e,t){return!!y(e,t)}(r,n);return!1},set:function(n,o){a&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new a),l(e,n,o)):u?(t||(t=new u),d(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=y(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n}},654:()=>{}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},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.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={};(()=>{"use strict";r.r(n),r.d(n,{AuthCallback:()=>G,AuthContext:()=>N,AuthFlow:()=>x,AuthProvider:()=>U,AuthRefreshTokenError:()=>I,AuthService:()=>C,DEFAULT_IDENTITY_PROVIDER:()=>h,Modes:()=>m,Privileges:()=>_,Protected:()=>F,ProtectedContentContext:()=>L,ProtectedContentProvider:()=>M,getIdentityProviderFromHostname:()=>v,userHasMode:()=>b,userHasTenantAccess:()=>S});var e=r(129),t=r.n(e);const o=require("react");var i=r.n(o);const s=require("react-router-dom");function a(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}Object.create,Object.create;var u=r(187),c=r.n(u);function l(e){this.message=e}l.prototype=new Error,l.prototype.name="InvalidCharacterError";var p="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new l("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,o=0,i=0,s="";n=t.charAt(i++);~n&&(r=o%4?64*r+n:n,o++%4)?s+=String.fromCharCode(255&r>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return s};function f(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(p(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 p(t)}}function d(e){this.message=e}d.prototype=new Error,d.prototype.name="InvalidTokenError";const h="default",y=/^(.+)\..+\.touchtech\.com$/,g=/^(.+)\.localhost$/;function v(e){var t;const r=e.toLowerCase(),n=null!==(t=r.match(y))&&void 0!==t?t:r.match(g);return null!==n?n[1]:h}class m{}m.SUPERADMIN="superadmin";class _{}function S(e,t,r){for(const n of e.roles)if(n===`${t}:${r}`||n===`${t}:${_.UNIVERSAL}`)return!0;return!1}function b(e,t){return e.mode===t}_.UNIVERSAL="universal",_.SHOWROOM_APP="showroom-app",_.SENDOUTS_APP="sendouts-app",_.SENDOUTS_CMS_APP="sendouts-cms-app",_.MARKETING_ENGINE_APP="marketing-engine-app",_.USER_MANAGEMENT_APP="user-management-app",_.INSTORE_ADMIN_APP="instore-admin-app";var w=r(865),O=r(438),A=r(960),E=r(373),P=r(892),k=r(551),R=r(298);class I extends Error{constructor(e="Refresh token error"){super(e)}}class j extends w.BasicQueryStringUtils{parse(e){return super.parse(e,!1)}}class x extends u.EventEmitter{constructor(e){super(),this._configuration=e,this._notifier=new A.AuthorizationNotifier,this._authorizationHandler=new w.RedirectRequestHandler(new w.LocalStorageBackend,new j),this._tokenHandler=new k.BaseTokenRequestHandler(x.s_requestor),this._authorizationHandler.setAuthorizationNotifier(this._notifier),this._notifier.setAuthorizationListener(this.authorizationListener.bind(this)),window.addEventListener("storage",this.handleStorage.bind(this))}initialize(){this.loadState(),this.loadSignOutState()}authorizationListener(e,t,r){var n;return a(this,void 0,void 0,(function*(){console.debug("Authorization request complete",e,t,r);const o=null!==(n=null==t?void 0:t.state)&&void 0!==n?n:null==r?void 0:r.state,i=JSON.parse(window.atob(o));if(this.emit("authorizationComplete",{request:e,response:t,error:r,state:i}),t){let r;e.internal&&e.internal.code_verifier&&(r=e.internal.code_verifier),yield this.makeTokenRequest(t.code,r),this.emit("tokenResponse")}}))}signIn({identityProvider:e,force:t=!1,state:r}){return a(this,void 0,void 0,(function*(){this.isSignedIn()?t&&(this.signOutCore(),yield this.makeAuthorizationRequest(e,r)):yield this.makeAuthorizationRequest(e,r)}))}completeSignInIfPossible(){return a(this,void 0,void 0,(function*(){try{yield this._authorizationHandler.completeAuthorizationRequestIfPossible()}finally{window.localStorage.removeItem("appauth_current_authorization_request"),Object.keys(window.localStorage).filter((e=>e.includes("appauth_authorization"))).forEach((e=>{window.localStorage.removeItem(e)}))}}))}isSignedIn(){return!!this._tokenResponse&&this._tokenResponse.isValid(x.AUTH_EXPIRY_BUFFER)}getAccessToken(e=!1,t=0){var r,n;return a(this,void 0,void 0,(function*(){if(!e&&this._tokenResponse&&this._tokenResponse.isValid(x.AUTH_EXPIRY_BUFFER))return this._tokenResponse.accessToken;if(e&&t>0&&void 0!==(null===(r=this._tokenResponse)||void 0===r?void 0:r.issuedAt)&&!((new Date).getTime()/1e3-this._tokenResponse.issuedAt>t)&&this._tokenResponse.isValid(x.AUTH_EXPIRY_BUFFER))return this._tokenResponse.accessToken;if(this._refreshTokenPromise)return yield this._refreshTokenPromise;{if(void 0===(null===(n=this._tokenResponse)||void 0===n?void 0:n.refreshToken))return null;let e;try{this._refreshTokenPromise=this.refreshToken(this._tokenResponse.refreshToken),e=yield this._refreshTokenPromise}finally{this._refreshTokenPromise=void 0}return e}}))}signOut({state:e}){return a(this,void 0,void 0,(function*(){if(!this._tokenResponse)return;const t=this._tokenResponse.idToken;this.signOutCore();const r=yield this.ensureServiceConfiguration(),n=this._configuration.postLogoutRedirectUri;let o=`${r.endSessionEndpoint}?id_token_hint=${t}&post_logout_redirect_uri=${n}`;e&&(o=`${o}&state=${window.btoa(JSON.stringify(e))}`),console.debug(`[AuthFlow] Signing out using post_logout_redirect_uri '${n}' (full endSession URL: '${o}') ...`),window.location.assign(o)}))}signOutCore(){this._tokenResponse=void 0,window.localStorage.removeItem(x.TOKEN_RESPONSE_KEY)}makeAuthorizationRequest(e,t){return a(this,void 0,void 0,(function*(){const r={idp:e},n={returnUri:`${window.location.pathname}${window.location.search}`,signInState:t},o=window.btoa(JSON.stringify(n)),i=new O.AuthorizationRequest({client_id:this._configuration.clientId,redirect_uri:this._configuration.redirectUri,scope:this._configuration.scope,response_type:O.AuthorizationRequest.RESPONSE_TYPE_CODE,state:o,extras:r});this._authorizationHandler.performAuthorizationRequest(yield this.ensureServiceConfiguration(),i)}))}ensureServiceConfiguration(){return a(this,void 0,void 0,(function*(){if(!this._serviceConfiguration){const e=yield E.AuthorizationServiceConfiguration.fetchFromIssuer(this._configuration.openIdIssuerUrl,x.s_requestor);this._serviceConfiguration=e}return this._serviceConfiguration}))}saveState(){this._tokenResponse&&window.localStorage.setItem(x.TOKEN_RESPONSE_KEY,JSON.stringify(this._tokenResponse.toJson()))}loadState(){const e=window.localStorage.getItem(x.TOKEN_RESPONSE_KEY);if(null!=e){const t=JSON.parse(e),r=new R.TokenResponse(t);return this._tokenResponse=r,void this.emit("tokenResponse")}window.localStorage.getItem(x.IS_REFRESHING_TOKEN_KEY)||this.emit("tokenResponseFail")}loadSignOutState(){const{state:e}=t().parse(window.location.search,{ignoreQueryPrefix:!0});if(!e)return;const r=JSON.parse(window.atob(e));this.emit("signOutStateChanged",{state:r})}makeTokenRequest(e,t){return a(this,void 0,void 0,(function*(){const r={};t&&(r.code_verifier=t);const n=new P.TokenRequest({code:e,extras:r,client_id:this._configuration.clientId,redirect_uri:this._configuration.redirectUri,grant_type:P.GRANT_TYPE_AUTHORIZATION_CODE,refresh_token:void 0}),o=yield this._tokenHandler.performTokenRequest(yield this.ensureServiceConfiguration(),n);this._tokenResponse=o,this.saveState()}))}refreshToken(e){return a(this,void 0,void 0,(function*(){console.debug("Refreshing token ..."),this._tokenResponse=void 0,window.localStorage.removeItem(x.TOKEN_RESPONSE_KEY),window.localStorage.setItem(x.IS_REFRESHING_TOKEN_KEY,"true");const t=new P.TokenRequest({client_id:this._configuration.clientId,redirect_uri:this._configuration.redirectUri,grant_type:P.GRANT_TYPE_REFRESH_TOKEN,refresh_token:e,code:void 0,extras:void 0});let r;try{r=yield this._tokenHandler.performTokenRequest(yield this.ensureServiceConfiguration(),t)}catch(e){throw new I(e instanceof Error?e.message:void 0)}finally{window.localStorage.removeItem(x.IS_REFRESHING_TOKEN_KEY)}return this._tokenResponse=r,this.saveState(),console.debug("Refreshed token --\x3e",r),r.accessToken}))}handleStorage(e){e.key===x.TOKEN_RESPONSE_KEY&&null!==e.newValue&&this.loadState()}}x.TOKEN_RESPONSE_KEY="AuthFlow:tokenResponse",x.AUTH_EXPIRY_BUFFER=-600,x.IS_REFRESHING_TOKEN_KEY="AuthFlow:isRefreshingToken",x.s_requestor=new w.FetchRequestor;class T{}T.EMAIL="email",T.GIVEN_NAME="given_name",T.FAMILY_NAME="family_name",T.ROLE="http://schemas.microsoft.com/ws/2008/06/identity/claims/role",T.MODE="mode";class C extends(c()){constructor(e){super(),this._canSignOut=!0,this._isSigningOut=!1,this._isTokenResponseFailed=!1,this._auth=new x(e),this._auth.on("tokenResponse",this.handleTokenResponse.bind(this)).on("authorizationComplete",this.handleAuthorizationComplete.bind(this)).on("tokenResponseFail",this.handleTokenResponseFail.bind(this)).on("signOutStateChanged",this.handleSignOutStateChanged.bind(this)),this._auth.initialize()}static get instance(){if(!C.s_instance)throw new Error("AuthService has not been initialized");return C.s_instance}static initialize(e){if(C.s_instance)throw new Error("AuthService has already been initialized");C.s_instance=new C(e)}static ensureClaimValue(e,t){const r=e[t];if(void 0===r)throw new Error(`Invalid access token. Missing claim '${t}'.`);return r}setUser(e){this._user!==e&&(this._user=e,this.emit("userChanged"))}setSignInState(e){this._signInState!==e&&(this._signInState=e,this.emit("signInStateChanged"))}setSignOutState(e){this._signOutState!==e&&(this._signOutState=e,this.emit("signOutStateChanged"))}setCanSignOut(e){this._canSignOut!==e&&(this._canSignOut=e,this.emit("canSignOutChanged"))}setIsSigningOut(e){this._isSigningOut!==e&&(this._isSigningOut=e,this.emit("isSigningOutChanged"))}handleTokenResponse(){return a(this,void 0,void 0,(function*(){try{this.setUser(yield this.getUser())}catch(e){this.emit("error",e)}}))}handleAuthorizationComplete(e){this.setSignInState(e.state.signInState),this.emit("authorizationComplete",e)}handleTokenResponseFail(){this._isTokenResponseFailed=!0}handleSignOutStateChanged(e){this.setSignOutState(e.state)}getUser(e=!1,t=0){var r;return a(this,void 0,void 0,(function*(){const n=yield this.getAccessTokenPrivate(e,t);if(null===n)return;let o;try{o=function(e,t){if("string"!=typeof e)throw new d("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(f(e.split(".")[r]))}catch(e){throw new d("Invalid token specified: "+e.message)}}(n)}catch(e){const t=e instanceof Error?e:void 0,r=void 0!==t?t.message:e;throw new Error(`Failed to decode access token: ${r}`,{cause:t})}const i=C.ensureClaimValue(o,T.EMAIL),s=C.ensureClaimValue(o,T.GIVEN_NAME),a=C.ensureClaimValue(o,T.FAMILY_NAME),u=null!==(r=o[T.ROLE])&&void 0!==r?r:[];return{email:i,firstName:s,lastName:a,roles:Array.isArray(u)?u:[u],mode:o[T.MODE]}}))}get user(){return this._user}get signInState(){return this._signInState}get signOutState(){return this._signOutState}get canSignOut(){return this._canSignOut}get isSigningOut(){return this._isSigningOut}get isTokenResponseFailed(){return this._isTokenResponseFailed}signIn({force:e=!1,state:t}={}){return a(this,void 0,void 0,(function*(){try{const r=v(window.location.hostname);console.debug(`[AuthService] Using identity provider '${r}' ...`),yield this._auth.signIn({identityProvider:r,force:e,state:t})}catch(e){this.emit("error",e)}}))}completeSignInIfPossible(){return a(this,void 0,void 0,(function*(){try{yield this._auth.completeSignInIfPossible()}catch(e){this.emit("error",e)}}))}getAccessToken(){return a(this,void 0,void 0,(function*(){return yield this.getAccessTokenPrivate(!1,0)}))}getAccessTokenPrivate(e,t){return a(this,void 0,void 0,(function*(){try{return yield this._auth.getAccessToken(e,t)}catch(e){return this.emit("error",e),null}}))}signOut({state:e}={}){return a(this,void 0,void 0,(function*(){try{this.setCanSignOut(!1),this.setIsSigningOut(!0),yield this._auth.signOut({state:e})}catch(e){this.emit("error",e)}}))}refreshUser(e){return a(this,void 0,void 0,(function*(){try{this.setUser(yield this.getUser(!0,e))}catch(e){this.emit("error",e)}}))}}const N=i().createContext({}),U=({children:e,authService:t,onError:r,onUserIdentified:n})=>{const[s,u]=(0,o.useState)(),[c,l]=(0,o.useState)(t.canSignOut),[p,f]=(0,o.useState)(t.isSigningOut),[d,h]=(0,o.useState)(t.signInState),[y,g]=(0,o.useState)(t.signOutState);(0,o.useEffect)((()=>{function e(){const e=t.user;e&&(u(e),n(e))}e();const o=()=>{e()},i=()=>{h(t.signInState)},s=()=>{g(t.signOutState)},c=e=>a(void 0,void 0,void 0,(function*(){if(e instanceof I)return yield t.signIn();r(e)})),p=()=>{l(t.canSignOut)},d=()=>{f(t.isSigningOut)};return t.on("userChanged",o).on("signInStateChanged",i).on("signOutStateChanged",s).on("error",c).on("canSignOutChanged",p).on("isSigningOutChanged",d),()=>{t.off("userChanged",o).off("signInStateChanged",i).off("signOutStateChanged",s).off("error",c).off("canSignOutChanged",p).off("isSigningOutChanged",d)}}),[t,r,n]);const v=(0,o.useMemo)((()=>({user:s,authService:t,signInState:d,signOutState:y,canSignOut:c,isSigningOut:p})),[t,c,p,d,y,s]);return i().createElement(N.Provider,{value:v},e)},L=i().createContext({}),M=({children:e,authorization:t,unauthorizedUrl:r})=>{const n=(0,o.useMemo)((()=>({authorization:t,unauthorizedUrl:r})),[t,r]);return i().createElement(L.Provider,{value:n},e)},F=function({skipAuthorization:e,children:r}){const n=(0,s.useLocation)(),{user:i,authService:a}=(0,o.useContext)(N),{authorization:u,unauthorizedUrl:c}=(0,o.useContext)(L),{state:l}=(0,o.useMemo)((()=>t().parse(n.search,{ignoreQueryPrefix:!0})),[n.search]);return i?e||function(e,t){return function(e){const t=e;return void 0!==t.tenantId&&void 0!==t.privilege}(t)?S(e,t.tenantId,t.privilege):!!function(e){return void 0!==e.mode}(t)&&b(e,t.mode)}(i,u)?r:(console.debug("[Protected] User not authorized to access route; navigating to unauthorized path ..."),window.location.assign(c),null):l?(window.location.assign(l),null):a.isTokenResponseFailed?(a.signIn(),null):null},z=require("@touchtech/baselayer-ui"),q="access_denied",D={general_error:"General error.",invalid_confirmation:"Invalid confirmation.",idp_not_specified:"IDP not provided.",idp_not_recognized:"IDP not recognized.",federation_not_found:"Federation not found.",external_idp_token_fetch:"External IDP token fetch.",external_idp_token_contents:"External IDP token contents.",external_idp_token_fields:"External IDP token fields.",verificator_not_found:"Verificator not found.",no_user_nor_proto_found:"No user nor proto found.",invite_not_recognized:"Invite not recognized.",user_not_created:"User not created."},B={[q]:"Access denied.",account_selection_required:"Account selection required.",consent_required:"Consent required.",interaction_required:"Interaction required.",login_required:"Login required."},H=function({errorMessage:e,navigateTo:t}){const r=(0,s.useNavigate)();return i().createElement("div",{className:"gJiT0wPP9YyRVDsYxWqk"},i().createElement("h1",null,"Sorry, something went wrong."),i().createElement("h3",null,e),i().createElement(z.Button,{onClick:()=>r(t,{replace:!0}),rounded:!0,inverted:!0},"Continue"))},G=function({basename:e}){const t=(0,s.useNavigate)(),{authService:r,user:n}=(0,o.useContext)(N),[{error:a,state:u},c]=(0,o.useState)({error:null,state:null}),l=(0,o.useMemo)((()=>{const t=null==u?void 0:u.returnUri;if(null==t?void 0:t.startsWith(e)){const r=t.substring(e.length);if("?"===r[0])return`/${r}`;if(r.length)return r}return"/"}),[u,e]),p=(0,o.useMemo)((()=>{var e;if(a){const{error:t,errorDescription:r}=a;if(t===q){const e=r;if(void 0!==e){const t=D[e];if(t)return t}}return null!==(e=null!=r?r:B[t])&&void 0!==e?e:`An unknown error occurred. (Error code: '${t}'.)`}}),[a]);return(0,o.useEffect)((()=>{n&&t(l,{replace:!0})}),[t,l,n]),(0,o.useEffect)((()=>{const e=({error:e,state:t})=>{c({error:e,state:t})};return r.on("authorizationComplete",e),r.completeSignInIfPossible(),()=>{r.off("authorizationComplete",e)}}),[r]),i().createElement("div",{className:"C_297mJYGNkE35qpiNZS"},null!=p?i().createElement(H,{errorMessage:p,navigateTo:l}):i().createElement(z.Icon,{src:"data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg width='100%25' height='100%25' viewBox='0 0 46 46' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd%3bclip-rule:evenodd%3bstroke-linejoin:round%3bstroke-miterlimit:2%3b'%3e %3cg transform='matrix(1%2c0%2c0%2c1%2c-27%2c-27)'%3e %3cpath d='M73%2c50C73%2c37.3 62.7%2c27 50%2c27C37.3%2c27 27%2c37.3 27%2c50M30.9%2c50C30.9%2c39.5 39.4%2c30.9 50%2c30.9C60.6%2c30.9 69.1%2c39.5 69.1%2c50' style='fill-rule:nonzero%3b'%3e %3canimateTransform attributeName='transform' attributeType='XML' type='rotate' dur='1s' from='0 50 50' to='360 50 50' repeatCount='indefinite' /%3e %3c/path%3e %3c/g%3e %3c/svg%3e",alt:"Icon",size:"xlarge"}))}})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
1
|
+
(()=>{var e={438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationRequest=void 0;var n=r(537),o=r(96),i=function(){function e(t,r,o){void 0===r&&(r=new n.DefaultCrypto),void 0===o&&(o=!0),this.crypto=r,this.usePkce=o,this.clientId=t.client_id,this.redirectUri=t.redirect_uri,this.scope=t.scope,this.responseType=t.response_type||e.RESPONSE_TYPE_CODE,this.state=t.state||function(e){return e.generateRandom(10)}(r),this.extras=t.extras,this.internal=t.internal}return e.prototype.setupCodeVerifier=function(){var e=this;if(this.usePkce){var t=this.crypto.generateRandom(128);return this.crypto.deriveChallenge(t).catch((function(e){o.log("Unable to generate PKCE challenge. Not using PKCE",e)})).then((function(r){r&&(e.internal=e.internal||{},e.internal.code_verifier=t,e.extras=e.extras||{},e.extras.code_challenge=r,e.extras.code_challenge_method="S256")}))}return Promise.resolve()},e.prototype.toJson=function(){var e=this;return this.setupCodeVerifier().then((function(){return{response_type:e.responseType,client_id:e.clientId,redirect_uri:e.redirectUri,scope:e.scope,state:e.state,extras:e.extras,internal:e.internal}}))},e.RESPONSE_TYPE_TOKEN="token",e.RESPONSE_TYPE_CODE="code",e}();t.AuthorizationRequest=i},960:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationRequestHandler=t.BUILT_IN_PARAMETERS=t.AuthorizationNotifier=void 0;var n=r(96),o=function(){function e(){this.listener=null}return e.prototype.setAuthorizationListener=function(e){this.listener=e},e.prototype.onAuthorizationComplete=function(e,t,r){this.listener&&this.listener(e,t,r)},e}();t.AuthorizationNotifier=o,t.BUILT_IN_PARAMETERS=["redirect_uri","client_id","response_type","state","scope"];var i=function(){function e(e,t){this.utils=e,this.crypto=t,this.notifier=null}return e.prototype.buildRequestUrl=function(e,r){var n={redirect_uri:r.redirectUri,client_id:r.clientId,response_type:r.responseType,state:r.state,scope:r.scope};if(r.extras)for(var o in r.extras)r.extras.hasOwnProperty(o)&&t.BUILT_IN_PARAMETERS.indexOf(o)<0&&(n[o]=r.extras[o]);var i=this.utils.stringify(n);return e.authorizationEndpoint+"?"+i},e.prototype.completeAuthorizationRequestIfPossible=function(){var e=this;return n.log("Checking to see if there is an authorization response to be delivered."),this.notifier||n.log("Notifier is not present on AuthorizationRequest handler.\n No delivery of result will be possible"),this.completeAuthorizationRequest().then((function(t){t||n.log("No result is available yet."),t&&e.notifier&&e.notifier.onAuthorizationComplete(t.request,t.response,t.error)}))},e.prototype.setAuthorizationNotifier=function(e){return this.notifier=e,this},e}();t.AuthorizationRequestHandler=i},208:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationError=t.AuthorizationResponse=void 0;var r=function(){function e(e){this.code=e.code,this.state=e.state}return e.prototype.toJson=function(){return{code:this.code,state:this.state}},e}();t.AuthorizationResponse=r;var n=function(){function e(e){this.error=e.error,this.errorDescription=e.error_description,this.errorUri=e.error_uri,this.state=e.state}return e.prototype.toJson=function(){return{error:this.error,error_description:this.errorDescription,error_uri:this.errorUri,state:this.state}},e}();t.AuthorizationError=n},373:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationServiceConfiguration=void 0;var n=r(157),o=function(){function e(e){this.authorizationEndpoint=e.authorization_endpoint,this.tokenEndpoint=e.token_endpoint,this.revocationEndpoint=e.revocation_endpoint,this.userInfoEndpoint=e.userinfo_endpoint,this.endSessionEndpoint=e.end_session_endpoint}return e.prototype.toJson=function(){return{authorization_endpoint:this.authorizationEndpoint,token_endpoint:this.tokenEndpoint,revocation_endpoint:this.revocationEndpoint,end_session_endpoint:this.endSessionEndpoint,userinfo_endpoint:this.userInfoEndpoint}},e.fetchFromIssuer=function(t,r){var o=t+"/.well-known/openid-configuration";return(r||new n.JQueryRequestor).xhr({url:o,dataType:"json",method:"GET"}).then((function(t){return new e(t)}))},e}();t.AuthorizationServiceConfiguration=o},537:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultCrypto=t.textEncodeLite=t.urlSafe=t.bufferToString=void 0;var n=r(742),o=r(3),i="undefined"!=typeof window&&!!window.crypto,s=i&&!!window.crypto.subtle,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function u(e){for(var t=[],r=0;r<e.byteLength;r+=1){var n=e[r]%a.length;t.push(a[n])}return t.join("")}function c(e){return n.fromByteArray(new Uint8Array(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function l(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}t.bufferToString=u,t.urlSafe=c,t.textEncodeLite=l;var p=function(){function e(){}return e.prototype.generateRandom=function(e){var t=new Uint8Array(e);if(i)window.crypto.getRandomValues(t);else for(var r=0;r<e;r+=1)t[r]=Math.random()*a.length|0;return u(t)},e.prototype.deriveChallenge=function(e){return e.length<43||e.length>128?Promise.reject(new o.AppAuthError("Invalid code length.")):s?new Promise((function(t,r){crypto.subtle.digest("SHA-256",l(e)).then((function(e){return t(c(new Uint8Array(e)))}),(function(e){return r(e)}))})):Promise.reject(new o.AppAuthError("window.crypto.subtle is unavailable."))},e}();t.DefaultCrypto=p},3:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppAuthError=void 0;t.AppAuthError=function(e,t){this.message=e,this.extras=t}},577:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IS_PROFILE=t.IS_LOG=void 0,t.IS_LOG=!0,t.IS_PROFILE=!1},865:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(438),t),o(r(960),t),o(r(208),t),o(r(373),t),o(r(537),t),o(r(3),t),o(r(577),t),o(r(96),t),o(r(629),t),o(r(417),t),o(r(33),t),o(r(480),t),o(r(892),t),o(r(551),t),o(r(298),t),o(r(53),t),o(r(157),t)},96:function(e,t,r){"use strict";var n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.profile=t.log=void 0;var o=r(577);function i(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(o.IS_LOG){var i=t?t.length:0;i>0?console.log.apply(console,n([e],t)):console.log(e)}}t.log=i;var s="undefined"!=typeof window&&!!window.performance&&!!console.profile;t.profile=function(e,t,r){return o.IS_PROFILE?function(e,t,r){var o=r.value,a=o.name;return a||(a="anonymous function"),r.value=s?function(e){console.profile(a);var t=window.performance.now(),r=o.call.apply(o,n([this||window],e)),i=window.performance.now()-t;return console.log(a+" took "+i+" ms"),console.profileEnd(),r}:function(e){i("Profile start "+a);var t=Date.now(),r=o.call.apply(o,n([this||window],e)),s=Date.now()-t;return i("Profile end "+a+" took "+s+" ms."),r},r}(0,0,r):r}},629:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BasicQueryStringUtils=void 0;var r=function(){function e(){}return e.prototype.parse=function(e,t){return t?this.parseQueryString(e.hash):this.parseQueryString(e.search)},e.prototype.parseQueryString=function(e){for(var t={},r=(e=e.trim().replace(/^(\?|#|&)/,"")).split("&"),n=0;n<r.length;n+=1){var o=r[n].split("=");if(o.length>=2){var i=decodeURIComponent(o.shift()),s=o.length>0?o.join("="):null;s&&(t[i]=decodeURIComponent(s))}}return t},e.prototype.stringify=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&e[r]&&t.push(encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t.join("&")},e}();t.BasicQueryStringUtils=r},417:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.RedirectRequestHandler=void 0;var i=r(438),s=r(960),a=r(208),u=r(537),c=r(96),l=r(629),p=r(480),f=function(e){return e+"_appauth_authorization_request"},d=function(e){return e+"_appauth_authorization_service_configuration"},h="appauth_current_authorization_request",y=function(e){function t(t,r,n,o){void 0===t&&(t=new p.LocalStorageBackend),void 0===r&&(r=new l.BasicQueryStringUtils),void 0===n&&(n=window.location),void 0===o&&(o=new u.DefaultCrypto);var i=e.call(this,r,o)||this;return i.storageBackend=t,i.locationLike=n,i}return o(t,e),t.prototype.performAuthorizationRequest=function(e,t){var r=this,n=this.crypto.generateRandom(10);Promise.all([this.storageBackend.setItem(h,n),t.toJson().then((function(e){return r.storageBackend.setItem(f(n),JSON.stringify(e))})),this.storageBackend.setItem(d(n),JSON.stringify(e.toJson()))]).then((function(){var n=r.buildRequestUrl(e,t);c.log("Making a request to ",t,n),r.locationLike.assign(n)}))},t.prototype.completeAuthorizationRequest=function(){var e=this;return this.storageBackend.getItem(h).then((function(t){return t?e.storageBackend.getItem(f(t)).then((function(e){return JSON.parse(e)})).then((function(e){return new i.AuthorizationRequest(e)})).then((function(r){var n=""+e.locationLike.origin+e.locationLike.pathname,o=e.utils.parse(e.locationLike,!0),i=o.state,s=o.code,u=o.error;c.log("Potential authorization request ",n,o,i,s,u);var l=i===r.state,p=null,y=null;if(l){if(u){var g=o.error_uri,v=o.error_description;y=new a.AuthorizationError({error:u,error_description:v,error_uri:g,state:i})}else p=new a.AuthorizationResponse({code:s,state:i});return Promise.all([e.storageBackend.removeItem(h),e.storageBackend.removeItem(f(t)),e.storageBackend.removeItem(d(t))]).then((function(){return c.log("Delivering authorization response"),{request:r,response:p,error:y}}))}return c.log("Mismatched request (state and request_uri) dont match."),Promise.resolve(null)})):null}))},t}(s.AuthorizationRequestHandler);t.RedirectRequestHandler=y},33:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RevokeTokenRequest=void 0;var r=function(){function e(e){this.token=e.token,this.tokenTypeHint=e.token_type_hint,this.clientId=e.client_id,this.clientSecret=e.client_secret}return e.prototype.toJson=function(){var e={token:this.token};return this.tokenTypeHint&&(e.token_type_hint=this.tokenTypeHint),this.clientId&&(e.client_id=this.clientId),this.clientSecret&&(e.client_secret=this.clientSecret),e},e.prototype.toStringMap=function(){return this.toJson()},e}();t.RevokeTokenRequest=r},480:function(e,t){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStorageBackend=t.StorageBackend=void 0;var o=function(){};t.StorageBackend=o;var i=function(e){function t(t){var r=e.call(this)||this;return r.storage=t||window.localStorage,r}return n(t,e),t.prototype.getItem=function(e){var t=this;return new Promise((function(r,n){r(t.storage.getItem(e)||null)}))},t.prototype.removeItem=function(e){var t=this;return new Promise((function(r,n){t.storage.removeItem(e),r()}))},t.prototype.clear=function(){var e=this;return new Promise((function(t,r){e.storage.clear(),t()}))},t.prototype.setItem=function(e,t){var r=this;return new Promise((function(n,o){r.storage.setItem(e,t),n()}))},t}(o);t.LocalStorageBackend=i},892:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenRequest=t.GRANT_TYPE_REFRESH_TOKEN=t.GRANT_TYPE_AUTHORIZATION_CODE=void 0,t.GRANT_TYPE_AUTHORIZATION_CODE="authorization_code",t.GRANT_TYPE_REFRESH_TOKEN="refresh_token";var r=function(){function e(e){this.clientId=e.client_id,this.redirectUri=e.redirect_uri,this.grantType=e.grant_type,this.code=e.code,this.refreshToken=e.refresh_token,this.extras=e.extras}return e.prototype.toJson=function(){return{grant_type:this.grantType,code:this.code,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,client_id:this.clientId,extras:this.extras}},e.prototype.toStringMap=function(){var e={grant_type:this.grantType,client_id:this.clientId,redirect_uri:this.redirectUri};if(this.code&&(e.code=this.code),this.refreshToken&&(e.refresh_token=this.refreshToken),this.extras)for(var t in this.extras)this.extras.hasOwnProperty(t)&&!e.hasOwnProperty(t)&&(e[t]=this.extras[t]);return e},e}();t.TokenRequest=r},551:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTokenRequestHandler=void 0;var n=r(3),o=r(629),i=r(298),s=r(157),a=function(){function e(e,t){void 0===e&&(e=new s.JQueryRequestor),void 0===t&&(t=new o.BasicQueryStringUtils),this.requestor=e,this.utils=t}return e.prototype.isTokenResponse=function(e){return void 0===e.error},e.prototype.performRevokeTokenRequest=function(e,t){return this.requestor.xhr({url:e.revocationEndpoint,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:this.utils.stringify(t.toStringMap())}).then((function(e){return!0}))},e.prototype.performTokenRequest=function(e,t){var r=this;return this.requestor.xhr({url:e.tokenEndpoint,method:"POST",dataType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:this.utils.stringify(t.toStringMap())}).then((function(e){return r.isTokenResponse(e)?new i.TokenResponse(e):Promise.reject(new n.AppAuthError(e.error,new i.TokenError(e)))}))},e}();t.BaseTokenRequestHandler=a},298:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenError=t.TokenResponse=t.nowInSeconds=void 0,t.nowInSeconds=function(){return Math.round((new Date).getTime()/1e3)};var r=function(){function e(e){this.accessToken=e.access_token,this.tokenType=e.token_type||"bearer",e.expires_in&&(this.expiresIn=parseInt(e.expires_in,10)),this.refreshToken=e.refresh_token,this.scope=e.scope,this.idToken=e.id_token,this.issuedAt=e.issued_at||t.nowInSeconds()}return e.prototype.toJson=function(){var e;return{access_token:this.accessToken,id_token:this.idToken,refresh_token:this.refreshToken,scope:this.scope,token_type:this.tokenType,issued_at:this.issuedAt,expires_in:null===(e=this.expiresIn)||void 0===e?void 0:e.toString()}},e.prototype.isValid=function(e){return void 0===e&&(e=-600),!this.expiresIn||t.nowInSeconds()<this.issuedAt+this.expiresIn+e},e}();t.TokenResponse=r;var n=function(){function e(e){this.error=e.error,this.errorDescription=e.error_description,this.errorUri=e.error_uri}return e.prototype.toJson=function(){return{error:this.error,error_description:this.errorDescription,error_uri:this.errorUri}},e}();t.TokenError=n},53:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},157:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.TestRequestor=t.FetchRequestor=t.JQueryRequestor=t.Requestor=void 0;var i=r(3),s=function(){};t.Requestor=s;var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.xhr=function(e){var t=$.ajax(e);return new Promise((function(e,r){t.then((function(t,r,n){e(t)}),(function(e,t,n){r(new i.AppAuthError(n))}))}))},t}(s);t.JQueryRequestor=a;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.xhr=function(e){if(!e.url)return Promise.reject(new i.AppAuthError("A URL must be provided."));var t=new URL(e.url),r={};if(r.method=e.method,r.mode="cors",e.data&&(e.method&&"POST"===e.method.toUpperCase()?r.body=e.data:new URLSearchParams(e.data).forEach((function(e,r){t.searchParams.append(r,e)}))),r.headers={},e.headers)for(var n in e.headers)e.headers.hasOwnProperty(n)&&(r.headers[n]=e.headers[n]);var o=e.dataType&&"json"===e.dataType.toLowerCase();return o&&(r.headers.Accept="application/json, text/javascript, */*; q=0.01"),fetch(t.toString(),r).then((function(e){if(e.status>=200&&e.status<300){var t=e.headers.get("content-type");return o||t&&-1!==t.indexOf("application/json")?e.json():e.text()}return Promise.reject(new i.AppAuthError(e.status.toString(),e.statusText))}))},t}(s);t.FetchRequestor=u;var c=function(e){function t(t){var r=e.call(this)||this;return r.promise=t,r}return o(t,e),t.prototype.xhr=function(e){return this.promise},t}(s);t.TestRequestor=c},742:(e,t)=>{"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=u(e),s=i[0],a=i[1],c=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,p=a>0?s-4:s;for(r=0;r<p;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,a=0,u=n-o;a<u;a+=s)i.push(c(e,a,a+s>u?u:a+s));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=i.length;s<a;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var o,i,s=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},924:(e,t,r)=>{"use strict";var n=r(210),o=r(559),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},559:(e,t,r)=>{"use strict";var n=r(612),o=r(210),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||n.call(s,i),u=o("%Object.getOwnPropertyDescriptor%",!0),c=o("%Object.defineProperty%",!0),l=o("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var t=a(n,s,arguments);if(u&&c){var r=u(t,"length");r.configurable&&c(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(n,i,arguments)};c?c(e.exports,"apply",{value:p}):e.exports.apply=p},187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}y(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var o,i,s,c;if(a(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),s=i[t]),void 0===s)s=i[t]=r,++e._eventsCount;else if("function"==typeof s?s=i[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=u(e))>0&&s.length>o&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,c=l,console&&console.warn&&console.warn(c)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function f(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return u(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var c=u.length,l=h(u,c);for(r=0;r<c;++r)n(l[r],this,t)}return!0},i.prototype.addListener=function(e,t){return c(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return c(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,p(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,p(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,o,i,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},i.prototype.listenerCount=d,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(t+i);for(var s,a=r.call(arguments,1),u=function(){if(this instanceof s){var t=i.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return i.apply(e,a.concat(r.call(arguments)))},c=Math.max(0,i.length-a.length),l=[],p=0;p<c;p++)l.push("$"+p);if(s=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(u),i.prototype){var f=function(){};f.prototype=i.prototype,s.prototype=new f,f.prototype=null}return s}},612:(e,t,r)=>{"use strict";var n=r(648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,o=SyntaxError,i=Function,s=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(e){u=null}var c=function(){throw new s},l=u?function(){try{return c}catch(e){try{return u(arguments,"callee").get}catch(e){return c}}}():c,p=r(405)(),f=Object.getPrototypeOf||function(e){return e.__proto__},d={},h="undefined"==typeof Uint8Array?n:f(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":p?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?f(""[Symbol.iterator]()):n,"%Symbol%":p?Symbol:n,"%SyntaxError%":o,"%ThrowTypeError%":l,"%TypedArray%":h,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},g=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=f(o.prototype))}return y[t]=r,r},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(612),_=r(642),S=m.call(Function.call,Array.prototype.concat),b=m.call(Function.apply,Array.prototype.splice),w=m.call(Function.call,String.prototype.replace),O=m.call(Function.call,String.prototype.slice),E=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A=/\\(\\)?/g,R=function(e){var t=O(e,0,1),r=O(e,-1);if("%"===t&&"%"!==r)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var n=[];return w(e,E,(function(e,t,r,o){n[n.length]=r?w(o,A,"$1"):t||e})),n},P=function(e,t){var r,n=e;if(_(v,n)&&(n="%"+(r=v[n])[0]+"%"),_(y,n)){var i=y[n];if(i===d&&(i=g(n)),void 0===i&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var r=R(e),n=r.length>0?r[0]:"",i=P("%"+n+"%",t),a=i.name,c=i.value,l=!1,p=i.alias;p&&(n=p[0],b(r,S([0,1],p)));for(var f=1,d=!0;f<r.length;f+=1){var h=r[f],g=O(h,0,1),v=O(h,-1);if(('"'===g||"'"===g||"`"===g||'"'===v||"'"===v||"`"===v)&&g!==v)throw new o("property names with quotes must have matching quotes");if("constructor"!==h&&d||(l=!0),_(y,a="%"+(n+="."+h)+"%"))c=y[a];else if(null!=c){if(!(h in c)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(u&&f+1>=r.length){var m=u(c,h);c=(d=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:c[h]}else d=_(c,h),c=c[h];d&&!l&&(y[a]=c)}}return c}},405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},642:(e,t,r)=>{"use strict";var n=r(612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},631:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=n&&o&&"function"==typeof o.get?o.get:null,s=n&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,u=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=a&&u&&"function"==typeof u.get?u.get:null,l=a&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,f="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,g=Function.prototype.toString,v=String.prototype.match,m=String.prototype.slice,_=String.prototype.replace,S=String.prototype.toUpperCase,b=String.prototype.toLowerCase,w=RegExp.prototype.test,O=Array.prototype.concat,E=Array.prototype.join,A=Array.prototype.slice,R=Math.floor,P="function"==typeof BigInt?BigInt.prototype.valueOf:null,k=Object.getOwnPropertySymbols,I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,T="function"==typeof Symbol&&"object"==typeof Symbol.iterator,j="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,x=Object.prototype.propertyIsEnumerable,C=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function N(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-R(-e):R(e);if(n!==e){var o=String(n),i=m.call(t,o.length+1);return _.call(o,r,"$&_")+"."+_.call(_.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(t,r,"$&_")}var U=r(654).custom,L=U&&z(U)?U:null;function M(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function F(e){return _.call(String(e),/"/g,""")}function q(e){return!("[object Array]"!==H(e)||j&&"object"==typeof e&&j in e)}function z(e){if(T)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!I)return!1;try{return I.call(e),!0}catch(e){}return!1}e.exports=function e(t,r,n,o){var a=r||{};if(B(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(B(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!B(a,"customInspect")||a.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(B(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(B(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var y=a.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return G(t,a);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var S=String(t);return y?N(t,S):S}if("bigint"==typeof t){var w=String(t)+"n";return y?N(t,w):w}var R=void 0===a.depth?5:a.depth;if(void 0===n&&(n=0),n>=R&&R>0&&"object"==typeof t)return q(t)?"[Array]":"[Object]";var k,U=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=E.call(Array(e.indent+1)," ")}return{base:r,prev:E.call(Array(t+1),r)}}(a,n);if(void 0===o)o=[];else if(K(o,t)>=0)return"[Circular]";function D(t,r,i){if(r&&(o=A.call(o)).push(r),i){var s={depth:a.depth};return B(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,n+1,o)}return e(t,a,n+1,o)}if("function"==typeof t){var W=function(e){if(e.name)return e.name;var t=v.call(g.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),X=Q(t,D);return"[Function"+(W?": "+W:" (anonymous)")+"]"+(X.length>0?" { "+E.call(X,", ")+" }":"")}if(z(t)){var Z=T?_.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):I.call(t);return"object"!=typeof t||T?Z:Y(Z)}if((k=t)&&"object"==typeof k&&("undefined"!=typeof HTMLElement&&k instanceof HTMLElement||"string"==typeof k.nodeName&&"function"==typeof k.getAttribute)){for(var ee="<"+b.call(String(t.nodeName)),te=t.attributes||[],re=0;re<te.length;re++)ee+=" "+te[re].name+"="+M(F(te[re].value),"double",a);return ee+=">",t.childNodes&&t.childNodes.length&&(ee+="..."),ee+"</"+b.call(String(t.nodeName))+">"}if(q(t)){if(0===t.length)return"[]";var ne=Q(t,D);return U&&!function(e){for(var t=0;t<e.length;t++)if(K(e[t],"\n")>=0)return!1;return!0}(ne)?"["+V(ne,U)+"]":"[ "+E.call(ne,", ")+" ]"}if(function(e){return!("[object Error]"!==H(e)||j&&"object"==typeof e&&j in e)}(t)){var oe=Q(t,D);return"cause"in t&&!x.call(t,"cause")?"{ ["+String(t)+"] "+E.call(O.call("[cause]: "+D(t.cause),oe),", ")+" }":0===oe.length?"["+String(t)+"]":"{ ["+String(t)+"] "+E.call(oe,", ")+" }"}if("object"==typeof t&&u){if(L&&"function"==typeof t[L])return t[L]();if("symbol"!==u&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{c.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ie=[];return s.call(t,(function(e,r){ie.push(D(r,t,!0)+" => "+D(e,t))})),$("Map",i.call(t),ie,U)}if(function(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var se=[];return l.call(t,(function(e){se.push(D(e,t))})),$("Set",c.call(t),se,U)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return J("WeakMap");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return J("WeakSet");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{return d.call(e),!0}catch(e){}return!1}(t))return J("WeakRef");if(function(e){return!("[object Number]"!==H(e)||j&&"object"==typeof e&&j in e)}(t))return Y(D(Number(t)));if(function(e){if(!e||"object"!=typeof e||!P)return!1;try{return P.call(e),!0}catch(e){}return!1}(t))return Y(D(P.call(t)));if(function(e){return!("[object Boolean]"!==H(e)||j&&"object"==typeof e&&j in e)}(t))return Y(h.call(t));if(function(e){return!("[object String]"!==H(e)||j&&"object"==typeof e&&j in e)}(t))return Y(D(String(t)));if(!function(e){return!("[object Date]"!==H(e)||j&&"object"==typeof e&&j in e)}(t)&&!function(e){return!("[object RegExp]"!==H(e)||j&&"object"==typeof e&&j in e)}(t)){var ae=Q(t,D),ue=C?C(t)===Object.prototype:t instanceof Object||t.constructor===Object,ce=t instanceof Object?"":"null prototype",le=!ue&&j&&Object(t)===t&&j in t?m.call(H(t),8,-1):ce?"Object":"",pe=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(le||ce?"["+E.call(O.call([],le||[],ce||[]),": ")+"] ":"");return 0===ae.length?pe+"{}":U?pe+"{"+V(ae,U)+"}":pe+"{ "+E.call(ae,", ")+" }"}return String(t)};var D=Object.prototype.hasOwnProperty||function(e){return e in this};function B(e,t){return D.call(e,t)}function H(e){return y.call(e)}function K(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function G(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return G(m.call(e,0,t.maxStringLength),t)+n}return M(_.call(_.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,W),"single",t)}function W(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+S.call(t.toString(16))}function Y(e){return"Object("+e+")"}function J(e){return e+" { ? }"}function $(e,t,r,n){return e+" ("+t+") {"+(n?V(r,n):E.call(r,", "))+"}"}function V(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+E.call(e,","+r)+"\n"+t.prev}function Q(e,t){var r=q(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=B(e,o)?t(e[o],e):""}var i,s="function"==typeof k?k(e):[];if(T){i={};for(var a=0;a<s.length;a++)i["$"+s[a]]=s[a]}for(var u in e)B(e,u)&&(r&&String(Number(u))===u&&u<e.length||T&&i["$"+u]instanceof Symbol||(w.call(/[^\w$]/,u)?n.push(t(u,e)+": "+t(e[u],e)):n.push(u+": "+t(e[u],e))));if("function"==typeof k)for(var c=0;c<s.length;c++)x.call(e,s[c])&&n.push("["+t(s[c])+"]: "+t(e[s[c]],e));return n}},798:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC3986";e.exports={default:n,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:n}},129:(e,t,r)=>{"use strict";var n=r(261),o=r(235),i=r(798);e.exports={formats:i,parse:o,stringify:n}},235:(e,t,r)=>{"use strict";var n=r(769),o=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},u=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},c=function(e,t,r,n){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(i),c=a?i.slice(0,a.index):i,l=[];if(c){if(!r.plainObjects&&o.call(Object.prototype,c)&&!r.allowPrototypes)return;l.push(c)}for(var p=0;r.depth>0&&null!==(a=s.exec(i))&&p<r.depth;){if(p+=1,!r.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;l.push(a[1])}return a&&l.push("["+i.slice(a.index)+"]"),function(e,t,r,n){for(var o=n?t:u(t,r),i=e.length-1;i>=0;--i){var s,a=e[i];if("[]"===a&&r.parseArrays)s=[].concat(o);else{s=r.plainObjects?Object.create(null):{};var c="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,l=parseInt(c,10);r.parseArrays||""!==c?!isNaN(l)&&a!==c&&String(l)===c&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(s=[])[l]=o:"__proto__"!==c&&(s[c]=o):s={0:o}}o=s}return o}(l,t,r,n)}};e.exports=function(e,t){var r=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function(e,t){var r,c={},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,f=l.split(t.delimiter,p),d=-1,h=t.charset;if(t.charsetSentinel)for(r=0;r<f.length;++r)0===f[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===f[r]?h="utf-8":"utf8=%26%2310003%3B"===f[r]&&(h="iso-8859-1"),d=r,r=f.length);for(r=0;r<f.length;++r)if(r!==d){var y,g,v=f[r],m=v.indexOf("]="),_=-1===m?v.indexOf("="):m+1;-1===_?(y=t.decoder(v,s.decoder,h,"key"),g=t.strictNullHandling?null:""):(y=t.decoder(v.slice(0,_),s.decoder,h,"key"),g=n.maybeMap(u(v.slice(_+1),t),(function(e){return t.decoder(e,s.decoder,h,"value")}))),g&&t.interpretNumericEntities&&"iso-8859-1"===h&&(g=a(g)),v.indexOf("[]=")>-1&&(g=i(g)?[g]:g),o.call(c,y)?c[y]=n.combine(c[y],g):c[y]=g}return c}(e,r):e,p=r.plainObjects?Object.create(null):{},f=Object.keys(l),d=0;d<f.length;++d){var h=f[d],y=c(h,l[h],r,"string"==typeof e);p=n.merge(p,y,r)}return!0===r.allowSparse?p:n.compact(p)}},261:(e,t,r)=>{"use strict";var n=r(478),o=r(769),i=r(798),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},u=Array.isArray,c=String.prototype.split,l=Array.prototype.push,p=function(e,t){l.apply(e,u(t)?t:[t])},f=Date.prototype.toISOString,d=i.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:o.encode,encodeValuesOnly:!1,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return f.call(e)},skipNulls:!1,strictNullHandling:!1},y={},g=function e(t,r,i,s,a,l,f,d,g,v,m,_,S,b,w){for(var O,E=t,A=w,R=0,P=!1;void 0!==(A=A.get(y))&&!P;){var k=A.get(t);if(R+=1,void 0!==k){if(k===R)throw new RangeError("Cyclic object value");P=!0}void 0===A.get(y)&&(R=0)}if("function"==typeof f?E=f(r,E):E instanceof Date?E=v(E):"comma"===i&&u(E)&&(E=o.maybeMap(E,(function(e){return e instanceof Date?v(e):e}))),null===E){if(s)return l&&!S?l(r,h.encoder,b,"key",m):r;E=""}if("string"==typeof(O=E)||"number"==typeof O||"boolean"==typeof O||"symbol"==typeof O||"bigint"==typeof O||o.isBuffer(E)){if(l){var I=S?r:l(r,h.encoder,b,"key",m);if("comma"===i&&S){for(var T=c.call(String(E),","),j="",x=0;x<T.length;++x)j+=(0===x?"":",")+_(l(T[x],h.encoder,b,"value",m));return[_(I)+"="+j]}return[_(I)+"="+_(l(E,h.encoder,b,"value",m))]}return[_(r)+"="+_(String(E))]}var C,N=[];if(void 0===E)return N;if("comma"===i&&u(E))C=[{value:E.length>0?E.join(",")||null:void 0}];else if(u(f))C=f;else{var U=Object.keys(E);C=d?U.sort(d):U}for(var L=0;L<C.length;++L){var M=C[L],F="object"==typeof M&&void 0!==M.value?M.value:E[M];if(!a||null!==F){var q=u(E)?"function"==typeof i?i(r,M):r:r+(g?"."+M:"["+M+"]");w.set(t,R);var z=n();z.set(y,w),p(N,e(F,q,i,s,a,l,f,d,g,v,m,_,S,b,z))}}return N};e.exports=function(e,t){var r,o=e,c=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i.default;if(void 0!==e.format){if(!s.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=i.formatters[r],o=h.filter;return("function"==typeof e.filter||u(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof c.filter?o=(0,c.filter)("",o):u(c.filter)&&(r=c.filter);var l,f=[];if("object"!=typeof o||null===o)return"";l=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var d=a[l];r||(r=Object.keys(o)),c.sort&&r.sort(c.sort);for(var y=n(),v=0;v<r.length;++v){var m=r[v];c.skipNulls&&null===o[m]||p(f,g(o[m],m,d,c.strictNullHandling,c.skipNulls,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,y))}var _=f.join(c.delimiter),S=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?S+="utf8=%26%2310003%3B&":S+="utf8=%E2%9C%93&"),_.length>0?S+_:""}},769:(e,t,r)=>{"use strict";var n=r(798),o=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],s=o.obj[o.prop],a=Object.keys(s),u=0;u<a.length;++u){var c=a[u],l=s[c];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(t.push({obj:s,prop:c}),r.push(l))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,o,i){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===r)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var u="",c=0;c<a.length;++c){var l=a.charCodeAt(c);45===l||46===l||95===l||126===l||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===n.RFC1738&&(40===l||41===l)?u+=a.charAt(c):l<128?u+=s[l]:l<2048?u+=s[192|l>>6]+s[128|63&l]:l<55296||l>=57344?u+=s[224|l>>12]+s[128|l>>6&63]+s[128|63&l]:(c+=1,l=65536+((1023&l)<<10|1023&a.charCodeAt(c)),u+=s[240|l>>18]+s[128|l>>12&63]+s[128|l>>6&63]+s[128|63&l])}return u},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(i(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return i(t)&&!i(r)&&(s=a(t,n)),i(t)&&i(r)?(r.forEach((function(r,i){if(o.call(t,i)){var s=t[i];s&&"object"==typeof s&&r&&"object"==typeof r?t[i]=e(s,r,n):t.push(r)}else t[i]=r})),t):Object.keys(r).reduce((function(t,i){var s=r[i];return o.call(t,i)?t[i]=e(t[i],s,n):t[i]=s,t}),s)}}},478:(e,t,r)=>{"use strict";var n=r(210),o=r(924),i=r(631),s=n("%TypeError%"),a=n("%WeakMap%",!0),u=n("%Map%",!0),c=o("WeakMap.prototype.get",!0),l=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),f=o("Map.prototype.get",!0),d=o("Map.prototype.set",!0),h=o("Map.prototype.has",!0),y=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new s("Side channel does not contain "+i(e))},get:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return c(e,n)}else if(u){if(t)return f(t,n)}else if(r)return function(e,t){var r=y(e,t);return r&&r.value}(r,n)},has:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return p(e,n)}else if(u){if(t)return h(t,n)}else if(r)return function(e,t){return!!y(e,t)}(r,n);return!1},set:function(n,o){a&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new a),l(e,n,o)):u?(t||(t=new u),d(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=y(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n}},654:()=>{}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},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.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={};(()=>{"use strict";r.r(n),r.d(n,{AuthCallback:()=>K,AuthContext:()=>N,AuthFlow:()=>j,AuthProvider:()=>U,AuthRefreshTokenError:()=>I,AuthService:()=>C,DEFAULT_IDENTITY_PROVIDER:()=>h,Modes:()=>m,Privileges:()=>_,Protected:()=>F,ProtectedContentContext:()=>L,ProtectedContentProvider:()=>M,getIdentityProviderFromHostname:()=>v,userHasMode:()=>b,userHasTenantAccess:()=>S});var e=r(129),t=r.n(e);const o=require("react");var i=r.n(o);const s=require("react-router-dom");function a(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}Object.create,Object.create;var u=r(187),c=r.n(u);function l(e){this.message=e}l.prototype=new Error,l.prototype.name="InvalidCharacterError";var p="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new l("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,o=0,i=0,s="";n=t.charAt(i++);~n&&(r=o%4?64*r+n:n,o++%4)?s+=String.fromCharCode(255&r>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return s};function f(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(p(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 p(t)}}function d(e){this.message=e}d.prototype=new Error,d.prototype.name="InvalidTokenError";const h="default",y=/^(.+)\..+\.touchtech\.com$/,g=/^(.+)\.localhost$/;function v(e){var t;const r=e.toLowerCase(),n=null!==(t=r.match(y))&&void 0!==t?t:r.match(g);return null!==n?n[1]:h}class m{}m.SUPERADMIN="superadmin";class _{}function S(e,t,r){for(const n of e.roles)if(n===`${t}:${r}`||n===`${t}:${_.UNIVERSAL}`)return!0;return!1}function b(e,t){return e.mode===t}_.UNIVERSAL="universal",_.SHOWROOM_APP="showroom-app",_.SENDOUTS_APP="sendouts-app",_.SENDOUTS_CMS_APP="sendouts-cms-app",_.MARKETING_ENGINE_APP="marketing-engine-app",_.USER_MANAGEMENT_APP="user-management-app",_.INSTORE_ADMIN_APP="instore-admin-app";var w=r(865),O=r(438),E=r(960),A=r(373),R=r(892),P=r(551),k=r(298);class I extends Error{constructor(e="Refresh token error"){super(e)}}class T extends w.BasicQueryStringUtils{parse(e){return super.parse(e,!1)}}class j extends u.EventEmitter{constructor(e){super(),this._configuration=e,this._notifier=new E.AuthorizationNotifier,this._authorizationHandler=new w.RedirectRequestHandler(new w.LocalStorageBackend,new T),this._tokenHandler=new P.BaseTokenRequestHandler(j.s_requestor),this._authorizationHandler.setAuthorizationNotifier(this._notifier),this._notifier.setAuthorizationListener(this.authorizationListener.bind(this)),window.addEventListener("storage",this.handleStorage.bind(this))}initialize(){this.loadCleanup(),this.loadState(),this.loadSignOutState()}authorizationListener(e,t,r){var n;return a(this,void 0,void 0,(function*(){console.debug("Authorization request complete",e,t,r);const o=null!==(n=null==t?void 0:t.state)&&void 0!==n?n:null==r?void 0:r.state,i=JSON.parse(window.atob(o));if(this.emit("authorizationComplete",{request:e,response:t,error:r,state:i}),t){let r;e.internal&&e.internal.code_verifier&&(r=e.internal.code_verifier);try{yield this.makeTokenRequest(t.code,r)}catch(e){if(j.hasRedirectedOnTokenRequest())return;j.setRedirectedOnTokenRequest(),window.location.assign(i.returnUri)}this.emit("tokenResponse")}}))}static hasRedirectedOnTokenRequest(){return!!window.sessionStorage.getItem(j.REDIRECTED_ON_TOKEN_REQUEST_KEY)}static setRedirectedOnTokenRequest(){window.sessionStorage.setItem(j.REDIRECTED_ON_TOKEN_REQUEST_KEY,"true")}signIn({identityProvider:e,force:t=!1,state:r}){return a(this,void 0,void 0,(function*(){this.isSignedIn()?t&&(this.signOutCore(),yield this.makeAuthorizationRequest(e,r)):yield this.makeAuthorizationRequest(e,r)}))}completeSignInIfPossible(){return a(this,void 0,void 0,(function*(){try{yield this._authorizationHandler.completeAuthorizationRequestIfPossible()}finally{window.localStorage.removeItem("appauth_current_authorization_request"),Object.keys(window.localStorage).filter((e=>e.includes("appauth_authorization"))).forEach((e=>{window.localStorage.removeItem(e)}))}}))}isSignedIn(){return!!this._tokenResponse&&this._tokenResponse.isValid(j.AUTH_EXPIRY_BUFFER)}waitUntilTokenResponseIsSet(){return window.localStorage.getItem(j.IS_REFRESHING_TOKEN_KEY)?(this._tokenResponseSetByOtherTabPromise||(this._tokenResponseSetByOtherTabPromise=new Promise(((e,t)=>{const r=setTimeout((()=>{window.localStorage.removeItem(j.IS_REFRESHING_TOKEN_KEY),t()}),j.WAIT_FOR_REFRESH_TOKEN_TIMEOUT);this._tokenResponseSetByOtherTabPromiseResolve=()=>{clearTimeout(r),e()}}))),this._tokenResponseSetByOtherTabPromise):Promise.resolve()}getAccessToken(e=!1,t=0){var r,n;return a(this,void 0,void 0,(function*(){try{yield this.waitUntilTokenResponseIsSet()}catch(e){return null}if(!e&&this._tokenResponse&&this._tokenResponse.isValid(j.AUTH_EXPIRY_BUFFER))return this._tokenResponse.accessToken;if(e&&t>0&&void 0!==(null===(r=this._tokenResponse)||void 0===r?void 0:r.issuedAt)&&!((new Date).getTime()/1e3-this._tokenResponse.issuedAt>t)&&this._tokenResponse.isValid(j.AUTH_EXPIRY_BUFFER))return this._tokenResponse.accessToken;if(this._refreshTokenPromise)return yield this._refreshTokenPromise;{if(void 0===(null===(n=this._tokenResponse)||void 0===n?void 0:n.refreshToken))return null;let e;try{this._refreshTokenPromise=this.refreshToken(this._tokenResponse.refreshToken),e=yield this._refreshTokenPromise}finally{this._refreshTokenPromise=void 0}return e}}))}signOut({state:e}){return a(this,void 0,void 0,(function*(){if(!this._tokenResponse)return;const t=this._tokenResponse.idToken;this.signOutCore();const r=yield this.ensureServiceConfiguration(),n=this._configuration.postLogoutRedirectUri;let o=`${r.endSessionEndpoint}?id_token_hint=${t}&post_logout_redirect_uri=${n}`;e&&(o=`${o}&state=${window.btoa(JSON.stringify(e))}`),console.debug(`[AuthFlow] Signing out using post_logout_redirect_uri '${n}' (full endSession URL: '${o}') ...`),window.location.assign(o)}))}signOutCore(){this._tokenResponse=void 0,window.localStorage.removeItem(j.TOKEN_RESPONSE_KEY)}makeAuthorizationRequest(e,t){return a(this,void 0,void 0,(function*(){const r={idp:e},n={returnUri:`${window.location.pathname}${window.location.search}`,signInState:t},o=window.btoa(JSON.stringify(n)),i=new O.AuthorizationRequest({client_id:this._configuration.clientId,redirect_uri:this._configuration.redirectUri,scope:this._configuration.scope,response_type:O.AuthorizationRequest.RESPONSE_TYPE_CODE,state:o,extras:r});this._authorizationHandler.performAuthorizationRequest(yield this.ensureServiceConfiguration(),i)}))}ensureServiceConfiguration(){return a(this,void 0,void 0,(function*(){if(!this._serviceConfiguration){const e=yield A.AuthorizationServiceConfiguration.fetchFromIssuer(this._configuration.openIdIssuerUrl,j.s_requestor);this._serviceConfiguration=e}return this._serviceConfiguration}))}saveState(){this._tokenResponse&&window.localStorage.setItem(j.TOKEN_RESPONSE_KEY,JSON.stringify(this._tokenResponse.toJson()))}loadState(){const e=window.localStorage.getItem(j.TOKEN_RESPONSE_KEY);if(null!=e){const t=JSON.parse(e),r=new k.TokenResponse(t);return this._tokenResponse=r,void this.emit("tokenResponse")}window.localStorage.getItem(j.IS_REFRESHING_TOKEN_KEY)?this.emit("tokenIsRefreshing"):this.emit("tokenResponseFail")}loadSignOutState(){const{state:e}=t().parse(window.location.search,{ignoreQueryPrefix:!0});if(!e)return;const r=JSON.parse(window.atob(e));this.emit("signOutStateChanged",{state:r})}loadCleanup(){window.sessionStorage.removeItem(j.REDIRECTED_ON_TOKEN_REQUEST_KEY)}makeTokenRequest(e,t){return a(this,void 0,void 0,(function*(){const r={};t&&(r.code_verifier=t);const n=new R.TokenRequest({code:e,extras:r,client_id:this._configuration.clientId,redirect_uri:this._configuration.redirectUri,grant_type:R.GRANT_TYPE_AUTHORIZATION_CODE,refresh_token:void 0}),o=yield this._tokenHandler.performTokenRequest(yield this.ensureServiceConfiguration(),n);this._tokenResponse=o,this.saveState()}))}refreshToken(e){return a(this,void 0,void 0,(function*(){console.debug("Refreshing token ..."),this._tokenResponse=void 0,window.localStorage.removeItem(j.TOKEN_RESPONSE_KEY),window.localStorage.setItem(j.IS_REFRESHING_TOKEN_KEY,"true");const t=()=>window.localStorage.removeItem(j.IS_REFRESHING_TOKEN_KEY);window.addEventListener("unload",t);const r=new R.TokenRequest({client_id:this._configuration.clientId,redirect_uri:this._configuration.redirectUri,grant_type:R.GRANT_TYPE_REFRESH_TOKEN,refresh_token:e,code:void 0,extras:void 0});let n;try{n=yield this._tokenHandler.performTokenRequest(yield this.ensureServiceConfiguration(),r)}catch(e){throw new I(e instanceof Error?e.message:void 0)}finally{window.localStorage.removeItem(j.IS_REFRESHING_TOKEN_KEY),window.removeEventListener("unload",t)}return this._tokenResponse=n,this.saveState(),console.debug("Refreshed token --\x3e",n),n.accessToken}))}handleStorage(e){e.key===j.TOKEN_RESPONSE_KEY&&null!==e.newValue&&(this.loadState(),this._tokenResponseSetByOtherTabPromiseResolve&&(this._tokenResponseSetByOtherTabPromiseResolve(),this._tokenResponseSetByOtherTabPromiseResolve=void 0,this._tokenResponseSetByOtherTabPromise=void 0))}}j.TOKEN_RESPONSE_KEY="AuthFlow:tokenResponse",j.AUTH_EXPIRY_BUFFER=-600,j.IS_REFRESHING_TOKEN_KEY="AuthFlow:isRefreshingToken",j.REDIRECTED_ON_TOKEN_REQUEST_KEY="AuthFlow:redirectedOnTokenRequest",j.WAIT_FOR_REFRESH_TOKEN_TIMEOUT=3e3,j.s_requestor=new w.FetchRequestor;class x{}x.EMAIL="email",x.GIVEN_NAME="given_name",x.FAMILY_NAME="family_name",x.ROLE="http://schemas.microsoft.com/ws/2008/06/identity/claims/role",x.MODE="mode";class C extends(c()){constructor(e){super(),this._canSignOut=!0,this._isSigningOut=!1,this._isTokenResponseFailed=!1,this._auth=new j(e),this._auth.on("tokenResponse",this.handleTokenResponse.bind(this)).on("authorizationComplete",this.handleAuthorizationComplete.bind(this)).on("tokenResponseFail",this.handleTokenResponseFail.bind(this)).on("signOutStateChanged",this.handleSignOutStateChanged.bind(this)).on("tokenIsRefreshing",this.handleTokenIsRefreshing.bind(this)),this._auth.initialize()}static get instance(){if(!C.s_instance)throw new Error("AuthService has not been initialized");return C.s_instance}static initialize(e){if(C.s_instance)throw new Error("AuthService has already been initialized");C.s_instance=new C(e)}static ensureClaimValue(e,t){const r=e[t];if(void 0===r)throw new Error(`Invalid access token. Missing claim '${t}'.`);return r}setUser(e){this._user!==e&&(this._user=e,this.emit("userChanged"))}setSignInState(e){this._signInState!==e&&(this._signInState=e,this.emit("signInStateChanged"))}setSignOutState(e){this._signOutState!==e&&(this._signOutState=e,this.emit("signOutStateChanged"))}setCanSignOut(e){this._canSignOut!==e&&(this._canSignOut=e,this.emit("canSignOutChanged"))}setIsSigningOut(e){this._isSigningOut!==e&&(this._isSigningOut=e,this.emit("isSigningOutChanged"))}handleTokenResponse(){return a(this,void 0,void 0,(function*(){try{this.setUser(yield this.getUser())}catch(e){this.emit("error",e)}}))}handleTokenIsRefreshing(){return a(this,void 0,void 0,(function*(){try{yield this._auth.waitUntilTokenResponseIsSet()}catch(e){this.signIn()}}))}handleAuthorizationComplete(e){this.setSignInState(e.state.signInState),this.emit("authorizationComplete",e)}handleTokenResponseFail(){this._isTokenResponseFailed=!0}handleSignOutStateChanged(e){this.setSignOutState(e.state)}getUser(e=!1,t=0){var r;return a(this,void 0,void 0,(function*(){const n=yield this.getAccessTokenPrivate(e,t);if(null===n)return;let o;try{o=function(e,t){if("string"!=typeof e)throw new d("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(f(e.split(".")[r]))}catch(e){throw new d("Invalid token specified: "+e.message)}}(n)}catch(e){const t=e instanceof Error?e:void 0,r=void 0!==t?t.message:e;throw new Error(`Failed to decode access token: ${r}`,{cause:t})}const i=C.ensureClaimValue(o,x.EMAIL),s=C.ensureClaimValue(o,x.GIVEN_NAME),a=C.ensureClaimValue(o,x.FAMILY_NAME),u=null!==(r=o[x.ROLE])&&void 0!==r?r:[];return{email:i,firstName:s,lastName:a,roles:Array.isArray(u)?u:[u],mode:o[x.MODE]}}))}get user(){return this._user}get signInState(){return this._signInState}get signOutState(){return this._signOutState}get canSignOut(){return this._canSignOut}get isSigningOut(){return this._isSigningOut}get isTokenResponseFailed(){return this._isTokenResponseFailed}signIn({force:e=!1,state:t}={}){return a(this,void 0,void 0,(function*(){try{const r=v(window.location.hostname);console.debug(`[AuthService] Using identity provider '${r}' ...`),yield this._auth.signIn({identityProvider:r,force:e,state:t})}catch(e){this.emit("error",e)}}))}completeSignInIfPossible(){return a(this,void 0,void 0,(function*(){try{yield this._auth.completeSignInIfPossible()}catch(e){this.emit("error",e)}}))}getAccessToken(){return a(this,void 0,void 0,(function*(){return yield this.getAccessTokenPrivate(!1,0)}))}getAccessTokenPrivate(e,t){return a(this,void 0,void 0,(function*(){try{return yield this._auth.getAccessToken(e,t)}catch(e){return this.emit("error",e),null}}))}signOut({state:e}={}){return a(this,void 0,void 0,(function*(){try{this.setCanSignOut(!1),this.setIsSigningOut(!0),yield this._auth.signOut({state:e})}catch(e){this.emit("error",e)}}))}refreshUser(e){return a(this,void 0,void 0,(function*(){try{this.setUser(yield this.getUser(!0,e))}catch(e){this.emit("error",e)}}))}}const N=i().createContext({}),U=({children:e,authService:t,onError:r,onUserIdentified:n})=>{const[s,u]=(0,o.useState)(),[c,l]=(0,o.useState)(t.canSignOut),[p,f]=(0,o.useState)(t.isSigningOut),[d,h]=(0,o.useState)(t.signInState),[y,g]=(0,o.useState)(t.signOutState);(0,o.useEffect)((()=>{function e(){const e=t.user;e&&(u(e),n(e))}e();const o=()=>{e()},i=()=>{h(t.signInState)},s=()=>{g(t.signOutState)},c=e=>a(void 0,void 0,void 0,(function*(){if(e instanceof I)return yield t.signIn();r(e)})),p=()=>{l(t.canSignOut)},d=()=>{f(t.isSigningOut)};return t.on("userChanged",o).on("signInStateChanged",i).on("signOutStateChanged",s).on("error",c).on("canSignOutChanged",p).on("isSigningOutChanged",d),()=>{t.off("userChanged",o).off("signInStateChanged",i).off("signOutStateChanged",s).off("error",c).off("canSignOutChanged",p).off("isSigningOutChanged",d)}}),[t,r,n]);const v=(0,o.useMemo)((()=>({user:s,authService:t,signInState:d,signOutState:y,canSignOut:c,isSigningOut:p})),[t,c,p,d,y,s]);return i().createElement(N.Provider,{value:v},e)},L=i().createContext({}),M=({children:e,authorization:t,unauthorizedUrl:r})=>{const n=(0,o.useMemo)((()=>({authorization:t,unauthorizedUrl:r})),[t,r]);return i().createElement(L.Provider,{value:n},e)},F=function({skipAuthorization:e,children:r}){const n=(0,s.useLocation)(),{user:i,authService:a}=(0,o.useContext)(N),{authorization:u,unauthorizedUrl:c}=(0,o.useContext)(L),{state:l}=(0,o.useMemo)((()=>t().parse(n.search,{ignoreQueryPrefix:!0})),[n.search]);return i?e||function(e,t){return function(e){const t=e;return void 0!==t.tenantId&&void 0!==t.privilege}(t)?S(e,t.tenantId,t.privilege):!!function(e){return void 0!==e.mode}(t)&&b(e,t.mode)}(i,u)?r:(console.debug("[Protected] User not authorized to access route; navigating to unauthorized path ..."),window.location.assign(c),null):l?(window.location.assign(l),null):a.isTokenResponseFailed?(a.signIn(),null):null},q=require("@touchtech/baselayer-ui"),z="access_denied",D={general_error:"General error.",invalid_confirmation:"Invalid confirmation.",idp_not_specified:"IDP not provided.",idp_not_recognized:"IDP not recognized.",federation_not_found:"Federation not found.",external_idp_token_fetch:"External IDP token fetch.",external_idp_token_contents:"External IDP token contents.",external_idp_token_fields:"External IDP token fields.",verificator_not_found:"Verificator not found.",no_user_nor_proto_found:"No user nor proto found.",invite_not_recognized:"Invite not recognized.",user_not_created:"User not created."},B={[z]:"Access denied.",account_selection_required:"Account selection required.",consent_required:"Consent required.",interaction_required:"Interaction required.",login_required:"Login required."},H=function({errorMessage:e,navigateTo:t}){const r=(0,s.useNavigate)();return i().createElement("div",{className:"gJiT0wPP9YyRVDsYxWqk"},i().createElement("h1",null,"Sorry, something went wrong."),i().createElement("h3",null,e),i().createElement(q.Button,{onClick:()=>r(t,{replace:!0}),rounded:!0,inverted:!0},"Continue"))},K=function({basename:e}){const t=(0,s.useNavigate)(),{authService:r,user:n}=(0,o.useContext)(N),[{error:a,state:u},c]=(0,o.useState)({error:null,state:null}),l=(0,o.useMemo)((()=>{const t=null==u?void 0:u.returnUri;if(null==t?void 0:t.startsWith(e)){const r=t.substring(e.length);if("?"===r[0])return`/${r}`;if(r.length)return r}return"/"}),[u,e]),p=(0,o.useMemo)((()=>{var e;if(a){const{error:t,errorDescription:r}=a;if(t===z){const e=r;if(void 0!==e){const t=D[e];if(t)return t}}return null!==(e=null!=r?r:B[t])&&void 0!==e?e:`An unknown error occurred. (Error code: '${t}'.)`}}),[a]);return(0,o.useEffect)((()=>{n&&t(l,{replace:!0})}),[t,l,n]),(0,o.useEffect)((()=>{const e=({error:e,state:t})=>{c({error:e,state:t})};return r.on("authorizationComplete",e),r.completeSignInIfPossible(),()=>{r.off("authorizationComplete",e)}}),[r]),i().createElement("div",{className:"C_297mJYGNkE35qpiNZS"},null!=p?i().createElement(H,{errorMessage:p,navigateTo:l}):i().createElement(q.Icon,{src:"data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e %3c!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e %3csvg width='100%25' height='100%25' viewBox='0 0 46 46' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd%3bclip-rule:evenodd%3bstroke-linejoin:round%3bstroke-miterlimit:2%3b'%3e %3cg transform='matrix(1%2c0%2c0%2c1%2c-27%2c-27)'%3e %3cpath d='M73%2c50C73%2c37.3 62.7%2c27 50%2c27C37.3%2c27 27%2c37.3 27%2c50M30.9%2c50C30.9%2c39.5 39.4%2c30.9 50%2c30.9C60.6%2c30.9 69.1%2c39.5 69.1%2c50' style='fill-rule:nonzero%3b'%3e %3canimateTransform attributeName='transform' attributeType='XML' type='rotate' dur='1s' from='0 50 50' to='360 50 50' repeatCount='indefinite' /%3e %3c/path%3e %3c/g%3e %3c/svg%3e",alt:"Icon",size:"xlarge"}))}})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
@@ -27,6 +27,7 @@ interface AuthFlowEvents {
|
|
|
27
27
|
canSignOutChanged(): void;
|
|
28
28
|
isSigningOutChanged(): void;
|
|
29
29
|
tokenResponseFail(): void;
|
|
30
|
+
tokenIsRefreshing(): void;
|
|
30
31
|
signOutStateChanged(event: AuthorizationSignOutChangedEvent): void;
|
|
31
32
|
}
|
|
32
33
|
interface SignInOptions {
|
|
@@ -46,6 +47,8 @@ export declare class AuthFlow extends EventEmitter {
|
|
|
46
47
|
private static readonly TOKEN_RESPONSE_KEY;
|
|
47
48
|
private static readonly AUTH_EXPIRY_BUFFER;
|
|
48
49
|
private static readonly IS_REFRESHING_TOKEN_KEY;
|
|
50
|
+
private static readonly REDIRECTED_ON_TOKEN_REQUEST_KEY;
|
|
51
|
+
private static readonly WAIT_FOR_REFRESH_TOKEN_TIMEOUT;
|
|
49
52
|
private static readonly s_requestor;
|
|
50
53
|
private readonly _configuration;
|
|
51
54
|
private readonly _notifier;
|
|
@@ -54,12 +57,17 @@ export declare class AuthFlow extends EventEmitter {
|
|
|
54
57
|
private _serviceConfiguration;
|
|
55
58
|
private _tokenResponse;
|
|
56
59
|
private _refreshTokenPromise;
|
|
60
|
+
private _tokenResponseSetByOtherTabPromise;
|
|
61
|
+
private _tokenResponseSetByOtherTabPromiseResolve;
|
|
57
62
|
constructor(configuration: AuthConfiguration);
|
|
58
63
|
initialize(): void;
|
|
59
64
|
private authorizationListener;
|
|
65
|
+
private static hasRedirectedOnTokenRequest;
|
|
66
|
+
private static setRedirectedOnTokenRequest;
|
|
60
67
|
signIn({ identityProvider, force, state, }: SignInOptions): Promise<void>;
|
|
61
68
|
completeSignInIfPossible(): Promise<void>;
|
|
62
69
|
isSignedIn(): boolean;
|
|
70
|
+
waitUntilTokenResponseIsSet(): Promise<void>;
|
|
63
71
|
getAccessToken(forceRefresh?: boolean, forceRefreshCooldownInSeconds?: number): Promise<string | null>;
|
|
64
72
|
signOut({ state }: SignOutOptions): Promise<void>;
|
|
65
73
|
private signOutCore;
|
|
@@ -68,6 +76,7 @@ export declare class AuthFlow extends EventEmitter {
|
|
|
68
76
|
private saveState;
|
|
69
77
|
private loadState;
|
|
70
78
|
private loadSignOutState;
|
|
79
|
+
private loadCleanup;
|
|
71
80
|
private makeTokenRequest;
|
|
72
81
|
private refreshToken;
|
|
73
82
|
private handleStorage;
|
|
@@ -28,6 +28,7 @@ export declare class AuthService extends EventEmitter implements IAuthService {
|
|
|
28
28
|
private setCanSignOut;
|
|
29
29
|
private setIsSigningOut;
|
|
30
30
|
private handleTokenResponse;
|
|
31
|
+
private handleTokenIsRefreshing;
|
|
31
32
|
private handleAuthorizationComplete;
|
|
32
33
|
private handleTokenResponseFail;
|
|
33
34
|
private handleSignOutStateChanged;
|