@revenuecat/purchases-js 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,36 @@
1
- (function(E,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(E=typeof globalThis<"u"?globalThis:E||self,p(E.Purchases={}))})(this,function(E){"use strict";var Ns=Object.create;var at=Object.defineProperty;var Us=Object.getOwnPropertyDescriptor;var un=(E,p)=>(p=Symbol[E])?p:Symbol.for("Symbol."+E),Ne=E=>{throw TypeError(E)};var fn=(E,p,R)=>p in E?at(E,p,{enumerable:!0,configurable:!0,writable:!0,value:R}):E[p]=R;var ln=(E,p)=>at(E,"name",{value:p,configurable:!0});var dn=E=>[,,,Ns((E==null?void 0:E[un("metadata")])??null)],gn=["class","method","getter","setter","accessor","field","value","get","set"],Oe=E=>E!==void 0&&typeof E!="function"?Ne("Function expected"):E,Ss=(E,p,R,ie,Y)=>({kind:gn[E],name:p,metadata:ie,addInitializer:H=>R._?Ne("Already initialized"):Y.push(Oe(H||null))}),ut=(E,p)=>fn(p,un("metadata"),E[3]),mn=(E,p,R,ie)=>{for(var Y=0,H=E[p>>1],re=H&&H.length;Y<re;Y++)p&1?H[Y].call(R):ie=H[Y].call(R,ie);return ie},pn=(E,p,R,ie,Y,H)=>{var re,B,ue,Z,me,L=p&7,Ie=!!(p&8),F=!!(p&16),pe=L>3?E.length+1:L?Ie?1:2:0,j=gn[L+5],q=L>3&&(E[pe-1]=[]),ee=E[pe]||(E[pe]=[]),J=L&&(!F&&!Ie&&(Y=Y.prototype),L<5&&(L>3||!F)&&Us(L<4?Y:{get[R](){return cn(this,H)},set[R](T){return an(this,H,T)}},R));L?F&&L<4&&ln(H,(L>2?"set ":L>1?"get ":"")+R):ln(Y,R);for(var M=ie.length-1;M>=0;M--)Z=Ss(L,R,ue={},E[3],ee),L&&(Z.static=Ie,Z.private=F,me=Z.access={has:F?T=>Ls(Y,T):T=>R in T},L^3&&(me.get=F?T=>(L^1?cn:Fs)(T,Y,L^4?H:J.get):T=>T[R]),L>2&&(me.set=F?(T,we)=>an(T,Y,we,L^4?H:J.set):(T,we)=>T[R]=we)),B=(0,ie[M])(L?L<4?F?H:J[j]:L>4?void 0:{get:J.get,set:J.set}:Y,Z),ue._=1,L^4||B===void 0?Oe(B)&&(L>4?q.unshift(B):L?F?H=B:J[j]=B:Y=B):typeof B!="object"||B===null?Ne("Object expected"):(Oe(re=B.get)&&(J.get=re),Oe(re=B.set)&&(J.set=re),Oe(re=B.init)&&q.unshift(re));return L||ut(E,Y),J&&at(Y,R,J),F?L^4?H:J:Y},C=(E,p,R)=>fn(E,typeof p!="symbol"?p+"":p,R),ft=(E,p,R)=>p.has(E)||Ne("Cannot "+R),Ls=(E,p)=>Object(p)!==p?Ne('Cannot use the "in" operator on this value'):E.has(p),cn=(E,p,R)=>(ft(E,p,"read from private field"),R?R.call(E):p.get(E));var an=(E,p,R,ie)=>(ft(E,p,"write to private field"),ie?ie.call(E,R):p.set(E,R),R),Fs=(E,p,R)=>(ft(E,p,"access private method"),R);var rn,lt;function p(){}function R(t,e){for(const r in e)t[r]=e[r];return t}function ie(t){return t()}function Y(){return Object.create(null)}function H(t){t.forEach(ie)}function re(t){return typeof t=="function"}function B(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ue;function Z(t,e){return t===e?!0:(ue||(ue=document.createElement("a")),ue.href=e,t===ue.href)}function me(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function L(t,e){const r=me(t.srcset),n=me(e||"");return n.length===r.length&&n.every(([i,o],s)=>o===r[s][1]&&(Z(r[s][0],i)||Z(i,r[s][0])))}function Ie(t){return Object.keys(t).length===0}function F(t,e,r,n){if(t){const i=pe(t,e,r,n);return t[0](i)}}function pe(t,e,r,n){return t[1]&&n?R(r.ctx.slice(),t[1](n(e))):r.ctx}function j(t,e,r,n){if(t[2]&&n){const i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],s=Math.max(e.dirty.length,i.length);for(let l=0;l<s;l+=1)o[l]=e.dirty[l]|i[l];return o}return e.dirty|i}return e.dirty}function q(t,e,r,n,i,o){if(i){const s=pe(e,r,n,o);t.p(s,i)}}function ee(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 J(t){return t??""}function M(t,e){t.appendChild(e)}function T(t,e,r){const n=we(t);if(!n.getElementById(e)){const i=w("style");i.id=e,i.textContent=r,hn(n,i)}}function we(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function hn(t,e){return M(t.head||t,e),e.sheet}function _(t,e,r){t.insertBefore(e,r||null)}function h(t){t.parentNode&&t.parentNode.removeChild(t)}function w(t){return document.createElement(t)}function G(t){return document.createTextNode(t)}function Q(){return G(" ")}function ce(){return G("")}function ye(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function dt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function b(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}const _n=["width","height"];function An(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&&_n.indexOf(n)===-1?t[n]=e[n]:b(t,n,e[n])}function bn(t,e){Object.keys(e).forEach(r=>{En(t,r,e[r])})}function En(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:b(t,e,r)}function In(t){return/-/.test(t)?bn:An}function wn(t){return Array.from(t.childNodes)}function fe(t,e){e=""+e,t.data!==e&&(t.data=e)}function gt(t,e){t.value=e??""}function yn(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let ke;function ve(t){ke=t}function $e(){if(!ke)throw new Error("Function called outside component initialization");return ke}function kn(t){$e().$$.before_update.push(t)}function Ue(t){$e().$$.on_mount.push(t)}function vn(){const t=$e();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=yn(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function $n(t,e){return $e().$$.context.set(t,e),e}function Bn(t){return $e().$$.context.get(t)}function mt(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const he=[],Se=[];let _e=[];const Je=[],Pn=Promise.resolve();let Ve=!1;function Dn(){Ve||(Ve=!0,Pn.then(pt))}function We(t){_e.push(t)}function Cn(t){Je.push(t)}const ze=new Set;let Ae=0;function pt(){if(Ae!==0)return;const t=ke;do{try{for(;Ae<he.length;){const e=he[Ae];Ae++,ve(e),Mn(e.$$)}}catch(e){throw he.length=0,Ae=0,e}for(ve(null),he.length=0,Ae=0;Se.length;)Se.pop()();for(let e=0;e<_e.length;e+=1){const r=_e[e];ze.has(r)||(ze.add(r),r())}_e.length=0}while(he.length);for(;Je.length;)Je.pop()();Ve=!1,ze.clear(),ve(t)}function Mn(t){if(t.fragment!==null){t.update(),H(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(We)}}function Tn(t){const e=[],r=[];_e.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),_e=e}const Le=new Set;let de;function V(){de={r:0,c:[],p:de}}function W(){de.r||H(de.c),de=de.p}function f(t,e){t&&t.i&&(Le.delete(t),t.i(e))}function g(t,e,r,n){if(t&&t.o){if(Le.has(t))return;Le.add(t),de.c.push(()=>{Le.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function Rn(t,e,r){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function v(t){t&&t.c()}function y(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),We(()=>{const o=t.$$.on_mount.map(ie).filter(re);t.$$.on_destroy?t.$$.on_destroy.push(...o):H(o),t.$$.on_mount=[]}),i.forEach(We)}function k(t,e){const r=t.$$;r.fragment!==null&&(Tn(r.after_update),H(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function Qn(t,e){t.$$.dirty[0]===-1&&(he.push(t),Dn(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function N(t,e,r,n,i,o,s=null,l=[-1]){const c=ke;ve(t);const a=t.$$={fragment:null,ctx:[],props:o,update:p,not_equal:i,bound:Y(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Y(),dirty:l,skip_bound:!1,root:e.target||c.$$.root};s&&s(a.root);let u=!1;if(a.ctx=r?r(t,e.props||{},(d,A,...I)=>{const P=I.length?I[0]:A;return a.ctx&&i(a.ctx[d],a.ctx[d]=P)&&(!a.skip_bound&&a.bound[d]&&a.bound[d](P),u&&Qn(t,d)),A}):[],a.update(),u=!0,H(a.before_update),a.fragment=n?n(a.ctx):!1,e.target){if(e.hydrate){const d=wn(e.target);a.fragment&&a.fragment.l(d),d.forEach(h)}else a.fragment&&a.fragment.c();e.intro&&f(t.$$.fragment),y(t,e.target,e.anchor),pt()}ve(c)}class U{constructor(){C(this,"$$");C(this,"$$set")}$destroy(){k(this,1),this.$destroy=p}$on(e,r){if(!re(r))return p;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&&!Ie(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const On="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(On);function Nn(t){T(t,"svelte-1bzqb13",".rcb-modal-section.svelte-1bzqb13{padding:8px 0px;display:flex}section.rcb-modal-section.svelte-1bzqb13{flex-grow:1}.rcb-modal-section.svelte-1bzqb13:last-of-type{padding:0}")}function Xe(t){let e,r;const n=t[2].default,i=F(n,t,t[1],null);return{c(){e=w(t[0]),i&&i.c(),In(t[0])(e,{class:J("rcb-modal-section")+" svelte-1bzqb13"})},m(o,s){_(o,e,s),i&&i.m(e,null),r=!0},p(o,s){i&&i.p&&(!r||s&2)&&q(i,n,o,o[1],r?j(n,o[1],s,null):ee(o[1]),null)},i(o){r||(f(i,o),r=!0)},o(o){g(i,o),r=!1},d(o){o&&h(e),i&&i.d(o)}}}function Un(t){let e=t[0],r,n,i=t[0]&&Xe(t);return{c(){i&&i.c(),r=ce()},m(o,s){i&&i.m(o,s),_(o,r,s),n=!0},p(o,[s]){o[0]?e?B(e,o[0])?(i.d(1),i=Xe(o),e=o[0],i.c(),i.m(r.parentNode,r)):i.p(o,s):(i=Xe(o),e=o[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=o[0])},i(o){n||(f(i,o),n=!0)},o(o){g(i,o),n=!1},d(o){o&&h(r),i&&i.d(o)}}}function Sn(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:o="section"}=e;return t.$$set=s=>{"as"in s&&r(0,o=s.as),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class be extends U{constructor(e){super(),N(this,e,Sn,Un,B,{as:0},Nn)}}var oe=(t=>(t[t.Silent=0]="Silent",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug",t[t.Verbose=5]="Verbose",t))(oe||{});class x{static setLogLevel(e){this.logLevel=e}static log(e,r=this.logLevel){const n=`[Purchases] ${e}`;if(!(this.logLevel<r||r===oe.Silent))switch(r){case oe.Error:console.error(n);break;case oe.Warn:console.warn(n);break;case oe.Info:console.info(n);break;case oe.Debug:console.debug(n);break;case oe.Verbose:console.debug(n);break}}static errorLog(e){this.log(e,oe.Error)}static warnLog(e){this.log(e,oe.Warn)}static infoLog(e){this.log(e,oe.Info)}static debugLog(e){this.log(e,oe.Debug)}static verboseLog(e){this.log(e,oe.Verbose)}}C(x,"logLevel",oe.Silent);var ae=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(ae||{});function Ze(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return x.errorLog(`Invalid ISO 8601 duration format: ${t}`),null;const r=parseInt(e[1]);switch(e[2]){case"Y":return{number:r,unit:"year"};case"M":return{number:r,unit:"month"};case"W":return{number:r,unit:"week"};case"D":return{number:r,unit:"day"};default:return x.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}const Ln=(t,e,r)=>{const n=t/1e6;return new Intl.NumberFormat(r,{style:"currency",currency:e}).format(n)},Fn=t=>{const e=t.number;if(e===1)switch(t.unit){case ae.Year:return"yearly";case ae.Month:return"monthly";case ae.Week:return"weekly";case ae.Day:return"daily"}else return`every ${e} ${t.unit}s`},xn=t=>{const e=t.number;if(e===1)switch(t.unit){case ae.Year:return"1 year";case ae.Month:return"1 month";case ae.Week:return"1 week";case ae.Day:return"1 day"}else return`${e} ${t.unit}s`},ht=t=>{const e=Ze(t);return e?Fn(e):"unknown"},Gn=t=>{const e=Ze(t);return e?xn(e):"unknown"};function Yn(t){return t!=null}var _t=(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))(_t||{}),Fe=(t=>(t.Subscription="subscription",t.Consumable="consumable",t.NonConsumable="non_consumable",t))(Fe||{});const At=t=>({amount:t.amount_micros/1e4,amountMicros:t.amount_micros,currency:t.currency,formattedPrice:Ln(t.amount_micros,t.currency)}),bt=t=>{const e=t.period_duration;return{periodDuration:e,period:e?Ze(e):null,cycleCount:t.cycle_count,price:t.price?At(t.price):null}},Hn=t=>t.base==null?(x.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,base:bt(t.base),trial:t.trial?bt(t.trial):null},Kn=t=>t.base_price==null?(x.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,basePrice:At(t.base_price)},jn=(t,e)=>{const r=t.product_type;return r==="subscription"?Jn(t,e,r):qn(t,e,r)},qn=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([s,l])=>{const c=Kn(l);c!=null&&(n[s]=c)}),Object.keys(n).length===0)return x.debugLog(`Product ${t.identifier} has no purchase options. Ignoring.`),null;const i=t.default_purchase_option_id,o=i&&i in t.purchase_options?n[i]:null;return o==null?(x.debugLog(`Product ${t.identifier} has no default purchase option. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:r,currentPrice:o.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:o,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:o}},Jn=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([l,c])=>{const a=Hn(c);a!=null&&(n[l]=a)}),Object.keys(n).length===0)return x.debugLog(`Product ${t.identifier} has no subscription options. Ignoring.`),null;const i=t.default_purchase_option_id,o=i&&i in n?n[i]:null;if(o==null)return x.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const s=o.base.price;return s==null?(x.debugLog(`Product ${t.identifier} default option has no base price. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:r,currentPrice:s,normalPeriodDuration:o.base.periodDuration,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:o,defaultSubscriptionOption:o,subscriptionOptions:n,defaultNonSubscriptionOption:null}},Vn=(t,e,r)=>{const n=r[e.platform_product_identifier];if(n===void 0)return null;const i=jn(n,t);return i===null?null:{identifier:e.identifier,rcBillingProduct:i,packageType:zn(e.identifier)}},Wn=(t,e,r,n)=>{const i={offeringIdentifier:e.identifier,targetingContext:t&&n?{ruleId:n.rule_id,revision:n.revision}:null,placementIdentifier:null},o=e.packages.map(l=>Vn(i,l,r)).filter(Yn),s={};for(const l of o)l!=null&&(s[l.identifier]=l);return o.length==0?null:{identifier:e.identifier,serverDescription:e.description,metadata:e.metadata,packagesById:s,availablePackages:o,lifetime:s.$rc_lifetime??null,annual:s.$rc_annual??null,sixMonth:s.$rc_six_month??null,threeMonth:s.$rc_three_month??null,twoMonth:s.$rc_two_month??null,monthly:s.$rc_monthly??null,weekly:s.$rc_weekly??null}};function zn(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 Xn(t){T(t,"svelte-gf0gr5",".rcb-pricing-info.svelte-gf0gr5{display:flex;flex-direction:column;margin-top:102px;font-weight:500}.rcb-product-price.svelte-gf0gr5{font-size:24px;margin:12px 0px}.rcb-product-price-after-trial.svelte-gf0gr5{margin-bottom:12px}.rcb-product-details.svelte-gf0gr5{opacity:0.6;list-style-type:disc;list-style-position:inside;margin:0px;padding:0px}@media screen and (max-width: 960px){.rcb-pricing-info.svelte-gf0gr5{margin-top:48px}}")}function Zn(t){var P,S;let e,r,n,i,o,s,l,c,a,u=((P=t[2])==null?void 0:P.periodDuration)&&er(t),d=!((S=t[2])!=null&&S.periodDuration)&&t[3]&&tr(t),A=t[2]&&t[3]&&nr(t),I=t[0].normalPeriodDuration&&Et(t);return{c(){e=w("span"),u&&u.c(),r=Q(),d&&d.c(),n=Q(),A&&A.c(),i=Q(),o=w("ul"),I&&I.c(),s=Q(),l=w("li"),l.textContent="Continues until canceled",c=Q(),a=w("li"),a.textContent="Cancel anytime",b(e,"class","rcb-product-price svelte-gf0gr5"),b(o,"class","rcb-product-details svelte-gf0gr5")},m(m,$){_(m,e,$),u&&u.m(e,null),M(e,r),d&&d.m(e,null),_(m,n,$),A&&A.m(m,$),_(m,i,$),_(m,o,$),I&&I.m(o,null),M(o,s),M(o,l),M(o,c),M(o,a)},p(m,$){var le,O;(le=m[2])!=null&&le.periodDuration&&u.p(m,$),!((O=m[2])!=null&&O.periodDuration)&&m[3]&&d.p(m,$),m[2]&&m[3]&&A.p(m,$),m[0].normalPeriodDuration?I?I.p(m,$):(I=Et(m),I.c(),I.m(o,s)):I&&(I.d(1),I=null)},d(m){m&&(h(e),h(n),h(i),h(o)),u&&u.d(),d&&d.d(),A&&A.d(m),I&&I.d()}}}function er(t){let e=Gn(t[2].periodDuration)+"",r,n;return{c(){r=G(e),n=G(" free trial")},m(i,o){_(i,r,o),_(i,n,o)},p,d(i){i&&(h(r),h(n))}}}function tr(t){let e=t[3].formattedPrice+"",r;return{c(){r=G(e)},m(n,i){_(n,r,i)},p,d(n){n&&h(r)}}}function nr(t){let e;return{c(){e=w("span"),e.textContent=`${t[2]&&t[3]&&`${t[3].formattedPrice} after end of trial`}`,b(e,"class","rcb-product-price-after-trial svelte-gf0gr5")},m(r,n){_(r,e,n)},p,d(r){r&&h(e)}}}function Et(t){let e,r,n=ht(t[0].normalPeriodDuration)+"",i;return{c(){e=w("li"),r=G("Renews "),i=G(n)},m(o,s){_(o,e,s),M(e,r),M(e,i)},p(o,s){s&1&&n!==(n=ht(o[0].normalPeriodDuration)+"")&&fe(i,n)},d(o){o&&h(e)}}}function rr(t){let e;return{c(){var r;e=w("span"),e.textContent=`${(r=t[4])==null?void 0:r.formattedPrice}`,b(e,"class","rcb-product-price svelte-gf0gr5")},m(r,n){_(r,e,n)},p,d(r){r&&h(e)}}}function ir(t){let e,r,n=t[0].title+"",i,o,s,l=t[1]&&Zn(t),c=!t[1]&&rr(t);return{c(){e=w("div"),r=w("span"),i=G(n),o=Q(),l&&l.c(),s=Q(),c&&c.c(),b(e,"class","rcb-pricing-info svelte-gf0gr5")},m(a,u){_(a,e,u),M(e,r),M(r,i),M(e,o),l&&l.m(e,null),M(e,s),c&&c.m(e,null)},p(a,u){u&1&&n!==(n=a[0].title+"")&&fe(i,n),a[1]&&l.p(a,u),a[1]||c.p(a,u)},d(a){a&&h(e),l&&l.d(),c&&c.d()}}}function or(t){let e,r;return e=new be({props:{$$slots:{default:[ir]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,[i]){const o={};i&257&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function sr(t,e,r){var d;let{productDetails:n}=e,{purchaseOption:i}=e;const o=n.productType===Fe.Subscription,s=i,l=i,c=s==null?void 0:s.trial,a=(d=s==null?void 0:s.base)==null?void 0:d.price,u=l==null?void 0:l.basePrice;return t.$$set=A=>{"productDetails"in A&&r(0,n=A.productDetails),"purchaseOption"in A&&r(5,i=A.purchaseOption)},[n,o,c,a,u,i]}class It extends U{constructor(e){super(),N(this,e,sr,or,B,{productDetails:0,purchaseOption:5},Xn)}}const lr="data:image/gif;base64,R0lGODlhMgAyAPcBAAAAAAD/AAMDAwcHBxERERUVFSoqKi0tLTAwMDg4OD09PURERElJSUtLS1BQUFJSUlVVVVdXV1paWl9fX2NjY2ZmZmlpaWxsbG1tbXNzc3t7e39/f4GBgYKCgoSEhIaGhoeHh4iIiIuLi5KSkpSUlJaWlp2dnaGhoaOjo6SkpKWlpaenp6ioqKqqqqurq6ysrLCwsLGxsbS0tLa2tri4uLm5ub29vb6+vsDAwMHBwcLCwsXFxcjIyMnJyc3Nzc7OztPT09TU1NXV1dfX19nZ2dra2tvb29zc3N7e3uDg4OHh4eLi4uPj4+fn5+np6ezs7O7u7vDw8PHx8fLy8vPz8/X19fb29vj4+Pn5+fz8/P39/f7+/v///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQFBAABACwAAAAAMgAyAIcAAAAA/wADAwMHBwcREREVFRUqKiotLS0wMDA4ODg9PT1ERERJSUlLS0tQUFBSUlJVVVVXV1daWlpfX19jY2NmZmZpaWlsbGxtbW1zc3N7e3t/f3+BgYGCgoKEhISGhoaHh4eIiIiLi4uSkpKUlJSWlpadnZ2hoaGjo6OkpKSlpaWnp6eoqKiqqqqrq6usrKywsLCxsbG0tLS2tra4uLi5ubm9vb2+vr7AwMDBwcHCwsLFxcXIyMjJycnNzc3Ozs7T09PU1NTV1dXX19fZ2dna2trb29vc3Nze3t7g4ODh4eHi4uLj4+Pn5+fp6ens7Ozu7u7w8PDx8fHy8vLz8/P19fX29vb4+Pj5+fn8/Pz9/f3+/v7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8I/wCzcBFIcKDBgggPKkzIcCEXLlq4bIEokeLEiBcrYrTIcaNHjRobinQ4sqRCkBlTdtR44MBKlR9TmjQJQMBMkgZfdpwSMSYAACgpRtHpcSYSFUIa1mz448UQnAWDfmzSooUVmD9XVnnBwglMlDdvvMjhcOlCHit23CSqcUrVJiizpnTC4sXQmB1vZvmxwgYWhWYLznjRA+rJryqvxGhxxGNLjkVcwMCCN6ZeLkNevDCcRYYKJJfZptyCQwdiijl0CDxdlLPryw2lymY9WzTs17ijVq69mzbM28Bd8x7u23bu46F7i16uXEvw5ziJM5duGbl1k9OLN5cKvfvh7OC3b0jxTv6h+PDUy3unzl67RPXXc56fnz4+/PbofcOHnr9/5f3x4UeffvYVqJuACP5m4IIJ+gfWgusN6KCCAN7WoITVVXjchBxqERAAIfkEBQQAAQAsDQADACAAEAAACKcAAwgcSDDAAwcFEypcSNDAAYYQA2DZstCAAYZOKCqM8uNJxYcKa3DYsVBKECBYFFpU+MTDhiIMkQxBohJkwRYaUkDEEiQIlYQrCyLZ0MFJRCdAkgC1OZBEBxgRJRIBAqXgwYI8NoCwEjWAkyFDoorQ4KOrQCRLoqbQuZCKR7NdqzD5MaQKXIhZmAwBIqTJ3YVYogQZ8oMJ178Kk/A1YhfxQiRHjBYMCAAh+QQFBQABACwNAAMAIAAQAAAInQADCBxIMECGDAUTKlxI8EEEhhADcGEI4QFDJQy5ZJmo0OFCFBFkLNzCRQvHghEgKHQi4cEPhhuzdHyYUMQDDxC5kNSSsGLCIA4x5oxZ0GNBDBFKRAxgkmTBgwVpRJhAZWkAohErPKhhVaLJpR8+YFnohEjXrlB2qHgB5SxELD5etHgBxC1DJC9eqOAxxe5CHSxc0HDilyEOGWYLBgQAIfkEBQQAAQAsGAADABcAFwAACJYAS5AIQLCgwYMINXBAyLDhhg0NtxRpWFBDh4YiDpygGOAhwyUIDOTgqJAhBgMVOHaEeLCHgQMTSV40uKXBAZYcBR5UYSBBFJUNFRhoAbShhZQNi/DYUvRgkxQKmzQlaCVGhw0eakwN4MNDBw0tnmxN8ZAEkq0ET4jYgbat27dw474lMuTHECB1hxBpigRIECBC/AJBEhAAIfkEBQQAAQAsGAADABcAFwAACJIAa9AIQLCgwYMIVbxAyLBhCxYNAwCJSHDFQoYaBIyg6KIFQyQDAMigqJAhBAAMKAZ4iPAGAAETKVpEaECABZUBBB4kAYAAFJwMCwAoAZQhg5QNf4wsajCJhwcRkjANQMVEBAgSVDC9UkNChAcimkz9ADVDkKkEPVRYirat27dw47ad8UKhRYUzitZo8bDjwxoBAQAh+QQFBAABACwYAAMAFwAiAAAIvwCRGAlAsKDBgwh/DEHIsGEQIA0DFIlIEMhChiIOnKAoBCLCJQgM5KCokCEGAxUoBniIsIeBAxMpWkTY4MAGlQEEHlRhIEEUnAwVGGgBlKGFlA1zbCxqkEiFl0SYBojS4YABBCO2MG2RwCqGJFKfGnDQQyrBCgpQaDXLtq3bt3DZkuiggYMGuhxIFC2xoa/fDSXiCh5MuDDBJUSgZGl7ZAiQJFLYbnlCBEiQJFjYXnFiEciTtliSPMzcNspPggEBACH5BAUEAAEALBgAAwAXACIAAAi6ALlsCUCwoMGDCLNwQciwIRctDpU0LKiwIYoIMiYGEMjQiYQHPzRWRCjigQeNGyEeDPIggkSRCw1ywRChBMqNAw3SiDCByk2GFR7U+Mnww4eJMkYQPQiEAQABQJYGgGJBAIABGqSWIGAVghGpTgEcuCGVIIMCSsuqXcu2rdu1NFvKjYCBaAYIEFrifZDhrd+/gAMT1AHjCNsbL1bYYLKWSIwWLXRYUVvlB4sXLISsnYKjBYspbJkgKRgQACH5BAUEAAEALB8ABQAQACgAAAjDAAMIDOBkoMGDAmtw2IEQ4RMPG4o0PNhCQ4qJBpFs6FAQo0ASHWB4FMhjAwgrIwOI0OAjZYAUKbJMzHEiJZEKBg4QwRilwwEDCEZgbJHgJ4YkGHEacNBjZAUFKFxKnUq1qlWBDX5qzdmg4QMDYMMaeHC1rNmzA1WIaJryBAcNJSR61MIjxIYNKqKMnDJj4wYcKZ2cuNuRyRGMQ3xgEUgkyBOXUYAUuZIyCxIgTVxKGQJEZsokQpBWBjJEb2Agj116xhgQACH5BAUFAAEALB8ABQAQACgAAAjFAAMIDBCFy8CDCAP8eDEkYcIqL1g4cYiQx4odFA86YfEiSsaBM170+CiwiAsYWEgGkKECicoAOXRk/CFDZRIPDyIkyUjFRAQIElQYdFhDQoQHIppk/JAzQxCSHirIGPqyqtWrWLEaEACAq1cDDg8AGEsWwIGsaNOqdRiCQo2XHY5m+EEyy4wJECCEmPgxygkIESK0UMmEA4QHTATuuJGxx1uBMFoQeYlkhYwqL2u0oEs4ImaVOlzgeHmFY2KVQFgYqfo5Y0AAIfkEBQQAAQAsGAAFABcAKgAACOUAAwgcSDDAlYIIEw5kMsSJwocCrwgBQgXiQyZAmFhUWAXIkIMbERIZojFkwSdChmQxWfDIjygsCyZJ8rAIj5gDm6TQwKFJTCsxOmzwUIMlFh8eOmho8SRmig0bSCDBGeCEiB1Us2rdyrWryQYHDIQd28DkAwNo0xp44LWt27dtLShYgSUrhbAPsFJVkQDthZIxn3wQe4BEXZxHKKA98pDFiYc2VEAUseHmRiI0CfrQIGLKxokIS2yQsfHHEIRFOGxoCjEIkIQqNjyG6DGhlA0cTj8EndDGhh4QTT98clih662YtwYEACH5BAUEAAEALBgABQAXACoAAAjfAAMIHEgwwJaCCBMOzMIli8KHArdw0cIF4sOGFS0mnMjloEaEDB1+LEhR4siCGE8WlKhFoRMiGVVC2aHiBRSVWHy8aPECiEokL16o4DFFpQ4WLmg4USkQhwwiTKNKnUq16lQMER5k3YphZAYIELSCfZDBqtmzaNMKbFCgxNQFAgAgqCF1BAEAABwkieoEAwABAjZIFbIAr5CHIjp4RBiDBEQKEGZ8nGGjYI0HFKJodNEC4VcTGmsi/BEBAhOLLVgkDBGBg8UVLxI+iRChB0TOClc8oAFRtMLTEFNTpUw1IAAh+QQFBAABACwNAA0AIgAiAAAI5QADCBxIsKDBgwGoPEHIsOHAKkx+DKnisCLBLEyGABHSxKLHKEGG/GBixaPFJBuNUDRpEckRJyxjypxJs6bNmzhvkuiggYMGnhxI5CyxoajRDSVyKl3KtKlTphYUrHhK4YCBBzucqkhgwMAFJk2ffDBw4IDQpkcodD1SEMsSJBUvUGBoQ4VBKECKVFRgwK7HLSFhEiSRlGALAwoWWmQixMiWgkXbPjDgwWIVIj+uGOxpcIdVuA6VAFlyMLLBCwbmNqwiseTmDgeblLXR8EmQjqU3IBxhIIXDlQc5H8QCmqZpp4RrBgQAIfkEBQQAAQAsDQANACIAIgAACOAAAwgcSLCgwYMBuGxByLDhwCxcIGZxSJEgFy0KL1asKDFixI0VL2YEuVEiyZMoU6pcybKly5YzXqh4sULmixkva7RowcLFThY1XgodSrSoUaIhKNSYWLRDhAcZfhidMQEChBBOikY5ASFChBZMhzLhAOEBE4M7cFB0sIBhj6AFjbCIQbEAgBEgs7x4QaQghgwFSwAokLWiDxc0DEaAYPAAgAsVoch8YvBBBIM1BAAYQlFHix0Hyx50AKBtQyczpxy0fFCJAAF0GRJpAQThYoQaAJBwCIUha4ScV4o++ndlQAAh+QQFBAABACwFABgAKgAXAAAI5gADCBxIsKDBgwWJDPkxBMjCIUQQSpxoEAmQIECEXASChKLHjyBDihxJsqTJkyhHbnlSJAlKFSJ6eLyi8McSlCc4aChRBOGVJRmHQMmCUguPEBs2qIhSkElDIky2pBw4ZcaGDhtwDLyCUcmVqQadnEjqZKCTKhJVnPB4gYLEIT5A9tggwqMCAypSXvHQYUfBBg8KtjCg4AnKGBtIaClowIDBBwY8nGziQYNLxgcM7jhgoGPJsSwONj54wYBbkkc0fDBs0EBmg00OHLBBkseGGghHHxxhIEXJJhJdS/QMdqDu4h4BnwwIACH5BAUFAAEALAUAGAAqABcAAAjlAAMIHEiwoMGDBbNwUchwIcKHEA1y2cJFy8SKXCJq3Mixo8ePIEOKHEkSZJEYOUjqgHFE45MZL1TsIHnjxQobTBBW2cHCBQwjJbcQidGihQ4rBX/YfNEjS8mBVX6weMFCyMAoLVjoiPLU4BQcWacMHOIE4ZUQHjSK6PCQCRKnGmk8oKCRAoQZJatIiCCjoAEEBWvM5TrSRIQMBgEASJgBgomRSSQ8GJJYgMEfESDkDOkBgoiDig+GiMAh5I8HEpqAtmzwSYQIPUDKgKACYeiDKx7QCJnkIQDWBrNs7jrwNnGNf0cGBAAh+QQFBAABACwDABgAKgAXAAAI5gCT/BgCZMhAIEkCKFzIsKHDhw2NBAEiBMhEIUYgatzIsaPHjyBDihxJsqTJkygVauEhIsXJJUSgdExCooMGFSePEEwiBeITFhs2gOiR8gkRi0mwNKzxQYMHGFdSKrzipCCQJwudBD3hRGpDLEkmKlW444hGCxU6sjjBBWKUKB9XGFDQUcQGHiinJDiAomGDBw19aBAx5WQHAw6yNDRgwGGJDTJMEkFgwIdDAwccFuGwAStJCgYwPGT8UMWGEyR1GECQ8HJmh1I2cBgy8oSBERBJP7SxgehIIhoxa/TsVaHu4hz/kgwIACH5BAUEAAEALAMAGAAqABcAAAjfAG2oeLHixcAVNgIoXMiwocOHDWm0YOGixUQXNCBq3Mixo8ePIEOKHEmypMmTKBfSoPDhJJctXLRwHIIhwoMQJ7Nw0ZkFohMRDyJMoIHFpZaXMbk0RCHhgYQSVVIq5LlTqUIlEB54UCK1IdKjC2X80NiAQccdNzTq/EgCQIGOMFoQQRmFgIARDTFkaIhkhYyoJi0AOOAwAgSHNVqMLQlkAAAcDoM6ZPKCBeCRCwA8eJj1oQ4XkEfSADDAyEPJDq+weMFk5AgAGiAahgiEhemRQDSiflilZ1eFnX931EsyIAAh+QQFBAABACwDAA0AIgAiAAAI4wADCHwiRaDBgwgTKjyY5ccQJFkWSpxo0AkQIUGaYKHIMWEWJEOAFHHSsaRBKkiABEFi0iSWKEOYtJxJs6bNmzhz6uxYQgMHDR18aiixk8SGo0g3kNjJtKnTp1CjelShwMJTHw0OGLDKdAkGAwYSrGgqAoEBBBumNC0ClkIRqCd0SLRQgSOTIzNXGFDAkUiQJyanJDiAAiEJogejiLxSsoMBBwmPJkzZpCMRsz4S+kwoJWREihQMYFAoOWESIUko6jibWnMHhVmADIky8YSBEQtLJ7QIeCIRiZsXfrap++lhigEBACH5BAUEAAEALAMADQAiACIAAAjgAAMINNJEoMGDCBMqPFhFxYsbVRZKnChQC5AWLlr8uEKxY8IrOV6skDHEo0mDTWq0aIHjpEskL3a4nEmzps2bOHPq9JjhQQSfQDPszADBJ4SiEYTuXMq0qdOnUBOSKMDAKQ4DAgA0YIrkAQAABEgw1TAAwAALUZgC+boAyNMRNCSG8NCRS5aZNB5Q6LiFi5aTVSREkIFwhg2Edu2aNJH078GMCLVw6esxiYQHJRE6TJglcUcPEEQobMFCoeQtFH88kFAw4YoXChPflSgDgoqFkGNLpphE4uaFXHCSjmqYYkAAIfkEBQQAAQAsAwAFABcAKgAACOUAAwgcSDAAloIIEw6M8uOJwocDpQQBchDiQyRDkFh8iCVIECobFToBkqRiSIJYiACBchKhkyFDHmbpQUThFiRLHj7RwMGEw5YDbXTYsEFGFaACpaTgoEHEDqQCj5QgegKqQB8hWFjdyrWr164PDBwQS/bBSQcG0qo14OCr27dw4yZUocACVB8NxtptuQRD2gQrgIpAYADBhilAi6SlUMTqCR0KsaioarXHBhFWr3jo8JQgkSQbY2wggVAIEItNPGgAXfBHTIgnNmhFOBHiEQ0ffhYE8lohjw01FJpG/dA119pbPwcEACH5BAUFAAEALAMABQAXACoAAAjkAAMIHEgwwBQtBRMqFIhEhZCFEAc2adHCSsSIN17kuAhxCsUmHBf+WGEjpMIrMVocMZlwyIsXEWn4gIhDB0QmDyJsYMKS4IoIQE1I6SnwCYgIDyjI2EI0AJAMECB4aCqwxgQRVLNq3cp1KwIAAsCKRWDyAICzaAEc6Mq2rdu3CbXQoPCh6RAMSEP0dCIi5wQaPVFIeCChRJWeSiA88KCEqowfEHfgyGqERQyqWV4SKZiFC0cfLmgwJchlNEQoL1Q8Sdj5oo4WOxRyQQjRiYoXUxS2hkikBZCFpS9Cgbib6mytnQMCACH5BAUEAAEALAMABQAQACgAAAjDAAMIHEgwixOCCBH60IAjoUMiGzpEcZjQRIcUFBE62bDhSEaCMzSU+DiwSogNPUgK3MEhxMAUDR1qOaFCIBIDByYgIZllxAGcHqCQbGLhpwIUKnk8MGCAgsorLRJcUEm1qtWrVpf+3GrggUMHTMMydYC1rNmzaHmIwPgxCYkOGmpSfMKCI4geWSjW+KDBA4wrGTduOHGQ5A6PFJfsVAkFSBGVW4IMKfyRiRAjKqsQ+QGYpBIgSzL/GGJF5ZMgTapWIRgQACH5BAUEAAEALAMABQAQACgAAAjAAAMIHEgwAJOCCAfWeNAiIUIfECI4cVhwQwQQFAkyiQABSMaBJx5k+ChQygQINUgGkBFhwkASMhxm8RBC4BAAAhYMIalhAM4LTz4qcSAAQIERJG0cAACAgcoSBByonEq1qtWMGR5E0Mp1JMIMELRCCBvB69WzaNNO3VIkRo6PT2a8ULGDYpUdLFzAMELxx4sVL3pkoRilBQsdUUgOmZgwC5fBJLlo4RLZMeSMk7dQzmh5c0Yumis/JqlZy9TLAQICACH5BAUEAAEALAMAAwAXACIAAAi+AAMIHEiwoEEkRgwqXPhjyMKBR7IsDALkYQAVBkgsBOLwIQ4DB5goFFLR4oQDFhQ2tBjgyAEDPAxSZBngg4EHVwpypAklgYEVBRHSDIDiQAKLKXA8pJByIRKQE5AMNTji5QEPUKYSbGLhpQIUWgnyeGDAAIWwBFskuIC2rdu3cONaLKGBg4YOdTWUmEpig9+/GzTKHUy4sGGWT4okaXuFyJAfS8JeWQJEyJCsWpkMAUKEyRbJFJXkbOukStuAAAAh+QQFBAABACwDAAMAFwAiAAAItQADCBxIsKDBGjQMKlyo4sXCgUIetmDxMAAJABsWrnD4UAaAAUkUumhRMcACAQ4UNiwpRAAAGwYnlgyAAQACgxtnPiEAoERBhDMDjBBAoCINHw8ZNHjI5EGEDUyCFtSyIoJVE1KkEnwCIsIDCjK0EgSSAQIED2IHYqkxQUTat3Djyp1b0UbDjXdhBqUxcWTfhHQDCx5MuCIXLVy2vOWShTEXsVsOJz6stbHlx1ojI1b8tvHbgAAAIfkEBQQAAQAsAwADABcAFwAACJQAAwgcSLCgwRIkDCpcqIHDwoFHHm7Y8DCACgMJFWroUBGHgQNMFE6sGGDCAQsaHVY8csAAD4MjSX4w8MDgRpIBoCQwsKIgQpwBUBxIULEHkYcUUC580tDEE6AGbXSYKKMKVIJSUnDQIGIHl6sQS0w8AZagjxAsyqpdy7at24pJfgwBMkQukCRQjQQBIgTIXiFGoAYEACH5BAUFAAEALAMAAwAXABcAAAiVAAMIHEiwoMEMGQwqXPggwsKBTLQshPDgYYAaD1owdPjQB4QIThRGgGAxwIYIIBQ2LMlkJBCDFEsGOPEgA5aCK0tKmQChRkGEMgPIiDDhoRYjTR56CPGwiooXN6oENQikhYsWP65MJXglx4sVMoZsJdikRosWOMYSRPJih9q3cOPKnWuRSxa7eO9O3cJFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function cr(t){let e,r;return{c(){e=w("img"),Z(e.src,r=lr)||b(e,"src",r),b(e,"alt","spinner")},m(n,i){_(n,e,i)},p,i:p,o:p,d(n){n&&h(e)}}}class ar extends U{constructor(e){super(),N(this,e,null,cr,B,{})}}function ur(t){T(t,"svelte-1mxx341",".rcb-modal-loader.svelte-1mxx341{width:100%;flex-grow:1;min-height:100%;display:flex;justify-content:center;align-items:center}")}function fr(t){let e,r,n;return r=new ar({}),{c(){e=w("div"),v(r.$$.fragment),b(e,"class","rcb-modal-loader svelte-1mxx341")},m(i,o){_(i,e,o),y(r,e,null),n=!0},p,i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){g(r.$$.fragment,i),n=!1},d(i){i&&h(e),k(r)}}}class et extends U{constructor(e){super(),N(this,e,null,fr,B,{},ur)}}var te=(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[t.InvalidEmailError=38]="InvalidEmailError",t))(te||{});class Be{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. Please check your network connection and try again.";case 11:return"There was a credentials issue. Check the underlying error for more details.";case 12:return"Received unexpected response from the backend.";case 14:return"The app user id is not valid.";case 15:return"The operation is already in progress.";case 16:return"There was an unknown backend error.";case 17:return"Apple Subscription Key is invalid or not present. In order to provide subscription offers, you must first generate a subscription key. Please see https://docs.revenuecat.com/docs/ios-subscription-offers for more info.";case 18:return"The User is ineligible for that action.";case 19:return"App does not have sufficient permissions to make purchases.";case 20:return"The payment is pending.";case 21:return"One or more of the attributes sent could not be saved.";case 22:return"Called logOut but the current user is anonymous.";case 23:return"There is an issue with your configuration. Check the underlying error for more details.";case 24:return"There was a problem with the operation. Looks like we doesn't support that yet. Check the underlying error for more details.";case 25:return"A request for subscriber attributes returned none.";case 28:return"There was a problem related to the customer info.";case 36:return"Request failed signature verification. Please see https://rev.cat/trusted-entitlements for more info.";case 38:return"Email is not valid. Please provide a valid email address."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:case 7773:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:case 7814:return 4;case 7772:return 6;case 7220:return 14;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:return 38}}static convertCodeToBackendErrorCode(e){return e in wt?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case ne.ErrorSettingUpPurchase:return 2;case ne.ErrorChargingPayment:return 20;case ne.NetworkError:return 10;case ne.MissingEmailError:return 4;case ne.StripeError:return 2;case ne.UnknownError:return 0;case ne.AlreadySubscribedError:return 6}}}var wt=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendInvalidEmail=7012]="BackendInvalidEmail",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[t.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",t[t.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",t[t.BackendOfferNotFound=7814]="BackendOfferNotFound",t[t.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",t))(wt||{});class z extends Error{constructor(r,n,i,o){super(n);C(this,"toString",()=>`PurchasesError(code: ${te[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i,this.extra=o}static getForBackendError(r,n){const i=Be.getErrorCodeForBackendErrorCode(r);return new z(i,Be.getPublicMessage(i),n,{backendErrorCode:r})}static getForPurchasesFlowError(r){return new z(Be.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class yt extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Pe=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Pe||{}),xe=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(xe||{}),ne=(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[t.AlreadySubscribedError=6]="AlreadySubscribedError",t))(ne||{});class X extends Error{constructor(e,r,n,i,o){super(r),this.errorCode=e,this.underlyingErrorMessage=n,this.purchasesErrorCode=i,this.extra=o}isRecoverable(){switch(this.errorCode){case 3:case 5:return!0;case 0:case 1:case 6:case 4:case 2:return!1}}getPublicErrorMessage(){var r;const e=((r=this.extra)==null?void 0:r.backendErrorCode)??this.purchasesErrorCode??this.errorCode;switch(this.errorCode){case 2:return`An unknown error occurred. Error code: ${e}.`;case 0:return`Purchase not started due to an error. Error code: ${e}.`;case 1:return"Payment failed.";case 3:return"Network error. Please check your internet connection.";case 4:return this.message;case 5:return"Email is required to complete the purchase.";case 6:return"You are already subscribed to this product."}}static fromPurchasesError(e,r){let n;return e.errorCode===te.ProductAlreadyPurchasedError?n=6:e.errorCode===te.InvalidEmailError?n=5:e.errorCode===te.NetworkError?n=3:n=r,new X(n,e.message,e.underlyingErrorMessage,e.errorCode,e.extra)}}class dr{constructor(e,r=10){C(this,"operationSessionId",null);C(this,"backend");C(this,"maxNumberAttempts");C(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=r}async startPurchase(e,r,n,i,o){try{const s=await this.backend.postPurchase(e,r,i,o,n);return this.operationSessionId=s.operation_session_id,s}catch(s){if(s instanceof z)throw X.fromPurchasesError(s,0);{const l="Unknown error starting purchase: "+String(s);throw x.errorLog(l),new X(2,l)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new X(0,"No purchase in progress");return new Promise((r,n)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new X(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(s=>{switch(s.operation.status){case Pe.Started:case Pe.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case Pe.Succeeded:this.clearPurchaseInProgress(),r();return;case Pe.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(s.operation.error,n)}}).catch(s=>{const l=X.fromPurchasesError(s,3);n(l)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new X(2,"Got an error status but error field is empty."));return}switch(e.code){case xe.SetupIntentCreationFailed:r(new X(0,"Setup intent creation failed"));return;case xe.PaymentMethodCreationFailed:r(new X(0,"Payment method creation failed"));return;case xe.PaymentChargeFailed:r(new X(1,"Payment charge failed"));return}}}const gr="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 mr(t){T(t,"svelte-1609h93","img.svelte-1609h93{width:124px;height:124px;margin:0 auto}")}function pr(t){let e,r;return{c(){e=w("img"),Z(e.src,r=gr)||b(e,"src",r),b(e,"alt","icon"),b(e,"class","rcb-ui-asset-icon svelte-1609h93")},m(n,i){_(n,e,i)},p,i:p,o:p,d(n){n&&h(e)}}}class hr extends U{constructor(e){super(),N(this,e,null,pr,B,{},mr)}}function _r(t){T(t,"svelte-1rmxk7q","button.svelte-1rmxk7q{border:none;border-radius:56px;font-size:16px;cursor:pointer;height:56px;color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center}button.intent-primary.svelte-1rmxk7q{background-color:var(--rc-color-grey-text-dark);color:var(--rc-color-white);font-size:16px}button.svelte-1rmxk7q:disabled{color:var(--rc-color-grey-text-light)}button.intent-primary.svelte-1rmxk7q:disabled{color:var(--rc-color-grey-text-light)}")}function Ar(t){let e,r,n,i,o;const s=t[4].default,l=F(s,t,t[3],null);return{c(){e=w("button"),l&&l.c(),b(e,"class",r=J(`intent-${t[0]}`)+" svelte-1rmxk7q"),e.disabled=t[1],b(e,"data-testid",t[2])},m(c,a){_(c,e,a),l&&l.m(e,null),n=!0,i||(o=ye(e,"click",t[5]),i=!0)},p(c,[a]){l&&l.p&&(!n||a&8)&&q(l,s,c,c[3],n?j(s,c[3],a,null):ee(c[3]),null),(!n||a&1&&r!==(r=J(`intent-${c[0]}`)+" svelte-1rmxk7q"))&&b(e,"class",r),(!n||a&2)&&(e.disabled=c[1]),(!n||a&4)&&b(e,"data-testid",c[2])},i(c){n||(f(l,c),n=!0)},o(c){g(l,c),n=!1},d(c){c&&h(e),l&&l.d(c),i=!1,o()}}}function br(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:o="primary"}=e,{disabled:s=!1}=e,{testId:l=void 0}=e;function c(a){mt.call(this,t,a)}return t.$$set=a=>{"intent"in a&&r(0,o=a.intent),"disabled"in a&&r(1,s=a.disabled),"testId"in a&&r(2,l=a.testId),"$$scope"in a&&r(3,i=a.$$scope)},[o,s,l,i,n,c]}class De extends U{constructor(e){super(),N(this,e,br,Ar,B,{intent:0,disabled:1,testId:2},_r)}}function Er(t){T(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function Ir(t){let e,r;const n=t[1].default,i=F(n,t,t[0],null);return{c(){e=w("footer"),i&&i.c(),b(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(o,s){_(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&1)&&q(i,n,o,o[0],r?j(n,o[0],s,null):ee(o[0]),null)},i(o){r||(f(i,o),r=!0)},o(o){g(i,o),r=!1},d(o){o&&h(e),i&&i.d(o)}}}function wr(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}class tt extends U{constructor(e){super(),N(this,e,wr,Ir,B,{},Er)}}function yr(t){T(t,"svelte-6o8e90",'.column.svelte-6o8e90{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "8px");flex-grow:1}')}function kr(t){let e,r,n;const i=t[2].default,o=F(i,t,t[1],null);return{c(){e=w("div"),o&&o.c(),b(e,"class","column svelte-6o8e90"),b(e,"style",r=`--gap:${t[0]};`)},m(s,l){_(s,e,l),o&&o.m(e,null),n=!0},p(s,[l]){o&&o.p&&(!n||l&2)&&q(o,i,s,s[1],n?j(i,s[1],l,null):ee(s[1]),null),(!n||l&1&&r!==(r=`--gap:${s[0]};`))&&b(e,"style",r)},i(s){n||(f(o,s),n=!0)},o(s){g(o,s),n=!1},d(s){s&&h(e),o&&o.d(s)}}}function vr(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:o="8px"}=e;return t.$$set=s=>{"gutter"in s&&r(0,o=s.gutter),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class Ce extends U{constructor(e){super(),N(this,e,vr,kr,B,{gutter:0},yr)}}const $r="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 Br(t){T(t,"svelte-14xreta",".close-button.svelte-14xreta{border:none;cursor:pointer;background-color:transparent;padding:0px}")}function Pr(t){let e,r,n,i,o;return{c(){e=w("button"),r=w("img"),Z(r.src,n=$r)||b(r,"src",n),b(r,"alt","close"),b(e,"class","close-button svelte-14xreta"),e.disabled=t[0]},m(s,l){_(s,e,l),M(e,r),i||(o=ye(e,"click",t[1]),i=!0)},p(s,[l]){l&1&&(e.disabled=s[0])},i:p,o:p,d(s){s&&h(e),i=!1,o()}}}function Dr(t,e,r){let{disabled:n=!1}=e;function i(o){mt.call(this,t,o)}return t.$$set=o=>{"disabled"in o&&r(0,n=o.disabled)},[n,i]}class Cr extends U{constructor(e){super(),N(this,e,Dr,Pr,B,{disabled:0},Br)}}function Mr(t){T(t,"svelte-44qpq9",".rcb-app-icon.svelte-44qpq9{width:40px;height:40px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:16px}.rcb-app-icon-picture-container.svelte-44qpq9{height:40px}.rcb-app-icon.loading.svelte-44qpq9{background-color:gray}")}function Tr(t){let e;return{c(){e=w("div"),b(e,"class","rcb-app-icon loading svelte-44qpq9")},m(r,n){_(r,e,n)},p,d(r){r&&h(e)}}}function Rr(t){let e,r,n,i,o,s;return{c(){e=w("picture"),r=w("source"),i=Q(),o=w("img"),b(r,"type","image/webp"),L(r,n=t[1])||b(r,"srcset",n),b(o,"class","rcb-app-icon svelte-44qpq9"),Z(o.src,s=t[0])||b(o,"src",s),b(o,"alt","App icon"),b(e,"class","rcb-app-icon-picture-container svelte-44qpq9")},m(l,c){_(l,e,c),M(e,r),M(e,i),M(e,o)},p(l,c){c&2&&n!==(n=l[1])&&b(r,"srcset",n),c&1&&!Z(o.src,s=l[0])&&b(o,"src",s)},d(l){l&&h(e)}}}function Qr(t){let e;function r(o,s){return o[0]!==null?Rr:Tr}let n=r(t),i=n(t);return{c(){i.c(),e=ce()},m(o,s){i.m(o,s),_(o,e,s)},p(o,[s]){n===(n=r(o))&&i?i.p(o,s):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:p,o:p,d(o){o&&h(e),i.d(o)}}}function Or(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=o=>{"src"in o&&r(0,n=o.src),"srcWebp"in o&&r(1,i=o.srcWebp)},[n,i]}class kt extends U{constructor(e){super(),N(this,e,Or,Qr,B,{src:0,srcWebp:1},Mr)}}const Ge=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Nr(t){T(t,"svelte-10uf5fq",".app-title.svelte-10uf5fq{font-weight:500;margin:8px 0;font-size:16px}.rcb-header-layout__business-info.svelte-10uf5fq{display:flex;align-items:center}")}function Ur(t){let e,r;return e=new kt({}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Sr(t){let e,r,n=t[0].seller_company_name+"",i,o,s=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&vt(t);return{c(){s&&s.c(),e=Q(),r=w("span"),i=G(n),b(r,"class","app-title svelte-10uf5fq")},m(l,c){s&&s.m(l,c),_(l,e,c),_(l,r,c),M(r,i),o=!0},p(l,c){l[0].app_icon_webp!==null&&l[0].app_icon!==null?s?(s.p(l,c),c&1&&f(s,1)):(s=vt(l),s.c(),f(s,1),s.m(e.parentNode,e)):s&&(V(),g(s,1,1,()=>{s=null}),W()),(!o||c&1)&&n!==(n=l[0].seller_company_name+"")&&fe(i,n)},i(l){o||(f(s),o=!0)},o(l){g(s),o=!1},d(l){l&&(h(e),h(r)),s&&s.d(l)}}}function vt(t){let e,r;return e=new kt({props:{src:Ge(t[0].app_icon),srcWebp:Ge(t[0].app_icon_webp)}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&1&&(o.src=Ge(n[0].app_icon)),i&1&&(o.srcWebp=Ge(n[0].app_icon_webp)),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Lr(t){let e,r,n,i;const o=[Sr,Ur],s=[];function l(c,a){return c[0]!==null?0:1}return r=l(t),n=s[r]=o[r](t),{c(){e=w("div"),n.c(),b(e,"class","rcb-header-layout__business-info svelte-10uf5fq")},m(c,a){_(c,e,a),s[r].m(e,null),i=!0},p(c,[a]){let u=r;r=l(c),r===u?s[r].p(c,a):(V(),g(s[u],1,1,()=>{s[u]=null}),W(),n=s[r],n?n.p(c,a):(n=s[r]=o[r](c),n.c()),f(n,1),n.m(e,null))},i(c){i||(f(n),i=!0)},o(c){g(n),i=!1},d(c){c&&h(e),s[r].d()}}}function Fr(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class $t extends U{constructor(e){super(),N(this,e,Fr,Lr,B,{brandingInfo:0},Nr)}}function xr(t){T(t,"svelte-17puakv",".rcb-post-purchase-header-layout.svelte-17puakv{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:-4px}")}function Gr(t){let e,r,n,i,o;return r=new $t({props:{brandingInfo:t[0]}}),i=new Cr({}),i.$on("click",function(){re(t[1])&&t[1].apply(this,arguments)}),{c(){e=w("div"),v(r.$$.fragment),n=Q(),v(i.$$.fragment),b(e,"class","rcb-post-purchase-header-layout svelte-17puakv")},m(s,l){_(s,e,l),y(r,e,null),M(e,n),y(i,e,null),o=!0},p(s,l){t=s;const c={};l&1&&(c.brandingInfo=t[0]),r.$set(c)},i(s){o||(f(r.$$.fragment,s),f(i.$$.fragment,s),o=!0)},o(s){g(r.$$.fragment,s),g(i.$$.fragment,s),o=!1},d(s){s&&h(e),k(r),k(i)}}}function Yr(t){let e,r;return e=new be({props:{as:"header",$$slots:{default:[Gr]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,[i]){const o={};i&7&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Hr(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=o=>{"brandingInfo"in o&&r(0,n=o.brandingInfo),"onClose"in o&&r(1,i=o.onClose)},[n,i]}class Kr extends U{constructor(e){super(),N(this,e,Hr,Yr,B,{brandingInfo:0,onClose:1},xr)}}function jr(t){T(t,"svelte-10pcqja",".rcb-modal-message.svelte-10pcqja{width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-10pcqja{font-size:24px;line-height:1.25em}.subtitle.svelte-10pcqja{font-size:16px;line-height:1.25em;overflow-wrap:anywhere}")}const qr=t=>({}),Bt=t=>({});function Jr(t){let e,r,n,i,o;const s=t[4].default,l=F(s,t,t[5],null);return{c(){e=w("span"),r=G(t[2]),n=Q(),i=w("span"),l&&l.c(),b(e,"class","title svelte-10pcqja"),b(i,"class","subtitle svelte-10pcqja")},m(c,a){_(c,e,a),M(e,r),_(c,n,a),_(c,i,a),l&&l.m(i,null),o=!0},p(c,a){(!o||a&4)&&fe(r,c[2]),l&&l.p&&(!o||a&32)&&q(l,s,c,c[5],o?j(s,c[5],a,null):ee(c[5]),null)},i(c){o||(f(l,c),o=!0)},o(c){g(l,c),o=!1},d(c){c&&(h(e),h(n),h(i)),l&&l.d(c)}}}function Vr(t){let e,r,n;const i=t[4].icon,o=F(i,t,t[5],Bt);return r=new Ce({props:{gutter:"16px",$$slots:{default:[Jr]},$$scope:{ctx:t}}}),{c(){o&&o.c(),e=Q(),v(r.$$.fragment)},m(s,l){o&&o.m(s,l),_(s,e,l),y(r,s,l),n=!0},p(s,l){o&&o.p&&(!n||l&32)&&q(o,i,s,s[5],n?j(i,s[5],l,qr):ee(s[5]),Bt);const c={};l&36&&(c.$$scope={dirty:l,ctx:s}),r.$set(c)},i(s){n||(f(o,s),f(r.$$.fragment,s),n=!0)},o(s){g(o,s),g(r.$$.fragment,s),n=!1},d(s){s&&h(e),o&&o.d(s),k(r,s)}}}function Wr(t){let e,r,n;return r=new Ce({props:{gutter:"16px",$$slots:{default:[Vr]},$$scope:{ctx:t}}}),{c(){e=w("div"),v(r.$$.fragment),b(e,"class","rcb-modal-message svelte-10pcqja"),b(e,"data-type",t[3])},m(i,o){_(i,e,o),y(r,e,null),n=!0},p(i,o){const s={};o&36&&(s.$$scope={dirty:o,ctx:i}),r.$set(s),(!n||o&8)&&b(e,"data-type",i[3])},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){g(r.$$.fragment,i),n=!1},d(i){i&&h(e),k(r)}}}function zr(t){let e;return{c(){e=G("Go back to app")},m(r,n){_(r,e,n)},d(r){r&&h(e)}}}function Xr(t){let e,r;return e=new De({props:{$$slots:{default:[zr]},$$scope:{ctx:t}}}),e.$on("click",function(){re(t[1])&&t[1].apply(this,arguments)}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){t=n;const o={};i&32&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Zr(t){let e,r,n,i,o,s;return e=new Kr({props:{brandingInfo:t[0],onClose:t[1]}}),n=new be({props:{$$slots:{default:[Wr]},$$scope:{ctx:t}}}),o=new tt({props:{$$slots:{default:[Xr]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment),r=Q(),v(n.$$.fragment),i=Q(),v(o.$$.fragment)},m(l,c){y(e,l,c),_(l,r,c),y(n,l,c),_(l,i,c),y(o,l,c),s=!0},p(l,c){const a={};c&1&&(a.brandingInfo=l[0]),c&2&&(a.onClose=l[1]),e.$set(a);const u={};c&44&&(u.$$scope={dirty:c,ctx:l}),n.$set(u);const d={};c&34&&(d.$$scope={dirty:c,ctx:l}),o.$set(d)},i(l){s||(f(e.$$.fragment,l),f(n.$$.fragment,l),f(o.$$.fragment,l),s=!0)},o(l){g(e.$$.fragment,l),g(n.$$.fragment,l),g(o.$$.fragment,l),s=!1},d(l){l&&(h(r),h(i)),k(e,l),k(n,l),k(o,l)}}}function ei(t){let e,r;return e=new Ce({props:{gutter:"32px",$$slots:{default:[Zr]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,[i]){const o={};i&47&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function ti(t,e,r){let{$$slots:n={},$$scope:i}=e,{brandingInfo:o=null}=e,{onContinue:s}=e,{title:l}=e,{type:c}=e;return t.$$set=a=>{"brandingInfo"in a&&r(0,o=a.brandingInfo),"onContinue"in a&&r(1,s=a.onContinue),"title"in a&&r(2,l=a.title),"type"in a&&r(3,c=a.type),"$$scope"in a&&r(5,i=a.$$scope)},[o,s,l,c,n,i]}class Pt extends U{constructor(e){super(),N(this,e,ti,ei,B,{brandingInfo:0,onContinue:1,title:2,type:3},jr)}}function Dt(t){let e,r,n,i,o,s;return{c(){e=w("br"),r=G("If this error persists, please contact "),n=w("a"),i=G(t[2]),s=G("."),b(n,"href",o="mailto:"+t[2])},m(l,c){_(l,e,c),_(l,r,c),_(l,n,c),M(n,i),_(l,s,c)},p(l,c){c&4&&fe(i,l[2]),c&4&&o!==(o="mailto:"+l[2])&&b(n,"href",o)},d(l){l&&(h(e),h(r),h(n),h(s))}}}function ni(t){let e=t[1].getPublicErrorMessage()+"",r,n,i,o=t[2]&&Dt(t);return{c(){r=G(e),n=Q(),o&&o.c(),i=ce()},m(s,l){_(s,r,l),_(s,n,l),o&&o.m(s,l),_(s,i,l)},p(s,l){l&2&&e!==(e=s[1].getPublicErrorMessage()+"")&&fe(r,e),s[2]?o?o.p(s,l):(o=Dt(s),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},d(s){s&&(h(r),h(n),h(i)),o&&o.d(s)}}}function ri(t){let e,r;return e=new hr({props:{slot:"icon"}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function ii(t){let e,r;return e=new Pt({props:{title:t[4](),brandingInfo:t[0],onContinue:t[3],type:"error",$$slots:{icon:[ri],default:[ni]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.brandingInfo=n[0]),i&8&&(o.onContinue=n[3]),i&38&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function oi(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:o=null}=e,{onContinue:s}=e;Ue(()=>{x.errorLog(`Displayed error: ${ne[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function l(){switch(i.errorCode){case ne.AlreadySubscribedError:return"Already subscribed";default:return"Something went wrong"}}return t.$$set=c=>{"brandingInfo"in c&&r(0,n=c.brandingInfo),"lastError"in c&&r(1,i=c.lastError),"supportEmail"in c&&r(2,o=c.supportEmail),"onContinue"in c&&r(3,s=c.onContinue)},[n,i,o,s,l]}class si extends U{constructor(e){super(),N(this,e,oi,ii,B,{brandingInfo:0,lastError:1,supportEmail:2,onContinue:3})}}const li="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 ci(t){T(t,"svelte-1609h93","img.svelte-1609h93{width:124px;height:124px;margin:0 auto}")}function ai(t){let e,r;return{c(){e=w("img"),Z(e.src,r=li)||b(e,"src",r),b(e,"alt","icon"),b(e,"class","rcb-ui-asset-icon svelte-1609h93")},m(n,i){_(n,e,i)},p,i:p,o:p,d(n){n&&h(e)}}}class ui extends U{constructor(e){super(),N(this,e,null,ai,B,{},ci)}}function fi(t){let e;return{c(){e=G("Your plan is now active.")},m(r,n){_(r,e,n)},d(r){r&&h(e)}}}function di(t){let e,r=t[2]&&fi();return{c(){r&&r.c(),e=ce()},m(n,i){r&&r.m(n,i),_(n,e,i)},p,d(n){n&&h(e),r&&r.d(n)}}}function gi(t){let e,r;return e=new ui({props:{slot:"icon"}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function mi(t){let e,r;return e=new Pt({props:{type:"success",title:"Purchase successful",brandingInfo:t[0],onContinue:t[1],$$slots:{icon:[gi],default:[di]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.brandingInfo=n[0]),i&2&&(o.onContinue=n[1]),i&16&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function pi(t,e,r){let{productDetails:n=null}=e,{brandingInfo:i=null}=e,{onContinue:o}=e;const s=(n==null?void 0:n.productType)===Fe.Subscription;return t.$$set=l=>{"productDetails"in l&&r(3,n=l.productDetails),"brandingInfo"in l&&r(0,i=l.brandingInfo),"onContinue"in l&&r(1,o=l.onContinue)},[i,o,s,n]}class hi extends U{constructor(e){super(),N(this,e,pi,mi,B,{productDetails:3,brandingInfo:0,onContinue:1})}}function _i(t,e,r,n,i={}){const o=r.create(e,i);return o.mount(t),o.on("change",s=>n("change",s)),o.on("ready",s=>n("ready",s)),o.on("focus",s=>n("focus",s)),o.on("blur",s=>n("blur",s)),o.on("escape",s=>n("escape",s)),o.on("click",s=>n("click",s)),o.on("loaderror",s=>n("loaderror",s)),o.on("loaderstart",s=>n("loaderstart",s)),o.on("networkschange",s=>n("networkschange",s)),o}const Ai=typeof window>"u";function bi(t){if(!Ai)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function Ei(t){let e;return{c(){e=w("div")},m(r,n){_(r,e,n),t[6](e)},p,i:p,o:p,d(r){r&&h(e),t[6](null)}}}function Ii(t,e,r){let n,i;const o=vn(),{elements:s}=Bn("stripe");let{options:l=void 0}=e;Ue(()=>(n=_i(i,"payment",s,o,l),()=>n.destroy()));function c(){n.blur()}function a(){n.clear()}function u(){n.destroy()}function d(){n.focus()}function A(I){Se[I?"unshift":"push"](()=>{i=I,r(0,i)})}return t.$$set=I=>{"options"in I&&r(1,l=I.options)},[i,l,c,a,u,d,A]}class wi extends U{constructor(e){super(),N(this,e,Ii,Ei,B,{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 Ct(t){let e;const r=t[15].default,n=F(r,t,t[14],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&16384)&&q(n,r,i,i[14],e?j(r,i[14],o,null):ee(i[14]),null)},i(i){e||(f(n,i),e=!0)},o(i){g(n,i),e=!1},d(i){n&&n.d(i)}}}function yi(t){let e,r,n=t[1]&&t[0]&&Ct(t);return{c(){n&&n.c(),e=ce()},m(i,o){n&&n.m(i,o),_(i,e,o),r=!0},p(i,[o]){i[1]&&i[0]?n?(n.p(i,o),o&3&&f(n,1)):(n=Ct(i),n.c(),f(n,1),n.m(e.parentNode,e)):n&&(V(),g(n,1,1,()=>{n=null}),W())},i(i){r||(f(n),r=!0)},o(i){g(n),r=!1},d(i){i&&h(e),n&&n.d(i)}}}function ki(t,e,r){let n,{$$slots:i={},$$scope:o}=e,{stripe:s}=e,{mode:l=void 0}=e,{theme:c="stripe"}=e,{variables:a={}}=e,{rules:u={}}=e,{labels:d="above"}=e,{loader:A="auto"}=e,{fonts:I=[]}=e,{locale:P="auto"}=e,{currency:S=void 0}=e,{amount:m=void 0}=e,{clientSecret:$=void 0}=e,{elements:le=null}=e;return t.$$set=O=>{"stripe"in O&&r(1,s=O.stripe),"mode"in O&&r(2,l=O.mode),"theme"in O&&r(3,c=O.theme),"variables"in O&&r(4,a=O.variables),"rules"in O&&r(5,u=O.rules),"labels"in O&&r(6,d=O.labels),"loader"in O&&r(7,A=O.loader),"fonts"in O&&r(8,I=O.fonts),"locale"in O&&r(9,P=O.locale),"currency"in O&&r(10,S=O.currency),"amount"in O&&r(11,m=O.amount),"clientSecret"in O&&r(12,$=O.clientSecret),"elements"in O&&r(0,le=O.elements),"$$scope"in O&&r(14,o=O.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:a,rules:u,labels:d}),t.$$.dirty&16263&&s&&!le&&(r(0,le=s.elements({mode:l,currency:S,amount:m,appearance:n,clientSecret:$,fonts:I,loader:A,locale:P})),bi(s),$n("stripe",{stripe:s,elements:le})),t.$$.dirty&8705&&le&&le.update({appearance:n,locale:P})},[le,s,l,c,a,u,d,A,I,P,S,m,$,n,o,i]}class vi extends U{constructor(e){super(),N(this,e,ki,yi,B,{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 Mt="https://js.stripe.com/v3",$i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Tt="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Bi=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Mt,'"]')),r=0;r<e.length;r++){var n=e[r];if($i.test(n.src))return n}return null},Rt=function(e){var r="",n=document.createElement("script");n.src="".concat(Mt).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},Pi=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.4.0",startTime:r})},Me=null,Ye=null,He=null,Di=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Ci=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},Mi=function(e){return Me!==null?Me:(Me=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(Tt),window.Stripe){r(window.Stripe);return}try{var i=Bi();if(i&&e)console.warn(Tt);else if(!i)i=Rt(e);else if(i&&He!==null&&Ye!==null){var o;i.removeEventListener("load",He),i.removeEventListener("error",Ye),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=Rt(e)}He=Ci(r,n),Ye=Di(n),i.addEventListener("load",He),i.addEventListener("error",Ye)}catch(s){n(s);return}}),Me.catch(function(r){return Me=null,Promise.reject(r)}))},Ti=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return Pi(i,n),i},Te,Qt=!1,Ot=function(){return Te||(Te=Mi(null).catch(function(e){return Te=null,Promise.reject(e)}),Te)};Promise.resolve().then(function(){return Ot()}).catch(function(t){Qt||console.warn(t)});var Ri=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];Qt=!0;var i=Date.now();return Ot().then(function(o){return Ti(o,r,i)})};function Qi(t){T(t,"svelte-1xe711j",".rcb-header-layout.svelte-1xe711j{display:flex;justify-content:space-between;align-items:center;width:100%;font-size:24px;margin:0;font-weight:500}")}function Oi(t){let e,r;const n=t[0].default,i=F(n,t,t[1],null);return{c(){e=w("div"),i&&i.c(),b(e,"class","rcb-header-layout svelte-1xe711j")},m(o,s){_(o,e,s),i&&i.m(e,null),r=!0},p(o,s){i&&i.p&&(!r||s&2)&&q(i,n,o,o[1],r?j(n,o[1],s,null):ee(o[1]),null)},i(o){r||(f(i,o),r=!0)},o(o){g(i,o),r=!1},d(o){o&&h(e),i&&i.d(o)}}}function Ni(t){let e,r;return e=new be({props:{as:"header",$$slots:{default:[Oi]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,[i]){const o={};i&2&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Ui(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(1,i=o.$$scope)},[n,i]}class nt extends U{constructor(e){super(),N(this,e,Ui,Ni,B,{},Qi)}}const Si="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18%208H17V6C17%203.24%2014.76%201%2012%201C9.24%201%207%203.24%207%206V8H6C4.9%208%204%208.9%204%2010V20C4%2021.1%204.9%2022%206%2022H18C19.1%2022%2020%2021.1%2020%2020V10C20%208.9%2019.1%208%2018%208ZM12%2017C10.9%2017%2010%2016.1%2010%2015C10%2013.9%2010.9%2013%2012%2013C13.1%2013%2014%2013.9%2014%2015C14%2016.1%2013.1%2017%2012%2017ZM15.1%208H8.9V6C8.9%204.29%2010.29%202.9%2012%202.9C13.71%202.9%2015.1%204.29%2015.1%206V8Z'%20fill='%2311D483'/%3e%3c/svg%3e";function Li(t){let e,r;return{c(){e=w("img"),Z(e.src,r=Si)||b(e,"src",r),b(e,"alt","icon"),b(e,"class","rcb-ui-asset-icon")},m(n,i){_(n,e,i)},p,i:p,o:p,d(n){n&&h(e)}}}class Fi extends U{constructor(e){super(),N(this,e,null,Li,B,{})}}const Re={error:"#f2545b",warning:"#f4e971",focus:"#000080","grey-text-dark":"#000000","grey-text-light":"#767676","grey-ui-dark":"#dfdfdf",white:"#ffffff"};function xi(t){T(t,"svelte-rjmul6",`.processing.svelte-rjmul6{width:12px;aspect-ratio:1;border-radius:50%;animation:svelte-rjmul6-l5 1.5s infinite linear}@keyframes svelte-rjmul6-l5{0%{box-shadow:20px 0 #fff2,
1
+ (function(E,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(E=typeof globalThis<"u"?globalThis:E||self,h(E.Purchases={}))})(this,function(E){"use strict";var kl=Object.create;var gt=Object.defineProperty;var Pl=Object.getOwnPropertyDescriptor;var Tn=(E,h)=>(h=Symbol[E])?h:Symbol.for("Symbol."+E),Be=E=>{throw TypeError(E)};var An=(E,h,B)=>h in E?gt(E,h,{enumerable:!0,configurable:!0,writable:!0,value:B}):E[h]=B;var $n=(E,h)=>gt(E,"name",{value:h,configurable:!0});var On=E=>[,,,kl((E==null?void 0:E[Tn("metadata")])??null)],Nn=["class","method","getter","setter","accessor","field","value","get","set"],De=E=>E!==void 0&&typeof E!="function"?Be("Function expected"):E,Tl=(E,h,B,oe,G)=>({kind:Nn[E],name:h,metadata:oe,addInitializer:Y=>B._?Be("Already initialized"):G.push(De(Y||null))}),ht=(E,h)=>An(h,Tn("metadata"),E[3]),Un=(E,h,B,oe)=>{for(var G=0,Y=E[h>>1],ne=Y&&Y.length;G<ne;G++)h&1?Y[G].call(B):oe=Y[G].call(B,oe);return oe},Rn=(E,h,B,oe,G,Y)=>{var ne,A,pe,ce,ge,F=h&7,$e=!!(h&8),H=!!(h&16),he=F>3?E.length+1:F?$e?1:2:0,z=Nn[F+5],W=F>3&&(E[he-1]=[]),K=E[he]||(E[he]=[]),re=F&&(!H&&!$e&&(G=G.prototype),F<5&&(F>3||!H)&&Pl(F<4?G:{get[B](){return kn(this,Y)},set[B](R){return Pn(this,Y,R)}},B));F?H&&F<4&&$n(Y,(F>2?"set ":F>1?"get ":"")+B):$n(G,B);for(var L=oe.length-1;L>=0;L--)ce=Tl(F,B,pe={},E[3],K),F&&(ce.static=$e,ce.private=H,ge=ce.access={has:H?R=>Al(G,R):R=>B in R},F^3&&(ge.get=H?R=>(F^1?kn:Ol)(R,G,F^4?Y:re.get):R=>R[B]),F>2&&(ge.set=H?(R,ke)=>Pn(R,G,ke,F^4?Y:re.set):(R,ke)=>R[B]=ke)),A=(0,oe[L])(F?F<4?H?Y:re[z]:F>4?void 0:{get:re.get,set:re.set}:G,ce),pe._=1,F^4||A===void 0?De(A)&&(F>4?W.unshift(A):F?H?Y=A:re[z]=A:G=A):typeof A!="object"||A===null?Be("Object expected"):(De(ne=A.get)&&(re.get=ne),De(ne=A.set)&&(re.set=ne),De(ne=A.init)&&W.unshift(ne));return F||ht(E,G),re&&gt(G,B,re),H?F^4?Y:re:G},M=(E,h,B)=>An(E,typeof h!="symbol"?h+"":h,B),bt=(E,h,B)=>h.has(E)||Be("Cannot "+B),Al=(E,h)=>Object(h)!==h?Be('Cannot use the "in" operator on this value'):E.has(h),kn=(E,h,B)=>(bt(E,h,"read from private field"),B?B.call(E):h.get(E));var Pn=(E,h,B,oe)=>(bt(E,h,"write to private field"),oe?oe.call(E,B):h.set(E,B),B),Ol=(E,h,B)=>(bt(E,h,"access private method"),B);var vn,_t;function h(){}function B(t,e){for(const r in e)t[r]=e[r];return t}function oe(t){return t()}function G(){return Object.create(null)}function Y(t){t.forEach(oe)}function ne(t){return typeof t=="function"}function A(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let pe;function ce(t,e){return t===e?!0:(pe||(pe=document.createElement("a")),pe.href=e,t===pe.href)}function ge(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function F(t,e){const r=ge(t.srcset),n=ge(e||"");return n.length===r.length&&n.every(([i,o],s)=>o===r[s][1]&&(ce(r[s][0],i)||ce(i,r[s][0])))}function $e(t){return Object.keys(t).length===0}function H(t,e,r,n){if(t){const i=he(t,e,r,n);return t[0](i)}}function he(t,e,r,n){return t[1]&&n?B(r.ctx.slice(),t[1](n(e))):r.ctx}function z(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 o=[],s=Math.max(e.dirty.length,i.length);for(let l=0;l<s;l+=1)o[l]=e.dirty[l]|i[l];return o}return e.dirty|i}return e.dirty}function W(t,e,r,n,i,o){if(i){const s=he(e,r,n,o);t.p(s,i)}}function K(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 re(t){return t??""}function L(t,e){t.appendChild(e)}function R(t,e,r){const n=ke(t);if(!n.getElementById(e)){const i=v("style");i.id=e,i.textContent=r,Ln(n,i)}}function ke(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Ln(t,e){return L(t.head||t,e),e.sheet}function g(t,e,r){t.insertBefore(e,r||null)}function _(t){t.parentNode&&t.parentNode.removeChild(t)}function v(t){return document.createElement(t)}function V(t){return document.createTextNode(t)}function S(){return V(" ")}function ae(){return V("")}function Pe(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function wt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function b(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}const Sn=["width","height"];function Mn(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&&Sn.indexOf(n)===-1?t[n]=e[n]:b(t,n,e[n])}function Dn(t,e){Object.keys(e).forEach(r=>{Bn(t,r,e[r])})}function Bn(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:b(t,e,r)}function Cn(t){return/-/.test(t)?Dn:Mn}function jn(t){return Array.from(t.childNodes)}function ue(t,e){e=""+e,t.data!==e&&(t.data=e)}function yt(t,e){t.value=e??""}function fe(t,e,r,n){r==null?t.style.removeProperty(e):t.style.setProperty(e,r,"")}function Fn(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let Te;function Ae(t){Te=t}function Oe(){if(!Te)throw new Error("Function called outside component initialization");return Te}function Hn(t){Oe().$$.before_update.push(t)}function Ce(t){Oe().$$.on_mount.push(t)}function qn(){const t=Oe();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Fn(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function xn(t,e){return Oe().$$.context.set(t,e),e}function Gn(t){return Oe().$$.context.get(t)}function Et(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const be=[],je=[];let we=[];const Xe=[],Vn=Promise.resolve();let Ze=!1;function Yn(){Ze||(Ze=!0,Vn.then(vt))}function Je(t){we.push(t)}function zn(t){Xe.push(t)}const et=new Set;let ye=0;function vt(){if(ye!==0)return;const t=Te;do{try{for(;ye<be.length;){const e=be[ye];ye++,Ae(e),Wn(e.$$)}}catch(e){throw be.length=0,ye=0,e}for(Ae(null),be.length=0,ye=0;je.length;)je.pop()();for(let e=0;e<we.length;e+=1){const r=we[e];et.has(r)||(et.add(r),r())}we.length=0}while(be.length);for(;Xe.length;)Xe.pop()();Ze=!1,et.clear(),Ae(t)}function Wn(t){if(t.fragment!==null){t.update(),Y(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Je)}}function Kn(t){const e=[],r=[];we.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),we=e}const Fe=new Set;let me;function Q(){me={r:0,c:[],p:me}}function X(){me.r||Y(me.c),me=me.p}function d(t,e){t&&t.i&&(Fe.delete(t),t.i(e))}function p(t,e,r,n){if(t&&t.o){if(Fe.has(t))return;Fe.add(t),me.c.push(()=>{Fe.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function Qn(t,e,r){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function T(t){t&&t.c()}function k(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),Je(()=>{const o=t.$$.on_mount.map(oe).filter(ne);t.$$.on_destroy?t.$$.on_destroy.push(...o):Y(o),t.$$.on_mount=[]}),i.forEach(Je)}function P(t,e){const r=t.$$;r.fragment!==null&&(Kn(r.after_update),Y(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function Xn(t,e){t.$$.dirty[0]===-1&&(be.push(t),Yn(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function C(t,e,r,n,i,o,s=null,l=[-1]){const a=Te;Ae(t);const c=t.$$={fragment:null,ctx:[],props:o,update:h,not_equal:i,bound:G(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:G(),dirty:l,skip_bound:!1,root:e.target||a.$$.root};s&&s(c.root);let u=!1;if(c.ctx=r?r(t,e.props||{},(f,m,...w)=>{const I=w.length?w[0]:m;return c.ctx&&i(c.ctx[f],c.ctx[f]=I)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](I),u&&Xn(t,f)),m}):[],c.update(),u=!0,Y(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const f=jn(e.target);c.fragment&&c.fragment.l(f),f.forEach(_)}else c.fragment&&c.fragment.c();e.intro&&d(t.$$.fragment),k(t,e.target,e.anchor),vt()}Ae(a)}class j{constructor(){M(this,"$$");M(this,"$$set")}$destroy(){P(this,1),this.$destroy=h}$on(e,r){if(!ne(r))return h;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&&!$e(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Zn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zn);function Jn(t){R(t,"svelte-1bzqb13",".rcb-modal-section.svelte-1bzqb13{padding:8px 0px;display:flex}section.rcb-modal-section.svelte-1bzqb13{flex-grow:1}.rcb-modal-section.svelte-1bzqb13:last-of-type{padding:0}")}function tt(t){let e,r;const n=t[2].default,i=H(n,t,t[1],null);return{c(){e=v(t[0]),i&&i.c(),Cn(t[0])(e,{class:re("rcb-modal-section")+" svelte-1bzqb13"})},m(o,s){g(o,e,s),i&&i.m(e,null),r=!0},p(o,s){i&&i.p&&(!r||s&2)&&W(i,n,o,o[1],r?z(n,o[1],s,null):K(o[1]),null)},i(o){r||(d(i,o),r=!0)},o(o){p(i,o),r=!1},d(o){o&&_(e),i&&i.d(o)}}}function er(t){let e=t[0],r,n,i=t[0]&&tt(t);return{c(){i&&i.c(),r=ae()},m(o,s){i&&i.m(o,s),g(o,r,s),n=!0},p(o,[s]){o[0]?e?A(e,o[0])?(i.d(1),i=tt(o),e=o[0],i.c(),i.m(r.parentNode,r)):i.p(o,s):(i=tt(o),e=o[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=o[0])},i(o){n||(d(i,o),n=!0)},o(o){p(i,o),n=!1},d(o){o&&_(r),i&&i.d(o)}}}function tr(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:o="section"}=e;return t.$$set=s=>{"as"in s&&r(0,o=s.as),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class Ee extends j{constructor(e){super(),C(this,e,tr,er,A,{as:0},Jn)}}var se=(t=>(t[t.Silent=0]="Silent",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug",t[t.Verbose=5]="Verbose",t))(se||{});class q{static setLogLevel(e){this.logLevel=e}static log(e,r=this.logLevel){const n=`[Purchases] ${e}`;if(!(this.logLevel<r||r===se.Silent))switch(r){case se.Error:console.error(n);break;case se.Warn:console.warn(n);break;case se.Info:console.info(n);break;case se.Debug:console.debug(n);break;case se.Verbose:console.debug(n);break}}static errorLog(e){this.log(e,se.Error)}static warnLog(e){this.log(e,se.Warn)}static infoLog(e){this.log(e,se.Info)}static debugLog(e){this.log(e,se.Debug)}static verboseLog(e){this.log(e,se.Verbose)}}M(q,"logLevel",se.Silent);var de=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(de||{});function nt(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return q.errorLog(`Invalid ISO 8601 duration format: ${t}`),null;const r=parseInt(e[1]);switch(e[2]){case"Y":return{number:r,unit:"year"};case"M":return{number:r,unit:"month"};case"W":return{number:r,unit:"week"};case"D":return{number:r,unit:"day"};default:return q.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}const nr=(t,e,r)=>{const n=t/1e6;return new Intl.NumberFormat(r,{style:"currency",currency:e}).format(n)},rr=t=>{const e=t.number;if(e===1)switch(t.unit){case de.Year:return"yearly";case de.Month:return"monthly";case de.Week:return"weekly";case de.Day:return"daily"}else return`every ${e} ${t.unit}s`},ir=t=>{const e=t.number;if(e===1)switch(t.unit){case de.Year:return"1 year";case de.Month:return"1 month";case de.Week:return"1 week";case de.Day:return"1 day"}else return`${e} ${t.unit}s`},It=t=>{const e=nt(t);return e?rr(e):"unknown"},or=t=>{const e=nt(t);return e?ir(e):"unknown"};function sr(t){return t!=null}var $t=(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))($t||{}),ve=(t=>(t.Subscription="subscription",t.Consumable="consumable",t.NonConsumable="non_consumable",t))(ve||{});const kt=t=>({amount:t.amount_micros/1e4,amountMicros:t.amount_micros,currency:t.currency,formattedPrice:nr(t.amount_micros,t.currency)}),Pt=t=>{const e=t.period_duration;return{periodDuration:e,period:e?nt(e):null,cycleCount:t.cycle_count,price:t.price?kt(t.price):null}},lr=t=>t.base==null?(q.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,base:Pt(t.base),trial:t.trial?Pt(t.trial):null},ar=t=>t.base_price==null?(q.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,basePrice:kt(t.base_price)},cr=(t,e)=>{const r=t.product_type;return r==="subscription"?fr(t,e,r):ur(t,e,r)},ur=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([s,l])=>{const a=ar(l);a!=null&&(n[s]=a)}),Object.keys(n).length===0)return q.debugLog(`Product ${t.identifier} has no purchase options. Ignoring.`),null;const i=t.default_purchase_option_id,o=i&&i in t.purchase_options?n[i]:null;return o==null?(q.debugLog(`Product ${t.identifier} has no default purchase option. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:r,currentPrice:o.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:o,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:o}},fr=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([l,a])=>{const c=lr(a);c!=null&&(n[l]=c)}),Object.keys(n).length===0)return q.debugLog(`Product ${t.identifier} has no subscription options. Ignoring.`),null;const i=t.default_purchase_option_id,o=i&&i in n?n[i]:null;if(o==null)return q.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const s=o.base.price;return s==null?(q.debugLog(`Product ${t.identifier} default option has no base price. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:r,currentPrice:s,normalPeriodDuration:o.base.periodDuration,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:o,defaultSubscriptionOption:o,subscriptionOptions:n,defaultNonSubscriptionOption:null}},dr=(t,e,r)=>{const n=r[e.platform_product_identifier];if(n===void 0)return null;const i=cr(n,t);return i===null?null:{identifier:e.identifier,rcBillingProduct:i,packageType:mr(e.identifier)}},pr=(t,e,r,n)=>{const i={offeringIdentifier:e.identifier,targetingContext:t&&n?{ruleId:n.rule_id,revision:n.revision}:null,placementIdentifier:null},o=e.packages.map(l=>dr(i,l,r)).filter(sr),s={};for(const l of o)l!=null&&(s[l.identifier]=l);return o.length==0?null:{identifier:e.identifier,serverDescription:e.description,metadata:e.metadata,packagesById:s,availablePackages:o,lifetime:s.$rc_lifetime??null,annual:s.$rc_annual??null,sixMonth:s.$rc_six_month??null,threeMonth:s.$rc_three_month??null,twoMonth:s.$rc_two_month??null,monthly:s.$rc_monthly??null,weekly:s.$rc_weekly??null}};function mr(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 _r(t){R(t,"svelte-1mdrqnh",".rcb-pricing-info.svelte-1mdrqnh{display:flex;flex-direction:column;margin-top:102px;font-weight:500}.rcb-product-price.svelte-1mdrqnh{color:var(--rc-color-grey-text-dark);font-size:24px;margin:12px 0px}.rcb-product-description.svelte-1mdrqnh{color:var(--rc-color-grey-text-dark);margin:0 0 12px 0}.rcb-product-price-after-trial.svelte-1mdrqnh{margin-bottom:12px}.rcb-product-details.svelte-1mdrqnh{color:var(--rc-color-grey-text-light);list-style-type:disc;list-style-position:inside;margin:0px;padding:0px}@media screen and (max-width: 960px){.rcb-pricing-info.svelte-1mdrqnh{margin-top:48px}}")}function gr(t){var y,N,ie;let e,r,n,i,o,s,l,a,c,u,f=((y=t[3])==null?void 0:y.periodDuration)&&hr(t),m=!((N=t[3])!=null&&N.periodDuration)&&t[4]&&br(t),w=t[3]&&t[4]&&wr(t),I=((ie=t[1])==null?void 0:ie.show_product_description)&&t[0].description&&Tt(t),O=t[0].normalPeriodDuration&&At(t);return{c(){e=v("span"),f&&f.c(),r=S(),m&&m.c(),n=S(),w&&w.c(),i=S(),I&&I.c(),o=S(),s=v("ul"),O&&O.c(),l=S(),a=v("li"),a.textContent="Continues until canceled",c=S(),u=v("li"),u.textContent="Cancel anytime",b(e,"class","rcb-product-price svelte-1mdrqnh"),b(s,"class","rcb-product-details svelte-1mdrqnh")},m($,U){g($,e,U),f&&f.m(e,null),L(e,r),m&&m.m(e,null),g($,n,U),w&&w.m($,U),g($,i,U),I&&I.m($,U),g($,o,U),g($,s,U),O&&O.m(s,null),L(s,l),L(s,a),L(s,c),L(s,u)},p($,U){var x,Ke,Qe;(x=$[3])!=null&&x.periodDuration&&f.p($,U),!((Ke=$[3])!=null&&Ke.periodDuration)&&$[4]&&m.p($,U),$[3]&&$[4]&&w.p($,U),(Qe=$[1])!=null&&Qe.show_product_description&&$[0].description?I?I.p($,U):(I=Tt($),I.c(),I.m(o.parentNode,o)):I&&(I.d(1),I=null),$[0].normalPeriodDuration?O?O.p($,U):(O=At($),O.c(),O.m(s,l)):O&&(O.d(1),O=null)},d($){$&&(_(e),_(n),_(i),_(o),_(s)),f&&f.d(),m&&m.d(),w&&w.d($),I&&I.d($),O&&O.d()}}}function hr(t){let e=or(t[3].periodDuration)+"",r,n;return{c(){r=V(e),n=V(" free trial")},m(i,o){g(i,r,o),g(i,n,o)},p:h,d(i){i&&(_(r),_(n))}}}function br(t){let e=t[4].formattedPrice+"",r;return{c(){r=V(e)},m(n,i){g(n,r,i)},p:h,d(n){n&&_(r)}}}function wr(t){let e;return{c(){e=v("span"),e.textContent=`${t[3]&&t[4]&&`${t[4].formattedPrice} after end of trial`}`,b(e,"class","rcb-product-price-after-trial svelte-1mdrqnh")},m(r,n){g(r,e,n)},p:h,d(r){r&&_(e)}}}function Tt(t){let e,r=t[0].description+"",n;return{c(){e=v("span"),n=V(r),b(e,"class","rcb-product-description svelte-1mdrqnh")},m(i,o){g(i,e,o),L(e,n)},p(i,o){o&1&&r!==(r=i[0].description+"")&&ue(n,r)},d(i){i&&_(e)}}}function At(t){let e,r,n=It(t[0].normalPeriodDuration)+"",i;return{c(){e=v("li"),r=V("Renews "),i=V(n)},m(o,s){g(o,e,s),L(e,r),L(e,i)},p(o,s){s&1&&n!==(n=It(o[0].normalPeriodDuration)+"")&&ue(i,n)},d(o){o&&_(e)}}}function yr(t){var o;let e,r,n,i=((o=t[1])==null?void 0:o.show_product_description)&&Ot(t);return{c(){var s;e=v("span"),e.textContent=`${(s=t[5])==null?void 0:s.formattedPrice}`,r=S(),i&&i.c(),n=ae(),b(e,"class","rcb-product-price svelte-1mdrqnh")},m(s,l){g(s,e,l),g(s,r,l),i&&i.m(s,l),g(s,n,l)},p(s,l){var a;(a=s[1])!=null&&a.show_product_description?i?i.p(s,l):(i=Ot(s),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(s){s&&(_(e),_(r),_(n)),i&&i.d(s)}}}function Ot(t){let e,r=t[0].description+"",n;return{c(){e=v("span"),n=V(r),b(e,"class","rcb-product-description svelte-1mdrqnh")},m(i,o){g(i,e,o),L(e,n)},p(i,o){o&1&&r!==(r=i[0].description+"")&&ue(n,r)},d(i){i&&_(e)}}}function Er(t){let e,r,n=t[0].title+"",i,o,s,l=t[2]&&gr(t),a=!t[2]&&yr(t);return{c(){e=v("div"),r=v("span"),i=V(n),o=S(),l&&l.c(),s=S(),a&&a.c(),b(r,"class","rc-product-title"),b(e,"class","rcb-pricing-info svelte-1mdrqnh")},m(c,u){g(c,e,u),L(e,r),L(r,i),L(e,o),l&&l.m(e,null),L(e,s),a&&a.m(e,null)},p(c,u){u&1&&n!==(n=c[0].title+"")&&ue(i,n),c[2]&&l.p(c,u),c[2]||a.p(c,u)},d(c){c&&_(e),l&&l.d(),a&&a.d()}}}function vr(t){let e,r;return e=new Ee({props:{$$slots:{default:[Er]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,[i]){const o={};i&515&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Ir(t,e,r){var m;let{productDetails:n}=e,{purchaseOption:i}=e,{brandingAppearance:o=void 0}=e;const s=n.productType===ve.Subscription,l=i,a=i,c=l==null?void 0:l.trial,u=(m=l==null?void 0:l.base)==null?void 0:m.price,f=a==null?void 0:a.basePrice;return t.$$set=w=>{"productDetails"in w&&r(0,n=w.productDetails),"purchaseOption"in w&&r(6,i=w.purchaseOption),"brandingAppearance"in w&&r(1,o=w.brandingAppearance)},[n,o,s,c,u,f,i]}class Nt extends j{constructor(e){super(),C(this,e,Ir,vr,A,{productDetails:0,purchaseOption:6,brandingAppearance:1},_r)}}const $r='<svg width="80" height="80" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" transform="rotate(0 0 0)"><path d="M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 11.5858 20.8358 11.25 21.25 11.25C21.6642 11.25 22 11.5858 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C12.4142 2 12.75 2.33579 12.75 2.75C12.75 3.16421 12.4142 3.5 12 3.5Z" fill="currentColor"/></svg>';function kr(t){R(t,"svelte-16h2a8k","@-webkit-keyframes svelte-16h2a8k-rotating{from{-webkit-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes svelte-16h2a8k-rotating{from{-ms-transform:rotate(0deg);-moz-transform:rotate(0deg);-webkit-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}to{-ms-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}div.svelte-16h2a8k{width:80px;height:80px;-webkit-animation:svelte-16h2a8k-rotating 2s ease-in-out infinite;-moz-animation:svelte-16h2a8k-rotating 2s ease-in-out infinite;-ms-animation:svelte-16h2a8k-rotating 2s ease-in-out infinite;-o-animation:svelte-16h2a8k-rotating 2s ease-in-out infinite;animation:svelte-16h2a8k-rotating 2s ease-in-out infinite}")}function Pr(t){let e;return{c(){e=v("div"),fe(e,"color","var(--rc-color-accent)"),b(e,"class","rcb-ui-asset-icon svelte-16h2a8k")},m(r,n){g(r,e,n),e.innerHTML=$r},p:h,i:h,o:h,d(r){r&&_(e)}}}class Tr extends j{constructor(e){super(),C(this,e,null,Pr,A,{},kr)}}function Ar(t){R(t,"svelte-l57ojl",".rcb-modal-loader.svelte-l57ojl{width:100%;flex-grow:1;min-height:100%;display:flex;justify-content:center;align-items:center}")}function Or(t){let e,r,n;return r=new Tr({}),{c(){e=v("div"),T(r.$$.fragment),b(e,"class","rcb-modal-loader svelte-l57ojl")},m(i,o){g(i,e,o),k(r,e,null),n=!0},p:h,i(i){n||(d(r.$$.fragment,i),n=!0)},o(i){p(r.$$.fragment,i),n=!1},d(i){i&&_(e),P(r)}}}class rt extends j{constructor(e){super(),C(this,e,null,Or,A,{},Ar)}}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[t.InvalidEmailError=38]="InvalidEmailError",t))(ee||{});class Ne{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. Please check your network connection and try again.";case 11:return"There was a credentials issue. Check the underlying error for more details.";case 12:return"Received unexpected response from the backend.";case 14:return"The app user id is not valid.";case 15:return"The operation is already in progress.";case 16:return"There was an unknown backend error.";case 17:return"Apple Subscription Key is invalid or not present. In order to provide subscription offers, you must first generate a subscription key. Please see https://docs.revenuecat.com/docs/ios-subscription-offers for more info.";case 18:return"The User is ineligible for that action.";case 19:return"App does not have sufficient permissions to make purchases.";case 20:return"The payment is pending.";case 21:return"One or more of the attributes sent could not be saved.";case 22:return"Called logOut but the current user is anonymous.";case 23:return"There is an issue with your configuration. Check the underlying error for more details.";case 24:return"There was a problem with the operation. Looks like we doesn't support that yet. Check the underlying error for more details.";case 25:return"A request for subscriber attributes returned none.";case 28:return"There was a problem related to the customer info.";case 36:return"Request failed signature verification. Please see https://rev.cat/trusted-entitlements for more info.";case 38:return"Email is not valid. Please provide a valid email address."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:case 7773:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:case 7814:return 4;case 7772:return 6;case 7220:return 14;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:return 38}}static convertCodeToBackendErrorCode(e){return e in Ut?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case te.ErrorSettingUpPurchase:return 2;case te.ErrorChargingPayment:return 20;case te.NetworkError:return 10;case te.MissingEmailError:return 4;case te.StripeError:return 2;case te.UnknownError:return 0;case te.AlreadyPurchasedError:return 6}}}var Ut=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendInvalidEmail=7012]="BackendInvalidEmail",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[t.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",t[t.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",t[t.BackendOfferNotFound=7814]="BackendOfferNotFound",t[t.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",t))(Ut||{});class Z extends Error{constructor(r,n,i,o){super(n);M(this,"toString",()=>`PurchasesError(code: ${ee[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i,this.extra=o}static getForBackendError(r,n){const i=Ne.getErrorCodeForBackendErrorCode(r);return new Z(i,Ne.getPublicMessage(i),n,{backendErrorCode:r})}static getForPurchasesFlowError(r){return new Z(Ne.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class Rt extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Ue=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Ue||{}),He=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(He||{}),te=(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[t.AlreadyPurchasedError=6]="AlreadyPurchasedError",t))(te||{});class J extends Error{constructor(e,r,n,i,o){super(r),this.errorCode=e,this.underlyingErrorMessage=n,this.purchasesErrorCode=i,this.extra=o}isRecoverable(){switch(this.errorCode){case 3:case 5:return!0;case 0:case 1:case 6:case 4:case 2:return!1}}getPublicErrorMessage(e){var n;const r=((n=this.extra)==null?void 0:n.backendErrorCode)??this.purchasesErrorCode??this.errorCode;switch(this.errorCode){case 2:return`An unknown error occurred. Error code: ${r}.`;case 0:return`Purchase not started due to an error. Error code: ${r}.`;case 1:return"Payment failed.";case 3:return"Network error. Please check your internet connection.";case 4:return this.message;case 5:return"Email is required to complete the purchase.";case 6:return(e==null?void 0:e.productType)===ve.Subscription?"You are already subscribed to this product.":"You have already purchased this product."}}static fromPurchasesError(e,r){let n;return e.errorCode===ee.ProductAlreadyPurchasedError?n=6:e.errorCode===ee.InvalidEmailError?n=5:e.errorCode===ee.NetworkError?n=3:n=r,new J(n,e.message,e.underlyingErrorMessage,e.errorCode,e.extra)}}class Nr{constructor(e,r=10){M(this,"operationSessionId",null);M(this,"backend");M(this,"maxNumberAttempts");M(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=r}async startPurchase(e,r,n,i,o){try{const s=await this.backend.postPurchase(e,r,i,o,n);return this.operationSessionId=s.operation_session_id,s}catch(s){if(s instanceof Z)throw J.fromPurchasesError(s,0);{const l="Unknown error starting purchase: "+String(s);throw q.errorLog(l),new J(2,l)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new J(0,"No purchase in progress");return new Promise((r,n)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new J(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(s=>{switch(s.operation.status){case Ue.Started:case Ue.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case Ue.Succeeded:this.clearPurchaseInProgress(),r();return;case Ue.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(s.operation.error,n)}}).catch(s=>{const l=J.fromPurchasesError(s,3);n(l)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new J(2,"Got an error status but error field is empty."));return}switch(e.code){case He.SetupIntentCreationFailed:r(new J(0,"Setup intent creation failed"));return;case He.PaymentMethodCreationFailed:r(new J(0,"Payment method creation failed"));return;case He.PaymentChargeFailed:r(new J(1,"Payment charge failed"));return}}}const Ur=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="62" cy="62" r="62" fill="currentColor"/>
3
+ <path d="M87.6668 41.504L82.4968 36.334L62.0002 56.8307L41.5035 36.334L36.3335 41.504L56.8302 62.0006L36.3335 82.4973L41.5035 87.6673L62.0002 67.1706L82.4968 87.6673L87.6668 82.4973L67.1702 62.0006L87.6668 41.504Z"
4
+ fill="white"/>
5
+ </svg>
6
+ `;function Rr(t){R(t,"svelte-7wiquz",".rcb-ui-asset-icon.svelte-7wiquz{width:96px;height:96px;margin:0 auto}")}function Lr(t){let e;return{c(){e=v("div"),fe(e,"color","var(--rc-color-error)"),b(e,"class","rcb-ui-asset-icon svelte-7wiquz")},m(r,n){g(r,e,n),e.innerHTML=Ur},p:h,i:h,o:h,d(r){r&&_(e)}}}class Sr extends j{constructor(e){super(),C(this,e,null,Lr,A,{},Rr)}}function Mr(t){R(t,"svelte-2xwwo","button.svelte-2xwwo{border:none;border-radius:var(--rc-shape-input-button-border-radius);font-size:16px;cursor:pointer;height:56px;color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);-webkit-tap-highlight-color:transparent}button.svelte-2xwwo:focus,button.svelte-2xwwo:active{outline:2px solid var(--rc-color-focus)}button.intent-primary.svelte-2xwwo{background-color:var(--rc-color-primary);color:var(--rc-color-primary-text);font-size:16px}button.svelte-2xwwo:disabled{color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark)}button.intent-primary.svelte-2xwwo:disabled{color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark)}")}function Dr(t){let e,r,n,i,o;const s=t[5].default,l=H(s,t,t[4],null);return{c(){e=v("button"),l&&l.c(),b(e,"class",r=re(`intent-${t[0]}`)+" svelte-2xwwo"),e.disabled=t[1],b(e,"data-testid",t[2]),b(e,"type",t[3])},m(a,c){g(a,e,c),l&&l.m(e,null),n=!0,i||(o=Pe(e,"click",t[6]),i=!0)},p(a,[c]){l&&l.p&&(!n||c&16)&&W(l,s,a,a[4],n?z(s,a[4],c,null):K(a[4]),null),(!n||c&1&&r!==(r=re(`intent-${a[0]}`)+" svelte-2xwwo"))&&b(e,"class",r),(!n||c&2)&&(e.disabled=a[1]),(!n||c&4)&&b(e,"data-testid",a[2]),(!n||c&8)&&b(e,"type",a[3])},i(a){n||(d(l,a),n=!0)},o(a){p(l,a),n=!1},d(a){a&&_(e),l&&l.d(a),i=!1,o()}}}function Br(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:o="primary"}=e,{disabled:s=!1}=e,{testId:l=void 0}=e,{type:a=void 0}=e;function c(u){Et.call(this,t,u)}return t.$$set=u=>{"intent"in u&&r(0,o=u.intent),"disabled"in u&&r(1,s=u.disabled),"testId"in u&&r(2,l=u.testId),"type"in u&&r(3,a=u.type),"$$scope"in u&&r(4,i=u.$$scope)},[o,s,l,a,i,n,c]}class it extends j{constructor(e){super(),C(this,e,Br,Dr,A,{intent:0,disabled:1,testId:2,type:3},Mr)}}function Cr(t){R(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function jr(t){let e,r;const n=t[1].default,i=H(n,t,t[0],null);return{c(){e=v("footer"),i&&i.c(),b(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(o,s){g(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&1)&&W(i,n,o,o[0],r?z(n,o[0],s,null):K(o[0]),null)},i(o){r||(d(i,o),r=!0)},o(o){p(i,o),r=!1},d(o){o&&_(e),i&&i.d(o)}}}function Fr(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}class ot extends j{constructor(e){super(),C(this,e,Fr,jr,A,{},Cr)}}function Hr(t){R(t,"svelte-6o8e90",'.column.svelte-6o8e90{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "8px");flex-grow:1}')}function qr(t){let e,r,n;const i=t[2].default,o=H(i,t,t[1],null);return{c(){e=v("div"),o&&o.c(),b(e,"class","column svelte-6o8e90"),b(e,"style",r=`--gap:${t[0]};`)},m(s,l){g(s,e,l),o&&o.m(e,null),n=!0},p(s,[l]){o&&o.p&&(!n||l&2)&&W(o,i,s,s[1],n?z(i,s[1],l,null):K(s[1]),null),(!n||l&1&&r!==(r=`--gap:${s[0]};`))&&b(e,"style",r)},i(s){n||(d(o,s),n=!0)},o(s){p(o,s),n=!1},d(s){s&&_(e),o&&o.d(s)}}}function xr(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:o="8px"}=e;return t.$$set=s=>{"gutter"in s&&r(0,o=s.gutter),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class Re extends j{constructor(e){super(),C(this,e,xr,qr,A,{gutter:0},Hr)}}const Gr="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 Vr(t){R(t,"svelte-1hv9ta1",".close-button.svelte-1hv9ta1{border:none;cursor:pointer;background-color:transparent;padding:0px;height:24px;border-radius:50%}.close-button.svelte-1hv9ta1:focus{outline:2px solid var(--rc-color-focus)}")}function Yr(t){let e,r,n,i,o;return{c(){e=v("button"),r=v("img"),ce(r.src,n=Gr)||b(r,"src",n),b(r,"alt","close"),b(e,"class","close-button svelte-1hv9ta1"),e.disabled=t[0]},m(s,l){g(s,e,l),L(e,r),i||(o=Pe(e,"click",t[1]),i=!0)},p(s,[l]){l&1&&(e.disabled=s[0])},i:h,o:h,d(s){s&&_(e),i=!1,o()}}}function zr(t,e,r){let{disabled:n=!1}=e;function i(o){Et.call(this,t,o)}return t.$$set=o=>{"disabled"in o&&r(0,n=o.disabled)},[n,i]}class st extends j{constructor(e){super(),C(this,e,zr,Yr,A,{disabled:0},Vr)}}function Wr(t){R(t,"svelte-44qpq9",".rcb-app-icon.svelte-44qpq9{width:40px;height:40px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:16px}.rcb-app-icon-picture-container.svelte-44qpq9{height:40px}.rcb-app-icon.loading.svelte-44qpq9{background-color:gray}")}function Kr(t){let e;return{c(){e=v("div"),b(e,"class","rcb-app-icon loading svelte-44qpq9")},m(r,n){g(r,e,n)},p:h,d(r){r&&_(e)}}}function Qr(t){let e,r,n,i,o,s;return{c(){e=v("picture"),r=v("source"),i=S(),o=v("img"),b(r,"type","image/webp"),F(r,n=t[1])||b(r,"srcset",n),b(o,"class","rcb-app-icon svelte-44qpq9"),ce(o.src,s=t[0])||b(o,"src",s),b(o,"alt","App icon"),b(e,"class","rcb-app-icon-picture-container svelte-44qpq9")},m(l,a){g(l,e,a),L(e,r),L(e,i),L(e,o)},p(l,a){a&2&&n!==(n=l[1])&&b(r,"srcset",n),a&1&&!ce(o.src,s=l[0])&&b(o,"src",s)},d(l){l&&_(e)}}}function Xr(t){let e;function r(o,s){return o[0]!==null?Qr:Kr}let n=r(t),i=n(t);return{c(){i.c(),e=ae()},m(o,s){i.m(o,s),g(o,e,s)},p(o,[s]){n===(n=r(o))&&i?i.p(o,s):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:h,o:h,d(o){o&&_(e),i.d(o)}}}function Zr(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=o=>{"src"in o&&r(0,n=o.src),"srcWebp"in o&&r(1,i=o.srcWebp)},[n,i]}class Lt extends j{constructor(e){super(),C(this,e,Zr,Xr,A,{src:0,srcWebp:1},Wr)}}const qe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Jr(t){R(t,"svelte-10uf5fq",".app-title.svelte-10uf5fq{font-weight:500;margin:8px 0;font-size:16px}.rcb-header-layout__business-info.svelte-10uf5fq{display:flex;align-items:center}")}function ei(t){let e,r;return e=new Lt({}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p:h,i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function ti(t){let e,r,n=t[0].seller_company_name+"",i,o,s=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&St(t);return{c(){s&&s.c(),e=S(),r=v("span"),i=V(n),b(r,"class","app-title svelte-10uf5fq")},m(l,a){s&&s.m(l,a),g(l,e,a),g(l,r,a),L(r,i),o=!0},p(l,a){l[0].app_icon_webp!==null&&l[0].app_icon!==null?s?(s.p(l,a),a&1&&d(s,1)):(s=St(l),s.c(),d(s,1),s.m(e.parentNode,e)):s&&(Q(),p(s,1,1,()=>{s=null}),X()),(!o||a&1)&&n!==(n=l[0].seller_company_name+"")&&ue(i,n)},i(l){o||(d(s),o=!0)},o(l){p(s),o=!1},d(l){l&&(_(e),_(r)),s&&s.d(l)}}}function St(t){let e,r;return e=new Lt({props:{src:qe(t[0].app_icon),srcWebp:qe(t[0].app_icon_webp)}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&1&&(o.src=qe(n[0].app_icon)),i&1&&(o.srcWebp=qe(n[0].app_icon_webp)),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function ni(t){let e,r,n,i;const o=[ti,ei],s=[];function l(a,c){return a[0]!==null?0:1}return r=l(t),n=s[r]=o[r](t),{c(){e=v("div"),n.c(),b(e,"class","rcb-header-layout__business-info svelte-10uf5fq")},m(a,c){g(a,e,c),s[r].m(e,null),i=!0},p(a,[c]){let u=r;r=l(a),r===u?s[r].p(a,c):(Q(),p(s[u],1,1,()=>{s[u]=null}),X(),n=s[r],n?n.p(a,c):(n=s[r]=o[r](a),n.c()),d(n,1),n.m(e,null))},i(a){i||(d(n),i=!0)},o(a){p(n),i=!1},d(a){a&&_(e),s[r].d()}}}function ri(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class Mt extends j{constructor(e){super(),C(this,e,ri,ni,A,{brandingInfo:0},Jr)}}function ii(t){R(t,"svelte-17puakv",".rcb-post-purchase-header-layout.svelte-17puakv{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:-4px}")}function oi(t){let e,r,n,i,o;return r=new Mt({props:{brandingInfo:t[0]}}),i=new st({}),i.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){e=v("div"),T(r.$$.fragment),n=S(),T(i.$$.fragment),b(e,"class","rcb-post-purchase-header-layout svelte-17puakv")},m(s,l){g(s,e,l),k(r,e,null),L(e,n),k(i,e,null),o=!0},p(s,l){t=s;const a={};l&1&&(a.brandingInfo=t[0]),r.$set(a)},i(s){o||(d(r.$$.fragment,s),d(i.$$.fragment,s),o=!0)},o(s){p(r.$$.fragment,s),p(i.$$.fragment,s),o=!1},d(s){s&&_(e),P(r),P(i)}}}function si(t){let e,r;return e=new Ee({props:{as:"header",$$slots:{default:[oi]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,[i]){const o={};i&7&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function li(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=o=>{"brandingInfo"in o&&r(0,n=o.brandingInfo),"onClose"in o&&r(1,i=o.onClose)},[n,i]}class ai extends j{constructor(e){super(),C(this,e,li,si,A,{brandingInfo:0,onClose:1},ii)}}function ci(t){R(t,"svelte-idou50",".rcb-modal-message.svelte-idou50{width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;margin-bottom:16px;margin-top:16px}.title.svelte-idou50{font-size:24px;line-height:1.25em}.subtitle.svelte-idou50{font-size:16px;line-height:1.25em;overflow-wrap:anywhere}")}const ui=t=>({}),Dt=t=>({});function fi(t){let e,r,n,i,o;const s=t[5].default,l=H(s,t,t[6],null);return{c(){e=v("span"),r=V(t[2]),n=S(),i=v("span"),l&&l.c(),b(e,"class","title svelte-idou50"),b(i,"class","subtitle svelte-idou50")},m(a,c){g(a,e,c),L(e,r),g(a,n,c),g(a,i,c),l&&l.m(i,null),o=!0},p(a,c){(!o||c&4)&&ue(r,a[2]),l&&l.p&&(!o||c&64)&&W(l,s,a,a[6],o?z(s,a[6],c,null):K(a[6]),null)},i(a){o||(d(l,a),o=!0)},o(a){p(l,a),o=!1},d(a){a&&(_(e),_(n),_(i)),l&&l.d(a)}}}function di(t){let e,r,n;const i=t[5].icon,o=H(i,t,t[6],Dt);return r=new Re({props:{gutter:"16px",$$slots:{default:[fi]},$$scope:{ctx:t}}}),{c(){o&&o.c(),e=S(),T(r.$$.fragment)},m(s,l){o&&o.m(s,l),g(s,e,l),k(r,s,l),n=!0},p(s,l){o&&o.p&&(!n||l&64)&&W(o,i,s,s[6],n?z(i,s[6],l,ui):K(s[6]),Dt);const a={};l&68&&(a.$$scope={dirty:l,ctx:s}),r.$set(a)},i(s){n||(d(o,s),d(r.$$.fragment,s),n=!0)},o(s){p(o,s),p(r.$$.fragment,s),n=!1},d(s){s&&_(e),o&&o.d(s),P(r,s)}}}function pi(t){let e,r,n;return r=new Re({props:{gutter:"48px",$$slots:{default:[di]},$$scope:{ctx:t}}}),{c(){e=v("div"),T(r.$$.fragment),b(e,"class","rcb-modal-message svelte-idou50"),b(e,"data-type",t[3])},m(i,o){g(i,e,o),k(r,e,null),n=!0},p(i,o){const s={};o&68&&(s.$$scope={dirty:o,ctx:i}),r.$set(s),(!n||o&8)&&b(e,"data-type",i[3])},i(i){n||(d(r.$$.fragment,i),n=!0)},o(i){p(r.$$.fragment,i),n=!1},d(i){i&&_(e),P(r)}}}function mi(t){let e;return{c(){e=V(t[4])},m(r,n){g(r,e,n)},p(r,n){n&16&&ue(e,r[4])},d(r){r&&_(e)}}}function _i(t){let e,r;return e=new it({props:{type:"submit",$$slots:{default:[mi]},$$scope:{ctx:t}}}),e.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){t=n;const o={};i&80&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function gi(t){let e,r,n,i,o,s;return e=new ai({props:{brandingInfo:t[0],onClose:t[1]}}),n=new Ee({props:{$$slots:{default:[pi]},$$scope:{ctx:t}}}),o=new ot({props:{$$slots:{default:[_i]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment),r=S(),T(n.$$.fragment),i=S(),T(o.$$.fragment)},m(l,a){k(e,l,a),g(l,r,a),k(n,l,a),g(l,i,a),k(o,l,a),s=!0},p(l,a){const c={};a&1&&(c.brandingInfo=l[0]),a&2&&(c.onClose=l[1]),e.$set(c);const u={};a&76&&(u.$$scope={dirty:a,ctx:l}),n.$set(u);const f={};a&82&&(f.$$scope={dirty:a,ctx:l}),o.$set(f)},i(l){s||(d(e.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),s=!0)},o(l){p(e.$$.fragment,l),p(n.$$.fragment,l),p(o.$$.fragment,l),s=!1},d(l){l&&(_(r),_(i)),P(e,l),P(n,l),P(o,l)}}}function hi(t){let e,r;return e=new Re({props:{gutter:"32px",$$slots:{default:[gi]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,[i]){const o={};i&95&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function bi(t,e,r){let{$$slots:n={},$$scope:i}=e,{brandingInfo:o=null}=e,{onContinue:s}=e,{title:l}=e,{type:a}=e,{closeButtonTitle:c="Go back to app"}=e;return t.$$set=u=>{"brandingInfo"in u&&r(0,o=u.brandingInfo),"onContinue"in u&&r(1,s=u.onContinue),"title"in u&&r(2,l=u.title),"type"in u&&r(3,a=u.type),"closeButtonTitle"in u&&r(4,c=u.closeButtonTitle),"$$scope"in u&&r(6,i=u.$$scope)},[o,s,l,a,c,n,i]}class Bt extends j{constructor(e){super(),C(this,e,bi,hi,A,{brandingInfo:0,onContinue:1,title:2,type:3,closeButtonTitle:4},ci)}}function Ct(t){let e,r,n,i,o,s;return{c(){e=v("br"),r=V("If this error persists, please contact "),n=v("a"),i=V(t[2]),s=V("."),b(n,"href",o="mailto:"+t[2])},m(l,a){g(l,e,a),g(l,r,a),g(l,n,a),L(n,i),g(l,s,a)},p(l,a){a&4&&ue(i,l[2]),a&4&&o!==(o="mailto:"+l[2])&&b(n,"href",o)},d(l){l&&(_(e),_(r),_(n),_(s))}}}function wi(t){let e=t[1].getPublicErrorMessage(t[3])+"",r,n,i,o=t[2]&&Ct(t);return{c(){r=V(e),n=S(),o&&o.c(),i=ae()},m(s,l){g(s,r,l),g(s,n,l),o&&o.m(s,l),g(s,i,l)},p(s,l){l&10&&e!==(e=s[1].getPublicErrorMessage(s[3])+"")&&ue(r,e),s[2]?o?o.p(s,l):(o=Ct(s),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},d(s){s&&(_(r),_(n),_(i)),o&&o.d(s)}}}function yi(t){let e,r;return e=new Sr({props:{slot:"icon"}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p:h,i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Ei(t){let e,r;return e=new Bt({props:{title:t[5](),brandingInfo:t[0],onContinue:t[4],type:"error",closeButtonTitle:"Try Again",$$slots:{icon:[yi],default:[wi]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.brandingInfo=n[0]),i&16&&(o.onContinue=n[4]),i&78&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function vi(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:o=null}=e,{productDetails:s=null}=e,{onContinue:l}=e;Ce(()=>{q.errorLog(`Displayed error: ${te[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function a(){switch(i.errorCode){case te.AlreadyPurchasedError:return(s==null?void 0:s.productType)===ve.Subscription?"Already subscribed":"Already purchased";default:return"Something went wrong"}}return t.$$set=c=>{"brandingInfo"in c&&r(0,n=c.brandingInfo),"lastError"in c&&r(1,i=c.lastError),"supportEmail"in c&&r(2,o=c.supportEmail),"productDetails"in c&&r(3,s=c.productDetails),"onContinue"in c&&r(4,l=c.onContinue)},[n,i,o,s,l,a]}class Ii extends j{constructor(e){super(),C(this,e,vi,Ei,A,{brandingInfo:0,lastError:1,supportEmail:2,productDetails:3,onContinue:4})}}const $i=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
7
+ <circle cx="62" cy="62" r="62" fill="currentColor"/>
8
+ <rect x="44.1116" y="56" width="27.5" height="11" transform="rotate(45 44.1116 56)" fill="white"/>
9
+ <rect x="79.1133" y="44.334" width="11" height="44" transform="rotate(45 79.1133 44.334)" fill="white"/>
10
+ </svg>
11
+ `;function ki(t){R(t,"svelte-7wiquz",".rcb-ui-asset-icon.svelte-7wiquz{width:96px;height:96px;margin:0 auto}")}function Pi(t){let e;return{c(){e=v("div"),fe(e,"color","var(--rc-color-accent)"),b(e,"class","rcb-ui-asset-icon svelte-7wiquz")},m(r,n){g(r,e,n),e.innerHTML=$i},p:h,i:h,o:h,d(r){r&&_(e)}}}class Ti extends j{constructor(e){super(),C(this,e,null,Pi,A,{},ki)}}function Ai(t){let e;return{c(){e=V("Your plan is now active.")},m(r,n){g(r,e,n)},d(r){r&&_(e)}}}function Oi(t){let e,r=t[2]&&Ai();return{c(){r&&r.c(),e=ae()},m(n,i){r&&r.m(n,i),g(n,e,i)},p:h,d(n){n&&_(e),r&&r.d(n)}}}function Ni(t){let e,r;return e=new Ti({props:{slot:"icon"}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p:h,i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Ui(t){let e,r;return e=new Bt({props:{type:"success",title:"Purchase successful",brandingInfo:t[0],onContinue:t[1],closeButtonTitle:"Close",$$slots:{icon:[Ni],default:[Oi]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.brandingInfo=n[0]),i&2&&(o.onContinue=n[1]),i&16&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Ri(t,e,r){let{productDetails:n=null}=e,{brandingInfo:i=null}=e,{onContinue:o}=e;const s=(n==null?void 0:n.productType)===ve.Subscription;return t.$$set=l=>{"productDetails"in l&&r(3,n=l.productDetails),"brandingInfo"in l&&r(0,i=l.brandingInfo),"onContinue"in l&&r(1,o=l.onContinue)},[i,o,s,n]}class Li extends j{constructor(e){super(),C(this,e,Ri,Ui,A,{productDetails:3,brandingInfo:0,onContinue:1})}}function Si(t,e,r,n,i={}){const o=r.create(e,i);return o.mount(t),o.on("change",s=>n("change",s)),o.on("ready",s=>n("ready",s)),o.on("focus",s=>n("focus",s)),o.on("blur",s=>n("blur",s)),o.on("escape",s=>n("escape",s)),o.on("click",s=>n("click",s)),o.on("loaderror",s=>n("loaderror",s)),o.on("loaderstart",s=>n("loaderstart",s)),o.on("networkschange",s=>n("networkschange",s)),o}const Mi=typeof window>"u";function Di(t){if(!Mi)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function Bi(t){let e;return{c(){e=v("div")},m(r,n){g(r,e,n),t[6](e)},p:h,i:h,o:h,d(r){r&&_(e),t[6](null)}}}function Ci(t,e,r){let n,i;const o=qn(),{elements:s}=Gn("stripe");let{options:l=void 0}=e;Ce(()=>(n=Si(i,"payment",s,o,l),()=>n.destroy()));function a(){n.blur()}function c(){n.clear()}function u(){n.destroy()}function f(){n.focus()}function m(w){je[w?"unshift":"push"](()=>{i=w,r(0,i)})}return t.$$set=w=>{"options"in w&&r(1,l=w.options)},[i,l,a,c,u,f,m]}class ji extends j{constructor(e){super(),C(this,e,Ci,Bi,A,{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 jt(t){let e;const r=t[15].default,n=H(r,t,t[14],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&16384)&&W(n,r,i,i[14],e?z(r,i[14],o,null):K(i[14]),null)},i(i){e||(d(n,i),e=!0)},o(i){p(n,i),e=!1},d(i){n&&n.d(i)}}}function Fi(t){let e,r,n=t[1]&&t[0]&&jt(t);return{c(){n&&n.c(),e=ae()},m(i,o){n&&n.m(i,o),g(i,e,o),r=!0},p(i,[o]){i[1]&&i[0]?n?(n.p(i,o),o&3&&d(n,1)):(n=jt(i),n.c(),d(n,1),n.m(e.parentNode,e)):n&&(Q(),p(n,1,1,()=>{n=null}),X())},i(i){r||(d(n),r=!0)},o(i){p(n),r=!1},d(i){i&&_(e),n&&n.d(i)}}}function Hi(t,e,r){let n,{$$slots:i={},$$scope:o}=e,{stripe:s}=e,{mode:l=void 0}=e,{theme:a="stripe"}=e,{variables:c={}}=e,{rules:u={}}=e,{labels:f="above"}=e,{loader:m="auto"}=e,{fonts:w=[]}=e,{locale:I="auto"}=e,{currency:O=void 0}=e,{amount:y=void 0}=e,{clientSecret:N=void 0}=e,{elements:ie=null}=e;return t.$$set=$=>{"stripe"in $&&r(1,s=$.stripe),"mode"in $&&r(2,l=$.mode),"theme"in $&&r(3,a=$.theme),"variables"in $&&r(4,c=$.variables),"rules"in $&&r(5,u=$.rules),"labels"in $&&r(6,f=$.labels),"loader"in $&&r(7,m=$.loader),"fonts"in $&&r(8,w=$.fonts),"locale"in $&&r(9,I=$.locale),"currency"in $&&r(10,O=$.currency),"amount"in $&&r(11,y=$.amount),"clientSecret"in $&&r(12,N=$.clientSecret),"elements"in $&&r(0,ie=$.elements),"$$scope"in $&&r(14,o=$.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:a,variables:c,rules:u,labels:f}),t.$$.dirty&16263&&s&&!ie&&(r(0,ie=s.elements({mode:l,currency:O,amount:y,appearance:n,clientSecret:N,fonts:w,loader:m,locale:I})),Di(s),xn("stripe",{stripe:s,elements:ie})),t.$$.dirty&8705&&ie&&ie.update({appearance:n,locale:I})},[ie,s,l,a,c,u,f,m,w,I,O,y,N,n,o,i]}class qi extends j{constructor(e){super(),C(this,e,Hi,Fi,A,{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 Ft="https://js.stripe.com/v3",xi=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Ht="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Gi=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Ft,'"]')),r=0;r<e.length;r++){var n=e[r];if(xi.test(n.src))return n}return null},qt=function(e){var r="",n=document.createElement("script");n.src="".concat(Ft).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},Vi=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.4.0",startTime:r})},Le=null,xe=null,Ge=null,Yi=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},zi=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},Wi=function(e){return Le!==null?Le:(Le=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(Ht),window.Stripe){r(window.Stripe);return}try{var i=Gi();if(i&&e)console.warn(Ht);else if(!i)i=qt(e);else if(i&&Ge!==null&&xe!==null){var o;i.removeEventListener("load",Ge),i.removeEventListener("error",xe),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=qt(e)}Ge=zi(r,n),xe=Yi(n),i.addEventListener("load",Ge),i.addEventListener("error",xe)}catch(s){n(s);return}}),Le.catch(function(r){return Le=null,Promise.reject(r)}))},Ki=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return Vi(i,n),i},Se,xt=!1,Gt=function(){return Se||(Se=Wi(null).catch(function(e){return Se=null,Promise.reject(e)}),Se)};Promise.resolve().then(function(){return Gt()}).catch(function(t){xt||console.warn(t)});var Qi=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];xt=!0;var i=Date.now();return Gt().then(function(o){return Ki(o,r,i)})};function Xi(t){R(t,"svelte-1xe711j",".rcb-header-layout.svelte-1xe711j{display:flex;justify-content:space-between;align-items:center;width:100%;font-size:24px;margin:0;font-weight:500}")}function Zi(t){let e,r;const n=t[0].default,i=H(n,t,t[1],null);return{c(){e=v("div"),i&&i.c(),b(e,"class","rcb-header-layout svelte-1xe711j")},m(o,s){g(o,e,s),i&&i.m(e,null),r=!0},p(o,s){i&&i.p&&(!r||s&2)&&W(i,n,o,o[1],r?z(n,o[1],s,null):K(o[1]),null)},i(o){r||(d(i,o),r=!0)},o(o){p(i,o),r=!1},d(o){o&&_(e),i&&i.d(o)}}}function Ji(t){let e,r;return e=new Ee({props:{as:"header",$$slots:{default:[Zi]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,[i]){const o={};i&2&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function eo(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(1,i=o.$$scope)},[n,i]}class lt extends j{constructor(e){super(),C(this,e,eo,Ji,A,{},Xi)}}const to=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
12
+ xmlns="http://www.w3.org/2000/svg">
13
+ <path d="M18 8H17V6C17 3.24 14.76 1 12 1C9.24 1 7 3.24 7 6V8H6C4.9 8 4 8.9 4 10V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V10C20 8.9 19.1 8 18 8ZM12 17C10.9 17 10 16.1 10 15C10 13.9 10.9 13 12 13C13.1 13 14 13.9 14 15C14 16.1 13.1 17 12 17ZM15.1 8H8.9V6C8.9 4.29 10.29 2.9 12 2.9C13.71 2.9 15.1 4.29 15.1 6V8Z"
14
+ fill="currentColor"/>
15
+ </svg>
16
+ `;function no(t){R(t,"svelte-1z0jca3","div.svelte-1z0jca3{height:24px;width:24px}")}function ro(t){let e;return{c(){e=v("div"),fe(e,"color","var(--rc-color-accent)"),b(e,"class","rcb-ui-asset-icon svelte-1z0jca3")},m(r,n){g(r,e,n),e.innerHTML=to},p:h,i:h,o:h,d(r){r&&_(e)}}}class io extends j{constructor(e){super(),C(this,e,null,ro,A,{},no)}}function oo(t){R(t,"svelte-rjmul6",`.processing.svelte-rjmul6{width:12px;aspect-ratio:1;border-radius:50%;animation:svelte-rjmul6-l5 1.5s infinite linear}@keyframes svelte-rjmul6-l5{0%{box-shadow:20px 0 #fff2,
2
17
  -20px 0 #fff2;background:#fff2}25%{box-shadow:20px 0 #fff2,
3
18
  -20px 0 #ffff;background:#fff2}50%{box-shadow:20px 0 #fff2,
4
19
  -20px 0 #fff2;background:#ffff}75%{box-shadow:20px 0 #ffff,
5
20
  -20px 0 #fff2;background:#fff2}100%{box-shadow:20px 0 #fff2,
6
- -20px 0 #fff2;background:#fff2}}`)}function Gi(t){let e;return{c(){e=w("div"),b(e,"class","processing svelte-rjmul6")},m(r,n){_(r,e,n)},p,i:p,o:p,d(r){r&&h(e)}}}class Nt extends U{constructor(e){super(),N(this,e,null,Gi,B,{},xi)}}function Yi(t){T(t,"svelte-1wxt892",".rcb-stripe-elements-container.svelte-1wxt892{width:100%;margin-top:32px;margin-bottom:24px}")}function Hi(t){let e,r;return e=new et({}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Ki(t){let e,r,n,i,o,s;function l(a){t[11](a)}let c={stripe:t[5],clientSecret:t[6],loader:"always",theme:"stripe",variables:{borderRadius:"12px",fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",colorText:Re["grey-text-dark"],focusBoxShadow:"none",colorDanger:Re.error},rules:{".Input":{boxShadow:"none",border:`2px solid ${Re["grey-ui-dark"]}`},".Input:focus":{border:`2px solid ${Re.focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px"},".Input--invalid":{boxShadow:"none"}},$$slots:{default:[to]},$$scope:{ctx:t}};return t[4]!==void 0&&(c.elements=t[4]),r=new vi({props:c}),Se.push(()=>Rn(r,"elements",l)),{c(){e=w("form"),v(r.$$.fragment)},m(a,u){_(a,e,u),y(r,e,null),i=!0,o||(s=ye(e,"submit",dt(t[7])),o=!0)},p(a,u){const d={};u&32&&(d.stripe=a[5]),u&8207&&(d.$$scope={dirty:u,ctx:a}),!n&&u&16&&(n=!0,d.elements=a[4],Cn(()=>n=!1)),r.$set(d)},i(a){i||(f(r.$$.fragment,a),i=!0)},o(a){g(r.$$.fragment,a),i=!1},d(a){a&&h(e),k(r),o=!1,s()}}}function ji(t){let e,r,n,i;return n=new Fi({}),{c(){e=w("div"),e.textContent="Secure Checkout",r=Q(),v(n.$$.fragment)},m(o,s){_(o,e,s),_(o,r,s),y(n,o,s),i=!0},p,i(o){i||(f(n.$$.fragment,o),i=!0)},o(o){g(n.$$.fragment,o),i=!1},d(o){o&&(h(e),h(r)),k(n,o)}}}function qi(t){let e,r,n;return r=new wi({}),{c(){e=w("div"),v(r.$$.fragment),b(e,"class","rcb-stripe-elements-container svelte-1wxt892")},m(i,o){_(i,e,o),y(r,e,null),n=!0},p,i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){g(r.$$.fragment,i),n=!1},d(i){i&&h(e),k(r)}}}function Ji(t){let e;return{c(){e=G("Pay")},m(r,n){_(r,e,n)},i:p,o:p,d(r){r&&h(e)}}}function Vi(t){let e;return{c(){e=G("Start Trial")},m(r,n){_(r,e,n)},i:p,o:p,d(r){r&&h(e)}}}function Wi(t){let e,r;return e=new Nt({}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function zi(t){let e,r,n,i;const o=[Wi,Vi,Ji],s=[];function l(c,a){var u,d;return c[0]?0:(d=(u=c[2].subscriptionOptions)==null?void 0:u[c[3].id])!=null&&d.trial?1:2}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=ce()},m(c,a){s[e].m(c,a),_(c,n,a),i=!0},p(c,a){let u=e;e=l(c),e!==u&&(V(),g(s[u],1,1,()=>{s[u]=null}),W(),r=s[e],r||(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){g(r),i=!1},d(c){c&&h(n),s[e].d(c)}}}function Xi(t){let e;return{c(){e=G("Close")},m(r,n){_(r,e,n)},d(r){r&&h(e)}}}function Zi(t){let e,r,n,i;return e=new De({props:{disabled:t[0],testId:"PayButton",$$slots:{default:[zi]},$$scope:{ctx:t}}}),n=new De({props:{disabled:t[0],intent:"secondary",$$slots:{default:[Xi]},$$scope:{ctx:t}}}),n.$on("click",function(){re(t[1])&&t[1].apply(this,arguments)}),{c(){v(e.$$.fragment),r=Q(),v(n.$$.fragment)},m(o,s){y(e,o,s),_(o,r,s),y(n,o,s),i=!0},p(o,s){t=o;const l={};s&1&&(l.disabled=t[0]),s&8205&&(l.$$scope={dirty:s,ctx:t}),e.$set(l);const c={};s&1&&(c.disabled=t[0]),s&8192&&(c.$$scope={dirty:s,ctx:t}),n.$set(c)},i(o){i||(f(e.$$.fragment,o),f(n.$$.fragment,o),i=!0)},o(o){g(e.$$.fragment,o),g(n.$$.fragment,o),i=!1},d(o){o&&h(r),k(e,o),k(n,o)}}}function eo(t){let e,r;return e=new Ce({props:{$$slots:{default:[Zi]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&8207&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function to(t){let e,r,n,i,o,s;return e=new nt({props:{$$slots:{default:[ji]},$$scope:{ctx:t}}}),n=new be({props:{$$slots:{default:[qi]},$$scope:{ctx:t}}}),o=new tt({props:{$$slots:{default:[eo]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment),r=Q(),v(n.$$.fragment),i=Q(),v(o.$$.fragment)},m(l,c){y(e,l,c),_(l,r,c),y(n,l,c),_(l,i,c),y(o,l,c),s=!0},p(l,c){const a={};c&8192&&(a.$$scope={dirty:c,ctx:l}),e.$set(a);const u={};c&8192&&(u.$$scope={dirty:c,ctx:l}),n.$set(u);const d={};c&8207&&(d.$$scope={dirty:c,ctx:l}),o.$set(d)},i(l){s||(f(e.$$.fragment,l),f(n.$$.fragment,l),f(o.$$.fragment,l),s=!0)},o(l){g(e.$$.fragment,l),g(n.$$.fragment,l),g(o.$$.fragment,l),s=!1},d(l){l&&(h(r),h(i)),k(e,l),k(n,l),k(o,l)}}}function no(t){let e,r,n,i;const o=[Ki,Hi],s=[];function l(c,a){return c[5]&&c[6]?0:1}return r=l(t),n=s[r]=o[r](t),{c(){e=w("div"),n.c()},m(c,a){_(c,e,a),s[r].m(e,null),i=!0},p(c,[a]){let u=r;r=l(c),r===u?s[r].p(c,a):(V(),g(s[u],1,1,()=>{s[u]=null}),W(),n=s[r],n?n.p(c,a):(n=s[r]=o[r](c),n.c()),f(n,1),n.m(e,null))},i(c){i||(f(n),i=!0)},o(c){g(n),i=!1},d(c){c&&h(e),s[r].d()}}}function ro(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:o}=e,{paymentInfoCollectionMetadata:s}=e,{processing:l=!1}=e,{productDetails:c}=e,{purchaseOptionToUse:a}=e;const u=s.data.client_secret;let d=null,A,I;Ue(async()=>{const m=s.data.publishable_api_key,$=s.data.stripe_account_id;if(!m||!$)throw new Error("Stripe publishable key or account ID not found");r(5,d=await Ri(m,{stripeAccount:$}))});const P=async()=>{if(l||!d||!I)return;r(0,l=!0);const m=await d.confirmSetup({elements:I,redirect:"if_required"});m.error?(r(0,l=!1),o(new X(ne.StripeError,m.error.message))):i()};function S(m){A=m,r(4,A)}return t.$$set=m=>{"onClose"in m&&r(1,n=m.onClose),"onContinue"in m&&r(8,i=m.onContinue),"onError"in m&&r(9,o=m.onError),"paymentInfoCollectionMetadata"in m&&r(10,s=m.paymentInfoCollectionMetadata),"processing"in m&&r(0,l=m.processing),"productDetails"in m&&r(2,c=m.productDetails),"purchaseOptionToUse"in m&&r(3,a=m.purchaseOptionToUse)},t.$$.update=()=>{t.$$.dirty&16&&A&&A._elements.length>0&&(I=A)},[l,n,c,a,A,d,u,P,i,o,s,S]}class io extends U{constructor(e){super(),N(this,e,ro,no,B,{onClose:1,onContinue:8,onError:9,paymentInfoCollectionMetadata:10,processing:0,productDetails:2,purchaseOptionToUse:3},Yi)}}function oo(t){return t.trim()===""?"You need to provide your email address to continue.":t.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function so(t){if(t&&!t.match(/^[A-Z]{3}$/)){const e=`Currency code ${t} is not valid. Please provide a valid ISO 4217 currency code.`;throw x.errorLog(e),new z(te.ConfigurationError,e)}}function lo(t){T(t,"svelte-favd20","form.svelte-favd20.svelte-favd20{display:flex;flex-direction:column;min-height:100%;flex-grow:1}.form-container.svelte-favd20.svelte-favd20{display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px}.form-label.svelte-favd20.svelte-favd20{margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px}.form-input.error.svelte-favd20 input.svelte-favd20{border-color:var(--rc-color-error)}.form-error.svelte-favd20.svelte-favd20{margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error)}input.svelte-favd20.svelte-favd20{width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:12px;font-size:16px;height:48px;padding:6px 14px}input.svelte-favd20.svelte-favd20:focus{outline:none;border:2px solid var(--rc-color-focus)}")}function co(t){let e;return{c(){e=G("Billing email address")},m(r,n){_(r,e,n)},d(r){r&&h(e)}}}function Ut(t){let e,r;return{c(){e=w("div"),r=G(t[2]),b(e,"class","form-error svelte-favd20")},m(n,i){_(n,e,i),M(e,r)},p(n,i){i&4&&fe(r,n[2])},d(n){n&&h(e)}}}function ao(t){let e,r,n,i,o,s,l,c,a,u=t[2]&&Ut(t);return{c(){e=w("div"),r=w("div"),r.innerHTML='<label for="email">Email</label>',n=Q(),i=w("div"),o=w("input"),l=Q(),u&&u.c(),b(r,"class","form-label svelte-favd20"),b(o,"name","email"),b(o,"placeholder","john@appleseed.com"),b(o,"autocapitalize","off"),b(o,"class","svelte-favd20"),b(i,"class",s="form-input "+t[4]+" svelte-favd20"),b(e,"class","form-container svelte-favd20")},m(d,A){_(d,e,A),M(e,r),M(e,n),M(e,i),M(i,o),gt(o,t[3]),M(e,l),u&&u.m(e,null),c||(a=ye(o,"input",t[8]),c=!0)},p(d,A){A&8&&o.value!==d[3]&&gt(o,d[3]),A&16&&s!==(s="form-input "+d[4]+" svelte-favd20")&&b(i,"class",s),d[2]?u?u.p(d,A):(u=Ut(d),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},d(d){d&&h(e),u&&u.d(),c=!1,a()}}}function uo(t){let e;return{c(){e=G("Continue")},m(r,n){_(r,e,n)},i:p,o:p,d(r){r&&h(e)}}}function fo(t){let e,r;return e=new Nt({}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function go(t){let e,r,n,i;const o=[fo,uo],s=[];function l(c,a){return c[1]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=ce()},m(c,a){s[e].m(c,a),_(c,n,a),i=!0},p(c,a){let u=e;e=l(c),e!==u&&(V(),g(s[u],1,1,()=>{s[u]=null}),W(),r=s[e],r||(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){g(r),i=!1},d(c){c&&h(n),s[e].d(c)}}}function mo(t){let e;return{c(){e=G("Close")},m(r,n){_(r,e,n)},d(r){r&&h(e)}}}function po(t){let e,r,n,i;return e=new De({props:{disabled:t[1],$$slots:{default:[go]},$$scope:{ctx:t}}}),n=new De({props:{intent:"secondary",disabled:t[1],$$slots:{default:[mo]},$$scope:{ctx:t}}}),n.$on("click",function(){re(t[0])&&t[0].apply(this,arguments)}),{c(){v(e.$$.fragment),r=Q(),v(n.$$.fragment)},m(o,s){y(e,o,s),_(o,r,s),y(n,o,s),i=!0},p(o,s){t=o;const l={};s&2&&(l.disabled=t[1]),s&514&&(l.$$scope={dirty:s,ctx:t}),e.$set(l);const c={};s&2&&(c.disabled=t[1]),s&512&&(c.$$scope={dirty:s,ctx:t}),n.$set(c)},i(o){i||(f(e.$$.fragment,o),f(n.$$.fragment,o),i=!0)},o(o){g(e.$$.fragment,o),g(n.$$.fragment,o),i=!1},d(o){o&&h(r),k(e,o),k(n,o)}}}function ho(t){let e,r;return e=new Ce({props:{$$slots:{default:[po]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&515&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function _o(t){let e,r,n,i,o,s,l,c,a;return r=new nt({props:{$$slots:{default:[co]},$$scope:{ctx:t}}}),i=new be({props:{$$slots:{default:[ao]},$$scope:{ctx:t}}}),s=new tt({props:{$$slots:{default:[ho]},$$scope:{ctx:t}}}),{c(){e=w("form"),v(r.$$.fragment),n=Q(),v(i.$$.fragment),o=Q(),v(s.$$.fragment),b(e,"class","svelte-favd20")},m(u,d){_(u,e,d),y(r,e,null),M(e,n),y(i,e,null),M(e,o),y(s,e,null),l=!0,c||(a=ye(e,"submit",dt(t[5])),c=!0)},p(u,[d]){const A={};d&512&&(A.$$scope={dirty:d,ctx:u}),r.$set(A);const I={};d&540&&(I.$$scope={dirty:d,ctx:u}),i.$set(I);const P={};d&515&&(P.$$scope={dirty:d,ctx:u}),s.$set(P)},i(u){l||(f(r.$$.fragment,u),f(i.$$.fragment,u),f(s.$$.fragment,u),l=!0)},o(u){g(r.$$.fragment,u),g(i.$$.fragment,u),g(s.$$.fragment,u),l=!1},d(u){u&&h(e),k(r),k(i),k(s),c=!1,a()}}}function Ao(t,e,r){let n,i,o,{onContinue:s}=e,{onClose:l}=e,{processing:c}=e,{lastError:a}=e;const u=async()=>{const A=oo(n);A?r(2,i=A):s({email:n})};kn(async()=>{r(2,i=(a==null?void 0:a.message)??"")});function d(){n=this.value,r(3,n)}return t.$$set=A=>{"onContinue"in A&&r(6,s=A.onContinue),"onClose"in A&&r(0,l=A.onClose),"processing"in A&&r(1,c=A.processing),"lastError"in A&&r(7,a=A.lastError)},t.$$.update=()=>{t.$$.dirty&4&&r(4,o=i?"error":"")},r(3,n=""),r(2,i=""),[l,c,i,n,o,u,s,a,d]}class bo extends U{constructor(e){super(),N(this,e,Ao,_o,B,{onContinue:6,onClose:0,processing:1,lastError:7},lo)}}function Eo(t){T(t,"svelte-17tslso",".rcb-modal-backdrop.svelte-17tslso{position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001}")}function Io(t){let e,r;const n=t[1].default,i=F(n,t,t[0],null);return{c(){e=w("div"),i&&i.c(),b(e,"class","rcb-modal-backdrop svelte-17tslso")},m(o,s){_(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&1)&&q(i,n,o,o[0],r?j(n,o[0],s,null):ee(o[0]),null)},i(o){r||(f(i,o),r=!0)},o(o){g(i,o),r=!1},d(o){o&&h(e),i&&i.d(o)}}}function wo(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}class yo extends U{constructor(e){super(),N(this,e,wo,Io,B,{},Eo)}}function ko(t){T(t,"svelte-z3twhy",".rcb-modal-container.svelte-z3twhy{width:100%}.rcb-modal-main.svelte-z3twhy{box-sizing:border-box;border-radius:16px;background-color:var(--rc-color-white);color:var(--rc-color-grey-text-dark);min-height:460px;padding:40px;flex-direction:column;display:flex}.rcb-modal-dark.svelte-z3twhy{background-color:var(--rc-color-grey-text-dark);color:var(--rc-color-white);min-height:0px}@media screen and (max-width: 960px){.rcb-modal-container.svelte-z3twhy{width:calc(100% - 32px);min-width:300px;max-width:640px;margin:auto}.rcb-modal-main.svelte-z3twhy,.rcb-modal-dark.svelte-z3twhy{min-width:300px;max-width:640px;padding:32px}}")}function vo(t){let e,r,n,i;const o=t[2].default,s=F(o,t,t[1],null);return{c(){e=w("div"),r=w("main"),s&&s.c(),b(r,"class",n=J(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-z3twhy"),b(e,"class","rcb-modal-container svelte-z3twhy")},m(l,c){_(l,e,c),M(e,r),s&&s.m(r,null),i=!0},p(l,[c]){s&&s.p&&(!i||c&2)&&q(s,o,l,l[1],i?j(o,l[1],c,null):ee(l[1]),null),(!i||c&1&&n!==(n=J(`rcb-modal-main ${l[0]?"rcb-modal-dark":""}`)+" svelte-z3twhy"))&&b(r,"class",n)},i(l){i||(f(s,l),i=!0)},o(l){g(s,l),i=!1},d(l){l&&h(e),s&&s.d(l)}}}function $o(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:o=!1}=e;return t.$$set=s=>{"dark"in s&&r(0,o=s.dark),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class Bo extends U{constructor(e){super(),N(this,e,$o,vo,B,{dark:0},ko)}}function Po(t){let e;const r=t[1].default,n=F(r,t,t[2],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&4)&&q(n,r,i,i[2],e?j(r,i[2],o,null):ee(i[2]),null)},i(i){e||(f(n,i),e=!0)},o(i){g(n,i),e=!1},d(i){n&&n.d(i)}}}function Do(t){let e,r;return e=new yo({props:{$$slots:{default:[Co]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Co(t){let e;const r=t[1].default,n=F(r,t,t[2],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&4)&&q(n,r,i,i[2],e?j(r,i[2],o,null):ee(i[2]),null)},i(i){e||(f(n,i),e=!0)},o(i){g(n,i),e=!1},d(i){n&&n.d(i)}}}function Mo(t){let e,r,n,i;const o=[Do,Po],s=[];function l(c,a){return c[0]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=ce()},m(c,a){s[e].m(c,a),_(c,n,a),i=!0},p(c,[a]){let u=e;e=l(c),e===u?s[e].p(c,a):(V(),g(s[u],1,1,()=>{s[u]=null}),W(),r=s[e],r?r.p(c,a):(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){g(r),i=!1},d(c){c&&h(n),s[e].d(c)}}}function To(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:o=!1}=e;return t.$$set=s=>{"condition"in s&&r(0,o=s.condition),"$$scope"in s&&r(2,i=s.$$scope)},[o,n,i]}class Ro extends U{constructor(e){super(),N(this,e,To,Mo,B,{condition:0})}}const Qo=t=>({}),St=t=>({});function Oo(t){let e,r;const n=t[1].header,i=F(n,t,t[2],St),o=t[1].default,s=F(o,t,t[2],null);return{c(){i&&i.c(),e=Q(),s&&s.c()},m(l,c){i&&i.m(l,c),_(l,e,c),s&&s.m(l,c),r=!0},p(l,c){i&&i.p&&(!r||c&4)&&q(i,n,l,l[2],r?j(n,l[2],c,Qo):ee(l[2]),St),s&&s.p&&(!r||c&4)&&q(s,o,l,l[2],r?j(o,l[2],c,null):ee(l[2]),null)},i(l){r||(f(i,l),f(s,l),r=!0)},o(l){g(i,l),g(s,l),r=!1},d(l){l&&h(e),i&&i.d(l),s&&s.d(l)}}}function No(t){let e,r;return e=new Bo({props:{dark:t[0],$$slots:{default:[Oo]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.dark=n[0]),i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Uo(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:o=!1}=e;return t.$$set=s=>{"dark"in s&&r(0,o=s.dark),"$$scope"in s&&r(2,i=s.$$scope)},[o,n,i]}class Lt extends U{constructor(e){super(),N(this,e,Uo,No,B,{dark:0})}}const So="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 Lo(t){let e,r;return{c(){e=w("img"),Z(e.src,r=So)||b(e,"src",r),b(e,"alt","icon"),b(e,"class","rcb-ui-asset-icon")},m(n,i){_(n,e,i)},p,i:p,o:p,d(n){n&&h(e)}}}class Fo extends U{constructor(e){super(),N(this,e,null,Lo,B,{})}}function xo(t){T(t,"svelte-1rhrjxe","div.svelte-1rhrjxe{background-color:var(--rc-color-warning);color:var(--rc-color-grey-text-dark);font-size:10px;font-weight:bold;text-transform:uppercase;padding:4px 10px;line-height:10px;border-radius:9px;margin:0px;margin-left:16px}")}function Go(t){let e;return{c(){e=w("div"),e.textContent="Sandbox",b(e,"class","svelte-1rhrjxe")},m(r,n){_(r,e,n)},p,i:p,o:p,d(r){r&&h(e)}}}class Yo extends U{constructor(e){super(),N(this,e,null,Go,B,{},xo)}}function Ho(t){T(t,"svelte-17btec4",`.rcb-ui-container.svelte-17btec4{color-scheme:none;font-size:16px;line-height:1.5em;font-weight:400;font-family:-apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
7
- Cantarell, "Open Sans", "Helvetica Neue", sans-serif}.rcb-ui-layout.svelte-17btec4{width:100vw;width:100 dvw;margin-right:auto;display:flex;justify-content:center;align-items:flex-start;position:relative;padding:0px 80px;box-sizing:border-box}.rcb-ui-aside.svelte-17btec4{margin-right:16px;flex:320px 1 0;max-width:480px}.rcb-ui-main.svelte-17btec4{flex:480px 1 0;max-width:640px}@media screen and (max-width: 960px){.rcb-ui-layout.svelte-17btec4{flex-direction:column;align-items:center;justify-content:center;height:100%;min-width:100%}.rcb-ui-aside.svelte-17btec4{margin-right:0;margin-bottom:16px;min-width:100%;display:flex;flex-direction:column;align-items:center;flex:none;max-width:none}.rcb-ui-main.svelte-17btec4{flex:none;max-width:none;min-width:100%}}@media screen and (max-width: 960px) and (max-height: 960px){.rcb-ui-layout.svelte-17btec4{overflow-y:scroll;justify-content:flex-start;padding:16px 0px}}`)}function Ft(t){let e,r,n;return r=new Lt({props:{dark:!0,$$slots:{header:[Vo],default:[Ko]},$$scope:{ctx:t}}}),{c(){e=w("div"),v(r.$$.fragment),b(e,"class","rcb-ui-aside svelte-17btec4")},m(i,o){_(i,e,o),y(r,e,null),n=!0},p(i,o){const s={};o&33554446&&(s.$$scope={dirty:o,ctx:i}),r.$set(s)},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){g(r.$$.fragment,i),n=!1},d(i){i&&h(e),k(r)}}}function xt(t){let e,r;return e=new It({props:{productDetails:t[3],purchaseOption:t[8]}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&8&&(o.productDetails=n[3]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Ko(t){let e,r,n=t[3]&&t[8]&&xt(t);return{c(){n&&n.c(),e=ce()},m(i,o){n&&n.m(i,o),_(i,e,o),r=!0},p(i,o){i[3]&&i[8]?n?(n.p(i,o),o&8&&f(n,1)):(n=xt(i),n.c(),f(n,1),n.m(e.parentNode,e)):n&&(V(),g(n,1,1,()=>{n=null}),W())},i(i){r||(f(n),r=!0)},o(i){g(n),r=!1},d(i){i&&h(e),n&&n.d(i)}}}function jo(t){let e,r;return e=new Fo({}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function qo(t){let e,r;return e=new Yo({}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Jo(t){let e,r,n,i,o,s,l;e=new $t({props:{brandingInfo:t[1]}});const c=[qo,jo],a=[];function u(d,A){return A&4&&(n=null),n==null&&(n=!!d[2].isSandbox()),n?0:1}return i=u(t,-1),o=a[i]=c[i](t),{c(){v(e.$$.fragment),r=Q(),o.c(),s=ce()},m(d,A){y(e,d,A),_(d,r,A),a[i].m(d,A),_(d,s,A),l=!0},p(d,A){const I={};A&2&&(I.brandingInfo=d[1]),e.$set(I);let P=i;i=u(d,A),i!==P&&(V(),g(a[P],1,1,()=>{a[P]=null}),W(),o=a[i],o||(o=a[i]=c[i](d),o.c()),f(o,1),o.m(s.parentNode,s))},i(d){l||(f(e.$$.fragment,d),f(o),l=!0)},o(d){g(e.$$.fragment,d),g(o),l=!1},d(d){d&&(h(r),h(s)),k(e,d),a[i].d(d)}}}function Vo(t){let e,r;return e=new nt({props:{slot:"header",$$slots:{default:[Jo]},$$scope:{ctx:t}}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&33554438&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Gt(t){let e,r;return e=new It({props:{productDetails:t[3],purchaseOption:t[8]}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&8&&(o.productDetails=n[3]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Yt(t){let e,r;return e=new et({}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Ht(t){let e,r;return e=new bo({props:{onContinue:t[11],onClose:t[10],processing:t[6]==="processing-auth-info",lastError:t[5]}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&64&&(o.processing=n[6]==="processing-auth-info"),i&32&&(o.lastError=n[5]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Kt(t){let e,r;return e=new io({props:{paymentInfoCollectionMetadata:t[4],onContinue:t[11],onClose:t[10],onError:t[12],processing:t[6]==="polling-purchase-status",productDetails:t[3],purchaseOptionToUse:t[8]}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&16&&(o.paymentInfoCollectionMetadata=n[4]),i&64&&(o.processing=n[6]==="polling-purchase-status"),i&8&&(o.productDetails=n[3]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function jt(t){let e,r;return e=new et({}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function qt(t){var n;let e,r;return e=new si({props:{brandingInfo:t[1],lastError:t[5]??new X(ne.UnknownError,"Unknown error without state set."),supportEmail:(n=t[1])==null?void 0:n.seller_company_support_email,onContinue:t[13]}}),{c(){v(e.$$.fragment)},m(i,o){y(e,i,o),r=!0},p(i,o){var l;const s={};o&2&&(s.brandingInfo=i[1]),o&32&&(s.lastError=i[5]??new X(ne.UnknownError,"Unknown error without state set.")),o&2&&(s.supportEmail=(l=i[1])==null?void 0:l.seller_company_support_email),e.$set(s)},i(i){r||(f(e.$$.fragment,i),r=!0)},o(i){g(e.$$.fragment,i),r=!1},d(i){k(e,i)}}}function Jt(t){let e,r;return e=new hi({props:{productDetails:t[3],brandingInfo:t[1],onContinue:t[11]}}),{c(){v(e.$$.fragment)},m(n,i){y(e,n,i),r=!0},p(n,i){const o={};i&8&&(o.productDetails=n[3]),i&2&&(o.brandingInfo=n[1]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){g(e.$$.fragment,n),r=!1},d(n){k(e,n)}}}function Wo(t){let e,r,n,i,o,s,l,c,a=t[6]==="present-offer"&&t[3]&&t[8]&&Gt(t),u=t[6]==="present-offer"&&!t[3]&&Yt(),d=(t[6]==="needs-auth-info"||t[6]==="processing-auth-info")&&Ht(t),A=t[4]&&(t[6]==="needs-payment-info"||t[6]==="polling-purchase-status")&&t[3]&&t[8]&&Kt(t),I=t[6]==="loading"&&jt(),P=t[6]==="error"&&qt(t),S=t[6]==="success"&&Jt(t);return{c(){a&&a.c(),e=Q(),u&&u.c(),r=Q(),d&&d.c(),n=Q(),A&&A.c(),i=Q(),I&&I.c(),o=Q(),P&&P.c(),s=Q(),S&&S.c(),l=ce()},m(m,$){a&&a.m(m,$),_(m,e,$),u&&u.m(m,$),_(m,r,$),d&&d.m(m,$),_(m,n,$),A&&A.m(m,$),_(m,i,$),I&&I.m(m,$),_(m,o,$),P&&P.m(m,$),_(m,s,$),S&&S.m(m,$),_(m,l,$),c=!0},p(m,$){m[6]==="present-offer"&&m[3]&&m[8]?a?(a.p(m,$),$&72&&f(a,1)):(a=Gt(m),a.c(),f(a,1),a.m(e.parentNode,e)):a&&(V(),g(a,1,1,()=>{a=null}),W()),m[6]==="present-offer"&&!m[3]?u?$&72&&f(u,1):(u=Yt(),u.c(),f(u,1),u.m(r.parentNode,r)):u&&(V(),g(u,1,1,()=>{u=null}),W()),m[6]==="needs-auth-info"||m[6]==="processing-auth-info"?d?(d.p(m,$),$&64&&f(d,1)):(d=Ht(m),d.c(),f(d,1),d.m(n.parentNode,n)):d&&(V(),g(d,1,1,()=>{d=null}),W()),m[4]&&(m[6]==="needs-payment-info"||m[6]==="polling-purchase-status")&&m[3]&&m[8]?A?(A.p(m,$),$&88&&f(A,1)):(A=Kt(m),A.c(),f(A,1),A.m(i.parentNode,i)):A&&(V(),g(A,1,1,()=>{A=null}),W()),m[6]==="loading"?I?$&64&&f(I,1):(I=jt(),I.c(),f(I,1),I.m(o.parentNode,o)):I&&(V(),g(I,1,1,()=>{I=null}),W()),m[6]==="error"?P?(P.p(m,$),$&64&&f(P,1)):(P=qt(m),P.c(),f(P,1),P.m(s.parentNode,s)):P&&(V(),g(P,1,1,()=>{P=null}),W()),m[6]==="success"?S?(S.p(m,$),$&64&&f(S,1)):(S=Jt(m),S.c(),f(S,1),S.m(l.parentNode,l)):S&&(V(),g(S,1,1,()=>{S=null}),W())},i(m){c||(f(a),f(u),f(d),f(A),f(I),f(P),f(S),c=!0)},o(m){g(a),g(u),g(d),g(A),g(I),g(P),g(S),c=!1},d(m){m&&(h(e),h(r),h(n),h(i),h(o),h(s),h(l)),a&&a.d(m),u&&u.d(m),d&&d.d(m),A&&A.d(m),I&&I.d(m),P&&P.d(m),S&&S.d(m)}}}function zo(t){let e,r=t[9].includes(t[6]),n,i,o,s,l=r&&Ft(t);return o=new Lt({props:{$$slots:{default:[Wo]},$$scope:{ctx:t}}}),{c(){e=w("div"),l&&l.c(),n=Q(),i=w("div"),v(o.$$.fragment),b(i,"class","rcb-ui-main svelte-17btec4"),b(e,"class","rcb-ui-layout svelte-17btec4"),b(e,"style",t[7])},m(c,a){_(c,e,a),l&&l.m(e,null),M(e,n),M(e,i),y(o,i,null),s=!0},p(c,a){a&64&&(r=c[9].includes(c[6])),r?l?(l.p(c,a),a&64&&f(l,1)):(l=Ft(c),l.c(),f(l,1),l.m(e,n)):l&&(V(),g(l,1,1,()=>{l=null}),W());const u={};a&33554554&&(u.$$scope={dirty:a,ctx:c}),o.$set(u)},i(c){s||(f(l),f(o.$$.fragment,c),s=!0)},o(c){g(l),g(o.$$.fragment,c),s=!1},d(c){c&&h(e),l&&l.d(),k(o)}}}function Xo(t){let e,r,n;return r=new Ro({props:{condition:t[0],$$slots:{default:[zo]},$$scope:{ctx:t}}}),{c(){e=w("div"),v(r.$$.fragment),b(e,"class","rcb-ui-container svelte-17btec4")},m(i,o){_(i,e,o),y(r,e,null),n=!0},p(i,[o]){const s={};o&1&&(s.condition=i[0]),o&33554558&&(s.$$scope={dirty:o,ctx:i}),r.$set(s)},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){g(r.$$.fragment,i),n=!1},d(i){i&&h(e),k(r)}}}function Zo(t,e,r){let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:o}=e,{rcPackage:s}=e,{purchaseOption:l}=e,{brandingInfo:c}=e,{onFinished:a}=e,{onError:u}=e,{onClose:d}=e,{purchases:A}=e,{purchaseOperationHelper:I}=e;const P=Object.entries(Re).map(([D,ct])=>`--rc-color-${D}: ${ct}`).join("; ");let S=null,m=null,$=null;const le=s.rcBillingProduct.identifier??null,O=s.rcBillingProduct.defaultPurchaseOption,on=l||O;let K="present-offer";const Ts=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];Ue(async()=>{if(r(3,S=s.rcBillingProduct),K==="present-offer"){i?sn():r(6,K="needs-auth-info");return}});const Rs=()=>{d()},sn=()=>{if(le===null){Qe(new X(ne.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else K==="present-offer"&&r(6,K="loading");if(!i){Qe(new X(ne.MissingEmailError));return}I.startPurchase(o,le,on,i,s.rcBillingProduct.presentedOfferingContext).then(D=>{if(D.next_action==="collect_payment_info"){r(5,$=null),r(6,K="needs-payment-info"),r(4,m=D);return}if(D.next_action==="completed"){r(5,$=null),r(6,K="success");return}}).catch(D=>{Qe(D)})},Qs=D=>{if(K==="needs-auth-info"){D&&(r(14,i=D.email),r(6,K="processing-auth-info")),sn();return}if(K==="needs-payment-info"){r(6,K="polling-purchase-status"),I.pollCurrentPurchaseForCompletion().then(()=>{r(6,K="success")}).catch(ct=>{Qe(ct)});return}if(K==="success"||K==="error"){a();return}r(6,K="success")},Qe=D=>{if(K==="processing-auth-info"&&D.isRecoverable()){r(5,$=D),r(6,K="needs-auth-info");return}r(5,$=D),r(6,K="error")},Os=()=>{u($??new X(ne.UnknownError,"Unknown error without state set."))};return t.$$set=D=>{"asModal"in D&&r(0,n=D.asModal),"customerEmail"in D&&r(14,i=D.customerEmail),"appUserId"in D&&r(15,o=D.appUserId),"rcPackage"in D&&r(16,s=D.rcPackage),"purchaseOption"in D&&r(17,l=D.purchaseOption),"brandingInfo"in D&&r(1,c=D.brandingInfo),"onFinished"in D&&r(18,a=D.onFinished),"onError"in D&&r(19,u=D.onError),"onClose"in D&&r(20,d=D.onClose),"purchases"in D&&r(2,A=D.purchases),"purchaseOperationHelper"in D&&r(21,I=D.purchaseOperationHelper)},[n,c,A,S,m,$,K,P,on,Ts,Rs,Qs,Qe,Os,i,o,s,l,a,u,d,I]}class es extends U{constructor(e){super(),N(this,e,Zo,Xo,B,{asModal:0,customerEmail:14,appUserId:15,rcPackage:16,purchaseOption:17,brandingInfo:1,onFinished:18,onError:19,onClose:20,purchases:2,purchaseOperationHelper:21},Ho)}}function ts(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function ns(t,e,r,n){const i=e.product_identifier;if(i in r)return rs(t,e,r[i]);if(i in n)return is(t,e,n[i]);throw new z(te.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function rs(t,e,r){return{identifier:t,isActive:ts(e),willRenew:ls(e,r),store:(r==null?void 0:r.store)??"unknown",latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(e.purchase_date),expirationDate:Ke(e.expires_date),productIdentifier:e.product_identifier,unsubscribeDetectedAt:Ke(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:Ke(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 is(t,e,r){return{identifier:t,isActive:!0,willRenew:!1,store:r.store,latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(r.original_purchase_date),expirationDate:null,productIdentifier:e.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:r.is_sandbox,periodType:"normal"}}function os(t,e,r){const n={},i={};for(const o in t){const s=ns(o,t[o],e,r);n[o]=s,s.isActive&&(i[o]=s)}return{all:n,active:i}}function Ke(t){return t==null?null:new Date(t)}function ss(t){const e=as(t),r=t.subscriber,n=fs(r.non_subscriptions);return{entitlements:os(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:cs(t,n),activeSubscriptions:us(e),managementURL:r.management_url,requestDate:new Date(t.request_date),firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Ke(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id}}function ls(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,o=e.billing_issues_detected_at!=null;return!(r||n||i||o)}function cs(t,e){const r={};for(const n in t.subscriber.subscriptions){const i=t.subscriber.subscriptions[n];r[n]=new Date(i.purchase_date)}for(const n in e){const i=e[n].purchase_date;i==null?r[n]=null:r[n]=new Date(i)}return r}function as(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 us(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}function fs(t){const e={};for(const r in t){if(t[r].length===0)continue;const n=t[r].length;e[r]=t[r][n-1]}return e}const ds="0.9.0",gs="https://api.revenuecat.com";var je;(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"})(je||(je={}));function rt(t){return t?t.startsWith("rcb_sb_"):!1}async function Ee(t,e){const{apiKey:r,body:n,headers:i,httpConfig:o}=e,l=`${(o==null?void 0:o.proxyURL)??gs}${t.urlPath()}`;try{const c=await fetch(l,{method:t.method,headers:_s(r,i,o==null?void 0:o.additionalHeaders),body:ps(n)});return await ms(c,t),await c.json()}catch(c){throw c instanceof TypeError?new z(te.NetworkError,Be.getPublicMessage(te.NetworkError),c.message):c}}async function ms(t,e){const r=t.status;if(r>=je.INTERNAL_SERVER_ERROR)it(e,r,await t.text());else if(r>=je.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,o=n==null?void 0:n.code,s=n==null?void 0:n.message;if(o!=null){const l=Be.convertCodeToBackendErrorCode(o);if(l==null)it(e,r,i,o);else throw z.getForBackendError(l,s)}else it(e,r,i)}}function it(t,e,r,n){throw new z(te.UnknownBackendError,"Unknown backend error.",`Request: ${t.name}. Status code: ${e}. Body: ${r}.`,{backendErrorCode:n})}function ps(t){return t==null?null:JSON.stringify(t)}const Vt="Authorization",Wt="Content-Type",zt="Accept",Xt="X-Platform",Zt="X-Version",en="X-Is-Sandbox",hs=new Set([Vt,Wt,zt,Xt,Zt,en]);function _s(t,e,r){let n={[Vt]:`Bearer ${t}`,[Wt]:"application/json",[zt]:"application/json",[Xt]:"web",[Zt]:ds,[en]:`${rt(t)}`};return e&&(n={...n,...e}),r&&(n={...r,...n}),n}const tn="/v1/subscribers",qe="/rcbilling/v1";class As{constructor(e){C(this,"appUserId");C(this,"method","GET");C(this,"name","getOfferings");this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${tn}/${e}/offerings`}}class bs{constructor(){C(this,"method","POST");C(this,"name","purchase")}urlPath(){return`${qe}/purchase`}}class Es{constructor(e,r,n){C(this,"method","GET");C(this,"name","getProducts");C(this,"appUserId");C(this,"productIds");C(this,"currency");this.appUserId=e,this.productIds=r,this.currency=n}urlPath(){const e=encodeURIComponent(this.appUserId),r=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`&currency=${this.currency}`:"";return`${qe}/subscribers/${e}/products?id=${r}${n}`}}class Is{constructor(e){C(this,"method","GET");C(this,"name","getCustomerInfo");C(this,"appUserId");this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${tn}/${e}`}}class ws{constructor(){C(this,"method","GET");C(this,"name","getBrandingInfo")}urlPath(){return`${qe}/branding`}}class ys{constructor(e){C(this,"method","GET");C(this,"name","getCheckoutStatus");C(this,"operationSessionId");this.operationSessionId=e}urlPath(){return`${qe}/checkout/${this.operationSessionId}`}}const ot={};class ks{constructor(e,r=ot){C(this,"API_KEY");C(this,"httpConfig");this.API_KEY=e,this.httpConfig=r}async getOfferings(e){return await Ee(new As(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(e){return await Ee(new Is(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(e,r,n){return await Ee(new Es(e,r,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await Ee(new ws,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(e,r,n,i,o){const s={app_user_id:e,product_id:r,email:n,price_id:o.priceId,presented_offering_identifier:i.offeringIdentifier};return o.id!=="base_option"&&(s.offer_id=o.id),i.targetingContext&&(s.applied_targeting_rule={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision}),i.placementIdentifier&&(s.presented_placement_identifier=i.placementIdentifier),await Ee(new bs,{apiKey:this.API_KEY,body:s,httpConfig:this.httpConfig})}async getCheckoutStatus(e){return await Ee(new ys(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function vs(t){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(t))throw new z(te.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function $s(t){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new z(te.InvalidAppUserIdError,'Provided user id: "'+t+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Bs(t){if(t!=null&&t.endsWith("/"))throw new z(te.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function Ps(t){if(t){for(const e in t)if(hs.has(e))throw new z(te.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}function Ds(t,e){async function r(...n){return await this.preload(),await t.call(this,...n)}return r}const nn=(t,e)=>({...t,rcBillingProduct:{...t.rcBillingProduct,presentedOfferingContext:{...t.rcBillingProduct.presentedOfferingContext,placementIdentifier:e}}}),ge=(t,e)=>t==null?null:nn(t,e),Cs=(t,e,r)=>{const n=t.offering_ids_by_placement??null;if(n==null)return null;const i=t.fallback_offering_id??null;let o;if(r in n){const l=n[r]??null;if(l==null)return null;o=e[l],o==null&&(o=e[i])}else o=e[i];if(o==null)return null;const s=Object.fromEntries(Object.entries(o.packagesById).map(([l,c])=>[l,nn(c,r)]));return{...o,packagesById:s,availablePackages:Object.values(s),weekly:ge(o.weekly,r),monthly:ge(o.monthly,r),twoMonth:ge(o.twoMonth,r),threeMonth:ge(o.threeMonth,r),sixMonth:ge(o.sixMonth,r),annual:ge(o.annual,r),lifetime:ge(o.lifetime,r)}};function Ms(t,e){const r={};e.product_details.forEach(o=>{r[o.identifier]=o});const n={};t.offerings.forEach(o=>{const s=o.identifier===t.current_offering_id,l=Wn(s,o,r,t.targeting);l!=null&&(n[o.identifier]=l)});const i=t.current_offering_id?n[t.current_offering_id]??null:null;return Object.keys(n).length==0&&x.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:i}}rn=[Ds];const se=class se{constructor(e,r,n=ot){mn(lt,5,this);C(this,"_API_KEY");C(this,"_appUserId");C(this,"_brandingInfo",null);C(this,"_loadingResourcesPromise",null);C(this,"backend");C(this,"purchaseOperationHelper");this._API_KEY=e,this._appUserId=r,rt(e)&&x.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new ks(this._API_KEY,n),this.purchaseOperationHelper=new dr(this.backend)}static setLogLevel(e){x.setLogLevel(e)}static getSharedInstance(){if(se.isConfigured())return se.instance;throw new yt}static isConfigured(){return se.instance!==void 0}static configure(e,r,n=ot){return se.instance!==void 0&&x.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),vs(e),$s(r),Bs(n.proxyURL),Ps(n.additionalHeaders),se.instance=new se(e,r,n),se.getSharedInstance()}async preload(){if(this.hasLoadedResources()){x.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){x.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.backend.getBrandingInfo().then(e=>{this._brandingInfo=e}).catch(e=>{let r=`${e}`;e instanceof z&&(r=`${e.message}. ${e.underlyingErrorMessage?`Underlying error: ${e.underlyingErrorMessage}`:""}`),x.errorLog(`Error fetching branding info: ${r}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}hasLoadedResources(){return this._brandingInfo!==null}async getOfferings(e){so(e==null?void 0:e.currency);const r=this._appUserId,n=await this.backend.getOfferings(r);return await this.getAllOfferings(n,r,e)}async getCurrentOfferingForPlacement(e,r){const n=this._appUserId,i=await this.backend.getOfferings(n),o=await this.getAllOfferings(i,n,r),s=i.placements??null;return s==null?null:Cs(s,o.all,e)}async getAllOfferings(e,r,n){const i=e.offerings.flatMap(s=>s.packages).map(s=>s.platform_product_identifier),o=await this.backend.getProducts(r,i,n==null?void 0:n.currency);return this.logMissingProductIds(i,o.product_details),Ms(e,o)}async isEntitledTo(e){const r=await this.getCustomerInfo();return e in r.entitlements.active}purchasePackage(e,r,n){return this.purchase({rcPackage:e,customerEmail:r,htmlTarget:n})}purchase(e){const{rcPackage:r,purchaseOption:n,htmlTarget:i,customerEmail:o}=e;let s=i??document.getElementById("rcb-ui-root");if(s===null){const u=document.createElement("div");u.className="rcb-ui-root",document.body.appendChild(u),s=u}if(s===null)throw new Error("Could not generate a mount point for the billing widget");const l=s,c=!i,a=this._appUserId;return x.debugLog(`Presenting purchase form for package ${r.identifier}`),new Promise((u,d)=>{new es({target:l,props:{appUserId:a,rcPackage:r,purchaseOption:n,customerEmail:o,onFinished:async()=>{x.debugLog("Purchase finished"),l.innerHTML="",u({customerInfo:await this._getCustomerInfoForUserId(a)})},onClose:()=>{l.innerHTML="",x.debugLog("Purchase cancelled by user"),d(new z(te.UserCancelledError))},onError:A=>{l.innerHTML="",d(z.getForPurchasesFlowError(A))},purchases:this,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,asModal:c}})})}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(o=>n[o.identifier]=o);const i=[];e.forEach(o=>{n[o]===void 0&&i.push(o)}),i.length>0&&x.debugLog(`Could not find product data for product ids:
8
- ${i.join()}.
9
- Please check that your product configuration is correct.`)}isSandbox(){return rt(this._API_KEY)}close(){se.instance===this?se.instance=void 0:x.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const r=await this.backend.getCustomerInfo(e);return ss(r)}};lt=dn(null),pn(lt,1,"purchase",rn,se),ut(lt,se),C(se,"instance");let st=se;E.ErrorCode=te,E.LogLevel=oe,E.PackageType=_t,E.ProductType=Fe,E.Purchases=st,E.PurchasesError=z,E.UninitializedPurchasesError=yt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
21
+ -20px 0 #fff2;background:#fff2}}`)}function so(t){let e;return{c(){e=v("div"),b(e,"class","processing svelte-rjmul6")},m(r,n){g(r,e,n)},p:h,i:h,o:h,d(r){r&&_(e)}}}class Vt extends j{constructor(e){super(),C(this,e,null,so,A,{},oo)}}const lo={error:"#f2545b",warning:"#f4e971",focus:"#576CDB",accent:"#576CDB",primary:"#000000","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.5)","grey-ui-dark":"rgba(0,0,0,0.125)","grey-ui-light":"rgba(0,0,0,0.005)","input-background":"transparent",background:"white"},ao={error:"#f2545b",warning:"#f4e971",focus:"#576CDB",accent:"#576CDB",primary:"#ffffff","primary-text":"#000000",white:"#ffffff","grey-text-dark":"rgba(255,255,255,1)","grey-text-light":"rgba(255,255,255,0.5)","grey-ui-dark":"rgba(255,255,255,0.125)","grey-ui-light":"rgba(255,255,255,0.005)","input-background":"transparent",background:"#000000"},Yt={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},co={...Yt,background:"color_form_bg"},uo={...Yt,background:"color_product_info_bg"},zt={"input-border-radius":"12px","input-button-border-radius":"12px","modal-border-radius":"16px"},fo={"input-border-radius":"0px","input-button-border-radius":"0px","modal-border-radius":"0px"},po={"input-border-radius":"24px","input-button-border-radius":"56px","modal-border-radius":"16px"},Wt=zt,Kt=t=>t.length==7?{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)}:t.length==4?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null,Qt=({r:t,g:e,b:r})=>{const n=o=>(o=o/255,o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4));return .2126*n(t)+.7152*n(e)+.0722*n(r)>.179},mo=t=>{const e=Qt(t)?"0,0,0":"255,255,255";return{"grey-text-dark":`rgba(${e},1.0)`,"grey-text-light":`rgba(${e},0.50)`,"grey-ui-dark":`rgba(${e},0.125)`,"grey-ui-light":`rgba(${e},0.05)`}},_o=(t,e,r)=>{const n={"grey-text-dark":r["grey-text-dark"],"grey-text-light":r["grey-text-light"],"grey-ui-dark":r["grey-ui-dark"],"grey-ui-light":r["grey-ui-light"],"primary-text":r["primary-text"]};if(t!=null&&t.startsWith("#")){const i=Kt(t);i!==null&&Object.assign(n,mo(i))}if(e!=null&&e.startsWith("#")){const i=Kt(e);i!==null&&(n["primary-text"]=Qt(i)?"black":"white")}return n},go=(t,e)=>t||e,ho=(t,e,r)=>{const n=Object.entries(t).map(([i,o])=>[i,go(r?r[o]:null,e[i])]);return Object.fromEntries(n)},Xt=(t,e,r)=>{const n=ho(t,e,r);return r?{...e,...n,..._o(n.background,n.primary,e)}:{...e}},bo=t=>Xt(uo,ao,t),Zt=t=>Xt(co,lo,t),at=t=>{if(!t)return Wt;switch(t.shapes){case"rounded":return zt;case"rectangle":return fo;case"pill":return po;default:return Wt}},Ve=(t="",e)=>e.map(([r,n])=>`--rc-${t}-${r}: ${n}`).join("; "),Jt=t=>{const e=Ve("color",Object.entries(bo(t))),r=Ve("shape",Object.entries(at(t)));return[e,r].join("; ")},wo=t=>{const e=Ve("color",Object.entries(Zt(t))),r=Ve("shape",Object.entries(at(t)));return[e,r].join("; ")};class ct{constructor(e){this.brandingAppearance=e}get shape(){return at(this.brandingAppearance)}get formColors(){return Zt(this.brandingAppearance)}get formStyleVars(){return wo(this.brandingAppearance)}get productInfoStyleVars(){return Jt(this.brandingAppearance)}}function yo(t){R(t,"svelte-8jsoa8",".rcb-stripe-elements-container.svelte-8jsoa8{width:100%;min-height:320px;margin-top:32px;margin-bottom:24px}")}function Eo(t){let e,r;return e=new rt({}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p:h,i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function vo(t){let e,r,n,i,o,s,l,a;e=new lt({props:{$$slots:{default:[Io]},$$scope:{ctx:t}}});function c(f){t[14](f)}let u={stripe:t[5],clientSecret:t[6],loader:"always",locale:"en",theme:"stripe",variables:{borderRadius:t[8]["input-border-radius"],fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",focusBoxShadow:"none",colorDanger:t[9].error,colorTextPlaceholder:t[9]["grey-text-light"]},rules:{".Input":{boxShadow:"none",border:`2px solid ${t[9]["grey-ui-dark"]}`,backgroundColor:"transparent",color:t[9]["grey-text-dark"]},".Input:focus":{border:`2px solid ${t[9].focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px",color:t[9]["grey-text-dark"]},".Input--invalid":{boxShadow:"none"},".Tab":{boxShadow:"none",backgroundColor:"transparent"}},$$slots:{default:[Uo]},$$scope:{ctx:t}};return t[4]!==void 0&&(u.elements=t[4]),i=new qi({props:u}),je.push(()=>Qn(i,"elements",c)),{c(){T(e.$$.fragment),r=S(),n=v("form"),T(i.$$.fragment)},m(f,m){k(e,f,m),g(f,r,m),g(f,n,m),k(i,n,null),s=!0,l||(a=Pe(n,"submit",wt(t[7])),l=!0)},p(f,m){const w={};m&131074&&(w.$$scope={dirty:m,ctx:f}),e.$set(w);const I={};m&32&&(I.stripe=f[5]),m&131085&&(I.$$scope={dirty:m,ctx:f}),!o&&m&16&&(o=!0,I.elements=f[4],zn(()=>o=!1)),i.$set(I)},i(f){s||(d(e.$$.fragment,f),d(i.$$.fragment,f),s=!0)},o(f){p(e.$$.fragment,f),p(i.$$.fragment,f),s=!1},d(f){f&&(_(r),_(n)),P(e,f),P(i),l=!1,a()}}}function Io(t){let e,r,n,i,o,s,l;return r=new io({}),s=new st({}),s.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){e=v("div"),T(r.$$.fragment),n=S(),i=v("div"),i.textContent="Secure Checkout",o=S(),T(s.$$.fragment),fe(i,"margin-left","10px"),fe(e,"display","flex"),fe(e,"align-items","center"),fe(e,"justify-content","baseline")},m(a,c){g(a,e,c),k(r,e,null),L(e,n),L(e,i),g(a,o,c),k(s,a,c),l=!0},p(a,c){t=a},i(a){l||(d(r.$$.fragment,a),d(s.$$.fragment,a),l=!0)},o(a){p(r.$$.fragment,a),p(s.$$.fragment,a),l=!1},d(a){a&&(_(e),_(o)),P(r),P(s,a)}}}function $o(t){let e,r,n;return r=new ji({}),{c(){e=v("div"),T(r.$$.fragment),b(e,"class","rcb-stripe-elements-container svelte-8jsoa8")},m(i,o){g(i,e,o),k(r,e,null),n=!0},p:h,i(i){n||(d(r.$$.fragment,i),n=!0)},o(i){p(r.$$.fragment,i),n=!1},d(i){i&&_(e),P(r)}}}function ko(t){let e;return{c(){e=V("Pay")},m(r,n){g(r,e,n)},i:h,o:h,d(r){r&&_(e)}}}function Po(t){let e;return{c(){e=V("Start Trial")},m(r,n){g(r,e,n)},i:h,o:h,d(r){r&&_(e)}}}function To(t){let e,r;return e=new Vt({}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Ao(t){let e,r,n,i;const o=[To,Po,ko],s=[];function l(a,c){var u,f;return a[0]?0:(f=(u=a[2].subscriptionOptions)==null?void 0:u[a[3].id])!=null&&f.trial?1:2}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=ae()},m(a,c){s[e].m(a,c),g(a,n,c),i=!0},p(a,c){let u=e;e=l(a),e!==u&&(Q(),p(s[u],1,1,()=>{s[u]=null}),X(),r=s[e],r||(r=s[e]=o[e](a),r.c()),d(r,1),r.m(n.parentNode,n))},i(a){i||(d(r),i=!0)},o(a){p(r),i=!1},d(a){a&&_(n),s[e].d(a)}}}function Oo(t){let e,r;return e=new it({props:{disabled:t[0],testId:"PayButton",$$slots:{default:[Ao]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&1&&(o.disabled=n[0]),i&131085&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function No(t){let e,r;return e=new Re({props:{$$slots:{default:[Oo]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&131085&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Uo(t){let e,r,n,i;return e=new Ee({props:{$$slots:{default:[$o]},$$scope:{ctx:t}}}),n=new ot({props:{$$slots:{default:[No]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment),r=S(),T(n.$$.fragment)},m(o,s){k(e,o,s),g(o,r,s),k(n,o,s),i=!0},p(o,s){const l={};s&131072&&(l.$$scope={dirty:s,ctx:o}),e.$set(l);const a={};s&131085&&(a.$$scope={dirty:s,ctx:o}),n.$set(a)},i(o){i||(d(e.$$.fragment,o),d(n.$$.fragment,o),i=!0)},o(o){p(e.$$.fragment,o),p(n.$$.fragment,o),i=!1},d(o){o&&_(r),P(e,o),P(n,o)}}}function Ro(t){let e,r,n,i;const o=[vo,Eo],s=[];function l(a,c){return a[5]&&a[6]?0:1}return r=l(t),n=s[r]=o[r](t),{c(){e=v("div"),n.c()},m(a,c){g(a,e,c),s[r].m(e,null),i=!0},p(a,[c]){let u=r;r=l(a),r===u?s[r].p(a,c):(Q(),p(s[u],1,1,()=>{s[u]=null}),X(),n=s[r],n?n.p(a,c):(n=s[r]=o[r](a),n.c()),d(n,1),n.m(e,null))},i(a){i||(d(n),i=!0)},o(a){p(n),i=!1},d(a){a&&_(e),s[r].d()}}}function Lo(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:o}=e,{paymentInfoCollectionMetadata:s}=e,{processing:l=!1}=e,{productDetails:a}=e,{purchaseOptionToUse:c}=e,{brandingInfo:u}=e;const f=s.data.client_secret;let m=null,w,I;Ce(async()=>{const U=s.data.publishable_api_key,x=s.data.stripe_account_id;if(!U||!x)throw new Error("Stripe publishable key or account ID not found");r(5,m=await Qi(U,{stripeAccount:x}))});const O=async()=>{if(l||!m||!I)return;r(0,l=!0);const U=await m.confirmSetup({elements:I,redirect:"if_required"});U.error?(r(0,l=!1),o(new J(te.StripeError,U.error.message))):i()},y=new ct(u==null?void 0:u.appearance);let N=y.shape,ie=y.formColors;function $(U){w=U,r(4,w)}return t.$$set=U=>{"onClose"in U&&r(1,n=U.onClose),"onContinue"in U&&r(10,i=U.onContinue),"onError"in U&&r(11,o=U.onError),"paymentInfoCollectionMetadata"in U&&r(12,s=U.paymentInfoCollectionMetadata),"processing"in U&&r(0,l=U.processing),"productDetails"in U&&r(2,a=U.productDetails),"purchaseOptionToUse"in U&&r(3,c=U.purchaseOptionToUse),"brandingInfo"in U&&r(13,u=U.brandingInfo)},t.$$.update=()=>{t.$$.dirty&16&&w&&w._elements.length>0&&(I=w)},[l,n,a,c,w,m,f,O,N,ie,i,o,s,u,$]}class So extends j{constructor(e){super(),C(this,e,Lo,Ro,A,{onClose:1,onContinue:10,onError:11,paymentInfoCollectionMetadata:12,processing:0,productDetails:2,purchaseOptionToUse:3,brandingInfo:13},yo)}}function Mo(t){return t.trim()===""?"You need to provide your email address to continue.":t.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function Do(t){if(t&&!t.match(/^[A-Z]{3}$/)){const e=`Currency code ${t} is not valid. Please provide a valid ISO 4217 currency code.`;throw q.errorLog(e),new Z(ee.ConfigurationError,e)}}function Bo(t){R(t,"svelte-yf01ty",".container.svelte-yf01ty.svelte-yf01ty{display:flex;flex-direction:column;flex-grow:1}form.svelte-yf01ty.svelte-yf01ty{display:flex;flex-direction:column;min-height:100%;flex-grow:1}.form-container.svelte-yf01ty.svelte-yf01ty{display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px}.form-label.svelte-yf01ty.svelte-yf01ty{margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px}.form-input.error.svelte-yf01ty input.svelte-yf01ty{border-color:var(--rc-color-error)}.form-error.svelte-yf01ty.svelte-yf01ty{margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error)}input.svelte-yf01ty.svelte-yf01ty{width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:var(--rc-shape-input-border-radius);font-size:16px;height:48px;padding:6px 14px;background:var(--rc-color-input-background);color:inherit}input.svelte-yf01ty.svelte-yf01ty:focus{outline:none;border:2px solid var(--rc-color-focus)}")}function Co(t){let e,r,n,i;return n=new st({}),n.$on("click",function(){ne(t[0])&&t[0].apply(this,arguments)}),{c(){e=v("span"),e.textContent="Billing email address",r=S(),T(n.$$.fragment)},m(o,s){g(o,e,s),g(o,r,s),k(n,o,s),i=!0},p(o,s){t=o},i(o){i||(d(n.$$.fragment,o),i=!0)},o(o){p(n.$$.fragment,o),i=!1},d(o){o&&(_(e),_(r)),P(n,o)}}}function en(t){let e,r;return{c(){e=v("div"),r=V(t[2]),b(e,"class","form-error svelte-yf01ty")},m(n,i){g(n,e,i),L(e,r)},p(n,i){i&4&&ue(r,n[2])},d(n){n&&_(e)}}}function jo(t){let e,r,n,i,o,s,l,a,c,u=t[2]&&en(t);return{c(){e=v("div"),r=v("div"),r.innerHTML='<label for="email">Email</label>',n=S(),i=v("div"),o=v("input"),l=S(),u&&u.c(),b(r,"class","form-label svelte-yf01ty"),b(o,"name","email"),b(o,"placeholder","john@appleseed.com"),b(o,"autocapitalize","off"),b(o,"class","svelte-yf01ty"),b(i,"class",s="form-input "+t[4]+" svelte-yf01ty"),b(e,"class","form-container svelte-yf01ty")},m(f,m){g(f,e,m),L(e,r),L(e,n),L(e,i),L(i,o),yt(o,t[3]),L(e,l),u&&u.m(e,null),a||(c=Pe(o,"input",t[8]),a=!0)},p(f,m){m&8&&o.value!==f[3]&&yt(o,f[3]),m&16&&s!==(s="form-input "+f[4]+" svelte-yf01ty")&&b(i,"class",s),f[2]?u?u.p(f,m):(u=en(f),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},d(f){f&&_(e),u&&u.d(),a=!1,c()}}}function Fo(t){let e;return{c(){e=V("Continue")},m(r,n){g(r,e,n)},i:h,o:h,d(r){r&&_(e)}}}function Ho(t){let e,r;return e=new Vt({}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function qo(t){let e,r,n,i;const o=[Ho,Fo],s=[];function l(a,c){return a[1]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=ae()},m(a,c){s[e].m(a,c),g(a,n,c),i=!0},p(a,c){let u=e;e=l(a),e!==u&&(Q(),p(s[u],1,1,()=>{s[u]=null}),X(),r=s[e],r||(r=s[e]=o[e](a),r.c()),d(r,1),r.m(n.parentNode,n))},i(a){i||(d(r),i=!0)},o(a){p(r),i=!1},d(a){a&&_(n),s[e].d(a)}}}function xo(t){let e,r;return e=new it({props:{disabled:t[1],type:"submit",$$slots:{default:[qo]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&2&&(o.disabled=n[1]),i&514&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Go(t){let e,r;return e=new Re({props:{$$slots:{default:[xo]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&514&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Vo(t){let e,r,n,i,o,s,l,a,c,u;return r=new lt({props:{$$slots:{default:[Co]},$$scope:{ctx:t}}}),o=new Ee({props:{$$slots:{default:[jo]},$$scope:{ctx:t}}}),l=new ot({props:{$$slots:{default:[Go]},$$scope:{ctx:t}}}),{c(){e=v("div"),T(r.$$.fragment),n=S(),i=v("form"),T(o.$$.fragment),s=S(),T(l.$$.fragment),b(i,"class","svelte-yf01ty"),b(e,"class","container svelte-yf01ty")},m(f,m){g(f,e,m),k(r,e,null),L(e,n),L(e,i),k(o,i,null),L(i,s),k(l,i,null),a=!0,c||(u=Pe(i,"submit",wt(t[5])),c=!0)},p(f,[m]){const w={};m&513&&(w.$$scope={dirty:m,ctx:f}),r.$set(w);const I={};m&540&&(I.$$scope={dirty:m,ctx:f}),o.$set(I);const O={};m&514&&(O.$$scope={dirty:m,ctx:f}),l.$set(O)},i(f){a||(d(r.$$.fragment,f),d(o.$$.fragment,f),d(l.$$.fragment,f),a=!0)},o(f){p(r.$$.fragment,f),p(o.$$.fragment,f),p(l.$$.fragment,f),a=!1},d(f){f&&_(e),P(r),P(o),P(l),c=!1,u()}}}function Yo(t,e,r){let n,i,o,{onContinue:s}=e,{onClose:l}=e,{processing:a}=e,{lastError:c}=e;const u=async()=>{const m=Mo(n);m?r(2,i=m):s({email:n})};Hn(async()=>{r(2,i=(c==null?void 0:c.message)??"")});function f(){n=this.value,r(3,n)}return t.$$set=m=>{"onContinue"in m&&r(6,s=m.onContinue),"onClose"in m&&r(0,l=m.onClose),"processing"in m&&r(1,a=m.processing),"lastError"in m&&r(7,c=m.lastError)},t.$$.update=()=>{t.$$.dirty&4&&r(4,o=i?"error":"")},r(3,n=""),r(2,i=""),[l,a,i,n,o,u,s,c,f]}class zo extends j{constructor(e){super(),C(this,e,Yo,Vo,A,{onContinue:6,onClose:0,processing:1,lastError:7},Bo)}}function Wo(t){R(t,"svelte-17tslso",".rcb-modal-backdrop.svelte-17tslso{position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001}")}function Ko(t){let e,r;const n=t[1].default,i=H(n,t,t[0],null);return{c(){e=v("div"),i&&i.c(),b(e,"class","rcb-modal-backdrop svelte-17tslso")},m(o,s){g(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&1)&&W(i,n,o,o[0],r?z(n,o[0],s,null):K(o[0]),null)},i(o){r||(d(i,o),r=!0)},o(o){p(i,o),r=!1},d(o){o&&_(e),i&&i.d(o)}}}function Qo(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}class Xo extends j{constructor(e){super(),C(this,e,Qo,Ko,A,{},Wo)}}function Zo(t){R(t,"svelte-1fufj5b",".rcb-modal-container.svelte-1fufj5b{width:100%}.rcb-modal-main.svelte-1fufj5b{box-sizing:border-box;border-radius:var(--rc-shape-modal-border-radius);background-color:var(--rc-color-background);color:var(--rc-color-grey-text-dark);padding:40px;flex-direction:column;display:flex}@media screen and (max-width: 960px){.rcb-modal-container.svelte-1fufj5b{width:calc(100% - 32px);min-width:300px;max-width:640px;margin:auto}.rcb-modal-main.svelte-1fufj5b{min-width:300px;max-width:640px;padding:32px}}")}function Jo(t){let e,r,n;const i=t[2].default,o=H(i,t,t[1],null);return{c(){e=v("div"),r=v("main"),o&&o.c(),b(r,"class","rcb-modal-main svelte-1fufj5b"),b(r,"style",t[0]),b(e,"class","rcb-modal-container svelte-1fufj5b")},m(s,l){g(s,e,l),L(e,r),o&&o.m(r,null),n=!0},p(s,[l]){o&&o.p&&(!n||l&2)&&W(o,i,s,s[1],n?z(i,s[1],l,null):K(s[1]),null),(!n||l&1)&&b(r,"style",s[0])},i(s){n||(d(o,s),n=!0)},o(s){p(o,s),n=!1},d(s){s&&_(e),o&&o.d(s)}}}function es(t,e,r){let{$$slots:n={},$$scope:i}=e,{style:o=""}=e;return t.$$set=s=>{"style"in s&&r(0,o=s.style),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class tn extends j{constructor(e){super(),C(this,e,es,Jo,A,{style:0},Zo)}}function ts(t){let e;const r=t[1].default,n=H(r,t,t[2],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&4)&&W(n,r,i,i[2],e?z(r,i[2],o,null):K(i[2]),null)},i(i){e||(d(n,i),e=!0)},o(i){p(n,i),e=!1},d(i){n&&n.d(i)}}}function ns(t){let e,r;return e=new Xo({props:{$$slots:{default:[rs]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function rs(t){let e;const r=t[1].default,n=H(r,t,t[2],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&4)&&W(n,r,i,i[2],e?z(r,i[2],o,null):K(i[2]),null)},i(i){e||(d(n,i),e=!0)},o(i){p(n,i),e=!1},d(i){n&&n.d(i)}}}function is(t){let e,r,n,i;const o=[ns,ts],s=[];function l(a,c){return a[0]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=ae()},m(a,c){s[e].m(a,c),g(a,n,c),i=!0},p(a,[c]){let u=e;e=l(a),e===u?s[e].p(a,c):(Q(),p(s[u],1,1,()=>{s[u]=null}),X(),r=s[e],r?r.p(a,c):(r=s[e]=o[e](a),r.c()),d(r,1),r.m(n.parentNode,n))},i(a){i||(d(r),i=!0)},o(a){p(r),i=!1},d(a){a&&_(n),s[e].d(a)}}}function os(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:o=!1}=e;return t.$$set=s=>{"condition"in s&&r(0,o=s.condition),"$$scope"in s&&r(2,i=s.$$scope)},[o,n,i]}class ss extends j{constructor(e){super(),C(this,e,os,is,A,{condition:0})}}const ls=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
22
+ xmlns="http://www.w3.org/2000/svg">
23
+ <g opacity="0.5" clip-path="url(#clip0_344_3390)">
24
+ <path d="M7 18C5.9 18 5.01 18.9 5.01 20C5.01 21.1 5.9 22 7 22C8.1 22 9 21.1 9 20C9 18.9 8.1 18 7 18ZM1 2V4H3L6.6 11.59L5.25 14.04C5.09 14.32 5 14.65 5 15C5 16.1 5.9 17 7 17H19V15H7.42C7.28 15 7.17 14.89 7.17 14.75L7.2 14.63L8.1 13H15.55C16.3 13 16.96 12.59 17.3 11.97L20.88 5.48C20.96 5.34 21 5.17 21 5C21 4.45 20.55 4 20 4H5.21L4.27 2H1ZM17 18C15.9 18 15.01 18.9 15.01 20C15.01 21.1 15.9 22 17 22C18.1 22 19 21.1 19 20C19 18.9 18.1 18 17 18Z"
25
+ fill="currentColor"/>
26
+ </g>
27
+ <defs>
28
+ <clipPath id="clip0_344_3390">
29
+ <rect width="24" height="24" fill="currentColor"/>
30
+ </clipPath>
31
+ </defs>
32
+ </svg>
33
+ `;function as(t){let e;return{c(){e=v("div"),fe(e,"color","var(--rc-color-gray-text-dark)")},m(r,n){g(r,e,n),e.innerHTML=ls},p:h,i:h,o:h,d(r){r&&_(e)}}}class cs extends j{constructor(e){super(),C(this,e,null,as,A,{})}}function us(t){R(t,"svelte-1ny4y2s","div.svelte-1ny4y2s{background-color:var(--rc-color-warning);color:rgba(0,0,0,1);font-size:10px;font-weight:bold;text-transform:uppercase;padding:4px 10px;line-height:10px;border-radius:9px;margin:0px;margin-left:16px}")}function fs(t){let e;return{c(){e=v("div"),e.textContent="Sandbox",b(e,"class","svelte-1ny4y2s")},m(r,n){g(r,e,n)},p:h,i:h,o:h,d(r){r&&_(e)}}}class ds extends j{constructor(e){super(),C(this,e,null,fs,A,{},us)}}function ps(t){R(t,"svelte-1iuls9l",".rcb-ui-layout.svelte-1iuls9l{width:100vw;margin-right:auto;display:flex;justify-content:center;align-items:flex-start;position:relative;padding:0px 80px;box-sizing:border-box}@media screen and (max-width: 960px){.rcb-ui-layout.svelte-1iuls9l{flex-direction:column;align-items:center;justify-content:center;height:100%;min-width:100%}}@media screen and (max-width: 960px) and (max-height: 960px){.rcb-ui-layout.svelte-1iuls9l{overflow-y:scroll;justify-content:flex-start;padding:16px 0}}")}function ms(t){let e,r;const n=t[2].default,i=H(n,t,t[1],null);return{c(){e=v("div"),i&&i.c(),b(e,"class","rcb-ui-layout svelte-1iuls9l"),b(e,"style",t[0])},m(o,s){g(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&2)&&W(i,n,o,o[1],r?z(n,o[1],s,null):K(o[1]),null),(!r||s&1)&&b(e,"style",o[0])},i(o){r||(d(i,o),r=!0)},o(o){p(i,o),r=!1},d(o){o&&_(e),i&&i.d(o)}}}function _s(t,e,r){let{$$slots:n={},$$scope:i}=e,{style:o=""}=e;return t.$$set=s=>{"style"in s&&r(0,o=s.style),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class gs extends j{constructor(e){super(),C(this,e,_s,ms,A,{style:0},ps)}}function hs(t){R(t,"svelte-1sfb5if",`.rcb-ui-container.svelte-1sfb5if{color-scheme:none;font-size:16px;line-height:1.5em;font-weight:400;font-family:-apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
34
+ Cantarell, "Open Sans", "Helvetica Neue", sans-serif}`)}function bs(t){let e,r;const n=t[2].default,i=H(n,t,t[1],null);return{c(){e=v("div"),i&&i.c(),b(e,"class","rcb-ui-container svelte-1sfb5if"),b(e,"style",t[0])},m(o,s){g(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&2)&&W(i,n,o,o[1],r?z(n,o[1],s,null):K(o[1]),null),(!r||s&1)&&b(e,"style",o[0])},i(o){r||(d(i,o),r=!0)},o(o){p(i,o),r=!1},d(o){o&&_(e),i&&i.d(o)}}}function ws(t,e,r){let{$$slots:n={},$$scope:i}=e,{style:o=""}=e;return t.$$set=s=>{"style"in s&&r(0,o=s.style),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class ys extends j{constructor(e){super(),C(this,e,ws,bs,A,{style:0},hs)}}function Es(t){R(t,"svelte-17dr902",".rcb-ui-aside.svelte-17dr902{margin-right:16px;flex:320px 1 0;max-width:480px}@media screen and (max-width: 960px){.rcb-ui-aside.svelte-17dr902{margin-right:0;margin-bottom:16px;min-width:100%;display:flex;flex-direction:column;align-items:center;flex:none;max-width:none}}")}const vs=t=>({}),nn=t=>({});function Is(t){let e,r;const n=t[2].header,i=H(n,t,t[3],nn),o=t[2].default,s=H(o,t,t[3],null);return{c(){i&&i.c(),e=S(),s&&s.c()},m(l,a){i&&i.m(l,a),g(l,e,a),s&&s.m(l,a),r=!0},p(l,a){i&&i.p&&(!r||a&8)&&W(i,n,l,l[3],r?z(n,l[3],a,vs):K(l[3]),nn),s&&s.p&&(!r||a&8)&&W(s,o,l,l[3],r?z(o,l[3],a,null):K(l[3]),null)},i(l){r||(d(i,l),d(s,l),r=!0)},o(l){p(i,l),p(s,l),r=!1},d(l){l&&_(e),i&&i.d(l),s&&s.d(l)}}}function $s(t){let e,r,n;return r=new tn({props:{$$slots:{default:[Is]},$$scope:{ctx:t}}}),{c(){e=v("div"),T(r.$$.fragment),b(e,"class","rcb-ui-aside svelte-17dr902"),b(e,"style",t[0])},m(i,o){g(i,e,o),k(r,e,null),n=!0},p(i,[o]){const s={};o&8&&(s.$$scope={dirty:o,ctx:i}),r.$set(s)},i(i){n||(d(r.$$.fragment,i),n=!0)},o(i){p(r.$$.fragment,i),n=!1},d(i){i&&_(e),P(r)}}}function ks(t,e,r){let{$$slots:n={},$$scope:i}=e,{brandingAppearance:o=void 0}=e,s=new ct(o).productInfoStyleVars;return t.$$set=l=>{"brandingAppearance"in l&&r(1,o=l.brandingAppearance),"$$scope"in l&&r(3,i=l.$$scope)},[s,o,n,i]}class Ps extends j{constructor(e){super(),C(this,e,ks,$s,A,{brandingAppearance:1},Es)}}function Ts(t){R(t,"svelte-vpgys",".rcb-ui-main.svelte-vpgys{flex:480px 1 0;max-width:640px}@media screen and (max-width: 960px){.rcb-ui-main.svelte-vpgys{flex:none;max-width:none;min-width:100%}}")}const As=t=>({}),rn=t=>({});function Os(t){let e,r;const n=t[2].header,i=H(n,t,t[3],rn),o=t[2].default,s=H(o,t,t[3],null);return{c(){i&&i.c(),e=S(),s&&s.c()},m(l,a){i&&i.m(l,a),g(l,e,a),s&&s.m(l,a),r=!0},p(l,a){i&&i.p&&(!r||a&8)&&W(i,n,l,l[3],r?z(n,l[3],a,As):K(l[3]),rn),s&&s.p&&(!r||a&8)&&W(s,o,l,l[3],r?z(o,l[3],a,null):K(l[3]),null)},i(l){r||(d(i,l),d(s,l),r=!0)},o(l){p(i,l),p(s,l),r=!1},d(l){l&&_(e),i&&i.d(l),s&&s.d(l)}}}function Ns(t){let e,r,n;return r=new tn({props:{style:"min-height: 360px;",$$slots:{default:[Os]},$$scope:{ctx:t}}}),{c(){e=v("div"),T(r.$$.fragment),b(e,"class","rcb-ui-main svelte-vpgys"),b(e,"style",t[0])},m(i,o){g(i,e,o),k(r,e,null),n=!0},p(i,[o]){const s={};o&8&&(s.$$scope={dirty:o,ctx:i}),r.$set(s)},i(i){n||(d(r.$$.fragment,i),n=!0)},o(i){p(r.$$.fragment,i),n=!1},d(i){i&&_(e),P(r)}}}function Us(t,e,r){let{$$slots:n={},$$scope:i}=e,{brandingAppearance:o=void 0}=e,s=new ct(o).formStyleVars;return t.$$set=l=>{"brandingAppearance"in l&&r(1,o=l.brandingAppearance),"$$scope"in l&&r(3,i=l.$$scope)},[s,o,n,i]}class Rs extends j{constructor(e){super(),C(this,e,Us,Ns,A,{brandingAppearance:1},Ts)}}function on(t){var n;let e,r;return e=new Ps({props:{brandingAppearance:(n=t[1])==null?void 0:n.appearance,$$slots:{header:[Bs],default:[Ls]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(i,o){k(e,i,o),r=!0},p(i,o){var l;const s={};o&2&&(s.brandingAppearance=(l=i[1])==null?void 0:l.appearance),o&33554454&&(s.$$scope={dirty:o,ctx:i}),e.$set(s)},i(i){r||(d(e.$$.fragment,i),r=!0)},o(i){p(e.$$.fragment,i),r=!1},d(i){P(e,i)}}}function sn(t){var n;let e,r;return e=new Nt({props:{productDetails:t[4],brandingAppearance:(n=t[1])==null?void 0:n.appearance,purchaseOption:t[8]}}),{c(){T(e.$$.fragment)},m(i,o){k(e,i,o),r=!0},p(i,o){var l;const s={};o&16&&(s.productDetails=i[4]),o&2&&(s.brandingAppearance=(l=i[1])==null?void 0:l.appearance),e.$set(s)},i(i){r||(d(e.$$.fragment,i),r=!0)},o(i){p(e.$$.fragment,i),r=!1},d(i){P(e,i)}}}function Ls(t){let e,r,n=t[4]&&t[8]&&sn(t);return{c(){n&&n.c(),e=ae()},m(i,o){n&&n.m(i,o),g(i,e,o),r=!0},p(i,o){i[4]&&i[8]?n?(n.p(i,o),o&16&&d(n,1)):(n=sn(i),n.c(),d(n,1),n.m(e.parentNode,e)):n&&(Q(),p(n,1,1,()=>{n=null}),X())},i(i){r||(d(n),r=!0)},o(i){p(n),r=!1},d(i){i&&_(e),n&&n.d(i)}}}function Ss(t){let e,r;return e=new cs({}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Ms(t){let e,r;return e=new ds({}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Ds(t){let e,r,n,i,o,s,l;e=new Mt({props:{brandingInfo:t[1]}});const a=[Ms,Ss],c=[];function u(f,m){return m&4&&(n=null),n==null&&(n=!!f[2].isSandbox()),n?0:1}return i=u(t,-1),o=c[i]=a[i](t),{c(){T(e.$$.fragment),r=S(),o.c(),s=ae()},m(f,m){k(e,f,m),g(f,r,m),c[i].m(f,m),g(f,s,m),l=!0},p(f,m){const w={};m&2&&(w.brandingInfo=f[1]),e.$set(w);let I=i;i=u(f,m),i!==I&&(Q(),p(c[I],1,1,()=>{c[I]=null}),X(),o=c[i],o||(o=c[i]=a[i](f),o.c()),d(o,1),o.m(s.parentNode,s))},i(f){l||(d(e.$$.fragment,f),d(o),l=!0)},o(f){p(e.$$.fragment,f),p(o),l=!1},d(f){f&&(_(r),_(s)),P(e,f),c[i].d(f)}}}function Bs(t){let e,r;return e=new lt({props:{slot:"header",$$slots:{default:[Ds]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&33554438&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function ln(t){let e,r;return e=new Nt({props:{productDetails:t[4],purchaseOption:t[8]}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&16&&(o.productDetails=n[4]),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function an(t){let e,r;return e=new rt({}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function cn(t){let e,r;return e=new zo({props:{onContinue:t[11],onClose:t[10],processing:t[7]==="processing-auth-info",lastError:t[6]}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&128&&(o.processing=n[7]==="processing-auth-info"),i&64&&(o.lastError=n[6]),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function un(t){let e,r;return e=new So({props:{paymentInfoCollectionMetadata:t[5],onContinue:t[11],onClose:t[10],onError:t[12],processing:t[7]==="polling-purchase-status",productDetails:t[4],purchaseOptionToUse:t[8],brandingInfo:t[1]}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&32&&(o.paymentInfoCollectionMetadata=n[5]),i&128&&(o.processing=n[7]==="polling-purchase-status"),i&16&&(o.productDetails=n[4]),i&2&&(o.brandingInfo=n[1]),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function fn(t){let e,r;return e=new rt({}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function dn(t){var n;let e,r;return e=new Ii({props:{brandingInfo:t[1],lastError:t[6]??new J(te.UnknownError,"Unknown error without state set."),supportEmail:(n=t[1])==null?void 0:n.seller_company_support_email,productDetails:t[4],onContinue:t[13]}}),{c(){T(e.$$.fragment)},m(i,o){k(e,i,o),r=!0},p(i,o){var l;const s={};o&2&&(s.brandingInfo=i[1]),o&64&&(s.lastError=i[6]??new J(te.UnknownError,"Unknown error without state set.")),o&2&&(s.supportEmail=(l=i[1])==null?void 0:l.seller_company_support_email),o&16&&(s.productDetails=i[4]),e.$set(s)},i(i){r||(d(e.$$.fragment,i),r=!0)},o(i){p(e.$$.fragment,i),r=!1},d(i){P(e,i)}}}function pn(t){let e,r;return e=new Li({props:{productDetails:t[4],brandingInfo:t[1],onContinue:t[11]}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&16&&(o.productDetails=n[4]),i&2&&(o.brandingInfo=n[1]),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Cs(t){let e,r,n,i,o,s,l,a,c=t[7]==="present-offer"&&t[4]&&t[8]&&ln(t),u=t[7]==="present-offer"&&!t[4]&&an(),f=(t[7]==="needs-auth-info"||t[7]==="processing-auth-info")&&cn(t),m=t[5]&&(t[7]==="needs-payment-info"||t[7]==="polling-purchase-status")&&t[4]&&t[8]&&un(t),w=t[7]==="loading"&&fn(),I=t[7]==="error"&&dn(t),O=t[7]==="success"&&pn(t);return{c(){c&&c.c(),e=S(),u&&u.c(),r=S(),f&&f.c(),n=S(),m&&m.c(),i=S(),w&&w.c(),o=S(),I&&I.c(),s=S(),O&&O.c(),l=ae()},m(y,N){c&&c.m(y,N),g(y,e,N),u&&u.m(y,N),g(y,r,N),f&&f.m(y,N),g(y,n,N),m&&m.m(y,N),g(y,i,N),w&&w.m(y,N),g(y,o,N),I&&I.m(y,N),g(y,s,N),O&&O.m(y,N),g(y,l,N),a=!0},p(y,N){y[7]==="present-offer"&&y[4]&&y[8]?c?(c.p(y,N),N&144&&d(c,1)):(c=ln(y),c.c(),d(c,1),c.m(e.parentNode,e)):c&&(Q(),p(c,1,1,()=>{c=null}),X()),y[7]==="present-offer"&&!y[4]?u?N&144&&d(u,1):(u=an(),u.c(),d(u,1),u.m(r.parentNode,r)):u&&(Q(),p(u,1,1,()=>{u=null}),X()),y[7]==="needs-auth-info"||y[7]==="processing-auth-info"?f?(f.p(y,N),N&128&&d(f,1)):(f=cn(y),f.c(),d(f,1),f.m(n.parentNode,n)):f&&(Q(),p(f,1,1,()=>{f=null}),X()),y[5]&&(y[7]==="needs-payment-info"||y[7]==="polling-purchase-status")&&y[4]&&y[8]?m?(m.p(y,N),N&176&&d(m,1)):(m=un(y),m.c(),d(m,1),m.m(i.parentNode,i)):m&&(Q(),p(m,1,1,()=>{m=null}),X()),y[7]==="loading"?w?N&128&&d(w,1):(w=fn(),w.c(),d(w,1),w.m(o.parentNode,o)):w&&(Q(),p(w,1,1,()=>{w=null}),X()),y[7]==="error"?I?(I.p(y,N),N&128&&d(I,1)):(I=dn(y),I.c(),d(I,1),I.m(s.parentNode,s)):I&&(Q(),p(I,1,1,()=>{I=null}),X()),y[7]==="success"?O?(O.p(y,N),N&128&&d(O,1)):(O=pn(y),O.c(),d(O,1),O.m(l.parentNode,l)):O&&(Q(),p(O,1,1,()=>{O=null}),X())},i(y){a||(d(c),d(u),d(f),d(m),d(w),d(I),d(O),a=!0)},o(y){p(c),p(u),p(f),p(m),p(w),p(I),p(O),a=!1},d(y){y&&(_(e),_(r),_(n),_(i),_(o),_(s),_(l)),c&&c.d(y),u&&u.d(y),f&&f.d(y),m&&m.d(y),w&&w.d(y),I&&I.d(y),O&&O.d(y)}}}function js(t){var s;let e=t[9].includes(t[7]),r,n,i,o=e&&on(t);return n=new Rs({props:{brandingAppearance:(s=t[1])==null?void 0:s.appearance,$$slots:{default:[Cs]},$$scope:{ctx:t}}}),{c(){o&&o.c(),r=S(),T(n.$$.fragment)},m(l,a){o&&o.m(l,a),g(l,r,a),k(n,l,a),i=!0},p(l,a){var u;a&128&&(e=l[9].includes(l[7])),e?o?(o.p(l,a),a&128&&d(o,1)):(o=on(l),o.c(),d(o,1),o.m(r.parentNode,r)):o&&(Q(),p(o,1,1,()=>{o=null}),X());const c={};a&2&&(c.brandingAppearance=(u=l[1])==null?void 0:u.appearance),a&33554674&&(c.$$scope={dirty:a,ctx:l}),n.$set(c)},i(l){i||(d(o),d(n.$$.fragment,l),i=!0)},o(l){p(o),p(n.$$.fragment,l),i=!1},d(l){l&&_(r),o&&o.d(l),P(n,l)}}}function Fs(t){let e,r;return e=new gs({props:{style:t[3],$$slots:{default:[js]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&8&&(o.style=n[3]),i&33554678&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function Hs(t){let e,r;return e=new ss({props:{condition:t[0],$$slots:{default:[Fs]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,i){const o={};i&1&&(o.condition=n[0]),i&33554686&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function qs(t){let e,r;return e=new ys({props:{$$slots:{default:[Hs]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(n,i){k(e,n,i),r=!0},p(n,[i]){const o={};i&33554687&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(d(e.$$.fragment,n),r=!0)},o(n){p(e.$$.fragment,n),r=!1},d(n){P(e,n)}}}function xs(t,e,r){let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:o}=e,{rcPackage:s}=e,{purchaseOption:l}=e,{brandingInfo:a}=e,{onFinished:c}=e,{onError:u}=e,{onClose:f}=e,{purchases:m}=e,{purchaseOperationHelper:w}=e,I="",O=null,y=null,N=null;const ie=s.rcBillingProduct.identifier??null,$=s.rcBillingProduct.defaultPurchaseOption,U=l||$;let x="present-offer";const Ke=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];Ce(async()=>{if(r(4,O=s.rcBillingProduct),r(3,I=Jt(a==null?void 0:a.appearance)),x==="present-offer"){i?In():r(7,x="needs-auth-info");return}});const Qe=()=>{f()},In=()=>{if(ie===null){Me(new J(te.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else x==="present-offer"&&r(7,x="loading");if(!i){Me(new J(te.MissingEmailError));return}w.startPurchase(o,ie,U,i,s.rcBillingProduct.presentedOfferingContext).then(D=>{if(D.next_action==="collect_payment_info"){r(6,N=null),r(7,x="needs-payment-info"),r(5,y=D);return}if(D.next_action==="completed"){r(6,N=null),r(7,x="success");return}}).catch(D=>{Me(D)})},vl=D=>{if(x==="needs-auth-info"){D&&(r(14,i=D.email),r(7,x="processing-auth-info")),In();return}if(x==="needs-payment-info"){r(7,x="polling-purchase-status"),w.pollCurrentPurchaseForCompletion().then(()=>{r(7,x="success")}).catch($l=>{Me($l)});return}if(x==="success"||x==="error"){c();return}r(7,x="success")},Me=D=>{if(x==="processing-auth-info"&&D.isRecoverable()){r(6,N=D),r(7,x="needs-auth-info");return}r(6,N=D),r(7,x="error")},Il=()=>{u(N??new J(te.UnknownError,"Unknown error without state set."))};return t.$$set=D=>{"asModal"in D&&r(0,n=D.asModal),"customerEmail"in D&&r(14,i=D.customerEmail),"appUserId"in D&&r(15,o=D.appUserId),"rcPackage"in D&&r(16,s=D.rcPackage),"purchaseOption"in D&&r(17,l=D.purchaseOption),"brandingInfo"in D&&r(1,a=D.brandingInfo),"onFinished"in D&&r(18,c=D.onFinished),"onError"in D&&r(19,u=D.onError),"onClose"in D&&r(20,f=D.onClose),"purchases"in D&&r(2,m=D.purchases),"purchaseOperationHelper"in D&&r(21,w=D.purchaseOperationHelper)},[n,a,m,I,O,y,N,x,U,Ke,Qe,vl,Me,Il,i,o,s,l,c,u,f,w]}class Gs extends j{constructor(e){super(),C(this,e,xs,qs,A,{asModal:0,customerEmail:14,appUserId:15,rcPackage:16,purchaseOption:17,brandingInfo:1,onFinished:18,onError:19,onClose:20,purchases:2,purchaseOperationHelper:21})}}function Vs(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function Ys(t,e,r,n){const i=e.product_identifier;if(i in r)return zs(t,e,r[i]);if(i in n)return Ws(t,e,n[i]);throw new Z(ee.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function zs(t,e,r){return{identifier:t,isActive:Vs(e),willRenew:Xs(e,r),store:(r==null?void 0:r.store)??"unknown",latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(e.purchase_date),expirationDate:Ye(e.expires_date),productIdentifier:e.product_identifier,unsubscribeDetectedAt:Ye(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:Ye(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 Ws(t,e,r){return{identifier:t,isActive:!0,willRenew:!1,store:r.store,latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(r.original_purchase_date),expirationDate:null,productIdentifier:e.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:r.is_sandbox,periodType:"normal"}}function Ks(t,e,r){const n={},i={};for(const o in t){const s=Ys(o,t[o],e,r);n[o]=s,s.isActive&&(i[o]=s)}return{all:n,active:i}}function Ye(t){return t==null?null:new Date(t)}function Qs(t){const e=Js(t),r=t.subscriber,n=tl(r.non_subscriptions);return{entitlements:Ks(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:Zs(t,n),activeSubscriptions:el(e),managementURL:r.management_url,requestDate:new Date(t.request_date),firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Ye(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id}}function Xs(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,o=e.billing_issues_detected_at!=null;return!(r||n||i||o)}function Zs(t,e){const r={};for(const n in t.subscriber.subscriptions){const i=t.subscriber.subscriptions[n];r[n]=new Date(i.purchase_date)}for(const n in e){const i=e[n].purchase_date;i==null?r[n]=null:r[n]=new Date(i)}return r}function Js(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 el(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}function tl(t){const e={};for(const r in t){if(t[r].length===0)continue;const n=t[r].length;e[r]=t[r][n-1]}return e}const nl="0.11.0",rl="https://api.revenuecat.com";var ze;(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"})(ze||(ze={}));function ut(t){return t?t.startsWith("rcb_sb_"):!1}async function Ie(t,e){const{apiKey:r,body:n,headers:i,httpConfig:o}=e,l=`${(o==null?void 0:o.proxyURL)??rl}${t.urlPath()}`;try{const a=await fetch(l,{method:t.method,headers:ll(r,i,o==null?void 0:o.additionalHeaders),body:ol(n)});return await il(a,t),await a.json()}catch(a){throw a instanceof TypeError?new Z(ee.NetworkError,Ne.getPublicMessage(ee.NetworkError),a.message):a}}async function il(t,e){const r=t.status;if(r>=ze.INTERNAL_SERVER_ERROR)ft(e,r,await t.text());else if(r>=ze.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,o=n==null?void 0:n.code,s=n==null?void 0:n.message;if(o!=null){const l=Ne.convertCodeToBackendErrorCode(o);if(l==null)ft(e,r,i,o);else throw Z.getForBackendError(l,s)}else ft(e,r,i)}}function ft(t,e,r,n){throw new Z(ee.UnknownBackendError,"Unknown backend error.",`Request: ${t.name}. Status code: ${e}. Body: ${r}.`,{backendErrorCode:n})}function ol(t){return t==null?null:JSON.stringify(t)}const mn="Authorization",_n="Content-Type",gn="Accept",hn="X-Platform",bn="X-Version",wn="X-Is-Sandbox",sl=new Set([mn,_n,gn,hn,bn,wn]);function ll(t,e,r){let n={[mn]:`Bearer ${t}`,[_n]:"application/json",[gn]:"application/json",[hn]:"web",[bn]:nl,[wn]:`${ut(t)}`};return e&&(n={...n,...e}),r&&(n={...r,...n}),n}const yn="/v1/subscribers",We="/rcbilling/v1";class al{constructor(e){M(this,"appUserId");M(this,"method","GET");M(this,"name","getOfferings");this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${yn}/${e}/offerings`}}class cl{constructor(){M(this,"method","POST");M(this,"name","purchase")}urlPath(){return`${We}/purchase`}}class ul{constructor(e,r,n){M(this,"method","GET");M(this,"name","getProducts");M(this,"appUserId");M(this,"productIds");M(this,"currency");this.appUserId=e,this.productIds=r,this.currency=n}urlPath(){const e=encodeURIComponent(this.appUserId),r=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`&currency=${this.currency}`:"";return`${We}/subscribers/${e}/products?id=${r}${n}`}}class fl{constructor(e){M(this,"method","GET");M(this,"name","getCustomerInfo");M(this,"appUserId");this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${yn}/${e}`}}class dl{constructor(){M(this,"method","GET");M(this,"name","getBrandingInfo")}urlPath(){return`${We}/branding`}}class pl{constructor(e){M(this,"method","GET");M(this,"name","getCheckoutStatus");M(this,"operationSessionId");this.operationSessionId=e}urlPath(){return`${We}/checkout/${this.operationSessionId}`}}const dt={};class ml{constructor(e,r=dt){M(this,"API_KEY");M(this,"httpConfig");this.API_KEY=e,this.httpConfig=r}async getOfferings(e){return await Ie(new al(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(e){return await Ie(new fl(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(e,r,n){return await Ie(new ul(e,r,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await Ie(new dl,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(e,r,n,i,o){const s={app_user_id:e,product_id:r,email:n,price_id:o.priceId,presented_offering_identifier:i.offeringIdentifier};return o.id!=="base_option"&&(s.offer_id=o.id),i.targetingContext&&(s.applied_targeting_rule={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision}),i.placementIdentifier&&(s.presented_placement_identifier=i.placementIdentifier),await Ie(new cl,{apiKey:this.API_KEY,body:s,httpConfig:this.httpConfig})}async getCheckoutStatus(e){return await Ie(new pl(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function _l(t){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(t))throw new Z(ee.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function gl(t){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new Z(ee.InvalidAppUserIdError,'Provided user id: "'+t+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function hl(t){if(t!=null&&t.endsWith("/"))throw new Z(ee.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function bl(t){if(t){for(const e in t)if(sl.has(e))throw new Z(ee.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var pt=(t=>(t.Current="current",t))(pt||{});function wl(t,e){async function r(...n){return await this.preload(),await t.call(this,...n)}return r}const En=(t,e)=>({...t,rcBillingProduct:{...t.rcBillingProduct,presentedOfferingContext:{...t.rcBillingProduct.presentedOfferingContext,placementIdentifier:e}}}),_e=(t,e)=>t==null?null:En(t,e),yl=(t,e,r)=>{const n=t.offering_ids_by_placement??null;if(n==null)return null;const i=t.fallback_offering_id??null;let o;if(r in n){const l=n[r]??null;if(l==null)return null;o=e[l],o==null&&(o=e[i])}else o=e[i];if(o==null)return null;const s=Object.fromEntries(Object.entries(o.packagesById).map(([l,a])=>[l,En(a,r)]));return{...o,packagesById:s,availablePackages:Object.values(s),weekly:_e(o.weekly,r),monthly:_e(o.monthly,r),twoMonth:_e(o.twoMonth,r),threeMonth:_e(o.threeMonth,r),sixMonth:_e(o.sixMonth,r),annual:_e(o.annual,r),lifetime:_e(o.lifetime,r)}};function El(t,e){const r={};e.product_details.forEach(o=>{r[o.identifier]=o});const n={};t.offerings.forEach(o=>{const s=o.identifier===t.current_offering_id,l=pr(s,o,r,t.targeting);l!=null&&(n[o.identifier]=l)});const i=t.current_offering_id?n[t.current_offering_id]??null:null;return Object.keys(n).length==0&&q.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:i}}vn=[wl];const le=class le{constructor(e,r,n=dt){Un(_t,5,this);M(this,"_API_KEY");M(this,"_appUserId");M(this,"_brandingInfo",null);M(this,"_loadingResourcesPromise",null);M(this,"backend");M(this,"purchaseOperationHelper");this._API_KEY=e,this._appUserId=r,ut(e)&&q.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new ml(this._API_KEY,n),this.purchaseOperationHelper=new Nr(this.backend)}static setLogLevel(e){q.setLogLevel(e)}static getSharedInstance(){if(le.isConfigured())return le.instance;throw new Rt}static isConfigured(){return le.instance!==void 0}static configure(e,r,n=dt){return le.instance!==void 0&&q.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),_l(e),gl(r),hl(n.proxyURL),bl(n.additionalHeaders),le.instance=new le(e,r,n),le.getSharedInstance()}async preload(){if(this.hasLoadedResources()){q.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){q.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.backend.getBrandingInfo().then(e=>{this._brandingInfo=e}).catch(e=>{let r=`${e}`;e instanceof Z&&(r=`${e.message}. ${e.underlyingErrorMessage?`Underlying error: ${e.underlyingErrorMessage}`:""}`),q.errorLog(`Error fetching branding info: ${r}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}hasLoadedResources(){return this._brandingInfo!==null}async getOfferings(e){Do(e==null?void 0:e.currency);const r=this._appUserId,n=await this.backend.getOfferings(r),i=(e==null?void 0:e.offeringIdentifier)===pt.Current?n.current_offering_id:e==null?void 0:e.offeringIdentifier;return i&&(n.offerings=n.offerings.filter(o=>o.identifier===i)),await this.getAllOfferings(n,r,e)}async getCurrentOfferingForPlacement(e,r){const n=this._appUserId,i=await this.backend.getOfferings(n),o=await this.getAllOfferings(i,n,r),s=i.placements??null;return s==null?null:yl(s,o.all,e)}async getAllOfferings(e,r,n){const i=e.offerings.flatMap(s=>s.packages).map(s=>s.platform_product_identifier),o=await this.backend.getProducts(r,i,n==null?void 0:n.currency);return this.logMissingProductIds(i,o.product_details),El(e,o)}async isEntitledTo(e){const r=await this.getCustomerInfo();return e in r.entitlements.active}purchasePackage(e,r,n){return this.purchase({rcPackage:e,customerEmail:r,htmlTarget:n})}purchase(e){const{rcPackage:r,purchaseOption:n,htmlTarget:i,customerEmail:o}=e;let s=i??document.getElementById("rcb-ui-root");if(s===null){const u=document.createElement("div");u.className="rcb-ui-root",document.body.appendChild(u),s=u}if(s===null)throw new Error("Could not generate a mount point for the billing widget");const l=s,a=!i,c=this._appUserId;return q.debugLog(`Presenting purchase form for package ${r.identifier}`),new Promise((u,f)=>{new Gs({target:l,props:{appUserId:c,rcPackage:r,purchaseOption:n,customerEmail:o,onFinished:async()=>{q.debugLog("Purchase finished"),l.innerHTML="",u({customerInfo:await this._getCustomerInfoForUserId(c)})},onClose:()=>{l.innerHTML="",q.debugLog("Purchase cancelled by user"),f(new Z(ee.UserCancelledError))},onError:m=>{l.innerHTML="",f(Z.getForPurchasesFlowError(m))},purchases:this,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,asModal:a}})})}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(o=>n[o.identifier]=o);const i=[];e.forEach(o=>{n[o]===void 0&&i.push(o)}),i.length>0&&q.debugLog(`Could not find product data for product ids:
35
+ ${i.join()}.
36
+ Please check that your product configuration is correct.`)}isSandbox(){return ut(this._API_KEY)}close(){le.instance===this?le.instance=void 0:q.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const r=await this.backend.getCustomerInfo(e);return Qs(r)}};_t=On(null),Rn(_t,1,"purchase",vn,le),ht(_t,le),M(le,"instance");let mt=le;E.ErrorCode=ee,E.LogLevel=se,E.OfferingKeyword=pt,E.PackageType=$t,E.ProductType=ve,E.Purchases=mt,E.PurchasesError=Z,E.UninitializedPurchasesError=Rt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});