PageSourceSearch

https://ir.fusemachines.com/_next/static/chunks/7176-a2d7564f31208916.js

js fusemachines.com collected 2026-10-02 07:16:02 UTC 66,857 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7176],{67176:(e,t,i)=>{let n;i.d(t,{WB:()=>eF,y2:()=>eV});var o,r=i(12115),a=function(e,t){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},s=function(){return(s=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function c(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(i[n[o]]=e[n[o]]);return i}function u(e,t,i,n){return new(i||(i=Promise))(function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})}function l(e,t){var i,n,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){var u=[s,c];if(i)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(r=0)),r;)try{if(i=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,n=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(!(o=(o=r.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){r=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(6===u[0]&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(e){u=[6,e],n=0}finally{i=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function d(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(i[n[o]]=e[n[o]])}return i}"function"==typeof SuppressedError&&SuppressedError,"function"==typeof SuppressedError&&SuppressedError;var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self?self:{};function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function m(e,t){return e(t={exports:{}},t.exports),t.exports}var f=m(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,i){var n=e.locked.get(t);void 0===n?void 0===i?e.locked.set(t,[]):e.locked.set(t,[i]):void 0!==i&&(n.unshift(i),e.locked.set(t,n))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(i,n){e.isLocked(t)?e.addToLocked(t,i):(e.addToLocked(t),i())})},this.unlock=function(t){var i=e.locked.get(t);if(void 0!==i&&0!==i.length){var n=i.pop();e.locked.set(t,i),void 0!==n&&setTimeout(n,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();t.default=function(){return i.getInstance()}});p(f);var y=p(m(function(e,t){var i=h&&h.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(a,s)}c((n=n.apply(e,t||[])).next())})},n=h&&h.__generator||function(e,t){var i,n,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){var c=[r,s];if(i)throw TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{i=o=0}
1if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0});var o="browser-tabs-lock-key",r={key:function(e){return i(h,void 0,void 0,function(){return n(this,function(e){throw Error("Unsupported")})})},getItem:function(e){return i(h,void 0,void 0,function(){return n(this,function(e){throw Error("Unsupported")})})},clear:function(){return i(h,void 0,void 0,function(){return n(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return i(h,void 0,void 0,function(){return n(this,function(e){throw Error("Unsupported")})})},setItem:function(e,t){return i(h,void 0,void 0,function(){return n(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 a(e){return new Promise(function(t){return setTimeout(t,e)})}function s(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",i="",n=0;n<e;n++)i+=t[Math.floor(Math.random()*t.length)];return i}t.default=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+s(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,void 0===e.waiters&&(e.waiters=[])}return e.prototype.acquireLock=function(t,c){return void 0===c&&(c=5e3),i(this,void 0,void 0,function(){var i,u,l,d,h,p,m;return n(this,function(n){switch(n.label){case 0:i=Date.now()+s(4),u=Date.now()+c,l=o+"-"+t,d=void 0===this.storageHandler?r:this.storageHandler,n.label=1;case 1:return Date.now()<u?[4,a(30)]:[3,8];case 2:return n.sent(),null!==d.getItemSync(l)?[3,5]:(h=this.id+"-"+t+"-"+i,[4,a(Math.floor(25*Math.random()))]);case 3:return n.sent(),d.setItemSync(l,JSON.stringify({id:this.id,iat:i,timeoutKey:h,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,a(30)];case 4:return n.sent(),null!==(p=d.getItemSync(l))&&(m=JSON.parse(p)).id===this.id&&m.iat===i?(this.acquiredIatSet.add(i),this.refreshLockWhileAcquired(l,i),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?r:this.storageHandler),[4,this.waitForSomethingToChange(u)];case 6:n.sent(),n.label=7;case 7:return i=Date.now()+s(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return i(this,void 0,void 0,function(){var o=this;return n(this,function(a){return setTimeout(function(){return i(o,void 0,void 0,function(){var i,o,a;return n(this,function(n){switch(n.label){case 0:return[4,f.default().lock(t)];case 1:return n.sent(),this.acquiredIatSet.has(t)?null===(o=(i=void 0===this.storageHandler?r:this.storageHandler).getItemSync(e))?f.default().unlock(t):((a=JSON.parse(o)).timeRefreshed=Date.now(),i.setItemSync(e,JSON.stringify(a)),f.default().unlock(t),this.refreshLockWhileAcquired(e,t)):f.default().unlock(t),[2]}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return i(this,void 0,void 0,function(){return n(this,function(i){switch(i.label){case 0:return[4,new Promise(function(i){var n=!1,o=Date.now(),r=!1;function a(){if(r||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),r=!0),!n){n=!0;var t=50-(Date.now()-o);t>0?setTimeout(i,t):i(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return i.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return i(this,void 0,void 0,function(){return n(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 i(this,void 0,void 0,function(){var i,a,s,c;return n(this,function(n){switch(n.label){case 0:return i=void 0===this.storageHandler?r:this.storageHandler,a=o+"-"+t,null===(s=i.getItemSync(a))?[2]:(c=JSON.parse(s)).id!==this.id?[3,2]:[4,f.default().lock(c.iat)];case 1:n.sent(),this.acquiredIatSet.delete(c.iat),i.removeItemSync(a),f.default().unlock(c.iat),e.notifyWaiters(),n.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var i=Date.now()-5e3,n=[],r=0;;){var a=t.keySync(r);if(null===a)break;n.push(a),r++}for(var s=!1,c=0;c<n.length;c++){var u=n[c];if(u.includes(o)){var l=t.getItemSync(u);if(null!==l){var d=JSON.parse(l);(void 0===d.timeRefreshed&&d.timeAcquired<i||void 0!==d.timeRefreshed&&d.timeRefreshed<i)&&(t.removeItemSync(u),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}()}));let g={timeoutInSeconds:60},w={name:"auth0-spa-js",version:"2.7.0"},b=()=>Date.now();
1class k extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,k.prototype)}static fromPayload({error:e,error_description:t}){return new k(e,t)}}class v extends k{constructor(e,t,i,n=null){super(e,t),this.state=i,this.appState=n,Object.setPrototypeOf(this,v.prototype)}}class _ extends k{constructor(e,t,i,n,o=null){super(e,t),this.connection=i,this.state=n,this.appState=o,Object.setPrototypeOf(this,_.prototype)}}class S extends k{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,S.prototype)}}class I extends S{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,I.prototype)}}class P extends k{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,P.prototype)}}class O extends k{constructor(e,t,i){super(e,t),this.mfa_token=i,Object.setPrototypeOf(this,O.prototype)}}class T extends k{constructor(e,t){super("missing_refresh_token",`Missing Refresh Token (audience: '${j(e,["default"])}', scope: '${j(t)}')`),this.audience=e,this.scope=t,Object.setPrototypeOf(this,T.prototype)}}class C extends k{constructor(e,t){super("missing_scopes",`Missing requested scopes after refresh (audience: '${j(e,["default"])}', missing scope: '${j(t)}')`),this.audience=e,this.scope=t,Object.setPrototypeOf(this,C.prototype)}}class E extends k{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,E.prototype)}}function j(e,t=[]){return e&&!t.includes(e)?e:""}let x=()=>{let e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.",t="";return Array.from(window.crypto.getRandomValues(new Uint8Array(43))).forEach(i=>t+=e[i%e.length]),t},K=e=>btoa(e),R=e=>{var{clientId:t}=e;return new URLSearchParams((e=>Object.keys(e).filter(t=>void 0!==e[t]).reduce((t,i)=>Object.assign(Object.assign({},t),{[i]:e[i]}),{}))(Object.assign({client_id:t},d(e,["clientId"])))).toString()},z=async e=>{let t=window.crypto.subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},N=e=>decodeURIComponent(atob(e.replace(/_/g,"/").replace(/-/g,"+")).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")),A=e=>{let t=new Uint8Array(e);return(e=>{let t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))},U=new TextEncoder,D=new TextDecoder;function L(e){return"string"==typeof e?U.encode(e):D.decode(e)}function Z(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new G(`${e.name} modulusLength must be at least 2048 bits`)}async function W(e,t,i){var o,r,a;
1if(!1===i.usages.includes("sign"))throw TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');let s=`${(o=L(JSON.stringify(e)),n(o))}.${(r=L(JSON.stringify(t)),n(r))}`;return`${s}.${a=await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return Z(e.algorithm),{name:e.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return Z(e.algorithm),{name:e.algorithm.name};case"Ed25519":return{name:e.algorithm.name}}throw new H}(i),i,L(s)),n(a)}`}n=Uint8Array.prototype.toBase64?e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0})):e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let t=[];for(let i=0;i<e.byteLength;i+=32768)t.push(String.fromCharCode.apply(null,e.subarray(i,i+32768)));return btoa(t.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};class H extends Error{constructor(e){var t;super(null!=e?e:"operation not supported"),this.name=this.constructor.name,null==(t=Error.captureStackTrace)||t.call(Error,this,this.constructor)}}class G extends Error{constructor(e){var t;super(e),this.name=this.constructor.name,null==(t=Error.captureStackTrace)||t.call(Error,this,this.constructor)}}function J(e){return e instanceof CryptoKey}function X(e){return J(e)&&"public"===e.type}async function V(e,t,i,o,r,a){var s;let c=null==e?void 0:e.privateKey,u=null==e?void 0:e.publicKey;if(!J(c)||"private"!==c.type)throw TypeError('"keypair.privateKey" must be a private CryptoKey');if(!X(u))throw TypeError('"keypair.publicKey" must be a public CryptoKey');if(!0!==u.extractable)throw TypeError('"keypair.publicKey.extractable" must be true');if("string"!=typeof t)throw TypeError('"htu" must be a string');if("string"!=typeof i)throw TypeError('"htm" must be a string');if(void 0!==o&&"string"!=typeof o)throw TypeError('"nonce" must be a string or undefined');if(void 0!==r&&"string"!=typeof r)throw TypeError('"accessToken" must be a string or undefined');if(void 0!==a&&("object"!=typeof a||null===a||Array.isArray(a)))throw TypeError('"additional" must be an object');return W({alg:function(e){switch(e.algorithm.name){case"RSA-PSS":if("SHA-256"===e.algorithm.hash.name)return"PS256";throw new H("unsupported RsaHashedKeyAlgorithm hash name");case"RSASSA-PKCS1-v1_5":if("SHA-256"===e.algorithm.hash.name)return"RS256";throw new H("unsupported RsaHashedKeyAlgorithm hash name");case"ECDSA":if("P-256"===e.algorithm.namedCurve)return"ES256";throw new H("unsupported EcKeyAlgorithm namedCurve");case"Ed25519":return"Ed25519";default:throw new H("unsupported CryptoKey algorithm name")}}(c),typ:"dpop+jwt",jwk:await F(u)},Object.assign(Object.assign({},a),{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:i,nonce:o,htu:t,ath:r?(s=await crypto.subtle.digest("SHA-256",L(r)),n(s)):void 0}),c)}async function F(e){let{kty:t,e:i,n:n,x:o,y:r,crv:a}=await crypto.subtle.exportKey("jwk",e);return{kty:t,crv:a,e:i,n:n,x:o,y:r}}let M=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange"],Y=async(e,t)=>{let i=await fetch(e,t);return{ok:i.ok,json:await i.json(),headers:[...i.headers].reduce((e,[t,i])=>(e[t]=i,e),{})}},$=async(e,t,i)=>{let n,o=new AbortController;return t.signal=o.signal,Promise.race([Y(e,t),new Promise((e,t)=>{n=setTimeout(()=>{o.abort(),t(Error("Timeout when executing 'fetch'"))},i)})]).finally(()=>{clearTimeout(n)})},B=async(e,t,i,n,o,r,a,s)=>{var c;return c={auth:{audience:t,scope:i},timeout:o,fetchUrl:e,fetchOptions:n,useFormData:a,useMrrt:s},new Promise(function(e,t){let i=new MessageChannel;i.port1.onmessage=function(n){n.data.error?t(Error(n.data.error)):e(n.data),i.port1.close()},r.postMessage(c,[i.port2])})},q=async(e,t,i,n,o,r,a=1e4,s)=>o?B(e,t,i,n,a,o,r,s):$(e,n,a);async function Q(e,t,i,n,o,r,a,s,c,u){let l;if(c){let t=await c.generateProof({url:e,method:o.method||"GET",nonce:await c.getNonce()});o.headers=Object.assign(Object.assign({},o.headers),{dpop:t})}let h,p=null;for(let c=0;c<3;c++)try{h=await q(e,i,n,o,r,a,t,s),p=null;break}catch(e){p=e}if(p)throw p;let m=h.json,{error:f,error_description:y}=m,g=d(m,["error","error_description"]),{headers:w,ok:b}=h;if(c&&(l=w["dpop-nonce"])&&await c.setNonce(l),!b){let d=y||`HTTP error. Unable to fetch ${e}`;if("mfa_required"===f)throw new O(f,d,g.mfa_token);if("missing_refresh_token"===f)throw new T(i,n);if("use_dpop_nonce"===f){if(!c||!l||u)throw new E(l);return Q(e,t,i,n,o,r,a,s,c,!0)}throw new k(f||"request_error",d)}return g}async function ee(e,t){var i,{baseUrl:n,timeout:o,audience:r,scope:a,auth0Client:s,useFormData:c,useMrrt:u,dpop:l}=e,h=d(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);let p="urn:ietf:params:oauth:grant-type:token-exchange"===h.grant_type,m="refresh_token"===h.grant_type&&u,f=Object.assign(Object.assign(Object.assign(Object.assign({},h),p&&r&&{audience:r}),p&&a&&{scope:a}),m&&{audience:r,scope:a}),y=c?R(f):JSON.stringify(f),g=(i=h.grant_type,M.includes(i));return await Q(`${n}/oauth/token`,o,r||"default",a,{method:"POST",body:y,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(s||w))}},t,c,u,g?l:void 0)}let et=(...e)=>Array.from(new Set(e.filter(Boolean).join(" ").trim().split(/\s+/))).join(" ");class ei{constructor(e,t="@@auth0spajs@@",i){this.prefix=t,this.suffix=i,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(
1Boolean).join("::")}static fromKey(e){let[t,i,n,o]=e.split("::");return new ei({clientId:i,scope:o,audience:n},t)}static fromCacheEntry(e){let{scope:t,audience:i,client_id:n}=e;return new ei({scope:t,audience:i,clientId:n})}}class en{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(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}}class eo{constructor(){this.enclosedCache=function(){let e={};return{set(t,i){e[t]=i},get(t){let i=e[t];if(i)return i},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class er{constructor(e,t,i){this.cache=e,this.keyManifest=t,this.nowProvider=i||b}async setIdToken(e,t,i){var n;let o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:i}),await (null==(n=this.keyManifest)?void 0:n.add(o))}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);if(!t||!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e,t=0,i=!1,n){var o;let r=await this.cache.get(e.toKey());if(!r){let t=await this.getCacheKeys();if(!t)return;let o=this.matchExistingCacheKey(e,t);if(o&&(r=await this.cache.get(o)),!o&&i&&"cache-only"!==n)return this.getEntryWithRefreshToken(e,t)}if(!r)return;let a=Math.floor(await this.nowProvider()/1e3);return r.expiresAt-t<a?r.body.refresh_token?this.modifiedCachedEntry(r,e):(await this.cache.remove(e.toKey()),void await (null==(o=this.keyManifest)?void 0:o.remove(e.toKey()))):r.body}async modifiedCachedEntry(e,t){return e.body={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},await this.cache.set(t.toKey(),e),{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}async set(e){var t;let i=new ei({clientId:e.client_id,scope:e.scope,audience:e.audience}),n=await this.wrapCacheEntry(e);await this.cache.set(i.toKey(),n),await (null==(t=this.keyManifest)?void 0:t.add(i.toKey()))}async clear(e){var t;let i=await this.getCacheKeys();i&&(await i.filter(t=>!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await (null==(t=this.keyManifest)?void 0:t.clear()))}async wrapCacheEntry(e){return{body:e,expiresAt:Math.floor(await this.nowProvider()/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null==(e=await this.keyManifest.get())?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new ei({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var i;let n=ei.fromKey(t),o=new Set(n.scope&&n.scope.split(" ")),r=(null==(i=e.scope)?void 0:i.split(" "))||[],a=n.scope&&r.reduce((e,t)=>e&&o.has(t),!0);return"@@auth0spajs@@"===n.prefix&&n.clientId===e.clientId&&n.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var i;for(let n of t){let t=ei.fromKey(n);if("@@auth0spajs@@"===t.prefix&&t.clientId===e.clientId){let t=await this.cache.get(n);if(null==(i=null==t?void 0:t.body)?void 0:i.refresh_token)return this.modifiedCachedEntry(t,e)}}}async updateEntry(e,t){var i;let n=await this.getCacheKeys();if(n)for(let o of n){let n=await this.cache.get(o);if((null==(i=null==n?void 0:n.body)?void 0:i.refresh_token)===e){let e=Object.assign(Object.assign({},n.body),{refresh_token:t});await this.set(e)}}}}class ea{constructor(e,t,i){this.storage=e,this.clientId=t,this.cookieDomain=i,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})}}let es=["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"];var ec=m(function(e,t){var i=h&&h.__assign||function(){return(i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function n(e,t){if(!t)return"";var i="; "+e;return!0===t?i:i+"="+t}function o(e,t,i){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decode
1URIComponent).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("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return n("Expires",e.expires?e.expires.toUTCString():"")+n("Domain",e.domain)+n("Path",e.path)+n("Secure",e.secure)+n("SameSite",e.sameSite)}(i)}function r(e){for(var t={},i=e?e.split("; "):[],n=/(%[\dA-F]{2})+/gi,o=0;o<i.length;o++){var r=i[o].split("="),a=r.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[r[0].replace(n,decodeURIComponent)]=a.replace(n,decodeURIComponent)}catch(e){}}return t}function a(){return r(document.cookie)}function s(e,t,n){document.cookie=o(e,t,i({path:"/"},n))}t.__esModule=!0,t.encode=o,t.parse=r,t.getAll=a,t.get=function(e){return a()[e]},t.set=s,t.remove=function(e,t){s(e,"",i(i({},t),{expires:-1}))}});p(ec),ec.encode,ec.parse,ec.getAll;var eu=ec.get,el=ec.set,ed=ec.remove;let eh={get(e){let t=eu(e);if(void 0!==t)return JSON.parse(t)},save(e,t,i){let n={};"https:"===window.location.protocol&&(n={secure:!0,sameSite:"none"}),(null==i?void 0:i.daysUntilExpire)&&(n.expires=i.daysUntilExpire),(null==i?void 0:i.cookieDomain)&&(n.domain=i.cookieDomain),el(e,JSON.stringify(t),n)},remove(e,t){let i={};(null==t?void 0:t.cookieDomain)&&(i.domain=t.cookieDomain),ed(e,i)}},ep={get:e=>eh.get(e)||eh.get(`_legacy_${e}`),save(e,t,i){let n={};"https:"===window.location.protocol&&(n={secure:!0}),(null==i?void 0:i.daysUntilExpire)&&(n.expires=i.daysUntilExpire),(null==i?void 0:i.cookieDomain)&&(n.domain=i.cookieDomain),el(`_legacy_${e}`,JSON.stringify(t),n),eh.save(e,t,i)},remove(e,t){let i={};(null==t?void 0:t.cookieDomain)&&(i.domain=t.cookieDomain),ed(e,i),eh.remove(e,t),eh.remove(`_legacy_${e}`,t)}},em={get(e){if("undefined"==typeof sessionStorage)return;let t=sessionStorage.getItem(e);return null!=t?JSON.parse(t):void 0},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};!function(e){e.Code="code",e.ConnectCode="connect_code"}(ef||(ef={}));var ef,ey,eg=function(e){var t,i,n;return new Worker(ey=ey||(i=(t=function(e,t){var i=atob(e);if(t){for(var n=new Uint8Array(i.length),o=0,r=i.length;o<r;++o)n[o]=i.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(n.buffer))}return i}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YSx1c2VNcnJ0OmZ9LHBvcnRzOltwXX0pPT57bGV0IGgsdSxsPXt9O2NvbnN0e2F1ZGllbmNlOmQsc2NvcGU6eX09cnx8e307dHJ5e2NvbnN0IHI9YT8oZT0+e2NvbnN0IHQ9bmV3IFVSTFNlYXJjaFBhcmFtcyhlKSxyPXt9O3JldHVybiB0LmZvckVhY2goKChlLHQpPT57clt0XT1lfSkpLHJ9KShjLmJvZHkpOkpTT04ucGFyc2UoYy5ib2R5KTtpZighci5yZWZyZXNoX3Rva2VuJiYicmVmcmVzaF90b2tlbiI9PT1yLmdyYW50X3R5cGUpe2lmKHU9KChlLHQpPT5vW24oZSx0KV0pKGQseSksIXUmJmYpe2NvbnN0IGU9by5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+e2NvbnN0IHI9T2JqZWN0LmtleXMobykuZmluZCgocj0+e2lmKCJsYXRlc3RfcmVmcmVzaF90b2tlbiIhPT1yKXtjb25zdCBzPSgoZSx0KT0+dC5zdGFydHNXaXRoKGAke2V9fGApKSh0LHIpLG89ci5zcGxpdCgifCIpWzFdLnNwbGl0KCIgIiksbj1lLnNwbGl0KCIgIikuZXZlcnkoKGU9Pm8uaW5jbHVkZXMoZSkpKTtyZXR1cm4gcyYmbn19KSk7cmV0dXJuISFyfSkoeSxkKTtlJiYhdCYmKHU9ZSl9aWYoIXUpdGhyb3cgbmV3IHQoZCx5KTtjLmJvZHk9YT9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fS
1xyKSx7cmVmcmVzaF90b2tlbjp1fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpfWxldCBqLGs7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGo9bmV3IEFib3J0Q29udHJvbGxlcixjLnNpZ25hbD1qLnNpZ25hbCk7dHJ5e2s9YXdhaXQgUHJvbWlzZS5yYWNlKFsoXz1lLG5ldyBQcm9taXNlKChlPT5zZXRUaW1lb3V0KGUsXykpKSksZmV0Y2goaSxPYmplY3QuYXNzaWduKHt9LGMpKV0pfWNhdGNoKGUpe3JldHVybiB2b2lkIHAucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfWlmKCFrKXJldHVybiBqJiZqLmFib3J0KCksdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjoiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIn0pO2c9ay5oZWFkZXJzLGw9Wy4uLmddLnJlZHVjZSgoKGUsW3Qscl0pPT4oZVt0XT1yLGUpKSx7fSksaD1hd2FpdCBrLmpzb24oKSxoLnJlZnJlc2hfdG9rZW4/KGYmJihvLmxhdGVzdF9yZWZyZXNoX3Rva2VuPWgucmVmcmVzaF90b2tlbixPPXUsYj1oLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVudHJpZXMobykuZm9yRWFjaCgoKFtlLHRdKT0+e3Q9PT1PJiYob1tlXT1iKX0pKSksKChlLHQscik9PntvW24odCxyKV09ZX0pKGgucmVmcmVzaF90b2tlbixkLHkpLGRlbGV0ZSBoLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KShkLHkpLHAucG9zdE1lc3NhZ2Uoe29rOmsub2ssanNvbjpoLGhlYWRlcnM6bH0pfWNhdGNoKGUpe3AucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmx9KX12YXIgTyxiLGcsX30pKX0oKTsKCg==",!1)).indexOf("\n",10)+1,n=new Blob([t.substring(i)+""],{type:"application/javascript"}),URL.createObjectURL(n)),e)};let ew={};class eb{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;let i=new Set((null==(t=await this.cache.get(this.manifestKey))?void 0:t.keys)||[]);i.add(e),await this.cache.set(this.manifestKey,{keys:[...i]})}async remove(e){let t=await this.cache.get(this.manifestKey);if(t){let i=new Set(t.keys);return i.delete(e),i.size>0?await this.cache.set(this.manifestKey,{keys:[...i]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}}let ek={memory:()=>(new eo).enclosedCache,localstorage:()=>new en},ev=e=>ek[e],e_=e=>{let{openUrl:t,onRedirect:i}=e;return Object.assign(Object.assign({},d(e,["openUrl","onRedirect"])),{openUrl:!1===t||t?t:i})},eS=(e,t)=>{let i=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>i.includes(e))},eI={NONCE:"nonce",KEYPAIR:"keypair"};class eP{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){let e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,i)=>{e.onupgradeneeded=()=>Object.values(eI).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>i(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,t,i){let n=i((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}buildKey(e){let t=e?`_${e}`:"auth0";return`${this.clientId}::${t}`}setNonce(e,t){return this.save(eI.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(eI.KEYPAIR,this.buildKey(),e)}async save(e,t,i){await this.executeDbRequest(e,"readwrite",e=>e.put(i,t))}findNonce(e){return this.find(eI.NONCE,this.buildKey(e))}findKeyPair(){return this.find(eI.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){let i=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());null==i||i.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t)))}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith(`${t}::`))}clearNonces(){return this.deleteByClientId(eI.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(eI.KEYPAIR,this.clientId)}}class eO{constructor(e){this.storage=new eP(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 async function(e,t){var i;let n;if("string"!=typeof e||0===e.length)throw TypeError('"alg" must be a non-empty string');switch(e){case"PS256":n={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":n={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":n={name:"Ed25519"};break;default:throw new H}return crypto.subtle.generateKey(n,null!=(i=null==t?void 0:t.extractable)&&i,["sign","verify"])}("ES256",{extractable:!1}),await this.storage.setKeyPair(e)),e}async generateProof(e){return function({keyPair:e,url:t,method:i,nonce:n,accessToken:o}){return V(e,function(e){let t=new URL(e);return t.search="",t.hash="",t.href}(t),i,n,o)}(Object.assign({keyPair:await this.getOrGenerateKeyPair()},e))}async calculateThumbprint(){return async function(e){var t;let i;if(!X(e))throw TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw TypeError('"publicKey.extractable" must be true');let o=await F(e);switch(o.kty){case"EC":i={crv:o.crv,kty:o.kty,x:o.x,y:o.y};break;case"OKP":i={crv:o.crv,kty:o.kty,x:o.x};break;case"RSA":i={e:o.e,kty:o.kty,n:o.n};break;default:throw new H("unsupported JWK kty")}return t=await crypto.subtle.digest({name:"SHA-256"},L(JSON.stringify(i))),n(t)}((await this.getOrGenerateKeyPair()).publicKey)}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(o||(o={}));class eT{constructor(e,t){this.hooks=t,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||("undefined"==typeof window?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)}extractUrl(e){return"string"==typeof e?e:e instanceof URL?e.href:e.url}
1buildBaseRequest(e,t){if(!this.config.baseUrl)return new Request(e,t);let i=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),n=e instanceof Request?new Request(i,e):i;return new Request(n,t)}setAuthorizationHeader(e,t,i=o.Bearer){e.headers.set("authorization",`${i} ${t}`)}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;let i=await this.hooks.getDpopNonce(),n=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:i,url:e.url});e.headers.set("dpop",n)}async prepareRequest(e,t){let i,n,r=await this.getAccessToken(t);"string"==typeof r?(i=this.config.dpopNonceId?o.DPoP:o.Bearer,n=r):(i=r.token_type,n=r.access_token),this.setAuthorizationHeader(e,n,i),i===o.DPoP&&await this.setDpopProofHeader(e,n)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;let t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){let i=this.getHeader(e.headers,"dpop-nonce");if(i&&await this.hooks.setDpopNonce(i),!this.hasUseDpopNonceError(e))return e;if(!i||!t.onUseDpopNonceError)throw new E(i);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,i,n){let o=this.buildBaseRequest(e,t);await this.prepareRequest(o,n);let r=await this.config.fetch(o);return this.handleResponse(r,i)}fetchWithAuth(e,t,i){let n={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},n),{onUseDpopNonceError:void 0}),i)};return this.internalFetchWithAuth(e,t,n,i)}}class eC{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){let t=await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){let t=await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(i){throw new eE({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(i)})}if(e.ok)return t;throw new eE(t)}}class eE extends Error{constructor({type:e,status:t,title:i,detail:n,validation_errors:o}){super(n),this.name="MyAccountApiError",this.type=e,this.status=t,this.title=i,this.detail=n,this.validation_errors=o,Object.setPrototypeOf(this,eE.prototype)}}let ej=new y;class ex{constructor(e){var t;let i,n,o;if(this.userCache=(new eo).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await ej.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!window.crypto)throw Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===window.crypto.subtle)throw Error("\n      auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n    ")})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(!ev(i=e.cacheLocation||"memory"))throw Error(`Invalid cache location "${i}"`);n=ev(i)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?eh:ep,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(o=this.options.clientId,`auth0.${o}.is.authenticated`),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;let r=e.useCookiesForTransactions?this.cookieStorage:em;this.scope=et("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new ea(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||b,this.cacheManager=new er(n,n.allKeys?void 0:new eb(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new eO(this.options.clientId):void 0,this.domainUrl=(t=this.options.domain,/^https?:\/\//.test(t)?t:`https://${t}`),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:`https://${e}/`:`${t}/`)(this.options.issuer,this.domainUrl);let a=`${this.domainUrl}/me/`,s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new eC(s,a),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===i&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new eg)}_url(e){let t=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||w)));return`${this.domainUrl}${e}&auth0Client=${t}`}_authorizeUrl(e){return this._url(`/authorize?${R(e)}`)}async _verifyIdToken(e,t,i){var n;let o=await this.nowProvider();return(e=>{if(!e.id_token)throw Error("ID token is required but missing");let t=(e=>{let t=e.split("."),[i,n,o]=t;if(3!==t.length||!i||!n||!o)throw Error("ID token could not be decoded");let r=JSON.parse(N(n)),a={__raw:e},s={};
1return Object.keys(r).forEach(e=>{a[e]=r[e],es.includes(e)||(s[e]=r[e])}),{encoded:{header:i,payload:n,signature:o},header:JSON.parse(N(i)),claims:a,user:s}})(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("RS256"!==t.header.alg)throw Error(`Signature algorithm of "${t.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!t.claims.aud||"string"!=typeof t.claims.aud&&!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&&"number"!=typeof 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(null==t.claims.exp||"number"!=typeof t.claims.exp)throw Error("Expiration Time (exp) claim must be a number present in the ID token");if("number"!=typeof t.claims.iat)throw Error("Issued At (iat) claim must be a number present in the ID token");let i=e.leeway||60,n=new Date(e.now||Date.now()),o=new Date(0);if(o.setUTCSeconds(t.claims.exp+i),n>o)throw Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${o})`);if(null!=t.claims.nbf&&"number"==typeof t.claims.nbf){let e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-i),n<e)throw Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${n}) is before ${e}`)}if(null!=t.claims.auth_time&&"number"==typeof t.claims.auth_time){let o=new Date(0);if(o.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+i),n>o)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 (${n}) is after last auth at ${o}`)}if(e.organization){let i=e.organization.trim();if(i.startsWith("org_")){if(!t.claims.org_id)throw Error("Organization ID (org_id) claim must be a string present in the ID token");if(i!==t.claims.org_id)throw Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${i}", found "${t.claims.org_id}"`)}else{let e=i.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})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:i,leeway:this.options.leeway,max_age:"string"!=typeof(n=this.options.authorizationParams.max_age)?n:parseInt(n,10)||void 0,now:o})}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,t,i){var n;let o,r,a,s,c=K(x()),u=K(x()),l=x(),d=A(await z(l)),h=await (null==(n=this.dpop)?void 0:n.calculateThumbprint()),p=(o=this.options,r=this.scope,a=e.redirect_uri||this.options.authorizationParams.redirect_uri||i,s=null==t?void 0:t.response_mode,Object.assign(Object.assign(Object.assign({client_id:o.clientId},o.authorizationParams),e),{scope:et(r,e.scope),response_type:"code",response_mode:s||"query",state:c,nonce:u,redirect_uri:a||o.authorizationParams.redirect_uri,code_challenge:d,code_challenge_method:"S256",dpop_jkt:h})),m=this._authorizeUrl(p);return{nonce:u,code_verifier:l,scope:p.scope,audience:p.audience||"default",redirect_uri:p.redirect_uri,state:c,url:m}}async loginWithPopup(e,t){var i;let n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(e=>{let t=window.screenX+(window.innerWidth-400)/2,i=window.screenY+(window.innerHeight-600)/2;return window.open(e,"auth0:authorize:popup",`left=${t},top=${i},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!t.popup))throw Error("Unable to open a popup for loginWithPopup - window.open returned `null`");let o=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=o.url;let r=await (n=Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new Promise((e,t)=>
1{let i,o=setInterval(()=>{n.popup&&n.popup.closed&&(clearInterval(o),clearTimeout(r),window.removeEventListener("message",i,!1),t(new P(n.popup)))},1e3),r=setTimeout(()=>{clearInterval(o),t(new I(n.popup)),window.removeEventListener("message",i,!1)},1e3*(n.timeoutInSeconds||60));i=function(a){if(a.data&&"authorization_response"===a.data.type){if(clearTimeout(r),clearInterval(o),window.removeEventListener("message",i,!1),n.popup.close(),a.data.response.error)return t(k.fromPayload(a.data.response));e(a.data.response)}},window.addEventListener("message",i)}));if(o.state!==r.state)throw new k("state_mismatch","Invalid state");let a=(null==(i=e.authorizationParams)?void 0:i.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:r.code,redirect_uri:o.redirect_uri},{nonceIn:o.nonce,organization:a})}async getUser(){var e;let t=await this._getIdTokenFromCache();return null==(e=null==t?void 0:t.decodedToken)?void 0:e.user}async getIdTokenClaims(){var e;let t=await this._getIdTokenFromCache();return null==(e=null==t?void 0:t.decodedToken)?void 0:e.claims}async loginWithRedirect(e={}){var t;let i=e_(e),{openUrl:n,fragment:o,appState:r}=i,a=d(i,["openUrl","fragment","appState"]),s=(null==(t=a.authorizationParams)?void 0:t.organization)||this.options.authorizationParams.organization,c=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:u}=c,l=d(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},l),{appState:r,response_type:ef.Code}),s&&{organization:s}));let h=o?`${u}#${o}`:u;n?await n(h):window.location.assign(h)}async handleRedirectCallback(e=window.location.href){let t=e.split("?").slice(1);if(0===t.length)throw Error("There are no query params available for parsing.");let i=this.transactionManager.get();if(!i)throw new k("missing_transaction","Invalid state");this.transactionManager.remove();let n=(e=>{e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));let t=new URLSearchParams(e);return{state:t.get("state"),code:t.get("code")||void 0,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(t.join(""));return i.response_type===ef.ConnectCode?this._handleConnectAccountRedirectCallback(n,i):this._handleLoginRedirectCallback(n,i)}async _handleLoginRedirectCallback(e,t){let{code:i,state:n,error:o,error_description:r}=e;if(o)throw new v(o,r||o,n,t.appState);if(!t.code_verifier||t.state&&t.state!==n)throw new k("state_mismatch","Invalid state");let a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(Object.assign({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:i},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:ef.Code}}async _handleConnectAccountRedirectCallback(e,t){let{connect_code:i,state:n,error:o,error_description:r}=e;if(o)throw new _(o,r||o,t.connection,n,t.appState);if(!i)throw new k("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===n))throw new k("state_mismatch","Invalid state");return Object.assign(Object.assign({},await this.myAccountApi.completeAccount({auth_session:t.auth_session,connect_code:i,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier})),{appState:t.appState,response_type:ef.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(e={}){var t,i,n;let o,r=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:et(this.scope,null==(t=e.authorizationParams)?void 0:t.scope)})}),a=await (i=()=>this._getTokenSilently(r),(o=ew[n=`${this.options.clientId}::${r.authorizationParams.audience}::${r.authorizationParams.scope}`])||(o=i().finally(()=>{delete ew[n],o=null}),ew[n]=o),o);return e.detailedResponse?a:null==a?void 0:a.access_token}async _getTokenSilently(e){let{cacheMode:t}=e,i=d(e,["cacheMode"]);if("off"!==t){let e=await this._getEntryFromCache({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"!==t){if(!await (async(e,t=3)=>{for(let i=0;i<t;i++)if(await e())return!0;return!1})(()=>ej.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new S;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),"off"!==t){let e=await this._getEntryFromCache({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId});if(e)return e}let{id_token:e,token_type:n,access_token:o,oauthTokenScope:r,expires_in:a}=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(i):await this._getTokenFromIFrame(i);return Object.assign(Object.assign({id_token:e,token_type:n,access_token:o},r?{scope:r}:null),{expires_in:a})}finally{await ej.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},t={}){var i;let n=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:et(this.scope,null==(i=e.authorizationParams)?void 0:i.scope)})});return t=Object.assign(Object.assign({},g),t),await this.loginWithPopup(n,t),(await this.cacheManager.get(new ei({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;let t=e.logoutParams||{},{federated:i}=t,n=d(t,["federated"]);return this._url(`/v2/logout?${R(Object.assign({clientId:e.clientId},n))}`)+(i?"&federated":"")}async logout(e={}){var t;let i=e_(e),{openUrl:n}=i,o=d(i,["openUrl"]);null===e.clientId?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@"),await (null==(t=this.dpop)?void 0:t.clear());let r=this._buildLogoutUrl(o);n?await n(r):!1!==n&&window.location.assign(r)}async _getTokenFromIFrame(e){let t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),i=this.cookieStorage.get(this.orgHintCookieName);i&&!t.organization&&(t.organization=i);let{url:n,state:o,nonce:r,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);try{let i;if(window.crossOriginIsolated)throw new k("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");let l=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;try{i=new URL(this.domainUrl).origin}catch(e){i=this.domainUrl}let d=await ((e,t,i=60)=>new Promise((n,o)=>{let r,a=window.document.createElement("iframe");a.setAttribute("width","0"),a.setAttribute("height","0"),a.style.display="none";let s=()=>{window.document.body.contains(a)&&(window.document.body.removeChild(a),window.removeEventListener("message",r,!1))},c=setTimeout(()=>{o(new S),s()},1e3*i);r=function(e){if(e.origin!=t||!e.data||"authorization_response"!==e.data.type)return;let i=e.source;i&&i.close(),e.data.response.error?o(k.fromPayload(e.data.response)):n(e.data.response),clearTimeout(c),window.removeEventListener("message",r,!1),setTimeout(s,2e3)},window.addEventListener("message",r,!1),window.document.body.appendChild(a),a.setAttribute("src",e)}))(n,i,l);if(o!==d.state)throw new k("state_mismatch","Invalid state");let h=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:a,code:d.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:r,organization:t.organization});return Object.assign(Object.assign({},h),{scope:c,oauthTokenScope:h.scope,audience:u})}catch(e){throw"login_required"===e.error&&this.logout({openUrl:!1}),e}}async _getTokenUsingRefreshToken(e){var t,i,n,o;let r=await this.cacheManager.get(new ei({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new T(e.authorizationParams.audience||"default",e.authorizationParams.scope)}let a=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,s="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,c=((e,t,i,n)=>{var o;
1if(e&&i&&n){if(t.audience!==i)return t.scope;let e=n.split(" "),r=(null==(o=t.scope)?void 0:o.split(" "))||[],a=r.every(t=>e.includes(t));return e.length>=r.length&&a?n:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==r?void 0:r.audience,null==r?void 0:r.scope);try{let u=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:a}),s&&{timeout:s}),{scopesToRequest:c});if(u.refresh_token&&this.options.useMrrt&&(null==r?void 0:r.refresh_token)&&await this.cacheManager.updateEntry(r.refresh_token,u.refresh_token),this.options.useMrrt&&(t=null==r?void 0:r.audience,i=null==r?void 0:r.scope,n=e.authorizationParams.audience,o=e.authorizationParams.scope,t!==n||!eS(o,i))&&!eS(c,u.scope)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);let t=((e,t)=>{let i=(null==e?void 0:e.split(" "))||[],n=(null==t?void 0:t.split(" "))||[];return i.filter(e=>-1==n.indexOf(e)).join(",")})(c,u.scope);throw new C(e.authorizationParams.audience||"default",t)}return Object.assign(Object.assign({},u),{scope:e.authorizationParams.scope,oauthTokenScope:u.scope,audience:e.authorizationParams.audience||"default"})}catch(t){if((t.message.indexOf("Missing Refresh Token")>-1||t.message&&t.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw t}}async _saveEntryInCache(e){let{id_token:t,decodedToken:i}=e,n=d(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:t,decodedToken:i}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(n)}async _getIdTokenFromCache(){let e=this.options.authorizationParams.audience||"default",t=await this.cacheManager.getIdToken(new ei({clientId:this.options.clientId,audience:e,scope:this.scope})),i=this.userCache.get("@@user@@");return t&&t.id_token===(null==i?void 0:i.id_token)?i:(this.userCache.set("@@user@@",t),t)}async _getEntryFromCache({scope:e,audience:t,clientId:i,cacheMode:n}){let o=await this.cacheManager.get(new ei({scope:e,audience:t,clientId:i}),60,this.options.useMrrt,n);if(o&&o.access_token){let{token_type:e,access_token:t,oauthTokenScope:i,expires_in:n}=o,r=await this._getIdTokenFromCache();return r&&Object.assign(Object.assign({id_token:r.id_token,token_type:e||"Bearer",access_token:t},i?{scope:i}:null),{expires_in:n})}}async _requestToken(e,t){let{nonceIn:i,organization:n,scopesToRequest:o}=t||{},r=await ee(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{scope:o||e.scope}),this.worker),a=await this._verifyIdToken(r.id_token,i,n);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},r),{decodedToken:a,scope:e.scope,audience:e.audience||"default"}),r.scope?{oauthTokenScope:r.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(n||a.claims.org_id),Object.assign(Object.assign({},r),{decodedToken:a})}async exchangeToken(e){return this._requestToken({grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:et(e.scope,this.scope),audience:e.audience||this.options.authorizationParams.audience})}_assertDpop(e){if(!e)throw Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,t){return this._assertDpop(this.dpop),this.dpop.setNonce(e,t)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(e={}){return new eT(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null==(t=null==e?void 0:e.scope)?void 0:t.join(" "),audience:null==e?void 0:e.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:t=>this.setDpopNonce(t,e.dpopNonceId),generateDpopProof:e=>this.generateDpopProof(e)})}async connectAccountWithRedirect(e){let{openUrl:t,appState:i,connection:n,authorization_params:o,redirectUri:r=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!n)throw Error("connection is required");let a=K(x()),s=x(),c=A(await z(s)),{connect_uri:u,connect_params:l,auth_session:d}=await this.myAccountApi.connectAccount({connection:n,redirect_uri:r,state:a,code_challenge:c,code_challenge_method:"S256",authorization_params:o});this.transactionManager.create({state:a,code_verifier:s,auth_session:d,redirect_uri:r,appState:i,connection:n,response_type:ef.ConnectCode});let h=new URL(u);h.searchParams.set("ticket",l.ticket),t?await t(h.toString()):window.location.assign(h)}}var eK={isAuthenticated:!1,isLoading:!0,error:void 0,user:void 0},eR=function(){throw Error("You forgot to wrap your component in <Auth0Provider>.")},ez=s(s({},eK),{buildAuthorizeUrl:eR,buildLogoutUrl:eR,getAccessTokenSilently:eR,getAccessTokenWithPopup:eR,getIdTokenClaims:eR,loginWithRedirect:eR,loginWithPopup:eR,connectAccountWithRedirect:eR,logout:eR,handleRedirectCallback:eR,getDpopNonce:eR,setDpopNonce:eR,generateDpopProof:eR,createFetcher:eR}),eN=(0,r.createContext)(ez),eA=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=i}function i(t,n){var o=e.call(this,null!=n?n:t)||this;return o.error=t,o.error_description=n,Object.setPrototypeOf(o,i.prototype),o}return a(i,e),i.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),i}(Error),eU=/[?&](?:connect_)?code=[^&]+/,eD=/[?&]state=[^&]+/,eL=/[?&]error=[^&]+/,eZ=function(e){return function(t){return t instanceof Error?t:null!==t&&"object"==typeof t&&"error"in t&&"string"==typeof t.error?"error_description"in t&&"string"==typeof t.error_description?new eA(t.error,t.error_description):new eA(t.error):Error(e)}},eW=eZ("Login failed"),eH=eZ("Get access token failed"),eG=function(e){var t,i;(null==e?void 0:e.redirectUri)&&(console.warn("Using `redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `redirectUri` will be no longer supported in a future version"),e.authorizationParams=null!=(t=e.authorizationParams)?t:{},e.authorizationParams.redirect_uri=e.redirectUri,delete e.redirectUri),(null==(i=null==e?void 0:e.authorizationParams)?void 0:i.redirectUri)&&(console.warn("Using `authorizationParams.redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `authorizationParams.redirectUri` will be removed in a future version"),e.authorizationParams.redirect_uri=e.authorizationParams.redirectUri,delete e.authorizationParams.redirectUri)},eJ=function(e,t){switch(t.type){case"LOGIN_POPUP_STARTED":return s(s({},e),{isLoading:!0});case"LOGIN_POPUP_COMPLETE":case"INITIALISED":return s(s({},e),{isAuthenticated:!!t.user,user:t.user,isLoading:!1,error:void 0});case"HANDLE_REDIRECT_COMPLETE":case"GET_ACCESS_TOKEN_COMPLETE":if(e.user===t.user)return e;return s(s({},e),{isAuthenticated:!!t.user,user:t.user});case"LOGOUT":return s(s({},e),{isAuthenticated:!1,user:void 0});case"ERROR":return s(s({},e),{isLoading:!1,error:t.error})}},eX=function(e){var t;window.history.replaceState({},document.title,null!=(t=e.returnTo)?t:window.location.pathname)},eV=function(e){var t=e.children,i=e.skipRedirectCallback,n=e.onRedirectCallback,o=void 0===n?eX:n,a=e.context,d=void 0===a?eN:a,h=c(e,["children","skipRedirectCallback","onRedirectCallback","context"]),p=(0,r.useState)(function(){return new ex((eG(h),s(s({},h),{auth0Client:{name:"auth0-react",version:"2.8.0"}})))})[0],m=(0,r.useReducer)(eJ,eK),f=m[0],y=m[1],g=(0,r.useRef)(!1),w=(0,r.useCallback)(function(e){return y({type:"ERROR",error:e}),e},[]);(0,r.useEffect)(function(){g.current||(g.current=!0,u(void 0,void 0,void 0,function(){var e,t,n,r,a,s;return l(this,function(u){switch(u.label){case 0:var l;if(u.trys.push([0,7,,8]),e=void 0,void 0===l&&(l=window.location.search),!((eU.test(l)||eL.test(l))&&eD.test(l))||i)return[3,3];return[4,p.handleRedirectCallback()];case 1:return r=void 0===(n=(t=u.sent()).appState)?{}:n,a=t.response_type,s=c(t,["appState","response_type"]),[4,p.getUser()];case 2:return e=u.sent(),r.response_type=a,a===ef.ConnectCode&&(r.connectedAccount=s),o(r,e),[3,6];case 3:return[4,p.checkSession()];case 4:return u.sent(),[4,p.getUser()];case 5:e=u.sent(),u.label=6;case 6:return y({type:"INITIALISED",user:e}),[3,8];case 7:return w(eW(u.sent())),[3,8];case 8:return[2]}})}))},[p,o,i,w]);var b=(0,r.useCallback)(function(e){return eG(e),p.loginWithRedirect(e)},[p]),k=(0,r.useCallback)(function(e,t){return u(void 0,void 0,void 0,function(){return l(this,function(i){switch(i.label){case 0:y({type:"LOGIN_POPUP_STARTED"}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,p.loginWithPopup(e,t)];case 2:return i.sent(),[3,4];case 3:return w(eW(i.sent())),[2];case 4:return[4,p.getUser()];case 5:return y({type:"LOGIN_POPUP_COMPLETE",user:i.sent()}),[2]}})})},[p,w]),v=(0,r.useCallback)(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return u(void 0,function(e,t,i){if(i||2==arguments.length)for(var n,o=0,r=t.length;o<r;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([],e,!0),void 0,function(e){return void 0===e&&(e={}),l(this,function(t){switch(t.label){case 0:return[4,p.logout(e)];case 1:return t.sent(),(e.openUrl||!1===e.openUrl)&&y({type:"LOGOUT"}),[2]}})})},[p]),_=(0,r.useCallback)(function(e){return u(void 0,void 0,void 0,function(){var t,i,n;return l(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,3,5]),[4,p.getTokenSilently(e)];case 1:return t=o.sent(),[3,5];case 2:throw eH(o.sent());case 3:return i=y,n={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,p.getUser()];case 4:return i.apply(void 0,[(n.user=o.sent(),n)]),[7];case 5:return[2,t]}})})},[p]),S=(0,r.useCallback)(function(e,t){return u(void 0,void 0,void 0,function(){var i,n,o;return l(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,3,5]),[4,p.getTokenWithPopup(e,t)];case 1:return i=r.sent(),[3,5];case 2:throw eH(r.sent());case 3:return n=y,o={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,p.getUser()];case 4:return n.apply(void 0,[(o.user=r.sent(),o)]),[7];case 5:return[2,i]}})})},[p]),I=(0,r.useCallback)(function(e){return p.connectAccountWithRedirect(e)},[p]),P=(0,r.useCallback)(function(){return p.getIdTokenClaims()},[p]),O=(0,r.useCallback)(function(e){return u(void 0,void 0,void 0,function(){var t,i;return l(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,3,5]),[4,p.handleRedirectCallback(e)];case 1:return[2,n.sent()];case 2:throw eH(n.sent());case 3:return t=y,i={type:"HANDLE_REDIRECT_COMPLETE"},[4,p.getUser()];case 4:return t.apply(void 0,[(i.user=n.sent(),i)]),[7];case 5:return[2]}})})},[p]),T=(0,r.useCallback)(function(e){return p.getDpopNonce(e)},[p]),C=(0,r.useCallback)(function(e,t){return p.setDpopNonce(e,t)},[p]),E=(0,r.useCallback)(function(e){return p.generateDpopProof(e)},[p]),j=(0,r.useCallback)(function(e){return p.createFetcher(e)},[p]),x=(0,r.useMemo)(function(){return s(s({},f),{getAccessTokenSilently:_,getAccessTokenWithPopup:S,getIdTokenClaims:P,loginWithRedirect:b,loginWithPopup:k,connectAccountWithRedirect:I,logout:v,handleRedirectCallback:O,getDpopNonce:T,setDpopNonce:C,generateDpopProof:E,createFetcher:j})},[f,_,S,P,b,k,I,v,O,T,C,E,j]);return r.createElement(d.Provider,{value:x},t)},eF=function(e){return void 0===e&&(e=eN),(0,r.useContext)(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.