@revenuecat/purchases-js 0.0.15 → 0.0.16

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 CHANGED
@@ -55,10 +55,12 @@ By downloading the current Offerings you can easily build a Paywall page using t
55
55
  associated `rcBillingProduct` and price.
56
56
 
57
57
  ```typescript
58
- const appUserId = "the unique id of the user in your systems";
59
- const purchases = new Purchases("your RC_PUBLISHABLE_API_KEY");
58
+ const purchases = Purchases.configure(
59
+ "your RC_PUBLISHABLE_API_KEY",
60
+ "the unique id of the user in your systems",
61
+ );
60
62
 
61
- purchases.getOfferings(appUserId).then((offerings) => {
63
+ purchases.getOfferings().then((offerings) => {
62
64
  // Get current offering
63
65
  console.log(offerings.current);
64
66
  // Or a dictionary of all offerings
@@ -77,12 +79,15 @@ You can check the entitlements granted to your users throughout all the platform
77
79
  also on your website!
78
80
 
79
81
  ```typescript
80
- const appUserId = "the unique id of the user in your systems";
81
82
  const entitlementId = "the entitlementId you set up in RC";
82
83
 
83
- const purchases = new Purchases("your RC_PUBLISHABLE_API_KEY");
84
+ const purchases = Purchases.configure(
85
+ "your RC_PUBLISHABLE_API_KEY",
86
+ "the unique id of the user in your systems",
87
+ );
88
+ const appUserID = purchases.getAppUserId();
84
89
 
85
- purchases.isEntitledTo(appUserId, entitlementId).then((isEntitled) => {
90
+ purchases.isEntitledTo(entitlementId).then((isEntitled) => {
86
91
  if (isEntitled == true) {
87
92
  console.log(`User ${appUserID} is entitled to ${entitlementId}`);
88
93
  } else {
@@ -94,15 +99,21 @@ purchases.isEntitledTo(appUserId, entitlementId).then((isEntitled) => {
94
99
  As example, you can build a cool React component with it:
95
100
 
96
101
  ```tsx
97
- const WithEntitlement = ({ appUserId, entitlementId, children }) => {
102
+ Purchases.configure(
103
+ "your RC_PUBLISHABLE_API_KEY",
104
+ "the unique id of the user in your systems",
105
+ );
106
+
107
+ const WithEntitlement = ({ entitlementId, children }) => {
98
108
  const [isEntitled, setIsEntitled] = useState<boolean | null>(null);
99
109
 
100
110
  useEffect(() => {
101
- const purchases = new Purchases("your RC_PUBLISHABLE_API_KEY");
102
- purchases.isEntitledTo(appUserId, entitlementId).then((isEntitled) => {
103
- setIsEntitled(isEntitled);
104
- });
105
- }, [appUserId, entitlementId]);
111
+ Purchases.getSharedInstance()
112
+ .isEntitledTo(entitlementId)
113
+ .then((isEntitled) => {
114
+ setIsEntitled(isEntitled);
115
+ });
116
+ }, [entitlementId]);
106
117
 
107
118
  if (isEntitled === null) {
108
119
  return <>"loading..."</>;
@@ -121,7 +132,7 @@ And then use it in your app:
121
132
  ```tsx
122
133
  const App = () => (
123
134
  <>
124
- <WithEntitlement appUserId={"user12345"} entitlementId={"functionality5"}>
135
+ <WithEntitlement entitlementId={"functionality5"}>
125
136
  <Functionality5 />
126
137
  </WithEntitlement>
127
138
  </>
@@ -131,7 +142,7 @@ const App = () => (
131
142
  If you need further information about the user's entitlements, you can use the `getCustomerInfo` method:
132
143
 
133
144
  ```ts
134
- const customerInfo = await purchases.getCustomerInfo(appUserId);
145
+ const customerInfo = await purchases.getCustomerInfo();
135
146
  ```
136
147
 
137
148
  ### Important note
@@ -149,15 +160,17 @@ In this example we will show Stripe, more will be supported soon!
149
160
  You built your paywall, and your user just clicked on the offer they want to subscribe to.
150
161
 
151
162
  ```tsx
152
- const purchases = new Purchases("your RC_PUBLISHABLE_API_KEY");
163
+ const purchases = Purchases.configure(
164
+ "your RC_PUBLISHABLE_API_KEY",
165
+ "the unique id of the user in your systems",
166
+ );
153
167
  // You can retrieve the package from the offerings through `getOfferings`:
154
168
  const rcBillingPackage = offerings.current.availablePackages[0];
155
- const appUserId =
156
- "the unique id of the user that wants to subscribe to your product";
169
+ const appUserId = purchases.getAppUserId();
157
170
  const entitlementIdToCheck =
158
171
  "the entitlementId you set up in RC for your product"; // TODO: remove once this is not needed
159
172
 
160
- purchase.purchasePackage(appUserId, rcBillingPackage).then((response) => {
173
+ purchase.purchasePackage(rcBillingPackage).then((response) => {
161
174
  const isEntitled =
162
175
  entitlementIdToCheck in response.customerInfo.entitlements.active;
163
176
  if (isEntitled == true) {
@@ -369,22 +369,22 @@ export declare interface Product {
369
369
  export declare class Purchases {
370
370
  /**
371
371
  * Get the singleton instance of Purchases. It's preferred to use the instance
372
- * obtained from the {@link Purchases.initializePurchases} method when possible.
372
+ * obtained from the {@link Purchases.configure} method when possible.
373
373
  * @throws {@link UninitializedPurchasesError} if the instance has not been initialized yet.
374
374
  */
375
- static getInstance(): Purchases;
375
+ static getSharedInstance(): Purchases;
376
376
  /**
377
377
  * Returns whether the Purchases SDK is configured or not.
378
378
  */
379
379
  static isConfigured(): boolean;
380
380
  /**
381
- * Initializes the Purchases SDK. This should be called as soon as your app
381
+ * Configures the Purchases SDK. This should be called as soon as your app
382
382
  * has a unique user id for your user. You should only call this once, and
383
383
  * keep the returned instance around for use throughout your application.
384
384
  * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
385
385
  * @param appUserId - Your unique id for identifying the user.
386
386
  */
387
- static initializePurchases(apiKey: string, appUserId: string): Purchases;
387
+ static configure(apiKey: string, appUserId: string): Purchases;
388
388
  /**
389
389
  * Fetch the configured offerings for this user. You can configure these
390
390
  * in the RevenueCat dashboard.
@@ -481,6 +481,7 @@ export declare class Purchases {
481
481
 
482
482
  /**
483
483
  * Error indicating that the SDK was accessed before it was initialized.
484
+ * @public
484
485
  */
485
486
  export declare class UninitializedPurchasesError extends Error {
486
487
  constructor();
@@ -4502,10 +4502,10 @@ const H = class H {
4502
4502
  }
4503
4503
  /**
4504
4504
  * Get the singleton instance of Purchases. It's preferred to use the instance
4505
- * obtained from the {@link Purchases.initializePurchases} method when possible.
4505
+ * obtained from the {@link Purchases.configure} method when possible.
4506
4506
  * @throws {@link UninitializedPurchasesError} if the instance has not been initialized yet.
4507
4507
  */
4508
- static getInstance() {
4508
+ static getSharedInstance() {
4509
4509
  if (H.isConfigured())
4510
4510
  return H.instance;
4511
4511
  throw new Oi();
@@ -4517,16 +4517,16 @@ const H = class H {
4517
4517
  return H.instance !== void 0;
4518
4518
  }
4519
4519
  /**
4520
- * Initializes the Purchases SDK. This should be called as soon as your app
4520
+ * Configures the Purchases SDK. This should be called as soon as your app
4521
4521
  * has a unique user id for your user. You should only call this once, and
4522
4522
  * keep the returned instance around for use throughout your application.
4523
4523
  * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
4524
4524
  * @param appUserId - Your unique id for identifying the user.
4525
4525
  */
4526
- static initializePurchases(e, r) {
4526
+ static configure(e, r) {
4527
4527
  return H.instance !== void 0 ? (console.warn(
4528
4528
  "Purchases is already initialized. Ignoring and returning existing instance."
4529
- ), H.getInstance()) : (H.instance = new H(e, r), H.getInstance());
4529
+ ), H.getSharedInstance()) : (H.instance = new H(e, r), H.getSharedInstance());
4530
4530
  }
4531
4531
  /**
4532
4532
  * Fetch the configured offerings for this user. You can configure these
@@ -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 as=Object.defineProperty;var us=(Y,K,W)=>K in Y?as(Y,K,{enumerable:!0,configurable:!0,writable:!0,value:W}):Y[K]=W;var Q=(Y,K,W)=>(us(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 Tt=(t,e)=>({identifier:t.identifier,displayName:t.title,currentPrice:t.current_price,normalPeriodDuration:t.normal_period_duration,presentedOfferingIdentifier:e}),Pt=(t,e,r)=>{const n=r[e.platform_product_identifier];return n===void 0?null:{identifier:e.identifier,rcBillingProduct:Tt(n,t),packageType:Ut(e.identifier)}},He=(t,e)=>{const r=t.packages.map(i=>Pt(t.identifier,i,e)).filter(K),n={};for(const i of r)i!=null&&(n[i.identifier]=i);return r.length==0?null:{identifier:t.identifier,serverDescription:t.description,metadata:t.metadata,packagesById:n,availablePackages:r,lifetime:n.$rc_lifetime??null,annual:n.$rc_annual??null,sixMonth:n.$rc_six_month??null,threeMonth:n.$rc_three_month??null,twoMonth:n.$rc_two_month??null,monthly:n.$rc_monthly??null,weekly:n.$rc_weekly??null}};function Ut(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 Nt(t,e){for(const r in e)t[r]=e[r];return t}function Ke(t){return t()}function je(){return Object.create(null)}function ue(t){t.forEach(Ke)}function re(t){return typeof t=="function"}function N(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let we;function z(t,e){return t===e?!0:(we||(we=document.createElement("a")),we.href=e,t===we.href)}function Je(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function Rt(t,e){const r=Je(t.srcset),n=Je(e||"");return n.length===r.length&&n.every(([i,s],l)=>s===r[l][1]&&(z(r[l][0],i)||z(i,r[l][0])))}function Ct(t){return Object.keys(t).length===0}function J(t,e,r,n){if(t){const i=xe(t,e,r,n);return t[0](i)}}function xe(t,e,r,n){return t[1]&&n?Nt(r.ctx.slice(),t[1](n(e))):r.ctx}function x(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 s=[],l=Math.max(e.dirty.length,i.length);for(let o=0;o<l;o+=1)s[o]=e.dirty[o]|i[o];return s}return e.dirty|i}return e.dirty}function V(t,e,r,n,i,s){if(i){const l=xe(e,r,n,s);t.p(l,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 fe(t){return t??""}function M(t,e){t.appendChild(e)}function O(t,e,r){const n=Ot(t);if(!n.getElementById(e)){const i=$("style");i.id=e,i.textContent=r,St(n,i)}}function Ot(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function St(t,e){return M(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 ee(){return L("")}function de(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function Ve(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 Lt=["width","height"];function Ft(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&&Lt.indexOf(n)===-1?t[n]=e[n]:h(t,n,e[n])}function Gt(t,e){Object.keys(e).forEach(r=>{Yt(t,r,e[r])})}function Yt(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 Ht(t){return/-/.test(t)?Gt:Ft}function Kt(t){return Array.from(t.childNodes)}function ie(t,e){e=""+e,t.data!==e&&(t.data=e)}function qe(t,e){t.value=e??""}function jt(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let me;function ge(t){me=t}function be(){if(!me)throw new Error("Function called outside component initialization");return me}function $e(t){be().$$.on_mount.push(t)}function Jt(){const t=be();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=jt(e,r,{cancelable:n});return i.slice().forEach(l=>{l.call(t,s)}),!s.defaultPrevented}return!0}}function xt(t,e){return be().$$.context.set(t,e),e}function Vt(t){return be().$$.context.get(t)}function ze(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const se=[],Be=[];let le=[];const Ce=[],qt=Promise.resolve();let Oe=!1;function zt(){Oe||(Oe=!0,qt.then(We))}function Se(t){le.push(t)}function Wt(t){Ce.push(t)}const Le=new Set;let oe=0;function We(){if(oe!==0)return;const t=me;do{try{for(;oe<se.length;){const e=se[oe];oe++,ge(e),Xt(e.$$)}}catch(e){throw se.length=0,oe=0,e}for(ge(null),se.length=0,oe=0;Be.length;)Be.pop()();for(let e=0;e<le.length;e+=1){const r=le[e];Le.has(r)||(Le.add(r),r())}le.length=0}while(se.length);for(;Ce.length;)Ce.pop()();Oe=!1,Le.clear(),ge(t)}function Xt(t){if(t.fragment!==null){t.update(),ue(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Se)}}function Zt(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 te;function F(){te={r:0,c:[],p:te}}function G(){te.r||ue(te.c),te=te.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),te.c.push(()=>{ke.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function en(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),Se(()=>{const s=t.$$.on_mount.map(Ke).filter(re);t.$$.on_destroy?t.$$.on_destroy.push(...s):ue(s),t.$$.on_mount=[]}),i.forEach(Se)}function I(t,e){const r=t.$$;r.fragment!==null&&(Zt(r.after_update),ue(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function tn(t,e){t.$$.dirty[0]===-1&&(se.push(t),zt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function R(t,e,r,n,i,s,l=null,o=[-1]){const c=me;ge(t);const u=t.$$={fragment:null,ctx:[],props:s,update:y,not_equal:i,bound:je(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:je(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let _=!1;if(u.ctx=r?r(t,e.props||{},(g,B,...k)=>{const w=k.length?k[0]:B;return u.ctx&&i(u.ctx[g],u.ctx[g]=w)&&(!u.skip_bound&&u.bound[g]&&u.bound[g](w),_&&tn(t,g)),B}):[],u.update(),_=!0,ue(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const g=Kt(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),We()}ge(c)}class C{constructor(){Q(this,"$$");Q(this,"$$set")}$destroy(){I(this,1),this.$destroy=y}$on(e,r){if(!re(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&&!Ct(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const nn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nn);function rn(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 sn(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 ln extends C{constructor(e){super(),R(this,e,null,sn,N,{},rn)}}function on(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 Fe(t){let e,r;const n=t[2].default,i=J(n,t,t[1],null);return{c(){e=$(t[0]),i&&i.c(),Ht(t[0])(e,{class:fe("rcb-modal-section")+" svelte-ujomz3"})},m(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,l){i&&i.p&&(!r||l&2)&&V(i,n,s,s[1],r?x(n,s[1],l,null):q(s[1]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function cn(t){let e=t[0],r,n,i=t[0]&&Fe(t);return{c(){i&&i.c(),r=ee()},m(s,l){i&&i.m(s,l),A(s,r,l),n=!0},p(s,[l]){s[0]?e?N(e,s[0])?(i.d(1),i=Fe(s),e=s[0],i.c(),i.m(r.parentNode,r)):i.p(s,l):(i=Fe(s),e=s[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=s[0])},i(s){n||(a(i,s),n=!0)},o(s){f(i,s),n=!1},d(s){s&&m(r),i&&i.d(s)}}}function an(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:s="section"}=e;return t.$$set=l=>{"as"in l&&r(0,s=l.as),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class X extends C{constructor(e){super(),R(this,e,an,cn,N,{as:0},on)}}const un={Y:"year",M:"month",W:"week",D:"day",H:"hour"},Xe=(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":`${un[e]}ly`};function fn(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 dn(t){let e,r,n=t[0].displayName+"",i,s,l,o=t[0].currentPrice.currency+"",c,u=" ",_,g=Xe(t[0].currentPrice.amount,t[0].currentPrice.currency)+"",B,k,w,D,T=Ze(t[0].normalPeriodDuration)+"",U;return{c(){e=$("div"),r=$("span"),i=L(n),s=P(),l=$("span"),c=L(o),_=L(u),B=L(g),k=P(),w=$("span"),D=L("Billed "),U=L(T),h(l,"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),M(e,r),M(r,i),M(e,s),M(e,l),M(l,c),M(l,_),M(l,B),M(e,k),M(e,w),M(w,D),M(w,U)},p(d,p){p&1&&n!==(n=d[0].displayName+"")&&ie(i,n),p&1&&o!==(o=d[0].currentPrice.currency+"")&&ie(c,o),p&1&&g!==(g=Xe(d[0].currentPrice.amount,d[0].currentPrice.currency)+"")&&ie(B,g),p&1&&T!==(T=Ze(d[0].normalPeriodDuration)+"")&&ie(U,T)},d(d){d&&m(e)}}}function mn(t){let e,r;return e=new X({props:{$$slots:{default:[dn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&3&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function gn(t,e,r){let{productDetails:n}=e;return t.$$set=i=>{"productDetails"in i&&r(0,n=i.productDetails)},[n]}class et extends C{constructor(e){super(),R(this,e,gn,mn,N,{productDetails:0},fn)}}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/wCzcBFIcKDBgggPKkzIcCEXLlq4bIEokeLEiBcrYrTIcaNHjRobinQ4sqR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IHDwoFHHm7Y8DCACgMJFWroUBGHgQNMFE6sGGDCAQsaHVY8csAAD4MjSX4w8MDgRpIBoCQwsKIgQpwBUBxIULEHkYcUUC580tDEE6AGbXSYKKMKVIJSUnDQIGIHl6sQS0w8AZagjxAsyqpdy7at24pJfgwBMkQukCRQjQQBIgTIXiFGoAYEACH5BAUFAAEALAMAAwAXABcAAAiVAAMIHEiwoMEMGQwqXPggwsKBTLQshPDgYYAaD1owdPjQB4QIThRGgGAxwIYIIBQ2LMlkJBCDFEsGOPEgA5aCK0tKmQChRkGEMgPIiDDhoRYjTR56CPGwiooXN6oENQikhYsWP65MJXglx4sVMoZsJdikRosWOMYSRPJih9q3cOPKnWuRSxa7eO9O3cJFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function _n(t){let e,r;return{c(){e=$("img"),z(e.src,r=An)||h(e,"src",r),h(e,"alt","spinner")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class pn extends C{constructor(e){super(),R(this,e,null,_n,N,{})}}function hn(t){O(t,"svelte-4wmtg7",".rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}")}function En(t){let e,r,n;return r=new pn({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-loader svelte-4wmtg7")},m(i,s){A(i,e,s),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 ye extends C{constructor(e){super(),R(this,e,null,En,N,{},hn)}}var Ae=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Ae||{}),De=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(De||{}),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 In{constructor(e,r=10){Q(this,"operationSessionId",null);Q(this,"backend");Q(this,"maxNumberAttempts");Q(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=(s=1)=>{if(s>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new H(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(l=>{switch(l.operation.status){case Ae.Started:case Ae.InProgress:setTimeout(()=>i(s+1),this.waitMSBetweenAttempts);break;case Ae.Succeeded:this.clearPurchaseInProgress(),r();return;case Ae.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(l.operation.error,n)}}).catch(l=>{n(new H(3,l.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 De.SetupIntentCreationFailed:r(new H(0,"Setup intent creation failed"));return;case De.PaymentMethodCreationFailed:r(new H(0,"Payment method creation failed"));return;case De.PaymentChargeFailed:r(new H(1,"Payment charge failed"));return}}}function wn(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 bn(t){let e,r,n,i,s;const l=t[3].default,o=J(l,t,t[2],null);return{c(){e=$("button"),o&&o.c(),h(e,"class",r=fe(`intent-${t[0]}`)+" svelte-igat39"),e.disabled=t[1]},m(c,u){A(c,e,u),o&&o.m(e,null),n=!0,i||(s=de(e,"click",t[4]),i=!0)},p(c,[u]){o&&o.p&&(!n||u&4)&&V(o,l,c,c[2],n?x(l,c[2],u,null):q(c[2]),null),(!n||u&1&&r!==(r=fe(`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,s()}}}function $n(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:s="primary"}=e,{disabled:l=!1}=e;function o(c){ze.call(this,t,c)}return t.$$set=c=>{"intent"in c&&r(0,s=c.intent),"disabled"in c&&r(1,l=c.disabled),"$$scope"in c&&r(2,i=c.$$scope)},[s,l,i,n,o]}class _e extends C{constructor(e){super(),R(this,e,$n,bn,N,{intent:0,disabled:1},wn)}}function Bn(t){O(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function kn(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(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,[l]){i&&i.p&&(!r||l&1)&&V(i,n,s,s[0],r?x(n,s[0],l,null):q(s[0]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function yn(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}class ve extends C{constructor(e){super(),R(this,e,yn,kn,N,{},Bn)}}const Dn="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 vn(t){O(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function Qn(t){let e,r;return{c(){e=$("img"),z(e.src,r=Dn)||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 Mn extends C{constructor(e){super(),R(this,e,null,Qn,N,{},vn)}}function Tn(t){O(t,"svelte-18njhoa",'.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}')}function Pn(t){let e,r,n;const i=t[2].default,s=J(i,t,t[1],null);return{c(){e=$("div"),s&&s.c(),h(e,"class","column svelte-18njhoa"),h(e,"style",r=`--gap:${t[0]};`)},m(l,o){A(l,e,o),s&&s.m(e,null),n=!0},p(l,[o]){s&&s.p&&(!n||o&2)&&V(s,i,l,l[1],n?x(i,l[1],o,null):q(l[1]),null),(!n||o&1&&r!==(r=`--gap:${l[0]};`))&&h(e,"style",r)},i(l){n||(a(s,l),n=!0)},o(l){f(s,l),n=!1},d(l){l&&m(e),s&&s.d(l)}}}function Un(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:s="0.5rem"}=e;return t.$$set=l=>{"gutter"in l&&r(0,s=l.gutter),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class ne extends C{constructor(e){super(),R(this,e,Un,Pn,N,{gutter:0},Tn)}}const Nn="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 Rn(t){O(t,"svelte-r1ujja",".close-button.svelte-r1ujja{border:none;cursor:pointer;background-color:transparent}")}function Cn(t){let e,r,n,i,s;return{c(){e=$("button"),r=$("img"),z(r.src,n=Nn)||h(r,"src",n),h(r,"alt","close"),h(e,"class","close-button svelte-r1ujja"),e.disabled=t[0]},m(l,o){A(l,e,o),M(e,r),i||(s=de(e,"click",t[1]),i=!0)},p(l,[o]){o&1&&(e.disabled=l[0])},i:y,o:y,d(l){l&&m(e),i=!1,s()}}}function On(t,e,r){let{disabled:n=!1}=e;function i(s){ze.call(this,t,s)}return t.$$set=s=>{"disabled"in s&&r(0,n=s.disabled)},[n,i]}class Sn extends C{constructor(e){super(),R(this,e,On,Cn,N,{disabled:0},Rn)}}function Ln(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 Fn(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 Gn(t){let e,r,n,i,s,l;return{c(){e=$("picture"),r=$("source"),i=P(),s=$("img"),h(r,"type","image/webp"),Rt(r,n=t[1])||h(r,"srcset",n),h(s,"class","rcb-app-icon svelte-10u48yl"),z(s.src,l=t[0])||h(s,"src",l),h(s,"alt","App icon"),h(e,"class","rcb-app-icon-picture-container svelte-10u48yl")},m(o,c){A(o,e,c),M(e,r),M(e,i),M(e,s)},p(o,c){c&2&&n!==(n=o[1])&&h(r,"srcset",n),c&1&&!z(s.src,l=o[0])&&h(s,"src",l)},d(o){o&&m(e)}}}function Yn(t){let e;function r(s,l){return s[0]!==null?Gn:Fn}let n=r(t),i=n(t);return{c(){i.c(),e=ee()},m(s,l){i.m(s,l),A(s,e,l)},p(s,[l]){n===(n=r(s))&&i?i.p(s,l):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},i:y,o:y,d(s){s&&m(e),i.d(s)}}}function Hn(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=s=>{"src"in s&&r(0,n=s.src),"srcWebp"in s&&r(1,i=s.srcWebp)},[n,i]}class tt extends C{constructor(e){super(),R(this,e,Hn,Yn,N,{src:0,srcWebp:1},Ln)}}const Qe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Kn(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 jn(t){let e,r;return e=new tt({}),{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 Jn(t){let e,r,n=t[0].seller_company_name+"",i,s,l=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&nt(t);return{c(){l&&l.c(),e=P(),r=$("span"),i=L(n),h(r,"class","app-title svelte-1tdgim9")},m(o,c){l&&l.m(o,c),A(o,e,c),A(o,r,c),M(r,i),s=!0},p(o,c){o[0].app_icon_webp!==null&&o[0].app_icon!==null?l?(l.p(o,c),c&1&&a(l,1)):(l=nt(o),l.c(),a(l,1),l.m(e.parentNode,e)):l&&(F(),f(l,1,1,()=>{l=null}),G()),(!s||c&1)&&n!==(n=o[0].seller_company_name+"")&&ie(i,n)},i(o){s||(a(l),s=!0)},o(o){f(l),s=!1},d(o){o&&(m(e),m(r)),l&&l.d(o)}}}function nt(t){let e,r;return e=new tt({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 s={};i&1&&(s.src=Qe(n[0].app_icon)),i&1&&(s.srcWebp=Qe(n[0].app_icon_webp)),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function xn(t){let e,r,n,i;const s=[Jn,jn],l=[];function o(c,u){return c[0]!==null?0:1}return r=o(t),n=l[r]=s[r](t),{c(){e=$("div"),n.c(),h(e,"class","rcb-header-layout__business-info svelte-1tdgim9")},m(c,u){A(c,e,u),l[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?l[r].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),n=l[r],n?n.p(c,u):(n=l[r]=s[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),l[r].d()}}}function Vn(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class rt extends C{constructor(e){super(),R(this,e,Vn,xn,N,{brandingInfo:0},Kn)}}function qn(t){O(t,"svelte-j03lz1",".rcb-post-purchase-header-layout.svelte-j03lz1{display:flex;justify-content:space-between;align-items:center;width:100%}")}function zn(t){let e,r,n,i,s;return r=new rt({props:{brandingInfo:t[0]}}),i=new Sn({}),i.$on("click",function(){re(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(l,o){A(l,e,o),E(r,e,null),M(e,n),E(i,e,null),s=!0},p(l,o){t=l;const c={};o&1&&(c.brandingInfo=t[0]),r.$set(c)},i(l){s||(a(r.$$.fragment,l),a(i.$$.fragment,l),s=!0)},o(l){f(r.$$.fragment,l),f(i.$$.fragment,l),s=!1},d(l){l&&m(e),I(r),I(i)}}}function Wn(t){let e,r;return e=new X({props:{as:"header",$$slots:{default:[zn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&7&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Xn(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=s=>{"brandingInfo"in s&&r(0,n=s.brandingInfo),"onClose"in s&&r(1,i=s.onClose)},[n,i]}class it extends C{constructor(e){super(),R(this,e,Xn,Wn,N,{brandingInfo:0,onClose:1},qn)}}function Zn(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 st(t){let e,r,n,i,s;return{c(){e=L("If this error persists, please contact "),r=$("a"),n=L(t[1]),s=L("."),h(r,"href",i="mailto:"+t[1])},m(l,o){A(l,e,o),A(l,r,o),M(r,n),A(l,s,o)},p(l,o){o&2&&ie(n,l[1]),o&2&&i!==(i="mailto:"+l[1])&&h(r,"href",i)},d(l){l&&(m(e),m(r),m(s))}}}function er(t){let e,r,n,i=t[3]()+"",s,l,o=t[1]&&st(t);return{c(){e=$("span"),e.textContent="Something went wrong.",r=P(),n=$("span"),s=L(i),l=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),M(n,s),M(n,l),o&&o.m(n,null)},p(c,u){c[1]?o?o.p(c,u):(o=st(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 tr(t){let e,r,n,i;return e=new Mn({}),n=new ne({props:{gutter:"1rem",$$slots:{default:[er]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&34&&(o.$$scope={dirty:l,ctx:s}),n.$set(o)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function nr(t){let e,r,n;return r=new ne({props:{gutter:"1rem",$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-error svelte-ahi052")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,s){const l={};s&34&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},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 rr(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function ir(t){let e,r;return e=new _e({props:{$$slots:{default:[rr]},$$scope:{ctx:t}}}),e.$on("click",function(){re(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 s={};i&32&&(s.$$scope={dirty:i,ctx:t}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function sr(t){let e,r,n,i,s,l;return e=new it({props:{brandingInfo:t[0],onClose:t[2]}}),n=new X({props:{$$slots:{default:[nr]},$$scope:{ctx:t}}}),s=new ve({props:{$$slots:{default:[ir]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment),i=P(),b(s.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(s,o,c),l=!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}),s.$set(g)},i(o){l||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(s.$$.fragment,o),l=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(s.$$.fragment,o),l=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(s,o)}}}function lr(t){let e,r;return e=new ne({props:{gutter:"2rem",$$slots:{default:[sr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&39&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function or(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:s=null}=e,{onContinue:l}=e;$e(()=>{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,s=c.supportEmail),"onContinue"in c&&r(2,l=c.onContinue)},[n,s,l,o,i]}class cr extends C{constructor(e){super(),R(this,e,or,lr,N,{brandingInfo:0,lastError:4,supportEmail:1,onContinue:2},Zn)}}const ar="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 ur(t){O(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function fr(t){let e,r;return{c(){e=$("img"),z(e.src,r=ar)||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 dr extends C{constructor(e){super(),R(this,e,null,fr,N,{},ur)}}function mr(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 gr(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,s){A(i,e,s),A(i,r,s),A(i,n,s)},p:y,d(i){i&&(m(e),m(r),m(n))}}}function Ar(t){let e,r,n,i;return e=new dr({}),n=new ne({props:{gutter:"1rem",$$slots:{default:[gr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&4&&(o.$$scope={dirty:l,ctx:s}),n.$set(o)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function _r(t){let e,r,n;return r=new ne({props:{gutter:"1rem",$$slots:{default:[Ar]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-success svelte-1lcsna9")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,s){const l={};s&4&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},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 pr(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function hr(t){let e,r;return e=new _e({props:{$$slots:{default:[pr]},$$scope:{ctx:t}}}),e.$on("click",function(){re(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 s={};i&4&&(s.$$scope={dirty:i,ctx:t}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Er(t){let e,r,n,i,s,l;return e=new it({props:{brandingInfo:t[0],onClose:t[1]}}),n=new X({props:{$$slots:{default:[_r]},$$scope:{ctx:t}}}),s=new ve({props:{$$slots:{default:[hr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment),i=P(),b(s.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(s,o,c),l=!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}),s.$set(g)},i(o){l||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(s.$$.fragment,o),l=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(s.$$.fragment,o),l=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(s,o)}}}function Ir(t){let e,r;return e=new ne({props:{gutter:"2rem",$$slots:{default:[Er]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&7&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function wr(t,e,r){let{brandingInfo:n=null}=e,{onContinue:i}=e;return t.$$set=s=>{"brandingInfo"in s&&r(0,n=s.brandingInfo),"onContinue"in s&&r(1,i=s.onContinue)},[n,i]}class br extends C{constructor(e){super(),R(this,e,wr,Ir,N,{brandingInfo:0,onContinue:1},mr)}}function $r(t,e,r,n,i={}){const s=r.create(e,i);return s.mount(t),s.on("change",l=>n("change",l)),s.on("ready",l=>n("ready",l)),s.on("focus",l=>n("focus",l)),s.on("blur",l=>n("blur",l)),s.on("escape",l=>n("escape",l)),s.on("click",l=>n("click",l)),s.on("loaderror",l=>n("loaderror",l)),s.on("loaderstart",l=>n("loaderstart",l)),s.on("networkschange",l=>n("networkschange",l)),s}const Br=typeof window>"u";function kr(t){if(!Br)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function yr(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 Dr(t,e,r){let n,i;const s=Jt(),{elements:l}=Vt("stripe");let{options:o=void 0}=e;$e(()=>(n=$r(i,"payment",l,s,o),()=>n.destroy()));function c(){n.blur()}function u(){n.clear()}function _(){n.destroy()}function g(){n.focus()}function B(k){Be[k?"unshift":"push"](()=>{i=k,r(0,i)})}return t.$$set=k=>{"options"in k&&r(1,o=k.options)},[i,o,c,u,_,g,B]}class vr extends C{constructor(e){super(),R(this,e,Dr,yr,N,{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 lt(t){let e;const r=t[15].default,n=J(r,t,t[14],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16384)&&V(n,r,i,i[14],e?x(r,i[14],s,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 Qr(t){let e,r,n=t[1]&&t[0]&&lt(t);return{c(){n&&n.c(),e=ee()},m(i,s){n&&n.m(i,s),A(i,e,s),r=!0},p(i,[s]){i[1]&&i[0]?n?(n.p(i,s),s&3&&a(n,1)):(n=lt(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 Mr(t,e,r){let n,{$$slots:i={},$$scope:s}=e,{stripe:l}=e,{mode:o=void 0}=e,{theme:c="stripe"}=e,{variables:u={}}=e,{rules:_={}}=e,{labels:g="above"}=e,{loader:B="auto"}=e,{fonts:k=[]}=e,{locale:w="auto"}=e,{currency:D=void 0}=e,{amount:T=void 0}=e,{clientSecret:U=void 0}=e,{elements:d=null}=e;return t.$$set=p=>{"stripe"in p&&r(1,l=p.stripe),"mode"in p&&r(2,o=p.mode),"theme"in p&&r(3,c=p.theme),"variables"in p&&r(4,u=p.variables),"rules"in p&&r(5,_=p.rules),"labels"in p&&r(6,g=p.labels),"loader"in p&&r(7,B=p.loader),"fonts"in p&&r(8,k=p.fonts),"locale"in p&&r(9,w=p.locale),"currency"in p&&r(10,D=p.currency),"amount"in p&&r(11,T=p.amount),"clientSecret"in p&&r(12,U=p.clientSecret),"elements"in p&&r(0,d=p.elements),"$$scope"in p&&r(14,s=p.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:u,rules:_,labels:g}),t.$$.dirty&16263&&l&&!d&&(r(0,d=l.elements({mode:o,currency:D,amount:T,appearance:n,clientSecret:U,fonts:k,loader:B,locale:w})),kr(l),xt("stripe",{stripe:l,elements:d})),t.$$.dirty&8705&&d&&d.update({appearance:n,locale:w})},[d,l,o,c,u,_,g,B,k,w,D,T,U,n,s,i]}class Tr extends C{constructor(e){super(),R(this,e,Mr,Qr,N,{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 ot="https://js.stripe.com/v3",Pr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,ct="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Ur=function(){for(var e=document.querySelectorAll('script[src^="'.concat(ot,'"]')),r=0;r<e.length;r++){var n=e[r];if(Pr.test(n.src))return n}return null},at=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(ot).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},Nr=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.3.0",startTime:r})},pe=null,Me=null,Te=null,Rr=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Cr=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},Or=function(e){return pe!==null?pe:(pe=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(ct),window.Stripe){r(window.Stripe);return}try{var i=Ur();if(i&&e)console.warn(ct);else if(!i)i=at(e);else if(i&&Te!==null&&Me!==null){var s;i.removeEventListener("load",Te),i.removeEventListener("error",Me),(s=i.parentNode)===null||s===void 0||s.removeChild(i),i=at(e)}Te=Cr(r,n),Me=Rr(n),i.addEventListener("load",Te),i.addEventListener("error",Me)}catch(l){n(l);return}}),pe.catch(function(r){return pe=null,Promise.reject(r)}))},Sr=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return Nr(i,n),i},he,ut=!1,ft=function(){return he||(he=Or(null).catch(function(e){return he=null,Promise.reject(e)}),he)};Promise.resolve().then(function(){return ft()}).catch(function(t){ut||console.warn(t)});var Lr=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];ut=!0;var i=Date.now();return ft().then(function(s){return Sr(s,r,i)})};function Fr(t){O(t,"svelte-1fwwzeb",".rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}")}function Gr(t){let e,r;return e=new ye({}),{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 Yr(t){let e,r,n,i,s,l;function o(u){t[9](u)}let c={stripe:t[2],clientSecret:t[4],loader:"always",$$slots:{default:[zr]},$$scope:{ctx:t}};return t[1]!==void 0&&(c.elements=t[1]),r=new Tr({props:c}),Be.push(()=>en(r,"elements",o)),{c(){e=$("form"),b(r.$$.fragment)},m(u,_){A(u,e,_),E(r,e,null),i=!0,s||(l=de(e,"submit",Ve(t[5])),s=!0)},p(u,_){const g={};_&4&&(g.stripe=u[2]),_&2057&&(g.$$scope={dirty:_,ctx:u}),!n&&_&2&&(n=!0,g.elements=u[1],Wt(()=>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),s=!1,l()}}}function Hr(t){let e,r,n;return r=new vr({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-stripe-elements-container svelte-1fwwzeb")},m(i,s){A(i,e,s),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 Kr(t){let e;return{c(){e=L("Pay")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function jr(t){let e;return{c(){e=L("Processing...")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Jr(t){let e;function r(s,l){return s[3]?jr:Kr}let n=r(t),i=n(t);return{c(){i.c(),e=ee()},m(s,l){i.m(s,l),A(s,e,l)},p(s,l){n!==(n=r(s))&&(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){s&&m(e),i.d(s)}}}function xr(t){let e;return{c(){e=L("Close")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Vr(t){let e,r,n,i;return e=new _e({props:{disabled:t[3],$$slots:{default:[Jr]},$$scope:{ctx:t}}}),n=new _e({props:{disabled:t[3],intent:"secondary",$$slots:{default:[xr]},$$scope:{ctx:t}}}),n.$on("click",function(){re(t[0])&&t[0].apply(this,arguments)}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){t=s;const o={};l&8&&(o.disabled=t[3]),l&2056&&(o.$$scope={dirty:l,ctx:t}),e.$set(o);const c={};l&8&&(c.disabled=t[3]),l&2048&&(c.$$scope={dirty:l,ctx:t}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function qr(t){let e,r;return e=new ne({props:{$$slots:{default:[Vr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&2057&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function zr(t){let e,r,n,i;return e=new X({props:{$$slots:{default:[Hr]},$$scope:{ctx:t}}}),n=new ve({props:{$$slots:{default:[qr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&2048&&(o.$$scope={dirty:l,ctx:s}),e.$set(o);const c={};l&2057&&(c.$$scope={dirty:l,ctx:s}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function Wr(t){let e,r,n,i;const s=[Yr,Gr],l=[];function o(c,u){return c[2]&&c[4]?0:1}return r=o(t),n=l[r]=s[r](t),{c(){e=$("div"),n.c()},m(c,u){A(c,e,u),l[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?l[r].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),n=l[r],n?n.p(c,u):(n=l[r]=s[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),l[r].d()}}}function Xr(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:s}=e,{paymentInfoCollectionMetadata:l}=e;const o=l.data.client_secret;let c=null,u,_=!1,g;$e(async()=>{const w=l.data.publishable_api_key,D=l.data.stripe_account_id;if(!w||!D)throw new Error("Stripe publishable key or account ID not found");r(2,c=await Lr(w,{stripeAccount:D}))});const B=async()=>{if(_||!c||!g)return;r(3,_=!0);const w=await c.confirmSetup({elements:g,redirect:"if_required"});w.error?(r(3,_=!1),s(new H(S.StripeError,w.error.message))):i()};function k(w){u=w,r(1,u)}return t.$$set=w=>{"onClose"in w&&r(0,n=w.onClose),"onContinue"in w&&r(6,i=w.onContinue),"onError"in w&&r(7,s=w.onError),"paymentInfoCollectionMetadata"in w&&r(8,l=w.paymentInfoCollectionMetadata)},t.$$.update=()=>{t.$$.dirty&2&&u&&u._elements.length>0&&(g=u)},[n,u,c,_,o,B,i,s,l,k]}class Zr extends C{constructor(e){super(),R(this,e,Xr,Wr,N,{onClose:0,onContinue:6,onError:7,paymentInfoCollectionMetadata:8},Fr)}}function ei(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 ti(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 ni(t){let e,r,n,i,s,l,o;return{c(){e=$("div"),r=$("div"),r.innerHTML='<label for="email">E-mail</label>',n=P(),i=$("div"),s=$("input"),h(r,"class","form-label svelte-1xardyz"),h(s,"name","email"),h(s,"placeholder","john@appleseed.com"),h(s,"class","svelte-1xardyz"),h(i,"class","form-input svelte-1xardyz"),h(e,"class","form-container svelte-1xardyz")},m(c,u){A(c,e,u),M(e,r),M(e,n),M(e,i),M(i,s),qe(s,t[0]),l||(o=de(s,"input",t[3]),l=!0)},p(c,u){u&1&&s.value!==c[0]&&qe(s,c[0])},d(c){c&&m(e),l=!1,o()}}}function ri(t){let e;return{c(){e=L("Continue")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function ii(t){let e,r;return e=new _e({props:{$$slots:{default:[ri]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&16&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function si(t){let e,r,n,i,s,l,o,c,u,_;return n=new X({props:{$$slots:{default:[ti]},$$scope:{ctx:t}}}),s=new X({props:{$$slots:{default:[ni]},$$scope:{ctx:t}}}),o=new ve({props:{$$slots:{default:[ii]},$$scope:{ctx:t}}}),{c(){e=$("div"),r=$("form"),b(n.$$.fragment),i=P(),b(s.$$.fragment),l=P(),b(o.$$.fragment)},m(g,B){A(g,e,B),M(e,r),E(n,r,null),M(r,i),E(s,r,null),M(r,l),E(o,r,null),c=!0,u||(_=de(r,"submit",Ve(t[1])),u=!0)},p(g,[B]){const k={};B&16&&(k.$$scope={dirty:B,ctx:g}),n.$set(k);const w={};B&17&&(w.$$scope={dirty:B,ctx:g}),s.$set(w);const D={};B&16&&(D.$$scope={dirty:B,ctx:g}),o.$set(D)},i(g){c||(a(n.$$.fragment,g),a(s.$$.fragment,g),a(o.$$.fragment,g),c=!0)},o(g){f(n.$$.fragment,g),f(s.$$.fragment,g),f(o.$$.fragment,g),c=!1},d(g){g&&m(e),I(n),I(s),I(o),u=!1,_()}}}function li(t,e,r){let n,{onContinue:i}=e;const s=async()=>{i({email:n})};function l(){n=this.value,r(0,n)}return t.$$set=o=>{"onContinue"in o&&r(2,i=o.onContinue)},r(0,n=""),[n,s,i,l]}class oi extends C{constructor(e){super(),R(this,e,li,si,N,{onContinue:2},ei)}}const ci="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 ai(t){let e,r;return{c(){e=$("img"),z(e.src,r=ci)||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 ui extends C{constructor(e){super(),R(this,e,null,ai,N,{})}}function fi(t){O(t,"svelte-1ggdgso",".rcb-header-layout.svelte-1ggdgso{display:flex;justify-content:space-between;align-items:center;width:100%}")}function di(t){let e,r,n,i,s;return r=new rt({props:{brandingInfo:t[0]}}),i=new ui({}),{c(){e=$("div"),b(r.$$.fragment),n=P(),b(i.$$.fragment),h(e,"class","rcb-header-layout svelte-1ggdgso")},m(l,o){A(l,e,o),E(r,e,null),M(e,n),E(i,e,null),s=!0},p(l,o){const c={};o&1&&(c.brandingInfo=l[0]),r.$set(c)},i(l){s||(a(r.$$.fragment,l),a(i.$$.fragment,l),s=!0)},o(l){f(r.$$.fragment,l),f(i.$$.fragment,l),s=!1},d(l){l&&m(e),I(r),I(i)}}}function mi(t){let e,r;return e=new X({props:{as:"header",$$slots:{default:[di]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&3&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function gi(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class Ai extends C{constructor(e){super(),R(this,e,gi,mi,N,{brandingInfo:0},fi)}}function _i(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 pi(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(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,[l]){i&&i.p&&(!r||l&1)&&V(i,n,s,s[0],r?x(n,s[0],l,null):q(s[0]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function hi(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}class Ei extends C{constructor(e){super(),R(this,e,hi,pi,N,{},_i)}}function Ii(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 wi(t){let e,r,n;const i=t[2].default,s=J(i,t,t[1],null);return{c(){e=$("main"),s&&s.c(),h(e,"class",r=fe(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx")},m(l,o){A(l,e,o),s&&s.m(e,null),n=!0},p(l,[o]){s&&s.p&&(!n||o&2)&&V(s,i,l,l[1],n?x(i,l[1],o,null):q(l[1]),null),(!n||o&1&&r!==(r=fe(`rcb-modal-main ${l[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx"))&&h(e,"class",r)},i(l){n||(a(s,l),n=!0)},o(l){f(s,l),n=!1},d(l){l&&m(e),s&&s.d(l)}}}function bi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:s=!1}=e;return t.$$set=l=>{"dark"in l&&r(0,s=l.dark),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class $i extends C{constructor(e){super(),R(this,e,bi,wi,N,{dark:0},Ii)}}function Bi(t){let e;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&4)&&V(n,r,i,i[2],e?x(r,i[2],s,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 ki(t){let e,r;return e=new Ei({props:{$$slots:{default:[yi]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},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;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&4)&&V(n,r,i,i[2],e?x(r,i[2],s,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 Di(t){let e,r,n,i;const s=[ki,Bi],l=[];function o(c,u){return c[0]?0:1}return e=o(t),r=l[e]=s[e](t),{c(){r.c(),n=ee()},m(c,u){l[e].m(c,u),A(c,n,u),i=!0},p(c,[u]){let _=e;e=o(c),e===_?l[e].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),r=l[e],r?r.p(c,u):(r=l[e]=s[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),l[e].d(c)}}}function vi(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:s=!1}=e;return t.$$set=l=>{"condition"in l&&r(0,s=l.condition),"$$scope"in l&&r(2,i=l.$$scope)},[s,n,i]}class Qi extends C{constructor(e){super(),R(this,e,vi,Di,N,{condition:0})}}function dt(t){let e,r;return e=new Ai({props:{brandingInfo:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.brandingInfo=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Mi(t){let e,r,n=t[1]&&dt(t);const i=t[3].default,s=J(i,t,t[4],null);return{c(){n&&n.c(),e=P(),s&&s.c()},m(l,o){n&&n.m(l,o),A(l,e,o),s&&s.m(l,o),r=!0},p(l,o){l[1]?n?(n.p(l,o),o&2&&a(n,1)):(n=dt(l),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G()),s&&s.p&&(!r||o&16)&&V(s,i,l,l[4],r?x(i,l[4],o,null):q(l[4]),null)},i(l){r||(a(n),a(s,l),r=!0)},o(l){f(n),f(s,l),r=!1},d(l){l&&m(e),n&&n.d(l),s&&s.d(l)}}}function Ti(t){let e,r;return e=new $i({props:{dark:t[0],$$slots:{default:[Mi]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&1&&(s.dark=n[0]),i&22&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Pi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:s=!1}=e,{showHeader:l=!1}=e,{brandingInfo:o=null}=e;return t.$$set=c=>{"dark"in c&&r(0,s=c.dark),"showHeader"in c&&r(1,l=c.showHeader),"brandingInfo"in c&&r(2,o=c.brandingInfo),"$$scope"in c&&r(4,i=c.$$scope)},[s,l,o,n,i]}class mt extends C{constructor(e){super(),R(this,e,Pi,Ti,N,{dark:0,showHeader:1,brandingInfo:2})}}var Ee=(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))(Ee||{});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 gt?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 gt=(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))(gt||{});class Z extends Error{constructor(r,n,i){super(n);Q(this,"toString",()=>`PurchasesError(code: ${Ee[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=Pe.getErrorCodeForBackendErrorCode(r);return new Z(i,Pe.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new Z(Pe.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class At extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}const Ui="0.0.10",ce="https://api.revenuecat.com";var Ue;(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"})(Ue||(Ue={}));function _t(t){return t?t.startsWith("rcb_sb_"):!1}async function ae(t,e,r,n){const i=await fetch(t.url(),{method:t.method,headers:Ci(e,n),body:Ri(r)});return await Ni(i,t),await i.json()}async function Ni(t,e){const r=t.status;if(r>=Ue.INTERNAL_SERVER_ERROR)Ge(e,r,await t.text());else if(r>=Ue.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,s=n==null?void 0:n.code,l=n==null?void 0:n.message;if(s!=null){const o=Pe.convertCodeToBackendErrorCode(s);if(o==null)Ge(e,r,i);else throw Z.getForBackendError(o,l)}else Ge(e,r,i)}}function Ge(t,e,r){throw new Z(Ee.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function Ri(t){return t==null?null:JSON.stringify(t)}function Ci(t,e){let r={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":Ui,"X-Is-Sandbox":`${_t(t)}`};return e!=null&&(r={...r,...e}),r}const pt="/v1/subscribers",Ne="/rcbilling/v1";class Oi{constructor(e){Q(this,"appUserId");Q(this,"method","GET");Q(this,"name","getOfferings");this.appUserId=e}url(){return`${ce}${pt}/${this.appUserId}/offerings`}}class Si{constructor(){Q(this,"method","POST");Q(this,"name","subscribe")}url(){return`${ce}${Ne}/subscribe`}}class Li{constructor(e,r){Q(this,"method","GET");Q(this,"name","getProducts");Q(this,"appUserId");Q(this,"productIds");this.appUserId=e,this.productIds=r}url(){return`${ce}${Ne}/subscribers/${this.appUserId}/products?id=${this.productIds.join("&id=")}`}}class Fi{constructor(e){Q(this,"method","GET");Q(this,"name","getCustomerInfo");Q(this,"appUserId");this.appUserId=e}url(){return`${ce}${pt}/${this.appUserId}`}}class Gi{constructor(){Q(this,"method","GET");Q(this,"name","getBrandingInfo")}url(){return`${ce}${Ne}/branding`}}class Yi{constructor(e){Q(this,"method","GET");Q(this,"name","getCheckoutStatus");Q(this,"operationSessionId");this.operationSessionId=e}url(){return`${ce}${Ne}/checkout/${this.operationSessionId}`}}class Hi{constructor(e){Q(this,"API_KEY");this.API_KEY=e}async getOfferings(e){return await ae(new Oi(e),this.API_KEY)}async getCustomerInfo(e){return await ae(new Fi(e),this.API_KEY)}async getProducts(e,r){return await ae(new Li(e,r),this.API_KEY)}async getBrandingInfo(){return await ae(new Gi,this.API_KEY)}async postSubscribe(e,r,n){return await ae(new Si,this.API_KEY,{app_user_id:e,product_id:r,email:n})}async getCheckoutStatus(e){return await ae(new Yi(e),this.API_KEY)}}function Ki(t){O(t,"svelte-ofxzf4",`.rcb-ui-container.svelte-ofxzf4{color-scheme:none;font-family:"PP Object Sans",
1
+ (function(Y,K){typeof exports=="object"&&typeof module<"u"?K(exports):typeof define=="function"&&define.amd?define(["exports"],K):(Y=typeof globalThis<"u"?globalThis:Y||self,K(Y.Purchases={}))})(this,function(Y){"use strict";var as=Object.defineProperty;var us=(Y,K,z)=>K in Y?as(Y,K,{enumerable:!0,configurable:!0,writable:!0,value:z}):Y[K]=z;var Q=(Y,K,z)=>(us(Y,typeof K!="symbol"?K+"":K,z),z);function K(t){return t!=null}var z=(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))(z||{});const Tt=(t,e)=>({identifier:t.identifier,displayName:t.title,currentPrice:t.current_price,normalPeriodDuration:t.normal_period_duration,presentedOfferingIdentifier:e}),Pt=(t,e,r)=>{const n=r[e.platform_product_identifier];return n===void 0?null:{identifier:e.identifier,rcBillingProduct:Tt(n,t),packageType:Ut(e.identifier)}},He=(t,e)=>{const r=t.packages.map(i=>Pt(t.identifier,i,e)).filter(K),n={};for(const i of r)i!=null&&(n[i.identifier]=i);return r.length==0?null:{identifier:t.identifier,serverDescription:t.description,metadata:t.metadata,packagesById:n,availablePackages:r,lifetime:n.$rc_lifetime??null,annual:n.$rc_annual??null,sixMonth:n.$rc_six_month??null,threeMonth:n.$rc_three_month??null,twoMonth:n.$rc_two_month??null,monthly:n.$rc_monthly??null,weekly:n.$rc_weekly??null}};function Ut(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 Nt(t,e){for(const r in e)t[r]=e[r];return t}function Ke(t){return t()}function je(){return Object.create(null)}function ue(t){t.forEach(Ke)}function re(t){return typeof t=="function"}function N(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let we;function W(t,e){return t===e?!0:(we||(we=document.createElement("a")),we.href=e,t===we.href)}function Je(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function Rt(t,e){const r=Je(t.srcset),n=Je(e||"");return n.length===r.length&&n.every(([i,s],l)=>s===r[l][1]&&(W(r[l][0],i)||W(i,r[l][0])))}function Ct(t){return Object.keys(t).length===0}function J(t,e,r,n){if(t){const i=xe(t,e,r,n);return t[0](i)}}function xe(t,e,r,n){return t[1]&&n?Nt(r.ctx.slice(),t[1](n(e))):r.ctx}function x(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 s=[],l=Math.max(e.dirty.length,i.length);for(let o=0;o<l;o+=1)s[o]=e.dirty[o]|i[o];return s}return e.dirty|i}return e.dirty}function V(t,e,r,n,i,s){if(i){const l=xe(e,r,n,s);t.p(l,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 fe(t){return t??""}function M(t,e){t.appendChild(e)}function S(t,e,r){const n=St(t);if(!n.getElementById(e)){const i=$("style");i.id=e,i.textContent=r,Ot(n,i)}}function St(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Ot(t,e){return M(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 ee(){return L("")}function de(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function Ve(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 Lt=["width","height"];function Ft(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&&Lt.indexOf(n)===-1?t[n]=e[n]:h(t,n,e[n])}function Gt(t,e){Object.keys(e).forEach(r=>{Yt(t,r,e[r])})}function Yt(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 Ht(t){return/-/.test(t)?Gt:Ft}function Kt(t){return Array.from(t.childNodes)}function ie(t,e){e=""+e,t.data!==e&&(t.data=e)}function qe(t,e){t.value=e??""}function jt(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let me;function ge(t){me=t}function be(){if(!me)throw new Error("Function called outside component initialization");return me}function $e(t){be().$$.on_mount.push(t)}function Jt(){const t=be();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=jt(e,r,{cancelable:n});return i.slice().forEach(l=>{l.call(t,s)}),!s.defaultPrevented}return!0}}function xt(t,e){return be().$$.context.set(t,e),e}function Vt(t){return be().$$.context.get(t)}function We(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const se=[],Be=[];let le=[];const Ce=[],qt=Promise.resolve();let Se=!1;function Wt(){Se||(Se=!0,qt.then(ze))}function Oe(t){le.push(t)}function zt(t){Ce.push(t)}const Le=new Set;let oe=0;function ze(){if(oe!==0)return;const t=me;do{try{for(;oe<se.length;){const e=se[oe];oe++,ge(e),Xt(e.$$)}}catch(e){throw se.length=0,oe=0,e}for(ge(null),se.length=0,oe=0;Be.length;)Be.pop()();for(let e=0;e<le.length;e+=1){const r=le[e];Le.has(r)||(Le.add(r),r())}le.length=0}while(se.length);for(;Ce.length;)Ce.pop()();Se=!1,Le.clear(),ge(t)}function Xt(t){if(t.fragment!==null){t.update(),ue(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Oe)}}function Zt(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 te;function F(){te={r:0,c:[],p:te}}function G(){te.r||ue(te.c),te=te.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),te.c.push(()=>{ke.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function en(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 s=t.$$.on_mount.map(Ke).filter(re);t.$$.on_destroy?t.$$.on_destroy.push(...s):ue(s),t.$$.on_mount=[]}),i.forEach(Oe)}function I(t,e){const r=t.$$;r.fragment!==null&&(Zt(r.after_update),ue(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function tn(t,e){t.$$.dirty[0]===-1&&(se.push(t),Wt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function R(t,e,r,n,i,s,l=null,o=[-1]){const c=me;ge(t);const u=t.$$={fragment:null,ctx:[],props:s,update:y,not_equal:i,bound:je(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:je(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let _=!1;if(u.ctx=r?r(t,e.props||{},(g,B,...k)=>{const w=k.length?k[0]:B;return u.ctx&&i(u.ctx[g],u.ctx[g]=w)&&(!u.skip_bound&&u.bound[g]&&u.bound[g](w),_&&tn(t,g)),B}):[],u.update(),_=!0,ue(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const g=Kt(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),ze()}ge(c)}class C{constructor(){Q(this,"$$");Q(this,"$$set")}$destroy(){I(this,1),this.$destroy=y}$on(e,r){if(!re(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&&!Ct(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const nn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nn);function rn(t){S(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 sn(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 ln extends C{constructor(e){super(),R(this,e,null,sn,N,{},rn)}}function on(t){S(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 Fe(t){let e,r;const n=t[2].default,i=J(n,t,t[1],null);return{c(){e=$(t[0]),i&&i.c(),Ht(t[0])(e,{class:fe("rcb-modal-section")+" svelte-ujomz3"})},m(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,l){i&&i.p&&(!r||l&2)&&V(i,n,s,s[1],r?x(n,s[1],l,null):q(s[1]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function cn(t){let e=t[0],r,n,i=t[0]&&Fe(t);return{c(){i&&i.c(),r=ee()},m(s,l){i&&i.m(s,l),A(s,r,l),n=!0},p(s,[l]){s[0]?e?N(e,s[0])?(i.d(1),i=Fe(s),e=s[0],i.c(),i.m(r.parentNode,r)):i.p(s,l):(i=Fe(s),e=s[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=s[0])},i(s){n||(a(i,s),n=!0)},o(s){f(i,s),n=!1},d(s){s&&m(r),i&&i.d(s)}}}function an(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:s="section"}=e;return t.$$set=l=>{"as"in l&&r(0,s=l.as),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class X extends C{constructor(e){super(),R(this,e,an,cn,N,{as:0},on)}}const un={Y:"year",M:"month",W:"week",D:"day",H:"hour"},Xe=(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":`${un[e]}ly`};function fn(t){S(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 dn(t){let e,r,n=t[0].displayName+"",i,s,l,o=t[0].currentPrice.currency+"",c,u=" ",_,g=Xe(t[0].currentPrice.amount,t[0].currentPrice.currency)+"",B,k,w,D,T=Ze(t[0].normalPeriodDuration)+"",U;return{c(){e=$("div"),r=$("span"),i=L(n),s=P(),l=$("span"),c=L(o),_=L(u),B=L(g),k=P(),w=$("span"),D=L("Billed "),U=L(T),h(l,"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),M(e,r),M(r,i),M(e,s),M(e,l),M(l,c),M(l,_),M(l,B),M(e,k),M(e,w),M(w,D),M(w,U)},p(d,p){p&1&&n!==(n=d[0].displayName+"")&&ie(i,n),p&1&&o!==(o=d[0].currentPrice.currency+"")&&ie(c,o),p&1&&g!==(g=Xe(d[0].currentPrice.amount,d[0].currentPrice.currency)+"")&&ie(B,g),p&1&&T!==(T=Ze(d[0].normalPeriodDuration)+"")&&ie(U,T)},d(d){d&&m(e)}}}function mn(t){let e,r;return e=new X({props:{$$slots:{default:[dn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&3&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function gn(t,e,r){let{productDetails:n}=e;return t.$$set=i=>{"productDetails"in i&&r(0,n=i.productDetails)},[n]}class et extends C{constructor(e){super(),R(this,e,gn,mn,N,{productDetails:0},fn)}}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+/PbofcOHnr9/5f3x4UeffvYVqJuACP5m4IIJ+g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x4sVMoZsJdikRosWOMYSRPJih9q3cOPKnWuRSxa7eO9O3cJFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function _n(t){let e,r;return{c(){e=$("img"),W(e.src,r=An)||h(e,"src",r),h(e,"alt","spinner")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class pn extends C{constructor(e){super(),R(this,e,null,_n,N,{})}}function hn(t){S(t,"svelte-4wmtg7",".rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}")}function En(t){let e,r,n;return r=new pn({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-loader svelte-4wmtg7")},m(i,s){A(i,e,s),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 ye extends C{constructor(e){super(),R(this,e,null,En,N,{},hn)}}var Ae=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Ae||{}),De=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(De||{}),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 In{constructor(e,r=10){Q(this,"operationSessionId",null);Q(this,"backend");Q(this,"maxNumberAttempts");Q(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=(s=1)=>{if(s>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new H(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(l=>{switch(l.operation.status){case Ae.Started:case Ae.InProgress:setTimeout(()=>i(s+1),this.waitMSBetweenAttempts);break;case Ae.Succeeded:this.clearPurchaseInProgress(),r();return;case Ae.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(l.operation.error,n)}}).catch(l=>{n(new H(3,l.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 De.SetupIntentCreationFailed:r(new H(0,"Setup intent creation failed"));return;case De.PaymentMethodCreationFailed:r(new H(0,"Payment method creation failed"));return;case De.PaymentChargeFailed:r(new H(1,"Payment charge failed"));return}}}function wn(t){S(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 bn(t){let e,r,n,i,s;const l=t[3].default,o=J(l,t,t[2],null);return{c(){e=$("button"),o&&o.c(),h(e,"class",r=fe(`intent-${t[0]}`)+" svelte-igat39"),e.disabled=t[1]},m(c,u){A(c,e,u),o&&o.m(e,null),n=!0,i||(s=de(e,"click",t[4]),i=!0)},p(c,[u]){o&&o.p&&(!n||u&4)&&V(o,l,c,c[2],n?x(l,c[2],u,null):q(c[2]),null),(!n||u&1&&r!==(r=fe(`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,s()}}}function $n(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:s="primary"}=e,{disabled:l=!1}=e;function o(c){We.call(this,t,c)}return t.$$set=c=>{"intent"in c&&r(0,s=c.intent),"disabled"in c&&r(1,l=c.disabled),"$$scope"in c&&r(2,i=c.$$scope)},[s,l,i,n,o]}class _e extends C{constructor(e){super(),R(this,e,$n,bn,N,{intent:0,disabled:1},wn)}}function Bn(t){S(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function kn(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(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,[l]){i&&i.p&&(!r||l&1)&&V(i,n,s,s[0],r?x(n,s[0],l,null):q(s[0]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function yn(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}class ve extends C{constructor(e){super(),R(this,e,yn,kn,N,{},Bn)}}const Dn="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 vn(t){S(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function Qn(t){let e,r;return{c(){e=$("img"),W(e.src,r=Dn)||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 Mn extends C{constructor(e){super(),R(this,e,null,Qn,N,{},vn)}}function Tn(t){S(t,"svelte-18njhoa",'.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}')}function Pn(t){let e,r,n;const i=t[2].default,s=J(i,t,t[1],null);return{c(){e=$("div"),s&&s.c(),h(e,"class","column svelte-18njhoa"),h(e,"style",r=`--gap:${t[0]};`)},m(l,o){A(l,e,o),s&&s.m(e,null),n=!0},p(l,[o]){s&&s.p&&(!n||o&2)&&V(s,i,l,l[1],n?x(i,l[1],o,null):q(l[1]),null),(!n||o&1&&r!==(r=`--gap:${l[0]};`))&&h(e,"style",r)},i(l){n||(a(s,l),n=!0)},o(l){f(s,l),n=!1},d(l){l&&m(e),s&&s.d(l)}}}function Un(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:s="0.5rem"}=e;return t.$$set=l=>{"gutter"in l&&r(0,s=l.gutter),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class ne extends C{constructor(e){super(),R(this,e,Un,Pn,N,{gutter:0},Tn)}}const Nn="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 Rn(t){S(t,"svelte-r1ujja",".close-button.svelte-r1ujja{border:none;cursor:pointer;background-color:transparent}")}function Cn(t){let e,r,n,i,s;return{c(){e=$("button"),r=$("img"),W(r.src,n=Nn)||h(r,"src",n),h(r,"alt","close"),h(e,"class","close-button svelte-r1ujja"),e.disabled=t[0]},m(l,o){A(l,e,o),M(e,r),i||(s=de(e,"click",t[1]),i=!0)},p(l,[o]){o&1&&(e.disabled=l[0])},i:y,o:y,d(l){l&&m(e),i=!1,s()}}}function Sn(t,e,r){let{disabled:n=!1}=e;function i(s){We.call(this,t,s)}return t.$$set=s=>{"disabled"in s&&r(0,n=s.disabled)},[n,i]}class On extends C{constructor(e){super(),R(this,e,Sn,Cn,N,{disabled:0},Rn)}}function Ln(t){S(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 Fn(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 Gn(t){let e,r,n,i,s,l;return{c(){e=$("picture"),r=$("source"),i=P(),s=$("img"),h(r,"type","image/webp"),Rt(r,n=t[1])||h(r,"srcset",n),h(s,"class","rcb-app-icon svelte-10u48yl"),W(s.src,l=t[0])||h(s,"src",l),h(s,"alt","App icon"),h(e,"class","rcb-app-icon-picture-container svelte-10u48yl")},m(o,c){A(o,e,c),M(e,r),M(e,i),M(e,s)},p(o,c){c&2&&n!==(n=o[1])&&h(r,"srcset",n),c&1&&!W(s.src,l=o[0])&&h(s,"src",l)},d(o){o&&m(e)}}}function Yn(t){let e;function r(s,l){return s[0]!==null?Gn:Fn}let n=r(t),i=n(t);return{c(){i.c(),e=ee()},m(s,l){i.m(s,l),A(s,e,l)},p(s,[l]){n===(n=r(s))&&i?i.p(s,l):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},i:y,o:y,d(s){s&&m(e),i.d(s)}}}function Hn(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=s=>{"src"in s&&r(0,n=s.src),"srcWebp"in s&&r(1,i=s.srcWebp)},[n,i]}class tt extends C{constructor(e){super(),R(this,e,Hn,Yn,N,{src:0,srcWebp:1},Ln)}}const Qe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Kn(t){S(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 jn(t){let e,r;return e=new tt({}),{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 Jn(t){let e,r,n=t[0].seller_company_name+"",i,s,l=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&nt(t);return{c(){l&&l.c(),e=P(),r=$("span"),i=L(n),h(r,"class","app-title svelte-1tdgim9")},m(o,c){l&&l.m(o,c),A(o,e,c),A(o,r,c),M(r,i),s=!0},p(o,c){o[0].app_icon_webp!==null&&o[0].app_icon!==null?l?(l.p(o,c),c&1&&a(l,1)):(l=nt(o),l.c(),a(l,1),l.m(e.parentNode,e)):l&&(F(),f(l,1,1,()=>{l=null}),G()),(!s||c&1)&&n!==(n=o[0].seller_company_name+"")&&ie(i,n)},i(o){s||(a(l),s=!0)},o(o){f(l),s=!1},d(o){o&&(m(e),m(r)),l&&l.d(o)}}}function nt(t){let e,r;return e=new tt({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 s={};i&1&&(s.src=Qe(n[0].app_icon)),i&1&&(s.srcWebp=Qe(n[0].app_icon_webp)),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function xn(t){let e,r,n,i;const s=[Jn,jn],l=[];function o(c,u){return c[0]!==null?0:1}return r=o(t),n=l[r]=s[r](t),{c(){e=$("div"),n.c(),h(e,"class","rcb-header-layout__business-info svelte-1tdgim9")},m(c,u){A(c,e,u),l[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?l[r].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),n=l[r],n?n.p(c,u):(n=l[r]=s[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),l[r].d()}}}function Vn(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class rt extends C{constructor(e){super(),R(this,e,Vn,xn,N,{brandingInfo:0},Kn)}}function qn(t){S(t,"svelte-j03lz1",".rcb-post-purchase-header-layout.svelte-j03lz1{display:flex;justify-content:space-between;align-items:center;width:100%}")}function Wn(t){let e,r,n,i,s;return r=new rt({props:{brandingInfo:t[0]}}),i=new On({}),i.$on("click",function(){re(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(l,o){A(l,e,o),E(r,e,null),M(e,n),E(i,e,null),s=!0},p(l,o){t=l;const c={};o&1&&(c.brandingInfo=t[0]),r.$set(c)},i(l){s||(a(r.$$.fragment,l),a(i.$$.fragment,l),s=!0)},o(l){f(r.$$.fragment,l),f(i.$$.fragment,l),s=!1},d(l){l&&m(e),I(r),I(i)}}}function zn(t){let e,r;return e=new X({props:{as:"header",$$slots:{default:[Wn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&7&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Xn(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=s=>{"brandingInfo"in s&&r(0,n=s.brandingInfo),"onClose"in s&&r(1,i=s.onClose)},[n,i]}class it extends C{constructor(e){super(),R(this,e,Xn,zn,N,{brandingInfo:0,onClose:1},qn)}}function Zn(t){S(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 st(t){let e,r,n,i,s;return{c(){e=L("If this error persists, please contact "),r=$("a"),n=L(t[1]),s=L("."),h(r,"href",i="mailto:"+t[1])},m(l,o){A(l,e,o),A(l,r,o),M(r,n),A(l,s,o)},p(l,o){o&2&&ie(n,l[1]),o&2&&i!==(i="mailto:"+l[1])&&h(r,"href",i)},d(l){l&&(m(e),m(r),m(s))}}}function er(t){let e,r,n,i=t[3]()+"",s,l,o=t[1]&&st(t);return{c(){e=$("span"),e.textContent="Something went wrong.",r=P(),n=$("span"),s=L(i),l=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),M(n,s),M(n,l),o&&o.m(n,null)},p(c,u){c[1]?o?o.p(c,u):(o=st(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 tr(t){let e,r,n,i;return e=new Mn({}),n=new ne({props:{gutter:"1rem",$$slots:{default:[er]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&34&&(o.$$scope={dirty:l,ctx:s}),n.$set(o)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function nr(t){let e,r,n;return r=new ne({props:{gutter:"1rem",$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-error svelte-ahi052")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,s){const l={};s&34&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},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 rr(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function ir(t){let e,r;return e=new _e({props:{$$slots:{default:[rr]},$$scope:{ctx:t}}}),e.$on("click",function(){re(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 s={};i&32&&(s.$$scope={dirty:i,ctx:t}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function sr(t){let e,r,n,i,s,l;return e=new it({props:{brandingInfo:t[0],onClose:t[2]}}),n=new X({props:{$$slots:{default:[nr]},$$scope:{ctx:t}}}),s=new ve({props:{$$slots:{default:[ir]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment),i=P(),b(s.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(s,o,c),l=!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}),s.$set(g)},i(o){l||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(s.$$.fragment,o),l=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(s.$$.fragment,o),l=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(s,o)}}}function lr(t){let e,r;return e=new ne({props:{gutter:"2rem",$$slots:{default:[sr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&39&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function or(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:s=null}=e,{onContinue:l}=e;$e(()=>{console.debug(`Displayed error: ${O[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function o(){switch(i.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 i.message;case O.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,s=c.supportEmail),"onContinue"in c&&r(2,l=c.onContinue)},[n,s,l,o,i]}class cr extends C{constructor(e){super(),R(this,e,or,lr,N,{brandingInfo:0,lastError:4,supportEmail:1,onContinue:2},Zn)}}const ar="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 ur(t){S(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function fr(t){let e,r;return{c(){e=$("img"),W(e.src,r=ar)||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 dr extends C{constructor(e){super(),R(this,e,null,fr,N,{},ur)}}function mr(t){S(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 gr(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,s){A(i,e,s),A(i,r,s),A(i,n,s)},p:y,d(i){i&&(m(e),m(r),m(n))}}}function Ar(t){let e,r,n,i;return e=new dr({}),n=new ne({props:{gutter:"1rem",$$slots:{default:[gr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&4&&(o.$$scope={dirty:l,ctx:s}),n.$set(o)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function _r(t){let e,r,n;return r=new ne({props:{gutter:"1rem",$$slots:{default:[Ar]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-success svelte-1lcsna9")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,s){const l={};s&4&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},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 pr(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function hr(t){let e,r;return e=new _e({props:{$$slots:{default:[pr]},$$scope:{ctx:t}}}),e.$on("click",function(){re(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 s={};i&4&&(s.$$scope={dirty:i,ctx:t}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Er(t){let e,r,n,i,s,l;return e=new it({props:{brandingInfo:t[0],onClose:t[1]}}),n=new X({props:{$$slots:{default:[_r]},$$scope:{ctx:t}}}),s=new ve({props:{$$slots:{default:[hr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment),i=P(),b(s.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(s,o,c),l=!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}),s.$set(g)},i(o){l||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(s.$$.fragment,o),l=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(s.$$.fragment,o),l=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(s,o)}}}function Ir(t){let e,r;return e=new ne({props:{gutter:"2rem",$$slots:{default:[Er]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&7&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function wr(t,e,r){let{brandingInfo:n=null}=e,{onContinue:i}=e;return t.$$set=s=>{"brandingInfo"in s&&r(0,n=s.brandingInfo),"onContinue"in s&&r(1,i=s.onContinue)},[n,i]}class br extends C{constructor(e){super(),R(this,e,wr,Ir,N,{brandingInfo:0,onContinue:1},mr)}}function $r(t,e,r,n,i={}){const s=r.create(e,i);return s.mount(t),s.on("change",l=>n("change",l)),s.on("ready",l=>n("ready",l)),s.on("focus",l=>n("focus",l)),s.on("blur",l=>n("blur",l)),s.on("escape",l=>n("escape",l)),s.on("click",l=>n("click",l)),s.on("loaderror",l=>n("loaderror",l)),s.on("loaderstart",l=>n("loaderstart",l)),s.on("networkschange",l=>n("networkschange",l)),s}const Br=typeof window>"u";function kr(t){if(!Br)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function yr(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 Dr(t,e,r){let n,i;const s=Jt(),{elements:l}=Vt("stripe");let{options:o=void 0}=e;$e(()=>(n=$r(i,"payment",l,s,o),()=>n.destroy()));function c(){n.blur()}function u(){n.clear()}function _(){n.destroy()}function g(){n.focus()}function B(k){Be[k?"unshift":"push"](()=>{i=k,r(0,i)})}return t.$$set=k=>{"options"in k&&r(1,o=k.options)},[i,o,c,u,_,g,B]}class vr extends C{constructor(e){super(),R(this,e,Dr,yr,N,{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 lt(t){let e;const r=t[15].default,n=J(r,t,t[14],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16384)&&V(n,r,i,i[14],e?x(r,i[14],s,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 Qr(t){let e,r,n=t[1]&&t[0]&&lt(t);return{c(){n&&n.c(),e=ee()},m(i,s){n&&n.m(i,s),A(i,e,s),r=!0},p(i,[s]){i[1]&&i[0]?n?(n.p(i,s),s&3&&a(n,1)):(n=lt(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 Mr(t,e,r){let n,{$$slots:i={},$$scope:s}=e,{stripe:l}=e,{mode:o=void 0}=e,{theme:c="stripe"}=e,{variables:u={}}=e,{rules:_={}}=e,{labels:g="above"}=e,{loader:B="auto"}=e,{fonts:k=[]}=e,{locale:w="auto"}=e,{currency:D=void 0}=e,{amount:T=void 0}=e,{clientSecret:U=void 0}=e,{elements:d=null}=e;return t.$$set=p=>{"stripe"in p&&r(1,l=p.stripe),"mode"in p&&r(2,o=p.mode),"theme"in p&&r(3,c=p.theme),"variables"in p&&r(4,u=p.variables),"rules"in p&&r(5,_=p.rules),"labels"in p&&r(6,g=p.labels),"loader"in p&&r(7,B=p.loader),"fonts"in p&&r(8,k=p.fonts),"locale"in p&&r(9,w=p.locale),"currency"in p&&r(10,D=p.currency),"amount"in p&&r(11,T=p.amount),"clientSecret"in p&&r(12,U=p.clientSecret),"elements"in p&&r(0,d=p.elements),"$$scope"in p&&r(14,s=p.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:u,rules:_,labels:g}),t.$$.dirty&16263&&l&&!d&&(r(0,d=l.elements({mode:o,currency:D,amount:T,appearance:n,clientSecret:U,fonts:k,loader:B,locale:w})),kr(l),xt("stripe",{stripe:l,elements:d})),t.$$.dirty&8705&&d&&d.update({appearance:n,locale:w})},[d,l,o,c,u,_,g,B,k,w,D,T,U,n,s,i]}class Tr extends C{constructor(e){super(),R(this,e,Mr,Qr,N,{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 ot="https://js.stripe.com/v3",Pr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,ct="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Ur=function(){for(var e=document.querySelectorAll('script[src^="'.concat(ot,'"]')),r=0;r<e.length;r++){var n=e[r];if(Pr.test(n.src))return n}return null},at=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(ot).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},Nr=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.3.0",startTime:r})},pe=null,Me=null,Te=null,Rr=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Cr=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},Sr=function(e){return pe!==null?pe:(pe=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(ct),window.Stripe){r(window.Stripe);return}try{var i=Ur();if(i&&e)console.warn(ct);else if(!i)i=at(e);else if(i&&Te!==null&&Me!==null){var s;i.removeEventListener("load",Te),i.removeEventListener("error",Me),(s=i.parentNode)===null||s===void 0||s.removeChild(i),i=at(e)}Te=Cr(r,n),Me=Rr(n),i.addEventListener("load",Te),i.addEventListener("error",Me)}catch(l){n(l);return}}),pe.catch(function(r){return pe=null,Promise.reject(r)}))},Or=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return Nr(i,n),i},he,ut=!1,ft=function(){return he||(he=Sr(null).catch(function(e){return he=null,Promise.reject(e)}),he)};Promise.resolve().then(function(){return ft()}).catch(function(t){ut||console.warn(t)});var Lr=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];ut=!0;var i=Date.now();return ft().then(function(s){return Or(s,r,i)})};function Fr(t){S(t,"svelte-1fwwzeb",".rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}")}function Gr(t){let e,r;return e=new ye({}),{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 Yr(t){let e,r,n,i,s,l;function o(u){t[9](u)}let c={stripe:t[2],clientSecret:t[4],loader:"always",$$slots:{default:[Wr]},$$scope:{ctx:t}};return t[1]!==void 0&&(c.elements=t[1]),r=new Tr({props:c}),Be.push(()=>en(r,"elements",o)),{c(){e=$("form"),b(r.$$.fragment)},m(u,_){A(u,e,_),E(r,e,null),i=!0,s||(l=de(e,"submit",Ve(t[5])),s=!0)},p(u,_){const g={};_&4&&(g.stripe=u[2]),_&2057&&(g.$$scope={dirty:_,ctx:u}),!n&&_&2&&(n=!0,g.elements=u[1],zt(()=>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),s=!1,l()}}}function Hr(t){let e,r,n;return r=new vr({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-stripe-elements-container svelte-1fwwzeb")},m(i,s){A(i,e,s),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 Kr(t){let e;return{c(){e=L("Pay")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function jr(t){let e;return{c(){e=L("Processing...")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Jr(t){let e;function r(s,l){return s[3]?jr:Kr}let n=r(t),i=n(t);return{c(){i.c(),e=ee()},m(s,l){i.m(s,l),A(s,e,l)},p(s,l){n!==(n=r(s))&&(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){s&&m(e),i.d(s)}}}function xr(t){let e;return{c(){e=L("Close")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Vr(t){let e,r,n,i;return e=new _e({props:{disabled:t[3],$$slots:{default:[Jr]},$$scope:{ctx:t}}}),n=new _e({props:{disabled:t[3],intent:"secondary",$$slots:{default:[xr]},$$scope:{ctx:t}}}),n.$on("click",function(){re(t[0])&&t[0].apply(this,arguments)}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){t=s;const o={};l&8&&(o.disabled=t[3]),l&2056&&(o.$$scope={dirty:l,ctx:t}),e.$set(o);const c={};l&8&&(c.disabled=t[3]),l&2048&&(c.$$scope={dirty:l,ctx:t}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function qr(t){let e,r;return e=new ne({props:{$$slots:{default:[Vr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&2057&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Wr(t){let e,r,n,i;return e=new X({props:{$$slots:{default:[Hr]},$$scope:{ctx:t}}}),n=new ve({props:{$$slots:{default:[qr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&2048&&(o.$$scope={dirty:l,ctx:s}),e.$set(o);const c={};l&2057&&(c.$$scope={dirty:l,ctx:s}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function zr(t){let e,r,n,i;const s=[Yr,Gr],l=[];function o(c,u){return c[2]&&c[4]?0:1}return r=o(t),n=l[r]=s[r](t),{c(){e=$("div"),n.c()},m(c,u){A(c,e,u),l[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?l[r].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),n=l[r],n?n.p(c,u):(n=l[r]=s[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),l[r].d()}}}function Xr(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:s}=e,{paymentInfoCollectionMetadata:l}=e;const o=l.data.client_secret;let c=null,u,_=!1,g;$e(async()=>{const w=l.data.publishable_api_key,D=l.data.stripe_account_id;if(!w||!D)throw new Error("Stripe publishable key or account ID not found");r(2,c=await Lr(w,{stripeAccount:D}))});const B=async()=>{if(_||!c||!g)return;r(3,_=!0);const w=await c.confirmSetup({elements:g,redirect:"if_required"});w.error?(r(3,_=!1),s(new H(O.StripeError,w.error.message))):i()};function k(w){u=w,r(1,u)}return t.$$set=w=>{"onClose"in w&&r(0,n=w.onClose),"onContinue"in w&&r(6,i=w.onContinue),"onError"in w&&r(7,s=w.onError),"paymentInfoCollectionMetadata"in w&&r(8,l=w.paymentInfoCollectionMetadata)},t.$$.update=()=>{t.$$.dirty&2&&u&&u._elements.length>0&&(g=u)},[n,u,c,_,o,B,i,s,l,k]}class Zr extends C{constructor(e){super(),R(this,e,Xr,zr,N,{onClose:0,onContinue:6,onError:7,paymentInfoCollectionMetadata:8},Fr)}}function ei(t){S(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 ti(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 ni(t){let e,r,n,i,s,l,o;return{c(){e=$("div"),r=$("div"),r.innerHTML='<label for="email">E-mail</label>',n=P(),i=$("div"),s=$("input"),h(r,"class","form-label svelte-1xardyz"),h(s,"name","email"),h(s,"placeholder","john@appleseed.com"),h(s,"class","svelte-1xardyz"),h(i,"class","form-input svelte-1xardyz"),h(e,"class","form-container svelte-1xardyz")},m(c,u){A(c,e,u),M(e,r),M(e,n),M(e,i),M(i,s),qe(s,t[0]),l||(o=de(s,"input",t[3]),l=!0)},p(c,u){u&1&&s.value!==c[0]&&qe(s,c[0])},d(c){c&&m(e),l=!1,o()}}}function ri(t){let e;return{c(){e=L("Continue")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function ii(t){let e,r;return e=new _e({props:{$$slots:{default:[ri]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&16&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function si(t){let e,r,n,i,s,l,o,c,u,_;return n=new X({props:{$$slots:{default:[ti]},$$scope:{ctx:t}}}),s=new X({props:{$$slots:{default:[ni]},$$scope:{ctx:t}}}),o=new ve({props:{$$slots:{default:[ii]},$$scope:{ctx:t}}}),{c(){e=$("div"),r=$("form"),b(n.$$.fragment),i=P(),b(s.$$.fragment),l=P(),b(o.$$.fragment)},m(g,B){A(g,e,B),M(e,r),E(n,r,null),M(r,i),E(s,r,null),M(r,l),E(o,r,null),c=!0,u||(_=de(r,"submit",Ve(t[1])),u=!0)},p(g,[B]){const k={};B&16&&(k.$$scope={dirty:B,ctx:g}),n.$set(k);const w={};B&17&&(w.$$scope={dirty:B,ctx:g}),s.$set(w);const D={};B&16&&(D.$$scope={dirty:B,ctx:g}),o.$set(D)},i(g){c||(a(n.$$.fragment,g),a(s.$$.fragment,g),a(o.$$.fragment,g),c=!0)},o(g){f(n.$$.fragment,g),f(s.$$.fragment,g),f(o.$$.fragment,g),c=!1},d(g){g&&m(e),I(n),I(s),I(o),u=!1,_()}}}function li(t,e,r){let n,{onContinue:i}=e;const s=async()=>{i({email:n})};function l(){n=this.value,r(0,n)}return t.$$set=o=>{"onContinue"in o&&r(2,i=o.onContinue)},r(0,n=""),[n,s,i,l]}class oi extends C{constructor(e){super(),R(this,e,li,si,N,{onContinue:2},ei)}}const ci="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 ai(t){let e,r;return{c(){e=$("img"),W(e.src,r=ci)||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 ui extends C{constructor(e){super(),R(this,e,null,ai,N,{})}}function fi(t){S(t,"svelte-1ggdgso",".rcb-header-layout.svelte-1ggdgso{display:flex;justify-content:space-between;align-items:center;width:100%}")}function di(t){let e,r,n,i,s;return r=new rt({props:{brandingInfo:t[0]}}),i=new ui({}),{c(){e=$("div"),b(r.$$.fragment),n=P(),b(i.$$.fragment),h(e,"class","rcb-header-layout svelte-1ggdgso")},m(l,o){A(l,e,o),E(r,e,null),M(e,n),E(i,e,null),s=!0},p(l,o){const c={};o&1&&(c.brandingInfo=l[0]),r.$set(c)},i(l){s||(a(r.$$.fragment,l),a(i.$$.fragment,l),s=!0)},o(l){f(r.$$.fragment,l),f(i.$$.fragment,l),s=!1},d(l){l&&m(e),I(r),I(i)}}}function mi(t){let e,r;return e=new X({props:{as:"header",$$slots:{default:[di]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&3&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function gi(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class Ai extends C{constructor(e){super(),R(this,e,gi,mi,N,{brandingInfo:0},fi)}}function _i(t){S(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 pi(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(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,[l]){i&&i.p&&(!r||l&1)&&V(i,n,s,s[0],r?x(n,s[0],l,null):q(s[0]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function hi(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}class Ei extends C{constructor(e){super(),R(this,e,hi,pi,N,{},_i)}}function Ii(t){S(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 wi(t){let e,r,n;const i=t[2].default,s=J(i,t,t[1],null);return{c(){e=$("main"),s&&s.c(),h(e,"class",r=fe(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx")},m(l,o){A(l,e,o),s&&s.m(e,null),n=!0},p(l,[o]){s&&s.p&&(!n||o&2)&&V(s,i,l,l[1],n?x(i,l[1],o,null):q(l[1]),null),(!n||o&1&&r!==(r=fe(`rcb-modal-main ${l[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx"))&&h(e,"class",r)},i(l){n||(a(s,l),n=!0)},o(l){f(s,l),n=!1},d(l){l&&m(e),s&&s.d(l)}}}function bi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:s=!1}=e;return t.$$set=l=>{"dark"in l&&r(0,s=l.dark),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class $i extends C{constructor(e){super(),R(this,e,bi,wi,N,{dark:0},Ii)}}function Bi(t){let e;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&4)&&V(n,r,i,i[2],e?x(r,i[2],s,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 ki(t){let e,r;return e=new Ei({props:{$$slots:{default:[yi]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},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;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&4)&&V(n,r,i,i[2],e?x(r,i[2],s,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 Di(t){let e,r,n,i;const s=[ki,Bi],l=[];function o(c,u){return c[0]?0:1}return e=o(t),r=l[e]=s[e](t),{c(){r.c(),n=ee()},m(c,u){l[e].m(c,u),A(c,n,u),i=!0},p(c,[u]){let _=e;e=o(c),e===_?l[e].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),r=l[e],r?r.p(c,u):(r=l[e]=s[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),l[e].d(c)}}}function vi(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:s=!1}=e;return t.$$set=l=>{"condition"in l&&r(0,s=l.condition),"$$scope"in l&&r(2,i=l.$$scope)},[s,n,i]}class Qi extends C{constructor(e){super(),R(this,e,vi,Di,N,{condition:0})}}function dt(t){let e,r;return e=new Ai({props:{brandingInfo:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.brandingInfo=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Mi(t){let e,r,n=t[1]&&dt(t);const i=t[3].default,s=J(i,t,t[4],null);return{c(){n&&n.c(),e=P(),s&&s.c()},m(l,o){n&&n.m(l,o),A(l,e,o),s&&s.m(l,o),r=!0},p(l,o){l[1]?n?(n.p(l,o),o&2&&a(n,1)):(n=dt(l),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G()),s&&s.p&&(!r||o&16)&&V(s,i,l,l[4],r?x(i,l[4],o,null):q(l[4]),null)},i(l){r||(a(n),a(s,l),r=!0)},o(l){f(n),f(s,l),r=!1},d(l){l&&m(e),n&&n.d(l),s&&s.d(l)}}}function Ti(t){let e,r;return e=new $i({props:{dark:t[0],$$slots:{default:[Mi]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&1&&(s.dark=n[0]),i&22&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Pi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:s=!1}=e,{showHeader:l=!1}=e,{brandingInfo:o=null}=e;return t.$$set=c=>{"dark"in c&&r(0,s=c.dark),"showHeader"in c&&r(1,l=c.showHeader),"brandingInfo"in c&&r(2,o=c.brandingInfo),"$$scope"in c&&r(4,i=c.$$scope)},[s,l,o,n,i]}class mt extends C{constructor(e){super(),R(this,e,Pi,Ti,N,{dark:0,showHeader:1,brandingInfo:2})}}var Ee=(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))(Ee||{});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 gt?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 gt=(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))(gt||{});class Z extends Error{constructor(r,n,i){super(n);Q(this,"toString",()=>`PurchasesError(code: ${Ee[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=Pe.getErrorCodeForBackendErrorCode(r);return new Z(i,Pe.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new Z(Pe.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class At extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}const Ui="0.0.10",ce="https://api.revenuecat.com";var Ue;(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"})(Ue||(Ue={}));function _t(t){return t?t.startsWith("rcb_sb_"):!1}async function ae(t,e,r,n){const i=await fetch(t.url(),{method:t.method,headers:Ci(e,n),body:Ri(r)});return await Ni(i,t),await i.json()}async function Ni(t,e){const r=t.status;if(r>=Ue.INTERNAL_SERVER_ERROR)Ge(e,r,await t.text());else if(r>=Ue.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,s=n==null?void 0:n.code,l=n==null?void 0:n.message;if(s!=null){const o=Pe.convertCodeToBackendErrorCode(s);if(o==null)Ge(e,r,i);else throw Z.getForBackendError(o,l)}else Ge(e,r,i)}}function Ge(t,e,r){throw new Z(Ee.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function Ri(t){return t==null?null:JSON.stringify(t)}function Ci(t,e){let r={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":Ui,"X-Is-Sandbox":`${_t(t)}`};return e!=null&&(r={...r,...e}),r}const pt="/v1/subscribers",Ne="/rcbilling/v1";class Si{constructor(e){Q(this,"appUserId");Q(this,"method","GET");Q(this,"name","getOfferings");this.appUserId=e}url(){return`${ce}${pt}/${this.appUserId}/offerings`}}class Oi{constructor(){Q(this,"method","POST");Q(this,"name","subscribe")}url(){return`${ce}${Ne}/subscribe`}}class Li{constructor(e,r){Q(this,"method","GET");Q(this,"name","getProducts");Q(this,"appUserId");Q(this,"productIds");this.appUserId=e,this.productIds=r}url(){return`${ce}${Ne}/subscribers/${this.appUserId}/products?id=${this.productIds.join("&id=")}`}}class Fi{constructor(e){Q(this,"method","GET");Q(this,"name","getCustomerInfo");Q(this,"appUserId");this.appUserId=e}url(){return`${ce}${pt}/${this.appUserId}`}}class Gi{constructor(){Q(this,"method","GET");Q(this,"name","getBrandingInfo")}url(){return`${ce}${Ne}/branding`}}class Yi{constructor(e){Q(this,"method","GET");Q(this,"name","getCheckoutStatus");Q(this,"operationSessionId");this.operationSessionId=e}url(){return`${ce}${Ne}/checkout/${this.operationSessionId}`}}class Hi{constructor(e){Q(this,"API_KEY");this.API_KEY=e}async getOfferings(e){return await ae(new Si(e),this.API_KEY)}async getCustomerInfo(e){return await ae(new Fi(e),this.API_KEY)}async getProducts(e,r){return await ae(new Li(e,r),this.API_KEY)}async getBrandingInfo(){return await ae(new Gi,this.API_KEY)}async postSubscribe(e,r,n){return await ae(new Oi,this.API_KEY,{app_user_id:e,product_id:r,email:n})}async getCheckoutStatus(e){return await ae(new Yi(e),this.API_KEY)}}function Ki(t){S(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 ht(t){let e,r,n,i=t[1].isSandbox(),s;r=new mt({props:{dark:!0,showHeader:!0,brandingInfo:t[3],$$slots:{default:[ji]},$$scope:{ctx:t}}});let l=i&&It();return{c(){e=$("div"),b(r.$$.fragment),n=P(),l&&l.c(),h(e,"class","rcb-ui-aside svelte-ofxzf4")},m(o,c){A(o,e,c),E(r,e,null),M(e,n),l&&l.m(e,null),s=!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?l?c&2&&a(l,1):(l=It(),l.c(),a(l,1),l.m(e,null)):l&&(F(),f(l,1,1,()=>{l=null}),G())},i(o){s||(a(r.$$.fragment,o),a(l),s=!0)},o(o){f(r.$$.fragment,o),f(l),s=!1},d(o){o&&m(e),I(r),l&&l.d()}}}function Et(t){let e,r;return e=new et({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.productDetails=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ji(t){let e,r,n=t[2]&&Et(t);return{c(){n&&n.c(),e=ee()},m(i,s){n&&n.m(i,s),A(i,e,s),r=!0},p(i,s){i[2]?n?(n.p(i,s),s&4&&a(n,1)):(n=Et(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 It(t){let e,r;return e=new ln({}),{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 et({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.productDetails=n[2]),e.$set(s)},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 ye({}),{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 $t(t){let e,r;return e=new ye({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Bt(t){let e,r;return e=new oi({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 kt(t){let e,r;return e=new Zr({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 s={};i&16&&(s.paymentInfoCollectionMetadata=n[4]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function yt(t){let e,r;return e=new ye({}),{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 Dt(t){var n;let e,r;return e=new cr({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,s){E(e,i,s),r=!0},p(i,s){var o;const l={};s&8&&(l.brandingInfo=i[3]),s&32&&(l.lastError=i[5]??new H(S.UnknownError,"Unknown error without state set.")),s&8&&(l.supportEmail=(o=i[3])==null?void 0:o.seller_company_support_email),e.$set(l)},i(i){r||(a(e.$$.fragment,i),r=!0)},o(i){f(e.$$.fragment,i),r=!1},d(i){I(e,i)}}}function vt(t){let e,r;return e=new br({props:{brandingInfo:t[3],onContinue:t[9]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&8&&(s.brandingInfo=n[3]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ji(t){let e,r,n,i,s,l,o,c,u,_=t[6]==="present-offer"&&t[2]&&wt(t),g=t[6]==="present-offer"&&!t[2]&&bt(),B=t[6]==="polling-purchase-status"&&$t(),k=t[6]==="needs-auth-info"&&Bt(t),w=t[6]==="needs-payment-info"&&t[4]&&kt(t),D=t[6]==="loading"&&yt(),T=t[6]==="error"&&Dt(t),U=t[6]==="success"&&vt(t);return{c(){_&&_.c(),e=P(),g&&g.c(),r=P(),B&&B.c(),n=P(),k&&k.c(),i=P(),w&&w.c(),s=P(),D&&D.c(),l=P(),T&&T.c(),o=P(),U&&U.c(),c=ee()},m(d,p){_&&_.m(d,p),A(d,e,p),g&&g.m(d,p),A(d,r,p),B&&B.m(d,p),A(d,n,p),k&&k.m(d,p),A(d,i,p),w&&w.m(d,p),A(d,s,p),D&&D.m(d,p),A(d,l,p),T&&T.m(d,p),A(d,o,p),U&&U.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)):(_=wt(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=bt(),g.c(),a(g,1),g.m(r.parentNode,r)):g&&(F(),f(g,1,1,()=>{g=null}),G()),d[6]==="polling-purchase-status"?B?p&64&&a(B,1):(B=$t(),B.c(),a(B,1),B.m(n.parentNode,n)):B&&(F(),f(B,1,1,()=>{B=null}),G()),d[6]==="needs-auth-info"?k?(k.p(d,p),p&64&&a(k,1)):(k=Bt(d),k.c(),a(k,1),k.m(i.parentNode,i)):k&&(F(),f(k,1,1,()=>{k=null}),G()),d[6]==="needs-payment-info"&&d[4]?w?(w.p(d,p),p&80&&a(w,1)):(w=kt(d),w.c(),a(w,1),w.m(s.parentNode,s)):w&&(F(),f(w,1,1,()=>{w=null}),G()),d[6]==="loading"?D?p&64&&a(D,1):(D=yt(),D.c(),a(D,1),D.m(l.parentNode,l)):D&&(F(),f(D,1,1,()=>{D=null}),G()),d[6]==="error"?T?(T.p(d,p),p&64&&a(T,1)):(T=Dt(d),T.c(),a(T,1),T.m(o.parentNode,o)):T&&(F(),f(T,1,1,()=>{T=null}),G()),d[6]==="success"?U?(U.p(d,p),p&64&&a(U,1)):(U=vt(d),U.c(),a(U,1),U.m(c.parentNode,c)):U&&(F(),f(U,1,1,()=>{U=null}),G())},i(d){u||(a(_),a(g),a(B),a(k),a(w),a(D),a(T),a(U),u=!0)},o(d){f(_),f(g),f(B),f(k),f(w),f(D),f(T),f(U),u=!1},d(d){d&&(m(e),m(r),m(n),m(i),m(s),m(l),m(o),m(c)),_&&_.d(d),g&&g.d(d),B&&B.d(d),k&&k.d(d),w&&w.d(d),D&&D.d(d),T&&T.d(d),U&&U.d(d)}}}function xi(t){let e,r=t[7].includes(t[6]),n,i,s,l=r&&ht(t);return i=new mt({props:{$$slots:{default:[Ji]},$$scope:{ctx:t}}}),{c(){e=$("div"),l&&l.c(),n=P(),b(i.$$.fragment),h(e,"class","rcb-ui-layout svelte-ofxzf4")},m(o,c){A(o,e,c),l&&l.m(e,null),M(e,n),E(i,e,null),s=!0},p(o,c){c&64&&(r=o[7].includes(o[6])),r?l?(l.p(o,c),c&64&&a(l,1)):(l=ht(o),l.c(),a(l,1),l.m(e,n)):l&&(F(),f(l,1,1,()=>{l=null}),G());const u={};c&4194428&&(u.$$scope={dirty:c,ctx:o}),i.$set(u)},i(o){s||(a(l),a(i.$$.fragment,o),s=!0)},o(o){f(l),f(i.$$.fragment,o),s=!1},d(o){o&&m(e),l&&l.d(),I(i)}}}function Vi(t){let e,r,n;return r=new Qi({props:{condition:t[0],$$slots:{default:[xi]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-ui-container svelte-ofxzf4")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,[s]){const l={};s&1&&(l.condition=i[0]),s&4194430&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},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 qi(t,e,r){var Mt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:s}=e,{rcPackage:l}=e,{onFinished:o}=e,{onError:c}=e,{onClose:u}=e,{purchases:_}=e,{backend:g}=e,{purchaseOperationHelper:B}=e,k=null,w=null,D=null,T=null;const U=((Mt=l.rcBillingProduct)==null?void 0:Mt.identifier)??null;let d="present-offer";const p=["present-offer","needs-auth-info","needs-payment-info","loading"];$e(async()=>{if(r(2,k=l.rcBillingProduct),r(3,w=await g.getBrandingInfo()),d==="present-offer"){i?Qt():r(6,d="needs-auth-info");return}});const ss=()=>{u()},Qt=()=>{if(U===null){Ie(new H(S.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else r(6,d="loading");if(!i){Ie(new H(S.MissingEmailError));return}B.startPurchase(s,U,i).then(v=>{if(v.next_action==="collect_payment_info"){r(6,d="needs-payment-info"),r(4,D=v);return}if(v.next_action==="completed"){r(6,d="success");return}}).catch(v=>{Ie(new H(S.ErrorSettingUpPurchase,v.message,v.underlyingErrorMessage))})},ls=v=>{if(d==="needs-auth-info"){v&&r(12,i=v.email),Qt();return}if(d==="needs-payment-info"){r(6,d="polling-purchase-status"),B.pollCurrentPurchaseForCompletion().then(()=>{r(6,d="success")}).catch(cs=>{Ie(cs)});return}if(d==="success"||d==="error"){o();return}r(6,d="success")},Ie=v=>{r(5,T=v),r(6,d="error")},os=()=>{c(T??new H(S.UnknownError,"Unknown error without state set."))};return t.$$set=v=>{"asModal"in v&&r(0,n=v.asModal),"customerEmail"in v&&r(12,i=v.customerEmail),"appUserId"in v&&r(13,s=v.appUserId),"rcPackage"in v&&r(14,l=v.rcPackage),"onFinished"in v&&r(15,o=v.onFinished),"onError"in v&&r(16,c=v.onError),"onClose"in v&&r(17,u=v.onClose),"purchases"in v&&r(1,_=v.purchases),"backend"in v&&r(18,g=v.backend),"purchaseOperationHelper"in v&&r(19,B=v.purchaseOperationHelper)},[n,_,k,w,D,T,d,p,ss,ls,Ie,os,i,s,l,o,c,u,g,B]}class zi extends C{constructor(e){super(),R(this,e,qi,Vi,N,{asModal:0,customerEmail:12,appUserId:13,rcPackage:14,onFinished:15,onError:16,onClose:17,purchases:1,backend:18,purchaseOperationHelper:19},Ki)}}function Wi(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function Xi(t,e,r){return{identifier:t,isActive:Wi(e),willRenew:ts(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 Zi(t,e){const r={},n={};for(const i in t){const s=e[i]??null,l=Xi(i,t[i],s);r[i]=l,l.isActive&&(n[i]=l)}return{all:r,active:n}}function Re(t){return t==null?null:new Date(t)}function es(t){const e=rs(t),r=t.subscriber;return{entitlements:Zi(r.entitlements,r.subscriptions),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:ns(t),activeSubscriptions:is(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 ts(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,s=e.billing_issues_detected_at!=null;return!(r||n||i||s)}function ns(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 rs(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 is(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}const j=class j{constructor(e,r){Q(this,"_API_KEY");Q(this,"_appUserId");Q(this,"backend");Q(this,"purchaseOperationHelper");Q(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 s=n==null?null:He(n,i),l={};return e.offerings.forEach(o=>{const c=He(o,i);c!=null&&(l[o.identifier]=c)}),Object.keys(l).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:l,current:s}});this._API_KEY=e,this._appUserId=r,this.backend=new Hi(this._API_KEY),this.purchaseOperationHelper=new In(this.backend)}static getInstance(){if(j.isConfigured())return j.instance;throw new At}static isConfigured(){return j.instance!==void 0}static initializePurchases(e,r){return j.instance!==void 0?(console.warn("Purchases is already initialized. Ignoring and returning existing instance."),j.getInstance()):(j.instance=new j(e,r),j.getInstance())}async getOfferings(){const e=this._appUserId,r=await this.backend.getOfferings(e),n=r.offerings.flatMap(s=>s.packages).map(s=>s.platform_product_identifier),i=await this.backend.getProducts(e,n);return this.logMissingProductIds(n,i.product_details),this.toOfferings(r,i)}async isEntitledTo(e){const r=await this.getCustomerInfo();return e in r.entitlements.active}purchasePackage(e,r,n){let i=n??document.getElementById("rcb-ui-root");if(i===null){const c=document.createElement("div");c.className="rcb-ui-root",document.body.appendChild(c),i=c}if(i===null)throw new Error("Could not generate a mount point for the billing widget");const s=i,l=!n,o=this._appUserId;return new Promise((c,u)=>{new zi({target:s,props:{appUserId:o,rcPackage:e,customerEmail:r,onFinished:async()=>{s.innerHTML="",c({customerInfo:await this._getCustomerInfoForUserId(o)})},onClose:()=>{s.innerHTML="",u(new Z(Ee.UserCancelledError))},onError:_=>{s.innerHTML="",u(Z.getForPurchasesFlowError(_))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:l}})})}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async changeUser(e){return this._appUserId=e,await this.getCustomerInfo()}logMissingProductIds(e,r){const n={};r.forEach(s=>n[s.identifier]=s);const i=[];e.forEach(s=>{n[s]===void 0&&i.push(s)}),i.length>0&&console.debug("Could not find product data for product ids: ",i,". Please check that your product configuration is correct.")}isSandbox(){return _t(this._API_KEY)}close(){j.instance===this?j.instance=void 0:console.warn("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const r=await this.backend.getCustomerInfo(e);return es(r)}};Q(j,"instance");let Ye=j;Y.ErrorCode=Ee,Y.PackageType=W,Y.Purchases=Ye,Y.PurchasesError=Z,Y.UninitializedPurchasesError=At,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 ht(t){let e,r,n,i=t[1].isSandbox(),s;r=new mt({props:{dark:!0,showHeader:!0,brandingInfo:t[3],$$slots:{default:[ji]},$$scope:{ctx:t}}});let l=i&&It();return{c(){e=$("div"),b(r.$$.fragment),n=P(),l&&l.c(),h(e,"class","rcb-ui-aside svelte-ofxzf4")},m(o,c){A(o,e,c),E(r,e,null),M(e,n),l&&l.m(e,null),s=!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?l?c&2&&a(l,1):(l=It(),l.c(),a(l,1),l.m(e,null)):l&&(F(),f(l,1,1,()=>{l=null}),G())},i(o){s||(a(r.$$.fragment,o),a(l),s=!0)},o(o){f(r.$$.fragment,o),f(l),s=!1},d(o){o&&m(e),I(r),l&&l.d()}}}function Et(t){let e,r;return e=new et({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.productDetails=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ji(t){let e,r,n=t[2]&&Et(t);return{c(){n&&n.c(),e=ee()},m(i,s){n&&n.m(i,s),A(i,e,s),r=!0},p(i,s){i[2]?n?(n.p(i,s),s&4&&a(n,1)):(n=Et(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 It(t){let e,r;return e=new ln({}),{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 et({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.productDetails=n[2]),e.$set(s)},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 ye({}),{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 $t(t){let e,r;return e=new ye({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Bt(t){let e,r;return e=new oi({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 kt(t){let e,r;return e=new Zr({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 s={};i&16&&(s.paymentInfoCollectionMetadata=n[4]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function yt(t){let e,r;return e=new ye({}),{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 Dt(t){var n;let e,r;return e=new cr({props:{brandingInfo:t[3],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(){b(e.$$.fragment)},m(i,s){E(e,i,s),r=!0},p(i,s){var o;const l={};s&8&&(l.brandingInfo=i[3]),s&32&&(l.lastError=i[5]??new H(O.UnknownError,"Unknown error without state set.")),s&8&&(l.supportEmail=(o=i[3])==null?void 0:o.seller_company_support_email),e.$set(l)},i(i){r||(a(e.$$.fragment,i),r=!0)},o(i){f(e.$$.fragment,i),r=!1},d(i){I(e,i)}}}function vt(t){let e,r;return e=new br({props:{brandingInfo:t[3],onContinue:t[9]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&8&&(s.brandingInfo=n[3]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ji(t){let e,r,n,i,s,l,o,c,u,_=t[6]==="present-offer"&&t[2]&&wt(t),g=t[6]==="present-offer"&&!t[2]&&bt(),B=t[6]==="polling-purchase-status"&&$t(),k=t[6]==="needs-auth-info"&&Bt(t),w=t[6]==="needs-payment-info"&&t[4]&&kt(t),D=t[6]==="loading"&&yt(),T=t[6]==="error"&&Dt(t),U=t[6]==="success"&&vt(t);return{c(){_&&_.c(),e=P(),g&&g.c(),r=P(),B&&B.c(),n=P(),k&&k.c(),i=P(),w&&w.c(),s=P(),D&&D.c(),l=P(),T&&T.c(),o=P(),U&&U.c(),c=ee()},m(d,p){_&&_.m(d,p),A(d,e,p),g&&g.m(d,p),A(d,r,p),B&&B.m(d,p),A(d,n,p),k&&k.m(d,p),A(d,i,p),w&&w.m(d,p),A(d,s,p),D&&D.m(d,p),A(d,l,p),T&&T.m(d,p),A(d,o,p),U&&U.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)):(_=wt(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=bt(),g.c(),a(g,1),g.m(r.parentNode,r)):g&&(F(),f(g,1,1,()=>{g=null}),G()),d[6]==="polling-purchase-status"?B?p&64&&a(B,1):(B=$t(),B.c(),a(B,1),B.m(n.parentNode,n)):B&&(F(),f(B,1,1,()=>{B=null}),G()),d[6]==="needs-auth-info"?k?(k.p(d,p),p&64&&a(k,1)):(k=Bt(d),k.c(),a(k,1),k.m(i.parentNode,i)):k&&(F(),f(k,1,1,()=>{k=null}),G()),d[6]==="needs-payment-info"&&d[4]?w?(w.p(d,p),p&80&&a(w,1)):(w=kt(d),w.c(),a(w,1),w.m(s.parentNode,s)):w&&(F(),f(w,1,1,()=>{w=null}),G()),d[6]==="loading"?D?p&64&&a(D,1):(D=yt(),D.c(),a(D,1),D.m(l.parentNode,l)):D&&(F(),f(D,1,1,()=>{D=null}),G()),d[6]==="error"?T?(T.p(d,p),p&64&&a(T,1)):(T=Dt(d),T.c(),a(T,1),T.m(o.parentNode,o)):T&&(F(),f(T,1,1,()=>{T=null}),G()),d[6]==="success"?U?(U.p(d,p),p&64&&a(U,1)):(U=vt(d),U.c(),a(U,1),U.m(c.parentNode,c)):U&&(F(),f(U,1,1,()=>{U=null}),G())},i(d){u||(a(_),a(g),a(B),a(k),a(w),a(D),a(T),a(U),u=!0)},o(d){f(_),f(g),f(B),f(k),f(w),f(D),f(T),f(U),u=!1},d(d){d&&(m(e),m(r),m(n),m(i),m(s),m(l),m(o),m(c)),_&&_.d(d),g&&g.d(d),B&&B.d(d),k&&k.d(d),w&&w.d(d),D&&D.d(d),T&&T.d(d),U&&U.d(d)}}}function xi(t){let e,r=t[7].includes(t[6]),n,i,s,l=r&&ht(t);return i=new mt({props:{$$slots:{default:[Ji]},$$scope:{ctx:t}}}),{c(){e=$("div"),l&&l.c(),n=P(),b(i.$$.fragment),h(e,"class","rcb-ui-layout svelte-ofxzf4")},m(o,c){A(o,e,c),l&&l.m(e,null),M(e,n),E(i,e,null),s=!0},p(o,c){c&64&&(r=o[7].includes(o[6])),r?l?(l.p(o,c),c&64&&a(l,1)):(l=ht(o),l.c(),a(l,1),l.m(e,n)):l&&(F(),f(l,1,1,()=>{l=null}),G());const u={};c&4194428&&(u.$$scope={dirty:c,ctx:o}),i.$set(u)},i(o){s||(a(l),a(i.$$.fragment,o),s=!0)},o(o){f(l),f(i.$$.fragment,o),s=!1},d(o){o&&m(e),l&&l.d(),I(i)}}}function Vi(t){let e,r,n;return r=new Qi({props:{condition:t[0],$$slots:{default:[xi]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-ui-container svelte-ofxzf4")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,[s]){const l={};s&1&&(l.condition=i[0]),s&4194430&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},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 qi(t,e,r){var Mt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:s}=e,{rcPackage:l}=e,{onFinished:o}=e,{onError:c}=e,{onClose:u}=e,{purchases:_}=e,{backend:g}=e,{purchaseOperationHelper:B}=e,k=null,w=null,D=null,T=null;const U=((Mt=l.rcBillingProduct)==null?void 0:Mt.identifier)??null;let d="present-offer";const p=["present-offer","needs-auth-info","needs-payment-info","loading"];$e(async()=>{if(r(2,k=l.rcBillingProduct),r(3,w=await g.getBrandingInfo()),d==="present-offer"){i?Qt():r(6,d="needs-auth-info");return}});const ss=()=>{u()},Qt=()=>{if(U===null){Ie(new H(O.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else r(6,d="loading");if(!i){Ie(new H(O.MissingEmailError));return}B.startPurchase(s,U,i).then(v=>{if(v.next_action==="collect_payment_info"){r(6,d="needs-payment-info"),r(4,D=v);return}if(v.next_action==="completed"){r(6,d="success");return}}).catch(v=>{Ie(new H(O.ErrorSettingUpPurchase,v.message,v.underlyingErrorMessage))})},ls=v=>{if(d==="needs-auth-info"){v&&r(12,i=v.email),Qt();return}if(d==="needs-payment-info"){r(6,d="polling-purchase-status"),B.pollCurrentPurchaseForCompletion().then(()=>{r(6,d="success")}).catch(cs=>{Ie(cs)});return}if(d==="success"||d==="error"){o();return}r(6,d="success")},Ie=v=>{r(5,T=v),r(6,d="error")},os=()=>{c(T??new H(O.UnknownError,"Unknown error without state set."))};return t.$$set=v=>{"asModal"in v&&r(0,n=v.asModal),"customerEmail"in v&&r(12,i=v.customerEmail),"appUserId"in v&&r(13,s=v.appUserId),"rcPackage"in v&&r(14,l=v.rcPackage),"onFinished"in v&&r(15,o=v.onFinished),"onError"in v&&r(16,c=v.onError),"onClose"in v&&r(17,u=v.onClose),"purchases"in v&&r(1,_=v.purchases),"backend"in v&&r(18,g=v.backend),"purchaseOperationHelper"in v&&r(19,B=v.purchaseOperationHelper)},[n,_,k,w,D,T,d,p,ss,ls,Ie,os,i,s,l,o,c,u,g,B]}class Wi extends C{constructor(e){super(),R(this,e,qi,Vi,N,{asModal:0,customerEmail:12,appUserId:13,rcPackage:14,onFinished:15,onError:16,onClose:17,purchases:1,backend:18,purchaseOperationHelper:19},Ki)}}function zi(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function Xi(t,e,r){return{identifier:t,isActive:zi(e),willRenew:ts(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 Zi(t,e){const r={},n={};for(const i in t){const s=e[i]??null,l=Xi(i,t[i],s);r[i]=l,l.isActive&&(n[i]=l)}return{all:r,active:n}}function Re(t){return t==null?null:new Date(t)}function es(t){const e=rs(t),r=t.subscriber;return{entitlements:Zi(r.entitlements,r.subscriptions),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:ns(t),activeSubscriptions:is(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 ts(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,s=e.billing_issues_detected_at!=null;return!(r||n||i||s)}function ns(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 rs(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 is(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}const j=class j{constructor(e,r){Q(this,"_API_KEY");Q(this,"_appUserId");Q(this,"backend");Q(this,"purchaseOperationHelper");Q(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 s=n==null?null:He(n,i),l={};return e.offerings.forEach(o=>{const c=He(o,i);c!=null&&(l[o.identifier]=c)}),Object.keys(l).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:l,current:s}});this._API_KEY=e,this._appUserId=r,this.backend=new Hi(this._API_KEY),this.purchaseOperationHelper=new In(this.backend)}static getSharedInstance(){if(j.isConfigured())return j.instance;throw new At}static isConfigured(){return j.instance!==void 0}static configure(e,r){return j.instance!==void 0?(console.warn("Purchases is already initialized. Ignoring and returning existing instance."),j.getSharedInstance()):(j.instance=new j(e,r),j.getSharedInstance())}async getOfferings(){const e=this._appUserId,r=await this.backend.getOfferings(e),n=r.offerings.flatMap(s=>s.packages).map(s=>s.platform_product_identifier),i=await this.backend.getProducts(e,n);return this.logMissingProductIds(n,i.product_details),this.toOfferings(r,i)}async isEntitledTo(e){const r=await this.getCustomerInfo();return e in r.entitlements.active}purchasePackage(e,r,n){let i=n??document.getElementById("rcb-ui-root");if(i===null){const c=document.createElement("div");c.className="rcb-ui-root",document.body.appendChild(c),i=c}if(i===null)throw new Error("Could not generate a mount point for the billing widget");const s=i,l=!n,o=this._appUserId;return new Promise((c,u)=>{new Wi({target:s,props:{appUserId:o,rcPackage:e,customerEmail:r,onFinished:async()=>{s.innerHTML="",c({customerInfo:await this._getCustomerInfoForUserId(o)})},onClose:()=>{s.innerHTML="",u(new Z(Ee.UserCancelledError))},onError:_=>{s.innerHTML="",u(Z.getForPurchasesFlowError(_))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:l}})})}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async changeUser(e){return this._appUserId=e,await this.getCustomerInfo()}logMissingProductIds(e,r){const n={};r.forEach(s=>n[s.identifier]=s);const i=[];e.forEach(s=>{n[s]===void 0&&i.push(s)}),i.length>0&&console.debug("Could not find product data for product ids: ",i,". Please check that your product configuration is correct.")}isSandbox(){return _t(this._API_KEY)}close(){j.instance===this?j.instance=void 0:console.warn("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const r=await this.backend.getCustomerInfo(e);return es(r)}};Q(j,"instance");let Ye=j;Y.ErrorCode=Ee,Y.PackageType=z,Y.Purchases=Ye,Y.PurchasesError=Z,Y.UninitializedPurchasesError=At,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-js",
3
3
  "private": false,
4
- "version": "0.0.15",
4
+ "version": "0.0.16",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"