1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[890],{63:(t,e,r)=>{var o=r(7260);r.o(o,"notFound")&&r.d(e,{notFound:function(){return o.notFound}}),r.o(o,"useParams")&&r.d(e,{useParams:function(){return o.useParams}}),r.o(o,"usePathname")&&r.d(e,{usePathname:function(){return o.usePathname}}),r.o(o,"useRouter")&&r.d(e,{useRouter:function(){return o.useRouter}}),r.o(o,"useSearchParams")&&r.d(e,{useSearchParams:function(){return o.useSearchParams}})},6044:(t,e,r)=>{r.d(e,{fw:()=>p,oo:()=>y,p0:()=>n});var o=r(2078),s=r(9708),i=r(3885);function n(t,e){return a.create(t,e)}(0,o.KO)("firestore-stripe-payments","__VERSION__");var a=class t{constructor(t,e){this.app=t,this.options=e,this.components={}}static create(e,r){return new t(e,r)}get customersCollection(){return this.options.customersCollection}get productsCollection(){return this.options.productsCollection}getComponent(t){let e=this.components[t];return e||null}setComponent(t,e){this.components[t]=e}},u=class extends Error{constructor(t,e,r){super(e),this.code=t,this.message=e,this.cause=r}},c=class{constructor(t){this.auth=(0,i.xI)(t)}getCurrentUser(){let t=this.auth.currentUser?.uid;if(!t)throw new u("unauthenticated","Failed to determine currently signed in user. User not signed in.");return t}},l="user-dao";function h(t,e){if("string"!=typeof t||""===t)throw Error(e??"arg must be a non-empty string.")}function d(t,e){if("number"!=typeof t||isNaN(t)||t<=0)throw Error(e??"arg must be positive number.")}function p(t,e,r){if(void 0!==(o=e={...e}).cancel_url?h(o.cancel_url,"cancel_url must be a non-empty string."):o.cancel_url=window.location.href,o.mode??(o.mode="subscription"),void 0!==o.success_url?h(o.success_url,"success_url must be a non-empty string."):o.success_url=window.location.href,"line_items"in e){var o,s,i,n=e,a=n.line_items;if(!Array.isArray(a)||0===a.length)throw Error("line_items must be a non-empty array.")}else{h((s=e).price,"price must be a non-empty string."),void 0!==s.quantity&&d(s.quantity,"quantity must be a positive integer.")}let u=void 0!==(i=r?.timeoutMillis)?(d(i,"timeoutMillis must be a positive number."),i):3e4;return(function(t){try{var e,r,o;let s,i=((s=(e=t).getComponent(l))||(s=new c(e.app),r=e,o=s,r.setComponent(l,o)),s).getCurrentUser();return Promise.resolve(i)}catch(t){return Promise.reject(t)}})(t).then(r=>{var o,s,i;let n;return((n=(o=t).getComponent(f))||(n=new m(o.app,o.customersCollection),s=o,i=n,s.setComponent(f,i)),n).createCheckoutSession(r,e,u)})}var m=class{constructor(t,e){this.customersCollection=e,this.firestore=(0,s.aU)(t)}async createCheckoutSession(t,e,r){let o=await this.addSessionDoc(t,e);return this.waitForSessionId(o,r)}async addSessionDoc(t,e){let r=(0,s.rJ)(this.firestore,this.customersCollection,t,"checkout_sessions");try{return await (0,s.gS)(r,e)}catch(t){throw new u("internal","Error while querying Firestore.",t)}}waitForSessionId(t,e){let r;return new Promise((o,i)=>{let n=setTimeout(()=>{i(new u("deadline-exceeded","Timeout while waiting for session response."))},e);r=(0,s.aQ)(t.withConverter(w),t=>{var e;let r=t.data();e=r,void 0!==e?.id&&(clearTimeout(n),o(r))},t=>{clearTimeout(n),i(new u("internal","Error while querying Firestore.",t))})}).finally(()=>r())}},w={toFirestore:()=>{throw Error("Not implemented for readonly Session type.")},fromFirestore:t=>{let{created:e,sessionId:r,...o}=t.data();return void 0!==r?{...o,id:r,created_at:e.toDate().toUTCString()}:{...o}}},f="checkout-session-dao";function y(t,e,r){var o,s,i;let n;h(e,"productId must be a non-empty string.");let a=((n=(o=t).getComponent(_))||(n=new v(o.app,o.productsCollection),s=o,i=n,s.setComponent(_,i)),n);return a.getProduct(e).then(t=>r?.includePrices?g(a,t):t)}async function g(t,e){let r=await t.getPrices(e.id);return{...e,prices:r}}var C={toFirestore:()=>{throw Error("Not implemented for readonly Product type.")},fromFirestore:t=>({...t.data(),id:t.id,prices:[]})},P={toFirestore:()=>{throw Error("Not implemented for readonly Price type.")},fromFirestore:t=>({...t.data(),id:t.id,product:t.ref.parent.parent.id})},v=class{constructor(t,e){this.productsCollection=e,this.firestore=(0,s.aU)(t)}async getProduct(t){return(await this.getProductSnapshotIfExists(t)).data()}async getProducts(t){let e=await this.getProductSnapshots(t),r=[];return e.forEach(t=>{r.push(t.data())}),r}async getPrice(t,e){return(await this.getPriceSnapshotIfExists(t,e)).data()}async getPrices(t,e){e?.assertProduct&&await this.getProductSnapshotIfExists(t);let r=await this.getPriceSnapshots(t),o=[];return r.forEach(t=>{o.push(t.data())}),o}async getProductSnapshotIfExists(t){let e=(0,s.H9)(this.firestore,this.productsCollection,t).withConverter(C),r=await this.queryFirestore(()=>(0,s.x7)(e));if(!r.exists())throw new u("not-found",`No product found with the ID: ${t}`);return r}async getProductSnapshots(t){let e=(0,s.rJ)(this.firestore,this.productsCollection).withConverter(C),r=[];if(t?.activeOnly&&r.push((0,s._M)("active","==",!0)),t?.where)for(let e of t.where)r.push((0,s._M)(...e));return void 0!==t?.limit&&r.push((0,s.AB)(t.limit)),await this.queryFirestore(()=>(r.length>0&&(e=(0,s.P)(e,...r)),(0,s.GG)(e)))}async getPriceSnapshotIfExists(t,e){let r=(0,s.H9)(this.firestore,this.productsCollection,t,"prices",e).withConverter(P),o=await this.queryFirestore(()=>(0,s.x7)(r));if(!o.exists())throw new u("not-found",`No price found with the product ID: ${t} and price ID: ${e}`);return o}async getPriceSnapshots(t){let e=(0,s.rJ)(this.firestore,this.productsCollection,t,"prices").withConverter(P);return await this.queryFirestore(()=>(0,s.GG)(e))}async queryFirestore(t){try{return await t()}catch(t){throw new u("internal","Unexpected error while querying Firestore",t)}}},_="product-dao"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.