/*! For license information please see 340.js.LICENSE.txt */ "use strict";(self.webpackChunknuovisoldi_webapp=self.webpackChunknuovisoldi_webapp||[]).push([[340],{100:(e,t,n)=>{n.d(t,{D3:()=>ye,tw:()=>ge});var r=n(294),o=function(e,t){return o=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])},o(e,t)},a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0?setTimeout(n,t):n(null)}}window.addEventListener("storage",i),e.addToWaiting(i);var l=setTimeout(i,Math.max(0,t-Date.now()))}))];case 1:return n.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 n(this,void 0,void 0,(function(){return r(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 n(this,void 0,void 0,(function(){var n,o,l,s;return r(this,(function(r){switch(r.label){case 0:return n=void 0===this.storageHandler?i:this.storageHandler,o=a+"-"+t,null===(l=n.getItemSync(o))?[2]:(s=JSON.parse(l)).id!==this.id?[3,2]:[4,f.default().lock(s.iat)];case 1:r.sent(),this.acquiredIatSet.delete(s.iat),n.removeItemSync(o),f.default().unlock(s.iat),e.notifyWaiters(),r.label=2;case 2:return[2]}}))}))},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var l=r.keySync(i);if(null===l)break;o.push(l),i++}for(var s=!1,u=0;uDate.now();class g extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,g.prototype)}static fromPayload({error:e,error_description:t}){return new g(e,t)}}class y extends g{constructor(e,t,n,r=null){super(e,t),this.state=n,this.appState=r,Object.setPrototypeOf(this,y.prototype)}}class b extends g{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,b.prototype)}}class w extends b{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,w.prototype)}}class k extends g{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,k.prototype)}}class S extends g{constructor(e,t,n){super(e,t),this.mfa_token=n,Object.setPrototypeOf(this,S.prototype)}}class E extends g{constructor(e,t){super("missing_refresh_token",`Missing Refresh Token (audience: '${x(e,["default"])}', scope: '${x(t)}')`),this.audience=e,this.scope=t,Object.setPrototypeOf(this,E.prototype)}}function x(e,t=[]){return e&&!t.includes(e)?e:""}const C=()=>window.crypto,_=()=>{let e="";return Array.from(C().getRandomValues(new Uint8Array(43))).forEach((t=>e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[t%66])),e},P=e=>btoa(e),T=e=>{var{clientId:t}=e,n=s(e,["clientId"]);return new URLSearchParams((e=>Object.keys(e).filter((t=>void 0!==e[t])).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:e[n]})),{}))(Object.assign({client_id:t},n))).toString()},R=e=>(e=>decodeURIComponent(atob(e).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),O=async(e,t)=>{const n=await fetch(e,t);return{ok:n.ok,json:await n.json()}},L=async(e,t,n,r,o,a,i=1e4)=>o?(async(e,t,n,r,o,a,i)=>{return l={auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:i},s=a,new Promise((function(e,t){const n=new MessageChannel;n.port1.onmessage=function(r){r.data.error?t(new Error(r.data.error)):e(r.data),n.port1.close()},s.postMessage(l,[n.port2])}));var l,s})(e,t,n,r,i,o,a):(async(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([O(e,t),new Promise(((e,t)=>{o=setTimeout((()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))}),n)}))]).finally((()=>{clearTimeout(o)}))})(e,r,i);async function N(e,t){var{baseUrl:n,timeout:r,audience:o,scope:a,auth0Client:i,useFormData:l}=e,u=s(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const c=l?T(u):JSON.stringify(u);return await async function(e,t,n,r,o,a,i){let l,u=null;for(let s=0;s<3;s++)try{l=await L(e,n,r,o,a,i,t),u=null;break}catch(e){u=e}if(u)throw u;const c=l.json,{error:d,error_description:f}=c,p=s(c,["error","error_description"]),{ok:h}=l;if(!h){const t=f||`HTTP error. Unable to fetch ${e}`;if("mfa_required"===d)throw new S(d,t,p.mfa_token);if("missing_refresh_token"===d)throw new E(n,r);throw new g(d||"request_error",t)}return p}(`${n}/oauth/token`,r,o||"default",a,{method:"POST",body:c,headers:{"Content-Type":l?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(i||m))}},t,l)}const I=(...e)=>{return(t=e.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(t))).join(" ");var t};class D{constructor(e,t="@@auth0spajs@@",n){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(e){const[t,n,r,o]=e.split("::");return new D({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new D({scope:t,audience:n,clientId:r})}}class z{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const 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 M{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class A{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||v}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!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){var n;let r=await this.cache.get(e.toKey());if(!r){const t=await this.getCacheKeys();if(!t)return;const n=this.matchExistingCacheKey(e,t);n&&(r=await this.cache.get(n))}if(!r)return;const o=await this.nowProvider(),a=Math.floor(o/1e3);return r.expiresAt-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?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new D({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter((t=>{var n;const r=D.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),a=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],i=r.scope&&a.reduce(((e,t)=>e&&o.has(t)),!0);return"@@auth0spajs@@"===r.prefix&&r.clientId===e.clientId&&r.audience===e.audience&&i}))[0]}}class U{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})}}const j=e=>"number"==typeof e,F=["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 W=d((function(e,t){var n=u&&u.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n$.get(e)||$.get(`_legacy_${e}`),save(e,t,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),V(`_legacy_${e}`,JSON.stringify(t),r),$.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),B(e,n),$.remove(e,t),$.remove(`_legacy_${e}`,t)}},Z={get(e){if("undefined"==typeof sessionStorage)return;const 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)}};var X,Y=function(e){return X=X||function(e,t,n){var r=function(e,t){var n=atob(e);return n}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo="),o=r.indexOf("\n",10)+1,a=r.substring(o)+"",i=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(i)}(),new Worker(X,e)};const J={};class Q{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;const n=new Set((null===(t=await this.cache.get(this.manifestKey))||void 0===t?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const t=await this.cache.get(this.manifestKey);if(t){const 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`@@auth0spajs@@::${e}`}}const G={memory:()=>(new M).enclosedCache,localstorage:()=>new z},q=e=>G[e],ee=e=>{const{openUrl:t,onRedirect:n}=e,r=s(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},te=new p;class ne{constructor(e){let t,n;if(this.userCache=(new M).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await te.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(!C())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===C().subtle)throw new 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(t=e.cacheLocation||"memory",!q(t))throw new Error(`Invalid cache location "${t}"`);n=q(t)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?$:K,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(e=>`auth0.${this.options.clientId}.is.authenticated`)(),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const r=e.useCookiesForTransactions?this.cookieStorage:Z;var o;this.scope=I("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new U(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||v,this.cacheManager=new A(n,n.allKeys?void 0:new Q(n,this.options.clientId),this.nowProvider),this.domainUrl=(o=this.options.domain,/^https?:\/\//.test(o)?o:`https://${o}`),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:`https://${e}/`:`${t}/`)(this.options.issuer,this.domainUrl),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===t&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Y)}_url(e){const t=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||m)));return`${this.domainUrl}${e}&auth0Client=${t}`}_authorizeUrl(e){return this._url(`/authorize?${T(e)}`)}async _verifyIdToken(e,t,n){const r=await this.nowProvider();return(e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(e=>{const t=e.split("."),[n,r,o]=t;if(3!==t.length||!n||!r||!o)throw new Error("ID token could not be decoded");const a=JSON.parse(R(r)),i={__raw:e},l={};return Object.keys(a).forEach((e=>{i[e]=a[e],F.includes(e)||(l[e]=a[e])})),{encoded:{header:n,payload:r,signature:o},header:JSON.parse(R(n)),claims:i,user:l}})(e.id_token);if(!t.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==e.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${e.iss}", found "${t.claims.iss}"`);if(!t.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==t.header.alg)throw new 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 new 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 new 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 new 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 new 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 new 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 new Error("Nonce (nonce) claim must be a string present in the ID token");if(t.claims.nonce!==e.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${e.nonce}", found "${t.claims.nonce}"`)}if(e.max_age&&!j(t.claims.auth_time))throw new 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||!j(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!j(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,r=new Date(e.now||Date.now()),o=new Date(0);if(o.setUTCSeconds(t.claims.exp+n),r>o)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${o})`);if(null!=t.claims.nbf&&j(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)throw new 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 ${o}`)}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${e}", found "${t.claims.org_id}"`)}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new 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:n,leeway:this.options.leeway,max_age:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var 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,n){const r=P(_()),o=P(_()),a=_(),i=(e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,(e=>t[e]))})(window.btoa(String.fromCharCode(...Array.from(t))))})(await(async e=>{const t=C().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t})(a)),l=((e,t,n,r,o,a,i,l)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:I(t,n.scope),response_type:"code",response_mode:l||"query",state:r,nonce:o,redirect_uri:i||e.authorizationParams.redirect_uri,code_challenge:a,code_challenge_method:"S256"}))(this.options,this.scope,e,r,o,i,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode),s=this._authorizeUrl(l);return{nonce:o,code_verifier:a,scope:l.scope,audience:l.audience||"default",redirect_uri:l.redirect_uri,state:r,url:s}}async loginWithPopup(e,t){var n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(e=>{const t=window.screenX+(window.innerWidth-400)/2,n=window.screenY+(window.innerHeight-600)/2;return window.open("","auth0:authorize:popup",`left=${t},top=${n},width=400,height=600,resizable,scrollbars=yes,status=1`)})(),!t.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const r=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const o=await(e=>new Promise(((t,n)=>{let r;const o=setInterval((()=>{e.popup&&e.popup.closed&&(clearInterval(o),clearTimeout(a),window.removeEventListener("message",r,!1),n(new k(e.popup)))}),1e3),a=setTimeout((()=>{clearInterval(o),n(new w(e.popup)),window.removeEventListener("message",r,!1)}),1e3*(e.timeoutInSeconds||60));r=function(i){if(i.data&&"authorization_response"===i.data.type){if(clearTimeout(a),clearInterval(o),window.removeEventListener("message",r,!1),e.popup.close(),i.data.response.error)return n(g.fromPayload(i.data.response));t(i.data.response)}},window.addEventListener("message",r)})))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==o.state)throw new g("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:o.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:a})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(e={}){var t;const n=ee(e),{openUrl:r,fragment:o,appState:a}=n,i=s(n,["openUrl","fragment","appState"]),l=(null===(t=i.authorizationParams)||void 0===t?void 0:t.organization)||this.options.authorizationParams.organization,u=await this._prepareAuthorizeUrl(i.authorizationParams||{}),{url:c}=u,d=s(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},d),{appState:a}),l&&{organization:l}));const f=o?`${c}#${o}`:c;r?await r(f):window.location.assign(f)}async handleRedirectCallback(e=window.location.href){const t=e.split("?").slice(1);if(0===t.length)throw new Error("There are no query params available for parsing.");const{state:n,code:r,error:o,error_description:a}=(e=>{e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=new URLSearchParams(e);return{state:t.get("state"),code:t.get("code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(t.join("")),i=this.transactionManager.get();if(!i)throw new g("missing_transaction","Invalid state");if(this.transactionManager.remove(),o)throw new y(o,a||o,n,i.appState);if(!i.code_verifier||i.state&&i.state!==n)throw new g("state_mismatch","Invalid state");const l=i.organization,s=i.nonce,u=i.redirect_uri;return await this._requestToken(Object.assign({audience:i.audience,scope:i.scope,code_verifier:i.code_verifier,grant_type:"authorization_code",code:r},u?{redirect_uri:u}:{}),{nonceIn:s,organization:l}),{appState:i.appState}}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;const n=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:I(this.scope,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope)})}),r=await((e,t)=>{let n=J[t];return n||(n=e().finally((()=>{delete J[t],n=null})),J[t]=n),n})((()=>this._getTokenSilently(n)),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return e.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(e){const{cacheMode:t}=e,n=s(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(e)return e}if("cache-only"!==t){if(!await(async(e,t=3)=>{for(let n=0;nte.acquireLock("auth0.lock.getTokenSilently",5e3)),10))throw new b;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),"off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,access_token:o,oauthTokenScope:a,expires_in:i}=e;return Object.assign(Object.assign({id_token:r,access_token:o},a?{scope:a}:null),{expires_in:i})}finally{await te.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},t={}){var n;const r=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:I(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope)})});return t=Object.assign(Object.assign({},h),t),await this.loginWithPopup(r,t),(await this.cacheManager.get(new D({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},{federated:n}=t,r=s(t,["federated"]),o=n?"&federated":"";return this._url(`/v2/logout?${T(Object.assign({clientId:e.clientId},r))}`)+o}async logout(e={}){const t=ee(e),{openUrl:n}=t,r=s(t,["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@@");const o=this._buildLogoutUrl(r);n?await n(o):!1!==n&&window.location.assign(o)}async _getTokenFromIFrame(e){const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:r,state:o,nonce:a,code_verifier:i,redirect_uri:l,scope:s,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new g("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const n=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,c=await((e,t,n=60)=>new Promise(((r,o)=>{const a=window.document.createElement("iframe");a.setAttribute("width","0"),a.setAttribute("height","0"),a.style.display="none";const i=()=>{window.document.body.contains(a)&&(window.document.body.removeChild(a),window.removeEventListener("message",l,!1))};let l;const s=setTimeout((()=>{o(new b),i()}),1e3*n);l=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?o(g.fromPayload(e.data.response)):r(e.data.response),clearTimeout(s),window.removeEventListener("message",l,!1),setTimeout(i,2e3)},window.addEventListener("message",l,!1),window.document.body.appendChild(a),a.setAttribute("src",e)})))(r,this.domainUrl,n);if(o!==c.state)throw new g("state_mismatch","Invalid state");const d=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:i,code:c.code,grant_type:"authorization_code",redirect_uri:l,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:t.organization});return Object.assign(Object.assign({},d),{scope:s,oauthTokenScope:d.scope,audience:u})}catch(e){throw"login_required"===e.error&&this.logout({openUrl:!1}),e}}async _getTokenUsingRefreshToken(e){const t=await this.cacheManager.get(new D({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new E(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,r="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null;try{const o=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:n}),r&&{timeout:r}));return Object.assign(Object.assign({},o),{scope:e.authorizationParams.scope,oauthTokenScope:o.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){const{id_token:t,decodedToken:n}=e,r=s(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",t=await this.cacheManager.getIdToken(new D({clientId:this.options.clientId,audience:e,scope:this.scope})),n=this.userCache.get("@@user@@");return t&&t.id_token===(null==n?void 0:n.id_token)?n:(this.userCache.set("@@user@@",t),t)}async _getEntryFromCache({scope:e,audience:t,clientId:n}){const r=await this.cacheManager.get(new D({scope:e,audience:t,clientId:n}),60);if(r&&r.access_token){const{access_token:e,oauthTokenScope:t,expires_in:n}=r,o=await this._getIdTokenFromCache();return o&&Object.assign(Object.assign({id_token:o.id_token,access_token:e},t?{scope:t}:null),{expires_in:n})}}async _requestToken(e,t){const{nonceIn:n,organization:r}=t||{},o=await N(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},e),this.worker),a=await this._verifyIdToken(o.id_token,n,r);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},o),{decodedToken:a,scope:e.scope,audience:e.audience||"default"}),o.scope?{oauthTokenScope:o.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(r||a.claims.org_id),Object.assign(Object.assign({},o),{decodedToken:a})}}var re={isAuthenticated:!1,isLoading:!0},oe=function(){throw new Error("You forgot to wrap your component in .")},ae=a(a({},re),{buildAuthorizeUrl:oe,buildLogoutUrl:oe,getAccessTokenSilently:oe,getAccessTokenWithPopup:oe,getIdTokenClaims:oe,loginWithRedirect:oe,loginWithPopup:oe,logout:oe,handleRedirectCallback:oe}),ie=(0,r.createContext)(ae),le=function(e){function t(n,r){var o=e.call(this,r||n)||this;return o.error=n,o.error_description=r,Object.setPrototypeOf(o,t.prototype),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t}(Error),se=/[?&]code=[^&]+/,ue=/[?&]state=[^&]+/,ce=/[?&]error=[^&]+/,de=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 le(t.error,t.error_description):new le(t.error):new Error(e)}},fe=de("Login failed"),pe=de("Get access token failed"),he=function(e){var t;(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=e.authorizationParams||{},e.authorizationParams.redirect_uri=e.redirectUri,delete e.redirectUri),(null===(t=null==e?void 0:e.authorizationParams)||void 0===t?void 0:t.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)},me=function(e,t){switch(t.type){case"LOGIN_POPUP_STARTED":return a(a({},e),{isLoading:!0});case"LOGIN_POPUP_COMPLETE":case"INITIALISED":return a(a({},e),{isAuthenticated:!!t.user,user:t.user,isLoading:!1,error:void 0});case"HANDLE_REDIRECT_COMPLETE":case"GET_ACCESS_TOKEN_COMPLETE":return e.user===t.user?e:a(a({},e),{isAuthenticated:!!t.user,user:t.user});case"LOGOUT":return a(a({},e),{isAuthenticated:!1,user:void 0});case"ERROR":return a(a({},e),{isLoading:!1,error:t.error})}},ve=function(e){window.history.replaceState({},document.title,(null==e?void 0:e.returnTo)||window.location.pathname)},ge=function(e){var t=e.children,n=e.skipRedirectCallback,o=e.onRedirectCallback,s=void 0===o?ve:o,u=e.context,c=void 0===u?ie:u,d=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;td,J0:()=>l,OF:()=>F,RQ:()=>z,WK:()=>W,X3:()=>j,Zn:()=>O,aU:()=>o,cP:()=>f,cm:()=>I,fp:()=>v,lX:()=>i,p7:()=>ee,pC:()=>D}),function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(o||(o={}));const a="popstate";function i(e){return void 0===e&&(e={}),function(e,t,n,i){void 0===i&&(i={});let{window:s=document.defaultView,v5Compat:f=!1}=i,p=s.history,h=o.Pop,m=null,v=g();function g(){return(p.state||{idx:null}).idx}function y(){h=o.Pop;let e=g(),t=null==e?null:e-v;v=e,m&&m({action:h,location:w.location,delta:t})}function b(e){let t="null"!==s.location.origin?s.location.origin:s.location.href,n="string"==typeof e?e:d(e);return l(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==v&&(v=0,p.replaceState(r({},p.state,{idx:v}),""));let w={get action(){return h},get location(){return e(s,p)},listen(e){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(a,y),m=e,()=>{s.removeEventListener(a,y),m=null}},createHref:e=>t(s,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){h=o.Push;let r=c(w.location,e,t);n&&n(r,e),v=g()+1;let a=u(r,v),i=w.createHref(r);try{p.pushState(a,"",i)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;s.location.assign(i)}f&&m&&m({action:h,location:w.location,delta:1})},replace:function(e,t){h=o.Replace;let r=c(w.location,e,t);n&&n(r,e),v=g();let a=u(r,v),i=w.createHref(r);p.replaceState(a,"",i),f&&m&&m({action:h,location:w.location,delta:0})},go:e=>p.go(e)};return w}((function(e,t){let{pathname:n,search:r,hash:o}=e.location;return c("",{pathname:n,search:r,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:d(t)}),null,e)}function l(e,t){if(!1===e||null==e)throw new Error(t)}function s(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function u(e,t){return{usr:e.state,key:e.key,idx:t}}function c(e,t,n,o){return void 0===n&&(n=null),r({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?f(t):t,{state:n,key:t&&t.key||o||Math.random().toString(36).substr(2,8)})}function d(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function f(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}var p;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(p||(p={}));const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function m(e,t,n,o){return void 0===n&&(n=[]),void 0===o&&(o={}),e.map(((e,a)=>{let i=[...n,a],s="string"==typeof e.id?e.id:i.join("-");if(l(!0!==e.index||!e.children,"Cannot specify children on an index route"),l(!o[s],'Found a route id collision on id "'+s+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let n=r({},e,t(e),{id:s});return o[s]=n,n}{let n=r({},e,t(e),{id:s,children:void 0});return o[s]=n,e.children&&(n.children=m(e.children,t,i,o)),n}}))}function v(e,t,n){void 0===n&&(n="/");let r=O(("string"==typeof t?f(t):t).pathname||"/",n);if(null==r)return null;let o=g(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let a=null;for(let e=0;null==a&&e{let i={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};i.relativePath.startsWith("/")&&(l(i.relativePath.startsWith(r),'Absolute route path "'+i.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),i.relativePath=i.relativePath.slice(r.length));let s=z([r,i.relativePath]),u=n.concat(i);e.children&&e.children.length>0&&(l(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+s+'".'),g(e.children,t,u,s)),(null!=e.path||e.index)&&t.push({path:s,score:_(s,e.index),routesMeta:u})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of y(e.path))o(e,t,n);else o(e,t)})),t}function y(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(0===r.length)return o?[a,""]:[a];let i=y(r.join("/")),l=[];return l.push(...i.map((e=>""===e?a:[a,e].join("/")))),o&&l.push(...i),l.map((t=>e.startsWith("/")&&""===t?"/":t))}const b=/^:\w+$/,w=3,k=2,S=1,E=10,x=-2,C=e=>"*"===e;function _(e,t){let n=e.split("/"),r=n.length;return n.some(C)&&(r+=x),t&&(r+=k),n.filter((e=>!C(e))).reduce(((e,t)=>e+(b.test(t)?w:""===t?S:E)),r)}function P(e,t){let{routesMeta:n}=e,r={},o="/",a=[];for(let e=0;e(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));return e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce(((e,t,n)=>{let{paramName:r,isOptional:o}=t;if("*"===r){let e=l[n]||"";i=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}const u=l[n];return e[r]=o&&!u?void 0:function(e,t){try{return decodeURIComponent(e)}catch(n){return s(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+n+")."),e}}(u||"",r),e}),{}),pathname:a,pathnameBase:i,pattern:e}}function R(e){try{return decodeURI(e)}catch(t){return s(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function O(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function L(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in and the router will parse it for you.'}function N(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function I(e){return N(e).map(((t,n)=>n===e.length-1?t.pathname:t.pathnameBase))}function D(e,t,n,o){let a;void 0===o&&(o=!1),"string"==typeof e?a=f(e):(a=r({},e),l(!a.pathname||!a.pathname.includes("?"),L("?","pathname","search",a)),l(!a.pathname||!a.pathname.includes("#"),L("#","pathname","hash",a)),l(!a.search||!a.search.includes("#"),L("#","search","hash",a)));let i,s=""===e||""===a.pathname,u=s?"/":a.pathname;if(null==u)i=n;else if(o){let e=t[t.length-1].replace(/^\//,"").split("/");if(u.startsWith("..")){let t=u.split("/");for(;".."===t[0];)t.shift(),e.pop();a.pathname=t.join("/")}i="/"+e.join("/")}else{let e=t.length-1;if(u.startsWith("..")){let t=u.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}i=e>=0?t[e]:"/"}let c=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:o=""}="string"==typeof e?f(e):e,a=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:a,search:A(r),hash:U(o)}}(a,i),d=u&&"/"!==u&&u.endsWith("/"),p=(s||"."===u)&&n.endsWith("/");return c.pathname.endsWith("/")||!d&&!p||(c.pathname+="/"),c}const z=e=>e.join("/").replace(/\/\/+/g,"/"),M=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),A=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",U=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class j extends Error{}class F{constructor(e,t,n,r){void 0===r&&(r=!1),this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function W(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const H=["post","put","patch","delete"],V=new Set(H),B=["get",...H],$=new Set(B),K=new Set([301,302,303,307,308]),Z=new Set([307,308]),X={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Y={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Q=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,G=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),q="remix-router-transitions";function ee(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,n=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement,a=!n;let i;if(l(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;i=e=>({hasErrorBoundary:t(e)})}else i=G;let u,d={},f=m(e.routes,i,void 0,d),h=e.basename||"/",g=r({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_prependBasename:!1},e.future),y=null,b=new Set,w=null,k=null,S=null,E=null!=e.hydrationData,x=v(f,e.history.location,h),C=null;if(null==x){let t=me(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=he(f);x=n,C={[r.id]:t}}let _,P,T=!(x.some((e=>e.route.lazy))||x.some((e=>e.route.loader))&&null==e.hydrationData),R={historyAction:e.history.action,location:e.history.location,matches:x,initialized:T,navigation:X,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||C,fetchers:new Map,blockers:new Map},L=o.Pop,N=!1,I=!1,D=new Map,z=null,M=!1,A=!1,U=[],j=[],F=new Map,W=0,H=-1,V=new Map,B=new Set,$=new Map,K=new Map,ee=new Set,oe=new Map,ae=new Map,ie=!1;function ue(e,t){void 0===t&&(t={}),R=r({},R,e);let n=[],o=[];g.v7_fetcherPersist&&R.fetchers.forEach(((e,t)=>{"idle"===e.state&&(ee.has(t)?o.push(t):n.push(t))})),[...b].forEach((e=>e(R,{deletedFetchers:o,unstable_viewTransitionOpts:t.viewTransitionOpts,unstable_flushSync:!0===t.flushSync}))),g.v7_fetcherPersist&&(n.forEach((e=>R.fetchers.delete(e))),o.forEach((e=>ze(e))))}function ce(t,n,a){var i,l;let s,{flushSync:c}=void 0===a?{}:a,d=null!=R.actionData&&null!=R.navigation.formMethod&&ke(R.navigation.formMethod)&&"loading"===R.navigation.state&&!0!==(null==(i=t.state)?void 0:i._isRedirect);s=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:d?R.actionData:null;let p=n.loaderData?fe(R.loaderData,n.loaderData,n.matches||[],n.errors):R.loaderData,h=R.blockers;h.size>0&&(h=new Map(h),h.forEach(((e,t)=>h.set(t,J))));let m,v=!0===N||null!=R.navigation.formMethod&&ke(R.navigation.formMethod)&&!0!==(null==(l=t.state)?void 0:l._isRedirect);if(u&&(f=u,u=void 0),M||L===o.Pop||(L===o.Push?e.history.push(t,t.state):L===o.Replace&&e.history.replace(t,t.state)),L===o.Pop){let e=D.get(R.location.pathname);e&&e.has(t.pathname)?m={currentLocation:R.location,nextLocation:t}:D.has(t.pathname)&&(m={currentLocation:t,nextLocation:R.location})}else if(I){let e=D.get(R.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),D.set(R.location.pathname,e)),m={currentLocation:R.location,nextLocation:t}}ue(r({},n,{actionData:s,loaderData:p,historyAction:L,location:t,initialized:!0,navigation:X,revalidation:"idle",restoreScrollPosition:$e(t,n.matches||R.matches),preventScrollReset:v,blockers:h}),{viewTransitionOpts:m,flushSync:!0===c}),L=o.Pop,N=!1,I=!1,M=!1,A=!1,U=[],j=[]}async function ge(t,n,a){P&&P.abort(),P=null,L=t,M=!0===(a&&a.startUninterruptedRevalidation),function(e,t){if(w&&S){let n=Be(e,t);w[n]=S()}}(R.location,R.matches),N=!0===(a&&a.preventScrollReset),I=!0===(a&&a.enableViewTransition);let l=u||f,s=a&&a.overrideNavigation,c=v(l,n,h),m=!0===(a&&a.flushSync);if(!c){let e=me(404,{pathname:n.pathname}),{matches:t,route:r}=he(l);return Ve(),void ce(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:m})}if(R.initialized&&!A&&(g=R.location,y=n,g.pathname===y.pathname&&g.search===y.search&&(""===g.hash?""!==y.hash:g.hash===y.hash||""!==y.hash))&&!(a&&a.submission&&ke(a.submission.formMethod)))return void ce(n,{matches:c},{flushSync:m});var g,y;P=new AbortController;let b,k,E=se(e.history,n,P.signal,a&&a.submission);if(a&&a.pendingError)k={[pe(c).route.id]:a.pendingError};else if(a&&a.submission&&ke(a.submission.formMethod)){let e=await async function(e,t,n,r,a){void 0===a&&(a={}),Le();let l,s=function(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}(t,n);ue({navigation:s},{flushSync:!0===a.flushSync});let u=Ce(r,t);if(u.route.action||u.route.lazy){if(l=await le("action",e,u,r,d,i,h),e.signal.aborted)return{shortCircuited:!0}}else l={type:p.error,error:me(405,{method:e.method,pathname:t.pathname,routeId:u.route.id})};if(we(l)){let e;return e=a&&null!=a.replace?a.replace:l.location===R.location.pathname+R.location.search,await xe(R,l,{submission:n,replace:e}),{shortCircuited:!0}}if(be(l)){let e=pe(r,u.route.id);return!0!==(a&&a.replace)&&(L=o.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:l.error}}}if(ye(l))throw me(400,{type:"defer-action"});return{pendingActionData:{[u.route.id]:l.data}}}(E,n,a.submission,c,{replace:a.replace,flushSync:m});if(e.shortCircuited)return;b=e.pendingActionData,k=e.pendingActionError,s=Pe(n,a.submission),m=!1,E=new Request(E.url,{signal:E.signal})}let{shortCircuited:x,loaderData:C,errors:_}=await async function(t,n,o,a,i,l,s,c,d,p){let m=a||Pe(n,i),v=i||l||_e(m),g=u||f,[y,b]=re(e.history,R,o,v,n,A,U,j,ee,$,B,g,h,d,p);if(Ve((e=>!(o&&o.some((t=>t.route.id===e)))||y&&y.some((t=>t.route.id===e)))),H=++W,0===y.length&&0===b.length){let e=Ue();return ce(n,r({matches:o,loaderData:{},errors:p||null},d?{actionData:d}:{},e?{fetchers:new Map(R.fetchers)}:{}),{flushSync:c}),{shortCircuited:!0}}if(!M){b.forEach((e=>{let t=R.fetchers.get(e.key),n=Te(void 0,t?t.data:void 0);R.fetchers.set(e.key,n)}));let e=d||R.actionData;ue(r({navigation:m},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},b.length>0?{fetchers:new Map(R.fetchers)}:{}),{flushSync:c})}b.forEach((e=>{F.has(e.key)&&Me(e.key),e.controller&&F.set(e.key,e.controller)}));let w=()=>b.forEach((e=>Me(e.key)));P&&P.signal.addEventListener("abort",w);let{results:k,loaderResults:S,fetcherResults:E}=await Oe(R.matches,o,y,b,t);if(t.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener("abort",w),b.forEach((e=>F.delete(e.key)));let x=ve(k);if(x){if(x.idx>=y.length){let e=b[x.idx-y.length].key;B.add(e)}return await xe(R,x.result,{replace:s}),{shortCircuited:!0}}let{loaderData:C,errors:_}=de(R,o,y,S,p,b,E,oe);oe.forEach(((e,t)=>{e.subscribe((n=>{(n||e.done)&&oe.delete(t)}))}));let T=Ue(),O=je(H);return r({loaderData:C,errors:_},T||O||b.length>0?{fetchers:new Map(R.fetchers)}:{})}(E,n,c,s,a&&a.submission,a&&a.fetcherSubmission,a&&a.replace,m,b,k);x||(P=null,ce(n,r({matches:c},b?{actionData:b}:{},{loaderData:C,errors:_})))}async function xe(a,i,s){let{submission:u,fetcherSubmission:d,replace:f}=void 0===s?{}:s;i.revalidate&&(A=!0);let p=c(a.location,i.location,{_isRedirect:!0});if(l(p,"Expected a location on the redirect navigation"),n){let n=!1;if(i.reloadDocument)n=!0;else if(Q.test(i.location)){const r=e.history.createURL(i.location);n=r.origin!==t.location.origin||null==O(r.pathname,h)}if(n)return void(f?t.location.replace(i.location):t.location.assign(i.location))}P=null;let m=!0===f?o.Replace:o.Push,{formMethod:v,formAction:g,formEncType:y}=a.navigation;!u&&!d&&v&&g&&y&&(u=_e(a.navigation));let b=u||d;if(Z.has(i.status)&&b&&ke(b.formMethod))await ge(m,p,{submission:r({},b,{formAction:i.location}),preventScrollReset:N});else{let e=Pe(p,u);await ge(m,p,{overrideNavigation:e,fetcherSubmission:d,preventScrollReset:N})}}async function Oe(t,n,r,o,a){let l=await Promise.all([...r.map((e=>le("loader",a,e,n,d,i,h))),...o.map((t=>t.matches&&t.match&&t.controller?le("loader",se(e.history,t.path,t.controller.signal),t.match,t.matches,d,i,h):{type:p.error,error:me(404,{pathname:t.path})}))]),s=l.slice(0,r.length),u=l.slice(r.length);return await Promise.all([Se(t,r,s,s.map((()=>a.signal)),!1,R.loaderData),Se(t,o.map((e=>e.match)),u,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:l,loaderResults:s,fetcherResults:u}}function Le(){A=!0,U.push(...Ve()),$.forEach(((e,t)=>{F.has(t)&&(j.push(t),Me(t))}))}function Ne(e,t,n){void 0===n&&(n={}),R.fetchers.set(e,t),ue({fetchers:new Map(R.fetchers)},{flushSync:!0===(n&&n.flushSync)})}function Ie(e,t,n,r){void 0===r&&(r={});let o=pe(R.matches,t);ze(e),ue({errors:{[o.route.id]:n},fetchers:new Map(R.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function De(e){return g.v7_fetcherPersist&&(K.set(e,(K.get(e)||0)+1),ee.has(e)&&ee.delete(e)),R.fetchers.get(e)||Y}function ze(e){let t=R.fetchers.get(e);!F.has(e)||t&&"loading"===t.state&&V.has(e)||Me(e),$.delete(e),V.delete(e),B.delete(e),ee.delete(e),R.fetchers.delete(e)}function Me(e){let t=F.get(e);l(t,"Expected fetch controller: "+e),t.abort(),F.delete(e)}function Ae(e){for(let t of e){let e=Re(De(t).data);R.fetchers.set(t,e)}}function Ue(){let e=[],t=!1;for(let n of B){let r=R.fetchers.get(n);l(r,"Expected fetcher: "+n),"loading"===r.state&&(B.delete(n),e.push(n),t=!0)}return Ae(e),t}function je(e){let t=[];for(let[n,r]of V)if(r0}function Fe(e){R.blockers.delete(e),ae.delete(e)}function We(e,t){let n=R.blockers.get(e)||J;l("unblocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"proceeding"===t.state||"blocked"===n.state&&"unblocked"===t.state||"proceeding"===n.state&&"unblocked"===t.state,"Invalid blocker state transition: "+n.state+" -> "+t.state);let r=new Map(R.blockers);r.set(e,t),ue({blockers:r})}function He(e){let{currentLocation:t,nextLocation:n,historyAction:r}=e;if(0===ae.size)return;ae.size>1&&s(!1,"A router only supports one blocker at a time");let o=Array.from(ae.entries()),[a,i]=o[o.length-1],l=R.blockers.get(a);return l&&"proceeding"===l.state?void 0:i({currentLocation:t,nextLocation:n,historyAction:r})?a:void 0}function Ve(e){let t=[];return oe.forEach(((n,r)=>{e&&!e(r)||(n.cancel(),t.push(r),oe.delete(r))})),t}function Be(e,t){return k&&k(e,t.map((e=>function(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],handle:n.handle}}(e,R.loaderData))))||e.key}function $e(e,t){if(w){let n=Be(e,t),r=w[n];if("number"==typeof r)return r}return null}return _={get basename(){return h},get state(){return R},get routes(){return f},get window(){return t},initialize:function(){if(y=e.history.listen((t=>{let{action:n,location:r,delta:o}=t;if(ie)return void(ie=!1);s(0===ae.size||null!=o,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let a=He({currentLocation:R.location,nextLocation:r,historyAction:n});return a&&null!=o?(ie=!0,e.history.go(-1*o),void We(a,{state:"blocked",location:r,proceed(){We(a,{state:"proceeding",proceed:void 0,reset:void 0,location:r}),e.history.go(o)},reset(){let e=new Map(R.blockers);e.set(a,J),ue({blockers:e})}})):ge(n,r)})),n){!function(e,t){try{let n=e.sessionStorage.getItem(q);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch(e){}}(t,D);let e=()=>function(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(q,JSON.stringify(n))}catch(e){s(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(t,D);t.addEventListener("pagehide",e),z=()=>t.removeEventListener("pagehide",e)}return R.initialized||ge(o.Pop,R.location),_},subscribe:function(e){return b.add(e),()=>b.delete(e)},enableScrollRestoration:function(e,t,n){if(w=e,S=t,k=n||null,!E&&R.navigation===X){E=!0;let e=$e(R.location,R.matches);null!=e&&ue({restoreScrollPosition:e})}return()=>{w=null,S=null,k=null}},navigate:async function t(n,a){if("number"==typeof n)return void e.history.go(n);let i=te(R.location,R.matches,h,g.v7_prependBasename,n,null==a?void 0:a.fromRouteId,null==a?void 0:a.relative),{path:l,submission:s,error:u}=ne(g.v7_normalizeFormMethod,!1,i,a),d=R.location,f=c(R.location,l,a&&a.state);f=r({},f,e.history.encodeLocation(f));let p=a&&null!=a.replace?a.replace:void 0,m=o.Push;!0===p?m=o.Replace:!1===p||null!=s&&ke(s.formMethod)&&s.formAction===R.location.pathname+R.location.search&&(m=o.Replace);let v=a&&"preventScrollReset"in a?!0===a.preventScrollReset:void 0,y=!0===(a&&a.unstable_flushSync),b=He({currentLocation:d,nextLocation:f,historyAction:m});if(!b)return await ge(m,f,{submission:s,pendingError:u,preventScrollReset:v,replace:a&&a.replace,enableViewTransition:a&&a.unstable_viewTransition,flushSync:y});We(b,{state:"blocked",location:f,proceed(){We(b,{state:"proceeding",proceed:void 0,reset:void 0,location:f}),t(n,a)},reset(){let e=new Map(R.blockers);e.set(b,J),ue({blockers:e})}})},fetch:function(t,n,r,o){if(a)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");F.has(t)&&Me(t);let s=!0===(o&&o.unstable_flushSync),c=u||f,p=te(R.location,R.matches,h,g.v7_prependBasename,r,n,null==o?void 0:o.relative),m=v(c,p,h);if(!m)return void Ie(t,n,me(404,{pathname:p}),{flushSync:s});let{path:y,submission:b,error:w}=ne(g.v7_normalizeFormMethod,!0,p,o);if(w)return void Ie(t,n,w,{flushSync:s});let k=Ce(m,y);N=!0===(o&&o.preventScrollReset),b&&ke(b.formMethod)?async function(t,n,r,o,a,s,c){if(Le(),$.delete(t),!o.route.action&&!o.route.lazy){let e=me(405,{method:c.formMethod,pathname:r,routeId:n});return void Ie(t,n,e,{flushSync:s})}let p=R.fetchers.get(t);Ne(t,function(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}(c,p),{flushSync:s});let m=new AbortController,g=se(e.history,r,m.signal,c);F.set(t,m);let y=W,b=await le("action",g,o,a,d,i,h);if(g.signal.aborted)return void(F.get(t)===m&&F.delete(t));if(ee.has(t))return void Ne(t,Re(void 0));if(we(b))return F.delete(t),H>y?void Ne(t,Re(void 0)):(B.add(t),Ne(t,Te(c)),xe(R,b,{fetcherSubmission:c}));if(be(b))return void Ie(t,n,b.error);if(ye(b))throw me(400,{type:"defer-action"});let w=R.navigation.location||R.location,k=se(e.history,w,m.signal),S=u||f,E="idle"!==R.navigation.state?v(S,R.navigation.location,h):R.matches;l(E,"Didn't find any matches after fetcher action");let x=++W;V.set(t,x);let C=Te(c,b.data);R.fetchers.set(t,C);let[_,T]=re(e.history,R,E,c,w,A,U,j,ee,$,B,S,h,{[o.route.id]:b.data},void 0);T.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,n=R.fetchers.get(t),r=Te(void 0,n?n.data:void 0);R.fetchers.set(t,r),F.has(t)&&Me(t),e.controller&&F.set(t,e.controller)})),ue({fetchers:new Map(R.fetchers)});let O=()=>T.forEach((e=>Me(e.key)));m.signal.addEventListener("abort",O);let{results:N,loaderResults:I,fetcherResults:D}=await Oe(R.matches,E,_,T,k);if(m.signal.aborted)return;m.signal.removeEventListener("abort",O),V.delete(t),F.delete(t),T.forEach((e=>F.delete(e.key)));let z=ve(N);if(z){if(z.idx>=_.length){let e=T[z.idx-_.length].key;B.add(e)}return xe(R,z.result)}let{loaderData:M,errors:K}=de(R,R.matches,_,I,void 0,T,D,oe);if(R.fetchers.has(t)){let e=Re(b.data);R.fetchers.set(t,e)}je(x),"loading"===R.navigation.state&&x>H?(l(L,"Expected pending action"),P&&P.abort(),ce(R.navigation.location,{matches:E,loaderData:M,errors:K,fetchers:new Map(R.fetchers)})):(ue({errors:K,loaderData:fe(R.loaderData,M,E,K),fetchers:new Map(R.fetchers)}),A=!1)}(t,n,y,k,m,s,b):($.set(t,{routeId:n,path:y}),async function(t,n,r,o,a,s,u){let c=R.fetchers.get(t);Ne(t,Te(u,c?c.data:void 0),{flushSync:s});let f=new AbortController,p=se(e.history,r,f.signal);F.set(t,f);let m=W,v=await le("loader",p,o,a,d,i,h);if(ye(v)&&(v=await Ee(v,p.signal,!0)||v),F.get(t)===f&&F.delete(t),!p.signal.aborted){if(!ee.has(t))return we(v)?H>m?void Ne(t,Re(void 0)):(B.add(t),void await xe(R,v)):void(be(v)?Ie(t,n,v.error):(l(!ye(v),"Unhandled fetcher deferred data"),Ne(t,Re(v.data))));Ne(t,Re(void 0))}}(t,n,y,k,m,s,b))},revalidate:function(){Le(),ue({revalidation:"loading"}),"submitting"!==R.navigation.state&&("idle"!==R.navigation.state?ge(L||R.historyAction,R.navigation.location,{overrideNavigation:R.navigation}):ge(R.historyAction,R.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:De,deleteFetcher:function(e){if(g.v7_fetcherPersist){let t=(K.get(e)||0)-1;t<=0?(K.delete(e),ee.add(e)):K.set(e,t)}else ze(e);ue({fetchers:new Map(R.fetchers)})},dispose:function(){y&&y(),z&&z(),b.clear(),P&&P.abort(),R.fetchers.forEach(((e,t)=>ze(t))),R.blockers.forEach(((e,t)=>Fe(t)))},getBlocker:function(e,t){let n=R.blockers.get(e)||J;return ae.get(e)!==t&&ae.set(e,t),n},deleteBlocker:Fe,_internalFetchControllers:F,_internalActiveDeferreds:oe,_internalSetRoutes:function(e){d={},u=m(e,i,void 0,d)}},_}function te(e,t,n,r,o,a,i){let l,s;if(a){l=[];for(let e of t)if(l.push(e),e.route.id===a){s=e;break}}else l=t,s=t[t.length-1];let u=D(o||".",I(l),O(e.pathname,n)||e.pathname,"path"===i);return null==o&&(u.search=e.search,u.hash=e.hash),null!=o&&""!==o&&"."!==o||!s||!s.route.index||xe(u.search)||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r&&"/"!==n&&(u.pathname="/"===u.pathname?n:z([n,u.pathname])),d(u)}function ne(e,t,n,r){if(!r||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(r))return{path:n};if(r.formMethod&&(o=r.formMethod,!$.has(o.toLowerCase())))return{path:n,error:me(405,{method:r.formMethod})};var o;let a,i,s=()=>({path:n,error:me(400,{type:"invalid-body"})}),u=r.formMethod||"get",c=e?u.toUpperCase():u.toLowerCase(),p=ge(n);if(void 0!==r.body){if("text/plain"===r.formEncType){if(!ke(c))return s();let e="string"==typeof r.body?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce(((e,t)=>{let[n,r]=t;return""+e+n+"="+r+"\n"}),""):String(r.body);return{path:n,submission:{formMethod:c,formAction:p,formEncType:r.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===r.formEncType){if(!ke(c))return s();try{let e="string"==typeof r.body?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:c,formAction:p,formEncType:r.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(l("function"==typeof FormData,"FormData is not available in this environment"),r.formData)a=ue(r.formData),i=r.formData;else if(r.body instanceof FormData)a=ue(r.body),i=r.body;else if(r.body instanceof URLSearchParams)a=r.body,i=ce(a);else if(null==r.body)a=new URLSearchParams,i=new FormData;else try{a=new URLSearchParams(r.body),i=ce(a)}catch(e){return s()}let h={formMethod:c,formAction:p,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(ke(h.formMethod))return{path:n,submission:h};let m=f(n);return t&&m.search&&xe(m.search)&&a.append("index",""),m.search="?"+a,{path:d(m),submission:h}}function re(e,t,n,o,a,i,l,s,u,c,d,f,p,h,m){let g=m?Object.values(m)[0]:h?Object.values(h)[0]:void 0,y=e.createURL(t.location),b=e.createURL(a),w=m?Object.keys(m)[0]:void 0,k=function(e,t){let n=e;if(t){let r=e.findIndex((e=>e.route.id===t));r>=0&&(n=e.slice(0,r))}return n}(n,w).filter(((e,n)=>{if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,n){let r=!t||n.route.id!==t.route.id,o=void 0===e[n.route.id];return r||o}(t.loaderData,t.matches[n],e)||l.some((t=>t===e.route.id)))return!0;let a=t.matches[n],s=e;return ae(e,r({currentUrl:y,currentParams:a.params,nextUrl:b,nextParams:s.params},o,{actionResult:g,defaultShouldRevalidate:i||y.pathname+y.search===b.pathname+b.search||y.search!==b.search||oe(a,s)}))})),S=[];return c.forEach(((e,a)=>{if(!n.some((t=>t.route.id===e.routeId))||u.has(a))return;let l=v(f,e.path,p);if(!l)return void S.push({key:a,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let c=t.fetchers.get(a),h=Ce(l,e.path),m=!1;m=!d.has(a)&&(!!s.includes(a)||(c&&"idle"!==c.state&&void 0===c.data?i:ae(h,r({currentUrl:y,currentParams:t.matches[t.matches.length-1].params,nextUrl:b,nextParams:n[n.length-1].params},o,{actionResult:g,defaultShouldRevalidate:i})))),m&&S.push({key:a,routeId:e.routeId,path:e.path,matches:l,match:h,controller:new AbortController})})),[k,S]}function oe(e,t){let n=e.route.path;return e.pathname!==t.pathname||null!=n&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function ae(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if("boolean"==typeof n)return n}return t.defaultShouldRevalidate}async function ie(e,t,n){if(!e.lazy)return;let o=await e.lazy();if(!e.lazy)return;let a=n[e.id];l(a,"No route found in manifest");let i={};for(let e in o){let t=void 0!==a[e]&&"hasErrorBoundary"!==e;s(!t,'Route "'+a.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||h.has(e)||(i[e]=o[e])}Object.assign(a,i),Object.assign(a,r({},t(a),{lazy:void 0}))}async function le(e,t,n,r,o,a,i,s){let u,c,d;void 0===s&&(s={});let f=e=>{let r,o=new Promise(((e,t)=>r=t));return d=()=>r(),t.signal.addEventListener("abort",d),Promise.race([e({request:t,params:n.params,context:s.requestContext}),o])};try{let r=n.route[e];if(n.route.lazy)if(r){let e,t=await Promise.all([f(r).catch((t=>{e=t})),ie(n.route,a,o)]);if(e)throw e;c=t[0]}else{if(await ie(n.route,a,o),r=n.route[e],!r){if("action"===e){let e=new URL(t.url),r=e.pathname+e.search;throw me(405,{method:t.method,pathname:r,routeId:n.route.id})}return{type:p.data,data:void 0}}c=await f(r)}else{if(!r){let e=new URL(t.url);throw me(404,{pathname:e.pathname+e.search})}c=await f(r)}l(void 0!==c,"You defined "+("action"===e?"an action":"a loader")+' for route "'+n.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){u=p.error,c=e}finally{d&&t.signal.removeEventListener("abort",d)}if(null!=(h=c)&&"number"==typeof h.status&&"string"==typeof h.statusText&&"object"==typeof h.headers&&void 0!==h.body){let e,o=c.status;if(K.has(o)){let e=c.headers.get("Location");if(l(e,"Redirects returned/thrown from loaders/actions must have a Location header"),Q.test(e)){if(!s.isStaticRequest){let n=new URL(t.url),r=e.startsWith("//")?new URL(n.protocol+e):new URL(e),o=null!=O(r.pathname,i);r.origin===n.origin&&o&&(e=r.pathname+r.search+r.hash)}}else e=te(new URL(t.url),r.slice(0,r.indexOf(n)+1),i,!0,e);if(s.isStaticRequest)throw c.headers.set("Location",e),c;return{type:p.redirect,status:o,location:e,revalidate:null!==c.headers.get("X-Remix-Revalidate"),reloadDocument:null!==c.headers.get("X-Remix-Reload-Document")}}if(s.isRouteRequest)throw{type:u===p.error?p.error:p.data,response:c};let a=c.headers.get("Content-Type");return e=a&&/\bapplication\/json\b/.test(a)?await c.json():await c.text(),u===p.error?{type:u,error:new F(o,c.statusText,e),headers:c.headers}:{type:p.data,data:e,statusCode:c.status,headers:c.headers}}var h,m,v;return u===p.error?{type:u,error:c}:function(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}(c)?{type:p.deferred,deferredData:c,statusCode:null==(m=c.init)?void 0:m.status,headers:(null==(v=c.init)?void 0:v.headers)&&new Headers(c.init.headers)}:{type:p.data,data:c}}function se(e,t,n,r){let o=e.createURL(ge(t)).toString(),a={signal:n};if(r&&ke(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),"application/json"===t?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):"text/plain"===t?a.body=r.text:"application/x-www-form-urlencoded"===t&&r.formData?a.body=ue(r.formData):a.body=r.formData}return new Request(o,a)}function ue(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,"string"==typeof r?r:r.name);return t}function ce(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function de(e,t,n,o,a,i,s,u){let{loaderData:c,errors:d}=function(e,t,n,r,o){let a,i={},s=null,u=!1,c={};return n.forEach(((n,d)=>{let f=t[d].route.id;if(l(!we(n),"Cannot handle redirect results in processLoaderData"),be(n)){let t=pe(e,f),o=n.error;r&&(o=Object.values(r)[0],r=void 0),s=s||{},null==s[t.route.id]&&(s[t.route.id]=o),i[f]=void 0,u||(u=!0,a=W(n.error)?n.error.status:500),n.headers&&(c[f]=n.headers)}else ye(n)?(o.set(f,n.deferredData),i[f]=n.deferredData.data):i[f]=n.data,null==n.statusCode||200===n.statusCode||u||(a=n.statusCode),n.headers&&(c[f]=n.headers)})),r&&(s=r,i[Object.keys(r)[0]]=void 0),{loaderData:i,errors:s,statusCode:a||200,loaderHeaders:c}}(t,n,o,a,u);for(let t=0;te.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function he(e){let t=1===e.length?e[0]:e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function me(e,t){let{pathname:n,routeId:r,method:o,type:a}=void 0===t?{}:t,i="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&n&&r?l="You made a "+o+' request to "'+n+'" but did not provide a `loader` for route "'+r+'", so there is no way to handle the request.':"defer-action"===a?l="defer() is not supported in actions":"invalid-body"===a&&(l="Unable to encode submission body")):403===e?(i="Forbidden",l='Route "'+r+'" does not match URL "'+n+'"'):404===e?(i="Not Found",l='No route matches URL "'+n+'"'):405===e&&(i="Method Not Allowed",o&&n&&r?l="You made a "+o.toUpperCase()+' request to "'+n+'" but did not provide an `action` for route "'+r+'", so there is no way to handle the request.':o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new F(e||500,i,new Error(l),!0)}function ve(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(we(n))return{result:n,idx:t}}}function ge(e){return d(r({},"string"==typeof e?f(e):e,{hash:""}))}function ye(e){return e.type===p.deferred}function be(e){return e.type===p.error}function we(e){return(e&&e.type)===p.redirect}function ke(e){return V.has(e.toLowerCase())}async function Se(e,t,n,r,o,a){for(let i=0;ie.route.id===u.route.id)),d=null!=c&&!oe(c,u)&&void 0!==(a&&a[u.route.id]);if(ye(s)&&(o||d)){let e=r[i];l(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await Ee(s,e,o).then((e=>{e&&(n[i]=e||n[i])}))}}}async function Ee(e,t,n){if(void 0===n&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:p.data,data:e.deferredData.unwrappedData}}catch(e){return{type:p.error,error:e}}return{type:p.data,data:e.deferredData.data}}}function xe(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Ce(e,t){let n="string"==typeof t?f(t).search:t.search;if(e[e.length-1].route.index&&xe(n||""))return e[e.length-1];let r=N(e);return r[r.length-1]}function _e(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:a,json:i}=e;if(t&&n&&r)return null!=o?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o}:null!=a?{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:i,text:void 0}:void 0}function Pe(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Te(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Re(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}Symbol("deferred")},489:(e,t)=>{t.Q=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},r=(t||{}).decode||o,a=0;a{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(r)for(var l=0;l0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=a),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},81:e=>{e.exports=function(e){return e[1]}},499:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(294),o=n(489);function a(e,t={}){const n=function(e){return e&&"j"===e[0]&&":"===e[1]?e.substr(2):e}(e);if(!t.doNotParse)try{return JSON.parse(n)}catch(e){}return e}const i=r.createContext(new class{constructor(e,t={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const e=this.cookies;this.cookies=o.Q(document.cookie),this._checkChanges(e)};const n="undefined"==typeof document?"":document.cookie;this.cookies=function(e){return"string"==typeof e?o.Q(e):"object"==typeof e&&null!==e?e:{}}(e||n),this.defaultSetOptions=t,this.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie}_emitChange(e){for(let t=0;t{e[t]!==this.cookies[t]&&this._emitChange({name:t,value:a(e[t])})}))}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(e,t={}){return t.doNotUpdate||this.update(),a(this.cookies[e],t)}getAll(e={}){e.doNotUpdate||this.update();const t={};for(let n in this.cookies)t[n]=a(this.cookies[n],e);return t}set(e,t,n){n=n?Object.assign(Object.assign({},this.defaultSetOptions),n):this.defaultSetOptions;const r="string"==typeof t?t:JSON.stringify(t);this.cookies=Object.assign(Object.assign({},this.cookies),{[e]:r}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=o.q(e,r,n)),this._emitChange({name:e,value:t,options:n})}remove(e,t){const n=t=Object.assign(Object.assign({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=o.q(e,"",n)),this._emitChange({name:e,value:void 0,options:t})}addChangeListener(e){this.changeListeners.push(e),1===this.changeListeners.length&&("object"==typeof window&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(e){const t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1),0===this.changeListeners.length&&("object"==typeof window&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}}),{Provider:l,Consumer:s}=i,u=i;function c(e){const t=(0,r.useContext)(u);if(!t)throw new Error("Missing ");const[n,o]=(0,r.useState)((()=>t.getAll()));"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement&&(0,r.useLayoutEffect)((()=>{function r(){const r=t.getAll({doNotUpdate:!0});(function(e,t,n){if(!e)return!0;for(let r of e)if(t[r]!==n[r])return!0;return!1})(e||null,r,n)&&o(r)}return t.addChangeListener(r),()=>{t.removeChangeListener(r)}}),[t,n]);const a=(0,r.useMemo)((()=>t.set.bind(t)),[t]),i=(0,r.useMemo)((()=>t.remove.bind(t)),[t]),l=(0,r.useMemo)((()=>t.update.bind(t)),[t]);return[n,a,i,l]}},448:(e,t,n)=>{var r=n(294),o=n(840);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n