@revenuecat/purchases-js 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(Y,K){typeof exports=="object"&&typeof module<"u"?K(exports):typeof define=="function"&&define.amd?define(["exports"],K):(Y=typeof globalThis<"u"?globalThis:Y||self,K(Y.Purchases={}))})(this,function(Y){"use strict";var ol=Object.defineProperty;var cl=(Y,K,W)=>K in Y?ol(Y,K,{enumerable:!0,configurable:!0,writable:!0,value:W}):Y[K]=W;var T=(Y,K,W)=>(cl(Y,typeof K!="symbol"?K+"":K,W),W);function K(t){return t!=null}var W=(t=>(t.Unknown="unknown",t.Custom="custom",t.Lifetime="$rc_lifetime",t.Annual="$rc_annual",t.SixMonth="$rc_six_month",t.ThreeMonth="$rc_three_month",t.TwoMonth="$rc_two_month",t.Monthly="$rc_monthly",t.Weekly="$rc_weekly",t))(W||{});const Qt=(t,e)=>({identifier:t.identifier,displayName:t.title,currentPrice:t.current_price,normalPeriodDuration:t.normal_period_duration,presentedOfferingIdentifier:e}),vt=(t,e,r)=>{const n=r[e.platform_product_identifier];return n===void 0?null:{identifier:e.identifier,rcBillingProduct:Qt(n,t),packageType:Mt(e.identifier)}},Ge=(t,e)=>{const r=t.packages.map(i=>vt(t.identifier,i,e)).filter(K),n={};for(const i of r)i!=null&&(n[i.identifier]=i);return r.length==0?null:{identifier:t.identifier,serverDescription:t.description,metadata:t.metadata,packagesById:n,availablePackages:r,lifetimePackage:n.$rc_lifetime??null,annualPackage:n.$rc_annual??null,sixMonthPackage:n.$rc_six_month??null,threeMonthPackage:n.$rc_three_month??null,twoMonthPackage:n.$rc_two_month??null,monthlyPackage:n.$rc_monthly??null,weeklyPackage:n.$rc_weekly??null}};function Mt(t){switch(t){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 t.startsWith("$rc_")?"unknown":"custom"}}function y(){}function Pt(t,e){for(const r in e)t[r]=e[r];return t}function Ye(t){return t()}function He(){return Object.create(null)}function ae(t){t.forEach(Ye)}function ne(t){return typeof t=="function"}function R(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Ie;function q(t,e){return t===e?!0:(Ie||(Ie=document.createElement("a")),Ie.href=e,t===Ie.href)}function Ke(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function Tt(t,e){const r=Ke(t.srcset),n=Ke(e||"");return n.length===r.length&&n.every(([i,l],s)=>l===r[s][1]&&(q(r[s][0],i)||q(i,r[s][0])))}function Nt(t){return Object.keys(t).length===0}function j(t,e,r,n){if(t){const i=je(t,e,r,n);return t[0](i)}}function je(t,e,r,n){return t[1]&&n?Pt(r.ctx.slice(),t[1](n(e))):r.ctx}function J(t,e,r,n){if(t[2]&&n){const i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){const l=[],s=Math.max(e.dirty.length,i.length);for(let o=0;o<s;o+=1)l[o]=e.dirty[o]|i[o];return l}return e.dirty|i}return e.dirty}function x(t,e,r,n,i,l){if(i){const s=je(e,r,n,l);t.p(s,i)}}function V(t){if(t.ctx.length>32){const e=[],r=t.ctx.length/32;for(let n=0;n<r;n++)e[n]=-1;return e}return-1}function ue(t){return t??""}function v(t,e){t.appendChild(e)}function O(t,e,r){const n=Rt(t);if(!n.getElementById(e)){const i=$("style");i.id=e,i.textContent=r,Ct(n,i)}}function Rt(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Ct(t,e){return v(t.head||t,e),e.sheet}function A(t,e,r){t.insertBefore(e,r||null)}function m(t){t.parentNode&&t.parentNode.removeChild(t)}function $(t){return document.createElement(t)}function L(t){return document.createTextNode(t)}function P(){return L(" ")}function Z(){return L("")}function fe(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function Je(t){return function(e){return e.preventDefault(),t.call(this,e)}}function h(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}const Ut=["width","height"];function Ot(t,e){const r=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:r[n]&&r[n].set&&Ut.indexOf(n)===-1?t[n]=e[n]:h(t,n,e[n])}function St(t,e){Object.keys(e).forEach(r=>{Lt(t,r,e[r])})}function Lt(t,e,r){const n=e.toLowerCase();n in t?t[n]=typeof t[n]=="boolean"&&r===""?!0:r:e in t?t[e]=typeof t[e]=="boolean"&&r===""?!0:r:h(t,e,r)}function Ft(t){return/-/.test(t)?St:Ot}function Gt(t){return Array.from(t.childNodes)}function re(t,e){e=""+e,t.data!==e&&(t.data=e)}function xe(t,e){t.value=e??""}function Yt(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let de;function me(t){de=t}function we(){if(!de)throw new Error("Function called outside component initialization");return de}function be(t){we().$$.on_mount.push(t)}function Ht(){const t=we();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const l=Yt(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,l)}),!l.defaultPrevented}return!0}}function Kt(t,e){return we().$$.context.set(t,e),e}function jt(t){return we().$$.context.get(t)}function Ve(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const ie=[],$e=[];let le=[];const Ce=[],Jt=Promise.resolve();let Ue=!1;function xt(){Ue||(Ue=!0,Jt.then(qe))}function Oe(t){le.push(t)}function Vt(t){Ce.push(t)}const Se=new Set;let se=0;function qe(){if(se!==0)return;const t=de;do{try{for(;se<ie.length;){const e=ie[se];se++,me(e),qt(e.$$)}}catch(e){throw ie.length=0,se=0,e}for(me(null),ie.length=0,se=0;$e.length;)$e.pop()();for(let e=0;e<le.length;e+=1){const r=le[e];Se.has(r)||(Se.add(r),r())}le.length=0}while(ie.length);for(;Ce.length;)Ce.pop()();Ue=!1,Se.clear(),me(t)}function qt(t){if(t.fragment!==null){t.update(),ae(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Oe)}}function Wt(t){const e=[],r=[];le.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),le=e}const ke=new Set;let ee;function F(){ee={r:0,c:[],p:ee}}function G(){ee.r||ae(ee.c),ee=ee.p}function a(t,e){t&&t.i&&(ke.delete(t),t.i(e))}function f(t,e,r,n){if(t&&t.o){if(ke.has(t))return;ke.add(t),ee.c.push(()=>{ke.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function zt(t,e,r){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function b(t){t&&t.c()}function E(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),Oe(()=>{const l=t.$$.on_mount.map(Ye).filter(ne);t.$$.on_destroy?t.$$.on_destroy.push(...l):ae(l),t.$$.on_mount=[]}),i.forEach(Oe)}function I(t,e){const r=t.$$;r.fragment!==null&&(Wt(r.after_update),ae(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function Xt(t,e){t.$$.dirty[0]===-1&&(ie.push(t),xt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function C(t,e,r,n,i,l,s=null,o=[-1]){const c=de;me(t);const u=t.$$={fragment:null,ctx:[],props:l,update:y,not_equal:i,bound:He(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:He(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};s&&s(u.root);let _=!1;if(u.ctx=r?r(t,e.props||{},(g,k,...B)=>{const w=B.length?B[0]:k;return u.ctx&&i(u.ctx[g],u.ctx[g]=w)&&(!u.skip_bound&&u.bound[g]&&u.bound[g](w),_&&Xt(t,g)),k}):[],u.update(),_=!0,ae(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const g=Gt(e.target);u.fragment&&u.fragment.l(g),g.forEach(m)}else u.fragment&&u.fragment.c();e.intro&&a(t.$$.fragment),E(t,e.target,e.anchor),qe()}me(c)}class U{constructor(){T(this,"$$");T(this,"$$set")}$destroy(){I(this,1),this.$destroy=y}$on(e,r){if(!ne(r))return y;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const i=n.indexOf(r);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Nt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Zt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zt);function en(t){O(t,"svelte-8uc6s0","aside.svelte-8uc6s0{color:yellowgreen;font-weight:bold;text-transform:uppercase;padding:0.5rem 0;width:100%;font-size:0.75rem;border-radius:0.5rem}")}function tn(t){let e;return{c(){e=$("aside"),e.innerHTML="<span>Sandbox Mode</span>",h(e,"class","svelte-8uc6s0")},m(r,n){A(r,e,n)},p:y,i:y,o:y,d(r){r&&m(e)}}}class nn extends U{constructor(e){super(),C(this,e,null,tn,R,{},en)}}function rn(t){O(t,"svelte-ujomz3",".rcb-modal-section.svelte-ujomz3{padding:0.5rem 0rem;display:flex}.rcb-modal-section.svelte-ujomz3:last-of-type{padding:0}")}function Le(t){let e,r;const n=t[2].default,i=j(n,t,t[1],null);return{c(){e=$(t[0]),i&&i.c(),Ft(t[0])(e,{class:ue("rcb-modal-section")+" svelte-ujomz3"})},m(l,s){A(l,e,s),i&&i.m(e,null),r=!0},p(l,s){i&&i.p&&(!r||s&2)&&x(i,n,l,l[1],r?J(n,l[1],s,null):V(l[1]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&m(e),i&&i.d(l)}}}function ln(t){let e=t[0],r,n,i=t[0]&&Le(t);return{c(){i&&i.c(),r=Z()},m(l,s){i&&i.m(l,s),A(l,r,s),n=!0},p(l,[s]){l[0]?e?R(e,l[0])?(i.d(1),i=Le(l),e=l[0],i.c(),i.m(r.parentNode,r)):i.p(l,s):(i=Le(l),e=l[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=l[0])},i(l){n||(a(i,l),n=!0)},o(l){f(i,l),n=!1},d(l){l&&m(r),i&&i.d(l)}}}function sn(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:l="section"}=e;return t.$$set=s=>{"as"in s&&r(0,l=s.as),"$$scope"in s&&r(1,i=s.$$scope)},[l,i,n]}class z extends U{constructor(e){super(),C(this,e,sn,ln,R,{as:0},rn)}}const on={Y:"year",M:"month",W:"week",D:"day",H:"hour"},We=(t,e)=>{const r=t/100;return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(r)},ze=t=>{const e=t.slice(-1);return e==="D"?"daily":`${on[e]}ly`};function cn(t){O(t,"svelte-1oa6nu8",".rcb-pricing-info.svelte-1oa6nu8{display:flex;flex-direction:column;height:10rem;justify-content:flex-end}.rcb-product-price.svelte-1oa6nu8{font-size:1.5rem}.rcb-product-duration.svelte-1oa6nu8{opacity:0.6}")}function an(t){let e,r,n=t[0].displayName+"",i,l,s,o=t[0].currentPrice.currency+"",c,u=" ",_,g=We(t[0].currentPrice.amount,t[0].currentPrice.currency)+"",k,B,w,D,M=ze(t[0].normalPeriodDuration)+"",N;return{c(){e=$("div"),r=$("span"),i=L(n),l=P(),s=$("span"),c=L(o),_=L(u),k=L(g),B=P(),w=$("span"),D=L("Billed "),N=L(M),h(s,"class","rcb-product-price svelte-1oa6nu8"),h(w,"class","rcb-product-duration svelte-1oa6nu8"),h(e,"class","rcb-pricing-info svelte-1oa6nu8")},m(d,p){A(d,e,p),v(e,r),v(r,i),v(e,l),v(e,s),v(s,c),v(s,_),v(s,k),v(e,B),v(e,w),v(w,D),v(w,N)},p(d,p){p&1&&n!==(n=d[0].displayName+"")&&re(i,n),p&1&&o!==(o=d[0].currentPrice.currency+"")&&re(c,o),p&1&&g!==(g=We(d[0].currentPrice.amount,d[0].currentPrice.currency)+"")&&re(k,g),p&1&&M!==(M=ze(d[0].normalPeriodDuration)+"")&&re(N,M)},d(d){d&&m(e)}}}function un(t){let e,r;return e=new z({props:{$$slots:{default:[an]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&3&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function fn(t,e,r){let{productDetails:n}=e;return t.$$set=i=>{"productDetails"in i&&r(0,n=i.productDetails)},[n]}class Xe extends U{constructor(e){super(),C(this,e,fn,un,R,{productDetails:0},cn)}}const dn="data:image/gif;base64,R0lGODlhMgAyAPcBAAAAAAD/AAMDAwcHBxERERUVFSoqKi0tLTAwMDg4OD09PURERElJSUtLS1BQUFJSUlVVVVdXV1paWl9fX2NjY2ZmZmlpaWxsbG1tbXNzc3t7e39/f4GBgYKCgoSEhIaGhoeHh4iIiIuLi5KSkpSUlJaWlp2dnaGhoaOjo6SkpKWlpaenp6ioqKqqqqurq6ysrLCwsLGxsbS0tLa2tri4uLm5ub29vb6+vsDAwMHBwcLCwsXFxcjIyMnJyc3Nzc7OztPT09TU1NXV1dfX19nZ2dra2tvb29zc3N7e3uDg4OHh4eLi4uPj4+fn5+np6ezs7O7u7vDw8PHx8fLy8vPz8/X19fb29vj4+Pn5+fz8/P39/f7+/v///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQFBAABACwAAAAAMgAyAIcAAAAA/wADAwMHBwcREREVFRUqKiotLS0wMDA4ODg9PT1ERERJSUlLS0tQUFBSUlJVVVVXV1daWlpfX19jY2NmZmZpaWlsbGxtbW1zc3N7e3t/f3+BgYGCgoKEhISGhoaHh4eIiIiLi4uSkpKUlJSWlpadnZ2hoaGjo6OkpKSlpaWnp6eoqKiqqqqrq6usrKywsLCxsbG0tLS2tra4uLi5ubm9vb2+vr7AwMDBwcHCwsLFxcXIyMjJycnNzc3Ozs7T09PU1NTV1dXX19fZ2dna2trb29vc3Nze3t7g4ODh4eHi4uLj4+Pn5+fp6ens7Ozu7u7w8PDx8fHy8vLz8/P19fX29vb4+Pj5+fn8/Pz9/f3+/v7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8I/wCzcBFIcKDBgggPKkzIcCEXLlq4bIEokeLEiBcrYrTIcaNHjRobinQ4sqRCkBlTdtR44MBKlR9TmjQJQMBMkgZfdpwSMSYAACgpRtHpcSYSFUIa1mz448UQnAWDfmzSooUVmD9XVnnBwglMlDdvvMjhcOlCHit23CSqcUrVJiizpnTC4sXQmB1vZvmxwgYWhWYLznjRA+rJryqvxGhxxGNLjkVcwMCCN6ZeLkNevDCcRYYKJJfZptyCQwdiijl0CDxdlLPryw2lymY9WzTs17ijVq69mzbM28Bd8x7u23bu46F7i16uXEvw5ziJM5duGbl1k9OLN5cKvfvh7OC3b0jxTv6h+PDUy3unzl67RPXXc56fnz4+/PbofcOHnr9/5f3x4UeffvYVqJuACP5m4IIJ+gfWgusN6KCCAN7WoITVVXj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PJih9q3cOPKnWuRSxa7eO9O3cJFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function mn(t){let e,r;return{c(){e=$("img"),q(e.src,r=dn)||h(e,"src",r),h(e,"alt","spinner")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class gn extends U{constructor(e){super(),C(this,e,null,mn,R,{})}}function An(t){O(t,"svelte-4wmtg7",".rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}")}function _n(t){let e,r,n;return r=new gn({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-loader svelte-4wmtg7")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p:y,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}class Be extends U{constructor(e){super(),C(this,e,null,_n,R,{},An)}}var ge=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(ge||{}),ye=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(ye||{}),S=(t=>(t[t.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",t[t.ErrorChargingPayment=1]="ErrorChargingPayment",t[t.UnknownError=2]="UnknownError",t[t.NetworkError=3]="NetworkError",t[t.StripeError=4]="StripeError",t[t.MissingEmailError=5]="MissingEmailError",t))(S||{});class H extends Error{constructor(e,r,n){super(r),this.errorCode=e,this.underlyingErrorMessage=n}}class pn{constructor(e,r=10){T(this,"operationSessionId",null);T(this,"backend");T(this,"maxNumberAttempts");T(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=r}async startPurchase(e,r,n){const i=await this.backend.postSubscribe(e,r,n);return this.operationSessionId=i.operation_session_id,i}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new H(0,"No purchase in progress");return new Promise((r,n)=>{const i=(l=1)=>{if(l>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new H(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(s=>{switch(s.operation.status){case ge.Started:case ge.InProgress:setTimeout(()=>i(l+1),this.waitMSBetweenAttempts);break;case ge.Succeeded:this.clearPurchaseInProgress(),r();return;case ge.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(s.operation.error,n)}}).catch(s=>{n(new H(3,s.message))})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new H(2,"Got an error status but error field is empty."));return}switch(e.code){case ye.SetupIntentCreationFailed:r(new H(0,"Setup intent creation failed"));return;case ye.PaymentMethodCreationFailed:r(new H(0,"Payment method creation failed"));return;case ye.PaymentChargeFailed:r(new H(1,"Payment charge failed"));return}}}function hn(t){O(t,"svelte-igat39","button.svelte-igat39{border:none;border-radius:3.5rem;font-size:1rem;cursor:pointer;height:3.5rem;color:black;background-color:#dfdfdf}button.intent-primary.svelte-igat39{background-color:#000;color:white;font-size:1rem}")}function En(t){let e,r,n,i,l;const s=t[3].default,o=j(s,t,t[2],null);return{c(){e=$("button"),o&&o.c(),h(e,"class",r=ue(`intent-${t[0]}`)+" svelte-igat39"),e.disabled=t[1]},m(c,u){A(c,e,u),o&&o.m(e,null),n=!0,i||(l=fe(e,"click",t[4]),i=!0)},p(c,[u]){o&&o.p&&(!n||u&4)&&x(o,s,c,c[2],n?J(s,c[2],u,null):V(c[2]),null),(!n||u&1&&r!==(r=ue(`intent-${c[0]}`)+" svelte-igat39"))&&h(e,"class",r),(!n||u&2)&&(e.disabled=c[1])},i(c){n||(a(o,c),n=!0)},o(c){f(o,c),n=!1},d(c){c&&m(e),o&&o.d(c),i=!1,l()}}}function In(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:l="primary"}=e,{disabled:s=!1}=e;function o(c){Ve.call(this,t,c)}return t.$$set=c=>{"intent"in c&&r(0,l=c.intent),"disabled"in c&&r(1,s=c.disabled),"$$scope"in c&&r(2,i=c.$$scope)},[l,s,i,n,o]}class Ae extends U{constructor(e){super(),C(this,e,In,En,R,{intent:0,disabled:1},hn)}}function wn(t){O(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function bn(t){let e,r;const n=t[1].default,i=j(n,t,t[0],null);return{c(){e=$("footer"),i&&i.c(),h(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(l,s){A(l,e,s),i&&i.m(e,null),r=!0},p(l,[s]){i&&i.p&&(!r||s&1)&&x(i,n,l,l[0],r?J(n,l[0],s,null):V(l[0]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&m(e),i&&i.d(l)}}}function $n(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=l=>{"$$scope"in l&&r(0,i=l.$$scope)},[i,n]}class De extends U{constructor(e){super(),C(this,e,$n,bn,R,{},wn)}}const kn="data:image/svg+xml,%3csvg%20width='124'%20height='124'%20viewBox='0%200%20124%20124'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='62'%20cy='62'%20r='62'%20fill='%23767676'/%3e%3cpath%20d='M87.6668%2041.504L82.4968%2036.334L62.0002%2056.8307L41.5035%2036.334L36.3335%2041.504L56.8302%2062.0006L36.3335%2082.4973L41.5035%2087.6673L62.0002%2067.1706L82.4968%2087.6673L87.6668%2082.4973L67.1702%2062.0006L87.6668%2041.504Z'%20fill='white'/%3e%3c/svg%3e";function Bn(t){O(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function yn(t){let e,r;return{c(){e=$("img"),q(e.src,r=kn)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class Dn extends U{constructor(e){super(),C(this,e,null,yn,R,{},Bn)}}function Qn(t){O(t,"svelte-18njhoa",'.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}')}function vn(t){let e,r,n;const i=t[2].default,l=j(i,t,t[1],null);return{c(){e=$("div"),l&&l.c(),h(e,"class","column svelte-18njhoa"),h(e,"style",r=`--gap:${t[0]};`)},m(s,o){A(s,e,o),l&&l.m(e,null),n=!0},p(s,[o]){l&&l.p&&(!n||o&2)&&x(l,i,s,s[1],n?J(i,s[1],o,null):V(s[1]),null),(!n||o&1&&r!==(r=`--gap:${s[0]};`))&&h(e,"style",r)},i(s){n||(a(l,s),n=!0)},o(s){f(l,s),n=!1},d(s){s&&m(e),l&&l.d(s)}}}function Mn(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:l="0.5rem"}=e;return t.$$set=s=>{"gutter"in s&&r(0,l=s.gutter),"$$scope"in s&&r(1,i=s.$$scope)},[l,i,n]}class te extends U{constructor(e){super(),C(this,e,Mn,vn,R,{gutter:0},Qn)}}const Pn="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='mdi_close'%3e%3cpath%20id='Vector'%20d='M19%206.41L17.59%205L12%2010.59L6.41%205L5%206.41L10.59%2012L5%2017.59L6.41%2019L12%2013.41L17.59%2019L19%2017.59L13.41%2012L19%206.41Z'%20fill='%23767676'/%3e%3c/g%3e%3c/svg%3e";function Tn(t){O(t,"svelte-r1ujja",".close-button.svelte-r1ujja{border:none;cursor:pointer;background-color:transparent}")}function Nn(t){let e,r,n,i,l;return{c(){e=$("button"),r=$("img"),q(r.src,n=Pn)||h(r,"src",n),h(r,"alt","close"),h(e,"class","close-button svelte-r1ujja"),e.disabled=t[0]},m(s,o){A(s,e,o),v(e,r),i||(l=fe(e,"click",t[1]),i=!0)},p(s,[o]){o&1&&(e.disabled=s[0])},i:y,o:y,d(s){s&&m(e),i=!1,l()}}}function Rn(t,e,r){let{disabled:n=!1}=e;function i(l){Ve.call(this,t,l)}return t.$$set=l=>{"disabled"in l&&r(0,n=l.disabled)},[n,i]}class Cn extends U{constructor(e){super(),C(this,e,Rn,Nn,R,{disabled:0},Tn)}}function Un(t){O(t,"svelte-10u48yl",".rcb-app-icon.svelte-10u48yl{width:2.5rem;height:2.5rem;border-radius:0.75rem;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:1rem}.rcb-app-icon-picture-container.svelte-10u48yl{height:2.5rem}.rcb-app-icon.loading.svelte-10u48yl{background-color:gray}")}function On(t){let e;return{c(){e=$("div"),h(e,"class","rcb-app-icon loading svelte-10u48yl")},m(r,n){A(r,e,n)},p:y,d(r){r&&m(e)}}}function Sn(t){let e,r,n,i,l,s;return{c(){e=$("picture"),r=$("source"),i=P(),l=$("img"),h(r,"type","image/webp"),Tt(r,n=t[1])||h(r,"srcset",n),h(l,"class","rcb-app-icon svelte-10u48yl"),q(l.src,s=t[0])||h(l,"src",s),h(l,"alt","App icon"),h(e,"class","rcb-app-icon-picture-container svelte-10u48yl")},m(o,c){A(o,e,c),v(e,r),v(e,i),v(e,l)},p(o,c){c&2&&n!==(n=o[1])&&h(r,"srcset",n),c&1&&!q(l.src,s=o[0])&&h(l,"src",s)},d(o){o&&m(e)}}}function Ln(t){let e;function r(l,s){return l[0]!==null?Sn:On}let n=r(t),i=n(t);return{c(){i.c(),e=Z()},m(l,s){i.m(l,s),A(l,e,s)},p(l,[s]){n===(n=r(l))&&i?i.p(l,s):(i.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},i:y,o:y,d(l){l&&m(e),i.d(l)}}}function Fn(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=l=>{"src"in l&&r(0,n=l.src),"srcWebp"in l&&r(1,i=l.srcWebp)},[n,i]}class Ze extends U{constructor(e){super(),C(this,e,Fn,Ln,R,{src:0,srcWebp:1},Un)}}const Qe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Gn(t){O(t,"svelte-1tdgim9",".app-title.svelte-1tdgim9{font-weight:500;margin:0.5rem 0;font-size:1rem}.rcb-header-layout__business-info.svelte-1tdgim9{display:flex;align-items:center}")}function Yn(t){let e,r;return e=new Ze({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Hn(t){let e,r,n=t[0].seller_company_name+"",i,l,s=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&et(t);return{c(){s&&s.c(),e=P(),r=$("span"),i=L(n),h(r,"class","app-title svelte-1tdgim9")},m(o,c){s&&s.m(o,c),A(o,e,c),A(o,r,c),v(r,i),l=!0},p(o,c){o[0].app_icon_webp!==null&&o[0].app_icon!==null?s?(s.p(o,c),c&1&&a(s,1)):(s=et(o),s.c(),a(s,1),s.m(e.parentNode,e)):s&&(F(),f(s,1,1,()=>{s=null}),G()),(!l||c&1)&&n!==(n=o[0].seller_company_name+"")&&re(i,n)},i(o){l||(a(s),l=!0)},o(o){f(s),l=!1},d(o){o&&(m(e),m(r)),s&&s.d(o)}}}function et(t){let e,r;return e=new Ze({props:{src:Qe(t[0].app_icon),srcWebp:Qe(t[0].app_icon_webp)}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&1&&(l.src=Qe(n[0].app_icon)),i&1&&(l.srcWebp=Qe(n[0].app_icon_webp)),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Kn(t){let e,r,n,i;const l=[Hn,Yn],s=[];function o(c,u){return c[0]!==null?0:1}return r=o(t),n=s[r]=l[r](t),{c(){e=$("div"),n.c(),h(e,"class","rcb-header-layout__business-info svelte-1tdgim9")},m(c,u){A(c,e,u),s[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?s[r].p(c,u):(F(),f(s[_],1,1,()=>{s[_]=null}),G(),n=s[r],n?n.p(c,u):(n=s[r]=l[r](c),n.c()),a(n,1),n.m(e,null))},i(c){i||(a(n),i=!0)},o(c){f(n),i=!1},d(c){c&&m(e),s[r].d()}}}function jn(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class tt extends U{constructor(e){super(),C(this,e,jn,Kn,R,{brandingInfo:0},Gn)}}function Jn(t){O(t,"svelte-j03lz1",".rcb-post-purchase-header-layout.svelte-j03lz1{display:flex;justify-content:space-between;align-items:center;width:100%}")}function xn(t){let e,r,n,i,l;return r=new tt({props:{brandingInfo:t[0]}}),i=new Cn({}),i.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){e=$("div"),b(r.$$.fragment),n=P(),b(i.$$.fragment),h(e,"class","rcb-post-purchase-header-layout svelte-j03lz1")},m(s,o){A(s,e,o),E(r,e,null),v(e,n),E(i,e,null),l=!0},p(s,o){t=s;const c={};o&1&&(c.brandingInfo=t[0]),r.$set(c)},i(s){l||(a(r.$$.fragment,s),a(i.$$.fragment,s),l=!0)},o(s){f(r.$$.fragment,s),f(i.$$.fragment,s),l=!1},d(s){s&&m(e),I(r),I(i)}}}function Vn(t){let e,r;return e=new z({props:{as:"header",$$slots:{default:[xn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&7&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function qn(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=l=>{"brandingInfo"in l&&r(0,n=l.brandingInfo),"onClose"in l&&r(1,i=l.onClose)},[n,i]}class nt extends U{constructor(e){super(),C(this,e,qn,Vn,R,{brandingInfo:0,onClose:1},Jn)}}function Wn(t){O(t,"svelte-ahi052",".rcb-modal-error.svelte-ahi052{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-ahi052{font-size:24px}.subtitle.svelte-ahi052{font-size:16px}")}function rt(t){let e,r,n,i,l;return{c(){e=L("If this error persists, please contact "),r=$("a"),n=L(t[1]),l=L("."),h(r,"href",i="mailto:"+t[1])},m(s,o){A(s,e,o),A(s,r,o),v(r,n),A(s,l,o)},p(s,o){o&2&&re(n,s[1]),o&2&&i!==(i="mailto:"+s[1])&&h(r,"href",i)},d(s){s&&(m(e),m(r),m(l))}}}function zn(t){let e,r,n,i=t[3]()+"",l,s,o=t[1]&&rt(t);return{c(){e=$("span"),e.textContent="Something went wrong.",r=P(),n=$("span"),l=L(i),s=P(),o&&o.c(),h(e,"class","title svelte-ahi052"),h(n,"class","subtitle svelte-ahi052")},m(c,u){A(c,e,u),A(c,r,u),A(c,n,u),v(n,l),v(n,s),o&&o.m(n,null)},p(c,u){c[1]?o?o.p(c,u):(o=rt(c),o.c(),o.m(n,null)):o&&(o.d(1),o=null)},d(c){c&&(m(e),m(r),m(n)),o&&o.d()}}}function Xn(t){let e,r,n,i;return e=new Dn({}),n=new te({props:{gutter:"1rem",$$slots:{default:[zn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(l,s){E(e,l,s),A(l,r,s),E(n,l,s),i=!0},p(l,s){const o={};s&34&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(a(e.$$.fragment,l),a(n.$$.fragment,l),i=!0)},o(l){f(e.$$.fragment,l),f(n.$$.fragment,l),i=!1},d(l){l&&m(r),I(e,l),I(n,l)}}}function Zn(t){let e,r,n;return r=new te({props:{gutter:"1rem",$$slots:{default:[Xn]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-error svelte-ahi052")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p(i,l){const s={};l&34&&(s.$$scope={dirty:l,ctx:i}),r.$set(s)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function er(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function tr(t){let e,r;return e=new Ae({props:{$$slots:{default:[er]},$$scope:{ctx:t}}}),e.$on("click",function(){ne(t[2])&&t[2].apply(this,arguments)}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){t=n;const l={};i&32&&(l.$$scope={dirty:i,ctx:t}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function nr(t){let e,r,n,i,l,s;return e=new nt({props:{brandingInfo:t[0],onClose:t[2]}}),n=new z({props:{$$slots:{default:[Zn]},$$scope:{ctx:t}}}),l=new De({props:{$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment),i=P(),b(l.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(l,o,c),s=!0},p(o,c){const u={};c&1&&(u.brandingInfo=o[0]),c&4&&(u.onClose=o[2]),e.$set(u);const _={};c&34&&(_.$$scope={dirty:c,ctx:o}),n.$set(_);const g={};c&36&&(g.$$scope={dirty:c,ctx:o}),l.$set(g)},i(o){s||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(l.$$.fragment,o),s=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(l.$$.fragment,o),s=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(l,o)}}}function rr(t){let e,r;return e=new te({props:{gutter:"2rem",$$slots:{default:[nr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&39&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ir(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:l=null}=e,{onContinue:s}=e;be(()=>{console.debug(`Displayed error: ${S[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function o(){switch(i.errorCode){case S.UnknownError:return"An unknown error occurred.";case S.ErrorSettingUpPurchase:return"Purchase not started due to an error.";case S.ErrorChargingPayment:return"Payment failed.";case S.NetworkError:return"Network error. Please check your internet connection.";case S.StripeError:return i.message;case S.MissingEmailError:return"Email is required to complete the purchase."}return i.message}return t.$$set=c=>{"brandingInfo"in c&&r(0,n=c.brandingInfo),"lastError"in c&&r(4,i=c.lastError),"supportEmail"in c&&r(1,l=c.supportEmail),"onContinue"in c&&r(2,s=c.onContinue)},[n,l,s,o,i]}class lr extends U{constructor(e){super(),C(this,e,ir,rr,R,{brandingInfo:0,lastError:4,supportEmail:1,onContinue:2},Wn)}}const sr="data:image/svg+xml,%3csvg%20width='124'%20height='124'%20viewBox='0%200%20124%20124'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='62'%20cy='62'%20r='62'%20fill='%23576CDB'/%3e%3crect%20x='44.1116'%20y='56'%20width='27.5'%20height='11'%20transform='rotate(45%2044.1116%2056)'%20fill='white'/%3e%3crect%20x='79.1133'%20y='44.334'%20width='11'%20height='44'%20transform='rotate(45%2079.1133%2044.334)'%20fill='white'/%3e%3c/svg%3e";function or(t){O(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function cr(t){let e,r;return{c(){e=$("img"),q(e.src,r=sr)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class ar extends U{constructor(e){super(),C(this,e,null,cr,R,{},or)}}function ur(t){O(t,"svelte-1lcsna9",".rcb-modal-success.svelte-1lcsna9{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-1lcsna9{font-size:24px}.subtitle.svelte-1lcsna9{font-size:16px}")}function fr(t){let e,r,n;return{c(){e=$("span"),e.textContent="Purchase Successful",r=P(),n=$("span"),n.textContent="Your plan is now active.",h(e,"class","title svelte-1lcsna9"),h(n,"class","subtitle svelte-1lcsna9")},m(i,l){A(i,e,l),A(i,r,l),A(i,n,l)},p:y,d(i){i&&(m(e),m(r),m(n))}}}function dr(t){let e,r,n,i;return e=new ar({}),n=new te({props:{gutter:"1rem",$$slots:{default:[fr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(l,s){E(e,l,s),A(l,r,s),E(n,l,s),i=!0},p(l,s){const o={};s&4&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(a(e.$$.fragment,l),a(n.$$.fragment,l),i=!0)},o(l){f(e.$$.fragment,l),f(n.$$.fragment,l),i=!1},d(l){l&&m(r),I(e,l),I(n,l)}}}function mr(t){let e,r,n;return r=new te({props:{gutter:"1rem",$$slots:{default:[dr]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-success svelte-1lcsna9")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p(i,l){const s={};l&4&&(s.$$scope={dirty:l,ctx:i}),r.$set(s)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function gr(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Ar(t){let e,r;return e=new Ae({props:{$$slots:{default:[gr]},$$scope:{ctx:t}}}),e.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){t=n;const l={};i&4&&(l.$$scope={dirty:i,ctx:t}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function _r(t){let e,r,n,i,l,s;return e=new nt({props:{brandingInfo:t[0],onClose:t[1]}}),n=new z({props:{$$slots:{default:[mr]},$$scope:{ctx:t}}}),l=new De({props:{$$slots:{default:[Ar]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment),i=P(),b(l.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(l,o,c),s=!0},p(o,c){const u={};c&1&&(u.brandingInfo=o[0]),c&2&&(u.onClose=o[1]),e.$set(u);const _={};c&4&&(_.$$scope={dirty:c,ctx:o}),n.$set(_);const g={};c&6&&(g.$$scope={dirty:c,ctx:o}),l.$set(g)},i(o){s||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(l.$$.fragment,o),s=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(l.$$.fragment,o),s=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(l,o)}}}function pr(t){let e,r;return e=new te({props:{gutter:"2rem",$$slots:{default:[_r]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&7&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function hr(t,e,r){let{brandingInfo:n=null}=e,{onContinue:i}=e;return t.$$set=l=>{"brandingInfo"in l&&r(0,n=l.brandingInfo),"onContinue"in l&&r(1,i=l.onContinue)},[n,i]}class Er extends U{constructor(e){super(),C(this,e,hr,pr,R,{brandingInfo:0,onContinue:1},ur)}}function Ir(t,e,r,n,i={}){const l=r.create(e,i);return l.mount(t),l.on("change",s=>n("change",s)),l.on("ready",s=>n("ready",s)),l.on("focus",s=>n("focus",s)),l.on("blur",s=>n("blur",s)),l.on("escape",s=>n("escape",s)),l.on("click",s=>n("click",s)),l.on("loaderror",s=>n("loaderror",s)),l.on("loaderstart",s=>n("loaderstart",s)),l.on("networkschange",s=>n("networkschange",s)),l}const wr=typeof window>"u";function br(t){if(!wr)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function $r(t){let e;return{c(){e=$("div")},m(r,n){A(r,e,n),t[6](e)},p:y,i:y,o:y,d(r){r&&m(e),t[6](null)}}}function kr(t,e,r){let n,i;const l=Ht(),{elements:s}=jt("stripe");let{options:o=void 0}=e;be(()=>(n=Ir(i,"payment",s,l,o),()=>n.destroy()));function c(){n.blur()}function u(){n.clear()}function _(){n.destroy()}function g(){n.focus()}function k(B){$e[B?"unshift":"push"](()=>{i=B,r(0,i)})}return t.$$set=B=>{"options"in B&&r(1,o=B.options)},[i,o,c,u,_,g,k]}class Br extends U{constructor(e){super(),C(this,e,kr,$r,R,{options:1,blur:2,clear:3,destroy:4,focus:5})}get blur(){return this.$$.ctx[2]}get clear(){return this.$$.ctx[3]}get destroy(){return this.$$.ctx[4]}get focus(){return this.$$.ctx[5]}}function it(t){let e;const r=t[15].default,n=j(r,t,t[14],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&16384)&&x(n,r,i,i[14],e?J(r,i[14],l,null):V(i[14]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function yr(t){let e,r,n=t[1]&&t[0]&&it(t);return{c(){n&&n.c(),e=Z()},m(i,l){n&&n.m(i,l),A(i,e,l),r=!0},p(i,[l]){i[1]&&i[0]?n?(n.p(i,l),l&3&&a(n,1)):(n=it(i),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G())},i(i){r||(a(n),r=!0)},o(i){f(n),r=!1},d(i){i&&m(e),n&&n.d(i)}}}function Dr(t,e,r){let n,{$$slots:i={},$$scope:l}=e,{stripe:s}=e,{mode:o=void 0}=e,{theme:c="stripe"}=e,{variables:u={}}=e,{rules:_={}}=e,{labels:g="above"}=e,{loader:k="auto"}=e,{fonts:B=[]}=e,{locale:w="auto"}=e,{currency:D=void 0}=e,{amount:M=void 0}=e,{clientSecret:N=void 0}=e,{elements:d=null}=e;return t.$$set=p=>{"stripe"in p&&r(1,s=p.stripe),"mode"in p&&r(2,o=p.mode),"theme"in p&&r(3,c=p.theme),"variables"in p&&r(4,u=p.variables),"rules"in p&&r(5,_=p.rules),"labels"in p&&r(6,g=p.labels),"loader"in p&&r(7,k=p.loader),"fonts"in p&&r(8,B=p.fonts),"locale"in p&&r(9,w=p.locale),"currency"in p&&r(10,D=p.currency),"amount"in p&&r(11,M=p.amount),"clientSecret"in p&&r(12,N=p.clientSecret),"elements"in p&&r(0,d=p.elements),"$$scope"in p&&r(14,l=p.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:u,rules:_,labels:g}),t.$$.dirty&16263&&s&&!d&&(r(0,d=s.elements({mode:o,currency:D,amount:M,appearance:n,clientSecret:N,fonts:B,loader:k,locale:w})),br(s),Kt("stripe",{stripe:s,elements:d})),t.$$.dirty&8705&&d&&d.update({appearance:n,locale:w})},[d,s,o,c,u,_,g,k,B,w,D,M,N,n,l,i]}class Qr extends U{constructor(e){super(),C(this,e,Dr,yr,R,{stripe:1,mode:2,theme:3,variables:4,rules:5,labels:6,loader:7,fonts:8,locale:9,currency:10,amount:11,clientSecret:12,elements:0})}}var lt="https://js.stripe.com/v3",vr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,st="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Mr=function(){for(var e=document.querySelectorAll('script[src^="'.concat(lt,'"]')),r=0;r<e.length;r++){var n=e[r];if(vr.test(n.src))return n}return null},ot=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(lt).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},Pr=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.3.0",startTime:r})},_e=null,ve=null,Me=null,Tr=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Nr=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},Rr=function(e){return _e!==null?_e:(_e=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(st),window.Stripe){r(window.Stripe);return}try{var i=Mr();if(i&&e)console.warn(st);else if(!i)i=ot(e);else if(i&&Me!==null&&ve!==null){var l;i.removeEventListener("load",Me),i.removeEventListener("error",ve),(l=i.parentNode)===null||l===void 0||l.removeChild(i),i=ot(e)}Me=Nr(r,n),ve=Tr(n),i.addEventListener("load",Me),i.addEventListener("error",ve)}catch(s){n(s);return}}),_e.catch(function(r){return _e=null,Promise.reject(r)}))},Cr=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return Pr(i,n),i},pe,ct=!1,at=function(){return pe||(pe=Rr(null).catch(function(e){return pe=null,Promise.reject(e)}),pe)};Promise.resolve().then(function(){return at()}).catch(function(t){ct||console.warn(t)});var Ur=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];ct=!0;var i=Date.now();return at().then(function(l){return Cr(l,r,i)})};function Or(t){O(t,"svelte-1fwwzeb",".rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}")}function Sr(t){let e,r;return e=new Be({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Lr(t){let e,r,n,i,l,s;function o(u){t[9](u)}let c={stripe:t[2],clientSecret:t[4],loader:"always",$$slots:{default:[xr]},$$scope:{ctx:t}};return t[1]!==void 0&&(c.elements=t[1]),r=new Qr({props:c}),$e.push(()=>zt(r,"elements",o)),{c(){e=$("form"),b(r.$$.fragment)},m(u,_){A(u,e,_),E(r,e,null),i=!0,l||(s=fe(e,"submit",Je(t[5])),l=!0)},p(u,_){const g={};_&4&&(g.stripe=u[2]),_&2057&&(g.$$scope={dirty:_,ctx:u}),!n&&_&2&&(n=!0,g.elements=u[1],Vt(()=>n=!1)),r.$set(g)},i(u){i||(a(r.$$.fragment,u),i=!0)},o(u){f(r.$$.fragment,u),i=!1},d(u){u&&m(e),I(r),l=!1,s()}}}function Fr(t){let e,r,n;return r=new Br({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-stripe-elements-container svelte-1fwwzeb")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p:y,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function Gr(t){let e;return{c(){e=L("Pay")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Yr(t){let e;return{c(){e=L("Processing...")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Hr(t){let e;function r(l,s){return l[3]?Yr:Gr}let n=r(t),i=n(t);return{c(){i.c(),e=Z()},m(l,s){i.m(l,s),A(l,e,s)},p(l,s){n!==(n=r(l))&&(i.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},d(l){l&&m(e),i.d(l)}}}function Kr(t){let e;return{c(){e=L("Close")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function jr(t){let e,r,n,i;return e=new Ae({props:{disabled:t[3],$$slots:{default:[Hr]},$$scope:{ctx:t}}}),n=new Ae({props:{disabled:t[3],intent:"secondary",$$slots:{default:[Kr]},$$scope:{ctx:t}}}),n.$on("click",function(){ne(t[0])&&t[0].apply(this,arguments)}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(l,s){E(e,l,s),A(l,r,s),E(n,l,s),i=!0},p(l,s){t=l;const o={};s&8&&(o.disabled=t[3]),s&2056&&(o.$$scope={dirty:s,ctx:t}),e.$set(o);const c={};s&8&&(c.disabled=t[3]),s&2048&&(c.$$scope={dirty:s,ctx:t}),n.$set(c)},i(l){i||(a(e.$$.fragment,l),a(n.$$.fragment,l),i=!0)},o(l){f(e.$$.fragment,l),f(n.$$.fragment,l),i=!1},d(l){l&&m(r),I(e,l),I(n,l)}}}function Jr(t){let e,r;return e=new te({props:{$$slots:{default:[jr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&2057&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function xr(t){let e,r,n,i;return e=new z({props:{$$slots:{default:[Fr]},$$scope:{ctx:t}}}),n=new De({props:{$$slots:{default:[Jr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(l,s){E(e,l,s),A(l,r,s),E(n,l,s),i=!0},p(l,s){const o={};s&2048&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const c={};s&2057&&(c.$$scope={dirty:s,ctx:l}),n.$set(c)},i(l){i||(a(e.$$.fragment,l),a(n.$$.fragment,l),i=!0)},o(l){f(e.$$.fragment,l),f(n.$$.fragment,l),i=!1},d(l){l&&m(r),I(e,l),I(n,l)}}}function Vr(t){let e,r,n,i;const l=[Lr,Sr],s=[];function o(c,u){return c[2]&&c[4]?0:1}return r=o(t),n=s[r]=l[r](t),{c(){e=$("div"),n.c()},m(c,u){A(c,e,u),s[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?s[r].p(c,u):(F(),f(s[_],1,1,()=>{s[_]=null}),G(),n=s[r],n?n.p(c,u):(n=s[r]=l[r](c),n.c()),a(n,1),n.m(e,null))},i(c){i||(a(n),i=!0)},o(c){f(n),i=!1},d(c){c&&m(e),s[r].d()}}}function qr(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:l}=e,{paymentInfoCollectionMetadata:s}=e;const o=s.data.client_secret;let c=null,u,_=!1,g;be(async()=>{const w=s.data.publishable_api_key,D=s.data.stripe_account_id;if(!w||!D)throw new Error("Stripe publishable key or account ID not found");r(2,c=await Ur(w,{stripeAccount:D}))});const k=async()=>{if(_||!c||!g)return;r(3,_=!0);const w=await c.confirmSetup({elements:g,redirect:"if_required"});w.error?(r(3,_=!1),l(new H(S.StripeError,w.error.message))):i()};function B(w){u=w,r(1,u)}return t.$$set=w=>{"onClose"in w&&r(0,n=w.onClose),"onContinue"in w&&r(6,i=w.onContinue),"onError"in w&&r(7,l=w.onError),"paymentInfoCollectionMetadata"in w&&r(8,s=w.paymentInfoCollectionMetadata)},t.$$.update=()=>{t.$$.dirty&2&&u&&u._elements.length>0&&(g=u)},[n,u,c,_,o,k,i,l,s,B]}class Wr extends U{constructor(e){super(),C(this,e,qr,Vr,R,{onClose:0,onContinue:6,onError:7,paymentInfoCollectionMetadata:8},Or)}}function zr(t){O(t,"svelte-1xardyz",".form-container.svelte-1xardyz{display:flex;flex-direction:column;width:100%}.form-label.svelte-1xardyz{margin-top:0.5rem;margin-bottom:0.5rem;display:block}.form-input.svelte-1xardyz{margin-bottom:1rem}.title.svelte-1xardyz{font-size:1.5rem;margin:0;margin-bottom:0.5rem}input.svelte-1xardyz{width:94%;padding:0.5rem;border:1px solid #ccc;border-radius:0.25rem}")}function Xr(t){let e;return{c(){e=$("span"),e.textContent="User authentication",h(e,"class","title svelte-1xardyz")},m(r,n){A(r,e,n)},p:y,d(r){r&&m(e)}}}function Zr(t){let e,r,n,i,l,s,o;return{c(){e=$("div"),r=$("div"),r.innerHTML='<label for="email">E-mail</label>',n=P(),i=$("div"),l=$("input"),h(r,"class","form-label svelte-1xardyz"),h(l,"name","email"),h(l,"placeholder","john@appleseed.com"),h(l,"class","svelte-1xardyz"),h(i,"class","form-input svelte-1xardyz"),h(e,"class","form-container svelte-1xardyz")},m(c,u){A(c,e,u),v(e,r),v(e,n),v(e,i),v(i,l),xe(l,t[0]),s||(o=fe(l,"input",t[3]),s=!0)},p(c,u){u&1&&l.value!==c[0]&&xe(l,c[0])},d(c){c&&m(e),s=!1,o()}}}function ei(t){let e;return{c(){e=L("Continue")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function ti(t){let e,r;return e=new Ae({props:{$$slots:{default:[ei]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&16&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ni(t){let e,r,n,i,l,s,o,c,u,_;return n=new z({props:{$$slots:{default:[Xr]},$$scope:{ctx:t}}}),l=new z({props:{$$slots:{default:[Zr]},$$scope:{ctx:t}}}),o=new De({props:{$$slots:{default:[ti]},$$scope:{ctx:t}}}),{c(){e=$("div"),r=$("form"),b(n.$$.fragment),i=P(),b(l.$$.fragment),s=P(),b(o.$$.fragment)},m(g,k){A(g,e,k),v(e,r),E(n,r,null),v(r,i),E(l,r,null),v(r,s),E(o,r,null),c=!0,u||(_=fe(r,"submit",Je(t[1])),u=!0)},p(g,[k]){const B={};k&16&&(B.$$scope={dirty:k,ctx:g}),n.$set(B);const w={};k&17&&(w.$$scope={dirty:k,ctx:g}),l.$set(w);const D={};k&16&&(D.$$scope={dirty:k,ctx:g}),o.$set(D)},i(g){c||(a(n.$$.fragment,g),a(l.$$.fragment,g),a(o.$$.fragment,g),c=!0)},o(g){f(n.$$.fragment,g),f(l.$$.fragment,g),f(o.$$.fragment,g),c=!1},d(g){g&&m(e),I(n),I(l),I(o),u=!1,_()}}}function ri(t,e,r){let n,{onContinue:i}=e;const l=async()=>{i({email:n})};function s(){n=this.value,r(0,n)}return t.$$set=o=>{"onContinue"in o&&r(2,i=o.onContinue)},r(0,n=""),[n,l,i,s]}class ii extends U{constructor(e){super(),C(this,e,ri,ni,R,{onContinue:2},zr)}}const li="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20opacity='0.5'%20clip-path='url(%23clip0_344_3390)'%3e%3cpath%20d='M7%2018C5.9%2018%205.01%2018.9%205.01%2020C5.01%2021.1%205.9%2022%207%2022C8.1%2022%209%2021.1%209%2020C9%2018.9%208.1%2018%207%2018ZM1%202V4H3L6.6%2011.59L5.25%2014.04C5.09%2014.32%205%2014.65%205%2015C5%2016.1%205.9%2017%207%2017H19V15H7.42C7.28%2015%207.17%2014.89%207.17%2014.75L7.2%2014.63L8.1%2013H15.55C16.3%2013%2016.96%2012.59%2017.3%2011.97L20.88%205.48C20.96%205.34%2021%205.17%2021%205C21%204.45%2020.55%204%2020%204H5.21L4.27%202H1ZM17%2018C15.9%2018%2015.01%2018.9%2015.01%2020C15.01%2021.1%2015.9%2022%2017%2022C18.1%2022%2019%2021.1%2019%2020C19%2018.9%2018.1%2018%2017%2018Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_344_3390'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function si(t){let e,r;return{c(){e=$("img"),q(e.src,r=li)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class oi extends U{constructor(e){super(),C(this,e,null,si,R,{})}}function ci(t){O(t,"svelte-1ggdgso",".rcb-header-layout.svelte-1ggdgso{display:flex;justify-content:space-between;align-items:center;width:100%}")}function ai(t){let e,r,n,i,l;return r=new tt({props:{brandingInfo:t[0]}}),i=new oi({}),{c(){e=$("div"),b(r.$$.fragment),n=P(),b(i.$$.fragment),h(e,"class","rcb-header-layout svelte-1ggdgso")},m(s,o){A(s,e,o),E(r,e,null),v(e,n),E(i,e,null),l=!0},p(s,o){const c={};o&1&&(c.brandingInfo=s[0]),r.$set(c)},i(s){l||(a(r.$$.fragment,s),a(i.$$.fragment,s),l=!0)},o(s){f(r.$$.fragment,s),f(i.$$.fragment,s),l=!1},d(s){s&&m(e),I(r),I(i)}}}function ui(t){let e,r;return e=new z({props:{as:"header",$$slots:{default:[ai]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&3&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function fi(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class di extends U{constructor(e){super(),C(this,e,fi,ui,R,{brandingInfo:0},ci)}}function mi(t){O(t,"svelte-17dhulw",".rcb-modal-backdrop.svelte-17dhulw{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around}")}function gi(t){let e,r;const n=t[1].default,i=j(n,t,t[0],null);return{c(){e=$("div"),i&&i.c(),h(e,"class","rcb-modal-backdrop svelte-17dhulw")},m(l,s){A(l,e,s),i&&i.m(e,null),r=!0},p(l,[s]){i&&i.p&&(!r||s&1)&&x(i,n,l,l[0],r?J(n,l[0],s,null):V(l[0]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&m(e),i&&i.d(l)}}}function Ai(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=l=>{"$$scope"in l&&r(0,i=l.$$scope)},[i,n]}class _i extends U{constructor(e){super(),C(this,e,Ai,gi,R,{},mi)}}function pi(t){O(t,"svelte-m6kocx",".rcb-modal-main.svelte-m6kocx{box-sizing:border-box;border-radius:0.5rem;background-color:#fff;color:black;max-width:40rem;min-width:30rem;overflow-y:auto;padding:2.5rem}.rcb-modal-dark.svelte-m6kocx{background-color:#000;color:#fff;max-width:30rem;min-width:20rem}@media screen and (max-width: 60rem){.rcb-modal-main.svelte-m6kocx,.rcb-modal-dark.svelte-m6kocx{max-width:40rem;min-width:90vw}}")}function hi(t){let e,r,n;const i=t[2].default,l=j(i,t,t[1],null);return{c(){e=$("main"),l&&l.c(),h(e,"class",r=ue(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx")},m(s,o){A(s,e,o),l&&l.m(e,null),n=!0},p(s,[o]){l&&l.p&&(!n||o&2)&&x(l,i,s,s[1],n?J(i,s[1],o,null):V(s[1]),null),(!n||o&1&&r!==(r=ue(`rcb-modal-main ${s[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx"))&&h(e,"class",r)},i(s){n||(a(l,s),n=!0)},o(s){f(l,s),n=!1},d(s){s&&m(e),l&&l.d(s)}}}function Ei(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:l=!1}=e;return t.$$set=s=>{"dark"in s&&r(0,l=s.dark),"$$scope"in s&&r(1,i=s.$$scope)},[l,i,n]}class Ii extends U{constructor(e){super(),C(this,e,Ei,hi,R,{dark:0},pi)}}function wi(t){let e;const r=t[1].default,n=j(r,t,t[2],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&4)&&x(n,r,i,i[2],e?J(r,i[2],l,null):V(i[2]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function bi(t){let e,r;return e=new _i({props:{$$slots:{default:[$i]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&4&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function $i(t){let e;const r=t[1].default,n=j(r,t,t[2],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&4)&&x(n,r,i,i[2],e?J(r,i[2],l,null):V(i[2]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function ki(t){let e,r,n,i;const l=[bi,wi],s=[];function o(c,u){return c[0]?0:1}return e=o(t),r=s[e]=l[e](t),{c(){r.c(),n=Z()},m(c,u){s[e].m(c,u),A(c,n,u),i=!0},p(c,[u]){let _=e;e=o(c),e===_?s[e].p(c,u):(F(),f(s[_],1,1,()=>{s[_]=null}),G(),r=s[e],r?r.p(c,u):(r=s[e]=l[e](c),r.c()),a(r,1),r.m(n.parentNode,n))},i(c){i||(a(r),i=!0)},o(c){f(r),i=!1},d(c){c&&m(n),s[e].d(c)}}}function Bi(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:l=!1}=e;return t.$$set=s=>{"condition"in s&&r(0,l=s.condition),"$$scope"in s&&r(2,i=s.$$scope)},[l,n,i]}class yi extends U{constructor(e){super(),C(this,e,Bi,ki,R,{condition:0})}}function ut(t){let e,r;return e=new di({props:{brandingInfo:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&4&&(l.brandingInfo=n[2]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Di(t){let e,r,n=t[1]&&ut(t);const i=t[3].default,l=j(i,t,t[4],null);return{c(){n&&n.c(),e=P(),l&&l.c()},m(s,o){n&&n.m(s,o),A(s,e,o),l&&l.m(s,o),r=!0},p(s,o){s[1]?n?(n.p(s,o),o&2&&a(n,1)):(n=ut(s),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G()),l&&l.p&&(!r||o&16)&&x(l,i,s,s[4],r?J(i,s[4],o,null):V(s[4]),null)},i(s){r||(a(n),a(l,s),r=!0)},o(s){f(n),f(l,s),r=!1},d(s){s&&m(e),n&&n.d(s),l&&l.d(s)}}}function Qi(t){let e,r;return e=new Ii({props:{dark:t[0],$$slots:{default:[Di]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&1&&(l.dark=n[0]),i&22&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function vi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:l=!1}=e,{showHeader:s=!1}=e,{brandingInfo:o=null}=e;return t.$$set=c=>{"dark"in c&&r(0,l=c.dark),"showHeader"in c&&r(1,s=c.showHeader),"brandingInfo"in c&&r(2,o=c.brandingInfo),"$$scope"in c&&r(4,i=c.$$scope)},[l,s,o,n,i]}class ft extends U{constructor(e){super(),C(this,e,vi,Qi,R,{dark:0,showHeader:1,brandingInfo:2})}}var he=(t=>(t[t.UnknownError=0]="UnknownError",t[t.UserCancelledError=1]="UserCancelledError",t[t.StoreProblemError=2]="StoreProblemError",t[t.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",t[t.PurchaseInvalidError=4]="PurchaseInvalidError",t[t.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",t[t.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",t[t.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",t[t.InvalidReceiptError=8]="InvalidReceiptError",t[t.MissingReceiptFileError=9]="MissingReceiptFileError",t[t.NetworkError=10]="NetworkError",t[t.InvalidCredentialsError=11]="InvalidCredentialsError",t[t.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",t[t.InvalidAppUserIdError=14]="InvalidAppUserIdError",t[t.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",t[t.UnknownBackendError=16]="UnknownBackendError",t[t.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",t[t.IneligibleError=18]="IneligibleError",t[t.InsufficientPermissionsError=19]="InsufficientPermissionsError",t[t.PaymentPendingError=20]="PaymentPendingError",t[t.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",t[t.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",t[t.ConfigurationError=23]="ConfigurationError",t[t.UnsupportedError=24]="UnsupportedError",t[t.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",t[t.CustomerInfoError=28]="CustomerInfoError",t[t.SignatureVerificationError=36]="SignatureVerificationError",t))(he||{});class Pe{static getPublicMessage(e){switch(e){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.";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."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:return 4;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}}static convertCodeToBackendErrorCode(e){return e in dt?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case S.ErrorSettingUpPurchase:return 2;case S.ErrorChargingPayment:return 20;case S.NetworkError:return 10;case S.MissingEmailError:return 4;case S.StripeError:return 2;case S.UnknownError:return 0}}}var dt=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendStoreProblem=7101]="BackendStoreProblem",t[t.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",t[t.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",t[t.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",t[t.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",t[t.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",t[t.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",t[t.BackendInternalServerError=7110]="BackendInternalServerError",t[t.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",t[t.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",t[t.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",t[t.BackendBadRequest=7226]="BackendBadRequest",t[t.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",t[t.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",t[t.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",t[t.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",t[t.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",t[t.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",t[t.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",t[t.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",t))(dt||{});class X extends Error{constructor(r,n,i){super(n);T(this,"toString",()=>`PurchasesError(code: ${he[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=Pe.getErrorCodeForBackendErrorCode(r);return new X(i,Pe.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new X(Pe.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}const Mi="0.0.10",oe="https://api.revenuecat.com";var Te;(function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.EARLY_HINTS=103]="EARLY_HINTS",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.USE_PROXY=305]="USE_PROXY",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",t[t.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.IM_A_TEAPOT=418]="IM_A_TEAPOT",t[t.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",t[t.METHOD_FAILURE=420]="METHOD_FAILURE",t[t.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",t[t.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(Te||(Te={}));function mt(t){return t?t.startsWith("rcb_sb_"):!1}async function ce(t,e,r,n){const i=await fetch(t.url(),{method:t.method,headers:Ni(e,n),body:Ti(r)});return await Pi(i,t),await i.json()}async function Pi(t,e){const r=t.status;if(r>=Te.INTERNAL_SERVER_ERROR)Fe(e,r,await t.text());else if(r>=Te.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,l=n==null?void 0:n.code,s=n==null?void 0:n.message;if(l!=null){const o=Pe.convertCodeToBackendErrorCode(l);if(o==null)Fe(e,r,i);else throw X.getForBackendError(o,s)}else Fe(e,r,i)}}function Fe(t,e,r){throw new X(he.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function Ti(t){return t==null?null:JSON.stringify(t)}function Ni(t,e){let r={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":Mi,"X-Is-Sandbox":`${mt(t)}`};return e!=null&&(r={...r,...e}),r}const gt="/v1/subscribers",Ne="/rcbilling/v1";class Ri{constructor(e){T(this,"appUserId");T(this,"method","GET");T(this,"name","getOfferings");this.appUserId=e}url(){return`${oe}${gt}/${this.appUserId}/offerings`}}class Ci{constructor(){T(this,"method","POST");T(this,"name","subscribe")}url(){return`${oe}${Ne}/subscribe`}}class Ui{constructor(e,r){T(this,"method","GET");T(this,"name","getProducts");T(this,"appUserId");T(this,"productIds");this.appUserId=e,this.productIds=r}url(){return`${oe}${Ne}/subscribers/${this.appUserId}/products?id=${this.productIds.join("&id=")}`}}class Oi{constructor(e){T(this,"method","GET");T(this,"name","getCustomerInfo");T(this,"appUserId");this.appUserId=e}url(){return`${oe}${gt}/${this.appUserId}`}}class Si{constructor(){T(this,"method","GET");T(this,"name","getBrandingInfo")}url(){return`${oe}${Ne}/branding`}}class Li{constructor(e){T(this,"method","GET");T(this,"name","getCheckoutStatus");T(this,"operationSessionId");this.operationSessionId=e}url(){return`${oe}${Ne}/checkout/${this.operationSessionId}`}}class Fi{constructor(e){T(this,"API_KEY");this.API_KEY=e}async getOfferings(e){return await ce(new Ri(e),this.API_KEY)}async getCustomerInfo(e){return await ce(new Oi(e),this.API_KEY)}async getProducts(e,r){return await ce(new Ui(e,r),this.API_KEY)}async getBrandingInfo(){return await ce(new Si,this.API_KEY)}async postSubscribe(e,r,n){return await ce(new Ci,this.API_KEY,{app_user_id:e,product_id:r,email:n})}async getCheckoutStatus(e){return await ce(new Li(e),this.API_KEY)}}function Gi(t){O(t,"svelte-ofxzf4",`.rcb-ui-container.svelte-ofxzf4{color-scheme:none;font-family:"PP Object Sans",
1
+ (function(Y,K){typeof exports=="object"&&typeof module<"u"?K(exports):typeof define=="function"&&define.amd?define(["exports"],K):(Y=typeof globalThis<"u"?globalThis:Y||self,K(Y.Purchases={}))})(this,function(Y){"use strict";var ol=Object.defineProperty;var cl=(Y,K,W)=>K in Y?ol(Y,K,{enumerable:!0,configurable:!0,writable:!0,value:W}):Y[K]=W;var P=(Y,K,W)=>(cl(Y,typeof K!="symbol"?K+"":K,W),W);function K(t){return t!=null}var W=(t=>(t.Unknown="unknown",t.Custom="custom",t.Lifetime="$rc_lifetime",t.Annual="$rc_annual",t.SixMonth="$rc_six_month",t.ThreeMonth="$rc_three_month",t.TwoMonth="$rc_two_month",t.Monthly="$rc_monthly",t.Weekly="$rc_weekly",t))(W||{});const Qt=(t,e)=>({identifier:t.identifier,displayName:t.title,currentPrice:t.current_price,normalPeriodDuration:t.normal_period_duration,presentedOfferingIdentifier:e}),vt=(t,e,r)=>{const n=r[e.platform_product_identifier];return n===void 0?null:{identifier:e.identifier,rcBillingProduct:Qt(n,t),packageType:Mt(e.identifier)}},Ge=(t,e)=>{const r=t.packages.map(i=>vt(t.identifier,i,e)).filter(K),n={};for(const i of r)i!=null&&(n[i.identifier]=i);return r.length==0?null:{identifier:t.identifier,serverDescription:t.description,metadata:t.metadata,packagesById:n,availablePackages:r,lifetime:n.$rc_lifetime??null,annual:n.$rc_annual??null,sixMonth:n.$rc_six_month??null,threeMonth:n.$rc_three_month??null,twoMonth:n.$rc_two_month??null,monthly:n.$rc_monthly??null,weekly:n.$rc_weekly??null}};function Mt(t){switch(t){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 t.startsWith("$rc_")?"unknown":"custom"}}function y(){}function Tt(t,e){for(const r in e)t[r]=e[r];return t}function Ye(t){return t()}function He(){return Object.create(null)}function ae(t){t.forEach(Ye)}function ne(t){return typeof t=="function"}function R(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Ie;function q(t,e){return t===e?!0:(Ie||(Ie=document.createElement("a")),Ie.href=e,t===Ie.href)}function Ke(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function Pt(t,e){const r=Ke(t.srcset),n=Ke(e||"");return n.length===r.length&&n.every(([i,l],s)=>l===r[s][1]&&(q(r[s][0],i)||q(i,r[s][0])))}function Nt(t){return Object.keys(t).length===0}function j(t,e,r,n){if(t){const i=je(t,e,r,n);return t[0](i)}}function je(t,e,r,n){return t[1]&&n?Tt(r.ctx.slice(),t[1](n(e))):r.ctx}function J(t,e,r,n){if(t[2]&&n){const i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){const l=[],s=Math.max(e.dirty.length,i.length);for(let o=0;o<s;o+=1)l[o]=e.dirty[o]|i[o];return l}return e.dirty|i}return e.dirty}function x(t,e,r,n,i,l){if(i){const s=je(e,r,n,l);t.p(s,i)}}function V(t){if(t.ctx.length>32){const e=[],r=t.ctx.length/32;for(let n=0;n<r;n++)e[n]=-1;return e}return-1}function ue(t){return t??""}function v(t,e){t.appendChild(e)}function O(t,e,r){const n=Rt(t);if(!n.getElementById(e)){const i=$("style");i.id=e,i.textContent=r,Ct(n,i)}}function Rt(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Ct(t,e){return v(t.head||t,e),e.sheet}function A(t,e,r){t.insertBefore(e,r||null)}function m(t){t.parentNode&&t.parentNode.removeChild(t)}function $(t){return document.createElement(t)}function L(t){return document.createTextNode(t)}function T(){return L(" ")}function Z(){return L("")}function fe(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function Je(t){return function(e){return e.preventDefault(),t.call(this,e)}}function h(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}const Ut=["width","height"];function Ot(t,e){const r=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:r[n]&&r[n].set&&Ut.indexOf(n)===-1?t[n]=e[n]:h(t,n,e[n])}function St(t,e){Object.keys(e).forEach(r=>{Lt(t,r,e[r])})}function Lt(t,e,r){const n=e.toLowerCase();n in t?t[n]=typeof t[n]=="boolean"&&r===""?!0:r:e in t?t[e]=typeof t[e]=="boolean"&&r===""?!0:r:h(t,e,r)}function Ft(t){return/-/.test(t)?St:Ot}function Gt(t){return Array.from(t.childNodes)}function re(t,e){e=""+e,t.data!==e&&(t.data=e)}function xe(t,e){t.value=e??""}function Yt(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let de;function me(t){de=t}function we(){if(!de)throw new Error("Function called outside component initialization");return de}function be(t){we().$$.on_mount.push(t)}function Ht(){const t=we();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const l=Yt(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,l)}),!l.defaultPrevented}return!0}}function Kt(t,e){return we().$$.context.set(t,e),e}function jt(t){return we().$$.context.get(t)}function Ve(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const ie=[],$e=[];let le=[];const Ce=[],Jt=Promise.resolve();let Ue=!1;function xt(){Ue||(Ue=!0,Jt.then(qe))}function Oe(t){le.push(t)}function Vt(t){Ce.push(t)}const Se=new Set;let se=0;function qe(){if(se!==0)return;const t=de;do{try{for(;se<ie.length;){const e=ie[se];se++,me(e),qt(e.$$)}}catch(e){throw ie.length=0,se=0,e}for(me(null),ie.length=0,se=0;$e.length;)$e.pop()();for(let e=0;e<le.length;e+=1){const r=le[e];Se.has(r)||(Se.add(r),r())}le.length=0}while(ie.length);for(;Ce.length;)Ce.pop()();Ue=!1,Se.clear(),me(t)}function qt(t){if(t.fragment!==null){t.update(),ae(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Oe)}}function Wt(t){const e=[],r=[];le.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),le=e}const Be=new Set;let ee;function F(){ee={r:0,c:[],p:ee}}function G(){ee.r||ae(ee.c),ee=ee.p}function a(t,e){t&&t.i&&(Be.delete(t),t.i(e))}function f(t,e,r,n){if(t&&t.o){if(Be.has(t))return;Be.add(t),ee.c.push(()=>{Be.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function zt(t,e,r){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function b(t){t&&t.c()}function E(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),Oe(()=>{const l=t.$$.on_mount.map(Ye).filter(ne);t.$$.on_destroy?t.$$.on_destroy.push(...l):ae(l),t.$$.on_mount=[]}),i.forEach(Oe)}function I(t,e){const r=t.$$;r.fragment!==null&&(Wt(r.after_update),ae(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function Xt(t,e){t.$$.dirty[0]===-1&&(ie.push(t),xt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function C(t,e,r,n,i,l,s=null,o=[-1]){const c=de;me(t);const u=t.$$={fragment:null,ctx:[],props:l,update:y,not_equal:i,bound:He(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:He(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};s&&s(u.root);let _=!1;if(u.ctx=r?r(t,e.props||{},(g,B,...k)=>{const w=k.length?k[0]:B;return u.ctx&&i(u.ctx[g],u.ctx[g]=w)&&(!u.skip_bound&&u.bound[g]&&u.bound[g](w),_&&Xt(t,g)),B}):[],u.update(),_=!0,ae(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const g=Gt(e.target);u.fragment&&u.fragment.l(g),g.forEach(m)}else u.fragment&&u.fragment.c();e.intro&&a(t.$$.fragment),E(t,e.target,e.anchor),qe()}me(c)}class U{constructor(){P(this,"$$");P(this,"$$set")}$destroy(){I(this,1),this.$destroy=y}$on(e,r){if(!ne(r))return y;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const i=n.indexOf(r);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Nt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Zt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zt);function en(t){O(t,"svelte-8uc6s0","aside.svelte-8uc6s0{color:yellowgreen;font-weight:bold;text-transform:uppercase;padding:0.5rem 0;width:100%;font-size:0.75rem;border-radius:0.5rem}")}function tn(t){let e;return{c(){e=$("aside"),e.innerHTML="<span>Sandbox Mode</span>",h(e,"class","svelte-8uc6s0")},m(r,n){A(r,e,n)},p:y,i:y,o:y,d(r){r&&m(e)}}}class nn extends U{constructor(e){super(),C(this,e,null,tn,R,{},en)}}function rn(t){O(t,"svelte-ujomz3",".rcb-modal-section.svelte-ujomz3{padding:0.5rem 0rem;display:flex}.rcb-modal-section.svelte-ujomz3:last-of-type{padding:0}")}function Le(t){let e,r;const n=t[2].default,i=j(n,t,t[1],null);return{c(){e=$(t[0]),i&&i.c(),Ft(t[0])(e,{class:ue("rcb-modal-section")+" svelte-ujomz3"})},m(l,s){A(l,e,s),i&&i.m(e,null),r=!0},p(l,s){i&&i.p&&(!r||s&2)&&x(i,n,l,l[1],r?J(n,l[1],s,null):V(l[1]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&m(e),i&&i.d(l)}}}function ln(t){let e=t[0],r,n,i=t[0]&&Le(t);return{c(){i&&i.c(),r=Z()},m(l,s){i&&i.m(l,s),A(l,r,s),n=!0},p(l,[s]){l[0]?e?R(e,l[0])?(i.d(1),i=Le(l),e=l[0],i.c(),i.m(r.parentNode,r)):i.p(l,s):(i=Le(l),e=l[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=l[0])},i(l){n||(a(i,l),n=!0)},o(l){f(i,l),n=!1},d(l){l&&m(r),i&&i.d(l)}}}function sn(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:l="section"}=e;return t.$$set=s=>{"as"in s&&r(0,l=s.as),"$$scope"in s&&r(1,i=s.$$scope)},[l,i,n]}class z extends U{constructor(e){super(),C(this,e,sn,ln,R,{as:0},rn)}}const on={Y:"year",M:"month",W:"week",D:"day",H:"hour"},We=(t,e)=>{const r=t/100;return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(r)},ze=t=>{const e=t.slice(-1);return e==="D"?"daily":`${on[e]}ly`};function cn(t){O(t,"svelte-1oa6nu8",".rcb-pricing-info.svelte-1oa6nu8{display:flex;flex-direction:column;height:10rem;justify-content:flex-end}.rcb-product-price.svelte-1oa6nu8{font-size:1.5rem}.rcb-product-duration.svelte-1oa6nu8{opacity:0.6}")}function an(t){let e,r,n=t[0].displayName+"",i,l,s,o=t[0].currentPrice.currency+"",c,u=" ",_,g=We(t[0].currentPrice.amount,t[0].currentPrice.currency)+"",B,k,w,D,M=ze(t[0].normalPeriodDuration)+"",N;return{c(){e=$("div"),r=$("span"),i=L(n),l=T(),s=$("span"),c=L(o),_=L(u),B=L(g),k=T(),w=$("span"),D=L("Billed "),N=L(M),h(s,"class","rcb-product-price svelte-1oa6nu8"),h(w,"class","rcb-product-duration svelte-1oa6nu8"),h(e,"class","rcb-pricing-info svelte-1oa6nu8")},m(d,p){A(d,e,p),v(e,r),v(r,i),v(e,l),v(e,s),v(s,c),v(s,_),v(s,B),v(e,k),v(e,w),v(w,D),v(w,N)},p(d,p){p&1&&n!==(n=d[0].displayName+"")&&re(i,n),p&1&&o!==(o=d[0].currentPrice.currency+"")&&re(c,o),p&1&&g!==(g=We(d[0].currentPrice.amount,d[0].currentPrice.currency)+"")&&re(B,g),p&1&&M!==(M=ze(d[0].normalPeriodDuration)+"")&&re(N,M)},d(d){d&&m(e)}}}function un(t){let e,r;return e=new z({props:{$$slots:{default:[an]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&3&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function fn(t,e,r){let{productDetails:n}=e;return t.$$set=i=>{"productDetails"in i&&r(0,n=i.productDetails)},[n]}class Xe extends U{constructor(e){super(),C(this,e,fn,un,R,{productDetails:0},cn)}}const dn="data:image/gif;base64,R0lGODlhMgAyAPcBAAAAAAD/AAMDAwcHBxERERUVFSoqKi0tLTAwMDg4OD09PURERElJSUtLS1BQUFJSUlVVVVdXV1paWl9fX2NjY2ZmZmlpaWxsbG1tbXNzc3t7e39/f4GBgYKCgoSEhIaGhoeHh4iIiIuLi5KSkpSUlJaWlp2dnaGhoaOjo6SkpKWlpaenp6ioqKqqqqurq6ysrLCwsLGxsbS0tLa2tri4uLm5ub29vb6+vsDAwMHBwcLCwsXFxcjIyMnJyc3Nzc7OztPT09TU1NXV1dfX19nZ2dra2tvb29zc3N7e3uDg4OHh4eLi4uPj4+fn5+np6ezs7O7u7vDw8PHx8fLy8vPz8/X19fb29vj4+Pn5+fz8/P39/f7+/v///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQFBAABACwAAAAAMgAyAIcAAAAA/wADAwMHBwcREREVFRUqKiotLS0wMDA4ODg9PT1ERERJSUlLS0tQUFBSUlJVVVVXV1daWlpfX19jY2NmZmZpaWlsbGxtbW1zc3N7e3t/f3+BgYGCgoKEhISGhoaHh4eIiIiLi4uSkpKUlJSWlpadnZ2hoaGjo6OkpKSlpaWnp6eoqKiqqqqrq6usrKywsLCxsbG0tLS2tra4uLi5ubm9vb2+vr7AwMDBwcHCwsLFxcXIyMjJycnNzc3Ozs7T09PU1NTV1dXX19fZ2dna2trb29vc3Nze3t7g4ODh4eHi4uLj4+Pn5+fp6ens7Ozu7u7w8PDx8fHy8vLz8/P19fX29vb4+Pj5+fn8/Pz9/f3+/v7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8I/wCzcBFIcKDBgggPKkzIcCEXLlq4bIEokeLEiBcrYrTIcaNHjRobinQ4sqRCkBlTdtR44MBKlR9TmjQJQMBMkgZfdpwSMSYAACgpRtHpcSYSFUIa1mz448UQnAWDfmzSooUVmD9XVnnBwglMlDdvvMjhcOlCHit23CSqcUrVJiizpnTC4sXQmB1vZvmxwgYWhWYLznjRA+rJryqvxGhxxGNLjkVcwMCCN6ZeLkNevDCcRYYKJJfZptyCQwdiijl0CDxdlLPryw2lymY9WzTs17ijVq69mzbM28Bd8x7u23bu46F7i16uXEvw5ziJM5duGbl1k9OLN5cKvfvh7OC3b0jxTv6h+PDUy3unzl67RPXXc56fnz4+/PbofcOHnr9/5f3x4UeffvYVqJuACP5m4IIJ+gfWgusN6KCCAN7WoITVVXjchBxqERAAIfkEBQQAAQAsDQADACAAEAAACKcAAwgcSDDAAwcFEypcSNDAAYYQA2DZstCAAYZOKCqM8uNJxYcKa3DYsVBKECBYFFpU+MTDhiIMkQxBohJkwRYaUkDEEiQIlYQrCyLZ0MFJRCdAkgC1OZBEBxgRJRIBAqXgwYI8NoCwEjWAkyFDoorQ4KOrQCRLoqbQuZCKR7NdqzD5MaQKXIhZmAwBIqTJ3YVYogQZ8oMJ178Kk/A1YhfxQiRHjBYMCAAh+QQFBQABACwNAAMAIAAQAAAInQADCBxIMECGDAUTKlxI8EEEhhADcGEI4QFDJQy5ZJmo0OFCFBFkLNzCRQvHghEgKHQi4cEPhhuzdHyYUMQDDxC5kNSSsGLCIA4x5oxZ0GNBDBFKRAxgkmTBg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AMAFwAiAAAItQADCBxIsKDBGjQMKlyo4sXCgUIetmDxMAAJABsWrnD4UAaAAUkUumhRMcACAQ4UNiwpRAAAGwYnlgyAAQACgxtnPiEAoERBhDMDjBBAoCINHw8ZNHjI5EGEDUyCFtSyIoJVE1KkEnwCIsIDCjK0EgSSAQIED2IHYqkxQUTat3Djyp1b0UbDjXdhBqUxcWTfhHQDCx5MuCIXLVy2vOWShTEXsVsOJz6stbHlx1ojI1b8tvHbgAAAIfkEBQQAAQAsAwADABcAFwAACJQAAwgcSLCgwRIkDCpcqIHDwoFHHm7Y8DCACgMJFWroUBGHgQNMFE6sGGDCAQsaHVY8csAAD4MjSX4w8MDgRpIBoCQwsKIgQpwBUBxIULEHkYcUUC580tDEE6AGbXSYKKMKVIJSUnDQIGIHl6sQS0w8AZagjxAsyqpdy7at24pJfgwBMkQukCRQjQQBIgTIXiFGoAYEACH5BAUFAAEALAMAAwAXABcAAAiVAAMIHEiwoMEMGQwqXPggwsKBTLQshPDgYYAaD1owdPjQB4QIThRGgGAxwIYIIBQ2LMlkJBCDFEsGOPEgA5aCK0tKmQChRkGEMgPIiDDhoRYjTR56CPGwiooXN6oENQikhYsWP65MJXglx4sVMoZsJdikRosWOMYSRPJih9q3cOPKnWuRSxa7eO9O3cJFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function mn(t){let e,r;return{c(){e=$("img"),q(e.src,r=dn)||h(e,"src",r),h(e,"alt","spinner")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class gn extends U{constructor(e){super(),C(this,e,null,mn,R,{})}}function An(t){O(t,"svelte-4wmtg7",".rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}")}function _n(t){let e,r,n;return r=new gn({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-loader svelte-4wmtg7")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p:y,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}class ke extends U{constructor(e){super(),C(this,e,null,_n,R,{},An)}}var ge=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(ge||{}),ye=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(ye||{}),S=(t=>(t[t.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",t[t.ErrorChargingPayment=1]="ErrorChargingPayment",t[t.UnknownError=2]="UnknownError",t[t.NetworkError=3]="NetworkError",t[t.StripeError=4]="StripeError",t[t.MissingEmailError=5]="MissingEmailError",t))(S||{});class H extends Error{constructor(e,r,n){super(r),this.errorCode=e,this.underlyingErrorMessage=n}}class pn{constructor(e,r=10){P(this,"operationSessionId",null);P(this,"backend");P(this,"maxNumberAttempts");P(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=r}async startPurchase(e,r,n){const i=await this.backend.postSubscribe(e,r,n);return this.operationSessionId=i.operation_session_id,i}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new H(0,"No purchase in progress");return new Promise((r,n)=>{const i=(l=1)=>{if(l>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new H(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(s=>{switch(s.operation.status){case ge.Started:case ge.InProgress:setTimeout(()=>i(l+1),this.waitMSBetweenAttempts);break;case ge.Succeeded:this.clearPurchaseInProgress(),r();return;case ge.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(s.operation.error,n)}}).catch(s=>{n(new H(3,s.message))})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new H(2,"Got an error status but error field is empty."));return}switch(e.code){case ye.SetupIntentCreationFailed:r(new H(0,"Setup intent creation failed"));return;case ye.PaymentMethodCreationFailed:r(new H(0,"Payment method creation failed"));return;case ye.PaymentChargeFailed:r(new H(1,"Payment charge failed"));return}}}function hn(t){O(t,"svelte-igat39","button.svelte-igat39{border:none;border-radius:3.5rem;font-size:1rem;cursor:pointer;height:3.5rem;color:black;background-color:#dfdfdf}button.intent-primary.svelte-igat39{background-color:#000;color:white;font-size:1rem}")}function En(t){let e,r,n,i,l;const s=t[3].default,o=j(s,t,t[2],null);return{c(){e=$("button"),o&&o.c(),h(e,"class",r=ue(`intent-${t[0]}`)+" svelte-igat39"),e.disabled=t[1]},m(c,u){A(c,e,u),o&&o.m(e,null),n=!0,i||(l=fe(e,"click",t[4]),i=!0)},p(c,[u]){o&&o.p&&(!n||u&4)&&x(o,s,c,c[2],n?J(s,c[2],u,null):V(c[2]),null),(!n||u&1&&r!==(r=ue(`intent-${c[0]}`)+" svelte-igat39"))&&h(e,"class",r),(!n||u&2)&&(e.disabled=c[1])},i(c){n||(a(o,c),n=!0)},o(c){f(o,c),n=!1},d(c){c&&m(e),o&&o.d(c),i=!1,l()}}}function In(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:l="primary"}=e,{disabled:s=!1}=e;function o(c){Ve.call(this,t,c)}return t.$$set=c=>{"intent"in c&&r(0,l=c.intent),"disabled"in c&&r(1,s=c.disabled),"$$scope"in c&&r(2,i=c.$$scope)},[l,s,i,n,o]}class Ae extends U{constructor(e){super(),C(this,e,In,En,R,{intent:0,disabled:1},hn)}}function wn(t){O(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function bn(t){let e,r;const n=t[1].default,i=j(n,t,t[0],null);return{c(){e=$("footer"),i&&i.c(),h(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(l,s){A(l,e,s),i&&i.m(e,null),r=!0},p(l,[s]){i&&i.p&&(!r||s&1)&&x(i,n,l,l[0],r?J(n,l[0],s,null):V(l[0]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&m(e),i&&i.d(l)}}}function $n(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=l=>{"$$scope"in l&&r(0,i=l.$$scope)},[i,n]}class De extends U{constructor(e){super(),C(this,e,$n,bn,R,{},wn)}}const Bn="data:image/svg+xml,%3csvg%20width='124'%20height='124'%20viewBox='0%200%20124%20124'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='62'%20cy='62'%20r='62'%20fill='%23767676'/%3e%3cpath%20d='M87.6668%2041.504L82.4968%2036.334L62.0002%2056.8307L41.5035%2036.334L36.3335%2041.504L56.8302%2062.0006L36.3335%2082.4973L41.5035%2087.6673L62.0002%2067.1706L82.4968%2087.6673L87.6668%2082.4973L67.1702%2062.0006L87.6668%2041.504Z'%20fill='white'/%3e%3c/svg%3e";function kn(t){O(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function yn(t){let e,r;return{c(){e=$("img"),q(e.src,r=Bn)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class Dn extends U{constructor(e){super(),C(this,e,null,yn,R,{},kn)}}function Qn(t){O(t,"svelte-18njhoa",'.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}')}function vn(t){let e,r,n;const i=t[2].default,l=j(i,t,t[1],null);return{c(){e=$("div"),l&&l.c(),h(e,"class","column svelte-18njhoa"),h(e,"style",r=`--gap:${t[0]};`)},m(s,o){A(s,e,o),l&&l.m(e,null),n=!0},p(s,[o]){l&&l.p&&(!n||o&2)&&x(l,i,s,s[1],n?J(i,s[1],o,null):V(s[1]),null),(!n||o&1&&r!==(r=`--gap:${s[0]};`))&&h(e,"style",r)},i(s){n||(a(l,s),n=!0)},o(s){f(l,s),n=!1},d(s){s&&m(e),l&&l.d(s)}}}function Mn(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:l="0.5rem"}=e;return t.$$set=s=>{"gutter"in s&&r(0,l=s.gutter),"$$scope"in s&&r(1,i=s.$$scope)},[l,i,n]}class te extends U{constructor(e){super(),C(this,e,Mn,vn,R,{gutter:0},Qn)}}const Tn="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='mdi_close'%3e%3cpath%20id='Vector'%20d='M19%206.41L17.59%205L12%2010.59L6.41%205L5%206.41L10.59%2012L5%2017.59L6.41%2019L12%2013.41L17.59%2019L19%2017.59L13.41%2012L19%206.41Z'%20fill='%23767676'/%3e%3c/g%3e%3c/svg%3e";function Pn(t){O(t,"svelte-r1ujja",".close-button.svelte-r1ujja{border:none;cursor:pointer;background-color:transparent}")}function Nn(t){let e,r,n,i,l;return{c(){e=$("button"),r=$("img"),q(r.src,n=Tn)||h(r,"src",n),h(r,"alt","close"),h(e,"class","close-button svelte-r1ujja"),e.disabled=t[0]},m(s,o){A(s,e,o),v(e,r),i||(l=fe(e,"click",t[1]),i=!0)},p(s,[o]){o&1&&(e.disabled=s[0])},i:y,o:y,d(s){s&&m(e),i=!1,l()}}}function Rn(t,e,r){let{disabled:n=!1}=e;function i(l){Ve.call(this,t,l)}return t.$$set=l=>{"disabled"in l&&r(0,n=l.disabled)},[n,i]}class Cn extends U{constructor(e){super(),C(this,e,Rn,Nn,R,{disabled:0},Pn)}}function Un(t){O(t,"svelte-10u48yl",".rcb-app-icon.svelte-10u48yl{width:2.5rem;height:2.5rem;border-radius:0.75rem;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:1rem}.rcb-app-icon-picture-container.svelte-10u48yl{height:2.5rem}.rcb-app-icon.loading.svelte-10u48yl{background-color:gray}")}function On(t){let e;return{c(){e=$("div"),h(e,"class","rcb-app-icon loading svelte-10u48yl")},m(r,n){A(r,e,n)},p:y,d(r){r&&m(e)}}}function Sn(t){let e,r,n,i,l,s;return{c(){e=$("picture"),r=$("source"),i=T(),l=$("img"),h(r,"type","image/webp"),Pt(r,n=t[1])||h(r,"srcset",n),h(l,"class","rcb-app-icon svelte-10u48yl"),q(l.src,s=t[0])||h(l,"src",s),h(l,"alt","App icon"),h(e,"class","rcb-app-icon-picture-container svelte-10u48yl")},m(o,c){A(o,e,c),v(e,r),v(e,i),v(e,l)},p(o,c){c&2&&n!==(n=o[1])&&h(r,"srcset",n),c&1&&!q(l.src,s=o[0])&&h(l,"src",s)},d(o){o&&m(e)}}}function Ln(t){let e;function r(l,s){return l[0]!==null?Sn:On}let n=r(t),i=n(t);return{c(){i.c(),e=Z()},m(l,s){i.m(l,s),A(l,e,s)},p(l,[s]){n===(n=r(l))&&i?i.p(l,s):(i.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},i:y,o:y,d(l){l&&m(e),i.d(l)}}}function Fn(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=l=>{"src"in l&&r(0,n=l.src),"srcWebp"in l&&r(1,i=l.srcWebp)},[n,i]}class Ze extends U{constructor(e){super(),C(this,e,Fn,Ln,R,{src:0,srcWebp:1},Un)}}const Qe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Gn(t){O(t,"svelte-1tdgim9",".app-title.svelte-1tdgim9{font-weight:500;margin:0.5rem 0;font-size:1rem}.rcb-header-layout__business-info.svelte-1tdgim9{display:flex;align-items:center}")}function Yn(t){let e,r;return e=new Ze({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Hn(t){let e,r,n=t[0].seller_company_name+"",i,l,s=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&et(t);return{c(){s&&s.c(),e=T(),r=$("span"),i=L(n),h(r,"class","app-title svelte-1tdgim9")},m(o,c){s&&s.m(o,c),A(o,e,c),A(o,r,c),v(r,i),l=!0},p(o,c){o[0].app_icon_webp!==null&&o[0].app_icon!==null?s?(s.p(o,c),c&1&&a(s,1)):(s=et(o),s.c(),a(s,1),s.m(e.parentNode,e)):s&&(F(),f(s,1,1,()=>{s=null}),G()),(!l||c&1)&&n!==(n=o[0].seller_company_name+"")&&re(i,n)},i(o){l||(a(s),l=!0)},o(o){f(s),l=!1},d(o){o&&(m(e),m(r)),s&&s.d(o)}}}function et(t){let e,r;return e=new Ze({props:{src:Qe(t[0].app_icon),srcWebp:Qe(t[0].app_icon_webp)}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&1&&(l.src=Qe(n[0].app_icon)),i&1&&(l.srcWebp=Qe(n[0].app_icon_webp)),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Kn(t){let e,r,n,i;const l=[Hn,Yn],s=[];function o(c,u){return c[0]!==null?0:1}return r=o(t),n=s[r]=l[r](t),{c(){e=$("div"),n.c(),h(e,"class","rcb-header-layout__business-info svelte-1tdgim9")},m(c,u){A(c,e,u),s[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?s[r].p(c,u):(F(),f(s[_],1,1,()=>{s[_]=null}),G(),n=s[r],n?n.p(c,u):(n=s[r]=l[r](c),n.c()),a(n,1),n.m(e,null))},i(c){i||(a(n),i=!0)},o(c){f(n),i=!1},d(c){c&&m(e),s[r].d()}}}function jn(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class tt extends U{constructor(e){super(),C(this,e,jn,Kn,R,{brandingInfo:0},Gn)}}function Jn(t){O(t,"svelte-j03lz1",".rcb-post-purchase-header-layout.svelte-j03lz1{display:flex;justify-content:space-between;align-items:center;width:100%}")}function xn(t){let e,r,n,i,l;return r=new tt({props:{brandingInfo:t[0]}}),i=new Cn({}),i.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){e=$("div"),b(r.$$.fragment),n=T(),b(i.$$.fragment),h(e,"class","rcb-post-purchase-header-layout svelte-j03lz1")},m(s,o){A(s,e,o),E(r,e,null),v(e,n),E(i,e,null),l=!0},p(s,o){t=s;const c={};o&1&&(c.brandingInfo=t[0]),r.$set(c)},i(s){l||(a(r.$$.fragment,s),a(i.$$.fragment,s),l=!0)},o(s){f(r.$$.fragment,s),f(i.$$.fragment,s),l=!1},d(s){s&&m(e),I(r),I(i)}}}function Vn(t){let e,r;return e=new z({props:{as:"header",$$slots:{default:[xn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&7&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function qn(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=l=>{"brandingInfo"in l&&r(0,n=l.brandingInfo),"onClose"in l&&r(1,i=l.onClose)},[n,i]}class nt extends U{constructor(e){super(),C(this,e,qn,Vn,R,{brandingInfo:0,onClose:1},Jn)}}function Wn(t){O(t,"svelte-ahi052",".rcb-modal-error.svelte-ahi052{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-ahi052{font-size:24px}.subtitle.svelte-ahi052{font-size:16px}")}function rt(t){let e,r,n,i,l;return{c(){e=L("If this error persists, please contact "),r=$("a"),n=L(t[1]),l=L("."),h(r,"href",i="mailto:"+t[1])},m(s,o){A(s,e,o),A(s,r,o),v(r,n),A(s,l,o)},p(s,o){o&2&&re(n,s[1]),o&2&&i!==(i="mailto:"+s[1])&&h(r,"href",i)},d(s){s&&(m(e),m(r),m(l))}}}function zn(t){let e,r,n,i=t[3]()+"",l,s,o=t[1]&&rt(t);return{c(){e=$("span"),e.textContent="Something went wrong.",r=T(),n=$("span"),l=L(i),s=T(),o&&o.c(),h(e,"class","title svelte-ahi052"),h(n,"class","subtitle svelte-ahi052")},m(c,u){A(c,e,u),A(c,r,u),A(c,n,u),v(n,l),v(n,s),o&&o.m(n,null)},p(c,u){c[1]?o?o.p(c,u):(o=rt(c),o.c(),o.m(n,null)):o&&(o.d(1),o=null)},d(c){c&&(m(e),m(r),m(n)),o&&o.d()}}}function Xn(t){let e,r,n,i;return e=new Dn({}),n=new te({props:{gutter:"1rem",$$slots:{default:[zn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=T(),b(n.$$.fragment)},m(l,s){E(e,l,s),A(l,r,s),E(n,l,s),i=!0},p(l,s){const o={};s&34&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(a(e.$$.fragment,l),a(n.$$.fragment,l),i=!0)},o(l){f(e.$$.fragment,l),f(n.$$.fragment,l),i=!1},d(l){l&&m(r),I(e,l),I(n,l)}}}function Zn(t){let e,r,n;return r=new te({props:{gutter:"1rem",$$slots:{default:[Xn]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-error svelte-ahi052")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p(i,l){const s={};l&34&&(s.$$scope={dirty:l,ctx:i}),r.$set(s)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function er(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function tr(t){let e,r;return e=new Ae({props:{$$slots:{default:[er]},$$scope:{ctx:t}}}),e.$on("click",function(){ne(t[2])&&t[2].apply(this,arguments)}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){t=n;const l={};i&32&&(l.$$scope={dirty:i,ctx:t}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function nr(t){let e,r,n,i,l,s;return e=new nt({props:{brandingInfo:t[0],onClose:t[2]}}),n=new z({props:{$$slots:{default:[Zn]},$$scope:{ctx:t}}}),l=new De({props:{$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=T(),b(n.$$.fragment),i=T(),b(l.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(l,o,c),s=!0},p(o,c){const u={};c&1&&(u.brandingInfo=o[0]),c&4&&(u.onClose=o[2]),e.$set(u);const _={};c&34&&(_.$$scope={dirty:c,ctx:o}),n.$set(_);const g={};c&36&&(g.$$scope={dirty:c,ctx:o}),l.$set(g)},i(o){s||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(l.$$.fragment,o),s=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(l.$$.fragment,o),s=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(l,o)}}}function rr(t){let e,r;return e=new te({props:{gutter:"2rem",$$slots:{default:[nr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&39&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ir(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:l=null}=e,{onContinue:s}=e;be(()=>{console.debug(`Displayed error: ${S[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function o(){switch(i.errorCode){case S.UnknownError:return"An unknown error occurred.";case S.ErrorSettingUpPurchase:return"Purchase not started due to an error.";case S.ErrorChargingPayment:return"Payment failed.";case S.NetworkError:return"Network error. Please check your internet connection.";case S.StripeError:return i.message;case S.MissingEmailError:return"Email is required to complete the purchase."}return i.message}return t.$$set=c=>{"brandingInfo"in c&&r(0,n=c.brandingInfo),"lastError"in c&&r(4,i=c.lastError),"supportEmail"in c&&r(1,l=c.supportEmail),"onContinue"in c&&r(2,s=c.onContinue)},[n,l,s,o,i]}class lr extends U{constructor(e){super(),C(this,e,ir,rr,R,{brandingInfo:0,lastError:4,supportEmail:1,onContinue:2},Wn)}}const sr="data:image/svg+xml,%3csvg%20width='124'%20height='124'%20viewBox='0%200%20124%20124'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='62'%20cy='62'%20r='62'%20fill='%23576CDB'/%3e%3crect%20x='44.1116'%20y='56'%20width='27.5'%20height='11'%20transform='rotate(45%2044.1116%2056)'%20fill='white'/%3e%3crect%20x='79.1133'%20y='44.334'%20width='11'%20height='44'%20transform='rotate(45%2079.1133%2044.334)'%20fill='white'/%3e%3c/svg%3e";function or(t){O(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function cr(t){let e,r;return{c(){e=$("img"),q(e.src,r=sr)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class ar extends U{constructor(e){super(),C(this,e,null,cr,R,{},or)}}function ur(t){O(t,"svelte-1lcsna9",".rcb-modal-success.svelte-1lcsna9{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-1lcsna9{font-size:24px}.subtitle.svelte-1lcsna9{font-size:16px}")}function fr(t){let e,r,n;return{c(){e=$("span"),e.textContent="Purchase Successful",r=T(),n=$("span"),n.textContent="Your plan is now active.",h(e,"class","title svelte-1lcsna9"),h(n,"class","subtitle svelte-1lcsna9")},m(i,l){A(i,e,l),A(i,r,l),A(i,n,l)},p:y,d(i){i&&(m(e),m(r),m(n))}}}function dr(t){let e,r,n,i;return e=new ar({}),n=new te({props:{gutter:"1rem",$$slots:{default:[fr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=T(),b(n.$$.fragment)},m(l,s){E(e,l,s),A(l,r,s),E(n,l,s),i=!0},p(l,s){const o={};s&4&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(a(e.$$.fragment,l),a(n.$$.fragment,l),i=!0)},o(l){f(e.$$.fragment,l),f(n.$$.fragment,l),i=!1},d(l){l&&m(r),I(e,l),I(n,l)}}}function mr(t){let e,r,n;return r=new te({props:{gutter:"1rem",$$slots:{default:[dr]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-success svelte-1lcsna9")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p(i,l){const s={};l&4&&(s.$$scope={dirty:l,ctx:i}),r.$set(s)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function gr(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Ar(t){let e,r;return e=new Ae({props:{$$slots:{default:[gr]},$$scope:{ctx:t}}}),e.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){t=n;const l={};i&4&&(l.$$scope={dirty:i,ctx:t}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function _r(t){let e,r,n,i,l,s;return e=new nt({props:{brandingInfo:t[0],onClose:t[1]}}),n=new z({props:{$$slots:{default:[mr]},$$scope:{ctx:t}}}),l=new De({props:{$$slots:{default:[Ar]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=T(),b(n.$$.fragment),i=T(),b(l.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(l,o,c),s=!0},p(o,c){const u={};c&1&&(u.brandingInfo=o[0]),c&2&&(u.onClose=o[1]),e.$set(u);const _={};c&4&&(_.$$scope={dirty:c,ctx:o}),n.$set(_);const g={};c&6&&(g.$$scope={dirty:c,ctx:o}),l.$set(g)},i(o){s||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(l.$$.fragment,o),s=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(l.$$.fragment,o),s=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(l,o)}}}function pr(t){let e,r;return e=new te({props:{gutter:"2rem",$$slots:{default:[_r]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&7&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function hr(t,e,r){let{brandingInfo:n=null}=e,{onContinue:i}=e;return t.$$set=l=>{"brandingInfo"in l&&r(0,n=l.brandingInfo),"onContinue"in l&&r(1,i=l.onContinue)},[n,i]}class Er extends U{constructor(e){super(),C(this,e,hr,pr,R,{brandingInfo:0,onContinue:1},ur)}}function Ir(t,e,r,n,i={}){const l=r.create(e,i);return l.mount(t),l.on("change",s=>n("change",s)),l.on("ready",s=>n("ready",s)),l.on("focus",s=>n("focus",s)),l.on("blur",s=>n("blur",s)),l.on("escape",s=>n("escape",s)),l.on("click",s=>n("click",s)),l.on("loaderror",s=>n("loaderror",s)),l.on("loaderstart",s=>n("loaderstart",s)),l.on("networkschange",s=>n("networkschange",s)),l}const wr=typeof window>"u";function br(t){if(!wr)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function $r(t){let e;return{c(){e=$("div")},m(r,n){A(r,e,n),t[6](e)},p:y,i:y,o:y,d(r){r&&m(e),t[6](null)}}}function Br(t,e,r){let n,i;const l=Ht(),{elements:s}=jt("stripe");let{options:o=void 0}=e;be(()=>(n=Ir(i,"payment",s,l,o),()=>n.destroy()));function c(){n.blur()}function u(){n.clear()}function _(){n.destroy()}function g(){n.focus()}function B(k){$e[k?"unshift":"push"](()=>{i=k,r(0,i)})}return t.$$set=k=>{"options"in k&&r(1,o=k.options)},[i,o,c,u,_,g,B]}class kr extends U{constructor(e){super(),C(this,e,Br,$r,R,{options:1,blur:2,clear:3,destroy:4,focus:5})}get blur(){return this.$$.ctx[2]}get clear(){return this.$$.ctx[3]}get destroy(){return this.$$.ctx[4]}get focus(){return this.$$.ctx[5]}}function it(t){let e;const r=t[15].default,n=j(r,t,t[14],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&16384)&&x(n,r,i,i[14],e?J(r,i[14],l,null):V(i[14]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function yr(t){let e,r,n=t[1]&&t[0]&&it(t);return{c(){n&&n.c(),e=Z()},m(i,l){n&&n.m(i,l),A(i,e,l),r=!0},p(i,[l]){i[1]&&i[0]?n?(n.p(i,l),l&3&&a(n,1)):(n=it(i),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G())},i(i){r||(a(n),r=!0)},o(i){f(n),r=!1},d(i){i&&m(e),n&&n.d(i)}}}function Dr(t,e,r){let n,{$$slots:i={},$$scope:l}=e,{stripe:s}=e,{mode:o=void 0}=e,{theme:c="stripe"}=e,{variables:u={}}=e,{rules:_={}}=e,{labels:g="above"}=e,{loader:B="auto"}=e,{fonts:k=[]}=e,{locale:w="auto"}=e,{currency:D=void 0}=e,{amount:M=void 0}=e,{clientSecret:N=void 0}=e,{elements:d=null}=e;return t.$$set=p=>{"stripe"in p&&r(1,s=p.stripe),"mode"in p&&r(2,o=p.mode),"theme"in p&&r(3,c=p.theme),"variables"in p&&r(4,u=p.variables),"rules"in p&&r(5,_=p.rules),"labels"in p&&r(6,g=p.labels),"loader"in p&&r(7,B=p.loader),"fonts"in p&&r(8,k=p.fonts),"locale"in p&&r(9,w=p.locale),"currency"in p&&r(10,D=p.currency),"amount"in p&&r(11,M=p.amount),"clientSecret"in p&&r(12,N=p.clientSecret),"elements"in p&&r(0,d=p.elements),"$$scope"in p&&r(14,l=p.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:u,rules:_,labels:g}),t.$$.dirty&16263&&s&&!d&&(r(0,d=s.elements({mode:o,currency:D,amount:M,appearance:n,clientSecret:N,fonts:k,loader:B,locale:w})),br(s),Kt("stripe",{stripe:s,elements:d})),t.$$.dirty&8705&&d&&d.update({appearance:n,locale:w})},[d,s,o,c,u,_,g,B,k,w,D,M,N,n,l,i]}class Qr extends U{constructor(e){super(),C(this,e,Dr,yr,R,{stripe:1,mode:2,theme:3,variables:4,rules:5,labels:6,loader:7,fonts:8,locale:9,currency:10,amount:11,clientSecret:12,elements:0})}}var lt="https://js.stripe.com/v3",vr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,st="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Mr=function(){for(var e=document.querySelectorAll('script[src^="'.concat(lt,'"]')),r=0;r<e.length;r++){var n=e[r];if(vr.test(n.src))return n}return null},ot=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(lt).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},Tr=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.3.0",startTime:r})},_e=null,ve=null,Me=null,Pr=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Nr=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},Rr=function(e){return _e!==null?_e:(_e=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(st),window.Stripe){r(window.Stripe);return}try{var i=Mr();if(i&&e)console.warn(st);else if(!i)i=ot(e);else if(i&&Me!==null&&ve!==null){var l;i.removeEventListener("load",Me),i.removeEventListener("error",ve),(l=i.parentNode)===null||l===void 0||l.removeChild(i),i=ot(e)}Me=Nr(r,n),ve=Pr(n),i.addEventListener("load",Me),i.addEventListener("error",ve)}catch(s){n(s);return}}),_e.catch(function(r){return _e=null,Promise.reject(r)}))},Cr=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return Tr(i,n),i},pe,ct=!1,at=function(){return pe||(pe=Rr(null).catch(function(e){return pe=null,Promise.reject(e)}),pe)};Promise.resolve().then(function(){return at()}).catch(function(t){ct||console.warn(t)});var Ur=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];ct=!0;var i=Date.now();return at().then(function(l){return Cr(l,r,i)})};function Or(t){O(t,"svelte-1fwwzeb",".rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}")}function Sr(t){let e,r;return e=new ke({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Lr(t){let e,r,n,i,l,s;function o(u){t[9](u)}let c={stripe:t[2],clientSecret:t[4],loader:"always",$$slots:{default:[xr]},$$scope:{ctx:t}};return t[1]!==void 0&&(c.elements=t[1]),r=new Qr({props:c}),$e.push(()=>zt(r,"elements",o)),{c(){e=$("form"),b(r.$$.fragment)},m(u,_){A(u,e,_),E(r,e,null),i=!0,l||(s=fe(e,"submit",Je(t[5])),l=!0)},p(u,_){const g={};_&4&&(g.stripe=u[2]),_&2057&&(g.$$scope={dirty:_,ctx:u}),!n&&_&2&&(n=!0,g.elements=u[1],Vt(()=>n=!1)),r.$set(g)},i(u){i||(a(r.$$.fragment,u),i=!0)},o(u){f(r.$$.fragment,u),i=!1},d(u){u&&m(e),I(r),l=!1,s()}}}function Fr(t){let e,r,n;return r=new kr({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-stripe-elements-container svelte-1fwwzeb")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p:y,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function Gr(t){let e;return{c(){e=L("Pay")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Yr(t){let e;return{c(){e=L("Processing...")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Hr(t){let e;function r(l,s){return l[3]?Yr:Gr}let n=r(t),i=n(t);return{c(){i.c(),e=Z()},m(l,s){i.m(l,s),A(l,e,s)},p(l,s){n!==(n=r(l))&&(i.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},d(l){l&&m(e),i.d(l)}}}function Kr(t){let e;return{c(){e=L("Close")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function jr(t){let e,r,n,i;return e=new Ae({props:{disabled:t[3],$$slots:{default:[Hr]},$$scope:{ctx:t}}}),n=new Ae({props:{disabled:t[3],intent:"secondary",$$slots:{default:[Kr]},$$scope:{ctx:t}}}),n.$on("click",function(){ne(t[0])&&t[0].apply(this,arguments)}),{c(){b(e.$$.fragment),r=T(),b(n.$$.fragment)},m(l,s){E(e,l,s),A(l,r,s),E(n,l,s),i=!0},p(l,s){t=l;const o={};s&8&&(o.disabled=t[3]),s&2056&&(o.$$scope={dirty:s,ctx:t}),e.$set(o);const c={};s&8&&(c.disabled=t[3]),s&2048&&(c.$$scope={dirty:s,ctx:t}),n.$set(c)},i(l){i||(a(e.$$.fragment,l),a(n.$$.fragment,l),i=!0)},o(l){f(e.$$.fragment,l),f(n.$$.fragment,l),i=!1},d(l){l&&m(r),I(e,l),I(n,l)}}}function Jr(t){let e,r;return e=new te({props:{$$slots:{default:[jr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&2057&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function xr(t){let e,r,n,i;return e=new z({props:{$$slots:{default:[Fr]},$$scope:{ctx:t}}}),n=new De({props:{$$slots:{default:[Jr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=T(),b(n.$$.fragment)},m(l,s){E(e,l,s),A(l,r,s),E(n,l,s),i=!0},p(l,s){const o={};s&2048&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const c={};s&2057&&(c.$$scope={dirty:s,ctx:l}),n.$set(c)},i(l){i||(a(e.$$.fragment,l),a(n.$$.fragment,l),i=!0)},o(l){f(e.$$.fragment,l),f(n.$$.fragment,l),i=!1},d(l){l&&m(r),I(e,l),I(n,l)}}}function Vr(t){let e,r,n,i;const l=[Lr,Sr],s=[];function o(c,u){return c[2]&&c[4]?0:1}return r=o(t),n=s[r]=l[r](t),{c(){e=$("div"),n.c()},m(c,u){A(c,e,u),s[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?s[r].p(c,u):(F(),f(s[_],1,1,()=>{s[_]=null}),G(),n=s[r],n?n.p(c,u):(n=s[r]=l[r](c),n.c()),a(n,1),n.m(e,null))},i(c){i||(a(n),i=!0)},o(c){f(n),i=!1},d(c){c&&m(e),s[r].d()}}}function qr(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:l}=e,{paymentInfoCollectionMetadata:s}=e;const o=s.data.client_secret;let c=null,u,_=!1,g;be(async()=>{const w=s.data.publishable_api_key,D=s.data.stripe_account_id;if(!w||!D)throw new Error("Stripe publishable key or account ID not found");r(2,c=await Ur(w,{stripeAccount:D}))});const B=async()=>{if(_||!c||!g)return;r(3,_=!0);const w=await c.confirmSetup({elements:g,redirect:"if_required"});w.error?(r(3,_=!1),l(new H(S.StripeError,w.error.message))):i()};function k(w){u=w,r(1,u)}return t.$$set=w=>{"onClose"in w&&r(0,n=w.onClose),"onContinue"in w&&r(6,i=w.onContinue),"onError"in w&&r(7,l=w.onError),"paymentInfoCollectionMetadata"in w&&r(8,s=w.paymentInfoCollectionMetadata)},t.$$.update=()=>{t.$$.dirty&2&&u&&u._elements.length>0&&(g=u)},[n,u,c,_,o,B,i,l,s,k]}class Wr extends U{constructor(e){super(),C(this,e,qr,Vr,R,{onClose:0,onContinue:6,onError:7,paymentInfoCollectionMetadata:8},Or)}}function zr(t){O(t,"svelte-1xardyz",".form-container.svelte-1xardyz{display:flex;flex-direction:column;width:100%}.form-label.svelte-1xardyz{margin-top:0.5rem;margin-bottom:0.5rem;display:block}.form-input.svelte-1xardyz{margin-bottom:1rem}.title.svelte-1xardyz{font-size:1.5rem;margin:0;margin-bottom:0.5rem}input.svelte-1xardyz{width:94%;padding:0.5rem;border:1px solid #ccc;border-radius:0.25rem}")}function Xr(t){let e;return{c(){e=$("span"),e.textContent="User authentication",h(e,"class","title svelte-1xardyz")},m(r,n){A(r,e,n)},p:y,d(r){r&&m(e)}}}function Zr(t){let e,r,n,i,l,s,o;return{c(){e=$("div"),r=$("div"),r.innerHTML='<label for="email">E-mail</label>',n=T(),i=$("div"),l=$("input"),h(r,"class","form-label svelte-1xardyz"),h(l,"name","email"),h(l,"placeholder","john@appleseed.com"),h(l,"class","svelte-1xardyz"),h(i,"class","form-input svelte-1xardyz"),h(e,"class","form-container svelte-1xardyz")},m(c,u){A(c,e,u),v(e,r),v(e,n),v(e,i),v(i,l),xe(l,t[0]),s||(o=fe(l,"input",t[3]),s=!0)},p(c,u){u&1&&l.value!==c[0]&&xe(l,c[0])},d(c){c&&m(e),s=!1,o()}}}function ei(t){let e;return{c(){e=L("Continue")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function ti(t){let e,r;return e=new Ae({props:{$$slots:{default:[ei]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&16&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ni(t){let e,r,n,i,l,s,o,c,u,_;return n=new z({props:{$$slots:{default:[Xr]},$$scope:{ctx:t}}}),l=new z({props:{$$slots:{default:[Zr]},$$scope:{ctx:t}}}),o=new De({props:{$$slots:{default:[ti]},$$scope:{ctx:t}}}),{c(){e=$("div"),r=$("form"),b(n.$$.fragment),i=T(),b(l.$$.fragment),s=T(),b(o.$$.fragment)},m(g,B){A(g,e,B),v(e,r),E(n,r,null),v(r,i),E(l,r,null),v(r,s),E(o,r,null),c=!0,u||(_=fe(r,"submit",Je(t[1])),u=!0)},p(g,[B]){const k={};B&16&&(k.$$scope={dirty:B,ctx:g}),n.$set(k);const w={};B&17&&(w.$$scope={dirty:B,ctx:g}),l.$set(w);const D={};B&16&&(D.$$scope={dirty:B,ctx:g}),o.$set(D)},i(g){c||(a(n.$$.fragment,g),a(l.$$.fragment,g),a(o.$$.fragment,g),c=!0)},o(g){f(n.$$.fragment,g),f(l.$$.fragment,g),f(o.$$.fragment,g),c=!1},d(g){g&&m(e),I(n),I(l),I(o),u=!1,_()}}}function ri(t,e,r){let n,{onContinue:i}=e;const l=async()=>{i({email:n})};function s(){n=this.value,r(0,n)}return t.$$set=o=>{"onContinue"in o&&r(2,i=o.onContinue)},r(0,n=""),[n,l,i,s]}class ii extends U{constructor(e){super(),C(this,e,ri,ni,R,{onContinue:2},zr)}}const li="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20opacity='0.5'%20clip-path='url(%23clip0_344_3390)'%3e%3cpath%20d='M7%2018C5.9%2018%205.01%2018.9%205.01%2020C5.01%2021.1%205.9%2022%207%2022C8.1%2022%209%2021.1%209%2020C9%2018.9%208.1%2018%207%2018ZM1%202V4H3L6.6%2011.59L5.25%2014.04C5.09%2014.32%205%2014.65%205%2015C5%2016.1%205.9%2017%207%2017H19V15H7.42C7.28%2015%207.17%2014.89%207.17%2014.75L7.2%2014.63L8.1%2013H15.55C16.3%2013%2016.96%2012.59%2017.3%2011.97L20.88%205.48C20.96%205.34%2021%205.17%2021%205C21%204.45%2020.55%204%2020%204H5.21L4.27%202H1ZM17%2018C15.9%2018%2015.01%2018.9%2015.01%2020C15.01%2021.1%2015.9%2022%2017%2022C18.1%2022%2019%2021.1%2019%2020C19%2018.9%2018.1%2018%2017%2018Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_344_3390'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function si(t){let e,r;return{c(){e=$("img"),q(e.src,r=li)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class oi extends U{constructor(e){super(),C(this,e,null,si,R,{})}}function ci(t){O(t,"svelte-1ggdgso",".rcb-header-layout.svelte-1ggdgso{display:flex;justify-content:space-between;align-items:center;width:100%}")}function ai(t){let e,r,n,i,l;return r=new tt({props:{brandingInfo:t[0]}}),i=new oi({}),{c(){e=$("div"),b(r.$$.fragment),n=T(),b(i.$$.fragment),h(e,"class","rcb-header-layout svelte-1ggdgso")},m(s,o){A(s,e,o),E(r,e,null),v(e,n),E(i,e,null),l=!0},p(s,o){const c={};o&1&&(c.brandingInfo=s[0]),r.$set(c)},i(s){l||(a(r.$$.fragment,s),a(i.$$.fragment,s),l=!0)},o(s){f(r.$$.fragment,s),f(i.$$.fragment,s),l=!1},d(s){s&&m(e),I(r),I(i)}}}function ui(t){let e,r;return e=new z({props:{as:"header",$$slots:{default:[ai]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&3&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function fi(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class di extends U{constructor(e){super(),C(this,e,fi,ui,R,{brandingInfo:0},ci)}}function mi(t){O(t,"svelte-17dhulw",".rcb-modal-backdrop.svelte-17dhulw{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around}")}function gi(t){let e,r;const n=t[1].default,i=j(n,t,t[0],null);return{c(){e=$("div"),i&&i.c(),h(e,"class","rcb-modal-backdrop svelte-17dhulw")},m(l,s){A(l,e,s),i&&i.m(e,null),r=!0},p(l,[s]){i&&i.p&&(!r||s&1)&&x(i,n,l,l[0],r?J(n,l[0],s,null):V(l[0]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&m(e),i&&i.d(l)}}}function Ai(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=l=>{"$$scope"in l&&r(0,i=l.$$scope)},[i,n]}class _i extends U{constructor(e){super(),C(this,e,Ai,gi,R,{},mi)}}function pi(t){O(t,"svelte-m6kocx",".rcb-modal-main.svelte-m6kocx{box-sizing:border-box;border-radius:0.5rem;background-color:#fff;color:black;max-width:40rem;min-width:30rem;overflow-y:auto;padding:2.5rem}.rcb-modal-dark.svelte-m6kocx{background-color:#000;color:#fff;max-width:30rem;min-width:20rem}@media screen and (max-width: 60rem){.rcb-modal-main.svelte-m6kocx,.rcb-modal-dark.svelte-m6kocx{max-width:40rem;min-width:90vw}}")}function hi(t){let e,r,n;const i=t[2].default,l=j(i,t,t[1],null);return{c(){e=$("main"),l&&l.c(),h(e,"class",r=ue(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx")},m(s,o){A(s,e,o),l&&l.m(e,null),n=!0},p(s,[o]){l&&l.p&&(!n||o&2)&&x(l,i,s,s[1],n?J(i,s[1],o,null):V(s[1]),null),(!n||o&1&&r!==(r=ue(`rcb-modal-main ${s[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx"))&&h(e,"class",r)},i(s){n||(a(l,s),n=!0)},o(s){f(l,s),n=!1},d(s){s&&m(e),l&&l.d(s)}}}function Ei(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:l=!1}=e;return t.$$set=s=>{"dark"in s&&r(0,l=s.dark),"$$scope"in s&&r(1,i=s.$$scope)},[l,i,n]}class Ii extends U{constructor(e){super(),C(this,e,Ei,hi,R,{dark:0},pi)}}function wi(t){let e;const r=t[1].default,n=j(r,t,t[2],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&4)&&x(n,r,i,i[2],e?J(r,i[2],l,null):V(i[2]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function bi(t){let e,r;return e=new _i({props:{$$slots:{default:[$i]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&4&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function $i(t){let e;const r=t[1].default,n=j(r,t,t[2],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&4)&&x(n,r,i,i[2],e?J(r,i[2],l,null):V(i[2]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function Bi(t){let e,r,n,i;const l=[bi,wi],s=[];function o(c,u){return c[0]?0:1}return e=o(t),r=s[e]=l[e](t),{c(){r.c(),n=Z()},m(c,u){s[e].m(c,u),A(c,n,u),i=!0},p(c,[u]){let _=e;e=o(c),e===_?s[e].p(c,u):(F(),f(s[_],1,1,()=>{s[_]=null}),G(),r=s[e],r?r.p(c,u):(r=s[e]=l[e](c),r.c()),a(r,1),r.m(n.parentNode,n))},i(c){i||(a(r),i=!0)},o(c){f(r),i=!1},d(c){c&&m(n),s[e].d(c)}}}function ki(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:l=!1}=e;return t.$$set=s=>{"condition"in s&&r(0,l=s.condition),"$$scope"in s&&r(2,i=s.$$scope)},[l,n,i]}class yi extends U{constructor(e){super(),C(this,e,ki,Bi,R,{condition:0})}}function ut(t){let e,r;return e=new di({props:{brandingInfo:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&4&&(l.brandingInfo=n[2]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Di(t){let e,r,n=t[1]&&ut(t);const i=t[3].default,l=j(i,t,t[4],null);return{c(){n&&n.c(),e=T(),l&&l.c()},m(s,o){n&&n.m(s,o),A(s,e,o),l&&l.m(s,o),r=!0},p(s,o){s[1]?n?(n.p(s,o),o&2&&a(n,1)):(n=ut(s),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G()),l&&l.p&&(!r||o&16)&&x(l,i,s,s[4],r?J(i,s[4],o,null):V(s[4]),null)},i(s){r||(a(n),a(l,s),r=!0)},o(s){f(n),f(l,s),r=!1},d(s){s&&m(e),n&&n.d(s),l&&l.d(s)}}}function Qi(t){let e,r;return e=new Ii({props:{dark:t[0],$$slots:{default:[Di]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const l={};i&1&&(l.dark=n[0]),i&22&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function vi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:l=!1}=e,{showHeader:s=!1}=e,{brandingInfo:o=null}=e;return t.$$set=c=>{"dark"in c&&r(0,l=c.dark),"showHeader"in c&&r(1,s=c.showHeader),"brandingInfo"in c&&r(2,o=c.brandingInfo),"$$scope"in c&&r(4,i=c.$$scope)},[l,s,o,n,i]}class ft extends U{constructor(e){super(),C(this,e,vi,Qi,R,{dark:0,showHeader:1,brandingInfo:2})}}var he=(t=>(t[t.UnknownError=0]="UnknownError",t[t.UserCancelledError=1]="UserCancelledError",t[t.StoreProblemError=2]="StoreProblemError",t[t.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",t[t.PurchaseInvalidError=4]="PurchaseInvalidError",t[t.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",t[t.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",t[t.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",t[t.InvalidReceiptError=8]="InvalidReceiptError",t[t.MissingReceiptFileError=9]="MissingReceiptFileError",t[t.NetworkError=10]="NetworkError",t[t.InvalidCredentialsError=11]="InvalidCredentialsError",t[t.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",t[t.InvalidAppUserIdError=14]="InvalidAppUserIdError",t[t.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",t[t.UnknownBackendError=16]="UnknownBackendError",t[t.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",t[t.IneligibleError=18]="IneligibleError",t[t.InsufficientPermissionsError=19]="InsufficientPermissionsError",t[t.PaymentPendingError=20]="PaymentPendingError",t[t.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",t[t.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",t[t.ConfigurationError=23]="ConfigurationError",t[t.UnsupportedError=24]="UnsupportedError",t[t.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",t[t.CustomerInfoError=28]="CustomerInfoError",t[t.SignatureVerificationError=36]="SignatureVerificationError",t))(he||{});class Te{static getPublicMessage(e){switch(e){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.";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."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:return 4;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}}static convertCodeToBackendErrorCode(e){return e in dt?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case S.ErrorSettingUpPurchase:return 2;case S.ErrorChargingPayment:return 20;case S.NetworkError:return 10;case S.MissingEmailError:return 4;case S.StripeError:return 2;case S.UnknownError:return 0}}}var dt=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendStoreProblem=7101]="BackendStoreProblem",t[t.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",t[t.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",t[t.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",t[t.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",t[t.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",t[t.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",t[t.BackendInternalServerError=7110]="BackendInternalServerError",t[t.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",t[t.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",t[t.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",t[t.BackendBadRequest=7226]="BackendBadRequest",t[t.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",t[t.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",t[t.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",t[t.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",t[t.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",t[t.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",t[t.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",t[t.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",t))(dt||{});class X extends Error{constructor(r,n,i){super(n);P(this,"toString",()=>`PurchasesError(code: ${he[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=Te.getErrorCodeForBackendErrorCode(r);return new X(i,Te.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new X(Te.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}const Mi="0.0.10",oe="https://api.revenuecat.com";var Pe;(function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.EARLY_HINTS=103]="EARLY_HINTS",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.USE_PROXY=305]="USE_PROXY",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",t[t.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.IM_A_TEAPOT=418]="IM_A_TEAPOT",t[t.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",t[t.METHOD_FAILURE=420]="METHOD_FAILURE",t[t.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",t[t.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(Pe||(Pe={}));function mt(t){return t?t.startsWith("rcb_sb_"):!1}async function ce(t,e,r,n){const i=await fetch(t.url(),{method:t.method,headers:Ni(e,n),body:Pi(r)});return await Ti(i,t),await i.json()}async function Ti(t,e){const r=t.status;if(r>=Pe.INTERNAL_SERVER_ERROR)Fe(e,r,await t.text());else if(r>=Pe.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,l=n==null?void 0:n.code,s=n==null?void 0:n.message;if(l!=null){const o=Te.convertCodeToBackendErrorCode(l);if(o==null)Fe(e,r,i);else throw X.getForBackendError(o,s)}else Fe(e,r,i)}}function Fe(t,e,r){throw new X(he.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function Pi(t){return t==null?null:JSON.stringify(t)}function Ni(t,e){let r={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":Mi,"X-Is-Sandbox":`${mt(t)}`};return e!=null&&(r={...r,...e}),r}const gt="/v1/subscribers",Ne="/rcbilling/v1";class Ri{constructor(e){P(this,"appUserId");P(this,"method","GET");P(this,"name","getOfferings");this.appUserId=e}url(){return`${oe}${gt}/${this.appUserId}/offerings`}}class Ci{constructor(){P(this,"method","POST");P(this,"name","subscribe")}url(){return`${oe}${Ne}/subscribe`}}class Ui{constructor(e,r){P(this,"method","GET");P(this,"name","getProducts");P(this,"appUserId");P(this,"productIds");this.appUserId=e,this.productIds=r}url(){return`${oe}${Ne}/subscribers/${this.appUserId}/products?id=${this.productIds.join("&id=")}`}}class Oi{constructor(e){P(this,"method","GET");P(this,"name","getCustomerInfo");P(this,"appUserId");this.appUserId=e}url(){return`${oe}${gt}/${this.appUserId}`}}class Si{constructor(){P(this,"method","GET");P(this,"name","getBrandingInfo")}url(){return`${oe}${Ne}/branding`}}class Li{constructor(e){P(this,"method","GET");P(this,"name","getCheckoutStatus");P(this,"operationSessionId");this.operationSessionId=e}url(){return`${oe}${Ne}/checkout/${this.operationSessionId}`}}class Fi{constructor(e){P(this,"API_KEY");this.API_KEY=e}async getOfferings(e){return await ce(new Ri(e),this.API_KEY)}async getCustomerInfo(e){return await ce(new Oi(e),this.API_KEY)}async getProducts(e,r){return await ce(new Ui(e,r),this.API_KEY)}async getBrandingInfo(){return await ce(new Si,this.API_KEY)}async postSubscribe(e,r,n){return await ce(new Ci,this.API_KEY,{app_user_id:e,product_id:r,email:n})}async getCheckoutStatus(e){return await ce(new Li(e),this.API_KEY)}}function Gi(t){O(t,"svelte-ofxzf4",`.rcb-ui-container.svelte-ofxzf4{color-scheme:none;font-family:"PP Object Sans",
2
2
  -apple-system,
3
3
  BlinkMacSystemFont,
4
4
  avenir next,
@@ -11,4 +11,4 @@
11
11
  roboto,
12
12
  noto,
13
13
  arial,
14
- sans-serif}.rcb-ui-layout.svelte-ofxzf4{display:flex;justify-content:center;align-items:flex-start}.rcb-ui-aside.svelte-ofxzf4{margin-right:1rem}@media screen and (max-width: 60rem){.rcb-ui-layout.svelte-ofxzf4{flex-direction:column;align-items:center;justify-content:flex-end;height:100%}.rcb-ui-aside.svelte-ofxzf4{margin-right:0;margin-bottom:1rem}}`)}function At(t){let e,r,n,i=t[1].isSandbox(),l;r=new ft({props:{dark:!0,showHeader:!0,brandingInfo:t[3],$$slots:{default:[Yi]},$$scope:{ctx:t}}});let s=i&&pt();return{c(){e=$("div"),b(r.$$.fragment),n=P(),s&&s.c(),h(e,"class","rcb-ui-aside svelte-ofxzf4")},m(o,c){A(o,e,c),E(r,e,null),v(e,n),s&&s.m(e,null),l=!0},p(o,c){const u={};c&8&&(u.brandingInfo=o[3]),c&4194308&&(u.$$scope={dirty:c,ctx:o}),r.$set(u),c&2&&(i=o[1].isSandbox()),i?s?c&2&&a(s,1):(s=pt(),s.c(),a(s,1),s.m(e,null)):s&&(F(),f(s,1,1,()=>{s=null}),G())},i(o){l||(a(r.$$.fragment,o),a(s),l=!0)},o(o){f(r.$$.fragment,o),f(s),l=!1},d(o){o&&m(e),I(r),s&&s.d()}}}function _t(t){let e,r;return e=new Xe({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&4&&(l.productDetails=n[2]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Yi(t){let e,r,n=t[2]&&_t(t);return{c(){n&&n.c(),e=Z()},m(i,l){n&&n.m(i,l),A(i,e,l),r=!0},p(i,l){i[2]?n?(n.p(i,l),l&4&&a(n,1)):(n=_t(i),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G())},i(i){r||(a(n),r=!0)},o(i){f(n),r=!1},d(i){i&&m(e),n&&n.d(i)}}}function pt(t){let e,r;return e=new nn({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ht(t){let e,r;return e=new Xe({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&4&&(l.productDetails=n[2]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Et(t){let e,r;return e=new Be({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function It(t){let e,r;return e=new Be({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function wt(t){let e,r;return e=new ii({props:{onContinue:t[9]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function bt(t){let e,r;return e=new Wr({props:{paymentInfoCollectionMetadata:t[4],onContinue:t[9],onClose:t[8],onError:t[10]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&16&&(l.paymentInfoCollectionMetadata=n[4]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function $t(t){let e,r;return e=new Be({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function kt(t){var n;let e,r;return e=new lr({props:{brandingInfo:t[3],lastError:t[5]??new H(S.UnknownError,"Unknown error without state set."),supportEmail:(n=t[3])==null?void 0:n.seller_company_support_email,onContinue:t[11]}}),{c(){b(e.$$.fragment)},m(i,l){E(e,i,l),r=!0},p(i,l){var o;const s={};l&8&&(s.brandingInfo=i[3]),l&32&&(s.lastError=i[5]??new H(S.UnknownError,"Unknown error without state set.")),l&8&&(s.supportEmail=(o=i[3])==null?void 0:o.seller_company_support_email),e.$set(s)},i(i){r||(a(e.$$.fragment,i),r=!0)},o(i){f(e.$$.fragment,i),r=!1},d(i){I(e,i)}}}function Bt(t){let e,r;return e=new Er({props:{brandingInfo:t[3],onContinue:t[9]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&8&&(l.brandingInfo=n[3]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Hi(t){let e,r,n,i,l,s,o,c,u,_=t[6]==="present-offer"&&t[2]&&ht(t),g=t[6]==="present-offer"&&!t[2]&&Et(),k=t[6]==="polling-purchase-status"&&It(),B=t[6]==="needs-auth-info"&&wt(t),w=t[6]==="needs-payment-info"&&t[4]&&bt(t),D=t[6]==="loading"&&$t(),M=t[6]==="error"&&kt(t),N=t[6]==="success"&&Bt(t);return{c(){_&&_.c(),e=P(),g&&g.c(),r=P(),k&&k.c(),n=P(),B&&B.c(),i=P(),w&&w.c(),l=P(),D&&D.c(),s=P(),M&&M.c(),o=P(),N&&N.c(),c=Z()},m(d,p){_&&_.m(d,p),A(d,e,p),g&&g.m(d,p),A(d,r,p),k&&k.m(d,p),A(d,n,p),B&&B.m(d,p),A(d,i,p),w&&w.m(d,p),A(d,l,p),D&&D.m(d,p),A(d,s,p),M&&M.m(d,p),A(d,o,p),N&&N.m(d,p),A(d,c,p),u=!0},p(d,p){d[6]==="present-offer"&&d[2]?_?(_.p(d,p),p&68&&a(_,1)):(_=ht(d),_.c(),a(_,1),_.m(e.parentNode,e)):_&&(F(),f(_,1,1,()=>{_=null}),G()),d[6]==="present-offer"&&!d[2]?g?p&68&&a(g,1):(g=Et(),g.c(),a(g,1),g.m(r.parentNode,r)):g&&(F(),f(g,1,1,()=>{g=null}),G()),d[6]==="polling-purchase-status"?k?p&64&&a(k,1):(k=It(),k.c(),a(k,1),k.m(n.parentNode,n)):k&&(F(),f(k,1,1,()=>{k=null}),G()),d[6]==="needs-auth-info"?B?(B.p(d,p),p&64&&a(B,1)):(B=wt(d),B.c(),a(B,1),B.m(i.parentNode,i)):B&&(F(),f(B,1,1,()=>{B=null}),G()),d[6]==="needs-payment-info"&&d[4]?w?(w.p(d,p),p&80&&a(w,1)):(w=bt(d),w.c(),a(w,1),w.m(l.parentNode,l)):w&&(F(),f(w,1,1,()=>{w=null}),G()),d[6]==="loading"?D?p&64&&a(D,1):(D=$t(),D.c(),a(D,1),D.m(s.parentNode,s)):D&&(F(),f(D,1,1,()=>{D=null}),G()),d[6]==="error"?M?(M.p(d,p),p&64&&a(M,1)):(M=kt(d),M.c(),a(M,1),M.m(o.parentNode,o)):M&&(F(),f(M,1,1,()=>{M=null}),G()),d[6]==="success"?N?(N.p(d,p),p&64&&a(N,1)):(N=Bt(d),N.c(),a(N,1),N.m(c.parentNode,c)):N&&(F(),f(N,1,1,()=>{N=null}),G())},i(d){u||(a(_),a(g),a(k),a(B),a(w),a(D),a(M),a(N),u=!0)},o(d){f(_),f(g),f(k),f(B),f(w),f(D),f(M),f(N),u=!1},d(d){d&&(m(e),m(r),m(n),m(i),m(l),m(s),m(o),m(c)),_&&_.d(d),g&&g.d(d),k&&k.d(d),B&&B.d(d),w&&w.d(d),D&&D.d(d),M&&M.d(d),N&&N.d(d)}}}function Ki(t){let e,r=t[7].includes(t[6]),n,i,l,s=r&&At(t);return i=new ft({props:{$$slots:{default:[Hi]},$$scope:{ctx:t}}}),{c(){e=$("div"),s&&s.c(),n=P(),b(i.$$.fragment),h(e,"class","rcb-ui-layout svelte-ofxzf4")},m(o,c){A(o,e,c),s&&s.m(e,null),v(e,n),E(i,e,null),l=!0},p(o,c){c&64&&(r=o[7].includes(o[6])),r?s?(s.p(o,c),c&64&&a(s,1)):(s=At(o),s.c(),a(s,1),s.m(e,n)):s&&(F(),f(s,1,1,()=>{s=null}),G());const u={};c&4194428&&(u.$$scope={dirty:c,ctx:o}),i.$set(u)},i(o){l||(a(s),a(i.$$.fragment,o),l=!0)},o(o){f(s),f(i.$$.fragment,o),l=!1},d(o){o&&m(e),s&&s.d(),I(i)}}}function ji(t){let e,r,n;return r=new yi({props:{condition:t[0],$$slots:{default:[Ki]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-ui-container svelte-ofxzf4")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p(i,[l]){const s={};l&1&&(s.condition=i[0]),l&4194430&&(s.$$scope={dirty:l,ctx:i}),r.$set(s)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function Ji(t,e,r){var Dt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:l}=e,{rcPackage:s}=e,{onFinished:o}=e,{onError:c}=e,{onClose:u}=e,{purchases:_}=e,{backend:g}=e,{purchaseOperationHelper:k}=e,B=null,w=null,D=null,M=null;const N=((Dt=s.rcBillingProduct)==null?void 0:Dt.identifier)??null;let d="present-offer";const p=["present-offer","needs-auth-info","needs-payment-info","loading"];be(async()=>{if(r(2,B=s.rcBillingProduct),r(3,w=await g.getBrandingInfo()),d==="present-offer"){i?yt():r(6,d="needs-auth-info");return}});const rl=()=>{u()},yt=()=>{if(N===null){Ee(new H(S.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else r(6,d="loading");if(!i){Ee(new H(S.MissingEmailError));return}k.startPurchase(l,N,i).then(Q=>{if(Q.next_action==="collect_payment_info"){r(6,d="needs-payment-info"),r(4,D=Q);return}if(Q.next_action==="completed"){r(6,d="success");return}}).catch(Q=>{Ee(new H(S.ErrorSettingUpPurchase,Q.message,Q.underlyingErrorMessage))})},il=Q=>{if(d==="needs-auth-info"){Q&&r(12,i=Q.email),yt();return}if(d==="needs-payment-info"){r(6,d="polling-purchase-status"),k.pollCurrentPurchaseForCompletion().then(()=>{r(6,d="success")}).catch(sl=>{Ee(sl)});return}if(d==="success"||d==="error"){o();return}r(6,d="success")},Ee=Q=>{r(5,M=Q),r(6,d="error")},ll=()=>{c(M??new H(S.UnknownError,"Unknown error without state set."))};return t.$$set=Q=>{"asModal"in Q&&r(0,n=Q.asModal),"customerEmail"in Q&&r(12,i=Q.customerEmail),"appUserId"in Q&&r(13,l=Q.appUserId),"rcPackage"in Q&&r(14,s=Q.rcPackage),"onFinished"in Q&&r(15,o=Q.onFinished),"onError"in Q&&r(16,c=Q.onError),"onClose"in Q&&r(17,u=Q.onClose),"purchases"in Q&&r(1,_=Q.purchases),"backend"in Q&&r(18,g=Q.backend),"purchaseOperationHelper"in Q&&r(19,k=Q.purchaseOperationHelper)},[n,_,B,w,D,M,d,p,rl,il,Ee,ll,i,l,s,o,c,u,g,k]}class xi extends U{constructor(e){super(),C(this,e,Ji,ji,R,{asModal:0,customerEmail:12,appUserId:13,rcPackage:14,onFinished:15,onError:16,onClose:17,purchases:1,backend:18,purchaseOperationHelper:19},Gi)}}function Vi(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function qi(t,e,r){return{identifier:t,isActive:Vi(e),willRenew:Xi(e,r),store:(r==null?void 0:r.store)??"unknown",originalPurchaseDate:new Date(e.purchase_date),expirationDate:Re(e.expires_date),productIdentifier:e.product_identifier,unsubscribeDetectedAt:Re(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:Re(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 Wi(t,e){const r={},n={};for(const i in t){const l=e[i]??null,s=qi(i,t[i],l);r[i]=s,s.isActive&&(n[i]=s)}return{all:r,active:n}}function Re(t){return t==null?null:new Date(t)}function zi(t){const e=el(t),r=t.subscriber;return{entitlements:Wi(r.entitlements,r.subscriptions),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:Zi(t),activeSubscriptions:tl(e),managementURL:r.management_url,requestDate:new Date(t.request_date),firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Re(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id}}function Xi(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,l=e.billing_issues_detected_at!=null;return!(r||n||i||l)}function Zi(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];e[r]=new Date(n.purchase_date)}return e}function el(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];n.expires_date==null?e[r]=null:e[r]=new Date(n.expires_date)}return e}function tl(t){const e=new Set,r=new Date;for(const n in t){const i=t[n];(i==null||i>r)&&e.add(n)}return e}class nl{constructor(e){T(this,"_API_KEY");T(this,"backend");T(this,"purchaseOperationHelper");T(this,"toOfferings",(e,r)=>{const n=e.offerings.find(o=>o.identifier===e.current_offering_id)??null,i={};r.product_details.forEach(o=>{i[o.identifier]=o});const l=n==null?null:Ge(n,i),s={};return e.offerings.forEach(o=>{const c=Ge(o,i);c!=null&&(s[o.identifier]=c)}),Object.keys(s).length==0&&console.debug("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:s,current:l}});this._API_KEY=e,this.backend=new Fi(this._API_KEY),this.purchaseOperationHelper=new pn(this.backend)}async getOfferings(e){const r=await this.backend.getOfferings(e),n=r.offerings.flatMap(l=>l.packages).map(l=>l.platform_product_identifier),i=await this.backend.getProducts(e,n);return this.logMissingProductIds(n,i.product_details),this.toOfferings(r,i)}async isEntitledTo(e,r){const n=await this.getCustomerInfo(e);return r in n.entitlements.active}purchasePackage(e,r,n,i){let l=i??document.getElementById("rcb-ui-root");if(l===null){const c=document.createElement("div");c.className="rcb-ui-root",document.body.appendChild(c),l=c}if(l===null)throw new Error("Could not generate a mount point for the billing widget");const s=l,o=!i;return new Promise((c,u)=>{new xi({target:s,props:{appUserId:e,rcPackage:r,customerEmail:n,onFinished:async()=>{s.innerHTML="",c({customerInfo:await this.getCustomerInfo(e)})},onClose:()=>{s.innerHTML="",u(new X(he.UserCancelledError))},onError:_=>{s.innerHTML="",u(X.getForPurchasesFlowError(_))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:o}})})}async getCustomerInfo(e){const r=await this.backend.getCustomerInfo(e);return zi(r)}logMissingProductIds(e,r){const n={};r.forEach(l=>n[l.identifier]=l);const i=[];e.forEach(l=>{n[l]===void 0&&i.push(l)}),i.length>0&&console.debug("Could not find product data for product ids: ",i,". Please check that your product configuration is correct.")}isSandbox(){return mt(this._API_KEY)}}Y.ErrorCode=he,Y.PackageType=W,Y.Purchases=nl,Y.PurchasesError=X,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
14
+ sans-serif}.rcb-ui-layout.svelte-ofxzf4{display:flex;justify-content:center;align-items:flex-start}.rcb-ui-aside.svelte-ofxzf4{margin-right:1rem}@media screen and (max-width: 60rem){.rcb-ui-layout.svelte-ofxzf4{flex-direction:column;align-items:center;justify-content:flex-end;height:100%}.rcb-ui-aside.svelte-ofxzf4{margin-right:0;margin-bottom:1rem}}`)}function At(t){let e,r,n,i=t[1].isSandbox(),l;r=new ft({props:{dark:!0,showHeader:!0,brandingInfo:t[3],$$slots:{default:[Yi]},$$scope:{ctx:t}}});let s=i&&pt();return{c(){e=$("div"),b(r.$$.fragment),n=T(),s&&s.c(),h(e,"class","rcb-ui-aside svelte-ofxzf4")},m(o,c){A(o,e,c),E(r,e,null),v(e,n),s&&s.m(e,null),l=!0},p(o,c){const u={};c&8&&(u.brandingInfo=o[3]),c&4194308&&(u.$$scope={dirty:c,ctx:o}),r.$set(u),c&2&&(i=o[1].isSandbox()),i?s?c&2&&a(s,1):(s=pt(),s.c(),a(s,1),s.m(e,null)):s&&(F(),f(s,1,1,()=>{s=null}),G())},i(o){l||(a(r.$$.fragment,o),a(s),l=!0)},o(o){f(r.$$.fragment,o),f(s),l=!1},d(o){o&&m(e),I(r),s&&s.d()}}}function _t(t){let e,r;return e=new Xe({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&4&&(l.productDetails=n[2]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Yi(t){let e,r,n=t[2]&&_t(t);return{c(){n&&n.c(),e=Z()},m(i,l){n&&n.m(i,l),A(i,e,l),r=!0},p(i,l){i[2]?n?(n.p(i,l),l&4&&a(n,1)):(n=_t(i),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G())},i(i){r||(a(n),r=!0)},o(i){f(n),r=!1},d(i){i&&m(e),n&&n.d(i)}}}function pt(t){let e,r;return e=new nn({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ht(t){let e,r;return e=new Xe({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&4&&(l.productDetails=n[2]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Et(t){let e,r;return e=new ke({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function It(t){let e,r;return e=new ke({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function wt(t){let e,r;return e=new ii({props:{onContinue:t[9]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function bt(t){let e,r;return e=new Wr({props:{paymentInfoCollectionMetadata:t[4],onContinue:t[9],onClose:t[8],onError:t[10]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&16&&(l.paymentInfoCollectionMetadata=n[4]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function $t(t){let e,r;return e=new ke({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Bt(t){var n;let e,r;return e=new lr({props:{brandingInfo:t[3],lastError:t[5]??new H(S.UnknownError,"Unknown error without state set."),supportEmail:(n=t[3])==null?void 0:n.seller_company_support_email,onContinue:t[11]}}),{c(){b(e.$$.fragment)},m(i,l){E(e,i,l),r=!0},p(i,l){var o;const s={};l&8&&(s.brandingInfo=i[3]),l&32&&(s.lastError=i[5]??new H(S.UnknownError,"Unknown error without state set.")),l&8&&(s.supportEmail=(o=i[3])==null?void 0:o.seller_company_support_email),e.$set(s)},i(i){r||(a(e.$$.fragment,i),r=!0)},o(i){f(e.$$.fragment,i),r=!1},d(i){I(e,i)}}}function kt(t){let e,r;return e=new Er({props:{brandingInfo:t[3],onContinue:t[9]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const l={};i&8&&(l.brandingInfo=n[3]),e.$set(l)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Hi(t){let e,r,n,i,l,s,o,c,u,_=t[6]==="present-offer"&&t[2]&&ht(t),g=t[6]==="present-offer"&&!t[2]&&Et(),B=t[6]==="polling-purchase-status"&&It(),k=t[6]==="needs-auth-info"&&wt(t),w=t[6]==="needs-payment-info"&&t[4]&&bt(t),D=t[6]==="loading"&&$t(),M=t[6]==="error"&&Bt(t),N=t[6]==="success"&&kt(t);return{c(){_&&_.c(),e=T(),g&&g.c(),r=T(),B&&B.c(),n=T(),k&&k.c(),i=T(),w&&w.c(),l=T(),D&&D.c(),s=T(),M&&M.c(),o=T(),N&&N.c(),c=Z()},m(d,p){_&&_.m(d,p),A(d,e,p),g&&g.m(d,p),A(d,r,p),B&&B.m(d,p),A(d,n,p),k&&k.m(d,p),A(d,i,p),w&&w.m(d,p),A(d,l,p),D&&D.m(d,p),A(d,s,p),M&&M.m(d,p),A(d,o,p),N&&N.m(d,p),A(d,c,p),u=!0},p(d,p){d[6]==="present-offer"&&d[2]?_?(_.p(d,p),p&68&&a(_,1)):(_=ht(d),_.c(),a(_,1),_.m(e.parentNode,e)):_&&(F(),f(_,1,1,()=>{_=null}),G()),d[6]==="present-offer"&&!d[2]?g?p&68&&a(g,1):(g=Et(),g.c(),a(g,1),g.m(r.parentNode,r)):g&&(F(),f(g,1,1,()=>{g=null}),G()),d[6]==="polling-purchase-status"?B?p&64&&a(B,1):(B=It(),B.c(),a(B,1),B.m(n.parentNode,n)):B&&(F(),f(B,1,1,()=>{B=null}),G()),d[6]==="needs-auth-info"?k?(k.p(d,p),p&64&&a(k,1)):(k=wt(d),k.c(),a(k,1),k.m(i.parentNode,i)):k&&(F(),f(k,1,1,()=>{k=null}),G()),d[6]==="needs-payment-info"&&d[4]?w?(w.p(d,p),p&80&&a(w,1)):(w=bt(d),w.c(),a(w,1),w.m(l.parentNode,l)):w&&(F(),f(w,1,1,()=>{w=null}),G()),d[6]==="loading"?D?p&64&&a(D,1):(D=$t(),D.c(),a(D,1),D.m(s.parentNode,s)):D&&(F(),f(D,1,1,()=>{D=null}),G()),d[6]==="error"?M?(M.p(d,p),p&64&&a(M,1)):(M=Bt(d),M.c(),a(M,1),M.m(o.parentNode,o)):M&&(F(),f(M,1,1,()=>{M=null}),G()),d[6]==="success"?N?(N.p(d,p),p&64&&a(N,1)):(N=kt(d),N.c(),a(N,1),N.m(c.parentNode,c)):N&&(F(),f(N,1,1,()=>{N=null}),G())},i(d){u||(a(_),a(g),a(B),a(k),a(w),a(D),a(M),a(N),u=!0)},o(d){f(_),f(g),f(B),f(k),f(w),f(D),f(M),f(N),u=!1},d(d){d&&(m(e),m(r),m(n),m(i),m(l),m(s),m(o),m(c)),_&&_.d(d),g&&g.d(d),B&&B.d(d),k&&k.d(d),w&&w.d(d),D&&D.d(d),M&&M.d(d),N&&N.d(d)}}}function Ki(t){let e,r=t[7].includes(t[6]),n,i,l,s=r&&At(t);return i=new ft({props:{$$slots:{default:[Hi]},$$scope:{ctx:t}}}),{c(){e=$("div"),s&&s.c(),n=T(),b(i.$$.fragment),h(e,"class","rcb-ui-layout svelte-ofxzf4")},m(o,c){A(o,e,c),s&&s.m(e,null),v(e,n),E(i,e,null),l=!0},p(o,c){c&64&&(r=o[7].includes(o[6])),r?s?(s.p(o,c),c&64&&a(s,1)):(s=At(o),s.c(),a(s,1),s.m(e,n)):s&&(F(),f(s,1,1,()=>{s=null}),G());const u={};c&4194428&&(u.$$scope={dirty:c,ctx:o}),i.$set(u)},i(o){l||(a(s),a(i.$$.fragment,o),l=!0)},o(o){f(s),f(i.$$.fragment,o),l=!1},d(o){o&&m(e),s&&s.d(),I(i)}}}function ji(t){let e,r,n;return r=new yi({props:{condition:t[0],$$slots:{default:[Ki]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-ui-container svelte-ofxzf4")},m(i,l){A(i,e,l),E(r,e,null),n=!0},p(i,[l]){const s={};l&1&&(s.condition=i[0]),l&4194430&&(s.$$scope={dirty:l,ctx:i}),r.$set(s)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function Ji(t,e,r){var Dt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:l}=e,{rcPackage:s}=e,{onFinished:o}=e,{onError:c}=e,{onClose:u}=e,{purchases:_}=e,{backend:g}=e,{purchaseOperationHelper:B}=e,k=null,w=null,D=null,M=null;const N=((Dt=s.rcBillingProduct)==null?void 0:Dt.identifier)??null;let d="present-offer";const p=["present-offer","needs-auth-info","needs-payment-info","loading"];be(async()=>{if(r(2,k=s.rcBillingProduct),r(3,w=await g.getBrandingInfo()),d==="present-offer"){i?yt():r(6,d="needs-auth-info");return}});const rl=()=>{u()},yt=()=>{if(N===null){Ee(new H(S.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else r(6,d="loading");if(!i){Ee(new H(S.MissingEmailError));return}B.startPurchase(l,N,i).then(Q=>{if(Q.next_action==="collect_payment_info"){r(6,d="needs-payment-info"),r(4,D=Q);return}if(Q.next_action==="completed"){r(6,d="success");return}}).catch(Q=>{Ee(new H(S.ErrorSettingUpPurchase,Q.message,Q.underlyingErrorMessage))})},il=Q=>{if(d==="needs-auth-info"){Q&&r(12,i=Q.email),yt();return}if(d==="needs-payment-info"){r(6,d="polling-purchase-status"),B.pollCurrentPurchaseForCompletion().then(()=>{r(6,d="success")}).catch(sl=>{Ee(sl)});return}if(d==="success"||d==="error"){o();return}r(6,d="success")},Ee=Q=>{r(5,M=Q),r(6,d="error")},ll=()=>{c(M??new H(S.UnknownError,"Unknown error without state set."))};return t.$$set=Q=>{"asModal"in Q&&r(0,n=Q.asModal),"customerEmail"in Q&&r(12,i=Q.customerEmail),"appUserId"in Q&&r(13,l=Q.appUserId),"rcPackage"in Q&&r(14,s=Q.rcPackage),"onFinished"in Q&&r(15,o=Q.onFinished),"onError"in Q&&r(16,c=Q.onError),"onClose"in Q&&r(17,u=Q.onClose),"purchases"in Q&&r(1,_=Q.purchases),"backend"in Q&&r(18,g=Q.backend),"purchaseOperationHelper"in Q&&r(19,B=Q.purchaseOperationHelper)},[n,_,k,w,D,M,d,p,rl,il,Ee,ll,i,l,s,o,c,u,g,B]}class xi extends U{constructor(e){super(),C(this,e,Ji,ji,R,{asModal:0,customerEmail:12,appUserId:13,rcPackage:14,onFinished:15,onError:16,onClose:17,purchases:1,backend:18,purchaseOperationHelper:19},Gi)}}function Vi(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function qi(t,e,r){return{identifier:t,isActive:Vi(e),willRenew:Xi(e,r),store:(r==null?void 0:r.store)??"unknown",originalPurchaseDate:new Date(e.purchase_date),expirationDate:Re(e.expires_date),productIdentifier:e.product_identifier,unsubscribeDetectedAt:Re(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:Re(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 Wi(t,e){const r={},n={};for(const i in t){const l=e[i]??null,s=qi(i,t[i],l);r[i]=s,s.isActive&&(n[i]=s)}return{all:r,active:n}}function Re(t){return t==null?null:new Date(t)}function zi(t){const e=el(t),r=t.subscriber;return{entitlements:Wi(r.entitlements,r.subscriptions),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:Zi(t),activeSubscriptions:tl(e),managementURL:r.management_url,requestDate:new Date(t.request_date),firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Re(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id}}function Xi(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,l=e.billing_issues_detected_at!=null;return!(r||n||i||l)}function Zi(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];e[r]=new Date(n.purchase_date)}return e}function el(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];n.expires_date==null?e[r]=null:e[r]=new Date(n.expires_date)}return e}function tl(t){const e=new Set,r=new Date;for(const n in t){const i=t[n];(i==null||i>r)&&e.add(n)}return e}class nl{constructor(e){P(this,"_API_KEY");P(this,"backend");P(this,"purchaseOperationHelper");P(this,"toOfferings",(e,r)=>{const n=e.offerings.find(o=>o.identifier===e.current_offering_id)??null,i={};r.product_details.forEach(o=>{i[o.identifier]=o});const l=n==null?null:Ge(n,i),s={};return e.offerings.forEach(o=>{const c=Ge(o,i);c!=null&&(s[o.identifier]=c)}),Object.keys(s).length==0&&console.debug("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:s,current:l}});this._API_KEY=e,this.backend=new Fi(this._API_KEY),this.purchaseOperationHelper=new pn(this.backend)}async getOfferings(e){const r=await this.backend.getOfferings(e),n=r.offerings.flatMap(l=>l.packages).map(l=>l.platform_product_identifier),i=await this.backend.getProducts(e,n);return this.logMissingProductIds(n,i.product_details),this.toOfferings(r,i)}async isEntitledTo(e,r){const n=await this.getCustomerInfo(e);return r in n.entitlements.active}purchasePackage(e,r,n,i){let l=i??document.getElementById("rcb-ui-root");if(l===null){const c=document.createElement("div");c.className="rcb-ui-root",document.body.appendChild(c),l=c}if(l===null)throw new Error("Could not generate a mount point for the billing widget");const s=l,o=!i;return new Promise((c,u)=>{new xi({target:s,props:{appUserId:e,rcPackage:r,customerEmail:n,onFinished:async()=>{s.innerHTML="",c({customerInfo:await this.getCustomerInfo(e)})},onClose:()=>{s.innerHTML="",u(new X(he.UserCancelledError))},onError:_=>{s.innerHTML="",u(X.getForPurchasesFlowError(_))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:o}})})}async getCustomerInfo(e){const r=await this.backend.getCustomerInfo(e);return zi(r)}logMissingProductIds(e,r){const n={};r.forEach(l=>n[l.identifier]=l);const i=[];e.forEach(l=>{n[l]===void 0&&i.push(l)}),i.length>0&&console.debug("Could not find product data for product ids: ",i,". Please check that your product configuration is correct.")}isSandbox(){return mt(this._API_KEY)}}Y.ErrorCode=he,Y.PackageType=W,Y.Purchases=nl,Y.PurchasesError=X,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-js",
3
3
  "private": false,
4
- "version": "0.0.13",
4
+ "version": "0.0.14",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"