@revenuecat/purchases-js 0.12.1 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -8
- package/dist/Purchases.es.d.ts +12 -0
- package/dist/Purchases.es.js +3486 -2200
- package/dist/Purchases.umd.js +42 -18
- package/package.json +6 -6
package/dist/Purchases.umd.js
CHANGED
|
@@ -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&>(()=>{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 Uu=Object.create;var bn=Object.defineProperty;var Lu=Object.getOwnPropertyDescriptor;var ho=(E,O)=>(O=Symbol[E])?O:Symbol.for("Symbol."+E),ir=E=>{throw TypeError(E)};var _o=(E,O,S)=>O in E?bn(E,O,{enumerable:!0,configurable:!0,writable:!0,value:S}):E[O]=S;var fo=(E,O)=>bn(E,"name",{value:O,configurable:!0});var po=E=>[,,,Uu((E==null?void 0:E[ho("metadata")])??null)],bo=["class","method","getter","setter","accessor","field","value","get","set"],nr=E=>E!==void 0&&typeof E!="function"?ir("Function expected"):E,Cu=(E,O,S,ye,K)=>({kind:bo[E],name:O,metadata:ye,addInitializer:J=>S._?ir("Already initialized"):K.push(nr(J||null))}),mn=(E,O)=>_o(O,ho("metadata"),E[3]),mo=(E,O,S,ye)=>{for(var K=0,J=E[O>>1],Ne=J&&J.length;K<Ne;K++)O&1?J[K].call(S):ye=J[K].call(S,ye);return ye},yo=(E,O,S,ye,K,J)=>{var Ne,he,or,lt,St,H=O&7,Rt=!!(O&8),ke=!!(O&16),Mt=H>3?E.length+1:H?Rt?1:2:0,ar=bo[H+5],se=H>3&&(E[Mt-1]=[]),Dt=E[Mt]||(E[Mt]=[]),we=H&&(!ke&&!Rt&&(K=K.prototype),H<5&&(H>3||!ke)&&Lu(H<4?K:{get[S](){return vo(this,J)},set[S](ie){return go(this,J,ie)}},S));H?ke&&H<4&&fo(J,(H>2?"set ":H>1?"get ":"")+S):fo(K,S);for(var Ve=ye.length-1;Ve>=0;Ve--)lt=Cu(H,S,or={},E[3],Dt),H&&(lt.static=Rt,lt.private=ke,St=lt.access={has:ke?ie=>Bu(K,ie):ie=>S in ie},H^3&&(St.get=ke?ie=>(H^1?vo:qu)(ie,K,H^4?J:we.get):ie=>ie[S]),H>2&&(St.set=ke?(ie,Ut)=>go(ie,K,Ut,H^4?J:we.set):(ie,Ut)=>ie[S]=Ut)),he=(0,ye[Ve])(H?H<4?ke?J:we[ar]:H>4?void 0:{get:we.get,set:we.set}:K,lt),or._=1,H^4||he===void 0?nr(he)&&(H>4?se.unshift(he):H?ke?J=he:we[ar]=he:K=he):typeof he!="object"||he===null?ir("Object expected"):(nr(Ne=he.get)&&(we.get=Ne),nr(Ne=he.set)&&(we.set=Ne),nr(Ne=he.init)&&se.unshift(Ne));return H||mn(E,K),we&&bn(K,S,we),ke?H^4?J:we:K},B=(E,O,S)=>_o(E,typeof O!="symbol"?O+"":O,S),yn=(E,O,S)=>O.has(E)||ir("Cannot "+S),Bu=(E,O)=>Object(O)!==O?ir('Cannot use the "in" operator on this value'):E.has(O),vo=(E,O,S)=>(yn(E,O,"read from private field"),S?S.call(E):O.get(E));var go=(E,O,S,ye)=>(yn(E,O,"write to private field"),ye?ye.call(E,S):O.set(E,S),S),qu=(E,O,S)=>(yn(E,O,"access private method"),S);var co,pn;const O="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(O);let S=!1;function ye(){S=!0}ye();const K=1,J=2,Ne=4,he=8,or=16,lt=1,St=2,H=4,Rt=8,ke=16,Mt=1,ar=2,se=Symbol(),Dt="http://www.w3.org/2000/svg",we=!1;var Ve=Array.isArray,ie=Array.from,Ut=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,wn=Object.getOwnPropertyDescriptors,wo=Object.prototype,Eo=Array.prototype,sr=Object.getPrototypeOf;function Lt(e){return typeof e=="function"}const $e=()=>{};function xo(e){return e()}function Or(e){for(var t=0;t<e.length;t++)e[t]()}const Ye=2,En=4,Ct=8,Nr=16,Se=32,Bt=64,ct=128,lr=256,ue=512,rt=1024,_t=2048,Ue=4096,qt=8192,Io=16384,pt=32768,Po=65536,ko=1<<18,xn=1<<19,nt=Symbol("$state"),In=Symbol("legacy props"),To=Symbol("");function Pn(e){return e===this.v}function kn(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Sr(e){return!kn(e,this.v)}function Ao(e){throw new Error("effect_in_teardown")}function Oo(){throw new Error("effect_in_unowned_derived")}function No(e){throw new Error("effect_orphan")}function So(){throw new Error("effect_update_depth_exceeded")}function Ro(e){throw new Error("lifecycle_legacy_only")}function Mo(e){throw new Error("props_invalid_value")}function Do(){throw new Error("state_descriptors_fixed")}function Uo(){throw new Error("state_prototype_fixed")}function Lo(){throw new Error("state_unsafe_local_read")}function Co(){throw new Error("state_unsafe_mutation")}function Ee(e){return{f:0,v:e,reactions:null,equals:Pn,version:0}}function Bo(e){return Tn(Ee(e))}function cr(e,t=!1){var n;const r=Ee(e);return t||(r.equals=Sr),S&&U!==null&&U.l!==null&&((n=U.l).s??(n.s=[])).push(r),r}function _e(e,t=!1){return Tn(cr(e,t))}function Tn(e){return G!==null&&G.f&Ye&&(Be===null?Go([e]):Be.push(e)),e}function N(e,t){return G!==null&&dr()&&G.f&(Ye|Nr)&&(Be===null||!Be.includes(e))&&Co(),Rr(e,t)}function Rr(e,t){return e.equals(t)||(e.v=t,e.version=Hn(),An(e,rt),dr()&&M!==null&&M.f&ue&&!(M.f&Se)&&(le!==null&&le.includes(e)?(Re(M,rt),vr(M)):ot===null?$o([e]):ot.push(e))),t}function An(e,t){var r=e.reactions;if(r!==null)for(var n=dr(),i=r.length,o=0;o<i;o++){var a=r[o],s=a.f;s&rt||!n&&a===M||(Re(a,t),s&(ue|ct)&&(s&Ye?An(a,_t):vr(a)))}}function ee(e){var t=Ye|rt;M===null?t|=ct:M.f|=xn;const r={children:null,ctx:U,deps:null,equals:Pn,f:t,fn:e,reactions:null,v:null,version:0,parent:M};if(G!==null&&G.f&Ye){var n=G;(n.children??(n.children=[])).push(r)}return r}function fe(e){const t=ee(e);return t.equals=Sr,t}function On(e){var t=e.children;if(t!==null){e.children=null;for(var r=0;r<t.length;r+=1){var n=t[r];n.f&Ye?Mr(n):Le(n)}}}function Nn(e){var t,r=M;Ce(e.parent);try{On(e),t=Vn(e)}finally{Ce(r)}return t}function Sn(e){var t=Nn(e),r=(wt||e.f&ct)&&e.deps!==null?_t:ue;Re(e,r),e.equals(t)||(e.v=t,e.version=Hn())}function Mr(e){On(e),Gt(e,0),Re(e,qt),e.v=e.children=e.deps=e.ctx=e.reactions=null}function Rn(e){M===null&&G===null&&No(),G!==null&&G.f&ct&&Oo(),jr&&Ao()}function qo(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function bt(e,t,r,n=!0){var i=(e&Bt)!==0,o=M,a={ctx:U,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:e|rt,first:null,fn:t,last:null,next:null,parent:i?null:o,prev:null,teardown:null,transitions:null,version:0};if(r){var s=yt;try{qn(!0),$t(a),a.f|=Io}catch(u){throw Le(a),u}finally{qn(s)}}else t!==null&&vr(a);var l=r&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&xn)===0;if(!l&&!i&&n&&(o!==null&&qo(a,o),G!==null&&G.f&Ye)){var c=G;(c.children??(c.children=[])).push(a)}return a}function Dr(e){const t=bt(Ct,null,!1);return Re(t,ue),t.teardown=e,t}function Ur(e){Rn();var t=M!==null&&(M.f&Se)!==0&&U!==null&&!U.m;if(t){var r=U;(r.e??(r.e=[])).push({fn:e,effect:M,reaction:G})}else{var n=Lr(e);return n}}function Fo(e){return Rn(),Ft(e)}function jo(e){const t=bt(Bt,e,!0);return()=>{Le(t)}}function Lr(e){return bt(En,e,!1)}function ut(e,t){var r=U,n={effect:null,ran:!1};r.l.r1.push(n),n.effect=Ft(()=>{e(),!n.ran&&(n.ran=!0,N(r.l.r2,!0),dt(t))})}function Cr(){var e=U;Ft(()=>{if(v(e.l.r2)){for(var t of e.l.r1){var r=t.effect;r.f&ue&&Re(r,_t),Et(r)&&$t(r),t.ran=!1}e.l.r2.v=!1}})}function Ft(e){return bt(Ct,e,!0)}function F(e){return ft(e)}function ft(e,t=0){return bt(Ct|Nr|t,e,!0)}function ze(e,t=!0){return bt(Ct|Se,e,!0,t)}function Mn(e){var t=e.teardown;if(t!==null){const r=jr,n=G;Fn(!0),it(null);try{t.call(null)}finally{Fn(r),it(n)}}}function Dn(e){var t=e.deriveds;if(t!==null){e.deriveds=null;for(var r=0;r<t.length;r+=1)Mr(t[r])}}function Un(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){var n=r.next;Le(r,t),r=n}}function Ho(e){for(var t=e.first;t!==null;){var r=t.next;t.f&Se||Le(t),t=r}}function Le(e,t=!0){var r=!1;if((t||e.f&ko)&&e.nodes_start!==null){for(var n=e.nodes_start,i=e.nodes_end;n!==null;){var o=n===i?null:gr(n);n.remove(),n=o}r=!0}Un(e,t&&!r),Dn(e),Gt(e,0),Re(e,qt);var a=e.transitions;if(a!==null)for(const l of a)l.stop();Mn(e);var s=e.parent;s!==null&&s.first!==null&&Ln(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.parent=e.fn=e.nodes_start=e.nodes_end=null}function Ln(e){var t=e.parent,r=e.prev,n=e.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),t!==null&&(t.first===e&&(t.first=n),t.last===e&&(t.last=r))}function jt(e,t){var r=[];Br(e,r,!0),Cn(r,()=>{Le(e),t&&t()})}function Cn(e,t){var r=e.length;if(r>0){var n=()=>--r||t();for(var i of e)i.out(n)}else t()}function Br(e,t,r){if(!(e.f&Ue)){if(e.f^=Ue,e.transitions!==null)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var n=e.first;n!==null;){var i=n.next,o=(n.f&pt)!==0||(n.f&Se)!==0;Br(n,t,o?r:!1),n=i}}}function Ht(e){Bn(e,!0)}function Bn(e,t){if(e.f&Ue){Et(e)&&$t(e),e.f^=Ue;for(var r=e.first;r!==null;){var n=r.next,i=(r.f&pt)!==0||(r.f&Se)!==0;Bn(r,i?t:!1),r=n}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||t)&&o.in()}}let qr=!1,Fr=[];function Vo(){qr=!1;const e=Fr.slice();Fr=[],Or(e)}function mt(e){qr||(qr=!0,queueMicrotask(Vo)),Fr.push(e)}function ur(e){throw new Error("lifecycle_outside_component")}let fr=!1,yt=!1,jr=!1;function qn(e){yt=e}function Fn(e){jr=e}let Hr=[],Vt=0,Fu=[],G=null;function it(e){G=e}let M=null;function Ce(e){M=e}let Be=null;function Go(e){Be=e}let le=null,xe=0,ot=null;function $o(e){ot=e}let jn=0,wt=!1,U=null;function Hn(){return++jn}function dr(){return!S||U!==null&&U.l===null}function Et(e){var a,s;var t=e.f;if(t&rt)return!0;if(t&_t){var r=e.deps,n=(t&ct)!==0;if(r!==null){var i;if(t&lr){for(i=0;i<r.length;i++)((a=r[i]).reactions??(a.reactions=[])).push(e);e.f^=lr}for(i=0;i<r.length;i++){var o=r[i];if(Et(o)&&Sn(o),n&&M!==null&&!wt&&!((s=o==null?void 0:o.reactions)!=null&&s.includes(e))&&(o.reactions??(o.reactions=[])).push(e),o.version>e.version)return!0}}n||Re(e,ue)}return!1}function Yo(e,t,r){throw e}function Vn(e){var d;var t=le,r=xe,n=ot,i=G,o=wt,a=Be,s=U,l=e.f;le=null,xe=0,ot=null,G=l&(Se|Bt)?null:e,wt=!yt&&(l&ct)!==0,Be=null,U=e.ctx;try{var c=(0,e.fn)(),u=e.deps;if(le!==null){var f;if(Gt(e,xe),u!==null&&xe>0)for(u.length=xe+le.length,f=0;f<le.length;f++)u[xe+f]=le[f];else e.deps=u=le;if(!wt)for(f=xe;f<u.length;f++)((d=u[f]).reactions??(d.reactions=[])).push(e)}else u!==null&&xe<u.length&&(Gt(e,xe),u.length=xe);return c}finally{le=t,xe=r,ot=n,G=i,wt=o,Be=a,U=s}}function zo(e,t){let r=t.reactions;if(r!==null){var n=r.indexOf(e);if(n!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[n]=r[i],r.pop())}}r===null&&t.f&Ye&&(le===null||!le.includes(t))&&(Re(t,_t),t.f&(ct|lr)||(t.f^=lr),Gt(t,0))}function Gt(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)zo(e,r[n])}function $t(e){var t=e.f;if(!(t&qt)){Re(e,ue);var r=M;M=e;try{t&Nr?Ho(e):Un(e),Dn(e),Mn(e);var n=Vn(e);e.teardown=typeof n=="function"?n:null,e.version=jn}catch(i){Yo(i)}finally{M=r}}}function Ko(){Vt>1e3&&(Vt=0,So()),Vt++}function Qo(e){var t=e.length;if(t!==0){Ko();var r=yt;yt=!0;try{for(var n=0;n<t;n++){var i=e[n];i.f&ue||(i.f^=ue);var o=[];Gn(i,o),Wo(o)}}finally{yt=r}}}function Wo(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var n=e[r];!(n.f&(qt|Ue))&&Et(n)&&($t(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Ln(n):n.fn=null))}}function Zo(){if(fr=!1,Vt>1001)return;const e=Hr;Hr=[],Qo(e),fr||(Vt=0)}function vr(e){fr||(fr=!0,queueMicrotask(Zo));for(var t=e;t.parent!==null;){t=t.parent;var r=t.f;if(r&(Bt|Se)){if(!(r&ue))return;t.f^=ue}}Hr.push(t)}function Gn(e,t){var r=e.first,n=[];e:for(;r!==null;){var i=r.f,o=(i&Se)!==0,a=o&&(i&ue)!==0;if(!a&&!(i&Ue))if(i&Ct){o?r.f^=ue:Et(r)&&$t(r);var s=r.first;if(s!==null){r=s;continue}}else i&En&&n.push(r);var l=r.next;if(l===null){let f=r.parent;for(;f!==null;){if(e===f)break e;var c=f.next;if(c!==null){r=c;continue e}f=f.parent}}r=l}for(var u=0;u<n.length;u++)s=n[u],t.push(s),Gn(s,t)}function v(e){var s;var t=e.f,r=(t&Ye)!==0;if(r&&t&qt){var n=Nn(e);return Mr(e),n}if(G!==null){Be!==null&&Be.includes(e)&&Lo();var i=G.deps;le===null&&i!==null&&i[xe]===e?xe++:le===null?le=[e]:le.push(e),ot!==null&&M!==null&&M.f&ue&&!(M.f&Se)&&ot.includes(e)&&(Re(M,rt),vr(M))}else if(r&&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 r&&(o=e,Et(o)&&Sn(o)),e.v}function dt(e){const t=G;try{return G=null,e()}finally{G=t}}const Xo=~(rt|_t|ue);function Re(e,t){e.f=e.f&Xo|t}function Jo(e){return Yn().get(e)}function $n(e,t){return Yn().set(e,t),t}function Yn(e){return U===null&&ur(),U.c??(U.c=new Map(ea(U)||void 0))}function ea(e){let t=e.p;for(;t!==null;){const r=t.c;if(r!==null)return r;t=t.p}return null}function W(e,t=!1,r){U={p:U,c:null,e:null,m:!1,s:e,x:null,l:null},S&&!t&&(U.l={s:null,u:null,r1:[],r2:Ee(!1)})}function Z(e){const t=U;if(t!==null){e!==void 0&&(t.x=e);const a=t.e;if(a!==null){var r=M,n=G;t.e=null;try{for(var i=0;i<a.length;i++){var o=a[i];Ce(o.effect),it(o.reaction),Lr(o.fn)}}finally{Ce(r),it(n)}}U=t.p,t.m=!0}return e||{}}function ce(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(nt in e)Vr(e);else if(!Array.isArray(e))for(let t in e){const r=e[t];typeof r=="object"&&r&&nt in r&&Vr(r)}}}function Vr(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 n in e)try{Vr(e[n],t)}catch{}const r=sr(e);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const n=wn(r);for(let i in n){const o=n[i].get;if(o)try{o.call(e)}catch{}}}}}function Ke(e,t=null,r){if(typeof e!="object"||e===null||nt in e)return e;const n=sr(e);if(n!==wo&&n!==Eo)return e;var i=new Map,o=Ve(e),a=Ee(0);o&&i.set("length",Ee(e.length));var s;return new Proxy(e,{defineProperty(l,c,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&Do();var f=i.get(c);return f===void 0?(f=Ee(u.value),i.set(c,f)):N(f,Ke(u.value,s)),!0},deleteProperty(l,c){var u=i.get(c);if(u===void 0)c in l&&i.set(c,Ee(se));else{if(o&&typeof c=="string"){var f=i.get("length"),d=Number(c);Number.isInteger(d)&&d<f.v&&N(f,d)}N(u,se),zn(a)}return!0},get(l,c,u){var h;if(c===nt)return e;var f=i.get(c),d=c in l;if(f===void 0&&(!d||(h=Ge(l,c))!=null&&h.writable)&&(f=Ee(Ke(d?l[c]:se,s)),i.set(c,f)),f!==void 0){var g=v(f);return g===se?void 0:g}return Reflect.get(l,c,u)},getOwnPropertyDescriptor(l,c){var u=Reflect.getOwnPropertyDescriptor(l,c);if(u&&"value"in u){var f=i.get(c);f&&(u.value=v(f))}else if(u===void 0){var d=i.get(c),g=d==null?void 0:d.v;if(d!==void 0&&g!==se)return{enumerable:!0,configurable:!0,value:g,writable:!0}}return u},has(l,c){var g;if(c===nt)return!0;var u=i.get(c),f=u!==void 0&&u.v!==se||Reflect.has(l,c);if(u!==void 0||M!==null&&(!f||(g=Ge(l,c))!=null&&g.writable)){u===void 0&&(u=Ee(f?Ke(l[c],s):se),i.set(c,u));var d=v(u);if(d===se)return!1}return f},set(l,c,u,f){var k;var d=i.get(c),g=c in l;if(o&&c==="length")for(var h=u;h<d.v;h+=1){var b=i.get(h+"");b!==void 0?N(b,se):h in l&&(b=Ee(se),i.set(h+"",b))}d===void 0?(!g||(k=Ge(l,c))!=null&&k.writable)&&(d=Ee(void 0),N(d,Ke(u,s)),i.set(c,d)):(g=d.v!==se,N(d,Ke(u,s)));var x=Reflect.getOwnPropertyDescriptor(l,c);if(x!=null&&x.set&&x.set.call(f,u),!g){if(o&&typeof c=="string"){var y=i.get("length"),w=Number(c);Number.isInteger(w)&&w>=y.v&&N(y,w+1)}zn(a)}return!0},ownKeys(l){v(a);var c=Reflect.ownKeys(l).filter(d=>{var g=i.get(d);return g===void 0||g.v!==se});for(var[u,f]of i)f.v!==se&&!(u in l)&&c.push(u);return c},setPrototypeOf(){Uo()}})}function zn(e,t=1){N(e,e.v+t)}var Kn,Qn,Wn;function ta(){if(Kn===void 0){Kn=window;var e=Element.prototype,t=Node.prototype;Qn=Ge(t,"firstChild").get,Wn=Ge(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 Yt(e=""){return document.createTextNode(e)}function zt(e){return Qn.call(e)}function gr(e){return Wn.call(e)}function T(e,t){return zt(e)}function L(e,t){{var r=zt(e);return r instanceof Comment&&r.data===""?gr(r):r}}function D(e,t=1,r=!1){let n=e;for(;t--;)n=gr(n);return n}function ra(e){e.textContent=""}let Zn=!1;function na(e,t){if(t){const r=document.body;e.autofocus=!0,mt(()=>{document.activeElement===r&&e.focus()})}}let Xn=!1;function ia(){Xn||(Xn=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function Jn(e){var t=G,r=M;it(null),Ce(null);try{return e()}finally{it(t),Ce(r)}}function oa(e,t,r,n=r){e.addEventListener(t,()=>Jn(r));const i=e.__on_r;i?e.__on_r=()=>{i(),n()}:e.__on_r=n,ia()}const ei=new Set,Gr=new Set;function $r(e,t,r,n){function i(o){if(n.capture||Kt.call(t,o),!o.cancelBubble)return Jn(()=>r.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?mt(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function hr(e,t,r,n,i){var o={capture:n,passive:i},a=$r(e,t,r,o);(t===document.body||t===window||t===document)&&Dr(()=>{t.removeEventListener(e,a,o)})}function Yr(e){for(var t=0;t<e.length;t++)ei.add(e[t]);for(var r of Gr)r(e)}function Kt(e){var w;var t=this,r=t.ownerDocument,n=e.type,i=((w=e.composedPath)==null?void 0:w.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){Ut(e,"currentTarget",{configurable:!0,get(){return o||r}});var u=G,f=M;it(null),Ce(null);try{for(var d,g=[];o!==null;){var h=o.assignedSlot||o.parentNode||o.host||null;try{var b=o["__"+n];if(b!==void 0&&!o.disabled)if(Ve(b)){var[x,...y]=b;x.apply(o,[e,...y])}else b.call(o,e)}catch(k){d?g.push(k):d=k}if(e.cancelBubble||h===t||h===null)break;o=h}if(d){for(let k of g)queueMicrotask(()=>{throw k});throw d}}finally{e.__root=t,delete e.currentTarget,it(u),Ce(f)}}}function ti(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function xt(e,t){var r=M;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function I(e,t){var r=(t&Mt)!==0,n=(t&ar)!==0,i,o=!e.startsWith("<!>");return()=>{i===void 0&&(i=ti(o?e:"<!>"+e),r||(i=zt(i)));var a=n?document.importNode(i,!0):i.cloneNode(!0);if(r){var s=zt(a),l=a.lastChild;xt(s,l)}else xt(a,a);return a}}function at(e=""){{var t=Yt(e+"");return xt(t,t),t}}function oe(){var e=document.createDocumentFragment(),t=document.createComment(""),r=Yt();return e.append(t,r),xt(t,r),e}function _(e,t){e!==null&&e.before(t)}function aa(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const sa=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function la(e){return sa.includes(e)}const ca={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"};function ua(e){return e=e.toLowerCase(),ca[e]??e}const fa=["touchstart","touchmove"];function da(e){return fa.includes(e)}function de(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=r==null?"":r+"")}function ri(e,t){return va(e,t)}const It=new Map;function va(e,{target:t,anchor:r,props:n={},events:i,context:o,intro:a=!0}){ta();var s=new Set,l=f=>{for(var d=0;d<f.length;d++){var g=f[d];if(!s.has(g)){s.add(g);var h=da(g);t.addEventListener(g,Kt,{passive:h});var b=It.get(g);b===void 0?(document.addEventListener(g,Kt,{passive:h}),It.set(g,1)):It.set(g,b+1)}}};l(ie(ei)),Gr.add(l);var c=void 0,u=jo(()=>{var f=r??t.appendChild(Yt());return ze(()=>{if(o){W({});var d=U;d.c=o}i&&(n.$$events=i),c=e(f,n)||{},o&&Z()}),()=>{var h;for(var d of s){t.removeEventListener(d,Kt);var g=It.get(d);--g===0?(document.removeEventListener(d,Kt),It.delete(d)):It.set(d,g)}Gr.delete(l),ni.delete(c),f!==r&&((h=f.parentNode)==null||h.removeChild(f))}});return ni.set(c,u),c}let ni=new WeakMap;function j(e,t,r,n=null,i=!1){var o=e,a=null,s=null,l=null,c=i?pt:0;ft(()=>{l!==(l=!!t())&&(l?(a?Ht(a):a=ze(()=>r(o)),s&&jt(s,()=>{s=null})):(s?Ht(s):n&&(s=ze(()=>n(o))),a&&jt(a,()=>{a=null})))},c)}function ii(e,t){return t}function ga(e,t,r,n){for(var i=[],o=t.length,a=0;a<o;a++)Br(t[a].e,i,!0);var s=o>0&&i.length===0&&r!==null;if(s){var l=r.parentNode;ra(l),l.append(r),n.clear(),st(e,t[0].prev,t[o-1].next)}Cn(i,()=>{for(var c=0;c<o;c++){var u=t[c];s||(n.delete(u.k),st(e,u.prev,u.next)),Le(u.e,!s)}})}function oi(e,t,r,n,i,o=null){var a=e,s={flags:t,items:new Map,first:null},l=(t&Ne)!==0;if(l){var c=e;a=c.appendChild(Yt())}var u=null,f=!1;ft(()=>{var d=r(),g=Ve(d)?d:d==null?[]:ie(d),h=g.length;if(!(f&&h===0)){f=h===0;{var b=G;ha(g,s,a,i,t,(b.f&Ue)!==0,n)}o!==null&&(h===0?u?Ht(u):u=ze(()=>o(a)):u!==null&&jt(u,()=>{u=null})),r()}})}function ha(e,t,r,n,i,o,a){var Ae,We,qe,gt;var s=(i&he)!==0,l=(i&(K|J))!==0,c=e.length,u=t.items,f=t.first,d=f,g,h=null,b,x=[],y=[],w,k,p,P;if(s)for(P=0;P<c;P+=1)w=e[P],k=a(w,P),p=u.get(k),p!==void 0&&((Ae=p.a)==null||Ae.measure(),(b??(b=new Set)).add(p));for(P=0;P<c;P+=1){if(w=e[P],k=a(w,P),p=u.get(k),p===void 0){var C=d?d.e.nodes_start:r;h=pa(C,t,h,h===null?t.first:h.next,w,k,P,n,i),u.set(k,h),x=[],y=[],d=h.next;continue}if(l&&_a(p,w,P,i),p.e.f&Ue&&(Ht(p.e),s&&((We=p.a)==null||We.unfix(),(b??(b=new Set)).delete(p))),p!==d){if(g!==void 0&&g.has(p)){if(x.length<y.length){var V=y[0],A;h=V.prev;var z=x[0],X=x[x.length-1];for(A=0;A<x.length;A+=1)ai(x[A],V,r);for(A=0;A<y.length;A+=1)g.delete(y[A]);st(t,z.prev,X.next),st(t,h,z),st(t,X,V),d=V,h=X,P-=1,x=[],y=[]}else g.delete(p),ai(p,d,r),st(t,p.prev,p.next),st(t,p,h===null?t.first:h.next),st(t,h,p),h=p;continue}for(x=[],y=[];d!==null&&d.k!==k;)(o||!(d.e.f&Ue))&&(g??(g=new Set)).add(d),y.push(d),d=d.next;if(d===null)continue;p=d}x.push(p),h=p,d=p.next}if(d!==null||g!==void 0){for(var Ie=g===void 0?[]:ie(g);d!==null;)(o||!(d.e.f&Ue))&&Ie.push(d),d=d.next;var R=Ie.length;if(R>0){var $=i&Ne&&c===0?r:null;if(s){for(P=0;P<R;P+=1)(qe=Ie[P].a)==null||qe.measure();for(P=0;P<R;P+=1)(gt=Ie[P].a)==null||gt.fix()}ga(t,Ie,$,u)}}s&&mt(()=>{var De;if(b!==void 0)for(p of b)(De=p.a)==null||De.apply()}),M.first=t.first&&t.first.e,M.last=h&&h.e}function _a(e,t,r,n){n&K&&Rr(e.v,t),n&J?Rr(e.i,r):e.i=r}function pa(e,t,r,n,i,o,a,s,l){var c=(l&K)!==0,u=(l&or)===0,f=c?u?cr(i):Ee(i):i,d=l&J?Ee(a):a,g={i:d,v:f,k:o,a:null,e:null,prev:r,next:n};try{return g.e=ze(()=>s(e,f,d),Zn),g.e.prev=r&&r.e,g.e.next=n&&n.e,r===null?t.first=g:(r.next=g,r.e.next=g.e),n!==null&&(n.prev=g,n.e.prev=g.e),g}finally{}}function ai(e,t,r){for(var n=e.next?e.next.e.nodes_start:r,i=t?t.e.nodes_start:r,o=e.e.nodes_start;o!==n;){var a=gr(o);i.before(o),o=a}}function st(e,t,r){t===null?e.first=r:(t.next=r,t.e.next=r&&r.e),r!==null&&(r.prev=t,r.e.prev=t&&t.e)}function Pt(e,t,r,n,i){var o=e,a="",s;ft(()=>{a!==(a=t()??"")&&(s!==void 0&&(Le(s),s=void 0),a!==""&&(s=ze(()=>{var l=a+"",c=ti(l);xt(zt(c),c.lastChild),o.before(c)})))})}function re(e,t,r,n,i){var s;var o=(s=t.$$slots)==null?void 0:s[r],a=!1;o===!0&&(o=t[r==="default"?"children":r],a=!0),o===void 0||o(e,a?()=>n:n)}function si(e,t,...r){var n=e,i=$e,o;ft(()=>{i!==(i=t())&&(o&&(Le(o),o=null),o=ze(()=>i(n,...r)))},pt)}function ba(e,t,r){var n=e,i,o;ft(()=>{i!==(i=t())&&(o&&(jt(o),o=null),i&&(o=ze(()=>r(n,i))))},pt)}function li(e,t,r,n,i,o){var a,s,l=null,c=e,u;ft(()=>{const f=t()||null;var d=f==="svg"?Dt:null;f!==a&&(u&&(f===null?jt(u,()=>{u=null,s=null}):f===s?Ht(u):Le(u)),f&&f!==s&&(u=ze(()=>{if(l=d?document.createElementNS(d,f):document.createElement(f),xt(l,l),n){var g=l.appendChild(Yt());n(l,g)}M.nodes_end=l,c.before(l)})),a=f,a&&(s=a))},pt)}function q(e,t){mt(()=>{var r=e.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){const i=document.createElement("style");i.id=t.hash,i.textContent=t.code,n.appendChild(i)}})}function Q(e,t,r,n){var i=e.__attributes??(e.__attributes={});i[t]!==(i[t]=r)&&(t==="style"&&"__styles"in e&&(e.__styles={}),t==="loading"&&(e[To]=r),r==null?e.removeAttribute(t):typeof r!="string"&&fi(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function ci(e,t,r,n,i=!1,o=!1,a=!1){var s=t||{},l=e.tagName==="OPTION";for(var c in t)c in r||(r[c]=null);n!==void 0&&(r.class=r.class?r.class+" "+n:n);var u=fi(e),f=e.__attributes??(e.__attributes={}),d=[];for(const y in r){let w=r[y];if(l&&y==="value"&&w==null){e.value=e.__value="",s[y]=w;continue}var g=s[y];if(w!==g){s[y]=w;var h=y[0]+y[1];if(h!=="$$"){if(h==="on"){const k={},p="$$"+y;let P=y.slice(2);var b=la(P);if(aa(P)&&(P=P.slice(0,-7),k.capture=!0),!b&&g){if(w!=null)continue;e.removeEventListener(P,s[p],k),s[p]=null}if(w!=null)if(b)e[`__${P}`]=w,Yr([P]);else{let C=function(V){s[y].call(this,V)};t?s[p]=$r(P,e,C,k):d.push([y,w,()=>s[p]=$r(P,e,C,k)])}}else if(y==="style"&&w!=null)e.style.cssText=w+"";else if(y==="autofocus")na(e,!!w);else if(y==="__value"||y==="value"&&w!=null)e.value=e[y]=e.__value=w;else{var x=y;i||(x=ua(x)),w==null&&!o?(f[y]=null,e.removeAttribute(y)):u.includes(x)&&(o||typeof w!="string")?e[x]=w:typeof w!="function"&&Q(e,x,w)}y==="style"&&"__styles"in e&&(e.__styles={})}}}return t||mt(()=>{if(e.isConnected)for(const[y,w,k]of d)s[y]===w&&k()}),s}var ui=new Map;function fi(e){var t=ui.get(e.nodeName);if(t)return t;ui.set(e.nodeName,t=[]);for(var r,n=sr(e),i=Element.prototype;i!==n;){r=wn(n);for(var o in r)r[o].set&&t.push(o);n=sr(n)}return t}function zr(e,t){var r=e.__className,n=ma(t);(r!==n||Zn)&&(t==null?e.removeAttribute("class"):e.className=n,e.__className=n)}function ma(e){return e??""}function ya(e,t,r){if(r){if(e.classList.contains(t))return;e.classList.add(t)}else{if(!e.classList.contains(t))return;e.classList.remove(t)}}function wa(e,t,r=t){var n=dr();oa(e,"input",()=>{var i=di(e)?vi(e.value):e.value;r(i),n&&i!==(i=t())&&(e.value=i??"")}),Ft(()=>{var i=t();di(e)&&i===vi(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function di(e){var t=e.type;return t==="number"||t==="range"}function vi(e){return e===""?null:+e}function _r(e,t,r){var n=Ge(e,t);n&&n.set&&(e[t]=r,Dr(()=>{e[t]=null}))}function gi(e,t){return e===t||(e==null?void 0:e[nt])===t}function Ea(e={},t,r,n){return Lr(()=>{var i,o;return Ft(()=>{i=o,o=[],dt(()=>{e!==r(...o)&&(t(e,...o),i&&gi(r(...i),e)&&t(null,...i))})}),()=>{mt(()=>{o&&gi(r(...o),e)&&t(null,...o)})}}),e}function hi(e){return function(...t){var r=t[0];return r.preventDefault(),e==null?void 0:e.apply(this,t)}}function Me(e=!1){const t=U,r=t.l.u;if(!r)return;let n=()=>ce(t.s);if(e){let i=0,o={};const a=ee(()=>{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});n=()=>v(a)}r.b.length&&Fo(()=>{_i(t,n),Or(r.b)}),Ur(()=>{const i=dt(()=>r.m.map(xo));return()=>{for(const o of i)typeof o=="function"&&o()}}),r.a.length&&Ur(()=>{_i(t,n),Or(r.a)})}function _i(e,t){if(e.l.s)for(const r of e.l.s)v(r);t()}function pi(e,t){var o;var r=(o=e.$$events)==null?void 0:o[t.type],n=Ve(r)?r.slice():r==null?[]:[r];for(var i of n)i.call(this,t)}function pr(e){U===null&&ur(),S&&U.l!==null?bi(U).m.push(e):Ur(()=>{const t=dt(e);if(typeof t=="function")return t})}function xa(e,t,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(e,{detail:t,bubbles:r,cancelable:n})}function Ia(){const e=U;return e===null&&ur(),(t,r,n)=>{var o;const i=(o=e.s.$$events)==null?void 0:o[t];if(i){const a=Ve(i)?i.slice():[i],s=xa(t,r,n);for(const l of a)l.call(e.x,s);return!s.defaultPrevented}return!0}}function Pa(e){U===null&&ur(),U.l===null&&Ro(),bi(U).b.push(e)}function bi(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}function ka(e,t,r){if(e==null)return t(void 0),$e;const n=dt(()=>e.subscribe(t,r));return n.unsubscribe?()=>n.unsubscribe():n}let br=!1;function Ta(e,t,r){const n=r[t]??(r[t]={store:null,source:cr(void 0),unsubscribe:$e});if(n.store!==e)if(n.unsubscribe(),n.store=e??null,e==null)n.source.v=void 0,n.unsubscribe=$e;else{var i=!0;n.unsubscribe=ka(e,o=>{i?n.source.v=o:N(n.source,o)}),i=!1}return v(n.source)}function Aa(){const e={};return Dr(()=>{for(var t in e)e[t].unsubscribe()}),e}function Oa(e){var t=br;try{return br=!1,[e(),br]}finally{br=t}}const Na={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 Kr(e,t,r){return new Proxy({props:e,exclude:t},Na)}const Sa={get(e,t){let r=e.props.length;for(;r--;){let n=e.props[r];if(Lt(n)&&(n=n()),typeof n=="object"&&n!==null&&t in n)return n[t]}},set(e,t,r){let n=e.props.length;for(;n--;){let i=e.props[n];Lt(i)&&(i=i());const o=Ge(i,t);if(o&&o.set)return o.set(r),!0}return!1},getOwnPropertyDescriptor(e,t){let r=e.props.length;for(;r--;){let n=e.props[r];if(Lt(n)&&(n=n()),typeof n=="object"&&n!==null&&t in n){const i=Ge(n,t);return i&&!i.configurable&&(i.configurable=!0),i}}},has(e,t){if(t===nt||t===In)return!1;for(let r of e.props)if(Lt(r)&&(r=r()),r!=null&&t in r)return!0;return!1},ownKeys(e){const t=[];for(let r of e.props){Lt(r)&&(r=r());for(const n in r)t.includes(n)||t.push(n)}return t}};function Qt(...e){return new Proxy({props:e},Sa)}function mi(e){for(var t=M,r=M;t!==null&&!(t.f&(Se|Bt));)t=t.parent;try{return Ce(t),e()}finally{Ce(r)}}function m(e,t,r,n){var V;var i=(r<)!==0,o=!S||(r&St)!==0,a=(r&Rt)!==0,s=(r&ke)!==0,l=!1,c;a?[c,l]=Oa(()=>e[t]):c=e[t];var u=nt in e||In in e,f=((V=Ge(e,t))==null?void 0:V.set)??(u&&a&&t in e?A=>e[t]=A:void 0),d=n,g=!0,h=!1,b=()=>(h=!0,g&&(g=!1,s?d=dt(n):d=n),d);c===void 0&&n!==void 0&&(f&&o&&Mo(),c=b(),f&&f(c));var x;if(o)x=()=>{var A=e[t];return A===void 0?b():(g=!0,h=!1,A)};else{var y=mi(()=>(i?ee:fe)(()=>e[t]));y.f|=Po,x=()=>{var A=v(y);return A!==void 0&&(d=void 0),A===void 0?d:A}}if(!(r&H))return x;if(f){var w=e.$$legacy;return function(A,z){return arguments.length>0?((!o||!z||w||l)&&f(z?x():A),A):x()}}var k=!1,p=!1,P=cr(c),C=mi(()=>ee(()=>{var A=x(),z=v(P);return k?(k=!1,p=!0,z):(p=!1,P.v=A)}));return i||(C.equals=Sr),function(A,z){if(arguments.length>0){const X=z?v(C):o&&a?Ke(A):A;return C.equals(X)||(k=!0,N(P,X),h&&d!==void 0&&(d=X),dt(()=>v(C))),A}return v(C)}}const Ra={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 kt(e,t){q(e,Ra);let r=m(t,"as",8,"section");var n=oe(),i=L(n);li(i,r,!1,(o,a)=>{ci(o,null,{class:"rcb-modal-section"},"svelte-1bzqb13",o.namespaceURI===Dt,o.nodeName.includes("-"));var s=oe(),l=L(s);re(l,t,"default",{}),_(a,s)}),_(e,n)}var pe=(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))(pe||{});class Y{static setLogLevel(t){this.logLevel=t}static log(t,r=this.logLevel){const n=`[Purchases] ${t}`;if(!(this.logLevel<r||r===pe.Silent))switch(r){case pe.Error:console.error(n);break;case pe.Warn:console.warn(n);break;case pe.Info:console.info(n);break;case pe.Debug:console.debug(n);break;case pe.Verbose:console.debug(n);break}}static errorLog(t){this.log(t,pe.Error)}static warnLog(t){this.log(t,pe.Warn)}static infoLog(t){this.log(t,pe.Info)}static debugLog(t){this.log(t,pe.Debug)}static verboseLog(t){this.log(t,pe.Verbose)}}B(Y,"logLevel",pe.Silent);var Qe=(e=>(e.Year="year",e.Month="month",e.Week="week",e.Day="day",e))(Qe||{});function Qr(e){const t=e.match(/^PT?([0-9]+)([MDYW])$/);if(!t||t.length<3)return Y.errorLog(`Invalid ISO 8601 duration format: ${e}`),null;const r=parseInt(t[1]);switch(t[2]){case"Y":return{number:r,unit:"year"};case"M":return{number:r,unit:"month"};case"W":return{number:r,unit:"week"};case"D":return{number:r,unit:"day"};default:return Y.errorLog(`Invalid ISO 8601 unit duration format: ${e}`),null}}const ve=(e,t,r)=>{const n=e/1e6;return new Intl.NumberFormat(r,{style:"currency",currency:t}).format(n)},yi=e=>{const t=e.number;if(t===1)switch(e.unit){case Qe.Year:return"yearly";case Qe.Month:return"monthly";case Qe.Week:return"weekly";case Qe.Day:return"daily"}else return`every ${t} ${e.unit}s`},wi=e=>{const t=e.number;if(t===1)switch(e.unit){case Qe.Year:return"1 year";case Qe.Month:return"1 month";case Qe.Week:return"1 week";case Qe.Day:return"1 day"}else return`${t} ${e.unit}s`},Ma=e=>{const t=Qr(e);return t?yi(t):"unknown"},Da=e=>{const t=Qr(e);return t?wi(t):"unknown"};function Ua(e){return e!=null}var Ei=(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))(Ei||{}),Te=(e=>(e.Subscription="subscription",e.Consumable="consumable",e.NonConsumable="non_consumable",e))(Te||{});const xi=e=>({amount:e.amount_micros/1e4,amountMicros:e.amount_micros,currency:e.currency,formattedPrice:ve(e.amount_micros,e.currency)}),Ii=e=>{const t=e.period_duration;return{periodDuration:t,period:t?Qr(t):null,cycleCount:e.cycle_count,price:e.price?xi(e.price):null}},La=e=>e.base==null?(Y.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,base:Ii(e.base),trial:e.trial?Ii(e.trial):null},Ca=e=>e.base_price==null?(Y.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,basePrice:xi(e.base_price)},Ba=(e,t)=>{const r=e.product_type;return r==="subscription"?Fa(e,t,r):qa(e,t,r)},qa=(e,t,r)=>{const n={};if(Object.entries(e.purchase_options).forEach(([a,s])=>{const l=Ca(s);l!=null&&(n[a]=l)}),Object.keys(n).length===0)return Y.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?(Y.debugLog(`Product ${e.identifier} has no default purchase option. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:r,currentPrice:o.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:t.offeringIdentifier,presentedOfferingContext:t,defaultPurchaseOption:o,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:o}},Fa=(e,t,r)=>{const n={};if(Object.entries(e.purchase_options).forEach(([s,l])=>{const c=La(l);c!=null&&(n[s]=c)}),Object.keys(n).length===0)return Y.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 Y.debugLog(`Product ${e.identifier} has no default subscription option. Ignoring.`),null;const a=o.base.price;return a==null?(Y.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:r,currentPrice:a,normalPeriodDuration:o.base.periodDuration,presentedOfferingIdentifier:t.offeringIdentifier,presentedOfferingContext:t,defaultPurchaseOption:o,defaultSubscriptionOption:o,subscriptionOptions:n,defaultNonSubscriptionOption:null}},ja=(e,t,r)=>{const n=r[t.platform_product_identifier];if(n===void 0)return null;const i=Ba(n,e);return i===null?null:{identifier:t.identifier,rcBillingProduct:i,packageType:Va(t.identifier)}},Ha=(e,t,r,n)=>{const i={offeringIdentifier:t.identifier,targetingContext:e&&n?{ruleId:n.rule_id,revision:n.revision}:null,placementIdentifier:null},o=t.packages.map(s=>ja(i,s,r)).filter(Ua),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 Ga=I('<span class="rcb-product-price-after-trial svelte-1mdrqnh"> </span>'),$a=I('<span class="rcb-product-description svelte-1mdrqnh"> </span>'),Ya=I("<li> </li>"),za=I('<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=I('<span class="rcb-product-description svelte-1mdrqnh"> </span>'),Qa=I('<span class="rcb-product-price svelte-1mdrqnh"> </span> <!>',1),Wa=I('<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
|
|
4
|
+
}`};function Pi(e,t){var f;W(t,!1),q(e,Za);let r=m(t,"productDetails",8),n=m(t,"purchaseOption",8),i=m(t,"brandingAppearance",8,void 0);const o=r().productType===Te.Subscription,a=n(),s=n(),l=a==null?void 0:a.trial,c=(f=a==null?void 0:a.base)==null?void 0:f.price,u=s==null?void 0:s.basePrice;Me(),kt(e,{children:(d,g)=>{var h=Wa(),b=T(h),x=T(b),y=D(b,2);j(y,()=>o,k=>{var p=za(),P=L(p),C=T(P);j(C,()=>l==null?void 0:l.periodDuration,R=>{var $=at();F(()=>de($,`${Da(l.periodDuration)??""} free trial`)),_(R,$)});var V=D(C,2);j(V,()=>!(l!=null&&l.periodDuration)&&c,R=>{var $=at();F(()=>de($,c.formattedPrice)),_(R,$)});var A=D(P,2);j(A,()=>l&&c,R=>{var $=Ga(),Ae=T($);F(()=>de(Ae,l&&c&&`${c.formattedPrice} after end of trial`)),_(R,$)});var z=D(A,2);j(z,()=>{var R;return((R=i())==null?void 0:R.show_product_description)&&r().description},R=>{var $=$a(),Ae=T($);F(()=>de(Ae,r().description)),_(R,$)});var X=D(z,2),Ie=T(X);j(Ie,()=>r().normalPeriodDuration,R=>{var $=Ya(),Ae=T($);F(()=>de(Ae,`Renews ${Ma(r().normalPeriodDuration)??""}`)),_(R,$)}),_(k,p)});var w=D(y,2);j(w,()=>!o,k=>{var p=Qa(),P=L(p),C=T(P),V=D(P,2);j(V,()=>{var A;return(A=i())==null?void 0:A.show_product_description},A=>{var z=Ka(),X=T(z);F(()=>de(X,r().description)),_(A,z)}),F(()=>de(C,u==null?void 0:u.formattedPrice)),_(k,p)}),F(()=>de(x,r().title)),_(d,h)},$$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=I('<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,29 @@
|
|
|
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){q(e,es);var t=Ja(),r=T(t);Pt(r,()=>Xa),_(e,t)}var rs=I('<div class="rcb-modal-loader svelte-l57ojl"><!></div>');const ns={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 Wr(e){q(e,ns);var t=rs(),r=T(t);ts(r),_(e,t)}var ae=(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))(ae||{});class Wt{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 ki?t:null}static convertPurchaseFlowErrorCodeToErrorCode(t){switch(t){case ge.ErrorSettingUpPurchase:return 2;case ge.ErrorChargingPayment:return 20;case ge.NetworkError:return 10;case ge.MissingEmailError:return 4;case ge.StripeError:return 2;case ge.UnknownError:return 0;case ge.AlreadyPurchasedError:return 6}}}var ki=(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))(ki||{});class ne extends Error{constructor(r,n,i,o){super(n);B(this,"toString",()=>`PurchasesError(code: ${ae[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i,this.extra=o}static getForBackendError(r,n){const i=Wt.getErrorCodeForBackendErrorCode(r);return new ne(i,Wt.getPublicMessage(i),n,{backendErrorCode:r})}static getForPurchasesFlowError(r){return new ne(Wt.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class Ti extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Zt=(e=>(e.Started="started",e.InProgress="in_progress",e.Succeeded="succeeded",e.Failed="failed",e))(Zt||{}),Tt=(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))(Tt||{});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 ge=(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))(ge||{});class te extends Error{constructor(t,r,n,i,o){super(r),this.errorCode=t,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(t){var n;const r=((n=this.extra)==null?void 0:n.backendErrorCode)??this.purchasesErrorCode??this.errorCode;switch(this.errorCode){case 2:return`An unknown error occurred. Error code: ${r}.`;case 0:return`Purchase not started due to an error. Error code: ${r}.`;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)===Te.Subscription?"You are already subscribed to this product.":"You have already purchased this product."}}static fromPurchasesError(t,r){let n;return t.errorCode===ae.ProductAlreadyPurchasedError?n=6:t.errorCode===ae.InvalidEmailError?n=5:t.errorCode===ae.NetworkError?n=3:n=r,new te(n,t.message,t.underlyingErrorMessage,t.errorCode,t.extra)}}class os{constructor(t,r=10){B(this,"operationSessionId",null);B(this,"backend");B(this,"maxNumberAttempts");B(this,"waitMSBetweenAttempts",1e3);this.backend=t,this.maxNumberAttempts=r}async startPurchase(t,r,n,i,o){try{const a=await this.backend.postPurchase(t,r,i,o,n);return this.operationSessionId=a.operation_session_id,a}catch(a){if(a instanceof ne)throw te.fromPurchasesError(a,0);{const s="Unknown error starting purchase: "+String(a);throw Y.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((r,n)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new te(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(t).then(a=>{switch(a.operation.status){case Zt.Started:case Zt.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case Zt.Succeeded:this.clearPurchaseInProgress(),r({redemptionInfo:is(a)});return;case Zt.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(a.operation.error,n)}}).catch(a=>{const s=te.fromPurchasesError(a,3);n(s)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(t,r){if(t==null){r(new te(2,"Got an error status but error field is empty."));return}switch(t.code){case Tt.SetupIntentCreationFailed:r(new te(0,"Setup intent creation failed"));return;case Tt.PaymentMethodCreationFailed:r(new te(0,"Payment method creation failed"));return;case Tt.PaymentChargeFailed:r(new te(1,"Payment charge failed"));return;case Tt.SetupIntentCompletionFailed:r(new te(0,"Setup intent completion failed"));return;case Tt.AlreadyPurchased:r(new te(6,"Purchased was already completed"));return;default:r(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
|
|
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
|
|
42
|
+
`;var ss=I('<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){q(e,ls);var t=ss(),r=T(t);Pt(r,()=>as),_(e,t)}var us=I("<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 Zr(e,t){q(e,fs);let r=m(t,"intent",8,"primary"),n=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);re(s,t,"default",{}),F(()=>{zr(a,`${`intent-${r()}`??""} svelte-2xwwo`),a.disabled=n(),Q(a,"data-testid",i()),Q(a,"type",o())}),hr("click",a,function(l){pi.call(this,t,l)}),_(e,a)}var ds=I('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const vs={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function Xr(e,t){q(e,vs);var r=ds(),n=T(r);re(n,t,"default",{}),_(e,r)}var gs=I('<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 Xt(e,t){q(e,hs);let r=m(t,"gutter",8,"8px");var n=gs(),i=T(n);re(i,t,"default",{}),F(()=>Q(n,"style",`--gap:${r()};`)),_(e,n)}const _s=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
44
|
+
<g id="mdi_close">
|
|
45
|
+
<path id="Vector" d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z"
|
|
46
|
+
fill="currentColor"/>
|
|
47
|
+
</g>
|
|
48
|
+
</svg>
|
|
49
|
+
`;var ps=I('<button class="close-button svelte-1y0elb4"><div><!></div></button>');const bs={hash:"svelte-1y0elb4",code:".close-button.svelte-1y0elb4 {border:none;cursor:pointer;background-color:transparent;padding:0px;height:24px;border-radius:50%;color:var(--rc-color-grey-text-light);}.close-button.svelte-1y0elb4:focus {outline:2px solid var(--rc-color-focus);}.close-button.svelte-1y0elb4:hover {color:var(--rc-color-grey-text-dark);}"};function Jr(e,t){q(e,bs);let r=m(t,"disabled",8,!1);var n=ps(),i=T(n),o=T(i);Pt(o,()=>_s),F(()=>n.disabled=r()),hr("click",n,function(a){pi.call(this,t,a)}),_(e,n)}var ms=I('<picture class="rcb-app-icon-picture-container svelte-44qpq9"><source type="image/webp"> <img class="rcb-app-icon svelte-44qpq9" alt="App icon"></picture>'),ys=I('<div class="rcb-app-icon loading svelte-44qpq9"></div>');const ws={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 Ai(e,t){q(e,ws);let r=m(t,"src",8,null),n=m(t,"srcWebp",8,null);var i=oe(),o=L(i);j(o,()=>r()!==null,a=>{var s=ms(),l=T(s),c=D(l,2);F(()=>{Q(l,"srcset",n()),Q(c,"src",r())}),_(a,s)},a=>{var s=ys();_(a,s)}),_(e,i)}const Oi=e=>`https://da08ctfrofx1b.cloudfront.net/${e}`;var Es=I('<!> <span class="app-title svelte-10uf5fq"> </span>',1),xs=I('<div class="rcb-header-layout__business-info svelte-10uf5fq"><!></div>');const Is={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 Ni(e,t){W(t,!1),q(e,Is);let r=m(t,"brandingInfo",8,null);Me();var n=xs(),i=T(n);j(i,()=>r()!==null,o=>{var a=Es(),s=L(a);j(s,()=>r().app_icon_webp!==null&&r().app_icon!==null,u=>{var f=fe(()=>Oi(r().app_icon)),d=fe(()=>Oi(r().app_icon_webp));Ai(u,{get src(){return v(f)},get srcWebp(){return v(d)}})});var l=D(s,2),c=T(l);F(()=>de(c,r().seller_company_name)),_(o,a)},o=>{Ai(o,{})}),_(e,n),Z()}var Ps=I('<div class="rcb-post-purchase-header-layout svelte-17puakv"><!> <!></div>');const ks={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 Ts(e,t){q(e,ks);let r=m(t,"brandingInfo",8,null),n=m(t,"onClose",8);kt(e,{as:"header",children:(i,o)=>{var a=Ps(),s=T(a);Ni(s,{get brandingInfo(){return r()}});var l=D(s,2);Jr(l,{$$events:{click(...c){var u;(u=n())==null||u.apply(this,c)}}}),_(i,a)},$$slots:{default:!0}})}var As=I('<span class="title svelte-idou50"> </span> <span class="subtitle svelte-idou50"><!></span>',1),Os=I("<!> <!>",1),Ns=I('<div class="rcb-modal-message svelte-idou50"><!></div>'),Ss=I("<!> <!> <!>",1);const Rs={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 Si(e,t){q(e,Rs);let r=m(t,"brandingInfo",8,null),n=m(t,"onContinue",8),i=m(t,"title",8),o=m(t,"type",8),a=m(t,"closeButtonTitle",8,"Go back to app");Xt(e,{gutter:"32px",children:(s,l)=>{var c=Ss(),u=L(c);Ts(u,{get brandingInfo(){return r()},get onClose(){return n()}});var f=D(u,2);kt(f,{children:(g,h)=>{var b=Ns(),x=T(b);Xt(x,{gutter:"48px",children:(y,w)=>{var k=Os(),p=L(k);re(p,t,"icon",{});var P=D(p,2);Xt(P,{gutter:"16px",children:(C,V)=>{var A=As(),z=L(A),X=T(z),Ie=D(z,2),R=T(Ie);re(R,t,"default",{}),F(()=>de(X,i())),_(C,A)},$$slots:{default:!0}}),_(y,k)},$$slots:{default:!0}}),F(()=>Q(b,"data-type",o())),_(g,b)},$$slots:{default:!0}});var d=D(f,2);Xr(d,{children:(g,h)=>{Zr(g,{type:"submit",$$events:{click(...b){var x;(x=n())==null||x.apply(this,b)}},children:(b,x)=>{var y=at();F(()=>de(y,a())),_(b,y)},$$slots:{default:!0}})},$$slots:{default:!0}}),_(s,c)},$$slots:{default:!0}})}var Ms=I("<br>If this error persists, please contact <a> </a>.",1),Ds=I(" <!>",1);function Us(e,t){W(t,!1);let r=m(t,"brandingInfo",8,null),n=m(t,"lastError",8),i=m(t,"supportEmail",8,null),o=m(t,"productDetails",8,null),a=m(t,"onContinue",8);pr(()=>{Y.errorLog(`Displayed error: ${ge[n().errorCode]}. Message: ${n().message??"None"}. Underlying error: ${n().underlyingErrorMessage??"None"}`)});function s(){var c;switch(n().errorCode){case ge.AlreadyPurchasedError:return((c=o())==null?void 0:c.productType)===Te.Subscription?"Already subscribed":"Already purchased";default:return"Something went wrong"}}Me();var l=fe(s);Si(e,{get title(){return v(l)},get brandingInfo(){return r()},get onContinue(){return a()},type:"error",closeButtonTitle:"Try Again",children:(c,u)=>{var f=Ds(),d=L(f);F(()=>de(d,`${n().getPublicErrorMessage(o())??""} `));var g=D(d);j(g,i,h=>{var b=Ms(),x=D(L(b),2),y=T(x);F(()=>{Q(x,"href",`mailto:${i()??""}`),de(y,i())}),_(h,b)}),_(c,f)},$$slots:{default:!0,icon:(c,u)=>{cs(c)}}}),Z()}const Ls=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
44
50
|
<circle cx="62" cy="62" r="62" fill="currentColor"/>
|
|
45
51
|
<rect x="44.1116" y="56" width="27.5" height="11" transform="rotate(45 44.1116 56)" fill="white"/>
|
|
46
52
|
<rect x="79.1133" y="44.334" width="11" height="44" transform="rotate(45 79.1133 44.334)" fill="white"/>
|
|
47
53
|
</svg>
|
|
48
|
-
`;var
|
|
54
|
+
`;var Cs=I('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-7wiquz"><!></div>');const Bs={hash:"svelte-7wiquz",code:".rcb-ui-asset-icon.svelte-7wiquz {width:96px;height:96px;margin:0 auto;}"};function qs(e){q(e,Bs);var t=Cs(),r=T(t);Pt(r,()=>Ls),_(e,t)}function Fs(e,t){var a;W(t,!1);let r=m(t,"productDetails",8,null),n=m(t,"brandingInfo",8,null),i=m(t,"onContinue",8);const o=((a=r())==null?void 0:a.productType)===Te.Subscription;Me(),Si(e,{type:"success",title:"Purchase successful",get brandingInfo(){return n()},get onContinue(){return i()},closeButtonTitle:"Close",children:(s,l)=>{var c=oe(),u=L(c);j(u,()=>o,f=>{var d=at("Your subscription is now active.");_(f,d)}),_(s,c)},$$slots:{default:!0,icon:(s,l)=>{qs(s)}}}),Z()}function js(e,t,r,n,i={}){const o=r.create(t,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 Hs=typeof window>"u";function Vs(e){if(!Hs)return e.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}var Gs=I("<div></div>");function $s(e,t){W(t,!1);let r,n=_e();const i=Ia(),{elements:o}=Jo("stripe");let a=m(t,"options",8,void 0);pr(()=>(r=js(v(n),"payment",o,i,a()),()=>r.destroy()));function s(){r.blur()}function l(){r.clear()}function c(){r.destroy()}function u(){r.focus()}Me();var f=Gs();return Ea(f,d=>N(n,d),()=>v(n)),_(e,f),_r(t,"blur",s),_r(t,"clear",l),_r(t,"destroy",c),_r(t,"focus",u),Z({blur:s,clear:l,destroy:c,focus:u})}function Ys(e,t){W(t,!1);const r=_e();let n=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"),u=m(t,"fonts",24,()=>[]),f=m(t,"locale",8,"auto"),d=m(t,"currency",8,void 0),g=m(t,"amount",8,void 0),h=m(t,"clientSecret",8,void 0),b=m(t,"elements",12,null);ut(()=>(ce(o()),ce(a()),ce(s()),ce(l())),()=>{N(r,{theme:o(),variables:a(),rules:s(),labels:l()})}),ut(()=>(ce(n()),ce(b()),ce(i()),ce(d()),ce(g()),v(r),ce(h()),ce(u()),ce(c()),ce(f()),$n),()=>{n()&&!b()&&(b(n().elements({mode:i(),currency:d(),amount:g(),appearance:v(r),clientSecret:h(),fonts:u(),loader:c(),locale:f()})),Vs(n()),$n("stripe",{stripe:n(),elements:b()}))}),ut(()=>(ce(b()),v(r),ce(f())),()=>{b()&&b().update({appearance:v(r),locale:f()})}),Cr(),Me();var x=oe(),y=L(x);j(y,()=>n()&&b(),w=>{var k=oe(),p=L(k);re(p,t,"default",{}),_(w,k)}),_(e,x),Z()}var Ri="https://js.stripe.com/v3",zs=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Mi="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Ks=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Ri,'"]')),r=0;r<t.length;r++){var n=t[r];if(zs.test(n.src))return n}return null},Di=function(t){var r="",n=document.createElement("script");n.src="".concat(Ri).concat(r);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},Qs=function(t,r){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"4.6.0",startTime:r})},Jt=null,mr=null,yr=null,Ws=function(t){return function(){t(new Error("Failed to load Stripe.js"))}},Zs=function(t,r){return function(){window.Stripe?t(window.Stripe):r(new Error("Stripe.js not available"))}},Xs=function(t){return Jt!==null?Jt:(Jt=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&t&&console.warn(Mi),window.Stripe){r(window.Stripe);return}try{var i=Ks();if(i&&t)console.warn(Mi);else if(!i)i=Di(t);else if(i&&yr!==null&&mr!==null){var o;i.removeEventListener("load",yr),i.removeEventListener("error",mr),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=Di(t)}yr=Zs(r,n),mr=Ws(n),i.addEventListener("load",yr),i.addEventListener("error",mr)}catch(a){n(a);return}}),Jt.catch(function(r){return Jt=null,Promise.reject(r)}))},Js=function(t,r,n){if(t===null)return null;var i=t.apply(void 0,r);return Qs(i,n),i},er,Ui=!1,Li=function(){return er||(er=Xs(null).catch(function(t){return er=null,Promise.reject(t)}),er)};Promise.resolve().then(function(){return Li()}).catch(function(e){Ui||console.warn(e)});var el=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];Ui=!0;var i=Date.now();return Li().then(function(o){return Js(o,r,i)})},tl=I('<div class="rcb-header-layout svelte-1xe711j"><!></div>');const rl={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 en(e,t){q(e,rl),kt(e,{as:"header",children:(r,n)=>{var i=tl(),o=T(i);re(o,t,"default",{}),_(r,i)},$$slots:{default:!0}})}const nl=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
|
|
49
55
|
xmlns="http://www.w3.org/2000/svg">
|
|
50
56
|
<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
57
|
fill="currentColor"/>
|
|
52
58
|
</svg>
|
|
53
|
-
`;var
|
|
59
|
+
`;var il=I('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1z0jca3"><!></div>');const ol={hash:"svelte-1z0jca3",code:"div.svelte-1z0jca3 {height:24px;width:24px;}"};function al(e){q(e,ol);var t=il(),r=T(t);Pt(r,()=>nl),_(e,t)}var sl=I('<div class="processing svelte-rjmul6"></div>');const ll={hash:"svelte-rjmul6",code:`.processing.svelte-rjmul6 {width:12px;aspect-ratio:1;border-radius:50%;
|
|
54
60
|
animation: svelte-rjmul6-l5 1.5s infinite linear;}
|
|
55
61
|
@keyframes svelte-rjmul6-l5 {
|
|
56
62
|
0% {
|
|
@@ -83,13 +89,13 @@
|
|
|
83
89
|
-20px 0 #fff2;
|
|
84
90
|
background: #fff2;
|
|
85
91
|
}
|
|
86
|
-
}`};function
|
|
92
|
+
}`};function Ci(e){q(e,ll);var t=sl();_(e,t)}const cl={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"},ul={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"},Bi={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},fl={...Bi,background:"color_form_bg"},dl={...Bi,background:"color_product_info_bg"},qi={"input-border-radius":"12px","input-button-border-radius":"12px","modal-border-radius":"16px"},vl={"input-border-radius":"0px","input-button-border-radius":"0px","modal-border-radius":"0px"},gl={"input-border-radius":"24px","input-button-border-radius":"56px","modal-border-radius":"16px"},Fi=qi,ji=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,Hi=({r:e,g:t,b:r,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(t)+.0722*i(r)>n},Vi=.37,hl=(e,t=Vi)=>{const r=Hi({...e,luminanceThreshold:t})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${r})`,"grey-text-light":`rgba(${r},0.50)`,"grey-ui-dark":`rgba(${r},0.125)`,"grey-ui-light":`rgba(${r},0.05)`}},_l=(e,t,r,n=Vi)=>{const i={"grey-text-dark":r["grey-text-dark"],"grey-text-light":r["grey-text-light"],"grey-ui-dark":r["grey-ui-dark"],"grey-ui-light":r["grey-ui-light"],"primary-text":r["primary-text"]};if(e!=null&&e.startsWith("#")){const o=ji(e);o!==null&&Object.assign(i,hl(o))}if(t!=null&&t.startsWith("#")){const o=ji(t);o!==null&&(i["primary-text"]=Hi({...o,luminanceThreshold:n})?"black":"white")}return i},pl=(e,t)=>e||t,bl=(e,t,r)=>{const n=Object.entries(e).map(([i,o])=>[i,pl(r?r[o]:null,t[i])]);return Object.fromEntries(n)},Gi=(e,t,r)=>{const n=bl(e,t,r);return r?{...t,...n,..._l(n.background,n.primary,t)}:{...t}},ml=e=>Gi(dl,ul,e),$i=e=>Gi(fl,cl,e),tn=e=>{if(!e)return Fi;switch(e.shapes){case"rounded":return qi;case"rectangle":return vl;case"pill":return gl;default:return Fi}},wr=(e="",t)=>t.map(([r,n])=>`--rc-${e}-${r}: ${n}`).join("; "),Yi=e=>{const t=wr("color",Object.entries(ml(e))),r=wr("shape",Object.entries(tn(e)));return[t,r].join("; ")},yl=e=>{const t=wr("color",Object.entries($i(e))),r=wr("shape",Object.entries(tn(e)));return[t,r].join("; ")};class rn{constructor(t){this.brandingAppearance=t}get shape(){return tn(this.brandingAppearance)}get formColors(){return $i(this.brandingAppearance)}get formStyleVars(){return yl(this.brandingAppearance)}get productInfoStyleVars(){return Yi(this.brandingAppearance)}}var wl=I('<div style="display: flex; align-items: center; justify-content: baseline;"><!> <div style="margin-left: 10px">Secure Checkout</div></div> <!>',1),El=I('<div class="rcb-stripe-elements-container svelte-8jsoa8"><!></div>'),xl=I("<!> <!>",1),Il=I("<!> <form><!></form>",1),Pl=I("<div><!></div>");const kl={hash:"svelte-8jsoa8",code:`.rcb-stripe-elements-container.svelte-8jsoa8 {width:100%;
|
|
87
93
|
|
|
88
94
|
/* 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
|
|
95
|
+
/* Added to avoid the card getting smaller while loading */min-height:320px;margin-top:32px;margin-bottom:24px;}`};function Tl(e,t){var P;W(t,!1),q(e,kl);let r=m(t,"onClose",8),n=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 u=o().data.client_secret;let f=_e(null),d=_e(),g=_e(),h=_e(!1);pr(async()=>{const C=o().data.publishable_api_key,V=o().data.stripe_account_id;if(!C||!V)throw new Error("Stripe publishable key or account ID not found");N(f,await el(C,{stripeAccount:V}))});const b=async()=>{if(a()||!v(f)||!v(g))return;a(!0);const C=await v(f).confirmSetup({elements:v(g),redirect:"if_required"});C.error?(a(!1),i()(new te(ge.StripeError,C.error.message))):n()()},x=new rn((P=c())==null?void 0:P.appearance);let y=x.shape,w=x.formColors;ut(()=>v(d),()=>{v(d)&&v(d)._elements.length>0&&N(g,v(d))}),Cr(),Me();var k=Pl(),p=T(k);j(p,()=>v(f)&&u,C=>{var V=Il(),A=L(V);en(A,{children:($,Ae)=>{var We=wl(),qe=L(We),gt=T(qe);al(gt);var De=D(qe,2);Jr(De,{$$events:{click(...Nt){var Ze;(Ze=r())==null||Ze.apply(this,Nt)}}}),_($,We)},$$slots:{default:!0}});var z=D(A,2),X=T(z),Ie=fe(()=>({borderRadius:y["input-border-radius"],fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",focusBoxShadow:"none",colorDanger:w.error,colorTextPlaceholder:w["grey-text-light"],colorText:w["grey-text-dark"],colorTextSecondary:w["grey-text-light"]})),R=fe(()=>({".Input":{boxShadow:"none",border:`2px solid ${w["grey-ui-dark"]}`,backgroundColor:"transparent",color:w["grey-text-dark"]},".Input:focus":{border:`2px solid ${w.focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px",color:w["grey-text-dark"]},".Input--invalid":{boxShadow:"none"},".Tab":{boxShadow:"none",backgroundColor:"transparent",color:w["grey-text-light"],border:`2px solid ${w["grey-ui-dark"]}`},".Tab:hover, .Tab:focus, .Tab--selected, .Tab--selected:hover, .Tab--selected:focus":{boxShadow:"none",color:w["grey-text-dark"]},".Tab:focus, .Tab--selected, .Tab--selected:hover, .Tab--selected:focus":{border:`2px solid ${w.focus}`},".TabIcon":{fill:w["grey-text-light"]},".TabIcon--selected":{fill:w["grey-text-dark"]},".Block":{boxShadow:"none",backgroundColor:"transparent",border:`2px solid ${w["grey-ui-dark"]}`}}));Ys(X,{get stripe(){return v(f)},clientSecret:u,loader:"always",locale:"en",get elements(){return v(d)},set elements($){N(d,$)},theme:"stripe",get variables(){return v(Ie)},get rules(){return v(R)},children:($,Ae)=>{var We=xl(),qe=L(We);kt(qe,{children:(De,Nt)=>{var Ze=El(),Ar=T(Ze),Fe=fe(()=>{var Xe;return{business:(Xe=c())!=null&&Xe.seller_company_name?{name:c().seller_company_name}:void 0,layout:{type:"tabs"}}});$s(Ar,{get options(){return v(Fe)},$$events:{change:Xe=>{N(h,Xe.detail.complete)}}}),_(De,Ze)},$$slots:{default:!0}});var gt=D(qe,2);Xr(gt,{children:(De,Nt)=>{Xt(De,{children:(Ze,Ar)=>{var Fe=fe(()=>a()||!v(h));Zr(Ze,{get disabled(){return v(Fe)},testId:"PayButton",children:(Xe,je)=>{var ht=oe(),Je=L(ht);j(Je,a,et=>{Ci(et)},et=>{var He=oe(),tt=L(He);j(tt,()=>{var me,Oe;return(Oe=(me=s().subscriptionOptions)==null?void 0:me[l().id])==null?void 0:Oe.trial},me=>{var Oe=at("Start Trial");_(me,Oe)},me=>{var Oe=at("Pay");_(me,Oe)},!0),_(et,He)}),_(Xe,ht)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),_($,We)},$$slots:{default:!0},$$legacy:!0}),hr("submit",z,hi(b)),_(C,V)},C=>{Wr(C)}),_(e,k),Z()}function Al(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 Ol(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 Y.errorLog(t),new ne(ae.ConfigurationError,t)}}var Nl=I("<span>Billing email address</span> <!>",1),Sl=I('<div class="form-error svelte-yf01ty"> </div>'),Rl=I('<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>'),Ml=I('<div class="container svelte-yf01ty"><!> <form class="svelte-yf01ty"><!> <!></form></div>');const Dl={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),q(e,Dl);const r=_e(),n=_e(),i=_e();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=Al(v(r));b?N(n,b):o()({email:v(r)})};Pa(async()=>{var b;N(n,((b=l())==null?void 0:b.message)??"")}),ut(()=>{},()=>{N(r,"")}),ut(()=>{},()=>{N(n,"")}),ut(()=>v(n),()=>{N(i,v(n)?"error":"")}),Cr(),Me();var u=Ml(),f=T(u);en(f,{children:(b,x)=>{var y=Nl(),w=D(L(y),2);Jr(w,{$$events:{click(...k){var p;(p=a())==null||p.apply(this,k)}}}),_(b,y)},$$slots:{default:!0}});var d=D(f,2),g=T(d);kt(g,{children:(b,x)=>{var y=Rl(),w=D(T(y),2),k=T(w),p=D(w,2);j(p,()=>v(n),P=>{var C=Sl(),V=T(C);F(()=>de(V,v(n))),_(P,C)}),F(()=>zr(w,`form-input ${v(i)??""} svelte-yf01ty`)),wa(k,()=>v(r),P=>N(r,P)),_(b,y)},$$slots:{default:!0}});var h=D(g,2);Xr(h,{children:(b,x)=>{Xt(b,{children:(y,w)=>{Zr(y,{get disabled(){return s()},type:"submit",children:(k,p)=>{var P=oe(),C=L(P);j(C,s,V=>{Ci(V)},V=>{var A=at("Continue");_(V,A)}),_(k,P)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),hr("submit",d,hi(c)),_(e,u),Z()}var Ll=I('<div class="rcb-modal-backdrop svelte-17tslso"><!></div>');const Cl={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 Bl(e,t){q(e,Cl);var r=Ll(),n=T(r);re(n,t,"default",{}),_(e,r)}var ql=I('<div class="rcb-modal-container svelte-1fufj5b"><main class="rcb-modal-main svelte-1fufj5b"><!></main></div>');const Fl={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
96
|
|
|
91
97
|
@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
|
|
98
|
+
}`};function zi(e,t){q(e,Fl);let r=m(t,"style",8,"");var n=ql(),i=T(n),o=T(i);re(o,t,"default",{}),F(()=>Q(i,"style",r())),_(e,n)}function jl(e,t){let r=m(t,"condition",8,!1);var n=oe(),i=L(n);j(i,r,o=>{Bl(o,{children:(a,s)=>{var l=oe(),c=L(l);re(c,t,"default",{}),_(a,l)},$$slots:{default:!0}})},o=>{var a=oe(),s=L(a);re(s,t,"default",{}),_(o,a)}),_(e,n)}const Hl=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
|
|
93
99
|
xmlns="http://www.w3.org/2000/svg">
|
|
94
100
|
<g opacity="0.5" clip-path="url(#clip0_344_3390)">
|
|
95
101
|
<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 +107,37 @@
|
|
|
101
107
|
</clipPath>
|
|
102
108
|
</defs>
|
|
103
109
|
</svg>
|
|
104
|
-
`;var
|
|
110
|
+
`;var Vl=I('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function Gl(e){var t=Vl(),r=T(t);Pt(r,()=>Hl),_(e,t)}var $l=I('<div class="svelte-1ny4y2s">Sandbox</div>');const Yl={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 zl(e){q(e,Yl);var t=$l();_(e,t)}var Kl=I('<div class="rcb-ui-layout svelte-wuqzav"><!></div>');const Ql={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
111
|
|
|
106
|
-
@media screen and (max-width: 960px) {.rcb-ui-layout.svelte-
|
|
112
|
+
@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
113
|
}
|
|
108
114
|
|
|
109
|
-
@media screen and (max-width: 960px) and (max-height: 960px) {.rcb-ui-layout.svelte-
|
|
110
|
-
}`};function
|
|
111
|
-
Cantarell, "Open Sans", "Helvetica Neue", sans-serif;}`};function
|
|
115
|
+
@media screen and (max-width: 960px) and (max-height: 960px) {.rcb-ui-layout.svelte-wuqzav {overflow-y:scroll;justify-content:flex-start;}
|
|
116
|
+
}`};function Wl(e,t){q(e,Ql);let r=m(t,"style",8,"");var n=Kl(),i=T(n);re(i,t,"default",{}),F(()=>Q(n,"style",r())),_(e,n)}var Zl=I('<div class="rcb-ui-container svelte-1sfb5if"><!></div>');const Xl={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,
|
|
117
|
+
Cantarell, "Open Sans", "Helvetica Neue", sans-serif;}`};function Jl(e,t){q(e,Xl);let r=m(t,"style",8,"");var n=Zl(),i=T(n);re(i,t,"default",{}),F(()=>Q(n,"style",r())),_(e,n)}var ec=I("<!> <!>",1),tc=I('<div class="rcb-ui-aside svelte-17dr902"><!></div>');const rc={hash:"svelte-17dr902",code:`.rcb-ui-aside.svelte-17dr902 {margin-right:16px;flex:320px 1 0;max-width:480px;}
|
|
112
118
|
|
|
113
119
|
@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
|
|
120
|
+
}`};function nc(e,t){W(t,!1),q(e,rc);let r=m(t,"brandingAppearance",8,void 0),n=new rn(r()).productInfoStyleVars;Me();var i=tc();Q(i,"style",n);var o=T(i);zi(o,{children:(a,s)=>{var l=ec(),c=L(l);re(c,t,"header",{});var u=D(c,2);re(u,t,"default",{}),_(a,l)},$$slots:{default:!0}}),_(e,i),Z()}var ic=I("<!> <!>",1),oc=I('<div class="rcb-ui-main svelte-vpgys"><!></div>');const ac={hash:"svelte-vpgys",code:`.rcb-ui-main.svelte-vpgys {flex:480px 1 0;max-width:640px;}
|
|
115
121
|
|
|
116
122
|
@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?`¤cy=${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:
|
|
123
|
+
}`};function sc(e,t){W(t,!1),q(e,ac);let r=m(t,"brandingAppearance",8,void 0),n=new rn(r()).formStyleVars;Me();var i=oc();Q(i,"style",n);var o=T(i);zi(o,{style:"min-height: 360px;",children:(a,s)=>{var l=ic(),c=L(l);re(c,t,"header",{});var u=D(c,2);re(u,t,"default",{}),_(a,l)},$$slots:{default:!0}}),_(e,i),Z()}var lc=I("<!> <!>",1),cc=I("<!> <!> <!> <!> <!> <!> <!>",1),uc=I("<!> <!>",1);function fc(e,t){W(t,!1);let r=m(t,"asModal",8,!0),n=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),u=m(t,"onClose",8),f=m(t,"purchases",8),d=m(t,"purchaseOperationHelper",8),g=_e(""),h=_e(null),b=_e(null),x=_e(null);const y=o().rcBillingProduct.identifier??null,w=o().rcBillingProduct.defaultPurchaseOption,k=a()?a():w;let p=_e("present-offer"),P=null;const C=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];pr(async()=>{var R;if(N(h,o().rcBillingProduct),N(g,Yi((R=s())==null?void 0:R.appearance)),v(p)==="present-offer"){n()?A():N(p,"needs-auth-info");return}});const V=()=>{u()()},A=()=>{if(y===null){X(new te(ge.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else v(p)==="present-offer"&&N(p,"loading");if(!n()){X(new te(ge.MissingEmailError));return}d().startPurchase(i(),y,k,n(),o().rcBillingProduct.presentedOfferingContext).then(R=>{if(R.next_action==="collect_payment_info"){N(x,null),N(p,"needs-payment-info"),N(b,R);return}if(R.next_action==="completed"){N(x,null),N(p,"success");return}}).catch(R=>{X(R)})},z=R=>{if(v(p)==="needs-auth-info"){R&&(n(R.email),N(p,"processing-auth-info")),A();return}if(v(p)==="needs-payment-info"){N(p,"polling-purchase-status"),d().pollCurrentPurchaseForCompletion().then($=>{N(p,"success"),P=$.redemptionInfo}).catch($=>{X($)});return}if(v(p)==="success"||v(p)==="error"){l()(P);return}N(p,"success")},X=R=>{if(v(p)==="processing-auth-info"&&R.isRecoverable()){N(x,R),N(p,"needs-auth-info");return}N(x,R),N(p,"error")},Ie=()=>{c()(v(x)??new te(ge.UnknownError,"Unknown error without state set."))};Me(),Jl(e,{children:(R,$)=>{jl(R,{get condition(){return r()},children:(Ae,We)=>{Wl(Ae,{get style(){return v(g)},children:(qe,gt)=>{var De=uc(),Nt=L(De);j(Nt,()=>C.includes(v(p)),Fe=>{var Xe=fe(()=>{var je;return(je=s())==null?void 0:je.appearance});nc(Fe,{get brandingAppearance(){return v(Xe)},children:(je,ht)=>{var Je=oe(),et=L(Je);j(et,()=>v(h)&&k,He=>{var tt=fe(()=>{var me;return(me=s())==null?void 0:me.appearance});Pi(He,{get productDetails(){return v(h)},get brandingAppearance(){return v(tt)},purchaseOption:k})}),_(je,Je)},$$slots:{default:!0,header:(je,ht)=>{en(je,{slot:"header",children:(Je,et)=>{var He=lc(),tt=L(He);Ni(tt,{get brandingInfo(){return s()}});var me=D(tt,2);j(me,()=>f().isSandbox(),Oe=>{zl(Oe)},Oe=>{Gl(Oe)}),_(Je,He)},$$slots:{default:!0}})}}})});var Ze=D(Nt,2),Ar=fe(()=>{var Fe;return(Fe=s())==null?void 0:Fe.appearance});sc(Ze,{get brandingAppearance(){return v(Ar)},children:(Fe,Xe)=>{var je=cc(),ht=L(je);j(ht,()=>v(p)==="present-offer"&&v(h)&&k,Pe=>{Pi(Pe,{get productDetails(){return v(h)},purchaseOption:k})});var Je=D(ht,2);j(Je,()=>v(p)==="present-offer"&&!v(h),Pe=>{Wr(Pe)});var et=D(Je,2);j(et,()=>v(p)==="needs-auth-info"||v(p)==="processing-auth-info",Pe=>{var rr=fe(()=>v(p)==="processing-auth-info");Ul(Pe,{onContinue:z,onClose:V,get processing(){return v(rr)},get lastError(){return v(x)}})});var He=D(et,2);j(He,()=>v(b)&&(v(p)==="needs-payment-info"||v(p)==="polling-purchase-status")&&v(h)&&k,Pe=>{var rr=fe(()=>v(p)==="polling-purchase-status");Tl(Pe,{get paymentInfoCollectionMetadata(){return v(b)},onContinue:z,onClose:V,onError:X,get processing(){return v(rr)},get productDetails(){return v(h)},purchaseOptionToUse:k,get brandingInfo(){return s()}})});var tt=D(He,2);j(tt,()=>v(p)==="loading",Pe=>{Wr(Pe)});var me=D(tt,2);j(me,()=>v(p)==="error",Pe=>{var rr=fe(()=>v(x)??new te(ge.UnknownError,"Unknown error without state set.")),Du=fe(()=>{var uo;return(uo=s())==null?void 0:uo.seller_company_support_email});Us(Pe,{get brandingInfo(){return s()},get lastError(){return v(rr)},get supportEmail(){return v(Du)},get productDetails(){return v(h)},onContinue:Ie})});var Oe=D(me,2);j(Oe,()=>v(p)==="success",Pe=>{Fs(Pe,{get productDetails(){return v(h)},get brandingInfo(){return s()},onContinue:z})}),_(Fe,je)},$$slots:{default:!0}}),_(qe,De)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),Z()}function dc(e){return e.expires_date==null?!0:new Date(e.expires_date)>new Date}function vc(e,t,r,n){const i=t.product_identifier;if(i in r)return gc(e,t,r[i]);if(i in n)return hc(e,t,n[i]);throw new ne(ae.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function gc(e,t,r){return{identifier:e,isActive:dc(t),willRenew:bc(t,r),store:(r==null?void 0:r.store)??"unknown",latestPurchaseDate:new Date(t.purchase_date),originalPurchaseDate:new Date(t.purchase_date),expirationDate:Er(t.expires_date),productIdentifier:t.product_identifier,unsubscribeDetectedAt:Er(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:Er(r==null?void 0:r.billing_issues_detected_at),isSandbox:(r==null?void 0:r.is_sandbox)??!1,periodType:(r==null?void 0:r.period_type)??"normal"}}function hc(e,t,r){return{identifier:e,isActive:!0,willRenew:!1,store:r.store,latestPurchaseDate:new Date(t.purchase_date),originalPurchaseDate:new Date(r.original_purchase_date),expirationDate:null,productIdentifier:t.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:r.is_sandbox,periodType:"normal"}}function _c(e,t,r){const n={},i={};for(const o in e){const a=vc(o,e[o],t,r);n[o]=a,a.isActive&&(i[o]=a)}return{all:n,active:i}}function Er(e){return e==null?null:new Date(e)}function pc(e){const t=yc(e),r=e.subscriber,n=Ec(r.non_subscriptions);return{entitlements:_c(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:t,allPurchaseDatesByProduct:mc(e,n),activeSubscriptions:wc(t),managementURL:r.management_url,requestDate:new Date(e.request_date),firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Er(r.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id}}function bc(e,t){if(t==null)return!1;const r=t.store=="promotional",n=e.expires_date==null,i=t.unsubscribe_detected_at!=null,o=t.billing_issues_detected_at!=null;return!(r||n||i||o)}function mc(e,t){const r={};for(const n in e.subscriber.subscriptions){const i=e.subscriber.subscriptions[n];r[n]=new Date(i.purchase_date)}for(const n in t){const i=t[n].purchase_date;i==null?r[n]=null:r[n]=new Date(i)}return r}function yc(e){const t={};for(const r in e.subscriber.subscriptions){const n=e.subscriber.subscriptions[r];n.expires_date==null?t[r]=null:t[r]=new Date(n.expires_date)}return t}function wc(e){const t=new Set,r=new Date;for(const n in e){const i=e[n];(i==null||i>r)&&t.add(n)}return t}function Ec(e){const t={};for(const r in e){if(e[r].length===0)continue;const n=e[r].length;t[r]=e[r][n-1]}return t}const xc="0.13.1",Ic="https://api.revenuecat.com";var xr;(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"})(xr||(xr={}));function nn(e){return e?e.startsWith("rcb_sb_"):!1}async function At(e,t){const{apiKey:r,body:n,headers:i,httpConfig:o}=t,s=`${(o==null?void 0:o.proxyURL)??Ic}${e.urlPath()}`;try{const l=await fetch(s,{method:e.method,headers:Ac(r,i,o==null?void 0:o.additionalHeaders),body:kc(n)});return await Pc(l,e),await l.json()}catch(l){throw l instanceof TypeError?new ne(ae.NetworkError,Wt.getPublicMessage(ae.NetworkError),l.message):l}}async function Pc(e,t){const r=e.status;if(r>=xr.INTERNAL_SERVER_ERROR)on(t,r,await e.text());else if(r>=xr.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=Wt.convertCodeToBackendErrorCode(o);if(s==null)on(t,r,i,o);else throw ne.getForBackendError(s,a)}else on(t,r,i)}}function on(e,t,r,n){throw new ne(ae.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${t}. Body: ${r}.`,{backendErrorCode:n})}function kc(e){return e==null?null:JSON.stringify(e)}const Ki="Authorization",Qi="Content-Type",Wi="Accept",Zi="X-Platform",Xi="X-Version",Ji="X-Is-Sandbox",Tc=new Set([Ki,Qi,Wi,Zi,Xi,Ji]);function Ac(e,t,r){let n={[Ki]:`Bearer ${e}`,[Qi]:"application/json",[Wi]:"application/json",[Zi]:"web",[Xi]:xc,[Ji]:`${nn(e)}`};return t&&(n={...n,...t}),r&&(n={...r,...n}),n}const eo="/v1/subscribers",Ir="/rcbilling/v1";class Oc{constructor(t){B(this,"appUserId");B(this,"method","GET");B(this,"name","getOfferings");this.appUserId=t}urlPath(){const t=encodeURIComponent(this.appUserId);return`${eo}/${t}/offerings`}}class Nc{constructor(){B(this,"method","POST");B(this,"name","purchase")}urlPath(){return`${Ir}/purchase`}}class Sc{constructor(t,r,n){B(this,"method","GET");B(this,"name","getProducts");B(this,"appUserId");B(this,"productIds");B(this,"currency");this.appUserId=t,this.productIds=r,this.currency=n}urlPath(){const t=encodeURIComponent(this.appUserId),r=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`¤cy=${this.currency}`:"";return`${Ir}/subscribers/${t}/products?id=${r}${n}`}}class Rc{constructor(t){B(this,"method","GET");B(this,"name","getCustomerInfo");B(this,"appUserId");this.appUserId=t}urlPath(){const t=encodeURIComponent(this.appUserId);return`${eo}/${t}`}}class Mc{constructor(){B(this,"method","GET");B(this,"name","getBrandingInfo")}urlPath(){return`${Ir}/branding`}}class Dc{constructor(t){B(this,"method","GET");B(this,"name","getCheckoutStatus");B(this,"operationSessionId");this.operationSessionId=t}urlPath(){return`${Ir}/checkout/${this.operationSessionId}`}}const an={};class Uc{constructor(t,r=an){B(this,"API_KEY");B(this,"httpConfig");this.API_KEY=t,this.httpConfig=r}async getOfferings(t){return await At(new Oc(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(t){return await At(new Rc(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(t,r,n){return await At(new Sc(t,r,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await At(new Mc,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(t,r,n,i,o){const a={app_user_id:t,product_id:r,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 At(new Nc,{apiKey:this.API_KEY,body:a,httpConfig:this.httpConfig})}async getCheckoutStatus(t){return await At(new Dc(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Lc(e){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(e))throw new ne(ae.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function Cc(e){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new ne(ae.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 Bc(e){if(e!=null&&e.endsWith("/"))throw new ne(ae.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function qc(e){if(e){for(const t in e)if(Tc.has(t))throw new ne(ae.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var sn=(e=>(e.Current="current",e))(sn||{});function Fc(e,t){async function r(...n){return await this.preload(),await e.call(this,...n)}return r}const to=(e,t)=>({...e,rcBillingProduct:{...e.rcBillingProduct,presentedOfferingContext:{...e.rcBillingProduct.presentedOfferingContext,placementIdentifier:t}}}),vt=(e,t)=>e==null?null:to(e,t),jc=(e,t,r)=>{const n=e.offering_ids_by_placement??null;if(n==null)return null;const i=e.fallback_offering_id??null;let o;if(r in n){const s=n[r]??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,to(l,r)]));return{...o,packagesById:a,availablePackages:Object.values(a),weekly:vt(o.weekly,r),monthly:vt(o.monthly,r),twoMonth:vt(o.twoMonth,r),threeMonth:vt(o.threeMonth,r),sixMonth:vt(o.sixMonth,r),annual:vt(o.annual,r),lifetime:vt(o.lifetime,r)}};function Hc(e,t){const r={};t.product_details.forEach(o=>{r[o.identifier]=o});const n={};e.offerings.forEach(o=>{const a=o.identifier===e.current_offering_id,s=Ha(a,o,r,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&&Y.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}}var ln;(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"})(ln||(ln={}));var cn;(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"})(cn||(cn={}));var un;(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"})(un||(un={}));var fn;(function(e){e.vertical="column",e.horizontal="row"})(fn||(fn={}));var dn;(function(e){e.top="flex-start",e.leading="flex-start",e.center="center",e.bottom="flex-end",e.trailing="flex-end"})(dn||(dn={}));var vn;(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"})(vn||(vn={}));const Ot=[];function Vc(e,t){return{subscribe:Gc(e,t).subscribe}}function Gc(e,t=$e){let r=null;const n=new Set;function i(s){if(kn(e,s)&&(e=s,r)){const l=!Ot.length;for(const c of n)c[1](),Ot.push(c,e);if(l){for(let c=0;c<Ot.length;c+=2)Ot[c][0](Ot[c+1]);Ot.length=0}}}function o(s){i(s(e))}function a(s,l=$e){const c=[s,l];return n.add(c),n.size===1&&(r=t(i,o)||$e),s(e),()=>{n.delete(c),n.size===0&&r&&(r(),r=null)}}return{set:i,update:o,subscribe:a}}const $c=Vc(!1,e=>{if(typeof window<"u"){const t=window.matchMedia("(prefers-color-scheme: dark)");e(t.matches);const r=n=>e(n.matches);return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}return()=>{}}),Yc=(e,t)=>{var r;(r=t.onclick)==null||r.call(t)};var zc=I("<button><!></button>");const Kc={hash:"svelte-g3k3fu",code:"button.svelte-g3k3fu {border:none;cursor:pointer;background:transparent;padding:0;width:100%;display:flex;align-items:center;justify-content:center;}"};function ro(e,t){W(t,!0),q(e,Kc);var r=zc();r.__click=[Yc,t];var n=T(r);si(n,()=>t.children??$e),F(()=>{zr(r,`${t.class??""} svelte-g3k3fu`),r.disabled=!t.onclick,Q(r,"style",t.style)}),_(e,r),Z()}Yr(["click"]);function no(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 Qc(e){return ln[e]}function Pr({colorMap:e,colorMode:t="light",fallback:r="FFFFFF"}){const n=e==null?void 0:e[t];if(!n)return r;let i="";switch(n.type){case"hex":case"alias":return n.value??r;case"linear":return i=(n.points||[]).map(o=>`${o.color} ${o.percent}%`).join(", "),`linear-gradient(${n.degrees}deg, ${i})`;case"radial":return i=(n.points||[]).map(o=>`${o.color} ${o.percent}%`).join(", "),`radial-gradient(${i})`}return r}function Wc(e,t="light"){const r=Pr({colorMap:e.color,colorMode:t});return`${e.width}px solid ${r}`}function io(e){return`${e.top_leading}px ${e.top_trailing}px ${e.bottom_trailing}px ${e.bottom_leading}px`}function oo({backgroundColor:e,border:t,margin:r,padding:n,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":"transparent","--text-color":"#000000","--border":"none","--border-radius":"0px","--shadow":"none"};return n&&Object.assign(l,no(n,"padding")),r&&Object.assign(l,no(r,"margin")),e&&(l["--background"]=Pr({colorMap:e,colorMode:o,fallback:"transparent"})),i&&(l["--text-color"]=Pr({colorMap:i,colorMode:o,fallback:"#000000"})),t&&(l["--border"]=Wc(t,o)),(a==null?void 0:a.type)==="rectangle"&&a.corners&&(l["--border-radius"]=io(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
|
|
124
|
+
${Pr({colorMap:s.color,colorMode:o,fallback:"#000000"})}`),l}function gn(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 r=t(e.width),n=t(e.height),i=e.width.type==="fill"||e.height.type==="fill";return{"--width":r,"--height":n,"--flex":i?"unset":"0 1 auto"}}function Zc(e,t){return t?{"--background":`linear-gradient(${t.map(r=>{var n;return(n=r[e])==null?void 0:n.value}).join(", ")})`}:{"--background":"none"}}const Xc=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"]=io(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 Jc(e){const t={"--direction":"initial","--alignment":"initial","--distribution":"initial"};return e.type==="zlayer"||(t["--direction"]=fn[e.type],t["--alignment"]=dn[e.alignment],e.distribution&&(t["--distribution"]=vn[e.distribution])),t}function eu(e){const{font_size:t,horizontal_alignment:r,font_weight:n,font_name:i}=e,o={"--text-align":"initial","--font-weight":400,"--font-size":"initial","--font-family":"sans-serif"};return o["--text-align"]=r,o["--font-weight"]=cn[n],o["--font-size"]=un[t],o["--font-family"]=i||"sans-serif",o}function kr(e){return Object.entries(e).map(([t,r])=>`${t}: ${r}`).join("; ")}function ao(e,t,r,n){const i=(n[r]||{})[e];return(n[t]||{})[e]?n[t][e]:i}function tu(e){const t=n=>{if(n.type==="package"&&n.is_selected_by_default)return n;if(n.components)for(let i of n.components){const o=t(i);if(o)return o}if(n.stack!==void 0){const i=t(n.stack);if(i)return i}},r=t(e.components_config.base.stack);if(r!==void 0)return r.package_id}const ru=e=>{const{background_color:t,margin:r,padding:n,spacing:i,size:o,border:a,shape:s,colorMode:l,shadow:c,dimension:u}=e,f=oo({backgroundColor:t,margin:r,padding:n,border:a,colorMode:l,shape:s,shadow:c}),d=Jc(u);return{...gn(o),...d,...f,"--spacing":`${i||0}px`}};var nu=I('<div class="stack svelte-hkx1fg"></div>');const iu={hash:"svelte-hkx1fg",code:".stack.svelte-hkx1fg {box-sizing:border-box;display:flex;flex-direction:var(--direction, unset);width:var(--width, unset);height:var(--height, unset);gap:var(--spacing, 0);background:var(--background, none);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);}"};function tr(e,t){W(t,!0),q(e,iu);const r=Kr(t,["$$slots","$$events","$$legacy","id","components","labels","onAction","purchaseState","variableDictionary"]),n=ee(()=>kr(ru({id:t.id,components:t.components,labels:t.labels,onAction:t.onAction,purchaseState:t.purchaseState,...r})));var i=nu();oi(i,21,()=>t.components,ii,(o,a)=>{hn(o,{get nodeData(){return v(a)},get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary}})}),F(()=>{Q(i,"id",t.id),Q(i,"style",v(n))}),_(e,i),Z()}function ou(e,t){W(t,!0),ro(e,{onclick:()=>{t.onAction&&t.onAction(t.action)},children:(n,i)=>{tr(n,Qt(()=>t.stack,{get labels(){return t.labels},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary}}))},$$slots:{default:!0}}),Z()}const au=e=>{const{font_size:t="body_m",color:r={dark:{type:"hex",value:"#000000"},light:{type:"hex",value:"#000000"}},background_color:n={dark:{type:"hex",value:"#FFFFFF"},light:{type:"hex",value:"#FFFFFF"}},padding:i,margin:o,colorMode:a,size:s}=e,l=Qc(t),c=eu(e),u=oo({backgroundColor:n,textColor:r,margin:o,padding:i,colorMode:a}),f=gn(s);return{textStyles:{...c,...u,...f},tagToRender:l}},su={hash:"svelte-9lrpkv",code:".text-block.svelte-9lrpkv {display:block;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:var(--background, none);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 lu(e,t){W(t,!0),q(e,su);const r=m(t,"styleVariables",3,""),n=m(t,"component",3,"p");var i=oe(),o=L(i);li(o,n,!1,(a,s)=>{let l;F(()=>l=ci(a,l,{id:t.id,style:r(),class:"text-block"},"svelte-9lrpkv",a.namespaceURI===Dt,a.nodeName.includes("-")));var c=oe(),u=L(c);si(u,()=>t.children??$e),_(s,c)}),_(e,i),Z()}const cu=["product_name","price","price_per_period","price_per_period_full","total_price_and_per_month","total_price_and_per_month_full","sub_price_per_month","sub_price_per_week","sub_duration","sub_duration_in_months","sub_period","sub_period_length","sub_period_abbreviated","sub_offer_duration","sub_offer_duration_2","sub_offer_price","sub_offer_price_2","sub_relative_discount"],uu=({value:e="",variableDictionary:t})=>t?cu.reduce((r,n)=>{var o;return r.replaceAll(`{{ ${n} }}`,((o=t[n])==null?void 0:o.toString())||"N/A")},e):e;function fu(e,t){W(t,!0);const r=Kr(t,["$$slots","$$events","$$legacy","id","labels","text_lid","purchaseState","variableDictionary"]),n=ee(()=>au({id:t.id,labels:t.labels,text_lid:t.text_lid,purchaseState:t.purchaseState,...r})),i=ee(()=>v(n).tagToRender),o=ee(()=>v(n).textStyles),a=ee(()=>kr(v(o))),s=ee(()=>ao(t.text_lid,t.purchaseState.locale,t.purchaseState.defaultLocale,t.labels)),l=ee(()=>uu({value:v(s),variableDictionary:t.variableDictionary}));lu(e,{get styleVariables(){return v(a)},get component(){return v(i)},get id(){return t.id},children:(c,u)=>{var f=at();F(()=>de(f,v(l))),_(c,f)},$$slots:{default:!0}}),Z()}function hn(e,t){W(t,!0);const r=Aa(),n=()=>Ta($c,"$prefersDarkMode",r),i={text:fu,stack:tr,image:bu,button:ou,purchase_button:yu,package:Iu,footer:ku},o=ee(()=>i[t.nodeData.type]);var a=oe(),s=L(a);ba(s,()=>v(o),(l,c)=>{c(l,Qt(()=>t.nodeData||{},{get labels(){return t.labels},get prefersDarkMode(){return n()},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary},children:(u,f)=>{var d=oe(),g=L(d);oi(g,17,()=>t.nodeData.components,ii,(h,b)=>{hn(h,{get nodeData(){return v(b)},get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary}})}),_(u,d)},$$slots:{default:!0}}))}),_(e,a),Z()}var du=I('<div class="paywall svelte-1f98y3q"><!></div>');const vu={hash:"svelte-1f98y3q",code:`
|
|
125
|
+
/* 1. Use a more-intuitive box-sizing model */.svelte-1f98y3q,
|
|
126
|
+
.svelte-1f98y3q::before,
|
|
127
|
+
.svelte-1f98y3q::after {box-sizing:border-box;}
|
|
128
|
+
|
|
129
|
+
/* 2. Remove default margin */.svelte-1f98y3q {margin:0;}
|
|
130
|
+
|
|
131
|
+
/* 5. Improve media defaults */
|
|
132
|
+
|
|
133
|
+
/* 6. Inherit fonts for form controls */
|
|
134
|
+
|
|
135
|
+
/* 7. Avoid text overflows */
|
|
136
|
+
|
|
137
|
+
/* 8. Improve line wrapping */
|
|
138
|
+
|
|
139
|
+
/*
|
|
140
|
+
9. Create a root stacking context
|
|
141
|
+
*/`};function gu(e,t){W(t,!0),q(e,vu);const r=m(t,"variablesPerPackage",19,()=>({}));let n=Ke({selectedPackageId:tu(t.paywallData),locale:t.selectedLocale||t.paywallData.default_locale,defaultLocale:t.paywallData.default_locale,variablesPerPackage:r()}),i=Bo(Ke(r()[n.selectedPackageId||""]));const o=(g,h)=>{var b;(b=t.onRestorePurchasesClicked)==null||b.call(t)},a=(g,h)=>{var b;(b=t.onBackClicked)==null||b.call(t)},s=(g,h)=>{var x,y;if(g.destination==="customer_center"&&((x=t.onVisitCustomerCenterClicked)==null||x.call(t)),!g.url)return;const b=ao(g.url.url_lid,n.locale,n.defaultLocale,t.paywallData.components_localizations);b&&((y=t.onNavigateToUrlClicked)==null||y.call(t,b))},l=(g,h)=>{n.selectedPackageId=h==null?void 0:h.packageId,h!=null&&h.packageId&&N(i,Ke(r()[h.packageId]))},c=(g,h)=>{var b;n.selectedPackageId!==void 0&&((b=t.onPurchaseClicked)==null||b.call(t,n.selectedPackageId))},u=(g,h)=>{switch(g.type){case"select_package":l(g,h);break;case"navigate_to":s(g);break;case"navigate_back":a();break;case"restore_purchases":o();break;case"purchase":c();break}};var f=du(),d=T(f);hn(d,{onAction:u,get nodeData(){return t.paywallData.components_config.base.stack},get labels(){return t.paywallData.components_localizations},get purchaseState(){return n},get variableDictionary(){return v(i)}}),_(e,f),Z()}const hu=e=>{const{gradient_colors:t,colorMode:r,mask_shape:n,size:i,max_height:o,override_source_lid:a}=e,s=Zc(r,t),l=gn(i),c=Xc(n);return{imageStyles:{...l,...c},gradientStyles:s}};var _u=I('<div class="image-container svelte-1bktrru"><img class="image svelte-1bktrru" alt=""> <span class="image-overlay svelte-1bktrru"></span></div>');const pu={hash:"svelte-1bktrru",code:".image-container.svelte-1bktrru {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:var(--flex, 1 0 auto);}.image.svelte-1bktrru {width:100%;height:100%;object-fit:cover;display:block;}.image-overlay.svelte-1bktrru {position:absolute;inset:0;background:var(--background, none);}"};function bu(e,t){W(t,!0),q(e,pu);const r=Kr(t,["$$slots","$$events","$$legacy","id","colorMode","source"]),n=ee(()=>hu({id:t.id,colorMode:t.colorMode,source:t.source,...r})),i=ee(()=>v(n).gradientStyles),o=ee(()=>v(n).imageStyles),a=ee(()=>kr(v(i))),s=ee(()=>kr(v(o)));var l=_u(),c=T(l),u=D(c,2);F(()=>{var f;Q(l,"id",`image-container-${t.id}`),Q(l,"style",v(s)),Q(c,"src",(f=t.source[t.colorMode||"light"])==null?void 0:f.original),Q(c,"id",t.id),Q(u,"style",v(a))}),_(e,l),Z()}const mu={hash:"svelte-raczc6",code:""};function yu(e,t){W(t,!0),q(e,mu),ro(e,{onclick:()=>{t.onAction&&t.onAction({type:"purchase"})},class:"purchase-button",children:(n,i)=>{tr(n,Qt(()=>t.stack,{get labels(){return t.labels},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary}}))},$$slots:{default:!0}}),Z()}const wu=(e,t)=>{e.preventDefault(),e.stopPropagation(),t.onAction&&t.onAction({type:"select_package"},{packageId:t.package_id})};var Eu=I('<button class="package svelte-128m8vw"><!></button>');const xu={hash:"svelte-128m8vw",code:".package.svelte-128m8vw {width:100%;display:flex;margin:0;padding:0;background:unset;border:unset;text-align:unset;}"};function Iu(e,t){W(t,!0),q(e,xu);const r=ee(()=>{var a;return((a=t.purchaseState.variablesPerPackage)==null?void 0:a[t.package_id])||t.variableDictionary}),n=ee(()=>{var a;return((a=t.purchaseState)==null?void 0:a.selectedPackageId)===t.package_id});var i=Eu();i.__click=[wu,t];var o=T(i);tr(o,Qt(()=>t.stack,{get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get variableDictionary(){return v(r)}})),F(()=>{Q(i,"id",t.id),ya(i,"selected",v(n))}),_(e,i),Z()}Yr(["click"]);var Pu=I('<div class="footer"><!></div>');function ku(e,t){var r=Pu(),n=T(r);tr(n,Qt(()=>t.stack,{get labels(){return t.labels},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary}})),F(()=>Q(r,"id",t.id)),_(e,r)}const Tu=1000001;function Au(e){switch(e.rcBillingProduct.productType){case Te.Subscription:return e.rcBillingProduct.defaultSubscriptionOption;case(Te.Consumable||Te.NonConsumable):return e.rcBillingProduct.defaultNonSubscriptionOption}}var Tr=(e=>(e.month="mo",e.year="yr",e.week="wk",e.day="d",e))(Tr||{});function so(e,t,r=!1){var n;return`${e}/${(n=t.base.period)==null?void 0:n.number}${r?t.base.period.unit:Tr[t.base.period.unit]}`}function Ou(e){if(e.unit==="week"||e.unit==="day")return`${e.number} ${e.unit}`;if(e.unit==="month")return`${e.number>1?e.number+"s":e.number} ${e.unit}`;if(e.unit==="year")return`${e.number*12} ${e.unit}`}function Nu({price:e,period:t,selectedLocale:r}){const n=ve(e.amountMicros,e.currency,r);return t?t.unit==="year"?ve(e.amountMicros/12/4,e.currency,r):t.unit==="month"||t.unit==="week"&&t.number>1?ve(e.amountMicros/t.number,e.currency,r):t.unit==="day"?ve(e.amountMicros*7/t.number,e.currency,r):n:n}function Su({price:e,period:t,selectedLocale:r}){const n=ve(e.amountMicros,e.currency,r);return!t||!t.number?n:t.unit==="year"?ve(e.amountMicros/12,e.currency,r):t.unit==="month"&&t.number>1?ve(e.amountMicros/t.number,e.currency,r):t.unit==="week"?ve(e.amountMicros*4/t.number,e.currency,r):t.unit==="day"?ve(e.amountMicros*30/t.number,e.currency,r):n}function lo({price:e,period:t,full:r=!1,selectedLocale:n}){if(!t||!t.number)return e.formattedPrice;let i="";const o=r?"month":"mo",a=r?t.unit:Tr[t.unit];return t.unit==="year"?(i=ve(e.amountMicros/12,e.currency,n),`${e.formattedPrice}/${t.number}${a}($${i}/(${o})`):t.unit==="month"?(i=ve(e.amountMicros/t.number,e.currency,n),t.number>1?`${e.formattedPrice}/${t.number}${a}(${i}/${o})`:`${e.formattedPrice}`):t.unit==="week"?(i=ve(e.amountMicros*4/t.number,e.currency,n),`${e.formattedPrice}/${t.number}${a}(${i}/${o})`):t.unit==="day"?(i=ve(e.amountMicros*30/t.number,e.currency,n),`${e.formattedPrice}/${t.number}${a}(${i}/${o})`):e.formattedPrice}function Ru(e,t){const r=e.availablePackages,n=r.reduce((o,a)=>o.rcBillingProduct.currentPrice.amountMicros>a.rcBillingProduct.currentPrice.amountMicros?o:a);return r.reduce((o,a)=>(o[a.identifier]=Mu(a,n,t),o),{})}function Mu(e,t,r){var l;const n=e.rcBillingProduct,i=n.currentPrice.formattedPrice,o=Au(e),a=n.productType,s={product_name:n.title,price:i,price_per_period:"",price_per_period_full:"",total_price_and_per_month:"",total_price_and_per_month_full:"",sub_price_per_month:"",sub_price_per_week:"",sub_duration:"",sub_duration_in_months:"",sub_period:"",sub_period_length:"",sub_period_abbreviated:"",sub_offer_duration:void 0,sub_offer_duration_2:void 0,sub_offer_price:void 0,sub_offer_price_2:void 0,sub_relative_discount:""};if(a===Te.Subscription&&o){const c=so(i,o);s.price_per_period=c,s.price_per_period_full=so(i,o,!0),s.total_price_and_per_month=lo({price:n.currentPrice,period:o.base.period,selectedLocale:r}),s.total_price_and_per_month_full=lo({price:n.currentPrice,period:o.base.period,full:!0,selectedLocale:r}),s.sub_price_per_month=Su({price:n.currentPrice,period:o.base.period,selectedLocale:r}),s.sub_price_per_week=Nu({price:n.currentPrice,period:o.base.period,selectedLocale:r}),s.sub_duration=wi(o.base.period),s.sub_duration_in_months=Ou(o.base.period),s.sub_period=yi(o.base.period),s.sub_period_length=`${(l=o.base.period)==null?void 0:l.unit}`,s.sub_period_abbreviated=`${Tr[o.base.period.unit]}`;const u=n.currentPrice.amountMicros,f=t.rcBillingProduct.currentPrice.amountMicros,d=((f-u)*100/f).toFixed(0);s.sub_relative_discount=u===f?"":`${d}% off`}return(a===Te.NonConsumable||a===Te.Consumable)&&o&&(s.price=i,s.price_per_period=i,s.price_per_period_full=i,s.total_price_and_per_month=i,s.sub_price_per_month=i,s.sub_duration="Lifetime",s.sub_duration_in_months="Lifetime",s.sub_period="Lifetime",s.sub_price_per_week=void 0,s.sub_relative_discount=void 0,s.price_per_period_full=i,s.total_price_and_per_month_full=i,s.sub_period_length=void 0,s.sub_period_abbreviated=void 0),s}co=[Fc];const be=class be{constructor(t,r,n=an){mo(pn,5,this);B(this,"_API_KEY");B(this,"_appUserId");B(this,"_brandingInfo",null);B(this,"_loadingResourcesPromise",null);B(this,"backend");B(this,"purchaseOperationHelper");this._API_KEY=t,this._appUserId=r,nn(t)&&Y.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new Uc(this._API_KEY,n),this.purchaseOperationHelper=new os(this.backend)}static setLogLevel(t){Y.setLogLevel(t)}static getSharedInstance(){if(be.isConfigured())return be.instance;throw new Ti}static isConfigured(){return be.instance!==void 0}static configure(t,r,n=an){return be.instance!==void 0&&Y.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),Lc(t),Cc(r),Bc(n.proxyURL),qc(n.additionalHeaders),be.instance=new be(t,r,n),be.getSharedInstance()}async preload(){if(this.hasLoadedResources()){Y.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){Y.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.backend.getBrandingInfo().then(t=>{this._brandingInfo=t}).catch(t=>{let r=`${t}`;t instanceof ne&&(r=`${t.message}. ${t.underlyingErrorMessage?`Underlying error: ${t.underlyingErrorMessage}`:""}`),Y.errorLog(`Error fetching branding info: ${r}`)}).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 n=t.htmlTarget??document.getElementById("rcb-ui-pw-root");if(n===null){const f=document.createElement("div");f.id="rcb-ui-pw-root",f.className="rcb-ui-pw-root",f.style.zIndex=`${Tu}`,document.body.appendChild(f),n=f}if(n===null)throw new Error("Could not generate a mount point for the billing widget");const i=n;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 d=o.availablePackages.find(g=>g.identifier===f);if(d===void 0)throw new Error(`No package found for ${f}`);return this.purchase({rcPackage:d,htmlTarget:t.purchaseHtmlTarget,customerEmail:t.customerEmail})},s=f=>{var d;if(t.onNavigateToUrl){t.onNavigateToUrl(f);return}(d=window.open(f,"_blank"))==null||d.focus()},l=()=>{},c=()=>{if(t.onVisitCustomerCenter){t.onVisitCustomerCenter();return}},u=t.selectedLocale||navigator.language;return new Promise((f,d)=>{ri(gu,{target:i,props:{paywallData:o.paywall_components,selectedLocale:u,onNavigateToUrlClicked:s,onVisitCustomerCenterClicked:c,onBackClicked:()=>{if(t.onBack){t.onBack();return}i.innerHTML="",Y.debugLog("Purchase cancelled by user"),d(new ne(ae.UserCancelledError))},onRestorePurchasesClicked:l,onPurchaseClicked:g=>{a(g).then(h=>{f(h)}).catch(h=>d(h))},variablesPerPackage:Ru(o,u)}})})}async getOfferings(t){Ol(t==null?void 0:t.currency);const r=this._appUserId,n=await this.backend.getOfferings(r),i=(t==null?void 0:t.offeringIdentifier)===sn.Current?n.current_offering_id:t==null?void 0:t.offeringIdentifier;return i&&(n.offerings=n.offerings.filter(o=>o.identifier===i)),await this.getAllOfferings(n,r,t)}async getCurrentOfferingForPlacement(t,r){const n=this._appUserId,i=await this.backend.getOfferings(n),o=await this.getAllOfferings(i,n,r),a=i.placements??null;return a==null?null:jc(a,o.all,t)}async getAllOfferings(t,r,n){const i=t.offerings.flatMap(a=>a.packages).map(a=>a.platform_product_identifier),o=await this.backend.getProducts(r,i,n==null?void 0:n.currency);return this.logMissingProductIds(i,o.product_details),Hc(t,o)}async isEntitledTo(t){const r=await this.getCustomerInfo();return t in r.entitlements.active}purchasePackage(t,r,n){return this.purchase({rcPackage:t,customerEmail:r,htmlTarget:n})}purchase(t){const{rcPackage:r,purchaseOption:n,htmlTarget:i,customerEmail:o}=t;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,l=!i,c=this._appUserId;return Y.debugLog(`Presenting purchase form for package ${r.identifier}`),new Promise((u,f)=>{ri(fc,{target:s,props:{appUserId:c,rcPackage:r,purchaseOption:n,customerEmail:o,onFinished:async d=>{Y.debugLog("Purchase finished"),s.innerHTML="";const g={customerInfo:await this._getCustomerInfoForUserId(c),redemptionInfo:d};u(g)},onClose:()=>{s.innerHTML="",Y.debugLog("Purchase cancelled by user"),f(new ne(ae.UserCancelledError))},onError:d=>{s.innerHTML="",f(ne.getForPurchasesFlowError(d))},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,r){const n={};r.forEach(o=>n[o.identifier]=o);const i=[];t.forEach(o=>{n[o]===void 0&&i.push(o)}),i.length>0&&Y.debugLog(`Could not find product data for product ids:
|
|
118
142
|
${i.join()}.
|
|
119
|
-
Please check that your product configuration is correct.`)}isSandbox(){return
|
|
143
|
+
Please check that your product configuration is correct.`)}isSandbox(){return nn(this._API_KEY)}close(){be.instance===this?be.instance=void 0:Y.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(t){const r=await this.backend.getCustomerInfo(t);return pc(r)}static generateRevenueCatAnonymousAppUserId(){return`$RCAnonymousID:${crypto.randomUUID().replace(/-/g,"")}`}};pn=po(null),yo(pn,1,"purchase",co,be),mn(pn,be),B(be,"instance");let _n=be;E.ErrorCode=ae,E.LogLevel=pe,E.OfferingKeyword=sn,E.PackageType=Ei,E.ProductType=Te,E.Purchases=_n,E.PurchasesError=ne,E.UninitializedPurchasesError=Ti,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|