{"version":3,"sources":["jsdelivr-header.js","/npm/@capacitor-firebase/firestore@8.1.0/dist/esm/index.js","/npm/@capacitor-firebase/firestore@8.1.0/dist/esm/web.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,yFCLK,MAAC,kBAAoB,oBAAe,oBAAqB,CAC1D,IAAK,IAAM,QAAA,UAAA,MAAA,kBAAA,GAAA,IAAgB,MAAK,GAAK,IAAI,EAAE,yBCAxC,MAAM,6BAA6B,eACtC,WAAA,GACI,SAAS,WACT,KAAK,gBAAkB,IAAI,GAC/B,CACA,iBAAM,CAAY,GACd,MAAM,EAAY,0BACZ,UAAE,EAAS,KAAE,GAAS,EACtB,QAA0B,iBAAO,qBAAW,EAAW,GAAY,GACzE,MAAO,CACH,UAAW,CACP,GAAI,EAAkB,GACtB,KAAM,EAAkB,MAGpC,CACA,iBAAM,CAAY,GACd,MAAM,EAAY,0BACZ,UAAE,EAAS,KAAE,EAAI,MAAE,GAAU,QAC7B,iBAAO,cAAI,EAAW,GAAY,EAAM,CAC1C,SAER,CACA,iBAAM,CAAY,GACd,MAAM,EAAY,0BACZ,UAAE,GAAc,EAChB,QAAyB,iBAAO,cAAI,EAAW,IAC/C,EAAuB,EAAiB,OAC9C,MAAO,CACH,SAAU,CACN,GAAI,EAAiB,GACrB,KAAM,EAAiB,IAAI,KAC3B,UAAgC,IAAzB,EACD,KACA,EACN,SAAU,CACN,iBAAkB,EAAiB,SAAS,iBAC5C,UAAW,EAAiB,SAAS,YAIrD,CACA,oBAAM,CAAe,GACjB,MAAM,EAAY,0BACZ,UAAE,EAAS,KAAE,GAAS,QACtB,oBAAU,cAAI,EAAW,GAAY,EAC/C,CACA,oBAAM,CAAe,GACjB,MAAM,EAAY,0BACZ,UAAE,GAAc,QAChB,oBAAU,cAAI,EAAW,GACnC,CACA,gBAAM,CAAW,GACb,MAAM,EAAY,0BACZ,WAAE,GAAe,EACjB,EAAQ,qBAAW,GACzB,IAAK,MAAM,KAAa,EAAY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C,KAAK,sCAAsC,GAC1F,EAAkC,KAAK,EAC3C,CACA,OAAO,CACX,CACA,2CAAM,CAAsC,GACxC,OAAQ,EAAiB,MACrB,IAAK,UACD,OAAO,kBAAQ,EAAiB,UAAW,EAAiB,cAChE,IAAK,QACD,OAAO,gBAAM,EAAiB,OAClC,IAAK,cACD,OAAO,sBAAY,EAAiB,OACxC,IAAK,UACL,IAAK,aACL,IAAK,QACL,IAAK,YAAa,CACd,MAAM,EAAY,yBACZ,QAAyB,iBAAO,cAAI,EAAW,EAAiB,YACtE,OAAQ,EAAiB,MACrB,IAAK,UACD,OAAO,kBAAQ,GACnB,IAAK,aACD,OAAO,qBAAW,GACtB,IAAK,QACD,OAAO,gBAAM,GACjB,IAAK,YACD,OAAO,oBAAU,GAE7B,EAER,CACA,mCAAM,CAA8B,GAChC,MAAM,EAA2B,GACjC,IAAK,MAAM,KAAmB,EAAkB,CAC5C,MAAM,QAAgC,KAAK,6BAA6B,GACxE,EAAyB,KAAK,EAClC,CACA,OAAO,CACX,CACA,kCAAM,CAA6B,GAC/B,MAA6B,UAAzB,EAAgB,KACT,KAAK,wCAAwC,SAGvC,KAAK,sCAAsC,EAEhE,E","file":"/npm/@capacitor-firebase/firestore@8.1.0/dist/plugin.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@capacitor-firebase/firestore@8.1.0/dist/plugin.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { registerPlugin } from '@capacitor/core';\nconst FirebaseFirestore = registerPlugin('FirebaseFirestore', {\n    web: () => import('./web').then(m => new m.FirebaseFirestoreWeb()),\n});\nexport * from './definitions';\nexport { FirebaseFirestore };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { addDoc, and, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, deleteDoc, disableNetwork, doc, enableNetwork, endAt, endBefore, getCountFromServer, getDoc, getDocs, getFirestore, limit, limitToLast, onSnapshot, or, orderBy, query, setDoc, startAfter, startAt, updateDoc, where, writeBatch, } from 'firebase/firestore';\nexport class FirebaseFirestoreWeb extends WebPlugin {\n    constructor() {\n        super(...arguments);\n        this.unsubscribesMap = new Map();\n    }\n    async addDocument(options) {\n        const firestore = getFirestore();\n        const { reference, data } = options;\n        const documentReference = await addDoc(collection(firestore, reference), data);\n        return {\n            reference: {\n                id: documentReference.id,\n                path: documentReference.path,\n            },\n        };\n    }\n    async setDocument(options) {\n        const firestore = getFirestore();\n        const { reference, data, merge } = options;\n        await setDoc(doc(firestore, reference), data, {\n            merge,\n        });\n    }\n    async getDocument(options) {\n        const firestore = getFirestore();\n        const { reference } = options;\n        const documentSnapshot = await getDoc(doc(firestore, reference));\n        const documentSnapshotData = documentSnapshot.data();\n        return {\n            snapshot: {\n                id: documentSnapshot.id,\n                path: documentSnapshot.ref.path,\n                data: (documentSnapshotData === undefined\n                    ? null\n                    : documentSnapshotData),\n                metadata: {\n                    hasPendingWrites: documentSnapshot.metadata.hasPendingWrites,\n                    fromCache: documentSnapshot.metadata.fromCache,\n                },\n            },\n        };\n    }\n    async updateDocument(options) {\n        const firestore = getFirestore();\n        const { reference, data } = options;\n        await updateDoc(doc(firestore, reference), data);\n    }\n    async deleteDocument(options) {\n        const firestore = getFirestore();\n        const { reference } = options;\n        await deleteDoc(doc(firestore, reference));\n    }\n    async writeBatch(options) {\n        const firestore = getFirestore();\n        const { operations } = options;\n        const batch = writeBatch(firestore);\n        for (const operation of operations) {\n            const { type, reference, data, options } = operation;\n            const documentReference = doc(firestore, reference);\n            switch (type) {\n                case 'set':\n                    batch.set(documentReference, data, options !== null && options !== void 0 ? options : {});\n                    break;\n                case 'update':\n                    batch.update(documentReference, data !== null && data !== void 0 ? data : {});\n                    break;\n                case 'delete':\n                    batch.delete(documentReference);\n                    break;\n            }\n        }\n        await batch.commit();\n    }\n    async getCollection(options) {\n        const collectionQuery = await this.buildCollectionQuery(options, 'collection');\n        const collectionSnapshot = await getDocs(collectionQuery);\n        return {\n            snapshots: collectionSnapshot.docs.map(documentSnapshot => ({\n                id: documentSnapshot.id,\n                path: documentSnapshot.ref.path,\n                data: documentSnapshot.data(),\n                metadata: {\n                    hasPendingWrites: documentSnapshot.metadata.hasPendingWrites,\n                    fromCache: documentSnapshot.metadata.fromCache,\n                },\n            })),\n        };\n    }\n    async getCollectionGroup(options) {\n        const collectionQuery = await this.buildCollectionQuery(options, 'collectionGroup');\n        const collectionSnapshot = await getDocs(collectionQuery);\n        return {\n            snapshots: collectionSnapshot.docs.map(documentSnapshot => ({\n                id: documentSnapshot.id,\n                path: documentSnapshot.ref.path,\n                data: documentSnapshot.data(),\n                metadata: {\n                    hasPendingWrites: documentSnapshot.metadata.hasPendingWrites,\n                    fromCache: documentSnapshot.metadata.fromCache,\n                },\n            })),\n        };\n    }\n    async getCountFromServer(options) {\n        const firestore = getFirestore();\n        const { reference } = options;\n        const coll = collection(firestore, reference);\n        const snapshot = await getCountFromServer(coll);\n        return { count: snapshot.data().count };\n    }\n    async clearPersistence() {\n        const firestore = getFirestore();\n        await clearIndexedDbPersistence(firestore);\n    }\n    async enableNetwork() {\n        const firestore = getFirestore();\n        await enableNetwork(firestore);\n    }\n    async disableNetwork() {\n        const firestore = getFirestore();\n        await disableNetwork(firestore);\n    }\n    async useEmulator(options) {\n        const firestore = getFirestore();\n        const port = options.port || 8080;\n        connectFirestoreEmulator(firestore, options.host, port);\n    }\n    async addDocumentSnapshotListener(options, callback) {\n        const firestore = getFirestore();\n        const unsubscribe = onSnapshot(doc(firestore, options.reference), {\n            includeMetadataChanges: options.includeMetadataChanges,\n            source: options.source,\n        }, snapshot => {\n            const data = snapshot.data();\n            const event = {\n                snapshot: {\n                    id: snapshot.id,\n                    path: snapshot.ref.path,\n                    data: (data === undefined ? null : data),\n                    metadata: {\n                        hasPendingWrites: snapshot.metadata.hasPendingWrites,\n                        fromCache: snapshot.metadata.fromCache,\n                    },\n                },\n            };\n            callback(event, undefined);\n        }, error => callback(null, error));\n        const id = Date.now().toString();\n        this.unsubscribesMap.set(id, unsubscribe);\n        return id;\n    }\n    async addCollectionSnapshotListener(options, callback) {\n        const collectionQuery = await this.buildCollectionQuery(options, 'collection');\n        const unsubscribe = onSnapshot(collectionQuery, {\n            includeMetadataChanges: options.includeMetadataChanges,\n            source: options.source,\n        }, snapshot => {\n            const event = {\n                snapshots: snapshot.docs.map(documentSnapshot => ({\n                    id: documentSnapshot.id,\n                    path: documentSnapshot.ref.path,\n                    data: documentSnapshot.data(),\n                    metadata: {\n                        hasPendingWrites: documentSnapshot.metadata.hasPendingWrites,\n                        fromCache: documentSnapshot.metadata.fromCache,\n                    },\n                })),\n            };\n            callback(event, undefined);\n        }, error => callback(null, error));\n        const id = Date.now().toString();\n        this.unsubscribesMap.set(id, unsubscribe);\n        return id;\n    }\n    async addCollectionGroupSnapshotListener(options, callback) {\n        const collectionQuery = await this.buildCollectionQuery(options, 'collectionGroup');\n        const unsubscribe = onSnapshot(collectionQuery, {\n            includeMetadataChanges: options.includeMetadataChanges,\n            source: options.source,\n        }, snapshot => {\n            const event = {\n                snapshots: snapshot.docs.map(documentSnapshot => ({\n                    id: documentSnapshot.id,\n                    path: documentSnapshot.ref.path,\n                    data: documentSnapshot.data(),\n                    metadata: {\n                        hasPendingWrites: documentSnapshot.metadata.hasPendingWrites,\n                        fromCache: documentSnapshot.metadata.fromCache,\n                    },\n                })),\n            };\n            callback(event, undefined);\n        }, error => callback(null, error));\n        const id = Date.now().toString();\n        this.unsubscribesMap.set(id, unsubscribe);\n        return id;\n    }\n    async removeSnapshotListener(options) {\n        const unsubscribe = this.unsubscribesMap.get(options.callbackId);\n        if (!unsubscribe) {\n            return;\n        }\n        unsubscribe();\n        this.unsubscribesMap.delete(options.callbackId);\n    }\n    async removeAllListeners() {\n        this.unsubscribesMap.forEach(unsubscribe => unsubscribe());\n        this.unsubscribesMap.clear();\n        await super.removeAllListeners();\n    }\n    async buildCollectionQuery(options, type) {\n        const firestore = getFirestore();\n        let collectionQuery;\n        if (options.compositeFilter) {\n            const compositeFilter = this.buildFirebaseQueryCompositeFilterConstraint(options.compositeFilter);\n            const queryConstraints = await this.buildFirebaseQueryNonFilterConstraints(options.queryConstraints || []);\n            collectionQuery = query(type === 'collection'\n                ? collection(firestore, options.reference)\n                : collectionGroup(firestore, options.reference), compositeFilter, ...queryConstraints);\n        }\n        else {\n            const queryConstraints = await this.buildFirebaseQueryConstraints(options.queryConstraints || []);\n            collectionQuery = query(type === 'collection'\n                ? collection(firestore, options.reference)\n                : collectionGroup(firestore, options.reference), ...queryConstraints);\n        }\n        return collectionQuery;\n    }\n    buildFirebaseQueryCompositeFilterConstraint(compositeFilter) {\n        const queryConstraints = this.buildFirebaseQueryFilterConstraints(compositeFilter.queryConstraints);\n        if (compositeFilter.type === 'and') {\n            return and(...queryConstraints);\n        }\n        else {\n            return or(...queryConstraints);\n        }\n    }\n    buildFirebaseQueryFilterConstraints(queryfilterConstraints) {\n        const firebaseQueryFilterConstraints = [];\n        for (const queryfilterConstraint of queryfilterConstraints) {\n            const firebaseQueryFilterConstraint = this.buildFirebaseQueryFilterConstraint(queryfilterConstraint);\n            firebaseQueryFilterConstraints.push(firebaseQueryFilterConstraint);\n        }\n        return firebaseQueryFilterConstraints;\n    }\n    buildFirebaseQueryFilterConstraint(queryFilterConstraints) {\n        if (queryFilterConstraints.type === 'where') {\n            return this.buildFirebaseQueryFieldFilterConstraint(queryFilterConstraints);\n        }\n        else {\n            return this.buildFirebaseQueryCompositeFilterConstraint(queryFilterConstraints);\n        }\n    }\n    buildFirebaseQueryFieldFilterConstraint(queryfilterConstraints) {\n        return where(queryfilterConstraints.fieldPath, queryfilterConstraints.opStr, queryfilterConstraints.value);\n    }\n    async buildFirebaseQueryNonFilterConstraints(queryConstraints) {\n        const firebaseQueryNonFilterConstraints = [];\n        for (const queryConstraint of queryConstraints) {\n            const firebaseQueryNonFilterConstraint = await this.buildFirebaseQueryNonFilterConstraint(queryConstraint);\n            firebaseQueryNonFilterConstraints.push(firebaseQueryNonFilterConstraint);\n        }\n        return firebaseQueryNonFilterConstraints;\n    }\n    async buildFirebaseQueryNonFilterConstraint(queryConstraints) {\n        switch (queryConstraints.type) {\n            case 'orderBy':\n                return orderBy(queryConstraints.fieldPath, queryConstraints.directionStr);\n            case 'limit':\n                return limit(queryConstraints.limit);\n            case 'limitToLast':\n                return limitToLast(queryConstraints.limit);\n            case 'startAt':\n            case 'startAfter':\n            case 'endAt':\n            case 'endBefore': {\n                const firestore = getFirestore();\n                const documentSnapshot = await getDoc(doc(firestore, queryConstraints.reference));\n                switch (queryConstraints.type) {\n                    case 'startAt':\n                        return startAt(documentSnapshot);\n                    case 'startAfter':\n                        return startAfter(documentSnapshot);\n                    case 'endAt':\n                        return endAt(documentSnapshot);\n                    case 'endBefore':\n                        return endBefore(documentSnapshot);\n                }\n            }\n        }\n    }\n    async buildFirebaseQueryConstraints(queryConstraints) {\n        const firebaseQueryConstraints = [];\n        for (const queryConstraint of queryConstraints) {\n            const firebaseQueryConstraint = await this.buildFirebaseQueryConstraint(queryConstraint);\n            firebaseQueryConstraints.push(firebaseQueryConstraint);\n        }\n        return firebaseQueryConstraints;\n    }\n    async buildFirebaseQueryConstraint(queryConstraint) {\n        if (queryConstraint.type === 'where') {\n            return this.buildFirebaseQueryFieldFilterConstraint(queryConstraint);\n        }\n        else {\n            return await this.buildFirebaseQueryNonFilterConstraint(queryConstraint);\n        }\n    }\n}\n//# sourceMappingURL=web.js.map"]}