{"version":3,"sources":["jsdelivr-header.js","/npm/@jacotb/capacitor-firebase-messaging@1.2.5/dist/esm/index.js","/npm/@jacotb/capacitor-firebase-messaging@1.2.5/dist/esm/web.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gJCLK,MAAC,kBAAoB,oBAAe,oBAAqB,CAC1D,IAAK,IAAM,QAAA,UAAA,MAAA,kBAAA,GAAA,IAAgB,MAAK,GAAK,IAAI,EAAE,yBCAxC,MAAM,6BAA6B,eACtC,WAAA,GACI,QACA,wBAAmB,MAAK,IACpB,IAAK,EACD,OAEJ,MAAM,EAAY,yBAClB,oBAAU,GAAW,GAAW,KAAK,2BAA2B,IAAS,GAErF,CACI,sBAAM,GAEF,MAAO,CACH,QAFY,KAAK,+CAA+C,aAAa,YAIzF,CACI,wBAAM,GACF,MAAM,QAA+B,aAAa,oBAElD,MAAO,CACH,QAFY,KAAK,+CAA+C,GAI5E,CACI,iBAAM,GAEF,MAAO,CACH,kBAFsB,wBAIlC,CACI,cAAM,CAAS,GACX,MAAM,EAAY,yBAKlB,MAAO,CACH,YALgB,mBAAS,EAAW,CACpC,SAAU,EAAQ,SAClB,0BAA2B,EAAQ,4BAK/C,CACI,iBAAM,GACF,MAAM,EAAY,+BACZ,sBAAY,EAC1B,CACI,+BAAM,GACF,KAAK,uBACb,CACI,kCAAM,CAA6B,GAC/B,KAAK,uBACb,CACI,qCAAM,GACF,KAAK,uBACb,CACI,sBAAM,CAAiB,GACnB,KAAK,uBACb,CACI,0BAAM,CAAqB,GACvB,KAAK,uBACb,CACI,0BAAA,CAA2B,GACvB,MACM,EAAQ,CACV,aAFiB,KAAK,yBAAyB,IAInD,KAAK,gBAAgB,qBAAqB,0BAA2B,EAC7E,CACI,wBAAA,CAAyB,GACrB,IAAI,EAAI,EAAI,EAQZ,MAPqB,CACjB,KAA6C,QAAtC,EAAK,EAAe,oBAAiC,IAAP,OAAgB,EAAS,EAAG,KACjF,KAAM,EAAe,KACrB,GAAI,EAAe,UACnB,MAA8C,QAAtC,EAAK,EAAe,oBAAiC,IAAP,OAAgB,EAAS,EAAG,MAClF,MAA8C,QAAtC,EAAK,EAAe,oBAAiC,IAAP,OAAgB,EAAS,EAAG,MAG9F,CACI,8CAAA,CAA+C,GAC3C,IAAI,EAAQ,SACZ,OAAQ,GACJ,IAAK,UACD,EAAQ,UACR,MACJ,IAAK,SACD,EAAQ,SAGhB,OAAO,CACf,CACI,qBAAA,GACI,MAAM,KAAK,YAAY,wBAC/B,EAEA,qBAAqB,0BAA4B,uB","file":"/npm/@jacotb/capacitor-firebase-messaging@1.2.5/dist/plugin.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@jacotb/capacitor-firebase-messaging@1.2.5/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 FirebaseMessaging = registerPlugin('FirebaseMessaging', {\n    web: () => import('./web').then(m => new m.FirebaseMessagingWeb()),\n});\nexport * from './definitions';\nexport { FirebaseMessaging };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { deleteToken, getMessaging, getToken, isSupported as isSupportedInWeb, onMessage, } from 'firebase/messaging';\nexport class FirebaseMessagingWeb extends WebPlugin {\n    constructor() {\n        super();\n        isSupportedInWeb().then(supported => {\n            if (!supported) {\n                return;\n            }\n            const messaging = getMessaging();\n            onMessage(messaging, payload => this.handleNotificationReceived(payload));\n        });\n    }\n    async checkPermissions() {\n        const receive = this.convertNotificationPermissionToPermissionState(Notification.permission);\n        return {\n            receive,\n        };\n    }\n    async requestPermissions() {\n        const notificationPermission = await Notification.requestPermission();\n        const receive = this.convertNotificationPermissionToPermissionState(notificationPermission);\n        return {\n            receive,\n        };\n    }\n    async isSupported() {\n        const isSupported = await isSupportedInWeb();\n        return {\n            isSupported,\n        };\n    }\n    async getToken(options) {\n        const messaging = getMessaging();\n        const token = await getToken(messaging, {\n            vapidKey: options.vapidKey,\n            serviceWorkerRegistration: options.serviceWorkerRegistration,\n        });\n        return {\n            token,\n        };\n    }\n    async deleteToken() {\n        const messaging = getMessaging();\n        await deleteToken(messaging);\n    }\n    async getDeliveredNotifications() {\n        this.throwUnavailableError();\n    }\n    async removeDeliveredNotifications(_options) {\n        this.throwUnavailableError();\n    }\n    async removeAllDeliveredNotifications() {\n        this.throwUnavailableError();\n    }\n    async subscribeToTopic(_options) {\n        this.throwUnavailableError();\n    }\n    async unsubscribeFromTopic(_options) {\n        this.throwUnavailableError();\n    }\n    handleNotificationReceived(messagePayload) {\n        const notification = this.createNotificationResult(messagePayload);\n        const event = {\n            notification,\n        };\n        this.notifyListeners(FirebaseMessagingWeb.notificationReceivedEvent, event);\n    }\n    createNotificationResult(messagePayload) {\n        var _a, _b, _c;\n        const notification = {\n            body: (_a = messagePayload.notification) === null || _a === void 0 ? void 0 : _a.body,\n            data: messagePayload.data,\n            id: messagePayload.messageId,\n            image: (_b = messagePayload.notification) === null || _b === void 0 ? void 0 : _b.image,\n            title: (_c = messagePayload.notification) === null || _c === void 0 ? void 0 : _c.title,\n        };\n        return notification;\n    }\n    convertNotificationPermissionToPermissionState(permission) {\n        let state = 'prompt';\n        switch (permission) {\n            case 'granted':\n                state = 'granted';\n                break;\n            case 'denied':\n                state = 'denied';\n                break;\n        }\n        return state;\n    }\n    throwUnavailableError() {\n        throw this.unavailable('Not available on web.');\n    }\n}\nFirebaseMessagingWeb.notificationReceivedEvent = 'notificationReceived';\n//# sourceMappingURL=web.js.map"]}