@revenuecat/purchases-js 0.12.1 → 0.13.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.
@@ -1,7 +1,7 @@
1
- (function(_,P){typeof exports=="object"&&typeof module<"u"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(_=typeof globalThis<"u"?globalThis:_||self,P(_.Purchases={}))})(this,function(_){"use strict";var Ql=Object.create;var Ht=Object.defineProperty;var Zl=Object.getOwnPropertyDescriptor;var Ii=(_,P)=>(P=Symbol[_])?P:Symbol.for("Symbol."+_),Cr=_=>{throw TypeError(_)};var xi=(_,P,N)=>P in _?Ht(_,P,{enumerable:!0,configurable:!0,writable:!0,value:N}):_[P]=N;var yi=(_,P)=>Ht(_,"name",{value:P,configurable:!0});var Pi=_=>[,,,Ql((_==null?void 0:_[Ii("metadata")])??null)],Ti=["class","method","getter","setter","accessor","field","value","get","set"],jr=_=>_!==void 0&&typeof _!="function"?Cr("Function expected"):_,Xl=(_,P,N,ve,Y)=>({kind:Ti[_],name:P,metadata:ve,addInitializer:Z=>N._?Cr("Already initialized"):Y.push(jr(Z||null))}),Vt=(_,P)=>xi(P,Ii("metadata"),_[3]),Ai=(_,P,N,ve)=>{for(var Y=0,Z=_[P>>1],Oe=Z&&Z.length;Y<Oe;Y++)P&1?Z[Y].call(N):ve=Z[Y].call(N,ve);return ve},Oi=(_,P,N,ve,Y,Z)=>{var Oe,oe,Hr,Ve,mr,k=P&7,Je=!!(P&8),Ee=!!(P&16),Me=k>3?_.length+1:k?Je?1:2:0,Vr=Ti[k+5],Gr=k>3&&(_[Me-1]=[]),Le=_[Me]||(_[Me]=[]),ae=k&&(!Ee&&!Je&&(Y=Y.prototype),k<5&&(k>3||!Ee)&&Zl(k<4?Y:{get[N](){return Ei(this,Z)},set[N](te){return wi(this,Z,te)}},N));k?Ee&&k<4&&yi(Z,(k>2?"set ":k>1?"get ":"")+N):yi(Y,N);for(var br=ve.length-1;br>=0;br--)Ve=Xl(k,N,Hr={},_[3],Le),k&&(Ve.static=Je,Ve.private=Ee,mr=Ve.access={has:Ee?te=>Jl(Y,te):te=>N in te},k^3&&(mr.get=Ee?te=>(k^1?Ei:ec)(te,Y,k^4?Z:ae.get):te=>te[N]),k>2&&(mr.set=Ee?(te,Be)=>wi(te,Y,Be,k^4?Z:ae.set):(te,Be)=>te[N]=Be)),oe=(0,ve[br])(k?k<4?Ee?Z:ae[Vr]:k>4?void 0:{get:ae.get,set:ae.set}:Y,Ve),Hr._=1,k^4||oe===void 0?jr(oe)&&(k>4?Gr.unshift(oe):k?Ee?Z=oe:ae[Vr]=oe:Y=oe):typeof oe!="object"||oe===null?Cr("Object expected"):(jr(Oe=oe.get)&&(ae.get=Oe),jr(Oe=oe.set)&&(ae.set=Oe),jr(Oe=oe.init)&&Gr.unshift(Oe));return k||Vt(_,Y),ae&&Ht(Y,N,ae),Ee?k^4?Z:ae:Y},D=(_,P,N)=>xi(_,typeof P!="symbol"?P+"":P,N),Gt=(_,P,N)=>P.has(_)||Cr("Cannot "+N),Jl=(_,P)=>Object(P)!==P?Cr('Cannot use the "in" operator on this value'):_.has(P),Ei=(_,P,N)=>(Gt(_,P,"read from private field"),N?N.call(_):P.get(_));var wi=(_,P,N,ve)=>(Gt(_,P,"write to private field"),ve?ve.call(_,N):P.set(_,N),N),ec=(_,P,N)=>(Gt(_,P,"access private method"),N);var mi,jt;const P="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(P);let N=!1;function ve(){N=!0}ve();const Y=1,Z=2,Oe=4,oe=8,Hr=16,Ve=1,mr=2,k=Symbol(),Je="http://www.w3.org/2000/svg",Ee=!1;var Me=Array.isArray,Vr=Array.from,Gr=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,ae=Object.getOwnPropertyDescriptors,br=Object.prototype,te=Array.prototype,Be=Object.getPrototypeOf;function ki(e){return e()}function dt(e){for(var r=0;r<e.length;r++)e[r]()}const $e=2,Yt=4,yr=8,vt=16,xe=32,Er=64,Ge=128,Yr=256,ne=512,Fe=1024,er=2048,rr=4096,wr=8192,Ni=16384,Wr=32768,Ri=65536,Si=1<<18,Wt=1<<19,tr=Symbol("$state"),Ui=Symbol("");function zt(e){return e===this.v}function Li(e,r){return e!=e?r==r:e!==r||e!==null&&typeof e=="object"||typeof e=="function"}function pt(e){return!Li(e,this.v)}function $i(e){throw new Error("effect_in_teardown")}function Di(){throw new Error("effect_in_unowned_derived")}function Mi(e){throw new Error("effect_orphan")}function Bi(){throw new Error("effect_update_depth_exceeded")}function Fi(e){throw new Error("lifecycle_legacy_only")}function qi(e){throw new Error("props_invalid_value")}function ji(){throw new Error("state_descriptors_fixed")}function Ci(){throw new Error("state_prototype_fixed")}function Hi(){throw new Error("state_unsafe_local_read")}function Vi(){throw new Error("state_unsafe_mutation")}function ke(e){return{f:0,v:e,reactions:null,equals:zt,version:0}}function Kt(e,r=!1){var n;const t=ke(e);return r||(t.equals=pt),N&&U!==null&&U.l!==null&&((n=U.l).s??(n.s=[])).push(t),t}function pe(e,r=!1){return Gi(Kt(e,r))}function Gi(e){return q!==null&&q.f&$e&&(Re===null?Ji([e]):Re.push(e)),e}function R(e,r){return q!==null&&Xr()&&q.f&($e|vt)&&(Re===null||!Re.includes(e))&&Vi(),Yi(e,r)}function Yi(e,r){return e.equals(r)||(e.v=r,e.version=dn(),Qt(e,Fe),Xr()&&M!==null&&M.f&ne&&!(M.f&xe)&&(J!==null&&J.includes(e)?(Pe(M,Fe),Jr(M)):Ce===null?eo([e]):Ce.push(e))),r}function Qt(e,r){var t=e.reactions;if(t!==null)for(var n=Xr(),i=t.length,o=0;o<i;o++){var a=t[o],s=a.f;s&Fe||!n&&a===M||(Pe(a,r),s&(ne|Ge)&&(s&$e?Qt(a,er):Jr(a)))}}function zr(e){var r=$e|Fe;M===null?r|=Ge:M.f|=Wt;const t={children:null,ctx:U,deps:null,equals:zt,f:r,fn:e,reactions:null,v:null,version:0,parent:M};if(q!==null&&q.f&$e){var n=q;(n.children??(n.children=[])).push(t)}return t}function he(e){const r=zr(e);return r.equals=pt,r}function Zt(e){var r=e.children;if(r!==null){e.children=null;for(var t=0;t<r.length;t+=1){var n=r[t];n.f&$e?ht(n):qe(n)}}}function Xt(e){var r,t=M;Ne(e.parent);try{Zt(e),r=vn(e)}finally{Ne(t)}return r}function Jt(e){var r=Xt(e),t=(or||e.f&Ge)&&e.deps!==null?er:ne;Pe(e,t),e.equals(r)||(e.v=r,e.version=dn())}function ht(e){Zt(e),Ar(e,0),Pe(e,wr),e.v=e.children=e.deps=e.ctx=e.reactions=null}function en(e){M===null&&q===null&&Mi(),q!==null&&q.f&Ge&&Di(),It&&$i()}function Wi(e,r){var t=r.last;t===null?r.last=r.first=e:(t.next=e,e.prev=t,r.last=e)}function nr(e,r,t,n=!0){var i=(e&Er)!==0,o=M,a={ctx:U,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:e|Fe,first:null,fn:r,last:null,next:null,parent:i?null:o,prev:null,teardown:null,transitions:null,version:0};if(t){var s=ir;try{cn(!0),Or(a),a.f|=Ni}catch(u){throw qe(a),u}finally{cn(s)}}else r!==null&&Jr(a);var c=t&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&Wt)===0;if(!c&&!i&&n&&(o!==null&&Wi(a,o),q!==null&&q.f&$e)){var l=q;(l.children??(l.children=[])).push(a)}return a}function rn(e){const r=nr(yr,null,!1);return Pe(r,ne),r.teardown=e,r}function gt(e){en();var r=M!==null&&(M.f&xe)!==0&&U!==null&&!U.m;if(r){var t=U;(t.e??(t.e=[])).push({fn:e,effect:M,reaction:q})}else{var n=_t(e);return n}}function zi(e){return en(),Ir(e)}function Ki(e){const r=nr(Er,e,!0);return()=>{qe(r)}}function _t(e){return nr(Yt,e,!1)}function Ye(e,r){var t=U,n={effect:null,ran:!1};t.l.r1.push(n),n.effect=Ir(()=>{e(),!n.ran&&(n.ran=!0,R(t.l.r2,!0),sr(r))})}function mt(){var e=U;Ir(()=>{if(v(e.l.r2)){for(var r of e.l.r1){var t=r.effect;t.f&ne&&Pe(t,er),ar(t)&&Or(t),r.ran=!1}e.l.r2.v=!1}})}function Ir(e){return nr(yr,e,!0)}function G(e){return Kr(e)}function Kr(e,r=0){return nr(yr|vt|r,e,!0)}function xr(e,r=!0){return nr(yr|xe,e,!0,r)}function tn(e){var r=e.teardown;if(r!==null){const t=It,n=q;un(!0),je(null);try{r.call(null)}finally{un(t),je(n)}}}function nn(e){var r=e.deriveds;if(r!==null){e.deriveds=null;for(var t=0;t<r.length;t+=1)ht(r[t])}}function on(e,r=!1){var t=e.first;for(e.first=e.last=null;t!==null;){var n=t.next;qe(t,r),t=n}}function Qi(e){for(var r=e.first;r!==null;){var t=r.next;r.f&xe||qe(r),r=t}}function qe(e,r=!0){var t=!1;if((r||e.f&Si)&&e.nodes_start!==null){for(var n=e.nodes_start,i=e.nodes_end;n!==null;){var o=n===i?null:Tt(n);n.remove(),n=o}t=!0}on(e,r&&!t),nn(e),Ar(e,0),Pe(e,wr);var a=e.transitions;if(a!==null)for(const c of a)c.stop();tn(e);var s=e.parent;s!==null&&s.first!==null&&an(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.parent=e.fn=e.nodes_start=e.nodes_end=null}function an(e){var r=e.parent,t=e.prev,n=e.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),r!==null&&(r.first===e&&(r.first=n),r.last===e&&(r.last=t))}function bt(e,r){var t=[];sn(e,t,!0),Zi(t,()=>{qe(e),r&&r()})}function Zi(e,r){var t=e.length;if(t>0){var n=()=>--t||r();for(var i of e)i.out(n)}else r()}function sn(e,r,t){if(!(e.f&rr)){if(e.f^=rr,e.transitions!==null)for(const a of e.transitions)(a.is_global||t)&&r.push(a);for(var n=e.first;n!==null;){var i=n.next,o=(n.f&Wr)!==0||(n.f&xe)!==0;sn(n,r,o?t:!1),n=i}}}function yt(e){ln(e,!0)}function ln(e,r){if(e.f&rr){ar(e)&&Or(e),e.f^=rr;for(var t=e.first;t!==null;){var n=t.next,i=(t.f&Wr)!==0||(t.f&xe)!==0;ln(t,i?r:!1),t=n}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||r)&&o.in()}}let Et=!1,wt=[];function Xi(){Et=!1;const e=wt.slice();wt=[],dt(e)}function Pr(e){Et||(Et=!0,queueMicrotask(Xi)),wt.push(e)}function Qr(e){throw new Error("lifecycle_outside_component")}let Zr=!1,ir=!1,It=!1;function cn(e){ir=e}function un(e){It=e}let xt=[],Tr=0,rc=[],q=null;function je(e){q=e}let M=null;function Ne(e){M=e}let Re=null;function Ji(e){Re=e}let J=null,ge=0,Ce=null;function eo(e){Ce=e}let fn=0,or=!1,U=null;function dn(){return++fn}function Xr(){return!N||U!==null&&U.l===null}function ar(e){var a,s;var r=e.f;if(r&Fe)return!0;if(r&er){var t=e.deps,n=(r&Ge)!==0;if(t!==null){var i;if(r&Yr){for(i=0;i<t.length;i++)((a=t[i]).reactions??(a.reactions=[])).push(e);e.f^=Yr}for(i=0;i<t.length;i++){var o=t[i];if(ar(o)&&Jt(o),n&&M!==null&&!or&&!((s=o==null?void 0:o.reactions)!=null&&s.includes(e))&&(o.reactions??(o.reactions=[])).push(e),o.version>e.version)return!0}}n||Pe(e,ne)}return!1}function ro(e,r,t){throw e}function vn(e){var d;var r=J,t=ge,n=Ce,i=q,o=or,a=Re,s=U,c=e.f;J=null,ge=0,Ce=null,q=c&(xe|Er)?null:e,or=!ir&&(c&Ge)!==0,Re=null,U=e.ctx;try{var l=(0,e.fn)(),u=e.deps;if(J!==null){var f;if(Ar(e,ge),u!==null&&ge>0)for(u.length=ge+J.length,f=0;f<J.length;f++)u[ge+f]=J[f];else e.deps=u=J;if(!or)for(f=ge;f<u.length;f++)((d=u[f]).reactions??(d.reactions=[])).push(e)}else u!==null&&ge<u.length&&(Ar(e,ge),u.length=ge);return l}finally{J=r,ge=t,Ce=n,q=i,or=o,Re=a,U=s}}function to(e,r){let t=r.reactions;if(t!==null){var n=t.indexOf(e);if(n!==-1){var i=t.length-1;i===0?t=r.reactions=null:(t[n]=t[i],t.pop())}}t===null&&r.f&$e&&(J===null||!J.includes(r))&&(Pe(r,er),r.f&(Ge|Yr)||(r.f^=Yr),Ar(r,0))}function Ar(e,r){var t=e.deps;if(t!==null)for(var n=r;n<t.length;n++)to(e,t[n])}function Or(e){var r=e.f;if(!(r&wr)){Pe(e,ne);var t=M;M=e;try{r&vt?Qi(e):on(e),nn(e),tn(e);var n=vn(e);e.teardown=typeof n=="function"?n:null,e.version=fn}catch(i){ro(i)}finally{M=t}}}function no(){Tr>1e3&&(Tr=0,Bi()),Tr++}function io(e){var r=e.length;if(r!==0){no();var t=ir;ir=!0;try{for(var n=0;n<r;n++){var i=e[n];i.f&ne||(i.f^=ne);var o=[];pn(i,o),oo(o)}}finally{ir=t}}}function oo(e){var r=e.length;if(r!==0)for(var t=0;t<r;t++){var n=e[t];!(n.f&(wr|rr))&&ar(n)&&(Or(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?an(n):n.fn=null))}}function ao(){if(Zr=!1,Tr>1001)return;const e=xt;xt=[],io(e),Zr||(Tr=0)}function Jr(e){Zr||(Zr=!0,queueMicrotask(ao));for(var r=e;r.parent!==null;){r=r.parent;var t=r.f;if(t&(Er|xe)){if(!(t&ne))return;r.f^=ne}}xt.push(r)}function pn(e,r){var t=e.first,n=[];e:for(;t!==null;){var i=t.f,o=(i&xe)!==0,a=o&&(i&ne)!==0;if(!a&&!(i&rr))if(i&yr){o?t.f^=ne:ar(t)&&Or(t);var s=t.first;if(s!==null){t=s;continue}}else i&Yt&&n.push(t);var c=t.next;if(c===null){let f=t.parent;for(;f!==null;){if(e===f)break e;var l=f.next;if(l!==null){t=l;continue e}f=f.parent}}t=c}for(var u=0;u<n.length;u++)s=n[u],r.push(s),pn(s,r)}function v(e){var s;var r=e.f,t=(r&$e)!==0;if(t&&r&wr){var n=Xt(e);return ht(e),n}if(q!==null){Re!==null&&Re.includes(e)&&Hi();var i=q.deps;J===null&&i!==null&&i[ge]===e?ge++:J===null?J=[e]:J.push(e),Ce!==null&&M!==null&&M.f&ne&&!(M.f&xe)&&Ce.includes(e)&&(Pe(M,Fe),Jr(M))}else if(t&&e.deps===null){var o=e,a=o.parent;a!==null&&!((s=a.deriveds)!=null&&s.includes(o))&&(a.deriveds??(a.deriveds=[])).push(o)}return t&&(o=e,ar(o)&&Jt(o)),e.v}function sr(e){const r=q;try{return q=null,e()}finally{q=r}}const so=~(Fe|er|ne);function Pe(e,r){e.f=e.f&so|r}function lo(e){return gn().get(e)}function hn(e,r){return gn().set(e,r),r}function gn(e){return U===null&&Qr(),U.c??(U.c=new Map(co(U)||void 0))}function co(e){let r=e.p;for(;r!==null;){const t=r.c;if(t!==null)return t;r=r.p}return null}function we(e,r=!1,t){U={p:U,c:null,e:null,m:!1,s:e,x:null,l:null},N&&!r&&(U.l={s:null,u:null,r1:[],r2:ke(!1)})}function Ie(e){const r=U;if(r!==null){e!==void 0&&(r.x=e);const a=r.e;if(a!==null){var t=M,n=q;r.e=null;try{for(var i=0;i<a.length;i++){var o=a[i];Ne(o.effect),je(o.reaction),_t(o.fn)}}finally{Ne(t),je(n)}}U=r.p,r.m=!0}return e||{}}function ee(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(tr in e)Pt(e);else if(!Array.isArray(e))for(let r in e){const t=e[r];typeof t=="object"&&t&&tr in t&&Pt(t)}}}function Pt(e,r=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!r.has(e)){r.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Pt(e[n],r)}catch{}const t=Be(e);if(t!==Object.prototype&&t!==Array.prototype&&t!==Map.prototype&&t!==Set.prototype&&t!==Date.prototype){const n=ae(t);for(let i in n){const o=n[i].get;if(o)try{o.call(e)}catch{}}}}}function lr(e,r=null,t){if(typeof e!="object"||e===null||tr in e)return e;const n=Be(e);if(n!==br&&n!==te)return e;var i=new Map,o=Me(e),a=ke(0);o&&i.set("length",ke(e.length));var s;return new Proxy(e,{defineProperty(c,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&ji();var f=i.get(l);return f===void 0?(f=ke(u.value),i.set(l,f)):R(f,lr(u.value,s)),!0},deleteProperty(c,l){var u=i.get(l);if(u===void 0)l in c&&i.set(l,ke(k));else{if(o&&typeof l=="string"){var f=i.get("length"),d=Number(l);Number.isInteger(d)&&d<f.v&&R(f,d)}R(u,k),_n(a)}return!0},get(c,l,u){var w;if(l===tr)return e;var f=i.get(l),d=l in c;if(f===void 0&&(!d||(w=Le(c,l))!=null&&w.writable)&&(f=ke(lr(d?c[l]:k,s)),i.set(l,f)),f!==void 0){var m=v(f);return m===k?void 0:m}return Reflect.get(c,l,u)},getOwnPropertyDescriptor(c,l){var u=Reflect.getOwnPropertyDescriptor(c,l);if(u&&"value"in u){var f=i.get(l);f&&(u.value=v(f))}else if(u===void 0){var d=i.get(l),m=d==null?void 0:d.v;if(d!==void 0&&m!==k)return{enumerable:!0,configurable:!0,value:m,writable:!0}}return u},has(c,l){var m;if(l===tr)return!0;var u=i.get(l),f=u!==void 0&&u.v!==k||Reflect.has(c,l);if(u!==void 0||M!==null&&(!f||(m=Le(c,l))!=null&&m.writable)){u===void 0&&(u=ke(f?lr(c[l],s):k),i.set(l,u));var d=v(u);if(d===k)return!1}return f},set(c,l,u,f){var A;var d=i.get(l),m=l in c;if(o&&l==="length")for(var w=u;w<d.v;w+=1){var g=i.get(w+"");g!==void 0?R(g,k):w in c&&(g=ke(k),i.set(w+"",g))}d===void 0?(!m||(A=Le(c,l))!=null&&A.writable)&&(d=ke(void 0),R(d,lr(u,s)),i.set(l,d)):(m=d.v!==k,R(d,lr(u,s)));var T=Reflect.getOwnPropertyDescriptor(c,l);if(T!=null&&T.set&&T.set.call(f,u),!m){if(o&&typeof l=="string"){var b=i.get("length"),I=Number(l);Number.isInteger(I)&&I>=b.v&&R(b,I+1)}_n(a)}return!0},ownKeys(c){v(a);var l=Reflect.ownKeys(c).filter(d=>{var m=i.get(d);return m===void 0||m.v!==k});for(var[u,f]of i)f.v!==k&&!(u in c)&&l.push(u);return l},setPrototypeOf(){Ci()}})}function _n(e,r=1){R(e,e.v+r)}var mn,bn,yn;function uo(){if(mn===void 0){mn=window;var e=Element.prototype,r=Node.prototype;bn=Le(r,"firstChild").get,yn=Le(r,"nextSibling").get,e.__click=void 0,e.__className="",e.__attributes=null,e.__styles=null,e.__e=void 0,Text.prototype.__t=void 0}}function et(e=""){return document.createTextNode(e)}function kr(e){return bn.call(e)}function Tt(e){return yn.call(e)}function x(e,r){return kr(e)}function B(e,r){{var t=kr(e);return t instanceof Comment&&t.data===""?Tt(t):t}}function L(e,r=1,t=!1){let n=e;for(;r--;)n=Tt(n);return n}let fo=!1;function vo(e,r){if(r){const t=document.body;e.autofocus=!0,Pr(()=>{document.activeElement===t&&e.focus()})}}let En=!1;function po(){En||(En=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var r;if(!e.defaultPrevented)for(const t of e.target.elements)(r=t.__on_r)==null||r.call(t)})},{capture:!0}))}function wn(e){var r=q,t=M;je(null),Ne(null);try{return e()}finally{je(r),Ne(t)}}function ho(e,r,t,n=t){e.addEventListener(r,()=>wn(t));const i=e.__on_r;i?e.__on_r=()=>{i(),n()}:e.__on_r=n,po()}const In=new Set,At=new Set;function xn(e,r,t,n){function i(o){if(n.capture||Nr.call(r,o),!o.cancelBubble)return wn(()=>t.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Pr(()=>{r.addEventListener(e,i,n)}):r.addEventListener(e,i,n),i}function rt(e,r,t,n,i){var o={capture:n,passive:i},a=xn(e,r,t,o);(r===document.body||r===window||r===document)&&rn(()=>{r.removeEventListener(e,a,o)})}function go(e){for(var r=0;r<e.length;r++)In.add(e[r]);for(var t of At)t(e)}function Nr(e){var I;var r=this,t=r.ownerDocument,n=e.type,i=((I=e.composedPath)==null?void 0:I.call(e))||[],o=i[0]||e.target,a=0,s=e.__root;if(s){var c=i.indexOf(s);if(c!==-1&&(r===document||r===window)){e.__root=r;return}var l=i.indexOf(r);if(l===-1)return;c<=l&&(a=c)}if(o=i[a]||e.target,o!==r){Gr(e,"currentTarget",{configurable:!0,get(){return o||t}});var u=q,f=M;je(null),Ne(null);try{for(var d,m=[];o!==null;){var w=o.assignedSlot||o.parentNode||o.host||null;try{var g=o["__"+n];if(g!==void 0&&!o.disabled)if(Me(g)){var[T,...b]=g;T.apply(o,[e,...b])}else g.call(o,e)}catch(A){d?m.push(A):d=A}if(e.cancelBubble||w===r||w===null)break;o=w}if(d){for(let A of m)queueMicrotask(()=>{throw A});throw d}}finally{e.__root=r,delete e.currentTarget,je(u),Ne(f)}}}function Pn(e){var r=document.createElement("template");return r.innerHTML=e,r.content}function cr(e,r){var t=M;t.nodes_start===null&&(t.nodes_start=e,t.nodes_end=r)}function E(e,r){var t=(r&Ve)!==0,n=(r&mr)!==0,i,o=!e.startsWith("<!>");return()=>{i===void 0&&(i=Pn(o?e:"<!>"+e),t||(i=kr(i)));var a=n?document.importNode(i,!0):i.cloneNode(!0);if(t){var s=kr(a),c=a.lastChild;cr(s,c)}else cr(a,a);return a}}function We(e=""){{var r=et(e+"");return cr(r,r),r}}function _e(){var e=document.createDocumentFragment(),r=document.createComment(""),t=et();return e.append(r,t),cr(r,t),e}function p(e,r){e!==null&&e.before(r)}function _o(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const mo=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function bo(e){return mo.includes(e)}const yo={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"};function Eo(e){return e=e.toLowerCase(),yo[e]??e}const wo=["touchstart","touchmove"];function Io(e){return wo.includes(e)}function se(e,r){var t=r==null?"":typeof r=="object"?r+"":r;t!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=t,e.nodeValue=t==null?"":t+"")}function xo(e,r){return Po(e,r)}const ur=new Map;function Po(e,{target:r,anchor:t,props:n={},events:i,context:o,intro:a=!0}){uo();var s=new Set,c=f=>{for(var d=0;d<f.length;d++){var m=f[d];if(!s.has(m)){s.add(m);var w=Io(m);r.addEventListener(m,Nr,{passive:w});var g=ur.get(m);g===void 0?(document.addEventListener(m,Nr,{passive:w}),ur.set(m,1)):ur.set(m,g+1)}}};c(Vr(In)),At.add(c);var l=void 0,u=Ki(()=>{var f=t??r.appendChild(et());return xr(()=>{if(o){we({});var d=U;d.c=o}i&&(n.$$events=i),l=e(f,n)||{},o&&Ie()}),()=>{var w;for(var d of s){r.removeEventListener(d,Nr);var m=ur.get(d);--m===0?(document.removeEventListener(d,Nr),ur.delete(d)):ur.set(d,m)}At.delete(c),Tn.delete(l),f!==t&&((w=f.parentNode)==null||w.removeChild(f))}});return Tn.set(l,u),l}let Tn=new WeakMap;function F(e,r,t,n=null,i=!1){var o=e,a=null,s=null,c=null,l=i?Wr:0;Kr(()=>{c!==(c=!!r())&&(c?(a?yt(a):a=xr(()=>t(o)),s&&bt(s,()=>{s=null})):(s?yt(s):n&&(s=xr(()=>n(o))),a&&bt(a,()=>{a=null})))},l)}function Rr(e,r,t,n,i){var o=e,a="",s;Kr(()=>{a!==(a=r()??"")&&(s!==void 0&&(qe(s),s=void 0),a!==""&&(s=xr(()=>{var c=a+"",l=Pn(c);cr(kr(l),l.lastChild),o.before(l)})))})}function K(e,r,t,n,i){var s;var o=(s=r.$$slots)==null?void 0:s[t],a=!1;o===!0&&(o=r[t==="default"?"children":t],a=!0),o===void 0||o(e,a?()=>n:n)}function To(e,r,t,n,i,o){var a,s,c=null,l=e,u;Kr(()=>{const f=r()||null;var d=f==="svg"?Je:null;f!==a&&(u&&(f===null?bt(u,()=>{u=null,s=null}):f===s?yt(u):qe(u)),f&&f!==s&&(u=xr(()=>{if(c=d?document.createElementNS(d,f):document.createElement(f),cr(c,c),n){var m=c.appendChild(et());n(c,m)}M.nodes_end=c,l.before(c)})),a=f,a&&(s=a))},Wr)}function j(e,r){Pr(()=>{var t=e.getRootNode(),n=t.host?t:t.head??t.ownerDocument.head;if(!n.querySelector("#"+r.hash)){const i=document.createElement("style");i.id=r.hash,i.textContent=r.code,n.appendChild(i)}})}function le(e,r,t,n){var i=e.__attributes??(e.__attributes={});i[r]!==(i[r]=t)&&(r==="style"&&"__styles"in e&&(e.__styles={}),r==="loading"&&(e[Ui]=t),t==null?e.removeAttribute(r):typeof t!="string"&&On(e).includes(r)?e[r]=t:e.setAttribute(r,t))}function Ao(e,r,t,n,i=!1,o=!1,a=!1){var s={},c=e.tagName==="OPTION";for(var l in r)l in t||(t[l]=null);t.class=t.class?t.class+" "+n:n;var u=On(e),f=e.__attributes??(e.__attributes={}),d=[];for(const b in t){let I=t[b];if(c&&b==="value"&&I==null){e.value=e.__value="",s[b]=I;continue}var m=s[b];if(I!==m){s[b]=I;var w=b[0]+b[1];if(w!=="$$"){if(w==="on"){const A={},y="$$"+b;let O=b.slice(2);var g=bo(O);if(_o(O)&&(O=O.slice(0,-7),A.capture=!0),!g&&m){if(I!=null)continue;e.removeEventListener(O,s[y],A),s[y]=null}if(I!=null)if(g)e[`__${O}`]=I,go([O]);else{let V=function($){s[b].call(this,$)};d.push([b,I,()=>s[y]=xn(O,e,V,A)])}}else if(b==="style"&&I!=null)e.style.cssText=I+"";else if(b==="autofocus")vo(e,!!I);else if(b==="__value"||b==="value"&&I!=null)e.value=e[b]=e.__value=I;else{var T=b;i||(T=Eo(T)),I==null&&!o?(f[b]=null,e.removeAttribute(b)):u.includes(T)&&(o||typeof I!="string")?e[T]=I:typeof I!="function"&&le(e,T,I)}b==="style"&&"__styles"in e&&(e.__styles={})}}}return Pr(()=>{if(e.isConnected)for(const[b,I,A]of d)s[b]===I&&A()}),s}var An=new Map;function On(e){var r=An.get(e.nodeName);if(r)return r;An.set(e.nodeName,r=[]);for(var t,n=Be(e),i=Element.prototype;i!==n;){t=ae(n);for(var o in t)t[o].set&&r.push(o);n=Be(n)}return r}function kn(e,r){var t=e.__className,n=Oo(r);(t!==n||fo)&&(r==null?e.removeAttribute("class"):e.className=n,e.__className=n)}function Oo(e){return e??""}function ko(e,r,t=r){var n=Xr();ho(e,"input",()=>{var i=Nn(e)?Rn(e.value):e.value;t(i),n&&i!==(i=r())&&(e.value=i??"")}),Ir(()=>{var i=r();Nn(e)&&i===Rn(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function Nn(e){var r=e.type;return r==="number"||r==="range"}function Rn(e){return e===""?null:+e}function tt(e,r,t){var n=Le(e,r);n&&n.set&&(e[r]=t,rn(()=>{e[r]=null}))}function Sn(e,r){return e===r||(e==null?void 0:e[tr])===r}function No(e={},r,t,n){return _t(()=>{var i,o;return Ir(()=>{i=o,o=[],sr(()=>{e!==t(...o)&&(r(e,...o),i&&Sn(t(...i),e)&&r(null,...i))})}),()=>{Pr(()=>{o&&Sn(t(...o),e)&&r(null,...o)})}}),e}function Un(e){return function(...r){var t=r[0];return t.preventDefault(),e==null?void 0:e.apply(this,r)}}function Te(e=!1){const r=U,t=r.l.u;if(!t)return;let n=()=>ee(r.s);if(e){let i=0,o={};const a=zr(()=>{let s=!1;const c=r.s;for(const l in c)c[l]!==o[l]&&(o[l]=c[l],s=!0);return s&&i++,i});n=()=>v(a)}t.b.length&&zi(()=>{Ln(r,n),dt(t.b)}),gt(()=>{const i=sr(()=>t.m.map(ki));return()=>{for(const o of i)typeof o=="function"&&o()}}),t.a.length&&gt(()=>{Ln(r,n),dt(t.a)})}function Ln(e,r){if(e.l.s)for(const t of e.l.s)v(t);r()}function $n(e,r){var o;var t=(o=e.$$events)==null?void 0:o[r.type],n=Me(t)?t.slice():t==null?[]:[t];for(var i of n)i.call(this,r)}function nt(e){U===null&&Qr(),N&&U.l!==null?Dn(U).m.push(e):gt(()=>{const r=sr(e);if(typeof r=="function")return r})}function Ro(e,r,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(e,{detail:r,bubbles:t,cancelable:n})}function So(){const e=U;return e===null&&Qr(),(r,t,n)=>{var o;const i=(o=e.s.$$events)==null?void 0:o[r];if(i){const a=Me(i)?i.slice():[i],s=Ro(r,t,n);for(const c of a)c.call(e.x,s);return!s.defaultPrevented}return!0}}function Uo(e){U===null&&Qr(),U.l===null&&Fi(),Dn(U).b.push(e)}function Dn(e){var r=e.l;return r.u??(r.u={a:[],b:[],m:[]})}let it=!1;function Lo(e){var r=it;try{return it=!1,[e(),it]}finally{it=r}}function Mn(e){for(var r=M,t=M;r!==null&&!(r.f&(xe|Er));)r=r.parent;try{return Ne(r),e()}finally{Ne(t)}}function h(e,r,t,n){var V;var i=(t&Y)!==0,o=!N||(t&Z)!==0,a=(t&oe)!==0,s=(t&Hr)!==0,c=!1,l;a?[l,c]=Lo(()=>e[r]):l=e[r];var u=(V=Le(e,r))==null?void 0:V.set,f=n,d=!0,m=!1,w=()=>(m=!0,d&&(d=!1,s?f=sr(n):f=n),f);l===void 0&&n!==void 0&&(u&&o&&qi(),l=w(),u&&u(l));var g;if(o)g=()=>{var $=e[r];return $===void 0?w():(d=!0,m=!1,$)};else{var T=Mn(()=>(i?zr:he)(()=>e[r]));T.f|=Ri,g=()=>{var $=v(T);return $!==void 0&&(f=void 0),$===void 0?f:$}}if(!(t&Oe))return g;if(u){var b=e.$$legacy;return function($,H){return arguments.length>0?((!o||!H||b||c)&&u(H?g():$),$):g()}}var I=!1,A=!1,y=Kt(l),O=Mn(()=>zr(()=>{var $=g(),H=v(y);return I?(I=!1,A=!0,H):(A=!1,y.v=$)}));return i||(O.equals=pt),function($,H){if(arguments.length>0){const Q=H?v(O):o&&a?lr($):$;return O.equals(Q)||(I=!0,R(y,Q),m&&f!==void 0&&(f=Q),sr(()=>v(O))),$}return v(O)}}const $o={hash:"svelte-1bzqb13",code:".rcb-modal-section.svelte-1bzqb13 {padding:8px 0px;display:flex;}section.rcb-modal-section.svelte-1bzqb13 {flex-grow:1;}.rcb-modal-section.svelte-1bzqb13:last-of-type {padding:0;}"};function fr(e,r){j(e,$o);let t=h(r,"as",8,"section");var n=_e(),i=B(n);To(i,t,!1,(o,a)=>{Ao(o,null,{class:"rcb-modal-section"},"svelte-1bzqb13",o.namespaceURI===Je,o.nodeName.includes("-"));var s=_e(),c=B(s);K(c,r,"default",{}),p(a,s)}),p(e,n)}var ce=(e=>(e[e.Silent=0]="Silent",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose",e))(ce||{});class C{static setLogLevel(r){this.logLevel=r}static log(r,t=this.logLevel){const n=`[Purchases] ${r}`;if(!(this.logLevel<t||t===ce.Silent))switch(t){case ce.Error:console.error(n);break;case ce.Warn:console.warn(n);break;case ce.Info:console.info(n);break;case ce.Debug:console.debug(n);break;case ce.Verbose:console.debug(n);break}}static errorLog(r){this.log(r,ce.Error)}static warnLog(r){this.log(r,ce.Warn)}static infoLog(r){this.log(r,ce.Info)}static debugLog(r){this.log(r,ce.Debug)}static verboseLog(r){this.log(r,ce.Verbose)}}D(C,"logLevel",ce.Silent);var De=(e=>(e.Year="year",e.Month="month",e.Week="week",e.Day="day",e))(De||{});function Ot(e){const r=e.match(/^PT?([0-9]+)([MDYW])$/);if(!r||r.length<3)return C.errorLog(`Invalid ISO 8601 duration format: ${e}`),null;const t=parseInt(r[1]);switch(r[2]){case"Y":return{number:t,unit:"year"};case"M":return{number:t,unit:"month"};case"W":return{number:t,unit:"week"};case"D":return{number:t,unit:"day"};default:return C.errorLog(`Invalid ISO 8601 unit duration format: ${e}`),null}}const Do=(e,r,t)=>{const n=e/1e6;return new Intl.NumberFormat(t,{style:"currency",currency:r}).format(n)},Mo=e=>{const r=e.number;if(r===1)switch(e.unit){case De.Year:return"yearly";case De.Month:return"monthly";case De.Week:return"weekly";case De.Day:return"daily"}else return`every ${r} ${e.unit}s`},Bo=e=>{const r=e.number;if(r===1)switch(e.unit){case De.Year:return"1 year";case De.Month:return"1 month";case De.Week:return"1 week";case De.Day:return"1 day"}else return`${r} ${e.unit}s`},Fo=e=>{const r=Ot(e);return r?Mo(r):"unknown"},qo=e=>{const r=Ot(e);return r?Bo(r):"unknown"};function jo(e){return e!=null}var Bn=(e=>(e.Unknown="unknown",e.Custom="custom",e.Lifetime="$rc_lifetime",e.Annual="$rc_annual",e.SixMonth="$rc_six_month",e.ThreeMonth="$rc_three_month",e.TwoMonth="$rc_two_month",e.Monthly="$rc_monthly",e.Weekly="$rc_weekly",e))(Bn||{}),dr=(e=>(e.Subscription="subscription",e.Consumable="consumable",e.NonConsumable="non_consumable",e))(dr||{});const Fn=e=>({amount:e.amount_micros/1e4,amountMicros:e.amount_micros,currency:e.currency,formattedPrice:Do(e.amount_micros,e.currency)}),qn=e=>{const r=e.period_duration;return{periodDuration:r,period:r?Ot(r):null,cycleCount:e.cycle_count,price:e.price?Fn(e.price):null}},Co=e=>e.base==null?(C.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,base:qn(e.base),trial:e.trial?qn(e.trial):null},Ho=e=>e.base_price==null?(C.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,basePrice:Fn(e.base_price)},Vo=(e,r)=>{const t=e.product_type;return t==="subscription"?Yo(e,r,t):Go(e,r,t)},Go=(e,r,t)=>{const n={};if(Object.entries(e.purchase_options).forEach(([a,s])=>{const c=Ho(s);c!=null&&(n[a]=c)}),Object.keys(n).length===0)return C.debugLog(`Product ${e.identifier} has no purchase options. Ignoring.`),null;const i=e.default_purchase_option_id,o=i&&i in e.purchase_options?n[i]:null;return o==null?(C.debugLog(`Product ${e.identifier} has no default purchase option. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:t,currentPrice:o.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:r.offeringIdentifier,presentedOfferingContext:r,defaultPurchaseOption:o,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:o}},Yo=(e,r,t)=>{const n={};if(Object.entries(e.purchase_options).forEach(([s,c])=>{const l=Co(c);l!=null&&(n[s]=l)}),Object.keys(n).length===0)return C.debugLog(`Product ${e.identifier} has no subscription options. Ignoring.`),null;const i=e.default_purchase_option_id,o=i&&i in n?n[i]:null;if(o==null)return C.debugLog(`Product ${e.identifier} has no default subscription option. Ignoring.`),null;const a=o.base.price;return a==null?(C.debugLog(`Product ${e.identifier} default option has no base price. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:t,currentPrice:a,normalPeriodDuration:o.base.periodDuration,presentedOfferingIdentifier:r.offeringIdentifier,presentedOfferingContext:r,defaultPurchaseOption:o,defaultSubscriptionOption:o,subscriptionOptions:n,defaultNonSubscriptionOption:null}},Wo=(e,r,t)=>{const n=t[r.platform_product_identifier];if(n===void 0)return null;const i=Vo(n,e);return i===null?null:{identifier:r.identifier,rcBillingProduct:i,packageType:Ko(r.identifier)}},zo=(e,r,t,n)=>{const i={offeringIdentifier:r.identifier,targetingContext:e&&n?{ruleId:n.rule_id,revision:n.revision}:null,placementIdentifier:null},o=r.packages.map(s=>Wo(i,s,t)).filter(jo),a={};for(const s of o)s!=null&&(a[s.identifier]=s);return o.length==0?null:{identifier:r.identifier,serverDescription:r.description,metadata:r.metadata,packagesById:a,availablePackages:o,lifetime:a.$rc_lifetime??null,annual:a.$rc_annual??null,sixMonth:a.$rc_six_month??null,threeMonth:a.$rc_three_month??null,twoMonth:a.$rc_two_month??null,monthly:a.$rc_monthly??null,weekly:a.$rc_weekly??null}};function Ko(e){switch(e){case"$rc_lifetime":return"$rc_lifetime";case"$rc_annual":return"$rc_annual";case"$rc_six_month":return"$rc_six_month";case"$rc_three_month":return"$rc_three_month";case"$rc_two_month":return"$rc_two_month";case"$rc_monthly":return"$rc_monthly";case"$rc_weekly":return"$rc_weekly";default:return e.startsWith("$rc_")?"unknown":"custom"}}var Qo=E('<span class="rcb-product-price-after-trial svelte-1mdrqnh"> </span>'),Zo=E('<span class="rcb-product-description svelte-1mdrqnh"> </span>'),Xo=E("<li> </li>"),Jo=E('<span class="rcb-product-price svelte-1mdrqnh"><!> <!></span> <!> <!> <ul class="rcb-product-details svelte-1mdrqnh"><!> <li>Continues until canceled</li> <li>Cancel anytime</li></ul>',1),ea=E('<span class="rcb-product-description svelte-1mdrqnh"> </span>'),ra=E('<span class="rcb-product-price svelte-1mdrqnh"> </span> <!>',1),ta=E('<div class="rcb-pricing-info svelte-1mdrqnh"><span class="rc-product-title"> </span> <!> <!></div>');const na={hash:"svelte-1mdrqnh",code:`.rcb-pricing-info.svelte-1mdrqnh {display:flex;flex-direction:column;margin-top:102px;font-weight:500;}.rcb-product-price.svelte-1mdrqnh {color:var(--rc-color-grey-text-dark);font-size:24px;margin:12px 0px;}.rcb-product-description.svelte-1mdrqnh {color:var(--rc-color-grey-text-dark);margin:0 0 12px 0;}.rcb-product-price-after-trial.svelte-1mdrqnh {margin-bottom:12px;}.rcb-product-details.svelte-1mdrqnh {color:var(--rc-color-grey-text-light);list-style-type:disc;list-style-position:inside;margin:0px;padding:0px;}
1
+ (function(E,O){typeof exports=="object"&&typeof module<"u"?O(exports):typeof define=="function"&&define.amd?define(["exports"],O):(E=typeof globalThis<"u"?globalThis:E||self,O(E.Purchases={}))})(this,function(E){"use strict";var Pu=Object.create;var _r=Object.defineProperty;var ku=Object.getOwnPropertyDescriptor;var lo=(E,O)=>(O=Symbol[E])?O:Symbol.for("Symbol."+E),nn=E=>{throw TypeError(E)};var co=(E,O,R)=>O in E?_r(E,O,{enumerable:!0,configurable:!0,writable:!0,value:R}):E[O]=R;var oo=(E,O)=>_r(E,"name",{value:O,configurable:!0});var uo=E=>[,,,Pu((E==null?void 0:E[lo("metadata")])??null)],fo=["class","method","getter","setter","accessor","field","value","get","set"],tn=E=>E!==void 0&&typeof E!="function"?nn("Function expected"):E,Tu=(E,O,R,me,$)=>({kind:fo[E],name:O,metadata:me,addInitializer:ee=>R._?nn("Already initialized"):$.push(tn(ee||null))}),br=(E,O)=>co(O,lo("metadata"),E[3]),vo=(E,O,R,me)=>{for(var $=0,ee=E[O>>1],Ae=ee&&ee.length;$<Ae;$++)O&1?ee[$].call(R):me=ee[$].call(R,me);return me},go=(E,O,R,me,$,ee)=>{var Ae,ge,rn,nt,kt,H=O&7,Tt=!!(O&8),ke=!!(O&16),At=H>3?E.length+1:H?Tt?1:2:0,on=fo[H+5],oe=H>3&&(E[At-1]=[]),Ot=E[At]||(E[At]=[]),ye=H&&(!ke&&!Tt&&($=$.prototype),H<5&&(H>3||!ke)&&ku(H<4?$:{get[R](){return ao(this,ee)},set[R](ue){return so(this,ee,ue)}},R));H?ke&&H<4&&oo(ee,(H>2?"set ":H>1?"get ":"")+R):oo($,R);for(var Nt=me.length-1;Nt>=0;Nt--)nt=Tu(H,R,rn={},E[3],Ot),H&&(nt.static=Tt,nt.private=ke,kt=nt.access={has:ke?ue=>Au($,ue):ue=>R in ue},H^3&&(kt.get=ke?ue=>(H^1?ao:Ou)(ue,$,H^4?ee:ye.get):ue=>ue[R]),H>2&&(kt.set=ke?(ue,qe)=>so(ue,$,qe,H^4?ee:ye.set):(ue,qe)=>ue[R]=qe)),ge=(0,me[Nt])(H?H<4?ke?ee:ye[on]:H>4?void 0:{get:ye.get,set:ye.set}:$,nt),rn._=1,H^4||ge===void 0?tn(ge)&&(H>4?oe.unshift(ge):H?ke?ee=ge:ye[on]=ge:$=ge):typeof ge!="object"||ge===null?nn("Object expected"):(tn(Ae=ge.get)&&(ye.get=Ae),tn(Ae=ge.set)&&(ye.set=Ae),tn(Ae=ge.init)&&oe.unshift(Ae));return H||br(E,$),ye&&_r($,R,ye),ke?H^4?ee:ye:$},D=(E,O,R)=>co(E,typeof O!="symbol"?O+"":O,R),mr=(E,O,R)=>O.has(E)||nn("Cannot "+R),Au=(E,O)=>Object(O)!==O?nn('Cannot use the "in" operator on this value'):E.has(O),ao=(E,O,R)=>(mr(E,O,"read from private field"),R?R.call(E):O.get(E));var so=(E,O,R,me)=>(mr(E,O,"write to private field"),me?me.call(E,R):O.set(E,R),R),Ou=(E,O,R)=>(mr(E,O,"access private method"),R);var ro,hr;const O="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(O);let R=!1;function me(){R=!0}me();const $=1,ee=2,Ae=4,ge=8,rn=16,nt=1,kt=2,H=4,Tt=8,ke=16,At=1,on=2,oe=Symbol(),Ot="http://www.w3.org/2000/svg",ye=/[&"<]/g;function Nt(e,t){const n=String(e??""),r=ye;r.lastIndex=0;let i="",o=0;for(;r.test(n);){const a=r.lastIndex-1,s=n[a];i+=n.substring(o,a)+(s==="&"?"&amp;":s==='"'?"&quot;":"&lt;"),o=a+1}return i+n.substring(o)}const ue=!1;var qe=Array.isArray,An=Array.from,ho=Object.defineProperty,je=Object.getOwnPropertyDescriptor,yr=Object.getOwnPropertyDescriptors,po=Object.prototype,_o=Array.prototype,an=Object.getPrototypeOf;function St(e){return typeof e=="function"}const $e=()=>{};function bo(e){return e()}function On(e){for(var t=0;t<e.length;t++)e[t]()}const Fe=2,wr=4,Rt=8,Nn=16,Oe=32,Lt=64,rt=128,sn=256,fe=512,Ke=1024,dt=2048,Le=4096,Ut=8192,mo=16384,vt=32768,yo=65536,wo=1<<18,Er=1<<19,Qe=Symbol("$state"),xr=Symbol("legacy props"),Eo=Symbol("");function Ir(e){return e===this.v}function Pr(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Sn(e){return!Pr(e,this.v)}function xo(e){throw new Error("effect_in_teardown")}function Io(){throw new Error("effect_in_unowned_derived")}function Po(e){throw new Error("effect_orphan")}function ko(){throw new Error("effect_update_depth_exceeded")}function To(e){throw new Error("lifecycle_legacy_only")}function Ao(e){throw new Error("props_invalid_value")}function Oo(){throw new Error("state_descriptors_fixed")}function No(){throw new Error("state_prototype_fixed")}function So(){throw new Error("state_unsafe_local_read")}function Ro(){throw new Error("state_unsafe_mutation")}function Te(e){return{f:0,v:e,reactions:null,equals:Ir,version:0}}function ln(e,t=!1){var r;const n=Te(e);return t||(n.equals=Sn),R&&M!==null&&M.l!==null&&((r=M.l).s??(r.s=[])).push(n),n}function we(e,t=!1){return Lo(ln(e,t))}function Lo(e){return V!==null&&V.f&Fe&&(De===null?qo([e]):De.push(e)),e}function S(e,t){return V!==null&&fn()&&V.f&(Fe|Nn)&&(De===null||!De.includes(e))&&Ro(),Rn(e,t)}function Rn(e,t){return e.equals(t)||(e.v=t,e.version=jr(),kr(e,Ke),fn()&&L!==null&&L.f&fe&&!(L.f&Oe)&&(ae!==null&&ae.includes(e)?(Ne(L,Ke),dn(L)):Ze===null?jo([e]):Ze.push(e))),t}function kr(e,t){var n=e.reactions;if(n!==null)for(var r=fn(),i=n.length,o=0;o<i;o++){var a=n[o],s=a.f;s&Ke||!r&&a===L||(Ne(a,t),s&(fe|rt)&&(s&Fe?kr(a,dt):dn(a)))}}function J(e){var t=Fe|Ke;L===null?t|=rt:L.f|=Er;const n={children:null,ctx:M,deps:null,equals:Ir,f:t,fn:e,reactions:null,v:null,version:0,parent:L};if(V!==null&&V.f&Fe){var r=V;(r.children??(r.children=[])).push(n)}return n}function Ee(e){const t=J(e);return t.equals=Sn,t}function Tr(e){var t=e.children;if(t!==null){e.children=null;for(var n=0;n<t.length;n+=1){var r=t[n];r.f&Fe?Ln(r):Ue(r)}}}function Ar(e){var t,n=L;Me(e.parent);try{Tr(e),t=Fr(e)}finally{Me(n)}return t}function Or(e){var t=Ar(e),n=(_t||e.f&rt)&&e.deps!==null?dt:fe;Ne(e,n),e.equals(t)||(e.v=t,e.version=jr())}function Ln(e){Tr(e),qt(e,0),Ne(e,Ut),e.v=e.children=e.deps=e.ctx=e.reactions=null}function Nr(e){L===null&&V===null&&Po(),V!==null&&V.f&rt&&Io(),Fn&&xo()}function Uo(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function gt(e,t,n,r=!0){var i=(e&Lt)!==0,o=L,a={ctx:M,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:e|Ke,first:null,fn:t,last:null,next:null,parent:i?null:o,prev:null,teardown:null,transitions:null,version:0};if(n){var s=pt;try{Cr(!0),jt(a),a.f|=mo}catch(d){throw Ue(a),d}finally{Cr(s)}}else t!==null&&dn(a);var l=n&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&Er)===0;if(!l&&!i&&r&&(o!==null&&Uo(a,o),V!==null&&V.f&Fe)){var c=V;(c.children??(c.children=[])).push(a)}return a}function Un(e){const t=gt(Rt,null,!1);return Ne(t,fe),t.teardown=e,t}function Mn(e){Nr();var t=L!==null&&(L.f&Oe)!==0&&M!==null&&!M.m;if(t){var n=M;(n.e??(n.e=[])).push({fn:e,effect:L,reaction:V})}else{var r=Dn(e);return r}}function Mo(e){return Nr(),Mt(e)}function Do(e){const t=gt(Lt,e,!0);return()=>{Ue(t)}}function Dn(e){return gt(wr,e,!1)}function it(e,t){var n=M,r={effect:null,ran:!1};n.l.r1.push(r),r.effect=Mt(()=>{e(),!r.ran&&(r.ran=!0,S(n.l.r2,!0),at(t))})}function Cn(){var e=M;Mt(()=>{if(g(e.l.r2)){for(var t of e.l.r1){var n=t.effect;n.f&fe&&Ne(n,dt),bt(n)&&jt(n),t.ran=!1}e.l.r2.v=!1}})}function Mt(e){return gt(Rt,e,!0)}function q(e){return ot(e)}function ot(e,t=0){return gt(Rt|Nn|t,e,!0)}function He(e,t=!0){return gt(Rt|Oe,e,!0,t)}function Sr(e){var t=e.teardown;if(t!==null){const n=Fn,r=V;Br(!0),We(null);try{t.call(null)}finally{Br(n),We(r)}}}function Rr(e){var t=e.deriveds;if(t!==null){e.deriveds=null;for(var n=0;n<t.length;n+=1)Ln(t[n])}}function Lr(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){var r=n.next;Ue(n,t),n=r}}function Co(e){for(var t=e.first;t!==null;){var n=t.next;t.f&Oe||Ue(t),t=n}}function Ue(e,t=!0){var n=!1;if((t||e.f&wo)&&e.nodes_start!==null){for(var r=e.nodes_start,i=e.nodes_end;r!==null;){var o=r===i?null:vn(r);r.remove(),r=o}n=!0}Lr(e,t&&!n),Rr(e),qt(e,0),Ne(e,Ut);var a=e.transitions;if(a!==null)for(const l of a)l.stop();Sr(e);var s=e.parent;s!==null&&s.first!==null&&Ur(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.parent=e.fn=e.nodes_start=e.nodes_end=null}function Ur(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Dt(e,t){var n=[];Bn(e,n,!0),Mr(n,()=>{Ue(e),t&&t()})}function Mr(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function Bn(e,t,n){if(!(e.f&Le)){if(e.f^=Le,e.transitions!==null)for(const a of e.transitions)(a.is_global||n)&&t.push(a);for(var r=e.first;r!==null;){var i=r.next,o=(r.f&vt)!==0||(r.f&Oe)!==0;Bn(r,t,o?n:!1),r=i}}}function Ct(e){Dr(e,!0)}function Dr(e,t){if(e.f&Le){bt(e)&&jt(e),e.f^=Le;for(var n=e.first;n!==null;){var r=n.next,i=(n.f&vt)!==0||(n.f&Oe)!==0;Dr(n,i?t:!1),n=r}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||t)&&o.in()}}let qn=!1,jn=[];function Bo(){qn=!1;const e=jn.slice();jn=[],On(e)}function ht(e){qn||(qn=!0,queueMicrotask(Bo)),jn.push(e)}function cn(e){throw new Error("lifecycle_outside_component")}let un=!1,pt=!1,Fn=!1;function Cr(e){pt=e}function Br(e){Fn=e}let Hn=[],Bt=0,Nu=[],V=null;function We(e){V=e}let L=null;function Me(e){L=e}let De=null;function qo(e){De=e}let ae=null,xe=0,Ze=null;function jo(e){Ze=e}let qr=0,_t=!1,M=null;function jr(){return++qr}function fn(){return!R||M!==null&&M.l===null}function bt(e){var a,s;var t=e.f;if(t&Ke)return!0;if(t&dt){var n=e.deps,r=(t&rt)!==0;if(n!==null){var i;if(t&sn){for(i=0;i<n.length;i++)((a=n[i]).reactions??(a.reactions=[])).push(e);e.f^=sn}for(i=0;i<n.length;i++){var o=n[i];if(bt(o)&&Or(o),r&&L!==null&&!_t&&!((s=o==null?void 0:o.reactions)!=null&&s.includes(e))&&(o.reactions??(o.reactions=[])).push(e),o.version>e.version)return!0}}r||Ne(e,fe)}return!1}function Fo(e,t,n){throw e}function Fr(e){var u;var t=ae,n=xe,r=Ze,i=V,o=_t,a=De,s=M,l=e.f;ae=null,xe=0,Ze=null,V=l&(Oe|Lt)?null:e,_t=!pt&&(l&rt)!==0,De=null,M=e.ctx;try{var c=(0,e.fn)(),d=e.deps;if(ae!==null){var f;if(qt(e,xe),d!==null&&xe>0)for(d.length=xe+ae.length,f=0;f<ae.length;f++)d[xe+f]=ae[f];else e.deps=d=ae;if(!_t)for(f=xe;f<d.length;f++)((u=d[f]).reactions??(u.reactions=[])).push(e)}else d!==null&&xe<d.length&&(qt(e,xe),d.length=xe);return c}finally{ae=t,xe=n,Ze=r,V=i,_t=o,De=a,M=s}}function Ho(e,t){let n=t.reactions;if(n!==null){var r=n.indexOf(e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}n===null&&t.f&Fe&&(ae===null||!ae.includes(t))&&(Ne(t,dt),t.f&(rt|sn)||(t.f^=sn),qt(t,0))}function qt(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Ho(e,n[r])}function jt(e){var t=e.f;if(!(t&Ut)){Ne(e,fe);var n=L;L=e;try{t&Nn?Co(e):Lr(e),Rr(e),Sr(e);var r=Fr(e);e.teardown=typeof r=="function"?r:null,e.version=qr}catch(i){Fo(i)}finally{L=n}}}function Vo(){Bt>1e3&&(Bt=0,ko()),Bt++}function zo(e){var t=e.length;if(t!==0){Vo();var n=pt;pt=!0;try{for(var r=0;r<t;r++){var i=e[r];i.f&fe||(i.f^=fe);var o=[];Hr(i,o),Go(o)}}finally{pt=n}}}function Go(e){var t=e.length;if(t!==0)for(var n=0;n<t;n++){var r=e[n];!(r.f&(Ut|Le))&&bt(r)&&(jt(r),r.deps===null&&r.first===null&&r.nodes_start===null&&(r.teardown===null?Ur(r):r.fn=null))}}function Yo(){if(un=!1,Bt>1001)return;const e=Hn;Hn=[],zo(e),un||(Bt=0)}function dn(e){un||(un=!0,queueMicrotask(Yo));for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(n&(Lt|Oe)){if(!(n&fe))return;t.f^=fe}}Hn.push(t)}function Hr(e,t){var n=e.first,r=[];e:for(;n!==null;){var i=n.f,o=(i&Oe)!==0,a=o&&(i&fe)!==0;if(!a&&!(i&Le))if(i&Rt){o?n.f^=fe:bt(n)&&jt(n);var s=n.first;if(s!==null){n=s;continue}}else i&wr&&r.push(n);var l=n.next;if(l===null){let f=n.parent;for(;f!==null;){if(e===f)break e;var c=f.next;if(c!==null){n=c;continue e}f=f.parent}}n=l}for(var d=0;d<r.length;d++)s=r[d],t.push(s),Hr(s,t)}function g(e){var s;var t=e.f,n=(t&Fe)!==0;if(n&&t&Ut){var r=Ar(e);return Ln(e),r}if(V!==null){De!==null&&De.includes(e)&&So();var i=V.deps;ae===null&&i!==null&&i[xe]===e?xe++:ae===null?ae=[e]:ae.push(e),Ze!==null&&L!==null&&L.f&fe&&!(L.f&Oe)&&Ze.includes(e)&&(Ne(L,Ke),dn(L))}else if(n&&e.deps===null){var o=e,a=o.parent;a!==null&&!((s=a.deriveds)!=null&&s.includes(o))&&(a.deriveds??(a.deriveds=[])).push(o)}return n&&(o=e,bt(o)&&Or(o)),e.v}function at(e){const t=V;try{return V=null,e()}finally{V=t}}const $o=~(Ke|dt|fe);function Ne(e,t){e.f=e.f&$o|t}function Ko(e){return zr().get(e)}function Vr(e,t){return zr().set(e,t),t}function zr(e){return M===null&&cn(),M.c??(M.c=new Map(Qo(M)||void 0))}function Qo(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}function W(e,t=!1,n){M={p:M,c:null,e:null,m:!1,s:e,x:null,l:null},R&&!t&&(M.l={s:null,u:null,r1:[],r2:Te(!1)})}function Z(e){const t=M;if(t!==null){e!==void 0&&(t.x=e);const a=t.e;if(a!==null){var n=L,r=V;t.e=null;try{for(var i=0;i<a.length;i++){var o=a[i];Me(o.effect),We(o.reaction),Dn(o.fn)}}finally{Me(n),We(r)}}M=t.p,t.m=!0}return e||{}}function se(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Qe in e)Vn(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&Qe in n&&Vn(n)}}}function Vn(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{Vn(e[r],t)}catch{}const n=an(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=yr(n);for(let i in r){const o=r[i].get;if(o)try{o.call(e)}catch{}}}}}function st(e,t=null,n){if(typeof e!="object"||e===null||Qe in e)return e;const r=an(e);if(r!==po&&r!==_o)return e;var i=new Map,o=qe(e),a=Te(0);o&&i.set("length",Te(e.length));var s;return new Proxy(e,{defineProperty(l,c,d){(!("value"in d)||d.configurable===!1||d.enumerable===!1||d.writable===!1)&&Oo();var f=i.get(c);return f===void 0?(f=Te(d.value),i.set(c,f)):S(f,st(d.value,s)),!0},deleteProperty(l,c){var d=i.get(c);if(d===void 0)c in l&&i.set(c,Te(oe));else{if(o&&typeof c=="string"){var f=i.get("length"),u=Number(c);Number.isInteger(u)&&u<f.v&&S(f,u)}S(d,oe),Gr(a)}return!0},get(l,c,d){var _;if(c===Qe)return e;var f=i.get(c),u=c in l;if(f===void 0&&(!u||(_=je(l,c))!=null&&_.writable)&&(f=Te(st(u?l[c]:oe,s)),i.set(c,f)),f!==void 0){var v=g(f);return v===oe?void 0:v}return Reflect.get(l,c,d)},getOwnPropertyDescriptor(l,c){var d=Reflect.getOwnPropertyDescriptor(l,c);if(d&&"value"in d){var f=i.get(c);f&&(d.value=g(f))}else if(d===void 0){var u=i.get(c),v=u==null?void 0:u.v;if(u!==void 0&&v!==oe)return{enumerable:!0,configurable:!0,value:v,writable:!0}}return d},has(l,c){var v;if(c===Qe)return!0;var d=i.get(c),f=d!==void 0&&d.v!==oe||Reflect.has(l,c);if(d!==void 0||L!==null&&(!f||(v=je(l,c))!=null&&v.writable)){d===void 0&&(d=Te(f?st(l[c],s):oe),i.set(c,d));var u=g(d);if(u===oe)return!1}return f},set(l,c,d,f){var k;var u=i.get(c),v=c in l;if(o&&c==="length")for(var _=d;_<u.v;_+=1){var b=i.get(_+"");b!==void 0?S(b,oe):_ in l&&(b=Te(oe),i.set(_+"",b))}u===void 0?(!v||(k=je(l,c))!=null&&k.writable)&&(u=Te(void 0),S(u,st(d,s)),i.set(c,u)):(v=u.v!==oe,S(u,st(d,s)));var I=Reflect.getOwnPropertyDescriptor(l,c);if(I!=null&&I.set&&I.set.call(f,d),!v){if(o&&typeof c=="string"){var y=i.get("length"),P=Number(c);Number.isInteger(P)&&P>=y.v&&S(y,P+1)}Gr(a)}return!0},ownKeys(l){g(a);var c=Reflect.ownKeys(l).filter(u=>{var v=i.get(u);return v===void 0||v.v!==oe});for(var[d,f]of i)f.v!==oe&&!(d in l)&&c.push(d);return c},setPrototypeOf(){No()}})}function Gr(e,t=1){S(e,e.v+t)}var Yr,$r,Kr;function Wo(){if(Yr===void 0){Yr=window;var e=Element.prototype,t=Node.prototype;$r=je(t,"firstChild").get,Kr=je(t,"nextSibling").get,e.__click=void 0,e.__className="",e.__attributes=null,e.__styles=null,e.__e=void 0,Text.prototype.__t=void 0}}function Ft(e=""){return document.createTextNode(e)}function Ht(e){return $r.call(e)}function vn(e){return Kr.call(e)}function T(e,t){return Ht(e)}function C(e,t){{var n=Ht(e);return n instanceof Comment&&n.data===""?vn(n):n}}function U(e,t=1,n=!1){let r=e;for(;t--;)r=vn(r);return r}function Zo(e){e.textContent=""}let Qr=!1;function Xo(e,t){if(t){const n=document.body;e.autofocus=!0,ht(()=>{document.activeElement===n&&e.focus()})}}let Wr=!1;function Jo(){Wr||(Wr=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function Zr(e){var t=V,n=L;We(null),Me(null);try{return e()}finally{We(t),Me(n)}}function ea(e,t,n,r=n){e.addEventListener(t,()=>Zr(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r()}:e.__on_r=r,Jo()}const Xr=new Set,zn=new Set;function Gn(e,t,n,r){function i(o){if(r.capture||Vt.call(t,o),!o.cancelBubble)return Zr(()=>n.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?ht(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function gn(e,t,n,r,i){var o={capture:r,passive:i},a=Gn(e,t,n,o);(t===document.body||t===window||t===document)&&Un(()=>{t.removeEventListener(e,a,o)})}function Yn(e){for(var t=0;t<e.length;t++)Xr.add(e[t]);for(var n of zn)n(e)}function Vt(e){var P;var t=this,n=t.ownerDocument,r=e.type,i=((P=e.composedPath)==null?void 0:P.call(e))||[],o=i[0]||e.target,a=0,s=e.__root;if(s){var l=i.indexOf(s);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var c=i.indexOf(t);if(c===-1)return;l<=c&&(a=l)}if(o=i[a]||e.target,o!==t){ho(e,"currentTarget",{configurable:!0,get(){return o||n}});var d=V,f=L;We(null),Me(null);try{for(var u,v=[];o!==null;){var _=o.assignedSlot||o.parentNode||o.host||null;try{var b=o["__"+r];if(b!==void 0&&!o.disabled)if(qe(b)){var[I,...y]=b;I.apply(o,[e,...y])}else b.call(o,e)}catch(k){u?v.push(k):u=k}if(e.cancelBubble||_===t||_===null)break;o=_}if(u){for(let k of v)queueMicrotask(()=>{throw k});throw u}}finally{e.__root=t,delete e.currentTarget,We(d),Me(f)}}}function Jr(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function mt(e,t){var n=L;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function x(e,t){var n=(t&At)!==0,r=(t&on)!==0,i,o=!e.startsWith("<!>");return()=>{i===void 0&&(i=Jr(o?e:"<!>"+e),n||(i=Ht(i)));var a=r?document.importNode(i,!0):i.cloneNode(!0);if(n){var s=Ht(a),l=a.lastChild;mt(s,l)}else mt(a,a);return a}}function Xe(e=""){{var t=Ft(e+"");return mt(t,t),t}}function le(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Ft();return e.append(t,n),mt(t,n),e}function p(e,t){e!==null&&e.before(t)}function ta(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const na=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function ra(e){return na.includes(e)}const ia={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"};function oa(e){return e=e.toLowerCase(),ia[e]??e}const aa=["touchstart","touchmove"];function sa(e){return aa.includes(e)}function de(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=n,e.nodeValue=n==null?"":n+"")}function ei(e,t){return la(e,t)}const yt=new Map;function la(e,{target:t,anchor:n,props:r={},events:i,context:o,intro:a=!0}){Wo();var s=new Set,l=f=>{for(var u=0;u<f.length;u++){var v=f[u];if(!s.has(v)){s.add(v);var _=sa(v);t.addEventListener(v,Vt,{passive:_});var b=yt.get(v);b===void 0?(document.addEventListener(v,Vt,{passive:_}),yt.set(v,1)):yt.set(v,b+1)}}};l(An(Xr)),zn.add(l);var c=void 0,d=Do(()=>{var f=n??t.appendChild(Ft());return He(()=>{if(o){W({});var u=M;u.c=o}i&&(r.$$events=i),c=e(f,r)||{},o&&Z()}),()=>{var _;for(var u of s){t.removeEventListener(u,Vt);var v=yt.get(u);--v===0?(document.removeEventListener(u,Vt),yt.delete(u)):yt.set(u,v)}zn.delete(l),ti.delete(c),f!==n&&((_=f.parentNode)==null||_.removeChild(f))}});return ti.set(c,d),c}let ti=new WeakMap;function j(e,t,n,r=null,i=!1){var o=e,a=null,s=null,l=null,c=i?vt:0;ot(()=>{l!==(l=!!t())&&(l?(a?Ct(a):a=He(()=>n(o)),s&&Dt(s,()=>{s=null})):(s?Ct(s):r&&(s=He(()=>r(o))),a&&Dt(a,()=>{a=null})))},c)}function ni(e,t){return t}function ca(e,t,n,r){for(var i=[],o=t.length,a=0;a<o;a++)Bn(t[a].e,i,!0);var s=o>0&&i.length===0&&n!==null;if(s){var l=n.parentNode;Zo(l),l.append(n),r.clear(),Je(e,t[0].prev,t[o-1].next)}Mr(i,()=>{for(var c=0;c<o;c++){var d=t[c];s||(r.delete(d.k),Je(e,d.prev,d.next)),Ue(d.e,!s)}})}function ri(e,t,n,r,i,o=null){var a=e,s={flags:t,items:new Map,first:null},l=(t&Ae)!==0;if(l){var c=e;a=c.appendChild(Ft())}var d=null,f=!1;ot(()=>{var u=n(),v=qe(u)?u:u==null?[]:An(u),_=v.length;if(!(f&&_===0)){f=_===0;{var b=V;ua(v,s,a,i,t,(b.f&Le)!==0,r)}o!==null&&(_===0?d?Ct(d):d=He(()=>o(a)):d!==null&&Dt(d,()=>{d=null})),n()}})}function ua(e,t,n,r,i,o,a){var ce,ze,et,Ge;var s=(i&ge)!==0,l=(i&($|ee))!==0,c=e.length,d=t.items,f=t.first,u=f,v,_=null,b,I=[],y=[],P,k,h,w;if(s)for(w=0;w<c;w+=1)P=e[w],k=a(P,w),h=d.get(k),h!==void 0&&((ce=h.a)==null||ce.measure(),(b??(b=new Set)).add(h));for(w=0;w<c;w+=1){if(P=e[w],k=a(P,w),h=d.get(k),h===void 0){var F=u?u.e.nodes_start:n;_=da(F,t,_,_===null?t.first:_.next,P,k,w,r,i),d.set(k,_),I=[],y=[],u=_.next;continue}if(l&&fa(h,P,w,i),h.e.f&Le&&(Ct(h.e),s&&((ze=h.a)==null||ze.unfix(),(b??(b=new Set)).delete(h))),h!==u){if(v!==void 0&&v.has(h)){if(I.length<y.length){var G=y[0],A;_=G.prev;var Y=I[0],X=I[I.length-1];for(A=0;A<I.length;A+=1)ii(I[A],G,n);for(A=0;A<y.length;A+=1)v.delete(y[A]);Je(t,Y.prev,X.next),Je(t,_,Y),Je(t,X,G),u=G,_=X,w-=1,I=[],y=[]}else v.delete(h),ii(h,u,n),Je(t,h.prev,h.next),Je(t,h,_===null?t.first:_.next),Je(t,_,h),_=h;continue}for(I=[],y=[];u!==null&&u.k!==k;)(o||!(u.e.f&Le))&&(v??(v=new Set)).add(u),y.push(u),u=u.next;if(u===null)continue;h=u}I.push(h),_=h,u=h.next}if(u!==null||v!==void 0){for(var Ie=v===void 0?[]:An(v);u!==null;)(o||!(u.e.f&Le))&&Ie.push(u),u=u.next;var N=Ie.length;if(N>0){var Q=i&Ae&&c===0?n:null;if(s){for(w=0;w<N;w+=1)(et=Ie[w].a)==null||et.measure();for(w=0;w<N;w+=1)(Ge=Ie[w].a)==null||Ge.fix()}ca(t,Ie,Q,d)}}s&&ht(()=>{var Ye;if(b!==void 0)for(h of b)(Ye=h.a)==null||Ye.apply()}),L.first=t.first&&t.first.e,L.last=_&&_.e}function fa(e,t,n,r){r&$&&Rn(e.v,t),r&ee?Rn(e.i,n):e.i=n}function da(e,t,n,r,i,o,a,s,l){var c=(l&$)!==0,d=(l&rn)===0,f=c?d?ln(i):Te(i):i,u=l&ee?Te(a):a,v={i:u,v:f,k:o,a:null,e:null,prev:n,next:r};try{return v.e=He(()=>s(e,f,u),Qr),v.e.prev=n&&n.e,v.e.next=r&&r.e,n===null?t.first=v:(n.next=v,n.e.next=v.e),r!==null&&(r.prev=v,r.e.prev=v.e),v}finally{}}function ii(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,o=e.e.nodes_start;o!==r;){var a=vn(o);i.before(o),o=a}}function Je(e,t,n){t===null?e.first=n:(t.next=n,t.e.next=n&&n.e),n!==null&&(n.prev=t,n.e.prev=t&&t.e)}function zt(e,t,n,r,i){var o=e,a="",s;ot(()=>{a!==(a=t()??"")&&(s!==void 0&&(Ue(s),s=void 0),a!==""&&(s=He(()=>{var l=a+"",c=Jr(l);mt(Ht(c),c.lastChild),o.before(c)})))})}function ne(e,t,n,r,i){var s;var o=(s=t.$$slots)==null?void 0:s[n],a=!1;o===!0&&(o=t[n==="default"?"children":n],a=!0),o===void 0||o(e,a?()=>r:r)}function va(e,t,...n){var r=e,i=$e,o;ot(()=>{i!==(i=t())&&(o&&(Ue(o),o=null),o=He(()=>i(r,...n)))},vt)}function ga(e,t,n){var r=e,i,o;ot(()=>{i!==(i=t())&&(o&&(Dt(o),o=null),i&&(o=He(()=>n(r,i))))},vt)}function oi(e,t,n,r,i,o){var a,s,l=null,c=e,d;ot(()=>{const f=t()||null;var u=f==="svg"?Ot:null;f!==a&&(d&&(f===null?Dt(d,()=>{d=null,s=null}):f===s?Ct(d):Ue(d)),f&&f!==s&&(d=He(()=>{if(l=u?document.createElementNS(u,f):document.createElement(f),mt(l,l),r){var v=l.appendChild(Ft());r(l,v)}L.nodes_end=l,c.before(l)})),a=f,a&&(s=a))},vt)}function B(e,t){ht(()=>{var n=e.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const i=document.createElement("style");i.id=t.hash,i.textContent=t.code,r.appendChild(i)}})}function K(e,t,n,r){var i=e.__attributes??(e.__attributes={});i[t]!==(i[t]=n)&&(t==="style"&&"__styles"in e&&(e.__styles={}),t==="loading"&&(e[Eo]=n),n==null?e.removeAttribute(t):typeof n!="string"&&li(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function ai(e,t,n,r,i=!1,o=!1,a=!1){var s=t||{},l=e.tagName==="OPTION";for(var c in t)c in n||(n[c]=null);r!==void 0&&(n.class=n.class?n.class+" "+r:r);var d=li(e),f=e.__attributes??(e.__attributes={}),u=[];for(const y in n){let P=n[y];if(l&&y==="value"&&P==null){e.value=e.__value="",s[y]=P;continue}var v=s[y];if(P!==v){s[y]=P;var _=y[0]+y[1];if(_!=="$$"){if(_==="on"){const k={},h="$$"+y;let w=y.slice(2);var b=ra(w);if(ta(w)&&(w=w.slice(0,-7),k.capture=!0),!b&&v){if(P!=null)continue;e.removeEventListener(w,s[h],k),s[h]=null}if(P!=null)if(b)e[`__${w}`]=P,Yn([w]);else{let F=function(G){s[y].call(this,G)};t?s[h]=Gn(w,e,F,k):u.push([y,P,()=>s[h]=Gn(w,e,F,k)])}}else if(y==="style"&&P!=null)e.style.cssText=P+"";else if(y==="autofocus")Xo(e,!!P);else if(y==="__value"||y==="value"&&P!=null)e.value=e[y]=e.__value=P;else{var I=y;i||(I=oa(I)),P==null&&!o?(f[y]=null,e.removeAttribute(y)):d.includes(I)&&(o||typeof P!="string")?e[I]=P:typeof P!="function"&&K(e,I,P)}y==="style"&&"__styles"in e&&(e.__styles={})}}}return t||ht(()=>{if(e.isConnected)for(const[y,P,k]of u)s[y]===P&&k()}),s}var si=new Map;function li(e){var t=si.get(e.nodeName);if(t)return t;si.set(e.nodeName,t=[]);for(var n,r=an(e),i=Element.prototype;i!==r;){n=yr(r);for(var o in n)n[o].set&&t.push(o);r=an(r)}return t}function $n(e,t){var n=e.__className,r=ha(t);(n!==r||Qr)&&(t==null?e.removeAttribute("class"):e.className=r,e.__className=r)}function ha(e){return e??""}function pa(e,t,n){if(n){if(e.classList.contains(t))return;e.classList.add(t)}else{if(!e.classList.contains(t))return;e.classList.remove(t)}}function _a(e,t,n=t){var r=fn();ea(e,"input",()=>{var i=ci(e)?ui(e.value):e.value;n(i),r&&i!==(i=t())&&(e.value=i??"")}),Mt(()=>{var i=t();ci(e)&&i===ui(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function ci(e){var t=e.type;return t==="number"||t==="range"}function ui(e){return e===""?null:+e}function hn(e,t,n){var r=je(e,t);r&&r.set&&(e[t]=n,Un(()=>{e[t]=null}))}function fi(e,t){return e===t||(e==null?void 0:e[Qe])===t}function ba(e={},t,n,r){return Dn(()=>{var i,o;return Mt(()=>{i=o,o=[],at(()=>{e!==n(...o)&&(t(e,...o),i&&fi(n(...i),e)&&t(null,...i))})}),()=>{ht(()=>{o&&fi(n(...o),e)&&t(null,...o)})}}),e}function di(e){return function(...t){var n=t[0];return n.preventDefault(),e==null?void 0:e.apply(this,t)}}function Se(e=!1){const t=M,n=t.l.u;if(!n)return;let r=()=>se(t.s);if(e){let i=0,o={};const a=J(()=>{let s=!1;const l=t.s;for(const c in l)l[c]!==o[c]&&(o[c]=l[c],s=!0);return s&&i++,i});r=()=>g(a)}n.b.length&&Mo(()=>{vi(t,r),On(n.b)}),Mn(()=>{const i=at(()=>n.m.map(bo));return()=>{for(const o of i)typeof o=="function"&&o()}}),n.a.length&&Mn(()=>{vi(t,r),On(n.a)})}function vi(e,t){if(e.l.s)for(const n of e.l.s)g(n);t()}function gi(e,t){var o;var n=(o=e.$$events)==null?void 0:o[t.type],r=qe(n)?n.slice():n==null?[]:[n];for(var i of r)i.call(this,t)}function pn(e){M===null&&cn(),R&&M.l!==null?hi(M).m.push(e):Mn(()=>{const t=at(e);if(typeof t=="function")return t})}function ma(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}function ya(){const e=M;return e===null&&cn(),(t,n,r)=>{var o;const i=(o=e.s.$$events)==null?void 0:o[t];if(i){const a=qe(i)?i.slice():[i],s=ma(t,n,r);for(const l of a)l.call(e.x,s);return!s.defaultPrevented}return!0}}function wa(e){M===null&&cn(),M.l===null&&To(),hi(M).b.push(e)}function hi(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}function Ea(e,t,n){if(e==null)return t(void 0),$e;const r=at(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}let _n=!1;function xa(e,t,n){const r=n[t]??(n[t]={store:null,source:ln(void 0),unsubscribe:$e});if(r.store!==e)if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=$e;else{var i=!0;r.unsubscribe=Ea(e,o=>{i?r.source.v=o:S(r.source,o)}),i=!1}return g(r.source)}function Ia(){const e={};return Un(()=>{for(var t in e)e[t].unsubscribe()}),e}function Pa(e){var t=_n;try{return _n=!1,[e(),_n]}finally{_n=t}}const ka={get(e,t){if(!e.exclude.includes(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function bn(e,t,n){return new Proxy({props:e,exclude:t},ka)}const Ta={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(St(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];St(i)&&(i=i());const o=je(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(St(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r){const i=je(r,t);return i&&!i.configurable&&(i.configurable=!0),i}}},has(e,t){if(t===Qe||t===xr)return!1;for(let n of e.props)if(St(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){const t=[];for(let n of e.props){St(n)&&(n=n());for(const r in n)t.includes(r)||t.push(r)}return t}};function Gt(...e){return new Proxy({props:e},Ta)}function pi(e){for(var t=L,n=L;t!==null&&!(t.f&(Oe|Lt));)t=t.parent;try{return Me(t),e()}finally{Me(n)}}function m(e,t,n,r){var G;var i=(n&nt)!==0,o=!R||(n&kt)!==0,a=(n&Tt)!==0,s=(n&ke)!==0,l=!1,c;a?[c,l]=Pa(()=>e[t]):c=e[t];var d=Qe in e||xr in e,f=((G=je(e,t))==null?void 0:G.set)??(d&&a&&t in e?A=>e[t]=A:void 0),u=r,v=!0,_=!1,b=()=>(_=!0,v&&(v=!1,s?u=at(r):u=r),u);c===void 0&&r!==void 0&&(f&&o&&Ao(),c=b(),f&&f(c));var I;if(o)I=()=>{var A=e[t];return A===void 0?b():(v=!0,_=!1,A)};else{var y=pi(()=>(i?J:Ee)(()=>e[t]));y.f|=yo,I=()=>{var A=g(y);return A!==void 0&&(u=void 0),A===void 0?u:A}}if(!(n&H))return I;if(f){var P=e.$$legacy;return function(A,Y){return arguments.length>0?((!o||!Y||P||l)&&f(Y?I():A),A):I()}}var k=!1,h=!1,w=ln(c),F=pi(()=>J(()=>{var A=I(),Y=g(w);return k?(k=!1,h=!0,Y):(h=!1,w.v=A)}));return i||(F.equals=Sn),function(A,Y){if(arguments.length>0){const X=Y?g(F):o&&a?st(A):A;return F.equals(X)||(k=!0,S(w,X),_&&u!==void 0&&(u=X),at(()=>g(F))),A}return g(F)}}const _i={translate:new Map([[!0,"yes"],[!1,"no"]])};function Aa(e,t,n=!1){const r=e in _i&&_i[e].get(t)||t,i=n?"":`="${Nt(r)}"`;return` ${e}${i}`}const Oa={hash:"svelte-1bzqb13",code:".rcb-modal-section.svelte-1bzqb13 {padding:8px 0px;display:flex;}section.rcb-modal-section.svelte-1bzqb13 {flex-grow:1;}.rcb-modal-section.svelte-1bzqb13:last-of-type {padding:0;}"};function wt(e,t){B(e,Oa);let n=m(t,"as",8,"section");var r=le(),i=C(r);oi(i,n,!1,(o,a)=>{ai(o,null,{class:"rcb-modal-section"},"svelte-1bzqb13",o.namespaceURI===Ot,o.nodeName.includes("-"));var s=le(),l=C(s);ne(l,t,"default",{}),p(a,s)}),p(e,r)}var he=(e=>(e[e.Silent=0]="Silent",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose",e))(he||{});class z{static setLogLevel(t){this.logLevel=t}static log(t,n=this.logLevel){const r=`[Purchases] ${t}`;if(!(this.logLevel<n||n===he.Silent))switch(n){case he.Error:console.error(r);break;case he.Warn:console.warn(r);break;case he.Info:console.info(r);break;case he.Debug:console.debug(r);break;case he.Verbose:console.debug(r);break}}static errorLog(t){this.log(t,he.Error)}static warnLog(t){this.log(t,he.Warn)}static infoLog(t){this.log(t,he.Info)}static debugLog(t){this.log(t,he.Debug)}static verboseLog(t){this.log(t,he.Verbose)}}D(z,"logLevel",he.Silent);var Ve=(e=>(e.Year="year",e.Month="month",e.Week="week",e.Day="day",e))(Ve||{});function Kn(e){const t=e.match(/^PT?([0-9]+)([MDYW])$/);if(!t||t.length<3)return z.errorLog(`Invalid ISO 8601 duration format: ${e}`),null;const n=parseInt(t[1]);switch(t[2]){case"Y":return{number:n,unit:"year"};case"M":return{number:n,unit:"month"};case"W":return{number:n,unit:"week"};case"D":return{number:n,unit:"day"};default:return z.errorLog(`Invalid ISO 8601 unit duration format: ${e}`),null}}const Na=(e,t,n)=>{const r=e/1e6;return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(r)},Sa=e=>{const t=e.number;if(t===1)switch(e.unit){case Ve.Year:return"yearly";case Ve.Month:return"monthly";case Ve.Week:return"weekly";case Ve.Day:return"daily"}else return`every ${t} ${e.unit}s`},Ra=e=>{const t=e.number;if(t===1)switch(e.unit){case Ve.Year:return"1 year";case Ve.Month:return"1 month";case Ve.Week:return"1 week";case Ve.Day:return"1 day"}else return`${t} ${e.unit}s`},La=e=>{const t=Kn(e);return t?Sa(t):"unknown"},Ua=e=>{const t=Kn(e);return t?Ra(t):"unknown"};function Ma(e){return e!=null}var bi=(e=>(e.Unknown="unknown",e.Custom="custom",e.Lifetime="$rc_lifetime",e.Annual="$rc_annual",e.SixMonth="$rc_six_month",e.ThreeMonth="$rc_three_month",e.TwoMonth="$rc_two_month",e.Monthly="$rc_monthly",e.Weekly="$rc_weekly",e))(bi||{}),Et=(e=>(e.Subscription="subscription",e.Consumable="consumable",e.NonConsumable="non_consumable",e))(Et||{});const mi=e=>({amount:e.amount_micros/1e4,amountMicros:e.amount_micros,currency:e.currency,formattedPrice:Na(e.amount_micros,e.currency)}),yi=e=>{const t=e.period_duration;return{periodDuration:t,period:t?Kn(t):null,cycleCount:e.cycle_count,price:e.price?mi(e.price):null}},Da=e=>e.base==null?(z.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,base:yi(e.base),trial:e.trial?yi(e.trial):null},Ca=e=>e.base_price==null?(z.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,basePrice:mi(e.base_price)},Ba=(e,t)=>{const n=e.product_type;return n==="subscription"?ja(e,t,n):qa(e,t,n)},qa=(e,t,n)=>{const r={};if(Object.entries(e.purchase_options).forEach(([a,s])=>{const l=Ca(s);l!=null&&(r[a]=l)}),Object.keys(r).length===0)return z.debugLog(`Product ${e.identifier} has no purchase options. Ignoring.`),null;const i=e.default_purchase_option_id,o=i&&i in e.purchase_options?r[i]:null;return o==null?(z.debugLog(`Product ${e.identifier} has no default purchase option. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:n,currentPrice:o.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:t.offeringIdentifier,presentedOfferingContext:t,defaultPurchaseOption:o,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:o}},ja=(e,t,n)=>{const r={};if(Object.entries(e.purchase_options).forEach(([s,l])=>{const c=Da(l);c!=null&&(r[s]=c)}),Object.keys(r).length===0)return z.debugLog(`Product ${e.identifier} has no subscription options. Ignoring.`),null;const i=e.default_purchase_option_id,o=i&&i in r?r[i]:null;if(o==null)return z.debugLog(`Product ${e.identifier} has no default subscription option. Ignoring.`),null;const a=o.base.price;return a==null?(z.debugLog(`Product ${e.identifier} default option has no base price. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:n,currentPrice:a,normalPeriodDuration:o.base.periodDuration,presentedOfferingIdentifier:t.offeringIdentifier,presentedOfferingContext:t,defaultPurchaseOption:o,defaultSubscriptionOption:o,subscriptionOptions:r,defaultNonSubscriptionOption:null}},Fa=(e,t,n)=>{const r=n[t.platform_product_identifier];if(r===void 0)return null;const i=Ba(r,e);return i===null?null:{identifier:t.identifier,rcBillingProduct:i,packageType:Va(t.identifier)}},Ha=(e,t,n,r)=>{const i={offeringIdentifier:t.identifier,targetingContext:e&&r?{ruleId:r.rule_id,revision:r.revision}:null,placementIdentifier:null},o=t.packages.map(s=>Fa(i,s,n)).filter(Ma),a={};for(const s of o)s!=null&&(a[s.identifier]=s);return o.length==0?null:{identifier:t.identifier,serverDescription:t.description,metadata:t.metadata,packagesById:a,availablePackages:o,lifetime:a.$rc_lifetime??null,annual:a.$rc_annual??null,sixMonth:a.$rc_six_month??null,threeMonth:a.$rc_three_month??null,twoMonth:a.$rc_two_month??null,monthly:a.$rc_monthly??null,weekly:a.$rc_weekly??null,paywall_components:t.paywall_components?t.paywall_components:null}};function Va(e){switch(e){case"$rc_lifetime":return"$rc_lifetime";case"$rc_annual":return"$rc_annual";case"$rc_six_month":return"$rc_six_month";case"$rc_three_month":return"$rc_three_month";case"$rc_two_month":return"$rc_two_month";case"$rc_monthly":return"$rc_monthly";case"$rc_weekly":return"$rc_weekly";default:return e.startsWith("$rc_")?"unknown":"custom"}}var za=x('<span class="rcb-product-price-after-trial svelte-1mdrqnh"> </span>'),Ga=x('<span class="rcb-product-description svelte-1mdrqnh"> </span>'),Ya=x("<li> </li>"),$a=x('<span class="rcb-product-price svelte-1mdrqnh"><!> <!></span> <!> <!> <ul class="rcb-product-details svelte-1mdrqnh"><!> <li>Continues until canceled</li> <li>Cancel anytime</li></ul>',1),Ka=x('<span class="rcb-product-description svelte-1mdrqnh"> </span>'),Qa=x('<span class="rcb-product-price svelte-1mdrqnh"> </span> <!>',1),Wa=x('<div class="rcb-pricing-info svelte-1mdrqnh"><span class="rc-product-title"> </span> <!> <!></div>');const Za={hash:"svelte-1mdrqnh",code:`.rcb-pricing-info.svelte-1mdrqnh {display:flex;flex-direction:column;margin-top:102px;font-weight:500;}.rcb-product-price.svelte-1mdrqnh {color:var(--rc-color-grey-text-dark);font-size:24px;margin:12px 0px;}.rcb-product-description.svelte-1mdrqnh {color:var(--rc-color-grey-text-dark);margin:0 0 12px 0;}.rcb-product-price-after-trial.svelte-1mdrqnh {margin-bottom:12px;}.rcb-product-details.svelte-1mdrqnh {color:var(--rc-color-grey-text-light);list-style-type:disc;list-style-position:inside;margin:0px;padding:0px;}
2
2
 
3
3
  @media screen and (max-width: 960px) {.rcb-pricing-info.svelte-1mdrqnh {margin-top:48px;}
4
- }`};function jn(e,r){var f;we(r,!1),j(e,na);let t=h(r,"productDetails",8),n=h(r,"purchaseOption",8),i=h(r,"brandingAppearance",8,void 0);const o=t().productType===dr.Subscription,a=n(),s=n(),c=a==null?void 0:a.trial,l=(f=a==null?void 0:a.base)==null?void 0:f.price,u=s==null?void 0:s.basePrice;Te(),fr(e,{children:(d,m)=>{var w=ta(),g=x(w),T=x(g),b=L(g,2);F(b,()=>o,A=>{var y=Jo(),O=B(y),V=x(O);F(V,()=>c==null?void 0:c.periodDuration,S=>{var W=We();G(()=>se(W,`${qo(c.periodDuration)??""} free trial`)),p(S,W)});var $=L(V,2);F($,()=>!(c!=null&&c.periodDuration)&&l,S=>{var W=We();G(()=>se(W,l.formattedPrice)),p(S,W)});var H=L(O,2);F(H,()=>c&&l,S=>{var W=Qo(),be=x(W);G(()=>se(be,c&&l&&`${l.formattedPrice} after end of trial`)),p(S,W)});var Q=L(H,2);F(Q,()=>{var S;return((S=i())==null?void 0:S.show_product_description)&&t().description},S=>{var W=Zo(),be=x(W);G(()=>se(be,t().description)),p(S,W)});var me=L(Q,2),Ke=x(me);F(Ke,()=>t().normalPeriodDuration,S=>{var W=Xo(),be=x(W);G(()=>se(be,`Renews ${Fo(t().normalPeriodDuration)??""}`)),p(S,W)}),p(A,y)});var I=L(b,2);F(I,()=>!o,A=>{var y=ra(),O=B(y),V=x(O),$=L(O,2);F($,()=>{var H;return(H=i())==null?void 0:H.show_product_description},H=>{var Q=ea(),me=x(Q);G(()=>se(me,t().description)),p(H,Q)}),G(()=>se(V,u==null?void 0:u.formattedPrice)),p(A,y)}),G(()=>se(T,t().title)),p(d,w)},$$slots:{default:!0}}),Ie()}const ia='<svg width="80" height="80" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" transform="rotate(0 0 0)"><path d="M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 11.5858 20.8358 11.25 21.25 11.25C21.6642 11.25 22 11.5858 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C12.4142 2 12.75 2.33579 12.75 2.75C12.75 3.16421 12.4142 3.5 12 3.5Z" fill="currentColor"/></svg>';var oa=E('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-16h2a8k"><!></div>');const aa={hash:"svelte-16h2a8k",code:`
4
+ }`};function wi(e,t){var f;W(t,!1),B(e,Za);let n=m(t,"productDetails",8),r=m(t,"purchaseOption",8),i=m(t,"brandingAppearance",8,void 0);const o=n().productType===Et.Subscription,a=r(),s=r(),l=a==null?void 0:a.trial,c=(f=a==null?void 0:a.base)==null?void 0:f.price,d=s==null?void 0:s.basePrice;Se(),wt(e,{children:(u,v)=>{var _=Wa(),b=T(_),I=T(b),y=U(b,2);j(y,()=>o,k=>{var h=$a(),w=C(h),F=T(w);j(F,()=>l==null?void 0:l.periodDuration,N=>{var Q=Xe();q(()=>de(Q,`${Ua(l.periodDuration)??""} free trial`)),p(N,Q)});var G=U(F,2);j(G,()=>!(l!=null&&l.periodDuration)&&c,N=>{var Q=Xe();q(()=>de(Q,c.formattedPrice)),p(N,Q)});var A=U(w,2);j(A,()=>l&&c,N=>{var Q=za(),ce=T(Q);q(()=>de(ce,l&&c&&`${c.formattedPrice} after end of trial`)),p(N,Q)});var Y=U(A,2);j(Y,()=>{var N;return((N=i())==null?void 0:N.show_product_description)&&n().description},N=>{var Q=Ga(),ce=T(Q);q(()=>de(ce,n().description)),p(N,Q)});var X=U(Y,2),Ie=T(X);j(Ie,()=>n().normalPeriodDuration,N=>{var Q=Ya(),ce=T(Q);q(()=>de(ce,`Renews ${La(n().normalPeriodDuration)??""}`)),p(N,Q)}),p(k,h)});var P=U(y,2);j(P,()=>!o,k=>{var h=Qa(),w=C(h),F=T(w),G=U(w,2);j(G,()=>{var A;return(A=i())==null?void 0:A.show_product_description},A=>{var Y=Ka(),X=T(Y);q(()=>de(X,n().description)),p(A,Y)}),q(()=>de(F,d==null?void 0:d.formattedPrice)),p(k,h)}),q(()=>de(I,n().title)),p(u,_)},$$slots:{default:!0}}),Z()}const Xa='<svg width="80" height="80" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" transform="rotate(0 0 0)"><path d="M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 11.5858 20.8358 11.25 21.25 11.25C21.6642 11.25 22 11.5858 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C12.4142 2 12.75 2.33579 12.75 2.75C12.75 3.16421 12.4142 3.5 12 3.5Z" fill="currentColor"/></svg>';var Ja=x('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-16h2a8k"><!></div>');const es={hash:"svelte-16h2a8k",code:`
5
5
  @-webkit-keyframes svelte-16h2a8k-rotating /* Safari and Chrome */ {
6
6
  from {
7
7
  -webkit-transform: rotate(0deg);
@@ -34,23 +34,23 @@
34
34
  -moz-animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;
35
35
  -ms-animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;
36
36
  -o-animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;
37
- animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;}`};function sa(e){j(e,aa);var r=oa(),t=x(r);Rr(t,()=>ia),p(e,r)}var la=E('<div class="rcb-modal-loader svelte-l57ojl"><!></div>');const ca={hash:"svelte-l57ojl",code:".rcb-modal-loader.svelte-l57ojl {width:100%;flex-grow:1;min-height:100%;display:flex;justify-content:center;align-items:center;}"};function kt(e){j(e,ca);var r=la(),t=x(r);sa(t),p(e,r)}var re=(e=>(e[e.UnknownError=0]="UnknownError",e[e.UserCancelledError=1]="UserCancelledError",e[e.StoreProblemError=2]="StoreProblemError",e[e.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",e[e.PurchaseInvalidError=4]="PurchaseInvalidError",e[e.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",e[e.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",e[e.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",e[e.InvalidReceiptError=8]="InvalidReceiptError",e[e.MissingReceiptFileError=9]="MissingReceiptFileError",e[e.NetworkError=10]="NetworkError",e[e.InvalidCredentialsError=11]="InvalidCredentialsError",e[e.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",e[e.InvalidAppUserIdError=14]="InvalidAppUserIdError",e[e.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",e[e.UnknownBackendError=16]="UnknownBackendError",e[e.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",e[e.IneligibleError=18]="IneligibleError",e[e.InsufficientPermissionsError=19]="InsufficientPermissionsError",e[e.PaymentPendingError=20]="PaymentPendingError",e[e.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",e[e.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",e[e.ConfigurationError=23]="ConfigurationError",e[e.UnsupportedError=24]="UnsupportedError",e[e.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",e[e.CustomerInfoError=28]="CustomerInfoError",e[e.SignatureVerificationError=36]="SignatureVerificationError",e[e.InvalidEmailError=38]="InvalidEmailError",e))(re||{});class Sr{static getPublicMessage(r){switch(r){case 0:return"Unknown error.";case 1:return"Purchase was cancelled.";case 2:return"There was a problem with the store.";case 3:return"The device or user is not allowed to make the purchase.";case 4:return"One or more of the arguments provided are invalid.";case 5:return"The product is not available for purchase.";case 6:return"This product is already active for the user.";case 7:return"There is already another active subscriber using the same receipt.";case 8:return"The receipt is not valid.";case 9:return"The receipt is missing.";case 10:return"Error performing request. Please check your network connection and try again.";case 11:return"There was a credentials issue. Check the underlying error for more details.";case 12:return"Received unexpected response from the backend.";case 14:return"The app user id is not valid.";case 15:return"The operation is already in progress.";case 16:return"There was an unknown backend error.";case 17:return"Apple Subscription Key is invalid or not present. In order to provide subscription offers, you must first generate a subscription key. Please see https://docs.revenuecat.com/docs/ios-subscription-offers for more info.";case 18:return"The User is ineligible for that action.";case 19:return"App does not have sufficient permissions to make purchases.";case 20:return"The payment is pending.";case 21:return"One or more of the attributes sent could not be saved.";case 22:return"Called logOut but the current user is anonymous.";case 23:return"There is an issue with your configuration. Check the underlying error for more details.";case 24:return"There was a problem with the operation. Looks like we doesn't support that yet. Check the underlying error for more details.";case 25:return"A request for subscriber attributes returned none.";case 28:return"There was a problem related to the customer info.";case 36:return"Request failed signature verification. Please see https://rev.cat/trusted-entitlements for more info.";case 38:return"Email is not valid. Please provide a valid email address."}}static getErrorCodeForBackendErrorCode(r){switch(r){case 7101:case 7773:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:case 7814:return 4;case 7772:return 6;case 7220:return 14;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:return 38}}static convertCodeToBackendErrorCode(r){return r in Cn?r:null}static convertPurchaseFlowErrorCodeToErrorCode(r){switch(r){case ie.ErrorSettingUpPurchase:return 2;case ie.ErrorChargingPayment:return 20;case ie.NetworkError:return 10;case ie.MissingEmailError:return 4;case ie.StripeError:return 2;case ie.UnknownError:return 0;case ie.AlreadyPurchasedError:return 6}}}var Cn=(e=>(e[e.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",e[e.BackendInvalidEmail=7012]="BackendInvalidEmail",e[e.BackendStoreProblem=7101]="BackendStoreProblem",e[e.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",e[e.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",e[e.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",e[e.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",e[e.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",e[e.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",e[e.BackendInternalServerError=7110]="BackendInternalServerError",e[e.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",e[e.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",e[e.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",e[e.BackendBadRequest=7226]="BackendBadRequest",e[e.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",e[e.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",e[e.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",e[e.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",e[e.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",e[e.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",e[e.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",e[e.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",e[e.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",e[e.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",e[e.BackendOfferNotFound=7814]="BackendOfferNotFound",e[e.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",e))(Cn||{});class X extends Error{constructor(t,n,i,o){super(n);D(this,"toString",()=>`PurchasesError(code: ${re[this.errorCode]}, message: ${this.message})`);this.errorCode=t,this.underlyingErrorMessage=i,this.extra=o}static getForBackendError(t,n){const i=Sr.getErrorCodeForBackendErrorCode(t);return new X(i,Sr.getPublicMessage(i),n,{backendErrorCode:t})}static getForPurchasesFlowError(t){return new X(Sr.convertPurchaseFlowErrorCodeToErrorCode(t.errorCode),t.message,t.underlyingErrorMessage)}}class Hn extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Ur=(e=>(e.Started="started",e.InProgress="in_progress",e.Succeeded="succeeded",e.Failed="failed",e))(Ur||{}),vr=(e=>(e[e.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",e[e.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",e[e.PaymentChargeFailed=3]="PaymentChargeFailed",e[e.SetupIntentCompletionFailed=4]="SetupIntentCompletionFailed",e[e.AlreadyPurchased=5]="AlreadyPurchased",e))(vr||{});function ua(e){var r;return e.operation.redemption_info?{redeemUrl:((r=e.operation.redemption_info)==null?void 0:r.redeem_url)??null}:null}var ie=(e=>(e[e.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",e[e.ErrorChargingPayment=1]="ErrorChargingPayment",e[e.UnknownError=2]="UnknownError",e[e.NetworkError=3]="NetworkError",e[e.StripeError=4]="StripeError",e[e.MissingEmailError=5]="MissingEmailError",e[e.AlreadyPurchasedError=6]="AlreadyPurchasedError",e))(ie||{});class z extends Error{constructor(r,t,n,i,o){super(t),this.errorCode=r,this.underlyingErrorMessage=n,this.purchasesErrorCode=i,this.extra=o}isRecoverable(){switch(this.errorCode){case 3:case 5:return!0;case 0:case 1:case 6:case 4:case 2:return!1}}getPublicErrorMessage(r){var n;const t=((n=this.extra)==null?void 0:n.backendErrorCode)??this.purchasesErrorCode??this.errorCode;switch(this.errorCode){case 2:return`An unknown error occurred. Error code: ${t}.`;case 0:return`Purchase not started due to an error. Error code: ${t}.`;case 1:return"Payment failed.";case 3:return"Network error. Please check your internet connection.";case 4:return this.message;case 5:return"Email is required to complete the purchase.";case 6:return(r==null?void 0:r.productType)===dr.Subscription?"You are already subscribed to this product.":"You have already purchased this product."}}static fromPurchasesError(r,t){let n;return r.errorCode===re.ProductAlreadyPurchasedError?n=6:r.errorCode===re.InvalidEmailError?n=5:r.errorCode===re.NetworkError?n=3:n=t,new z(n,r.message,r.underlyingErrorMessage,r.errorCode,r.extra)}}class fa{constructor(r,t=10){D(this,"operationSessionId",null);D(this,"backend");D(this,"maxNumberAttempts");D(this,"waitMSBetweenAttempts",1e3);this.backend=r,this.maxNumberAttempts=t}async startPurchase(r,t,n,i,o){try{const a=await this.backend.postPurchase(r,t,i,o,n);return this.operationSessionId=a.operation_session_id,a}catch(a){if(a instanceof X)throw z.fromPurchasesError(a,0);{const s="Unknown error starting purchase: "+String(a);throw C.errorLog(s),new z(2,s)}}}async pollCurrentPurchaseForCompletion(){const r=this.operationSessionId;if(!r)throw new z(0,"No purchase in progress");return new Promise((t,n)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new z(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(r).then(a=>{switch(a.operation.status){case Ur.Started:case Ur.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case Ur.Succeeded:this.clearPurchaseInProgress(),t({redemptionInfo:ua(a)});return;case Ur.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(a.operation.error,n)}}).catch(a=>{const s=z.fromPurchasesError(a,3);n(s)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(r,t){if(r==null){t(new z(2,"Got an error status but error field is empty."));return}switch(r.code){case vr.SetupIntentCreationFailed:t(new z(0,"Setup intent creation failed"));return;case vr.PaymentMethodCreationFailed:t(new z(0,"Payment method creation failed"));return;case vr.PaymentChargeFailed:t(new z(1,"Payment charge failed"));return;case vr.SetupIntentCompletionFailed:t(new z(0,"Setup intent completion failed"));return;case vr.AlreadyPurchased:t(new z(6,"Purchased was already completed"));return;default:t(new z(2,"Unknown error code received"));return}}}const da=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
37
+ animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;}`};function ts(e){B(e,es);var t=Ja(),n=T(t);zt(n,()=>Xa),p(e,t)}var ns=x('<div class="rcb-modal-loader svelte-l57ojl"><!></div>');const rs={hash:"svelte-l57ojl",code:".rcb-modal-loader.svelte-l57ojl {width:100%;flex-grow:1;min-height:100%;display:flex;justify-content:center;align-items:center;}"};function Qn(e){B(e,rs);var t=ns(),n=T(t);ts(n),p(e,t)}var ie=(e=>(e[e.UnknownError=0]="UnknownError",e[e.UserCancelledError=1]="UserCancelledError",e[e.StoreProblemError=2]="StoreProblemError",e[e.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",e[e.PurchaseInvalidError=4]="PurchaseInvalidError",e[e.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",e[e.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",e[e.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",e[e.InvalidReceiptError=8]="InvalidReceiptError",e[e.MissingReceiptFileError=9]="MissingReceiptFileError",e[e.NetworkError=10]="NetworkError",e[e.InvalidCredentialsError=11]="InvalidCredentialsError",e[e.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",e[e.InvalidAppUserIdError=14]="InvalidAppUserIdError",e[e.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",e[e.UnknownBackendError=16]="UnknownBackendError",e[e.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",e[e.IneligibleError=18]="IneligibleError",e[e.InsufficientPermissionsError=19]="InsufficientPermissionsError",e[e.PaymentPendingError=20]="PaymentPendingError",e[e.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",e[e.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",e[e.ConfigurationError=23]="ConfigurationError",e[e.UnsupportedError=24]="UnsupportedError",e[e.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",e[e.CustomerInfoError=28]="CustomerInfoError",e[e.SignatureVerificationError=36]="SignatureVerificationError",e[e.InvalidEmailError=38]="InvalidEmailError",e))(ie||{});class Yt{static getPublicMessage(t){switch(t){case 0:return"Unknown error.";case 1:return"Purchase was cancelled.";case 2:return"There was a problem with the store.";case 3:return"The device or user is not allowed to make the purchase.";case 4:return"One or more of the arguments provided are invalid.";case 5:return"The product is not available for purchase.";case 6:return"This product is already active for the user.";case 7:return"There is already another active subscriber using the same receipt.";case 8:return"The receipt is not valid.";case 9:return"The receipt is missing.";case 10:return"Error performing request. Please check your network connection and try again.";case 11:return"There was a credentials issue. Check the underlying error for more details.";case 12:return"Received unexpected response from the backend.";case 14:return"The app user id is not valid.";case 15:return"The operation is already in progress.";case 16:return"There was an unknown backend error.";case 17:return"Apple Subscription Key is invalid or not present. In order to provide subscription offers, you must first generate a subscription key. Please see https://docs.revenuecat.com/docs/ios-subscription-offers for more info.";case 18:return"The User is ineligible for that action.";case 19:return"App does not have sufficient permissions to make purchases.";case 20:return"The payment is pending.";case 21:return"One or more of the attributes sent could not be saved.";case 22:return"Called logOut but the current user is anonymous.";case 23:return"There is an issue with your configuration. Check the underlying error for more details.";case 24:return"There was a problem with the operation. Looks like we doesn't support that yet. Check the underlying error for more details.";case 25:return"A request for subscriber attributes returned none.";case 28:return"There was a problem related to the customer info.";case 36:return"Request failed signature verification. Please see https://rev.cat/trusted-entitlements for more info.";case 38:return"Email is not valid. Please provide a valid email address."}}static getErrorCodeForBackendErrorCode(t){switch(t){case 7101:case 7773:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:case 7814:return 4;case 7772:return 6;case 7220:return 14;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:return 38}}static convertCodeToBackendErrorCode(t){return t in Ei?t:null}static convertPurchaseFlowErrorCodeToErrorCode(t){switch(t){case ve.ErrorSettingUpPurchase:return 2;case ve.ErrorChargingPayment:return 20;case ve.NetworkError:return 10;case ve.MissingEmailError:return 4;case ve.StripeError:return 2;case ve.UnknownError:return 0;case ve.AlreadyPurchasedError:return 6}}}var Ei=(e=>(e[e.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",e[e.BackendInvalidEmail=7012]="BackendInvalidEmail",e[e.BackendStoreProblem=7101]="BackendStoreProblem",e[e.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",e[e.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",e[e.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",e[e.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",e[e.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",e[e.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",e[e.BackendInternalServerError=7110]="BackendInternalServerError",e[e.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",e[e.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",e[e.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",e[e.BackendBadRequest=7226]="BackendBadRequest",e[e.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",e[e.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",e[e.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",e[e.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",e[e.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",e[e.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",e[e.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",e[e.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",e[e.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",e[e.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",e[e.BackendOfferNotFound=7814]="BackendOfferNotFound",e[e.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",e))(Ei||{});class re extends Error{constructor(n,r,i,o){super(r);D(this,"toString",()=>`PurchasesError(code: ${ie[this.errorCode]}, message: ${this.message})`);this.errorCode=n,this.underlyingErrorMessage=i,this.extra=o}static getForBackendError(n,r){const i=Yt.getErrorCodeForBackendErrorCode(n);return new re(i,Yt.getPublicMessage(i),r,{backendErrorCode:n})}static getForPurchasesFlowError(n){return new re(Yt.convertPurchaseFlowErrorCodeToErrorCode(n.errorCode),n.message,n.underlyingErrorMessage)}}class xi extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var $t=(e=>(e.Started="started",e.InProgress="in_progress",e.Succeeded="succeeded",e.Failed="failed",e))($t||{}),xt=(e=>(e[e.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",e[e.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",e[e.PaymentChargeFailed=3]="PaymentChargeFailed",e[e.SetupIntentCompletionFailed=4]="SetupIntentCompletionFailed",e[e.AlreadyPurchased=5]="AlreadyPurchased",e))(xt||{});function is(e){var t;return e.operation.redemption_info?{redeemUrl:((t=e.operation.redemption_info)==null?void 0:t.redeem_url)??null}:null}var ve=(e=>(e[e.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",e[e.ErrorChargingPayment=1]="ErrorChargingPayment",e[e.UnknownError=2]="UnknownError",e[e.NetworkError=3]="NetworkError",e[e.StripeError=4]="StripeError",e[e.MissingEmailError=5]="MissingEmailError",e[e.AlreadyPurchasedError=6]="AlreadyPurchasedError",e))(ve||{});class te extends Error{constructor(t,n,r,i,o){super(n),this.errorCode=t,this.underlyingErrorMessage=r,this.purchasesErrorCode=i,this.extra=o}isRecoverable(){switch(this.errorCode){case 3:case 5:return!0;case 0:case 1:case 6:case 4:case 2:return!1}}getPublicErrorMessage(t){var r;const n=((r=this.extra)==null?void 0:r.backendErrorCode)??this.purchasesErrorCode??this.errorCode;switch(this.errorCode){case 2:return`An unknown error occurred. Error code: ${n}.`;case 0:return`Purchase not started due to an error. Error code: ${n}.`;case 1:return"Payment failed.";case 3:return"Network error. Please check your internet connection.";case 4:return this.message;case 5:return"Email is required to complete the purchase.";case 6:return(t==null?void 0:t.productType)===Et.Subscription?"You are already subscribed to this product.":"You have already purchased this product."}}static fromPurchasesError(t,n){let r;return t.errorCode===ie.ProductAlreadyPurchasedError?r=6:t.errorCode===ie.InvalidEmailError?r=5:t.errorCode===ie.NetworkError?r=3:r=n,new te(r,t.message,t.underlyingErrorMessage,t.errorCode,t.extra)}}class os{constructor(t,n=10){D(this,"operationSessionId",null);D(this,"backend");D(this,"maxNumberAttempts");D(this,"waitMSBetweenAttempts",1e3);this.backend=t,this.maxNumberAttempts=n}async startPurchase(t,n,r,i,o){try{const a=await this.backend.postPurchase(t,n,i,o,r);return this.operationSessionId=a.operation_session_id,a}catch(a){if(a instanceof re)throw te.fromPurchasesError(a,0);{const s="Unknown error starting purchase: "+String(a);throw z.errorLog(s),new te(2,s)}}}async pollCurrentPurchaseForCompletion(){const t=this.operationSessionId;if(!t)throw new te(0,"No purchase in progress");return new Promise((n,r)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),r(new te(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(t).then(a=>{switch(a.operation.status){case $t.Started:case $t.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case $t.Succeeded:this.clearPurchaseInProgress(),n({redemptionInfo:is(a)});return;case $t.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(a.operation.error,r)}}).catch(a=>{const s=te.fromPurchasesError(a,3);r(s)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(t,n){if(t==null){n(new te(2,"Got an error status but error field is empty."));return}switch(t.code){case xt.SetupIntentCreationFailed:n(new te(0,"Setup intent creation failed"));return;case xt.PaymentMethodCreationFailed:n(new te(0,"Payment method creation failed"));return;case xt.PaymentChargeFailed:n(new te(1,"Payment charge failed"));return;case xt.SetupIntentCompletionFailed:n(new te(0,"Setup intent completion failed"));return;case xt.AlreadyPurchased:n(new te(6,"Purchased was already completed"));return;default:n(new te(2,"Unknown error code received"));return}}}const as=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
38
38
  <circle cx="62" cy="62" r="62" fill="currentColor"/>
39
39
  <path d="M87.6668 41.504L82.4968 36.334L62.0002 56.8307L41.5035 36.334L36.3335 41.504L56.8302 62.0006L36.3335 82.4973L41.5035 87.6673L62.0002 67.1706L82.4968 87.6673L87.6668 82.4973L67.1702 62.0006L87.6668 41.504Z"
40
40
  fill="white"/>
41
41
  </svg>
42
- `;var va=E('<div style="color:var(--rc-color-error);" class="rcb-ui-asset-icon svelte-7wiquz"><!></div>');const pa={hash:"svelte-7wiquz",code:".rcb-ui-asset-icon.svelte-7wiquz {width:96px;height:96px;margin:0 auto;}"};function ha(e){j(e,pa);var r=va(),t=x(r);Rr(t,()=>da),p(e,r)}var ga=E("<button><!></button>");const _a={hash:"svelte-2xwwo",code:`button.svelte-2xwwo {border:none;border-radius:var(--rc-shape-input-button-border-radius);font-size:16px;cursor:pointer;height:56px;color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);-webkit-tap-highlight-color:transparent;}button.svelte-2xwwo:focus,
43
- button.svelte-2xwwo:active {outline:2px solid var(--rc-color-focus);}button.intent-primary.svelte-2xwwo {background-color:var(--rc-color-primary);color:var(--rc-color-primary-text);font-size:16px;}button.svelte-2xwwo:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);}button.intent-primary.svelte-2xwwo:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);}`};function Nt(e,r){j(e,_a);let t=h(r,"intent",8,"primary"),n=h(r,"disabled",8,!1),i=h(r,"testId",8,void 0),o=h(r,"type",8,void 0);var a=ga(),s=x(a);K(s,r,"default",{}),G(()=>{kn(a,`${`intent-${t()}`??""} svelte-2xwwo`),a.disabled=n(),le(a,"data-testid",i()),le(a,"type",o())}),rt("click",a,function(c){$n.call(this,r,c)}),p(e,a)}var ma=E('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const ba={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function Rt(e,r){j(e,ba);var t=ma(),n=x(t);K(n,r,"default",{}),p(e,t)}var ya=E('<div class="column svelte-6o8e90"><!></div>');const Ea={hash:"svelte-6o8e90",code:'.column.svelte-6o8e90 {display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "8px");flex-grow:1;}'};function Lr(e,r){j(e,Ea);let t=h(r,"gutter",8,"8px");var n=ya(),i=x(n);K(i,r,"default",{}),G(()=>le(n,"style",`--gap:${t()};`)),p(e,n)}const wa="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='mdi_close'%3e%3cpath%20id='Vector'%20d='M19%206.41L17.59%205L12%2010.59L6.41%205L5%206.41L10.59%2012L5%2017.59L6.41%2019L12%2013.41L17.59%2019L19%2017.59L13.41%2012L19%206.41Z'%20fill='%23767676'/%3e%3c/g%3e%3c/svg%3e";var Ia=E('<button class="close-button svelte-1hv9ta1"><img alt="close"></button>');const xa={hash:"svelte-1hv9ta1",code:".close-button.svelte-1hv9ta1 {border:none;cursor:pointer;background-color:transparent;padding:0px;height:24px;border-radius:50%;}.close-button.svelte-1hv9ta1:focus {outline:2px solid var(--rc-color-focus);}"};function St(e,r){j(e,xa);let t=h(r,"disabled",8,!1);var n=Ia(),i=x(n);le(i,"src",wa),G(()=>n.disabled=t()),rt("click",n,function(o){$n.call(this,r,o)}),p(e,n)}var Pa=E('<picture class="rcb-app-icon-picture-container svelte-44qpq9"><source type="image/webp"> <img class="rcb-app-icon svelte-44qpq9" alt="App icon"></picture>'),Ta=E('<div class="rcb-app-icon loading svelte-44qpq9"></div>');const Aa={hash:"svelte-44qpq9",code:".rcb-app-icon.svelte-44qpq9 {width:40px;height:40px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:16px;}.rcb-app-icon-picture-container.svelte-44qpq9 {height:40px;}.rcb-app-icon.loading.svelte-44qpq9 {background-color:gray;}"};function Vn(e,r){j(e,Aa);let t=h(r,"src",8,null),n=h(r,"srcWebp",8,null);var i=_e(),o=B(i);F(o,()=>t()!==null,a=>{var s=Pa(),c=x(s),l=L(c,2);G(()=>{le(c,"srcset",n()),le(l,"src",t())}),p(a,s)},a=>{var s=Ta();p(a,s)}),p(e,i)}const Gn=e=>`https://da08ctfrofx1b.cloudfront.net/${e}`;var Oa=E('<!> <span class="app-title svelte-10uf5fq"> </span>',1),ka=E('<div class="rcb-header-layout__business-info svelte-10uf5fq"><!></div>');const Na={hash:"svelte-10uf5fq",code:".app-title.svelte-10uf5fq {font-weight:500;margin:8px 0;font-size:16px;}.rcb-header-layout__business-info.svelte-10uf5fq {display:flex;align-items:center;}"};function Yn(e,r){we(r,!1),j(e,Na);let t=h(r,"brandingInfo",8,null);Te();var n=ka(),i=x(n);F(i,()=>t()!==null,o=>{var a=Oa(),s=B(a);F(s,()=>t().app_icon_webp!==null&&t().app_icon!==null,u=>{var f=he(()=>Gn(t().app_icon)),d=he(()=>Gn(t().app_icon_webp));Vn(u,{get src(){return v(f)},get srcWebp(){return v(d)}})});var c=L(s,2),l=x(c);G(()=>se(l,t().seller_company_name)),p(o,a)},o=>{Vn(o,{})}),p(e,n),Ie()}var Ra=E('<div class="rcb-post-purchase-header-layout svelte-17puakv"><!> <!></div>');const Sa={hash:"svelte-17puakv",code:".rcb-post-purchase-header-layout.svelte-17puakv {display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:-4px;}"};function Ua(e,r){j(e,Sa);let t=h(r,"brandingInfo",8,null),n=h(r,"onClose",8);fr(e,{as:"header",children:(i,o)=>{var a=Ra(),s=x(a);Yn(s,{get brandingInfo(){return t()}});var c=L(s,2);St(c,{$$events:{click(...l){var u;(u=n())==null||u.apply(this,l)}}}),p(i,a)},$$slots:{default:!0}})}var La=E('<span class="title svelte-idou50"> </span> <span class="subtitle svelte-idou50"><!></span>',1),$a=E("<!> <!>",1),Da=E('<div class="rcb-modal-message svelte-idou50"><!></div>'),Ma=E("<!> <!> <!>",1);const Ba={hash:"svelte-idou50",code:".rcb-modal-message.svelte-idou50 {width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;margin-bottom:16px;margin-top:16px;}.title.svelte-idou50 {font-size:24px;line-height:1.25em;}.subtitle.svelte-idou50 {font-size:16px;line-height:1.25em;overflow-wrap:anywhere;}"};function Wn(e,r){j(e,Ba);let t=h(r,"brandingInfo",8,null),n=h(r,"onContinue",8),i=h(r,"title",8),o=h(r,"type",8),a=h(r,"closeButtonTitle",8,"Go back to app");Lr(e,{gutter:"32px",children:(s,c)=>{var l=Ma(),u=B(l);Ua(u,{get brandingInfo(){return t()},get onClose(){return n()}});var f=L(u,2);fr(f,{children:(m,w)=>{var g=Da(),T=x(g);Lr(T,{gutter:"48px",children:(b,I)=>{var A=$a(),y=B(A);K(y,r,"icon",{});var O=L(y,2);Lr(O,{gutter:"16px",children:(V,$)=>{var H=La(),Q=B(H),me=x(Q),Ke=L(Q,2),S=x(Ke);K(S,r,"default",{}),G(()=>se(me,i())),p(V,H)},$$slots:{default:!0}}),p(b,A)},$$slots:{default:!0}}),G(()=>le(g,"data-type",o())),p(m,g)},$$slots:{default:!0}});var d=L(f,2);Rt(d,{children:(m,w)=>{Nt(m,{type:"submit",$$events:{click(...g){var T;(T=n())==null||T.apply(this,g)}},children:(g,T)=>{var b=We();G(()=>se(b,a())),p(g,b)},$$slots:{default:!0}})},$$slots:{default:!0}}),p(s,l)},$$slots:{default:!0}})}var Fa=E("<br>If this error persists, please contact <a> </a>.",1),qa=E(" <!>",1);function ja(e,r){we(r,!1);let t=h(r,"brandingInfo",8,null),n=h(r,"lastError",8),i=h(r,"supportEmail",8,null),o=h(r,"productDetails",8,null),a=h(r,"onContinue",8);nt(()=>{C.errorLog(`Displayed error: ${ie[n().errorCode]}. Message: ${n().message??"None"}. Underlying error: ${n().underlyingErrorMessage??"None"}`)});function s(){var l;switch(n().errorCode){case ie.AlreadyPurchasedError:return((l=o())==null?void 0:l.productType)===dr.Subscription?"Already subscribed":"Already purchased";default:return"Something went wrong"}}Te();var c=he(s);Wn(e,{get title(){return v(c)},get brandingInfo(){return t()},get onContinue(){return a()},type:"error",closeButtonTitle:"Try Again",children:(l,u)=>{var f=qa(),d=B(f);G(()=>se(d,`${n().getPublicErrorMessage(o())??""} `));var m=L(d);F(m,i,w=>{var g=Fa(),T=L(B(g),2),b=x(T);G(()=>{le(T,"href",`mailto:${i()??""}`),se(b,i())}),p(w,g)}),p(l,f)},$$slots:{default:!0,icon:(l,u)=>{ha(l)}}}),Ie()}const Ca=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
42
+ `;var ss=x('<div style="color:var(--rc-color-error);" class="rcb-ui-asset-icon svelte-7wiquz"><!></div>');const ls={hash:"svelte-7wiquz",code:".rcb-ui-asset-icon.svelte-7wiquz {width:96px;height:96px;margin:0 auto;}"};function cs(e){B(e,ls);var t=ss(),n=T(t);zt(n,()=>as),p(e,t)}var us=x("<button><!></button>");const fs={hash:"svelte-2xwwo",code:`button.svelte-2xwwo {border:none;border-radius:var(--rc-shape-input-button-border-radius);font-size:16px;cursor:pointer;height:56px;color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);-webkit-tap-highlight-color:transparent;}button.svelte-2xwwo:focus,
43
+ button.svelte-2xwwo:active {outline:2px solid var(--rc-color-focus);}button.intent-primary.svelte-2xwwo {background-color:var(--rc-color-primary);color:var(--rc-color-primary-text);font-size:16px;}button.svelte-2xwwo:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);}button.intent-primary.svelte-2xwwo:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);}`};function Wn(e,t){B(e,fs);let n=m(t,"intent",8,"primary"),r=m(t,"disabled",8,!1),i=m(t,"testId",8,void 0),o=m(t,"type",8,void 0);var a=us(),s=T(a);ne(s,t,"default",{}),q(()=>{$n(a,`${`intent-${n()}`??""} svelte-2xwwo`),a.disabled=r(),K(a,"data-testid",i()),K(a,"type",o())}),gn("click",a,function(l){gi.call(this,t,l)}),p(e,a)}var ds=x('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const vs={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function Zn(e,t){B(e,vs);var n=ds(),r=T(n);ne(r,t,"default",{}),p(e,n)}var gs=x('<div class="column svelte-6o8e90"><!></div>');const hs={hash:"svelte-6o8e90",code:'.column.svelte-6o8e90 {display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "8px");flex-grow:1;}'};function Kt(e,t){B(e,hs);let n=m(t,"gutter",8,"8px");var r=gs(),i=T(r);ne(i,t,"default",{}),q(()=>K(r,"style",`--gap:${n()};`)),p(e,r)}var ps=x(`<button class="close-button svelte-1hv9ta1"><img${Aa("src","data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='mdi_close'%3e%3cpath%20id='Vector'%20d='M19%206.41L17.59%205L12%2010.59L6.41%205L5%206.41L10.59%2012L5%2017.59L6.41%2019L12%2013.41L17.59%2019L19%2017.59L13.41%2012L19%206.41Z'%20fill='%23767676'/%3e%3c/g%3e%3c/svg%3e")} alt="close"></button>`);const _s={hash:"svelte-1hv9ta1",code:".close-button.svelte-1hv9ta1 {border:none;cursor:pointer;background-color:transparent;padding:0px;height:24px;border-radius:50%;}.close-button.svelte-1hv9ta1:focus {outline:2px solid var(--rc-color-focus);}"};function Xn(e,t){B(e,_s);let n=m(t,"disabled",8,!1);var r=ps();q(()=>r.disabled=n()),gn("click",r,function(i){gi.call(this,t,i)}),p(e,r)}var bs=x('<picture class="rcb-app-icon-picture-container svelte-44qpq9"><source type="image/webp"> <img class="rcb-app-icon svelte-44qpq9" alt="App icon"></picture>'),ms=x('<div class="rcb-app-icon loading svelte-44qpq9"></div>');const ys={hash:"svelte-44qpq9",code:".rcb-app-icon.svelte-44qpq9 {width:40px;height:40px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:16px;}.rcb-app-icon-picture-container.svelte-44qpq9 {height:40px;}.rcb-app-icon.loading.svelte-44qpq9 {background-color:gray;}"};function Ii(e,t){B(e,ys);let n=m(t,"src",8,null),r=m(t,"srcWebp",8,null);var i=le(),o=C(i);j(o,()=>n()!==null,a=>{var s=bs(),l=T(s),c=U(l,2);q(()=>{K(l,"srcset",r()),K(c,"src",n())}),p(a,s)},a=>{var s=ms();p(a,s)}),p(e,i)}const Pi=e=>`https://da08ctfrofx1b.cloudfront.net/${e}`;var ws=x('<!> <span class="app-title svelte-10uf5fq"> </span>',1),Es=x('<div class="rcb-header-layout__business-info svelte-10uf5fq"><!></div>');const xs={hash:"svelte-10uf5fq",code:".app-title.svelte-10uf5fq {font-weight:500;margin:8px 0;font-size:16px;}.rcb-header-layout__business-info.svelte-10uf5fq {display:flex;align-items:center;}"};function ki(e,t){W(t,!1),B(e,xs);let n=m(t,"brandingInfo",8,null);Se();var r=Es(),i=T(r);j(i,()=>n()!==null,o=>{var a=ws(),s=C(a);j(s,()=>n().app_icon_webp!==null&&n().app_icon!==null,d=>{var f=Ee(()=>Pi(n().app_icon)),u=Ee(()=>Pi(n().app_icon_webp));Ii(d,{get src(){return g(f)},get srcWebp(){return g(u)}})});var l=U(s,2),c=T(l);q(()=>de(c,n().seller_company_name)),p(o,a)},o=>{Ii(o,{})}),p(e,r),Z()}var Is=x('<div class="rcb-post-purchase-header-layout svelte-17puakv"><!> <!></div>');const Ps={hash:"svelte-17puakv",code:".rcb-post-purchase-header-layout.svelte-17puakv {display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:-4px;}"};function ks(e,t){B(e,Ps);let n=m(t,"brandingInfo",8,null),r=m(t,"onClose",8);wt(e,{as:"header",children:(i,o)=>{var a=Is(),s=T(a);ki(s,{get brandingInfo(){return n()}});var l=U(s,2);Xn(l,{$$events:{click(...c){var d;(d=r())==null||d.apply(this,c)}}}),p(i,a)},$$slots:{default:!0}})}var Ts=x('<span class="title svelte-idou50"> </span> <span class="subtitle svelte-idou50"><!></span>',1),As=x("<!> <!>",1),Os=x('<div class="rcb-modal-message svelte-idou50"><!></div>'),Ns=x("<!> <!> <!>",1);const Ss={hash:"svelte-idou50",code:".rcb-modal-message.svelte-idou50 {width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;margin-bottom:16px;margin-top:16px;}.title.svelte-idou50 {font-size:24px;line-height:1.25em;}.subtitle.svelte-idou50 {font-size:16px;line-height:1.25em;overflow-wrap:anywhere;}"};function Ti(e,t){B(e,Ss);let n=m(t,"brandingInfo",8,null),r=m(t,"onContinue",8),i=m(t,"title",8),o=m(t,"type",8),a=m(t,"closeButtonTitle",8,"Go back to app");Kt(e,{gutter:"32px",children:(s,l)=>{var c=Ns(),d=C(c);ks(d,{get brandingInfo(){return n()},get onClose(){return r()}});var f=U(d,2);wt(f,{children:(v,_)=>{var b=Os(),I=T(b);Kt(I,{gutter:"48px",children:(y,P)=>{var k=As(),h=C(k);ne(h,t,"icon",{});var w=U(h,2);Kt(w,{gutter:"16px",children:(F,G)=>{var A=Ts(),Y=C(A),X=T(Y),Ie=U(Y,2),N=T(Ie);ne(N,t,"default",{}),q(()=>de(X,i())),p(F,A)},$$slots:{default:!0}}),p(y,k)},$$slots:{default:!0}}),q(()=>K(b,"data-type",o())),p(v,b)},$$slots:{default:!0}});var u=U(f,2);Zn(u,{children:(v,_)=>{Wn(v,{type:"submit",$$events:{click(...b){var I;(I=r())==null||I.apply(this,b)}},children:(b,I)=>{var y=Xe();q(()=>de(y,a())),p(b,y)},$$slots:{default:!0}})},$$slots:{default:!0}}),p(s,c)},$$slots:{default:!0}})}var Rs=x("<br>If this error persists, please contact <a> </a>.",1),Ls=x(" <!>",1);function Us(e,t){W(t,!1);let n=m(t,"brandingInfo",8,null),r=m(t,"lastError",8),i=m(t,"supportEmail",8,null),o=m(t,"productDetails",8,null),a=m(t,"onContinue",8);pn(()=>{z.errorLog(`Displayed error: ${ve[r().errorCode]}. Message: ${r().message??"None"}. Underlying error: ${r().underlyingErrorMessage??"None"}`)});function s(){var c;switch(r().errorCode){case ve.AlreadyPurchasedError:return((c=o())==null?void 0:c.productType)===Et.Subscription?"Already subscribed":"Already purchased";default:return"Something went wrong"}}Se();var l=Ee(s);Ti(e,{get title(){return g(l)},get brandingInfo(){return n()},get onContinue(){return a()},type:"error",closeButtonTitle:"Try Again",children:(c,d)=>{var f=Ls(),u=C(f);q(()=>de(u,`${r().getPublicErrorMessage(o())??""} `));var v=U(u);j(v,i,_=>{var b=Rs(),I=U(C(b),2),y=T(I);q(()=>{K(I,"href",`mailto:${i()??""}`),de(y,i())}),p(_,b)}),p(c,f)},$$slots:{default:!0,icon:(c,d)=>{cs(c)}}}),Z()}const Ms=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
44
44
  <circle cx="62" cy="62" r="62" fill="currentColor"/>
45
45
  <rect x="44.1116" y="56" width="27.5" height="11" transform="rotate(45 44.1116 56)" fill="white"/>
46
46
  <rect x="79.1133" y="44.334" width="11" height="44" transform="rotate(45 79.1133 44.334)" fill="white"/>
47
47
  </svg>
48
- `;var Ha=E('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-7wiquz"><!></div>');const Va={hash:"svelte-7wiquz",code:".rcb-ui-asset-icon.svelte-7wiquz {width:96px;height:96px;margin:0 auto;}"};function Ga(e){j(e,Va);var r=Ha(),t=x(r);Rr(t,()=>Ca),p(e,r)}function Ya(e,r){var a;we(r,!1);let t=h(r,"productDetails",8,null),n=h(r,"brandingInfo",8,null),i=h(r,"onContinue",8);const o=((a=t())==null?void 0:a.productType)===dr.Subscription;Te(),Wn(e,{type:"success",title:"Purchase successful",get brandingInfo(){return n()},get onContinue(){return i()},closeButtonTitle:"Close",children:(s,c)=>{var l=_e(),u=B(l);F(u,()=>o,f=>{var d=We("Your plan is now active.");p(f,d)}),p(s,l)},$$slots:{default:!0,icon:(s,c)=>{Ga(s)}}}),Ie()}function Wa(e,r,t,n,i={}){const o=t.create(r,i);return o.mount(e),o.on("change",a=>n("change",a)),o.on("ready",a=>n("ready",a)),o.on("focus",a=>n("focus",a)),o.on("blur",a=>n("blur",a)),o.on("escape",a=>n("escape",a)),o.on("click",a=>n("click",a)),o.on("loaderror",a=>n("loaderror",a)),o.on("loaderstart",a=>n("loaderstart",a)),o.on("networkschange",a=>n("networkschange",a)),o}const za=typeof window>"u";function Ka(e){if(!za)return e.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}var Qa=E("<div></div>");function Za(e,r){we(r,!1);let t,n=pe();const i=So(),{elements:o}=lo("stripe");let a=h(r,"options",8,void 0);nt(()=>(t=Wa(v(n),"payment",o,i,a()),()=>t.destroy()));function s(){t.blur()}function c(){t.clear()}function l(){t.destroy()}function u(){t.focus()}Te();var f=Qa();return No(f,d=>R(n,d),()=>v(n)),p(e,f),tt(r,"blur",s),tt(r,"clear",c),tt(r,"destroy",l),tt(r,"focus",u),Ie({blur:s,clear:c,destroy:l,focus:u})}function Xa(e,r){we(r,!1);const t=pe();let n=h(r,"stripe",8),i=h(r,"mode",8,void 0),o=h(r,"theme",8,"stripe"),a=h(r,"variables",24,()=>({})),s=h(r,"rules",24,()=>({})),c=h(r,"labels",8,"above"),l=h(r,"loader",8,"auto"),u=h(r,"fonts",24,()=>[]),f=h(r,"locale",8,"auto"),d=h(r,"currency",8,void 0),m=h(r,"amount",8,void 0),w=h(r,"clientSecret",8,void 0),g=h(r,"elements",12,null);Ye(()=>(ee(o()),ee(a()),ee(s()),ee(c())),()=>{R(t,{theme:o(),variables:a(),rules:s(),labels:c()})}),Ye(()=>(ee(n()),ee(g()),ee(i()),ee(d()),ee(m()),v(t),ee(w()),ee(u()),ee(l()),ee(f()),hn),()=>{n()&&!g()&&(g(n().elements({mode:i(),currency:d(),amount:m(),appearance:v(t),clientSecret:w(),fonts:u(),loader:l(),locale:f()})),Ka(n()),hn("stripe",{stripe:n(),elements:g()}))}),Ye(()=>(ee(g()),v(t),ee(f())),()=>{g()&&g().update({appearance:v(t),locale:f()})}),mt(),Te();var T=_e(),b=B(T);F(b,()=>n()&&g(),I=>{var A=_e(),y=B(A);K(y,r,"default",{}),p(I,A)}),p(e,T),Ie()}var zn="https://js.stripe.com/v3",Ja=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Kn="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",es=function(){for(var r=document.querySelectorAll('script[src^="'.concat(zn,'"]')),t=0;t<r.length;t++){var n=r[t];if(Ja.test(n.src))return n}return null},Qn=function(r){var t="",n=document.createElement("script");n.src="".concat(zn).concat(t);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n},rs=function(r,t){!r||!r._registerWrapper||r._registerWrapper({name:"stripe-js",version:"4.6.0",startTime:t})},$r=null,ot=null,at=null,ts=function(r){return function(){r(new Error("Failed to load Stripe.js"))}},ns=function(r,t){return function(){window.Stripe?r(window.Stripe):t(new Error("Stripe.js not available"))}},is=function(r){return $r!==null?$r:($r=new Promise(function(t,n){if(typeof window>"u"||typeof document>"u"){t(null);return}if(window.Stripe&&r&&console.warn(Kn),window.Stripe){t(window.Stripe);return}try{var i=es();if(i&&r)console.warn(Kn);else if(!i)i=Qn(r);else if(i&&at!==null&&ot!==null){var o;i.removeEventListener("load",at),i.removeEventListener("error",ot),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=Qn(r)}at=ns(t,n),ot=ts(n),i.addEventListener("load",at),i.addEventListener("error",ot)}catch(a){n(a);return}}),$r.catch(function(t){return $r=null,Promise.reject(t)}))},os=function(r,t,n){if(r===null)return null;var i=r.apply(void 0,t);return rs(i,n),i},Dr,Zn=!1,Xn=function(){return Dr||(Dr=is(null).catch(function(r){return Dr=null,Promise.reject(r)}),Dr)};Promise.resolve().then(function(){return Xn()}).catch(function(e){Zn||console.warn(e)});var as=function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];Zn=!0;var i=Date.now();return Xn().then(function(o){return os(o,t,i)})},ss=E('<div class="rcb-header-layout svelte-1xe711j"><!></div>');const ls={hash:"svelte-1xe711j",code:".rcb-header-layout.svelte-1xe711j {display:flex;justify-content:space-between;align-items:center;width:100%;font-size:24px;margin:0;font-weight:500;}"};function Ut(e,r){j(e,ls),fr(e,{as:"header",children:(t,n)=>{var i=ss(),o=x(i);K(o,r,"default",{}),p(t,i)},$$slots:{default:!0}})}const cs=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
48
+ `;var Ds=x('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-7wiquz"><!></div>');const Cs={hash:"svelte-7wiquz",code:".rcb-ui-asset-icon.svelte-7wiquz {width:96px;height:96px;margin:0 auto;}"};function Bs(e){B(e,Cs);var t=Ds(),n=T(t);zt(n,()=>Ms),p(e,t)}function qs(e,t){var a;W(t,!1);let n=m(t,"productDetails",8,null),r=m(t,"brandingInfo",8,null),i=m(t,"onContinue",8);const o=((a=n())==null?void 0:a.productType)===Et.Subscription;Se(),Ti(e,{type:"success",title:"Purchase successful",get brandingInfo(){return r()},get onContinue(){return i()},closeButtonTitle:"Close",children:(s,l)=>{var c=le(),d=C(c);j(d,()=>o,f=>{var u=Xe("Your plan is now active.");p(f,u)}),p(s,c)},$$slots:{default:!0,icon:(s,l)=>{Bs(s)}}}),Z()}function js(e,t,n,r,i={}){const o=n.create(t,i);return o.mount(e),o.on("change",a=>r("change",a)),o.on("ready",a=>r("ready",a)),o.on("focus",a=>r("focus",a)),o.on("blur",a=>r("blur",a)),o.on("escape",a=>r("escape",a)),o.on("click",a=>r("click",a)),o.on("loaderror",a=>r("loaderror",a)),o.on("loaderstart",a=>r("loaderstart",a)),o.on("networkschange",a=>r("networkschange",a)),o}const Fs=typeof window>"u";function Hs(e){if(!Fs)return e.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}var Vs=x("<div></div>");function zs(e,t){W(t,!1);let n,r=we();const i=ya(),{elements:o}=Ko("stripe");let a=m(t,"options",8,void 0);pn(()=>(n=js(g(r),"payment",o,i,a()),()=>n.destroy()));function s(){n.blur()}function l(){n.clear()}function c(){n.destroy()}function d(){n.focus()}Se();var f=Vs();return ba(f,u=>S(r,u),()=>g(r)),p(e,f),hn(t,"blur",s),hn(t,"clear",l),hn(t,"destroy",c),hn(t,"focus",d),Z({blur:s,clear:l,destroy:c,focus:d})}function Gs(e,t){W(t,!1);const n=we();let r=m(t,"stripe",8),i=m(t,"mode",8,void 0),o=m(t,"theme",8,"stripe"),a=m(t,"variables",24,()=>({})),s=m(t,"rules",24,()=>({})),l=m(t,"labels",8,"above"),c=m(t,"loader",8,"auto"),d=m(t,"fonts",24,()=>[]),f=m(t,"locale",8,"auto"),u=m(t,"currency",8,void 0),v=m(t,"amount",8,void 0),_=m(t,"clientSecret",8,void 0),b=m(t,"elements",12,null);it(()=>(se(o()),se(a()),se(s()),se(l())),()=>{S(n,{theme:o(),variables:a(),rules:s(),labels:l()})}),it(()=>(se(r()),se(b()),se(i()),se(u()),se(v()),g(n),se(_()),se(d()),se(c()),se(f()),Vr),()=>{r()&&!b()&&(b(r().elements({mode:i(),currency:u(),amount:v(),appearance:g(n),clientSecret:_(),fonts:d(),loader:c(),locale:f()})),Hs(r()),Vr("stripe",{stripe:r(),elements:b()}))}),it(()=>(se(b()),g(n),se(f())),()=>{b()&&b().update({appearance:g(n),locale:f()})}),Cn(),Se();var I=le(),y=C(I);j(y,()=>r()&&b(),P=>{var k=le(),h=C(k);ne(h,t,"default",{}),p(P,k)}),p(e,I),Z()}var Ai="https://js.stripe.com/v3",Ys=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Oi="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",$s=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Ai,'"]')),n=0;n<t.length;n++){var r=t[n];if(Ys.test(r.src))return r}return null},Ni=function(t){var n="",r=document.createElement("script");r.src="".concat(Ai).concat(n);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(r),r},Ks=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"4.6.0",startTime:n})},Qt=null,mn=null,yn=null,Qs=function(t){return function(){t(new Error("Failed to load Stripe.js"))}},Ws=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},Zs=function(t){return Qt!==null?Qt:(Qt=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&t&&console.warn(Oi),window.Stripe){n(window.Stripe);return}try{var i=$s();if(i&&t)console.warn(Oi);else if(!i)i=Ni(t);else if(i&&yn!==null&&mn!==null){var o;i.removeEventListener("load",yn),i.removeEventListener("error",mn),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=Ni(t)}yn=Ws(n,r),mn=Qs(r),i.addEventListener("load",yn),i.addEventListener("error",mn)}catch(a){r(a);return}}),Qt.catch(function(n){return Qt=null,Promise.reject(n)}))},Xs=function(t,n,r){if(t===null)return null;var i=t.apply(void 0,n);return Ks(i,r),i},Wt,Si=!1,Ri=function(){return Wt||(Wt=Zs(null).catch(function(t){return Wt=null,Promise.reject(t)}),Wt)};Promise.resolve().then(function(){return Ri()}).catch(function(e){Si||console.warn(e)});var Js=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Si=!0;var i=Date.now();return Ri().then(function(o){return Xs(o,n,i)})},el=x('<div class="rcb-header-layout svelte-1xe711j"><!></div>');const tl={hash:"svelte-1xe711j",code:".rcb-header-layout.svelte-1xe711j {display:flex;justify-content:space-between;align-items:center;width:100%;font-size:24px;margin:0;font-weight:500;}"};function Jn(e,t){B(e,tl),wt(e,{as:"header",children:(n,r)=>{var i=el(),o=T(i);ne(o,t,"default",{}),p(n,i)},$$slots:{default:!0}})}const nl=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
49
49
  xmlns="http://www.w3.org/2000/svg">
50
50
  <path d="M18 8H17V6C17 3.24 14.76 1 12 1C9.24 1 7 3.24 7 6V8H6C4.9 8 4 8.9 4 10V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V10C20 8.9 19.1 8 18 8ZM12 17C10.9 17 10 16.1 10 15C10 13.9 10.9 13 12 13C13.1 13 14 13.9 14 15C14 16.1 13.1 17 12 17ZM15.1 8H8.9V6C8.9 4.29 10.29 2.9 12 2.9C13.71 2.9 15.1 4.29 15.1 6V8Z"
51
51
  fill="currentColor"/>
52
52
  </svg>
53
- `;var us=E('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1z0jca3"><!></div>');const fs={hash:"svelte-1z0jca3",code:"div.svelte-1z0jca3 {height:24px;width:24px;}"};function ds(e){j(e,fs);var r=us(),t=x(r);Rr(t,()=>cs),p(e,r)}var vs=E('<div class="processing svelte-rjmul6"></div>');const ps={hash:"svelte-rjmul6",code:`.processing.svelte-rjmul6 {width:12px;aspect-ratio:1;border-radius:50%;
53
+ `;var rl=x('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1z0jca3"><!></div>');const il={hash:"svelte-1z0jca3",code:"div.svelte-1z0jca3 {height:24px;width:24px;}"};function ol(e){B(e,il);var t=rl(),n=T(t);zt(n,()=>nl),p(e,t)}var al=x('<div class="processing svelte-rjmul6"></div>');const sl={hash:"svelte-rjmul6",code:`.processing.svelte-rjmul6 {width:12px;aspect-ratio:1;border-radius:50%;
54
54
  animation: svelte-rjmul6-l5 1.5s infinite linear;}
55
55
  @keyframes svelte-rjmul6-l5 {
56
56
  0% {
@@ -83,13 +83,13 @@
83
83
  -20px 0 #fff2;
84
84
  background: #fff2;
85
85
  }
86
- }`};function Jn(e){j(e,ps);var r=vs();p(e,r)}const hs={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#000000","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.5)","grey-ui-dark":"rgba(0,0,0,0.125)","grey-ui-light":"rgba(0,0,0,0.005)","input-background":"transparent",background:"white"},gs={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#ffffff","primary-text":"#000000",white:"#ffffff","grey-text-dark":"rgba(255,255,255,1)","grey-text-light":"rgba(255,255,255,0.5)","grey-ui-dark":"rgba(255,255,255,0.125)","grey-ui-light":"rgba(255,255,255,0.005)","input-background":"transparent",background:"#000000"},ei={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},_s={...ei,background:"color_form_bg"},ms={...ei,background:"color_product_info_bg"},ri={"input-border-radius":"12px","input-button-border-radius":"12px","modal-border-radius":"16px"},bs={"input-border-radius":"0px","input-button-border-radius":"0px","modal-border-radius":"0px"},ys={"input-border-radius":"24px","input-button-border-radius":"56px","modal-border-radius":"16px"},ti=ri,ni=e=>e.length==7?{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)}:e.length==4?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null,ii=({r:e,g:r,b:t,luminanceThreshold:n})=>{const i=a=>(a=a/255,a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4));return .2126*i(e)+.7152*i(r)+.0722*i(t)>n},oi=.37,Es=(e,r=oi)=>{const t=ii({...e,luminanceThreshold:r})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgba(${t},1.0)`,"grey-text-light":`rgba(${t},0.50)`,"grey-ui-dark":`rgba(${t},0.125)`,"grey-ui-light":`rgba(${t},0.05)`}},ws=(e,r,t,n=oi)=>{const i={"grey-text-dark":t["grey-text-dark"],"grey-text-light":t["grey-text-light"],"grey-ui-dark":t["grey-ui-dark"],"grey-ui-light":t["grey-ui-light"],"primary-text":t["primary-text"]};if(e!=null&&e.startsWith("#")){const o=ni(e);o!==null&&Object.assign(i,Es(o))}if(r!=null&&r.startsWith("#")){const o=ni(r);o!==null&&(i["primary-text"]=ii({...o,luminanceThreshold:n})?"black":"white")}return i},Is=(e,r)=>e||r,xs=(e,r,t)=>{const n=Object.entries(e).map(([i,o])=>[i,Is(t?t[o]:null,r[i])]);return Object.fromEntries(n)},ai=(e,r,t)=>{const n=xs(e,r,t);return t?{...r,...n,...ws(n.background,n.primary,r)}:{...r}},Ps=e=>ai(ms,gs,e),si=e=>ai(_s,hs,e),Lt=e=>{if(!e)return ti;switch(e.shapes){case"rounded":return ri;case"rectangle":return bs;case"pill":return ys;default:return ti}},st=(e="",r)=>r.map(([t,n])=>`--rc-${e}-${t}: ${n}`).join("; "),li=e=>{const r=st("color",Object.entries(Ps(e))),t=st("shape",Object.entries(Lt(e)));return[r,t].join("; ")},Ts=e=>{const r=st("color",Object.entries(si(e))),t=st("shape",Object.entries(Lt(e)));return[r,t].join("; ")};class $t{constructor(r){this.brandingAppearance=r}get shape(){return Lt(this.brandingAppearance)}get formColors(){return si(this.brandingAppearance)}get formStyleVars(){return Ts(this.brandingAppearance)}get productInfoStyleVars(){return li(this.brandingAppearance)}}var As=E('<div style="display: flex; align-items: center; justify-content: baseline;"><!> <div style="margin-left: 10px">Secure Checkout</div></div> <!>',1),Os=E('<div class="rcb-stripe-elements-container svelte-8jsoa8"><!></div>'),ks=E("<!> <!>",1),Ns=E("<!> <form><!></form>",1),Rs=E("<div><!></div>");const Ss={hash:"svelte-8jsoa8",code:`.rcb-stripe-elements-container.svelte-8jsoa8 {width:100%;
86
+ }`};function Li(e){B(e,sl);var t=al();p(e,t)}const ll={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#000000","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.5)","grey-ui-dark":"rgba(0,0,0,0.125)","grey-ui-light":"rgba(0,0,0,0.005)","input-background":"transparent",background:"white"},cl={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#ffffff","primary-text":"#000000",white:"#ffffff","grey-text-dark":"rgba(255,255,255,1)","grey-text-light":"rgba(255,255,255,0.5)","grey-ui-dark":"rgba(255,255,255,0.125)","grey-ui-light":"rgba(255,255,255,0.005)","input-background":"transparent",background:"#000000"},Ui={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},ul={...Ui,background:"color_form_bg"},fl={...Ui,background:"color_product_info_bg"},Mi={"input-border-radius":"12px","input-button-border-radius":"12px","modal-border-radius":"16px"},dl={"input-border-radius":"0px","input-button-border-radius":"0px","modal-border-radius":"0px"},vl={"input-border-radius":"24px","input-button-border-radius":"56px","modal-border-radius":"16px"},Di=Mi,Ci=e=>e.length==7?{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)}:e.length==4?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null,Bi=({r:e,g:t,b:n,luminanceThreshold:r})=>{const i=a=>(a=a/255,a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4));return .2126*i(e)+.7152*i(t)+.0722*i(n)>r},qi=.37,gl=(e,t=qi)=>{const n=Bi({...e,luminanceThreshold:t})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgba(${n},1.0)`,"grey-text-light":`rgba(${n},0.50)`,"grey-ui-dark":`rgba(${n},0.125)`,"grey-ui-light":`rgba(${n},0.05)`}},hl=(e,t,n,r=qi)=>{const i={"grey-text-dark":n["grey-text-dark"],"grey-text-light":n["grey-text-light"],"grey-ui-dark":n["grey-ui-dark"],"grey-ui-light":n["grey-ui-light"],"primary-text":n["primary-text"]};if(e!=null&&e.startsWith("#")){const o=Ci(e);o!==null&&Object.assign(i,gl(o))}if(t!=null&&t.startsWith("#")){const o=Ci(t);o!==null&&(i["primary-text"]=Bi({...o,luminanceThreshold:r})?"black":"white")}return i},pl=(e,t)=>e||t,_l=(e,t,n)=>{const r=Object.entries(e).map(([i,o])=>[i,pl(n?n[o]:null,t[i])]);return Object.fromEntries(r)},ji=(e,t,n)=>{const r=_l(e,t,n);return n?{...t,...r,...hl(r.background,r.primary,t)}:{...t}},bl=e=>ji(fl,cl,e),Fi=e=>ji(ul,ll,e),er=e=>{if(!e)return Di;switch(e.shapes){case"rounded":return Mi;case"rectangle":return dl;case"pill":return vl;default:return Di}},wn=(e="",t)=>t.map(([n,r])=>`--rc-${e}-${n}: ${r}`).join("; "),Hi=e=>{const t=wn("color",Object.entries(bl(e))),n=wn("shape",Object.entries(er(e)));return[t,n].join("; ")},ml=e=>{const t=wn("color",Object.entries(Fi(e))),n=wn("shape",Object.entries(er(e)));return[t,n].join("; ")};class tr{constructor(t){this.brandingAppearance=t}get shape(){return er(this.brandingAppearance)}get formColors(){return Fi(this.brandingAppearance)}get formStyleVars(){return ml(this.brandingAppearance)}get productInfoStyleVars(){return Hi(this.brandingAppearance)}}var yl=x('<div style="display: flex; align-items: center; justify-content: baseline;"><!> <div style="margin-left: 10px">Secure Checkout</div></div> <!>',1),wl=x('<div class="rcb-stripe-elements-container svelte-8jsoa8"><!></div>'),El=x("<!> <!>",1),xl=x("<!> <form><!></form>",1),Il=x("<div><!></div>");const Pl={hash:"svelte-8jsoa8",code:`.rcb-stripe-elements-container.svelte-8jsoa8 {width:100%;
87
87
 
88
88
  /* The standard height of the payment form from Stripe */
89
- /* Added to avoid the card getting smaller while loading */min-height:320px;margin-top:32px;margin-bottom:24px;}`};function Us(e,r){var y;we(r,!1),j(e,Ss);let t=h(r,"onClose",8),n=h(r,"onContinue",8),i=h(r,"onError",8),o=h(r,"paymentInfoCollectionMetadata",8),a=h(r,"processing",12,!1),s=h(r,"productDetails",8),c=h(r,"purchaseOptionToUse",8),l=h(r,"brandingInfo",8);const u=o().data.client_secret;let f=pe(null),d=pe(),m=pe();nt(async()=>{const O=o().data.publishable_api_key,V=o().data.stripe_account_id;if(!O||!V)throw new Error("Stripe publishable key or account ID not found");R(f,await as(O,{stripeAccount:V}))});const w=async()=>{if(a()||!v(f)||!v(m))return;a(!0);const O=await v(f).confirmSetup({elements:v(m),redirect:"if_required"});O.error?(a(!1),i()(new z(ie.StripeError,O.error.message))):n()()},g=new $t((y=l())==null?void 0:y.appearance);let T=g.shape,b=g.formColors;Ye(()=>v(d),()=>{v(d)&&v(d)._elements.length>0&&R(m,v(d))}),mt(),Te();var I=Rs(),A=x(I);F(A,()=>v(f)&&u,O=>{var V=Ns(),$=B(V);Ut($,{children:(S,W)=>{var be=As(),hr=B(be),Mr=x(hr);ds(Mr);var gr=L(hr,2);St(gr,{$$events:{click(..._r){var Se;(Se=t())==null||Se.apply(this,_r)}}}),p(S,be)},$$slots:{default:!0}});var H=L($,2),Q=x(H),me=he(()=>({borderRadius:T["input-border-radius"],fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",focusBoxShadow:"none",colorDanger:b.error,colorTextPlaceholder:b["grey-text-light"]})),Ke=he(()=>({".Input":{boxShadow:"none",border:`2px solid ${b["grey-ui-dark"]}`,backgroundColor:"transparent",color:b["grey-text-dark"]},".Input:focus":{border:`2px solid ${b.focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px",color:b["grey-text-dark"]},".Input--invalid":{boxShadow:"none"},".Tab":{boxShadow:"none",backgroundColor:"transparent"}}));Xa(Q,{get stripe(){return v(f)},clientSecret:u,loader:"always",locale:"en",get elements(){return v(d)},set elements(S){R(d,S)},theme:"stripe",get variables(){return v(me)},get rules(){return v(Ke)},children:(S,W)=>{var be=ks(),hr=B(be);fr(hr,{children:(gr,_r)=>{var Se=Os(),ft=x(Se);Za(ft,{}),p(gr,Se)},$$slots:{default:!0}});var Mr=L(hr,2);Rt(Mr,{children:(gr,_r)=>{Lr(gr,{children:(Se,ft)=>{Nt(Se,{get disabled(){return a()},testId:"PayButton",children:(Ct,Qe)=>{var Br=_e(),Ae=B(Br);F(Ae,a,He=>{Jn(He)},He=>{var Ue=_e(),Ze=B(Ue);F(Ze,()=>{var fe,de;return(de=(fe=s().subscriptionOptions)==null?void 0:fe[c().id])==null?void 0:de.trial},fe=>{var de=We("Start Trial");p(fe,de)},fe=>{var de=We("Pay");p(fe,de)},!0),p(He,Ue)}),p(Ct,Br)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),p(S,be)},$$slots:{default:!0},$$legacy:!0}),rt("submit",H,Un(w)),p(O,V)},O=>{kt(O)}),p(e,I),Ie()}function Ls(e){return e.trim()===""?"You need to provide your email address to continue.":e.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function $s(e){if(e&&!e.match(/^[A-Z]{3}$/)){const r=`Currency code ${e} is not valid. Please provide a valid ISO 4217 currency code.`;throw C.errorLog(r),new X(re.ConfigurationError,r)}}var Ds=E("<span>Billing email address</span> <!>",1),Ms=E('<div class="form-error svelte-yf01ty"> </div>'),Bs=E('<div class="form-container svelte-yf01ty"><div class="form-label svelte-yf01ty"><label for="email">Email</label></div> <div><input name="email" placeholder="john@appleseed.com" autocapitalize="off" class="svelte-yf01ty"></div> <!></div>'),Fs=E('<div class="container svelte-yf01ty"><!> <form class="svelte-yf01ty"><!> <!></form></div>');const qs={hash:"svelte-yf01ty",code:".container.svelte-yf01ty {display:flex;flex-direction:column;flex-grow:1;}form.svelte-yf01ty {display:flex;flex-direction:column;min-height:100%;flex-grow:1;}.form-container.svelte-yf01ty {display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px;}.form-label.svelte-yf01ty {margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px;}.form-input.error.svelte-yf01ty input:where(.svelte-yf01ty) {border-color:var(--rc-color-error);}.form-error.svelte-yf01ty {margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error);}input.svelte-yf01ty {width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:var(--rc-shape-input-border-radius);font-size:16px;height:48px;padding:6px 14px;background:var(--rc-color-input-background);color:inherit;}input.svelte-yf01ty:focus {outline:none;border:2px solid var(--rc-color-focus);}"};function js(e,r){we(r,!1),j(e,qs);const t=pe(),n=pe(),i=pe();let o=h(r,"onContinue",8),a=h(r,"onClose",8),s=h(r,"processing",8),c=h(r,"lastError",8);const l=async()=>{const g=Ls(v(t));g?R(n,g):o()({email:v(t)})};Uo(async()=>{var g;R(n,((g=c())==null?void 0:g.message)??"")}),Ye(()=>{},()=>{R(t,"")}),Ye(()=>{},()=>{R(n,"")}),Ye(()=>v(n),()=>{R(i,v(n)?"error":"")}),mt(),Te();var u=Fs(),f=x(u);Ut(f,{children:(g,T)=>{var b=Ds(),I=L(B(b),2);St(I,{$$events:{click(...A){var y;(y=a())==null||y.apply(this,A)}}}),p(g,b)},$$slots:{default:!0}});var d=L(f,2),m=x(d);fr(m,{children:(g,T)=>{var b=Bs(),I=L(x(b),2),A=x(I),y=L(I,2);F(y,()=>v(n),O=>{var V=Ms(),$=x(V);G(()=>se($,v(n))),p(O,V)}),G(()=>kn(I,`form-input ${v(i)??""} svelte-yf01ty`)),ko(A,()=>v(t),O=>R(t,O)),p(g,b)},$$slots:{default:!0}});var w=L(m,2);Rt(w,{children:(g,T)=>{Lr(g,{children:(b,I)=>{Nt(b,{get disabled(){return s()},type:"submit",children:(A,y)=>{var O=_e(),V=B(O);F(V,s,$=>{Jn($)},$=>{var H=We("Continue");p($,H)}),p(A,O)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),rt("submit",d,Un(l)),p(e,u),Ie()}var Cs=E('<div class="rcb-modal-backdrop svelte-17tslso"><!></div>');const Hs={hash:"svelte-17tslso",code:".rcb-modal-backdrop.svelte-17tslso {position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001;}"};function Vs(e,r){j(e,Hs);var t=Cs(),n=x(t);K(n,r,"default",{}),p(e,t)}var Gs=E('<div class="rcb-modal-container svelte-1fufj5b"><main class="rcb-modal-main svelte-1fufj5b"><!></main></div>');const Ys={hash:"svelte-1fufj5b",code:`.rcb-modal-container.svelte-1fufj5b {width:100%;}.rcb-modal-main.svelte-1fufj5b {box-sizing:border-box;border-radius:var(--rc-shape-modal-border-radius);background-color:var(--rc-color-background);color:var(--rc-color-grey-text-dark);padding:40px;flex-direction:column;display:flex;}
89
+ /* Added to avoid the card getting smaller while loading */min-height:320px;margin-top:32px;margin-bottom:24px;}`};function kl(e,t){var h;W(t,!1),B(e,Pl);let n=m(t,"onClose",8),r=m(t,"onContinue",8),i=m(t,"onError",8),o=m(t,"paymentInfoCollectionMetadata",8),a=m(t,"processing",12,!1),s=m(t,"productDetails",8),l=m(t,"purchaseOptionToUse",8),c=m(t,"brandingInfo",8);const d=o().data.client_secret;let f=we(null),u=we(),v=we();pn(async()=>{const w=o().data.publishable_api_key,F=o().data.stripe_account_id;if(!w||!F)throw new Error("Stripe publishable key or account ID not found");S(f,await Js(w,{stripeAccount:F}))});const _=async()=>{if(a()||!g(f)||!g(v))return;a(!0);const w=await g(f).confirmSetup({elements:g(v),redirect:"if_required"});w.error?(a(!1),i()(new te(ve.StripeError,w.error.message))):r()()},b=new tr((h=c())==null?void 0:h.appearance);let I=b.shape,y=b.formColors;it(()=>g(u),()=>{g(u)&&g(u)._elements.length>0&&S(v,g(u))}),Cn(),Se();var P=Il(),k=T(P);j(k,()=>g(f)&&d,w=>{var F=xl(),G=C(F);Jn(G,{children:(N,Q)=>{var ce=yl(),ze=C(ce),et=T(ze);ol(et);var Ge=U(ze,2);Xn(Ge,{$$events:{click(...Ye){var Ce;(Ce=n())==null||Ce.apply(this,Ye)}}}),p(N,ce)},$$slots:{default:!0}});var A=U(G,2),Y=T(A),X=Ee(()=>({borderRadius:I["input-border-radius"],fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",focusBoxShadow:"none",colorDanger:y.error,colorTextPlaceholder:y["grey-text-light"]})),Ie=Ee(()=>({".Input":{boxShadow:"none",border:`2px solid ${y["grey-ui-dark"]}`,backgroundColor:"transparent",color:y["grey-text-dark"]},".Input:focus":{border:`2px solid ${y.focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px",color:y["grey-text-dark"]},".Input--invalid":{boxShadow:"none"},".Tab":{boxShadow:"none",backgroundColor:"transparent"}}));Gs(Y,{get stripe(){return g(f)},clientSecret:d,loader:"always",locale:"en",get elements(){return g(u)},set elements(N){S(u,N)},theme:"stripe",get variables(){return g(X)},get rules(){return g(Ie)},children:(N,Q)=>{var ce=El(),ze=C(ce);wt(ze,{children:(Ge,Ye)=>{var Ce=wl(),Tn=T(Ce);zs(Tn,{}),p(Ge,Ce)},$$slots:{default:!0}});var et=U(ze,2);Zn(et,{children:(Ge,Ye)=>{Kt(Ge,{children:(Ce,Tn)=>{Wn(Ce,{get disabled(){return a()},testId:"PayButton",children:(pr,ct)=>{var Xt=le(),Re=C(Xt);j(Re,a,tt=>{Li(tt)},tt=>{var Be=le(),ut=C(Be);j(ut,()=>{var _e,be;return(be=(_e=s().subscriptionOptions)==null?void 0:_e[l().id])==null?void 0:be.trial},_e=>{var be=Xe("Start Trial");p(_e,be)},_e=>{var be=Xe("Pay");p(_e,be)},!0),p(tt,Be)}),p(pr,Xt)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),p(N,ce)},$$slots:{default:!0},$$legacy:!0}),gn("submit",A,di(_)),p(w,F)},w=>{Qn(w)}),p(e,P),Z()}function Tl(e){return e.trim()===""?"You need to provide your email address to continue.":e.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function Al(e){if(e&&!e.match(/^[A-Z]{3}$/)){const t=`Currency code ${e} is not valid. Please provide a valid ISO 4217 currency code.`;throw z.errorLog(t),new re(ie.ConfigurationError,t)}}var Ol=x("<span>Billing email address</span> <!>",1),Nl=x('<div class="form-error svelte-yf01ty"> </div>'),Sl=x('<div class="form-container svelte-yf01ty"><div class="form-label svelte-yf01ty"><label for="email">Email</label></div> <div><input name="email" placeholder="john@appleseed.com" autocapitalize="off" class="svelte-yf01ty"></div> <!></div>'),Rl=x('<div class="container svelte-yf01ty"><!> <form class="svelte-yf01ty"><!> <!></form></div>');const Ll={hash:"svelte-yf01ty",code:".container.svelte-yf01ty {display:flex;flex-direction:column;flex-grow:1;}form.svelte-yf01ty {display:flex;flex-direction:column;min-height:100%;flex-grow:1;}.form-container.svelte-yf01ty {display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px;}.form-label.svelte-yf01ty {margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px;}.form-input.error.svelte-yf01ty input:where(.svelte-yf01ty) {border-color:var(--rc-color-error);}.form-error.svelte-yf01ty {margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error);}input.svelte-yf01ty {width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:var(--rc-shape-input-border-radius);font-size:16px;height:48px;padding:6px 14px;background:var(--rc-color-input-background);color:inherit;}input.svelte-yf01ty:focus {outline:none;border:2px solid var(--rc-color-focus);}"};function Ul(e,t){W(t,!1),B(e,Ll);const n=we(),r=we(),i=we();let o=m(t,"onContinue",8),a=m(t,"onClose",8),s=m(t,"processing",8),l=m(t,"lastError",8);const c=async()=>{const b=Tl(g(n));b?S(r,b):o()({email:g(n)})};wa(async()=>{var b;S(r,((b=l())==null?void 0:b.message)??"")}),it(()=>{},()=>{S(n,"")}),it(()=>{},()=>{S(r,"")}),it(()=>g(r),()=>{S(i,g(r)?"error":"")}),Cn(),Se();var d=Rl(),f=T(d);Jn(f,{children:(b,I)=>{var y=Ol(),P=U(C(y),2);Xn(P,{$$events:{click(...k){var h;(h=a())==null||h.apply(this,k)}}}),p(b,y)},$$slots:{default:!0}});var u=U(f,2),v=T(u);wt(v,{children:(b,I)=>{var y=Sl(),P=U(T(y),2),k=T(P),h=U(P,2);j(h,()=>g(r),w=>{var F=Nl(),G=T(F);q(()=>de(G,g(r))),p(w,F)}),q(()=>$n(P,`form-input ${g(i)??""} svelte-yf01ty`)),_a(k,()=>g(n),w=>S(n,w)),p(b,y)},$$slots:{default:!0}});var _=U(v,2);Zn(_,{children:(b,I)=>{Kt(b,{children:(y,P)=>{Wn(y,{get disabled(){return s()},type:"submit",children:(k,h)=>{var w=le(),F=C(w);j(F,s,G=>{Li(G)},G=>{var A=Xe("Continue");p(G,A)}),p(k,w)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),gn("submit",u,di(c)),p(e,d),Z()}var Ml=x('<div class="rcb-modal-backdrop svelte-17tslso"><!></div>');const Dl={hash:"svelte-17tslso",code:".rcb-modal-backdrop.svelte-17tslso {position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001;}"};function Cl(e,t){B(e,Dl);var n=Ml(),r=T(n);ne(r,t,"default",{}),p(e,n)}var Bl=x('<div class="rcb-modal-container svelte-1fufj5b"><main class="rcb-modal-main svelte-1fufj5b"><!></main></div>');const ql={hash:"svelte-1fufj5b",code:`.rcb-modal-container.svelte-1fufj5b {width:100%;}.rcb-modal-main.svelte-1fufj5b {box-sizing:border-box;border-radius:var(--rc-shape-modal-border-radius);background-color:var(--rc-color-background);color:var(--rc-color-grey-text-dark);padding:40px;flex-direction:column;display:flex;}
90
90
 
91
91
  @media screen and (max-width: 960px) {.rcb-modal-container.svelte-1fufj5b {width:calc(100% - 32px);min-width:300px;max-width:640px;margin:auto;}.rcb-modal-main.svelte-1fufj5b {min-width:300px;max-width:640px;padding:32px;}
92
- }`};function ci(e,r){j(e,Ys);let t=h(r,"style",8,"");var n=Gs(),i=x(n),o=x(i);K(o,r,"default",{}),G(()=>le(i,"style",t())),p(e,n)}function Ws(e,r){let t=h(r,"condition",8,!1);var n=_e(),i=B(n);F(i,t,o=>{Vs(o,{children:(a,s)=>{var c=_e(),l=B(c);K(l,r,"default",{}),p(a,c)},$$slots:{default:!0}})},o=>{var a=_e(),s=B(a);K(s,r,"default",{}),p(o,a)}),p(e,n)}const zs=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
92
+ }`};function Vi(e,t){B(e,ql);let n=m(t,"style",8,"");var r=Bl(),i=T(r),o=T(i);ne(o,t,"default",{}),q(()=>K(i,"style",n())),p(e,r)}function jl(e,t){let n=m(t,"condition",8,!1);var r=le(),i=C(r);j(i,n,o=>{Cl(o,{children:(a,s)=>{var l=le(),c=C(l);ne(c,t,"default",{}),p(a,l)},$$slots:{default:!0}})},o=>{var a=le(),s=C(a);ne(s,t,"default",{}),p(o,a)}),p(e,r)}const Fl=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
93
93
  xmlns="http://www.w3.org/2000/svg">
94
94
  <g opacity="0.5" clip-path="url(#clip0_344_3390)">
95
95
  <path d="M7 18C5.9 18 5.01 18.9 5.01 20C5.01 21.1 5.9 22 7 22C8.1 22 9 21.1 9 20C9 18.9 8.1 18 7 18ZM1 2V4H3L6.6 11.59L5.25 14.04C5.09 14.32 5 14.65 5 15C5 16.1 5.9 17 7 17H19V15H7.42C7.28 15 7.17 14.89 7.17 14.75L7.2 14.63L8.1 13H15.55C16.3 13 16.96 12.59 17.3 11.97L20.88 5.48C20.96 5.34 21 5.17 21 5C21 4.45 20.55 4 20 4H5.21L4.27 2H1ZM17 18C15.9 18 15.01 18.9 15.01 20C15.01 21.1 15.9 22 17 22C18.1 22 19 21.1 19 20C19 18.9 18.1 18 17 18Z"
@@ -101,19 +101,37 @@
101
101
  </clipPath>
102
102
  </defs>
103
103
  </svg>
104
- `;var Ks=E('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function Qs(e){var r=Ks(),t=x(r);Rr(t,()=>zs),p(e,r)}var Zs=E('<div class="svelte-1ny4y2s">Sandbox</div>');const Xs={hash:"svelte-1ny4y2s",code:"div.svelte-1ny4y2s {background-color:var(--rc-color-warning);color:rgba(0,0,0,1);font-size:10px;font-weight:bold;text-transform:uppercase;padding:4px 10px;line-height:10px;border-radius:9px;margin:0px;margin-left:16px;}"};function Js(e){j(e,Xs);var r=Zs();p(e,r)}var el=E('<div class="rcb-ui-layout svelte-1iuls9l"><!></div>');const rl={hash:"svelte-1iuls9l",code:`.rcb-ui-layout.svelte-1iuls9l {width:100vw;margin-right:auto;display:flex;justify-content:center;align-items:flex-start;position:relative;padding:0px 80px;box-sizing:border-box;}
104
+ `;var Hl=x('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function Vl(e){var t=Hl(),n=T(t);zt(n,()=>Fl),p(e,t)}var zl=x('<div class="svelte-1ny4y2s">Sandbox</div>');const Gl={hash:"svelte-1ny4y2s",code:"div.svelte-1ny4y2s {background-color:var(--rc-color-warning);color:rgba(0,0,0,1);font-size:10px;font-weight:bold;text-transform:uppercase;padding:4px 10px;line-height:10px;border-radius:9px;margin:0px;margin-left:16px;}"};function Yl(e){B(e,Gl);var t=zl();p(e,t)}var $l=x('<div class="rcb-ui-layout svelte-wuqzav"><!></div>');const Kl={hash:"svelte-wuqzav",code:`.rcb-ui-layout.svelte-wuqzav {width:100vw;margin-right:auto;display:flex;justify-content:center;align-items:flex-start;position:relative;padding:0px 80px;box-sizing:border-box;}
105
105
 
106
- @media screen and (max-width: 960px) {.rcb-ui-layout.svelte-1iuls9l {flex-direction:column;align-items:center;justify-content:center;height:100%;min-width:100%;}
106
+ @media screen and (max-width: 960px) {.rcb-ui-layout.svelte-wuqzav {flex-direction:column;align-items:center;justify-content:center;height:100%;min-width:100%;padding:16px 0;}
107
107
  }
108
108
 
109
- @media screen and (max-width: 960px) and (max-height: 960px) {.rcb-ui-layout.svelte-1iuls9l {overflow-y:scroll;justify-content:flex-start;padding:16px 0;}
110
- }`};function tl(e,r){j(e,rl);let t=h(r,"style",8,"");var n=el(),i=x(n);K(i,r,"default",{}),G(()=>le(n,"style",t())),p(e,n)}var nl=E('<div class="rcb-ui-container svelte-1sfb5if"><!></div>');const il={hash:"svelte-1sfb5if",code:`.rcb-ui-container.svelte-1sfb5if {color-scheme:none;font-size:16px;line-height:1.5em;font-weight:400;font-family:-apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
111
- Cantarell, "Open Sans", "Helvetica Neue", sans-serif;}`};function ol(e,r){j(e,il);let t=h(r,"style",8,"");var n=nl(),i=x(n);K(i,r,"default",{}),G(()=>le(n,"style",t())),p(e,n)}var al=E("<!> <!>",1),sl=E('<div class="rcb-ui-aside svelte-17dr902"><!></div>');const ll={hash:"svelte-17dr902",code:`.rcb-ui-aside.svelte-17dr902 {margin-right:16px;flex:320px 1 0;max-width:480px;}
109
+ @media screen and (max-width: 960px) and (max-height: 960px) {.rcb-ui-layout.svelte-wuqzav {overflow-y:scroll;justify-content:flex-start;}
110
+ }`};function Ql(e,t){B(e,Kl);let n=m(t,"style",8,"");var r=$l(),i=T(r);ne(i,t,"default",{}),q(()=>K(r,"style",n())),p(e,r)}var Wl=x('<div class="rcb-ui-container svelte-1sfb5if"><!></div>');const Zl={hash:"svelte-1sfb5if",code:`.rcb-ui-container.svelte-1sfb5if {color-scheme:none;font-size:16px;line-height:1.5em;font-weight:400;font-family:-apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
111
+ Cantarell, "Open Sans", "Helvetica Neue", sans-serif;}`};function Xl(e,t){B(e,Zl);let n=m(t,"style",8,"");var r=Wl(),i=T(r);ne(i,t,"default",{}),q(()=>K(r,"style",n())),p(e,r)}var Jl=x("<!> <!>",1),ec=x('<div class="rcb-ui-aside svelte-17dr902"><!></div>');const tc={hash:"svelte-17dr902",code:`.rcb-ui-aside.svelte-17dr902 {margin-right:16px;flex:320px 1 0;max-width:480px;}
112
112
 
113
113
  @media screen and (max-width: 960px) {.rcb-ui-aside.svelte-17dr902 {margin-right:0;margin-bottom:16px;min-width:100%;display:flex;flex-direction:column;align-items:center;flex:none;max-width:none;}
114
- }`};function cl(e,r){we(r,!1),j(e,ll);let t=h(r,"brandingAppearance",8,void 0),n=new $t(t()).productInfoStyleVars;Te();var i=sl();le(i,"style",n);var o=x(i);ci(o,{children:(a,s)=>{var c=al(),l=B(c);K(l,r,"header",{});var u=L(l,2);K(u,r,"default",{}),p(a,c)},$$slots:{default:!0}}),p(e,i),Ie()}var ul=E("<!> <!>",1),fl=E('<div class="rcb-ui-main svelte-vpgys"><!></div>');const dl={hash:"svelte-vpgys",code:`.rcb-ui-main.svelte-vpgys {flex:480px 1 0;max-width:640px;}
114
+ }`};function nc(e,t){W(t,!1),B(e,tc);let n=m(t,"brandingAppearance",8,void 0),r=new tr(n()).productInfoStyleVars;Se();var i=ec();K(i,"style",r);var o=T(i);Vi(o,{children:(a,s)=>{var l=Jl(),c=C(l);ne(c,t,"header",{});var d=U(c,2);ne(d,t,"default",{}),p(a,l)},$$slots:{default:!0}}),p(e,i),Z()}var rc=x("<!> <!>",1),ic=x('<div class="rcb-ui-main svelte-vpgys"><!></div>');const oc={hash:"svelte-vpgys",code:`.rcb-ui-main.svelte-vpgys {flex:480px 1 0;max-width:640px;}
115
115
 
116
116
  @media screen and (max-width: 960px) {.rcb-ui-main.svelte-vpgys {flex:none;max-width:none;min-width:100%;}
117
- }`};function vl(e,r){we(r,!1),j(e,dl);let t=h(r,"brandingAppearance",8,void 0),n=new $t(t()).formStyleVars;Te();var i=fl();le(i,"style",n);var o=x(i);ci(o,{style:"min-height: 360px;",children:(a,s)=>{var c=ul(),l=B(c);K(l,r,"header",{});var u=L(l,2);K(u,r,"default",{}),p(a,c)},$$slots:{default:!0}}),p(e,i),Ie()}var pl=E("<!> <!>",1),hl=E("<!> <!> <!> <!> <!> <!> <!>",1),gl=E("<!> <!>",1);function _l(e,r){we(r,!1);let t=h(r,"asModal",8,!0),n=h(r,"customerEmail",12),i=h(r,"appUserId",8),o=h(r,"rcPackage",8),a=h(r,"purchaseOption",8),s=h(r,"brandingInfo",8),c=h(r,"onFinished",8),l=h(r,"onError",8),u=h(r,"onClose",8),f=h(r,"purchases",8),d=h(r,"purchaseOperationHelper",8),m=pe(""),w=pe(null),g=pe(null),T=pe(null);const b=o().rcBillingProduct.identifier??null,I=o().rcBillingProduct.defaultPurchaseOption,A=a()?a():I;let y=pe("present-offer"),O=null;const V=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];nt(async()=>{var S;if(R(w,o().rcBillingProduct),R(m,li((S=s())==null?void 0:S.appearance)),v(y)==="present-offer"){n()?H():R(y,"needs-auth-info");return}});const $=()=>{u()()},H=()=>{if(b===null){me(new z(ie.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else v(y)==="present-offer"&&R(y,"loading");if(!n()){me(new z(ie.MissingEmailError));return}d().startPurchase(i(),b,A,n(),o().rcBillingProduct.presentedOfferingContext).then(S=>{if(S.next_action==="collect_payment_info"){R(T,null),R(y,"needs-payment-info"),R(g,S);return}if(S.next_action==="completed"){R(T,null),R(y,"success");return}}).catch(S=>{me(S)})},Q=S=>{if(v(y)==="needs-auth-info"){S&&(n(S.email),R(y,"processing-auth-info")),H();return}if(v(y)==="needs-payment-info"){R(y,"polling-purchase-status"),d().pollCurrentPurchaseForCompletion().then(W=>{R(y,"success"),O=W.redemptionInfo}).catch(W=>{me(W)});return}if(v(y)==="success"||v(y)==="error"){c()(O);return}R(y,"success")},me=S=>{if(v(y)==="processing-auth-info"&&S.isRecoverable()){R(T,S),R(y,"needs-auth-info");return}R(T,S),R(y,"error")},Ke=()=>{l()(v(T)??new z(ie.UnknownError,"Unknown error without state set."))};Te(),ol(e,{children:(S,W)=>{Ws(S,{get condition(){return t()},children:(be,hr)=>{tl(be,{get style(){return v(m)},children:(Mr,gr)=>{var _r=gl(),Se=B(_r);F(Se,()=>V.includes(v(y)),Qe=>{var Br=he(()=>{var Ae;return(Ae=s())==null?void 0:Ae.appearance});cl(Qe,{get brandingAppearance(){return v(Br)},children:(Ae,He)=>{var Ue=_e(),Ze=B(Ue);F(Ze,()=>v(w)&&A,fe=>{var de=he(()=>{var Xe;return(Xe=s())==null?void 0:Xe.appearance});jn(fe,{get productDetails(){return v(w)},get brandingAppearance(){return v(de)},purchaseOption:A})}),p(Ae,Ue)},$$slots:{default:!0,header:(Ae,He)=>{Ut(Ae,{slot:"header",children:(Ue,Ze)=>{var fe=pl(),de=B(fe);Yn(de,{get brandingInfo(){return s()}});var Xe=L(de,2);F(Xe,()=>f().isSandbox(),Fr=>{Js(Fr)},Fr=>{Qs(Fr)}),p(Ue,fe)},$$slots:{default:!0}})}}})});var ft=L(Se,2),Ct=he(()=>{var Qe;return(Qe=s())==null?void 0:Qe.appearance});vl(ft,{get brandingAppearance(){return v(Ct)},children:(Qe,Br)=>{var Ae=hl(),He=B(Ae);F(He,()=>v(y)==="present-offer"&&v(w)&&A,ye=>{jn(ye,{get productDetails(){return v(w)},purchaseOption:A})});var Ue=L(He,2);F(Ue,()=>v(y)==="present-offer"&&!v(w),ye=>{kt(ye)});var Ze=L(Ue,2);F(Ze,()=>v(y)==="needs-auth-info"||v(y)==="processing-auth-info",ye=>{var qr=he(()=>v(y)==="processing-auth-info");js(ye,{onContinue:Q,onClose:$,get processing(){return v(qr)},get lastError(){return v(T)}})});var fe=L(Ze,2);F(fe,()=>v(g)&&(v(y)==="needs-payment-info"||v(y)==="polling-purchase-status")&&v(w)&&A,ye=>{var qr=he(()=>v(y)==="polling-purchase-status");Us(ye,{get paymentInfoCollectionMetadata(){return v(g)},onContinue:Q,onClose:$,onError:me,get processing(){return v(qr)},get productDetails(){return v(w)},purchaseOptionToUse:A,get brandingInfo(){return s()}})});var de=L(fe,2);F(de,()=>v(y)==="loading",ye=>{kt(ye)});var Xe=L(de,2);F(Xe,()=>v(y)==="error",ye=>{var qr=he(()=>v(T)??new z(ie.UnknownError,"Unknown error without state set.")),Kl=he(()=>{var bi;return(bi=s())==null?void 0:bi.seller_company_support_email});ja(ye,{get brandingInfo(){return s()},get lastError(){return v(qr)},get supportEmail(){return v(Kl)},get productDetails(){return v(w)},onContinue:Ke})});var Fr=L(Xe,2);F(Fr,()=>v(y)==="success",ye=>{Ya(ye,{get productDetails(){return v(w)},get brandingInfo(){return s()},onContinue:Q})}),p(Qe,Ae)},$$slots:{default:!0}}),p(Mr,_r)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),Ie()}function ml(e){return e.expires_date==null?!0:new Date(e.expires_date)>new Date}function bl(e,r,t,n){const i=r.product_identifier;if(i in t)return yl(e,r,t[i]);if(i in n)return El(e,r,n[i]);throw new X(re.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function yl(e,r,t){return{identifier:e,isActive:ml(r),willRenew:xl(r,t),store:(t==null?void 0:t.store)??"unknown",latestPurchaseDate:new Date(r.purchase_date),originalPurchaseDate:new Date(r.purchase_date),expirationDate:lt(r.expires_date),productIdentifier:r.product_identifier,unsubscribeDetectedAt:lt(t==null?void 0:t.unsubscribe_detected_at),billingIssueDetectedAt:lt(t==null?void 0:t.billing_issues_detected_at),isSandbox:(t==null?void 0:t.is_sandbox)??!1,periodType:(t==null?void 0:t.period_type)??"normal"}}function El(e,r,t){return{identifier:e,isActive:!0,willRenew:!1,store:t.store,latestPurchaseDate:new Date(r.purchase_date),originalPurchaseDate:new Date(t.original_purchase_date),expirationDate:null,productIdentifier:r.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:t.is_sandbox,periodType:"normal"}}function wl(e,r,t){const n={},i={};for(const o in e){const a=bl(o,e[o],r,t);n[o]=a,a.isActive&&(i[o]=a)}return{all:n,active:i}}function lt(e){return e==null?null:new Date(e)}function Il(e){const r=Tl(e),t=e.subscriber,n=Ol(t.non_subscriptions);return{entitlements:wl(t.entitlements,t.subscriptions,n),allExpirationDatesByProduct:r,allPurchaseDatesByProduct:Pl(e,n),activeSubscriptions:Al(r),managementURL:t.management_url,requestDate:new Date(e.request_date),firstSeenDate:new Date(t.first_seen),originalPurchaseDate:lt(t.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id}}function xl(e,r){if(r==null)return!1;const t=r.store=="promotional",n=e.expires_date==null,i=r.unsubscribe_detected_at!=null,o=r.billing_issues_detected_at!=null;return!(t||n||i||o)}function Pl(e,r){const t={};for(const n in e.subscriber.subscriptions){const i=e.subscriber.subscriptions[n];t[n]=new Date(i.purchase_date)}for(const n in r){const i=r[n].purchase_date;i==null?t[n]=null:t[n]=new Date(i)}return t}function Tl(e){const r={};for(const t in e.subscriber.subscriptions){const n=e.subscriber.subscriptions[t];n.expires_date==null?r[t]=null:r[t]=new Date(n.expires_date)}return r}function Al(e){const r=new Set,t=new Date;for(const n in e){const i=e[n];(i==null||i>t)&&r.add(n)}return r}function Ol(e){const r={};for(const t in e){if(e[t].length===0)continue;const n=e[t].length;r[t]=e[t][n-1]}return r}const kl="0.12.1",Nl="https://api.revenuecat.com";var ct;(function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(ct||(ct={}));function Dt(e){return e?e.startsWith("rcb_sb_"):!1}async function pr(e,r){const{apiKey:t,body:n,headers:i,httpConfig:o}=r,s=`${(o==null?void 0:o.proxyURL)??Nl}${e.urlPath()}`;try{const c=await fetch(s,{method:e.method,headers:Ll(t,i,o==null?void 0:o.additionalHeaders),body:Sl(n)});return await Rl(c,e),await c.json()}catch(c){throw c instanceof TypeError?new X(re.NetworkError,Sr.getPublicMessage(re.NetworkError),c.message):c}}async function Rl(e,r){const t=e.status;if(t>=ct.INTERNAL_SERVER_ERROR)Mt(r,t,await e.text());else if(t>=ct.BAD_REQUEST){const n=await e.json(),i=n?JSON.stringify(n):null,o=n==null?void 0:n.code,a=n==null?void 0:n.message;if(o!=null){const s=Sr.convertCodeToBackendErrorCode(o);if(s==null)Mt(r,t,i,o);else throw X.getForBackendError(s,a)}else Mt(r,t,i)}}function Mt(e,r,t,n){throw new X(re.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${r}. Body: ${t}.`,{backendErrorCode:n})}function Sl(e){return e==null?null:JSON.stringify(e)}const ui="Authorization",fi="Content-Type",di="Accept",vi="X-Platform",pi="X-Version",hi="X-Is-Sandbox",Ul=new Set([ui,fi,di,vi,pi,hi]);function Ll(e,r,t){let n={[ui]:`Bearer ${e}`,[fi]:"application/json",[di]:"application/json",[vi]:"web",[pi]:kl,[hi]:`${Dt(e)}`};return r&&(n={...n,...r}),t&&(n={...t,...n}),n}const gi="/v1/subscribers",ut="/rcbilling/v1";class $l{constructor(r){D(this,"appUserId");D(this,"method","GET");D(this,"name","getOfferings");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${gi}/${r}/offerings`}}class Dl{constructor(){D(this,"method","POST");D(this,"name","purchase")}urlPath(){return`${ut}/purchase`}}class Ml{constructor(r,t,n){D(this,"method","GET");D(this,"name","getProducts");D(this,"appUserId");D(this,"productIds");D(this,"currency");this.appUserId=r,this.productIds=t,this.currency=n}urlPath(){const r=encodeURIComponent(this.appUserId),t=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`&currency=${this.currency}`:"";return`${ut}/subscribers/${r}/products?id=${t}${n}`}}class Bl{constructor(r){D(this,"method","GET");D(this,"name","getCustomerInfo");D(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${gi}/${r}`}}class Fl{constructor(){D(this,"method","GET");D(this,"name","getBrandingInfo")}urlPath(){return`${ut}/branding`}}class ql{constructor(r){D(this,"method","GET");D(this,"name","getCheckoutStatus");D(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${ut}/checkout/${this.operationSessionId}`}}const Bt={};class jl{constructor(r,t=Bt){D(this,"API_KEY");D(this,"httpConfig");this.API_KEY=r,this.httpConfig=t}async getOfferings(r){return await pr(new $l(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(r){return await pr(new Bl(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(r,t,n){return await pr(new Ml(r,t,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await pr(new Fl,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(r,t,n,i,o){const a={app_user_id:r,product_id:t,email:n,price_id:o.priceId,presented_offering_identifier:i.offeringIdentifier};return o.id!=="base_option"&&(a.offer_id=o.id),i.targetingContext&&(a.applied_targeting_rule={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision}),i.placementIdentifier&&(a.presented_placement_identifier=i.placementIdentifier),await pr(new Dl,{apiKey:this.API_KEY,body:a,httpConfig:this.httpConfig})}async getCheckoutStatus(r){return await pr(new ql(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Cl(e){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(e))throw new X(re.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function Hl(e){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new X(re.InvalidAppUserIdError,'Provided user id: "'+e+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Vl(e){if(e!=null&&e.endsWith("/"))throw new X(re.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function Gl(e){if(e){for(const r in e)if(Ul.has(r))throw new X(re.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var Ft=(e=>(e.Current="current",e))(Ft||{});function Yl(e,r){async function t(...n){return await this.preload(),await e.call(this,...n)}return t}const _i=(e,r)=>({...e,rcBillingProduct:{...e.rcBillingProduct,presentedOfferingContext:{...e.rcBillingProduct.presentedOfferingContext,placementIdentifier:r}}}),ze=(e,r)=>e==null?null:_i(e,r),Wl=(e,r,t)=>{const n=e.offering_ids_by_placement??null;if(n==null)return null;const i=e.fallback_offering_id??null;let o;if(t in n){const s=n[t]??null;if(s==null)return null;o=r[s],o==null&&(o=r[i])}else o=r[i];if(o==null)return null;const a=Object.fromEntries(Object.entries(o.packagesById).map(([s,c])=>[s,_i(c,t)]));return{...o,packagesById:a,availablePackages:Object.values(a),weekly:ze(o.weekly,t),monthly:ze(o.monthly,t),twoMonth:ze(o.twoMonth,t),threeMonth:ze(o.threeMonth,t),sixMonth:ze(o.sixMonth,t),annual:ze(o.annual,t),lifetime:ze(o.lifetime,t)}};function zl(e,r){const t={};r.product_details.forEach(o=>{t[o.identifier]=o});const n={};e.offerings.forEach(o=>{const a=o.identifier===e.current_offering_id,s=zo(a,o,t,e.targeting);s!=null&&(n[o.identifier]=s)});const i=e.current_offering_id?n[e.current_offering_id]??null:null;return Object.keys(n).length==0&&C.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:i}}mi=[Yl];const ue=class ue{constructor(r,t,n=Bt){Ai(jt,5,this);D(this,"_API_KEY");D(this,"_appUserId");D(this,"_brandingInfo",null);D(this,"_loadingResourcesPromise",null);D(this,"backend");D(this,"purchaseOperationHelper");this._API_KEY=r,this._appUserId=t,Dt(r)&&C.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new jl(this._API_KEY,n),this.purchaseOperationHelper=new fa(this.backend)}static setLogLevel(r){C.setLogLevel(r)}static getSharedInstance(){if(ue.isConfigured())return ue.instance;throw new Hn}static isConfigured(){return ue.instance!==void 0}static configure(r,t,n=Bt){return ue.instance!==void 0&&C.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),Cl(r),Hl(t),Vl(n.proxyURL),Gl(n.additionalHeaders),ue.instance=new ue(r,t,n),ue.getSharedInstance()}async preload(){if(this.hasLoadedResources()){C.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){C.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.backend.getBrandingInfo().then(r=>{this._brandingInfo=r}).catch(r=>{let t=`${r}`;r instanceof X&&(t=`${r.message}. ${r.underlyingErrorMessage?`Underlying error: ${r.underlyingErrorMessage}`:""}`),C.errorLog(`Error fetching branding info: ${t}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}hasLoadedResources(){return this._brandingInfo!==null}async getOfferings(r){$s(r==null?void 0:r.currency);const t=this._appUserId,n=await this.backend.getOfferings(t),i=(r==null?void 0:r.offeringIdentifier)===Ft.Current?n.current_offering_id:r==null?void 0:r.offeringIdentifier;return i&&(n.offerings=n.offerings.filter(o=>o.identifier===i)),await this.getAllOfferings(n,t,r)}async getCurrentOfferingForPlacement(r,t){const n=this._appUserId,i=await this.backend.getOfferings(n),o=await this.getAllOfferings(i,n,t),a=i.placements??null;return a==null?null:Wl(a,o.all,r)}async getAllOfferings(r,t,n){const i=r.offerings.flatMap(a=>a.packages).map(a=>a.platform_product_identifier),o=await this.backend.getProducts(t,i,n==null?void 0:n.currency);return this.logMissingProductIds(i,o.product_details),zl(r,o)}async isEntitledTo(r){const t=await this.getCustomerInfo();return r in t.entitlements.active}purchasePackage(r,t,n){return this.purchase({rcPackage:r,customerEmail:t,htmlTarget:n})}purchase(r){const{rcPackage:t,purchaseOption:n,htmlTarget:i,customerEmail:o}=r;let a=i??document.getElementById("rcb-ui-root");if(a===null){const u=document.createElement("div");u.className="rcb-ui-root",document.body.appendChild(u),a=u}if(a===null)throw new Error("Could not generate a mount point for the billing widget");const s=a,c=!i,l=this._appUserId;return C.debugLog(`Presenting purchase form for package ${t.identifier}`),new Promise((u,f)=>{xo(_l,{target:s,props:{appUserId:l,rcPackage:t,purchaseOption:n,customerEmail:o,onFinished:async d=>{C.debugLog("Purchase finished"),s.innerHTML="";const m={customerInfo:await this._getCustomerInfoForUserId(l),redemptionInfo:d};u(m)},onClose:()=>{s.innerHTML="",C.debugLog("Purchase cancelled by user"),f(new X(re.UserCancelledError))},onError:d=>{s.innerHTML="",f(X.getForPurchasesFlowError(d))},purchases:this,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,asModal:c}})})}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async changeUser(r){return this._appUserId=r,await this.getCustomerInfo()}logMissingProductIds(r,t){const n={};t.forEach(o=>n[o.identifier]=o);const i=[];r.forEach(o=>{n[o]===void 0&&i.push(o)}),i.length>0&&C.debugLog(`Could not find product data for product ids:
117
+ }`};function ac(e,t){W(t,!1),B(e,oc);let n=m(t,"brandingAppearance",8,void 0),r=new tr(n()).formStyleVars;Se();var i=ic();K(i,"style",r);var o=T(i);Vi(o,{style:"min-height: 360px;",children:(a,s)=>{var l=rc(),c=C(l);ne(c,t,"header",{});var d=U(c,2);ne(d,t,"default",{}),p(a,l)},$$slots:{default:!0}}),p(e,i),Z()}var sc=x("<!> <!>",1),lc=x("<!> <!> <!> <!> <!> <!> <!>",1),cc=x("<!> <!>",1);function uc(e,t){W(t,!1);let n=m(t,"asModal",8,!0),r=m(t,"customerEmail",12),i=m(t,"appUserId",8),o=m(t,"rcPackage",8),a=m(t,"purchaseOption",8),s=m(t,"brandingInfo",8),l=m(t,"onFinished",8),c=m(t,"onError",8),d=m(t,"onClose",8),f=m(t,"purchases",8),u=m(t,"purchaseOperationHelper",8),v=we(""),_=we(null),b=we(null),I=we(null);const y=o().rcBillingProduct.identifier??null,P=o().rcBillingProduct.defaultPurchaseOption,k=a()?a():P;let h=we("present-offer"),w=null;const F=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];pn(async()=>{var N;if(S(_,o().rcBillingProduct),S(v,Hi((N=s())==null?void 0:N.appearance)),g(h)==="present-offer"){r()?A():S(h,"needs-auth-info");return}});const G=()=>{d()()},A=()=>{if(y===null){X(new te(ve.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else g(h)==="present-offer"&&S(h,"loading");if(!r()){X(new te(ve.MissingEmailError));return}u().startPurchase(i(),y,k,r(),o().rcBillingProduct.presentedOfferingContext).then(N=>{if(N.next_action==="collect_payment_info"){S(I,null),S(h,"needs-payment-info"),S(b,N);return}if(N.next_action==="completed"){S(I,null),S(h,"success");return}}).catch(N=>{X(N)})},Y=N=>{if(g(h)==="needs-auth-info"){N&&(r(N.email),S(h,"processing-auth-info")),A();return}if(g(h)==="needs-payment-info"){S(h,"polling-purchase-status"),u().pollCurrentPurchaseForCompletion().then(Q=>{S(h,"success"),w=Q.redemptionInfo}).catch(Q=>{X(Q)});return}if(g(h)==="success"||g(h)==="error"){l()(w);return}S(h,"success")},X=N=>{if(g(h)==="processing-auth-info"&&N.isRecoverable()){S(I,N),S(h,"needs-auth-info");return}S(I,N),S(h,"error")},Ie=()=>{c()(g(I)??new te(ve.UnknownError,"Unknown error without state set."))};Se(),Xl(e,{children:(N,Q)=>{jl(N,{get condition(){return n()},children:(ce,ze)=>{Ql(ce,{get style(){return g(v)},children:(et,Ge)=>{var Ye=cc(),Ce=C(Ye);j(Ce,()=>F.includes(g(h)),ct=>{var Xt=Ee(()=>{var Re;return(Re=s())==null?void 0:Re.appearance});nc(ct,{get brandingAppearance(){return g(Xt)},children:(Re,tt)=>{var Be=le(),ut=C(Be);j(ut,()=>g(_)&&k,_e=>{var be=Ee(()=>{var ft;return(ft=s())==null?void 0:ft.appearance});wi(_e,{get productDetails(){return g(_)},get brandingAppearance(){return g(be)},purchaseOption:k})}),p(Re,Be)},$$slots:{default:!0,header:(Re,tt)=>{Jn(Re,{slot:"header",children:(Be,ut)=>{var _e=sc(),be=C(_e);ki(be,{get brandingInfo(){return s()}});var ft=U(be,2);j(ft,()=>f().isSandbox(),Jt=>{Yl(Jt)},Jt=>{Vl(Jt)}),p(Be,_e)},$$slots:{default:!0}})}}})});var Tn=U(Ce,2),pr=Ee(()=>{var ct;return(ct=s())==null?void 0:ct.appearance});ac(Tn,{get brandingAppearance(){return g(pr)},children:(ct,Xt)=>{var Re=lc(),tt=C(Re);j(tt,()=>g(h)==="present-offer"&&g(_)&&k,Pe=>{wi(Pe,{get productDetails(){return g(_)},purchaseOption:k})});var Be=U(tt,2);j(Be,()=>g(h)==="present-offer"&&!g(_),Pe=>{Qn(Pe)});var ut=U(Be,2);j(ut,()=>g(h)==="needs-auth-info"||g(h)==="processing-auth-info",Pe=>{var en=Ee(()=>g(h)==="processing-auth-info");Ul(Pe,{onContinue:Y,onClose:G,get processing(){return g(en)},get lastError(){return g(I)}})});var _e=U(ut,2);j(_e,()=>g(b)&&(g(h)==="needs-payment-info"||g(h)==="polling-purchase-status")&&g(_)&&k,Pe=>{var en=Ee(()=>g(h)==="polling-purchase-status");kl(Pe,{get paymentInfoCollectionMetadata(){return g(b)},onContinue:Y,onClose:G,onError:X,get processing(){return g(en)},get productDetails(){return g(_)},purchaseOptionToUse:k,get brandingInfo(){return s()}})});var be=U(_e,2);j(be,()=>g(h)==="loading",Pe=>{Qn(Pe)});var ft=U(be,2);j(ft,()=>g(h)==="error",Pe=>{var en=Ee(()=>g(I)??new te(ve.UnknownError,"Unknown error without state set.")),Iu=Ee(()=>{var io;return(io=s())==null?void 0:io.seller_company_support_email});Us(Pe,{get brandingInfo(){return s()},get lastError(){return g(en)},get supportEmail(){return g(Iu)},get productDetails(){return g(_)},onContinue:Ie})});var Jt=U(ft,2);j(Jt,()=>g(h)==="success",Pe=>{qs(Pe,{get productDetails(){return g(_)},get brandingInfo(){return s()},onContinue:Y})}),p(ct,Re)},$$slots:{default:!0}}),p(et,Ye)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),Z()}function fc(e){return e.expires_date==null?!0:new Date(e.expires_date)>new Date}function dc(e,t,n,r){const i=t.product_identifier;if(i in n)return vc(e,t,n[i]);if(i in r)return gc(e,t,r[i]);throw new re(ie.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function vc(e,t,n){return{identifier:e,isActive:fc(t),willRenew:_c(t,n),store:(n==null?void 0:n.store)??"unknown",latestPurchaseDate:new Date(t.purchase_date),originalPurchaseDate:new Date(t.purchase_date),expirationDate:En(t.expires_date),productIdentifier:t.product_identifier,unsubscribeDetectedAt:En(n==null?void 0:n.unsubscribe_detected_at),billingIssueDetectedAt:En(n==null?void 0:n.billing_issues_detected_at),isSandbox:(n==null?void 0:n.is_sandbox)??!1,periodType:(n==null?void 0:n.period_type)??"normal"}}function gc(e,t,n){return{identifier:e,isActive:!0,willRenew:!1,store:n.store,latestPurchaseDate:new Date(t.purchase_date),originalPurchaseDate:new Date(n.original_purchase_date),expirationDate:null,productIdentifier:t.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:n.is_sandbox,periodType:"normal"}}function hc(e,t,n){const r={},i={};for(const o in e){const a=dc(o,e[o],t,n);r[o]=a,a.isActive&&(i[o]=a)}return{all:r,active:i}}function En(e){return e==null?null:new Date(e)}function pc(e){const t=mc(e),n=e.subscriber,r=wc(n.non_subscriptions);return{entitlements:hc(n.entitlements,n.subscriptions,r),allExpirationDatesByProduct:t,allPurchaseDatesByProduct:bc(e,r),activeSubscriptions:yc(t),managementURL:n.management_url,requestDate:new Date(e.request_date),firstSeenDate:new Date(n.first_seen),originalPurchaseDate:En(n.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id}}function _c(e,t){if(t==null)return!1;const n=t.store=="promotional",r=e.expires_date==null,i=t.unsubscribe_detected_at!=null,o=t.billing_issues_detected_at!=null;return!(n||r||i||o)}function bc(e,t){const n={};for(const r in e.subscriber.subscriptions){const i=e.subscriber.subscriptions[r];n[r]=new Date(i.purchase_date)}for(const r in t){const i=t[r].purchase_date;i==null?n[r]=null:n[r]=new Date(i)}return n}function mc(e){const t={};for(const n in e.subscriber.subscriptions){const r=e.subscriber.subscriptions[n];r.expires_date==null?t[n]=null:t[n]=new Date(r.expires_date)}return t}function yc(e){const t=new Set,n=new Date;for(const r in e){const i=e[r];(i==null||i>n)&&t.add(r)}return t}function wc(e){const t={};for(const n in e){if(e[n].length===0)continue;const r=e[n].length;t[n]=e[n][r-1]}return t}const Ec="0.13.0",xc="https://api.revenuecat.com";var xn;(function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(xn||(xn={}));function nr(e){return e?e.startsWith("rcb_sb_"):!1}async function It(e,t){const{apiKey:n,body:r,headers:i,httpConfig:o}=t,s=`${(o==null?void 0:o.proxyURL)??xc}${e.urlPath()}`;try{const l=await fetch(s,{method:e.method,headers:Tc(n,i,o==null?void 0:o.additionalHeaders),body:Pc(r)});return await Ic(l,e),await l.json()}catch(l){throw l instanceof TypeError?new re(ie.NetworkError,Yt.getPublicMessage(ie.NetworkError),l.message):l}}async function Ic(e,t){const n=e.status;if(n>=xn.INTERNAL_SERVER_ERROR)rr(t,n,await e.text());else if(n>=xn.BAD_REQUEST){const r=await e.json(),i=r?JSON.stringify(r):null,o=r==null?void 0:r.code,a=r==null?void 0:r.message;if(o!=null){const s=Yt.convertCodeToBackendErrorCode(o);if(s==null)rr(t,n,i,o);else throw re.getForBackendError(s,a)}else rr(t,n,i)}}function rr(e,t,n,r){throw new re(ie.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${t}. Body: ${n}.`,{backendErrorCode:r})}function Pc(e){return e==null?null:JSON.stringify(e)}const zi="Authorization",Gi="Content-Type",Yi="Accept",$i="X-Platform",Ki="X-Version",Qi="X-Is-Sandbox",kc=new Set([zi,Gi,Yi,$i,Ki,Qi]);function Tc(e,t,n){let r={[zi]:`Bearer ${e}`,[Gi]:"application/json",[Yi]:"application/json",[$i]:"web",[Ki]:Ec,[Qi]:`${nr(e)}`};return t&&(r={...r,...t}),n&&(r={...n,...r}),r}const Wi="/v1/subscribers",In="/rcbilling/v1";class Ac{constructor(t){D(this,"appUserId");D(this,"method","GET");D(this,"name","getOfferings");this.appUserId=t}urlPath(){const t=encodeURIComponent(this.appUserId);return`${Wi}/${t}/offerings`}}class Oc{constructor(){D(this,"method","POST");D(this,"name","purchase")}urlPath(){return`${In}/purchase`}}class Nc{constructor(t,n,r){D(this,"method","GET");D(this,"name","getProducts");D(this,"appUserId");D(this,"productIds");D(this,"currency");this.appUserId=t,this.productIds=n,this.currency=r}urlPath(){const t=encodeURIComponent(this.appUserId),n=this.productIds.map(encodeURIComponent).join("&id="),r=this.currency?`&currency=${this.currency}`:"";return`${In}/subscribers/${t}/products?id=${n}${r}`}}class Sc{constructor(t){D(this,"method","GET");D(this,"name","getCustomerInfo");D(this,"appUserId");this.appUserId=t}urlPath(){const t=encodeURIComponent(this.appUserId);return`${Wi}/${t}`}}class Rc{constructor(){D(this,"method","GET");D(this,"name","getBrandingInfo")}urlPath(){return`${In}/branding`}}class Lc{constructor(t){D(this,"method","GET");D(this,"name","getCheckoutStatus");D(this,"operationSessionId");this.operationSessionId=t}urlPath(){return`${In}/checkout/${this.operationSessionId}`}}const ir={};class Uc{constructor(t,n=ir){D(this,"API_KEY");D(this,"httpConfig");this.API_KEY=t,this.httpConfig=n}async getOfferings(t){return await It(new Ac(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(t){return await It(new Sc(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(t,n,r){return await It(new Nc(t,n,r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await It(new Rc,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(t,n,r,i,o){const a={app_user_id:t,product_id:n,email:r,price_id:o.priceId,presented_offering_identifier:i.offeringIdentifier};return o.id!=="base_option"&&(a.offer_id=o.id),i.targetingContext&&(a.applied_targeting_rule={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision}),i.placementIdentifier&&(a.presented_placement_identifier=i.placementIdentifier),await It(new Oc,{apiKey:this.API_KEY,body:a,httpConfig:this.httpConfig})}async getCheckoutStatus(t){return await It(new Lc(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Mc(e){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(e))throw new re(ie.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function Dc(e){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new re(ie.InvalidAppUserIdError,'Provided user id: "'+e+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Cc(e){if(e!=null&&e.endsWith("/"))throw new re(ie.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function Bc(e){if(e){for(const t in e)if(kc.has(t))throw new re(ie.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var or=(e=>(e.Current="current",e))(or||{});function qc(e,t){async function n(...r){return await this.preload(),await e.call(this,...r)}return n}const Zi=(e,t)=>({...e,rcBillingProduct:{...e.rcBillingProduct,presentedOfferingContext:{...e.rcBillingProduct.presentedOfferingContext,placementIdentifier:t}}}),lt=(e,t)=>e==null?null:Zi(e,t),jc=(e,t,n)=>{const r=e.offering_ids_by_placement??null;if(r==null)return null;const i=e.fallback_offering_id??null;let o;if(n in r){const s=r[n]??null;if(s==null)return null;o=t[s],o==null&&(o=t[i])}else o=t[i];if(o==null)return null;const a=Object.fromEntries(Object.entries(o.packagesById).map(([s,l])=>[s,Zi(l,n)]));return{...o,packagesById:a,availablePackages:Object.values(a),weekly:lt(o.weekly,n),monthly:lt(o.monthly,n),twoMonth:lt(o.twoMonth,n),threeMonth:lt(o.threeMonth,n),sixMonth:lt(o.sixMonth,n),annual:lt(o.annual,n),lifetime:lt(o.lifetime,n)}};function Fc(e,t){const n={};t.product_details.forEach(o=>{n[o.identifier]=o});const r={};e.offerings.forEach(o=>{const a=o.identifier===e.current_offering_id,s=Ha(a,o,n,e.targeting);s!=null&&(r[o.identifier]=s)});const i=e.current_offering_id?r[e.current_offering_id]??null:null;return Object.keys(r).length==0&&z.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:r,current:i}}var ar;(function(e){e.body_s="p",e.body_m="p",e.body_l="p",e.body_xl="p",e.heading_xs="h6",e.heading_s="h5",e.heading_m="h4",e.heading_l="h3",e.heading_xl="h2",e.heading_xxl="h1"})(ar||(ar={}));var sr;(function(e){e[e.extra_light=100]="extra_light",e[e.thin=200]="thin",e[e.light=300]="light",e[e.regular=400]="regular",e[e.medium=500]="medium",e[e.semi_bold=600]="semi_bold",e[e.bold=700]="bold",e[e.extra_bold=800]="extra_bold",e[e.black=900]="black"})(sr||(sr={}));var lr;(function(e){e.body_s="13px",e.body_m="14px",e.body_l="15px",e.body_xl="16px",e.heading_xs="14px",e.heading_s="16px",e.heading_m="18px",e.heading_l="20px",e.heading_xl="26px",e.heading_xxl="32px"})(lr||(lr={}));var cr;(function(e){e.vertical="column",e.horizontal="row"})(cr||(cr={}));var ur;(function(e){e.top="flex-start",e.leading="flex-start",e.center="center",e.bottom="flex-end",e.trailing="flex-end"})(ur||(ur={}));var fr;(function(e){e.space_between="space-between",e.space_around="space-around",e.space_evenly="space-evenly",e.start="flex-start",e.center="center",e.end="flex-end"})(fr||(fr={}));const Pt=[];function Hc(e,t){return{subscribe:Vc(e,t).subscribe}}function Vc(e,t=$e){let n=null;const r=new Set;function i(s){if(Pr(e,s)&&(e=s,n)){const l=!Pt.length;for(const c of r)c[1](),Pt.push(c,e);if(l){for(let c=0;c<Pt.length;c+=2)Pt[c][0](Pt[c+1]);Pt.length=0}}}function o(s){i(s(e))}function a(s,l=$e){const c=[s,l];return r.add(c),r.size===1&&(n=t(i,o)||$e),s(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:a}}const zc=Hc(!1,e=>{if(typeof window<"u"){const t=window.matchMedia("(prefers-color-scheme: dark)");e(t.matches);const n=r=>e(r.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}return()=>{}}),Gc=(e,t)=>{var n;(n=t.onclick)==null||n.call(t)};var Yc=x("<button><!></button>");const $c={hash:"svelte-8axjuk",code:"button.svelte-8axjuk {border:none;cursor:pointer;background-color:transparent;padding:0;width:100%;display:flex;align-items:center;justify-content:center;}"};function Xi(e,t){W(t,!0),B(e,$c);var n=Yc();n.__click=[Gc,t];var r=T(n);va(r,()=>t.children??$e),q(()=>{$n(n,`${t.class??""} svelte-8axjuk`),n.disabled=!t.onclick,K(n,"style",t.style)}),p(e,n),Z()}Yn(["click"]);function Ji(e,t){return!e||!t?"":{[`--${t}-block-start`]:`${e.top??0}px`,[`--${t}-inline-end`]:`${e.trailing??0}px`,[`--${t}-block-end`]:`${e.bottom??0}px`,[`--${t}-inline-start`]:`${e.leading??0}px`}}function Kc(e){return ar[e]}function Pn({colorMap:e,colorMode:t="light",fallback:n="FFFFFF"}){var r;return((r=e==null?void 0:e[t])==null?void 0:r.value)||n}function Qc(e,t="light"){const n=Pn({colorMap:e.color,colorMode:t});return`${e.width}px solid ${n}`}function eo(e){return`${e.top_leading}px ${e.top_trailing}px ${e.bottom_trailing}px ${e.bottom_leading}px`}function to({backgroundColor:e,border:t,margin:n,padding:r,textColor:i,colorMode:o="light",shape:a,shadow:s}){const l={"--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background-color":"transparent","--text-color":"#000000","--border":"none","--border-radius":"0px","--shadow":"none"};return r&&Object.assign(l,Ji(r,"padding")),n&&Object.assign(l,Ji(n,"margin")),e&&(l["--background-color"]=Pn({colorMap:e,colorMode:o,fallback:"transparent"})),i&&(l["--text-color"]=Pn({colorMap:i,colorMode:o,fallback:"#000000"})),t&&(l["--border"]=Qc(t,o)),(a==null?void 0:a.type)==="rectangle"&&a.corners&&(l["--border-radius"]=eo(a.corners)),(a==null?void 0:a.type)==="pill"&&(l["--border-radius"]="9999px;"),s&&(l["--shadow"]=`${s.x}px ${s.y}px ${s.radius}px
118
+ ${Pn({colorMap:s.color,colorMode:o,fallback:"#000000"})};`),l}function dr(e){function t(o){return o.type==="fixed"?`${o.value}px`:o.type==="fit"?"fit-content":o.type==="fill"?navigator.userAgent.match(/firefox|fxios/i)?"-moz-available":"-webkit-fill-available":"unset"}const n=t(e.width),r=t(e.height),i=e.width.type==="fill"||e.height.type==="fill";return{"--width":n,"--height":r,"--flex":i?"unset":"0 1 auto"}}function Wc(e,t){return t?{"--background":`linear-gradient(${t.map(n=>{var r;return(r=n[e])==null?void 0:r.value}).join(", ")})`}:{"--background":"unset"}}const Zc=e=>{let t={"--corner-radius":"0px","--clip-path":"none"};return(e==null?void 0:e.type)==="circle"&&(t["--corner-radius"]="50%"),(e==null?void 0:e.type)==="rectangle"&&e.corners&&(t["--corner-radius"]=eo(e.corners)),(e==null?void 0:e.type)==="convex"&&(t["--corner-radius"]="0 0 50% 50%;"),(e==null?void 0:e.type)==="concave"&&(t["--clip-path"]="polygon(0 0, 100% 0, 100% 100%, 50% 110%, 0 100%);"),t};function Xc(e){const t={"--direction":"row","--alignment":"unset","--distribution":"unset"};return e.type==="zlayer"||(t["--direction"]=cr[e.type],t["--alignment"]=ur[e.alignment],e.distribution&&(t["--distribution"]=fr[e.distribution])),t}function Jc(e){const{font_size:t,horizontal_alignment:n,font_weight:r,font_name:i}=e,o={"--text-align":"initial","--font-weight":400,"--font-size":"initial","--font-family":"sans-serif"};return o["--text-align"]=n,o["--font-weight"]=sr[r],o["--font-size"]=lr[t],o["--font-family"]=i||"sans-serif",o}function kn(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("; ")}function no(e,t,n,r){const i=(r[n]||{})[e];return(r[t]||{})[e]?r[t][e]:i}function eu(e){const t=r=>{if(r.type==="package"&&r.is_selected_by_default)return r;if(r.components)for(let i of r.components){const o=t(i);if(o)return o}if(r.stack!==void 0){const i=t(r.stack);if(i)return i}},n=t(e.components_config.base.stack);if(n!==void 0)return n.package_id}const tu=e=>{const{background_color:t,margin:n,padding:r,spacing:i,size:o,border:a,shape:s,colorMode:l,shadow:c,dimension:d}=e,f=to({backgroundColor:t,margin:n,padding:r,border:a,colorMode:l,shape:s,shadow:c}),u=Xc(d);return{...dr(o),...u,...f,"--spacing":`${i||0}px`}};var nu=x('<div class="stack svelte-1igbv3z"></div>');const ru={hash:"svelte-1igbv3z",code:".stack.svelte-1igbv3z {box-sizing:border-box;display:flex;flex-direction:var(--direction, unset);width:var(--width, unset);height:var(--height, unset);gap:var(--spacing, 0);background-color:var(--background-color, unset);border:var(--border, none);border-radius:var(--border-radius, 0);box-shadow:var(--shadow, none);justify-content:var(--distribution, flex-start);align-items:var(--alignment, flex-start);padding-block-start:var(--padding-block-start, 0);padding-inline-end:var(--padding-inline-end, 0);padding-block-end:var(--padding-block-end, 0);padding-inline-start:var(--padding-inline-start, 0);margin-block-start:var(--margin-block-start, 0);margin-inline-end:var(--margin-inline-end, 0);margin-block-end:var(--margin-block-end, 0);margin-inline-start:var(--margin-inline-start, 0);flex:var(--flex, 0 1 auto);align-self:center;}"};function Zt(e,t){W(t,!0),B(e,ru);const n=bn(t,["$$slots","$$events","$$legacy","id","components","labels","onAction","purchaseState"]),r=J(()=>kn(tu({id:t.id,components:t.components,labels:t.labels,onAction:t.onAction,purchaseState:t.purchaseState,...n})));var i=nu();ri(i,21,()=>t.components,ni,(o,a)=>{vr(o,{get nodeData(){return g(a)},get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState}})}),q(()=>{K(i,"id",t.id),K(i,"style",g(r))}),p(e,i),Z()}function iu(e,t){W(t,!0),Xi(e,{onclick:()=>{t.onAction&&t.onAction(t.action)},children:(r,i)=>{Zt(r,Gt(()=>t.stack,{get labels(){return t.labels},get purchaseState(){return t.purchaseState}}))},$$slots:{default:!0}}),Z()}function vr(e,t){W(t,!0);const n=Ia(),r=()=>xa(zc,"$prefersDarkMode",n),i={text:uu,stack:Zt,image:gu,button:iu,purchase_button:pu,package:yu,footer:Eu},o=J(()=>i[t.nodeData.type]);var a=le(),s=C(a);ga(s,()=>g(o),(l,c)=>{c(l,Gt(()=>t.nodeData||{},{get labels(){return t.labels},get prefersDarkMode(){return r()},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},children:(d,f)=>{var u=le(),v=C(u);ri(v,17,()=>t.nodeData.components,ni,(_,b)=>{vr(_,{get nodeData(){return g(b)},get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState}})}),p(d,u)},$$slots:{default:!0}}))}),p(e,a),Z()}var ou=x('<div class="svelte-1f98y3q"><!></div>');const au={hash:"svelte-1f98y3q",code:`
119
+ /* 1. Use a more-intuitive box-sizing model */.svelte-1f98y3q,
120
+ .svelte-1f98y3q::before,
121
+ .svelte-1f98y3q::after {box-sizing:border-box;}
122
+
123
+ /* 2. Remove default margin */.svelte-1f98y3q {margin:0;}
124
+
125
+ /* 5. Improve media defaults */
126
+
127
+ /* 6. Inherit fonts for form controls */
128
+
129
+ /* 7. Avoid text overflows */
130
+
131
+ /* 8. Improve line wrapping */
132
+
133
+ /*
134
+ 9. Create a root stacking context
135
+ */`};function su(e,t){W(t,!0),B(e,au);let n=st({selectedPackageId:eu(t.paywallData),locale:t.selectedLocale||t.paywallData.default_locale,defaultLocale:t.paywallData.default_locale});const r=(f,u)=>{var v;(v=t.onRestorePurchasesClicked)==null||v.call(t)},i=(f,u)=>{var v;(v=t.onBackClicked)==null||v.call(t)},o=(f,u)=>{var _,b;if(f.destination==="customer_center"&&((_=t.onVisitCustomerCenterClicked)==null||_.call(t)),!f.url)return;const v=no(f.url.url_lid,n.locale,n.defaultLocale,t.paywallData.components_localizations);v&&((b=t.onNavigateToUrlClicked)==null||b.call(t,v))},a=(f,u)=>{n.selectedPackageId=u==null?void 0:u.packageId},s=(f,u)=>{var v;n.selectedPackageId!==void 0&&((v=t.onPurchaseClicked)==null||v.call(t,n.selectedPackageId))},l=(f,u)=>{switch(f.type){case"select_package":a(f,u);break;case"navigate_to":o(f);break;case"navigate_back":i();break;case"restore_purchases":r();break;case"purchase":s();break}};var c=ou(),d=T(c);vr(d,{onAction:l,get nodeData(){return t.paywallData.components_config.base.stack},get labels(){return t.paywallData.components_localizations},get purchaseState(){return n}}),p(e,c),Z()}const lu=e=>{const{font_size:t="body_m",color:n={dark:{type:"hex",value:"#000000"},light:{type:"hex",value:"#000000"}},background_color:r={dark:{type:"hex",value:"#FFFFFF"},light:{type:"hex",value:"#FFFFFF"}},padding:i,margin:o,colorMode:a,size:s}=e,l=Kc(t),c=Jc(e),d=to({backgroundColor:r,textColor:n,margin:o,padding:i,colorMode:a}),f=dr(s);return{textStyles:{...c,...d,...f},tagToRender:l}},cu={hash:"svelte-10xncm6",code:".text-block.svelte-10xncm6 {padding-block-start:var(--padding-block-start, unset);padding-inline-end:var(--padding-inline-end, unset);padding-block-end:var(--padding-block-end, unset);padding-inline-start:var(--padding-inline-start, unset);margin-block-start:var(--margin-block-start, unset);margin-inline-end:var(--margin-inline-end, unset);margin-block-end:var(--margin-block-end, unset);margin-inline-start:var(--margin-inline-start, unset);color:var(--text-color, #ffffff);background-color:var(--background-color, #ffffff);font-size:var(--font-size, 1rem);font-weight:var(--font-weight, normal);text-align:var(--text-align, center);height:var(--height, unset);width:var(--width, unset);font-family:var(--font-family, sans-serif);}"};function uu(e,t){W(t,!0),B(e,cu);const n=bn(t,["$$slots","$$events","$$legacy","id","labels","text_lid","purchaseState"]),r=J(()=>lu({id:t.id,labels:t.labels,text_lid:t.text_lid,purchaseState:t.purchaseState,...n})),i=J(()=>g(r).tagToRender),o=J(()=>g(r).textStyles),a=J(()=>kn(g(o))),s=J(()=>no(t.text_lid,t.purchaseState.locale,t.purchaseState.defaultLocale,t.labels));var l=le(),c=C(l);oi(c,()=>g(i),!1,(d,f)=>{let u;q(()=>u=ai(d,u,{id:t.id,style:g(a),class:"text-block"},"svelte-10xncm6",d.namespaceURI===Ot,d.nodeName.includes("-")));var v=Xe();q(()=>de(v,g(s))),p(f,v)}),p(e,l),Z()}const fu=e=>{const{gradient_colors:t,colorMode:n,mask_shape:r,size:i,max_height:o,override_source_lid:a}=e,s=Wc(n,t),l=dr(i),c=Zc(r);return{imageStyles:{...l,...c},gradientStyles:s}};var du=x('<div class="image-container svelte-1p87anq"><img class="image svelte-1p87anq" alt=""> <span class="image-overlay svelte-1p87anq"></span></div>');const vu={hash:"svelte-1p87anq",code:".image-container.svelte-1p87anq {position:relative;height:var(--height, unset);width:var(--width, unset);overflow:hidden;border-radius:var(--corner-radius, unset);clip-path:var(--clip-path, unset);display:flex;flex:1 0 auto;}.image.svelte-1p87anq {width:100%;height:100%;object-fit:cover;}.image-overlay.svelte-1p87anq {position:absolute;inset:0;background:var(--background, unset);}"};function gu(e,t){W(t,!0),B(e,vu);const n=bn(t,["$$slots","$$events","$$legacy","id","colorMode","source"]),r=J(()=>fu({id:t.id,colorMode:t.colorMode,source:t.source,...n})),i=J(()=>g(r).gradientStyles),o=J(()=>g(r).imageStyles),a=J(()=>kn(g(i))),s=J(()=>kn(g(o)));var l=du(),c=T(l),d=U(c,2);q(()=>{var f;K(l,"id",`image-container-${t.id}`),K(l,"style",g(s)),K(c,"src",(f=t.source[t.colorMode||"light"])==null?void 0:f.original),K(c,"id",t.id),K(d,"style",g(a))}),p(e,l),Z()}const hu={hash:"svelte-1rjn6eg",code:""};function pu(e,t){W(t,!0),B(e,hu),Xi(e,{onclick:()=>{t.onAction&&t.onAction({type:"purchase"})},class:"purchase-button",children:(r,i)=>{Zt(r,Gt(()=>t.stack,{get labels(){return t.labels},get purchaseState(){return t.purchaseState}}))},$$slots:{default:!0}}),Z()}const _u=(e,t)=>{e.preventDefault(),e.stopPropagation(),t.onAction&&t.onAction({type:"select_package"},{packageId:t.package_id})};var bu=x('<div class="package svelte-j5j2a5"><!></div>');const mu={hash:"svelte-j5j2a5",code:".package.svelte-j5j2a5 {width:100%;display:flex;cursor:pointer;}"};function yu(e,t){W(t,!0),B(e,mu);const n=J(()=>{var o;return((o=t.purchaseState)==null?void 0:o.selectedPackageId)===t.package_id});var r=bu();r.__click=[_u,t];var i=T(r);Zt(i,Gt(()=>t.stack,{get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState}})),q(()=>{K(r,"id",t.id),pa(r,"selected",g(n))}),p(e,r),Z()}Yn(["click"]);var wu=x('<div class="footer"><!></div>');function Eu(e,t){const n=bn(t,["$$slots","$$events","$$legacy"]),r=J(()=>n.stack),i=J(()=>n.labels),o=J(()=>n.id);var a=wu(),s=T(a);Zt(s,Gt(()=>g(r),{get labels(){return g(i)}})),q(()=>K(a,"id",g(o))),p(e,a)}const xu=1000001;ro=[qc];const pe=class pe{constructor(t,n,r=ir){vo(hr,5,this);D(this,"_API_KEY");D(this,"_appUserId");D(this,"_brandingInfo",null);D(this,"_loadingResourcesPromise",null);D(this,"backend");D(this,"purchaseOperationHelper");this._API_KEY=t,this._appUserId=n,nr(t)&&z.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new Uc(this._API_KEY,r),this.purchaseOperationHelper=new os(this.backend)}static setLogLevel(t){z.setLogLevel(t)}static getSharedInstance(){if(pe.isConfigured())return pe.instance;throw new xi}static isConfigured(){return pe.instance!==void 0}static configure(t,n,r=ir){return pe.instance!==void 0&&z.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),Mc(t),Dc(n),Cc(r.proxyURL),Bc(r.additionalHeaders),pe.instance=new pe(t,n,r),pe.getSharedInstance()}async preload(){if(this.hasLoadedResources()){z.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){z.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.backend.getBrandingInfo().then(t=>{this._brandingInfo=t}).catch(t=>{let n=`${t}`;t instanceof re&&(n=`${t.message}. ${t.underlyingErrorMessage?`Underlying error: ${t.underlyingErrorMessage}`:""}`),z.errorLog(`Error fetching branding info: ${n}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}hasLoadedResources(){return this._brandingInfo!==null}async renderPaywall(t){console.warn("This method is @experimental, Paywalls are not generally available but they will come soon!");let r=t.htmlTarget??document.getElementById("rcb-ui-pw-root");if(r===null){const f=document.createElement("div");f.id="rcb-ui-pw-root",f.className="rcb-ui-pw-root",f.style.zIndex=`${xu}`,document.body.appendChild(f),r=f}if(r===null)throw new Error("Could not generate a mount point for the billing widget");const i=r;i.innerHTML="";const o=t.offering;if(!o.paywall_components)throw new Error("You cannot use paywalls yet, they are coming soon!");const a=f=>{const u=o.availablePackages.find(v=>v.identifier===f);if(u===void 0)throw new Error(`No package found for ${f}`);return this.purchase({rcPackage:u,htmlTarget:t.purchaseHtmlTarget,customerEmail:t.customerEmail})},s=f=>{var u;if(t.onNavigateToUrl){t.onNavigateToUrl(f);return}(u=window.open(f,"_blank"))==null||u.focus()},l=()=>{},c=()=>{if(t.onVisitCustomerCenter){t.onVisitCustomerCenter();return}},d=t.selectedLocale||navigator.language;return new Promise((f,u)=>{ei(su,{target:i,props:{paywallData:o.paywall_components,selectedLocale:d,onNavigateToClicked:s,onVisitCustomerCenterClicked:c,onBackClicked:()=>{if(t.onBack){t.onBack();return}i.innerHTML="",z.debugLog("Purchase cancelled by user"),u(new re(ie.UserCancelledError))},onRestorePurchasesClicked:l,onPurchaseClicked:v=>{a(v).then(_=>{f(_)}).catch(_=>u(_))}}})})}async getOfferings(t){Al(t==null?void 0:t.currency);const n=this._appUserId,r=await this.backend.getOfferings(n),i=(t==null?void 0:t.offeringIdentifier)===or.Current?r.current_offering_id:t==null?void 0:t.offeringIdentifier;return i&&(r.offerings=r.offerings.filter(o=>o.identifier===i)),await this.getAllOfferings(r,n,t)}async getCurrentOfferingForPlacement(t,n){const r=this._appUserId,i=await this.backend.getOfferings(r),o=await this.getAllOfferings(i,r,n),a=i.placements??null;return a==null?null:jc(a,o.all,t)}async getAllOfferings(t,n,r){const i=t.offerings.flatMap(a=>a.packages).map(a=>a.platform_product_identifier),o=await this.backend.getProducts(n,i,r==null?void 0:r.currency);return this.logMissingProductIds(i,o.product_details),Fc(t,o)}async isEntitledTo(t){const n=await this.getCustomerInfo();return t in n.entitlements.active}purchasePackage(t,n,r){return this.purchase({rcPackage:t,customerEmail:n,htmlTarget:r})}purchase(t){const{rcPackage:n,purchaseOption:r,htmlTarget:i,customerEmail:o}=t;let a=i??document.getElementById("rcb-ui-root");if(a===null){const d=document.createElement("div");d.className="rcb-ui-root",document.body.appendChild(d),a=d}if(a===null)throw new Error("Could not generate a mount point for the billing widget");const s=a,l=!i,c=this._appUserId;return z.debugLog(`Presenting purchase form for package ${n.identifier}`),new Promise((d,f)=>{ei(uc,{target:s,props:{appUserId:c,rcPackage:n,purchaseOption:r,customerEmail:o,onFinished:async u=>{z.debugLog("Purchase finished"),s.innerHTML="";const v={customerInfo:await this._getCustomerInfoForUserId(c),redemptionInfo:u};d(v)},onClose:()=>{s.innerHTML="",z.debugLog("Purchase cancelled by user"),f(new re(ie.UserCancelledError))},onError:u=>{s.innerHTML="",f(re.getForPurchasesFlowError(u))},purchases:this,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,asModal:l}})})}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async changeUser(t){return this._appUserId=t,await this.getCustomerInfo()}logMissingProductIds(t,n){const r={};n.forEach(o=>r[o.identifier]=o);const i=[];t.forEach(o=>{r[o]===void 0&&i.push(o)}),i.length>0&&z.debugLog(`Could not find product data for product ids:
118
136
  ${i.join()}.
119
- Please check that your product configuration is correct.`)}isSandbox(){return Dt(this._API_KEY)}close(){ue.instance===this?ue.instance=void 0:C.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(r){const t=await this.backend.getCustomerInfo(r);return Il(t)}};jt=Pi(null),Oi(jt,1,"purchase",mi,ue),Vt(jt,ue),D(ue,"instance");let qt=ue;_.ErrorCode=re,_.LogLevel=ce,_.OfferingKeyword=Ft,_.PackageType=Bn,_.ProductType=dr,_.Purchases=qt,_.PurchasesError=X,_.UninitializedPurchasesError=Hn,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
137
+ Please check that your product configuration is correct.`)}isSandbox(){return nr(this._API_KEY)}close(){pe.instance===this?pe.instance=void 0:z.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(t){const n=await this.backend.getCustomerInfo(t);return pc(n)}static generateRevenueCatAnonymousAppUserId(){return`$RCAnonymousID:${crypto.randomUUID().replace(/-/g,"")}`}};hr=uo(null),go(hr,1,"purchase",ro,pe),br(hr,pe),D(pe,"instance");let gr=pe;E.ErrorCode=ie,E.LogLevel=he,E.OfferingKeyword=or,E.PackageType=bi,E.ProductType=Et,E.Purchases=gr,E.PurchasesError=re,E.UninitializedPurchasesError=xi,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});