UNPKG

@accounter/client

Version:
3 lines • 188 kB
import{s as e}from"./dist-C51EwTaa.js";import{o as t}from"./utils-DdVdMk8X.js";import{n,t as r}from"./dist-CpBGIA40.js";n();var i=e(t()),a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},a(e,t)};function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);a(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)};function c(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function l(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function u(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function d(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function f(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function p(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function m(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function h(e,t){this.v=e,this.k=t}function g(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function ee(e){return new h(e,0)}function v(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function y(e,t){return e.get(_(e,t))}function b(e,t,n){v(e,t),t.set(e,n)}function x(e,t,n){return e.set(_(e,t),n),n}function te(e,t){v(e,t),t.add(e)}function S(e,t,n){return(t=function(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}(e,`string`);return typeof t==`symbol`?t:t+``}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ne(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function re(e,t){if(e==null)return{};var n,r,i=function(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if(typeof e==`string`)return g(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}(e,t)||function(){throw TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ie(e){return function(){return new ae(e.apply(this,arguments))}}function ae(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof h;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}ae.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},ae.prototype.next=function(e){return this._invoke(`next`,e)},ae.prototype.throw=function(e){return this._invoke(`throw`,e)},ae.prototype.return=function(e){return this._invoke(`return`,e)};var oe={timeoutInSeconds:60},se=1e4,ce=`memory`,le={name:`auth0-spa-js`,version:`2.21.2`},ue=()=>Date.now(),T=`default`,E=class e extends Error{constructor(t,n){super(n),this.error=t,this.error_description=n,Object.setPrototypeOf(this,e.prototype)}static fromPayload(t){let n=t.error,r=t.error_description;return new e(n,r)}},de=class e extends E{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;super(t,n),this.state=r,this.appState=i,Object.setPrototypeOf(this,e.prototype)}},fe=class e extends E{constructor(t,n,r,i){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null;super(t,n),this.connection=r,this.state=i,this.appState=a,Object.setPrototypeOf(this,e.prototype)}},pe=class e extends E{constructor(){super(`timeout`,`Timeout`),Object.setPrototypeOf(this,e.prototype)}},me=class e extends pe{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,e.prototype)}},he=class e extends E{constructor(t){super(`cancelled`,`Popup closed`),this.popup=t,Object.setPrototypeOf(this,e.prototype)}},ge=class e extends E{constructor(){super(`popup_open`,"Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,e.prototype)}},_e=class e extends E{constructor(t,n,r,i){super(t,n),this.mfa_token=r,this.mfa_requirements=i,Object.setPrototypeOf(this,e.prototype)}},ve=class e extends E{constructor(t,n){super(`missing_refresh_token`,`Missing Refresh Token (audience: '${xe(t,[`default`])}', scope: '${xe(n)}')`),this.audience=t,this.scope=n,Object.setPrototypeOf(this,e.prototype)}},ye=class e extends E{constructor(t,n){super(`missing_scopes`,`Missing requested scopes after refresh (audience: '${xe(t,[`default`])}', missing scope: '${xe(n)}')`),this.audience=t,this.scope=n,Object.setPrototypeOf(this,e.prototype)}},be=class e extends E{constructor(t){super(`use_dpop_nonce`,`Server rejected DPoP proof: wrong nonce`),this.newDpopNonce=t,Object.setPrototypeOf(this,e.prototype)}};function xe(e){return e&&!(arguments.length>1&&arguments[1]!==void 0?arguments[1]:[]).includes(e)?e:``}var Se=()=>window.crypto,Ce=()=>{let e=``;for(;e.length<43;){let t=Se().getRandomValues(new Uint8Array(43-e.length));for(let n of t)e.length<43&&n<198&&(e+=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.`[n%66])}return e},we=e=>btoa(e),Te=[{key:`name`,type:[`string`]},{key:`version`,type:[`string`,`number`]},{key:`env`,type:[`object`]}],Ee=function(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return Object.keys(e).reduce((n,r)=>{if(t&&r===`env`)return n;let i=Te.find(e=>e.key===r);return i&&i.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},De=e=>{var t=e.clientId,n=f(e,[`clientId`]);return new URLSearchParams((e=>Object.keys(e).filter(t=>e[t]!==void 0).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:e[n]}),{}))(Object.assign({client_id:t},n))).toString()},Oe=async e=>await Se().subtle.digest({name:`SHA-256`},new TextEncoder().encode(e)),ke=e=>(e=>decodeURIComponent(atob(e).split(``).map(e=>`%`+(`00`+e.charCodeAt(0).toString(16)).slice(-2)).join(``)))(e.replace(/_/g,`/`).replace(/-/g,`+`)),Ae=e=>{let t=new Uint8Array(e);return(e=>{let t={"+":`-`,"/":`_`,"=":``};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))},je=typeof globalThis<`u`?globalThis:typeof window<`u`?window:r===void 0?typeof self<`u`?self:{}:r,Me={},Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});var Pe=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);r===void 0?n===void 0?e.locked.set(t,[]):e.locked.set(t,[n]):n!==void 0&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(n!==void 0&&n.length!==0){var r=n.pop();e.locked.set(t,n),r!==void 0&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return e.instance===void 0&&(e.instance=new e),e.instance},e}();Ne.default=function(){return Pe.getInstance()};var D=je&&je.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,s)}c((r=r.apply(e,t||[])).next())})},O=je&&je.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},Fe=je;Object.defineProperty(Me,"__esModule",{value:!0});var Ie=Ne,Le=`browser-tabs-lock-key`,Re={key:function(e){return D(Fe,void 0,void 0,function(){return O(this,function(e){throw Error(`Unsupported`)})})},getItem:function(e){return D(Fe,void 0,void 0,function(){return O(this,function(e){throw Error(`Unsupported`)})})},clear:function(){return D(Fe,void 0,void 0,function(){return O(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return D(Fe,void 0,void 0,function(){return O(this,function(e){throw Error(`Unsupported`)})})},setItem:function(e,t){return D(Fe,void 0,void 0,function(){return O(this,function(e){throw Error(`Unsupported`)})})},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function ze(e){return new Promise(function(t){return setTimeout(t,e)})}function Be(e){for(var t=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz`,n=``,r=0;r<e;r++)n+=t[Math.floor(61*Math.random())];return n}var Ve=Me.default=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+Be(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,e.waiters===void 0&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return n===void 0&&(n=5e3),D(this,void 0,void 0,function(){var r,i,a,o,s,c,l;return O(this,function(u){switch(u.label){case 0:r=Date.now()+Be(4),i=Date.now()+n,a=Le+`-`+t,o=this.storageHandler===void 0?Re:this.storageHandler,u.label=1;case 1:return Date.now()<i?[4,ze(30)]:[3,8];case 2:return u.sent(),o.getItemSync(a)===null?(s=this.id+`-`+t+`-`+r,[4,ze(Math.floor(25*Math.random()))]):[3,5];case 3:return u.sent(),o.setItemSync(a,JSON.stringify({id:this.id,iat:r,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,ze(30)];case 4:return u.sent(),(c=o.getItemSync(a))!==null&&(l=JSON.parse(c)).id===this.id&&l.iat===r?(this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(a,r),[2,!0]):[3,7];case 5:return e.lockCorrector(this.storageHandler===void 0?Re:this.storageHandler),[4,this.waitForSomethingToChange(i)];case 6:u.sent(),u.label=7;case 7:return r=Date.now()+Be(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return D(this,void 0,void 0,function(){var n=this;return O(this,function(r){return setTimeout(function(){return D(n,void 0,void 0,function(){var n,r,i;return O(this,function(a){switch(a.label){case 0:return[4,Ie.default().lock(t)];case 1:return a.sent(),this.acquiredIatSet.has(t)?(n=this.storageHandler===void 0?Re:this.storageHandler,(r=n.getItemSync(e))===null?(Ie.default().unlock(t),[2]):((i=JSON.parse(r)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(i)),Ie.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(Ie.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return D(this,void 0,void 0,function(){return O(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var r=!1,i=Date.now(),a=!1;function o(){if(a||=(window.removeEventListener(`storage`,o),e.removeFromWaiting(o),clearTimeout(s),!0),!r){r=!0;var t=50-(Date.now()-i);t>0?setTimeout(n,t):n(null)}}window.addEventListener(`storage`,o),e.addToWaiting(o);var s=setTimeout(o,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),e.waiters!==void 0&&e.waiters.push(t)},e.removeFromWaiting=function(t){e.waiters!==void 0&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){e.waiters!==void 0&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return D(this,void 0,void 0,function(){return O(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return D(this,void 0,void 0,function(){var n,r,i,a;return O(this,function(o){switch(o.label){case 0:return n=this.storageHandler===void 0?Re:this.storageHandler,r=Le+`-`+t,(i=n.getItemSync(r))===null?[2]:(a=JSON.parse(i)).id===this.id?[4,Ie.default().lock(a.iat)]:[3,2];case 1:o.sent(),this.acquiredIatSet.delete(a.iat),n.removeItemSync(r),Ie.default().unlock(a.iat),e.notifyWaiters(),o.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,i=[],a=0;;){var o=r.keySync(a);if(o===null)break;i.push(o),a++}for(var s=!1,c=0;c<i.length;c++){var l=i[c];if(l.includes(Le)){var u=r.getItemSync(l);if(u!==null){var d=JSON.parse(u);(d.timeRefreshed===void 0&&d.timeAcquired<n||d.timeRefreshed!==void 0&&d.timeRefreshed<n)&&(r.removeItemSync(l),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}(),He=class{async runWithLock(e,t,n){let r=new AbortController,i=setTimeout(()=>r.abort(),t);try{return await navigator.locks.request(e,{mode:`exclusive`,signal:r.signal},async e=>{if(clearTimeout(i),!e)throw Error(`Lock not available`);return await n()})}catch(e){throw clearTimeout(i),e?.name===`AbortError`?new pe:e}}},Ue=class{constructor(){this.activeLocks=new Set,this.lock=new Ve,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let r=!1;for(let n=0;n<10&&!r;n++)r=await this.lock.acquireLock(e,t);if(!r)throw new pe;this.activeLocks.add(e),this.activeLocks.size===1&&typeof window<`u`&&window.addEventListener(`pagehide`,this.pagehideHandler);try{return await n()}finally{this.activeLocks.delete(e),await this.lock.releaseLock(e),this.activeLocks.size===0&&typeof window<`u`&&window.removeEventListener(`pagehide`,this.pagehideHandler)}}};function We(){return typeof navigator<`u`&&typeof(e=navigator.locks)?.request==`function`?new He:new Ue;var e}var Ge=null,Ke=new TextEncoder,qe=new TextDecoder;function Je(e){return typeof e==`string`?Ke.encode(e):qe.decode(e)}function Ye(e){if(typeof e.modulusLength!=`number`||e.modulusLength<2048)throw new et(`${e.name} modulusLength must be at least 2048 bits`)}async function Xe(e,t,n){if(!1===n.usages.includes(`sign`))throw TypeError(`private CryptoKey instances used for signing assertions must include "sign" in their "usages"`);let r=`${Qe(Je(JSON.stringify(e)))}.${Qe(Je(JSON.stringify(t)))}`;return`${r}.${Qe(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case`ECDSA`:return{name:e.algorithm.name,hash:`SHA-256`};case`RSA-PSS`:return Ye(e.algorithm),{name:e.algorithm.name,saltLength:32};case`RSASSA-PKCS1-v1_5`:return Ye(e.algorithm),{name:e.algorithm.name};case`Ed25519`:return{name:e.algorithm.name}}throw new $e}(n),n,Je(r)))}`}var Ze;if(Uint8Array.prototype.toBase64)Ze=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:`base64url`,omitPadding:!0}));else{let e=32768;Ze=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));let n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join(``)).replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`)}}function Qe(e){return Ze(e)}var $e=class extends Error{constructor(e){var t;super(e??`operation not supported`),this.name=this.constructor.name,(t=Error.captureStackTrace)==null||t.call(Error,this,this.constructor)}},et=class extends Error{constructor(e){var t;super(e),this.name=this.constructor.name,(t=Error.captureStackTrace)==null||t.call(Error,this,this.constructor)}};function tt(e){switch(e.algorithm.name){case`RSA-PSS`:return function(e){if(e.algorithm.hash.name===`SHA-256`)return`PS256`;throw new $e(`unsupported RsaHashedKeyAlgorithm hash name`)}(e);case`RSASSA-PKCS1-v1_5`:return function(e){if(e.algorithm.hash.name===`SHA-256`)return`RS256`;throw new $e(`unsupported RsaHashedKeyAlgorithm hash name`)}(e);case`ECDSA`:return function(e){if(e.algorithm.namedCurve===`P-256`)return`ES256`;throw new $e(`unsupported EcKeyAlgorithm namedCurve`)}(e);case`Ed25519`:return`Ed25519`;default:throw new $e(`unsupported CryptoKey algorithm name`)}}function nt(e){return e instanceof CryptoKey}function rt(e){return nt(e)&&e.type===`public`}async function it(e,t,n,r,i,a){let o=e?.privateKey,s=e?.publicKey;if(!nt(c=o)||c.type!==`private`)throw TypeError(`"keypair.privateKey" must be a private CryptoKey`);var c;if(!rt(s))throw TypeError(`"keypair.publicKey" must be a public CryptoKey`);if(!0!==s.extractable)throw TypeError(`"keypair.publicKey.extractable" must be true`);if(typeof t!=`string`)throw TypeError(`"htu" must be a string`);if(typeof n!=`string`)throw TypeError(`"htm" must be a string`);if(r!==void 0&&typeof r!=`string`)throw TypeError(`"nonce" must be a string or undefined`);if(i!==void 0&&typeof i!=`string`)throw TypeError(`"accessToken" must be a string or undefined`);if(a!==void 0&&(typeof a!=`object`||!a||Array.isArray(a)))throw TypeError(`"additional" must be an object`);return Xe({alg:tt(o),typ:`dpop+jwt`,jwk:await at(s)},Object.assign(Object.assign({},a),{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:n,nonce:r,htu:t,ath:i?Qe(await crypto.subtle.digest(`SHA-256`,Je(i))):void 0}),o)}async function at(e){let{kty:t,e:n,n:r,x:i,y:a,crv:o}=await crypto.subtle.exportKey(`jwk`,e);return{kty:t,crv:o,e:n,n:r,x:i,y:a}}var ot=`dpop-nonce`,st=[`authorization_code`,`refresh_token`,`urn:ietf:params:oauth:grant-type:token-exchange`,`urn:okta:params:oauth:grant-type:webauthn`,`http://auth0.com/oauth/grant-type/mfa-oob`,`http://auth0.com/oauth/grant-type/mfa-otp`,`http://auth0.com/oauth/grant-type/mfa-recovery-code`];function ct(){return async function(e,t){var n;let r;if(typeof e!=`string`||e.length===0)throw TypeError(`"alg" must be a non-empty string`);switch(e){case`PS256`:r={name:`RSA-PSS`,hash:`SHA-256`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case`RS256`:r={name:`RSASSA-PKCS1-v1_5`,hash:`SHA-256`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case`ES256`:r={name:`ECDSA`,namedCurve:`P-256`};break;case`Ed25519`:r={name:`Ed25519`};break;default:throw new $e}return crypto.subtle.generateKey(r,(n=t?.extractable)!=null&&n,[`sign`,`verify`])}(`ES256`,{extractable:!1})}function lt(e){return async function(e){if(!rt(e))throw TypeError(`"publicKey" must be a public CryptoKey`);if(!0!==e.extractable)throw TypeError(`"publicKey.extractable" must be true`);let t=await at(e),n;switch(t.kty){case`EC`:n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case`OKP`:n={crv:t.crv,kty:t.kty,x:t.x};break;case`RSA`:n={e:t.e,kty:t.kty,n:t.n};break;default:throw new $e(`unsupported JWK kty`)}return Qe(await crypto.subtle.digest({name:`SHA-256`},Je(JSON.stringify(n))))}(e.publicKey)}function ut(e){let t=e.keyPair,n=e.url,r=e.method,i=e.nonce,a=e.accessToken;return it(t,function(e){let t=new URL(e);return t.search=``,t.hash=``,t.href}(n),r,i,a)}var dt=(e,t)=>new Promise(function(n,r){let i=new MessageChannel;i.port1.onmessage=function(e){e.data.error?r(Error(e.data.error)):n(e.data),i.port1.close()},t.postMessage(e,[i.port2])}),ft=(e,t,n)=>{let r=new AbortController,i;return t.signal=r.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{i=setTimeout(()=>{r.abort(),t(Error(`Timeout when executing 'fetch'`))},n)})]).finally(()=>{clearTimeout(i)})},pt=async function(e,t,n,r,i,a){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:se;return i?(async(e,t,n,r,i,a,o,s,c)=>dt({type:`refresh`,auth:{audience:t,scope:n},timeout:i,fetchUrl:e,fetchOptions:r,useFormData:o,useMrrt:s,skipTokenStorage:c},a))(e,t,n,r,o,i,a,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0):(async(e,t,n)=>{let r=await ft(e,t,n);return{ok:r.ok,json:await r.json(),headers:(i=r.headers,[...i].reduce((e,t)=>{let n=w(t,2),r=n[0];return e[r]=n[1],e},{}))};var i})(e,r,o)};async function mt(e,t,n,r,i,a,o,s,c,l,u){if(c){let t=await c.generateProof({url:e,method:i.method||`GET`,nonce:await c.getNonce()});i.headers=Object.assign(Object.assign({},i.headers),{dpop:t})}let d,p=null;for(let c=0;c<3;c++)try{d=await pt(e,n,r,i,a,o,t,s,u),p=null;break}catch(e){p=e}if(p)throw p;let m=d.json,h=m.error,g=m.error_description,_=f(m,[`error`,`error_description`]),ee=d,v=ee.headers,y=ee.ok,b;if(c&&(b=v[ot],b&&await c.setNonce(b)),!y){let d=g||`HTTP error. Unable to fetch ${e}`;if(h===`mfa_required`)throw new _e(h,d,_.mfa_token,_.mfa_requirements);if(h===`missing_refresh_token`)throw new ve(n,r);if(h===`use_dpop_nonce`){if(!c||!b||l)throw new be(b);return mt(e,t,n,r,i,a,o,s,c,!0,u)}throw new E(h||`request_error`,d)}return _}async function ht(e,t,n){var r=e.baseUrl,i=e.timeout,a=e.audience,o=e.scope,s=e.auth0Client,c=e.useFormData,l=e.useMrrt,u=e.dpop,d=f(e,[`baseUrl`,`timeout`,`audience`,`scope`,`auth0Client`,`useFormData`,`useMrrt`,`dpop`]);let p=d.grant_type===`urn:ietf:params:oauth:grant-type:token-exchange`,m=d.grant_type===`urn:okta:params:oauth:grant-type:webauthn`,h=d.grant_type===`refresh_token`&&l,g=p||m||h,_=Object.assign(Object.assign(Object.assign({},d),g&&a&&{audience:a}),g&&o&&{scope:o}),ee=m||!c,v=ee?JSON.stringify(_):De(_),y=(b=d.grant_type,st.includes(b));var b;return await mt(`${r}/oauth/token`,i,a||T,o,{method:`POST`,body:v,headers:{"Content-Type":ee?`application/json`:`application/x-www-form-urlencoded`,"Auth0-Client":btoa(JSON.stringify(Ee(s||le)))}},t,c,l,y?u:void 0,void 0,n)}var gt=function(){return(e=[...arguments].filter(Boolean).join(` `).trim().split(/\s+/),Array.from(new Set(e))).join(` `);var e},_t=(e,t,n)=>{let r;return n&&(r=e[n]),r||=e[T],gt(r,t)},vt=`@@auth0spajs@@`,yt=`@@user@@`,k=class e{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vt,n=arguments.length>2?arguments[2]:void 0;this.prefix=t,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join(`::`)}static fromKey(t){let n=w(t.split(`::`),4),r=n[0],i=n[1],a=n[2],o=n[3];return new e({clientId:i,scope:o,audience:a},r)}static fromCacheEntry(t){let n=t.scope,r=t.audience,i=t.client_id;return new e({scope:n,audience:r,clientId:i})}},bt=class{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){let t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith(vt))}},xt=class{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){let n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}},St=class{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||ue}async setIdToken(e,t,n){let r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:n}),await this.keyManifest?.add(r)}async getIdToken(e){let t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){let t=await this.get(e);return!t||!t.id_token||!t.decodedToken?void 0:{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=arguments.length>3?arguments[3]:void 0,i=await this.cache.get(e.toKey()),a=e;if(!i){let t=await this.getCacheKeys();if(!t)return;let o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o),a=k.fromKey(o)),!i&&n&&r!==`cache-only`)return this.getEntryWithRefreshToken(e,t)}if(!i)return;let o=await this.nowProvider(),s=Math.floor(o/1e3);return i.expiresAt-t<s?i.body.refresh_token?this.modifiedCachedEntry(i,a):(await this.cache.remove(a.toKey()),void await this.keyManifest?.remove(a.toKey())):i.body}async modifiedCachedEntry(e,t){let n={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},r={body:n,expiresAt:e.expiresAt};return await this.cache.set(t.toKey(),r),{refresh_token:n.refresh_token,audience:n.audience,scope:n.scope}}async set(e){let t=new k({clientId:e.client_id,scope:e.scope,audience:e.audience}),n=await this.wrapCacheEntry(e);await this.cache.set(t.toKey(),n),await this.keyManifest?.add(t.toKey())}async remove(e,t,n){let r=new k({clientId:e,scope:n,audience:t});await this.cache.remove(r.toKey())}async stripRefreshToken(e){let t=await this.getCacheKeys();if(t)for(let n of t){let t=await this.cache.get(n);t?.body?.refresh_token===e&&(delete t.body.refresh_token,await this.cache.set(n,t))}}async clear(e){let t=await this.getCacheKeys();t&&(await t.filter(t=>!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await this.keyManifest?.clear())}async wrapCacheEntry(e){let t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){return this.keyManifest?(await this.keyManifest.get())?.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new k({clientId:e},vt,yt).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{let n=k.fromKey(t),r=new Set(n.scope&&n.scope.split(` `)),i=e.scope?.split(` `)||[],a=n.scope&&i.reduce((e,t)=>e&&r.has(t),!0);return n.prefix===vt&&n.clientId===e.clientId&&n.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){for(let n of t){let t=k.fromKey(n);if(t.prefix===vt&&t.clientId===e.clientId){let e=await this.cache.get(n);if(e?.body?.refresh_token)return{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}}}async getRefreshTokensByAudience(e,t){var n;let r=await this.getCacheKeys();if(!r)return[];let i=new Set;for(let a of r){let r=k.fromKey(a);if(r.prefix===vt&&r.clientId===t&&r.audience===e){let e=await this.cache.get(a);(n=e?.body)!=null&&n.refresh_token&&i.add(e.body.refresh_token)}}return Array.from(i)}async updateEntry(e,t){let n=await this.getCacheKeys();if(n)for(let r of n){let n=await this.cache.get(r);n?.body?.refresh_token===e&&(n.body.refresh_token=t,await this.cache.set(r,n))}}},Ct=class{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}},wt=e=>typeof e==`number`,Tt=`iss.aud.exp.nbf.iat.jti.azp.nonce.auth_time.at_hash.c_hash.acr.amr.sub_jwk.cnf.sip_from_tag.sip_date.sip_callid.sip_cseq_num.sip_via_branch.orig.dest.mky.events.toe.txn.rph.sid.vot.vtm`.split(`.`),Et=e=>{if(!e.id_token)throw Error(`ID token is required but missing`);let t=(e=>{let t=e.split(`.`),n=w(t,3),r=n[0],i=n[1],a=n[2];if(t.length!==3||!r||!i||!a)throw Error(`ID token could not be decoded`);let o=JSON.parse(ke(i)),s={__raw:e},c={};return Object.keys(o).forEach(e=>{s[e]=o[e],Tt.includes(e)||(c[e]=o[e])}),{encoded:{header:r,payload:i,signature:a},header:JSON.parse(ke(r)),claims:s,user:c}})(e.id_token);if(!t.claims.iss)throw Error(`Issuer (iss) claim must be a string present in the ID token`);if(t.claims.iss!==e.iss)throw Error(`Issuer (iss) claim mismatch in the ID token; expected "${e.iss}", found "${t.claims.iss}"`);if(!t.user.sub)throw Error(`Subject (sub) claim must be a string present in the ID token`);if(t.header.alg!==`RS256`)throw Error(`Signature algorithm of "${t.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!t.claims.aud||typeof t.claims.aud!=`string`&&!Array.isArray(t.claims.aud))throw Error(`Audience (aud) claim must be a string or array of strings present in the ID token`);if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e.aud))throw Error(`Audience (aud) claim mismatch in the ID token; expected "${e.aud}" but was not one of "${t.claims.aud.join(`, `)}"`);if(t.claims.aud.length>1){if(!t.claims.azp)throw Error(`Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values`);if(t.claims.azp!==e.aud)throw Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${e.aud}", found "${t.claims.azp}"`)}}else if(t.claims.aud!==e.aud)throw Error(`Audience (aud) claim mismatch in the ID token; expected "${e.aud}" but found "${t.claims.aud}"`);if(e.nonce){if(!t.claims.nonce)throw Error(`Nonce (nonce) claim must be a string present in the ID token`);if(t.claims.nonce!==e.nonce)throw Error(`Nonce (nonce) claim mismatch in the ID token; expected "${e.nonce}", found "${t.claims.nonce}"`)}if(e.max_age&&!wt(t.claims.auth_time))throw Error(`Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified`);if(t.claims.exp==null||!wt(t.claims.exp))throw Error(`Expiration Time (exp) claim must be a number present in the ID token`);if(!wt(t.claims.iat))throw Error(`Issued At (iat) claim must be a number present in the ID token`);let n=e.leeway||60,r=new Date(e.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(t.claims.exp+n),r>i)throw Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);if(t.claims.nbf!=null&&wt(t.claims.nbf)){let e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),r<e)throw Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${e}`)}if(t.claims.auth_time!=null&&wt(t.claims.auth_time)){let i=new Date(0);if(i.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),r>i)throw Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${r}) is after last auth at ${i}`)}if(e.organization){let n=e.organization.trim();if(n.startsWith(`org_`)){let e=n;if(!t.claims.org_id)throw Error(`Organization ID (org_id) claim must be a string present in the ID token`);if(e!==t.claims.org_id)throw Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${e}", found "${t.claims.org_id}"`)}else{let e=n.toLowerCase();if(!t.claims.org_name)throw Error(`Organization Name (org_name) claim must be a string present in the ID token`);if(e!==t.claims.org_name)throw Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${e}", found "${t.claims.org_name}"`)}}return t},Dt=je&&je.__assign||function(){return Dt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Dt.apply(this,arguments)};function Ot(e,t){if(!t)return``;var n=`; `+e;return!0===t?n:n+`=`+t}function kt(e,t,n){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,`%28`).replace(/\)/g,`%29`)+`=`+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if(typeof e.expires==`number`){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return Ot(`Expires`,e.expires?e.expires.toUTCString():``)+Ot(`Domain`,e.domain)+Ot(`Path`,e.path)+Ot(`Secure`,e.secure)+Ot(`SameSite`,e.sameSite)}(n)}function At(){return function(e){for(var t={},n=e?e.split(`; `):[],r=/(%[\dA-F]{2})+/gi,i=0;i<n.length;i++){var a=n[i].split(`=`),o=a.slice(1).join(`=`);o.charAt(0)===`"`&&(o=o.slice(1,-1));try{t[a[0].replace(r,decodeURIComponent)]=o.replace(r,decodeURIComponent)}catch{}}return t}(document.cookie)}var jt=function(e){return At()[e]};function Mt(e,t,n){document.cookie=kt(e,t,Dt({path:`/`},n))}var Nt=Mt,Pt=function(e,t){Mt(e,``,Dt(Dt({},t),{expires:-1}))},Ft={get(e){let t=jt(e);if(t!==void 0)return JSON.parse(t)},save(e,t,n){let r={};window.location.protocol===`https:`&&(r={secure:!0,sameSite:`none`}),n!=null&&n.daysUntilExpire&&(r.expires=n.daysUntilExpire),n!=null&&n.cookieDomain&&(r.domain=n.cookieDomain),Nt(e,JSON.stringify(t),r)},remove(e,t){let n={};t!=null&&t.cookieDomain&&(n.domain=t.cookieDomain),Pt(e,n)}},It=`_legacy_`,Lt={get(e){return Ft.get(e)||Ft.get(`${It}${e}`)},save(e,t,n){let r={};window.location.protocol===`https:`&&(r={secure:!0}),n!=null&&n.daysUntilExpire&&(r.expires=n.daysUntilExpire),n!=null&&n.cookieDomain&&(r.domain=n.cookieDomain),Nt(`${It}${e}`,JSON.stringify(t),r),Ft.save(e,t,n)},remove(e,t){let n={};t!=null&&t.cookieDomain&&(n.domain=t.cookieDomain),Pt(e,n),Ft.remove(e,t),Ft.remove(`${It}${e}`,t)}},Rt={get(e){if(typeof sessionStorage>`u`)return;let t=sessionStorage.getItem(e);return t==null?void 0:JSON.parse(t)},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}},zt;(function(e){e.Code=`code`,e.ConnectCode=`connect_code`})(zt||={});function Bt(e,t,n){var r=t===void 0?null:t,i=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),i=0,a=n.length;i<a;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,n!==void 0&&n),a=i.indexOf(` `,10)+1,o=i.substring(a)+(r?`//# sourceMappingURL=`+r:``),s=new Blob([o],{type:`application/javascript`});return URL.createObjectURL(s)}var Vt,Ht,Ut,Wt,Gt=(Vt=`Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShlLHQpeyhudWxsPT10fHx0PmUubGVuZ3RoKSYmKHQ9ZS5sZ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CIvb2F1dGgvdG9rZW4iKT9kKGUpOm51bGw9PW98fG8ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOiJpbnZhbGlkX2ZldGNoX3VybCIsZXJyb3JfZGVzY3JpcHRpb246IlVuYXV0aG9yaXplZCBmZXRjaCBVUkwifSxoZWFkZXJzOnt9fSkpO2lmKG51bGw9PT1hKXRyeXtuZXcgVVJMKHIuYWxsb3dlZEJhc2VVcmwpLGE9ci5hbGxvd2VkQmFzZVVybH1jYXRjaChlKXtyZXR1cm59fSl9KCk7Cgo=`,Ht=null,Ut=!1,function(e){return Wt||=Bt(Vt,Ht,Ut),new Worker(Wt,e)}),Kt={},qt=class{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){let t=new Set((await this.cache.get(this.manifestKey))?.keys||[]);t.add(e),await this.cache.set(this.manifestKey,{keys:[...t]})}async remove(e){let t=await this.cache.get(this.manifestKey);if(t){let n=new Set(t.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`${vt}::${e}`}},Jt=`auth0.is.authenticated`,Yt={memory:()=>new xt().enclosedCache,localstorage:()=>new bt},Xt=e=>Yt[e],Zt=e=>{let t=e.openUrl,n=e.onRedirect,r=f(e,[`openUrl`,`onRedirect`]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},Qt=(e,t)=>{let n=t?.split(` `)||[];return(e?.split(` `)||[]).every(e=>n.includes(e))},$t={NONCE:`nonce`,KEYPAIR:`keypair`},en=class{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){let e=window.indexedDB.open(`auth0-spa-js`,this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>Object.values($t).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>n(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||=await this.createDbHandle(),this.dbHandle}async executeDbRequest(e,t,n){let r=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}buildKey(e){let t=e?`_${e}`:`auth0`;return`${this.clientId}::${t}`}setNonce(e,t){return this.save($t.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save($t.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,`readwrite`,e=>e.put(n,t))}findNonce(e){return this.find($t.NONCE,this.buildKey(e))}findKeyPair(){return this.find($t.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,`readonly`,e=>e.get(t))}async deleteBy(e,t){let n=await this.executeDbRequest(e,`readonly`,e=>e.getAllKeys());await Promise.all(n?.filter(t).map(t=>this.executeDbRequest(e,`readwrite`,e=>e.delete(t)))||[])}deleteByClientId(e,t){return this.deleteBy(e,e=>typeof e==`string`&&e.startsWith(`${t}::`))}clearNonces(){return this.deleteByClientId($t.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId($t.KEYPAIR,this.clientId)}},tn=class{constructor(e){this.storage=new en(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await ct(),await this.storage.setKeyPair(e)),e}async generateProof(e){let t=await this.getOrGenerateKeyPair();return ut(Object.assign({keyPair:t},e))}async calculateThumbprint(){return lt(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}},nn;(function(e){e.Bearer=`Bearer`,e.DPoP=`DPoP`})(nn||={});var rn=class{constructor(e,t){this.hooks=t,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||(typeof window>`u`?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,t){if(t){if(this.isAbsoluteUrl(t))return t;if(e)return`${e.replace(/\/?\/$/,``)}/${t.replace(/^\/+/,``)}`}throw TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)