@sesamy/sesamy-js 1.18.0 → 1.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -2
- package/dist/sesamy-js.cjs +5 -5
- package/dist/sesamy-js.d.ts +1 -0
- package/dist/sesamy-js.iife.js +5 -5
- package/dist/sesamy-js.mjs +3985 -2385
- package/package.json +9 -3
package/dist/sesamy-js.iife.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var sesamyJs=function(re){"use strict";var sa=Object.defineProperty;var ca=(re,X,V)=>X in re?sa(re,X,{enumerable:!0,configurable:!0,writable:!0,value:V}):re[X]=V;var ee=(re,X,V)=>ca(re,typeof X!="symbol"?X+"":X,V);function X(t,e){const n=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});dispatchEvent(n)}function V(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}typeof SuppressedError=="function"&&SuppressedError;var he=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function mt(t,e){return t(e={exports:{}},e.exports),e.exports}var fe=mt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function r(){var i=this;this.locked=new Map,this.addToLocked=function(o,a){var s=i.locked.get(o);s===void 0?a===void 0?i.locked.set(o,[]):i.locked.set(o,[a]):a!==void 0&&(s.unshift(a),i.locked.set(o,s))},this.isLocked=function(o){return i.locked.has(o)},this.lock=function(o){return new Promise(function(a,s){i.isLocked(o)?i.addToLocked(o,a):(i.addToLocked(o),a())})},this.unlock=function(o){var a=i.locked.get(o);if(a!==void 0&&a.length!==0){var s=a.pop();i.locked.set(o,a),s!==void 0&&setTimeout(s,0)}else i.locked.delete(o)}}return r.getInstance=function(){return r.instance===void 0&&(r.instance=new r),r.instance},r}();e.default=function(){return n.getInstance()}});pt(fe);var Mr=pt(mt(function(t,e){var n=he&&he.__awaiter||function(u,c,f,d){return new(f||(f=Promise))(function(b,I){function w(y){try{_(d.next(y))}catch(l){I(l)}}function E(y){try{_(d.throw(y))}catch(l){I(l)}}function _(y){y.done?b(y.value):new f(function(l){l(y.value)}).then(w,E)}_((d=d.apply(u,c||[])).next())})},r=he&&he.__generator||function(u,c){var f,d,b,I,w={label:0,sent:function(){if(1&b[0])throw b[1];return b[1]},trys:[],ops:[]};return I={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function E(_){return function(y){return function(l){if(f)throw new TypeError("Generator is already executing.");for(;w;)try{if(f=1,d&&(b=2&l[0]?d.return:l[0]?d.throw||((b=d.return)&&b.call(d),0):d.next)&&!(b=b.call(d,l[1])).done)return b;switch(d=0,b&&(l=[2&l[0],b.value]),l[0]){case 0:case 1:b=l;break;case 4:return w.label++,{value:l[1],done:!1};case 5:w.label++,d=l[1],l=[0];continue;case 7:l=w.ops.pop(),w.trys.pop();continue;default:if(b=w.trys,!((b=b.length>0&&b[b.length-1])||l[0]!==6&&l[0]!==2)){w=0;continue}if(l[0]===3&&(!b||l[1]>b[0]&&l[1]<b[3])){w.label=l[1];break}if(l[0]===6&&w.label<b[1]){w.label=b[1],b=l;break}if(b&&w.label<b[2]){w.label=b[2],w.ops.push(l);break}b[2]&&w.ops.pop(),w.trys.pop();continue}l=c.call(u,w)}catch(k){l=[6,k],d=0}finally{f=b=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([_,y])}}},i=he;Object.defineProperty(e,"__esModule",{value:!0});var o="browser-tabs-lock-key",a={key:function(u){return n(i,void 0,void 0,function(){return r(this,function(c){throw new Error("Unsupported")})})},getItem:function(u){return n(i,void 0,void 0,function(){return r(this,function(c){throw new Error("Unsupported")})})},clear:function(){return n(i,void 0,void 0,function(){return r(this,function(u){return[2,window.localStorage.clear()]})})},removeItem:function(u){return n(i,void 0,void 0,function(){return r(this,function(c){throw new Error("Unsupported")})})},setItem:function(u,c){return n(i,void 0,void 0,function(){return r(this,function(f){throw new Error("Unsupported")})})},keySync:function(u){return window.localStorage.key(u)},getItemSync:function(u){return window.localStorage.getItem(u)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(u){return window.localStorage.removeItem(u)},setItemSync:function(u,c){return window.localStorage.setItem(u,c)}};function s(u){return new Promise(function(c){return setTimeout(c,u)})}function h(u){for(var c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",f="",d=0;d<u;d++)f+=c[Math.floor(Math.random()*c.length)];return f}var p=function(){function u(c){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+h(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=c,u.waiters===void 0&&(u.waiters=[])}return u.prototype.acquireLock=function(c,f){return f===void 0&&(f=5e3),n(this,void 0,void 0,function(){var d,b,I,w,E,_,y;return r(this,function(l){switch(l.label){case 0:d=Date.now()+h(4),b=Date.now()+f,I=o+"-"+c,w=this.storageHandler===void 0?a:this.storageHandler,l.label=1;case 1:return Date.now()<b?[4,s(30)]:[3,8];case 2:return l.sent(),w.getItemSync(I)!==null?[3,5]:(E=this.id+"-"+c+"-"+d,[4,s(Math.floor(25*Math.random()))]);case 3:return l.sent(),w.setItemSync(I,JSON.stringify({id:this.id,iat:d,timeoutKey:E,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,s(30)];case 4:return l.sent(),(_=w.getItemSync(I))!==null&&(y=JSON.parse(_)).id===this.id&&y.iat===d?(this.acquiredIatSet.add(d),this.refreshLockWhileAcquired(I,d),[2,!0]):[3,7];case 5:return u.lockCorrector(this.storageHandler===void 0?a:this.storageHandler),[4,this.waitForSomethingToChange(b)];case 6:l.sent(),l.label=7;case 7:return d=Date.now()+h(4),[3,1];case 8:return[2,!1]}})})},u.prototype.refreshLockWhileAcquired=function(c,f){return n(this,void 0,void 0,function(){var d=this;return r(this,function(b){return setTimeout(function(){return n(d,void 0,void 0,function(){var I,w,E;return r(this,function(_){switch(_.label){case 0:return[4,fe.default().lock(f)];case 1:return _.sent(),this.acquiredIatSet.has(f)?(I=this.storageHandler===void 0?a:this.storageHandler,(w=I.getItemSync(c))===null?(fe.default().unlock(f),[2]):((E=JSON.parse(w)).timeRefreshed=Date.now(),I.setItemSync(c,JSON.stringify(E)),fe.default().unlock(f),this.refreshLockWhileAcquired(c,f),[2])):(fe.default().unlock(f),[2])}})})},1e3),[2]})})},u.prototype.waitForSomethingToChange=function(c){return n(this,void 0,void 0,function(){return r(this,function(f){switch(f.label){case 0:return[4,new Promise(function(d){var b=!1,I=Date.now(),w=!1;function E(){if(w||(window.removeEventListener("storage",E),u.removeFromWaiting(E),clearTimeout(_),w=!0),!b){b=!0;var y=50-(Date.now()-I);y>0?setTimeout(d,y):d(null)}}window.addEventListener("storage",E),u.addToWaiting(E);var _=setTimeout(E,Math.max(0,c-Date.now()))})];case 1:return f.sent(),[2]}})})},u.addToWaiting=function(c){this.removeFromWaiting(c),u.waiters!==void 0&&u.waiters.push(c)},u.removeFromWaiting=function(c){u.waiters!==void 0&&(u.waiters=u.waiters.filter(function(f){return f!==c}))},u.notifyWaiters=function(){u.waiters!==void 0&&u.waiters.slice().forEach(function(c){return c()})},u.prototype.releaseLock=function(c){return n(this,void 0,void 0,function(){return r(this,function(f){switch(f.label){case 0:return[4,this.releaseLock__private__(c)];case 1:return[2,f.sent()]}})})},u.prototype.releaseLock__private__=function(c){return n(this,void 0,void 0,function(){var f,d,b,I;return r(this,function(w){switch(w.label){case 0:return f=this.storageHandler===void 0?a:this.storageHandler,d=o+"-"+c,(b=f.getItemSync(d))===null?[2]:(I=JSON.parse(b)).id!==this.id?[3,2]:[4,fe.default().lock(I.iat)];case 1:w.sent(),this.acquiredIatSet.delete(I.iat),f.removeItemSync(d),fe.default().unlock(I.iat),u.notifyWaiters(),w.label=2;case 2:return[2]}})})},u.lockCorrector=function(c){for(var f=Date.now()-5e3,d=c,b=[],I=0;;){var w=d.keySync(I);if(w===null)break;b.push(w),I++}for(var E=!1,_=0;_<b.length;_++){var y=b[_];if(y.includes(o)){var l=d.getItemSync(y);if(l!==null){var k=JSON.parse(l);(k.timeRefreshed===void 0&&k.timeAcquired<f||k.timeRefreshed!==void 0&&k.timeRefreshed<f)&&(d.removeItemSync(y),E=!0)}}}E&&u.notifyWaiters()},u.waiters=void 0,u}();e.default=p}));const Zr={timeoutInSeconds:60},Vt={name:"auth0-spa-js",version:"2.1.3"},Yt=()=>Date.now();let q=class Jt extends Error{constructor(e,n){super(n),this.error=e,this.error_description=n,Object.setPrototypeOf(this,Jt.prototype)}static fromPayload({error:e,error_description:n}){return new Jt(e,n)}},Hr=class Lr extends q{constructor(e,n,r,i=null){super(e,n),this.state=r,this.appState=i,Object.setPrototypeOf(this,Lr.prototype)}},gt=class Ur extends q{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,Ur.prototype)}},Kr=class Rr extends gt{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,Rr.prototype)}},Wr=class Nr extends q{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,Nr.prototype)}},Fr=class Dr extends q{constructor(e,n,r){super(e,n),this.mfa_token=r,Object.setPrototypeOf(this,Dr.prototype)}},Gt=class zr extends q{constructor(e,n){super("missing_refresh_token",`Missing Refresh Token (audience: '${Bt(e,["default"])}', scope: '${Bt(n)}')`),this.audience=e,this.scope=n,Object.setPrototypeOf(this,zr.prototype)}};function Bt(t,e=[]){return t&&!e.includes(t)?t:""}const Ve=()=>window.crypto,yt=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(Ve().getRandomValues(new Uint8Array(43))).forEach(n=>e+=t[n%t.length]),e},qt=t=>btoa(t),vt=t=>{var{clientId:e}=t,n=V(t,["clientId"]);return new URLSearchParams((r=>Object.keys(r).filter(i=>r[i]!==void 0).reduce((i,o)=>Object.assign(Object.assign({},i),{[o]:r[o]}),{}))(Object.assign({client_id:e},n))).toString()},Qt=t=>(e=>decodeURIComponent(atob(e).split("").map(n=>"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),Jr=async(t,e)=>{const n=await fetch(t,e);return{ok:n.ok,json:await n.json()}},Xr=async(t,e,n)=>{const r=new AbortController;let i;return e.signal=r.signal,Promise.race([Jr(t,e),new Promise((o,a)=>{i=setTimeout(()=>{r.abort(),a(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(i)})},Vr=async(t,e,n,r,i,o,a)=>{return s={auth:{audience:e,scope:n},timeout:i,fetchUrl:t,fetchOptions:r,useFormData:a},h=o,new Promise(function(p,u){const c=new MessageChannel;c.port1.onmessage=function(f){f.data.error?u(new Error(f.data.error)):p(f.data),c.port1.close()},h.postMessage(s,[c.port2])});var s,h},Yr=async(t,e,n,r,i,o,a=1e4)=>i?Vr(t,e,n,r,a,i,o):Xr(t,r,a);async function Gr(t,e){var{baseUrl:n,timeout:r,audience:i,scope:o,auth0Client:a,useFormData:s}=t,h=V(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const p=s?vt(h):JSON.stringify(h);return await async function(u,c,f,d,b,I,w){let E,_=null;for(let A=0;A<3;A++)try{E=await Yr(u,f,d,b,I,w,c),_=null;break}catch(z){_=z}if(_)throw _;const y=E.json,{error:l,error_description:k}=y,O=V(y,["error","error_description"]),{ok:j}=E;if(!j){const A=k||`HTTP error. Unable to fetch ${u}`;throw l==="mfa_required"?new Fr(l,A,O.mfa_token):l==="missing_refresh_token"?new Gt(f,d):new q(l||"request_error",A)}return O}(`${n}/oauth/token`,r,i||"default",o,{method:"POST",body:p,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||Vt))}},e,s)}const Ye=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};let pe=class Xt{constructor(e,n="@@auth0spajs@@",r){this.prefix=n,this.suffix=r,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[n,r,i,o]=e.split("::");return new Xt({clientId:r,scope:o,audience:i},n)}static fromCacheEntry(e){const{scope:n,audience:r,client_id:i}=e;return new Xt({scope:n,audience:r,clientId:i})}},Br=class{set(e,n){localStorage.setItem(e,JSON.stringify(n))}get(e){const n=window.localStorage.getItem(e);if(n)try{return JSON.parse(n)}catch{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}},en=class{constructor(){this.enclosedCache=function(){let e={};return{set(n,r){e[n]=r},get(n){const r=e[n];if(r)return r},remove(n){delete e[n]},allKeys:()=>Object.keys(e)}}()}},qr=class{constructor(e,n,r){this.cache=e,this.keyManifest=n,this.nowProvider=r||Yt}async setIdToken(e,n,r){var i;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:n,decodedToken:r}),await((i=this.keyManifest)===null||i===void 0?void 0:i.add(o))}async getIdToken(e){const n=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!n&&e.scope&&e.audience){const r=await this.get(e);return!r||!r.id_token||!r.decodedToken?void 0:{id_token:r.id_token,decodedToken:r.decodedToken}}if(n)return{id_token:n.id_token,decodedToken:n.decodedToken}}async get(e,n=0){var r;let i=await this.cache.get(e.toKey());if(!i){const s=await this.getCacheKeys();if(!s)return;const h=this.matchExistingCacheKey(e,s);h&&(i=await this.cache.get(h))}if(!i)return;const o=await this.nowProvider(),a=Math.floor(o/1e3);return i.expiresAt-n<a?i.body.refresh_token?(i.body={refresh_token:i.body.refresh_token},await this.cache.set(e.toKey(),i),i.body):(await this.cache.remove(e.toKey()),void await((r=this.keyManifest)===null||r===void 0?void 0:r.remove(e.toKey()))):i.body}async set(e){var n;const r=new pe({clientId:e.client_id,scope:e.scope,audience:e.audience}),i=await this.wrapCacheEntry(e);await this.cache.set(r.toKey(),i),await((n=this.keyManifest)===null||n===void 0?void 0:n.add(r.toKey()))}async clear(e){var n;const r=await this.getCacheKeys();r&&(await r.filter(i=>!e||i.includes(e)).reduce(async(i,o)=>{await i,await this.cache.remove(o)},Promise.resolve()),await((n=this.keyManifest)===null||n===void 0?void 0:n.clear()))}async wrapCacheEntry(e){const n=await this.nowProvider();return{body:e,expiresAt:Math.floor(n/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?(e=await this.keyManifest.get())===null||e===void 0?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new pe({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,n){return n.filter(r=>{var i;const o=pe.fromKey(r),a=new Set(o.scope&&o.scope.split(" ")),s=((i=e.scope)===null||i===void 0?void 0:i.split(" "))||[],h=o.scope&&s.reduce((p,u)=>p&&a.has(u),!0);return o.prefix==="@@auth0spajs@@"&&o.clientId===e.clientId&&o.audience===e.audience&&h})[0]}},Qr=class{constructor(e,n,r){this.storage=e,this.clientId=n,this.cookieDomain=r,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 Re=t=>typeof t=="number",ei=["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"],ti=t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(o=>{const a=o.split("."),[s,h,p]=a;if(a.length!==3||!s||!h||!p)throw new Error("ID token could not be decoded");const u=JSON.parse(Qt(h)),c={__raw:o},f={};return Object.keys(u).forEach(d=>{c[d]=u[d],ei.includes(d)||(f[d]=u[d])}),{encoded:{header:s,payload:h,signature:p},header:JSON.parse(Qt(s)),claims:c,user:f}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(e.header.alg!=="RS256")throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||typeof e.claims.aud!="string"&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.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(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!Re(e.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(e.claims.exp==null||!Re(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Re(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=t.leeway||60,r=new Date(t.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+n),r>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);if(e.claims.nbf!=null&&Re(e.claims.nbf)){const o=new Date(0);if(o.setUTCSeconds(e.claims.nbf-n),r<o)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${o}`)}if(e.claims.auth_time!=null&&Re(e.claims.auth_time)){const o=new Date(0);if(o.setUTCSeconds(parseInt(e.claims.auth_time)+t.max_age+n),r>o)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(t.organization){const o=t.organization.trim();if(o.startsWith("org_")){const a=o;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(a!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${a}", found "${e.claims.org_id}"`)}else{const a=o.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(a!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${a}", found "${e.claims.org_name}"`)}}return e};var me=mt(function(t,e){var n=he&&he.__assign||function(){return n=Object.assign||function(h){for(var p,u=1,c=arguments.length;u<c;u++)for(var f in p=arguments[u])Object.prototype.hasOwnProperty.call(p,f)&&(h[f]=p[f]);return h},n.apply(this,arguments)};function r(h,p){if(!p)return"";var u="; "+h;return p===!0?u:u+"="+p}function i(h,p,u){return encodeURIComponent(h).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(p).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(c){if(typeof c.expires=="number"){var f=new Date;f.setMilliseconds(f.getMilliseconds()+864e5*c.expires),c.expires=f}return r("Expires",c.expires?c.expires.toUTCString():"")+r("Domain",c.domain)+r("Path",c.path)+r("Secure",c.secure)+r("SameSite",c.sameSite)}(u)}function o(h){for(var p={},u=h?h.split("; "):[],c=/(%[\dA-F]{2})+/gi,f=0;f<u.length;f++){var d=u[f].split("="),b=d.slice(1).join("=");b.charAt(0)==='"'&&(b=b.slice(1,-1));try{p[d[0].replace(c,decodeURIComponent)]=b.replace(c,decodeURIComponent)}catch{}}return p}function a(){return o(document.cookie)}function s(h,p,u){document.cookie=i(h,p,n({path:"/"},u))}e.__esModule=!0,e.encode=i,e.parse=o,e.getAll=a,e.get=function(h){return a()[h]},e.set=s,e.remove=function(h,p){s(h,"",n(n({},p),{expires:-1}))}});pt(me),me.encode,me.parse,me.getAll;var ni=me.get,tn=me.set,nn=me.remove;const Se={get(t){const e=ni(t);if(e!==void 0)return JSON.parse(e)},save(t,e,n){let r={};window.location.protocol==="https:"&&(r={secure:!0,sameSite:"none"}),n!=null&&n.daysUntilExpire&&(r.expires=n.daysUntilExpire),n!=null&&n.cookieDomain&&(r.domain=n.cookieDomain),tn(t,JSON.stringify(e),r)},remove(t,e){let n={};e!=null&&e.cookieDomain&&(n.domain=e.cookieDomain),nn(t,n)}},ri={get(t){return Se.get(t)||Se.get(`_legacy_${t}`)},save(t,e,n){let r={};window.location.protocol==="https:"&&(r={secure:!0}),n!=null&&n.daysUntilExpire&&(r.expires=n.daysUntilExpire),n!=null&&n.cookieDomain&&(r.domain=n.cookieDomain),tn(`_legacy_${t}`,JSON.stringify(e),r),Se.save(t,e,n)},remove(t,e){let n={};e!=null&&e.cookieDomain&&(n.domain=e.cookieDomain),nn(t,n),Se.remove(t,e),Se.remove(`_legacy_${t}`,e)}},ii={get(t){if(typeof sessionStorage>"u")return;const e=sessionStorage.getItem(t);return e!=null?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};function oi(t,e,n){var r=e===void 0?null:e,i=function(h,p){var u=atob(h);if(p){for(var c=new Uint8Array(u.length),f=0,d=u.length;f<d;++f)c[f]=u.charCodeAt(f);return String.fromCharCode.apply(null,new Uint16Array(c.buffer))}return u}(t,n!==void 0&&n),o=i.indexOf(`
|
|
2
|
-
`,10)+1,a
|
|
1
|
+
var sesamyJs=function(Te){"use strict";var SS=Object.defineProperty;var IS=(Te,ie,G)=>ie in Te?SS(Te,ie,{enumerable:!0,configurable:!0,writable:!0,value:G}):Te[ie]=G;var he=(Te,ie,G)=>IS(Te,typeof ie!="symbol"?ie+"":ie,G);var ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},G=function(e){try{return!!e()}catch{return!0}},Ol=G,dn=!Ol(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),Li=dn,Ui=Function.prototype,hn=Ui.call,_l=Li&&Ui.bind.bind(hn,hn),B=Li?_l:function(e){return function(){return hn.apply(e,arguments)}},xi=B,Rl=xi({}.toString),Cl=xi("".slice),vn=function(e){return Cl(Rl(e),8,-1)},jl=B,Al=G,Ll=vn,pn=Object,Ul=jl("".split),Ni=Al(function(){return!pn("z").propertyIsEnumerable(0)})?function(e){return Ll(e)==="String"?Ul(e,""):pn(e)}:pn,mn=function(e){return e==null},xl=mn,Nl=TypeError,fr=function(e){if(xl(e))throw new Nl("Can't call method on "+e);return e},Dl=Ni,Ml=fr,Lt=function(e){return Dl(Ml(e))},Ut=function(e){return e&&e.Math===Math&&e},X=Ut(typeof globalThis=="object"&&globalThis)||Ut(typeof window=="object"&&window)||Ut(typeof self=="object"&&self)||Ut(typeof ie=="object"&&ie)||Ut(typeof ie=="object"&&ie)||function(){return this}()||Function("return this")(),Di={exports:{}},Fl=!1,Mi=X,zl=Object.defineProperty,gn=function(e,t){try{zl(Mi,e,{value:t,configurable:!0,writable:!0})}catch{Mi[e]=t}return t},Hl=X,Bl=gn,Fi="__core-js_shared__",zi=Di.exports=Hl[Fi]||Bl(Fi,{});(zi.versions||(zi.versions=[])).push({version:"3.37.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"});var yn=Di.exports,Hi=yn,Bi=function(e,t){return Hi[e]||(Hi[e]=t||{})},Kl=fr,Gl=Object,dr=function(e){return Gl(Kl(e))},Wl=B,Vl=dr,Zl=Wl({}.hasOwnProperty),ve=Object.hasOwn||function(t,r){return Zl(Vl(t),r)},Yl=B,Jl=0,Xl=Math.random(),ql=Yl(1 .toString),Ki=function(e){return"Symbol("+(e===void 0?"":e)+")_"+ql(++Jl+Xl,36)},Ql=typeof navigator<"u"&&String(navigator.userAgent)||"",Gi=X,wn=Ql,Wi=Gi.process,Vi=Gi.Deno,Zi=Wi&&Wi.versions||Vi&&Vi.version,Yi=Zi&&Zi.v8,pe,hr;Yi&&(pe=Yi.split("."),hr=pe[0]>0&&pe[0]<4?1:+(pe[0]+pe[1])),!hr&&wn&&(pe=wn.match(/Edge\/(\d+)/),(!pe||pe[1]>=74)&&(pe=wn.match(/Chrome\/(\d+)/),pe&&(hr=+pe[1])));var ef=hr,Ji=ef,tf=G,rf=X,nf=rf.String,Xi=!!Object.getOwnPropertySymbols&&!tf(function(){var e=Symbol("symbol detection");return!nf(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Ji&&Ji<41}),af=Xi,qi=af&&!Symbol.sham&&typeof Symbol.iterator=="symbol",of=X,sf=Bi,Qi=ve,cf=Ki,uf=Xi,lf=qi,ot=of.Symbol,bn=sf("wks"),ff=lf?ot.for||ot:ot&&ot.withoutSetter||cf,oe=function(e){return Qi(bn,e)||(bn[e]=uf&&Qi(ot,e)?ot[e]:ff("Symbol."+e)),bn[e]},Sn=typeof document=="object"&&document.all,Y=typeof Sn>"u"&&Sn!==void 0?function(e){return typeof e=="function"||e===Sn}:function(e){return typeof e=="function"},df=Y,Ee=function(e){return typeof e=="object"?e!==null:df(e)},hf=Ee,vf=String,pf=TypeError,Ae=function(e){if(hf(e))return e;throw new pf(vf(e)+" is not an object")},eo={},mf=G,J=!mf(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),gf=J,yf=G,to=gf&&yf(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),be={},wf=X,ro=Ee,In=wf.document,bf=ro(In)&&ro(In.createElement),$n=function(e){return bf?In.createElement(e):{}},Sf=J,If=G,$f=$n,no=!Sf&&!If(function(){return Object.defineProperty($f("div"),"a",{get:function(){return 7}}).a!==7}),kf=dn,vr=Function.prototype.call,Se=kf?vr.bind(vr):function(){return vr.apply(vr,arguments)},kn=X,Pf=Y,Tf=function(e){return Pf(e)?e:void 0},st=function(e,t){return arguments.length<2?Tf(kn[e]):kn[e]&&kn[e][t]},Ef=B,ao=Ef({}.isPrototypeOf),Of=st,_f=Y,Rf=ao,Cf=qi,jf=Object,io=Cf?function(e){return typeof e=="symbol"}:function(e){var t=Of("Symbol");return _f(t)&&Rf(t.prototype,jf(e))},Af=String,oo=function(e){try{return Af(e)}catch{return"Object"}},Lf=Y,Uf=oo,xf=TypeError,pr=function(e){if(Lf(e))return e;throw new xf(Uf(e)+" is not a function")},Nf=pr,Df=mn,Pn=function(e,t){var r=e[t];return Df(r)?void 0:Nf(r)},Tn=Se,En=Y,On=Ee,Mf=TypeError,Ff=function(e,t){var r,n;if(t==="string"&&En(r=e.toString)&&!On(n=Tn(r,e))||En(r=e.valueOf)&&!On(n=Tn(r,e))||t!=="string"&&En(r=e.toString)&&!On(n=Tn(r,e)))return n;throw new Mf("Can't convert object to primitive value")},zf=Se,so=Ee,co=io,Hf=Pn,Bf=Ff,Kf=oe,Gf=TypeError,Wf=Kf("toPrimitive"),Vf=function(e,t){if(!so(e)||co(e))return e;var r=Hf(e,Wf),n;if(r){if(t===void 0&&(t="default"),n=zf(r,e,t),!so(n)||co(n))return n;throw new Gf("Can't convert object to primitive value")}return t===void 0&&(t="number"),Bf(e,t)},Zf=Vf,Yf=io,uo=function(e){var t=Zf(e,"string");return Yf(t)?t:t+""},Jf=J,Xf=no,qf=to,mr=Ae,lo=uo,Qf=TypeError,_n=Object.defineProperty,ed=Object.getOwnPropertyDescriptor,Rn="enumerable",Cn="configurable",jn="writable";be.f=Jf?qf?function(t,r,n){if(mr(t),r=lo(r),mr(n),typeof t=="function"&&r==="prototype"&&"value"in n&&jn in n&&!n[jn]){var a=ed(t,r);a&&a[jn]&&(t[r]=n.value,n={configurable:Cn in n?n[Cn]:a[Cn],enumerable:Rn in n?n[Rn]:a[Rn],writable:!1})}return _n(t,r,n)}:_n:function(t,r,n){if(mr(t),r=lo(r),mr(n),Xf)try{return _n(t,r,n)}catch{}if("get"in n||"set"in n)throw new Qf("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var td=Math.ceil,rd=Math.floor,nd=Math.trunc||function(t){var r=+t;return(r>0?rd:td)(r)},ad=nd,An=function(e){var t=+e;return t!==t||t===0?0:ad(t)},id=An,od=Math.max,sd=Math.min,cd=function(e,t){var r=id(e);return r<0?od(r+t,0):sd(r,t)},ud=An,ld=Math.min,fd=function(e){var t=ud(e);return t>0?ld(t,9007199254740991):0},dd=fd,fo=function(e){return dd(e.length)},hd=Lt,vd=cd,pd=fo,ho=function(e){return function(t,r,n){var a=hd(t),i=pd(a);if(i===0)return!e&&-1;var o=vd(n,i),c;if(e&&r!==r){for(;i>o;)if(c=a[o++],c!==c)return!0}else for(;i>o;o++)if((e||o in a)&&a[o]===r)return e||o||0;return!e&&-1}},md={includes:ho(!0),indexOf:ho(!1)},Ln={},gd=B,Un=ve,yd=Lt,wd=md.indexOf,bd=Ln,vo=gd([].push),po=function(e,t){var r=yd(e),n=0,a=[],i;for(i in r)!Un(bd,i)&&Un(r,i)&&vo(a,i);for(;t.length>n;)Un(r,i=t[n++])&&(~wd(a,i)||vo(a,i));return a},xn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Sd=po,Id=xn,mo=Object.keys||function(t){return Sd(t,Id)},$d=J,kd=to,Pd=be,Td=Ae,Ed=Lt,Od=mo;eo.f=$d&&!kd?Object.defineProperties:function(t,r){Td(t);for(var n=Ed(r),a=Od(r),i=a.length,o=0,c;i>o;)Pd.f(t,c=a[o++],n[c]);return t};var _d=st,Rd=_d("document","documentElement"),Cd=Bi,jd=Ki,go=Cd("keys"),Nn=function(e){return go[e]||(go[e]=jd(e))},Ad=Ae,Ld=eo,yo=xn,Ud=Ln,xd=Rd,Nd=$n,Dd=Nn,wo=">",bo="<",Dn="prototype",Mn="script",So=Dd("IE_PROTO"),Fn=function(){},Io=function(e){return bo+Mn+wo+e+bo+"/"+Mn+wo},$o=function(e){e.write(Io("")),e.close();var t=e.parentWindow.Object;return e=null,t},Md=function(){var e=Nd("iframe"),t="java"+Mn+":",r;return e.style.display="none",xd.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(Io("document.F=Object")),r.close(),r.F},gr,yr=function(){try{gr=new ActiveXObject("htmlfile")}catch{}yr=typeof document<"u"?document.domain&&gr?$o(gr):Md():$o(gr);for(var e=yo.length;e--;)delete yr[Dn][yo[e]];return yr()};Ud[So]=!0;var zn=Object.create||function(t,r){var n;return t!==null?(Fn[Dn]=Ad(t),n=new Fn,Fn[Dn]=null,n[So]=t):n=yr(),r===void 0?n:Ld.f(n,r)},Fd=oe,zd=zn,Hd=be.f,Hn=Fd("unscopables"),Bn=Array.prototype;Bn[Hn]===void 0&&Hd(Bn,Hn,{configurable:!0,value:zd(null)});var Bd=function(e){Bn[Hn][e]=!0},xt={},Kd=X,Gd=Y,ko=Kd.WeakMap,Wd=Gd(ko)&&/native code/.test(String(ko)),Nt=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},Vd=J,Zd=be,Yd=Nt,wr=Vd?function(e,t,r){return Zd.f(e,t,Yd(1,r))}:function(e,t,r){return e[t]=r,e},Jd=Wd,Po=X,Xd=Ee,qd=wr,Kn=ve,Gn=yn,Qd=Nn,eh=Ln,To="Object already initialized",Wn=Po.TypeError,th=Po.WeakMap,br,Dt,Sr,rh=function(e){return Sr(e)?Dt(e):br(e,{})},nh=function(e){return function(t){var r;if(!Xd(t)||(r=Dt(t)).type!==e)throw new Wn("Incompatible receiver, "+e+" required");return r}};if(Jd||Gn.state){var Ie=Gn.state||(Gn.state=new th);Ie.get=Ie.get,Ie.has=Ie.has,Ie.set=Ie.set,br=function(e,t){if(Ie.has(e))throw new Wn(To);return t.facade=e,Ie.set(e,t),t},Dt=function(e){return Ie.get(e)||{}},Sr=function(e){return Ie.has(e)}}else{var ct=Qd("state");eh[ct]=!0,br=function(e,t){if(Kn(e,ct))throw new Wn(To);return t.facade=e,qd(e,ct,t),t},Dt=function(e){return Kn(e,ct)?e[ct]:{}},Sr=function(e){return Kn(e,ct)}}var Mt={set:br,get:Dt,has:Sr,enforce:rh,getterFor:nh},Vn={},Zn={},Eo={}.propertyIsEnumerable,Oo=Object.getOwnPropertyDescriptor,ah=Oo&&!Eo.call({1:2},1);Zn.f=ah?function(t){var r=Oo(this,t);return!!r&&r.enumerable}:Eo;var ih=J,oh=Se,sh=Zn,ch=Nt,uh=Lt,lh=uo,fh=ve,dh=no,_o=Object.getOwnPropertyDescriptor;Vn.f=ih?_o:function(t,r){if(t=uh(t),r=lh(r),dh)try{return _o(t,r)}catch{}if(fh(t,r))return ch(!oh(sh.f,t,r),t[r])};var Ro={exports:{}},Yn=J,hh=ve,Co=Function.prototype,vh=Yn&&Object.getOwnPropertyDescriptor,Jn=hh(Co,"name"),ph=Jn&&(function(){}).name==="something",mh=Jn&&(!Yn||Yn&&vh(Co,"name").configurable),jo={EXISTS:Jn,PROPER:ph,CONFIGURABLE:mh},gh=B,yh=Y,Xn=yn,wh=gh(Function.toString);yh(Xn.inspectSource)||(Xn.inspectSource=function(e){return wh(e)});var Ao=Xn.inspectSource,qn=B,bh=G,Sh=Y,Ir=ve,Qn=J,Ih=jo.CONFIGURABLE,$h=Ao,Lo=Mt,kh=Lo.enforce,Ph=Lo.get,Uo=String,$r=Object.defineProperty,Th=qn("".slice),Eh=qn("".replace),Oh=qn([].join),_h=Qn&&!bh(function(){return $r(function(){},"length",{value:8}).length!==8}),Rh=String(String).split("String"),Ch=Ro.exports=function(e,t,r){Th(Uo(t),0,7)==="Symbol("&&(t="["+Eh(Uo(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Ir(e,"name")||Ih&&e.name!==t)&&(Qn?$r(e,"name",{value:t,configurable:!0}):e.name=t),_h&&r&&Ir(r,"arity")&&e.length!==r.arity&&$r(e,"length",{value:r.arity});try{r&&Ir(r,"constructor")&&r.constructor?Qn&&$r(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=kh(e);return Ir(n,"source")||(n.source=Oh(Rh,typeof t=="string"?t:"")),e};Function.prototype.toString=Ch(function(){return Sh(this)&&Ph(this).source||$h(this)},"toString");var xo=Ro.exports,jh=Y,Ah=be,Lh=xo,Uh=gn,Le=function(e,t,r,n){n||(n={});var a=n.enumerable,i=n.name!==void 0?n.name:t;if(jh(r)&&Lh(r,i,n),n.global)a?e[t]=r:Uh(t,r);else{try{n.unsafe?e[t]&&(a=!0):delete e[t]}catch{}a?e[t]=r:Ah.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},No={},xh=po,Nh=xn,Dh=Nh.concat("length","prototype");No.f=Object.getOwnPropertyNames||function(t){return xh(t,Dh)};var ea={};ea.f=Object.getOwnPropertySymbols;var Mh=st,Fh=B,zh=No,Hh=ea,Bh=Ae,Kh=Fh([].concat),Gh=Mh("Reflect","ownKeys")||function(t){var r=zh.f(Bh(t)),n=Hh.f;return n?Kh(r,n(t)):r},Do=ve,Wh=Gh,Vh=Vn,Zh=be,Yh=function(e,t,r){for(var n=Wh(t),a=Zh.f,i=Vh.f,o=0;o<n.length;o++){var c=n[o];!Do(e,c)&&!(r&&Do(r,c))&&a(e,c,i(t,c))}},Jh=G,Xh=Y,qh=/#|\.prototype\./,Ft=function(e,t){var r=ev[Qh(e)];return r===rv?!0:r===tv?!1:Xh(t)?Jh(t):!!t},Qh=Ft.normalize=function(e){return String(e).replace(qh,".").toLowerCase()},ev=Ft.data={},tv=Ft.NATIVE="N",rv=Ft.POLYFILL="P",nv=Ft,kr=X,av=Vn.f,iv=wr,ov=Le,sv=gn,cv=Yh,uv=nv,ut=function(e,t){var r=e.target,n=e.global,a=e.stat,i,o,c,l,f,u;if(n?o=kr:a?o=kr[r]||sv(r,{}):o=kr[r]&&kr[r].prototype,o)for(c in t){if(f=t[c],e.dontCallGetSet?(u=av(o,c),l=u&&u.value):l=o[c],i=uv(n?c:r+(a?".":"#")+c,e.forced),!i&&l!==void 0){if(typeof f==typeof l)continue;cv(f,l)}(e.sham||l&&l.sham)&&iv(f,"sham",!0),ov(o,c,f,e)}},lv=G,fv=!lv(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),dv=ve,hv=Y,vv=dr,pv=Nn,mv=fv,Mo=pv("IE_PROTO"),ta=Object,gv=ta.prototype,Fo=mv?ta.getPrototypeOf:function(e){var t=vv(e);if(dv(t,Mo))return t[Mo];var r=t.constructor;return hv(r)&&t instanceof r?r.prototype:t instanceof ta?gv:null},yv=G,wv=Y,bv=Ee,zo=Fo,Sv=Le,Iv=oe,ra=Iv("iterator"),Ho=!1,Ke,na,aa;[].keys&&(aa=[].keys(),"next"in aa?(na=zo(zo(aa)),na!==Object.prototype&&(Ke=na)):Ho=!0);var $v=!bv(Ke)||yv(function(){var e={};return Ke[ra].call(e)!==e});$v&&(Ke={}),wv(Ke[ra])||Sv(Ke,ra,function(){return this});var Bo={IteratorPrototype:Ke,BUGGY_SAFARI_ITERATORS:Ho},kv=be.f,Pv=ve,Tv=oe,Ko=Tv("toStringTag"),zt=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Pv(e,Ko)&&kv(e,Ko,{configurable:!0,value:t})},Ev=Bo.IteratorPrototype,Ov=zn,_v=Nt,Rv=zt,Cv=xt,jv=function(){return this},Go=function(e,t,r,n){var a=t+" Iterator";return e.prototype=Ov(Ev,{next:_v(+!n,r)}),Rv(e,a,!1),Cv[a]=jv,e},Av=B,Lv=pr,Uv=function(e,t,r){try{return Av(Lv(Object.getOwnPropertyDescriptor(e,t)[r]))}catch{}},xv=Ee,Nv=function(e){return xv(e)||e===null},Dv=Nv,Mv=String,Fv=TypeError,zv=function(e){if(Dv(e))return e;throw new Fv("Can't set "+Mv(e)+" as a prototype")},Hv=Uv,Bv=Ee,Kv=fr,Gv=zv,Wv=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=Hv(Object.prototype,"__proto__","set"),r(t,[]),e=t instanceof Array}catch{}return function(a,i){return Kv(a),Gv(i),Bv(a)&&(e?r(a,i):a.__proto__=i),a}}():void 0),Vv=ut,Zv=Se,Wo=jo,Yv=Y,Jv=Go,Vo=Fo,Zo=Wv,Xv=zt,qv=wr,ia=Le,Qv=oe,ep=xt,Yo=Bo,tp=Wo.PROPER,rp=Wo.CONFIGURABLE,Jo=Yo.IteratorPrototype,Pr=Yo.BUGGY_SAFARI_ITERATORS,Ht=Qv("iterator"),Xo="keys",Bt="values",qo="entries",np=function(){return this},Qo=function(e,t,r,n,a,i,o){Jv(r,t,n);var c=function($){if($===a&&d)return d;if(!Pr&&$&&$ in u)return u[$];switch($){case Xo:return function(){return new r(this,$)};case Bt:return function(){return new r(this,$)};case qo:return function(){return new r(this,$)}}return function(){return new r(this)}},l=t+" Iterator",f=!1,u=e.prototype,s=u[Ht]||u["@@iterator"]||a&&u[a],d=!Pr&&s||c(a),h=t==="Array"&&u.entries||s,m,S,g;if(h&&(m=Vo(h.call(new e)),m!==Object.prototype&&m.next&&(Vo(m)!==Jo&&(Zo?Zo(m,Jo):Yv(m[Ht])||ia(m,Ht,np)),Xv(m,l,!0))),tp&&a===Bt&&s&&s.name!==Bt&&(rp?qv(u,"name",Bt):(f=!0,d=function(){return Zv(s,this)})),a)if(S={values:c(Bt),keys:i?d:c(Xo),entries:c(qo)},o)for(g in S)(Pr||f||!(g in u))&&ia(u,g,S[g]);else Vv({target:t,proto:!0,forced:Pr||f},S);return u[Ht]!==d&&ia(u,Ht,d,{name:a}),ep[t]=d,S},oa=function(e,t){return{value:e,done:t}},ap=Lt,sa=Bd,es=xt,ts=Mt,ip=be.f,op=Qo,Tr=oa,sp=J,rs="Array Iterator",cp=ts.set,up=ts.getterFor(rs),lp=op(Array,"Array",function(e,t){cp(this,{type:rs,target:ap(e),index:0,kind:t})},function(){var e=up(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=void 0,Tr(void 0,!0);switch(e.kind){case"keys":return Tr(r,!1);case"values":return Tr(t[r],!1)}return Tr([r,t[r]],!1)},"values"),ns=es.Arguments=es.Array;if(sa("keys"),sa("values"),sa("entries"),sp&&ns.name!=="values")try{ip(ns,"name",{value:"values"})}catch{}var as=X,fp=J,dp=Object.getOwnPropertyDescriptor,hp=function(e){if(!fp)return as[e];var t=dp(as,e);return t&&t.value},vp=G,pp=oe,mp=J,is=Fl,gp=pp("iterator"),Er=!vp(function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),n="";return e.pathname="c%20d",t.forEach(function(a,i){t.delete("b"),n+=i+a}),r.delete("a",2),r.delete("b",void 0),is&&(!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b"))||!t.size&&(is||!mp)||!t.sort||e.href!=="http://a/c%20d?a=1&c=3"||t.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!t[gp]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://тест").host!=="xn--e1aybc"||new URL("http://a#б").hash!=="#%D0%B1"||n!=="a1c3"||new URL("http://x",void 0).host!=="x"}),os=xo,yp=be,ca=function(e,t,r){return r.get&&os(r.get,t,{getter:!0}),r.set&&os(r.set,t,{setter:!0}),yp.f(e,t,r)},wp=Le,bp=function(e,t,r){for(var n in t)wp(e,n,t[n],r);return e},Sp=ao,Ip=TypeError,ss=function(e,t){if(Sp(t,e))return e;throw new Ip("Incorrect invocation")},$p=vn,kp=B,Pp=function(e){if($p(e)==="Function")return kp(e)},cs=Pp,Tp=pr,Ep=dn,Op=cs(cs.bind),ua=function(e,t){return Tp(e),t===void 0?e:Ep?Op(e,t):function(){return e.apply(t,arguments)}},_p=oe,Rp=_p("toStringTag"),us={};us[Rp]="z";var Cp=String(us)==="[object z]",jp=Cp,Ap=Y,Or=vn,Lp=oe,Up=Lp("toStringTag"),xp=Object,Np=Or(function(){return arguments}())==="Arguments",Dp=function(e,t){try{return e[t]}catch{}},_r=jp?Or:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Dp(t=xp(e),Up))=="string"?r:Np?Or(t):(n=Or(t))==="Object"&&Ap(t.callee)?"Arguments":n},Mp=_r,Fp=String,Ue=function(e){if(Mp(e)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return Fp(e)},zp=_r,ls=Pn,Hp=mn,Bp=xt,Kp=oe,Gp=Kp("iterator"),la=function(e){if(!Hp(e))return ls(e,Gp)||ls(e,"@@iterator")||Bp[zp(e)]},Wp=Se,Vp=pr,Zp=Ae,Yp=oo,Jp=la,Xp=TypeError,fs=function(e,t){var r=arguments.length<2?Jp(e):t;if(Vp(r))return Zp(Wp(r,e));throw new Xp(Yp(e)+" is not iterable")},qp=TypeError,lt=function(e,t){if(e<t)throw new qp("Not enough arguments");return e},Qp=B,ds=Qp([].slice),hs=ds,em=Math.floor,fa=function(e,t){var r=e.length;if(r<8)for(var n=1,a,i;n<r;){for(i=n,a=e[n];i&&t(e[i-1],a)>0;)e[i]=e[--i];i!==n++&&(e[i]=a)}else for(var o=em(r/2),c=fa(hs(e,0,o),t),l=fa(hs(e,o),t),f=c.length,u=l.length,s=0,d=0;s<f||d<u;)e[s+d]=s<f&&d<u?t(c[s],l[d])<=0?c[s++]:l[d++]:s<f?c[s++]:l[d++];return e},tm=fa,da=ut,Rr=X,ha=hp,Cr=Se,$e=B,Kt=J,vs=Er,ps=Le,rm=ca,nm=bp,am=zt,im=Go,va=Mt,ms=ss,pa=Y,om=ve,sm=ua,cm=_r,um=Ae,gs=Ee,q=Ue,lm=zn,ys=Nt,ws=fs,fm=la,jr=oa,ft=lt,dm=oe,hm=tm,vm=dm("iterator"),dt="URLSearchParams",bs=dt+"Iterator",Ss=va.set,se=va.getterFor(dt),pm=va.getterFor(bs),Is=ha("fetch"),Ar=ha("Request"),Gt=ha("Headers"),ma=Ar&&Ar.prototype,$s=Gt&&Gt.prototype,mm=Rr.RegExp,gm=Rr.TypeError,ks=Rr.decodeURIComponent,ym=Rr.encodeURIComponent,wm=$e("".charAt),Ps=$e([].join),Ge=$e([].push),ga=$e("".replace),bm=$e([].shift),Ts=$e([].splice),Es=$e("".split),Sm=$e("".slice),Im=/\+/g,Os=Array(4),$m=function(e){return Os[e-1]||(Os[e-1]=mm("((?:%[\\da-f]{2}){"+e+"})","gi"))},km=function(e){try{return ks(e)}catch{return e}},_s=function(e){var t=ga(e,Im," "),r=4;try{return ks(t)}catch{for(;r;)t=ga(t,$m(r--),km);return t}},Pm=/[!'()~]|%20/g,Tm={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Em=function(e){return Tm[e]},Rs=function(e){return ga(ym(e),Pm,Em)},ya=im(function(t,r){Ss(this,{type:bs,target:se(t).entries,index:0,kind:r})},dt,function(){var t=pm(this),r=t.target,n=t.index++;if(!r||n>=r.length)return t.target=void 0,jr(void 0,!0);var a=r[n];switch(t.kind){case"keys":return jr(a.key,!1);case"values":return jr(a.value,!1)}return jr([a.key,a.value],!1)},!0),Cs=function(e){this.entries=[],this.url=null,e!==void 0&&(gs(e)?this.parseObject(e):this.parseQuery(typeof e=="string"?wm(e,0)==="?"?Sm(e,1):e:q(e)))};Cs.prototype={type:dt,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t=this.entries,r=fm(e),n,a,i,o,c,l,f;if(r)for(n=ws(e,r),a=n.next;!(i=Cr(a,n)).done;){if(o=ws(um(i.value)),c=o.next,(l=Cr(c,o)).done||(f=Cr(c,o)).done||!Cr(c,o).done)throw new gm("Expected sequence with length 2");Ge(t,{key:q(l.value),value:q(f.value)})}else for(var u in e)om(e,u)&&Ge(t,{key:u,value:q(e[u])})},parseQuery:function(e){if(e)for(var t=this.entries,r=Es(e,"&"),n=0,a,i;n<r.length;)a=r[n++],a.length&&(i=Es(a,"="),Ge(t,{key:_s(bm(i)),value:_s(Ps(i,"="))}))},serialize:function(){for(var e=this.entries,t=[],r=0,n;r<e.length;)n=e[r++],Ge(t,Rs(n.key)+"="+Rs(n.value));return Ps(t,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Lr=function(){ms(this,ht);var t=arguments.length>0?arguments[0]:void 0,r=Ss(this,new Cs(t));Kt||(this.size=r.entries.length)},ht=Lr.prototype;if(nm(ht,{append:function(t,r){var n=se(this);ft(arguments.length,2),Ge(n.entries,{key:q(t),value:q(r)}),Kt||this.length++,n.updateURL()},delete:function(e){for(var t=se(this),r=ft(arguments.length,1),n=t.entries,a=q(e),i=r<2?void 0:arguments[1],o=i===void 0?i:q(i),c=0;c<n.length;){var l=n[c];if(l.key===a&&(o===void 0||l.value===o)){if(Ts(n,c,1),o!==void 0)break}else c++}Kt||(this.size=n.length),t.updateURL()},get:function(t){var r=se(this).entries;ft(arguments.length,1);for(var n=q(t),a=0;a<r.length;a++)if(r[a].key===n)return r[a].value;return null},getAll:function(t){var r=se(this).entries;ft(arguments.length,1);for(var n=q(t),a=[],i=0;i<r.length;i++)r[i].key===n&&Ge(a,r[i].value);return a},has:function(t){for(var r=se(this).entries,n=ft(arguments.length,1),a=q(t),i=n<2?void 0:arguments[1],o=i===void 0?i:q(i),c=0;c<r.length;){var l=r[c++];if(l.key===a&&(o===void 0||l.value===o))return!0}return!1},set:function(t,r){var n=se(this);ft(arguments.length,1);for(var a=n.entries,i=!1,o=q(t),c=q(r),l=0,f;l<a.length;l++)f=a[l],f.key===o&&(i?Ts(a,l--,1):(i=!0,f.value=c));i||Ge(a,{key:o,value:c}),Kt||(this.size=a.length),n.updateURL()},sort:function(){var t=se(this);hm(t.entries,function(r,n){return r.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var r=se(this).entries,n=sm(t,arguments.length>1?arguments[1]:void 0),a=0,i;a<r.length;)i=r[a++],n(i.value,i.key,this)},keys:function(){return new ya(this,"keys")},values:function(){return new ya(this,"values")},entries:function(){return new ya(this,"entries")}},{enumerable:!0}),ps(ht,vm,ht.entries,{name:"entries"}),ps(ht,"toString",function(){return se(this).serialize()},{enumerable:!0}),Kt&&rm(ht,"size",{get:function(){return se(this).entries.length},configurable:!0,enumerable:!0}),am(Lr,dt),da({global:!0,constructor:!0,forced:!vs},{URLSearchParams:Lr}),!vs&&pa(Gt)){var Om=$e($s.has),_m=$e($s.set),js=function(e){if(gs(e)){var t=e.body,r;if(cm(t)===dt)return r=e.headers?new Gt(e.headers):new Gt,Om(r,"content-type")||_m(r,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),lm(e,{body:ys(0,q(t)),headers:ys(0,r)})}return e};if(pa(Is)&&da({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return Is(t,arguments.length>1?js(arguments[1]):{})}}),pa(Ar)){var wa=function(t){return ms(this,ma),new Ar(t,arguments.length>1?js(arguments[1]):{})};ma.constructor=wa,wa.prototype=ma,da({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:wa})}}var Rm={URLSearchParams:Lr,getState:se},Cm=Le,Ur=B,As=Ue,jm=lt,Ls=URLSearchParams,xr=Ls.prototype,Am=Ur(xr.append),Us=Ur(xr.delete),Lm=Ur(xr.forEach),Um=Ur([].push),ba=new Ls("a=1&a=2&b=3");ba.delete("a",1),ba.delete("b",void 0),ba+""!="a=2"&&Cm(xr,"delete",function(e){var t=arguments.length,r=t<2?void 0:arguments[1];if(t&&r===void 0)return Us(this,e);var n=[];Lm(this,function(s,d){Um(n,{key:d,value:s})}),jm(t,1);for(var a=As(e),i=As(r),o=0,c=0,l=!1,f=n.length,u;o<f;)u=n[o++],l||u.key===a?(l=!0,Us(this,u.key)):c++;for(;c<f;)u=n[c++],u.key===a&&u.value===i||Am(this,u.key,u.value)},{enumerable:!0,unsafe:!0});var xm=Le,xs=B,Nm=Ue,Dm=lt,Ns=URLSearchParams,Sa=Ns.prototype,Mm=xs(Sa.getAll),Fm=xs(Sa.has),Ds=new Ns("a=1");(Ds.has("a",2)||!Ds.has("a",void 0))&&xm(Sa,"has",function(t){var r=arguments.length,n=r<2?void 0:arguments[1];if(r&&n===void 0)return Fm(this,t);var a=Mm(this,t);Dm(r,1);for(var i=Nm(n),o=0;o<a.length;)if(a[o++]===i)return!0;return!1},{enumerable:!0,unsafe:!0});var zm=J,Hm=B,Bm=ca,Ia=URLSearchParams.prototype,Km=Hm(Ia.forEach);zm&&!("size"in Ia)&&Bm(Ia,"size",{get:function(){var t=0;return Km(this,function(){t++}),t},configurable:!0,enumerable:!0});var Gm=X,Ms=Gm,Wm=Ms;Wm.URLSearchParams;var $a=B,Vm=An,Zm=Ue,Ym=fr,Jm=$a("".charAt),Fs=$a("".charCodeAt),Xm=$a("".slice),zs=function(e){return function(t,r){var n=Zm(Ym(t)),a=Vm(r),i=n.length,o,c;return a<0||a>=i?e?"":void 0:(o=Fs(n,a),o<55296||o>56319||a+1===i||(c=Fs(n,a+1))<56320||c>57343?e?Jm(n,a):o:e?Xm(n,a,a+2):(o-55296<<10)+(c-56320)+65536)}},Hs={codeAt:zs(!1),charAt:zs(!0)},qm=Hs.charAt,Qm=Ue,Bs=Mt,eg=Qo,Ks=oa,Gs="String Iterator",tg=Bs.set,rg=Bs.getterFor(Gs);eg(String,"String",function(e){tg(this,{type:Gs,string:Qm(e),index:0})},function(){var t=rg(this),r=t.string,n=t.index,a;return n>=r.length?Ks(void 0,!0):(a=qm(r,n),t.index+=a.length,Ks(a,!1))});var Ws=J,ng=B,ag=Se,ig=G,ka=mo,og=ea,sg=Zn,cg=dr,ug=Ni,vt=Object.assign,Vs=Object.defineProperty,lg=ng([].concat),fg=!vt||ig(function(){if(Ws&&vt({b:1},vt(Vs({},"a",{enumerable:!0,get:function(){Vs(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(a){t[a]=a}),vt({},e)[r]!==7||ka(vt({},t)).join("")!==n})?function(t,r){for(var n=cg(t),a=arguments.length,i=1,o=og.f,c=sg.f;a>i;)for(var l=ug(arguments[i++]),f=o?lg(ka(l),o(l)):ka(l),u=f.length,s=0,d;u>s;)d=f[s++],(!Ws||ag(c,l,d))&&(n[d]=l[d]);return n}:vt,dg=Se,Zs=Ae,hg=Pn,vg=function(e,t,r){var n,a;Zs(e);try{if(n=hg(e,"return"),!n){if(t==="throw")throw r;return r}n=dg(n,e)}catch(i){a=!0,n=i}if(t==="throw")throw r;if(a)throw n;return Zs(n),r},pg=Ae,mg=vg,gg=function(e,t,r,n){try{return n?t(pg(r)[0],r[1]):t(r)}catch(a){mg(e,"throw",a)}},yg=oe,wg=xt,bg=yg("iterator"),Sg=Array.prototype,Ig=function(e){return e!==void 0&&(wg.Array===e||Sg[bg]===e)},$g=B,kg=G,Ys=Y,Pg=_r,Tg=st,Eg=Ao,Js=function(){},Xs=Tg("Reflect","construct"),Pa=/^\s*(?:class|function)\b/,Og=$g(Pa.exec),_g=!Pa.test(Js),Wt=function(t){if(!Ys(t))return!1;try{return Xs(Js,[],t),!0}catch{return!1}},qs=function(t){if(!Ys(t))return!1;switch(Pg(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _g||!!Og(Pa,Eg(t))}catch{return!0}};qs.sham=!0;var Rg=!Xs||kg(function(){var e;return Wt(Wt.call)||!Wt(Object)||!Wt(function(){e=!0})||e})?qs:Wt,Cg=J,jg=be,Ag=Nt,Lg=function(e,t,r){Cg?jg.f(e,t,Ag(0,r)):e[t]=r},Ug=ua,xg=Se,Ng=dr,Dg=gg,Mg=Ig,Fg=Rg,zg=fo,Qs=Lg,Hg=fs,Bg=la,ec=Array,Kg=function(t){var r=Ng(t),n=Fg(this),a=arguments.length,i=a>1?arguments[1]:void 0,o=i!==void 0;o&&(i=Ug(i,a>2?arguments[2]:void 0));var c=Bg(r),l=0,f,u,s,d,h,m;if(c&&!(this===ec&&Mg(c)))for(u=n?new this:[],d=Hg(r,c),h=d.next;!(s=xg(h,d)).done;l++)m=o?Dg(d,i,[s.value,l],!0):s.value,Qs(u,l,m);else for(f=zg(r),u=n?new this(f):ec(f);f>l;l++)m=o?i(r[l],l):r[l],Qs(u,l,m);return u.length=l,u},We=B,Ta=2147483647,Vt=36,tc=1,Ea=26,Gg=38,Wg=700,Vg=72,Zg=128,Yg="-",Jg=/[^\0-\u007E]/,rc=/[.\u3002\uFF0E\uFF61]/g,nc="Overflow: input needs wider integers to process",Oa=Vt-tc,ac=RangeError,Xg=We(rc.exec),pt=Math.floor,_a=String.fromCharCode,ic=We("".charCodeAt),oc=We([].join),xe=We([].push),qg=We("".replace),Qg=We("".split),ey=We("".toLowerCase),ty=function(e){for(var t=[],r=0,n=e.length;r<n;){var a=ic(e,r++);if(a>=55296&&a<=56319&&r<n){var i=ic(e,r++);(i&64512)===56320?xe(t,((a&1023)<<10)+(i&1023)+65536):(xe(t,a),r--)}else xe(t,a)}return t},sc=function(e){return e+22+75*(e<26)},ry=function(e,t,r){var n=0;for(e=r?pt(e/Wg):e>>1,e+=pt(e/t);e>Oa*Ea>>1;)e=pt(e/Oa),n+=Vt;return pt(n+(Oa+1)*e/(e+Gg))},ny=function(e){var t=[];e=ty(e);var r=e.length,n=Zg,a=0,i=Vg,o,c;for(o=0;o<e.length;o++)c=e[o],c<128&&xe(t,_a(c));var l=t.length,f=l;for(l&&xe(t,Yg);f<r;){var u=Ta;for(o=0;o<e.length;o++)c=e[o],c>=n&&c<u&&(u=c);var s=f+1;if(u-n>pt((Ta-a)/s))throw new ac(nc);for(a+=(u-n)*s,n=u,o=0;o<e.length;o++){if(c=e[o],c<n&&++a>Ta)throw new ac(nc);if(c===n){for(var d=a,h=Vt;;){var m=h<=i?tc:h>=i+Ea?Ea:h-i;if(d<m)break;var S=d-m,g=Vt-m;xe(t,_a(sc(m+S%g))),d=pt(S/g),h+=Vt}xe(t,_a(sc(d))),i=ry(a,s,f===l),a=0,f++}}a++,n++}return oc(t,"")},ay=function(e){var t=[],r=Qg(qg(ey(e),rc,"."),"."),n,a;for(n=0;n<r.length;n++)a=r[n],xe(t,Xg(Jg,a)?"xn--"+ny(a):a);return oc(t,".")},iy=ut,Ra=J,oy=Er,Ca=X,cc=ua,ce=B,Nr=Le,ue=ca,sy=ss,ja=ve,Aa=fg,mt=Kg,me=ds,cy=Hs.codeAt,uy=ay,Oe=Ue,ly=zt,fy=lt,uc=Rm,lc=Mt,dy=lc.set,Dr=lc.getterFor("URL"),hy=uc.URLSearchParams,vy=uc.getState,Zt=Ca.URL,La=Ca.TypeError,Mr=Ca.parseInt,py=Math.floor,fc=Math.pow,le=ce("".charAt),ge=ce(/./.exec),Yt=ce([].join),my=ce(1 .toString),gy=ce([].pop),gt=ce([].push),Ua=ce("".replace),yy=ce([].shift),wy=ce("".split),Jt=ce("".slice),Fr=ce("".toLowerCase),by=ce([].unshift),Sy="Invalid authority",xa="Invalid scheme",Ve="Invalid host",dc="Invalid port",hc=/[a-z]/i,Iy=/[\d+-.a-z]/i,Na=/\d/,$y=/^0x/i,ky=/^[0-7]+$/,Py=/^\d+$/,vc=/^[\da-f]+$/i,Ty=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Ey=/[\0\t\n\r #/:<>?@[\\\]^|]/,Oy=/^[\u0000-\u0020]+/,_y=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,Ry=/[\t\n\r]/g,fe,Cy=function(e){var t=wy(e,"."),r,n,a,i,o,c,l;if(t.length&&t[t.length-1]===""&&t.length--,r=t.length,r>4)return e;for(n=[],a=0;a<r;a++){if(i=t[a],i==="")return e;if(o=10,i.length>1&&le(i,0)==="0"&&(o=ge($y,i)?16:8,i=Jt(i,o===8?1:2)),i==="")c=0;else{if(!ge(o===10?Py:o===8?ky:vc,i))return e;c=Mr(i,o)}gt(n,c)}for(a=0;a<r;a++)if(c=n[a],a===r-1){if(c>=fc(256,5-r))return null}else if(c>255)return null;for(l=gy(n),a=0;a<n.length;a++)l+=n[a]*fc(256,3-a);return l},jy=function(e){var t=[0,0,0,0,0,0,0,0],r=0,n=null,a=0,i,o,c,l,f,u,s,d=function(){return le(e,a)};if(d()===":"){if(le(e,1)!==":")return;a+=2,r++,n=r}for(;d();){if(r===8)return;if(d()===":"){if(n!==null)return;a++,r++,n=r;continue}for(i=o=0;o<4&&ge(vc,d());)i=i*16+Mr(d(),16),a++,o++;if(d()==="."){if(o===0||(a-=o,r>6))return;for(c=0;d();){if(l=null,c>0)if(d()==="."&&c<4)a++;else return;if(!ge(Na,d()))return;for(;ge(Na,d());){if(f=Mr(d(),10),l===null)l=f;else{if(l===0)return;l=l*10+f}if(l>255)return;a++}t[r]=t[r]*256+l,c++,(c===2||c===4)&&r++}if(c!==4)return;break}else if(d()===":"){if(a++,!d())return}else if(d())return;t[r++]=i}if(n!==null)for(u=r-n,r=7;r!==0&&u>0;)s=t[r],t[r--]=t[n+u-1],t[n+--u]=s;else if(r!==8)return;return t},Ay=function(e){for(var t=null,r=1,n=null,a=0,i=0;i<8;i++)e[i]!==0?(a>r&&(t=n,r=a),n=null,a=0):(n===null&&(n=i),++a);return a>r&&(t=n,r=a),t},Xt=function(e){var t,r,n,a;if(typeof e=="number"){for(t=[],r=0;r<4;r++)by(t,e%256),e=py(e/256);return Yt(t,".")}else if(typeof e=="object"){for(t="",n=Ay(e),r=0;r<8;r++)a&&e[r]===0||(a&&(a=!1),n===r?(t+=r?":":"::",a=!0):(t+=my(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},zr={},pc=Aa({},zr,{" ":1,'"':1,"<":1,">":1,"`":1}),mc=Aa({},pc,{"#":1,"?":1,"{":1,"}":1}),Da=Aa({},mc,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ne=function(e,t){var r=cy(e,0);return r>32&&r<127&&!ja(t,e)?e:encodeURIComponent(e)},Hr={ftp:21,file:null,http:80,https:443,ws:80,wss:443},qt=function(e,t){var r;return e.length===2&&ge(hc,le(e,0))&&((r=le(e,1))===":"||!t&&r==="|")},gc=function(e){var t;return e.length>1&&qt(Jt(e,0,2))&&(e.length===2||(t=le(e,2))==="/"||t==="\\"||t==="?"||t==="#")},Ly=function(e){return e==="."||Fr(e)==="%2e"},Uy=function(e){return e=Fr(e),e===".."||e==="%2e."||e===".%2e"||e==="%2e%2e"},Ma={},yc={},Fa={},wc={},bc={},za={},Sc={},Ic={},Br={},Kr={},Ha={},Ba={},Ka={},Ga={},$c={},Wa={},yt={},ke={},kc={},Ze={},_e={},Va=function(e,t,r){var n=Oe(e),a,i,o;if(t){if(i=this.parse(n),i)throw new La(i);this.searchParams=null}else{if(r!==void 0&&(a=new Va(r,!0)),i=this.parse(n,null,a),i)throw new La(i);o=vy(new hy),o.bindURL(this),this.searchParams=o}};Va.prototype={type:"URL",parse:function(e,t,r){var n=this,a=t||Ma,i=0,o="",c=!1,l=!1,f=!1,u,s,d,h;for(e=Oe(e),t||(n.scheme="",n.username="",n.password="",n.host=null,n.port=null,n.path=[],n.query=null,n.fragment=null,n.cannotBeABaseURL=!1,e=Ua(e,Oy,""),e=Ua(e,_y,"$1")),e=Ua(e,Ry,""),u=mt(e);i<=u.length;){switch(s=u[i],a){case Ma:if(s&&ge(hc,s))o+=Fr(s),a=yc;else{if(t)return xa;a=Fa;continue}break;case yc:if(s&&(ge(Iy,s)||s==="+"||s==="-"||s==="."))o+=Fr(s);else if(s===":"){if(t&&(n.isSpecial()!==ja(Hr,o)||o==="file"&&(n.includesCredentials()||n.port!==null)||n.scheme==="file"&&!n.host))return;if(n.scheme=o,t){n.isSpecial()&&Hr[n.scheme]===n.port&&(n.port=null);return}o="",n.scheme==="file"?a=Ga:n.isSpecial()&&r&&r.scheme===n.scheme?a=wc:n.isSpecial()?a=Ic:u[i+1]==="/"?(a=bc,i++):(n.cannotBeABaseURL=!0,gt(n.path,""),a=kc)}else{if(t)return xa;o="",a=Fa,i=0;continue}break;case Fa:if(!r||r.cannotBeABaseURL&&s!=="#")return xa;if(r.cannotBeABaseURL&&s==="#"){n.scheme=r.scheme,n.path=me(r.path),n.query=r.query,n.fragment="",n.cannotBeABaseURL=!0,a=_e;break}a=r.scheme==="file"?Ga:za;continue;case wc:if(s==="/"&&u[i+1]==="/")a=Br,i++;else{a=za;continue}break;case bc:if(s==="/"){a=Kr;break}else{a=ke;continue}case za:if(n.scheme=r.scheme,s===fe)n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=me(r.path),n.query=r.query;else if(s==="/"||s==="\\"&&n.isSpecial())a=Sc;else if(s==="?")n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=me(r.path),n.query="",a=Ze;else if(s==="#")n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=me(r.path),n.query=r.query,n.fragment="",a=_e;else{n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=me(r.path),n.path.length--,a=ke;continue}break;case Sc:if(n.isSpecial()&&(s==="/"||s==="\\"))a=Br;else if(s==="/")a=Kr;else{n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,a=ke;continue}break;case Ic:if(a=Br,s!=="/"||le(o,i+1)!=="/")continue;i++;break;case Br:if(s!=="/"&&s!=="\\"){a=Kr;continue}break;case Kr:if(s==="@"){c&&(o="%40"+o),c=!0,d=mt(o);for(var m=0;m<d.length;m++){var S=d[m];if(S===":"&&!f){f=!0;continue}var g=Ne(S,Da);f?n.password+=g:n.username+=g}o=""}else if(s===fe||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()){if(c&&o==="")return Sy;i-=mt(o).length+1,o="",a=Ha}else o+=s;break;case Ha:case Ba:if(t&&n.scheme==="file"){a=Wa;continue}else if(s===":"&&!l){if(o==="")return Ve;if(h=n.parseHost(o),h)return h;if(o="",a=Ka,t===Ba)return}else if(s===fe||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()){if(n.isSpecial()&&o==="")return Ve;if(t&&o===""&&(n.includesCredentials()||n.port!==null))return;if(h=n.parseHost(o),h)return h;if(o="",a=yt,t)return;continue}else s==="["?l=!0:s==="]"&&(l=!1),o+=s;break;case Ka:if(ge(Na,s))o+=s;else if(s===fe||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()||t){if(o!==""){var $=Mr(o,10);if($>65535)return dc;n.port=n.isSpecial()&&$===Hr[n.scheme]?null:$,o=""}if(t)return;a=yt;continue}else return dc;break;case Ga:if(n.scheme="file",s==="/"||s==="\\")a=$c;else if(r&&r.scheme==="file")switch(s){case fe:n.host=r.host,n.path=me(r.path),n.query=r.query;break;case"?":n.host=r.host,n.path=me(r.path),n.query="",a=Ze;break;case"#":n.host=r.host,n.path=me(r.path),n.query=r.query,n.fragment="",a=_e;break;default:gc(Yt(me(u,i),""))||(n.host=r.host,n.path=me(r.path),n.shortenPath()),a=ke;continue}else{a=ke;continue}break;case $c:if(s==="/"||s==="\\"){a=Wa;break}r&&r.scheme==="file"&&!gc(Yt(me(u,i),""))&&(qt(r.path[0],!0)?gt(n.path,r.path[0]):n.host=r.host),a=ke;continue;case Wa:if(s===fe||s==="/"||s==="\\"||s==="?"||s==="#"){if(!t&&qt(o))a=ke;else if(o===""){if(n.host="",t)return;a=yt}else{if(h=n.parseHost(o),h)return h;if(n.host==="localhost"&&(n.host=""),t)return;o="",a=yt}continue}else o+=s;break;case yt:if(n.isSpecial()){if(a=ke,s!=="/"&&s!=="\\")continue}else if(!t&&s==="?")n.query="",a=Ze;else if(!t&&s==="#")n.fragment="",a=_e;else if(s!==fe&&(a=ke,s!=="/"))continue;break;case ke:if(s===fe||s==="/"||s==="\\"&&n.isSpecial()||!t&&(s==="?"||s==="#")){if(Uy(o)?(n.shortenPath(),s!=="/"&&!(s==="\\"&&n.isSpecial())&>(n.path,"")):Ly(o)?s!=="/"&&!(s==="\\"&&n.isSpecial())&>(n.path,""):(n.scheme==="file"&&!n.path.length&&qt(o)&&(n.host&&(n.host=""),o=le(o,0)+":"),gt(n.path,o)),o="",n.scheme==="file"&&(s===fe||s==="?"||s==="#"))for(;n.path.length>1&&n.path[0]==="";)yy(n.path);s==="?"?(n.query="",a=Ze):s==="#"&&(n.fragment="",a=_e)}else o+=Ne(s,mc);break;case kc:s==="?"?(n.query="",a=Ze):s==="#"?(n.fragment="",a=_e):s!==fe&&(n.path[0]+=Ne(s,zr));break;case Ze:!t&&s==="#"?(n.fragment="",a=_e):s!==fe&&(s==="'"&&n.isSpecial()?n.query+="%27":s==="#"?n.query+="%23":n.query+=Ne(s,zr));break;case _e:s!==fe&&(n.fragment+=Ne(s,pc));break}i++}},parseHost:function(e){var t,r,n;if(le(e,0)==="["){if(le(e,e.length-1)!=="]"||(t=jy(Jt(e,1,-1)),!t))return Ve;this.host=t}else if(this.isSpecial()){if(e=uy(e),ge(Ty,e)||(t=Cy(e),t===null))return Ve;this.host=t}else{if(ge(Ey,e))return Ve;for(t="",r=mt(e),n=0;n<r.length;n++)t+=Ne(r[n],zr);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return ja(Hr,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;t&&(this.scheme!=="file"||t!==1||!qt(e[0],!0))&&e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,a=e.host,i=e.port,o=e.path,c=e.query,l=e.fragment,f=t+":";return a!==null?(f+="//",e.includesCredentials()&&(f+=r+(n?":"+n:"")+"@"),f+=Xt(a),i!==null&&(f+=":"+i)):t==="file"&&(f+="//"),f+=e.cannotBeABaseURL?o[0]:o.length?"/"+Yt(o,"/"):"",c!==null&&(f+="?"+c),l!==null&&(f+="#"+l),f},setHref:function(e){var t=this.parse(e);if(t)throw new La(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if(e==="blob")try{return new wt(e.path[0]).origin}catch{return"null"}return e==="file"||!this.isSpecial()?"null":e+"://"+Xt(this.host)+(t!==null?":"+t:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Oe(e)+":",Ma)},getUsername:function(){return this.username},setUsername:function(e){var t=mt(Oe(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Ne(t[r],Da)}},getPassword:function(){return this.password},setPassword:function(e){var t=mt(Oe(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Ne(t[r],Da)}},getHost:function(){var e=this.host,t=this.port;return e===null?"":t===null?Xt(e):Xt(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Ha)},getHostname:function(){var e=this.host;return e===null?"":Xt(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Ba)},getPort:function(){var e=this.port;return e===null?"":Oe(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(e=Oe(e),e===""?this.port=null:this.parse(e,Ka))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+Yt(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,yt))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){e=Oe(e),e===""?this.query=null:(le(e,0)==="?"&&(e=Jt(e,1)),this.query="",this.parse(e,Ze)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){if(e=Oe(e),e===""){this.fragment=null;return}le(e,0)==="#"&&(e=Jt(e,1)),this.fragment="",this.parse(e,_e)},update:function(){this.query=this.searchParams.serialize()||null}};var wt=function(t){var r=sy(this,Q),n=fy(arguments.length,1)>1?arguments[1]:void 0,a=dy(r,new Va(t,!1,n));Ra||(r.href=a.serialize(),r.origin=a.getOrigin(),r.protocol=a.getProtocol(),r.username=a.getUsername(),r.password=a.getPassword(),r.host=a.getHost(),r.hostname=a.getHostname(),r.port=a.getPort(),r.pathname=a.getPathname(),r.search=a.getSearch(),r.searchParams=a.getSearchParams(),r.hash=a.getHash())},Q=wt.prototype,de=function(e,t){return{get:function(){return Dr(this)[e]()},set:t&&function(r){return Dr(this)[t](r)},configurable:!0,enumerable:!0}};if(Ra&&(ue(Q,"href",de("serialize","setHref")),ue(Q,"origin",de("getOrigin")),ue(Q,"protocol",de("getProtocol","setProtocol")),ue(Q,"username",de("getUsername","setUsername")),ue(Q,"password",de("getPassword","setPassword")),ue(Q,"host",de("getHost","setHost")),ue(Q,"hostname",de("getHostname","setHostname")),ue(Q,"port",de("getPort","setPort")),ue(Q,"pathname",de("getPathname","setPathname")),ue(Q,"search",de("getSearch","setSearch")),ue(Q,"searchParams",de("getSearchParams")),ue(Q,"hash",de("getHash","setHash"))),Nr(Q,"toJSON",function(){return Dr(this).serialize()},{enumerable:!0}),Nr(Q,"toString",function(){return Dr(this).serialize()},{enumerable:!0}),Zt){var Pc=Zt.createObjectURL,Tc=Zt.revokeObjectURL;Pc&&Nr(wt,"createObjectURL",cc(Pc,Zt)),Tc&&Nr(wt,"revokeObjectURL",cc(Tc,Zt))}ly(wt,"URL"),iy({global:!0,constructor:!0,forced:!oy,sham:!Ra},{URL:wt});var xy=ut,Ny=st,Ec=G,Dy=lt,Oc=Ue,My=Er,Za=Ny("URL"),Fy=My&&Ec(function(){Za.canParse()}),zy=Ec(function(){return Za.canParse.length!==1});xy({target:"URL",stat:!0,forced:!Fy||zy},{canParse:function(t){var r=Dy(arguments.length,1),n=Oc(t),a=r<2||arguments[1]===void 0?void 0:Oc(arguments[1]);try{return!!new Za(n,a)}catch{return!1}}});var Hy=ut,By=st,Ky=lt,_c=Ue,Gy=Er,Wy=By("URL");Hy({target:"URL",stat:!0,forced:!Gy},{parse:function(t){var r=Ky(arguments.length,1),n=_c(t),a=r<2||arguments[1]===void 0?void 0:_c(arguments[1]);try{return new Wy(n,a)}catch{return null}}});var Vy=ut,Zy=Se;Vy({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Zy(URL.prototype.toString,this)}});var Yy=Ms;Yy.URL;var Jy={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Xy=$n,Ya=Xy("span").classList,Rc=Ya&&Ya.constructor&&Ya.constructor.prototype,qy=Rc===Object.prototype?void 0:Rc,Cc=X,jc=Jy,Qy=qy,Qt=lp,Ac=wr,ew=zt,tw=oe,Ja=tw("iterator"),Xa=Qt.values,Lc=function(e,t){if(e){if(e[Ja]!==Xa)try{Ac(e,Ja,Xa)}catch{e[Ja]=Xa}if(ew(e,t,!0),jc[t]){for(var r in Qt)if(e[r]!==Qt[r])try{Ac(e,r,Qt[r])}catch{e[r]=Qt[r]}}}};for(var qa in jc)Lc(Cc[qa]&&Cc[qa].prototype,qa);Lc(Qy,"DOMTokenList");function De(e,t){const r=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0});dispatchEvent(r)}function Pe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}typeof SuppressedError=="function"&&SuppressedError;var Ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ei(e,t){return e(t={exports:{}},t.exports),t.exports}var Je=ei(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function n(){var a=this;this.locked=new Map,this.addToLocked=function(i,o){var c=a.locked.get(i);c===void 0?o===void 0?a.locked.set(i,[]):a.locked.set(i,[o]):o!==void 0&&(c.unshift(o),a.locked.set(i,c))},this.isLocked=function(i){return a.locked.has(i)},this.lock=function(i){return new Promise(function(o,c){a.isLocked(i)?a.addToLocked(i,o):(a.addToLocked(i),o())})},this.unlock=function(i){var o=a.locked.get(i);if(o!==void 0&&o.length!==0){var c=o.pop();a.locked.set(i,o),c!==void 0&&setTimeout(c,0)}else a.locked.delete(i)}}return n.getInstance=function(){return n.instance===void 0&&(n.instance=new n),n.instance},n}();t.default=function(){return r.getInstance()}});Qa(Je);var rw=Qa(ei(function(e,t){var r=Ye&&Ye.__awaiter||function(u,s,d,h){return new(d||(d=Promise))(function(m,S){function g(b){try{k(h.next(b))}catch(v){S(v)}}function $(b){try{k(h.throw(b))}catch(v){S(v)}}function k(b){b.done?m(b.value):new d(function(v){v(b.value)}).then(g,$)}k((h=h.apply(u,s||[])).next())})},n=Ye&&Ye.__generator||function(u,s){var d,h,m,S,g={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return S={next:$(0),throw:$(1),return:$(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function $(k){return function(b){return function(v){if(d)throw new TypeError("Generator is already executing.");for(;g;)try{if(d=1,h&&(m=2&v[0]?h.return:v[0]?h.throw||((m=h.return)&&m.call(h),0):h.next)&&!(m=m.call(h,v[1])).done)return m;switch(h=0,m&&(v=[2&v[0],m.value]),v[0]){case 0:case 1:m=v;break;case 4:return g.label++,{value:v[1],done:!1};case 5:g.label++,h=v[1],v=[0];continue;case 7:v=g.ops.pop(),g.trys.pop();continue;default:if(m=g.trys,!((m=m.length>0&&m[m.length-1])||v[0]!==6&&v[0]!==2)){g=0;continue}if(v[0]===3&&(!m||v[1]>m[0]&&v[1]<m[3])){g.label=v[1];break}if(v[0]===6&&g.label<m[1]){g.label=m[1],m=v;break}if(m&&g.label<m[2]){g.label=m[2],g.ops.push(v);break}m[2]&&g.ops.pop(),g.trys.pop();continue}v=s.call(u,g)}catch(I){v=[6,I],h=0}finally{d=m=0}if(5&v[0])throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}([k,b])}}},a=Ye;Object.defineProperty(t,"__esModule",{value:!0});var i="browser-tabs-lock-key",o={key:function(u){return r(a,void 0,void 0,function(){return n(this,function(s){throw new Error("Unsupported")})})},getItem:function(u){return r(a,void 0,void 0,function(){return n(this,function(s){throw new Error("Unsupported")})})},clear:function(){return r(a,void 0,void 0,function(){return n(this,function(u){return[2,window.localStorage.clear()]})})},removeItem:function(u){return r(a,void 0,void 0,function(){return n(this,function(s){throw new Error("Unsupported")})})},setItem:function(u,s){return r(a,void 0,void 0,function(){return n(this,function(d){throw new Error("Unsupported")})})},keySync:function(u){return window.localStorage.key(u)},getItemSync:function(u){return window.localStorage.getItem(u)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(u){return window.localStorage.removeItem(u)},setItemSync:function(u,s){return window.localStorage.setItem(u,s)}};function c(u){return new Promise(function(s){return setTimeout(s,u)})}function l(u){for(var s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",d="",h=0;h<u;h++)d+=s[Math.floor(Math.random()*s.length)];return d}var f=function(){function u(s){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+l(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=s,u.waiters===void 0&&(u.waiters=[])}return u.prototype.acquireLock=function(s,d){return d===void 0&&(d=5e3),r(this,void 0,void 0,function(){var h,m,S,g,$,k,b;return n(this,function(v){switch(v.label){case 0:h=Date.now()+l(4),m=Date.now()+d,S=i+"-"+s,g=this.storageHandler===void 0?o:this.storageHandler,v.label=1;case 1:return Date.now()<m?[4,c(30)]:[3,8];case 2:return v.sent(),g.getItemSync(S)!==null?[3,5]:($=this.id+"-"+s+"-"+h,[4,c(Math.floor(25*Math.random()))]);case 3:return v.sent(),g.setItemSync(S,JSON.stringify({id:this.id,iat:h,timeoutKey:$,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:return v.sent(),(k=g.getItemSync(S))!==null&&(b=JSON.parse(k)).id===this.id&&b.iat===h?(this.acquiredIatSet.add(h),this.refreshLockWhileAcquired(S,h),[2,!0]):[3,7];case 5:return u.lockCorrector(this.storageHandler===void 0?o:this.storageHandler),[4,this.waitForSomethingToChange(m)];case 6:v.sent(),v.label=7;case 7:return h=Date.now()+l(4),[3,1];case 8:return[2,!1]}})})},u.prototype.refreshLockWhileAcquired=function(s,d){return r(this,void 0,void 0,function(){var h=this;return n(this,function(m){return setTimeout(function(){return r(h,void 0,void 0,function(){var S,g,$;return n(this,function(k){switch(k.label){case 0:return[4,Je.default().lock(d)];case 1:return k.sent(),this.acquiredIatSet.has(d)?(S=this.storageHandler===void 0?o:this.storageHandler,(g=S.getItemSync(s))===null?(Je.default().unlock(d),[2]):(($=JSON.parse(g)).timeRefreshed=Date.now(),S.setItemSync(s,JSON.stringify($)),Je.default().unlock(d),this.refreshLockWhileAcquired(s,d),[2])):(Je.default().unlock(d),[2])}})})},1e3),[2]})})},u.prototype.waitForSomethingToChange=function(s){return r(this,void 0,void 0,function(){return n(this,function(d){switch(d.label){case 0:return[4,new Promise(function(h){var m=!1,S=Date.now(),g=!1;function $(){if(g||(window.removeEventListener("storage",$),u.removeFromWaiting($),clearTimeout(k),g=!0),!m){m=!0;var b=50-(Date.now()-S);b>0?setTimeout(h,b):h(null)}}window.addEventListener("storage",$),u.addToWaiting($);var k=setTimeout($,Math.max(0,s-Date.now()))})];case 1:return d.sent(),[2]}})})},u.addToWaiting=function(s){this.removeFromWaiting(s),u.waiters!==void 0&&u.waiters.push(s)},u.removeFromWaiting=function(s){u.waiters!==void 0&&(u.waiters=u.waiters.filter(function(d){return d!==s}))},u.notifyWaiters=function(){u.waiters!==void 0&&u.waiters.slice().forEach(function(s){return s()})},u.prototype.releaseLock=function(s){return r(this,void 0,void 0,function(){return n(this,function(d){switch(d.label){case 0:return[4,this.releaseLock__private__(s)];case 1:return[2,d.sent()]}})})},u.prototype.releaseLock__private__=function(s){return r(this,void 0,void 0,function(){var d,h,m,S;return n(this,function(g){switch(g.label){case 0:return d=this.storageHandler===void 0?o:this.storageHandler,h=i+"-"+s,(m=d.getItemSync(h))===null?[2]:(S=JSON.parse(m)).id!==this.id?[3,2]:[4,Je.default().lock(S.iat)];case 1:g.sent(),this.acquiredIatSet.delete(S.iat),d.removeItemSync(h),Je.default().unlock(S.iat),u.notifyWaiters(),g.label=2;case 2:return[2]}})})},u.lockCorrector=function(s){for(var d=Date.now()-5e3,h=s,m=[],S=0;;){var g=h.keySync(S);if(g===null)break;m.push(g),S++}for(var $=!1,k=0;k<m.length;k++){var b=m[k];if(b.includes(i)){var v=h.getItemSync(b);if(v!==null){var I=JSON.parse(v);(I.timeRefreshed===void 0&&I.timeAcquired<d||I.timeRefreshed!==void 0&&I.timeRefreshed<d)&&(h.removeItemSync(b),$=!0)}}}$&&u.notifyWaiters()},u.waiters=void 0,u}();t.default=f}));const nw={timeoutInSeconds:60},Uc={name:"auth0-spa-js",version:"2.1.3"},xc=()=>Date.now();let ne=class ji extends Error{constructor(t,r){super(r),this.error=t,this.error_description=r,Object.setPrototypeOf(this,ji.prototype)}static fromPayload({error:t,error_description:r}){return new ji(t,r)}},aw=class Il extends ne{constructor(t,r,n,a=null){super(t,r),this.state=n,this.appState=a,Object.setPrototypeOf(this,Il.prototype)}},ti=class $l extends ne{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,$l.prototype)}},iw=class kl extends ti{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,kl.prototype)}},ow=class Pl extends ne{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,Pl.prototype)}},sw=class Tl extends ne{constructor(t,r,n){super(t,r),this.mfa_token=n,Object.setPrototypeOf(this,Tl.prototype)}},Nc=class El extends ne{constructor(t,r){super("missing_refresh_token",`Missing Refresh Token (audience: '${Dc(t,["default"])}', scope: '${Dc(r)}')`),this.audience=t,this.scope=r,Object.setPrototypeOf(this,El.prototype)}};function Dc(e,t=[]){return e&&!t.includes(e)?e:""}const Gr=()=>window.crypto,ri=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(Gr().getRandomValues(new Uint8Array(43))).forEach(r=>t+=e[r%e.length]),t},Mc=e=>btoa(e),ni=e=>{var{clientId:t}=e,r=Pe(e,["clientId"]);return new URLSearchParams((n=>Object.keys(n).filter(a=>n[a]!==void 0).reduce((a,i)=>Object.assign(Object.assign({},a),{[i]:n[i]}),{}))(Object.assign({client_id:t},r))).toString()},Fc=e=>(t=>decodeURIComponent(atob(t).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),cw=async(e,t)=>{const r=await fetch(e,t);return{ok:r.ok,json:await r.json()}},uw=async(e,t,r)=>{const n=new AbortController;let a;return t.signal=n.signal,Promise.race([cw(e,t),new Promise((i,o)=>{a=setTimeout(()=>{n.abort(),o(new Error("Timeout when executing 'fetch'"))},r)})]).finally(()=>{clearTimeout(a)})},lw=async(e,t,r,n,a,i,o)=>{return c={auth:{audience:t,scope:r},timeout:a,fetchUrl:e,fetchOptions:n,useFormData:o},l=i,new Promise(function(f,u){const s=new MessageChannel;s.port1.onmessage=function(d){d.data.error?u(new Error(d.data.error)):f(d.data),s.port1.close()},l.postMessage(c,[s.port2])});var c,l},fw=async(e,t,r,n,a,i,o=1e4)=>a?lw(e,t,r,n,o,a,i):uw(e,n,o);async function dw(e,t){var{baseUrl:r,timeout:n,audience:a,scope:i,auth0Client:o,useFormData:c}=e,l=Pe(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const f=c?ni(l):JSON.stringify(l);return await async function(u,s,d,h,m,S,g){let $,k=null;for(let A=0;A<3;A++)try{$=await fw(u,d,h,m,S,g,s),k=null;break}catch(F){k=F}if(k)throw k;const b=$.json,{error:v,error_description:I}=b,O=Pe(b,["error","error_description"]),{ok:_}=$;if(!_){const A=I||`HTTP error. Unable to fetch ${u}`;throw v==="mfa_required"?new sw(v,A,O.mfa_token):v==="missing_refresh_token"?new Nc(d,h):new ne(v||"request_error",A)}return O}(`${r}/oauth/token`,n,a||"default",i,{method:"POST",body:f,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(o||Uc))}},t,c)}const Wr=(...e)=>{return(t=e.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(t))).join(" ");var t};let Xe=class Ai{constructor(t,r="@@auth0spajs@@",n){this.prefix=r,this.suffix=n,this.clientId=t.clientId,this.scope=t.scope,this.audience=t.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(t){const[r,n,a,i]=t.split("::");return new Ai({clientId:n,scope:i,audience:a},r)}static fromCacheEntry(t){const{scope:r,audience:n,client_id:a}=t;return new Ai({scope:r,audience:n,clientId:a})}},hw=class{set(t,r){localStorage.setItem(t,JSON.stringify(r))}get(t){const r=window.localStorage.getItem(t);if(r)try{return JSON.parse(r)}catch{return}}remove(t){localStorage.removeItem(t)}allKeys(){return Object.keys(window.localStorage).filter(t=>t.startsWith("@@auth0spajs@@"))}},zc=class{constructor(){this.enclosedCache=function(){let t={};return{set(r,n){t[r]=n},get(r){const n=t[r];if(n)return n},remove(r){delete t[r]},allKeys:()=>Object.keys(t)}}()}},vw=class{constructor(t,r,n){this.cache=t,this.keyManifest=r,this.nowProvider=n||xc}async setIdToken(t,r,n){var a;const i=this.getIdTokenCacheKey(t);await this.cache.set(i,{id_token:r,decodedToken:n}),await((a=this.keyManifest)===null||a===void 0?void 0:a.add(i))}async getIdToken(t){const r=await this.cache.get(this.getIdTokenCacheKey(t.clientId));if(!r&&t.scope&&t.audience){const n=await this.get(t);return!n||!n.id_token||!n.decodedToken?void 0:{id_token:n.id_token,decodedToken:n.decodedToken}}if(r)return{id_token:r.id_token,decodedToken:r.decodedToken}}async get(t,r=0){var n;let a=await this.cache.get(t.toKey());if(!a){const c=await this.getCacheKeys();if(!c)return;const l=this.matchExistingCacheKey(t,c);l&&(a=await this.cache.get(l))}if(!a)return;const i=await this.nowProvider(),o=Math.floor(i/1e3);return a.expiresAt-r<o?a.body.refresh_token?(a.body={refresh_token:a.body.refresh_token},await this.cache.set(t.toKey(),a),a.body):(await this.cache.remove(t.toKey()),void await((n=this.keyManifest)===null||n===void 0?void 0:n.remove(t.toKey()))):a.body}async set(t){var r;const n=new Xe({clientId:t.client_id,scope:t.scope,audience:t.audience}),a=await this.wrapCacheEntry(t);await this.cache.set(n.toKey(),a),await((r=this.keyManifest)===null||r===void 0?void 0:r.add(n.toKey()))}async clear(t){var r;const n=await this.getCacheKeys();n&&(await n.filter(a=>!t||a.includes(t)).reduce(async(a,i)=>{await a,await this.cache.remove(i)},Promise.resolve()),await((r=this.keyManifest)===null||r===void 0?void 0:r.clear()))}async wrapCacheEntry(t){const r=await this.nowProvider();return{body:t,expiresAt:Math.floor(r/1e3)+t.expires_in}}async getCacheKeys(){var t;return this.keyManifest?(t=await this.keyManifest.get())===null||t===void 0?void 0:t.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(t){return new Xe({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,r){return r.filter(n=>{var a;const i=Xe.fromKey(n),o=new Set(i.scope&&i.scope.split(" ")),c=((a=t.scope)===null||a===void 0?void 0:a.split(" "))||[],l=i.scope&&c.reduce((f,u)=>f&&o.has(u),!0);return i.prefix==="@@auth0spajs@@"&&i.clientId===t.clientId&&i.audience===t.audience&&l})[0]}},pw=class{constructor(t,r,n){this.storage=t,this.clientId=r,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(t){this.storage.save(this.storageKey,t,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}};const er=e=>typeof e=="number",mw=["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"],gw=e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(i=>{const o=i.split("."),[c,l,f]=o;if(o.length!==3||!c||!l||!f)throw new Error("ID token could not be decoded");const u=JSON.parse(Fc(l)),s={__raw:i},d={};return Object.keys(u).forEach(h=>{s[h]=u[h],mw.includes(h)||(d[h]=u[h])}),{encoded:{header:c,payload:l,signature:f},header:JSON.parse(Fc(c)),claims:s,user:d}})(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(t.header.alg!=="RS256")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||typeof t.claims.aud!="string"&&!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&&!er(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(t.claims.exp==null||!er(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!er(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const r=e.leeway||60,n=new Date(e.now||Date.now()),a=new Date(0);if(a.setUTCSeconds(t.claims.exp+r),n>a)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${a})`);if(t.claims.nbf!=null&&er(t.claims.nbf)){const i=new Date(0);if(i.setUTCSeconds(t.claims.nbf-r),n<i)throw new 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 ${i}`)}if(t.claims.auth_time!=null&&er(t.claims.auth_time)){const i=new Date(0);if(i.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+r),n>i)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 (${n}) is after last auth at ${i}`)}if(e.organization){const i=e.organization.trim();if(i.startsWith("org_")){const o=i;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(o!==t.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${o}", found "${t.claims.org_id}"`)}else{const o=i.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(o!==t.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${o}", found "${t.claims.org_name}"`)}}return t};var qe=ei(function(e,t){var r=Ye&&Ye.__assign||function(){return r=Object.assign||function(l){for(var f,u=1,s=arguments.length;u<s;u++)for(var d in f=arguments[u])Object.prototype.hasOwnProperty.call(f,d)&&(l[d]=f[d]);return l},r.apply(this,arguments)};function n(l,f){if(!f)return"";var u="; "+l;return f===!0?u:u+"="+f}function a(l,f,u){return encodeURIComponent(l).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(f).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(s){if(typeof s.expires=="number"){var d=new Date;d.setMilliseconds(d.getMilliseconds()+864e5*s.expires),s.expires=d}return n("Expires",s.expires?s.expires.toUTCString():"")+n("Domain",s.domain)+n("Path",s.path)+n("Secure",s.secure)+n("SameSite",s.sameSite)}(u)}function i(l){for(var f={},u=l?l.split("; "):[],s=/(%[\dA-F]{2})+/gi,d=0;d<u.length;d++){var h=u[d].split("="),m=h.slice(1).join("=");m.charAt(0)==='"'&&(m=m.slice(1,-1));try{f[h[0].replace(s,decodeURIComponent)]=m.replace(s,decodeURIComponent)}catch{}}return f}function o(){return i(document.cookie)}function c(l,f,u){document.cookie=a(l,f,r({path:"/"},u))}t.__esModule=!0,t.encode=a,t.parse=i,t.getAll=o,t.get=function(l){return o()[l]},t.set=c,t.remove=function(l,f){c(l,"",r(r({},f),{expires:-1}))}});Qa(qe),qe.encode,qe.parse,qe.getAll;var yw=qe.get,Hc=qe.set,Bc=qe.remove;const bt={get(e){const t=yw(e);if(t!==void 0)return JSON.parse(t)},save(e,t,r){let n={};window.location.protocol==="https:"&&(n={secure:!0,sameSite:"none"}),r!=null&&r.daysUntilExpire&&(n.expires=r.daysUntilExpire),r!=null&&r.cookieDomain&&(n.domain=r.cookieDomain),Hc(e,JSON.stringify(t),n)},remove(e,t){let r={};t!=null&&t.cookieDomain&&(r.domain=t.cookieDomain),Bc(e,r)}},ww={get(e){return bt.get(e)||bt.get(`_legacy_${e}`)},save(e,t,r){let n={};window.location.protocol==="https:"&&(n={secure:!0}),r!=null&&r.daysUntilExpire&&(n.expires=r.daysUntilExpire),r!=null&&r.cookieDomain&&(n.domain=r.cookieDomain),Hc(`_legacy_${e}`,JSON.stringify(t),n),bt.save(e,t,r)},remove(e,t){let r={};t!=null&&t.cookieDomain&&(r.domain=t.cookieDomain),Bc(e,r),bt.remove(e,t),bt.remove(`_legacy_${e}`,t)}},bw={get(e){if(typeof sessionStorage>"u")return;const t=sessionStorage.getItem(e);return t!=null?JSON.parse(t):void 0},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};function Sw(e,t,r){var n=t===void 0?null:t,a=function(l,f){var u=atob(l);if(f){for(var s=new Uint8Array(u.length),d=0,h=u.length;d<h;++d)s[d]=u.charCodeAt(d);return String.fromCharCode.apply(null,new Uint16Array(s.buffer))}return u}(e,r!==void 0&&r),i=a.indexOf(`
|
|
2
|
+
`,10)+1,o=a.substring(i)+(n?"//# sourceMappingURL="+n:""),c=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(c)}var Kc,Gc,Wc,ai,Iw=(Kc="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",Gc=null,Wc=!1,function(e){return ai=ai||Sw(Kc,Gc,Wc),new Worker(ai,e)});const ii={};let $w=class{constructor(t,r){this.cache=t,this.clientId=r,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(t){var r;const n=new Set(((r=await this.cache.get(this.manifestKey))===null||r===void 0?void 0:r.keys)||[]);n.add(t),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(t){const r=await this.cache.get(this.manifestKey);if(r){const n=new Set(r.keys);return n.delete(t),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(t){return`@@auth0spajs@@::${t}`}};const kw={memory:()=>new zc().enclosedCache,localstorage:()=>new hw},Vc=e=>kw[e],Zc=e=>{const{openUrl:t,onRedirect:r}=e,n=Pe(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},n),{openUrl:t===!1||t?t:r})},oi=new rw;let Pw=class{constructor(t){let r,n;if(this.userCache=new zc().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await oi.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),t),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),t.authorizationParams)}),typeof window<"u"&&(()=>{if(!Gr())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(Gr().subtle===void 0)throw new Error(`
|
|
3
3
|
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.
|
|
4
|
-
`)})(),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)r=e.cache;else{if(n=e.cacheLocation||"memory",!sn(n))throw new Error(`Invalid cache location "${n}"`);r=sn(n)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=e.legacySameSiteCookie===!1?Se:ri,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(a=>`auth0.${a}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const i=e.useCookiesForTransactions?this.cookieStorage:ii;var o;this.scope=Ye("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Qr(i,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||Yt,this.cacheManager=new qr(r,r.allKeys?void 0:new si(r,this.options.clientId),this.nowProvider),this.domainUrl=(o=this.options.domain,/^https?:\/\//.test(o)?o:`https://${o}`),this.tokenIssuer=((a,s)=>a?a.startsWith("https://")?a:`https://${a}/`:`${s}/`)(this.options.issuer,this.domainUrl),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&n==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new ai)}_url(e){const n=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||Vt)));return`${this.domainUrl}${e}&auth0Client=${n}`}_authorizeUrl(e){return this._url(`/authorize?${vt(e)}`)}async _verifyIdToken(e,n,r){const i=await this.nowProvider();return ti({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:n,organization:r,leeway:this.options.leeway,max_age:(o=this.options.authorizationParams.max_age,typeof o!="string"?o:parseInt(o,10)||void 0),now:i});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,n,r){const i=qt(yt()),o=qt(yt()),a=yt(),s=(u=>{const c=new Uint8Array(u);return(f=>{const d={"+":"-","/":"_","=":""};return f.replace(/[+/=]/g,b=>d[b])})(window.btoa(String.fromCharCode(...Array.from(c))))})(await(async u=>await Ve().subtle.digest({name:"SHA-256"},new TextEncoder().encode(u)))(a)),h=((u,c,f,d,b,I,w,E)=>Object.assign(Object.assign(Object.assign({client_id:u.clientId},u.authorizationParams),f),{scope:Ye(c,f.scope),response_type:"code",response_mode:E||"query",state:d,nonce:b,redirect_uri:w||u.authorizationParams.redirect_uri,code_challenge:I,code_challenge_method:"S256"}))(this.options,this.scope,e,i,o,s,e.redirect_uri||this.options.authorizationParams.redirect_uri||r,n==null?void 0:n.response_mode),p=this._authorizeUrl(h);return{nonce:o,code_verifier:a,scope:h.scope,audience:h.audience||"default",redirect_uri:h.redirect_uri,state:i,url:p}}async loginWithPopup(e,n){var r;if(e=e||{},!(n=n||{}).popup&&(n.popup=(s=>{const h=window.screenX+(window.innerWidth-400)/2,p=window.screenY+(window.innerHeight-600)/2;return window.open(s,"auth0:authorize:popup",`left=${h},top=${p},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!n.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const i=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);n.popup.location.href=i.url;const o=await(s=>new Promise((h,p)=>{let u;const c=setInterval(()=>{s.popup&&s.popup.closed&&(clearInterval(c),clearTimeout(f),window.removeEventListener("message",u,!1),p(new Wr(s.popup)))},1e3),f=setTimeout(()=>{clearInterval(c),p(new Kr(s.popup)),window.removeEventListener("message",u,!1)},1e3*(s.timeoutInSeconds||60));u=function(d){if(d.data&&d.data.type==="authorization_response"){if(clearTimeout(f),clearInterval(c),window.removeEventListener("message",u,!1),s.popup.close(),d.data.response.error)return p(q.fromPayload(d.data.response));h(d.data.response)}},window.addEventListener("message",u)}))(Object.assign(Object.assign({},n),{timeoutInSeconds:n.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(i.state!==o.state)throw new q("state_mismatch","Invalid state");const a=((r=e.authorizationParams)===null||r===void 0?void 0:r.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:i.audience,scope:i.scope,code_verifier:i.code_verifier,grant_type:"authorization_code",code:o.code,redirect_uri:i.redirect_uri},{nonceIn:i.nonce,organization:a})}async getUser(){var e;const n=await this._getIdTokenFromCache();return(e=n==null?void 0:n.decodedToken)===null||e===void 0?void 0:e.user}async getIdTokenClaims(){var e;const n=await this._getIdTokenFromCache();return(e=n==null?void 0:n.decodedToken)===null||e===void 0?void 0:e.claims}async loginWithRedirect(e={}){var n;const r=cn(e),{openUrl:i,fragment:o,appState:a}=r,s=V(r,["openUrl","fragment","appState"]),h=((n=s.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization,p=await this._prepareAuthorizeUrl(s.authorizationParams||{}),{url:u}=p,c=V(p,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},c),{appState:a}),h&&{organization:h}));const f=o?`${u}#${o}`:u;i?await i(f):window.location.assign(f)}async handleRedirectCallback(e=window.location.href){const n=e.split("?").slice(1);if(n.length===0)throw new Error("There are no query params available for parsing.");const{state:r,code:i,error:o,error_description:a}=(c=>{c.indexOf("#")>-1&&(c=c.substring(0,c.indexOf("#")));const f=new URLSearchParams(c);return{state:f.get("state"),code:f.get("code")||void 0,error:f.get("error")||void 0,error_description:f.get("error_description")||void 0}})(n.join("")),s=this.transactionManager.get();if(!s)throw new q("missing_transaction","Invalid state");if(this.transactionManager.remove(),o)throw new Hr(o,a||o,r,s.appState);if(!s.code_verifier||s.state&&s.state!==r)throw new q("state_mismatch","Invalid state");const h=s.organization,p=s.nonce,u=s.redirect_uri;return await this._requestToken(Object.assign({audience:s.audience,scope:s.scope,code_verifier:s.code_verifier,grant_type:"authorization_code",code:i},u?{redirect_uri:u}:{}),{nonceIn:p,organization:h}),{appState:s.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{}}async getTokenSilently(e={}){var n;const r=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ye(this.scope,(n=e.authorizationParams)===null||n===void 0?void 0:n.scope)})}),i=await((o,a)=>{let s=bt[a];return s||(s=o().finally(()=>{delete bt[a],s=null}),bt[a]=s),s})(()=>this._getTokenSilently(r),`${this.options.clientId}::${r.authorizationParams.audience}::${r.authorizationParams.scope}`);return e.detailedResponse?i:i==null?void 0:i.access_token}async _getTokenSilently(e){const{cacheMode:n}=e,r=V(e,["cacheMode"]);if(n!=="off"){const i=await this._getEntryFromCache({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId});if(i)return i}if(n!=="cache-only"){if(!await(async(i,o=3)=>{for(let a=0;a<o;a++)if(await i())return!0;return!1})(()=>kt.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new gt;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),n!=="off"){const p=await this._getEntryFromCache({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId});if(p)return p}const i=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(r):await this._getTokenFromIFrame(r),{id_token:o,access_token:a,oauthTokenScope:s,expires_in:h}=i;return Object.assign(Object.assign({id_token:o,access_token:a},s?{scope:s}:null),{expires_in:h})}finally{await kt.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},n={}){var r;const i=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ye(this.scope,(r=e.authorizationParams)===null||r===void 0?void 0:r.scope)})});return n=Object.assign(Object.assign({},Zr),n),await this.loginWithPopup(i,n),(await this.cacheManager.get(new pe({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId!==null?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const n=e.logoutParams||{},{federated:r}=n,i=V(n,["federated"]),o=r?"&federated":"";return this._url(`/v2/logout?${vt(Object.assign({clientId:e.clientId},i))}`)+o}async logout(e={}){const n=cn(e),{openUrl:r}=n,i=V(n,["openUrl"]);e.clientId===null?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(i);r?await r(o):r!==!1&&window.location.assign(o)}async _getTokenFromIFrame(e){const n=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),r=this.cookieStorage.get(this.orgHintCookieName);r&&!n.organization&&(n.organization=r);const{url:i,state:o,nonce:a,code_verifier:s,redirect_uri:h,scope:p,audience:u}=await this._prepareAuthorizeUrl(n,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new q("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const c=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,f=await((b,I,w=60)=>new Promise((E,_)=>{const y=window.document.createElement("iframe");y.setAttribute("width","0"),y.setAttribute("height","0"),y.style.display="none";const l=()=>{window.document.body.contains(y)&&(window.document.body.removeChild(y),window.removeEventListener("message",k,!1))};let k;const O=setTimeout(()=>{_(new gt),l()},1e3*w);k=function(j){if(j.origin!=I||!j.data||j.data.type!=="authorization_response")return;const A=j.source;A&&A.close(),j.data.response.error?_(q.fromPayload(j.data.response)):E(j.data.response),clearTimeout(O),window.removeEventListener("message",k,!1),setTimeout(l,2e3)},window.addEventListener("message",k,!1),window.document.body.appendChild(y),y.setAttribute("src",b)}))(i,this.domainUrl,c);if(o!==f.state)throw new q("state_mismatch","Invalid state");const d=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:s,code:f.code,grant_type:"authorization_code",redirect_uri:h,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:n.organization});return Object.assign(Object.assign({},d),{scope:p,oauthTokenScope:d.scope,audience:u})}catch(c){throw c.error==="login_required"&&this.logout({openUrl:!1}),c}}async _getTokenUsingRefreshToken(e){const n=await this.cacheManager.get(new pe({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(n&&n.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new Gt(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const r=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i=typeof e.timeoutInSeconds=="number"?1e3*e.timeoutInSeconds:null;try{const o=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:n&&n.refresh_token,redirect_uri:r}),i&&{timeout:i}));return Object.assign(Object.assign({},o),{scope:e.authorizationParams.scope,oauthTokenScope:o.scope,audience:e.authorizationParams.audience||"default"})}catch(o){if((o.message.indexOf("Missing Refresh Token")>-1||o.message&&o.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw o}}async _saveEntryInCache(e){const{id_token:n,decodedToken:r}=e,i=V(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:n,decodedToken:r}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(i)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",n=await this.cacheManager.getIdToken(new pe({clientId:this.options.clientId,audience:e,scope:this.scope})),r=this.userCache.get("@@user@@");return n&&n.id_token===(r==null?void 0:r.id_token)?r:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache({scope:e,audience:n,clientId:r}){const i=await this.cacheManager.get(new pe({scope:e,audience:n,clientId:r}),60);if(i&&i.access_token){const{access_token:o,oauthTokenScope:a,expires_in:s}=i,h=await this._getIdTokenFromCache();return h&&Object.assign(Object.assign({id_token:h.id_token,access_token:o},a?{scope:a}:null),{expires_in:s})}}async _requestToken(e,n){const{nonceIn:r,organization:i}=n||{},o=await Gr(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,r,i);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(i||a.claims.org_id),Object.assign(Object.assign({},o),{decodedToken:a})}};async function li(t){const e=new ui(t);return await e.checkSession(),e}var te=(t=>(t.READY="sesamyJsReady",t.AUTHENTICATED="sesamyJsAuthenticated",t.LOGOUT="sesamyJsLogout",t.CLEAR_CACHE="sesamyJsClearCache",t.USER_ATTRIBUTE_CHANGED="sesamyUserAttributeChanged",t.PURCHASE="sesamyJsPurchase",t))(te||{});const di="sesamy.com",hi="sesamy.dev",fi="https://sesa.my",It="sesamyCacheTimestamp";function se(t,e){return`https://${t}.${e==="dev"?hi:di}`}let Q,un;const Ne="sesamyAccessToken";function St(){const t=localStorage.getItem(Ne);if(!t)return null;const e=dn(t);return(!e||!e.exp||e.exp<new Date().getTime()/1e3)&&localStorage.removeItem(Ne),t}function ln(t){try{const e=new URL(t).hostname,n=e.split(".");return n.length>1?n.slice(-2).join("."):e}catch{return null}}async function pi(t){if(t.enabled===!1)return;un=t.organization;const e={domain:se("token",t.environment),clientId:t.clientId,useCookiesForTransactions:!0};if(ln(window.location.href)!==ln(se("auth",t.environment))&&(e.cacheLocation="localstorage",e.useRefreshTokens=!0),Q=await li(e),window.location.search.includes("code="))try{await Q.handleRedirectCallback();const n=await Q.getUser();X(te.AUTHENTICATED,n);const r=new URL(location.href),i=r.searchParams;i.delete("code"),i.delete("state"),r.search=i.toString(),window.history.replaceState({},document.title,r.toString())}catch(n){console.error(n)}}async function _t(){return St()?!0:Q?Q.isAuthenticated():!1}async function mi(){return St()?{sub:"local",name:"Local User"}:Q?Q.getUser():null}function Et(t){if(localStorage.removeItem(Ne),!Q)throw new Error("Auth0 client not initialized");const e=(t==null?void 0:t.authorizationParams)||{};return Q.loginWithRedirect({...t,authorizationParams:{organization:un,redirect_uri:window.location.href,...e}})}async function De(t=!0){const e=St();if(e)return e;try{return Q?await Q.getTokenSilently():null}catch(n){if(t)throw n;return null}}async function gi(t={}){if(localStorage.removeItem(Ne),X(te.LOGOUT,{}),!!Q)return Q.logout({...t,logoutParams:{returnTo:window.location.href,...t.logoutParams}})}function dn(t){const e=t.split(".");if(e.length!==3)return null;const r=e[1].replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(r).split("").map(function(o){return"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}async function hn(t){const e=dn(t);if(!e||!e.exp||e.exp<new Date().getTime()/1e3)throw new Error("Invalid token");localStorage.setItem(Ne,t),X(te.AUTHENTICATED,e)}const yi=(t,e)=>e.skipDedupe||e.method!=="GET",vi=(t,e)=>e.method+"@"+t,wi=t=>t.clone(),fn=({skip:t=yi,key:e=vi,resolver:n=wi}={})=>{const r=new Map;return i=>(o,a)=>{if(t(o,a))return i(o,a);const s=e(o,a);if(!r.has(s))r.set(s,[]);else return new Promise((h,p)=>{r.get(s).push([h,p])});try{return i(o,a).then(h=>(r.get(s).forEach(([p])=>p(n(h))),r.delete(s),h)).catch(h=>{throw r.get(s).forEach(([p,u])=>u(h)),r.delete(s),h})}catch(h){return r.delete(s),Promise.reject(h)}}},bi=(t,e)=>t*e,ki=t=>t&&t.ok,pn=({delayTimer:t=500,delayRamp:e=bi,maxAttempts:n=10,until:r=ki,onRetry:i=null,retryOnNetworkError:o=!1,resolveWithLatestResponse:a=!1,skip:s}={})=>h=>(p,u)=>{let c=0;if(s&&s(p,u))return h(p,u);const f=(d,b)=>Promise.resolve(r(d,b)).then(I=>I?d&&a?d:b?Promise.reject(b):d:(c++,!n||c<=n?new Promise(w=>{const E=e(t,c);setTimeout(()=>{typeof i=="function"?Promise.resolve(i({response:d,error:b,url:p,options:u})).then((_={})=>{var y,l;w(h((y=_&&_.url)!==null&&y!==void 0?y:p,(l=_&&_.options)!==null&&l!==void 0?l:u))}):w(h(p,u))},E)}).then(f).catch(w=>{if(!o)throw w;return f(null,w)}):d&&a?d:Promise.reject(b||new Error("Number of attempts exceeded."))));return h(p,u).then(f).catch(d=>{if(!o)throw d;return f(null,d)})},Ii="application/json",mn="Content-Type",_e=Symbol(),gn=Symbol();function yn(t={}){var e;return(e=Object.entries(t).find(([n])=>n.toLowerCase()===mn.toLowerCase()))===null||e===void 0?void 0:e[1]}function vn(t){return/^application\/.*json.*/.test(t)}const ge=function(t,e,n=!1){return Object.entries(e).reduce((r,[i,o])=>{const a=t[i];return Array.isArray(a)&&Array.isArray(o)?r[i]=n?[...a,...o]:o:typeof a=="object"&&typeof o=="object"?r[i]=ge(a,o,n):r[i]=o,r},{...t})},Ee={options:{},errorType:"text",polyfills:{},polyfill(t,e=!0,n=!1,...r){const i=this.polyfills[t]||(typeof self<"u"?self[t]:null)||(typeof global<"u"?global[t]:null);if(e&&!i)throw new Error(t+" is not defined");return n&&i?new i(...r):i}};function Si(t,e=!1){Ee.options=e?t:ge(Ee.options,t)}function _i(t,e=!1){Ee.polyfills=e?t:ge(Ee.polyfills,t)}function Ei(t){Ee.errorType=t}const Pi=t=>e=>t.reduceRight((n,r)=>r(n),e)||e;class wn extends Error{}const Ti=t=>{const e=Object.create(null);t=t._addons.reduce((y,l)=>l.beforeRequest&&l.beforeRequest(y,t._options,e)||y,t);const{_url:n,_options:r,_config:i,_catchers:o,_resolvers:a,_middlewares:s,_addons:h}=t,p=new Map(o),u=ge(i.options,r);let c=n;const f=Pi(s)((y,l)=>(c=y,i.polyfill("fetch")(y,l)))(n,u),d=new Error,b=f.catch(y=>{throw{[_e]:y}}).then(y=>{if(!y.ok){const l=new wn;if(l.cause=d,l.stack=l.stack+`
|
|
5
|
-
CAUSE: `+d.stack,l.response=y,l.url=c,y.type==="opaque")throw l;return y.text().then(k=>{var O;if(l.message=k,i.errorType==="json"||((O=y.headers.get("Content-Type"))===null||O===void 0?void 0:O.split(";")[0])==="application/json")try{l.json=JSON.parse(k)}catch{}throw l.text=k,l.status=y.status,l})}return y}),I=y=>y.catch(l=>{const k=l.hasOwnProperty(_e),O=k?l[_e]:l,j=(O==null?void 0:O.status)&&p.get(O.status)||p.get(O==null?void 0:O.name)||k&&p.has(_e)&&p.get(_e);if(j)return j(O,t);const A=p.get(gn);if(A)return A(O,t);throw O}),w=y=>l=>I(y?b.then(k=>k&&k[y]()).then(k=>l?l(k):k):b.then(k=>l?l(k):k)),E={_wretchReq:t,_fetchReq:f,_sharedState:e,res:w(null),json:w("json"),blob:w("blob"),formData:w("formData"),arrayBuffer:w("arrayBuffer"),text:w("text"),error(y,l){return p.set(y,l),this},badRequest(y){return this.error(400,y)},unauthorized(y){return this.error(401,y)},forbidden(y){return this.error(403,y)},notFound(y){return this.error(404,y)},timeout(y){return this.error(408,y)},internalError(y){return this.error(500,y)},fetchError(y){return this.error(_e,y)}},_=h.reduce((y,l)=>({...y,...typeof l.resolver=="function"?l.resolver(y):l.resolver}),E);return a.reduce((y,l)=>l(y,t),_)},Oi={_url:"",_options:{},_config:Ee,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(t){return{...this,_addons:[...this._addons,t],...t.wretch}},errorType(t){return{...this,_config:{...this._config,errorType:t}}},polyfills(t,e=!1){return{...this,_config:{...this._config,polyfills:e?t:ge(this._config.polyfills,t)}}},url(t,e=!1){if(e)return{...this,_url:t};const n=this._url.split("?");return{...this,_url:n.length>1?n[0]+t+"?"+n[1]:this._url+t}},options(t,e=!1){return{...this,_options:e?t:ge(this._options,t)}},headers(t){const e=t?Array.isArray(t)?Object.fromEntries(t):"entries"in t?Object.fromEntries(t.entries()):t:{};return{...this,_options:ge(this._options,{headers:e})}},accept(t){return this.headers({Accept:t})},content(t){return this.headers({[mn]:t})},auth(t){return this.headers({Authorization:t})},catcher(t,e){const n=new Map(this._catchers);return n.set(t,e),{...this,_catchers:n}},catcherFallback(t){return this.catcher(gn,t)},resolve(t,e=!1){return{...this,_resolvers:e?[t]:[...this._resolvers,t]}},defer(t,e=!1){return{...this,_deferred:e?[t]:[...this._deferred,t]}},middlewares(t,e=!1){return{...this,_middlewares:e?t:[...this._middlewares,...t]}},fetch(t=this._options.method,e="",n=null){let r=this.url(e).options({method:t});const i=yn(r._options.headers),o=this._config.polyfill("FormData",!1),a=typeof n=="object"&&!(o&&n instanceof o)&&(!r._options.headers||!i||vn(i));return r=n?a?r.json(n,i):r.body(n):r,Ti(r._deferred.reduce((s,h)=>h(s,s._url,s._options),r))},get(t=""){return this.fetch("GET",t)},delete(t=""){return this.fetch("DELETE",t)},put(t,e=""){return this.fetch("PUT",e,t)},post(t,e=""){return this.fetch("POST",e,t)},patch(t,e=""){return this.fetch("PATCH",e,t)},head(t=""){return this.fetch("HEAD",t)},opts(t=""){return this.fetch("OPTIONS",t)},body(t){return{...this,_options:{...this._options,body:t}}},json(t,e){const n=yn(this._options.headers);return this.content(e||vn(n)&&n||Ii).body(JSON.stringify(t))}};function ie(t="",e={}){return{...Oi,_url:t,_options:e}}ie.default=ie,ie.options=Si,ie.errorType=Ei,ie.polyfills=_i,ie.WretchError=wn;function ne(){sessionStorage.removeItem(It),X(te.CLEAR_CACHE,{})}function ji(){var n;return(n=(document.documentElement.getAttribute("lang")??"en").split("-")[0])==null?void 0:n.toLocaleLowerCase()}function Ci(t){const e=se("api2",t.environment),n=v=>async(S,P)=>{let Z=sessionStorage.getItem(It);Z||(Z=Date.now().toString(),sessionStorage.setItem(It,Z));const N={...P,headers:{...P.headers,"Cache-Timestamp":Z}};return v(S,N)},r=(v=!0)=>S=>async(P,Z)=>{let N=null;if(N=await De(v),!N){if(v)throw new Error("No access token available");return S(P,Z)}const B={...Z,headers:{...Z.headers,...N?{Authorization:`Bearer ${N}`}:{}}};return S(P,B)},i=v=>(S,P)=>{if(P.headers.Authorization)return v(S,P);const Z=localStorage.getItem("__anon_id"),N=btoa(`${Z}:`),B={...P,headers:{...P.headers,Authorization:`Basic ${N}`}};return v(S,B)},o=ie(e).headers({"Content-Type":"application/json"}).middlewares([n,r(),fn(),pn({delayTimer:1e3,delayRamp:(v,S)=>v*S,maxAttempts:3,until:v=>!!(v&&(v.ok||v.status>=400&&v.status<500)),retryOnNetworkError:!1})]),a=ie(e).headers({"Content-Type":"application/json"}).middlewares([n,r(!1),i,fn(),pn({delayTimer:1e3,delayRamp:(v,S)=>v*S,maxAttempts:3,until:v=>!!(v&&(v.ok||v.status>=400&&v.status<500)),retryOnNetworkError:!1})]);async function s(){return o.get("/entitlements").json()}async function h(v){const S=await o.get("/entitlements").json();return S==null?void 0:S.find(P=>P.id===v)}async function p(v){return o.get(`/entitlements/${v}/access`).json()}async function u(){return o.get("/contracts").json()}async function c(v){const S=await o.get("/contracts").json();return S==null?void 0:S.find(P=>P.id===v)}async function f(){return o.get("/subscriptions").json()}async function d(){return o.get("/bills").json()}async function b(v){const S=await o.get("/bills").json();return S==null?void 0:S.find(P=>P.id===v)}async function I(v,S){const P=await o.url(`/user-metadata/${v}`).put(S).json();return X(te.USER_ATTRIBUTE_CHANGED,{}),ne(),P}async function w(v){const S=await o.url(`/user-metadata/${v}`).delete().res();return ne(),S.ok}async function E(v){return(await o.url(`/user-metadata/${v}`).get().json())[v]}async function _(){return await o.url("/user-metadata").get().json()}async function y(){return await o.url("/tags").get().json()}async function l(v){const S=await o.url(`/tags/${v}`).delete().res();return ne(),S.ok}async function k(v){const S=await o.url("/tags").post(v).res();return X(te.USER_ATTRIBUTE_CHANGED,{}),ne(),S.ok}async function O(v){return(await a.url("/tallies").get().json())[v]}async function j(){return await a.url("/tallies").get().json()}async function A(v){const S=await a.url(`/tallies/${v}`).delete().res();return ne(),S.ok}async function z(v,S){return await a.url(`/tallies/${v}/push`).post(S).json()}async function M(v){return await o.url(`/products/${v}`).get().json()}async function W(){return await De(!1)?await o.url("/profile").get().json():null}async function L(v){const S=await o.url("/profile").patch(v).res();return ne(),S.ok}async function D(){return await o.url("/payment-issues").get().json()}async function H(){return(await o.url("/profile/spotify-link").get().json()).isSpotifyLinked}async function C(){return(await o.url("/profile/unlink-spotify").post().res()).ok}async function K(v){const S=await De(!1);if(!S)throw new Error("No access token available");const P=new URL(`${se("spotify-oas",t.environment)}/sesamy-callback`);P.searchParams.set("access_token",S),P.searchParams.set("state",v),window.location.href=P.toString()}async function F(v){const S=await o.url(`/products/${v}/auto-onboard`).post().json();return S.length&&ne(),S}async function Ie(v,S=3600){const{shortlink:P}=await ie(fi).post({url:v,ttl:S}).json();return P}async function m(v){const S=await De(!1);let P;switch(v.target){case"account":P=new URL(`${se("account",t.environment)}/subscriptions/${t.clientId}`);break;case"consume":P=new URL(`${se("consume",t.environment)}/@${t.clientId}/${v.sku}`),v.episodeId?P.href+=`/${v.episodeId}`:P.href+="/listen";break;default:throw new Error("Invalid target")}return P.searchParams.set("sesamy-redirect-url",v.redirectUrl||window.location.href),S&&(P.hash=`#access_token=${S}`),v.shorten?Ie(P.href,v.ttl):P.href}async function g(v){return(await a.url("/checkouts").post({language:ji(),...v,vendorId:t.clientId})).json()}async function T(v,S){return(await a.url(`/checkouts/${v}`).patch(S)).json()}async function U(v){return(await a.url(`/checkouts/${v}`).get()).json()}async function R(){const v=await De(!1),S=new URL(`${se("account",t.environment)}/subscriptions/${t.clientId}`);v&&(S.hash=`#access_token=${v}`),window.location.href=S.toString()}return{createCheckout:g,updateCheckout:T,getCheckout:U,getEntitlements:s,getEntitlement:h,getEntitlementAccess:p,getContracts:u,getContract:c,getProfile:W,updateProfile:L,getSubscriptions:f,getBills:d,getBill:b,setUserMetadata:I,deleteUserMetadata:w,getUserMetadata:E,listUserMetadata:_,getTags:y,deleteTag:l,setTag:k,getTally:O,getTallies:j,deleteTally:A,pushTally:z,getProduct:M,getPaymentIssues:D,autoOnboardProduct:F,isSpotifyLinked:H,unlinkSpotify:C,linkSpotify:K,generateLink:m,openHostedAccountPage:R}}const bn="@sesamy/sesamy-js",Pt="1.13.2";function kn(t,e,n,r,i){for(e=e.split?e.split("."):e,r=0;r<e.length;r++)t=t?t[e[r]]:i;return t===i?n:t}var Ge="undefined",In="object",Tt=function(){},Sn="any",_n="*",ye="__",Be=typeof process<"u"?process:{};Be.env&&Be.env.NODE_ENV;var J=typeof document<"u";Be.versions!=null&&Be.versions.node!=null,typeof Deno<"u"&&Deno.core,J&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent!==void 0&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function En(t,e){return e.charAt(0)[t]()+e.slice(1)}var xi=En.bind(null,"toUpperCase"),$i=En.bind(null,"toLowerCase");function Ai(t){return Pn(t)?xi("null"):typeof t=="object"?Ni(t):Object.prototype.toString.call(t).slice(8,-1)}function qe(t,e){e===void 0&&(e=!0);var n=Ai(t);return e?$i(n):n}function ze(t,e){return typeof e===t}var Y=ze.bind(null,"function"),ce=ze.bind(null,"string"),Pe=ze.bind(null,"undefined"),Li=ze.bind(null,"boolean");ze.bind(null,"symbol");function Pn(t){return t===null}function Ui(t){return qe(t)==="number"&&!isNaN(t)}function Tn(t){return qe(t)==="array"}function G(t){if(!Ri(t))return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function Ri(t){return t&&(typeof t=="object"||t!==null)}function Ni(t){return Y(t.constructor)?t.constructor.name:null}function Di(t){return t instanceof Error||ce(t.message)&&t.constructor&&Ui(t.constructor.stackTraceLimit)}function On(t,e){if(typeof e!="object"||Pn(e))return!1;if(e instanceof t)return!0;var n=qe(new t(""));if(Di(e))for(;e;){if(qe(e)===n)return!0;e=Object.getPrototypeOf(e)}return!1}On.bind(null,TypeError),On.bind(null,SyntaxError);function Qe(t,e){var n=t instanceof Element||t instanceof HTMLDocument;return n&&e?zi(t,e):n}function zi(t,e){return e===void 0&&(e=""),t&&t.nodeName===e.toUpperCase()}function et(t){var e=[].slice.call(arguments,1);return function(){return t.apply(void 0,[].slice.call(arguments).concat(e))}}et(Qe,"form"),et(Qe,"button"),et(Qe,"input"),et(Qe,"select");function Mi(t){return t?Tn(t)?t:[t]:[]}function jn(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function Zi(){if(J){var t=navigator,e=t.languages;return t.userLanguage||(e&&e.length?e[0]:t.language)}}function Hi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Ki(t){return function(e){for(var n,r=Object.create(null),i=/([^&=]+)=?([^&]*)/g;n=i.exec(e);){var o=jn(n[1]),a=jn(n[2]);o.substring(o.length-2)==="[]"?(r[o=o.substring(0,o.length-2)]||(r[o]=[])).push(a):r[o]=a===""||a}for(var s in r){var h=s.split("[");h.length>1&&(Wi(r,h.map(function(p){return p.replace(/[?[\]\\ ]/g,"")}),r[s]),delete r[s])}return r}(function(e){return J&&window.location.search.substring(1)}())}function Wi(t,e,n){for(var r=e.length-1,i=0;i<r;++i){var o=e[i];if(o==="__proto__"||o==="constructor")break;o in t||(t[o]={}),t=t[o]}t[e[r]]=n}function tt(){for(var t="",e=0,n=4294967295*Math.random()|0;e++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[e-1],i=15&n;t+=r=="-"||r=="4"?r:(r=="x"?i:3&i|8).toString(16),n=e%8==0?4294967295*Math.random()|0:n>>4}return t}function Fi(t,e){var n,r,i,o=null,a=0,s=function(){a=new Date,o=null,i=t.apply(n,r)};return function(){var h=new Date;a||(a=h);var p=e-(h-a);return n=this,r=arguments,p<=0?(clearTimeout(o),o=null,a=h,i=t.apply(n,r)):o||(o=setTimeout(s,p)),i}}var Me="global",Te=ye+"global"+ye,Oe=typeof self===In&&self.self===self&&self||typeof global===In&&global.global===global&&global||void 0;function ve(t){return Oe[Te][t]}function we(t,e){return Oe[Te][t]=e}function je(t){delete Oe[Te][t]}function Ce(t,e,n){var r;try{if(Ot(t)){var i=window[t];r=i[e].bind(i)}}catch{}return r||n}Oe[Te]||(Oe[Te]={});var nt={};function Ot(t){if(typeof nt[t]!==Ge)return nt[t];try{var e=window[t];e.setItem(Ge,Ge),e.removeItem(Ge)}catch{return nt[t]=!1}return nt[t]=!0}function x(){return x=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},x.apply(this,arguments)}var ue="function",oe="undefined",Ji="@@redux/"+Math.random().toString(36),Cn=function(){return typeof Symbol===ue&&Symbol.observable||"@@observable"}(),rt=" != "+ue;function xn(t,e,n){var r;if(typeof e===ue&&typeof n===oe&&(n=e,e=void 0),typeof n!==oe){if(typeof n!==ue)throw new Error("enhancer"+rt);return n(xn)(t,e)}if(typeof t!==ue)throw new Error("reducer"+rt);var i=t,o=e,a=[],s=a,h=!1;function p(){s===a&&(s=a.slice())}function u(){return o}function c(d){if(typeof d!==ue)throw new Error("Listener"+rt);var b=!0;return p(),s.push(d),function(){if(b){b=!1,p();var I=s.indexOf(d);s.splice(I,1)}}}function f(d){if(!G(d))throw new Error("Act != obj");if(typeof d.type===oe)throw new Error("ActType "+oe);if(h)throw new Error("Dispatch in reducer");try{h=!0,o=i(o,d)}finally{h=!1}for(var b=a=s,I=0;I<b.length;I++)(0,b[I])();return d}return f({type:"@@redux/INIT"}),(r={dispatch:f,subscribe:c,getState:u,replaceReducer:function(d){if(typeof d!==ue)throw new Error("next reducer"+rt);i=d,f({type:"@@redux/INIT"})}})[Cn]=function(){var d,b=c;return(d={subscribe:function(I){if(typeof I!="object")throw new TypeError("Observer != obj");function w(){I.next&&I.next(u())}return w(),{unsubscribe:b(w)}}})[Cn]=function(){return this},d},r}function Xi(t,e){var n=e&&e.type;return"action "+(n&&n.toString()||"?")+"reducer "+t+" returns "+oe}function xe(){var t=[].slice.call(arguments);return t.length===0?function(e){return e}:t.length===1?t[0]:t.reduce(function(e,n){return function(){return e(n.apply(void 0,[].slice.call(arguments)))}})}function Vi(){var t=arguments;return function(e){return function(n,r,i){var o,a=e(n,r,i),s=a.dispatch,h={getState:a.getState,dispatch:function(p){return s(p)}};return o=[].slice.call(t).map(function(p){return p(h)}),x({},a,{dispatch:s=xe.apply(void 0,o)(a.dispatch)})}}}var le=ye+"anon_id",be=ye+"user_id",$e=ye+"user_traits",de="userId",Ae="anonymousId",it=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],jt=["name","EVENTS","config","loaded"],$=it.reduce(function(t,e){return t[e]=e,t},{registerPluginType:function(t){return"registerPlugin:"+t},pluginReadyType:function(t){return"ready:"+t}}),$n=/^utm_/,An=/^an_prop_/,Ln=/^an_trait_/;function Yi(t){var e=t.storage.setItem;return function(n){return function(r){return function(i){if(i.type===$.bootstrap){var o=i.params,a=i.user,s=i.persistedUser,h=i.initialUser,p=s.userId===a.userId;s.anonymousId!==a.anonymousId&&e(le,a.anonymousId),p||e(be,a.userId),h.traits&&e($e,x({},p&&s.traits?s.traits:{},h.traits));var u=Object.keys(i.params);if(u.length){var c=o.an_uid,f=o.an_event,d=u.reduce(function(b,I){if(I.match($n)||I.match(/^(d|g)clid/)){var w=I.replace($n,"");b.campaign[w==="campaign"?"name":w]=o[I]}return I.match(An)&&(b.props[I.replace(An,"")]=o[I]),I.match(Ln)&&(b.traits[I.replace(Ln,"")]=o[I]),b},{campaign:{},props:{},traits:{}});n.dispatch(x({type:$.params,raw:o},d,c?{userId:c}:{})),c&&setTimeout(function(){return t.identify(c,d.traits)},0),f&&setTimeout(function(){return t.track(f,d.props)},0),Object.keys(d.campaign).length&&n.dispatch({type:$.campaign,campaign:d.campaign})}}return r(i)}}}}function Gi(t){return function(e,n){if(e===void 0&&(e={}),n===void 0&&(n={}),n.type===$.setItemEnd){if(n.key===le)return x({},e,{anonymousId:n.value});if(n.key===be)return x({},e,{userId:n.value})}switch(n.type){case $.identify:return Object.assign({},e,{userId:n.userId,traits:x({},e.traits,n.traits)});case $.reset:return[be,le,$e].forEach(function(r){t.removeItem(r)}),Object.assign({},e,{userId:null,anonymousId:null,traits:{}});default:return e}}}function Un(t){return{userId:t.getItem(be),anonymousId:t.getItem(le),traits:t.getItem($e)}}var Ct=function(t){return ye+"TEMP"+ye+t};function Bi(t){var e=t.storage,n=e.setItem,r=e.removeItem,i=e.getItem;return function(o){return function(a){return function(s){var h=s.userId,p=s.traits,u=s.options;if(s.type===$.reset&&([be,$e,le].forEach(function(d){r(d)}),[de,Ae,"traits"].forEach(function(d){je(Ct(d))})),s.type===$.identify){i(le)||n(le,tt());var c=i(be),f=i($e)||{};c&&c!==h&&o.dispatch({type:$.userIdChanged,old:{userId:c,traits:f},new:{userId:h,traits:p},options:u}),h&&n(be,h),p&&n($e,x({},f,p))}return a(s)}}}}var Ze={};function Rn(t,e){Ze[t]&&Y(Ze[t])&&(Ze[t](e),delete Ze[t])}function Nn(t,e,n){return new Promise(function(r,i){return e()?r(t):n<1?i(x({},t,{queue:!0})):new Promise(function(o){return setTimeout(o,10)}).then(function(o){return Nn(t,e,n-10).then(r,i)})})}function qi(t){return{abort:t}}function Dn(t,e,n){var r={},i=e(),o=t.getState(),a=o.plugins,s=o.queue,h=o.user;if(!o.context.offline&&s&&s.actions&&s.actions.length){var p=s.actions.reduce(function(c,f,d){return a[f.plugin].loaded?(c.process.push(f),c.processIndex.push(d)):(c.requeue.push(f),c.requeueIndex.push(d)),c},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(p.processIndex&&p.processIndex.length){p.processIndex.forEach(function(c){var f=s.actions[c],d=f.plugin,b=f.payload.type,I=i[d][b];if(I&&Y(I)){var w,E=function(l,k){return l===void 0&&(l={}),k===void 0&&(k={}),[de,Ae].reduce(function(O,j){return l.hasOwnProperty(j)&&k[j]&&k[j]!==l[j]&&(O[j]=k[j]),O},l)}(f.payload,h),_=r[E.meta.rid];if(!_&&(w=I({payload:E,config:a[d].config,instance:n,abort:qi}))&&G(w)&&w.abort)return void(r[E.meta.rid]=!0);if(!_){var y=b+":"+d;t.dispatch(x({},E,{type:y,_:{called:y,from:"queueDrain"}}))}}});var u=s.actions.filter(function(c,f){return!~p.processIndex.indexOf(f)});s.actions=u}}}var xt=function(t){var e=t.data,n=t.action,r=t.instance,i=t.state,o=t.allPlugins,a=t.allMatches,s=t.store,h=t.EVENTS;try{var p=i.plugins,u=i.context,c=n.type,f=c.match(Le),d=e.exact.map(function(w){return w.pluginName});f&&(d=a.during.map(function(w){return w.pluginName}));var b=function(w,E){return function(_,y,l){var k=y.config,O=y.name,j=O+"."+_.type;l&&(j=l.event);var A=_.type.match(Le)?function(z,M,W,L,D){return function(H,C){var K=L?L.name:z,F=C&&He(C)?C:W;if(L&&(!(F=C&&He(C)?C:[z]).includes(z)||F.length!==1))throw new Error("Method "+M+" can only abort "+z+" plugin. "+JSON.stringify(F)+" input valid");return x({},D,{abort:{reason:H,plugins:F,caller:M,_:K}})}}(O,j,E,l,_):function(z,M){return function(){throw new Error(z.type+" action not cancellable. Remove abort in "+M)}}(_,j);return{payload:Qi(_),instance:w,config:k||{},abort:A}}}(r,d),I=e.exact.reduce(function(w,E){var _=E.pluginName,y=E.methodName,l=!1;return y.match(/^initialize/)||y.match(/^reset/)||(l=!p[_].loaded),u.offline&&y.match(/^(page|track|identify)/)&&(l=!0),w[""+_]=l,w},{});return Promise.resolve(e.exact.reduce(function(w,E,_){try{var y=E.pluginName;return Promise.resolve(w).then(function(l){function k(){return Promise.resolve(l)}var O=function(){if(e.namespaced&&e.namespaced[y])return Promise.resolve(e.namespaced[y].reduce(function(j,A,z){try{return Promise.resolve(j).then(function(M){return A.method&&Y(A.method)?(function(H,C){var K=Jn(H);if(K&&K.name===C){var F=Jn(K.method);throw new Error([C+" plugin is calling method "+H,"Plugins cant call self","Use "+K.method+" "+(F?"or "+F.method:"")+" in "+C+" plugin insteadof "+H].join(`
|
|
6
|
-
`))}}(A.methodName,A.pluginName),Promise.resolve(A.method({payload:M,instance:r,abort:(W=M,L=y,D=A.pluginName,function(H,C){return x({},W,{abort:{reason:H,plugins:C||[L],caller:c,from:D||L}})}),config:Zn(A.pluginName,p,o),plugins:p})).then(function(H){var C=G(H)?H:{};return Promise.resolve(x({},M,C))})):M;var W,L,D})}catch(M){return Promise.reject(M)}},Promise.resolve(n))).then(function(j){l[y]=j});l[y]=n}();return O&&O.then?O.then(k):k()})}catch(l){return Promise.reject(l)}},Promise.resolve({}))).then(function(w){return Promise.resolve(e.exact.reduce(function(E,_,y){try{var l=e.exact.length===y+1,k=_.pluginName,O=o[k];return Promise.resolve(E).then(function(j){var A=w[k]?w[k]:{};if(f&&(A=j),At(A,k))return $t({data:A,method:c,instance:r,pluginName:k,store:s}),Promise.resolve(j);if(At(j,k))return l&&$t({data:j,method:c,instance:r,store:s}),Promise.resolve(j);if(I.hasOwnProperty(k)&&I[k]===!0)return s.dispatch({type:"queue",plugin:k,payload:A,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(j);var z=b(w[k],o[k]);return Promise.resolve(O[c]({abort:z.abort,payload:A,instance:r,config:Zn(k,p,o),plugins:p})).then(function(M){var W=G(M)?M:{},L=x({},j,W),D=w[k];if(At(D,k))$t({data:D,method:c,instance:r,pluginName:k,store:s});else{var H=c+":"+k;(H.match(/:/g)||[]).length<2&&!c.match(zn)&&!c.match(Mn)&&r.dispatch(x({},f?L:A,{type:H,_:{called:H,from:"submethod"}}))}return Promise.resolve(L)})})}catch(j){return Promise.reject(j)}},Promise.resolve(n))).then(function(E){if(!(c.match(Le)||c.match(/^registerPlugin/)||c.match(Mn)||c.match(zn)||c.match(/^params/)||c.match(/^userIdChanged/))){if(h.plugins.includes(c),E._&&E._.originalAction===c)return E;var _=x({},E,{_:{originalAction:E.type,called:E.type,from:"engineEnd"}});Wn(E,e.exact.length)&&!c.match(/End$/)&&(_=x({},_,{type:E.type+"Aborted"})),s.dispatch(_)}return E})})}catch(w){return Promise.reject(w)}},Le=/Start$/,zn=/^bootstrap/,Mn=/^ready/;function $t(t){var e=t.pluginName,n=t.method+"Aborted"+(e?":"+e:"");t.store.dispatch(x({},t.data,{type:n,_:{called:n,from:"abort"}}))}function Zn(t,e,n){var r=e[t]||n[t];return r&&r.config?r.config:{}}function Hn(t,e){return e.reduce(function(n,r){return r[t]?n.concat({methodName:t,pluginName:r.name,method:r[t]}):n},[])}function Kn(t,e){var n=t.replace(Le,""),r=e?":"+e:"";return[""+t+r,""+n+r,n+"End"+r]}function At(t,e){var n=t.abort;return!!n&&(n===!0||Fn(n,e)||n&&Fn(n.plugins,e))}function Wn(t,e){var n=t.abort;if(!n)return!1;if(n===!0||ce(n))return!0;var r=n.plugins;return He(n)&&n.length===e||He(r)&&r.length===e}function He(t){return Array.isArray(t)}function Fn(t,e){return!(!t||!He(t))&&t.includes(e)}function Jn(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function Qi(t){return Object.keys(t).reduce(function(e,n){return n==="type"||(e[n]=G(t[n])?Object.assign({},t[n]):t[n]),e},{})}function eo(t,e,n){var r={};return function(i){return function(o){return function(a){try{var s,h=function(l){return s?l:o(c)},p=a.type,u=a.plugins,c=a;if(a.abort)return Promise.resolve(o(a));if(p===$.enablePlugin&&i.dispatch({type:$.initializeStart,plugins:u,disabled:[],fromEnable:!0,meta:a.meta}),p===$.disablePlugin&&setTimeout(function(){return Rn(a.meta.rid,{payload:a})},0),p===$.initializeEnd){var f=e(),d=Object.keys(f),b=d.filter(function(l){return u.includes(l)}).map(function(l){return f[l]}),I=[],w=[],E=a.disabled,_=b.map(function(l){var k=l.loaded,O=l.name,j=l.config;return Nn(l,function(){return k({config:j})},1e4).then(function(A){return r[O]||(i.dispatch({type:$.pluginReadyType(O),name:O,events:Object.keys(l).filter(function(z){return!jt.includes(z)})}),r[O]=!0),I=I.concat(O),l}).catch(function(A){if(A instanceof Error)throw new Error(A);return w=w.concat(A.name),A})});Promise.all(_).then(function(l){var k={plugins:I,failed:w,disabled:E};setTimeout(function(){d.length===_.length+E.length&&i.dispatch(x({},{type:$.ready},k))},0)})}var y=function(){if(p!==$.bootstrap)return/^ready:([^:]*)$/.test(p)&&setTimeout(function(){return Dn(i,e,t)},0),Promise.resolve(function(l,k,O,j,A){try{var z=Y(k)?k():k,M=l.type,W=M.replace(Le,"");if(l._&&l._.called)return Promise.resolve(l);var L=O.getState(),D=(K=z,(F=L.plugins)===void 0&&(F={}),(Ie=l.options)===void 0&&(Ie={}),Object.keys(K).filter(function(m){var g=Ie.plugins||{};return Li(g[m])?g[m]:g.all!==!1&&(!F[m]||F[m].enabled!==!1)}).map(function(m){return K[m]}));M===$.initializeStart&&l.fromEnable&&(D=Object.keys(L.plugins).filter(function(m){var g=L.plugins[m];return l.plugins.includes(m)&&!g.initialized}).map(function(m){return z[m]}));var H=D.map(function(m){return m.name}),C=function(m,g,T){var U=Kn(m).map(function(R){return Hn(R,g)});return g.reduce(function(R,v){var S=v.name,P=Kn(m,S).map(function(Xe){return Hn(Xe,g)}),Z=P[0],N=P[1],B=P[2];return Z.length&&(R.beforeNS[S]=Z),N.length&&(R.duringNS[S]=N),B.length&&(R.afterNS[S]=B),R},{before:U[0],beforeNS:{},during:U[1],duringNS:{},after:U[2],afterNS:{}})}(M,D);return Promise.resolve(xt({action:l,data:{exact:C.before,namespaced:C.beforeNS},state:L,allPlugins:z,allMatches:C,instance:O,store:j,EVENTS:A})).then(function(m){function g(){var R=function(){if(M.match(Le))return Promise.resolve(xt({action:x({},T,{type:W+"End"}),data:{exact:C.after,namespaced:C.afterNS},state:L,allPlugins:z,allMatches:C,instance:O,store:j,EVENTS:A})).then(function(v){v.meta&&v.meta.hasCallback&&Rn(v.meta.rid,{payload:v})})}();return R&&R.then?R.then(function(){return m}):m}if(Wn(m,H.length))return m;var T,U=function(){if(M!==W)return Promise.resolve(xt({action:x({},m,{type:W}),data:{exact:C.during,namespaced:C.duringNS},state:L,allPlugins:z,allMatches:C,instance:O,store:j,EVENTS:A})).then(function(R){T=R});T=m}();return U&&U.then?U.then(g):g()})}catch(m){return Promise.reject(m)}var K,F,Ie}(a,e,t,i,n)).then(function(l){return s=1,o(l)})}();return Promise.resolve(y&&y.then?y.then(h):h(y))}catch(l){return Promise.reject(l)}}}}}function to(t){return function(e){return function(n){return function(r){var i=r.type,o=r.key,a=r.value,s=r.options;if(i===$.setItem||i===$.removeItem){if(r.abort)return n(r);i===$.setItem?t.setItem(o,a,s):t.removeItem(o,s)}return n(r)}}}}var no=function(){var t=this;this.before=[],this.after=[],this.addMiddleware=function(e,n){t[n]=t[n].concat(e)},this.removeMiddleware=function(e,n){var r=t[n].findIndex(function(i){return i===e});r!==-1&&(t[n]=[].concat(t[n].slice(0,r),t[n].slice(r+1)))},this.dynamicMiddlewares=function(e){return function(n){return function(r){return function(i){var o={getState:n.getState,dispatch:function(s){return n.dispatch(s)}},a=t[e].map(function(s){return s(o)});return xe.apply(void 0,a)(r)(i)}}}}};function ro(t){return function(e,n){e===void 0&&(e={});var r={};if(n.type==="initialize:aborted")return e;if(/^registerPlugin:([^:]*)$/.test(n.type)){var i=Xn(n.type,"registerPlugin"),o=t()[i];if(!o||!i)return e;var a=n.enabled,s=o.config;return r[i]={enabled:a,initialized:!!a&&!o.initialize,loaded:!!a&&!!o.loaded({config:s}),config:s},x({},e,r)}if(/^initialize:([^:]*)$/.test(n.type)){var h=Xn(n.type,$.initialize),p=t()[h];return p&&h?(r[h]=x({},e[h],{initialized:!0,loaded:!!p.loaded({config:p.config})}),x({},e,r)):e}if(/^ready:([^:]*)$/.test(n.type))return r[n.name]=x({},e[n.name],{loaded:!0}),x({},e,r);switch(n.type){case $.disablePlugin:return x({},e,Vn(n.plugins,!1,e));case $.enablePlugin:return x({},e,Vn(n.plugins,!0,e));default:return e}}}function Xn(t,e){return t.substring(e.length+1,t.length)}function Vn(t,e,n){return t.reduce(function(r,i){return r[i]=x({},n[i],{enabled:e}),r},n)}function Yn(t){try{return JSON.parse(JSON.stringify(t))}catch{}return t}var io={last:{},history:[]};function oo(t,e){t===void 0&&(t=io);var n=e.options,r=e.meta;if(e.type===$.track){var i=Yn(x({event:e.event,properties:e.properties},Object.keys(n).length&&{options:n},{meta:r}));return x({},t,{last:i,history:t.history.concat(i)})}return t}var ao={actions:[]};function so(t,e){t===void 0&&(t=ao);var n=e.payload;switch(e.type){case"queue":var r;return r=n&&n.type&&n.type===$.identify?[e].concat(t.actions):t.actions.concat(e),x({},t,{actions:r});case"dequeue":return[];default:return t}}var Gn=/#.*$/;function co(t){var e=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);return"/"+(e&&e[3]?e[3].split("?")[0].replace(Gn,""):"")}var Bn,qn,Qn,er,uo=function(t){if(t===void 0&&(t={}),!J)return t;var e=document,n=e.title,r=e.referrer,i=window,o=i.location,a=i.innerWidth,s=i.innerHeight,h=o.hash,p=o.search,u=function(f){var d=function(){if(J){for(var b,I=document.getElementsByTagName("link"),w=0;b=I[w];w++)if(b.getAttribute("rel")==="canonical")return b.getAttribute("href")}}();return d?d.match(/\?/)?d:d+f:window.location.href.replace(Gn,"")}(p),c={title:n,url:u,path:co(u),hash:h,search:p,width:a,height:s};return r&&r!==""&&(c.referrer=r),x({},c,t)},lo={last:{},history:[]};function ho(t,e){t===void 0&&(t=lo);var n=e.options;if(e.type===$.page){var r=Yn(x({properties:e.properties,meta:e.meta},Object.keys(n).length&&{options:n}));return x({},t,{last:r,history:t.history.concat(r)})}return t}Bn=function(){if(!J)return!1;var t=navigator.appVersion;return~t.indexOf("Win")?"Windows":~t.indexOf("Mac")?"MacOS":~t.indexOf("X11")?"UNIX":~t.indexOf("Linux")?"Linux":"Unknown OS"}(),qn=J?document.referrer:null,Qn=Zi(),er=Hi();var tr={initialized:!1,sessionId:tt(),app:null,version:null,debug:!1,offline:!!J&&!navigator.onLine,os:{name:Bn},userAgent:J?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.13"},timezone:er,locale:Qn,campaign:{},referrer:qn};function fo(t,e){t===void 0&&(t=tr);var n=t.initialized,r=e.campaign;switch(e.type){case $.campaign:return x({},t,{campaign:r});case $.offline:return x({},t,{offline:!0});case $.online:return x({},t,{offline:!1});default:return n?t:x({},tr,t,{initialized:!0})}}var po=["plugins","reducers","storage"];function mo(t,e,n){if(J){var r=window[(n?"add":"remove")+"EventListener"];t.split(" ").forEach(function(i){r(i,e)})}}function go(t){var e=mo.bind(null,"online offline",function(n){return Promise.resolve(!navigator.onLine).then(t)});return e(!0),function(n){return e(!1)}}function nr(){return we("analytics",[]),function(t){return function(e,n,r){var i=t(e,n,r),o=i.dispatch;return Object.assign(i,{dispatch:function(a){return Oe[Te].analytics.push(a.action||a),o(a)}})}}}function rr(t){return function(){return xe(xe.apply(null,arguments),nr())}}function Lt(t){return t?Tn(t)?t:[t]:[]}function ir(t,e,n){t===void 0&&(t={});var r,i,o=tt();return e&&(Ze[o]=(r=e,i=function(a){for(var s,h=a||Array.prototype.slice.call(arguments),p=0;p<h.length;p++)if(Y(h[p])){s=h[p];break}return s}(n),function(a){i&&i(a),r(a)})),x({},t,{rid:o,ts:new Date().getTime()},e?{hasCallback:!0}:{})}function yo(t){t===void 0&&(t={});var e=t.reducers||{},n=t.initialUser||{},r=(t.plugins||[]).reduce(function(m,g){if(Y(g))return m.middlewares=m.middlewares.concat(g),m;if(g.NAMESPACE&&(g.name=g.NAMESPACE),!g.name)throw new Error("https://lytics.dev/errors/1");g.config||(g.config={});var T=g.EVENTS?Object.keys(g.EVENTS).map(function(v){return g.EVENTS[v]}):[];m.pluginEnabled[g.name]=!(g.enabled===!1||g.config.enabled===!1),delete g.enabled,g.methods&&(m.methods[g.name]=Object.keys(g.methods).reduce(function(v,S){var P;return v[S]=(P=g.methods[S],function(){for(var Z=Array.prototype.slice.call(arguments),N=new Array(P.length),B=0;B<Z.length;B++)N[B]=Z[B];return N[N.length]=k,P.apply({instance:k},N)}),v},{}),delete g.methods);var U=Object.keys(g).concat(T),R=new Set(m.events.concat(U));if(m.events=Array.from(R),m.pluginsArray=m.pluginsArray.concat(g),m.plugins[g.name])throw new Error(g.name+"AlreadyLoaded");return m.plugins[g.name]=g,m.plugins[g.name].loaded||(m.plugins[g.name].loaded=function(){return!0}),m},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),i=t.storage?t.storage:{getItem:ve,setItem:we,removeItem:je},o=function(m){return function(g,T,U){return T.getState("user")[g]||(U&&G(U)&&U[g]?U[g]:Un(m)[g]||ve(Ct(g))||null)}}(i),a=r.plugins,s=r.events.filter(function(m){return!jt.includes(m)}).sort(),h=new Set(s.concat(it).filter(function(m){return!jt.includes(m)})),p=Array.from(h).sort(),u=function(){return a},c=new no,f=c.addMiddleware,d=c.removeMiddleware,b=c.dynamicMiddlewares,I=function(){throw new Error("Abort disabled inListener")},w=Ki(),E=Un(i),_=x({},E,n,w.an_uid?{userId:w.an_uid}:{},w.an_aid?{anonymousId:w.an_aid}:{});_.anonymousId||(_.anonymousId=tt());var y=x({enable:function(m,g){return new Promise(function(T){C.dispatch({type:$.enablePlugin,plugins:Lt(m),_:{originalAction:$.enablePlugin}},T,[g])})},disable:function(m,g){return new Promise(function(T){C.dispatch({type:$.disablePlugin,plugins:Lt(m),_:{originalAction:$.disablePlugin}},T,[g])})}},r.methods),l=!1,k={identify:function(m,g,T,U){try{var R=ce(m)?m:null,v=G(m)?m:g,S=T||{},P=k.user();we(Ct(de),R);var Z=R||v.userId||o(de,k,v);return Promise.resolve(new Promise(function(N){C.dispatch(x({type:$.identifyStart,userId:Z,traits:v||{},options:S,anonymousId:P.anonymousId},P.id&&P.id!==R&&{previousId:P.id}),N,[g,T,U])}))}catch(N){return Promise.reject(N)}},track:function(m,g,T,U){try{var R=G(m)?m.event:m;if(!R||!ce(R))throw new Error("EventMissing");var v=G(m)?m:g||{},S=G(T)?T:{};return Promise.resolve(new Promise(function(P){C.dispatch({type:$.trackStart,event:R,properties:v,options:S,userId:o(de,k,g),anonymousId:o(Ae,k,g)},P,[g,T,U])}))}catch(P){return Promise.reject(P)}},page:function(m,g,T){try{var U=G(m)?m:{},R=G(g)?g:{};return Promise.resolve(new Promise(function(v){C.dispatch({type:$.pageStart,properties:uo(U),options:R,userId:o(de,k,U),anonymousId:o(Ae,k,U)},v,[m,g,T])}))}catch(v){return Promise.reject(v)}},user:function(m){if(m===de||m==="id")return o(de,k);if(m===Ae||m==="anonId")return o(Ae,k);var g=k.getState("user");return m?kn(g,m):g},reset:function(m){return new Promise(function(g){C.dispatch({type:$.resetStart},g,m)})},ready:function(m){return l&&m({plugins:y,instance:k}),k.on($.ready,function(g){m(g),l=!0})},on:function(m,g){if(!m||!Y(g))return!1;if(m===$.bootstrap)throw new Error(".on disabled for "+m);var T=/Start$|Start:/;if(m==="*"){var U=function(P){return function(Z){return function(N){return N.type.match(T)&&g({payload:N,instance:k,plugins:a}),Z(N)}}},R=function(P){return function(Z){return function(N){return N.type.match(T)||g({payload:N,instance:k,plugins:a}),Z(N)}}};return f(U,ot),f(R,at),function(){d(U,ot),d(R,at)}}var v=m.match(T)?ot:at,S=function(P){return function(Z){return function(N){return N.type===m&&g({payload:N,instance:k,plugins:a,abort:I}),Z(N)}}};return f(S,v),function(){return d(S,v)}},once:function(m,g){if(!m||!Y(g))return!1;if(m===$.bootstrap)throw new Error(".once disabled for "+m);var T=k.on(m,function(U){g({payload:U.payload,instance:k,plugins:a,abort:I}),T()});return T},getState:function(m){var g=C.getState();return m?kn(g,m):Object.assign({},g)},dispatch:function(m){var g=ce(m)?{type:m}:m;if(it.includes(g.type))throw new Error("reserved action "+g.type);var T=x({},g,{_:x({originalAction:g.type},m._||{})});C.dispatch(T)},enablePlugin:y.enable,disablePlugin:y.disable,plugins:y,storage:{getItem:i.getItem,setItem:function(m,g,T){C.dispatch({type:$.setItemStart,key:m,value:g,options:T})},removeItem:function(m,g){C.dispatch({type:$.removeItemStart,key:m,options:g})}},setAnonymousId:function(m,g){k.storage.setItem(le,m,g)},events:{core:it,plugins:s}},O=r.middlewares.concat([function(m){return function(g){return function(T){return T.meta||(T.meta=ir()),g(T)}}},b(ot),eo(k,u,{all:p,plugins:s}),to(i),Yi(k),Bi(k),b(at)]),j={context:fo,user:Gi(i),page:ho,track:oo,plugins:ro(u),queue:so},A=xe,z=xe;if(J&&t.debug){var M=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;M&&(A=M({trace:!0,traceLimit:25})),z=function(){return arguments.length===0?nr():G(typeof arguments[0])?rr():rr().apply(null,arguments)}}var W,L=function(m){return Object.keys(m).reduce(function(g,T){return po.includes(T)||(g[T]=m[T]),g},{})}(t),D=r.pluginsArray.reduce(function(m,g){var T=g.name,U=g.config,R=g.loaded,v=r.pluginEnabled[T];return m[T]={enabled:v,initialized:!!v&&!g.initialize,loaded:!!R({config:U}),config:U},m},{}),H={context:L,user:_,plugins:D},C=xn(function(m){for(var g=Object.keys(m),T={},U=0;U<g.length;U++){var R=g[U];typeof m[R]===ue&&(T[R]=m[R])}var v,S=Object.keys(T);try{(function(P){Object.keys(P).forEach(function(Z){var N=P[Z];if(typeof N(void 0,{type:"@@redux/INIT"})===oe||typeof N(void 0,{type:Ji})===oe)throw new Error("reducer "+Z+" "+oe)})})(T)}catch(P){v=P}return function(P,Z){if(P===void 0&&(P={}),v)throw v;for(var N=!1,B={},Xe=0;Xe<S.length;Xe++){var ft=S[Xe],Ar=P[ft],Ft=(0,T[ft])(Ar,Z);if(typeof Ft===oe){var aa=Xi(ft,Z);throw new Error(aa)}B[ft]=Ft,N=N||Ft!==Ar}return N?B:P}}(x({},j,e)),H,z(A(Vi.apply(void 0,O))));C.dispatch=(W=C.dispatch,function(m,g,T){var U=x({},m,{meta:ir(m.meta,g,Lt(T))});return W.apply(null,[U])});var K=Object.keys(a);C.dispatch({type:$.bootstrap,plugins:K,config:L,params:w,user:_,initialUser:n,persistedUser:E});var F=K.filter(function(m){return r.pluginEnabled[m]}),Ie=K.filter(function(m){return!r.pluginEnabled[m]});return C.dispatch({type:$.registerPlugins,plugins:K,enabled:r.pluginEnabled}),r.pluginsArray.map(function(m,g){var T=m.bootstrap,U=m.config,R=m.name;T&&Y(T)&&T({instance:k,config:U,payload:m}),C.dispatch({type:$.registerPluginType(R),name:R,enabled:r.pluginEnabled[R],plugin:m}),r.pluginsArray.length===g+1&&C.dispatch({type:$.initializeStart,plugins:F,disabled:Ie})}),go(function(m){C.dispatch({type:m?$.offline:$.online})}),function(m,g,T){setInterval(function(){return Dn(m,g,T)},3e3)}(C,u,k),k}var ot="before",at="after",Ke="cookie",ke=sr(),or=st,vo=st;function ar(t){return ke?st(t,"",-1):je(t)}function sr(){if(ke!==void 0)return ke;var t="cookiecookie";try{st(t,t),ke=document.cookie.indexOf(t)!==-1,ar(t)}catch{ke=!1}return ke}function st(t,e,n,r,i,o){if(typeof window<"u"){var a=arguments.length>1;return ke===!1&&(a?we(t,e):ve(t)),a?document.cookie=t+"="+encodeURIComponent(e)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}}var We="localStorage",wo=Ot.bind(null,"localStorage");Ce("localStorage","getItem",ve),Ce("localStorage","setItem",we),Ce("localStorage","removeItem",je);var Fe="sessionStorage",bo=Ot.bind(null,"sessionStorage");Ce("sessionStorage","getItem",ve),Ce("sessionStorage","setItem",we),Ce("sessionStorage","removeItem",je);function Ue(t){var e=t;try{if((e=JSON.parse(t))==="true")return!0;if(e==="false")return!1;if(G(e))return e;parseFloat(e)===e&&(e=parseFloat(e))}catch{}if(e!==null&&e!=="")return e}var ko=wo(),Io=bo(),So=sr();function cr(t,e){if(t){var n=Ut(e),r=!zt(n),i=Rt(n)?Ue(localStorage.getItem(t)):void 0;if(r&&!Pe(i))return i;var o=Nt(n)?Ue(or(t)):void 0;if(r&&o)return o;var a=Dt(n)?Ue(sessionStorage.getItem(t)):void 0;if(r&&a)return a;var s=ve(t);return r?s:{localStorage:i,sessionStorage:a,cookie:o,global:s}}}function _o(t,e,n){if(t&&!Pe(e)){var r={},i=Ut(n),o=JSON.stringify(e),a=!zt(i);return Rt(i)&&(r[We]=ut(We,e,Ue(localStorage.getItem(t))),localStorage.setItem(t,o),a)?r[We]:Nt(i)&&(r[Ke]=ut(Ke,e,Ue(or(t))),vo(t,o),a)?r[Ke]:Dt(i)&&(r[Fe]=ut(Fe,e,Ue(sessionStorage.getItem(t))),sessionStorage.setItem(t,o),a)?r[Fe]:(r[Me]=ut(Me,e,ve(t)),we(t,e),a?r[Me]:r)}}function Eo(t,e){if(t){var n=Ut(e),r=cr(t,_n),i={};return!Pe(r.localStorage)&&Rt(n)&&(localStorage.removeItem(t),i[We]=r.localStorage),!Pe(r.cookie)&&Nt(n)&&(ar(t),i[Ke]=r.cookie),!Pe(r.sessionStorage)&&Dt(n)&&(sessionStorage.removeItem(t),i[Fe]=r.sessionStorage),!Pe(r.global)&&ct(n,Me)&&(je(t),i[Me]=r.global),i}}function Ut(t){return t?ce(t)?t:t.storage:Sn}function Rt(t){return ko&&ct(t,We)}function Nt(t){return So&&ct(t,Ke)}function Dt(t){return Io&&ct(t,Fe)}function zt(t){return t===_n||t==="all"}function ct(t,e){return t===Sn||t===e||zt(t)}function ut(t,e,n){return{location:t,current:e,previous:n}}var Po={setItem:_o,getItem:cr,removeItem:Eo};function To(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ur(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function lr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ur(Object(n),!0).forEach(function(r){To(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ur(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Oo(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e={storage:Po};return yo(lr(lr({},e),t))}function jo(t,e){e=e||{};var n,r,i=[],o=e.max||1/0;function a(){clearInterval(n),t(i.splice(0,o)),s()}function s(){n=setInterval(a,e.interval||1e4)}return s(),{flush:a,push:function(h){return r=i.push(h),r>=o&&a(),r},size:function(){return i.length},end:function(h){h&&a(),clearInterval(n)}}}function Co(t){if(typeof window>"u")return;const{addEventListener:e,history:n,location:r}=window;let i=r.pathname;e("popstate",()=>t(r.pathname)),["push","replace"].map(o=>{const a=`${o}State`;if(a!=="pushState"&&a!=="replaceState")return;const s=n[a];n[a]=function(...h){var c;const p=((c=h[2])==null?void 0:c.toString())||"",u=$o(p);return i!==u&&(i=u,setTimeout(()=>t(p),0)),s.apply(n,h)}})}function xo(t,e){const n=t.indexOf(e);return n>-1?t.slice(0,n):t}function $o(t){return["#","?"].forEach(e=>t=xo(t,e)),t}function Ao(){Co(()=>{ae.page()})}function Lo(t){if(t===void 0&&(t={}),!J)return Tt;var e=hr(),n=Mt(),r=dr(),i=lt(r,e),o=lt(n,e),a=[],s=[],h=[],p=r,u=i,c=o,f=Object.keys(t);if(!f.length)return Tt;var d=f.map(function(I){return Number(I)}),b=Fi(function(){var I=hr(),w=function(L,D){return D.map(function(H){return H===100?L-5:L*(H/100)})}(I,d),E=Mt(),_=dr(),y=lt(_,I),l=lt(E,I);if(u=y>u?y:u,c=l<c?l:c,!(a.length>=d.length)){var k=p===_,O="up";k?O="initial":p<=_&&(O="down");var j=w,A=d;(O==="up"||k)&&(j=w.slice().reverse(),A=d.slice().reverse());var z=A.reduce(function(L,D,H){var C=j[H];return h.includes(D)&&_<=C&&(h=h.filter(function(K){return K!==D}),L.singleFunction=D),O==="down"&&!a.includes(D)&&_>=C&&D>o?(s.push(D),L.callbacks=L.callbacks.concat(D),L):O==="up"&&!a.includes(D)&&_<=C&&D<=y?(L.foundFunc=[D],L):(k&&_>=C&&L.foundFunc.length===0&&(L.foundFunc=[D]),!s.includes(D)&&_>=C&&(s.push(D),L.singleFunction?h.push(D):L.singleFunction=D),L)},{foundFunc:[],singleFunction:null,callbacks:[],direction:O});if(p=_,O==="down"&&z.callbacks&&z.callbacks.forEach(function(L){Y(t[L])&&(t[L]({trigger:L,direction:O,scrollMin:c,scrollMax:u,range:[c,u]}),a.push(L))}),z.singleFunction){var M=z.singleFunction,W=z.direction;Y(t[M])&&t[M]({trigger:M,direction:W,scrollMin:c,scrollMax:u,range:[c,u]}),a.push(M)}}},500);return window.addEventListener("scroll",b),function(){return window.removeEventListener("scroll",b)}}function Mt(){return J?document.body.scrollTop||document.documentElement.scrollTop:0}function Uo(){return J?window.innerHeight||document.documentElement.clientHeight:0}function dr(){return Math.round(Mt()+Uo())}function hr(){if(!J)return 0;var t=document.body,e=document.documentElement;return Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)}function lt(t,e){return Math.round(t/e*100)}var fr="EventListener";function Ro(t){return function(e,n,r,i){var o=r||Tt,a=i||!1;if(!J)return o;var s=dt(n),h=dt(e,!0);if(!h.length)throw new Error("noElements");if(!s.length)throw new Error("noEvent");var p=[];return function u(c){c&&(p=[]);for(var f=c?"add"+fr:"remove"+fr,d=0;d<h.length;d++){var b=h[d];p[d]=c?a&&a.once?No(o):o:p[d]||o;for(var I=0;I<s.length;I++)b[f]?b["on"+s[I]]=c?p[d]:null:b[f](s[I],p[d],a)}return u.bind(null,!c)}(t)}}function dt(t,e){if(ce(t))return e?dt(document.querySelectorAll(t)):(n=t).split(n.indexOf(",")>-1?",":" ").map(function(a){return a.trim()});var n;if(NodeList.prototype.isPrototypeOf(t)){for(var r=[],i=t.length>>>0;i--;)r[i]=t[i];return r}var o=Mi(t);return e?o.map(function(a){return ce(a)?dt(a,!0):a}).flat():o}function No(t,e){var n;return function(){return t&&(n=t.apply(this,arguments),t=null),n}}var Zt=Ro("Event");function pr(t,e){return J&&Y(window[t])?(n=window[t],r=e,(i=window)===void 0&&(i=null),Y(n)?function(){n.apply(i,arguments),r.apply(i,arguments)}:r):window[t]=e;var n,r,i}pr.bind(null,"onerror"),pr.bind(null,"onload");var mr=typeof window>"u",gr="hidden";function Do(t){if(mr)return!1;var e=zo(),n="".concat(e.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return t(!!document[e])},i=function(){return document.addEventListener(n,r)};return i(),function(){return document.removeEventListener(n,r),i}}function zo(){var t=["webkit","moz","ms","o"];return mr||gr in document?gr:t.reduce(function(e,n){var r=n+"Hidden";return!e&&r in document?r:e},null)}var Mo=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function Zo(t,e){e===void 0&&(e={});var n=function(a,s){var h=this,p=!1;return function(u){p||(a.call(h,u),p=!0,setTimeout(function(){return p=!1},s))}}(t,e.throttle||1e4),r=[];function i(){var a=Do(function(s){s||n({type:"tabVisible"})});return r=[a].concat(Mo.map(function(s){return Zt(document,s,n)})).concat(Zt(window,"load",n)).concat(Zt(window,"scroll",n,{capture:!0,passive:!0})),o}function o(){r.map(function(a){return a()})}return i(),function(){return o(),i}}function Ho(t){var e,n,r=t.onIdle,i=t.onWakeUp,o=t.onHeartbeat,a=t.timeout,s=a===void 0?1e4:a,h=t.throttle,p=h===void 0?2e3:h,u=!1,c=!1,f=new Date,d=function(){return clearTimeout(e)};function b(w){d(),o&&!u&&o(Je(f),w),i&&u&&(u=!1,i(Je(n),w),f=new Date),e=setTimeout(function(){u=!0,r&&(n=new Date,r(Je(f),w))},s)}var I=Zo(b,{throttle:p});return{disable:function(){c=!0,u=!1,d();var w=I();return function(){return c=!1,f=new Date,b({type:"load"}),w()}},getStatus:function(){return{isIdle:u,isDisabled:c,active:u?0:Je(f,c),idle:u?Je(n,c):0}}}}function Je(t,e){return e?0:Math.round((new Date-t)/1e3)}const yr=5e3;class Ko{constructor(e){ee(this,"element");ee(this,"isInViewport",!1);ee(this,"isAwake",!1);ee(this,"isFlushing");ee(this,"observer");ee(this,"lastEventAt",Date.now());ee(this,"registeredView",!1);ee(this,"viewCallback");ee(this,"activeDurationCallback");ee(this,"idleDurationCallback");ee(this,"scrollCallback");this.element=e.element,this.viewCallback=e.viewCallback,this.activeDurationCallback=e.activeDurationCallback,this.idleDurationCallback=e.idleDurationCallback,this.scrollCallback=e.scrollCallback,this.observer=new IntersectionObserver(n=>{n.forEach(r=>{this.handleInViewPort(r.isIntersecting)})},{threshold:0}),this.observer.observe(this.element),Ho({onIdle:n=>this.handleAwake(!1,n),onWakeUp:n=>this.handleAwake(!0,n),timeout:yr}),Lo({25:this.handleScroll.bind(this),50:this.handleScroll.bind(this),75:this.handleScroll.bind(this),90:this.handleScroll.bind(this),100:this.handleScroll.bind(this)})}flush(){this.isFlushing=!0,this.handleAwake(!this.isAwake)}handleInViewPort(e){e?(this.isAwake=!0,this.trackInViewport()):this.handleAwake(!1),this.isInViewport=e}handleAwake(e,n=Math.round((Date.now()-this.lastEventAt)/1e3)){this.isAwake=e,this.lastEventAt=e?Date.now()-n*yr:Date.now(),this.isInViewport&&this.trackAwake(e,n)}handleScroll(e){this.scrollCallback&&this.scrollCallback(e)}handleVisibilityChange(){this.isAwake=!1;const e=Math.round((Date.now()-this.lastEventAt)/1e3);e>1&&(this.lastEventAt=Date.now(),this.trackAwake(!1,e))}trackAwake(e,n){!e&&this.activeDurationCallback&&this.activeDurationCallback(n,this.isFlushing,this.lastEventAt),e&&this.idleDurationCallback&&this.idleDurationCallback(n,this.isFlushing,this.lastEventAt)}trackInViewport(){this.registeredView||(this.registeredView=!0,this.viewCallback&&this.viewCallback())}}const vr="sesamy_session_id";function Wo(){let t=sessionStorage.getItem(vr);return t||(t=Math.random().toString(36).slice(2,9),sessionStorage.setItem(vr,t)),t}let wr=!1,Ht,br,ht;function Fo({clientId:t,enabled:e=!0,environment:n}){if(Ht=t,br=e,ht=`${se("logs",n)}/events`,!br)return;Ao();const r=new Ko({element:document.body,viewCallback:()=>{ae.page()},activeDurationCallback:(i,o,a)=>{ae.track("activeDuration",{duration:i,durationStart:a,flushing:o})},idleDurationCallback:(i,o,a)=>{ae.track("idleDuration",{duration:i,durationStart:a,flushing:o})},scrollCallback:i=>{ae.track("scroll",{scroll:i.scrollMax})}});Vo(document.body,()=>{r.flush()}),Yo(document.body,()=>{r.handleVisibilityChange()}),window.addEventListener(te.AUTHENTICATED,async i=>{const o=i;await ae.identify(o.detail.sub)}),window.addEventListener(te.LOGOUT,async()=>{await ae.track("logout",{}),Kt.flush(),await ae.reset()})}function kr(t){return JSON.stringify(t.map(e=>({...e,clientId:Ht,requestId:Math.random().toString(36).slice(2,9),sessionId:Wo(),timestamp:new Date().toISOString(),version:Pt,event:e.event,context:{page:{url:window.location.hostname,path:window.location.pathname,title:document.title,search:window.location.search,referrer:document.referrer},locale:navigator.language,library:bn,userAgent:navigator.userAgent,clientId:Ht}})))}const Kt=jo(async t=>{if(t.length>0){const e=kr(t);wr?navigator.sendBeacon(ht,e):(await fetch(ht,{method:"POST",body:e,headers:{"Content-Type":"text/plain"}})).ok}},{max:10,interval:3e3});function Wt(t){var e;if(t.anonymousId)if((e=t.properties)!=null&&e.flushing){const n={...t};delete n.properties.flushing,navigator.sendBeacon(ht,kr([n]))}else Kt.push(t)}const ae=Oo({app:bn,version:Pt,plugins:[{name:"custom-analytics-plugin",page:({payload:t})=>{const{properties:e,anonymousId:n,userId:r,event:i}=t;Wt({anonymousId:n,userId:r,properties:e,event:i,type:"page"})},track:({payload:t})=>{const{properties:e,anonymousId:n,userId:r,event:i}=t;Wt({anonymousId:n,userId:r,properties:e,event:i,type:"track"})},identify:({payload:t})=>{const{properties:e,anonymousId:n,userId:r}=t;Wt({anonymousId:n,userId:r,properties:e,type:"identify"})}}]});function Jo(t,e){ae.track(t,e)}function Xo(){return wr=!0,Kt.flush()}const Ir=new Map;function Vo(t,e){Ir.set(t,e)}window.addEventListener("beforeunload",()=>{Ir.forEach((t,e)=>{t.bind(e)()}),Xo()});const Sr=new Map;function Yo(t,e){Sr.set(t,e)}window.addEventListener("visibilitychange",()=>{document.visibilityState!=="visible"&&Sr.forEach((t,e)=>{t.bind(e)()})});const _r="sesamySignedURLs";function Er(){const t=sessionStorage.getItem(_r);return t?JSON.parse(t):[]}function Go(t){const e=Er();e.push(t),sessionStorage.setItem(_r,JSON.stringify(e))}function Bo(t){const{createCheckout:e,getCheckout:n,updateCheckout:r,getEntitlement:i,getEntitlements:o,getEntitlementAccess:a,getSubscriptions:s,getContract:h,getContracts:p,getBill:u,getBills:c,getProfile:f,updateProfile:d,getTags:b,deleteTag:I,setTag:w,getUserMetadata:E,listUserMetadata:_,setUserMetadata:y,deleteUserMetadata:l,getTally:k,getTallies:O,pushTally:j,deleteTally:A,getProduct:z,getPaymentIssues:M,isSpotifyLinked:W,unlinkSpotify:L,linkSpotify:D,autoOnboardProduct:H,openHostedAccountPage:C,generateLink:K}=Ci(t),F={auth:{getUser:f,isAuthenticated:_t,loginWithRedirect:Et,logout:gi,setToken:hn},checkouts:{get:n,create:e,update:r},profile:{get:f,update:d,openHostedAccountPage:C,isSpotifyLinked:W,unlinkSpotify:L},analytics:{track:Jo},tags:{list:b,set:w,delete:I},entitlements:{get:i,list:o,access:a,signedLinks:Er},contracts:{get:h,list:p},bills:{get:u,list:c},userMetadata:{get:E,list:_,set:y,delete:l},tallies:{get:k,list:O,push:j,delete:A},subscriptions:{list:s},products:{get:z,autoOnboard:H,linkSpotify:D},getVersion:qo,getPaymentIssues:M,generateLink:K,clearCache:ne};return t.namespace&&(window[t.namespace]=F),F}function qo(){return Pt}async function Qo({enabled:t=!1,rules:e}){if(!t)return;const n=await _t(),r=window.location.href;for(const i of e){const o=document.querySelectorAll(i.selector);if(!(i.path&&!new RegExp(i.path).test(r))){for(const a of o)if(!(i.authenticated!==void 0&&i.authenticated!==n))switch(i.transform){case"insert":if(i.contentType==="selector"&&i.content){const s=document.querySelector(i.content);s?a.innerHTML+=s.innerHTML:console.warn(`Source element for selector '${i.content}' not found`)}else if(i.contentType==="url"&&i.content){const s=await Pr(i.content);s?a.innerHTML+=s:console.warn(`Failed to fetch content from URL '${i.content}'`)}else i.content&&(a.innerHTML+=i.content);break;case"replace":if(i.contentType==="selector"&&i.content){const s=document.querySelector(i.content);s?a.innerHTML=s.innerHTML:console.warn(`Source element for selector '${i.content}' not found`)}else if(i.contentType==="url"&&i.content){const s=await Pr(i.content);s?a.innerHTML=s:console.warn(`Failed to fetch content from URL '${i.content}'`)}else i.content&&(a.innerHTML=i.content);break;case"remove":a.remove();break;default:console.warn(`Unknown transform type: ${i.transform}`)}}}}async function Pr(t){try{const e=await fetch(t);return e.ok?await e.text():(console.error(`Failed to fetch content from ${t}: ${e.statusText}`),null)}catch(e){return console.error(`Error fetching content from ${t}:`,e),null}}function ea(){const t=new URLSearchParams(window.location.hash.substring(1)),e=t.get("access_token");if(e){hn(e);const n=new URL(window.location.href);t.delete("access_token"),n.hash=t.toString(),window.history.replaceState(null,"",n)}}const Tr="sesamy-refresh",Or="force-refetch-entitlements";function ta(){const t=new URLSearchParams(window.location.search),e=t.get(Or),n=t.get(Tr);if(e!==null||n!==null){const r=new URL(window.location.href);t.delete(Or),t.delete(Tr),r.search=t.toString(),ne(),window.history.replaceState(null,"",r)}}function na(){const t=new URLSearchParams(window.location.search),e=t.get("token"),n=t.get("se");if(!n||!e)return;const r=parseInt(n,10);if(Number.isNaN(r)||r<Date.now())return;Go({url:window.location.href.split("?")[0],token:e,expiresAt:r,publisherContentId:t.get("sp")??void 0});const i=new URL(window.location.href);i.searchParams.delete("ss"),i.searchParams.delete("se"),i.searchParams.delete("sp"),i.searchParams.delete("so"),i.searchParams.delete("token"),window.history.replaceState(null,"",i)}const jr="sesamy-user";async function ra(){const e=new URLSearchParams(window.location.search).get(jr);if(!e)return;const n=await mi();(n==null?void 0:n.email)!==e&&(ne(),Et({authorizationParams:{email_hint:e,login_hint:e}}));const r=new URL(window.location.href);r.searchParams.delete(jr),window.history.replaceState(null,"",r)}const Cr="sesamy-purchase";function ia(){const t=new URLSearchParams(window.location.search),e=t.get(Cr);if(e!==null){const n=new URL(window.location.href);t.delete(Cr),n.search=t.toString(),X(te.PURCHASE,{itemSrc:e}),ne(),window.history.replaceState(null,"",n)}}const xr="sesamy-login";async function oa(){if(!new URLSearchParams(window.location.search).get(xr))return;await _t()||Et();const r=new URL(window.location.href);r.searchParams.delete(xr),window.history.replaceState(null,"",r)}async function $r(t){Fo({clientId:t.clientId,environment:t.environment,...t.analytics}),await pi({clientId:t.clientId,organization:t.organization,environment:t.environment,...t.auth}),t.transform&&await Qo(t.transform);const e=Bo({clientId:t.clientId,environment:t.environment,...t.api});return X(te.READY,{}),ea(),ta(),na(),await oa(),await ra(),ia(),e}if(typeof document<"u"){const t=document.getElementById("sesamy-js");if(t!=null&&t.textContent)try{const e=JSON.parse(t.textContent);$r(e)}catch(e){console.error("Failed to parse config",e)}}return re.init=$r,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"}),re}({});
|
|
4
|
+
`)})(),t.cache&&t.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),t.cache)n=t.cache;else{if(r=t.cacheLocation||"memory",!Vc(r))throw new Error(`Invalid cache location "${r}"`);n=Vc(r)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=t.legacySameSiteCookie===!1?bt:ww,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(o=>`auth0.${o}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=t.sessionCheckExpiryDays||1;const a=t.useCookiesForTransactions?this.cookieStorage:bw;var i;this.scope=Wr("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new pw(a,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||xc,this.cacheManager=new vw(n,n.allKeys?void 0:new $w(n,this.options.clientId),this.nowProvider),this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((o,c)=>o?o.startsWith("https://")?o:`https://${o}/`:`${c}/`)(this.options.issuer,this.domainUrl),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&r==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Iw)}_url(t){const r=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||Uc)));return`${this.domainUrl}${t}&auth0Client=${r}`}_authorizeUrl(t){return this._url(`/authorize?${ni(t)}`)}async _verifyIdToken(t,r,n){const a=await this.nowProvider();return gw({iss:this.tokenIssuer,aud:this.options.clientId,id_token:t,nonce:r,organization:n,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,typeof i!="string"?i:parseInt(i,10)||void 0),now:a});var i}_processOrgHint(t){t?this.cookieStorage.save(this.orgHintCookieName,t,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(t,r,n){const a=Mc(ri()),i=Mc(ri()),o=ri(),c=(u=>{const s=new Uint8Array(u);return(d=>{const h={"+":"-","/":"_","=":""};return d.replace(/[+/=]/g,m=>h[m])})(window.btoa(String.fromCharCode(...Array.from(s))))})(await(async u=>await Gr().subtle.digest({name:"SHA-256"},new TextEncoder().encode(u)))(o)),l=((u,s,d,h,m,S,g,$)=>Object.assign(Object.assign(Object.assign({client_id:u.clientId},u.authorizationParams),d),{scope:Wr(s,d.scope),response_type:"code",response_mode:$||"query",state:h,nonce:m,redirect_uri:g||u.authorizationParams.redirect_uri,code_challenge:S,code_challenge_method:"S256"}))(this.options,this.scope,t,a,i,c,t.redirect_uri||this.options.authorizationParams.redirect_uri||n,r==null?void 0:r.response_mode),f=this._authorizeUrl(l);return{nonce:i,code_verifier:o,scope:l.scope,audience:l.audience||"default",redirect_uri:l.redirect_uri,state:a,url:f}}async loginWithPopup(t,r){var n;if(t=t||{},!(r=r||{}).popup&&(r.popup=(c=>{const l=window.screenX+(window.innerWidth-400)/2,f=window.screenY+(window.innerHeight-600)/2;return window.open(c,"auth0:authorize:popup",`left=${l},top=${f},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!r.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const a=await this._prepareAuthorizeUrl(t.authorizationParams||{},{response_mode:"web_message"},window.location.origin);r.popup.location.href=a.url;const i=await(c=>new Promise((l,f)=>{let u;const s=setInterval(()=>{c.popup&&c.popup.closed&&(clearInterval(s),clearTimeout(d),window.removeEventListener("message",u,!1),f(new ow(c.popup)))},1e3),d=setTimeout(()=>{clearInterval(s),f(new iw(c.popup)),window.removeEventListener("message",u,!1)},1e3*(c.timeoutInSeconds||60));u=function(h){if(h.data&&h.data.type==="authorization_response"){if(clearTimeout(d),clearInterval(s),window.removeEventListener("message",u,!1),c.popup.close(),h.data.response.error)return f(ne.fromPayload(h.data.response));l(h.data.response)}},window.addEventListener("message",u)}))(Object.assign(Object.assign({},r),{timeoutInSeconds:r.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(a.state!==i.state)throw new ne("state_mismatch","Invalid state");const o=((n=t.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:a.audience,scope:a.scope,code_verifier:a.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:a.redirect_uri},{nonceIn:a.nonce,organization:o})}async getUser(){var t;const r=await this._getIdTokenFromCache();return(t=r==null?void 0:r.decodedToken)===null||t===void 0?void 0:t.user}async getIdTokenClaims(){var t;const r=await this._getIdTokenFromCache();return(t=r==null?void 0:r.decodedToken)===null||t===void 0?void 0:t.claims}async loginWithRedirect(t={}){var r;const n=Zc(t),{openUrl:a,fragment:i,appState:o}=n,c=Pe(n,["openUrl","fragment","appState"]),l=((r=c.authorizationParams)===null||r===void 0?void 0:r.organization)||this.options.authorizationParams.organization,f=await this._prepareAuthorizeUrl(c.authorizationParams||{}),{url:u}=f,s=Pe(f,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},s),{appState:o}),l&&{organization:l}));const d=i?`${u}#${i}`:u;a?await a(d):window.location.assign(d)}async handleRedirectCallback(t=window.location.href){const r=t.split("?").slice(1);if(r.length===0)throw new Error("There are no query params available for parsing.");const{state:n,code:a,error:i,error_description:o}=(s=>{s.indexOf("#")>-1&&(s=s.substring(0,s.indexOf("#")));const d=new URLSearchParams(s);return{state:d.get("state"),code:d.get("code")||void 0,error:d.get("error")||void 0,error_description:d.get("error_description")||void 0}})(r.join("")),c=this.transactionManager.get();if(!c)throw new ne("missing_transaction","Invalid state");if(this.transactionManager.remove(),i)throw new aw(i,o||i,n,c.appState);if(!c.code_verifier||c.state&&c.state!==n)throw new ne("state_mismatch","Invalid state");const l=c.organization,f=c.nonce,u=c.redirect_uri;return await this._requestToken(Object.assign({audience:c.audience,scope:c.scope,code_verifier:c.code_verifier,grant_type:"authorization_code",code:a},u?{redirect_uri:u}:{}),{nonceIn:f,organization:l}),{appState:c.appState}}async checkSession(t){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(t)}catch{}}async getTokenSilently(t={}){var r;const n=Object.assign(Object.assign({cacheMode:"on"},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:Wr(this.scope,(r=t.authorizationParams)===null||r===void 0?void 0:r.scope)})}),a=await((i,o)=>{let c=ii[o];return c||(c=i().finally(()=>{delete ii[o],c=null}),ii[o]=c),c})(()=>this._getTokenSilently(n),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return t.detailedResponse?a:a==null?void 0:a.access_token}async _getTokenSilently(t){const{cacheMode:r}=t,n=Pe(t,["cacheMode"]);if(r!=="off"){const a=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(a)return a}if(r!=="cache-only"){if(!await(async(a,i=3)=>{for(let o=0;o<i;o++)if(await a())return!0;return!1})(()=>oi.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new ti;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),r!=="off"){const f=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(f)return f}const a=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:i,access_token:o,oauthTokenScope:c,expires_in:l}=a;return Object.assign(Object.assign({id_token:i,access_token:o},c?{scope:c}:null),{expires_in:l})}finally{await oi.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(t={},r={}){var n;const a=Object.assign(Object.assign({},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:Wr(this.scope,(n=t.authorizationParams)===null||n===void 0?void 0:n.scope)})});return r=Object.assign(Object.assign({},nw),r),await this.loginWithPopup(a,r),(await this.cacheManager.get(new Xe({scope:a.authorizationParams.scope,audience:a.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(t){t.clientId!==null?t.clientId=t.clientId||this.options.clientId:delete t.clientId;const r=t.logoutParams||{},{federated:n}=r,a=Pe(r,["federated"]),i=n?"&federated":"";return this._url(`/v2/logout?${ni(Object.assign({clientId:t.clientId},a))}`)+i}async logout(t={}){const r=Zc(t),{openUrl:n}=r,a=Pe(r,["openUrl"]);t.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(t.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 i=this._buildLogoutUrl(a);n?await n(i):n!==!1&&window.location.assign(i)}async _getTokenFromIFrame(t){const r=Object.assign(Object.assign({},t.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!r.organization&&(r.organization=n);const{url:a,state:i,nonce:o,code_verifier:c,redirect_uri:l,scope:f,audience:u}=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new ne("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const s=t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,d=await((m,S,g=60)=>new Promise(($,k)=>{const b=window.document.createElement("iframe");b.setAttribute("width","0"),b.setAttribute("height","0"),b.style.display="none";const v=()=>{window.document.body.contains(b)&&(window.document.body.removeChild(b),window.removeEventListener("message",I,!1))};let I;const O=setTimeout(()=>{k(new ti),v()},1e3*g);I=function(_){if(_.origin!=S||!_.data||_.data.type!=="authorization_response")return;const A=_.source;A&&A.close(),_.data.response.error?k(ne.fromPayload(_.data.response)):$(_.data.response),clearTimeout(O),window.removeEventListener("message",I,!1),setTimeout(v,2e3)},window.addEventListener("message",I,!1),window.document.body.appendChild(b),b.setAttribute("src",m)}))(a,this.domainUrl,s);if(i!==d.state)throw new ne("state_mismatch","Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:c,code:d.code,grant_type:"authorization_code",redirect_uri:l,timeout:t.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:o,organization:r.organization});return Object.assign(Object.assign({},h),{scope:f,oauthTokenScope:h.scope,audience:u})}catch(s){throw s.error==="login_required"&&this.logout({openUrl:!1}),s}}async _getTokenUsingRefreshToken(t){const r=await this.cacheManager.get(new Xe({scope:t.authorizationParams.scope,audience:t.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw new Nc(t.authorizationParams.audience||"default",t.authorizationParams.scope)}const n=t.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,a=typeof t.timeoutInSeconds=="number"?1e3*t.timeoutInSeconds:null;try{const i=await this._requestToken(Object.assign(Object.assign(Object.assign({},t.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:n}),a&&{timeout:a}));return Object.assign(Object.assign({},i),{scope:t.authorizationParams.scope,oauthTokenScope:i.scope,audience:t.authorizationParams.audience||"default"})}catch(i){if((i.message.indexOf("Missing Refresh Token")>-1||i.message&&i.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw i}}async _saveEntryInCache(t){const{id_token:r,decodedToken:n}=t,a=Pe(t,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:r,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,t.id_token,t.decodedToken),await this.cacheManager.set(a)}async _getIdTokenFromCache(){const t=this.options.authorizationParams.audience||"default",r=await this.cacheManager.getIdToken(new Xe({clientId:this.options.clientId,audience:t,scope:this.scope})),n=this.userCache.get("@@user@@");return r&&r.id_token===(n==null?void 0:n.id_token)?n:(this.userCache.set("@@user@@",r),r)}async _getEntryFromCache({scope:t,audience:r,clientId:n}){const a=await this.cacheManager.get(new Xe({scope:t,audience:r,clientId:n}),60);if(a&&a.access_token){const{access_token:i,oauthTokenScope:o,expires_in:c}=a,l=await this._getIdTokenFromCache();return l&&Object.assign(Object.assign({id_token:l.id_token,access_token:i},o?{scope:o}:null),{expires_in:c})}}async _requestToken(t,r){const{nonceIn:n,organization:a}=r||{},i=await dw(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},t),this.worker),o=await this._verifyIdToken(i.id_token,n,a);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},i),{decodedToken:o,scope:t.scope,audience:t.audience||"default"}),i.scope?{oauthTokenScope:i.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(a||o.claims.org_id),Object.assign(Object.assign({},i),{decodedToken:o})}};async function Tw(e){const t=new Pw(e);return await t.checkSession(),t}var ye=(e=>(e.READY="sesamyJsReady",e.AUTHENTICATED="sesamyJsAuthenticated",e.LOGOUT="sesamyJsLogout",e.CLEAR_CACHE="sesamyJsClearCache",e.USER_ATTRIBUTE_CHANGED="sesamyUserAttributeChanged",e.PURCHASE="sesamyJsPurchase",e))(ye||{});const Ew="sesamy.com",Ow="sesamy.dev",_w="https://sesa.my",si="sesamyCacheTimestamp";function Me(e,t){return`https://${e}.${t==="dev"?Ow:Ew}`}let ae,Yc;const St="sesamyAccessToken",ci="sesamyRefreshToken";async function Rw(e){if(!e)return null;const t=localStorage.getItem(ci);if(!t)throw new Error("No refresh token available");const r=new URLSearchParams;r.set("client_id",e.iss),r.set("refresh_token",t),r.set("grant_type","refresh_token");const n=new URL(e.iss);n.pathname="/oauth/token",n.searchParams.set("user_id",e.sub);try{const a=await fetch(n.href,{body:r.toString(),method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"}});if(!a.ok)throw localStorage.removeItem(ci),new Error("Renew token failed");const i=await a.json();return localStorage.setItem(ci,i.refresh_token),localStorage.setItem(St,i.access_token),i.access_token}catch{Xc()}}async function ui(){const e=localStorage.getItem(St);if(!e)return null;const t=qc(e);if(!t||!t.exp||t.exp<new Date().getTime()/1e3){const r=await Rw(t);if(r)return r;localStorage.removeItem(St)}return e}function Jc(e){try{const t=new URL(e).hostname,r=t.split(".");return r.length>1?r.slice(-2).join("."):t}catch{return null}}async function Cw(e){if(e.enabled===!1)return;Yc=e.organization;const t={domain:Me("token",e.environment),clientId:e.clientId,useCookiesForTransactions:!0};if(Jc(window.location.href)!==Jc(Me("auth",e.environment))&&(t.cacheLocation="localstorage",t.useRefreshTokens=!0),ae=await Tw(t),window.location.search.includes("code="))try{await ae.handleRedirectCallback();const r=await ae.getUser();De(ye.AUTHENTICATED,r);const n=new URL(location.href),a=n.searchParams;a.delete("code"),a.delete("state"),n.search=a.toString(),window.history.replaceState({},document.title,n.toString())}catch(r){console.error(r)}}async function li(){return await ui()?!0:ae?ae.isAuthenticated():!1}async function jw(){return await ui()?{sub:"local",name:"Local User"}:ae?ae.getUser():null}function fi(e){if(localStorage.removeItem(St),!ae)throw new Error("Auth0 client not initialized");const t=(e==null?void 0:e.authorizationParams)||{};return ae.loginWithRedirect({...e,authorizationParams:{organization:Yc,redirect_uri:window.location.href,...t}})}async function tr(e=!0){const t=ui();if(t)return t;try{return ae?await ae.getTokenSilently():null}catch(r){if(e)throw r;return null}}async function Xc(e={}){if(localStorage.removeItem(St),De(ye.LOGOUT,{}),!!ae)return ae.logout({...e,logoutParams:{returnTo:window.location.href,...e.logoutParams}})}function qc(e){const t=e.split(".");if(t.length!==3)return null;const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(n).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}async function Qc(e){const t=qc(e);if(!t||!t.exp||t.exp<new Date().getTime()/1e3)throw new Error("Invalid token");localStorage.setItem(St,e),De(ye.AUTHENTICATED,t)}const Aw=(e,t)=>t.skipDedupe||t.method!=="GET",Lw=(e,t)=>t.method+"@"+e,Uw=e=>e.clone(),eu=({skip:e=Aw,key:t=Lw,resolver:r=Uw}={})=>{const n=new Map;return a=>(i,o)=>{if(e(i,o))return a(i,o);const c=t(i,o);if(!n.has(c))n.set(c,[]);else return new Promise((l,f)=>{n.get(c).push([l,f])});try{return a(i,o).then(l=>(n.get(c).forEach(([f])=>f(r(l))),n.delete(c),l)).catch(l=>{throw n.get(c).forEach(([f,u])=>u(l)),n.delete(c),l})}catch(l){return n.delete(c),Promise.reject(l)}}},xw=(e,t)=>e*t,Nw=e=>e&&e.ok,tu=({delayTimer:e=500,delayRamp:t=xw,maxAttempts:r=10,until:n=Nw,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:c}={})=>l=>(f,u)=>{let s=0;if(c&&c(f,u))return l(f,u);const d=(h,m)=>Promise.resolve(n(h,m)).then(S=>S?h&&o?h:m?Promise.reject(m):h:(s++,!r||s<=r?new Promise(g=>{const $=t(e,s);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:h,error:m,url:f,options:u})).then((k={})=>{var b,v;g(l((b=k&&k.url)!==null&&b!==void 0?b:f,(v=k&&k.options)!==null&&v!==void 0?v:u))}):g(l(f,u))},$)}).then(d).catch(g=>{if(!i)throw g;return d(null,g)}):h&&o?h:Promise.reject(m||new Error("Number of attempts exceeded."))));return l(f,u).then(d).catch(h=>{if(!i)throw h;return d(null,h)})},Dw="application/json",ru="Content-Type",It=Symbol(),nu=Symbol();function au(e={}){var t;return(t=Object.entries(e).find(([r])=>r.toLowerCase()===ru.toLowerCase()))===null||t===void 0?void 0:t[1]}function iu(e){return/^application\/.*json.*/.test(e)}const Qe=function(e,t,r=!1){return Object.entries(t).reduce((n,[a,i])=>{const o=e[a];return Array.isArray(o)&&Array.isArray(i)?n[a]=r?[...o,...i]:i:typeof o=="object"&&typeof i=="object"?n[a]=Qe(o,i,r):n[a]=i,n},{...e})},$t={options:{},errorType:"text",polyfills:{},polyfill(e,t=!0,r=!1,...n){const a=this.polyfills[e]||(typeof self<"u"?self[e]:null)||(typeof global<"u"?global[e]:null);if(t&&!a)throw new Error(e+" is not defined");return r&&a?new a(...n):a}};function Mw(e,t=!1){$t.options=t?e:Qe($t.options,e)}function Fw(e,t=!1){$t.polyfills=t?e:Qe($t.polyfills,e)}function zw(e){$t.errorType=e}const Hw=e=>t=>e.reduceRight((r,n)=>n(r),t)||t;class ou extends Error{}const Bw=e=>{const t=Object.create(null);e=e._addons.reduce((b,v)=>v.beforeRequest&&v.beforeRequest(b,e._options,t)||b,e);const{_url:r,_options:n,_config:a,_catchers:i,_resolvers:o,_middlewares:c,_addons:l}=e,f=new Map(i),u=Qe(a.options,n);let s=r;const d=Hw(c)((b,v)=>(s=b,a.polyfill("fetch")(b,v)))(r,u),h=new Error,m=d.catch(b=>{throw{[It]:b}}).then(b=>{if(!b.ok){const v=new ou;if(v.cause=h,v.stack=v.stack+`
|
|
5
|
+
CAUSE: `+h.stack,v.response=b,v.url=s,b.type==="opaque")throw v;return b.text().then(I=>{var O;if(v.message=I,a.errorType==="json"||((O=b.headers.get("Content-Type"))===null||O===void 0?void 0:O.split(";")[0])==="application/json")try{v.json=JSON.parse(I)}catch{}throw v.text=I,v.status=b.status,v})}return b}),S=b=>b.catch(v=>{const I=v.hasOwnProperty(It),O=I?v[It]:v,_=(O==null?void 0:O.status)&&f.get(O.status)||f.get(O==null?void 0:O.name)||I&&f.has(It)&&f.get(It);if(_)return _(O,e);const A=f.get(nu);if(A)return A(O,e);throw O}),g=b=>v=>S(b?m.then(I=>I&&I[b]()).then(I=>v?v(I):I):m.then(I=>v?v(I):I)),$={_wretchReq:e,_fetchReq:d,_sharedState:t,res:g(null),json:g("json"),blob:g("blob"),formData:g("formData"),arrayBuffer:g("arrayBuffer"),text:g("text"),error(b,v){return f.set(b,v),this},badRequest(b){return this.error(400,b)},unauthorized(b){return this.error(401,b)},forbidden(b){return this.error(403,b)},notFound(b){return this.error(404,b)},timeout(b){return this.error(408,b)},internalError(b){return this.error(500,b)},fetchError(b){return this.error(It,b)}},k=l.reduce((b,v)=>({...b,...typeof v.resolver=="function"?v.resolver(b):v.resolver}),$);return o.reduce((b,v)=>v(b,e),k)},Kw={_url:"",_options:{},_config:$t,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(e){return{...this,_addons:[...this._addons,e],...e.wretch}},errorType(e){return{...this,_config:{...this._config,errorType:e}}},polyfills(e,t=!1){return{...this,_config:{...this._config,polyfills:t?e:Qe(this._config.polyfills,e)}}},url(e,t=!1){if(t)return{...this,_url:e};const r=this._url.split("?");return{...this,_url:r.length>1?r[0]+e+"?"+r[1]:this._url+e}},options(e,t=!1){return{...this,_options:t?e:Qe(this._options,e)}},headers(e){const t=e?Array.isArray(e)?Object.fromEntries(e):"entries"in e?Object.fromEntries(e.entries()):e:{};return{...this,_options:Qe(this._options,{headers:t})}},accept(e){return this.headers({Accept:e})},content(e){return this.headers({[ru]:e})},auth(e){return this.headers({Authorization:e})},catcher(e,t){const r=new Map(this._catchers);return r.set(e,t),{...this,_catchers:r}},catcherFallback(e){return this.catcher(nu,e)},resolve(e,t=!1){return{...this,_resolvers:t?[e]:[...this._resolvers,e]}},defer(e,t=!1){return{...this,_deferred:t?[e]:[...this._deferred,e]}},middlewares(e,t=!1){return{...this,_middlewares:t?e:[...this._middlewares,...e]}},fetch(e=this._options.method,t="",r=null){let n=this.url(t).options({method:e});const a=au(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof r=="object"&&!(i&&r instanceof i)&&(!n._options.headers||!a||iu(a));return n=r?o?n.json(r,a):n.body(r):n,Bw(n._deferred.reduce((c,l)=>l(c,c._url,c._options),n))},get(e=""){return this.fetch("GET",e)},delete(e=""){return this.fetch("DELETE",e)},put(e,t=""){return this.fetch("PUT",t,e)},post(e,t=""){return this.fetch("POST",t,e)},patch(e,t=""){return this.fetch("PATCH",t,e)},head(e=""){return this.fetch("HEAD",e)},opts(e=""){return this.fetch("OPTIONS",e)},body(e){return{...this,_options:{...this._options,body:e}}},json(e,t){const r=au(this._options.headers);return this.content(t||iu(r)&&r||Dw).body(JSON.stringify(e))}};function Re(e="",t={}){return{...Kw,_url:e,_options:t}}Re.default=Re,Re.options=Mw,Re.errorType=zw,Re.polyfills=Fw,Re.WretchError=ou;function we(){sessionStorage.removeItem(si),De(ye.CLEAR_CACHE,{})}function su(){var r;return(r=(document.documentElement.getAttribute("lang")??"en").split("-")[0])==null?void 0:r.toLocaleLowerCase()}function Gw(e){const t=Me("api2",e.environment),r=w=>async(P,T)=>{let M=sessionStorage.getItem(si);M||(M=Date.now().toString(),sessionStorage.setItem(si,M));const N={...T,headers:{...T.headers,"Cache-Timestamp":M}};return w(P,N)},n=(w=!0)=>P=>async(T,M)=>{let N=null;if(N=await tr(w),!N){if(w)throw new Error("No access token available");return P(T,M)}const re={...M,headers:{...M.headers,...N?{Authorization:`Bearer ${N}`}:{}}};return P(T,re)},a=w=>(P,T)=>{if(T.headers.Authorization)return w(P,T);const M=localStorage.getItem("__anon_id"),N=btoa(`${M}:`),re={...T,headers:{...T.headers,Authorization:`Basic ${N}`}};return w(P,re)},i=Re(t).headers({"Content-Type":"application/json"}).middlewares([r,n(),eu(),tu({delayTimer:1e3,delayRamp:(w,P)=>w*P,maxAttempts:3,until:w=>!!(w&&(w.ok||w.status>=400&&w.status<500)),retryOnNetworkError:!1})]),o=Re(t).headers({"Content-Type":"application/json"}).middlewares([r,n(!1),a,eu(),tu({delayTimer:1e3,delayRamp:(w,P)=>w*P,maxAttempts:3,until:w=>!!(w&&(w.ok||w.status>=400&&w.status<500)),retryOnNetworkError:!1})]);async function c(){return i.get("/entitlements").json()}async function l(w){const P=await i.get("/entitlements").json();return P==null?void 0:P.find(T=>T.id===w)}async function f(w){return i.get(`/entitlements/${w}/access`).json()}async function u(){return i.get("/contracts").json()}async function s(w){const P=await i.get("/contracts").json();return P==null?void 0:P.find(T=>T.id===w)}async function d(){return i.get("/subscriptions").json()}async function h(){return i.get("/bills").json()}async function m(w){const P=await i.get("/bills").json();return P==null?void 0:P.find(T=>T.id===w)}async function S(w,P){const T=await i.url(`/user-metadata/${w}`).put(P).json();return De(ye.USER_ATTRIBUTE_CHANGED,{}),we(),T}async function g(w){const P=await i.url(`/user-metadata/${w}`).delete().res();return we(),P.ok}async function $(w){return(await i.url(`/user-metadata/${w}`).get().json())[w]}async function k(){return await i.url("/user-metadata").get().json()}async function b(){return await i.url("/tags").get().json()}async function v(w){const P=await i.url(`/tags/${w}`).delete().res();return we(),P.ok}async function I(w){const P=await i.url("/tags").post(w).res();return De(ye.USER_ATTRIBUTE_CHANGED,{}),we(),P.ok}async function O(w){return(await o.url("/tallies").get().json())[w]}async function _(){return await o.url("/tallies").get().json()}async function A(w){const P=await o.url(`/tallies/${w}`).delete().res();return we(),P.ok}async function F(w,P){return await o.url(`/tallies/${w}/push`).post(P).json()}async function z(w){return await i.url(`/products/${w}`).get().json()}async function W(){return await tr(!1)?await i.url("/profile").get().json():null}async function L(w){const P=await i.url("/profile").patch(w).res();return we(),P.ok}async function D(){return await i.url("/payment-issues").get().json()}async function H(){return(await i.url("/profile/spotify-link").get().json()).isSpotifyLinked}async function R(){return(await i.url("/profile/unlink-spotify").post().res()).ok}async function K(w){const P=await tr(!1);if(!P)throw new Error("No access token available");const T=new URL(`${Me("spotify-oas",e.environment)}/sesamy-callback`);T.searchParams.set("access_token",P),T.searchParams.set("state",w),window.location.href=T.toString()}async function V(w){const P=await i.url(`/products/${w}/auto-onboard`).post().json();return P.length&&we(),P}async function it(w,P=3600){const{shortlink:T}=await Re(_w).post({url:w,ttl:P}).json();return T}async function p(w){const P=await tr(!1);let T;const M=w.language||su();switch(w.target){case"account":T=new URL(`${Me("account",e.environment)}/${M}/subscriptions/${e.clientId}`);break;case"consume":T=new URL(`${Me("consume",e.environment)}/${M}/@${e.clientId}/${w.sku}`),w.episodeId?T.href+=`/${w.episodeId}`:T.href+="/listen";break;default:throw new Error("Invalid target")}return T.searchParams.set("sesamy-redirect-url",w.redirectUrl||window.location.href),P&&(T.hash=`#access_token=${P}`),w.shorten?it(T.href,w.ttl):T.href}async function y(w){return(await o.url("/checkouts").post({language:su(),...w,vendorId:e.clientId})).json()}async function E(w,P){return(await o.url(`/checkouts/${w}`).patch(P)).json()}async function U(w){return(await o.url(`/checkouts/${w}`).get()).json()}async function x(){const w=await tr(!1),P=new URL(`${Me("account",e.environment)}/subscriptions/${e.clientId}`);w&&(P.hash=`#access_token=${w}`),window.location.href=P.toString()}return{createCheckout:y,updateCheckout:E,getCheckout:U,getEntitlements:c,getEntitlement:l,getEntitlementAccess:f,getContracts:u,getContract:s,getProfile:W,updateProfile:L,getSubscriptions:d,getBills:h,getBill:m,setUserMetadata:S,deleteUserMetadata:g,getUserMetadata:$,listUserMetadata:k,getTags:b,deleteTag:v,setTag:I,getTally:O,getTallies:_,deleteTally:A,pushTally:F,getProduct:z,getPaymentIssues:D,autoOnboardProduct:V,isSpotifyLinked:H,unlinkSpotify:R,linkSpotify:K,generateLink:p,openHostedAccountPage:x}}const cu="@sesamy/sesamy-js",di="1.13.2";function uu(e,t,r,n,a){for(t=t.split?t.split("."):t,n=0;n<t.length;n++)e=e?e[t[n]]:a;return e===a?r:e}var Vr="undefined",lu="object",hi=function(){},fu="any",du="*",et="__",Zr=typeof process<"u"?process:{};Zr.env&&Zr.env.NODE_ENV;var Z=typeof document<"u";Zr.versions!=null&&Zr.versions.node!=null,typeof Deno<"u"&&Deno.core,Z&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent!==void 0&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function hu(e,t){return t.charAt(0)[e]()+t.slice(1)}var Ww=hu.bind(null,"toUpperCase"),Vw=hu.bind(null,"toLowerCase");function Zw(e){return vu(e)?Ww("null"):typeof e=="object"?qw(e):Object.prototype.toString.call(e).slice(8,-1)}function Yr(e,t){t===void 0&&(t=!0);var r=Zw(e);return t?Vw(r):r}function rr(e,t){return typeof t===e}var ee=rr.bind(null,"function"),Fe=rr.bind(null,"string"),kt=rr.bind(null,"undefined"),Yw=rr.bind(null,"boolean");rr.bind(null,"symbol");function vu(e){return e===null}function Jw(e){return Yr(e)==="number"&&!isNaN(e)}function pu(e){return Yr(e)==="array"}function te(e){if(!Xw(e))return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Xw(e){return e&&(typeof e=="object"||e!==null)}function qw(e){return ee(e.constructor)?e.constructor.name:null}function Qw(e){return e instanceof Error||Fe(e.message)&&e.constructor&&Jw(e.constructor.stackTraceLimit)}function mu(e,t){if(typeof t!="object"||vu(t))return!1;if(t instanceof e)return!0;var r=Yr(new e(""));if(Qw(t))for(;t;){if(Yr(t)===r)return!0;t=Object.getPrototypeOf(t)}return!1}mu.bind(null,TypeError),mu.bind(null,SyntaxError);function Jr(e,t){var r=e instanceof Element||e instanceof HTMLDocument;return r&&t?eb(e,t):r}function eb(e,t){return t===void 0&&(t=""),e&&e.nodeName===t.toUpperCase()}function Xr(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}Xr(Jr,"form"),Xr(Jr,"button"),Xr(Jr,"input"),Xr(Jr,"select");function tb(e){return e?pu(e)?e:[e]:[]}function gu(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function rb(){if(Z){var e=navigator,t=e.languages;return e.userLanguage||(t&&t.length?t[0]:e.language)}}function nb(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function ab(e){return function(t){for(var r,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;r=a.exec(t);){var i=gu(r[1]),o=gu(r[2]);i.substring(i.length-2)==="[]"?(n[i=i.substring(0,i.length-2)]||(n[i]=[])).push(o):n[i]=o===""||o}for(var c in n){var l=c.split("[");l.length>1&&(ib(n,l.map(function(f){return f.replace(/[?[\]\\ ]/g,"")}),n[c]),delete n[c])}return n}(function(t){return Z&&window.location.search.substring(1)}())}function ib(e,t,r){for(var n=t.length-1,a=0;a<n;++a){var i=t[a];if(i==="__proto__"||i==="constructor")break;i in e||(e[i]={}),e=e[i]}e[t[n]]=r}function qr(){for(var e="",t=0,r=4294967295*Math.random()|0;t++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],a=15&r;e+=n=="-"||n=="4"?n:(n=="x"?a:3&a|8).toString(16),r=t%8==0?4294967295*Math.random()|0:r>>4}return e}function ob(e,t){var r,n,a,i=null,o=0,c=function(){o=new Date,i=null,a=e.apply(r,n)};return function(){var l=new Date;o||(o=l);var f=t-(l-o);return r=this,n=arguments,f<=0?(clearTimeout(i),i=null,o=l,a=e.apply(r,n)):i||(i=setTimeout(c,f)),a}}var nr="global",Pt=et+"global"+et,Tt=typeof self===lu&&self.self===self&&self||typeof global===lu&&global.global===global&&global||void 0;function tt(e){return Tt[Pt][e]}function rt(e,t){return Tt[Pt][e]=t}function Et(e){delete Tt[Pt][e]}function Ot(e,t,r){var n;try{if(vi(e)){var a=window[e];n=a[t].bind(a)}}catch{}return n||r}Tt[Pt]||(Tt[Pt]={});var Qr={};function vi(e){if(typeof Qr[e]!==Vr)return Qr[e];try{var t=window[e];t.setItem(Vr,Vr),t.removeItem(Vr)}catch{return Qr[e]=!1}return Qr[e]=!0}function C(){return C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},C.apply(this,arguments)}var ze="function",Ce="undefined",sb="@@redux/"+Math.random().toString(36),yu=function(){return typeof Symbol===ze&&Symbol.observable||"@@observable"}(),en=" != "+ze;function wu(e,t,r){var n;if(typeof t===ze&&typeof r===Ce&&(r=t,t=void 0),typeof r!==Ce){if(typeof r!==ze)throw new Error("enhancer"+en);return r(wu)(e,t)}if(typeof e!==ze)throw new Error("reducer"+en);var a=e,i=t,o=[],c=o,l=!1;function f(){c===o&&(c=o.slice())}function u(){return i}function s(h){if(typeof h!==ze)throw new Error("Listener"+en);var m=!0;return f(),c.push(h),function(){if(m){m=!1,f();var S=c.indexOf(h);c.splice(S,1)}}}function d(h){if(!te(h))throw new Error("Act != obj");if(typeof h.type===Ce)throw new Error("ActType "+Ce);if(l)throw new Error("Dispatch in reducer");try{l=!0,i=a(i,h)}finally{l=!1}for(var m=o=c,S=0;S<m.length;S++)(0,m[S])();return h}return d({type:"@@redux/INIT"}),(n={dispatch:d,subscribe:s,getState:u,replaceReducer:function(h){if(typeof h!==ze)throw new Error("next reducer"+en);a=h,d({type:"@@redux/INIT"})}})[yu]=function(){var h,m=s;return(h={subscribe:function(S){if(typeof S!="object")throw new TypeError("Observer != obj");function g(){S.next&&S.next(u())}return g(),{unsubscribe:m(g)}}})[yu]=function(){return this},h},n}function cb(e,t){var r=t&&t.type;return"action "+(r&&r.toString()||"?")+"reducer "+e+" returns "+Ce}function _t(){var e=[].slice.call(arguments);return e.length===0?function(t){return t}:e.length===1?e[0]:e.reduce(function(t,r){return function(){return t(r.apply(void 0,[].slice.call(arguments)))}})}function ub(){var e=arguments;return function(t){return function(r,n,a){var i,o=t(r,n,a),c=o.dispatch,l={getState:o.getState,dispatch:function(f){return c(f)}};return i=[].slice.call(e).map(function(f){return f(l)}),C({},o,{dispatch:c=_t.apply(void 0,i)(o.dispatch)})}}}var He=et+"anon_id",nt=et+"user_id",Rt=et+"user_traits",Be="userId",Ct="anonymousId",tn=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],pi=["name","EVENTS","config","loaded"],j=tn.reduce(function(e,t){return e[t]=t,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),bu=/^utm_/,Su=/^an_prop_/,Iu=/^an_trait_/;function lb(e){var t=e.storage.setItem;return function(r){return function(n){return function(a){if(a.type===j.bootstrap){var i=a.params,o=a.user,c=a.persistedUser,l=a.initialUser,f=c.userId===o.userId;c.anonymousId!==o.anonymousId&&t(He,o.anonymousId),f||t(nt,o.userId),l.traits&&t(Rt,C({},f&&c.traits?c.traits:{},l.traits));var u=Object.keys(a.params);if(u.length){var s=i.an_uid,d=i.an_event,h=u.reduce(function(m,S){if(S.match(bu)||S.match(/^(d|g)clid/)){var g=S.replace(bu,"");m.campaign[g==="campaign"?"name":g]=i[S]}return S.match(Su)&&(m.props[S.replace(Su,"")]=i[S]),S.match(Iu)&&(m.traits[S.replace(Iu,"")]=i[S]),m},{campaign:{},props:{},traits:{}});r.dispatch(C({type:j.params,raw:i},h,s?{userId:s}:{})),s&&setTimeout(function(){return e.identify(s,h.traits)},0),d&&setTimeout(function(){return e.track(d,h.props)},0),Object.keys(h.campaign).length&&r.dispatch({type:j.campaign,campaign:h.campaign})}}return n(a)}}}}function fb(e){return function(t,r){if(t===void 0&&(t={}),r===void 0&&(r={}),r.type===j.setItemEnd){if(r.key===He)return C({},t,{anonymousId:r.value});if(r.key===nt)return C({},t,{userId:r.value})}switch(r.type){case j.identify:return Object.assign({},t,{userId:r.userId,traits:C({},t.traits,r.traits)});case j.reset:return[nt,He,Rt].forEach(function(n){e.removeItem(n)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function $u(e){return{userId:e.getItem(nt),anonymousId:e.getItem(He),traits:e.getItem(Rt)}}var mi=function(e){return et+"TEMP"+et+e};function db(e){var t=e.storage,r=t.setItem,n=t.removeItem,a=t.getItem;return function(i){return function(o){return function(c){var l=c.userId,f=c.traits,u=c.options;if(c.type===j.reset&&([nt,Rt,He].forEach(function(h){n(h)}),[Be,Ct,"traits"].forEach(function(h){Et(mi(h))})),c.type===j.identify){a(He)||r(He,qr());var s=a(nt),d=a(Rt)||{};s&&s!==l&&i.dispatch({type:j.userIdChanged,old:{userId:s,traits:d},new:{userId:l,traits:f},options:u}),l&&r(nt,l),f&&r(Rt,C({},d,f))}return o(c)}}}}var ar={};function ku(e,t){ar[e]&&ee(ar[e])&&(ar[e](t),delete ar[e])}function Pu(e,t,r){return new Promise(function(n,a){return t()?n(e):r<1?a(C({},e,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return Pu(e,t,r-10).then(n,a)})})}function hb(e){return{abort:e}}function Tu(e,t,r){var n={},a=t(),i=e.getState(),o=i.plugins,c=i.queue,l=i.user;if(!i.context.offline&&c&&c.actions&&c.actions.length){var f=c.actions.reduce(function(s,d,h){return o[d.plugin].loaded?(s.process.push(d),s.processIndex.push(h)):(s.requeue.push(d),s.requeueIndex.push(h)),s},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(f.processIndex&&f.processIndex.length){f.processIndex.forEach(function(s){var d=c.actions[s],h=d.plugin,m=d.payload.type,S=a[h][m];if(S&&ee(S)){var g,$=function(v,I){return v===void 0&&(v={}),I===void 0&&(I={}),[Be,Ct].reduce(function(O,_){return v.hasOwnProperty(_)&&I[_]&&I[_]!==v[_]&&(O[_]=I[_]),O},v)}(d.payload,l),k=n[$.meta.rid];if(!k&&(g=S({payload:$,config:o[h].config,instance:r,abort:hb}))&&te(g)&&g.abort)return void(n[$.meta.rid]=!0);if(!k){var b=m+":"+h;e.dispatch(C({},$,{type:b,_:{called:b,from:"queueDrain"}}))}}});var u=c.actions.filter(function(s,d){return!~f.processIndex.indexOf(d)});c.actions=u}}}var gi=function(e){var t=e.data,r=e.action,n=e.instance,a=e.state,i=e.allPlugins,o=e.allMatches,c=e.store,l=e.EVENTS;try{var f=a.plugins,u=a.context,s=r.type,d=s.match(jt),h=t.exact.map(function(g){return g.pluginName});d&&(h=o.during.map(function(g){return g.pluginName}));var m=function(g,$){return function(k,b,v){var I=b.config,O=b.name,_=O+"."+k.type;v&&(_=v.event);var A=k.type.match(jt)?function(F,z,W,L,D){return function(H,R){var K=L?L.name:F,V=R&&ir(R)?R:W;if(L&&(!(V=R&&ir(R)?R:[F]).includes(F)||V.length!==1))throw new Error("Method "+z+" can only abort "+F+" plugin. "+JSON.stringify(V)+" input valid");return C({},D,{abort:{reason:H,plugins:V,caller:z,_:K}})}}(O,_,$,v,k):function(F,z){return function(){throw new Error(F.type+" action not cancellable. Remove abort in "+z)}}(k,_);return{payload:vb(k),instance:g,config:I||{},abort:A}}}(n,h),S=t.exact.reduce(function(g,$){var k=$.pluginName,b=$.methodName,v=!1;return b.match(/^initialize/)||b.match(/^reset/)||(v=!f[k].loaded),u.offline&&b.match(/^(page|track|identify)/)&&(v=!0),g[""+k]=v,g},{});return Promise.resolve(t.exact.reduce(function(g,$,k){try{var b=$.pluginName;return Promise.resolve(g).then(function(v){function I(){return Promise.resolve(v)}var O=function(){if(t.namespaced&&t.namespaced[b])return Promise.resolve(t.namespaced[b].reduce(function(_,A,F){try{return Promise.resolve(_).then(function(z){return A.method&&ee(A.method)?(function(H,R){var K=Lu(H);if(K&&K.name===R){var V=Lu(K.method);throw new Error([R+" plugin is calling method "+H,"Plugins cant call self","Use "+K.method+" "+(V?"or "+V.method:"")+" in "+R+" plugin insteadof "+H].join(`
|
|
6
|
+
`))}}(A.methodName,A.pluginName),Promise.resolve(A.method({payload:z,instance:n,abort:(W=z,L=b,D=A.pluginName,function(H,R){return C({},W,{abort:{reason:H,plugins:R||[L],caller:s,from:D||L}})}),config:_u(A.pluginName,f,i),plugins:f})).then(function(H){var R=te(H)?H:{};return Promise.resolve(C({},z,R))})):z;var W,L,D})}catch(z){return Promise.reject(z)}},Promise.resolve(r))).then(function(_){v[b]=_});v[b]=r}();return O&&O.then?O.then(I):I()})}catch(v){return Promise.reject(v)}},Promise.resolve({}))).then(function(g){return Promise.resolve(t.exact.reduce(function($,k,b){try{var v=t.exact.length===b+1,I=k.pluginName,O=i[I];return Promise.resolve($).then(function(_){var A=g[I]?g[I]:{};if(d&&(A=_),wi(A,I))return yi({data:A,method:s,instance:n,pluginName:I,store:c}),Promise.resolve(_);if(wi(_,I))return v&&yi({data:_,method:s,instance:n,store:c}),Promise.resolve(_);if(S.hasOwnProperty(I)&&S[I]===!0)return c.dispatch({type:"queue",plugin:I,payload:A,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(_);var F=m(g[I],i[I]);return Promise.resolve(O[s]({abort:F.abort,payload:A,instance:n,config:_u(I,f,i),plugins:f})).then(function(z){var W=te(z)?z:{},L=C({},_,W),D=g[I];if(wi(D,I))yi({data:D,method:s,instance:n,pluginName:I,store:c});else{var H=s+":"+I;(H.match(/:/g)||[]).length<2&&!s.match(Eu)&&!s.match(Ou)&&n.dispatch(C({},d?L:A,{type:H,_:{called:H,from:"submethod"}}))}return Promise.resolve(L)})})}catch(_){return Promise.reject(_)}},Promise.resolve(r))).then(function($){if(!(s.match(jt)||s.match(/^registerPlugin/)||s.match(Ou)||s.match(Eu)||s.match(/^params/)||s.match(/^userIdChanged/))){if(l.plugins.includes(s),$._&&$._.originalAction===s)return $;var k=C({},$,{_:{originalAction:$.type,called:$.type,from:"engineEnd"}});ju($,t.exact.length)&&!s.match(/End$/)&&(k=C({},k,{type:$.type+"Aborted"})),c.dispatch(k)}return $})})}catch(g){return Promise.reject(g)}},jt=/Start$/,Eu=/^bootstrap/,Ou=/^ready/;function yi(e){var t=e.pluginName,r=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(C({},e.data,{type:r,_:{called:r,from:"abort"}}))}function _u(e,t,r){var n=t[e]||r[e];return n&&n.config?n.config:{}}function Ru(e,t){return t.reduce(function(r,n){return n[e]?r.concat({methodName:e,pluginName:n.name,method:n[e]}):r},[])}function Cu(e,t){var r=e.replace(jt,""),n=t?":"+t:"";return[""+e+n,""+r+n,r+"End"+n]}function wi(e,t){var r=e.abort;return!!r&&(r===!0||Au(r,t)||r&&Au(r.plugins,t))}function ju(e,t){var r=e.abort;if(!r)return!1;if(r===!0||Fe(r))return!0;var n=r.plugins;return ir(r)&&r.length===t||ir(n)&&n.length===t}function ir(e){return Array.isArray(e)}function Au(e,t){return!(!e||!ir(e))&&e.includes(t)}function Lu(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function vb(e){return Object.keys(e).reduce(function(t,r){return r==="type"||(t[r]=te(e[r])?Object.assign({},e[r]):e[r]),t},{})}function pb(e,t,r){var n={};return function(a){return function(i){return function(o){try{var c,l=function(v){return c?v:i(s)},f=o.type,u=o.plugins,s=o;if(o.abort)return Promise.resolve(i(o));if(f===j.enablePlugin&&a.dispatch({type:j.initializeStart,plugins:u,disabled:[],fromEnable:!0,meta:o.meta}),f===j.disablePlugin&&setTimeout(function(){return ku(o.meta.rid,{payload:o})},0),f===j.initializeEnd){var d=t(),h=Object.keys(d),m=h.filter(function(v){return u.includes(v)}).map(function(v){return d[v]}),S=[],g=[],$=o.disabled,k=m.map(function(v){var I=v.loaded,O=v.name,_=v.config;return Pu(v,function(){return I({config:_})},1e4).then(function(A){return n[O]||(a.dispatch({type:j.pluginReadyType(O),name:O,events:Object.keys(v).filter(function(F){return!pi.includes(F)})}),n[O]=!0),S=S.concat(O),v}).catch(function(A){if(A instanceof Error)throw new Error(A);return g=g.concat(A.name),A})});Promise.all(k).then(function(v){var I={plugins:S,failed:g,disabled:$};setTimeout(function(){h.length===k.length+$.length&&a.dispatch(C({},{type:j.ready},I))},0)})}var b=function(){if(f!==j.bootstrap)return/^ready:([^:]*)$/.test(f)&&setTimeout(function(){return Tu(a,t,e)},0),Promise.resolve(function(v,I,O,_,A){try{var F=ee(I)?I():I,z=v.type,W=z.replace(jt,"");if(v._&&v._.called)return Promise.resolve(v);var L=O.getState(),D=(K=F,(V=L.plugins)===void 0&&(V={}),(it=v.options)===void 0&&(it={}),Object.keys(K).filter(function(p){var y=it.plugins||{};return Yw(y[p])?y[p]:y.all!==!1&&(!V[p]||V[p].enabled!==!1)}).map(function(p){return K[p]}));z===j.initializeStart&&v.fromEnable&&(D=Object.keys(L.plugins).filter(function(p){var y=L.plugins[p];return v.plugins.includes(p)&&!y.initialized}).map(function(p){return F[p]}));var H=D.map(function(p){return p.name}),R=function(p,y,E){var U=Cu(p).map(function(x){return Ru(x,y)});return y.reduce(function(x,w){var P=w.name,T=Cu(p,P).map(function(lr){return Ru(lr,y)}),M=T[0],N=T[1],re=T[2];return M.length&&(x.beforeNS[P]=M),N.length&&(x.duringNS[P]=N),re.length&&(x.afterNS[P]=re),x},{before:U[0],beforeNS:{},during:U[1],duringNS:{},after:U[2],afterNS:{}})}(z,D);return Promise.resolve(gi({action:v,data:{exact:R.before,namespaced:R.beforeNS},state:L,allPlugins:F,allMatches:R,instance:O,store:_,EVENTS:A})).then(function(p){function y(){var x=function(){if(z.match(jt))return Promise.resolve(gi({action:C({},E,{type:W+"End"}),data:{exact:R.after,namespaced:R.afterNS},state:L,allPlugins:F,allMatches:R,instance:O,store:_,EVENTS:A})).then(function(w){w.meta&&w.meta.hasCallback&&ku(w.meta.rid,{payload:w})})}();return x&&x.then?x.then(function(){return p}):p}if(ju(p,H.length))return p;var E,U=function(){if(z!==W)return Promise.resolve(gi({action:C({},p,{type:W}),data:{exact:R.during,namespaced:R.duringNS},state:L,allPlugins:F,allMatches:R,instance:O,store:_,EVENTS:A})).then(function(x){E=x});E=p}();return U&&U.then?U.then(y):y()})}catch(p){return Promise.reject(p)}var K,V,it}(o,t,e,a,r)).then(function(v){return c=1,i(v)})}();return Promise.resolve(b&&b.then?b.then(l):l(b))}catch(v){return Promise.reject(v)}}}}}function mb(e){return function(t){return function(r){return function(n){var a=n.type,i=n.key,o=n.value,c=n.options;if(a===j.setItem||a===j.removeItem){if(n.abort)return r(n);a===j.setItem?e.setItem(i,o,c):e.removeItem(i,c)}return r(n)}}}}var gb=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(t,r){e[r]=e[r].concat(t)},this.removeMiddleware=function(t,r){var n=e[r].findIndex(function(a){return a===t});n!==-1&&(e[r]=[].concat(e[r].slice(0,n),e[r].slice(n+1)))},this.dynamicMiddlewares=function(t){return function(r){return function(n){return function(a){var i={getState:r.getState,dispatch:function(c){return r.dispatch(c)}},o=e[t].map(function(c){return c(i)});return _t.apply(void 0,o)(n)(a)}}}}};function yb(e){return function(t,r){t===void 0&&(t={});var n={};if(r.type==="initialize:aborted")return t;if(/^registerPlugin:([^:]*)$/.test(r.type)){var a=Uu(r.type,"registerPlugin"),i=e()[a];if(!i||!a)return t;var o=r.enabled,c=i.config;return n[a]={enabled:o,initialized:!!o&&!i.initialize,loaded:!!o&&!!i.loaded({config:c}),config:c},C({},t,n)}if(/^initialize:([^:]*)$/.test(r.type)){var l=Uu(r.type,j.initialize),f=e()[l];return f&&l?(n[l]=C({},t[l],{initialized:!0,loaded:!!f.loaded({config:f.config})}),C({},t,n)):t}if(/^ready:([^:]*)$/.test(r.type))return n[r.name]=C({},t[r.name],{loaded:!0}),C({},t,n);switch(r.type){case j.disablePlugin:return C({},t,xu(r.plugins,!1,t));case j.enablePlugin:return C({},t,xu(r.plugins,!0,t));default:return t}}}function Uu(e,t){return e.substring(t.length+1,e.length)}function xu(e,t,r){return e.reduce(function(n,a){return n[a]=C({},r[a],{enabled:t}),n},r)}function Nu(e){try{return JSON.parse(JSON.stringify(e))}catch{}return e}var wb={last:{},history:[]};function bb(e,t){e===void 0&&(e=wb);var r=t.options,n=t.meta;if(t.type===j.track){var a=Nu(C({event:t.event,properties:t.properties},Object.keys(r).length&&{options:r},{meta:n}));return C({},e,{last:a,history:e.history.concat(a)})}return e}var Sb={actions:[]};function Ib(e,t){e===void 0&&(e=Sb);var r=t.payload;switch(t.type){case"queue":var n;return n=r&&r.type&&r.type===j.identify?[t].concat(e.actions):e.actions.concat(t),C({},e,{actions:n});case"dequeue":return[];default:return e}}var Du=/#.*$/;function $b(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(Du,""):"")}var Mu,Fu,zu,Hu,kb=function(e){if(e===void 0&&(e={}),!Z)return e;var t=document,r=t.title,n=t.referrer,a=window,i=a.location,o=a.innerWidth,c=a.innerHeight,l=i.hash,f=i.search,u=function(d){var h=function(){if(Z){for(var m,S=document.getElementsByTagName("link"),g=0;m=S[g];g++)if(m.getAttribute("rel")==="canonical")return m.getAttribute("href")}}();return h?h.match(/\?/)?h:h+d:window.location.href.replace(Du,"")}(f),s={title:r,url:u,path:$b(u),hash:l,search:f,width:o,height:c};return n&&n!==""&&(s.referrer=n),C({},s,e)},Pb={last:{},history:[]};function Tb(e,t){e===void 0&&(e=Pb);var r=t.options;if(t.type===j.page){var n=Nu(C({properties:t.properties,meta:t.meta},Object.keys(r).length&&{options:r}));return C({},e,{last:n,history:e.history.concat(n)})}return e}Mu=function(){if(!Z)return!1;var e=navigator.appVersion;return~e.indexOf("Win")?"Windows":~e.indexOf("Mac")?"MacOS":~e.indexOf("X11")?"UNIX":~e.indexOf("Linux")?"Linux":"Unknown OS"}(),Fu=Z?document.referrer:null,zu=rb(),Hu=nb();var Bu={initialized:!1,sessionId:qr(),app:null,version:null,debug:!1,offline:!!Z&&!navigator.onLine,os:{name:Mu},userAgent:Z?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.13"},timezone:Hu,locale:zu,campaign:{},referrer:Fu};function Eb(e,t){e===void 0&&(e=Bu);var r=e.initialized,n=t.campaign;switch(t.type){case j.campaign:return C({},e,{campaign:n});case j.offline:return C({},e,{offline:!0});case j.online:return C({},e,{offline:!1});default:return r?e:C({},Bu,e,{initialized:!0})}}var Ob=["plugins","reducers","storage"];function _b(e,t,r){if(Z){var n=window[(r?"add":"remove")+"EventListener"];e.split(" ").forEach(function(a){n(a,t)})}}function Rb(e){var t=_b.bind(null,"online offline",function(r){return Promise.resolve(!navigator.onLine).then(e)});return t(!0),function(r){return t(!1)}}function Ku(){return rt("analytics",[]),function(e){return function(t,r,n){var a=e(t,r,n),i=a.dispatch;return Object.assign(a,{dispatch:function(o){return Tt[Pt].analytics.push(o.action||o),i(o)}})}}}function Gu(e){return function(){return _t(_t.apply(null,arguments),Ku())}}function bi(e){return e?pu(e)?e:[e]:[]}function Wu(e,t,r){e===void 0&&(e={});var n,a,i=qr();return t&&(ar[i]=(n=t,a=function(o){for(var c,l=o||Array.prototype.slice.call(arguments),f=0;f<l.length;f++)if(ee(l[f])){c=l[f];break}return c}(r),function(o){a&&a(o),n(o)})),C({},e,{rid:i,ts:new Date().getTime()},t?{hasCallback:!0}:{})}function Cb(e){e===void 0&&(e={});var t=e.reducers||{},r=e.initialUser||{},n=(e.plugins||[]).reduce(function(p,y){if(ee(y))return p.middlewares=p.middlewares.concat(y),p;if(y.NAMESPACE&&(y.name=y.NAMESPACE),!y.name)throw new Error("https://lytics.dev/errors/1");y.config||(y.config={});var E=y.EVENTS?Object.keys(y.EVENTS).map(function(w){return y.EVENTS[w]}):[];p.pluginEnabled[y.name]=!(y.enabled===!1||y.config.enabled===!1),delete y.enabled,y.methods&&(p.methods[y.name]=Object.keys(y.methods).reduce(function(w,P){var T;return w[P]=(T=y.methods[P],function(){for(var M=Array.prototype.slice.call(arguments),N=new Array(T.length),re=0;re<M.length;re++)N[re]=M[re];return N[N.length]=I,T.apply({instance:I},N)}),w},{}),delete y.methods);var U=Object.keys(y).concat(E),x=new Set(p.events.concat(U));if(p.events=Array.from(x),p.pluginsArray=p.pluginsArray.concat(y),p.plugins[y.name])throw new Error(y.name+"AlreadyLoaded");return p.plugins[y.name]=y,p.plugins[y.name].loaded||(p.plugins[y.name].loaded=function(){return!0}),p},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),a=e.storage?e.storage:{getItem:tt,setItem:rt,removeItem:Et},i=function(p){return function(y,E,U){return E.getState("user")[y]||(U&&te(U)&&U[y]?U[y]:$u(p)[y]||tt(mi(y))||null)}}(a),o=n.plugins,c=n.events.filter(function(p){return!pi.includes(p)}).sort(),l=new Set(c.concat(tn).filter(function(p){return!pi.includes(p)})),f=Array.from(l).sort(),u=function(){return o},s=new gb,d=s.addMiddleware,h=s.removeMiddleware,m=s.dynamicMiddlewares,S=function(){throw new Error("Abort disabled inListener")},g=ab(),$=$u(a),k=C({},$,r,g.an_uid?{userId:g.an_uid}:{},g.an_aid?{anonymousId:g.an_aid}:{});k.anonymousId||(k.anonymousId=qr());var b=C({enable:function(p,y){return new Promise(function(E){R.dispatch({type:j.enablePlugin,plugins:bi(p),_:{originalAction:j.enablePlugin}},E,[y])})},disable:function(p,y){return new Promise(function(E){R.dispatch({type:j.disablePlugin,plugins:bi(p),_:{originalAction:j.disablePlugin}},E,[y])})}},n.methods),v=!1,I={identify:function(p,y,E,U){try{var x=Fe(p)?p:null,w=te(p)?p:y,P=E||{},T=I.user();rt(mi(Be),x);var M=x||w.userId||i(Be,I,w);return Promise.resolve(new Promise(function(N){R.dispatch(C({type:j.identifyStart,userId:M,traits:w||{},options:P,anonymousId:T.anonymousId},T.id&&T.id!==x&&{previousId:T.id}),N,[y,E,U])}))}catch(N){return Promise.reject(N)}},track:function(p,y,E,U){try{var x=te(p)?p.event:p;if(!x||!Fe(x))throw new Error("EventMissing");var w=te(p)?p:y||{},P=te(E)?E:{};return Promise.resolve(new Promise(function(T){R.dispatch({type:j.trackStart,event:x,properties:w,options:P,userId:i(Be,I,y),anonymousId:i(Ct,I,y)},T,[y,E,U])}))}catch(T){return Promise.reject(T)}},page:function(p,y,E){try{var U=te(p)?p:{},x=te(y)?y:{};return Promise.resolve(new Promise(function(w){R.dispatch({type:j.pageStart,properties:kb(U),options:x,userId:i(Be,I,U),anonymousId:i(Ct,I,U)},w,[p,y,E])}))}catch(w){return Promise.reject(w)}},user:function(p){if(p===Be||p==="id")return i(Be,I);if(p===Ct||p==="anonId")return i(Ct,I);var y=I.getState("user");return p?uu(y,p):y},reset:function(p){return new Promise(function(y){R.dispatch({type:j.resetStart},y,p)})},ready:function(p){return v&&p({plugins:b,instance:I}),I.on(j.ready,function(y){p(y),v=!0})},on:function(p,y){if(!p||!ee(y))return!1;if(p===j.bootstrap)throw new Error(".on disabled for "+p);var E=/Start$|Start:/;if(p==="*"){var U=function(T){return function(M){return function(N){return N.type.match(E)&&y({payload:N,instance:I,plugins:o}),M(N)}}},x=function(T){return function(M){return function(N){return N.type.match(E)||y({payload:N,instance:I,plugins:o}),M(N)}}};return d(U,rn),d(x,nn),function(){h(U,rn),h(x,nn)}}var w=p.match(E)?rn:nn,P=function(T){return function(M){return function(N){return N.type===p&&y({payload:N,instance:I,plugins:o,abort:S}),M(N)}}};return d(P,w),function(){return h(P,w)}},once:function(p,y){if(!p||!ee(y))return!1;if(p===j.bootstrap)throw new Error(".once disabled for "+p);var E=I.on(p,function(U){y({payload:U.payload,instance:I,plugins:o,abort:S}),E()});return E},getState:function(p){var y=R.getState();return p?uu(y,p):Object.assign({},y)},dispatch:function(p){var y=Fe(p)?{type:p}:p;if(tn.includes(y.type))throw new Error("reserved action "+y.type);var E=C({},y,{_:C({originalAction:y.type},p._||{})});R.dispatch(E)},enablePlugin:b.enable,disablePlugin:b.disable,plugins:b,storage:{getItem:a.getItem,setItem:function(p,y,E){R.dispatch({type:j.setItemStart,key:p,value:y,options:E})},removeItem:function(p,y){R.dispatch({type:j.removeItemStart,key:p,options:y})}},setAnonymousId:function(p,y){I.storage.setItem(He,p,y)},events:{core:tn,plugins:c}},O=n.middlewares.concat([function(p){return function(y){return function(E){return E.meta||(E.meta=Wu()),y(E)}}},m(rn),pb(I,u,{all:f,plugins:c}),mb(a),lb(I),db(I),m(nn)]),_={context:Eb,user:fb(a),page:Tb,track:bb,plugins:yb(u),queue:Ib},A=_t,F=_t;if(Z&&e.debug){var z=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;z&&(A=z({trace:!0,traceLimit:25})),F=function(){return arguments.length===0?Ku():te(typeof arguments[0])?Gu():Gu().apply(null,arguments)}}var W,L=function(p){return Object.keys(p).reduce(function(y,E){return Ob.includes(E)||(y[E]=p[E]),y},{})}(e),D=n.pluginsArray.reduce(function(p,y){var E=y.name,U=y.config,x=y.loaded,w=n.pluginEnabled[E];return p[E]={enabled:w,initialized:!!w&&!y.initialize,loaded:!!x({config:U}),config:U},p},{}),H={context:L,user:k,plugins:D},R=wu(function(p){for(var y=Object.keys(p),E={},U=0;U<y.length;U++){var x=y[U];typeof p[x]===ze&&(E[x]=p[x])}var w,P=Object.keys(E);try{(function(T){Object.keys(T).forEach(function(M){var N=T[M];if(typeof N(void 0,{type:"@@redux/INIT"})===Ce||typeof N(void 0,{type:sb})===Ce)throw new Error("reducer "+M+" "+Ce)})})(E)}catch(T){w=T}return function(T,M){if(T===void 0&&(T={}),w)throw w;for(var N=!1,re={},lr=0;lr<P.length;lr++){var fn=P[lr],Sl=T[fn],Ci=(0,E[fn])(Sl,M);if(typeof Ci===Ce){var bS=cb(fn,M);throw new Error(bS)}re[fn]=Ci,N=N||Ci!==Sl}return N?re:T}}(C({},_,t)),H,F(A(ub.apply(void 0,O))));R.dispatch=(W=R.dispatch,function(p,y,E){var U=C({},p,{meta:Wu(p.meta,y,bi(E))});return W.apply(null,[U])});var K=Object.keys(o);R.dispatch({type:j.bootstrap,plugins:K,config:L,params:g,user:k,initialUser:r,persistedUser:$});var V=K.filter(function(p){return n.pluginEnabled[p]}),it=K.filter(function(p){return!n.pluginEnabled[p]});return R.dispatch({type:j.registerPlugins,plugins:K,enabled:n.pluginEnabled}),n.pluginsArray.map(function(p,y){var E=p.bootstrap,U=p.config,x=p.name;E&&ee(E)&&E({instance:I,config:U,payload:p}),R.dispatch({type:j.registerPluginType(x),name:x,enabled:n.pluginEnabled[x],plugin:p}),n.pluginsArray.length===y+1&&R.dispatch({type:j.initializeStart,plugins:V,disabled:it})}),Rb(function(p){R.dispatch({type:p?j.offline:j.online})}),function(p,y,E){setInterval(function(){return Tu(p,y,E)},3e3)}(R,u,I),I}var rn="before",nn="after",or="cookie",at=Yu(),Vu=an,jb=an;function Zu(e){return at?an(e,"",-1):Et(e)}function Yu(){if(at!==void 0)return at;var e="cookiecookie";try{an(e,e),at=document.cookie.indexOf(e)!==-1,Zu(e)}catch{at=!1}return at}function an(e,t,r,n,a,i){if(typeof window<"u"){var o=arguments.length>1;return at===!1&&(o?rt(e,t):tt(e)),o?document.cookie=e+"="+encodeURIComponent(t)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString()+(n?"; path="+n:"")+(a?"; domain="+a:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var sr="localStorage",Ab=vi.bind(null,"localStorage");Ot("localStorage","getItem",tt),Ot("localStorage","setItem",rt),Ot("localStorage","removeItem",Et);var cr="sessionStorage",Lb=vi.bind(null,"sessionStorage");Ot("sessionStorage","getItem",tt),Ot("sessionStorage","setItem",rt),Ot("sessionStorage","removeItem",Et);function At(e){var t=e;try{if((t=JSON.parse(e))==="true")return!0;if(t==="false")return!1;if(te(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch{}if(t!==null&&t!=="")return t}var Ub=Ab(),xb=Lb(),Nb=Yu();function Ju(e,t){if(e){var r=Si(t),n=!Pi(r),a=Ii(r)?At(localStorage.getItem(e)):void 0;if(n&&!kt(a))return a;var i=$i(r)?At(Vu(e)):void 0;if(n&&i)return i;var o=ki(r)?At(sessionStorage.getItem(e)):void 0;if(n&&o)return o;var c=tt(e);return n?c:{localStorage:a,sessionStorage:o,cookie:i,global:c}}}function Db(e,t,r){if(e&&!kt(t)){var n={},a=Si(r),i=JSON.stringify(t),o=!Pi(a);return Ii(a)&&(n[sr]=sn(sr,t,At(localStorage.getItem(e))),localStorage.setItem(e,i),o)?n[sr]:$i(a)&&(n[or]=sn(or,t,At(Vu(e))),jb(e,i),o)?n[or]:ki(a)&&(n[cr]=sn(cr,t,At(sessionStorage.getItem(e))),sessionStorage.setItem(e,i),o)?n[cr]:(n[nr]=sn(nr,t,tt(e)),rt(e,t),o?n[nr]:n)}}function Mb(e,t){if(e){var r=Si(t),n=Ju(e,du),a={};return!kt(n.localStorage)&&Ii(r)&&(localStorage.removeItem(e),a[sr]=n.localStorage),!kt(n.cookie)&&$i(r)&&(Zu(e),a[or]=n.cookie),!kt(n.sessionStorage)&&ki(r)&&(sessionStorage.removeItem(e),a[cr]=n.sessionStorage),!kt(n.global)&&on(r,nr)&&(Et(e),a[nr]=n.global),a}}function Si(e){return e?Fe(e)?e:e.storage:fu}function Ii(e){return Ub&&on(e,sr)}function $i(e){return Nb&&on(e,or)}function ki(e){return xb&&on(e,cr)}function Pi(e){return e===du||e==="all"}function on(e,t){return e===fu||e===t||Pi(e)}function sn(e,t,r){return{location:e,current:t,previous:r}}var Fb={setItem:Db,getItem:Ju,removeItem:Mb};function zb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function qu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xu(Object(r),!0).forEach(function(n){zb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Hb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={storage:Fb};return Cb(qu(qu({},t),e))}function Bb(e,t){t=t||{};var r,n,a=[],i=t.max||1/0;function o(){clearInterval(r),e(a.splice(0,i)),c()}function c(){r=setInterval(o,t.interval||1e4)}return c(),{flush:o,push:function(l){return n=a.push(l),n>=i&&o(),n},size:function(){return a.length},end:function(l){l&&o(),clearInterval(r)}}}function Kb(e){if(typeof window>"u")return;const{addEventListener:t,history:r,location:n}=window;let a=n.pathname;t("popstate",()=>e(n.pathname)),["push","replace"].map(i=>{const o=`${i}State`;if(o!=="pushState"&&o!=="replaceState")return;const c=r[o];r[o]=function(...l){var s;const f=((s=l[2])==null?void 0:s.toString())||"",u=Wb(f);return a!==u&&(a=u,setTimeout(()=>e(f),0)),c.apply(r,l)}})}function Gb(e,t){const r=e.indexOf(t);return r>-1?e.slice(0,r):e}function Wb(e){return["#","?"].forEach(t=>e=Gb(e,t)),e}function Vb(){Kb(()=>{je.page()})}function Zb(e){if(e===void 0&&(e={}),!Z)return hi;var t=el(),r=Ti(),n=Qu(),a=cn(n,t),i=cn(r,t),o=[],c=[],l=[],f=n,u=a,s=i,d=Object.keys(e);if(!d.length)return hi;var h=d.map(function(S){return Number(S)}),m=ob(function(){var S=el(),g=function(L,D){return D.map(function(H){return H===100?L-5:L*(H/100)})}(S,h),$=Ti(),k=Qu(),b=cn(k,S),v=cn($,S);if(u=b>u?b:u,s=v<s?v:s,!(o.length>=h.length)){var I=f===k,O="up";I?O="initial":f<=k&&(O="down");var _=g,A=h;(O==="up"||I)&&(_=g.slice().reverse(),A=h.slice().reverse());var F=A.reduce(function(L,D,H){var R=_[H];return l.includes(D)&&k<=R&&(l=l.filter(function(K){return K!==D}),L.singleFunction=D),O==="down"&&!o.includes(D)&&k>=R&&D>i?(c.push(D),L.callbacks=L.callbacks.concat(D),L):O==="up"&&!o.includes(D)&&k<=R&&D<=b?(L.foundFunc=[D],L):(I&&k>=R&&L.foundFunc.length===0&&(L.foundFunc=[D]),!c.includes(D)&&k>=R&&(c.push(D),L.singleFunction?l.push(D):L.singleFunction=D),L)},{foundFunc:[],singleFunction:null,callbacks:[],direction:O});if(f=k,O==="down"&&F.callbacks&&F.callbacks.forEach(function(L){ee(e[L])&&(e[L]({trigger:L,direction:O,scrollMin:s,scrollMax:u,range:[s,u]}),o.push(L))}),F.singleFunction){var z=F.singleFunction,W=F.direction;ee(e[z])&&e[z]({trigger:z,direction:W,scrollMin:s,scrollMax:u,range:[s,u]}),o.push(z)}}},500);return window.addEventListener("scroll",m),function(){return window.removeEventListener("scroll",m)}}function Ti(){return Z?document.body.scrollTop||document.documentElement.scrollTop:0}function Yb(){return Z?window.innerHeight||document.documentElement.clientHeight:0}function Qu(){return Math.round(Ti()+Yb())}function el(){if(!Z)return 0;var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}function cn(e,t){return Math.round(e/t*100)}var tl="EventListener";function Jb(e){return function(t,r,n,a){var i=n||hi,o=a||!1;if(!Z)return i;var c=un(r),l=un(t,!0);if(!l.length)throw new Error("noElements");if(!c.length)throw new Error("noEvent");var f=[];return function u(s){s&&(f=[]);for(var d=s?"add"+tl:"remove"+tl,h=0;h<l.length;h++){var m=l[h];f[h]=s?o&&o.once?Xb(i):i:f[h]||i;for(var S=0;S<c.length;S++)m[d]?m["on"+c[S]]=s?f[h]:null:m[d](c[S],f[h],o)}return u.bind(null,!s)}(e)}}function un(e,t){if(Fe(e))return t?un(document.querySelectorAll(e)):(r=e).split(r.indexOf(",")>-1?",":" ").map(function(o){return o.trim()});var r;if(NodeList.prototype.isPrototypeOf(e)){for(var n=[],a=e.length>>>0;a--;)n[a]=e[a];return n}var i=tb(e);return t?i.map(function(o){return Fe(o)?un(o,!0):o}).flat():i}function Xb(e,t){var r;return function(){return e&&(r=e.apply(this,arguments),e=null),r}}var Ei=Jb("Event");function rl(e,t){return Z&&ee(window[e])?(r=window[e],n=t,(a=window)===void 0&&(a=null),ee(r)?function(){r.apply(a,arguments),n.apply(a,arguments)}:n):window[e]=t;var r,n,a}rl.bind(null,"onerror"),rl.bind(null,"onload");var nl=typeof window>"u",al="hidden";function qb(e){if(nl)return!1;var t=Qb(),r="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),n=function(){return e(!!document[t])},a=function(){return document.addEventListener(r,n)};return a(),function(){return document.removeEventListener(r,n),a}}function Qb(){var e=["webkit","moz","ms","o"];return nl||al in document?al:e.reduce(function(t,r){var n=r+"Hidden";return!t&&n in document?n:t},null)}var eS=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function tS(e,t){t===void 0&&(t={});var r=function(o,c){var l=this,f=!1;return function(u){f||(o.call(l,u),f=!0,setTimeout(function(){return f=!1},c))}}(e,t.throttle||1e4),n=[];function a(){var o=qb(function(c){c||r({type:"tabVisible"})});return n=[o].concat(eS.map(function(c){return Ei(document,c,r)})).concat(Ei(window,"load",r)).concat(Ei(window,"scroll",r,{capture:!0,passive:!0})),i}function i(){n.map(function(o){return o()})}return a(),function(){return i(),a}}function rS(e){var t,r,n=e.onIdle,a=e.onWakeUp,i=e.onHeartbeat,o=e.timeout,c=o===void 0?1e4:o,l=e.throttle,f=l===void 0?2e3:l,u=!1,s=!1,d=new Date,h=function(){return clearTimeout(t)};function m(g){h(),i&&!u&&i(ur(d),g),a&&u&&(u=!1,a(ur(r),g),d=new Date),t=setTimeout(function(){u=!0,n&&(r=new Date,n(ur(d),g))},c)}var S=tS(m,{throttle:f});return{disable:function(){s=!0,u=!1,h();var g=S();return function(){return s=!1,d=new Date,m({type:"load"}),g()}},getStatus:function(){return{isIdle:u,isDisabled:s,active:u?0:ur(d,s),idle:u?ur(r,s):0}}}}function ur(e,t){return t?0:Math.round((new Date-e)/1e3)}const il=5e3;class nS{constructor(t){he(this,"element");he(this,"isInViewport",!1);he(this,"isAwake",!1);he(this,"isFlushing");he(this,"observer");he(this,"lastEventAt",Date.now());he(this,"registeredView",!1);he(this,"viewCallback");he(this,"activeDurationCallback");he(this,"idleDurationCallback");he(this,"scrollCallback");this.element=t.element,this.viewCallback=t.viewCallback,this.activeDurationCallback=t.activeDurationCallback,this.idleDurationCallback=t.idleDurationCallback,this.scrollCallback=t.scrollCallback,this.observer=new IntersectionObserver(r=>{r.forEach(n=>{this.handleInViewPort(n.isIntersecting)})},{threshold:0}),this.observer.observe(this.element),rS({onIdle:r=>this.handleAwake(!1,r),onWakeUp:r=>this.handleAwake(!0,r),timeout:il}),Zb({25:this.handleScroll.bind(this),50:this.handleScroll.bind(this),75:this.handleScroll.bind(this),90:this.handleScroll.bind(this),100:this.handleScroll.bind(this)})}flush(){this.isFlushing=!0,this.handleAwake(!this.isAwake)}handleInViewPort(t){t?(this.isAwake=!0,this.trackInViewport()):this.handleAwake(!1),this.isInViewport=t}handleAwake(t,r=Math.round((Date.now()-this.lastEventAt)/1e3)){this.isAwake=t,this.lastEventAt=t?Date.now()-r*il:Date.now(),this.isInViewport&&this.trackAwake(t,r)}handleScroll(t){this.scrollCallback&&this.scrollCallback(t)}handleVisibilityChange(){this.isAwake=!1;const t=Math.round((Date.now()-this.lastEventAt)/1e3);t>1&&(this.lastEventAt=Date.now(),this.trackAwake(!1,t))}trackAwake(t,r){!t&&this.activeDurationCallback&&this.activeDurationCallback(r,this.isFlushing,this.lastEventAt),t&&this.idleDurationCallback&&this.idleDurationCallback(r,this.isFlushing,this.lastEventAt)}trackInViewport(){this.registeredView||(this.registeredView=!0,this.viewCallback&&this.viewCallback())}}const ol="sesamy_session_id";function aS(){let e=sessionStorage.getItem(ol);return e||(e=Math.random().toString(36).slice(2,9),sessionStorage.setItem(ol,e)),e}let sl=!1,Oi,cl,ln;function iS({clientId:e,enabled:t=!0,environment:r}){if(Oi=e,cl=t,ln=`${Me("logs",r)}/events`,!cl)return;Vb();const n=new nS({element:document.body,viewCallback:()=>{je.page()},activeDurationCallback:(a,i,o)=>{je.track("activeDuration",{duration:a,durationStart:o,flushing:i})},idleDurationCallback:(a,i,o)=>{je.track("idleDuration",{duration:a,durationStart:o,flushing:i})},scrollCallback:a=>{je.track("scroll",{scroll:a.scrollMax})}});cS(document.body,()=>{n.flush()}),uS(document.body,()=>{n.handleVisibilityChange()}),window.addEventListener(ye.AUTHENTICATED,async a=>{const i=a;await je.identify(i.detail.sub)}),window.addEventListener(ye.LOGOUT,async()=>{await je.track("logout",{}),_i.flush(),await je.reset()})}function ul(e){return JSON.stringify(e.map(t=>({...t,clientId:Oi,requestId:Math.random().toString(36).slice(2,9),sessionId:aS(),timestamp:new Date().toISOString(),version:di,event:t.event,context:{page:{url:window.location.hostname,path:window.location.pathname,title:document.title,search:window.location.search,referrer:document.referrer},locale:navigator.language,library:cu,userAgent:navigator.userAgent,clientId:Oi}})))}const _i=Bb(async e=>{if(e.length>0){const t=ul(e);sl?navigator.sendBeacon(ln,t):(await fetch(ln,{method:"POST",body:t,headers:{"Content-Type":"text/plain"}})).ok}},{max:10,interval:3e3});function Ri(e){var t;if(e.anonymousId)if((t=e.properties)!=null&&t.flushing){const r={...e};delete r.properties.flushing,navigator.sendBeacon(ln,ul([r]))}else _i.push(e)}const je=Hb({app:cu,version:di,plugins:[{name:"custom-analytics-plugin",page:({payload:e})=>{const{properties:t,anonymousId:r,userId:n,event:a}=e;Ri({anonymousId:r,userId:n,properties:t,event:a,type:"page"})},track:({payload:e})=>{const{properties:t,anonymousId:r,userId:n,event:a}=e;Ri({anonymousId:r,userId:n,properties:t,event:a,type:"track"})},identify:({payload:e})=>{const{properties:t,anonymousId:r,userId:n}=e;Ri({anonymousId:r,userId:n,properties:t,type:"identify"})}}]});function oS(e,t){je.track(e,t)}function sS(){return sl=!0,_i.flush()}const ll=new Map;function cS(e,t){ll.set(e,t)}window.addEventListener("beforeunload",()=>{ll.forEach((e,t)=>{e.bind(t)()}),sS()});const fl=new Map;function uS(e,t){fl.set(e,t)}window.addEventListener("visibilitychange",()=>{document.visibilityState!=="visible"&&fl.forEach((e,t)=>{e.bind(t)()})});const dl="sesamySignedURLs";function hl(){const e=sessionStorage.getItem(dl);return e?JSON.parse(e):[]}function lS(e){const t=hl();t.push(e),sessionStorage.setItem(dl,JSON.stringify(t))}function fS(e){const{createCheckout:t,getCheckout:r,updateCheckout:n,getEntitlement:a,getEntitlements:i,getEntitlementAccess:o,getSubscriptions:c,getContract:l,getContracts:f,getBill:u,getBills:s,getProfile:d,updateProfile:h,getTags:m,deleteTag:S,setTag:g,getUserMetadata:$,listUserMetadata:k,setUserMetadata:b,deleteUserMetadata:v,getTally:I,getTallies:O,pushTally:_,deleteTally:A,getProduct:F,getPaymentIssues:z,isSpotifyLinked:W,unlinkSpotify:L,linkSpotify:D,autoOnboardProduct:H,openHostedAccountPage:R,generateLink:K}=Gw(e),V={auth:{getUser:d,isAuthenticated:li,loginWithRedirect:fi,logout:Xc,setToken:Qc},checkouts:{get:r,create:t,update:n},profile:{get:d,update:h,openHostedAccountPage:R,isSpotifyLinked:W,unlinkSpotify:L},analytics:{track:oS},tags:{list:m,set:g,delete:S},entitlements:{get:a,list:i,access:o,signedLinks:hl},contracts:{get:l,list:f},bills:{get:u,list:s},userMetadata:{get:$,list:k,set:b,delete:v},tallies:{get:I,list:O,push:_,delete:A},subscriptions:{list:c},products:{get:F,autoOnboard:H,linkSpotify:D},getVersion:dS,getPaymentIssues:z,generateLink:K,clearCache:we};return e.namespace&&(window[e.namespace]=V),V}function dS(){return di}async function hS({enabled:e=!1,rules:t}){if(!e)return;const r=await li(),n=window.location.href;for(const a of t){const i=document.querySelectorAll(a.selector);if(!(a.path&&!new RegExp(a.path).test(n))){for(const o of i)if(!(a.authenticated!==void 0&&a.authenticated!==r))switch(a.transform){case"insert":if(a.contentType==="selector"&&a.content){const c=document.querySelector(a.content);c?o.innerHTML+=c.innerHTML:console.warn(`Source element for selector '${a.content}' not found`)}else if(a.contentType==="url"&&a.content){const c=await vl(a.content);c?o.innerHTML+=c:console.warn(`Failed to fetch content from URL '${a.content}'`)}else a.content&&(o.innerHTML+=a.content);break;case"replace":if(a.contentType==="selector"&&a.content){const c=document.querySelector(a.content);c?o.innerHTML=c.innerHTML:console.warn(`Source element for selector '${a.content}' not found`)}else if(a.contentType==="url"&&a.content){const c=await vl(a.content);c?o.innerHTML=c:console.warn(`Failed to fetch content from URL '${a.content}'`)}else a.content&&(o.innerHTML=a.content);break;case"remove":o.remove();break;default:console.warn(`Unknown transform type: ${a.transform}`)}}}}async function vl(e){try{const t=await fetch(e);return t.ok?await t.text():(console.error(`Failed to fetch content from ${e}: ${t.statusText}`),null)}catch(t){return console.error(`Error fetching content from ${e}:`,t),null}}function vS(){const e=new URLSearchParams(window.location.hash.substring(1)),t=e.get("access_token");if(t){Qc(t);const r=new URL(window.location.href);e.delete("access_token"),r.hash=e.toString(),window.history.replaceState(null,"",r)}}const pl="sesamy-refresh",ml="force-refetch-entitlements";function pS(){const e=new URLSearchParams(window.location.search),t=e.get(ml),r=e.get(pl);if(t!==null||r!==null){const n=new URL(window.location.href);e.delete(ml),e.delete(pl),n.search=e.toString(),we(),window.history.replaceState(null,"",n)}}function mS(){const e=new URLSearchParams(window.location.search),t=e.get("token"),r=e.get("se");if(!r||!t)return;const n=parseInt(r,10);if(Number.isNaN(n)||n<Date.now())return;lS({url:window.location.href.split("?")[0],token:t,expiresAt:n,publisherContentId:e.get("sp")??void 0});const a=new URL(window.location.href);a.searchParams.delete("ss"),a.searchParams.delete("se"),a.searchParams.delete("sp"),a.searchParams.delete("so"),a.searchParams.delete("token"),window.history.replaceState(null,"",a)}const gl="sesamy-user";async function gS(){const t=new URLSearchParams(window.location.search).get(gl);if(!t)return;const r=await jw();(r==null?void 0:r.email)!==t&&(we(),fi({authorizationParams:{email_hint:t,login_hint:t}}));const n=new URL(window.location.href);n.searchParams.delete(gl),window.history.replaceState(null,"",n)}const yl="sesamy-purchase";function yS(){const e=new URLSearchParams(window.location.search),t=e.get(yl);if(t!==null){const r=new URL(window.location.href);e.delete(yl),r.search=e.toString(),De(ye.PURCHASE,{itemSrc:t}),we(),window.history.replaceState(null,"",r)}}const wl="sesamy-login";async function wS(){if(!new URLSearchParams(window.location.search).get(wl))return;await li()||fi();const n=new URL(window.location.href);n.searchParams.delete(wl),window.history.replaceState(null,"",n)}async function bl(e){iS({clientId:e.clientId,environment:e.environment,...e.analytics}),await Cw({clientId:e.clientId,organization:e.organization,environment:e.environment,...e.auth}),e.transform&&await hS(e.transform);const t=fS({clientId:e.clientId,environment:e.environment,...e.api});return De(ye.READY,{}),vS(),pS(),mS(),await wS(),await gS(),yS(),t}if(typeof document<"u"){const e=document.getElementById("sesamy-js");if(e!=null&&e.textContent)try{const t=JSON.parse(e.textContent);bl(t)}catch(t){console.error("Failed to parse config",t)}}return Te.init=bl,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"}),Te}({});
|