@revenuecat/purchases-js 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -2
- package/dist/Purchases.es.d.ts +347 -95
- package/dist/Purchases.es.js +1620 -1363
- package/dist/Purchases.umd.js +2 -2
- package/dist/style.css +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +6 -2
package/dist/Purchases.umd.js
CHANGED
|
@@ -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 ji=Object.defineProperty;var xi=(Y,K,z)=>K in Y?ji(Y,K,{enumerable:!0,configurable:!0,writable:!0,value:z}):Y[K]=z;var T=(Y,K,z)=>(xi(Y,typeof K!="symbol"?K+"":K,z),z);function K(t){return t!=null}const z=(t,e)=>({id:t.identifier,identifier:t.identifier,displayName:t.title,currentPrice:t.current_price,normalPeriodDuration:t.normal_period_duration,presentedOfferingIdentifier:e}),Bt=(t,e,r)=>{const n=r[e.platform_product_identifier];return n===void 0?null:{id:e.identifier,identifier:e.identifier,rcBillingProduct:z(n,t),packageType:yt(e.identifier)}},Ge=(t,e)=>{const r=t.packages.map(i=>Bt(t.identifier,i,e)).filter(K),n={};for(const i of r)i!=null&&(n[i.identifier]=i);return r.length==0?null:{id:t.identifier,identifier:t.identifier,displayName:t.description,metadata:t.metadata,packages:n,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 yt(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 Q(){}function Dt(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 ce(t){t.forEach(Ye)}function ae(t){return typeof t=="function"}function R(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Ee;function V(t,e){return t===e?!0:(Ee||(Ee=document.createElement("a")),Ee.href=e,t===Ee.href)}function Ke(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function Qt(t,e){const r=Ke(t.srcset),n=Ke(e||"");return n.length===r.length&&n.every(([i,l],s)=>l===r[s][1]&&(V(r[s][0],i)||V(i,r[s][0])))}function Pt(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?Dt(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 q(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 M(t,e){t.appendChild(e)}function L(t,e,r){const n=Mt(t);if(!n.getElementById(e)){const i=B("style");i.id=e,i.textContent=r,Tt(n,i)}}function Mt(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Tt(t,e){return M(t.head||t,e),e.sheet}function _(t,e,r){t.insertBefore(e,r||null)}function g(t){t.parentNode&&t.parentNode.removeChild(t)}function B(t){return document.createElement(t)}function S(t){return document.createTextNode(t)}function N(){return S(" ")}function X(){return S("")}function Ie(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 vt=["width","height"];function Nt(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&&vt.indexOf(n)===-1?t[n]=e[n]:h(t,n,e[n])}function Rt(t,e){Object.keys(e).forEach(r=>{Ut(t,r,e[r])})}function Ut(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 Ct(t){return/-/.test(t)?Rt:Nt}function Ot(t){return Array.from(t.childNodes)}function ne(t,e){e=""+e,t.data!==e&&(t.data=e)}function xe(t,e){t.value=e??""}function St(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let fe;function de(t){fe=t}function we(){if(!fe)throw new Error("Function called outside component initialization");return fe}function be(t){we().$$.on_mount.push(t)}function Lt(){const t=we();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const l=St(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,l)}),!l.defaultPrevented}return!0}}function Ft(t,e){return we().$$.context.set(t,e),e}function Gt(t){return we().$$.context.get(t)}function Yt(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const re=[],$e=[];let ie=[];const Ue=[],Ht=Promise.resolve();let Ce=!1;function Kt(){Ce||(Ce=!0,Ht.then(qe))}function Oe(t){ie.push(t)}function Jt(t){Ue.push(t)}const Se=new Set;let le=0;function qe(){if(le!==0)return;const t=fe;do{try{for(;le<re.length;){const e=re[le];le++,de(e),jt(e.$$)}}catch(e){throw re.length=0,le=0,e}for(de(null),re.length=0,le=0;$e.length;)$e.pop()();for(let e=0;e<ie.length;e+=1){const r=ie[e];Se.has(r)||(Se.add(r),r())}ie.length=0}while(re.length);for(;Ue.length;)Ue.pop()();Ce=!1,Se.clear(),de(t)}function jt(t){if(t.fragment!==null){t.update(),ce(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Oe)}}function xt(t){const e=[],r=[];ie.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),ie=e}const ke=new Set;let Z;function F(){Z={r:0,c:[],p:Z}}function G(){Z.r||ce(Z.c),Z=Z.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),Z.c.push(()=>{ke.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function qt(t,e,r){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function $(t){t&&t.c()}function I(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),Oe(()=>{const l=t.$$.on_mount.map(Ye).filter(ae);t.$$.on_destroy?t.$$.on_destroy.push(...l):ce(l),t.$$.on_mount=[]}),i.forEach(Oe)}function w(t,e){const r=t.$$;r.fragment!==null&&(xt(r.after_update),ce(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function Vt(t,e){t.$$.dirty[0]===-1&&(re.push(t),Kt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function U(t,e,r,n,i,l,s=null,o=[-1]){const c=fe;de(t);const u=t.$$={fragment:null,ctx:[],props:l,update:Q,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 p=!1;if(u.ctx=r?r(t,e.props||{},(m,E,...k)=>{const y=k.length?k[0]:E;return u.ctx&&i(u.ctx[m],u.ctx[m]=y)&&(!u.skip_bound&&u.bound[m]&&u.bound[m](y),p&&Vt(t,m)),E}):[],u.update(),p=!0,ce(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const m=Ot(e.target);u.fragment&&u.fragment.l(m),m.forEach(g)}else u.fragment&&u.fragment.c();e.intro&&a(t.$$.fragment),I(t,e.target,e.anchor),qe()}de(c)}class C{constructor(){T(this,"$$");T(this,"$$set")}$destroy(){w(this,1),this.$destroy=Q}$on(e,r){if(!ae(r))return Q;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&&!Pt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Wt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Wt);function zt(t){L(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 Xt(t){let e;return{c(){e=B("aside"),e.innerHTML="<span>Sandbox Mode</span>",h(e,"class","svelte-8uc6s0")},m(r,n){_(r,e,n)},p:Q,i:Q,o:Q,d(r){r&&g(e)}}}class Zt extends C{constructor(e){super(),U(this,e,null,Xt,R,{},zt)}}function en(t){L(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=B(t[0]),i&&i.c(),Ct(t[0])(e,{class:ue("rcb-modal-section")+" svelte-ujomz3"})},m(l,s){_(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):q(l[1]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&g(e),i&&i.d(l)}}}function tn(t){let e=t[0],r,n,i=t[0]&&Le(t);return{c(){i&&i.c(),r=X()},m(l,s){i&&i.m(l,s),_(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&&g(r),i&&i.d(l)}}}function nn(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 ee extends C{constructor(e){super(),U(this,e,nn,tn,R,{as:0},en)}}const rn={Y:"year",M:"month",W:"week",D:"day",H:"hour"},Ve=(t,e)=>{const r=t/100;return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(r)},We=t=>{const e=t.slice(-1);return e==="D"?"daily":`${rn[e]}ly`};function ln(t){L(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 sn(t){let e,r,n=t[0].displayName+"",i,l,s,o=t[0].currentPrice.currency+"",c,u=" ",p,m=Ve(t[0].currentPrice.amount,t[0].currentPrice.currency)+"",E,k,y,b,D=We(t[0].normalPeriodDuration)+"",v;return{c(){e=B("div"),r=B("span"),i=S(n),l=N(),s=B("span"),c=S(o),p=S(u),E=S(m),k=N(),y=B("span"),b=S("Billed "),v=S(D),h(s,"class","rcb-product-price svelte-1oa6nu8"),h(y,"class","rcb-product-duration svelte-1oa6nu8"),h(e,"class","rcb-pricing-info svelte-1oa6nu8")},m(d,A){_(d,e,A),M(e,r),M(r,i),M(e,l),M(e,s),M(s,c),M(s,p),M(s,E),M(e,k),M(e,y),M(y,b),M(y,v)},p(d,A){A&1&&n!==(n=d[0].displayName+"")&&ne(i,n),A&1&&o!==(o=d[0].currentPrice.currency+"")&&ne(c,o),A&1&&m!==(m=Ve(d[0].currentPrice.amount,d[0].currentPrice.currency)+"")&&ne(E,m),A&1&&D!==(D=We(d[0].normalPeriodDuration)+"")&&ne(v,D)},d(d){d&&g(e)}}}function on(t){let e,r;return e=new ee({props:{$$slots:{default:[sn]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function cn(t,e,r){let{productDetails:n}=e;return t.$$set=i=>{"productDetails"in i&&r(0,n=i.productDetails)},[n]}class ze extends C{constructor(e){super(),U(this,e,cn,on,R,{productDetails:0},ln)}}const an="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+/Pbofc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hoRYjTR56CPGwiooXN6oENQikhYsWP65MJXglx4sVMoZsJdikRosWOMYSRPJih9q3cOPKnWuRSxa7eO9O3cJFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function un(t){let e,r;return{c(){e=B("img"),V(e.src,r=an)||h(e,"src",r),h(e,"alt","spinner")},m(n,i){_(n,e,i)},p:Q,i:Q,o:Q,d(n){n&&g(e)}}}class fn extends C{constructor(e){super(),U(this,e,null,un,R,{})}}function dn(t){L(t,"svelte-4wmtg7",".rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}")}function mn(t){let e,r,n;return r=new fn({}),{c(){e=B("div"),$(r.$$.fragment),h(e,"class","rcb-modal-loader svelte-4wmtg7")},m(i,l){_(i,e,l),I(r,e,null),n=!0},p:Q,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&g(e),w(r)}}}class Be extends C{constructor(e){super(),U(this,e,null,mn,R,{},dn)}}var me=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(me||{}),ye=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(ye||{}),O=(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))(O||{});class H extends Error{constructor(e,r,n){super(r),this.errorCode=e,this.underlyingErrorMessage=n}}class An{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 me.Started:case me.InProgress:setTimeout(()=>i(l+1),this.waitMSBetweenAttempts);break;case me.Succeeded:this.clearPurchaseInProgress(),r();return;case me.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 gn(t){L(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 _n(t){let e,r,n,i,l;const s=t[3].default,o=J(s,t,t[2],null);return{c(){e=B("button"),o&&o.c(),h(e,"class",r=ue(`intent-${t[0]}`)+" svelte-igat39"),e.disabled=t[1]},m(c,u){_(c,e,u),o&&o.m(e,null),n=!0,i||(l=Ie(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):q(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&&g(e),o&&o.d(c),i=!1,l()}}}function pn(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:l="primary"}=e,{disabled:s=!1}=e;function o(c){Yt.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 C{constructor(e){super(),U(this,e,pn,_n,R,{intent:0,disabled:1},gn)}}function hn(t){L(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function En(t){let e,r;const n=t[1].default,i=J(n,t,t[0],null);return{c(){e=B("footer"),i&&i.c(),h(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(l,s){_(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):q(l[0]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&g(e),i&&i.d(l)}}}function In(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 C{constructor(e){super(),U(this,e,In,En,R,{},hn)}}const wn="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){L(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function $n(t){let e,r;return{c(){e=B("img"),V(e.src,r=wn)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){_(n,e,i)},p:Q,i:Q,o:Q,d(n){n&&g(e)}}}class kn extends C{constructor(e){super(),U(this,e,null,$n,R,{},bn)}}function Bn(t){L(t,"svelte-18njhoa",'.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}')}function yn(t){let e,r,n;const i=t[2].default,l=J(i,t,t[1],null);return{c(){e=B("div"),l&&l.c(),h(e,"class","column svelte-18njhoa"),h(e,"style",r=`--gap:${t[0]};`)},m(s,o){_(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):q(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&&g(e),l&&l.d(s)}}}function Dn(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 C{constructor(e){super(),U(this,e,Dn,yn,R,{gutter:0},Bn)}}function Qn(t){L(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 Xe(t){let e,r,n,i,l;return{c(){e=S("If this error persists, please contact "),r=B("a"),n=S(t[0]),l=S("."),h(r,"href",i="mailto:"+t[0])},m(s,o){_(s,e,o),_(s,r,o),M(r,n),_(s,l,o)},p(s,o){o&1&&ne(n,s[0]),o&1&&i!==(i="mailto:"+s[0])&&h(r,"href",i)},d(s){s&&(g(e),g(r),g(l))}}}function Pn(t){let e,r,n,i=t[2]()+"",l,s,o=t[0]&&Xe(t);return{c(){e=B("span"),e.textContent="Something went wrong.",r=N(),n=B("span"),l=S(i),s=N(),o&&o.c(),h(e,"class","title svelte-ahi052"),h(n,"class","subtitle svelte-ahi052")},m(c,u){_(c,e,u),_(c,r,u),_(c,n,u),M(n,l),M(n,s),o&&o.m(n,null)},p(c,u){c[0]?o?o.p(c,u):(o=Xe(c),o.c(),o.m(n,null)):o&&(o.d(1),o=null)},d(c){c&&(g(e),g(r),g(n)),o&&o.d()}}}function Mn(t){let e,r,n,i;return e=new kn({}),n=new te({props:{gutter:"1rem",$$slots:{default:[Pn]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment),r=N(),$(n.$$.fragment)},m(l,s){I(e,l,s),_(l,r,s),I(n,l,s),i=!0},p(l,s){const o={};s&17&&(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&&g(r),w(e,l),w(n,l)}}}function Tn(t){let e,r,n;return r=new te({props:{gutter:"1rem",$$slots:{default:[Mn]},$$scope:{ctx:t}}}),{c(){e=B("div"),$(r.$$.fragment),h(e,"class","rcb-modal-error svelte-ahi052")},m(i,l){_(i,e,l),I(r,e,null),n=!0},p(i,l){const s={};l&17&&(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&&g(e),w(r)}}}function vn(t){let e;return{c(){e=S("Go back to app")},m(r,n){_(r,e,n)},d(r){r&&g(e)}}}function Nn(t){let e,r;return e=new Ae({props:{$$slots:{default:[vn]},$$scope:{ctx:t}}}),e.$on("click",function(){ae(t[1])&&t[1].apply(this,arguments)}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p(n,i){t=n;const l={};i&16&&(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){w(e,n)}}}function Rn(t){let e,r,n,i;return e=new ee({props:{$$slots:{default:[Tn]},$$scope:{ctx:t}}}),n=new De({props:{$$slots:{default:[Nn]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment),r=N(),$(n.$$.fragment)},m(l,s){I(e,l,s),_(l,r,s),I(n,l,s),i=!0},p(l,s){const o={};s&17&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const c={};s&18&&(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&&g(r),w(e,l),w(n,l)}}}function Un(t){let e,r;return e=new te({props:{gutter:"2rem",$$slots:{default:[Rn]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p(n,[i]){const l={};i&19&&(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){w(e,n)}}}function Cn(t,e,r){let{lastError:n}=e,{supportEmail:i=null}=e,{onContinue:l}=e;be(()=>{console.debug(`Displayed error: ${O[n.errorCode]}. Message: ${n.message??"None"}. Underlying error: ${n.underlyingErrorMessage??"None"}`)});function s(){switch(n.errorCode){case O.UnknownError:return"An unknown error occurred.";case O.ErrorSettingUpPurchase:return"Purchase not started due to an error.";case O.ErrorChargingPayment:return"Payment failed.";case O.NetworkError:return"Network error. Please check your internet connection.";case O.StripeError:return n.message;case O.MissingEmailError:return"Email is required to complete the purchase."}return n.message}return t.$$set=o=>{"lastError"in o&&r(3,n=o.lastError),"supportEmail"in o&&r(0,i=o.supportEmail),"onContinue"in o&&r(1,l=o.onContinue)},[i,l,s,n]}class On extends C{constructor(e){super(),U(this,e,Cn,Un,R,{lastError:3,supportEmail:0,onContinue:1},Qn)}}const Sn="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 Ln(t){L(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function Fn(t){let e,r;return{c(){e=B("img"),V(e.src,r=Sn)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){_(n,e,i)},p:Q,i:Q,o:Q,d(n){n&&g(e)}}}class Gn extends C{constructor(e){super(),U(this,e,null,Fn,R,{},Ln)}}function Yn(t){L(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 Hn(t){let e,r,n;return{c(){e=B("span"),e.textContent="Purchase Successful",r=N(),n=B("span"),n.textContent="Your plan is now active.",h(e,"class","title svelte-1lcsna9"),h(n,"class","subtitle svelte-1lcsna9")},m(i,l){_(i,e,l),_(i,r,l),_(i,n,l)},p:Q,d(i){i&&(g(e),g(r),g(n))}}}function Kn(t){let e,r,n,i;return e=new Gn({}),n=new te({props:{gutter:"1rem",$$slots:{default:[Hn]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment),r=N(),$(n.$$.fragment)},m(l,s){I(e,l,s),_(l,r,s),I(n,l,s),i=!0},p(l,s){const o={};s&2&&(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&&g(r),w(e,l),w(n,l)}}}function Jn(t){let e,r,n;return r=new te({props:{gutter:"1rem",$$slots:{default:[Kn]},$$scope:{ctx:t}}}),{c(){e=B("div"),$(r.$$.fragment),h(e,"class","rcb-modal-success svelte-1lcsna9")},m(i,l){_(i,e,l),I(r,e,null),n=!0},p(i,l){const s={};l&2&&(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&&g(e),w(r)}}}function jn(t){let e;return{c(){e=S("Go back to app")},m(r,n){_(r,e,n)},d(r){r&&g(e)}}}function xn(t){let e,r;return e=new Ae({props:{intent:"secondary",$$slots:{default:[jn]},$$scope:{ctx:t}}}),e.$on("click",function(){ae(t[0])&&t[0].apply(this,arguments)}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p(n,i){t=n;const l={};i&2&&(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){w(e,n)}}}function qn(t){let e,r,n,i;return e=new ee({props:{$$slots:{default:[Jn]},$$scope:{ctx:t}}}),n=new De({props:{$$slots:{default:[xn]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment),r=N(),$(n.$$.fragment)},m(l,s){I(e,l,s),_(l,r,s),I(n,l,s),i=!0},p(l,s){const o={};s&2&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const c={};s&3&&(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&&g(r),w(e,l),w(n,l)}}}function Vn(t){let e,r;return e=new te({props:{gutter:"2rem",$$slots:{default:[qn]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function Wn(t,e,r){let{onContinue:n}=e;return t.$$set=i=>{"onContinue"in i&&r(0,n=i.onContinue)},[n]}class zn extends C{constructor(e){super(),U(this,e,Wn,Vn,R,{onContinue:0},Yn)}}function Xn(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 Zn=typeof window>"u";function er(t){if(!Zn)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function tr(t){let e;return{c(){e=B("div")},m(r,n){_(r,e,n),t[6](e)},p:Q,i:Q,o:Q,d(r){r&&g(e),t[6](null)}}}function nr(t,e,r){let n,i;const l=Lt(),{elements:s}=Gt("stripe");let{options:o=void 0}=e;be(()=>(n=Xn(i,"payment",s,l,o),()=>n.destroy()));function c(){n.blur()}function u(){n.clear()}function p(){n.destroy()}function m(){n.focus()}function E(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,p,m,E]}class rr extends C{constructor(e){super(),U(this,e,nr,tr,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 Ze(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):q(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 ir(t){let e,r,n=t[1]&&t[0]&&Ze(t);return{c(){n&&n.c(),e=X()},m(i,l){n&&n.m(i,l),_(i,e,l),r=!0},p(i,[l]){i[1]&&i[0]?n?(n.p(i,l),l&3&&a(n,1)):(n=Ze(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&&g(e),n&&n.d(i)}}}function lr(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:p={}}=e,{labels:m="above"}=e,{loader:E="auto"}=e,{fonts:k=[]}=e,{locale:y="auto"}=e,{currency:b=void 0}=e,{amount:D=void 0}=e,{clientSecret:v=void 0}=e,{elements:d=null}=e;return t.$$set=A=>{"stripe"in A&&r(1,s=A.stripe),"mode"in A&&r(2,o=A.mode),"theme"in A&&r(3,c=A.theme),"variables"in A&&r(4,u=A.variables),"rules"in A&&r(5,p=A.rules),"labels"in A&&r(6,m=A.labels),"loader"in A&&r(7,E=A.loader),"fonts"in A&&r(8,k=A.fonts),"locale"in A&&r(9,y=A.locale),"currency"in A&&r(10,b=A.currency),"amount"in A&&r(11,D=A.amount),"clientSecret"in A&&r(12,v=A.clientSecret),"elements"in A&&r(0,d=A.elements),"$$scope"in A&&r(14,l=A.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:u,rules:p,labels:m}),t.$$.dirty&16263&&s&&!d&&(r(0,d=s.elements({mode:o,currency:b,amount:D,appearance:n,clientSecret:v,fonts:k,loader:E,locale:y})),er(s),Ft("stripe",{stripe:s,elements:d})),t.$$.dirty&8705&&d&&d.update({appearance:n,locale:y})},[d,s,o,c,u,p,m,E,k,y,b,D,v,n,l,i]}class sr extends C{constructor(e){super(),U(this,e,lr,ir,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 et="https://js.stripe.com/v3",or=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,tt="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",cr=function(){for(var e=document.querySelectorAll('script[src^="'.concat(et,'"]')),r=0;r<e.length;r++){var n=e[r];if(or.test(n.src))return n}return null},nt=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(et).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},ar=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.3.0",startTime:r})},ge=null,Qe=null,Pe=null,ur=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},fr=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},dr=function(e){return ge!==null?ge:(ge=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(tt),window.Stripe){r(window.Stripe);return}try{var i=cr();if(i&&e)console.warn(tt);else if(!i)i=nt(e);else if(i&&Pe!==null&&Qe!==null){var l;i.removeEventListener("load",Pe),i.removeEventListener("error",Qe),(l=i.parentNode)===null||l===void 0||l.removeChild(i),i=nt(e)}Pe=fr(r,n),Qe=ur(n),i.addEventListener("load",Pe),i.addEventListener("error",Qe)}catch(s){n(s);return}}),ge.catch(function(r){return ge=null,Promise.reject(r)}))},mr=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return ar(i,n),i},_e,rt=!1,it=function(){return _e||(_e=dr(null).catch(function(e){return _e=null,Promise.reject(e)}),_e)};Promise.resolve().then(function(){return it()}).catch(function(t){rt||console.warn(t)});var Ar=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];rt=!0;var i=Date.now();return it().then(function(l){return mr(l,r,i)})};function gr(t){L(t,"svelte-1fwwzeb",".rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}")}function _r(t){let e,r;return e=new Be({}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p:Q,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){w(e,n)}}}function pr(t){let e,r,n,i,l,s;function o(u){t[10](u)}let c={stripe:t[2],clientSecret:t[4],loader:"always",$$slots:{default:[Br]},$$scope:{ctx:t}};return t[1]!==void 0&&(c.elements=t[1]),r=new sr({props:c}),$e.push(()=>qt(r,"elements",o)),{c(){e=B("form"),$(r.$$.fragment)},m(u,p){_(u,e,p),I(r,e,null),i=!0,l||(s=Ie(e,"submit",je(t[5])),l=!0)},p(u,p){const m={};p&4&&(m.stripe=u[2]),p&4105&&(m.$$scope={dirty:p,ctx:u}),!n&&p&2&&(n=!0,m.elements=u[1],Jt(()=>n=!1)),r.$set(m)},i(u){i||(a(r.$$.fragment,u),i=!0)},o(u){f(r.$$.fragment,u),i=!1},d(u){u&&g(e),w(r),l=!1,s()}}}function hr(t){let e,r,n;return r=new rr({}),{c(){e=B("div"),$(r.$$.fragment),h(e,"class","rcb-stripe-elements-container svelte-1fwwzeb")},m(i,l){_(i,e,l),I(r,e,null),n=!0},p:Q,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&g(e),w(r)}}}function Er(t){let e;return{c(){e=S("Pay")},m(r,n){_(r,e,n)},d(r){r&&g(e)}}}function Ir(t){let e;return{c(){e=S("Processing...")},m(r,n){_(r,e,n)},d(r){r&&g(e)}}}function wr(t){let e;function r(l,s){return l[3]?Ir:Er}let n=r(t),i=n(t);return{c(){i.c(),e=X()},m(l,s){i.m(l,s),_(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&&g(e),i.d(l)}}}function br(t){let e;return{c(){e=S("Close")},m(r,n){_(r,e,n)},d(r){r&&g(e)}}}function $r(t){let e,r,n,i;return e=new Ae({props:{disabled:t[3],$$slots:{default:[wr]},$$scope:{ctx:t}}}),n=new Ae({props:{disabled:t[3],intent:"secondary",$$slots:{default:[br]},$$scope:{ctx:t}}}),n.$on("click",function(){ae(t[0])&&t[0].apply(this,arguments)}),{c(){$(e.$$.fragment),r=N(),$(n.$$.fragment)},m(l,s){I(e,l,s),_(l,r,s),I(n,l,s),i=!0},p(l,s){t=l;const o={};s&8&&(o.disabled=t[3]),s&4104&&(o.$$scope={dirty:s,ctx:t}),e.$set(o);const c={};s&8&&(c.disabled=t[3]),s&4096&&(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&&g(r),w(e,l),w(n,l)}}}function kr(t){let e,r;return e=new te({props:{$$slots:{default:[$r]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p(n,i){const l={};i&4105&&(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){w(e,n)}}}function Br(t){let e,r,n,i;return e=new ee({props:{$$slots:{default:[hr]},$$scope:{ctx:t}}}),n=new De({props:{$$slots:{default:[kr]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment),r=N(),$(n.$$.fragment)},m(l,s){I(e,l,s),_(l,r,s),I(n,l,s),i=!0},p(l,s){const o={};s&4096&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const c={};s&4105&&(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&&g(r),w(e,l),w(n,l)}}}function yr(t){let e,r,n,i;const l=[pr,_r],s=[];function o(c,u){return c[2]&&c[4]?0:1}return r=o(t),n=s[r]=l[r](t),{c(){e=B("div"),n.c()},m(c,u){_(c,e,u),s[r].m(e,null),i=!0},p(c,[u]){let p=r;r=o(c),r===p?s[r].p(c,u):(F(),f(s[p],1,1,()=>{s[p]=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&&g(e),s[r].d()}}}function Dr(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:l}=e,{purchases:s}=e,{paymentInfoCollectionMetadata:o}=e;const c=o.data.client_secret;let u=null,p,m=!1,E;be(async()=>{const b=o.data.publishable_api_key,D=o.data.stripe_account_id;if(!b||!D)throw new Error("Stripe publishable key or account ID not found");r(2,u=await Ar(b,{stripeAccount:D}))});const k=async()=>{if(m||!u||!E)return;r(3,m=!0);const b=await u.confirmSetup({elements:E,redirect:"if_required"});b.error?(r(3,m=!1),l(new H(O.StripeError,b.error.message))):i()};function y(b){p=b,r(1,p)}return t.$$set=b=>{"onClose"in b&&r(0,n=b.onClose),"onContinue"in b&&r(6,i=b.onContinue),"onError"in b&&r(7,l=b.onError),"purchases"in b&&r(8,s=b.purchases),"paymentInfoCollectionMetadata"in b&&r(9,o=b.paymentInfoCollectionMetadata)},t.$$.update=()=>{t.$$.dirty&2&&p&&p._elements.length>0&&(E=p)},[n,p,u,m,c,k,i,l,s,o,y]}class Qr extends C{constructor(e){super(),U(this,e,Dr,yr,R,{onClose:0,onContinue:6,onError:7,purchases:8,paymentInfoCollectionMetadata:9},gr)}}function Pr(t){L(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 Mr(t){let e;return{c(){e=B("span"),e.textContent="User authentication",h(e,"class","title svelte-1xardyz")},m(r,n){_(r,e,n)},p:Q,d(r){r&&g(e)}}}function Tr(t){let e,r,n,i,l,s,o;return{c(){e=B("div"),r=B("div"),r.innerHTML='<label for="email">E-mail</label>',n=N(),i=B("div"),l=B("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){_(c,e,u),M(e,r),M(e,n),M(e,i),M(i,l),xe(l,t[0]),s||(o=Ie(l,"input",t[3]),s=!0)},p(c,u){u&1&&l.value!==c[0]&&xe(l,c[0])},d(c){c&&g(e),s=!1,o()}}}function vr(t){let e;return{c(){e=S("Continue")},m(r,n){_(r,e,n)},d(r){r&&g(e)}}}function Nr(t){let e,r;return e=new Ae({props:{$$slots:{default:[vr]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function Rr(t){let e,r,n,i,l,s,o,c,u,p;return n=new ee({props:{$$slots:{default:[Mr]},$$scope:{ctx:t}}}),l=new ee({props:{$$slots:{default:[Tr]},$$scope:{ctx:t}}}),o=new De({props:{$$slots:{default:[Nr]},$$scope:{ctx:t}}}),{c(){e=B("div"),r=B("form"),$(n.$$.fragment),i=N(),$(l.$$.fragment),s=N(),$(o.$$.fragment)},m(m,E){_(m,e,E),M(e,r),I(n,r,null),M(r,i),I(l,r,null),M(r,s),I(o,r,null),c=!0,u||(p=Ie(r,"submit",je(t[1])),u=!0)},p(m,[E]){const k={};E&16&&(k.$$scope={dirty:E,ctx:m}),n.$set(k);const y={};E&17&&(y.$$scope={dirty:E,ctx:m}),l.$set(y);const b={};E&16&&(b.$$scope={dirty:E,ctx:m}),o.$set(b)},i(m){c||(a(n.$$.fragment,m),a(l.$$.fragment,m),a(o.$$.fragment,m),c=!0)},o(m){f(n.$$.fragment,m),f(l.$$.fragment,m),f(o.$$.fragment,m),c=!1},d(m){m&&g(e),w(n),w(l),w(o),u=!1,p()}}}function Ur(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 Cr extends C{constructor(e){super(),U(this,e,Ur,Rr,R,{onContinue:2},Pr)}}function Or(t){L(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 Sr(t){let e;return{c(){e=B("div"),h(e,"class","rcb-app-icon loading svelte-10u48yl")},m(r,n){_(r,e,n)},p:Q,d(r){r&&g(e)}}}function Lr(t){let e,r,n,i,l,s;return{c(){e=B("picture"),r=B("source"),i=N(),l=B("img"),h(r,"type","image/webp"),Qt(r,n=t[1])||h(r,"srcset",n),h(l,"class","rcb-app-icon svelte-10u48yl"),V(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){_(o,e,c),M(e,r),M(e,i),M(e,l)},p(o,c){c&2&&n!==(n=o[1])&&h(r,"srcset",n),c&1&&!V(l.src,s=o[0])&&h(l,"src",s)},d(o){o&&g(e)}}}function Fr(t){let e;function r(l,s){return l[0]!==null?Lr:Sr}let n=r(t),i=n(t);return{c(){i.c(),e=X()},m(l,s){i.m(l,s),_(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:Q,o:Q,d(l){l&&g(e),i.d(l)}}}function Gr(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 lt extends C{constructor(e){super(),U(this,e,Gr,Fr,R,{src:0,srcWebp:1},Or)}}const Yr="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 Hr(t){let e,r;return{c(){e=B("img"),V(e.src,r=Yr)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon")},m(n,i){_(n,e,i)},p:Q,i:Q,o:Q,d(n){n&&g(e)}}}class Kr extends C{constructor(e){super(),U(this,e,null,Hr,R,{})}}const Me=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Jr(t){L(t,"svelte-fcqjlc",".app-title.svelte-fcqjlc{font-weight:500;margin:0.5rem 0;font-size:1rem}.rcb-header-layout.svelte-fcqjlc{display:flex;justify-content:space-between;align-items:center;width:100%}.rcb-header-layout__business-info.svelte-fcqjlc{display:flex;align-items:center}")}function jr(t){let e,r;return e=new lt({}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p:Q,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){w(e,n)}}}function xr(t){let e,r,n=t[0].seller_company_name+"",i,l,s=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&st(t);return{c(){s&&s.c(),e=N(),r=B("span"),i=S(n),h(r,"class","app-title svelte-fcqjlc")},m(o,c){s&&s.m(o,c),_(o,e,c),_(o,r,c),M(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=st(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+"")&&ne(i,n)},i(o){l||(a(s),l=!0)},o(o){f(s),l=!1},d(o){o&&(g(e),g(r)),s&&s.d(o)}}}function st(t){let e,r;return e=new lt({props:{src:Me(t[0].app_icon),srcWebp:Me(t[0].app_icon_webp)}}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p(n,i){const l={};i&1&&(l.src=Me(n[0].app_icon)),i&1&&(l.srcWebp=Me(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){w(e,n)}}}function qr(t){let e,r,n,i,l,s,o;const c=[xr,jr],u=[];function p(m,E){return m[0]!==null?0:1}return n=p(t),i=u[n]=c[n](t),s=new Kr({}),{c(){e=B("div"),r=B("div"),i.c(),l=N(),$(s.$$.fragment),h(r,"class","rcb-header-layout__business-info svelte-fcqjlc"),h(e,"class","rcb-header-layout svelte-fcqjlc")},m(m,E){_(m,e,E),M(e,r),u[n].m(r,null),M(e,l),I(s,e,null),o=!0},p(m,E){let k=n;n=p(m),n===k?u[n].p(m,E):(F(),f(u[k],1,1,()=>{u[k]=null}),G(),i=u[n],i?i.p(m,E):(i=u[n]=c[n](m),i.c()),a(i,1),i.m(r,null))},i(m){o||(a(i),a(s.$$.fragment,m),o=!0)},o(m){f(i),f(s.$$.fragment,m),o=!1},d(m){m&&g(e),u[n].d(),w(s)}}}function Vr(t){let e,r;return e=new ee({props:{as:"header",$$slots:{default:[qr]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function Wr(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class zr extends C{constructor(e){super(),U(this,e,Wr,Vr,R,{brandingInfo:0},Jr)}}function Xr(t){L(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 Zr(t){let e,r;const n=t[1].default,i=J(n,t,t[0],null);return{c(){e=B("div"),i&&i.c(),h(e,"class","rcb-modal-backdrop svelte-17dhulw")},m(l,s){_(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):q(l[0]),null)},i(l){r||(a(i,l),r=!0)},o(l){f(i,l),r=!1},d(l){l&&g(e),i&&i.d(l)}}}function ei(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=l=>{"$$scope"in l&&r(0,i=l.$$scope)},[i,n]}class ti extends C{constructor(e){super(),U(this,e,ei,Zr,R,{},Xr)}}function ni(t){L(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 ri(t){let e,r,n;const i=t[2].default,l=J(i,t,t[1],null);return{c(){e=B("main"),l&&l.c(),h(e,"class",r=ue(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx")},m(s,o){_(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):q(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&&g(e),l&&l.d(s)}}}function ii(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 li extends C{constructor(e){super(),U(this,e,ii,ri,R,{dark:0},ni)}}function si(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):q(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 oi(t){let e,r;return e=new ti({props:{$$slots:{default:[ci]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function ci(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):q(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 ai(t){let e,r,n,i;const l=[oi,si],s=[];function o(c,u){return c[0]?0:1}return e=o(t),r=s[e]=l[e](t),{c(){r.c(),n=X()},m(c,u){s[e].m(c,u),_(c,n,u),i=!0},p(c,[u]){let p=e;e=o(c),e===p?s[e].p(c,u):(F(),f(s[p],1,1,()=>{s[p]=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&&g(n),s[e].d(c)}}}function ui(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 fi extends C{constructor(e){super(),U(this,e,ui,ai,R,{condition:0})}}function ot(t){let e,r;return e=new zr({props:{brandingInfo:t[2]}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function di(t){let e,r,n=t[1]&&ot(t);const i=t[3].default,l=J(i,t,t[4],null);return{c(){n&&n.c(),e=N(),l&&l.c()},m(s,o){n&&n.m(s,o),_(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=ot(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):q(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&&g(e),n&&n.d(s),l&&l.d(s)}}}function mi(t){let e,r;return e=new li({props:{dark:t[0],$$slots:{default:[di]},$$scope:{ctx:t}}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function Ai(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 ct extends C{constructor(e){super(),U(this,e,Ai,mi,R,{dark:0,showHeader:1,brandingInfo:2})}}var pe=(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))(pe||{});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 at?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case O.ErrorSettingUpPurchase:return 2;case O.ErrorChargingPayment:return 20;case O.NetworkError:return 10;case O.MissingEmailError:return 4;case O.StripeError:return 2;case O.UnknownError:return 0}}}var at=(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))(at||{});class W extends Error{constructor(r,n,i){super(n);T(this,"toString",()=>`PurchasesError(code: ${pe[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=Te.getErrorCodeForBackendErrorCode(r);return new W(i,Te.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new W(Te.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}const gi="0.0.10",se="https://api.revenuecat.com";var ve;(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"})(ve||(ve={}));function ut(t){return t?t.startsWith("rcb_sb_"):!1}async function oe(t,e,r,n){const i=await fetch(t.url(),{method:t.method,headers:hi(e,n),body:pi(r)});return await _i(i,t),await i.json()}async function _i(t,e){const r=t.status;if(r>=ve.INTERNAL_SERVER_ERROR)Fe(e,r,await t.text());else if(r>=ve.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 W.getForBackendError(o,s)}else Fe(e,r,i)}}function Fe(t,e,r){throw new W(pe.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function pi(t){return t==null?null:JSON.stringify(t)}function hi(t,e){let r={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":gi,"X-Is-Sandbox":`${ut(t)}`};return e!=null&&(r={...r,...e}),r}const ft="/v1/subscribers",Ne="/rcbilling/v1";class Ei{constructor(e){T(this,"appUserId");T(this,"method","GET");T(this,"name","getOfferings");this.appUserId=e}url(){return`${se}${ft}/${this.appUserId}/offerings`}}class Ii{constructor(){T(this,"method","POST");T(this,"name","subscribe")}url(){return`${se}${Ne}/subscribe`}}class wi{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`${se}${Ne}/subscribers/${this.appUserId}/products?id=${this.productIds.join("&id=")}`}}class bi{constructor(e){T(this,"method","GET");T(this,"name","getCustomerInfo");T(this,"appUserId");this.appUserId=e}url(){return`${se}${ft}/${this.appUserId}`}}class $i{constructor(){T(this,"method","GET");T(this,"name","getBrandingInfo")}url(){return`${se}${Ne}/branding`}}class ki{constructor(e){T(this,"method","GET");T(this,"name","getCheckoutStatus");T(this,"operationSessionId");this.operationSessionId=e}url(){return`${se}${Ne}/checkout/${this.operationSessionId}`}}class Bi{constructor(e){T(this,"API_KEY");this.API_KEY=e}async getOfferings(e){return await oe(new Ei(e),this.API_KEY)}async getCustomerInfo(e){return await oe(new bi(e),this.API_KEY)}async getProducts(e,r){return await oe(new wi(e,r),this.API_KEY)}async getBrandingInfo(){return await oe(new $i,this.API_KEY)}async postSubscribe(e,r,n){return await oe(new Ii,this.API_KEY,{app_user_id:e,product_id:r,email:n})}async getCheckoutStatus(e){return await oe(new ki(e),this.API_KEY)}}function yi(t){L(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 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+gfWgusN6KCCAN7WoITVVXjchBxqERAAIfkEBQQAAQAsDQADACAAEAAACKcAAwgcSDDAAwcFEypcSNDAAYYQA2DZstCAAYZOKCqM8uNJxYcKa3DYsVBKECBYFFpU+MTDhiIMkQxBohJkwRYaUkDEEiQIlYQrCyLZ0MFJRCdAkgC1OZBEBxgRJRIBAqXgwYI8NoCwEjWAkyFDoorQ4KOrQCRLoqbQuZCKR7NdqzD5MaQKXIhZmAwBIqTJ3YVYogQZ8oMJ178Kk/A1YhfxQiRHjBYMCAAh+QQFBQABACwNAAMAIAAQAAAInQADCBxIMECGDAUTKlxI8EEEhhADcGEI4QFDJQy5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(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",
|
|
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 dt(t){let e,r,n,i=t[1].isSandbox(),l;r=new ct({props:{dark:!0,showHeader:!0,brandingInfo:t[3],$$slots:{default:[Di]},$$scope:{ctx:t}}});let s=i&&At();return{c(){e=B("div"),$(r.$$.fragment),n=N(),s&&s.c(),h(e,"class","rcb-ui-aside svelte-ofxzf4")},m(o,c){_(o,e,c),I(r,e,null),M(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=At(),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&&g(e),w(r),s&&s.d()}}}function mt(t){let e,r;return e=new ze({props:{productDetails:t[2]}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function Di(t){let e,r,n=t[2]&&mt(t);return{c(){n&&n.c(),e=X()},m(i,l){n&&n.m(i,l),_(i,e,l),r=!0},p(i,l){i[2]?n?(n.p(i,l),l&4&&a(n,1)):(n=mt(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&&g(e),n&&n.d(i)}}}function At(t){let e,r;return e=new Zt({}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){w(e,n)}}}function gt(t){let e,r;return e=new ze({props:{productDetails:t[2]}}),{c(){$(e.$$.fragment)},m(n,i){I(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){w(e,n)}}}function _t(t){let e,r;return e=new Be({}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){w(e,n)}}}function pt(t){let e,r;return e=new Be({}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){w(e,n)}}}function ht(t){let e,r;return e=new Cr({props:{onContinue:t[9]}}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p:Q,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){w(e,n)}}}function Et(t){let e,r;return e=new Qr({props:{purchases:t[1],paymentInfoCollectionMetadata:t[4],onContinue:t[9],onClose:t[8],onError:t[10]}}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p(n,i){const l={};i&2&&(l.purchases=n[1]),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){w(e,n)}}}function It(t){let e,r;return e=new Be({}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){w(e,n)}}}function wt(t){var n;let e,r;return e=new On({props:{lastError:t[5]??new H(O.UnknownError,"Unknown error without state set."),supportEmail:(n=t[3])==null?void 0:n.seller_company_support_email,onContinue:t[11]}}),{c(){$(e.$$.fragment)},m(i,l){I(e,i,l),r=!0},p(i,l){var o;const s={};l&32&&(s.lastError=i[5]??new H(O.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){w(e,i)}}}function bt(t){let e,r;return e=new zn({props:{onContinue:t[9]}}),{c(){$(e.$$.fragment)},m(n,i){I(e,n,i),r=!0},p:Q,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){w(e,n)}}}function Qi(t){let e,r,n,i,l,s,o,c,u,p=t[6]==="present-offer"&&t[2]&>(t),m=t[6]==="present-offer"&&!t[2]&&_t(),E=t[6]==="polling-purchase-status"&&pt(),k=t[6]==="needs-auth-info"&&ht(t),y=t[6]==="needs-payment-info"&&t[4]&&Et(t),b=t[6]==="loading"&&It(),D=t[6]==="error"&&wt(t),v=t[6]==="success"&&bt(t);return{c(){p&&p.c(),e=N(),m&&m.c(),r=N(),E&&E.c(),n=N(),k&&k.c(),i=N(),y&&y.c(),l=N(),b&&b.c(),s=N(),D&&D.c(),o=N(),v&&v.c(),c=X()},m(d,A){p&&p.m(d,A),_(d,e,A),m&&m.m(d,A),_(d,r,A),E&&E.m(d,A),_(d,n,A),k&&k.m(d,A),_(d,i,A),y&&y.m(d,A),_(d,l,A),b&&b.m(d,A),_(d,s,A),D&&D.m(d,A),_(d,o,A),v&&v.m(d,A),_(d,c,A),u=!0},p(d,A){d[6]==="present-offer"&&d[2]?p?(p.p(d,A),A&68&&a(p,1)):(p=gt(d),p.c(),a(p,1),p.m(e.parentNode,e)):p&&(F(),f(p,1,1,()=>{p=null}),G()),d[6]==="present-offer"&&!d[2]?m?A&68&&a(m,1):(m=_t(),m.c(),a(m,1),m.m(r.parentNode,r)):m&&(F(),f(m,1,1,()=>{m=null}),G()),d[6]==="polling-purchase-status"?E?A&64&&a(E,1):(E=pt(),E.c(),a(E,1),E.m(n.parentNode,n)):E&&(F(),f(E,1,1,()=>{E=null}),G()),d[6]==="needs-auth-info"?k?(k.p(d,A),A&64&&a(k,1)):(k=ht(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]?y?(y.p(d,A),A&80&&a(y,1)):(y=Et(d),y.c(),a(y,1),y.m(l.parentNode,l)):y&&(F(),f(y,1,1,()=>{y=null}),G()),d[6]==="loading"?b?A&64&&a(b,1):(b=It(),b.c(),a(b,1),b.m(s.parentNode,s)):b&&(F(),f(b,1,1,()=>{b=null}),G()),d[6]==="error"?D?(D.p(d,A),A&64&&a(D,1)):(D=wt(d),D.c(),a(D,1),D.m(o.parentNode,o)):D&&(F(),f(D,1,1,()=>{D=null}),G()),d[6]==="success"?v?(v.p(d,A),A&64&&a(v,1)):(v=bt(d),v.c(),a(v,1),v.m(c.parentNode,c)):v&&(F(),f(v,1,1,()=>{v=null}),G())},i(d){u||(a(p),a(m),a(E),a(k),a(y),a(b),a(D),a(v),u=!0)},o(d){f(p),f(m),f(E),f(k),f(y),f(b),f(D),f(v),u=!1},d(d){d&&(g(e),g(r),g(n),g(i),g(l),g(s),g(o),g(c)),p&&p.d(d),m&&m.d(d),E&&E.d(d),k&&k.d(d),y&&y.d(d),b&&b.d(d),D&&D.d(d),v&&v.d(d)}}}function Pi(t){let e,r=t[7].includes(t[6]),n,i,l,s=r&&dt(t);return i=new ct({props:{$$slots:{default:[Qi]},$$scope:{ctx:t}}}),{c(){e=B("div"),s&&s.c(),n=N(),$(i.$$.fragment),h(e,"class","rcb-ui-layout svelte-ofxzf4")},m(o,c){_(o,e,c),s&&s.m(e,null),M(e,n),I(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=dt(o),s.c(),a(s,1),s.m(e,n)):s&&(F(),f(s,1,1,()=>{s=null}),G());const u={};c&4194430&&(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&&g(e),s&&s.d(),w(i)}}}function Mi(t){let e,r,n;return r=new fi({props:{condition:t[0],$$slots:{default:[Pi]},$$scope:{ctx:t}}}),{c(){e=B("div"),$(r.$$.fragment),h(e,"class","rcb-ui-container svelte-ofxzf4")},m(i,l){_(i,e,l),I(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&&g(e),w(r)}}}function Ti(t,e,r){var kt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:l}=e,{rcPackage:s}=e,{onFinished:o}=e,{onError:c}=e,{onClose:u}=e,{purchases:p}=e,{backend:m}=e,{purchaseOperationHelper:E}=e,k=null,y=null,b=null,D=null;const v=((kt=s.rcBillingProduct)==null?void 0:kt.id)??null;let d="present-offer";const A=["present-offer","needs-auth-info","needs-payment-info","loading"];be(async()=>{if(r(2,k=s.rcBillingProduct),r(3,y=await m.getBrandingInfo()),d==="present-offer"){i?$t():r(6,d="needs-auth-info");return}});const Yi=()=>{u()},$t=()=>{if(v===null){he(new H(O.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else r(6,d="loading");if(!i){he(new H(O.MissingEmailError));return}E.startPurchase(l,v,i).then(P=>{if(P.next_action==="collect_payment_info"){r(6,d="needs-payment-info"),r(4,b=P);return}if(P.next_action==="completed"){r(6,d="success");return}}).catch(P=>{he(new H(O.ErrorSettingUpPurchase,P.message,P.underlyingErrorMessage))})},Hi=P=>{if(d==="needs-auth-info"){P&&r(12,i=P.email),$t();return}if(d==="needs-payment-info"){r(6,d="polling-purchase-status"),E.pollCurrentPurchaseForCompletion().then(()=>{r(6,d="success")}).catch(Ji=>{he(Ji)});return}if(d==="success"||d==="error"){o();return}r(6,d="success")},he=P=>{r(5,D=P),r(6,d="error")},Ki=()=>{c(D??new H(O.UnknownError,"Unknown error without state set."))};return t.$$set=P=>{"asModal"in P&&r(0,n=P.asModal),"customerEmail"in P&&r(12,i=P.customerEmail),"appUserId"in P&&r(13,l=P.appUserId),"rcPackage"in P&&r(14,s=P.rcPackage),"onFinished"in P&&r(15,o=P.onFinished),"onError"in P&&r(16,c=P.onError),"onClose"in P&&r(17,u=P.onClose),"purchases"in P&&r(1,p=P.purchases),"backend"in P&&r(18,m=P.backend),"purchaseOperationHelper"in P&&r(19,E=P.purchaseOperationHelper)},[n,p,k,y,b,D,d,A,Yi,Hi,he,Ki,i,l,s,o,c,u,m,E]}class vi extends C{constructor(e){super(),U(this,e,Ti,Mi,R,{asModal:0,customerEmail:12,appUserId:13,rcPackage:14,onFinished:15,onError:16,onClose:17,purchases:1,backend:18,purchaseOperationHelper:19},yi)}}function Ni(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function Ri(t,e,r){return{identifier:t,isActive:Ni(e),willRenew:Oi(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 Ui(t,e){const r={},n={};for(const i in t){const l=e[i]??null,s=Ri(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 Ci(t){const e=Li(t),r=t.subscriber;return{entitlements:Ui(r.entitlements,r.subscriptions),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:Si(t),activeSubscriptions:Fi(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 Oi(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 Si(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 Li(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 Fi(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 Gi{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 Bi(this._API_KEY),this.purchaseOperationHelper=new An(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,{customerEmail:n,htmlTarget: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 vi({target:s,props:{appUserId:e,rcPackage:r,customerEmail:n,onFinished:async()=>{s.innerHTML="",c({customerInfo:await this.getCustomerInfo(e)})},onClose:()=>{s.innerHTML="",u(new W(pe.UserCancelledError))},onError:p=>{s.innerHTML="",u(W.getForPurchasesFlowError(p))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:o}})})}async getCustomerInfo(e){const r=await this.backend.getCustomerInfo(e);return Ci(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 ut(this._API_KEY)}}Y.ErrorCode=pe,Y.Purchases=Gi,Y.PurchasesError=W,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=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"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
aside.svelte-8uc6s0{color:#9acd32;font-weight:700;text-transform:uppercase;padding:.5rem 0;width:100%;font-size:.75rem;border-radius:.5rem}.rcb-modal-section.svelte-ujomz3{padding:.5rem 0rem;display:flex}.rcb-modal-section.svelte-ujomz3:last-of-type{padding:0}.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:.6}.rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}button.svelte-igat39{border:none;border-radius:3.5rem;font-size:1rem;cursor:pointer;height:3.5rem;color:#000;background-color:#dfdfdf}button.intent-primary.svelte-igat39{background-color:#000;color:#fff;font-size:1rem}footer.svelte-1f9z0o8{display:flex;flex-direction:column}.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}.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}img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}.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}.rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}.form-container.svelte-1xardyz{display:flex;flex-direction:column;width:100%}.form-label.svelte-1xardyz{margin-top:.5rem;margin-bottom:.5rem;display:block}.form-input.svelte-1xardyz{margin-bottom:1rem}.title.svelte-1xardyz{font-size:1.5rem;margin:0;margin-bottom:.5rem}input.svelte-1xardyz{width:94%;padding:.5rem;border:1px solid #ccc;border-radius:.25rem}.rcb-
|
|
1
|
+
aside.svelte-8uc6s0{color:#9acd32;font-weight:700;text-transform:uppercase;padding:.5rem 0;width:100%;font-size:.75rem;border-radius:.5rem}.rcb-modal-section.svelte-ujomz3{padding:.5rem 0rem;display:flex}.rcb-modal-section.svelte-ujomz3:last-of-type{padding:0}.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:.6}.rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}button.svelte-igat39{border:none;border-radius:3.5rem;font-size:1rem;cursor:pointer;height:3.5rem;color:#000;background-color:#dfdfdf}button.intent-primary.svelte-igat39{background-color:#000;color:#fff;font-size:1rem}footer.svelte-1f9z0o8{display:flex;flex-direction:column}.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}.close-button.svelte-r1ujja{border:none;cursor:pointer;background-color:transparent}.rcb-app-icon.svelte-10u48yl{width:2.5rem;height:2.5rem;border-radius:.75rem;box-shadow:0 1px 10px #0000001a;margin-right:1rem}.rcb-app-icon-picture-container.svelte-10u48yl{height:2.5rem}.rcb-app-icon.loading.svelte-10u48yl{background-color:gray}.app-title.svelte-1tdgim9{font-weight:500;margin:.5rem 0;font-size:1rem}.rcb-header-layout__business-info.svelte-1tdgim9{display:flex;align-items:center}.rcb-post-purchase-header-layout.svelte-j03lz1{display:flex;justify-content:space-between;align-items:center;width:100%}.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}img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}.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}.rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}.form-container.svelte-1xardyz{display:flex;flex-direction:column;width:100%}.form-label.svelte-1xardyz{margin-top:.5rem;margin-bottom:.5rem;display:block}.form-input.svelte-1xardyz{margin-bottom:1rem}.title.svelte-1xardyz{font-size:1.5rem;margin:0;margin-bottom:.5rem}input.svelte-1xardyz{width:94%;padding:.5rem;border:1px solid #ccc;border-radius:.25rem}.rcb-header-layout.svelte-1ggdgso{display:flex;justify-content:space-between;align-items:center;width:100%}.rcb-modal-backdrop.svelte-17dhulw{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#282828bf;display:flex;flex-direction:column;justify-content:space-around}.rcb-modal-main.svelte-m6kocx{box-sizing:border-box;border-radius:.5rem;background-color:#fff;color:#000;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}}.rcb-ui-container.svelte-ofxzf4{color-scheme:none;font-family:PP Object Sans,-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,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}}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.40.1"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revenuecat/purchases-js",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -33,9 +33,13 @@
|
|
|
33
33
|
"prettier:ci": "prettier --check .",
|
|
34
34
|
"svelte-check": "svelte-check",
|
|
35
35
|
"storybook": "storybook dev -p 6006",
|
|
36
|
-
"build-storybook": "storybook build"
|
|
36
|
+
"build-storybook": "storybook build",
|
|
37
|
+
"extract-api": "api-extractor run --local --verbose",
|
|
38
|
+
"generate-docs": "api-documenter markdown --input-folder api-report --output-folder docs"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
41
|
+
"@microsoft/api-documenter": "^7.23.23",
|
|
42
|
+
"@microsoft/api-extractor": "^7.40.1",
|
|
39
43
|
"@storybook/addon-essentials": "^7.5.3",
|
|
40
44
|
"@storybook/addon-interactions": "^7.5.3",
|
|
41
45
|
"@storybook/addon-links": "^7.5.3",
|