@sesamy/sesamy-js 1.18.2 → 1.19.0
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 +4 -1
- package/dist/sesamy-js.cjs +5 -5
- package/dist/sesamy-js.iife.js +5 -5
- package/dist/sesamy-js.mjs +842 -834
- package/package.json +2 -2
package/dist/sesamy-js.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Ol=Object.defineProperty;var _l=(e,t,r)=>t in e?Ol(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ie=(e,t,r)=>_l(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("core-js/actual/fetch");var lr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},re=function(e){try{return!!e()}catch{return!0}},Rl=re,za=!Rl(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),uc=za,lc=Function.prototype,fa=lc.call,Cl=uc&&lc.bind.bind(fa,fa),K=uc?Cl:function(e){return function(){return fa.apply(e,arguments)}},fc=K,jl=fc({}.toString),Al=fc("".slice),Ha=function(e){return Al(jl(e),8,-1)},Ll=K,Ul=re,xl=Ha,dn=Object,Nl=Ll("".split),dc=Ul(function(){return!dn("z").propertyIsEnumerable(0)})?function(e){return xl(e)==="String"?Nl(e,""):dn(e)}:dn,Ba=function(e){return e==null},Dl=Ba,Ml=TypeError,Yr=function(e){if(Dl(e))throw new Ml("Can't call method on "+e);return e},Fl=dc,zl=Yr,rr=function(e){return Fl(zl(e))},At=function(e){return e&&e.Math===Math&&e},q=At(typeof globalThis=="object"&&globalThis)||At(typeof window=="object"&&window)||At(typeof self=="object"&&self)||At(typeof lr=="object"&&lr)||At(typeof lr=="object"&&lr)||function(){return this}()||Function("return this")(),hc={exports:{}},Hl=!1,Li=q,Bl=Object.defineProperty,Ka=function(e,t){try{Bl(Li,e,{value:t,configurable:!0,writable:!0})}catch{Li[e]=t}return t},Kl=q,Gl=Ka,Ui="__core-js_shared__",xi=hc.exports=Kl[Ui]||Gl(Ui,{});(xi.versions||(xi.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 Ga=hc.exports,Ni=Ga,vc=function(e,t){return Ni[e]||(Ni[e]=t||{})},Wl=Yr,Vl=Object,Jr=function(e){return Vl(Wl(e))},Zl=K,Yl=Jr,Jl=Zl({}.hasOwnProperty),ye=Object.hasOwn||function(t,r){return Jl(Yl(t),r)},Xl=K,ql=0,Ql=Math.random(),ef=Xl(1 .toString),pc=function(e){return"Symbol("+(e===void 0?"":e)+")_"+ef(++ql+Ql,36)},tf=typeof navigator<"u"&&String(navigator.userAgent)||"",mc=q,hn=tf,Di=mc.process,Mi=mc.Deno,Fi=Di&&Di.versions||Mi&&Mi.version,zi=Fi&&Fi.v8,pe,Nr;zi&&(pe=zi.split("."),Nr=pe[0]>0&&pe[0]<4?1:+(pe[0]+pe[1]));!Nr&&hn&&(pe=hn.match(/Edge\/(\d+)/),(!pe||pe[1]>=74)&&(pe=hn.match(/Chrome\/(\d+)/),pe&&(Nr=+pe[1])));var rf=Nr,Hi=rf,nf=re,af=q,of=af.String,gc=!!Object.getOwnPropertySymbols&&!nf(function(){var e=Symbol("symbol detection");return!of(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Hi&&Hi<41}),sf=gc,yc=sf&&!Symbol.sham&&typeof Symbol.iterator=="symbol",cf=q,uf=vc,Bi=ye,lf=pc,ff=gc,df=yc,dt=cf.Symbol,vn=uf("wks"),hf=df?dt.for||dt:dt&&dt.withoutSetter||lf,fe=function(e){return Bi(vn,e)||(vn[e]=ff&&Bi(dt,e)?dt[e]:hf("Symbol."+e)),vn[e]},pn=typeof document=="object"&&document.all,Z=typeof pn>"u"&&pn!==void 0?function(e){return typeof e=="function"||e===pn}:function(e){return typeof e=="function"},vf=Z,Re=function(e){return typeof e=="object"?e!==null:vf(e)},pf=Re,mf=String,gf=TypeError,Me=function(e){if(pf(e))return e;throw new gf(mf(e)+" is not an object")},wc={},yf=re,Y=!yf(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),wf=Y,bf=re,bc=wf&&bf(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),$e={},Sf=q,Ki=Re,da=Sf.document,If=Ki(da)&&Ki(da.createElement),Wa=function(e){return If?da.createElement(e):{}},$f=Y,kf=re,Pf=Wa,Sc=!$f&&!kf(function(){return Object.defineProperty(Pf("div"),"a",{get:function(){return 7}}).a!==7}),Tf=za,fr=Function.prototype.call,ke=Tf?fr.bind(fr):function(){return fr.apply(fr,arguments)},mn=q,Ef=Z,Of=function(e){return Ef(e)?e:void 0},Tt=function(e,t){return arguments.length<2?Of(mn[e]):mn[e]&&mn[e][t]},_f=K,Ic=_f({}.isPrototypeOf),Rf=Tt,Cf=Z,jf=Ic,Af=yc,Lf=Object,$c=Af?function(e){return typeof e=="symbol"}:function(e){var t=Rf("Symbol");return Cf(t)&&jf(t.prototype,Lf(e))},Uf=String,kc=function(e){try{return Uf(e)}catch{return"Object"}},xf=Z,Nf=kc,Df=TypeError,Xr=function(e){if(xf(e))return e;throw new Df(Nf(e)+" is not a function")},Mf=Xr,Ff=Ba,Va=function(e,t){var r=e[t];return Ff(r)?void 0:Mf(r)},gn=ke,yn=Z,wn=Re,zf=TypeError,Hf=function(e,t){var r,n;if(t==="string"&&yn(r=e.toString)&&!wn(n=gn(r,e))||yn(r=e.valueOf)&&!wn(n=gn(r,e))||t!=="string"&&yn(r=e.toString)&&!wn(n=gn(r,e)))return n;throw new zf("Can't convert object to primitive value")},Bf=ke,Gi=Re,Wi=$c,Kf=Va,Gf=Hf,Wf=fe,Vf=TypeError,Zf=Wf("toPrimitive"),Yf=function(e,t){if(!Gi(e)||Wi(e))return e;var r=Kf(e,Zf),n;if(r){if(t===void 0&&(t="default"),n=Bf(r,e,t),!Gi(n)||Wi(n))return n;throw new Vf("Can't convert object to primitive value")}return t===void 0&&(t="number"),Gf(e,t)},Jf=Yf,Xf=$c,Pc=function(e){var t=Jf(e,"string");return Xf(t)?t:t+""},qf=Y,Qf=Sc,ed=bc,dr=Me,Vi=Pc,td=TypeError,bn=Object.defineProperty,rd=Object.getOwnPropertyDescriptor,Sn="enumerable",In="configurable",$n="writable";$e.f=qf?ed?function(t,r,n){if(dr(t),r=Vi(r),dr(n),typeof t=="function"&&r==="prototype"&&"value"in n&&$n in n&&!n[$n]){var a=rd(t,r);a&&a[$n]&&(t[r]=n.value,n={configurable:In in n?n[In]:a[In],enumerable:Sn in n?n[Sn]:a[Sn],writable:!1})}return bn(t,r,n)}:bn:function(t,r,n){if(dr(t),r=Vi(r),dr(n),Qf)try{return bn(t,r,n)}catch{}if("get"in n||"set"in n)throw new td("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var nd=Math.ceil,ad=Math.floor,id=Math.trunc||function(t){var r=+t;return(r>0?ad:nd)(r)},od=id,Za=function(e){var t=+e;return t!==t||t===0?0:od(t)},sd=Za,cd=Math.max,ud=Math.min,ld=function(e,t){var r=sd(e);return r<0?cd(r+t,0):ud(r,t)},fd=Za,dd=Math.min,hd=function(e){var t=fd(e);return t>0?dd(t,9007199254740991):0},vd=hd,Tc=function(e){return vd(e.length)},pd=rr,md=ld,gd=Tc,Zi=function(e){return function(t,r,n){var a=pd(t),i=gd(a);if(i===0)return!e&&-1;var o=md(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}},yd={includes:Zi(!0),indexOf:Zi(!1)},Ya={},wd=K,kn=ye,bd=rr,Sd=yd.indexOf,Id=Ya,Yi=wd([].push),Ec=function(e,t){var r=bd(e),n=0,a=[],i;for(i in r)!kn(Id,i)&&kn(r,i)&&Yi(a,i);for(;t.length>n;)kn(r,i=t[n++])&&(~Sd(a,i)||Yi(a,i));return a},Ja=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$d=Ec,kd=Ja,Oc=Object.keys||function(t){return $d(t,kd)},Pd=Y,Td=bc,Ed=$e,Od=Me,_d=rr,Rd=Oc;wc.f=Pd&&!Td?Object.defineProperties:function(t,r){Od(t);for(var n=_d(r),a=Rd(r),i=a.length,o=0,c;i>o;)Ed.f(t,c=a[o++],n[c]);return t};var Cd=Tt,jd=Cd("document","documentElement"),Ad=vc,Ld=pc,Ji=Ad("keys"),Xa=function(e){return Ji[e]||(Ji[e]=Ld(e))},Ud=Me,xd=wc,Xi=Ja,Nd=Ya,Dd=jd,Md=Wa,Fd=Xa,qi=">",Qi="<",ha="prototype",va="script",_c=Fd("IE_PROTO"),Pn=function(){},Rc=function(e){return Qi+va+qi+e+Qi+"/"+va+qi},eo=function(e){e.write(Rc("")),e.close();var t=e.parentWindow.Object;return e=null,t},zd=function(){var e=Md("iframe"),t="java"+va+":",r;return e.style.display="none",Dd.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(Rc("document.F=Object")),r.close(),r.F},hr,Cr=function(){try{hr=new ActiveXObject("htmlfile")}catch{}Cr=typeof document<"u"?document.domain&&hr?eo(hr):zd():eo(hr);for(var e=Xi.length;e--;)delete Cr[ha][Xi[e]];return Cr()};Nd[_c]=!0;var qa=Object.create||function(t,r){var n;return t!==null?(Pn[ha]=Ud(t),n=new Pn,Pn[ha]=null,n[_c]=t):n=Cr(),r===void 0?n:xd.f(n,r)},Hd=fe,Bd=qa,Kd=$e.f,pa=Hd("unscopables"),ma=Array.prototype;ma[pa]===void 0&&Kd(ma,pa,{configurable:!0,value:Bd(null)});var Gd=function(e){ma[pa][e]=!0},nr={},Wd=q,Vd=Z,to=Wd.WeakMap,Zd=Vd(to)&&/native code/.test(String(to)),ar=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},Yd=Y,Jd=$e,Xd=ar,qr=Yd?function(e,t,r){return Jd.f(e,t,Xd(1,r))}:function(e,t,r){return e[t]=r,e},qd=Zd,Cc=q,Qd=Re,eh=qr,Tn=ye,En=Ga,th=Xa,rh=Ya,ro="Object already initialized",ga=Cc.TypeError,nh=Cc.WeakMap,Dr,er,Mr,ah=function(e){return Mr(e)?er(e):Dr(e,{})},ih=function(e){return function(t){var r;if(!Qd(t)||(r=er(t)).type!==e)throw new ga("Incompatible receiver, "+e+" required");return r}};if(qd||En.state){var we=En.state||(En.state=new nh);we.get=we.get,we.has=we.has,we.set=we.set,Dr=function(e,t){if(we.has(e))throw new ga(ro);return t.facade=e,we.set(e,t),t},er=function(e){return we.get(e)||{}},Mr=function(e){return we.has(e)}}else{var at=th("state");rh[at]=!0,Dr=function(e,t){if(Tn(e,at))throw new ga(ro);return t.facade=e,eh(e,at,t),t},er=function(e){return Tn(e,at)?e[at]:{}},Mr=function(e){return Tn(e,at)}}var ir={set:Dr,get:er,has:Mr,enforce:ah,getterFor:ih},Qa={},ei={},jc={}.propertyIsEnumerable,Ac=Object.getOwnPropertyDescriptor,oh=Ac&&!jc.call({1:2},1);ei.f=oh?function(t){var r=Ac(this,t);return!!r&&r.enumerable}:jc;var sh=Y,ch=ke,uh=ei,lh=ar,fh=rr,dh=Pc,hh=ye,vh=Sc,no=Object.getOwnPropertyDescriptor;Qa.f=sh?no:function(t,r){if(t=fh(t),r=dh(r),vh)try{return no(t,r)}catch{}if(hh(t,r))return lh(!ch(uh.f,t,r),t[r])};var Lc={exports:{}},ya=Y,ph=ye,Uc=Function.prototype,mh=ya&&Object.getOwnPropertyDescriptor,ti=ph(Uc,"name"),gh=ti&&(function(){}).name==="something",yh=ti&&(!ya||ya&&mh(Uc,"name").configurable),xc={EXISTS:ti,PROPER:gh,CONFIGURABLE:yh},wh=K,bh=Z,wa=Ga,Sh=wh(Function.toString);bh(wa.inspectSource)||(wa.inspectSource=function(e){return Sh(e)});var Nc=wa.inspectSource,ri=K,Ih=re,$h=Z,vr=ye,ba=Y,kh=xc.CONFIGURABLE,Ph=Nc,Dc=ir,Th=Dc.enforce,Eh=Dc.get,ao=String,jr=Object.defineProperty,Oh=ri("".slice),_h=ri("".replace),Rh=ri([].join),Ch=ba&&!Ih(function(){return jr(function(){},"length",{value:8}).length!==8}),jh=String(String).split("String"),Ah=Lc.exports=function(e,t,r){Oh(ao(t),0,7)==="Symbol("&&(t="["+_h(ao(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!vr(e,"name")||kh&&e.name!==t)&&(ba?jr(e,"name",{value:t,configurable:!0}):e.name=t),Ch&&r&&vr(r,"arity")&&e.length!==r.arity&&jr(e,"length",{value:r.arity});try{r&&vr(r,"constructor")&&r.constructor?ba&&jr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=Th(e);return vr(n,"source")||(n.source=Rh(jh,typeof t=="string"?t:"")),e};Function.prototype.toString=Ah(function(){return $h(this)&&Eh(this).source||Ph(this)},"toString");var Mc=Lc.exports,Lh=Z,Uh=$e,xh=Mc,Nh=Ka,Fe=function(e,t,r,n){n||(n={});var a=n.enumerable,i=n.name!==void 0?n.name:t;if(Lh(r)&&xh(r,i,n),n.global)a?e[t]=r:Nh(t,r);else{try{n.unsafe?e[t]&&(a=!0):delete e[t]}catch{}a?e[t]=r:Uh.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Fc={},Dh=Ec,Mh=Ja,Fh=Mh.concat("length","prototype");Fc.f=Object.getOwnPropertyNames||function(t){return Dh(t,Fh)};var ni={};ni.f=Object.getOwnPropertySymbols;var zh=Tt,Hh=K,Bh=Fc,Kh=ni,Gh=Me,Wh=Hh([].concat),Vh=zh("Reflect","ownKeys")||function(t){var r=Bh.f(Gh(t)),n=Kh.f;return n?Wh(r,n(t)):r},io=ye,Zh=Vh,Yh=Qa,Jh=$e,Xh=function(e,t,r){for(var n=Zh(t),a=Jh.f,i=Yh.f,o=0;o<n.length;o++){var c=n[o];!io(e,c)&&!(r&&io(r,c))&&a(e,c,i(t,c))}},qh=re,Qh=Z,ev=/#|\.prototype\./,or=function(e,t){var r=rv[tv(e)];return r===av?!0:r===nv?!1:Qh(t)?qh(t):!!t},tv=or.normalize=function(e){return String(e).replace(ev,".").toLowerCase()},rv=or.data={},nv=or.NATIVE="N",av=or.POLYFILL="P",iv=or,pr=q,ov=Qa.f,sv=qr,cv=Fe,uv=Ka,lv=Xh,fv=iv,Et=function(e,t){var r=e.target,n=e.global,a=e.stat,i,o,c,l,f,u;if(n?o=pr:a?o=pr[r]||uv(r,{}):o=pr[r]&&pr[r].prototype,o)for(c in t){if(f=t[c],e.dontCallGetSet?(u=ov(o,c),l=u&&u.value):l=o[c],i=fv(n?c:r+(a?".":"#")+c,e.forced),!i&&l!==void 0){if(typeof f==typeof l)continue;lv(f,l)}(e.sham||l&&l.sham)&&sv(f,"sham",!0),cv(o,c,f,e)}},dv=re,hv=!dv(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),vv=ye,pv=Z,mv=Jr,gv=Xa,yv=hv,oo=gv("IE_PROTO"),Sa=Object,wv=Sa.prototype,zc=yv?Sa.getPrototypeOf:function(e){var t=mv(e);if(vv(t,oo))return t[oo];var r=t.constructor;return pv(r)&&t instanceof r?r.prototype:t instanceof Sa?wv:null},bv=re,Sv=Z,Iv=Re,so=zc,$v=Fe,kv=fe,Ia=kv("iterator"),Hc=!1,Qe,On,_n;[].keys&&(_n=[].keys(),"next"in _n?(On=so(so(_n)),On!==Object.prototype&&(Qe=On)):Hc=!0);var Pv=!Iv(Qe)||bv(function(){var e={};return Qe[Ia].call(e)!==e});Pv&&(Qe={});Sv(Qe[Ia])||$v(Qe,Ia,function(){return this});var Bc={IteratorPrototype:Qe,BUGGY_SAFARI_ITERATORS:Hc},Tv=$e.f,Ev=ye,Ov=fe,co=Ov("toStringTag"),sr=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Ev(e,co)&&Tv(e,co,{configurable:!0,value:t})},_v=Bc.IteratorPrototype,Rv=qa,Cv=ar,jv=sr,Av=nr,Lv=function(){return this},Kc=function(e,t,r,n){var a=t+" Iterator";return e.prototype=Rv(_v,{next:Cv(+!n,r)}),jv(e,a,!1),Av[a]=Lv,e},Uv=K,xv=Xr,Nv=function(e,t,r){try{return Uv(xv(Object.getOwnPropertyDescriptor(e,t)[r]))}catch{}},Dv=Re,Mv=function(e){return Dv(e)||e===null},Fv=Mv,zv=String,Hv=TypeError,Bv=function(e){if(Fv(e))return e;throw new Hv("Can't set "+zv(e)+" as a prototype")},Kv=Nv,Gv=Re,Wv=Yr,Vv=Bv,Zv=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=Kv(Object.prototype,"__proto__","set"),r(t,[]),e=t instanceof Array}catch{}return function(a,i){return Wv(a),Vv(i),Gv(a)&&(e?r(a,i):a.__proto__=i),a}}():void 0),Yv=Et,Jv=ke,Gc=xc,Xv=Z,qv=Kc,uo=zc,lo=Zv,Qv=sr,ep=qr,Rn=Fe,tp=fe,rp=nr,Wc=Bc,np=Gc.PROPER,ap=Gc.CONFIGURABLE,fo=Wc.IteratorPrototype,mr=Wc.BUGGY_SAFARI_ITERATORS,Lt=tp("iterator"),ho="keys",Ut="values",vo="entries",ip=function(){return this},Vc=function(e,t,r,n,a,i,o){qv(r,t,n);var c=function($){if($===a&&d)return d;if(!mr&&$&&$ in u)return u[$];switch($){case ho:return function(){return new r(this,$)};case Ut:return function(){return new r(this,$)};case vo:return function(){return new r(this,$)}}return function(){return new r(this)}},l=t+" Iterator",f=!1,u=e.prototype,s=u[Lt]||u["@@iterator"]||a&&u[a],d=!mr&&s||c(a),h=t==="Array"&&u.entries||s,m,S,g;if(h&&(m=uo(h.call(new e)),m!==Object.prototype&&m.next&&(uo(m)!==fo&&(lo?lo(m,fo):Xv(m[Lt])||Rn(m,Lt,ip)),Qv(m,l,!0))),np&&a===Ut&&s&&s.name!==Ut&&(ap?ep(u,"name",Ut):(f=!0,d=function(){return Jv(s,this)})),a)if(S={values:c(Ut),keys:i?d:c(ho),entries:c(vo)},o)for(g in S)(mr||f||!(g in u))&&Rn(u,g,S[g]);else Yv({target:t,proto:!0,forced:mr||f},S);return u[Lt]!==d&&Rn(u,Lt,d,{name:a}),rp[t]=d,S},ai=function(e,t){return{value:e,done:t}},op=rr,ii=Gd,po=nr,Zc=ir,sp=$e.f,cp=Vc,gr=ai,up=Y,Yc="Array Iterator",lp=Zc.set,fp=Zc.getterFor(Yc),dp=cp(Array,"Array",function(e,t){lp(this,{type:Yc,target:op(e),index:0,kind:t})},function(){var e=fp(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=void 0,gr(void 0,!0);switch(e.kind){case"keys":return gr(r,!1);case"values":return gr(t[r],!1)}return gr([r,t[r]],!1)},"values"),mo=po.Arguments=po.Array;ii("keys");ii("values");ii("entries");if(up&&mo.name!=="values")try{sp(mo,"name",{value:"values"})}catch{}var go=q,hp=Y,vp=Object.getOwnPropertyDescriptor,pp=function(e){if(!hp)return go[e];var t=vp(go,e);return t&&t.value},mp=re,gp=fe,yp=Y,yo=Hl,wp=gp("iterator"),Qr=!mp(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),yo&&(!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b"))||!t.size&&(yo||!yp)||!t.sort||e.href!=="http://a/c%20d?a=1&c=3"||t.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!t[wp]||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"}),wo=Mc,bp=$e,oi=function(e,t,r){return r.get&&wo(r.get,t,{getter:!0}),r.set&&wo(r.set,t,{setter:!0}),bp.f(e,t,r)},Sp=Fe,Ip=function(e,t,r){for(var n in t)Sp(e,n,t[n],r);return e},$p=Ic,kp=TypeError,Jc=function(e,t){if($p(t,e))return e;throw new kp("Incorrect invocation")},Pp=Ha,Tp=K,Ep=function(e){if(Pp(e)==="Function")return Tp(e)},bo=Ep,Op=Xr,_p=za,Rp=bo(bo.bind),si=function(e,t){return Op(e),t===void 0?e:_p?Rp(e,t):function(){return e.apply(t,arguments)}},Cp=fe,jp=Cp("toStringTag"),Xc={};Xc[jp]="z";var Ap=String(Xc)==="[object z]",Lp=Ap,Up=Z,Ar=Ha,xp=fe,Np=xp("toStringTag"),Dp=Object,Mp=Ar(function(){return arguments}())==="Arguments",Fp=function(e,t){try{return e[t]}catch{}},en=Lp?Ar:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Fp(t=Dp(e),Np))=="string"?r:Mp?Ar(t):(n=Ar(t))==="Object"&&Up(t.callee)?"Arguments":n},zp=en,Hp=String,ze=function(e){if(zp(e)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return Hp(e)},Bp=en,So=Va,Kp=Ba,Gp=nr,Wp=fe,Vp=Wp("iterator"),ci=function(e){if(!Kp(e))return So(e,Vp)||So(e,"@@iterator")||Gp[Bp(e)]},Zp=ke,Yp=Xr,Jp=Me,Xp=kc,qp=ci,Qp=TypeError,qc=function(e,t){var r=arguments.length<2?qp(e):t;if(Yp(r))return Jp(Zp(r,e));throw new Qp(Xp(e)+" is not iterable")},em=TypeError,Ot=function(e,t){if(e<t)throw new em("Not enough arguments");return e},tm=K,Qc=tm([].slice),Io=Qc,rm=Math.floor,$a=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=rm(r/2),c=$a(Io(e,0,o),t),l=$a(Io(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},nm=$a,ka=Et,tn=q,ui=pp,yr=ke,Ie=K,Wt=Y,eu=Qr,tu=Fe,am=oi,im=Ip,om=sr,sm=Kc,li=ir,ru=Jc,Cn=Z,cm=ye,um=si,lm=en,fm=Me,nu=Re,X=ze,dm=qa,$o=ar,ko=qc,hm=ci,wr=ai,it=Ot,vm=fe,pm=nm,mm=vm("iterator"),_t="URLSearchParams",au=_t+"Iterator",iu=li.set,ue=li.getterFor(_t),gm=li.getterFor(au),Po=ui("fetch"),Fr=ui("Request"),Vt=ui("Headers"),jn=Fr&&Fr.prototype,To=Vt&&Vt.prototype,ym=tn.RegExp,wm=tn.TypeError,ou=tn.decodeURIComponent,bm=tn.encodeURIComponent,Sm=Ie("".charAt),Eo=Ie([].join),Ze=Ie([].push),Pa=Ie("".replace),Im=Ie([].shift),Oo=Ie([].splice),_o=Ie("".split),$m=Ie("".slice),km=/\+/g,Ro=Array(4),Pm=function(e){return Ro[e-1]||(Ro[e-1]=ym("((?:%[\\da-f]{2}){"+e+"})","gi"))},Tm=function(e){try{return ou(e)}catch{return e}},Co=function(e){var t=Pa(e,km," "),r=4;try{return ou(t)}catch{for(;r;)t=Pa(t,Pm(r--),Tm);return t}},Em=/[!'()~]|%20/g,Om={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},_m=function(e){return Om[e]},jo=function(e){return Pa(bm(e),Em,_m)},An=sm(function(t,r){iu(this,{type:au,target:ue(t).entries,index:0,kind:r})},_t,function(){var t=gm(this),r=t.target,n=t.index++;if(!r||n>=r.length)return t.target=void 0,wr(void 0,!0);var a=r[n];switch(t.kind){case"keys":return wr(a.key,!1);case"values":return wr(a.value,!1)}return wr([a.key,a.value],!1)},!0),su=function(e){this.entries=[],this.url=null,e!==void 0&&(nu(e)?this.parseObject(e):this.parseQuery(typeof e=="string"?Sm(e,0)==="?"?$m(e,1):e:X(e)))};su.prototype={type:_t,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t=this.entries,r=hm(e),n,a,i,o,c,l,f;if(r)for(n=ko(e,r),a=n.next;!(i=yr(a,n)).done;){if(o=ko(fm(i.value)),c=o.next,(l=yr(c,o)).done||(f=yr(c,o)).done||!yr(c,o).done)throw new wm("Expected sequence with length 2");Ze(t,{key:X(l.value),value:X(f.value)})}else for(var u in e)cm(e,u)&&Ze(t,{key:u,value:X(e[u])})},parseQuery:function(e){if(e)for(var t=this.entries,r=_o(e,"&"),n=0,a,i;n<r.length;)a=r[n++],a.length&&(i=_o(a,"="),Ze(t,{key:Co(Im(i)),value:Co(Eo(i,"="))}))},serialize:function(){for(var e=this.entries,t=[],r=0,n;r<e.length;)n=e[r++],Ze(t,jo(n.key)+"="+jo(n.value));return Eo(t,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var rn=function(){ru(this,wt);var t=arguments.length>0?arguments[0]:void 0,r=iu(this,new su(t));Wt||(this.size=r.entries.length)},wt=rn.prototype;im(wt,{append:function(t,r){var n=ue(this);it(arguments.length,2),Ze(n.entries,{key:X(t),value:X(r)}),Wt||this.length++,n.updateURL()},delete:function(e){for(var t=ue(this),r=it(arguments.length,1),n=t.entries,a=X(e),i=r<2?void 0:arguments[1],o=i===void 0?i:X(i),c=0;c<n.length;){var l=n[c];if(l.key===a&&(o===void 0||l.value===o)){if(Oo(n,c,1),o!==void 0)break}else c++}Wt||(this.size=n.length),t.updateURL()},get:function(t){var r=ue(this).entries;it(arguments.length,1);for(var n=X(t),a=0;a<r.length;a++)if(r[a].key===n)return r[a].value;return null},getAll:function(t){var r=ue(this).entries;it(arguments.length,1);for(var n=X(t),a=[],i=0;i<r.length;i++)r[i].key===n&&Ze(a,r[i].value);return a},has:function(t){for(var r=ue(this).entries,n=it(arguments.length,1),a=X(t),i=n<2?void 0:arguments[1],o=i===void 0?i:X(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=ue(this);it(arguments.length,1);for(var a=n.entries,i=!1,o=X(t),c=X(r),l=0,f;l<a.length;l++)f=a[l],f.key===o&&(i?Oo(a,l--,1):(i=!0,f.value=c));i||Ze(a,{key:o,value:c}),Wt||(this.size=a.length),n.updateURL()},sort:function(){var t=ue(this);pm(t.entries,function(r,n){return r.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var r=ue(this).entries,n=um(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 An(this,"keys")},values:function(){return new An(this,"values")},entries:function(){return new An(this,"entries")}},{enumerable:!0});tu(wt,mm,wt.entries,{name:"entries"});tu(wt,"toString",function(){return ue(this).serialize()},{enumerable:!0});Wt&&am(wt,"size",{get:function(){return ue(this).entries.length},configurable:!0,enumerable:!0});om(rn,_t);ka({global:!0,constructor:!0,forced:!eu},{URLSearchParams:rn});if(!eu&&Cn(Vt)){var Rm=Ie(To.has),Cm=Ie(To.set),Ao=function(e){if(nu(e)){var t=e.body,r;if(lm(t)===_t)return r=e.headers?new Vt(e.headers):new Vt,Rm(r,"content-type")||Cm(r,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),dm(e,{body:$o(0,X(t)),headers:$o(0,r)})}return e};if(Cn(Po)&&ka({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return Po(t,arguments.length>1?Ao(arguments[1]):{})}}),Cn(Fr)){var Ln=function(t){return ru(this,jn),new Fr(t,arguments.length>1?Ao(arguments[1]):{})};jn.constructor=Ln,Ln.prototype=jn,ka({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ln})}}var jm={URLSearchParams:rn,getState:ue},Am=Fe,nn=K,Lo=ze,Lm=Ot,cu=URLSearchParams,an=cu.prototype,Um=nn(an.append),Uo=nn(an.delete),xm=nn(an.forEach),Nm=nn([].push),fi=new cu("a=1&a=2&b=3");fi.delete("a",1);fi.delete("b",void 0);fi+""!="a=2"&&Am(an,"delete",function(e){var t=arguments.length,r=t<2?void 0:arguments[1];if(t&&r===void 0)return Uo(this,e);var n=[];xm(this,function(s,d){Nm(n,{key:d,value:s})}),Lm(t,1);for(var a=Lo(e),i=Lo(r),o=0,c=0,l=!1,f=n.length,u;o<f;)u=n[o++],l||u.key===a?(l=!0,Uo(this,u.key)):c++;for(;c<f;)u=n[c++],u.key===a&&u.value===i||Um(this,u.key,u.value)},{enumerable:!0,unsafe:!0});var Dm=Fe,uu=K,Mm=ze,Fm=Ot,lu=URLSearchParams,di=lu.prototype,zm=uu(di.getAll),Hm=uu(di.has),xo=new lu("a=1");(xo.has("a",2)||!xo.has("a",void 0))&&Dm(di,"has",function(t){var r=arguments.length,n=r<2?void 0:arguments[1];if(r&&n===void 0)return Hm(this,t);var a=zm(this,t);Fm(r,1);for(var i=Mm(n),o=0;o<a.length;)if(a[o++]===i)return!0;return!1},{enumerable:!0,unsafe:!0});var Bm=Y,Km=K,Gm=oi,Ta=URLSearchParams.prototype,Wm=Km(Ta.forEach);Bm&&!("size"in Ta)&&Gm(Ta,"size",{get:function(){var t=0;return Wm(this,function(){t++}),t},configurable:!0,enumerable:!0});var Vm=q,fu=Vm,Zm=fu;Zm.URLSearchParams;var hi=K,Ym=Za,Jm=ze,Xm=Yr,qm=hi("".charAt),No=hi("".charCodeAt),Qm=hi("".slice),Do=function(e){return function(t,r){var n=Jm(Xm(t)),a=Ym(r),i=n.length,o,c;return a<0||a>=i?e?"":void 0:(o=No(n,a),o<55296||o>56319||a+1===i||(c=No(n,a+1))<56320||c>57343?e?qm(n,a):o:e?Qm(n,a,a+2):(o-55296<<10)+(c-56320)+65536)}},du={codeAt:Do(!1),charAt:Do(!0)},eg=du.charAt,tg=ze,hu=ir,rg=Vc,Mo=ai,vu="String Iterator",ng=hu.set,ag=hu.getterFor(vu);rg(String,"String",function(e){ng(this,{type:vu,string:tg(e),index:0})},function(){var t=ag(this),r=t.string,n=t.index,a;return n>=r.length?Mo(void 0,!0):(a=eg(r,n),t.index+=a.length,Mo(a,!1))});var Fo=Y,ig=K,og=ke,sg=re,Un=Oc,cg=ni,ug=ei,lg=Jr,fg=dc,ot=Object.assign,zo=Object.defineProperty,dg=ig([].concat),hg=!ot||sg(function(){if(Fo&&ot({b:1},ot(zo({},"a",{enumerable:!0,get:function(){zo(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}),ot({},e)[r]!==7||Un(ot({},t)).join("")!==n})?function(t,r){for(var n=lg(t),a=arguments.length,i=1,o=cg.f,c=ug.f;a>i;)for(var l=fg(arguments[i++]),f=o?dg(Un(l),o(l)):Un(l),u=f.length,s=0,d;u>s;)d=f[s++],(!Fo||og(c,l,d))&&(n[d]=l[d]);return n}:ot,vg=ke,Ho=Me,pg=Va,mg=function(e,t,r){var n,a;Ho(e);try{if(n=pg(e,"return"),!n){if(t==="throw")throw r;return r}n=vg(n,e)}catch(i){a=!0,n=i}if(t==="throw")throw r;if(a)throw n;return Ho(n),r},gg=Me,yg=mg,wg=function(e,t,r,n){try{return n?t(gg(r)[0],r[1]):t(r)}catch(a){yg(e,"throw",a)}},bg=fe,Sg=nr,Ig=bg("iterator"),$g=Array.prototype,kg=function(e){return e!==void 0&&(Sg.Array===e||$g[Ig]===e)},Pg=K,Tg=re,pu=Z,Eg=en,Og=Tt,_g=Nc,mu=function(){},gu=Og("Reflect","construct"),vi=/^\s*(?:class|function)\b/,Rg=Pg(vi.exec),Cg=!vi.test(mu),xt=function(t){if(!pu(t))return!1;try{return gu(mu,[],t),!0}catch{return!1}},yu=function(t){if(!pu(t))return!1;switch(Eg(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Cg||!!Rg(vi,_g(t))}catch{return!0}};yu.sham=!0;var jg=!gu||Tg(function(){var e;return xt(xt.call)||!xt(Object)||!xt(function(){e=!0})||e})?yu:xt,Ag=Y,Lg=$e,Ug=ar,xg=function(e,t,r){Ag?Lg.f(e,t,Ug(0,r)):e[t]=r},Ng=si,Dg=ke,Mg=Jr,Fg=wg,zg=kg,Hg=jg,Bg=Tc,Bo=xg,Kg=qc,Gg=ci,Ko=Array,Wg=function(t){var r=Mg(t),n=Hg(this),a=arguments.length,i=a>1?arguments[1]:void 0,o=i!==void 0;o&&(i=Ng(i,a>2?arguments[2]:void 0));var c=Gg(r),l=0,f,u,s,d,h,m;if(c&&!(this===Ko&&zg(c)))for(u=n?new this:[],d=Kg(r,c),h=d.next;!(s=Dg(h,d)).done;l++)m=o?Fg(d,i,[s.value,l],!0):s.value,Bo(u,l,m);else for(f=Bg(r),u=n?new this(f):Ko(f);f>l;l++)m=o?i(r[l],l):r[l],Bo(u,l,m);return u.length=l,u},nt=K,xn=2147483647,Zt=36,wu=1,Ea=26,Vg=38,Zg=700,Yg=72,Jg=128,Xg="-",qg=/[^\0-\u007E]/,bu=/[.\u3002\uFF0E\uFF61]/g,Go="Overflow: input needs wider integers to process",Nn=Zt-wu,Wo=RangeError,Qg=nt(bu.exec),ht=Math.floor,Dn=String.fromCharCode,Vo=nt("".charCodeAt),Su=nt([].join),Ue=nt([].push),ey=nt("".replace),ty=nt("".split),ry=nt("".toLowerCase),ny=function(e){for(var t=[],r=0,n=e.length;r<n;){var a=Vo(e,r++);if(a>=55296&&a<=56319&&r<n){var i=Vo(e,r++);(i&64512)===56320?Ue(t,((a&1023)<<10)+(i&1023)+65536):(Ue(t,a),r--)}else Ue(t,a)}return t},Zo=function(e){return e+22+75*(e<26)},ay=function(e,t,r){var n=0;for(e=r?ht(e/Zg):e>>1,e+=ht(e/t);e>Nn*Ea>>1;)e=ht(e/Nn),n+=Zt;return ht(n+(Nn+1)*e/(e+Vg))},iy=function(e){var t=[];e=ny(e);var r=e.length,n=Jg,a=0,i=Yg,o,c;for(o=0;o<e.length;o++)c=e[o],c<128&&Ue(t,Dn(c));var l=t.length,f=l;for(l&&Ue(t,Xg);f<r;){var u=xn;for(o=0;o<e.length;o++)c=e[o],c>=n&&c<u&&(u=c);var s=f+1;if(u-n>ht((xn-a)/s))throw new Wo(Go);for(a+=(u-n)*s,n=u,o=0;o<e.length;o++){if(c=e[o],c<n&&++a>xn)throw new Wo(Go);if(c===n){for(var d=a,h=Zt;;){var m=h<=i?wu:h>=i+Ea?Ea:h-i;if(d<m)break;var S=d-m,g=Zt-m;Ue(t,Dn(Zo(m+S%g))),d=ht(S/g),h+=Zt}Ue(t,Dn(Zo(d))),i=ay(a,s,f===l),a=0,f++}}a++,n++}return Su(t,"")},oy=function(e){var t=[],r=ty(ey(ry(e),bu,"."),"."),n,a;for(n=0;n<r.length;n++)a=r[n],Ue(t,Qg(qg,a)?"xn--"+iy(a):a);return Su(t,".")},sy=Et,pi=Y,cy=Qr,mi=q,Yo=si,de=K,zr=Fe,oe=oi,uy=Jc,Oa=ye,gi=hg,st=Wg,he=Qc,ly=du.codeAt,fy=oy,Te=ze,dy=sr,hy=Ot,Iu=jm,$u=ir,vy=$u.set,Hr=$u.getterFor("URL"),py=Iu.URLSearchParams,my=Iu.getState,Nt=mi.URL,_a=mi.TypeError,Br=mi.parseInt,gy=Math.floor,Jo=Math.pow,le=de("".charAt),me=de(/./.exec),Ht=de([].join),yy=de(1 .toString),wy=de([].pop),lt=de([].push),Mn=de("".replace),by=de([].shift),Sy=de("".split),Yt=de("".slice),Kr=de("".toLowerCase),Iy=de([].unshift),$y="Invalid authority",Fn="Invalid scheme",Be="Invalid host",Xo="Invalid port",ku=/[a-z]/i,ky=/[\d+-.a-z]/i,Ra=/\d/,Py=/^0x/i,Ty=/^[0-7]+$/,Ey=/^\d+$/,Pu=/^[\da-f]+$/i,Oy=/[\0\t\n\r #%/:<>?@[\\\]^|]/,_y=/[\0\t\n\r #/:<>?@[\\\]^|]/,Ry=/^[\u0000-\u0020]+/,Cy=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,jy=/[\t\n\r]/g,se,Ay=function(e){var t=Sy(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=me(Py,i)?16:8,i=Yt(i,o===8?1:2)),i==="")c=0;else{if(!me(o===10?Ey:o===8?Ty:Pu,i))return e;c=Br(i,o)}lt(n,c)}for(a=0;a<r;a++)if(c=n[a],a===r-1){if(c>=Jo(256,5-r))return null}else if(c>255)return null;for(l=wy(n),a=0;a<n.length;a++)l+=n[a]*Jo(256,3-a);return l},Ly=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&&me(Pu,d());)i=i*16+Br(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(!me(Ra,d()))return;for(;me(Ra,d());){if(f=Br(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},Uy=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},Dt=function(e){var t,r,n,a;if(typeof e=="number"){for(t=[],r=0;r<4;r++)Iy(t,e%256),e=gy(e/256);return Ht(t,".")}else if(typeof e=="object"){for(t="",n=Uy(e),r=0;r<8;r++)a&&e[r]===0||(a&&(a=!1),n===r?(t+=r?":":"::",a=!0):(t+=yy(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},Lr={},Tu=gi({},Lr,{" ":1,'"':1,"<":1,">":1,"`":1}),Eu=gi({},Tu,{"#":1,"?":1,"{":1,"}":1}),zn=gi({},Eu,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ce=function(e,t){var r=ly(e,0);return r>32&&r<127&&!Oa(t,e)?e:encodeURIComponent(e)},br={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Bt=function(e,t){var r;return e.length===2&&me(ku,le(e,0))&&((r=le(e,1))===":"||!t&&r==="|")},qo=function(e){var t;return e.length>1&&Bt(Yt(e,0,2))&&(e.length===2||(t=le(e,2))==="/"||t==="\\"||t==="?"||t==="#")},xy=function(e){return e==="."||Kr(e)==="%2e"},Ny=function(e){return e=Kr(e),e===".."||e==="%2e."||e===".%2e"||e==="%2e%2e"},Hn={},Qo={},Bn={},es={},ts={},Kn={},rs={},ns={},Sr={},Ir={},Gn={},Wn={},Vn={},Zn={},as={},Yn={},ct={},be={},is={},Ke={},Pe={},yi=function(e,t,r){var n=Te(e),a,i,o;if(t){if(i=this.parse(n),i)throw new _a(i);this.searchParams=null}else{if(r!==void 0&&(a=new yi(r,!0)),i=this.parse(n,null,a),i)throw new _a(i);o=my(new py),o.bindURL(this),this.searchParams=o}};yi.prototype={type:"URL",parse:function(e,t,r){var n=this,a=t||Hn,i=0,o="",c=!1,l=!1,f=!1,u,s,d,h;for(e=Te(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=Mn(e,Ry,""),e=Mn(e,Cy,"$1")),e=Mn(e,jy,""),u=st(e);i<=u.length;){switch(s=u[i],a){case Hn:if(s&&me(ku,s))o+=Kr(s),a=Qo;else{if(t)return Fn;a=Bn;continue}break;case Qo:if(s&&(me(ky,s)||s==="+"||s==="-"||s==="."))o+=Kr(s);else if(s===":"){if(t&&(n.isSpecial()!==Oa(br,o)||o==="file"&&(n.includesCredentials()||n.port!==null)||n.scheme==="file"&&!n.host))return;if(n.scheme=o,t){n.isSpecial()&&br[n.scheme]===n.port&&(n.port=null);return}o="",n.scheme==="file"?a=Zn:n.isSpecial()&&r&&r.scheme===n.scheme?a=es:n.isSpecial()?a=ns:u[i+1]==="/"?(a=ts,i++):(n.cannotBeABaseURL=!0,lt(n.path,""),a=is)}else{if(t)return Fn;o="",a=Bn,i=0;continue}break;case Bn:if(!r||r.cannotBeABaseURL&&s!=="#")return Fn;if(r.cannotBeABaseURL&&s==="#"){n.scheme=r.scheme,n.path=he(r.path),n.query=r.query,n.fragment="",n.cannotBeABaseURL=!0,a=Pe;break}a=r.scheme==="file"?Zn:Kn;continue;case es:if(s==="/"&&u[i+1]==="/")a=Sr,i++;else{a=Kn;continue}break;case ts:if(s==="/"){a=Ir;break}else{a=be;continue}case Kn:if(n.scheme=r.scheme,s===se)n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=he(r.path),n.query=r.query;else if(s==="/"||s==="\\"&&n.isSpecial())a=rs;else if(s==="?")n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=he(r.path),n.query="",a=Ke;else if(s==="#")n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=he(r.path),n.query=r.query,n.fragment="",a=Pe;else{n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=he(r.path),n.path.length--,a=be;continue}break;case rs:if(n.isSpecial()&&(s==="/"||s==="\\"))a=Sr;else if(s==="/")a=Ir;else{n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,a=be;continue}break;case ns:if(a=Sr,s!=="/"||le(o,i+1)!=="/")continue;i++;break;case Sr:if(s!=="/"&&s!=="\\"){a=Ir;continue}break;case Ir:if(s==="@"){c&&(o="%40"+o),c=!0,d=st(o);for(var m=0;m<d.length;m++){var S=d[m];if(S===":"&&!f){f=!0;continue}var g=Ce(S,zn);f?n.password+=g:n.username+=g}o=""}else if(s===se||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()){if(c&&o==="")return $y;i-=st(o).length+1,o="",a=Gn}else o+=s;break;case Gn:case Wn:if(t&&n.scheme==="file"){a=Yn;continue}else if(s===":"&&!l){if(o==="")return Be;if(h=n.parseHost(o),h)return h;if(o="",a=Vn,t===Wn)return}else if(s===se||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()){if(n.isSpecial()&&o==="")return Be;if(t&&o===""&&(n.includesCredentials()||n.port!==null))return;if(h=n.parseHost(o),h)return h;if(o="",a=ct,t)return;continue}else s==="["?l=!0:s==="]"&&(l=!1),o+=s;break;case Vn:if(me(Ra,s))o+=s;else if(s===se||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()||t){if(o!==""){var $=Br(o,10);if($>65535)return Xo;n.port=n.isSpecial()&&$===br[n.scheme]?null:$,o=""}if(t)return;a=ct;continue}else return Xo;break;case Zn:if(n.scheme="file",s==="/"||s==="\\")a=as;else if(r&&r.scheme==="file")switch(s){case se:n.host=r.host,n.path=he(r.path),n.query=r.query;break;case"?":n.host=r.host,n.path=he(r.path),n.query="",a=Ke;break;case"#":n.host=r.host,n.path=he(r.path),n.query=r.query,n.fragment="",a=Pe;break;default:qo(Ht(he(u,i),""))||(n.host=r.host,n.path=he(r.path),n.shortenPath()),a=be;continue}else{a=be;continue}break;case as:if(s==="/"||s==="\\"){a=Yn;break}r&&r.scheme==="file"&&!qo(Ht(he(u,i),""))&&(Bt(r.path[0],!0)?lt(n.path,r.path[0]):n.host=r.host),a=be;continue;case Yn:if(s===se||s==="/"||s==="\\"||s==="?"||s==="#"){if(!t&&Bt(o))a=be;else if(o===""){if(n.host="",t)return;a=ct}else{if(h=n.parseHost(o),h)return h;if(n.host==="localhost"&&(n.host=""),t)return;o="",a=ct}continue}else o+=s;break;case ct:if(n.isSpecial()){if(a=be,s!=="/"&&s!=="\\")continue}else if(!t&&s==="?")n.query="",a=Ke;else if(!t&&s==="#")n.fragment="",a=Pe;else if(s!==se&&(a=be,s!=="/"))continue;break;case be:if(s===se||s==="/"||s==="\\"&&n.isSpecial()||!t&&(s==="?"||s==="#")){if(Ny(o)?(n.shortenPath(),s!=="/"&&!(s==="\\"&&n.isSpecial())&<(n.path,"")):xy(o)?s!=="/"&&!(s==="\\"&&n.isSpecial())&<(n.path,""):(n.scheme==="file"&&!n.path.length&&Bt(o)&&(n.host&&(n.host=""),o=le(o,0)+":"),lt(n.path,o)),o="",n.scheme==="file"&&(s===se||s==="?"||s==="#"))for(;n.path.length>1&&n.path[0]==="";)by(n.path);s==="?"?(n.query="",a=Ke):s==="#"&&(n.fragment="",a=Pe)}else o+=Ce(s,Eu);break;case is:s==="?"?(n.query="",a=Ke):s==="#"?(n.fragment="",a=Pe):s!==se&&(n.path[0]+=Ce(s,Lr));break;case Ke:!t&&s==="#"?(n.fragment="",a=Pe):s!==se&&(s==="'"&&n.isSpecial()?n.query+="%27":s==="#"?n.query+="%23":n.query+=Ce(s,Lr));break;case Pe:s!==se&&(n.fragment+=Ce(s,Tu));break}i++}},parseHost:function(e){var t,r,n;if(le(e,0)==="["){if(le(e,e.length-1)!=="]"||(t=Ly(Yt(e,1,-1)),!t))return Be;this.host=t}else if(this.isSpecial()){if(e=fy(e),me(Oy,e)||(t=Ay(e),t===null))return Be;this.host=t}else{if(me(_y,e))return Be;for(t="",r=st(e),n=0;n<r.length;n++)t+=Ce(r[n],Lr);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return Oa(br,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;t&&(this.scheme!=="file"||t!==1||!Bt(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+=Dt(a),i!==null&&(f+=":"+i)):t==="file"&&(f+="//"),f+=e.cannotBeABaseURL?o[0]:o.length?"/"+Ht(o,"/"):"",c!==null&&(f+="?"+c),l!==null&&(f+="#"+l),f},setHref:function(e){var t=this.parse(e);if(t)throw new _a(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if(e==="blob")try{return new bt(e.path[0]).origin}catch{return"null"}return e==="file"||!this.isSpecial()?"null":e+"://"+Dt(this.host)+(t!==null?":"+t:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Te(e)+":",Hn)},getUsername:function(){return this.username},setUsername:function(e){var t=st(Te(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Ce(t[r],zn)}},getPassword:function(){return this.password},setPassword:function(e){var t=st(Te(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Ce(t[r],zn)}},getHost:function(){var e=this.host,t=this.port;return e===null?"":t===null?Dt(e):Dt(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Gn)},getHostname:function(){var e=this.host;return e===null?"":Dt(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Wn)},getPort:function(){var e=this.port;return e===null?"":Te(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(e=Te(e),e===""?this.port=null:this.parse(e,Vn))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+Ht(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,ct))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){e=Te(e),e===""?this.query=null:(le(e,0)==="?"&&(e=Yt(e,1)),this.query="",this.parse(e,Ke)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){if(e=Te(e),e===""){this.fragment=null;return}le(e,0)==="#"&&(e=Yt(e,1)),this.fragment="",this.parse(e,Pe)},update:function(){this.query=this.searchParams.serialize()||null}};var bt=function(t){var r=uy(this,J),n=hy(arguments.length,1)>1?arguments[1]:void 0,a=vy(r,new yi(t,!1,n));pi||(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())},J=bt.prototype,ce=function(e,t){return{get:function(){return Hr(this)[e]()},set:t&&function(r){return Hr(this)[t](r)},configurable:!0,enumerable:!0}};pi&&(oe(J,"href",ce("serialize","setHref")),oe(J,"origin",ce("getOrigin")),oe(J,"protocol",ce("getProtocol","setProtocol")),oe(J,"username",ce("getUsername","setUsername")),oe(J,"password",ce("getPassword","setPassword")),oe(J,"host",ce("getHost","setHost")),oe(J,"hostname",ce("getHostname","setHostname")),oe(J,"port",ce("getPort","setPort")),oe(J,"pathname",ce("getPathname","setPathname")),oe(J,"search",ce("getSearch","setSearch")),oe(J,"searchParams",ce("getSearchParams")),oe(J,"hash",ce("getHash","setHash")));zr(J,"toJSON",function(){return Hr(this).serialize()},{enumerable:!0});zr(J,"toString",function(){return Hr(this).serialize()},{enumerable:!0});if(Nt){var os=Nt.createObjectURL,ss=Nt.revokeObjectURL;os&&zr(bt,"createObjectURL",Yo(os,Nt)),ss&&zr(bt,"revokeObjectURL",Yo(ss,Nt))}dy(bt,"URL");sy({global:!0,constructor:!0,forced:!cy,sham:!pi},{URL:bt});var Dy=Et,My=Tt,Ou=re,Fy=Ot,cs=ze,zy=Qr,wi=My("URL"),Hy=zy&&Ou(function(){wi.canParse()}),By=Ou(function(){return wi.canParse.length!==1});Dy({target:"URL",stat:!0,forced:!Hy||By},{canParse:function(t){var r=Fy(arguments.length,1),n=cs(t),a=r<2||arguments[1]===void 0?void 0:cs(arguments[1]);try{return!!new wi(n,a)}catch{return!1}}});var Ky=Et,Gy=Tt,Wy=Ot,us=ze,Vy=Qr,Zy=Gy("URL");Ky({target:"URL",stat:!0,forced:!Vy},{parse:function(t){var r=Wy(arguments.length,1),n=us(t),a=r<2||arguments[1]===void 0?void 0:us(arguments[1]);try{return new Zy(n,a)}catch{return null}}});var Yy=Et,Jy=ke;Yy({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Jy(URL.prototype.toString,this)}});var Xy=fu;Xy.URL;var qy={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},Qy=Wa,Jn=Qy("span").classList,ls=Jn&&Jn.constructor&&Jn.constructor.prototype,ew=ls===Object.prototype?void 0:ls,fs=q,_u=qy,tw=ew,Kt=dp,ds=qr,rw=sr,nw=fe,Xn=nw("iterator"),qn=Kt.values,Ru=function(e,t){if(e){if(e[Xn]!==qn)try{ds(e,Xn,qn)}catch{e[Xn]=qn}if(rw(e,t,!0),_u[t]){for(var r in Kt)if(e[r]!==Kt[r])try{ds(e,r,Kt[r])}catch{e[r]=Kt[r]}}}};for(var Qn in _u)Ru(fs[Qn]&&fs[Qn].prototype,Qn);Ru(tw,"DOMTokenList");function De(e,t){const r=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0});dispatchEvent(r)}function Se(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}var We=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Si(e,t){return e(t={exports:{}},t.exports),t.exports}var Ge=Si(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()}});bi(Ge);var aw=bi(Si(function(e,t){var r=We&&We.__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=We&&We.__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=We;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,Ge.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?(Ge.default().unlock(d),[2]):(($=JSON.parse(g)).timeRefreshed=Date.now(),S.setItemSync(s,JSON.stringify($)),Ge.default().unlock(d),this.refreshLockWhileAcquired(s,d),[2])):(Ge.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,Ge.default().lock(S.iat)];case 1:g.sent(),this.acquiredIatSet.delete(S.iat),d.removeItemSync(h),Ge.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 iw={timeoutInSeconds:60},Cu={name:"auth0-spa-js",version:"2.1.3"},ju=()=>Date.now();let ne=class Ca extends Error{constructor(t,r){super(r),this.error=t,this.error_description=r,Object.setPrototypeOf(this,Ca.prototype)}static fromPayload({error:t,error_description:r}){return new Ca(t,r)}},ow=class Au extends ne{constructor(t,r,n,a=null){super(t,r),this.state=n,this.appState=a,Object.setPrototypeOf(this,Au.prototype)}},ja=class Lu extends ne{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,Lu.prototype)}},sw=class Uu extends ja{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,Uu.prototype)}},cw=class xu extends ne{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,xu.prototype)}},uw=class Nu extends ne{constructor(t,r,n){super(t,r),this.mfa_token=n,Object.setPrototypeOf(this,Nu.prototype)}},Du=class Mu extends ne{constructor(t,r){super("missing_refresh_token",`Missing Refresh Token (audience: '${hs(t,["default"])}', scope: '${hs(r)}')`),this.audience=t,this.scope=r,Object.setPrototypeOf(this,Mu.prototype)}};function hs(e,t=[]){return e&&!t.includes(e)?e:""}const Ur=()=>window.crypto,ea=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(Ur().getRandomValues(new Uint8Array(43))).forEach(r=>t+=e[r%e.length]),t},vs=e=>btoa(e),Aa=e=>{var{clientId:t}=e,r=Se(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()},ps=e=>(t=>decodeURIComponent(atob(t).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),lw=async(e,t)=>{const r=await fetch(e,t);return{ok:r.ok,json:await r.json()}},fw=async(e,t,r)=>{const n=new AbortController;let a;return t.signal=n.signal,Promise.race([lw(e,t),new Promise((i,o)=>{a=setTimeout(()=>{n.abort(),o(new Error("Timeout when executing 'fetch'"))},r)})]).finally(()=>{clearTimeout(a)})},dw=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},hw=async(e,t,r,n,a,i,o=1e4)=>a?dw(e,t,r,n,o,a,i):fw(e,n,o);async function vw(e,t){var{baseUrl:r,timeout:n,audience:a,scope:i,auth0Client:o,useFormData:c}=e,l=Se(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const f=c?Aa(l):JSON.stringify(l);return await async function(u,s,d,h,m,S,g){let $,k=null;for(let C=0;C<3;C++)try{$=await hw(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=Se(b,["error","error_description"]),{ok:_}=$;if(!_){const C=I||`HTTP error. Unable to fetch ${u}`;throw v==="mfa_required"?new uw(v,C,O.mfa_token):v==="missing_refresh_token"?new Du(d,h):new ne(v||"request_error",C)}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||Cu))}},t,c)}const $r=(...e)=>{return(t=e.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(t))).join(" ");var t};let Ye=class La{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 La({clientId:n,scope:i,audience:a},r)}static fromCacheEntry(t){const{scope:r,audience:n,client_id:a}=t;return new La({scope:r,audience:n,clientId:a})}},pw=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@@"))}},Fu=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)}}()}},mw=class{constructor(t,r,n){this.cache=t,this.keyManifest=r,this.nowProvider=n||ju}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 Ye({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 Ye({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,r){return r.filter(n=>{var a;const i=Ye.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]}},gw=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 Mt=e=>typeof e=="number",yw=["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"],ww=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(ps(l)),s={__raw:i},d={};return Object.keys(u).forEach(h=>{s[h]=u[h],yw.includes(h)||(d[h]=u[h])}),{encoded:{header:c,payload:l,signature:f},header:JSON.parse(ps(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&&!Mt(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||!Mt(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Mt(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&&Mt(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&&Mt(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 Je=Si(function(e,t){var r=We&&We.__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}))}});bi(Je),Je.encode,Je.parse,Je.getAll;var bw=Je.get,zu=Je.set,Hu=Je.remove;const ft={get(e){const t=bw(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),zu(e,JSON.stringify(t),n)},remove(e,t){let r={};t!=null&&t.cookieDomain&&(r.domain=t.cookieDomain),Hu(e,r)}},Sw={get(e){return ft.get(e)||ft.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),zu(`_legacy_${e}`,JSON.stringify(t),n),ft.save(e,t,r)},remove(e,t){let r={};t!=null&&t.cookieDomain&&(r.domain=t.cookieDomain),Hu(e,r),ft.remove(e,t),ft.remove(`_legacy_${e}`,t)}},Iw={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 $w(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 ms,gs,ys,ta,kw=(ms="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",gs=null,ys=!1,function(e){return ta=ta||$w(ms,gs,ys),new Worker(ta,e)});const ra={};let Pw=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 Tw={memory:()=>new Fu().enclosedCache,localstorage:()=>new pw},ws=e=>Tw[e],bs=e=>{const{openUrl:t,onRedirect:r}=e,n=
|
|
1
|
+
"use strict";var Ol=Object.defineProperty;var _l=(e,t,r)=>t in e?Ol(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var oe=(e,t,r)=>_l(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var lr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ne=function(e){try{return!!e()}catch{return!0}},Rl=ne,za=!Rl(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),uc=za,lc=Function.prototype,fa=lc.call,Cl=uc&&lc.bind.bind(fa,fa),K=uc?Cl:function(e){return function(){return fa.apply(e,arguments)}},fc=K,jl=fc({}.toString),Al=fc("".slice),Ha=function(e){return Al(jl(e),8,-1)},Ll=K,Ul=ne,xl=Ha,dn=Object,Nl=Ll("".split),dc=Ul(function(){return!dn("z").propertyIsEnumerable(0)})?function(e){return xl(e)==="String"?Nl(e,""):dn(e)}:dn,Ba=function(e){return e==null},Dl=Ba,Ml=TypeError,Yr=function(e){if(Dl(e))throw new Ml("Can't call method on "+e);return e},Fl=dc,zl=Yr,nr=function(e){return Fl(zl(e))},Lt=function(e){return e&&e.Math===Math&&e},Q=Lt(typeof globalThis=="object"&&globalThis)||Lt(typeof window=="object"&&window)||Lt(typeof self=="object"&&self)||Lt(typeof lr=="object"&&lr)||Lt(typeof lr=="object"&&lr)||function(){return this}()||Function("return this")(),hc={exports:{}},Hl=!1,Li=Q,Bl=Object.defineProperty,Ka=function(e,t){try{Bl(Li,e,{value:t,configurable:!0,writable:!0})}catch{Li[e]=t}return t},Kl=Q,Gl=Ka,Ui="__core-js_shared__",xi=hc.exports=Kl[Ui]||Gl(Ui,{});(xi.versions||(xi.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 Ga=hc.exports,Ni=Ga,vc=function(e,t){return Ni[e]||(Ni[e]=t||{})},Wl=Yr,Vl=Object,Jr=function(e){return Vl(Wl(e))},Zl=K,Yl=Jr,Jl=Zl({}.hasOwnProperty),we=Object.hasOwn||function(t,r){return Jl(Yl(t),r)},Xl=K,ql=0,Ql=Math.random(),ef=Xl(1 .toString),pc=function(e){return"Symbol("+(e===void 0?"":e)+")_"+ef(++ql+Ql,36)},tf=typeof navigator<"u"&&String(navigator.userAgent)||"",mc=Q,hn=tf,Di=mc.process,Mi=mc.Deno,Fi=Di&&Di.versions||Mi&&Mi.version,zi=Fi&&Fi.v8,me,Nr;zi&&(me=zi.split("."),Nr=me[0]>0&&me[0]<4?1:+(me[0]+me[1]));!Nr&&hn&&(me=hn.match(/Edge\/(\d+)/),(!me||me[1]>=74)&&(me=hn.match(/Chrome\/(\d+)/),me&&(Nr=+me[1])));var rf=Nr,Hi=rf,nf=ne,af=Q,of=af.String,gc=!!Object.getOwnPropertySymbols&&!nf(function(){var e=Symbol("symbol detection");return!of(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Hi&&Hi<41}),sf=gc,yc=sf&&!Symbol.sham&&typeof Symbol.iterator=="symbol",cf=Q,uf=vc,Bi=we,lf=pc,ff=gc,df=yc,vt=cf.Symbol,vn=uf("wks"),hf=df?vt.for||vt:vt&&vt.withoutSetter||lf,de=function(e){return Bi(vn,e)||(vn[e]=ff&&Bi(vt,e)?vt[e]:hf("Symbol."+e)),vn[e]},pn=typeof document=="object"&&document.all,Y=typeof pn>"u"&&pn!==void 0?function(e){return typeof e=="function"||e===pn}:function(e){return typeof e=="function"},vf=Y,Ce=function(e){return typeof e=="object"?e!==null:vf(e)},pf=Ce,mf=String,gf=TypeError,ze=function(e){if(pf(e))return e;throw new gf(mf(e)+" is not an object")},wc={},yf=ne,J=!yf(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),wf=J,bf=ne,bc=wf&&bf(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),ke={},Sf=Q,Ki=Ce,da=Sf.document,If=Ki(da)&&Ki(da.createElement),Wa=function(e){return If?da.createElement(e):{}},$f=J,kf=ne,Pf=Wa,Sc=!$f&&!kf(function(){return Object.defineProperty(Pf("div"),"a",{get:function(){return 7}}).a!==7}),Tf=za,fr=Function.prototype.call,Pe=Tf?fr.bind(fr):function(){return fr.apply(fr,arguments)},mn=Q,Ef=Y,Of=function(e){return Ef(e)?e:void 0},Ot=function(e,t){return arguments.length<2?Of(mn[e]):mn[e]&&mn[e][t]},_f=K,Ic=_f({}.isPrototypeOf),Rf=Ot,Cf=Y,jf=Ic,Af=yc,Lf=Object,$c=Af?function(e){return typeof e=="symbol"}:function(e){var t=Rf("Symbol");return Cf(t)&&jf(t.prototype,Lf(e))},Uf=String,kc=function(e){try{return Uf(e)}catch{return"Object"}},xf=Y,Nf=kc,Df=TypeError,Xr=function(e){if(xf(e))return e;throw new Df(Nf(e)+" is not a function")},Mf=Xr,Ff=Ba,Va=function(e,t){var r=e[t];return Ff(r)?void 0:Mf(r)},gn=Pe,yn=Y,wn=Ce,zf=TypeError,Hf=function(e,t){var r,n;if(t==="string"&&yn(r=e.toString)&&!wn(n=gn(r,e))||yn(r=e.valueOf)&&!wn(n=gn(r,e))||t!=="string"&&yn(r=e.toString)&&!wn(n=gn(r,e)))return n;throw new zf("Can't convert object to primitive value")},Bf=Pe,Gi=Ce,Wi=$c,Kf=Va,Gf=Hf,Wf=de,Vf=TypeError,Zf=Wf("toPrimitive"),Yf=function(e,t){if(!Gi(e)||Wi(e))return e;var r=Kf(e,Zf),n;if(r){if(t===void 0&&(t="default"),n=Bf(r,e,t),!Gi(n)||Wi(n))return n;throw new Vf("Can't convert object to primitive value")}return t===void 0&&(t="number"),Gf(e,t)},Jf=Yf,Xf=$c,Pc=function(e){var t=Jf(e,"string");return Xf(t)?t:t+""},qf=J,Qf=Sc,ed=bc,dr=ze,Vi=Pc,td=TypeError,bn=Object.defineProperty,rd=Object.getOwnPropertyDescriptor,Sn="enumerable",In="configurable",$n="writable";ke.f=qf?ed?function(t,r,n){if(dr(t),r=Vi(r),dr(n),typeof t=="function"&&r==="prototype"&&"value"in n&&$n in n&&!n[$n]){var a=rd(t,r);a&&a[$n]&&(t[r]=n.value,n={configurable:In in n?n[In]:a[In],enumerable:Sn in n?n[Sn]:a[Sn],writable:!1})}return bn(t,r,n)}:bn:function(t,r,n){if(dr(t),r=Vi(r),dr(n),Qf)try{return bn(t,r,n)}catch{}if("get"in n||"set"in n)throw new td("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var nd=Math.ceil,ad=Math.floor,id=Math.trunc||function(t){var r=+t;return(r>0?ad:nd)(r)},od=id,Za=function(e){var t=+e;return t!==t||t===0?0:od(t)},sd=Za,cd=Math.max,ud=Math.min,ld=function(e,t){var r=sd(e);return r<0?cd(r+t,0):ud(r,t)},fd=Za,dd=Math.min,hd=function(e){var t=fd(e);return t>0?dd(t,9007199254740991):0},vd=hd,Tc=function(e){return vd(e.length)},pd=nr,md=ld,gd=Tc,Zi=function(e){return function(t,r,n){var a=pd(t),i=gd(a);if(i===0)return!e&&-1;var o=md(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}},yd={includes:Zi(!0),indexOf:Zi(!1)},Ya={},wd=K,kn=we,bd=nr,Sd=yd.indexOf,Id=Ya,Yi=wd([].push),Ec=function(e,t){var r=bd(e),n=0,a=[],i;for(i in r)!kn(Id,i)&&kn(r,i)&&Yi(a,i);for(;t.length>n;)kn(r,i=t[n++])&&(~Sd(a,i)||Yi(a,i));return a},Ja=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$d=Ec,kd=Ja,Oc=Object.keys||function(t){return $d(t,kd)},Pd=J,Td=bc,Ed=ke,Od=ze,_d=nr,Rd=Oc;wc.f=Pd&&!Td?Object.defineProperties:function(t,r){Od(t);for(var n=_d(r),a=Rd(r),i=a.length,o=0,c;i>o;)Ed.f(t,c=a[o++],n[c]);return t};var Cd=Ot,jd=Cd("document","documentElement"),Ad=vc,Ld=pc,Ji=Ad("keys"),Xa=function(e){return Ji[e]||(Ji[e]=Ld(e))},Ud=ze,xd=wc,Xi=Ja,Nd=Ya,Dd=jd,Md=Wa,Fd=Xa,qi=">",Qi="<",ha="prototype",va="script",_c=Fd("IE_PROTO"),Pn=function(){},Rc=function(e){return Qi+va+qi+e+Qi+"/"+va+qi},eo=function(e){e.write(Rc("")),e.close();var t=e.parentWindow.Object;return e=null,t},zd=function(){var e=Md("iframe"),t="java"+va+":",r;return e.style.display="none",Dd.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(Rc("document.F=Object")),r.close(),r.F},hr,Cr=function(){try{hr=new ActiveXObject("htmlfile")}catch{}Cr=typeof document<"u"?document.domain&&hr?eo(hr):zd():eo(hr);for(var e=Xi.length;e--;)delete Cr[ha][Xi[e]];return Cr()};Nd[_c]=!0;var qa=Object.create||function(t,r){var n;return t!==null?(Pn[ha]=Ud(t),n=new Pn,Pn[ha]=null,n[_c]=t):n=Cr(),r===void 0?n:xd.f(n,r)},Hd=de,Bd=qa,Kd=ke.f,pa=Hd("unscopables"),ma=Array.prototype;ma[pa]===void 0&&Kd(ma,pa,{configurable:!0,value:Bd(null)});var Gd=function(e){ma[pa][e]=!0},ar={},Wd=Q,Vd=Y,to=Wd.WeakMap,Zd=Vd(to)&&/native code/.test(String(to)),ir=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},Yd=J,Jd=ke,Xd=ir,qr=Yd?function(e,t,r){return Jd.f(e,t,Xd(1,r))}:function(e,t,r){return e[t]=r,e},qd=Zd,Cc=Q,Qd=Ce,eh=qr,Tn=we,En=Ga,th=Xa,rh=Ya,ro="Object already initialized",ga=Cc.TypeError,nh=Cc.WeakMap,Dr,tr,Mr,ah=function(e){return Mr(e)?tr(e):Dr(e,{})},ih=function(e){return function(t){var r;if(!Qd(t)||(r=tr(t)).type!==e)throw new ga("Incompatible receiver, "+e+" required");return r}};if(qd||En.state){var be=En.state||(En.state=new nh);be.get=be.get,be.has=be.has,be.set=be.set,Dr=function(e,t){if(be.has(e))throw new ga(ro);return t.facade=e,be.set(e,t),t},tr=function(e){return be.get(e)||{}},Mr=function(e){return be.has(e)}}else{var ot=th("state");rh[ot]=!0,Dr=function(e,t){if(Tn(e,ot))throw new ga(ro);return t.facade=e,eh(e,ot,t),t},tr=function(e){return Tn(e,ot)?e[ot]:{}},Mr=function(e){return Tn(e,ot)}}var or={set:Dr,get:tr,has:Mr,enforce:ah,getterFor:ih},Qa={},ei={},jc={}.propertyIsEnumerable,Ac=Object.getOwnPropertyDescriptor,oh=Ac&&!jc.call({1:2},1);ei.f=oh?function(t){var r=Ac(this,t);return!!r&&r.enumerable}:jc;var sh=J,ch=Pe,uh=ei,lh=ir,fh=nr,dh=Pc,hh=we,vh=Sc,no=Object.getOwnPropertyDescriptor;Qa.f=sh?no:function(t,r){if(t=fh(t),r=dh(r),vh)try{return no(t,r)}catch{}if(hh(t,r))return lh(!ch(uh.f,t,r),t[r])};var Lc={exports:{}},ya=J,ph=we,Uc=Function.prototype,mh=ya&&Object.getOwnPropertyDescriptor,ti=ph(Uc,"name"),gh=ti&&(function(){}).name==="something",yh=ti&&(!ya||ya&&mh(Uc,"name").configurable),xc={EXISTS:ti,PROPER:gh,CONFIGURABLE:yh},wh=K,bh=Y,wa=Ga,Sh=wh(Function.toString);bh(wa.inspectSource)||(wa.inspectSource=function(e){return Sh(e)});var Nc=wa.inspectSource,ri=K,Ih=ne,$h=Y,vr=we,ba=J,kh=xc.CONFIGURABLE,Ph=Nc,Dc=or,Th=Dc.enforce,Eh=Dc.get,ao=String,jr=Object.defineProperty,Oh=ri("".slice),_h=ri("".replace),Rh=ri([].join),Ch=ba&&!Ih(function(){return jr(function(){},"length",{value:8}).length!==8}),jh=String(String).split("String"),Ah=Lc.exports=function(e,t,r){Oh(ao(t),0,7)==="Symbol("&&(t="["+_h(ao(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!vr(e,"name")||kh&&e.name!==t)&&(ba?jr(e,"name",{value:t,configurable:!0}):e.name=t),Ch&&r&&vr(r,"arity")&&e.length!==r.arity&&jr(e,"length",{value:r.arity});try{r&&vr(r,"constructor")&&r.constructor?ba&&jr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=Th(e);return vr(n,"source")||(n.source=Rh(jh,typeof t=="string"?t:"")),e};Function.prototype.toString=Ah(function(){return $h(this)&&Eh(this).source||Ph(this)},"toString");var Mc=Lc.exports,Lh=Y,Uh=ke,xh=Mc,Nh=Ka,He=function(e,t,r,n){n||(n={});var a=n.enumerable,i=n.name!==void 0?n.name:t;if(Lh(r)&&xh(r,i,n),n.global)a?e[t]=r:Nh(t,r);else{try{n.unsafe?e[t]&&(a=!0):delete e[t]}catch{}a?e[t]=r:Uh.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Fc={},Dh=Ec,Mh=Ja,Fh=Mh.concat("length","prototype");Fc.f=Object.getOwnPropertyNames||function(t){return Dh(t,Fh)};var ni={};ni.f=Object.getOwnPropertySymbols;var zh=Ot,Hh=K,Bh=Fc,Kh=ni,Gh=ze,Wh=Hh([].concat),Vh=zh("Reflect","ownKeys")||function(t){var r=Bh.f(Gh(t)),n=Kh.f;return n?Wh(r,n(t)):r},io=we,Zh=Vh,Yh=Qa,Jh=ke,Xh=function(e,t,r){for(var n=Zh(t),a=Jh.f,i=Yh.f,o=0;o<n.length;o++){var c=n[o];!io(e,c)&&!(r&&io(r,c))&&a(e,c,i(t,c))}},qh=ne,Qh=Y,ev=/#|\.prototype\./,sr=function(e,t){var r=rv[tv(e)];return r===av?!0:r===nv?!1:Qh(t)?qh(t):!!t},tv=sr.normalize=function(e){return String(e).replace(ev,".").toLowerCase()},rv=sr.data={},nv=sr.NATIVE="N",av=sr.POLYFILL="P",iv=sr,pr=Q,ov=Qa.f,sv=qr,cv=He,uv=Ka,lv=Xh,fv=iv,_t=function(e,t){var r=e.target,n=e.global,a=e.stat,i,o,c,l,f,u;if(n?o=pr:a?o=pr[r]||uv(r,{}):o=pr[r]&&pr[r].prototype,o)for(c in t){if(f=t[c],e.dontCallGetSet?(u=ov(o,c),l=u&&u.value):l=o[c],i=fv(n?c:r+(a?".":"#")+c,e.forced),!i&&l!==void 0){if(typeof f==typeof l)continue;lv(f,l)}(e.sham||l&&l.sham)&&sv(f,"sham",!0),cv(o,c,f,e)}},dv=ne,hv=!dv(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),vv=we,pv=Y,mv=Jr,gv=Xa,yv=hv,oo=gv("IE_PROTO"),Sa=Object,wv=Sa.prototype,zc=yv?Sa.getPrototypeOf:function(e){var t=mv(e);if(vv(t,oo))return t[oo];var r=t.constructor;return pv(r)&&t instanceof r?r.prototype:t instanceof Sa?wv:null},bv=ne,Sv=Y,Iv=Ce,so=zc,$v=He,kv=de,Ia=kv("iterator"),Hc=!1,tt,On,_n;[].keys&&(_n=[].keys(),"next"in _n?(On=so(so(_n)),On!==Object.prototype&&(tt=On)):Hc=!0);var Pv=!Iv(tt)||bv(function(){var e={};return tt[Ia].call(e)!==e});Pv&&(tt={});Sv(tt[Ia])||$v(tt,Ia,function(){return this});var Bc={IteratorPrototype:tt,BUGGY_SAFARI_ITERATORS:Hc},Tv=ke.f,Ev=we,Ov=de,co=Ov("toStringTag"),cr=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Ev(e,co)&&Tv(e,co,{configurable:!0,value:t})},_v=Bc.IteratorPrototype,Rv=qa,Cv=ir,jv=cr,Av=ar,Lv=function(){return this},Kc=function(e,t,r,n){var a=t+" Iterator";return e.prototype=Rv(_v,{next:Cv(+!n,r)}),jv(e,a,!1),Av[a]=Lv,e},Uv=K,xv=Xr,Nv=function(e,t,r){try{return Uv(xv(Object.getOwnPropertyDescriptor(e,t)[r]))}catch{}},Dv=Ce,Mv=function(e){return Dv(e)||e===null},Fv=Mv,zv=String,Hv=TypeError,Bv=function(e){if(Fv(e))return e;throw new Hv("Can't set "+zv(e)+" as a prototype")},Kv=Nv,Gv=Ce,Wv=Yr,Vv=Bv,Zv=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=Kv(Object.prototype,"__proto__","set"),r(t,[]),e=t instanceof Array}catch{}return function(a,i){return Wv(a),Vv(i),Gv(a)&&(e?r(a,i):a.__proto__=i),a}}():void 0),Yv=_t,Jv=Pe,Gc=xc,Xv=Y,qv=Kc,uo=zc,lo=Zv,Qv=cr,ep=qr,Rn=He,tp=de,rp=ar,Wc=Bc,np=Gc.PROPER,ap=Gc.CONFIGURABLE,fo=Wc.IteratorPrototype,mr=Wc.BUGGY_SAFARI_ITERATORS,Ut=tp("iterator"),ho="keys",xt="values",vo="entries",ip=function(){return this},Vc=function(e,t,r,n,a,i,o){qv(r,t,n);var c=function($){if($===a&&d)return d;if(!mr&&$&&$ in u)return u[$];switch($){case ho:return function(){return new r(this,$)};case xt:return function(){return new r(this,$)};case vo:return function(){return new r(this,$)}}return function(){return new r(this)}},l=t+" Iterator",f=!1,u=e.prototype,s=u[Ut]||u["@@iterator"]||a&&u[a],d=!mr&&s||c(a),h=t==="Array"&&u.entries||s,m,S,g;if(h&&(m=uo(h.call(new e)),m!==Object.prototype&&m.next&&(uo(m)!==fo&&(lo?lo(m,fo):Xv(m[Ut])||Rn(m,Ut,ip)),Qv(m,l,!0))),np&&a===xt&&s&&s.name!==xt&&(ap?ep(u,"name",xt):(f=!0,d=function(){return Jv(s,this)})),a)if(S={values:c(xt),keys:i?d:c(ho),entries:c(vo)},o)for(g in S)(mr||f||!(g in u))&&Rn(u,g,S[g]);else Yv({target:t,proto:!0,forced:mr||f},S);return u[Ut]!==d&&Rn(u,Ut,d,{name:a}),rp[t]=d,S},ai=function(e,t){return{value:e,done:t}},op=nr,ii=Gd,po=ar,Zc=or,sp=ke.f,cp=Vc,gr=ai,up=J,Yc="Array Iterator",lp=Zc.set,fp=Zc.getterFor(Yc),dp=cp(Array,"Array",function(e,t){lp(this,{type:Yc,target:op(e),index:0,kind:t})},function(){var e=fp(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=void 0,gr(void 0,!0);switch(e.kind){case"keys":return gr(r,!1);case"values":return gr(t[r],!1)}return gr([r,t[r]],!1)},"values"),mo=po.Arguments=po.Array;ii("keys");ii("values");ii("entries");if(up&&mo.name!=="values")try{sp(mo,"name",{value:"values"})}catch{}var go=Q,hp=J,vp=Object.getOwnPropertyDescriptor,pp=function(e){if(!hp)return go[e];var t=vp(go,e);return t&&t.value},mp=ne,gp=de,yp=J,yo=Hl,wp=gp("iterator"),Qr=!mp(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),yo&&(!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b"))||!t.size&&(yo||!yp)||!t.sort||e.href!=="http://a/c%20d?a=1&c=3"||t.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!t[wp]||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"}),wo=Mc,bp=ke,oi=function(e,t,r){return r.get&&wo(r.get,t,{getter:!0}),r.set&&wo(r.set,t,{setter:!0}),bp.f(e,t,r)},Sp=He,Ip=function(e,t,r){for(var n in t)Sp(e,n,t[n],r);return e},$p=Ic,kp=TypeError,Jc=function(e,t){if($p(t,e))return e;throw new kp("Incorrect invocation")},Pp=Ha,Tp=K,Ep=function(e){if(Pp(e)==="Function")return Tp(e)},bo=Ep,Op=Xr,_p=za,Rp=bo(bo.bind),si=function(e,t){return Op(e),t===void 0?e:_p?Rp(e,t):function(){return e.apply(t,arguments)}},Cp=de,jp=Cp("toStringTag"),Xc={};Xc[jp]="z";var Ap=String(Xc)==="[object z]",Lp=Ap,Up=Y,Ar=Ha,xp=de,Np=xp("toStringTag"),Dp=Object,Mp=Ar(function(){return arguments}())==="Arguments",Fp=function(e,t){try{return e[t]}catch{}},en=Lp?Ar:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Fp(t=Dp(e),Np))=="string"?r:Mp?Ar(t):(n=Ar(t))==="Object"&&Up(t.callee)?"Arguments":n},zp=en,Hp=String,Be=function(e){if(zp(e)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return Hp(e)},Bp=en,So=Va,Kp=Ba,Gp=ar,Wp=de,Vp=Wp("iterator"),ci=function(e){if(!Kp(e))return So(e,Vp)||So(e,"@@iterator")||Gp[Bp(e)]},Zp=Pe,Yp=Xr,Jp=ze,Xp=kc,qp=ci,Qp=TypeError,qc=function(e,t){var r=arguments.length<2?qp(e):t;if(Yp(r))return Jp(Zp(r,e));throw new Qp(Xp(e)+" is not iterable")},em=TypeError,Rt=function(e,t){if(e<t)throw new em("Not enough arguments");return e},tm=K,Qc=tm([].slice),Io=Qc,rm=Math.floor,$a=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=rm(r/2),c=$a(Io(e,0,o),t),l=$a(Io(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},nm=$a,ka=_t,tn=Q,ui=pp,yr=Pe,$e=K,Vt=J,eu=Qr,tu=He,am=oi,im=Ip,om=cr,sm=Kc,li=or,ru=Jc,Cn=Y,cm=we,um=si,lm=en,fm=ze,nu=Ce,q=Be,dm=qa,$o=ir,ko=qc,hm=ci,wr=ai,st=Rt,vm=de,pm=nm,mm=vm("iterator"),Ct="URLSearchParams",au=Ct+"Iterator",iu=li.set,le=li.getterFor(Ct),gm=li.getterFor(au),Po=ui("fetch"),Fr=ui("Request"),Zt=ui("Headers"),jn=Fr&&Fr.prototype,To=Zt&&Zt.prototype,ym=tn.RegExp,wm=tn.TypeError,ou=tn.decodeURIComponent,bm=tn.encodeURIComponent,Sm=$e("".charAt),Eo=$e([].join),Je=$e([].push),Pa=$e("".replace),Im=$e([].shift),Oo=$e([].splice),_o=$e("".split),$m=$e("".slice),km=/\+/g,Ro=Array(4),Pm=function(e){return Ro[e-1]||(Ro[e-1]=ym("((?:%[\\da-f]{2}){"+e+"})","gi"))},Tm=function(e){try{return ou(e)}catch{return e}},Co=function(e){var t=Pa(e,km," "),r=4;try{return ou(t)}catch{for(;r;)t=Pa(t,Pm(r--),Tm);return t}},Em=/[!'()~]|%20/g,Om={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},_m=function(e){return Om[e]},jo=function(e){return Pa(bm(e),Em,_m)},An=sm(function(t,r){iu(this,{type:au,target:le(t).entries,index:0,kind:r})},Ct,function(){var t=gm(this),r=t.target,n=t.index++;if(!r||n>=r.length)return t.target=void 0,wr(void 0,!0);var a=r[n];switch(t.kind){case"keys":return wr(a.key,!1);case"values":return wr(a.value,!1)}return wr([a.key,a.value],!1)},!0),su=function(e){this.entries=[],this.url=null,e!==void 0&&(nu(e)?this.parseObject(e):this.parseQuery(typeof e=="string"?Sm(e,0)==="?"?$m(e,1):e:q(e)))};su.prototype={type:Ct,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t=this.entries,r=hm(e),n,a,i,o,c,l,f;if(r)for(n=ko(e,r),a=n.next;!(i=yr(a,n)).done;){if(o=ko(fm(i.value)),c=o.next,(l=yr(c,o)).done||(f=yr(c,o)).done||!yr(c,o).done)throw new wm("Expected sequence with length 2");Je(t,{key:q(l.value),value:q(f.value)})}else for(var u in e)cm(e,u)&&Je(t,{key:u,value:q(e[u])})},parseQuery:function(e){if(e)for(var t=this.entries,r=_o(e,"&"),n=0,a,i;n<r.length;)a=r[n++],a.length&&(i=_o(a,"="),Je(t,{key:Co(Im(i)),value:Co(Eo(i,"="))}))},serialize:function(){for(var e=this.entries,t=[],r=0,n;r<e.length;)n=e[r++],Je(t,jo(n.key)+"="+jo(n.value));return Eo(t,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var rn=function(){ru(this,St);var t=arguments.length>0?arguments[0]:void 0,r=iu(this,new su(t));Vt||(this.size=r.entries.length)},St=rn.prototype;im(St,{append:function(t,r){var n=le(this);st(arguments.length,2),Je(n.entries,{key:q(t),value:q(r)}),Vt||this.length++,n.updateURL()},delete:function(e){for(var t=le(this),r=st(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(Oo(n,c,1),o!==void 0)break}else c++}Vt||(this.size=n.length),t.updateURL()},get:function(t){var r=le(this).entries;st(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=le(this).entries;st(arguments.length,1);for(var n=q(t),a=[],i=0;i<r.length;i++)r[i].key===n&&Je(a,r[i].value);return a},has:function(t){for(var r=le(this).entries,n=st(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=le(this);st(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?Oo(a,l--,1):(i=!0,f.value=c));i||Je(a,{key:o,value:c}),Vt||(this.size=a.length),n.updateURL()},sort:function(){var t=le(this);pm(t.entries,function(r,n){return r.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var r=le(this).entries,n=um(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 An(this,"keys")},values:function(){return new An(this,"values")},entries:function(){return new An(this,"entries")}},{enumerable:!0});tu(St,mm,St.entries,{name:"entries"});tu(St,"toString",function(){return le(this).serialize()},{enumerable:!0});Vt&&am(St,"size",{get:function(){return le(this).entries.length},configurable:!0,enumerable:!0});om(rn,Ct);ka({global:!0,constructor:!0,forced:!eu},{URLSearchParams:rn});if(!eu&&Cn(Zt)){var Rm=$e(To.has),Cm=$e(To.set),Ao=function(e){if(nu(e)){var t=e.body,r;if(lm(t)===Ct)return r=e.headers?new Zt(e.headers):new Zt,Rm(r,"content-type")||Cm(r,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),dm(e,{body:$o(0,q(t)),headers:$o(0,r)})}return e};if(Cn(Po)&&ka({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return Po(t,arguments.length>1?Ao(arguments[1]):{})}}),Cn(Fr)){var Ln=function(t){return ru(this,jn),new Fr(t,arguments.length>1?Ao(arguments[1]):{})};jn.constructor=Ln,Ln.prototype=jn,ka({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ln})}}var jm={URLSearchParams:rn,getState:le},Am=He,nn=K,Lo=Be,Lm=Rt,cu=URLSearchParams,an=cu.prototype,Um=nn(an.append),Uo=nn(an.delete),xm=nn(an.forEach),Nm=nn([].push),fi=new cu("a=1&a=2&b=3");fi.delete("a",1);fi.delete("b",void 0);fi+""!="a=2"&&Am(an,"delete",function(e){var t=arguments.length,r=t<2?void 0:arguments[1];if(t&&r===void 0)return Uo(this,e);var n=[];xm(this,function(s,d){Nm(n,{key:d,value:s})}),Lm(t,1);for(var a=Lo(e),i=Lo(r),o=0,c=0,l=!1,f=n.length,u;o<f;)u=n[o++],l||u.key===a?(l=!0,Uo(this,u.key)):c++;for(;c<f;)u=n[c++],u.key===a&&u.value===i||Um(this,u.key,u.value)},{enumerable:!0,unsafe:!0});var Dm=He,uu=K,Mm=Be,Fm=Rt,lu=URLSearchParams,di=lu.prototype,zm=uu(di.getAll),Hm=uu(di.has),xo=new lu("a=1");(xo.has("a",2)||!xo.has("a",void 0))&&Dm(di,"has",function(t){var r=arguments.length,n=r<2?void 0:arguments[1];if(r&&n===void 0)return Hm(this,t);var a=zm(this,t);Fm(r,1);for(var i=Mm(n),o=0;o<a.length;)if(a[o++]===i)return!0;return!1},{enumerable:!0,unsafe:!0});var Bm=J,Km=K,Gm=oi,Ta=URLSearchParams.prototype,Wm=Km(Ta.forEach);Bm&&!("size"in Ta)&&Gm(Ta,"size",{get:function(){var t=0;return Wm(this,function(){t++}),t},configurable:!0,enumerable:!0});var Vm=Q,fu=Vm,Zm=fu;Zm.URLSearchParams;var hi=K,Ym=Za,Jm=Be,Xm=Yr,qm=hi("".charAt),No=hi("".charCodeAt),Qm=hi("".slice),Do=function(e){return function(t,r){var n=Jm(Xm(t)),a=Ym(r),i=n.length,o,c;return a<0||a>=i?e?"":void 0:(o=No(n,a),o<55296||o>56319||a+1===i||(c=No(n,a+1))<56320||c>57343?e?qm(n,a):o:e?Qm(n,a,a+2):(o-55296<<10)+(c-56320)+65536)}},du={codeAt:Do(!1),charAt:Do(!0)},eg=du.charAt,tg=Be,hu=or,rg=Vc,Mo=ai,vu="String Iterator",ng=hu.set,ag=hu.getterFor(vu);rg(String,"String",function(e){ng(this,{type:vu,string:tg(e),index:0})},function(){var t=ag(this),r=t.string,n=t.index,a;return n>=r.length?Mo(void 0,!0):(a=eg(r,n),t.index+=a.length,Mo(a,!1))});var Fo=J,ig=K,og=Pe,sg=ne,Un=Oc,cg=ni,ug=ei,lg=Jr,fg=dc,ct=Object.assign,zo=Object.defineProperty,dg=ig([].concat),hg=!ct||sg(function(){if(Fo&&ct({b:1},ct(zo({},"a",{enumerable:!0,get:function(){zo(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}),ct({},e)[r]!==7||Un(ct({},t)).join("")!==n})?function(t,r){for(var n=lg(t),a=arguments.length,i=1,o=cg.f,c=ug.f;a>i;)for(var l=fg(arguments[i++]),f=o?dg(Un(l),o(l)):Un(l),u=f.length,s=0,d;u>s;)d=f[s++],(!Fo||og(c,l,d))&&(n[d]=l[d]);return n}:ct,vg=Pe,Ho=ze,pg=Va,mg=function(e,t,r){var n,a;Ho(e);try{if(n=pg(e,"return"),!n){if(t==="throw")throw r;return r}n=vg(n,e)}catch(i){a=!0,n=i}if(t==="throw")throw r;if(a)throw n;return Ho(n),r},gg=ze,yg=mg,wg=function(e,t,r,n){try{return n?t(gg(r)[0],r[1]):t(r)}catch(a){yg(e,"throw",a)}},bg=de,Sg=ar,Ig=bg("iterator"),$g=Array.prototype,kg=function(e){return e!==void 0&&(Sg.Array===e||$g[Ig]===e)},Pg=K,Tg=ne,pu=Y,Eg=en,Og=Ot,_g=Nc,mu=function(){},gu=Og("Reflect","construct"),vi=/^\s*(?:class|function)\b/,Rg=Pg(vi.exec),Cg=!vi.test(mu),Nt=function(t){if(!pu(t))return!1;try{return gu(mu,[],t),!0}catch{return!1}},yu=function(t){if(!pu(t))return!1;switch(Eg(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Cg||!!Rg(vi,_g(t))}catch{return!0}};yu.sham=!0;var jg=!gu||Tg(function(){var e;return Nt(Nt.call)||!Nt(Object)||!Nt(function(){e=!0})||e})?yu:Nt,Ag=J,Lg=ke,Ug=ir,xg=function(e,t,r){Ag?Lg.f(e,t,Ug(0,r)):e[t]=r},Ng=si,Dg=Pe,Mg=Jr,Fg=wg,zg=kg,Hg=jg,Bg=Tc,Bo=xg,Kg=qc,Gg=ci,Ko=Array,Wg=function(t){var r=Mg(t),n=Hg(this),a=arguments.length,i=a>1?arguments[1]:void 0,o=i!==void 0;o&&(i=Ng(i,a>2?arguments[2]:void 0));var c=Gg(r),l=0,f,u,s,d,h,m;if(c&&!(this===Ko&&zg(c)))for(u=n?new this:[],d=Kg(r,c),h=d.next;!(s=Dg(h,d)).done;l++)m=o?Fg(d,i,[s.value,l],!0):s.value,Bo(u,l,m);else for(f=Bg(r),u=n?new this(f):Ko(f);f>l;l++)m=o?i(r[l],l):r[l],Bo(u,l,m);return u.length=l,u},it=K,xn=2147483647,Yt=36,wu=1,Ea=26,Vg=38,Zg=700,Yg=72,Jg=128,Xg="-",qg=/[^\0-\u007E]/,bu=/[.\u3002\uFF0E\uFF61]/g,Go="Overflow: input needs wider integers to process",Nn=Yt-wu,Wo=RangeError,Qg=it(bu.exec),pt=Math.floor,Dn=String.fromCharCode,Vo=it("".charCodeAt),Su=it([].join),Ne=it([].push),ey=it("".replace),ty=it("".split),ry=it("".toLowerCase),ny=function(e){for(var t=[],r=0,n=e.length;r<n;){var a=Vo(e,r++);if(a>=55296&&a<=56319&&r<n){var i=Vo(e,r++);(i&64512)===56320?Ne(t,((a&1023)<<10)+(i&1023)+65536):(Ne(t,a),r--)}else Ne(t,a)}return t},Zo=function(e){return e+22+75*(e<26)},ay=function(e,t,r){var n=0;for(e=r?pt(e/Zg):e>>1,e+=pt(e/t);e>Nn*Ea>>1;)e=pt(e/Nn),n+=Yt;return pt(n+(Nn+1)*e/(e+Vg))},iy=function(e){var t=[];e=ny(e);var r=e.length,n=Jg,a=0,i=Yg,o,c;for(o=0;o<e.length;o++)c=e[o],c<128&&Ne(t,Dn(c));var l=t.length,f=l;for(l&&Ne(t,Xg);f<r;){var u=xn;for(o=0;o<e.length;o++)c=e[o],c>=n&&c<u&&(u=c);var s=f+1;if(u-n>pt((xn-a)/s))throw new Wo(Go);for(a+=(u-n)*s,n=u,o=0;o<e.length;o++){if(c=e[o],c<n&&++a>xn)throw new Wo(Go);if(c===n){for(var d=a,h=Yt;;){var m=h<=i?wu:h>=i+Ea?Ea:h-i;if(d<m)break;var S=d-m,g=Yt-m;Ne(t,Dn(Zo(m+S%g))),d=pt(S/g),h+=Yt}Ne(t,Dn(Zo(d))),i=ay(a,s,f===l),a=0,f++}}a++,n++}return Su(t,"")},oy=function(e){var t=[],r=ty(ey(ry(e),bu,"."),"."),n,a;for(n=0;n<r.length;n++)a=r[n],Ne(t,Qg(qg,a)?"xn--"+iy(a):a);return Su(t,".")},sy=_t,pi=J,cy=Qr,mi=Q,Yo=si,he=K,zr=He,se=oi,uy=Jc,Oa=we,gi=hg,ut=Wg,ve=Qc,ly=du.codeAt,fy=oy,Ee=Be,dy=cr,hy=Rt,Iu=jm,$u=or,vy=$u.set,Hr=$u.getterFor("URL"),py=Iu.URLSearchParams,my=Iu.getState,Dt=mi.URL,_a=mi.TypeError,Br=mi.parseInt,gy=Math.floor,Jo=Math.pow,fe=he("".charAt),ge=he(/./.exec),Bt=he([].join),yy=he(1 .toString),wy=he([].pop),dt=he([].push),Mn=he("".replace),by=he([].shift),Sy=he("".split),Jt=he("".slice),Kr=he("".toLowerCase),Iy=he([].unshift),$y="Invalid authority",Fn="Invalid scheme",Ge="Invalid host",Xo="Invalid port",ku=/[a-z]/i,ky=/[\d+-.a-z]/i,Ra=/\d/,Py=/^0x/i,Ty=/^[0-7]+$/,Ey=/^\d+$/,Pu=/^[\da-f]+$/i,Oy=/[\0\t\n\r #%/:<>?@[\\\]^|]/,_y=/[\0\t\n\r #/:<>?@[\\\]^|]/,Ry=/^[\u0000-\u0020]+/,Cy=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,jy=/[\t\n\r]/g,ce,Ay=function(e){var t=Sy(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&&fe(i,0)==="0"&&(o=ge(Py,i)?16:8,i=Jt(i,o===8?1:2)),i==="")c=0;else{if(!ge(o===10?Ey:o===8?Ty:Pu,i))return e;c=Br(i,o)}dt(n,c)}for(a=0;a<r;a++)if(c=n[a],a===r-1){if(c>=Jo(256,5-r))return null}else if(c>255)return null;for(l=wy(n),a=0;a<n.length;a++)l+=n[a]*Jo(256,3-a);return l},Ly=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 fe(e,a)};if(d()===":"){if(fe(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(Pu,d());)i=i*16+Br(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(Ra,d()))return;for(;ge(Ra,d());){if(f=Br(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},Uy=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},Mt=function(e){var t,r,n,a;if(typeof e=="number"){for(t=[],r=0;r<4;r++)Iy(t,e%256),e=gy(e/256);return Bt(t,".")}else if(typeof e=="object"){for(t="",n=Uy(e),r=0;r<8;r++)a&&e[r]===0||(a&&(a=!1),n===r?(t+=r?":":"::",a=!0):(t+=yy(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},Lr={},Tu=gi({},Lr,{" ":1,'"':1,"<":1,">":1,"`":1}),Eu=gi({},Tu,{"#":1,"?":1,"{":1,"}":1}),zn=gi({},Eu,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ae=function(e,t){var r=ly(e,0);return r>32&&r<127&&!Oa(t,e)?e:encodeURIComponent(e)},br={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Kt=function(e,t){var r;return e.length===2&&ge(ku,fe(e,0))&&((r=fe(e,1))===":"||!t&&r==="|")},qo=function(e){var t;return e.length>1&&Kt(Jt(e,0,2))&&(e.length===2||(t=fe(e,2))==="/"||t==="\\"||t==="?"||t==="#")},xy=function(e){return e==="."||Kr(e)==="%2e"},Ny=function(e){return e=Kr(e),e===".."||e==="%2e."||e===".%2e"||e==="%2e%2e"},Hn={},Qo={},Bn={},es={},ts={},Kn={},rs={},ns={},Sr={},Ir={},Gn={},Wn={},Vn={},Zn={},as={},Yn={},lt={},Se={},is={},We={},Te={},yi=function(e,t,r){var n=Ee(e),a,i,o;if(t){if(i=this.parse(n),i)throw new _a(i);this.searchParams=null}else{if(r!==void 0&&(a=new yi(r,!0)),i=this.parse(n,null,a),i)throw new _a(i);o=my(new py),o.bindURL(this),this.searchParams=o}};yi.prototype={type:"URL",parse:function(e,t,r){var n=this,a=t||Hn,i=0,o="",c=!1,l=!1,f=!1,u,s,d,h;for(e=Ee(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=Mn(e,Ry,""),e=Mn(e,Cy,"$1")),e=Mn(e,jy,""),u=ut(e);i<=u.length;){switch(s=u[i],a){case Hn:if(s&&ge(ku,s))o+=Kr(s),a=Qo;else{if(t)return Fn;a=Bn;continue}break;case Qo:if(s&&(ge(ky,s)||s==="+"||s==="-"||s==="."))o+=Kr(s);else if(s===":"){if(t&&(n.isSpecial()!==Oa(br,o)||o==="file"&&(n.includesCredentials()||n.port!==null)||n.scheme==="file"&&!n.host))return;if(n.scheme=o,t){n.isSpecial()&&br[n.scheme]===n.port&&(n.port=null);return}o="",n.scheme==="file"?a=Zn:n.isSpecial()&&r&&r.scheme===n.scheme?a=es:n.isSpecial()?a=ns:u[i+1]==="/"?(a=ts,i++):(n.cannotBeABaseURL=!0,dt(n.path,""),a=is)}else{if(t)return Fn;o="",a=Bn,i=0;continue}break;case Bn:if(!r||r.cannotBeABaseURL&&s!=="#")return Fn;if(r.cannotBeABaseURL&&s==="#"){n.scheme=r.scheme,n.path=ve(r.path),n.query=r.query,n.fragment="",n.cannotBeABaseURL=!0,a=Te;break}a=r.scheme==="file"?Zn:Kn;continue;case es:if(s==="/"&&u[i+1]==="/")a=Sr,i++;else{a=Kn;continue}break;case ts:if(s==="/"){a=Ir;break}else{a=Se;continue}case Kn:if(n.scheme=r.scheme,s===ce)n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=ve(r.path),n.query=r.query;else if(s==="/"||s==="\\"&&n.isSpecial())a=rs;else if(s==="?")n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=ve(r.path),n.query="",a=We;else if(s==="#")n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=ve(r.path),n.query=r.query,n.fragment="",a=Te;else{n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=ve(r.path),n.path.length--,a=Se;continue}break;case rs:if(n.isSpecial()&&(s==="/"||s==="\\"))a=Sr;else if(s==="/")a=Ir;else{n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,a=Se;continue}break;case ns:if(a=Sr,s!=="/"||fe(o,i+1)!=="/")continue;i++;break;case Sr:if(s!=="/"&&s!=="\\"){a=Ir;continue}break;case Ir:if(s==="@"){c&&(o="%40"+o),c=!0,d=ut(o);for(var m=0;m<d.length;m++){var S=d[m];if(S===":"&&!f){f=!0;continue}var g=Ae(S,zn);f?n.password+=g:n.username+=g}o=""}else if(s===ce||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()){if(c&&o==="")return $y;i-=ut(o).length+1,o="",a=Gn}else o+=s;break;case Gn:case Wn:if(t&&n.scheme==="file"){a=Yn;continue}else if(s===":"&&!l){if(o==="")return Ge;if(h=n.parseHost(o),h)return h;if(o="",a=Vn,t===Wn)return}else if(s===ce||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()){if(n.isSpecial()&&o==="")return Ge;if(t&&o===""&&(n.includesCredentials()||n.port!==null))return;if(h=n.parseHost(o),h)return h;if(o="",a=lt,t)return;continue}else s==="["?l=!0:s==="]"&&(l=!1),o+=s;break;case Vn:if(ge(Ra,s))o+=s;else if(s===ce||s==="/"||s==="?"||s==="#"||s==="\\"&&n.isSpecial()||t){if(o!==""){var $=Br(o,10);if($>65535)return Xo;n.port=n.isSpecial()&&$===br[n.scheme]?null:$,o=""}if(t)return;a=lt;continue}else return Xo;break;case Zn:if(n.scheme="file",s==="/"||s==="\\")a=as;else if(r&&r.scheme==="file")switch(s){case ce:n.host=r.host,n.path=ve(r.path),n.query=r.query;break;case"?":n.host=r.host,n.path=ve(r.path),n.query="",a=We;break;case"#":n.host=r.host,n.path=ve(r.path),n.query=r.query,n.fragment="",a=Te;break;default:qo(Bt(ve(u,i),""))||(n.host=r.host,n.path=ve(r.path),n.shortenPath()),a=Se;continue}else{a=Se;continue}break;case as:if(s==="/"||s==="\\"){a=Yn;break}r&&r.scheme==="file"&&!qo(Bt(ve(u,i),""))&&(Kt(r.path[0],!0)?dt(n.path,r.path[0]):n.host=r.host),a=Se;continue;case Yn:if(s===ce||s==="/"||s==="\\"||s==="?"||s==="#"){if(!t&&Kt(o))a=Se;else if(o===""){if(n.host="",t)return;a=lt}else{if(h=n.parseHost(o),h)return h;if(n.host==="localhost"&&(n.host=""),t)return;o="",a=lt}continue}else o+=s;break;case lt:if(n.isSpecial()){if(a=Se,s!=="/"&&s!=="\\")continue}else if(!t&&s==="?")n.query="",a=We;else if(!t&&s==="#")n.fragment="",a=Te;else if(s!==ce&&(a=Se,s!=="/"))continue;break;case Se:if(s===ce||s==="/"||s==="\\"&&n.isSpecial()||!t&&(s==="?"||s==="#")){if(Ny(o)?(n.shortenPath(),s!=="/"&&!(s==="\\"&&n.isSpecial())&&dt(n.path,"")):xy(o)?s!=="/"&&!(s==="\\"&&n.isSpecial())&&dt(n.path,""):(n.scheme==="file"&&!n.path.length&&Kt(o)&&(n.host&&(n.host=""),o=fe(o,0)+":"),dt(n.path,o)),o="",n.scheme==="file"&&(s===ce||s==="?"||s==="#"))for(;n.path.length>1&&n.path[0]==="";)by(n.path);s==="?"?(n.query="",a=We):s==="#"&&(n.fragment="",a=Te)}else o+=Ae(s,Eu);break;case is:s==="?"?(n.query="",a=We):s==="#"?(n.fragment="",a=Te):s!==ce&&(n.path[0]+=Ae(s,Lr));break;case We:!t&&s==="#"?(n.fragment="",a=Te):s!==ce&&(s==="'"&&n.isSpecial()?n.query+="%27":s==="#"?n.query+="%23":n.query+=Ae(s,Lr));break;case Te:s!==ce&&(n.fragment+=Ae(s,Tu));break}i++}},parseHost:function(e){var t,r,n;if(fe(e,0)==="["){if(fe(e,e.length-1)!=="]"||(t=Ly(Jt(e,1,-1)),!t))return Ge;this.host=t}else if(this.isSpecial()){if(e=fy(e),ge(Oy,e)||(t=Ay(e),t===null))return Ge;this.host=t}else{if(ge(_y,e))return Ge;for(t="",r=ut(e),n=0;n<r.length;n++)t+=Ae(r[n],Lr);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return Oa(br,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;t&&(this.scheme!=="file"||t!==1||!Kt(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+=Mt(a),i!==null&&(f+=":"+i)):t==="file"&&(f+="//"),f+=e.cannotBeABaseURL?o[0]:o.length?"/"+Bt(o,"/"):"",c!==null&&(f+="?"+c),l!==null&&(f+="#"+l),f},setHref:function(e){var t=this.parse(e);if(t)throw new _a(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if(e==="blob")try{return new It(e.path[0]).origin}catch{return"null"}return e==="file"||!this.isSpecial()?"null":e+"://"+Mt(this.host)+(t!==null?":"+t:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Ee(e)+":",Hn)},getUsername:function(){return this.username},setUsername:function(e){var t=ut(Ee(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Ae(t[r],zn)}},getPassword:function(){return this.password},setPassword:function(e){var t=ut(Ee(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Ae(t[r],zn)}},getHost:function(){var e=this.host,t=this.port;return e===null?"":t===null?Mt(e):Mt(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Gn)},getHostname:function(){var e=this.host;return e===null?"":Mt(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Wn)},getPort:function(){var e=this.port;return e===null?"":Ee(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(e=Ee(e),e===""?this.port=null:this.parse(e,Vn))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+Bt(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,lt))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){e=Ee(e),e===""?this.query=null:(fe(e,0)==="?"&&(e=Jt(e,1)),this.query="",this.parse(e,We)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){if(e=Ee(e),e===""){this.fragment=null;return}fe(e,0)==="#"&&(e=Jt(e,1)),this.fragment="",this.parse(e,Te)},update:function(){this.query=this.searchParams.serialize()||null}};var It=function(t){var r=uy(this,X),n=hy(arguments.length,1)>1?arguments[1]:void 0,a=vy(r,new yi(t,!1,n));pi||(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())},X=It.prototype,ue=function(e,t){return{get:function(){return Hr(this)[e]()},set:t&&function(r){return Hr(this)[t](r)},configurable:!0,enumerable:!0}};pi&&(se(X,"href",ue("serialize","setHref")),se(X,"origin",ue("getOrigin")),se(X,"protocol",ue("getProtocol","setProtocol")),se(X,"username",ue("getUsername","setUsername")),se(X,"password",ue("getPassword","setPassword")),se(X,"host",ue("getHost","setHost")),se(X,"hostname",ue("getHostname","setHostname")),se(X,"port",ue("getPort","setPort")),se(X,"pathname",ue("getPathname","setPathname")),se(X,"search",ue("getSearch","setSearch")),se(X,"searchParams",ue("getSearchParams")),se(X,"hash",ue("getHash","setHash")));zr(X,"toJSON",function(){return Hr(this).serialize()},{enumerable:!0});zr(X,"toString",function(){return Hr(this).serialize()},{enumerable:!0});if(Dt){var os=Dt.createObjectURL,ss=Dt.revokeObjectURL;os&&zr(It,"createObjectURL",Yo(os,Dt)),ss&&zr(It,"revokeObjectURL",Yo(ss,Dt))}dy(It,"URL");sy({global:!0,constructor:!0,forced:!cy,sham:!pi},{URL:It});var Dy=_t,My=Ot,Ou=ne,Fy=Rt,cs=Be,zy=Qr,wi=My("URL"),Hy=zy&&Ou(function(){wi.canParse()}),By=Ou(function(){return wi.canParse.length!==1});Dy({target:"URL",stat:!0,forced:!Hy||By},{canParse:function(t){var r=Fy(arguments.length,1),n=cs(t),a=r<2||arguments[1]===void 0?void 0:cs(arguments[1]);try{return!!new wi(n,a)}catch{return!1}}});var Ky=_t,Gy=Ot,Wy=Rt,us=Be,Vy=Qr,Zy=Gy("URL");Ky({target:"URL",stat:!0,forced:!Vy},{parse:function(t){var r=Wy(arguments.length,1),n=us(t),a=r<2||arguments[1]===void 0?void 0:us(arguments[1]);try{return new Zy(n,a)}catch{return null}}});var Yy=_t,Jy=Pe;Yy({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Jy(URL.prototype.toString,this)}});var Xy=fu;Xy.URL;var qy={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},Qy=Wa,Jn=Qy("span").classList,ls=Jn&&Jn.constructor&&Jn.constructor.prototype,ew=ls===Object.prototype?void 0:ls,fs=Q,_u=qy,tw=ew,Gt=dp,ds=qr,rw=cr,nw=de,Xn=nw("iterator"),qn=Gt.values,Ru=function(e,t){if(e){if(e[Xn]!==qn)try{ds(e,Xn,qn)}catch{e[Xn]=qn}if(rw(e,t,!0),_u[t]){for(var r in Gt)if(e[r]!==Gt[r])try{ds(e,r,Gt[r])}catch{e[r]=Gt[r]}}}};for(var Qn in _u)Ru(fs[Qn]&&fs[Qn].prototype,Qn);Ru(tw,"DOMTokenList");function Fe(e,t){const r=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0});dispatchEvent(r)}function Ie(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}var Ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Si(e,t){return e(t={exports:{}},t.exports),t.exports}var Ve=Si(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()}});bi(Ve);var aw=bi(Si(function(e,t){var r=Ze&&Ze.__awaiter||function(u,s,d,h){return new(d||(d=Promise))(function(m,S){function g(b){try{P(h.next(b))}catch(v){S(v)}}function $(b){try{P(h.throw(b))}catch(v){S(v)}}function P(b){b.done?m(b.value):new d(function(v){v(b.value)}).then(g,$)}P((h=h.apply(u,s||[])).next())})},n=Ze&&Ze.__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 $(P){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}}([P,b])}}},a=Ze;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,$,P,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(),(P=g.getItemSync(S))!==null&&(b=JSON.parse(P)).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(P){switch(P.label){case 0:return[4,Ve.default().lock(d)];case 1:return P.sent(),this.acquiredIatSet.has(d)?(S=this.storageHandler===void 0?o:this.storageHandler,(g=S.getItemSync(s))===null?(Ve.default().unlock(d),[2]):(($=JSON.parse(g)).timeRefreshed=Date.now(),S.setItemSync(s,JSON.stringify($)),Ve.default().unlock(d),this.refreshLockWhileAcquired(s,d),[2])):(Ve.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(P),g=!0),!m){m=!0;var b=50-(Date.now()-S);b>0?setTimeout(h,b):h(null)}}window.addEventListener("storage",$),u.addToWaiting($);var P=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,Ve.default().lock(S.iat)];case 1:g.sent(),this.acquiredIatSet.delete(S.iat),d.removeItemSync(h),Ve.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,P=0;P<m.length;P++){var b=m[P];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 iw={timeoutInSeconds:60},Cu={name:"auth0-spa-js",version:"2.1.3"},ju=()=>Date.now();let ae=class Ca extends Error{constructor(t,r){super(r),this.error=t,this.error_description=r,Object.setPrototypeOf(this,Ca.prototype)}static fromPayload({error:t,error_description:r}){return new Ca(t,r)}},ow=class Au extends ae{constructor(t,r,n,a=null){super(t,r),this.state=n,this.appState=a,Object.setPrototypeOf(this,Au.prototype)}},ja=class Lu extends ae{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,Lu.prototype)}},sw=class Uu extends ja{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,Uu.prototype)}},cw=class xu extends ae{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,xu.prototype)}},uw=class Nu extends ae{constructor(t,r,n){super(t,r),this.mfa_token=n,Object.setPrototypeOf(this,Nu.prototype)}},Du=class Mu extends ae{constructor(t,r){super("missing_refresh_token",`Missing Refresh Token (audience: '${hs(t,["default"])}', scope: '${hs(r)}')`),this.audience=t,this.scope=r,Object.setPrototypeOf(this,Mu.prototype)}};function hs(e,t=[]){return e&&!t.includes(e)?e:""}const Ur=()=>window.crypto,ea=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(Ur().getRandomValues(new Uint8Array(43))).forEach(r=>t+=e[r%e.length]),t},vs=e=>btoa(e),Aa=e=>{var{clientId:t}=e,r=Ie(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()},ps=e=>(t=>decodeURIComponent(atob(t).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),lw=async(e,t)=>{const r=await fetch(e,t);return{ok:r.ok,json:await r.json()}},fw=async(e,t,r)=>{const n=new AbortController;let a;return t.signal=n.signal,Promise.race([lw(e,t),new Promise((i,o)=>{a=setTimeout(()=>{n.abort(),o(new Error("Timeout when executing 'fetch'"))},r)})]).finally(()=>{clearTimeout(a)})},dw=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},hw=async(e,t,r,n,a,i,o=1e4)=>a?dw(e,t,r,n,o,a,i):fw(e,n,o);async function vw(e,t){var{baseUrl:r,timeout:n,audience:a,scope:i,auth0Client:o,useFormData:c}=e,l=Ie(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const f=c?Aa(l):JSON.stringify(l);return await async function(u,s,d,h,m,S,g){let $,P=null;for(let C=0;C<3;C++)try{$=await hw(u,d,h,m,S,g,s),P=null;break}catch(M){P=M}if(P)throw P;const b=$.json,{error:v,error_description:I}=b,O=Ie(b,["error","error_description"]),{ok:_}=$;if(!_){const C=I||`HTTP error. Unable to fetch ${u}`;throw v==="mfa_required"?new uw(v,C,O.mfa_token):v==="missing_refresh_token"?new Du(d,h):new ae(v||"request_error",C)}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||Cu))}},t,c)}const $r=(...e)=>{return(t=e.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(t))).join(" ");var t};let Xe=class La{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 La({clientId:n,scope:i,audience:a},r)}static fromCacheEntry(t){const{scope:r,audience:n,client_id:a}=t;return new La({scope:r,audience:n,clientId:a})}},pw=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@@"))}},Fu=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)}}()}},mw=class{constructor(t,r,n){this.cache=t,this.keyManifest=r,this.nowProvider=n||ju}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]}},gw=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 Ft=e=>typeof e=="number",yw=["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"],ww=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(ps(l)),s={__raw:i},d={};return Object.keys(u).forEach(h=>{s[h]=u[h],yw.includes(h)||(d[h]=u[h])}),{encoded:{header:c,payload:l,signature:f},header:JSON.parse(ps(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&&!Ft(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||!Ft(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Ft(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&&Ft(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&&Ft(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=Si(function(e,t){var r=Ze&&Ze.__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}))}});bi(qe),qe.encode,qe.parse,qe.getAll;var bw=qe.get,zu=qe.set,Hu=qe.remove;const ht={get(e){const t=bw(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),zu(e,JSON.stringify(t),n)},remove(e,t){let r={};t!=null&&t.cookieDomain&&(r.domain=t.cookieDomain),Hu(e,r)}},Sw={get(e){return ht.get(e)||ht.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),zu(`_legacy_${e}`,JSON.stringify(t),n),ht.save(e,t,r)},remove(e,t){let r={};t!=null&&t.cookieDomain&&(r.domain=t.cookieDomain),Hu(e,r),ht.remove(e,t),ht.remove(`_legacy_${e}`,t)}},Iw={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 $w(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 ms,gs,ys,ta,kw=(ms="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",gs=null,ys=!1,function(e){return ta=ta||$w(ms,gs,ys),new Worker(ta,e)});const ra={};let Pw=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 Tw={memory:()=>new Fu().enclosedCache,localstorage:()=>new pw},ws=e=>Tw[e],bs=e=>{const{openUrl:t,onRedirect:r}=e,n=Ie(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},n),{openUrl:t===!1||t?t:r})},na=new aw;let Ew=class{constructor(t){let r,n;if(this.userCache=new Fu().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await na.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(!Ur())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(Ur().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
|
-
`)})(),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",!ws(r))throw new Error(`Invalid cache location "${r}"`);n=ws(r)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=t.legacySameSiteCookie===!1?ft:Sw,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:Iw;var i;this.scope=$r("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new gw(a,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||ju,this.cacheManager=new mw(n,n.allKeys?void 0:new Pw(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 kw)}_url(t){const r=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||Cu)));return`${this.domainUrl}${t}&auth0Client=${r}`}_authorizeUrl(t){return this._url(`/authorize?${Aa(t)}`)}async _verifyIdToken(t,r,n){const a=await this.nowProvider();return ww({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=vs(ea()),i=vs(ea()),o=ea(),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 Ur().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:$r(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 cw(c.popup)))},1e3),d=setTimeout(()=>{clearInterval(s),f(new sw(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=bs(t),{openUrl:a,fragment:i,appState:o}=n,c=Se(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=Se(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 ow(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:$r(this.scope,(r=t.authorizationParams)===null||r===void 0?void 0:r.scope)})}),a=await((i,o)=>{let c=ra[o];return c||(c=i().finally(()=>{delete ra[o],c=null}),ra[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=Se(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})(()=>na.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new ja;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 na.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:$r(this.scope,(n=t.authorizationParams)===null||n===void 0?void 0:n.scope)})});return r=Object.assign(Object.assign({},iw),r),await this.loginWithPopup(a,r),(await this.cacheManager.get(new Ye({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=Se(r,["federated"]),i=n?"&federated":"";return this._url(`/v2/logout?${Aa(Object.assign({clientId:t.clientId},a))}`)+i}async logout(t={}){const r=bs(t),{openUrl:n}=r,a=Se(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 ja),v()},1e3*g);I=function(_){if(_.origin!=S||!_.data||_.data.type!=="authorization_response")return;const C=_.source;C&&C.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 Ye({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 Du(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=Se(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 Ye({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 Ye({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 vw(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 Ow(e){const t=new Ew(e);return await t.checkSession(),t}var ge=(e=>(e.READY="sesamyJsReady",e.AUTHENTICATED="sesamyJsAuthenticated",e.LOGOUT="sesamyJsLogout",e.CLEAR_CACHE="sesamyJsClearCache",e.USER_ATTRIBUTE_CHANGED="sesamyUserAttributeChanged",e.PURCHASE="sesamyJsPurchase",e))(ge||{});const _w="sesamy.com",Rw="sesamy.dev",Cw="https://sesa.my",Ua="sesamyCacheTimestamp";function Ae(e,t){return`https://${e}.${t==="dev"?Rw:_w}`}let ae,Bu;const St="sesamyAccessToken",aa="sesamyRefreshToken";async function jw(e){if(!e)return null;const t=localStorage.getItem(aa);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(aa),new Error("Renew token failed");const i=await a.json();return localStorage.setItem(aa,i.refresh_token),localStorage.setItem(St,i.access_token),i.access_token}catch{Ku()}}async function Ii(){const e=localStorage.getItem(St);if(!e)return null;const t=Gu(e);if(!t||!t.exp||t.exp<new Date().getTime()/1e3){const r=await jw(t);if(r)return r;localStorage.removeItem(St)}return e}function Ss(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 Aw(e){if(e.enabled===!1)return;Bu=e.organization;const t={domain:Ae("token",e.environment),clientId:e.clientId,useCookiesForTransactions:!0};if(Ss(window.location.href)!==Ss(Ae("auth",e.environment))&&(t.cacheLocation="localstorage",t.useRefreshTokens=!0),ae=await Ow(t),window.location.search.includes("code="))try{await ae.handleRedirectCallback();const r=await ae.getUser();De(ge.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 $i(){return await Ii()?!0:ae?ae.isAuthenticated():!1}async function Lw(){return await Ii()?{sub:"local",name:"Local User"}:ae?ae.getUser():null}function ki(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:Bu,redirect_uri:window.location.href,...t}})}async function Ft(e=!0){const t=Ii();if(t)return t;try{return ae?await ae.getTokenSilently():null}catch(r){if(e)throw r;return null}}async function Ku(e={}){if(localStorage.removeItem(St),De(ge.LOGOUT,{}),!!ae)return ae.logout({...e,logoutParams:{returnTo:window.location.href,...e.logoutParams}})}function Gu(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 Wu(e){const t=Gu(e);if(!t||!t.exp||t.exp<new Date().getTime()/1e3)throw new Error("Invalid token");localStorage.setItem(St,e),De(ge.AUTHENTICATED,t)}const Uw=(e,t)=>t.skipDedupe||t.method!=="GET",xw=(e,t)=>t.method+"@"+e,Nw=e=>e.clone(),Is=({skip:e=Uw,key:t=xw,resolver:r=Nw}={})=>{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)}}},Dw=(e,t)=>e*t,Mw=e=>e&&e.ok,$s=({delayTimer:e=500,delayRamp:t=Dw,maxAttempts:r=10,until:n=Mw,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)})},Fw="application/json",Vu="Content-Type",ut=Symbol(),Zu=Symbol();function ks(e={}){var t;return(t=Object.entries(e).find(([r])=>r.toLowerCase()===Vu.toLowerCase()))===null||t===void 0?void 0:t[1]}function Ps(e){return/^application\/.*json.*/.test(e)}const Xe=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]=Xe(o,i,r):n[a]=i,n},{...e})},It={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 zw(e,t=!1){It.options=t?e:Xe(It.options,e)}function Hw(e,t=!1){It.polyfills=t?e:Xe(It.polyfills,e)}function Bw(e){It.errorType=e}const Kw=e=>t=>e.reduceRight((r,n)=>n(r),t)||t;class Yu extends Error{}const Gw=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=Xe(a.options,n);let s=r;const d=Kw(c)((b,v)=>(s=b,a.polyfill("fetch")(b,v)))(r,u),h=new Error,m=d.catch(b=>{throw{[ut]:b}}).then(b=>{if(!b.ok){const v=new Yu;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(ut),O=I?v[ut]:v,_=(O==null?void 0:O.status)&&f.get(O.status)||f.get(O==null?void 0:O.name)||I&&f.has(ut)&&f.get(ut);if(_)return _(O,e);const C=f.get(Zu);if(C)return C(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(ut,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)},Ww={_url:"",_options:{},_config:It,_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:Xe(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:Xe(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:Xe(this._options,{headers:t})}},accept(e){return this.headers({Accept:e})},content(e){return this.headers({[Vu]: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(Zu,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=ks(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof r=="object"&&!(i&&r instanceof i)&&(!n._options.headers||!a||Ps(a));return n=r?o?n.json(r,a):n.body(r):n,Gw(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=ks(this._options.headers);return this.content(t||Ps(r)&&r||Fw).body(JSON.stringify(e))}};function _e(e="",t={}){return{...Ww,_url:e,_options:t}}_e.default=_e;_e.options=zw;_e.errorType=Bw;_e.polyfills=Hw;_e.WretchError=Yu;function ve(){sessionStorage.removeItem(Ua),De(ge.CLEAR_CACHE,{})}function Ts(){var r;return(r=(document.documentElement.getAttribute("lang")??"en").split("-")[0])==null?void 0:r.toLocaleLowerCase()}function Vw(e){const t=Ae("api2",e.environment),r=w=>async(P,T)=>{let M=sessionStorage.getItem(Ua);M||(M=Date.now().toString(),sessionStorage.setItem(Ua,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 Ft(w),!N){if(w)throw new Error("No access token available");return P(T,M)}const Q={...M,headers:{...M.headers,...N?{Authorization:`Bearer ${N}`}:{}}};return P(T,Q)},a=w=>(P,T)=>{if(T.headers.Authorization)return w(P,T);const M=localStorage.getItem("__anon_id"),N=btoa(`${M}:`),Q={...T,headers:{...T.headers,Authorization:`Basic ${N}`}};return w(P,Q)},i=_e(t).headers({"Content-Type":"application/json"}).middlewares([r,n(),Is(),$s({delayTimer:1e3,delayRamp:(w,P)=>w*P,maxAttempts:3,until:w=>!!(w&&(w.ok||w.status>=400&&w.status<500)),retryOnNetworkError:!1})]),o=_e(t).headers({"Content-Type":"application/json"}).middlewares([r,n(!1),a,Is(),$s({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(ge.USER_ATTRIBUTE_CHANGED,{}),ve(),T}async function g(w){const P=await i.url(`/user-metadata/${w}`).delete().res();return ve(),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 ve(),P.ok}async function I(w){const P=await i.url("/tags").post(w).res();return De(ge.USER_ATTRIBUTE_CHANGED,{}),ve(),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 C(w){const P=await o.url(`/tallies/${w}`).delete().res();return ve(),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 G(){return await Ft(!1)?await i.url("/profile").get().json():null}async function L(w){const P=await i.url("/profile").patch(w).res();return ve(),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 B(w){const P=await Ft(!1);if(!P)throw new Error("No access token available");const T=new URL(`${Ae("spotify-oas",e.environment)}/sesamy-callback`);T.searchParams.set("access_token",P),T.searchParams.set("state",w),window.location.href=T.toString()}async function W(w){const P=await i.url(`/products/${w}/auto-onboard`).post().json();return P.length&&ve(),P}async function He(w,P=3600){const{shortlink:T}=await _e(Cw).post({url:w,ttl:P}).json();return T}async function p(w){const P=await Ft(!1);let T;const M=w.language||Ts();switch(w.target){case"account":T=new URL(`${Ae("account",e.environment)}/${M}/subscriptions/${e.clientId}`);break;case"consume":T=new URL(`${Ae("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?He(T.href,w.ttl):T.href}async function y(w){return(await o.url("/checkouts").post({language:Ts(),...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 Ft(!1),P=new URL(`${Ae("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:G,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:C,pushTally:F,getProduct:z,getPaymentIssues:D,autoOnboardProduct:W,isSpotifyLinked:H,unlinkSpotify:R,linkSpotify:B,generateLink:p,openHostedAccountPage:x}}const Ju="@sesamy/sesamy-js",Pi="1.13.2";function Es(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 kr="undefined",Os="object",xa=function(){},Xu="any",qu="*",et="__",Gr=typeof process<"u"?process:{};Gr.env&&Gr.env.NODE_ENV;var V=typeof document<"u";Gr.versions!=null&&Gr.versions.node!=null;typeof Deno<"u"&&Deno.core;V&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent!==void 0&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function Qu(e,t){return t.charAt(0)[e]()+t.slice(1)}var Zw=Qu.bind(null,"toUpperCase"),Yw=Qu.bind(null,"toLowerCase");function Jw(e){return el(e)?Zw("null"):typeof e=="object"?eb(e):Object.prototype.toString.call(e).slice(8,-1)}function Wr(e,t){t===void 0&&(t=!0);var r=Jw(e);return t?Yw(r):r}function cr(e,t){return typeof t===e}var te=cr.bind(null,"function"),xe=cr.bind(null,"string"),vt=cr.bind(null,"undefined"),Xw=cr.bind(null,"boolean");cr.bind(null,"symbol");function el(e){return e===null}function qw(e){return Wr(e)==="number"&&!isNaN(e)}function tl(e){return Wr(e)==="array"}function ee(e){if(!Qw(e))return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Qw(e){return e&&(typeof e=="object"||e!==null)}function eb(e){return te(e.constructor)?e.constructor.name:null}function tb(e){return e instanceof Error||xe(e.message)&&e.constructor&&qw(e.constructor.stackTraceLimit)}function rl(e,t){if(typeof t!="object"||el(t))return!1;if(t instanceof e)return!0;var r=Wr(new e(""));if(tb(t))for(;t;){if(Wr(t)===r)return!0;t=Object.getPrototypeOf(t)}return!1}rl.bind(null,TypeError);rl.bind(null,SyntaxError);function on(e,t){var r=e instanceof Element||e instanceof HTMLDocument;return r&&t?rb(e,t):r}function rb(e,t){return t===void 0&&(t=""),e&&e.nodeName===t.toUpperCase()}function sn(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}sn(on,"form");sn(on,"button");sn(on,"input");sn(on,"select");function nb(e){return e?tl(e)?e:[e]:[]}function _s(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function ab(){if(V){var e=navigator,t=e.languages;return e.userLanguage||(t&&t.length?t[0]:e.language)}}function ib(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function ob(e){return function(t){for(var r,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;r=a.exec(t);){var i=_s(r[1]),o=_s(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&&(sb(n,l.map(function(f){return f.replace(/[?[\]\\ ]/g,"")}),n[c]),delete n[c])}return n}(function(t){return V&&window.location.search.substring(1)}())}function sb(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 cn(){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 cb(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 Jt="global",$t=et+"global"+et,kt=typeof self===Os&&self.self===self&&self||typeof global===Os&&global.global===global&&global||void 0;function tt(e){return kt[$t][e]}function rt(e,t){return kt[$t][e]=t}function Rt(e){delete kt[$t][e]}function Ct(e,t,r){var n;try{if(Ti(e)){var a=window[e];n=a[t].bind(a)}}catch{}return n||r}kt[$t]||(kt[$t]={});var Pr={};function Ti(e){if(typeof Pr[e]!==kr)return Pr[e];try{var t=window[e];t.setItem(kr,kr),t.removeItem(kr)}catch{return Pr[e]=!1}return Pr[e]=!0}function A(){return A=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},A.apply(this,arguments)}var Le="function",Oe="undefined",ub="@@redux/"+Math.random().toString(36),Rs=function(){return typeof Symbol===Le&&Symbol.observable||"@@observable"}(),Tr=" != "+Le;function nl(e,t,r){var n;if(typeof t===Le&&typeof r===Oe&&(r=t,t=void 0),typeof r!==Oe){if(typeof r!==Le)throw new Error("enhancer"+Tr);return r(nl)(e,t)}if(typeof e!==Le)throw new Error("reducer"+Tr);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!==Le)throw new Error("Listener"+Tr);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(!ee(h))throw new Error("Act != obj");if(typeof h.type===Oe)throw new Error("ActType "+Oe);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!==Le)throw new Error("next reducer"+Tr);a=h,d({type:"@@redux/INIT"})}})[Rs]=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)}}})[Rs]=function(){return this},h},n}function lb(e,t){var r=t&&t.type;return"action "+(r&&r.toString()||"?")+"reducer "+e+" returns "+Oe}function Pt(){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 fb(){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)}),A({},o,{dispatch:c=Pt.apply(void 0,i)(o.dispatch)})}}}var Ne=et+"anon_id",qe=et+"user_id",mt=et+"user_traits",je="userId",pt="anonymousId",xr=["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"],Na=["name","EVENTS","config","loaded"],j=xr.reduce(function(e,t){return e[t]=t,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Cs=/^utm_/,js=/^an_prop_/,As=/^an_trait_/;function db(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(Ne,o.anonymousId),f||t(qe,o.userId),l.traits&&t(mt,A({},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(Cs)||S.match(/^(d|g)clid/)){var g=S.replace(Cs,"");m.campaign[g==="campaign"?"name":g]=i[S]}return S.match(js)&&(m.props[S.replace(js,"")]=i[S]),S.match(As)&&(m.traits[S.replace(As,"")]=i[S]),m},{campaign:{},props:{},traits:{}});r.dispatch(A({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 hb(e){return function(t,r){if(t===void 0&&(t={}),r===void 0&&(r={}),r.type===j.setItemEnd){if(r.key===Ne)return A({},t,{anonymousId:r.value});if(r.key===qe)return A({},t,{userId:r.value})}switch(r.type){case j.identify:return Object.assign({},t,{userId:r.userId,traits:A({},t.traits,r.traits)});case j.reset:return[qe,Ne,mt].forEach(function(n){e.removeItem(n)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function Ls(e){return{userId:e.getItem(qe),anonymousId:e.getItem(Ne),traits:e.getItem(mt)}}var Da=function(e){return et+"TEMP"+et+e};function vb(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&&([qe,mt,Ne].forEach(function(h){n(h)}),[je,pt,"traits"].forEach(function(h){Rt(Da(h))})),c.type===j.identify){a(Ne)||r(Ne,cn());var s=a(qe),d=a(mt)||{};s&&s!==l&&i.dispatch({type:j.userIdChanged,old:{userId:s,traits:d},new:{userId:l,traits:f},options:u}),l&&r(qe,l),f&&r(mt,A({},d,f))}return o(c)}}}}var Gt={};function Us(e,t){Gt[e]&&te(Gt[e])&&(Gt[e](t),delete Gt[e])}function al(e,t,r){return new Promise(function(n,a){return t()?n(e):r<1?a(A({},e,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return al(e,t,r-10).then(n,a)})})}function pb(e){return{abort:e}}function il(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&&te(S)){var g,$=function(v,I){return v===void 0&&(v={}),I===void 0&&(I={}),[je,pt].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:pb}))&&ee(g)&&g.abort)return void(n[$.meta.rid]=!0);if(!k){var b=m+":"+h;e.dispatch(A({},$,{type:b,_:{called:b,from:"queueDrain"}}))}}});var u=c.actions.filter(function(s,d){return!~f.processIndex.indexOf(d)});c.actions=u}}}var ia=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(gt),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 C=k.type.match(gt)?function(F,z,G,L,D){return function(H,R){var B=L?L.name:F,W=R&&tr(R)?R:G;if(L&&(!(W=R&&tr(R)?R:[F]).includes(F)||W.length!==1))throw new Error("Method "+z+" can only abort "+F+" plugin. "+JSON.stringify(W)+" input valid");return A({},D,{abort:{reason:H,plugins:W,caller:z,_:B}})}}(O,_,$,v,k):function(F,z){return function(){throw new Error(F.type+" action not cancellable. Remove abort in "+z)}}(k,_);return{payload:mb(k),instance:g,config:I||{},abort:C}}}(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(_,C,F){try{return Promise.resolve(_).then(function(z){return C.method&&te(C.method)?(function(H,R){var B=Hs(H);if(B&&B.name===R){var W=Hs(B.method);throw new Error([R+" plugin is calling method "+H,"Plugins cant call self","Use "+B.method+" "+(W?"or "+W.method:"")+" in "+R+" plugin insteadof "+H].join(`
|
|
6
|
-
`))}}(C.methodName,C.pluginName),Promise.resolve(C.method({payload:z,instance:n,abort:(G=z,L=b,D=C.pluginName,function(H,R){return A({},G,{abort:{reason:H,plugins:R||[L],caller:s,from:D||L}})}),config:Ds(C.pluginName,f,i),plugins:f})).then(function(H){var R=ee(H)?H:{};return Promise.resolve(A({},z,R))})):z;var G,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 C=g[I]?g[I]:{};if(d&&(C=_),sa(C,I))return oa({data:C,method:s,instance:n,pluginName:I,store:c}),Promise.resolve(_);if(sa(_,I))return v&&oa({data:_,method:s,instance:n,store:c}),Promise.resolve(_);if(S.hasOwnProperty(I)&&S[I]===!0)return c.dispatch({type:"queue",plugin:I,payload:C,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(_);var F=m(g[I],i[I]);return Promise.resolve(O[s]({abort:F.abort,payload:C,instance:n,config:Ds(I,f,i),plugins:f})).then(function(z){var G=ee(z)?z:{},L=A({},_,G),D=g[I];if(sa(D,I))oa({data:D,method:s,instance:n,pluginName:I,store:c});else{var H=s+":"+I;(H.match(/:/g)||[]).length<2&&!s.match(xs)&&!s.match(Ns)&&n.dispatch(A({},d?L:C,{type:H,_:{called:H,from:"submethod"}}))}return Promise.resolve(L)})})}catch(_){return Promise.reject(_)}},Promise.resolve(r))).then(function($){if(!(s.match(gt)||s.match(/^registerPlugin/)||s.match(Ns)||s.match(xs)||s.match(/^params/)||s.match(/^userIdChanged/))){if(l.plugins.includes(s),$._&&$._.originalAction===s)return $;var k=A({},$,{_:{originalAction:$.type,called:$.type,from:"engineEnd"}});ol($,t.exact.length)&&!s.match(/End$/)&&(k=A({},k,{type:$.type+"Aborted"})),c.dispatch(k)}return $})})}catch(g){return Promise.reject(g)}},gt=/Start$/,xs=/^bootstrap/,Ns=/^ready/;function oa(e){var t=e.pluginName,r=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(A({},e.data,{type:r,_:{called:r,from:"abort"}}))}function Ds(e,t,r){var n=t[e]||r[e];return n&&n.config?n.config:{}}function Ms(e,t){return t.reduce(function(r,n){return n[e]?r.concat({methodName:e,pluginName:n.name,method:n[e]}):r},[])}function Fs(e,t){var r=e.replace(gt,""),n=t?":"+t:"";return[""+e+n,""+r+n,r+"End"+n]}function sa(e,t){var r=e.abort;return!!r&&(r===!0||zs(r,t)||r&&zs(r.plugins,t))}function ol(e,t){var r=e.abort;if(!r)return!1;if(r===!0||xe(r))return!0;var n=r.plugins;return tr(r)&&r.length===t||tr(n)&&n.length===t}function tr(e){return Array.isArray(e)}function zs(e,t){return!(!e||!tr(e))&&e.includes(t)}function Hs(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function mb(e){return Object.keys(e).reduce(function(t,r){return r==="type"||(t[r]=ee(e[r])?Object.assign({},e[r]):e[r]),t},{})}function gb(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 Us(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 al(v,function(){return I({config:_})},1e4).then(function(C){return n[O]||(a.dispatch({type:j.pluginReadyType(O),name:O,events:Object.keys(v).filter(function(F){return!Na.includes(F)})}),n[O]=!0),S=S.concat(O),v}).catch(function(C){if(C instanceof Error)throw new Error(C);return g=g.concat(C.name),C})});Promise.all(k).then(function(v){var I={plugins:S,failed:g,disabled:$};setTimeout(function(){h.length===k.length+$.length&&a.dispatch(A({},{type:j.ready},I))},0)})}var b=function(){if(f!==j.bootstrap)return/^ready:([^:]*)$/.test(f)&&setTimeout(function(){return il(a,t,e)},0),Promise.resolve(function(v,I,O,_,C){try{var F=te(I)?I():I,z=v.type,G=z.replace(gt,"");if(v._&&v._.called)return Promise.resolve(v);var L=O.getState(),D=(B=F,(W=L.plugins)===void 0&&(W={}),(He=v.options)===void 0&&(He={}),Object.keys(B).filter(function(p){var y=He.plugins||{};return Xw(y[p])?y[p]:y.all!==!1&&(!W[p]||W[p].enabled!==!1)}).map(function(p){return B[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=Fs(p).map(function(x){return Ms(x,y)});return y.reduce(function(x,w){var P=w.name,T=Fs(p,P).map(function(jt){return Ms(jt,y)}),M=T[0],N=T[1],Q=T[2];return M.length&&(x.beforeNS[P]=M),N.length&&(x.duringNS[P]=N),Q.length&&(x.afterNS[P]=Q),x},{before:U[0],beforeNS:{},during:U[1],duringNS:{},after:U[2],afterNS:{}})}(z,D);return Promise.resolve(ia({action:v,data:{exact:R.before,namespaced:R.beforeNS},state:L,allPlugins:F,allMatches:R,instance:O,store:_,EVENTS:C})).then(function(p){function y(){var x=function(){if(z.match(gt))return Promise.resolve(ia({action:A({},E,{type:G+"End"}),data:{exact:R.after,namespaced:R.afterNS},state:L,allPlugins:F,allMatches:R,instance:O,store:_,EVENTS:C})).then(function(w){w.meta&&w.meta.hasCallback&&Us(w.meta.rid,{payload:w})})}();return x&&x.then?x.then(function(){return p}):p}if(ol(p,H.length))return p;var E,U=function(){if(z!==G)return Promise.resolve(ia({action:A({},p,{type:G}),data:{exact:R.during,namespaced:R.duringNS},state:L,allPlugins:F,allMatches:R,instance:O,store:_,EVENTS:C})).then(function(x){E=x});E=p}();return U&&U.then?U.then(y):y()})}catch(p){return Promise.reject(p)}var B,W,He}(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 yb(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 wb=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 Pt.apply(void 0,o)(n)(a)}}}}};function bb(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=Bs(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},A({},t,n)}if(/^initialize:([^:]*)$/.test(r.type)){var l=Bs(r.type,j.initialize),f=e()[l];return f&&l?(n[l]=A({},t[l],{initialized:!0,loaded:!!f.loaded({config:f.config})}),A({},t,n)):t}if(/^ready:([^:]*)$/.test(r.type))return n[r.name]=A({},t[r.name],{loaded:!0}),A({},t,n);switch(r.type){case j.disablePlugin:return A({},t,Ks(r.plugins,!1,t));case j.enablePlugin:return A({},t,Ks(r.plugins,!0,t));default:return t}}}function Bs(e,t){return e.substring(t.length+1,e.length)}function Ks(e,t,r){return e.reduce(function(n,a){return n[a]=A({},r[a],{enabled:t}),n},r)}function sl(e){try{return JSON.parse(JSON.stringify(e))}catch{}return e}var Sb={last:{},history:[]};function Ib(e,t){e===void 0&&(e=Sb);var r=t.options,n=t.meta;if(t.type===j.track){var a=sl(A({event:t.event,properties:t.properties},Object.keys(r).length&&{options:r},{meta:n}));return A({},e,{last:a,history:e.history.concat(a)})}return e}var $b={actions:[]};function kb(e,t){e===void 0&&(e=$b);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),A({},e,{actions:n});case"dequeue":return[];default:return e}}var cl=/#.*$/;function Pb(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(cl,""):"")}var ul,ll,fl,dl,Tb=function(e){if(e===void 0&&(e={}),!V)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(V){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(cl,"")}(f),s={title:r,url:u,path:Pb(u),hash:l,search:f,width:o,height:c};return n&&n!==""&&(s.referrer=n),A({},s,e)},Eb={last:{},history:[]};function Ob(e,t){e===void 0&&(e=Eb);var r=t.options;if(t.type===j.page){var n=sl(A({properties:t.properties,meta:t.meta},Object.keys(r).length&&{options:r}));return A({},e,{last:n,history:e.history.concat(n)})}return e}ul=function(){if(!V)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"}(),ll=V?document.referrer:null,fl=ab(),dl=ib();var Gs={initialized:!1,sessionId:cn(),app:null,version:null,debug:!1,offline:!!V&&!navigator.onLine,os:{name:ul},userAgent:V?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.13"},timezone:dl,locale:fl,campaign:{},referrer:ll};function _b(e,t){e===void 0&&(e=Gs);var r=e.initialized,n=t.campaign;switch(t.type){case j.campaign:return A({},e,{campaign:n});case j.offline:return A({},e,{offline:!0});case j.online:return A({},e,{offline:!1});default:return r?e:A({},Gs,e,{initialized:!0})}}var Rb=["plugins","reducers","storage"];function Cb(e,t,r){if(V){var n=window[(r?"add":"remove")+"EventListener"];e.split(" ").forEach(function(a){n(a,t)})}}function jb(e){var t=Cb.bind(null,"online offline",function(r){return Promise.resolve(!navigator.onLine).then(e)});return t(!0),function(r){return t(!1)}}function hl(){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 kt[$t].analytics.push(o.action||o),i(o)}})}}}function Ws(e){return function(){return Pt(Pt.apply(null,arguments),hl())}}function ca(e){return e?tl(e)?e:[e]:[]}function Vs(e,t,r){e===void 0&&(e={});var n,a,i=cn();return t&&(Gt[i]=(n=t,a=function(o){for(var c,l=o||Array.prototype.slice.call(arguments),f=0;f<l.length;f++)if(te(l[f])){c=l[f];break}return c}(r),function(o){a&&a(o),n(o)})),A({},e,{rid:i,ts:new Date().getTime()},t?{hasCallback:!0}:{})}function Ab(e){e===void 0&&(e={});var t=e.reducers||{},r=e.initialUser||{},n=(e.plugins||[]).reduce(function(p,y){if(te(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),Q=0;Q<M.length;Q++)N[Q]=M[Q];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:Rt},i=function(p){return function(y,E,U){return E.getState("user")[y]||(U&&ee(U)&&U[y]?U[y]:Ls(p)[y]||tt(Da(y))||null)}}(a),o=n.plugins,c=n.events.filter(function(p){return!Na.includes(p)}).sort(),l=new Set(c.concat(xr).filter(function(p){return!Na.includes(p)})),f=Array.from(l).sort(),u=function(){return o},s=new wb,d=s.addMiddleware,h=s.removeMiddleware,m=s.dynamicMiddlewares,S=function(){throw new Error("Abort disabled inListener")},g=ob(),$=Ls(a),k=A({},$,r,g.an_uid?{userId:g.an_uid}:{},g.an_aid?{anonymousId:g.an_aid}:{});k.anonymousId||(k.anonymousId=cn());var b=A({enable:function(p,y){return new Promise(function(E){R.dispatch({type:j.enablePlugin,plugins:ca(p),_:{originalAction:j.enablePlugin}},E,[y])})},disable:function(p,y){return new Promise(function(E){R.dispatch({type:j.disablePlugin,plugins:ca(p),_:{originalAction:j.disablePlugin}},E,[y])})}},n.methods),v=!1,I={identify:function(p,y,E,U){try{var x=xe(p)?p:null,w=ee(p)?p:y,P=E||{},T=I.user();rt(Da(je),x);var M=x||w.userId||i(je,I,w);return Promise.resolve(new Promise(function(N){R.dispatch(A({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=ee(p)?p.event:p;if(!x||!xe(x))throw new Error("EventMissing");var w=ee(p)?p:y||{},P=ee(E)?E:{};return Promise.resolve(new Promise(function(T){R.dispatch({type:j.trackStart,event:x,properties:w,options:P,userId:i(je,I,y),anonymousId:i(pt,I,y)},T,[y,E,U])}))}catch(T){return Promise.reject(T)}},page:function(p,y,E){try{var U=ee(p)?p:{},x=ee(y)?y:{};return Promise.resolve(new Promise(function(w){R.dispatch({type:j.pageStart,properties:Tb(U),options:x,userId:i(je,I,U),anonymousId:i(pt,I,U)},w,[p,y,E])}))}catch(w){return Promise.reject(w)}},user:function(p){if(p===je||p==="id")return i(je,I);if(p===pt||p==="anonId")return i(pt,I);var y=I.getState("user");return p?Es(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||!te(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,Er),d(x,Or),function(){h(U,Er),h(x,Or)}}var w=p.match(E)?Er:Or,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||!te(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?Es(y,p):Object.assign({},y)},dispatch:function(p){var y=xe(p)?{type:p}:p;if(xr.includes(y.type))throw new Error("reserved action "+y.type);var E=A({},y,{_:A({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(Ne,p,y)},events:{core:xr,plugins:c}},O=n.middlewares.concat([function(p){return function(y){return function(E){return E.meta||(E.meta=Vs()),y(E)}}},m(Er),gb(I,u,{all:f,plugins:c}),yb(a),db(I),vb(I),m(Or)]),_={context:_b,user:hb(a),page:Ob,track:Ib,plugins:bb(u),queue:kb},C=Pt,F=Pt;if(V&&e.debug){var z=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;z&&(C=z({trace:!0,traceLimit:25})),F=function(){return arguments.length===0?hl():ee(typeof arguments[0])?Ws():Ws().apply(null,arguments)}}var G,L=function(p){return Object.keys(p).reduce(function(y,E){return Rb.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=nl(function(p){for(var y=Object.keys(p),E={},U=0;U<y.length;U++){var x=y[U];typeof p[x]===Le&&(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"})===Oe||typeof N(void 0,{type:ub})===Oe)throw new Error("reducer "+M+" "+Oe)})})(E)}catch(T){w=T}return function(T,M){if(T===void 0&&(T={}),w)throw w;for(var N=!1,Q={},jt=0;jt<P.length;jt++){var ur=P[jt],Ai=T[ur],fn=(0,E[ur])(Ai,M);if(typeof fn===Oe){var El=lb(ur,M);throw new Error(El)}Q[ur]=fn,N=N||fn!==Ai}return N?Q:T}}(A({},_,t)),H,F(C(fb.apply(void 0,O))));R.dispatch=(G=R.dispatch,function(p,y,E){var U=A({},p,{meta:Vs(p.meta,y,ca(E))});return G.apply(null,[U])});var B=Object.keys(o);R.dispatch({type:j.bootstrap,plugins:B,config:L,params:g,user:k,initialUser:r,persistedUser:$});var W=B.filter(function(p){return n.pluginEnabled[p]}),He=B.filter(function(p){return!n.pluginEnabled[p]});return R.dispatch({type:j.registerPlugins,plugins:B,enabled:n.pluginEnabled}),n.pluginsArray.map(function(p,y){var E=p.bootstrap,U=p.config,x=p.name;E&&te(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:W,disabled:He})}),jb(function(p){R.dispatch({type:p?j.offline:j.online})}),function(p,y,E){setInterval(function(){return il(p,y,E)},3e3)}(R,u,I),I}var Er="before",Or="after",Xt="cookie",Ve=ml(),vl=un,Lb=un;function pl(e){return Ve?un(e,"",-1):Rt(e)}function ml(){if(Ve!==void 0)return Ve;var e="cookiecookie";try{un(e,e),Ve=document.cookie.indexOf(e)!==-1,pl(e)}catch{Ve=!1}return Ve}function un(e,t,r,n,a,i){if(typeof window<"u"){var o=arguments.length>1;return Ve===!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 qt="localStorage",Ub=Ti.bind(null,"localStorage");Ct("localStorage","getItem",tt);Ct("localStorage","setItem",rt);Ct("localStorage","removeItem",Rt);var Qt="sessionStorage",xb=Ti.bind(null,"sessionStorage");Ct("sessionStorage","getItem",tt);Ct("sessionStorage","setItem",rt);Ct("sessionStorage","removeItem",Rt);function yt(e){var t=e;try{if((t=JSON.parse(e))==="true")return!0;if(t==="false")return!1;if(ee(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch{}if(t!==null&&t!=="")return t}var Nb=Ub(),Db=xb(),Mb=ml();function gl(e,t){if(e){var r=Ei(t),n=!Ci(r),a=Oi(r)?yt(localStorage.getItem(e)):void 0;if(n&&!vt(a))return a;var i=_i(r)?yt(vl(e)):void 0;if(n&&i)return i;var o=Ri(r)?yt(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 Fb(e,t,r){if(e&&!vt(t)){var n={},a=Ei(r),i=JSON.stringify(t),o=!Ci(a);return Oi(a)&&(n[qt]=_r(qt,t,yt(localStorage.getItem(e))),localStorage.setItem(e,i),o)?n[qt]:_i(a)&&(n[Xt]=_r(Xt,t,yt(vl(e))),Lb(e,i),o)?n[Xt]:Ri(a)&&(n[Qt]=_r(Qt,t,yt(sessionStorage.getItem(e))),sessionStorage.setItem(e,i),o)?n[Qt]:(n[Jt]=_r(Jt,t,tt(e)),rt(e,t),o?n[Jt]:n)}}function zb(e,t){if(e){var r=Ei(t),n=gl(e,qu),a={};return!vt(n.localStorage)&&Oi(r)&&(localStorage.removeItem(e),a[qt]=n.localStorage),!vt(n.cookie)&&_i(r)&&(pl(e),a[Xt]=n.cookie),!vt(n.sessionStorage)&&Ri(r)&&(sessionStorage.removeItem(e),a[Qt]=n.sessionStorage),!vt(n.global)&&ln(r,Jt)&&(Rt(e),a[Jt]=n.global),a}}function Ei(e){return e?xe(e)?e:e.storage:Xu}function Oi(e){return Nb&&ln(e,qt)}function _i(e){return Mb&&ln(e,Xt)}function Ri(e){return Db&&ln(e,Qt)}function Ci(e){return e===qu||e==="all"}function ln(e,t){return e===Xu||e===t||Ci(e)}function _r(e,t,r){return{location:e,current:t,previous:r}}var Hb={setItem:Fb,getItem:gl,removeItem:zb};function Bb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zs(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 Ys(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zs(Object(r),!0).forEach(function(n){Bb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={storage:Hb};return Ab(Ys(Ys({},t),e))}function Gb(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 Wb(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=Zb(f);return a!==u&&(a=u,setTimeout(()=>e(f),0)),c.apply(r,l)}})}function Vb(e,t){const r=e.indexOf(t);return r>-1?e.slice(0,r):e}function Zb(e){return["#","?"].forEach(t=>e=Vb(e,t)),e}function Yb(){Wb(()=>{Ee.page()})}function Jb(e){if(e===void 0&&(e={}),!V)return xa;var t=Xs(),r=Ma(),n=Js(),a=Rr(n,t),i=Rr(r,t),o=[],c=[],l=[],f=n,u=a,s=i,d=Object.keys(e);if(!d.length)return xa;var h=d.map(function(S){return Number(S)}),m=cb(function(){var S=Xs(),g=function(L,D){return D.map(function(H){return H===100?L-5:L*(H/100)})}(S,h),$=Ma(),k=Js(),b=Rr(k,S),v=Rr($,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,C=h;(O==="up"||I)&&(_=g.slice().reverse(),C=h.slice().reverse());var F=C.reduce(function(L,D,H){var R=_[H];return l.includes(D)&&k<=R&&(l=l.filter(function(B){return B!==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){te(e[L])&&(e[L]({trigger:L,direction:O,scrollMin:s,scrollMax:u,range:[s,u]}),o.push(L))}),F.singleFunction){var z=F.singleFunction,G=F.direction;te(e[z])&&e[z]({trigger:z,direction:G,scrollMin:s,scrollMax:u,range:[s,u]}),o.push(z)}}},500);return window.addEventListener("scroll",m),function(){return window.removeEventListener("scroll",m)}}function Ma(){return V?document.body.scrollTop||document.documentElement.scrollTop:0}function Xb(){return V?window.innerHeight||document.documentElement.clientHeight:0}function Js(){return Math.round(Ma()+Xb())}function Xs(){if(!V)return 0;var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}function Rr(e,t){return Math.round(e/t*100)}var qs="EventListener";function qb(e){return function(t,r,n,a){var i=n||xa,o=a||!1;if(!V)return i;var c=Vr(r),l=Vr(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"+qs:"remove"+qs,h=0;h<l.length;h++){var m=l[h];f[h]=s?o&&o.once?Qb(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 Vr(e,t){if(xe(e))return t?Vr(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=nb(e);return t?i.map(function(o){return xe(o)?Vr(o,!0):o}).flat():i}function Qb(e,t){var r;return function(){return e&&(r=e.apply(this,arguments),e=null),r}}var ua=qb("Event");function yl(e,t){return V&&te(window[e])?(r=window[e],n=t,(a=window)===void 0&&(a=null),te(r)?function(){r.apply(a,arguments),n.apply(a,arguments)}:n):window[e]=t;var r,n,a}yl.bind(null,"onerror");yl.bind(null,"onload");var wl=typeof window>"u",Qs="hidden";function eS(e){if(wl)return!1;var t=tS(),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 tS(){var e=["webkit","moz","ms","o"];return wl||Qs in document?Qs:e.reduce(function(t,r){var n=r+"Hidden";return!t&&n in document?n:t},null)}var rS=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function nS(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=eS(function(c){c||r({type:"tabVisible"})});return n=[o].concat(rS.map(function(c){return ua(document,c,r)})).concat(ua(window,"load",r)).concat(ua(window,"scroll",r,{capture:!0,passive:!0})),i}function i(){n.map(function(o){return o()})}return a(),function(){return i(),a}}function aS(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(zt(d),g),a&&u&&(u=!1,a(zt(r),g),d=new Date),t=setTimeout(function(){u=!0,n&&(r=new Date,n(zt(d),g))},c)}var S=nS(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:zt(d,s),idle:u?zt(r,s):0}}}}function zt(e,t){return t?0:Math.round((new Date-e)/1e3)}const ec=5e3;class iS{constructor(t){ie(this,"element");ie(this,"isInViewport",!1);ie(this,"isAwake",!1);ie(this,"isFlushing");ie(this,"observer");ie(this,"lastEventAt",Date.now());ie(this,"registeredView",!1);ie(this,"viewCallback");ie(this,"activeDurationCallback");ie(this,"idleDurationCallback");ie(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),aS({onIdle:r=>this.handleAwake(!1,r),onWakeUp:r=>this.handleAwake(!0,r),timeout:ec}),Jb({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*ec: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 tc="sesamy_session_id";function oS(){let e=sessionStorage.getItem(tc);return e||(e=Math.random().toString(36).slice(2,9),sessionStorage.setItem(tc,e)),e}let bl=!1,Fa,rc,Zr;function sS({clientId:e,enabled:t=!0,environment:r}){if(Fa=e,rc=t,Zr=`${Ae("logs",r)}/events`,!rc)return;Yb();const n=new iS({element:document.body,viewCallback:()=>{Ee.page()},activeDurationCallback:(a,i,o)=>{Ee.track("activeDuration",{duration:a,durationStart:o,flushing:i})},idleDurationCallback:(a,i,o)=>{Ee.track("idleDuration",{duration:a,durationStart:o,flushing:i})},scrollCallback:a=>{Ee.track("scroll",{scroll:a.scrollMax})}});lS(document.body,()=>{n.flush()}),fS(document.body,()=>{n.handleVisibilityChange()}),window.addEventListener(ge.AUTHENTICATED,async a=>{const i=a;await Ee.identify(i.detail.sub)}),window.addEventListener(ge.LOGOUT,async()=>{await Ee.track("logout",{}),ji.flush(),await Ee.reset()})}function Sl(e){return JSON.stringify(e.map(t=>({...t,clientId:Fa,requestId:Math.random().toString(36).slice(2,9),sessionId:oS(),timestamp:new Date().toISOString(),version:Pi,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:Ju,userAgent:navigator.userAgent,clientId:Fa}})))}const ji=Gb(async e=>{if(e.length>0){const t=Sl(e);bl?navigator.sendBeacon(Zr,t):(await fetch(Zr,{method:"POST",body:t,headers:{"Content-Type":"text/plain"}})).ok}},{max:10,interval:3e3});function la(e){var t;if(e.anonymousId)if((t=e.properties)!=null&&t.flushing){const r={...e};delete r.properties.flushing,navigator.sendBeacon(Zr,Sl([r]))}else ji.push(e)}const Ee=Kb({app:Ju,version:Pi,plugins:[{name:"custom-analytics-plugin",page:({payload:e})=>{const{properties:t,anonymousId:r,userId:n,event:a}=e;la({anonymousId:r,userId:n,properties:t,event:a,type:"page"})},track:({payload:e})=>{const{properties:t,anonymousId:r,userId:n,event:a}=e;la({anonymousId:r,userId:n,properties:t,event:a,type:"track"})},identify:({payload:e})=>{const{properties:t,anonymousId:r,userId:n}=e;la({anonymousId:r,userId:n,properties:t,type:"identify"})}}]});function cS(e,t){Ee.track(e,t)}function uS(){return bl=!0,ji.flush()}const Il=new Map;function lS(e,t){Il.set(e,t)}window.addEventListener("beforeunload",()=>{Il.forEach((e,t)=>{e.bind(t)()}),uS()});const $l=new Map;function fS(e,t){$l.set(e,t)}window.addEventListener("visibilitychange",()=>{document.visibilityState!=="visible"&&$l.forEach((e,t)=>{e.bind(t)()})});const kl="sesamySignedURLs";function Pl(){const e=sessionStorage.getItem(kl);return e?JSON.parse(e):[]}function dS(e){const t=Pl();t.push(e),sessionStorage.setItem(kl,JSON.stringify(t))}function hS(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:C,getProduct:F,getPaymentIssues:z,isSpotifyLinked:G,unlinkSpotify:L,linkSpotify:D,autoOnboardProduct:H,openHostedAccountPage:R,generateLink:B}=Vw(e),W={auth:{getUser:d,isAuthenticated:$i,loginWithRedirect:ki,logout:Ku,setToken:Wu},checkouts:{get:r,create:t,update:n},profile:{get:d,update:h,openHostedAccountPage:R,isSpotifyLinked:G,unlinkSpotify:L},analytics:{track:cS},tags:{list:m,set:g,delete:S},entitlements:{get:a,list:i,access:o,signedLinks:Pl},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:C},subscriptions:{list:c},products:{get:F,autoOnboard:H,linkSpotify:D},getVersion:vS,getPaymentIssues:z,generateLink:B,clearCache:ve};return e.namespace&&(window[e.namespace]=W),W}function vS(){return Pi}async function pS({enabled:e=!1,rules:t}){if(!e)return;const r=await $i(),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 nc(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 nc(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 nc(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 mS(){const e=new URLSearchParams(window.location.hash.substring(1)),t=e.get("access_token");if(t){Wu(t);const r=new URL(window.location.href);e.delete("access_token"),r.hash=e.toString(),window.history.replaceState(null,"",r)}}const ac="sesamy-refresh",ic="force-refetch-entitlements";function gS(){const e=new URLSearchParams(window.location.search),t=e.get(ic),r=e.get(ac);if(t!==null||r!==null){const n=new URL(window.location.href);e.delete(ic),e.delete(ac),n.search=e.toString(),ve(),window.history.replaceState(null,"",n)}}function yS(){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;dS({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 oc="sesamy-user";async function wS(){const t=new URLSearchParams(window.location.search).get(oc);if(!t)return;const r=await Lw();(r==null?void 0:r.email)!==t&&(ve(),ki({authorizationParams:{email_hint:t,login_hint:t}}));const n=new URL(window.location.href);n.searchParams.delete(oc),window.history.replaceState(null,"",n)}const sc="sesamy-purchase";function bS(){const e=new URLSearchParams(window.location.search),t=e.get(sc);if(t!==null){const r=new URL(window.location.href);e.delete(sc),r.search=e.toString(),De(ge.PURCHASE,{itemSrc:t}),ve(),window.history.replaceState(null,"",r)}}const cc="sesamy-login";async function SS(){if(!new URLSearchParams(window.location.search).get(cc))return;await $i()||ki();const n=new URL(window.location.href);n.searchParams.delete(cc),window.history.replaceState(null,"",n)}async function Tl(e){sS({clientId:e.clientId,environment:e.environment,...e.analytics}),await Aw({clientId:e.clientId,organization:e.organization,environment:e.environment,...e.auth}),e.transform&&await pS(e.transform);const t=hS({clientId:e.clientId,environment:e.environment,...e.api});return De(ge.READY,{}),mS(),gS(),yS(),await SS(),await wS(),bS(),t}if(typeof document<"u"){const e=document.getElementById("sesamy-js");if(e!=null&&e.textContent)try{const t=JSON.parse(e.textContent);Tl(t)}catch(t){console.error("Failed to parse config",t)}}exports.init=Tl;
|
|
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",!ws(r))throw new Error(`Invalid cache location "${r}"`);n=ws(r)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=t.legacySameSiteCookie===!1?ht:Sw,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:Iw;var i;this.scope=$r("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new gw(a,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||ju,this.cacheManager=new mw(n,n.allKeys?void 0:new Pw(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 kw)}_url(t){const r=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||Cu)));return`${this.domainUrl}${t}&auth0Client=${r}`}_authorizeUrl(t){return this._url(`/authorize?${Aa(t)}`)}async _verifyIdToken(t,r,n){const a=await this.nowProvider();return ww({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=vs(ea()),i=vs(ea()),o=ea(),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 Ur().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:$r(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 cw(c.popup)))},1e3),d=setTimeout(()=>{clearInterval(s),f(new sw(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(ae.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 ae("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=bs(t),{openUrl:a,fragment:i,appState:o}=n,c=Ie(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=Ie(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 ae("missing_transaction","Invalid state");if(this.transactionManager.remove(),i)throw new ow(i,o||i,n,c.appState);if(!c.code_verifier||c.state&&c.state!==n)throw new ae("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:$r(this.scope,(r=t.authorizationParams)===null||r===void 0?void 0:r.scope)})}),a=await((i,o)=>{let c=ra[o];return c||(c=i().finally(()=>{delete ra[o],c=null}),ra[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=Ie(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})(()=>na.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new ja;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 na.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:$r(this.scope,(n=t.authorizationParams)===null||n===void 0?void 0:n.scope)})});return r=Object.assign(Object.assign({},iw),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=Ie(r,["federated"]),i=n?"&federated":"";return this._url(`/v2/logout?${Aa(Object.assign({clientId:t.clientId},a))}`)+i}async logout(t={}){const r=bs(t),{openUrl:n}=r,a=Ie(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 ae("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(($,P)=>{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(()=>{P(new ja),v()},1e3*g);I=function(_){if(_.origin!=S||!_.data||_.data.type!=="authorization_response")return;const C=_.source;C&&C.close(),_.data.response.error?P(ae.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 ae("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 Du(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=Ie(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 vw(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 Ow(e){const t=new Ew(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 _w="sesamy.com",Rw="sesamy.dev",Cw="https://sesa.my",Ua="sesamyCacheTimestamp";function Ue(e,t){return`https://${e}.${t==="dev"?Rw:_w}`}let ie,Bu;const $t="sesamyAccessToken",aa="sesamyRefreshToken";async function jw(e){if(!e)return null;const t=localStorage.getItem(aa);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(aa),new Error("Renew token failed");const i=await a.json();return localStorage.setItem(aa,i.refresh_token),localStorage.setItem($t,i.access_token),i.access_token}catch{Ku()}}async function Ii(){const e=localStorage.getItem($t);if(!e)return null;const t=Gu(e);if(!t||!t.exp||t.exp<new Date().getTime()/1e3){const r=await jw(t);if(r)return r;localStorage.removeItem($t)}return e}function Ss(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 Aw(e){if(e.enabled===!1)return;Bu=e.organization;const t={domain:Ue("token",e.environment),clientId:e.clientId,useCookiesForTransactions:!0};if(Ss(window.location.href)!==Ss(Ue("auth",e.environment))&&(t.cacheLocation="localstorage",t.useRefreshTokens=!0),ie=await Ow(t),window.location.search.includes("code="))try{await ie.handleRedirectCallback();const r=await ie.getUser();Fe(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 $i(){return await Ii()?!0:ie?ie.isAuthenticated():!1}async function Lw(){return await Ii()?{sub:"local",name:"Local User"}:ie?ie.getUser():null}function ki(e){if(localStorage.removeItem($t),!ie)throw new Error("Auth0 client not initialized");const t=(e==null?void 0:e.authorizationParams)||{};return ie.loginWithRedirect({...e,authorizationParams:{organization:Bu,redirect_uri:window.location.href,...t}})}async function zt(e=!0){const t=Ii();if(t)return t;try{return ie?await ie.getTokenSilently():null}catch(r){if(e)throw r;return null}}async function Ku(e={}){if(localStorage.removeItem($t),Fe(ye.LOGOUT,{}),!!ie)return ie.logout({...e,logoutParams:{returnTo:window.location.href,...e.logoutParams}})}function Gu(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 Wu(e){const t=Gu(e);if(!t||!t.exp||t.exp<new Date().getTime()/1e3)throw new Error("Invalid token");localStorage.setItem($t,e),Fe(ye.AUTHENTICATED,t)}const Uw=(e,t)=>t.skipDedupe||t.method!=="GET",xw=(e,t)=>t.method+"@"+e,Nw=e=>e.clone(),Is=({skip:e=Uw,key:t=xw,resolver:r=Nw}={})=>{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)}}},Dw=(e,t)=>e*t,Mw=e=>e&&e.ok,$s=({delayTimer:e=500,delayRamp:t=Dw,maxAttempts:r=10,until:n=Mw,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((P={})=>{var b,v;g(l((b=P&&P.url)!==null&&b!==void 0?b:f,(v=P&&P.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)})},Fw="application/json",Vu="Content-Type",ft=Symbol(),Zu=Symbol();function ks(e={}){var t;return(t=Object.entries(e).find(([r])=>r.toLowerCase()===Vu.toLowerCase()))===null||t===void 0?void 0:t[1]}function Ps(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})},kt={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 zw(e,t=!1){kt.options=t?e:Qe(kt.options,e)}function Hw(e,t=!1){kt.polyfills=t?e:Qe(kt.polyfills,e)}function Bw(e){kt.errorType=e}const Kw=e=>t=>e.reduceRight((r,n)=>n(r),t)||t;class Yu extends Error{}const Gw=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=Kw(c)((b,v)=>(s=b,a.polyfill("fetch")(b,v)))(r,u),h=new Error,m=d.catch(b=>{throw{[ft]:b}}).then(b=>{if(!b.ok){const v=new Yu;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(ft),O=I?v[ft]:v,_=(O==null?void 0:O.status)&&f.get(O.status)||f.get(O==null?void 0:O.name)||I&&f.has(ft)&&f.get(ft);if(_)return _(O,e);const C=f.get(Zu);if(C)return C(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(ft,b)}},P=l.reduce((b,v)=>({...b,...typeof v.resolver=="function"?v.resolver(b):v.resolver}),$);return o.reduce((b,v)=>v(b,e),P)},Ww={_url:"",_options:{},_config:kt,_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({[Vu]: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(Zu,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=ks(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof r=="object"&&!(i&&r instanceof i)&&(!n._options.headers||!a||Ps(a));return n=r?o?n.json(r,a):n.body(r):n,Gw(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=ks(this._options.headers);return this.content(t||Ps(r)&&r||Fw).body(JSON.stringify(e))}};function Re(e="",t={}){return{...Ww,_url:e,_options:t}}Re.default=Re;Re.options=zw;Re.errorType=Bw;Re.polyfills=Hw;Re.WretchError=Yu;function pe(){sessionStorage.removeItem(Ua),Fe(ye.CLEAR_CACHE,{})}function Ts(){var r;return(r=(document.documentElement.getAttribute("lang")??"en").split("-")[0])==null?void 0:r.toLocaleLowerCase()}function Vw(e){const t=Ue("api2",e.environment),r=w=>async(k,T)=>{let H=sessionStorage.getItem(Ua);H||(H=Date.now().toString(),sessionStorage.setItem(Ua,H));const ee={...T,headers:{...T.headers,"Cache-Timestamp":H}};return w(k,ee)},n=(w=!0)=>k=>async(T,H)=>{let ee=null;if(ee=await zt(w),!ee){if(w)throw new Error("No access token available");return k(T,H)}const je={...H,headers:{...H.headers,...ee?{Authorization:`Bearer ${ee}`}:{}}};return k(T,je)},a=w=>(k,T)=>{if(T.headers.Authorization)return w(k,T);const H=localStorage.getItem("__anon_id"),ee=btoa(`${H}:`),je={...T,headers:{...T.headers,Authorization:`Basic ${ee}`}};return w(k,je)},i=Re(t).headers({"Content-Type":"application/json"}).middlewares([r,n(),Is(),$s({delayTimer:1e3,delayRamp:(w,k)=>w*k,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,Is(),$s({delayTimer:1e3,delayRamp:(w,k)=>w*k,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 k=await i.get("/entitlements").json();return k==null?void 0:k.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 k=await i.get("/contracts").json();return k==null?void 0:k.find(T=>T.id===w)}async function d(){return console.warn("getSubscriptions is deprecated, use getContracts instead"),i.get("/subscriptions").json()}async function h(){return i.get("/bills").json()}async function m(w){const k=await i.get("/bills").json();return k==null?void 0:k.find(T=>T.id===w)}async function S(){return i.get("/transactions").json()}async function g(w){const k=await i.get("/transactions").json();return k==null?void 0:k.find(T=>T.id===w)}async function $(w,k){const T=await i.url(`/user-metadata/${w}`).put(k).json();return Fe(ye.USER_ATTRIBUTE_CHANGED,{}),pe(),T}async function P(w){const k=await i.url(`/user-metadata/${w}`).delete().res();return pe(),k.ok}async function b(w){return(await i.url(`/user-metadata/${w}`).get().json())[w]}async function v(){return await i.url("/user-metadata").get().json()}async function I(){return await i.url("/tags").get().json()}async function O(w){const k=await i.url(`/tags/${w}`).delete().res();return pe(),k.ok}async function _(w){const k=await i.url("/tags").post(w).res();return Fe(ye.USER_ATTRIBUTE_CHANGED,{}),pe(),k.ok}async function C(w){return(await o.url("/tallies").get().json())[w]}async function M(){return await o.url("/tallies").get().json()}async function F(w){const k=await o.url(`/tallies/${w}`).delete().res();return pe(),k.ok}async function G(w,k){return await o.url(`/tallies/${w}/push`).post(k).json()}async function L(w){return await i.url(`/products/${w}`).get().json()}async function N(){return await zt(!1)?await i.url("/profile").get().json():null}async function z(w){const k=await i.url("/profile").patch(w).res();return pe(),k.ok}async function R(){return await i.url("/payment-issues").get().json()}async function B(){return(await i.url("/profile/spotify-link").get().json()).isSpotifyLinked}async function W(){return(await i.url("/profile/unlink-spotify").post().res()).ok}async function Ke(w){const k=await zt(!1);if(!k)throw new Error("No access token available");const T=new URL(`${Ue("spotify-oas",e.environment)}/sesamy-callback`);T.searchParams.set("access_token",k),T.searchParams.set("state",w),window.location.href=T.toString()}async function p(w){const k=await i.url(`/products/${w}/auto-onboard`).post().json();return k.length&&pe(),k}async function y(w,k=3600){const{shortlink:T}=await Re(Cw).post({url:w,ttl:k}).json();return T}async function E(w){const k=await zt(!1);let T;const H=w.language||Ts();switch(w.target){case"account":T=new URL(`${Ue("account",e.environment)}/${H}/subscriptions/${e.clientId}`);break;case"consume":T=new URL(`${Ue("consume",e.environment)}/${H}/@${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),k&&(T.hash=`#access_token=${k}`),w.shorten?y(T.href,w.ttl):T.href}async function U(w){return(await o.url("/checkouts").post({language:Ts(),...w,vendorId:e.clientId})).json()}async function x(w,k){return(await o.url(`/checkouts/${w}`).patch(k)).json()}async function D(w){return(await o.url(`/checkouts/${w}`).get()).json()}async function V(){const w=await zt(!1),k=new URL(`${Ue("account",e.environment)}/subscriptions/${e.clientId}`);w&&(k.hash=`#access_token=${w}`),window.location.href=k.toString()}return{createCheckout:U,updateCheckout:x,getCheckout:D,getEntitlements:c,getEntitlement:l,getEntitlementAccess:f,getContracts:u,getContract:s,getProfile:N,updateProfile:z,getSubscriptions:d,getBills:h,getBill:m,setUserMetadata:$,deleteUserMetadata:P,getUserMetadata:b,listUserMetadata:v,getTags:I,deleteTag:O,setTag:_,getTally:C,getTallies:M,deleteTally:F,pushTally:G,getTransactions:S,getTransaction:g,getProduct:L,getPaymentIssues:R,autoOnboardProduct:p,isSpotifyLinked:B,unlinkSpotify:W,linkSpotify:Ke,generateLink:E,openHostedAccountPage:V}}const Ju="@sesamy/sesamy-js",Pi="1.13.2";function Es(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 kr="undefined",Os="object",xa=function(){},Xu="any",qu="*",rt="__",Gr=typeof process<"u"?process:{};Gr.env&&Gr.env.NODE_ENV;var Z=typeof document<"u";Gr.versions!=null&&Gr.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 Qu(e,t){return t.charAt(0)[e]()+t.slice(1)}var Zw=Qu.bind(null,"toUpperCase"),Yw=Qu.bind(null,"toLowerCase");function Jw(e){return el(e)?Zw("null"):typeof e=="object"?eb(e):Object.prototype.toString.call(e).slice(8,-1)}function Wr(e,t){t===void 0&&(t=!0);var r=Jw(e);return t?Yw(r):r}function ur(e,t){return typeof t===e}var re=ur.bind(null,"function"),De=ur.bind(null,"string"),mt=ur.bind(null,"undefined"),Xw=ur.bind(null,"boolean");ur.bind(null,"symbol");function el(e){return e===null}function qw(e){return Wr(e)==="number"&&!isNaN(e)}function tl(e){return Wr(e)==="array"}function te(e){if(!Qw(e))return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Qw(e){return e&&(typeof e=="object"||e!==null)}function eb(e){return re(e.constructor)?e.constructor.name:null}function tb(e){return e instanceof Error||De(e.message)&&e.constructor&&qw(e.constructor.stackTraceLimit)}function rl(e,t){if(typeof t!="object"||el(t))return!1;if(t instanceof e)return!0;var r=Wr(new e(""));if(tb(t))for(;t;){if(Wr(t)===r)return!0;t=Object.getPrototypeOf(t)}return!1}rl.bind(null,TypeError);rl.bind(null,SyntaxError);function on(e,t){var r=e instanceof Element||e instanceof HTMLDocument;return r&&t?rb(e,t):r}function rb(e,t){return t===void 0&&(t=""),e&&e.nodeName===t.toUpperCase()}function sn(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}sn(on,"form");sn(on,"button");sn(on,"input");sn(on,"select");function nb(e){return e?tl(e)?e:[e]:[]}function _s(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function ab(){if(Z){var e=navigator,t=e.languages;return e.userLanguage||(t&&t.length?t[0]:e.language)}}function ib(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function ob(e){return function(t){for(var r,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;r=a.exec(t);){var i=_s(r[1]),o=_s(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&&(sb(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 sb(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 cn(){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 cb(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 Xt="global",Pt=rt+"global"+rt,Tt=typeof self===Os&&self.self===self&&self||typeof global===Os&&global.global===global&&global||void 0;function nt(e){return Tt[Pt][e]}function at(e,t){return Tt[Pt][e]=t}function jt(e){delete Tt[Pt][e]}function At(e,t,r){var n;try{if(Ti(e)){var a=window[e];n=a[t].bind(a)}}catch{}return n||r}Tt[Pt]||(Tt[Pt]={});var Pr={};function Ti(e){if(typeof Pr[e]!==kr)return Pr[e];try{var t=window[e];t.setItem(kr,kr),t.removeItem(kr)}catch{return Pr[e]=!1}return Pr[e]=!0}function A(){return A=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},A.apply(this,arguments)}var xe="function",_e="undefined",ub="@@redux/"+Math.random().toString(36),Rs=function(){return typeof Symbol===xe&&Symbol.observable||"@@observable"}(),Tr=" != "+xe;function nl(e,t,r){var n;if(typeof t===xe&&typeof r===_e&&(r=t,t=void 0),typeof r!==_e){if(typeof r!==xe)throw new Error("enhancer"+Tr);return r(nl)(e,t)}if(typeof e!==xe)throw new Error("reducer"+Tr);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!==xe)throw new Error("Listener"+Tr);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===_e)throw new Error("ActType "+_e);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!==xe)throw new Error("next reducer"+Tr);a=h,d({type:"@@redux/INIT"})}})[Rs]=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)}}})[Rs]=function(){return this},h},n}function lb(e,t){var r=t&&t.type;return"action "+(r&&r.toString()||"?")+"reducer "+e+" returns "+_e}function Et(){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 fb(){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)}),A({},o,{dispatch:c=Et.apply(void 0,i)(o.dispatch)})}}}var Me=rt+"anon_id",et=rt+"user_id",yt=rt+"user_traits",Le="userId",gt="anonymousId",xr=["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"],Na=["name","EVENTS","config","loaded"],j=xr.reduce(function(e,t){return e[t]=t,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Cs=/^utm_/,js=/^an_prop_/,As=/^an_trait_/;function db(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(Me,o.anonymousId),f||t(et,o.userId),l.traits&&t(yt,A({},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(Cs)||S.match(/^(d|g)clid/)){var g=S.replace(Cs,"");m.campaign[g==="campaign"?"name":g]=i[S]}return S.match(js)&&(m.props[S.replace(js,"")]=i[S]),S.match(As)&&(m.traits[S.replace(As,"")]=i[S]),m},{campaign:{},props:{},traits:{}});r.dispatch(A({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 hb(e){return function(t,r){if(t===void 0&&(t={}),r===void 0&&(r={}),r.type===j.setItemEnd){if(r.key===Me)return A({},t,{anonymousId:r.value});if(r.key===et)return A({},t,{userId:r.value})}switch(r.type){case j.identify:return Object.assign({},t,{userId:r.userId,traits:A({},t.traits,r.traits)});case j.reset:return[et,Me,yt].forEach(function(n){e.removeItem(n)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function Ls(e){return{userId:e.getItem(et),anonymousId:e.getItem(Me),traits:e.getItem(yt)}}var Da=function(e){return rt+"TEMP"+rt+e};function vb(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&&([et,yt,Me].forEach(function(h){n(h)}),[Le,gt,"traits"].forEach(function(h){jt(Da(h))})),c.type===j.identify){a(Me)||r(Me,cn());var s=a(et),d=a(yt)||{};s&&s!==l&&i.dispatch({type:j.userIdChanged,old:{userId:s,traits:d},new:{userId:l,traits:f},options:u}),l&&r(et,l),f&&r(yt,A({},d,f))}return o(c)}}}}var Wt={};function Us(e,t){Wt[e]&&re(Wt[e])&&(Wt[e](t),delete Wt[e])}function al(e,t,r){return new Promise(function(n,a){return t()?n(e):r<1?a(A({},e,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return al(e,t,r-10).then(n,a)})})}function pb(e){return{abort:e}}function il(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&&re(S)){var g,$=function(v,I){return v===void 0&&(v={}),I===void 0&&(I={}),[Le,gt].reduce(function(O,_){return v.hasOwnProperty(_)&&I[_]&&I[_]!==v[_]&&(O[_]=I[_]),O},v)}(d.payload,l),P=n[$.meta.rid];if(!P&&(g=S({payload:$,config:o[h].config,instance:r,abort:pb}))&&te(g)&&g.abort)return void(n[$.meta.rid]=!0);if(!P){var b=m+":"+h;e.dispatch(A({},$,{type:b,_:{called:b,from:"queueDrain"}}))}}});var u=c.actions.filter(function(s,d){return!~f.processIndex.indexOf(d)});c.actions=u}}}var ia=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(wt),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(P,b,v){var I=b.config,O=b.name,_=O+"."+P.type;v&&(_=v.event);var C=P.type.match(wt)?function(M,F,G,L,N){return function(z,R){var B=L?L.name:M,W=R&&rr(R)?R:G;if(L&&(!(W=R&&rr(R)?R:[M]).includes(M)||W.length!==1))throw new Error("Method "+F+" can only abort "+M+" plugin. "+JSON.stringify(W)+" input valid");return A({},N,{abort:{reason:z,plugins:W,caller:F,_:B}})}}(O,_,$,v,P):function(M,F){return function(){throw new Error(M.type+" action not cancellable. Remove abort in "+F)}}(P,_);return{payload:mb(P),instance:g,config:I||{},abort:C}}}(n,h),S=t.exact.reduce(function(g,$){var P=$.pluginName,b=$.methodName,v=!1;return b.match(/^initialize/)||b.match(/^reset/)||(v=!f[P].loaded),u.offline&&b.match(/^(page|track|identify)/)&&(v=!0),g[""+P]=v,g},{});return Promise.resolve(t.exact.reduce(function(g,$,P){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(_,C,M){try{return Promise.resolve(_).then(function(F){return C.method&&re(C.method)?(function(z,R){var B=Hs(z);if(B&&B.name===R){var W=Hs(B.method);throw new Error([R+" plugin is calling method "+z,"Plugins cant call self","Use "+B.method+" "+(W?"or "+W.method:"")+" in "+R+" plugin insteadof "+z].join(`
|
|
6
|
+
`))}}(C.methodName,C.pluginName),Promise.resolve(C.method({payload:F,instance:n,abort:(G=F,L=b,N=C.pluginName,function(z,R){return A({},G,{abort:{reason:z,plugins:R||[L],caller:s,from:N||L}})}),config:Ds(C.pluginName,f,i),plugins:f})).then(function(z){var R=te(z)?z:{};return Promise.resolve(A({},F,R))})):F;var G,L,N})}catch(F){return Promise.reject(F)}},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($,P,b){try{var v=t.exact.length===b+1,I=P.pluginName,O=i[I];return Promise.resolve($).then(function(_){var C=g[I]?g[I]:{};if(d&&(C=_),sa(C,I))return oa({data:C,method:s,instance:n,pluginName:I,store:c}),Promise.resolve(_);if(sa(_,I))return v&&oa({data:_,method:s,instance:n,store:c}),Promise.resolve(_);if(S.hasOwnProperty(I)&&S[I]===!0)return c.dispatch({type:"queue",plugin:I,payload:C,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(_);var M=m(g[I],i[I]);return Promise.resolve(O[s]({abort:M.abort,payload:C,instance:n,config:Ds(I,f,i),plugins:f})).then(function(F){var G=te(F)?F:{},L=A({},_,G),N=g[I];if(sa(N,I))oa({data:N,method:s,instance:n,pluginName:I,store:c});else{var z=s+":"+I;(z.match(/:/g)||[]).length<2&&!s.match(xs)&&!s.match(Ns)&&n.dispatch(A({},d?L:C,{type:z,_:{called:z,from:"submethod"}}))}return Promise.resolve(L)})})}catch(_){return Promise.reject(_)}},Promise.resolve(r))).then(function($){if(!(s.match(wt)||s.match(/^registerPlugin/)||s.match(Ns)||s.match(xs)||s.match(/^params/)||s.match(/^userIdChanged/))){if(l.plugins.includes(s),$._&&$._.originalAction===s)return $;var P=A({},$,{_:{originalAction:$.type,called:$.type,from:"engineEnd"}});ol($,t.exact.length)&&!s.match(/End$/)&&(P=A({},P,{type:$.type+"Aborted"})),c.dispatch(P)}return $})})}catch(g){return Promise.reject(g)}},wt=/Start$/,xs=/^bootstrap/,Ns=/^ready/;function oa(e){var t=e.pluginName,r=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(A({},e.data,{type:r,_:{called:r,from:"abort"}}))}function Ds(e,t,r){var n=t[e]||r[e];return n&&n.config?n.config:{}}function Ms(e,t){return t.reduce(function(r,n){return n[e]?r.concat({methodName:e,pluginName:n.name,method:n[e]}):r},[])}function Fs(e,t){var r=e.replace(wt,""),n=t?":"+t:"";return[""+e+n,""+r+n,r+"End"+n]}function sa(e,t){var r=e.abort;return!!r&&(r===!0||zs(r,t)||r&&zs(r.plugins,t))}function ol(e,t){var r=e.abort;if(!r)return!1;if(r===!0||De(r))return!0;var n=r.plugins;return rr(r)&&r.length===t||rr(n)&&n.length===t}function rr(e){return Array.isArray(e)}function zs(e,t){return!(!e||!rr(e))&&e.includes(t)}function Hs(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function mb(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 gb(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 Us(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,P=m.map(function(v){var I=v.loaded,O=v.name,_=v.config;return al(v,function(){return I({config:_})},1e4).then(function(C){return n[O]||(a.dispatch({type:j.pluginReadyType(O),name:O,events:Object.keys(v).filter(function(M){return!Na.includes(M)})}),n[O]=!0),S=S.concat(O),v}).catch(function(C){if(C instanceof Error)throw new Error(C);return g=g.concat(C.name),C})});Promise.all(P).then(function(v){var I={plugins:S,failed:g,disabled:$};setTimeout(function(){h.length===P.length+$.length&&a.dispatch(A({},{type:j.ready},I))},0)})}var b=function(){if(f!==j.bootstrap)return/^ready:([^:]*)$/.test(f)&&setTimeout(function(){return il(a,t,e)},0),Promise.resolve(function(v,I,O,_,C){try{var M=re(I)?I():I,F=v.type,G=F.replace(wt,"");if(v._&&v._.called)return Promise.resolve(v);var L=O.getState(),N=(B=M,(W=L.plugins)===void 0&&(W={}),(Ke=v.options)===void 0&&(Ke={}),Object.keys(B).filter(function(p){var y=Ke.plugins||{};return Xw(y[p])?y[p]:y.all!==!1&&(!W[p]||W[p].enabled!==!1)}).map(function(p){return B[p]}));F===j.initializeStart&&v.fromEnable&&(N=Object.keys(L.plugins).filter(function(p){var y=L.plugins[p];return v.plugins.includes(p)&&!y.initialized}).map(function(p){return M[p]}));var z=N.map(function(p){return p.name}),R=function(p,y,E){var U=Fs(p).map(function(x){return Ms(x,y)});return y.reduce(function(x,D){var V=D.name,w=Fs(p,V).map(function(ee){return Ms(ee,y)}),k=w[0],T=w[1],H=w[2];return k.length&&(x.beforeNS[V]=k),T.length&&(x.duringNS[V]=T),H.length&&(x.afterNS[V]=H),x},{before:U[0],beforeNS:{},during:U[1],duringNS:{},after:U[2],afterNS:{}})}(F,N);return Promise.resolve(ia({action:v,data:{exact:R.before,namespaced:R.beforeNS},state:L,allPlugins:M,allMatches:R,instance:O,store:_,EVENTS:C})).then(function(p){function y(){var x=function(){if(F.match(wt))return Promise.resolve(ia({action:A({},E,{type:G+"End"}),data:{exact:R.after,namespaced:R.afterNS},state:L,allPlugins:M,allMatches:R,instance:O,store:_,EVENTS:C})).then(function(D){D.meta&&D.meta.hasCallback&&Us(D.meta.rid,{payload:D})})}();return x&&x.then?x.then(function(){return p}):p}if(ol(p,z.length))return p;var E,U=function(){if(F!==G)return Promise.resolve(ia({action:A({},p,{type:G}),data:{exact:R.during,namespaced:R.duringNS},state:L,allPlugins:M,allMatches:R,instance:O,store:_,EVENTS:C})).then(function(x){E=x});E=p}();return U&&U.then?U.then(y):y()})}catch(p){return Promise.reject(p)}var B,W,Ke}(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 yb(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 wb=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 Et.apply(void 0,o)(n)(a)}}}}};function bb(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=Bs(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},A({},t,n)}if(/^initialize:([^:]*)$/.test(r.type)){var l=Bs(r.type,j.initialize),f=e()[l];return f&&l?(n[l]=A({},t[l],{initialized:!0,loaded:!!f.loaded({config:f.config})}),A({},t,n)):t}if(/^ready:([^:]*)$/.test(r.type))return n[r.name]=A({},t[r.name],{loaded:!0}),A({},t,n);switch(r.type){case j.disablePlugin:return A({},t,Ks(r.plugins,!1,t));case j.enablePlugin:return A({},t,Ks(r.plugins,!0,t));default:return t}}}function Bs(e,t){return e.substring(t.length+1,e.length)}function Ks(e,t,r){return e.reduce(function(n,a){return n[a]=A({},r[a],{enabled:t}),n},r)}function sl(e){try{return JSON.parse(JSON.stringify(e))}catch{}return e}var Sb={last:{},history:[]};function Ib(e,t){e===void 0&&(e=Sb);var r=t.options,n=t.meta;if(t.type===j.track){var a=sl(A({event:t.event,properties:t.properties},Object.keys(r).length&&{options:r},{meta:n}));return A({},e,{last:a,history:e.history.concat(a)})}return e}var $b={actions:[]};function kb(e,t){e===void 0&&(e=$b);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),A({},e,{actions:n});case"dequeue":return[];default:return e}}var cl=/#.*$/;function Pb(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(cl,""):"")}var ul,ll,fl,dl,Tb=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(cl,"")}(f),s={title:r,url:u,path:Pb(u),hash:l,search:f,width:o,height:c};return n&&n!==""&&(s.referrer=n),A({},s,e)},Eb={last:{},history:[]};function Ob(e,t){e===void 0&&(e=Eb);var r=t.options;if(t.type===j.page){var n=sl(A({properties:t.properties,meta:t.meta},Object.keys(r).length&&{options:r}));return A({},e,{last:n,history:e.history.concat(n)})}return e}ul=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"}(),ll=Z?document.referrer:null,fl=ab(),dl=ib();var Gs={initialized:!1,sessionId:cn(),app:null,version:null,debug:!1,offline:!!Z&&!navigator.onLine,os:{name:ul},userAgent:Z?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.13"},timezone:dl,locale:fl,campaign:{},referrer:ll};function _b(e,t){e===void 0&&(e=Gs);var r=e.initialized,n=t.campaign;switch(t.type){case j.campaign:return A({},e,{campaign:n});case j.offline:return A({},e,{offline:!0});case j.online:return A({},e,{offline:!1});default:return r?e:A({},Gs,e,{initialized:!0})}}var Rb=["plugins","reducers","storage"];function Cb(e,t,r){if(Z){var n=window[(r?"add":"remove")+"EventListener"];e.split(" ").forEach(function(a){n(a,t)})}}function jb(e){var t=Cb.bind(null,"online offline",function(r){return Promise.resolve(!navigator.onLine).then(e)});return t(!0),function(r){return t(!1)}}function hl(){return at("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 Ws(e){return function(){return Et(Et.apply(null,arguments),hl())}}function ca(e){return e?tl(e)?e:[e]:[]}function Vs(e,t,r){e===void 0&&(e={});var n,a,i=cn();return t&&(Wt[i]=(n=t,a=function(o){for(var c,l=o||Array.prototype.slice.call(arguments),f=0;f<l.length;f++)if(re(l[f])){c=l[f];break}return c}(r),function(o){a&&a(o),n(o)})),A({},e,{rid:i,ts:new Date().getTime()},t?{hasCallback:!0}:{})}function Ab(e){e===void 0&&(e={});var t=e.reducers||{},r=e.initialUser||{},n=(e.plugins||[]).reduce(function(p,y){if(re(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(D){return y.EVENTS[D]}):[];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(D,V){var w;return D[V]=(w=y.methods[V],function(){for(var k=Array.prototype.slice.call(arguments),T=new Array(w.length),H=0;H<k.length;H++)T[H]=k[H];return T[T.length]=I,w.apply({instance:I},T)}),D},{}),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:nt,setItem:at,removeItem:jt},i=function(p){return function(y,E,U){return E.getState("user")[y]||(U&&te(U)&&U[y]?U[y]:Ls(p)[y]||nt(Da(y))||null)}}(a),o=n.plugins,c=n.events.filter(function(p){return!Na.includes(p)}).sort(),l=new Set(c.concat(xr).filter(function(p){return!Na.includes(p)})),f=Array.from(l).sort(),u=function(){return o},s=new wb,d=s.addMiddleware,h=s.removeMiddleware,m=s.dynamicMiddlewares,S=function(){throw new Error("Abort disabled inListener")},g=ob(),$=Ls(a),P=A({},$,r,g.an_uid?{userId:g.an_uid}:{},g.an_aid?{anonymousId:g.an_aid}:{});P.anonymousId||(P.anonymousId=cn());var b=A({enable:function(p,y){return new Promise(function(E){R.dispatch({type:j.enablePlugin,plugins:ca(p),_:{originalAction:j.enablePlugin}},E,[y])})},disable:function(p,y){return new Promise(function(E){R.dispatch({type:j.disablePlugin,plugins:ca(p),_:{originalAction:j.disablePlugin}},E,[y])})}},n.methods),v=!1,I={identify:function(p,y,E,U){try{var x=De(p)?p:null,D=te(p)?p:y,V=E||{},w=I.user();at(Da(Le),x);var k=x||D.userId||i(Le,I,D);return Promise.resolve(new Promise(function(T){R.dispatch(A({type:j.identifyStart,userId:k,traits:D||{},options:V,anonymousId:w.anonymousId},w.id&&w.id!==x&&{previousId:w.id}),T,[y,E,U])}))}catch(T){return Promise.reject(T)}},track:function(p,y,E,U){try{var x=te(p)?p.event:p;if(!x||!De(x))throw new Error("EventMissing");var D=te(p)?p:y||{},V=te(E)?E:{};return Promise.resolve(new Promise(function(w){R.dispatch({type:j.trackStart,event:x,properties:D,options:V,userId:i(Le,I,y),anonymousId:i(gt,I,y)},w,[y,E,U])}))}catch(w){return Promise.reject(w)}},page:function(p,y,E){try{var U=te(p)?p:{},x=te(y)?y:{};return Promise.resolve(new Promise(function(D){R.dispatch({type:j.pageStart,properties:Tb(U),options:x,userId:i(Le,I,U),anonymousId:i(gt,I,U)},D,[p,y,E])}))}catch(D){return Promise.reject(D)}},user:function(p){if(p===Le||p==="id")return i(Le,I);if(p===gt||p==="anonId")return i(gt,I);var y=I.getState("user");return p?Es(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||!re(y))return!1;if(p===j.bootstrap)throw new Error(".on disabled for "+p);var E=/Start$|Start:/;if(p==="*"){var U=function(w){return function(k){return function(T){return T.type.match(E)&&y({payload:T,instance:I,plugins:o}),k(T)}}},x=function(w){return function(k){return function(T){return T.type.match(E)||y({payload:T,instance:I,plugins:o}),k(T)}}};return d(U,Er),d(x,Or),function(){h(U,Er),h(x,Or)}}var D=p.match(E)?Er:Or,V=function(w){return function(k){return function(T){return T.type===p&&y({payload:T,instance:I,plugins:o,abort:S}),k(T)}}};return d(V,D),function(){return h(V,D)}},once:function(p,y){if(!p||!re(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?Es(y,p):Object.assign({},y)},dispatch:function(p){var y=De(p)?{type:p}:p;if(xr.includes(y.type))throw new Error("reserved action "+y.type);var E=A({},y,{_:A({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(Me,p,y)},events:{core:xr,plugins:c}},O=n.middlewares.concat([function(p){return function(y){return function(E){return E.meta||(E.meta=Vs()),y(E)}}},m(Er),gb(I,u,{all:f,plugins:c}),yb(a),db(I),vb(I),m(Or)]),_={context:_b,user:hb(a),page:Ob,track:Ib,plugins:bb(u),queue:kb},C=Et,M=Et;if(Z&&e.debug){var F=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;F&&(C=F({trace:!0,traceLimit:25})),M=function(){return arguments.length===0?hl():te(typeof arguments[0])?Ws():Ws().apply(null,arguments)}}var G,L=function(p){return Object.keys(p).reduce(function(y,E){return Rb.includes(E)||(y[E]=p[E]),y},{})}(e),N=n.pluginsArray.reduce(function(p,y){var E=y.name,U=y.config,x=y.loaded,D=n.pluginEnabled[E];return p[E]={enabled:D,initialized:!!D&&!y.initialize,loaded:!!x({config:U}),config:U},p},{}),z={context:L,user:P,plugins:N},R=nl(function(p){for(var y=Object.keys(p),E={},U=0;U<y.length;U++){var x=y[U];typeof p[x]===xe&&(E[x]=p[x])}var D,V=Object.keys(E);try{(function(w){Object.keys(w).forEach(function(k){var T=w[k];if(typeof T(void 0,{type:"@@redux/INIT"})===_e||typeof T(void 0,{type:ub})===_e)throw new Error("reducer "+k+" "+_e)})})(E)}catch(w){D=w}return function(w,k){if(w===void 0&&(w={}),D)throw D;for(var T=!1,H={},ee=0;ee<V.length;ee++){var je=V[ee],Ai=w[je],fn=(0,E[je])(Ai,k);if(typeof fn===_e){var El=lb(je,k);throw new Error(El)}H[je]=fn,T=T||fn!==Ai}return T?H:w}}(A({},_,t)),z,M(C(fb.apply(void 0,O))));R.dispatch=(G=R.dispatch,function(p,y,E){var U=A({},p,{meta:Vs(p.meta,y,ca(E))});return G.apply(null,[U])});var B=Object.keys(o);R.dispatch({type:j.bootstrap,plugins:B,config:L,params:g,user:P,initialUser:r,persistedUser:$});var W=B.filter(function(p){return n.pluginEnabled[p]}),Ke=B.filter(function(p){return!n.pluginEnabled[p]});return R.dispatch({type:j.registerPlugins,plugins:B,enabled:n.pluginEnabled}),n.pluginsArray.map(function(p,y){var E=p.bootstrap,U=p.config,x=p.name;E&&re(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:W,disabled:Ke})}),jb(function(p){R.dispatch({type:p?j.offline:j.online})}),function(p,y,E){setInterval(function(){return il(p,y,E)},3e3)}(R,u,I),I}var Er="before",Or="after",qt="cookie",Ye=ml(),vl=un,Lb=un;function pl(e){return Ye?un(e,"",-1):jt(e)}function ml(){if(Ye!==void 0)return Ye;var e="cookiecookie";try{un(e,e),Ye=document.cookie.indexOf(e)!==-1,pl(e)}catch{Ye=!1}return Ye}function un(e,t,r,n,a,i){if(typeof window<"u"){var o=arguments.length>1;return Ye===!1&&(o?at(e,t):nt(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 Qt="localStorage",Ub=Ti.bind(null,"localStorage");At("localStorage","getItem",nt);At("localStorage","setItem",at);At("localStorage","removeItem",jt);var er="sessionStorage",xb=Ti.bind(null,"sessionStorage");At("sessionStorage","getItem",nt);At("sessionStorage","setItem",at);At("sessionStorage","removeItem",jt);function bt(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 Nb=Ub(),Db=xb(),Mb=ml();function gl(e,t){if(e){var r=Ei(t),n=!Ci(r),a=Oi(r)?bt(localStorage.getItem(e)):void 0;if(n&&!mt(a))return a;var i=_i(r)?bt(vl(e)):void 0;if(n&&i)return i;var o=Ri(r)?bt(sessionStorage.getItem(e)):void 0;if(n&&o)return o;var c=nt(e);return n?c:{localStorage:a,sessionStorage:o,cookie:i,global:c}}}function Fb(e,t,r){if(e&&!mt(t)){var n={},a=Ei(r),i=JSON.stringify(t),o=!Ci(a);return Oi(a)&&(n[Qt]=_r(Qt,t,bt(localStorage.getItem(e))),localStorage.setItem(e,i),o)?n[Qt]:_i(a)&&(n[qt]=_r(qt,t,bt(vl(e))),Lb(e,i),o)?n[qt]:Ri(a)&&(n[er]=_r(er,t,bt(sessionStorage.getItem(e))),sessionStorage.setItem(e,i),o)?n[er]:(n[Xt]=_r(Xt,t,nt(e)),at(e,t),o?n[Xt]:n)}}function zb(e,t){if(e){var r=Ei(t),n=gl(e,qu),a={};return!mt(n.localStorage)&&Oi(r)&&(localStorage.removeItem(e),a[Qt]=n.localStorage),!mt(n.cookie)&&_i(r)&&(pl(e),a[qt]=n.cookie),!mt(n.sessionStorage)&&Ri(r)&&(sessionStorage.removeItem(e),a[er]=n.sessionStorage),!mt(n.global)&&ln(r,Xt)&&(jt(e),a[Xt]=n.global),a}}function Ei(e){return e?De(e)?e:e.storage:Xu}function Oi(e){return Nb&&ln(e,Qt)}function _i(e){return Mb&&ln(e,qt)}function Ri(e){return Db&&ln(e,er)}function Ci(e){return e===qu||e==="all"}function ln(e,t){return e===Xu||e===t||Ci(e)}function _r(e,t,r){return{location:e,current:t,previous:r}}var Hb={setItem:Fb,getItem:gl,removeItem:zb};function Bb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zs(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 Ys(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zs(Object(r),!0).forEach(function(n){Bb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={storage:Hb};return Ab(Ys(Ys({},t),e))}function Gb(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 Wb(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=Zb(f);return a!==u&&(a=u,setTimeout(()=>e(f),0)),c.apply(r,l)}})}function Vb(e,t){const r=e.indexOf(t);return r>-1?e.slice(0,r):e}function Zb(e){return["#","?"].forEach(t=>e=Vb(e,t)),e}function Yb(){Wb(()=>{Oe.page()})}function Jb(e){if(e===void 0&&(e={}),!Z)return xa;var t=Xs(),r=Ma(),n=Js(),a=Rr(n,t),i=Rr(r,t),o=[],c=[],l=[],f=n,u=a,s=i,d=Object.keys(e);if(!d.length)return xa;var h=d.map(function(S){return Number(S)}),m=cb(function(){var S=Xs(),g=function(L,N){return N.map(function(z){return z===100?L-5:L*(z/100)})}(S,h),$=Ma(),P=Js(),b=Rr(P,S),v=Rr($,S);if(u=b>u?b:u,s=v<s?v:s,!(o.length>=h.length)){var I=f===P,O="up";I?O="initial":f<=P&&(O="down");var _=g,C=h;(O==="up"||I)&&(_=g.slice().reverse(),C=h.slice().reverse());var M=C.reduce(function(L,N,z){var R=_[z];return l.includes(N)&&P<=R&&(l=l.filter(function(B){return B!==N}),L.singleFunction=N),O==="down"&&!o.includes(N)&&P>=R&&N>i?(c.push(N),L.callbacks=L.callbacks.concat(N),L):O==="up"&&!o.includes(N)&&P<=R&&N<=b?(L.foundFunc=[N],L):(I&&P>=R&&L.foundFunc.length===0&&(L.foundFunc=[N]),!c.includes(N)&&P>=R&&(c.push(N),L.singleFunction?l.push(N):L.singleFunction=N),L)},{foundFunc:[],singleFunction:null,callbacks:[],direction:O});if(f=P,O==="down"&&M.callbacks&&M.callbacks.forEach(function(L){re(e[L])&&(e[L]({trigger:L,direction:O,scrollMin:s,scrollMax:u,range:[s,u]}),o.push(L))}),M.singleFunction){var F=M.singleFunction,G=M.direction;re(e[F])&&e[F]({trigger:F,direction:G,scrollMin:s,scrollMax:u,range:[s,u]}),o.push(F)}}},500);return window.addEventListener("scroll",m),function(){return window.removeEventListener("scroll",m)}}function Ma(){return Z?document.body.scrollTop||document.documentElement.scrollTop:0}function Xb(){return Z?window.innerHeight||document.documentElement.clientHeight:0}function Js(){return Math.round(Ma()+Xb())}function Xs(){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 Rr(e,t){return Math.round(e/t*100)}var qs="EventListener";function qb(e){return function(t,r,n,a){var i=n||xa,o=a||!1;if(!Z)return i;var c=Vr(r),l=Vr(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"+qs:"remove"+qs,h=0;h<l.length;h++){var m=l[h];f[h]=s?o&&o.once?Qb(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 Vr(e,t){if(De(e))return t?Vr(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=nb(e);return t?i.map(function(o){return De(o)?Vr(o,!0):o}).flat():i}function Qb(e,t){var r;return function(){return e&&(r=e.apply(this,arguments),e=null),r}}var ua=qb("Event");function yl(e,t){return Z&&re(window[e])?(r=window[e],n=t,(a=window)===void 0&&(a=null),re(r)?function(){r.apply(a,arguments),n.apply(a,arguments)}:n):window[e]=t;var r,n,a}yl.bind(null,"onerror");yl.bind(null,"onload");var wl=typeof window>"u",Qs="hidden";function eS(e){if(wl)return!1;var t=tS(),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 tS(){var e=["webkit","moz","ms","o"];return wl||Qs in document?Qs:e.reduce(function(t,r){var n=r+"Hidden";return!t&&n in document?n:t},null)}var rS=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function nS(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=eS(function(c){c||r({type:"tabVisible"})});return n=[o].concat(rS.map(function(c){return ua(document,c,r)})).concat(ua(window,"load",r)).concat(ua(window,"scroll",r,{capture:!0,passive:!0})),i}function i(){n.map(function(o){return o()})}return a(),function(){return i(),a}}function aS(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(Ht(d),g),a&&u&&(u=!1,a(Ht(r),g),d=new Date),t=setTimeout(function(){u=!0,n&&(r=new Date,n(Ht(d),g))},c)}var S=nS(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:Ht(d,s),idle:u?Ht(r,s):0}}}}function Ht(e,t){return t?0:Math.round((new Date-e)/1e3)}const ec=5e3;class iS{constructor(t){oe(this,"element");oe(this,"isInViewport",!1);oe(this,"isAwake",!1);oe(this,"isFlushing");oe(this,"observer");oe(this,"lastEventAt",Date.now());oe(this,"registeredView",!1);oe(this,"viewCallback");oe(this,"activeDurationCallback");oe(this,"idleDurationCallback");oe(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),aS({onIdle:r=>this.handleAwake(!1,r),onWakeUp:r=>this.handleAwake(!0,r),timeout:ec}),Jb({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*ec: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 tc="sesamy_session_id";function oS(){let e=sessionStorage.getItem(tc);return e||(e=Math.random().toString(36).slice(2,9),sessionStorage.setItem(tc,e)),e}let bl=!1,Fa,rc,Zr;function sS({clientId:e,enabled:t=!0,environment:r}){if(Fa=e,rc=t,Zr=`${Ue("logs",r)}/events`,!rc)return;Yb();const n=new iS({element:document.body,viewCallback:()=>{Oe.page()},activeDurationCallback:(a,i,o)=>{Oe.track("activeDuration",{duration:a,durationStart:o,flushing:i})},idleDurationCallback:(a,i,o)=>{Oe.track("idleDuration",{duration:a,durationStart:o,flushing:i})},scrollCallback:a=>{Oe.track("scroll",{scroll:a.scrollMax})}});lS(document.body,()=>{n.flush()}),fS(document.body,()=>{n.handleVisibilityChange()}),window.addEventListener(ye.AUTHENTICATED,async a=>{const i=a;await Oe.identify(i.detail.sub)}),window.addEventListener(ye.LOGOUT,async()=>{await Oe.track("logout",{}),ji.flush(),await Oe.reset()})}function Sl(e){return JSON.stringify(e.map(t=>({...t,clientId:Fa,requestId:Math.random().toString(36).slice(2,9),sessionId:oS(),timestamp:new Date().toISOString(),version:Pi,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:Ju,userAgent:navigator.userAgent,clientId:Fa}})))}const ji=Gb(async e=>{if(e.length>0){const t=Sl(e);bl?navigator.sendBeacon(Zr,t):(await fetch(Zr,{method:"POST",body:t,headers:{"Content-Type":"text/plain"}})).ok}},{max:10,interval:3e3});function la(e){var t;if(e.anonymousId)if((t=e.properties)!=null&&t.flushing){const r={...e};delete r.properties.flushing,navigator.sendBeacon(Zr,Sl([r]))}else ji.push(e)}const Oe=Kb({app:Ju,version:Pi,plugins:[{name:"custom-analytics-plugin",page:({payload:e})=>{const{properties:t,anonymousId:r,userId:n,event:a}=e;la({anonymousId:r,userId:n,properties:t,event:a,type:"page"})},track:({payload:e})=>{const{properties:t,anonymousId:r,userId:n,event:a}=e;la({anonymousId:r,userId:n,properties:t,event:a,type:"track"})},identify:({payload:e})=>{const{properties:t,anonymousId:r,userId:n}=e;la({anonymousId:r,userId:n,properties:t,type:"identify"})}}]});function cS(e,t){Oe.track(e,t)}function uS(){return bl=!0,ji.flush()}const Il=new Map;function lS(e,t){Il.set(e,t)}window.addEventListener("beforeunload",()=>{Il.forEach((e,t)=>{e.bind(t)()}),uS()});const $l=new Map;function fS(e,t){$l.set(e,t)}window.addEventListener("visibilitychange",()=>{document.visibilityState!=="visible"&&$l.forEach((e,t)=>{e.bind(t)()})});const kl="sesamySignedURLs";function Pl(){const e=sessionStorage.getItem(kl);return e?JSON.parse(e):[]}function dS(e){const t=Pl();t.push(e),sessionStorage.setItem(kl,JSON.stringify(t))}function hS(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:P,setUserMetadata:b,deleteUserMetadata:v,getTally:I,getTallies:O,pushTally:_,deleteTally:C,getProduct:M,getPaymentIssues:F,isSpotifyLinked:G,unlinkSpotify:L,linkSpotify:N,autoOnboardProduct:z,openHostedAccountPage:R,generateLink:B}=Vw(e),W={auth:{getUser:d,isAuthenticated:$i,loginWithRedirect:ki,logout:Ku,setToken:Wu},checkouts:{get:r,create:t,update:n},profile:{get:d,update:h,openHostedAccountPage:R,isSpotifyLinked:G,unlinkSpotify:L},analytics:{track:cS},tags:{list:m,set:g,delete:S},entitlements:{get:a,list:i,access:o,signedLinks:Pl},contracts:{get:l,list:f},bills:{get:u,list:s},userMetadata:{get:$,list:P,set:b,delete:v},tallies:{get:I,list:O,push:_,delete:C},subscriptions:{list:c},products:{get:M,autoOnboard:z,linkSpotify:N},getVersion:vS,getPaymentIssues:F,generateLink:B,clearCache:pe};return e.namespace&&(window[e.namespace]=W),W}function vS(){return Pi}async function pS({enabled:e=!1,rules:t}){if(!e)return;const r=await $i(),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 nc(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 nc(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 nc(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 mS(){const e=new URLSearchParams(window.location.hash.substring(1)),t=e.get("access_token");if(t){Wu(t);const r=new URL(window.location.href);e.delete("access_token"),r.hash=e.toString(),window.history.replaceState(null,"",r)}}const ac="sesamy-refresh",ic="force-refetch-entitlements";function gS(){const e=new URLSearchParams(window.location.search),t=e.get(ic),r=e.get(ac);if(t!==null||r!==null){const n=new URL(window.location.href);e.delete(ic),e.delete(ac),n.search=e.toString(),pe(),window.history.replaceState(null,"",n)}}function yS(){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;dS({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 oc="sesamy-user";async function wS(){const t=new URLSearchParams(window.location.search).get(oc);if(!t)return;const r=await Lw();(r==null?void 0:r.email)!==t&&(pe(),ki({authorizationParams:{email_hint:t,login_hint:t}}));const n=new URL(window.location.href);n.searchParams.delete(oc),window.history.replaceState(null,"",n)}const sc="sesamy-purchase";function bS(){const e=new URLSearchParams(window.location.search),t=e.get(sc);if(t!==null){const r=new URL(window.location.href);e.delete(sc),r.search=e.toString(),Fe(ye.PURCHASE,{itemSrc:t}),pe(),window.history.replaceState(null,"",r)}}const cc="sesamy-login";async function SS(){if(!new URLSearchParams(window.location.search).get(cc))return;await $i()||ki();const n=new URL(window.location.href);n.searchParams.delete(cc),window.history.replaceState(null,"",n)}async function Tl(e){sS({clientId:e.clientId,environment:e.environment,...e.analytics}),await Aw({clientId:e.clientId,organization:e.organization,environment:e.environment,...e.auth}),e.transform&&await pS(e.transform);const t=hS({clientId:e.clientId,environment:e.environment,...e.api});return Fe(ye.READY,{}),mS(),gS(),yS(),await SS(),await wS(),bS(),t}if(typeof document<"u"){const e=document.getElementById("sesamy-js");if(e!=null&&e.textContent)try{const t=JSON.parse(e.textContent);Tl(t)}catch(t){console.error("Failed to parse config",t)}}exports.init=Tl;
|