@authress/login 2.2.238 → 2.2.241

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /*! Authress Login SDK 2.2.238 | Author - Authress Developers | License information can be found at https://github.com/Authress/login-sdk.js */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.authress=t():e.authress=t()}(this,(()=>(()=>{var e,t,r={669:(e,t,r)=>{e.exports=r(609)},448:(e,t,r)=>{"use strict";var n=r(867),o=r(26),i=r(372),s=r(327),a=r(97),c=r(109),u=r(985),d=r(61);e.exports=function(e){return new Promise((function(t,r){var l=e.data,h=e.headers,p=e.responseType;n.isFormData(l)&&delete h["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";h.Authorization="Basic "+btoa(m+":"+g)}var w=a(e.baseURL,e.url);function y(){if(f){var n="getAllResponseHeaders"in f?c(f.getAllResponseHeaders()):null,i={data:p&&"text"!==p&&"json"!==p?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f};o(t,r,i),f=null}}if(f.open(e.method.toUpperCase(),s(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=y:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(y)},f.onabort=function(){f&&(r(d("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){r(d("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(d(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},n.isStandardBrowserEnv()){var v=(e.withCredentials||u(w))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;v&&(h[e.xsrfHeaderName]=v)}"setRequestHeader"in f&&n.forEach(h,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete h[t]:f.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),p&&"json"!==p&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),r(e),f=null)})),l||(l=null),f.send(l)}))}},609:(e,t,r)=>{"use strict";var n=r(867),o=r(849),i=r(321),s=r(185);function a(e){var t=new i(e),r=o(i.prototype.request,t);return n.extend(r,i.prototype,t),n.extend(r,t),r}var c=a(r(655));c.Axios=i,c.create=function(e){return a(s(c.defaults,e))},c.Cancel=r(263),c.CancelToken=r(972),c.isCancel=r(502),c.all=function(e){return Promise.all(e)},c.spread=r(713),c.isAxiosError=r(268),e.exports=c,e.exports.default=c},263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:(e,t,r)=>{"use strict";var n=r(263);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(867),o=r(327),i=r(782),s=r(572),a=r(185),c=r(875),u=c.validators;function d(e){this.defaults=e,this.interceptors={request:new i,response:new i}}d.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&c.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!n){var d=[s,void 0];for(Array.prototype.unshift.apply(d,r),d=d.concat(i),o=Promise.resolve(e);d.length;)o=o.then(d.shift(),d.shift());return o}for(var l=e;r.length;){var h=r.shift(),p=r.shift();try{l=h(l)}catch(e){p(e);break}}try{o=s(l)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},d.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){d.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=d},782:(e,t,r)=>{"use strict";var n=r(867);function o(){this.handlers=[]}o.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},97:(e,t,r)=>{"use strict";var n=r(793),o=r(303);e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},61:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,o,i){var s=new Error(e);return n(s,t,r,o,i)}},572:(e,t,r)=>{"use strict";var n=r(867),o=r(527),i=r(502),s=r(655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(a(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t){t=t||{};var r={},o=["url","method","data"],i=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function u(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=c(void 0,e[o])):r[o]=c(e[o],t[o])}n.forEach(o,(function(e){n.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),n.forEach(i,u),n.forEach(s,(function(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=c(void 0,e[o])):r[o]=c(void 0,t[o])})),n.forEach(a,(function(n){n in t?r[n]=c(e[n],t[n]):n in e&&(r[n]=c(void 0,e[n]))}));var d=o.concat(i).concat(s).concat(a),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===d.indexOf(e)}));return n.forEach(l,u),r}},26:(e,t,r)=>{"use strict";var n=r(61);e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},527:(e,t,r)=>{"use strict";var n=r(867),o=r(655);e.exports=function(e,t,r){var i=this||o;return n.forEach(r,(function(r){e=r.call(i,e,t)})),e}},655:(e,t,r)=>{"use strict";var n=r(867),o=r(16),i=r(481),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(c=r(448)),c),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(t||JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,r=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||o&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(s)})),e.exports=u},849:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},327:(e,t,r)=>{"use strict";var n=r(867);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(n.isURLSearchParams(t))i=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(o(t)+"="+o(e))})))})),i=s.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},372:(e,t,r)=>{"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},985:(e,t,r)=>{"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},16:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},109:(e,t,r)=>{"use strict";var n=r(867),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,i,s={};return e?(n.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=n.trim(e.substr(0,i)).toLowerCase(),r=n.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}})),s):s}},713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},875:(e,t,r)=>{"use strict";var n=r(593),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var i={},s=n.version.split(".");function a(e,t){for(var r=t?t.split("."):s,n=e.split("."),o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}o.transitional=function(e,t,r){var o=t&&a(t);function s(e,t){return"[Axios v"+n.version+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,a){if(!1===e)throw new Error(s(n," has been removed in "+t));return o&&!i[n]&&(i[n]=!0,console.warn(s(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,a)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],s=t[i];if(s){var a=e[i],c=void 0===a||s(a,i,e);if(!0!==c)throw new TypeError("option "+i+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:o}},867:(e,t,r)=>{"use strict";var n=r(849),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===o.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:c,isUndefined:s,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:d,merge:function e(){var t={};function r(r,n){c(t[n])&&c(r)?t[n]=e(t[n],r):c(r)?t[n]=e({},r):i(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)d(arguments[n],r);return t},extend:function(e,t,r){return d(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},219:e=>{function t(e){return String.fromCharCode(parseInt(e.slice(1),16))}function r(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}e.exports.decode=function(e){return function(e){return decodeURIComponent(Array.from(atob(e),r).join(""))}(e.replace(/-/g,"+").replace(/_/g,"/"))},e.exports.encode=function(e){return e&&"object"==typeof e?btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,""):function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,t))}(e).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,"")}},99:(e,t,r)=>{const n=r(219),o=r(215),i="ExtensionRequestNonce";let s=null;e.exports=class{constructor(e,t){if(this.extensionId=t,!e)throw Error('Missing required property "authressCustomDomain" in ExtensionClient constructor. The Custom Authress Domain Host is required.');if(!t)throw Error('Missing required property "extensionId" in ExtensionClient constructor. The extension is required for selecting the correct login method.');this.authressCustomDomain=`https://${e.replace(/^(https?:\/+)/,"")}`,this.accessToken=null,window.onload=async()=>{await this.requestToken({silent:!0})}}async getUserIdentity(){const e=await this.accessToken&&o.decode(this.accessToken);return e?1e3*e.exp<Date.now()?(this.accessToken=null,null):e:null}async getTokenResponse(){return await this.getUserIdentity()?{accessToken:this.accessToken}:null}requestToken(e={code:null,silent:!1}){if(s)return s=s.catch((()=>{})).then((()=>this.requestTokenContinuation(e)));const t=this.requestTokenContinuation(e);return t.catch((()=>{})),s=t}async requestTokenContinuation(e={code:null,silent:!1}){const t=e&&e.code||new URLSearchParams(window.location.search).get("code");if(!t){if(!e||!e.silent){const e=Error("OAuth Authorization code is required");throw e.code="InvalidAuthorizationCode",e}return this.getTokenResponse()}const r=new URL(this.authressCustomDomain);r.pathname="/api/authentication/oauth/tokens";const{codeVerifier:n,redirectUrl:o}=JSON.parse(localStorage.getItem(i)||"{}"),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code_verifier:n,code:t,grant_type:"authorization_code",client_id:this.extensionId,redirect_uri:o})}),a=await s.json();this.accessToken=a.access_token;const c=new URL(window.location);return c.searchParams.delete("code"),c.searchParams.delete("iss"),c.searchParams.delete("nonce"),c.searchParams.delete("expires_in"),c.searchParams.delete("access_token"),c.searchParams.delete("id_token"),history.replaceState({},void 0,c.toString()),this.getTokenResponse()}async login(e){const t=await this.getTokenResponse();if(t)return t;const r=await this.requestToken({silent:!0});if(r)return r;const o=new URL(this.authressCustomDomain),s=n.encode((window.crypto||window.msCrypto).getRandomValues(new Uint32Array(16)).toString()),a=await(window.crypto||window.msCrypto).subtle.digest("SHA-256",(new TextEncoder).encode(s)),c=n.encode(a),u=e||window.location.href;return localStorage.setItem(i,JSON.stringify({codeVerifier:s,redirectUrl:u})),o.searchParams.set("client_id",this.extensionId),o.searchParams.set("code_challenge",c),o.searchParams.set("code_challenge_method","S256"),o.searchParams.set("redirect_uri",u),window.location.assign(o.toString()),await new Promise((e=>setTimeout(e,5e3))),null}}},965:(e,t,r)=>{const n=r(669),o={"Content-Type":"application/json"};async function i(e){let t=null;for(let r=0;r<5;r++)try{return await e()}catch(e){if(t=e,"Network Error"===e.message||"ERR_NETWORK"===e.code||!e.status||e.status>=500){await new Promise((e=>setTimeout(e,10*2**r)));continue}throw e}throw t}e.exports=class{constructor(e,t){if(!e)throw Error("Custom Authress Domain Host is required");const r=t||{debug(){},warn(){},critical(){}},o=`${new URL(`https://${e.replace(/^(https?:\/+)/,"")}`).origin}/api`,i=n.create({baseURL:o});i.interceptors.request.use((e=>(r.debug({title:"HttpClient Request",online:navigator.onLine,requestId:e.requestId,method:e.method,url:e.url}),e)),(e=>{let t,n,o=!1,i=e;e&&(i=e.message,e.response?(i={data:e.response.data,status:e.response.status,headers:e.response.headers},o=404===e.response.status):e.message&&(i={message:e.message,code:e.code,stack:e.stack}),e.config?(t=e.config.url,n=e.config.requestId):n=e.request&&e.request.config&&e.request.config.requestId);const s={title:"HttpClient Request Error",url:t,online:navigator.onLine,requestId:n,exception:i};throw o?r.debug(s):r.warn(s),i})),i.interceptors.response.use((e=>e),(e=>{if(e.re)throw e;const t=e&&e.response&&{url:e.config&&e.config.url,data:e.response.data,status:e.response.status,headers:e.response.headers}||e.message&&{message:e.message,code:e.code,stack:e.stack}||e;t.re=!0;const n=e&&(e.config&&e.config.requestId||e.request&&e.request.config&&e.request.config.requestId);let o="HttpClient Response Error",i="warn";throw e?e.response&&404===e.response.status?i="debug":e.response&&401===e.response.status&&(o="HttpClient Response Error due to invalid token"):o="HttpClient Response Error - Unknown error occurred",r[i]({title:o,online:navigator.onLine,requestId:n,exception:t,url:e&&e.config&&e.config.url}),t})),this.client=i}get(e,t,r,n="json"){return i((()=>this.client.get(e.toString(),{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,r),responseType:n})))}delete(e,t,r,n="json"){return i((()=>this.client.delete(e.toString(),{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,r),responseType:n})))}post(e,t,r,n){return i((()=>this.client.post(e.toString(),r,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,n)})))}put(e,t,r,n){return i((()=>this.client.put(e.toString(),r,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,n)})))}patch(e,t,r,n){return i((()=>this.client.patch(e.toString(),r,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,n)})))}}},125:(e,t,r)=>{const n=r(489),o=r(802),i=r(965),s=r(215),a=r(429);let c,u=new Promise((e=>c=e)),d=null;const l="AuthenticationRequestNonce";const h=r(99);e.exports={LoginClient:class{constructor(e,t){this.settings=Object.assign({applicationId:"app_default"},e),this.logger=t||console;const r=this.settings.authressLoginHostUrl||this.settings.authenticationServiceUrl||"";if(!r)throw Error('Missing required property "authressLoginHostUrl" in LoginClient constructor. Custom Authress Domain Host is required.');this.hostUrl=`https://${r.replace(/^(https?:\/+)/,"")}`,this.httpClient=new i(this.hostUrl),this.lastSessionCheck=0,this.enableCredentials=this.getMatchingDomainInfo(this.hostUrl,"undefined"!=typeof window?window:void 0),e.skipBackgroundCredentialsCheck||(window.onload=async()=>{await this.userSessionExists(!0)})}isLocalHost(){return"undefined"!=typeof window&&window.location&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)}getMatchingDomainInfo(e,t){const r=new URL(e);if(this.isLocalHost())return!1;if(void 0===t)return!1;if("https:"!==t.location.protocol)return!1;const n=r.host.toLowerCase().split(".").reverse(),i=t.location.host.toLowerCase().split(".").reverse();let s=[];for(let e of n){const t=o(i,s.length+1).join(".");if(s.concat(e).join(".")!==t)break;s.push(e)}return s.length===n.length&&s.length===i.length||s.length>1}getUserIdentity(){const e=a.getUserCookie(),t=s.decodeOrParse(e);if(t){const r=t.exp?new Date(1e3*t.exp):new Date(Date.now()+864e5);return a.set(e,r),t.userId=t.sub,t}const r=a.get(),n=s.decodeOrParse(r);return n?(n.userId=n.sub,n):null}async getConnectionCredentials(){await this.waitForUserSession();try{const e=await this.ensureToken();return(await this.httpClient.get("/session/credentials",this.enableCredentials,{Authorization:e&&`Bearer ${e}`})).data}catch(e){return null}}async waitForUserSession(){try{return await u,!0}catch(e){return!1}}userSessionExists(e){return d?Date.now()-this.lastSessionCheck<50?d:(this.lastSessionCheck=Date.now(),d=d.catch((()=>{})).then((()=>this.userSessionContinuation(e)))):(this.lastSessionCheck=Date.now(),d=this.userSessionContinuation(e))}async userSessionContinuation(e){const t=new URLSearchParams(window.location.search),r=new URL(window.location);let o={};try{o=JSON.parse(localStorage.getItem(l)||"{}"),localStorage.removeItem(l),Object.hasOwnProperty.call(o,"enableCredentials")&&(this.enableCredentials=o.enableCredentials)}catch(e){this.logger&&this.logger.debug&&this.logger.debug({title:"LocalStorage failed in Browser",error:e})}if(t.get("state")&&"oauthLogin"===t.get("flow"))return!1;if(o.nonce&&t.get("code")&&(r.searchParams.delete("nonce"),r.searchParams.delete("iss"),r.searchParams.delete("code"),history.replaceState({},void 0,r.toString()),o.nonce===t.get("nonce"))){const e="cookie"===t.get("code")?n.parse(document.cookie)["auth-code"]:t.get("code"),r={grant_type:"authorization_code",redirect_uri:o.redirectUrl,client_id:this.settings.applicationId,code:e,code_verifier:o.codeVerifier};try{const e=await this.httpClient.post(`/authentication/${o.nonce}/tokens`,this.enableCredentials,r),t=s.decode(e.data.id_token),i=e.data.expires_in&&new Date(Date.now()+1e3*e.data.expires_in)||new Date(1e3*t.exp);return document.cookie=n.serialize("authorization",e.data.access_token||"",{expires:i,path:"/",sameSite:"strict"}),a.set(e.data.id_token,i),c(),!0}catch(e){if(e.data&&"invalid_request"===e.data.error)return this.logger&&this.logger.log({title:"Failed exchange authentication response for a token.",error:e}),!1;throw e.data||e}}if(this.isLocalHost()&&t.get("nonce")&&t.get("access_token")&&(r.searchParams.delete("iss"),r.searchParams.delete("nonce"),r.searchParams.delete("expires_in"),r.searchParams.delete("access_token"),r.searchParams.delete("id_token"),history.replaceState({},void 0,r.toString()),!o.nonce||o.nonce===t.get("nonce"))){const e=s.decode(t.get("id_token")),r=Number(t.get("expires_in"))&&new Date(Date.now()+1e3*Number(t.get("expires_in")))||new Date(1e3*e.exp);return document.cookie=n.serialize("authorization",t.get("access_token")||"",{expires:r,path:"/",sameSite:"strict"}),a.set(t.get("id_token"),r),c(),!0}if(this.getUserIdentity())return c(),!0;if(!this.isLocalHost()&&!e){try{const e=await this.httpClient.patch("/session",this.enableCredentials,{});if(e.data.access_token){const t=s.decode(e.data.id_token),r=e.data.expires_in&&new Date(Date.now()+1e3*e.data.expires_in)||new Date(1e3*t.exp);document.cookie=n.serialize("authorization",e.data.access_token||"",{expires:r,path:"/",sameSite:"strict"}),a.set(e.data.id_token,r)}}catch(e){400!==e.status&&404!==e.status&&409!==e.status&&this.logger&&this.logger.log({title:"Failed attempting to check if the user has an existing authentication session",error:e})}if(this.getUserIdentity())return c(),!0}return!1}async updateExtensionAuthenticationRequest({state:e,connectionId:t,tenantLookupIdentifier:r,connectionProperties:n}){if(!t&&!r){const e=Error("connectionId or tenantLookupIdentifier must be specified");throw e.code="InvalidConnection",e}const o=new URLSearchParams(window.location.search),i=e||o.get("state");if(!i){const e=Error("The `state` parameters must be specified to update this authentication request");throw e.code="InvalidAuthenticationRequest",e}try{const e=await this.httpClient.patch(`/authentication/${i}`,!0,{connectionId:t,tenantLookupIdentifier:r,connectionProperties:n});window.location.assign(e.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e.data||e}await new Promise((e=>setTimeout(e,5e3)))}async unlinkIdentity(e){if(!e){const e=Error("connectionId must be specified");throw e.code="InvalidConnection",e}if(!this.getUserIdentity()){const e=Error("User must be logged into to unlink an account.");throw e.code="NotLoggedIn",e}let t;try{t=await this.ensureToken({timeoutInMillis:100})}catch(e){if("TokenTimeout"===e.code){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}}const r=this.enableCredentials&&!this.isLocalHost()?{}:{Authorization:`Bearer ${t}`};try{await this.httpClient.delete(`/identities/${encodeURIComponent(e)}`,this.enableCredentials,r)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e.data||e}}async linkIdentity({connectionId:e,tenantLookupIdentifier:t,redirectUrl:r,connectionProperties:n}){if(!e&&!t){const e=Error("connectionId or tenantLookupIdentifier must be specified");throw e.code="InvalidConnection",e}if(!this.getUserIdentity()){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}let o;try{o=await this.ensureToken({timeoutInMillis:100})}catch(e){if("TokenTimeout"===e.code){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}}const{codeChallenge:i}=await s.getAuthCodes();try{const s=r&&new URL(r).toString()||window.location.href,a=this.enableCredentials&&!this.isLocalHost()?{}:{Authorization:`Bearer ${o}`},c=await this.httpClient.post("/authentication",this.enableCredentials,{linkIdentity:!0,redirectUrl:s,codeChallengeMethod:"S256",codeChallenge:i,connectionId:e,tenantLookupIdentifier:t,connectionProperties:n,applicationId:this.settings.applicationId},a);window.location.assign(c.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e}await new Promise((e=>setTimeout(e,5e3)))}async authenticate(e={}){const{connectionId:t,tenantLookupIdentifier:r,inviteId:n,redirectUrl:o,force:i,responseLocation:c,flowType:u,connectionProperties:d,openType:h,multiAccount:p,clearUserDataBeforeLogin:f}=e||{};if(c&&"cookie"!==c&&"query"!==c&&"none"!==c){const e=Error("Authentication response location is not valid");throw e.code="InvalidResponseLocation",e}if(!i&&!p&&await this.userSessionExists())return!0;const{codeVerifier:m,codeChallenge:g}=await s.getAuthCodes();try{const e=o&&new URL(o).toString()||window.location.href;!1!==f&&a.clear();const i=await this.httpClient.post("/authentication",!1,{redirectUrl:e,codeChallengeMethod:"S256",codeChallenge:g,connectionId:t,tenantLookupIdentifier:r,inviteId:n,connectionProperties:d,applicationId:this.settings.applicationId,responseLocation:c,flowType:u,multiAccount:p});if(localStorage.setItem(l,JSON.stringify({nonce:i.data.authenticationRequestId,codeVerifier:m,lastConnectionId:t,tenantLookupIdentifier:r,redirectUrl:e,enableCredentials:i.data.enableCredentials,multiAccount:p})),"tab"===h){const e=window.open(i.data.authenticationUrl,"_blank");e&&!e.closed&&void 0!==e.closed||window.location.assign(i.data.authenticationUrl)}else window.location.assign(i.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e.data||e}return await new Promise((e=>setTimeout(e,5e3))),!1}async ensureToken(e){await this.userSessionExists();const t=Object.assign({timeoutInMillis:5e3},e||{}),r=this.waitForUserSession(),o=new Promise(((e,r)=>setTimeout(r,t.timeoutInMillis||0)));try{await Promise.race([r,o])}catch(e){const t=Error("No token retrieved after timeout");throw t.code="TokenTimeout",t}const i=n.parse(document.cookie);return"undefined"!==i.authorization&&i.authorization}async logout(e){if(a.clear(),u=new Promise((e=>c=e)),this.enableCredentials)try{return await this.httpClient.delete("/session",this.enableCredentials),void(e&&e!==window.location.href&&window.location.assign(e))}catch(e){}const t=new URL("/logout",this.hostUrl);t.searchParams.set("redirect_uri",e||window.location.href),t.searchParams.set("client_id",this.settings.applicationId),window.location.assign(t.toString())}},ExtensionClient:h}},215:(e,t,r)=>{const n=r(219);e.exports=new class{decode(e){try{return e&&JSON.parse(n.decode(e.split(".")[1]))}catch(e){return null}}decodeOrParse(e){if(!e)return null;if("object"==typeof e)return e;try{return JSON.parse(e)}catch(t){return this.decode(e)}}decodeFull(e){try{return e&&{header:JSON.parse(n.decode(e.split(".")[0])),payload:JSON.parse(n.decode(e.split(".")[1]))}}catch(e){return null}}async getAuthCodes(){const e=n.encode((window.crypto||window.msCrypto).getRandomValues(new Uint32Array(16)).toString()),t=await(window.crypto||window.msCrypto).subtle.digest("SHA-256",(new TextEncoder).encode(e));return{codeVerifier:e,codeChallenge:n.encode(t)}}}},429:(e,t,r)=>{const n=r(489),o="AuthenticationCredentialsStorage";e.exports=new class{getUserCookie(){return document.cookie.split(";").filter((e=>"user"===e.split("=")[0].trim())).map((e=>e.replace(/^user=/,""))).find((e=>e&&e.trim()))||null}set(e,t){try{const r=n.parse(document.cookie);localStorage.setItem(o,JSON.stringify({idToken:e,expiry:t&&t.getTime(),jsCookies:!!r.authorization})),this.clearCookies("user")}catch(e){console.debug("LocalStorage failed in Browser",e)}}get(){let e={};try{e=n.parse(document.cookie)}catch(e){console.debug("CookieManagement failed in Browser",e)}try{const{idToken:t,expiry:r,jsCookies:n}=JSON.parse(localStorage.getItem(o)||"{}");return t?r<Date.now()||n&&!e.authorization?null:t:this.getUserCookie()}catch(e){return console.debug("LocalStorage failed in Browser",e),this.getUserCookie()}}delete(){try{localStorage.removeItem(o)}catch(e){console.debug("LocalStorage failed in Browser",e)}try{this.clearCookies("user")}catch(e){console.debug("CookieManagement failed in Browser",e)}}clear(){this.clearCookies(),this.delete()}clearCookies(e){if("undefined"==typeof window)return;const t=document.cookie.split("; ");for(const r of t){if(!["user","authorization","auth-code"].includes(r.split("=")[0])||e&&r.split("=")[0]!==e)continue;const t=window.location.hostname.split("."),n=[...Array(t.length-1)].map(((e,r)=>t.reverse().slice(0,r+2).reverse().join("."))).map((e=>[e,`.${e}`])).flat(1).concat(null);"localhost"===window.location.hostname&&n.push("localhost");for(const e of n){const t=e?`domain=${e};`:"",n=`${encodeURIComponent(r.split(";")[0].split("=")[0])}=; expires=Thu, 01-Jan-1970 00:00:01 GMT; ${t} SameSite=Strict; path=`;document.cookie=`${n}/`;const o=location.pathname.split("/");for(;o.length>0;)document.cookie=n+o.join("/"),o.pop()}}}}},489:(e,t)=>{"use strict";t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");var r={},n=(t||{}).decode||o,i=0;for(;i<e.length;){var a=e.indexOf("=",i);if(-1===a)break;var c=e.indexOf(";",i);if(-1===c)c=e.length;else if(c<a){i=e.lastIndexOf(";",a-1)+1;continue}var u=e.slice(i,a).trim();if(void 0===r[u]){var d=e.slice(a+1,c).trim();34===d.charCodeAt(0)&&(d=d.slice(1,-1)),r[u]=s(d,n)}i=c+1}return r},t.serialize=function(e,t,o){var s=o||{},a=s.encode||i;if("function"!=typeof a)throw new TypeError("option encode is invalid");if(!n.test(e))throw new TypeError("argument name is invalid");var c=a(t);if(c&&!n.test(c))throw new TypeError("argument val is invalid");var u=e+"="+c;if(null!=s.maxAge){var d=s.maxAge-0;if(isNaN(d)||!isFinite(d))throw new TypeError("option maxAge is invalid");u+="; Max-Age="+Math.floor(d)}if(s.domain){if(!n.test(s.domain))throw new TypeError("option domain is invalid");u+="; Domain="+s.domain}if(s.path){if(!n.test(s.path))throw new TypeError("option path is invalid");u+="; Path="+s.path}if(s.expires){var l=s.expires;if(!function(e){return"[object Date]"===r.call(e)||e instanceof Date}(l)||isNaN(l.valueOf()))throw new TypeError("option expires is invalid");u+="; Expires="+l.toUTCString()}s.httpOnly&&(u+="; HttpOnly");s.secure&&(u+="; Secure");if(s.priority){switch("string"==typeof s.priority?s.priority.toLowerCase():s.priority){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(s.sameSite){switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"strict":u+="; SameSite=Strict";break;case"none":u+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return u};var r=Object.prototype.toString,n=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function o(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function i(e){return encodeURIComponent(e)}function s(e,t){try{return t(e)}catch(t){return e}}},802:e=>{var t=1/0,r=17976931348623157e292,n=NaN,o="[object Symbol]",i=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt,d=Object.prototype.toString;function l(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e,h,p){return e&&e.length?function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(o);++n<o;)i[n]=e[n+t];return i}(e,0,(h=p||void 0===h?1:(f=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==o}(e))return n;if(l(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=l(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var r=a.test(e);return r||c.test(e)?u(e.slice(2),r?2:8):s.test(e)?n:+e}(e))===t||e===-t?(e<0?-1:1)*r:e==e?e:0:0===e?e:0}(h),m=f%1,f==f?m?f-m:f:0))<0?0:h):[];var f,m}},593:e=>{"use strict";e.exports=JSON.parse('{"_from":"axios@^0.21","_id":"axios@0.21.4","_inBundle":false,"_integrity":"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"axios@^0.21","name":"axios","escapedName":"axios","rawSpec":"^0.21","saveSpec":null,"fetchSpec":"^0.21"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz","_shasum":"c67b90dc0568e5c1cf2b0b858c43ba28e2eda575","_spec":"axios@^0.21","_where":"/home/runner/work/authress-login.js/authress-login.js","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundleDependencies":false,"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"deprecated":false,"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.4"}')}},n={};function o(e){var t=n[e];if(void 0!==t){if(void 0!==t.error)throw t.error;return t.exports}var i=n[e]={exports:{}};try{var s={id:e,module:i,factory:r[e],require:o};o.i.forEach((function(e){e(s)})),i=s.module,s.factory.call(i.exports,i,i.exports,s.require)}catch(e){throw i.error=e,e}return i.exports}return o.m=r,o.c=n,o.i=[],o.hu=e=>e+"."+o.h()+".hot-update.js",o.hmrF=()=>"main."+o.h()+".hot-update.json",o.h=()=>"720cbe84cf25f6c776e9",o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="authress:",o.l=(r,n,i,s)=>{if(e[r])e[r].push(n);else{var a,c;if(void 0!==i)for(var u=document.getElementsByTagName("script"),d=0;d<u.length;d++){var l=u[d];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){a=l;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",t+i),a.src=r),e[r]=[n];var h=(t,n)=>{a.onerror=a.onload=null,clearTimeout(p);var o=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(n))),t)return t(n)},p=setTimeout(h.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=h.bind(null,a.onerror),a.onload=h.bind(null,a.onload),c&&document.head.appendChild(a)}},(()=>{var e,t,r,n={},i=o.c,s=[],a=[],c="idle",u=0,d=[];function l(e){c=e;for(var t=[],r=0;r<a.length;r++)t[r]=a[r].call(null,e);return Promise.all(t)}function h(){0==--u&&l("ready").then((function(){if(0===u){var e=d;d=[];for(var t=0;t<e.length;t++)e[t]()}}))}function p(e){if("idle"!==c)throw new Error("check() is only allowed in idle status");return l("check").then(o.hmrM).then((function(r){return r?l("prepare").then((function(){var n=[];return t=[],Promise.all(Object.keys(o.hmrC).reduce((function(e,i){return o.hmrC[i](r.c,r.r,r.m,e,t,n),e}),[])).then((function(){return t=function(){return e?m(e):l("ready").then((function(){return n}))},0===u?t():new Promise((function(e){d.push((function(){e(t())}))}));var t}))})):l(g()?"ready":"idle").then((function(){return null}))}))}function f(e){return"ready"!==c?Promise.resolve().then((function(){throw new Error("apply() is only allowed in ready status (state: "+c+")")})):m(e)}function m(e){e=e||{},g();var n=t.map((function(t){return t(e)}));t=void 0;var o=n.map((function(e){return e.error})).filter(Boolean);if(o.length>0)return l("abort").then((function(){throw o[0]}));var i=l("dispose");n.forEach((function(e){e.dispose&&e.dispose()}));var s,a=l("apply"),c=function(e){s||(s=e)},u=[];return n.forEach((function(e){if(e.apply){var t=e.apply(c);if(t)for(var r=0;r<t.length;r++)u.push(t[r])}})),Promise.all([i,a]).then((function(){return s?l("fail").then((function(){throw s})):r?m(e).then((function(e){return u.forEach((function(t){e.indexOf(t)<0&&e.push(t)})),e})):l("idle").then((function(){return u}))}))}function g(){if(r)return t||(t=[]),Object.keys(o.hmrI).forEach((function(e){r.forEach((function(r){o.hmrI[e](r,t)}))})),r=void 0,!0}o.hmrD=n,o.i.push((function(d){var m,g,w,y,v=d.module,b=function(t,r){var n=i[r];if(!n)return t;var o=function(o){if(n.hot.active){if(i[o]){var a=i[o].parents;-1===a.indexOf(r)&&a.push(r)}else s=[r],e=o;-1===n.children.indexOf(o)&&n.children.push(o)}else console.warn("[HMR] unexpected require("+o+") from disposed module "+r),s=[];return t(o)},a=function(e){return{configurable:!0,enumerable:!0,get:function(){return t[e]},set:function(r){t[e]=r}}};for(var d in t)Object.prototype.hasOwnProperty.call(t,d)&&"e"!==d&&Object.defineProperty(o,d,a(d));return o.e=function(e){return function(e){switch(c){case"ready":l("prepare");case"prepare":return u++,e.then(h,h),e;default:return e}}(t.e(e))},o}(d.require,d.id);v.hot=(m=d.id,g=v,y={_acceptedDependencies:{},_acceptedErrorHandlers:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:w=e!==m,_requireSelf:function(){s=g.parents.slice(),e=w?void 0:m,o(m)},active:!0,accept:function(e,t,r){if(void 0===e)y._selfAccepted=!0;else if("function"==typeof e)y._selfAccepted=e;else if("object"==typeof e&&null!==e)for(var n=0;n<e.length;n++)y._acceptedDependencies[e[n]]=t||function(){},y._acceptedErrorHandlers[e[n]]=r;else y._acceptedDependencies[e]=t||function(){},y._acceptedErrorHandlers[e]=r},decline:function(e){if(void 0===e)y._selfDeclined=!0;else if("object"==typeof e&&null!==e)for(var t=0;t<e.length;t++)y._declinedDependencies[e[t]]=!0;else y._declinedDependencies[e]=!0},dispose:function(e){y._disposeHandlers.push(e)},addDisposeHandler:function(e){y._disposeHandlers.push(e)},removeDisposeHandler:function(e){var t=y._disposeHandlers.indexOf(e);t>=0&&y._disposeHandlers.splice(t,1)},invalidate:function(){switch(this._selfInvalidated=!0,c){case"idle":t=[],Object.keys(o.hmrI).forEach((function(e){o.hmrI[e](m,t)})),l("ready");break;case"ready":Object.keys(o.hmrI).forEach((function(e){o.hmrI[e](m,t)}));break;case"prepare":case"check":case"dispose":case"apply":(r=r||[]).push(m)}},check:p,apply:f,status:function(e){if(!e)return c;a.push(e)},addStatusHandler:function(e){a.push(e)},removeStatusHandler:function(e){var t=a.indexOf(e);t>=0&&a.splice(t,1)},data:n[m]},e=void 0,y),v.parents=s,v.children=[],s=[],d.require=b})),o.hmrC={},o.hmrI={}})(),o.p="",(()=>{var e,t,r,n,i,s=o.hmrS_jsonp=o.hmrS_jsonp||{179:0},a={};function c(t,r){return e=r,new Promise(((e,r)=>{a[t]=e;var n=o.p+o.hu(t),i=new Error;o.l(n,(e=>{if(a[t]){a[t]=void 0;var n=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;i.message="Loading hot update chunk "+t+" failed.\n("+n+": "+o+")",i.name="ChunkLoadError",i.type=n,i.request=o,r(i)}}))}))}function u(e){function a(e){for(var t=[e],r={},n=t.map((function(e){return{chain:[e],id:e}}));n.length>0;){var i=n.pop(),s=i.id,a=i.chain,u=o.c[s];if(u&&(!u.hot._selfAccepted||u.hot._selfInvalidated)){if(u.hot._selfDeclined)return{type:"self-declined",chain:a,moduleId:s};if(u.hot._main)return{type:"unaccepted",chain:a,moduleId:s};for(var d=0;d<u.parents.length;d++){var l=u.parents[d],h=o.c[l];if(h){if(h.hot._declinedDependencies[s])return{type:"declined",chain:a.concat([l]),moduleId:s,parentId:l};-1===t.indexOf(l)&&(h.hot._acceptedDependencies[s]?(r[l]||(r[l]=[]),c(r[l],[s])):(delete r[l],t.push(l),n.push({chain:a.concat([l]),id:l})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:r}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];-1===e.indexOf(n)&&e.push(n)}}o.f&&delete o.f.jsonpHmr,t=void 0;var u={},d=[],l={},h=function(e){console.warn("[HMR] unexpected require("+e.id+") to disposed module")};for(var p in r)if(o.o(r,p)){var f,m=r[p],g=!1,w=!1,y=!1,v="";switch((f=m?a(p):{type:"disposed",moduleId:p}).chain&&(v="\nUpdate propagation: "+f.chain.join(" -> ")),f.type){case"self-declined":e.onDeclined&&e.onDeclined(f),e.ignoreDeclined||(g=new Error("Aborted because of self decline: "+f.moduleId+v));break;case"declined":e.onDeclined&&e.onDeclined(f),e.ignoreDeclined||(g=new Error("Aborted because of declined dependency: "+f.moduleId+" in "+f.parentId+v));break;case"unaccepted":e.onUnaccepted&&e.onUnaccepted(f),e.ignoreUnaccepted||(g=new Error("Aborted because "+p+" is not accepted"+v));break;case"accepted":e.onAccepted&&e.onAccepted(f),w=!0;break;case"disposed":e.onDisposed&&e.onDisposed(f),y=!0;break;default:throw new Error("Unexception type "+f.type)}if(g)return{error:g};if(w)for(p in l[p]=m,c(d,f.outdatedModules),f.outdatedDependencies)o.o(f.outdatedDependencies,p)&&(u[p]||(u[p]=[]),c(u[p],f.outdatedDependencies[p]));y&&(c(d,[f.moduleId]),l[p]=h)}r=void 0;for(var b,x=[],k=0;k<d.length;k++){var C=d[k],S=o.c[C];S&&(S.hot._selfAccepted||S.hot._main)&&l[C]!==h&&!S.hot._selfInvalidated&&x.push({module:C,require:S.hot._requireSelf,errorHandler:S.hot._selfAccepted})}return{dispose:function(){var e;n.forEach((function(e){delete s[e]})),n=void 0;for(var t,r=d.slice();r.length>0;){var i=r.pop(),a=o.c[i];if(a){var c={},l=a.hot._disposeHandlers;for(k=0;k<l.length;k++)l[k].call(null,c);for(o.hmrD[i]=c,a.hot.active=!1,delete o.c[i],delete u[i],k=0;k<a.children.length;k++){var h=o.c[a.children[k]];h&&((e=h.parents.indexOf(i))>=0&&h.parents.splice(e,1))}}}for(var p in u)if(o.o(u,p)&&(a=o.c[p]))for(b=u[p],k=0;k<b.length;k++)t=b[k],(e=a.children.indexOf(t))>=0&&a.children.splice(e,1)},apply:function(t){for(var r in l)o.o(l,r)&&(o.m[r]=l[r]);for(var n=0;n<i.length;n++)i[n](o);for(var s in u)if(o.o(u,s)){var a=o.c[s];if(a){b=u[s];for(var c=[],h=[],p=[],f=0;f<b.length;f++){var m=b[f],g=a.hot._acceptedDependencies[m],w=a.hot._acceptedErrorHandlers[m];if(g){if(-1!==c.indexOf(g))continue;c.push(g),h.push(w),p.push(m)}}for(var y=0;y<c.length;y++)try{c[y].call(null,b)}catch(r){if("function"==typeof h[y])try{h[y](r,{moduleId:s,dependencyId:p[y]})}catch(n){e.onErrored&&e.onErrored({type:"accept-error-handler-errored",moduleId:s,dependencyId:p[y],error:n,originalError:r}),e.ignoreErrored||(t(n),t(r))}else e.onErrored&&e.onErrored({type:"accept-errored",moduleId:s,dependencyId:p[y],error:r}),e.ignoreErrored||t(r)}}}for(var v=0;v<x.length;v++){var k=x[v],C=k.module;try{k.require(C)}catch(r){if("function"==typeof k.errorHandler)try{k.errorHandler(r,{moduleId:C,module:o.c[C]})}catch(n){e.onErrored&&e.onErrored({type:"self-accept-error-handler-errored",moduleId:C,error:n,originalError:r}),e.ignoreErrored||(t(n),t(r))}else e.onErrored&&e.onErrored({type:"self-accept-errored",moduleId:C,error:r}),e.ignoreErrored||t(r)}}return d}}}this.webpackHotUpdateauthress=(t,n,s)=>{for(var c in n)o.o(n,c)&&(r[c]=n[c],e&&e.push(c));s&&i.push(s),a[t]&&(a[t](),a[t]=void 0)},o.hmrI.jsonp=function(e,t){r||(r={},i=[],n=[],t.push(u)),o.o(r,e)||(r[e]=o.m[e])},o.hmrC.jsonp=function(e,a,d,l,h,p){h.push(u),t={},n=a,r=d.reduce((function(e,t){return e[t]=!1,e}),{}),i=[],e.forEach((function(e){o.o(s,e)&&void 0!==s[e]?(l.push(c(e,p)),t[e]=!0):t[e]=!1})),o.f&&(o.f.jsonpHmr=function(e,r){t&&o.o(t,e)&&!t[e]&&(r.push(c(e)),t[e]=!0)})},o.hmrM=()=>{if("undefined"==typeof fetch)throw new Error("No browser support: need fetch API");return fetch(o.p+o.hmrF()).then((e=>{if(404!==e.status){if(!e.ok)throw new Error("Failed to fetch update manifest "+e.statusText);return e.json()}}))}})(),o(125)})()));
1
+ /*! Authress Login SDK 2.2.241 | Author - Authress Developers | License information can be found at https://github.com/Authress/login-sdk.js */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.authress=t():e.authress=t()}(this,(()=>(()=>{var e,t,r={669:(e,t,r)=>{e.exports=r(609)},448:(e,t,r)=>{"use strict";var n=r(867),o=r(26),i=r(372),s=r(327),a=r(97),c=r(109),u=r(985),d=r(61);e.exports=function(e){return new Promise((function(t,r){var l=e.data,p=e.headers,h=e.responseType;n.isFormData(l)&&delete p["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";p.Authorization="Basic "+btoa(m+":"+g)}var w=a(e.baseURL,e.url);function y(){if(f){var n="getAllResponseHeaders"in f?c(f.getAllResponseHeaders()):null,i={data:h&&"text"!==h&&"json"!==h?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f};o(t,r,i),f=null}}if(f.open(e.method.toUpperCase(),s(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=y:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(y)},f.onabort=function(){f&&(r(d("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){r(d("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(d(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},n.isStandardBrowserEnv()){var v=(e.withCredentials||u(w))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;v&&(p[e.xsrfHeaderName]=v)}"setRequestHeader"in f&&n.forEach(p,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete p[t]:f.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),h&&"json"!==h&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),r(e),f=null)})),l||(l=null),f.send(l)}))}},609:(e,t,r)=>{"use strict";var n=r(867),o=r(849),i=r(321),s=r(185);function a(e){var t=new i(e),r=o(i.prototype.request,t);return n.extend(r,i.prototype,t),n.extend(r,t),r}var c=a(r(655));c.Axios=i,c.create=function(e){return a(s(c.defaults,e))},c.Cancel=r(263),c.CancelToken=r(972),c.isCancel=r(502),c.all=function(e){return Promise.all(e)},c.spread=r(713),c.isAxiosError=r(268),e.exports=c,e.exports.default=c},263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:(e,t,r)=>{"use strict";var n=r(263);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(867),o=r(327),i=r(782),s=r(572),a=r(185),c=r(875),u=c.validators;function d(e){this.defaults=e,this.interceptors={request:new i,response:new i}}d.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&c.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!n){var d=[s,void 0];for(Array.prototype.unshift.apply(d,r),d=d.concat(i),o=Promise.resolve(e);d.length;)o=o.then(d.shift(),d.shift());return o}for(var l=e;r.length;){var p=r.shift(),h=r.shift();try{l=p(l)}catch(e){h(e);break}}try{o=s(l)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},d.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){d.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=d},782:(e,t,r)=>{"use strict";var n=r(867);function o(){this.handlers=[]}o.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},97:(e,t,r)=>{"use strict";var n=r(793),o=r(303);e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},61:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,o,i){var s=new Error(e);return n(s,t,r,o,i)}},572:(e,t,r)=>{"use strict";var n=r(867),o=r(527),i=r(502),s=r(655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(a(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t){t=t||{};var r={},o=["url","method","data"],i=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function u(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=c(void 0,e[o])):r[o]=c(e[o],t[o])}n.forEach(o,(function(e){n.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),n.forEach(i,u),n.forEach(s,(function(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=c(void 0,e[o])):r[o]=c(void 0,t[o])})),n.forEach(a,(function(n){n in t?r[n]=c(e[n],t[n]):n in e&&(r[n]=c(void 0,e[n]))}));var d=o.concat(i).concat(s).concat(a),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===d.indexOf(e)}));return n.forEach(l,u),r}},26:(e,t,r)=>{"use strict";var n=r(61);e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},527:(e,t,r)=>{"use strict";var n=r(867),o=r(655);e.exports=function(e,t,r){var i=this||o;return n.forEach(r,(function(r){e=r.call(i,e,t)})),e}},655:(e,t,r)=>{"use strict";var n=r(867),o=r(16),i=r(481),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(c=r(448)),c),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(t||JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,r=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||o&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(s)})),e.exports=u},849:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},327:(e,t,r)=>{"use strict";var n=r(867);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(n.isURLSearchParams(t))i=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(o(t)+"="+o(e))})))})),i=s.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},372:(e,t,r)=>{"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},985:(e,t,r)=>{"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},16:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},109:(e,t,r)=>{"use strict";var n=r(867),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,i,s={};return e?(n.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=n.trim(e.substr(0,i)).toLowerCase(),r=n.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}})),s):s}},713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},875:(e,t,r)=>{"use strict";var n=r(593),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var i={},s=n.version.split(".");function a(e,t){for(var r=t?t.split("."):s,n=e.split("."),o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}o.transitional=function(e,t,r){var o=t&&a(t);function s(e,t){return"[Axios v"+n.version+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,a){if(!1===e)throw new Error(s(n," has been removed in "+t));return o&&!i[n]&&(i[n]=!0,console.warn(s(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,a)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],s=t[i];if(s){var a=e[i],c=void 0===a||s(a,i,e);if(!0!==c)throw new TypeError("option "+i+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:o}},867:(e,t,r)=>{"use strict";var n=r(849),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===o.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:c,isUndefined:s,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:d,merge:function e(){var t={};function r(r,n){c(t[n])&&c(r)?t[n]=e(t[n],r):c(r)?t[n]=e({},r):i(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)d(arguments[n],r);return t},extend:function(e,t,r){return d(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},219:e=>{function t(e){return String.fromCharCode(parseInt(e.slice(1),16))}function r(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}e.exports.decode=function(e){return function(e){return decodeURIComponent(Array.from(atob(e),r).join(""))}(e.replace(/-/g,"+").replace(/_/g,"/"))},e.exports.encode=function(e){return e&&"object"==typeof e?btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,""):function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,t))}(e).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,"")}},99:(e,t,r)=>{const n=r(219),o=r(215),i="ExtensionRequestNonce";let s=null;e.exports=class{constructor(e,t){if(this.extensionId=t,!e)throw Error('Missing required property "authressCustomDomain" in ExtensionClient constructor. The Custom Authress Domain Host is required.');if(!t)throw Error('Missing required property "extensionId" in ExtensionClient constructor. The extension is required for selecting the correct login method.');this.authressCustomDomain=`https://${e.replace(/^(https?:\/+)/,"")}`,this.accessToken=null,window.onload=async()=>{await this.requestToken({silent:!0})}}async getUserIdentity(){const e=await this.accessToken&&o.decode(this.accessToken);return e?1e3*e.exp<Date.now()?(this.accessToken=null,null):e:null}async getTokenResponse(){return await this.getUserIdentity()?{accessToken:this.accessToken}:null}requestToken(e={code:null,silent:!1}){if(s)return s=s.catch((()=>{})).then((()=>this.requestTokenContinuation(e)));const t=this.requestTokenContinuation(e);return t.catch((()=>{})),s=t}async requestTokenContinuation(e={code:null,silent:!1}){const t=e&&e.code||new URLSearchParams(window.location.search).get("code");if(!t){if(!e||!e.silent){const e=Error("OAuth Authorization code is required");throw e.code="InvalidAuthorizationCode",e}return this.getTokenResponse()}const r=new URL(this.authressCustomDomain);r.pathname="/api/authentication/oauth/tokens";const{codeVerifier:n,redirectUrl:o}=JSON.parse(localStorage.getItem(i)||"{}"),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code_verifier:n,code:t,grant_type:"authorization_code",client_id:this.extensionId,redirect_uri:o})}),a=await s.json();this.accessToken=a.access_token;const c=new URL(window.location);return c.searchParams.delete("code"),c.searchParams.delete("iss"),c.searchParams.delete("nonce"),c.searchParams.delete("expires_in"),c.searchParams.delete("access_token"),c.searchParams.delete("id_token"),history.replaceState({},void 0,c.toString()),this.getTokenResponse()}async login(e){const t=await this.getTokenResponse();if(t)return t;const r=await this.requestToken({silent:!0});if(r)return r;const o=new URL(this.authressCustomDomain),s=n.encode((window.crypto||window.msCrypto).getRandomValues(new Uint32Array(16)).toString()),a=await(window.crypto||window.msCrypto).subtle.digest("SHA-256",(new TextEncoder).encode(s)),c=n.encode(a),u=e||window.location.href;return localStorage.setItem(i,JSON.stringify({codeVerifier:s,redirectUrl:u})),o.searchParams.set("client_id",this.extensionId),o.searchParams.set("code_challenge",c),o.searchParams.set("code_challenge_method","S256"),o.searchParams.set("redirect_uri",u),window.location.assign(o.toString()),await new Promise((e=>setTimeout(e,5e3))),null}}},965:(e,t,r)=>{const n=r(669),o={"Content-Type":"application/json"};async function i(e){let t=null;for(let r=0;r<5;r++)try{return await e()}catch(e){if(t=e,"Network Error"===e.message||"ERR_NETWORK"===e.code||!e.status||e.status>=500){await new Promise((e=>setTimeout(e,10*2**r)));continue}throw e}throw t}e.exports=class{constructor(e,t){if(!e)throw Error("Custom Authress Domain Host is required");const r=t||{debug(){},warn(){},critical(){}},o=`${new URL(`https://${e.replace(/^(https?:\/+)/,"")}`).origin}/api`,i=n.create({baseURL:o});i.interceptors.request.use((e=>(r.debug({title:"HttpClient Request",online:navigator.onLine,requestId:e.requestId,method:e.method,url:e.url}),e)),(e=>{let t,n,o=!1,i=e;e&&(i=e.message,e.response?(i={data:e.response.data,status:e.response.status,headers:e.response.headers},o=404===e.response.status):e.message&&(i={message:e.message,code:e.code,stack:e.stack}),e.config?(t=e.config.url,n=e.config.requestId):n=e.request&&e.request.config&&e.request.config.requestId);const s={title:"HttpClient Request Error",url:t,online:navigator.onLine,requestId:n,exception:i};throw o?r.debug(s):r.warn(s),i})),i.interceptors.response.use((e=>e),(e=>{if(e.re)throw e;const t=e&&e.response&&{url:e.config&&e.config.url,data:e.response.data,status:e.response.status,headers:e.response.headers}||e.message&&{message:e.message,code:e.code,stack:e.stack}||e;t.re=!0;const n=e&&(e.config&&e.config.requestId||e.request&&e.request.config&&e.request.config.requestId);let o="HttpClient Response Error",i="warn";throw e?e.response&&404===e.response.status?i="debug":e.response&&401===e.response.status&&(o="HttpClient Response Error due to invalid token"):o="HttpClient Response Error - Unknown error occurred",r[i]({title:o,online:navigator.onLine,requestId:n,exception:t,url:e&&e.config&&e.config.url}),t})),this.client=i}get(e,t,r,n="json"){return i((()=>this.client.get(e.toString(),{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,r),responseType:n})))}delete(e,t,r,n="json"){return i((()=>this.client.delete(e.toString(),{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,r),responseType:n})))}post(e,t,r,n){return i((()=>this.client.post(e.toString(),r,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,n)})))}put(e,t,r,n){return i((()=>this.client.put(e.toString(),r,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,n)})))}patch(e,t,r,n){return i((()=>this.client.patch(e.toString(),r,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,n)})))}}},125:(e,t,r)=>{const n=r(489),o=r(802),i=r(965),s=r(215),a=r(429);let c,u=new Promise((e=>c=e)),d=null;const l="AuthenticationRequestNonce";const p=r(99);e.exports={LoginClient:class{constructor(e,t){this.settings=Object.assign({applicationId:"app_default"},e),this.logger=t||console;const r=this.settings.authressLoginHostUrl||this.settings.authenticationServiceUrl||"";if(!r)throw Error('Missing required property "authressLoginHostUrl" in LoginClient constructor. Custom Authress Domain Host is required.');this.hostUrl=`https://${r.replace(/^(https?:\/+)/,"")}`,this.httpClient=new i(this.hostUrl),this.lastSessionCheck=0,this.enableCredentials=this.getMatchingDomainInfo(this.hostUrl,"undefined"!=typeof window?window:void 0),e.skipBackgroundCredentialsCheck||(window.onload=async()=>{await this.userSessionExists(!0)})}isLocalHost(){return"undefined"!=typeof window&&window.location&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)}getMatchingDomainInfo(e,t){const r=new URL(e);if(this.isLocalHost())return!1;if(void 0===t)return!1;if("https:"!==t.location.protocol)return!1;const n=r.host.toLowerCase().split(".").reverse(),i=t.location.host.toLowerCase().split(".").reverse();let s=[];for(let e of n){const t=o(i,s.length+1).join(".");if(s.concat(e).join(".")!==t)break;s.push(e)}return s.length===n.length&&s.length===i.length||s.length>1}getUserIdentity(){const e=a.getUserCookie(),t=s.decodeOrParse(e);if(t){const r=t.exp?new Date(1e3*t.exp):new Date(Date.now()+864e5);return a.set(e,r),t.userId=t.sub,t}const r=a.get(),n=s.decodeOrParse(r);return n?(n.userId=n.sub,n):null}async getConnectionCredentials(){await this.waitForUserSession();try{const e=await this.ensureToken();return(await this.httpClient.get("/session/credentials",this.enableCredentials,{Authorization:e&&`Bearer ${e}`})).data}catch(e){return null}}async waitForUserSession(){try{return await u,!0}catch(e){return!1}}userSessionExists(e){return d?Date.now()-this.lastSessionCheck<50?d:(this.lastSessionCheck=Date.now(),d=d.catch((()=>{})).then((()=>this.userSessionContinuation(e)))):(this.lastSessionCheck=Date.now(),d=this.userSessionContinuation(e))}async userSessionContinuation(e){const t=new URLSearchParams(window.location.search),r=new URL(window.location);let o={};try{o=JSON.parse(localStorage.getItem(l)||"{}"),localStorage.removeItem(l),Object.hasOwnProperty.call(o,"enableCredentials")&&(this.enableCredentials=o.enableCredentials)}catch(e){this.logger&&this.logger.debug&&this.logger.debug({title:"LocalStorage failed in Browser",error:e})}if(t.get("state")&&"oauthLogin"===t.get("flow"))return!1;if(o.nonce&&t.get("code")&&(r.searchParams.delete("nonce"),r.searchParams.delete("iss"),r.searchParams.delete("code"),history.replaceState({},void 0,r.toString()),o.nonce===t.get("nonce"))){const e="cookie"===t.get("code")?n.parse(document.cookie)["auth-code"]:t.get("code"),r={grant_type:"authorization_code",redirect_uri:o.redirectUrl,client_id:this.settings.applicationId,code:e,code_verifier:o.codeVerifier};try{const e=await this.httpClient.post(`/authentication/${o.nonce}/tokens`,this.enableCredentials,r),t=s.decode(e.data.id_token),i=t.exp&&new Date(1e3*t.exp)||e.data.expires_in&&new Date(Date.now()+1e3*e.data.expires_in);return document.cookie=n.serialize("authorization",e.data.access_token||"",{expires:i,path:"/",sameSite:"strict"}),a.set(e.data.id_token,i),c(),!0}catch(e){if(e.data&&"invalid_request"===e.data.error)return this.logger&&this.logger.log({title:"Failed exchange authentication response for a token.",error:e}),!1;throw e.data||e}}if(this.isLocalHost()&&t.get("nonce")&&t.get("access_token")&&(r.searchParams.delete("iss"),r.searchParams.delete("nonce"),r.searchParams.delete("expires_in"),r.searchParams.delete("access_token"),r.searchParams.delete("id_token"),history.replaceState({},void 0,r.toString()),!o.nonce||o.nonce===t.get("nonce"))){const e=s.decode(t.get("id_token")),r=e.exp&&new Date(1e3*e.exp)||Number(t.get("expires_in"))&&new Date(Date.now()+1e3*Number(t.get("expires_in")));return document.cookie=n.serialize("authorization",t.get("access_token")||"",{expires:r,path:"/",sameSite:"strict"}),a.set(t.get("id_token"),r),c(),!0}if(this.getUserIdentity())return c(),!0;if(!this.isLocalHost()&&!e){try{const e=await this.httpClient.patch("/session",this.enableCredentials,{});if(e.data.access_token){const t=s.decode(e.data.id_token),r=t.exp&&new Date(1e3*t.exp)||e.data.expires_in&&new Date(Date.now()+1e3*e.data.expires_in);document.cookie=n.serialize("authorization",e.data.access_token||"",{expires:r,path:"/",sameSite:"strict"}),a.set(e.data.id_token,r)}}catch(e){400!==e.status&&404!==e.status&&409!==e.status&&this.logger&&this.logger.log({title:"Failed attempting to check if the user has an existing authentication session",error:e})}if(this.getUserIdentity())return c(),!0}return!1}async updateExtensionAuthenticationRequest({state:e,connectionId:t,tenantLookupIdentifier:r,connectionProperties:n}){if(!t&&!r){const e=Error("connectionId or tenantLookupIdentifier must be specified");throw e.code="InvalidConnection",e}const o=new URLSearchParams(window.location.search),i=e||o.get("state");if(!i){const e=Error("The `state` parameters must be specified to update this authentication request");throw e.code="InvalidAuthenticationRequest",e}try{const e=await this.httpClient.patch(`/authentication/${i}`,!0,{connectionId:t,tenantLookupIdentifier:r,connectionProperties:n});window.location.assign(e.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e.data||e}await new Promise((e=>setTimeout(e,5e3)))}async unlinkIdentity(e){if(!e){const e=Error("connectionId must be specified");throw e.code="InvalidConnection",e}if(!this.getUserIdentity()){const e=Error("User must be logged into to unlink an account.");throw e.code="NotLoggedIn",e}let t;try{t=await this.ensureToken({timeoutInMillis:100})}catch(e){if("TokenTimeout"===e.code){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}}const r=this.enableCredentials&&!this.isLocalHost()?{}:{Authorization:`Bearer ${t}`};try{await this.httpClient.delete(`/identities/${encodeURIComponent(e)}`,this.enableCredentials,r)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e.data||e}}async linkIdentity({connectionId:e,tenantLookupIdentifier:t,redirectUrl:r,connectionProperties:n}){if(!e&&!t){const e=Error("connectionId or tenantLookupIdentifier must be specified");throw e.code="InvalidConnection",e}if(!this.getUserIdentity()){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}let o;try{o=await this.ensureToken({timeoutInMillis:100})}catch(e){if("TokenTimeout"===e.code){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}}const{codeChallenge:i}=await s.getAuthCodes();try{const s=r&&new URL(r).toString()||window.location.href,a=this.enableCredentials&&!this.isLocalHost()?{}:{Authorization:`Bearer ${o}`},c=await this.httpClient.post("/authentication",this.enableCredentials,{linkIdentity:!0,redirectUrl:s,codeChallengeMethod:"S256",codeChallenge:i,connectionId:e,tenantLookupIdentifier:t,connectionProperties:n,applicationId:this.settings.applicationId},a);window.location.assign(c.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e}await new Promise((e=>setTimeout(e,5e3)))}async authenticate(e={}){const{connectionId:t,tenantLookupIdentifier:r,inviteId:n,redirectUrl:o,force:i,responseLocation:c,flowType:u,connectionProperties:d,openType:p,multiAccount:h,clearUserDataBeforeLogin:f}=e||{};if(c&&"cookie"!==c&&"query"!==c&&"none"!==c){const e=Error("Authentication response location is not valid");throw e.code="InvalidResponseLocation",e}if(!i&&!h&&await this.userSessionExists())return!0;const{codeVerifier:m,codeChallenge:g}=await s.getAuthCodes();try{const e=o&&new URL(o).toString()||window.location.href;!1!==f&&a.clear();const i=await this.httpClient.post("/authentication",!1,{redirectUrl:e,codeChallengeMethod:"S256",codeChallenge:g,connectionId:t,tenantLookupIdentifier:r,inviteId:n,connectionProperties:d,applicationId:this.settings.applicationId,responseLocation:c,flowType:u,multiAccount:h});if(localStorage.setItem(l,JSON.stringify({nonce:i.data.authenticationRequestId,codeVerifier:m,lastConnectionId:t,tenantLookupIdentifier:r,redirectUrl:e,enableCredentials:i.data.enableCredentials,multiAccount:h})),"tab"===p){const e=window.open(i.data.authenticationUrl,"_blank");e&&!e.closed&&void 0!==e.closed||window.location.assign(i.data.authenticationUrl)}else window.location.assign(i.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e.data||e}return await new Promise((e=>setTimeout(e,5e3))),!1}async ensureToken(e){await this.userSessionExists();const t=Object.assign({timeoutInMillis:5e3},e||{}),r=this.waitForUserSession(),o=new Promise(((e,r)=>setTimeout(r,t.timeoutInMillis||0)));try{await Promise.race([r,o])}catch(e){const t=Error("No token retrieved after timeout");throw t.code="TokenTimeout",t}const i=n.parse(document.cookie);return"undefined"!==i.authorization&&i.authorization}async logout(e){if(a.clear(),u=new Promise((e=>c=e)),this.enableCredentials)try{return await this.httpClient.delete("/session",this.enableCredentials),void(e&&e!==window.location.href&&window.location.assign(e))}catch(e){}const t=new URL("/logout",this.hostUrl);t.searchParams.set("redirect_uri",e||window.location.href),t.searchParams.set("client_id",this.settings.applicationId),window.location.assign(t.toString())}},ExtensionClient:p}},215:(e,t,r)=>{const n=r(219);e.exports=new class{decode(e){if(!e)return null;try{const t=JSON.parse(n.decode(e.split(".")[1]));return t.exp&&(t.exp=t.exp-10),t}catch(e){return null}}decodeOrParse(e){if(!e)return null;if("object"==typeof e)return e;try{return JSON.parse(e)}catch(t){return this.decode(e)}}decodeFull(e){if(!e)return null;try{const t=JSON.parse(n.decode(e.split(".")[0])),r=JSON.parse(n.decode(e.split(".")[1]));return r.exp&&(r.exp=r.exp-10),{header:t,payload:r}}catch(e){return null}}async getAuthCodes(){const e=n.encode((window.crypto||window.msCrypto).getRandomValues(new Uint32Array(16)).toString()),t=await(window.crypto||window.msCrypto).subtle.digest("SHA-256",(new TextEncoder).encode(e));return{codeVerifier:e,codeChallenge:n.encode(t)}}}},429:(e,t,r)=>{const n=r(489),o="AuthenticationCredentialsStorage";e.exports=new class{getUserCookie(){return document.cookie.split(";").filter((e=>"user"===e.split("=")[0].trim())).map((e=>e.replace(/^user=/,""))).find((e=>e&&e.trim()))||null}set(e,t){try{const r=n.parse(document.cookie);localStorage.setItem(o,JSON.stringify({idToken:e,expiry:t&&t.getTime(),jsCookies:!!r.authorization})),this.clearCookies("user")}catch(e){console.debug("LocalStorage failed in Browser",e)}}get(){let e={};try{e=n.parse(document.cookie)}catch(e){console.debug("CookieManagement failed in Browser",e)}try{const{idToken:t,expiry:r,jsCookies:n}=JSON.parse(localStorage.getItem(o)||"{}");return t?r<Date.now()||n&&!e.authorization?null:t:this.getUserCookie()}catch(e){return console.debug("LocalStorage failed in Browser",e),this.getUserCookie()}}delete(){try{localStorage.removeItem(o)}catch(e){console.debug("LocalStorage failed in Browser",e)}try{this.clearCookies("user")}catch(e){console.debug("CookieManagement failed in Browser",e)}}clear(){this.clearCookies(),this.delete()}clearCookies(e){if("undefined"==typeof window)return;const t=document.cookie.split("; ");for(const r of t){if(!["user","authorization","auth-code"].includes(r.split("=")[0])||e&&r.split("=")[0]!==e)continue;const t=window.location.hostname.split("."),n=[...Array(t.length-1)].map(((e,r)=>t.reverse().slice(0,r+2).reverse().join("."))).map((e=>[e,`.${e}`])).flat(1).concat(null);"localhost"===window.location.hostname&&n.push("localhost");for(const e of n){const t=e?`domain=${e};`:"",n=`${encodeURIComponent(r.split(";")[0].split("=")[0])}=; expires=Thu, 01-Jan-1970 00:00:01 GMT; ${t} SameSite=Strict; path=`;document.cookie=`${n}/`;const o=location.pathname.split("/");for(;o.length>0;)document.cookie=n+o.join("/"),o.pop()}}}}},489:(e,t)=>{"use strict";t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");var r={},n=(t||{}).decode||o,i=0;for(;i<e.length;){var a=e.indexOf("=",i);if(-1===a)break;var c=e.indexOf(";",i);if(-1===c)c=e.length;else if(c<a){i=e.lastIndexOf(";",a-1)+1;continue}var u=e.slice(i,a).trim();if(void 0===r[u]){var d=e.slice(a+1,c).trim();34===d.charCodeAt(0)&&(d=d.slice(1,-1)),r[u]=s(d,n)}i=c+1}return r},t.serialize=function(e,t,o){var s=o||{},a=s.encode||i;if("function"!=typeof a)throw new TypeError("option encode is invalid");if(!n.test(e))throw new TypeError("argument name is invalid");var c=a(t);if(c&&!n.test(c))throw new TypeError("argument val is invalid");var u=e+"="+c;if(null!=s.maxAge){var d=s.maxAge-0;if(isNaN(d)||!isFinite(d))throw new TypeError("option maxAge is invalid");u+="; Max-Age="+Math.floor(d)}if(s.domain){if(!n.test(s.domain))throw new TypeError("option domain is invalid");u+="; Domain="+s.domain}if(s.path){if(!n.test(s.path))throw new TypeError("option path is invalid");u+="; Path="+s.path}if(s.expires){var l=s.expires;if(!function(e){return"[object Date]"===r.call(e)||e instanceof Date}(l)||isNaN(l.valueOf()))throw new TypeError("option expires is invalid");u+="; Expires="+l.toUTCString()}s.httpOnly&&(u+="; HttpOnly");s.secure&&(u+="; Secure");if(s.priority){switch("string"==typeof s.priority?s.priority.toLowerCase():s.priority){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(s.sameSite){switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"strict":u+="; SameSite=Strict";break;case"none":u+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return u};var r=Object.prototype.toString,n=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function o(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function i(e){return encodeURIComponent(e)}function s(e,t){try{return t(e)}catch(t){return e}}},802:e=>{var t=1/0,r=17976931348623157e292,n=NaN,o="[object Symbol]",i=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt,d=Object.prototype.toString;function l(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e,p,h){return e&&e.length?function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(o);++n<o;)i[n]=e[n+t];return i}(e,0,(p=h||void 0===p?1:(f=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==o}(e))return n;if(l(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=l(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var r=a.test(e);return r||c.test(e)?u(e.slice(2),r?2:8):s.test(e)?n:+e}(e))===t||e===-t?(e<0?-1:1)*r:e==e?e:0:0===e?e:0}(p),m=f%1,f==f?m?f-m:f:0))<0?0:p):[];var f,m}},593:e=>{"use strict";e.exports=JSON.parse('{"_from":"axios@^0.21","_id":"axios@0.21.4","_inBundle":false,"_integrity":"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"axios@^0.21","name":"axios","escapedName":"axios","rawSpec":"^0.21","saveSpec":null,"fetchSpec":"^0.21"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz","_shasum":"c67b90dc0568e5c1cf2b0b858c43ba28e2eda575","_spec":"axios@^0.21","_where":"/home/runner/work/authress-login.js/authress-login.js","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundleDependencies":false,"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"deprecated":false,"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.4"}')}},n={};function o(e){var t=n[e];if(void 0!==t){if(void 0!==t.error)throw t.error;return t.exports}var i=n[e]={exports:{}};try{var s={id:e,module:i,factory:r[e],require:o};o.i.forEach((function(e){e(s)})),i=s.module,s.factory.call(i.exports,i,i.exports,s.require)}catch(e){throw i.error=e,e}return i.exports}return o.m=r,o.c=n,o.i=[],o.hu=e=>e+"."+o.h()+".hot-update.js",o.hmrF=()=>"main."+o.h()+".hot-update.json",o.h=()=>"9b2b47a6ee53141228d0",o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="authress:",o.l=(r,n,i,s)=>{if(e[r])e[r].push(n);else{var a,c;if(void 0!==i)for(var u=document.getElementsByTagName("script"),d=0;d<u.length;d++){var l=u[d];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){a=l;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",t+i),a.src=r),e[r]=[n];var p=(t,n)=>{a.onerror=a.onload=null,clearTimeout(h);var o=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(n))),t)return t(n)},h=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),c&&document.head.appendChild(a)}},(()=>{var e,t,r,n={},i=o.c,s=[],a=[],c="idle",u=0,d=[];function l(e){c=e;for(var t=[],r=0;r<a.length;r++)t[r]=a[r].call(null,e);return Promise.all(t)}function p(){0==--u&&l("ready").then((function(){if(0===u){var e=d;d=[];for(var t=0;t<e.length;t++)e[t]()}}))}function h(e){if("idle"!==c)throw new Error("check() is only allowed in idle status");return l("check").then(o.hmrM).then((function(r){return r?l("prepare").then((function(){var n=[];return t=[],Promise.all(Object.keys(o.hmrC).reduce((function(e,i){return o.hmrC[i](r.c,r.r,r.m,e,t,n),e}),[])).then((function(){return t=function(){return e?m(e):l("ready").then((function(){return n}))},0===u?t():new Promise((function(e){d.push((function(){e(t())}))}));var t}))})):l(g()?"ready":"idle").then((function(){return null}))}))}function f(e){return"ready"!==c?Promise.resolve().then((function(){throw new Error("apply() is only allowed in ready status (state: "+c+")")})):m(e)}function m(e){e=e||{},g();var n=t.map((function(t){return t(e)}));t=void 0;var o=n.map((function(e){return e.error})).filter(Boolean);if(o.length>0)return l("abort").then((function(){throw o[0]}));var i=l("dispose");n.forEach((function(e){e.dispose&&e.dispose()}));var s,a=l("apply"),c=function(e){s||(s=e)},u=[];return n.forEach((function(e){if(e.apply){var t=e.apply(c);if(t)for(var r=0;r<t.length;r++)u.push(t[r])}})),Promise.all([i,a]).then((function(){return s?l("fail").then((function(){throw s})):r?m(e).then((function(e){return u.forEach((function(t){e.indexOf(t)<0&&e.push(t)})),e})):l("idle").then((function(){return u}))}))}function g(){if(r)return t||(t=[]),Object.keys(o.hmrI).forEach((function(e){r.forEach((function(r){o.hmrI[e](r,t)}))})),r=void 0,!0}o.hmrD=n,o.i.push((function(d){var m,g,w,y,v=d.module,b=function(t,r){var n=i[r];if(!n)return t;var o=function(o){if(n.hot.active){if(i[o]){var a=i[o].parents;-1===a.indexOf(r)&&a.push(r)}else s=[r],e=o;-1===n.children.indexOf(o)&&n.children.push(o)}else console.warn("[HMR] unexpected require("+o+") from disposed module "+r),s=[];return t(o)},a=function(e){return{configurable:!0,enumerable:!0,get:function(){return t[e]},set:function(r){t[e]=r}}};for(var d in t)Object.prototype.hasOwnProperty.call(t,d)&&"e"!==d&&Object.defineProperty(o,d,a(d));return o.e=function(e){return function(e){switch(c){case"ready":l("prepare");case"prepare":return u++,e.then(p,p),e;default:return e}}(t.e(e))},o}(d.require,d.id);v.hot=(m=d.id,g=v,y={_acceptedDependencies:{},_acceptedErrorHandlers:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:w=e!==m,_requireSelf:function(){s=g.parents.slice(),e=w?void 0:m,o(m)},active:!0,accept:function(e,t,r){if(void 0===e)y._selfAccepted=!0;else if("function"==typeof e)y._selfAccepted=e;else if("object"==typeof e&&null!==e)for(var n=0;n<e.length;n++)y._acceptedDependencies[e[n]]=t||function(){},y._acceptedErrorHandlers[e[n]]=r;else y._acceptedDependencies[e]=t||function(){},y._acceptedErrorHandlers[e]=r},decline:function(e){if(void 0===e)y._selfDeclined=!0;else if("object"==typeof e&&null!==e)for(var t=0;t<e.length;t++)y._declinedDependencies[e[t]]=!0;else y._declinedDependencies[e]=!0},dispose:function(e){y._disposeHandlers.push(e)},addDisposeHandler:function(e){y._disposeHandlers.push(e)},removeDisposeHandler:function(e){var t=y._disposeHandlers.indexOf(e);t>=0&&y._disposeHandlers.splice(t,1)},invalidate:function(){switch(this._selfInvalidated=!0,c){case"idle":t=[],Object.keys(o.hmrI).forEach((function(e){o.hmrI[e](m,t)})),l("ready");break;case"ready":Object.keys(o.hmrI).forEach((function(e){o.hmrI[e](m,t)}));break;case"prepare":case"check":case"dispose":case"apply":(r=r||[]).push(m)}},check:h,apply:f,status:function(e){if(!e)return c;a.push(e)},addStatusHandler:function(e){a.push(e)},removeStatusHandler:function(e){var t=a.indexOf(e);t>=0&&a.splice(t,1)},data:n[m]},e=void 0,y),v.parents=s,v.children=[],s=[],d.require=b})),o.hmrC={},o.hmrI={}})(),o.p="",(()=>{var e,t,r,n,i,s=o.hmrS_jsonp=o.hmrS_jsonp||{179:0},a={};function c(t,r){return e=r,new Promise(((e,r)=>{a[t]=e;var n=o.p+o.hu(t),i=new Error;o.l(n,(e=>{if(a[t]){a[t]=void 0;var n=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;i.message="Loading hot update chunk "+t+" failed.\n("+n+": "+o+")",i.name="ChunkLoadError",i.type=n,i.request=o,r(i)}}))}))}function u(e){function a(e){for(var t=[e],r={},n=t.map((function(e){return{chain:[e],id:e}}));n.length>0;){var i=n.pop(),s=i.id,a=i.chain,u=o.c[s];if(u&&(!u.hot._selfAccepted||u.hot._selfInvalidated)){if(u.hot._selfDeclined)return{type:"self-declined",chain:a,moduleId:s};if(u.hot._main)return{type:"unaccepted",chain:a,moduleId:s};for(var d=0;d<u.parents.length;d++){var l=u.parents[d],p=o.c[l];if(p){if(p.hot._declinedDependencies[s])return{type:"declined",chain:a.concat([l]),moduleId:s,parentId:l};-1===t.indexOf(l)&&(p.hot._acceptedDependencies[s]?(r[l]||(r[l]=[]),c(r[l],[s])):(delete r[l],t.push(l),n.push({chain:a.concat([l]),id:l})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:r}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];-1===e.indexOf(n)&&e.push(n)}}o.f&&delete o.f.jsonpHmr,t=void 0;var u={},d=[],l={},p=function(e){console.warn("[HMR] unexpected require("+e.id+") to disposed module")};for(var h in r)if(o.o(r,h)){var f,m=r[h],g=!1,w=!1,y=!1,v="";switch((f=m?a(h):{type:"disposed",moduleId:h}).chain&&(v="\nUpdate propagation: "+f.chain.join(" -> ")),f.type){case"self-declined":e.onDeclined&&e.onDeclined(f),e.ignoreDeclined||(g=new Error("Aborted because of self decline: "+f.moduleId+v));break;case"declined":e.onDeclined&&e.onDeclined(f),e.ignoreDeclined||(g=new Error("Aborted because of declined dependency: "+f.moduleId+" in "+f.parentId+v));break;case"unaccepted":e.onUnaccepted&&e.onUnaccepted(f),e.ignoreUnaccepted||(g=new Error("Aborted because "+h+" is not accepted"+v));break;case"accepted":e.onAccepted&&e.onAccepted(f),w=!0;break;case"disposed":e.onDisposed&&e.onDisposed(f),y=!0;break;default:throw new Error("Unexception type "+f.type)}if(g)return{error:g};if(w)for(h in l[h]=m,c(d,f.outdatedModules),f.outdatedDependencies)o.o(f.outdatedDependencies,h)&&(u[h]||(u[h]=[]),c(u[h],f.outdatedDependencies[h]));y&&(c(d,[f.moduleId]),l[h]=p)}r=void 0;for(var b,x=[],k=0;k<d.length;k++){var C=d[k],S=o.c[C];S&&(S.hot._selfAccepted||S.hot._main)&&l[C]!==p&&!S.hot._selfInvalidated&&x.push({module:C,require:S.hot._requireSelf,errorHandler:S.hot._selfAccepted})}return{dispose:function(){var e;n.forEach((function(e){delete s[e]})),n=void 0;for(var t,r=d.slice();r.length>0;){var i=r.pop(),a=o.c[i];if(a){var c={},l=a.hot._disposeHandlers;for(k=0;k<l.length;k++)l[k].call(null,c);for(o.hmrD[i]=c,a.hot.active=!1,delete o.c[i],delete u[i],k=0;k<a.children.length;k++){var p=o.c[a.children[k]];p&&((e=p.parents.indexOf(i))>=0&&p.parents.splice(e,1))}}}for(var h in u)if(o.o(u,h)&&(a=o.c[h]))for(b=u[h],k=0;k<b.length;k++)t=b[k],(e=a.children.indexOf(t))>=0&&a.children.splice(e,1)},apply:function(t){for(var r in l)o.o(l,r)&&(o.m[r]=l[r]);for(var n=0;n<i.length;n++)i[n](o);for(var s in u)if(o.o(u,s)){var a=o.c[s];if(a){b=u[s];for(var c=[],p=[],h=[],f=0;f<b.length;f++){var m=b[f],g=a.hot._acceptedDependencies[m],w=a.hot._acceptedErrorHandlers[m];if(g){if(-1!==c.indexOf(g))continue;c.push(g),p.push(w),h.push(m)}}for(var y=0;y<c.length;y++)try{c[y].call(null,b)}catch(r){if("function"==typeof p[y])try{p[y](r,{moduleId:s,dependencyId:h[y]})}catch(n){e.onErrored&&e.onErrored({type:"accept-error-handler-errored",moduleId:s,dependencyId:h[y],error:n,originalError:r}),e.ignoreErrored||(t(n),t(r))}else e.onErrored&&e.onErrored({type:"accept-errored",moduleId:s,dependencyId:h[y],error:r}),e.ignoreErrored||t(r)}}}for(var v=0;v<x.length;v++){var k=x[v],C=k.module;try{k.require(C)}catch(r){if("function"==typeof k.errorHandler)try{k.errorHandler(r,{moduleId:C,module:o.c[C]})}catch(n){e.onErrored&&e.onErrored({type:"self-accept-error-handler-errored",moduleId:C,error:n,originalError:r}),e.ignoreErrored||(t(n),t(r))}else e.onErrored&&e.onErrored({type:"self-accept-errored",moduleId:C,error:r}),e.ignoreErrored||t(r)}}return d}}}this.webpackHotUpdateauthress=(t,n,s)=>{for(var c in n)o.o(n,c)&&(r[c]=n[c],e&&e.push(c));s&&i.push(s),a[t]&&(a[t](),a[t]=void 0)},o.hmrI.jsonp=function(e,t){r||(r={},i=[],n=[],t.push(u)),o.o(r,e)||(r[e]=o.m[e])},o.hmrC.jsonp=function(e,a,d,l,p,h){p.push(u),t={},n=a,r=d.reduce((function(e,t){return e[t]=!1,e}),{}),i=[],e.forEach((function(e){o.o(s,e)&&void 0!==s[e]?(l.push(c(e,h)),t[e]=!0):t[e]=!1})),o.f&&(o.f.jsonpHmr=function(e,r){t&&o.o(t,e)&&!t[e]&&(r.push(c(e)),t[e]=!0)})},o.hmrM=()=>{if("undefined"==typeof fetch)throw new Error("No browser support: need fetch API");return fetch(o.p+o.hmrF()).then((e=>{if(404!==e.status){if(!e.ok)throw new Error("Failed to fetch update manifest "+e.statusText);return e.json()}}))}})(),o(125)})()));
@@ -7,7 +7,7 @@
7
7
 
8
8
  /**
9
9
  * @preserve
10
- * Authress Login SDK 2.2.238
10
+ * Authress Login SDK 2.2.241
11
11
  * License: Apache-2.0
12
12
  * Repo : https://github.com/Authress/login-sdk.js
13
13
  * Author : Authress Developers
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authress/login",
3
- "version": "2.2.238",
3
+ "version": "2.2.241",
4
4
  "description": "Universal login sdk for Authress authentication as a service. Provides managed authentication for user identity, authentication, and token verification.",
5
5
  "main": "./src/index.js",
6
6
  "types": "./index.d.ts",
package/src/index.js CHANGED
@@ -198,7 +198,7 @@ class LoginClient {
198
198
  try {
199
199
  const tokenResult = await this.httpClient.post(`/authentication/${authRequest.nonce}/tokens`, this.enableCredentials, request);
200
200
  const idToken = jwtManager.decode(tokenResult.data.id_token);
201
- const expiry = tokenResult.data.expires_in && new Date(Date.now() + tokenResult.data.expires_in * 1000) || new Date(idToken.exp * 1000);
201
+ const expiry = idToken.exp && new Date(idToken.exp * 1000) || tokenResult.data.expires_in && new Date(Date.now() + tokenResult.data.expires_in * 1000);
202
202
  document.cookie = cookieManager.serialize('authorization', tokenResult.data.access_token || '', { expires: expiry, path: '/', sameSite: 'strict' });
203
203
  userIdentityTokenStorageManager.set(tokenResult.data.id_token, expiry);
204
204
  userSessionResolver();
@@ -227,7 +227,7 @@ class LoginClient {
227
227
  // * This prevents canonical replay attacks, and fall through. If the user is already logged in, then the new log in attempt is ignored.
228
228
  if (!authRequest.nonce || authRequest.nonce === urlSearchParams.get('nonce')) {
229
229
  const idToken = jwtManager.decode(urlSearchParams.get('id_token'));
230
- const expiry = Number(urlSearchParams.get('expires_in')) && new Date(Date.now() + Number(urlSearchParams.get('expires_in')) * 1000) || new Date(idToken.exp * 1000);
230
+ const expiry = idToken.exp && new Date(idToken.exp * 1000) || Number(urlSearchParams.get('expires_in')) && new Date(Date.now() + Number(urlSearchParams.get('expires_in')) * 1000);
231
231
  document.cookie = cookieManager.serialize('authorization', urlSearchParams.get('access_token') || '', { expires: expiry, path: '/', sameSite: 'strict' });
232
232
  userIdentityTokenStorageManager.set(urlSearchParams.get('id_token'), expiry);
233
233
  userSessionResolver();
@@ -251,7 +251,7 @@ class LoginClient {
251
251
  // In the case that the session contains non cookie based data, store it back to the cookie for this domain
252
252
  if (sessionResult.data.access_token) {
253
253
  const idToken = jwtManager.decode(sessionResult.data.id_token);
254
- const expiry = sessionResult.data.expires_in && new Date(Date.now() + sessionResult.data.expires_in * 1000) || new Date(idToken.exp * 1000);
254
+ const expiry = idToken.exp && new Date(idToken.exp * 1000) || sessionResult.data.expires_in && new Date(Date.now() + sessionResult.data.expires_in * 1000);
255
255
  document.cookie = cookieManager.serialize('authorization', sessionResult.data.access_token || '', { expires: expiry, path: '/', sameSite: 'strict' });
256
256
  userIdentityTokenStorageManager.set(sessionResult.data.id_token, expiry);
257
257
  }
package/src/jwtManager.js CHANGED
@@ -2,8 +2,19 @@ const base64url = require('./base64url');
2
2
 
3
3
  class JwtManager {
4
4
  decode(token) {
5
+ if (!token) {
6
+ return null;
7
+ }
8
+
5
9
  try {
6
- return token && JSON.parse(base64url.decode(token.split('.')[1]));
10
+ const parsedToken = JSON.parse(base64url.decode(token.split('.')[1]));
11
+ // If the identity expires in less than 10 seconds from now, assume it is already expired.
12
+ // * This blocks issues with intermittent access, and subsequent issues when the token has a limited finite lifetime
13
+ // * All the Authress token server returns 5 second long JWT lifetimes to prevent issues with browsers refusing 0 second long lifetimes, so a buffer is required
14
+ if (parsedToken.exp) {
15
+ parsedToken.exp = parsedToken.exp - 10;
16
+ }
17
+ return parsedToken;
7
18
  } catch (error) {
8
19
  return null;
9
20
  }
@@ -26,11 +37,20 @@ class JwtManager {
26
37
  }
27
38
 
28
39
  decodeFull(token) {
40
+ if (!token) {
41
+ return null;
42
+ }
43
+
29
44
  try {
30
- return token && {
31
- header: JSON.parse(base64url.decode(token.split('.')[0])),
32
- payload: JSON.parse(base64url.decode(token.split('.')[1]))
33
- };
45
+ const header = JSON.parse(base64url.decode(token.split('.')[0]));
46
+ const payload = JSON.parse(base64url.decode(token.split('.')[1]));
47
+ // If the identity expires in less than 10 seconds from now, assume it is already expired.
48
+ // * This blocks issues with intermittent access, and subsequent issues when the token has a limited finite lifetime
49
+ // * All the Authress token server returns 5 second long JWT lifetimes to prevent issues with browsers refusing 0 second long lifetimes, so a buffer is required
50
+ if (payload.exp) {
51
+ payload.exp = payload.exp - 10;
52
+ }
53
+ return { header, payload };
34
54
  } catch (error) {
35
55
  return null;
36
56
  }
@@ -32,6 +32,7 @@ class UserIdentityTokenStorageManager {
32
32
  if (!idToken) {
33
33
  return this.getUserCookie();
34
34
  }
35
+
35
36
  if (expiry < Date.now()) {
36
37
  return null;
37
38
  }