{"version":3,"sources":["jsdelivr-header.js","/npm/@firebase/messaging-compat@0.2.24/src/messaging-compat.ts","/npm/@firebase/messaging-compat@0.2.24/src/registerMessagingCompat.ts","/npm/@firebase/messaging-compat@0.2.24/src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;SCiDgB,cACd,OAAI,MAAQ,6BAA8B,KAEjC,gBAGA,mBAEX,CAOA,SAAS,oBACP,MACoB,oBAAX,QACP,wBACA,qBACA,kBAAmB,WACnB,gBAAiB,QACjB,iBAAkB,QAClB,UAAW,QACX,0BAA0B,UAAU,eAAe,qBACnD,iBAAiB,UAAU,eAAe,SAE9C,CAKA,SAAS,gBACP,OACE,wBACA,gBAAiB,MACjB,iBAAkB,MAClB,0BAA0B,UAAU,eAAe,qBACnD,iBAAiB,UAAU,eAAe,SAE9C,C,MAEa,oBACX,WAAA,CAAqB,EAAyB,GAAzB,KAAG,IAAH,EAAyB,KAAS,UAAT,EAC5C,KAAK,IAAM,EACX,KAAK,UAAY,C,CAGnB,cAAM,CAAS,GAIb,OAAO,SAAS,KAAK,UAAW,E,CAGlC,iBAAM,GACJ,OAAO,YAAY,KAAK,U,CAG1B,SAAA,CACE,GAEA,OAAO,UAAU,KAAK,UAAW,E,CAGnC,mBAAA,CACE,GAEA,OAAO,oBAAoB,KAAK,UAAW,E;;;;;;;;;;;;;;;;GC3F/C,MAAM,uBACJ,GAEI,MAAQ,6BAA8B,KAEjC,IAAI,oBACT,EAAU,YAAY,cAAc,eACpC,EAAU,YAAY,gBAAgB,gBAIjC,IAAI,oBACT,EAAU,YAAY,cAAc,eACpC,EAAU,YAAY,aAAa,gBAKnC,kBAAoB,CACxB,yB,SAGc,0BACb,SAAgC,SAAS,kBACxC,IAAI,UACF,mBACA,uBAAsB,UAEtB,gBAAgB,mBAEtB;;;;;;;;;;;;;;;;GCvCA,0BACA,SAAS,gBAAgB,KAAM","file":"/npm/@firebase/messaging-compat@0.2.24/dist/esm/index.esm.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@firebase/messaging-compat@0.2.24/dist/esm/index.esm.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  FirebaseApp as AppCompat,\n  _FirebaseService\n} from '@firebase/app-compat';\nimport {\n  Messaging,\n  MessagePayload,\n  deleteToken,\n  getToken,\n  onMessage\n} from '@firebase/messaging';\nimport {\n  areCookiesEnabled,\n  isIndexedDBAvailable,\n  NextFn,\n  Observer,\n  Unsubscribe\n} from '@firebase/util';\n\nimport { onBackgroundMessage } from '@firebase/messaging/sw';\n\nexport interface MessagingCompat {\n  getToken(options?: {\n    vapidKey?: string;\n    serviceWorkerRegistration?: ServiceWorkerRegistration;\n  }): Promise<string>;\n\n  deleteToken(): Promise<boolean>;\n\n  onMessage(\n    nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n  ): Unsubscribe;\n\n  onBackgroundMessage(\n    nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n  ): Unsubscribe;\n}\n\nexport function isSupported(): boolean {\n  if (self && 'ServiceWorkerGlobalScope' in self) {\n    // Running in ServiceWorker context\n    return isSwSupported();\n  } else {\n    // Assume we are in the window context.\n    return isWindowSupported();\n  }\n}\n\n/**\n * Checks to see if the required APIs exist.\n * Unlike the modular version, it does not check if IndexedDB.open() is allowed\n * in order to keep isSupported() synchronous and maintain v8 compatibility.\n */\nfunction isWindowSupported(): boolean {\n  return (\n    typeof window !== 'undefined' &&\n    isIndexedDBAvailable() &&\n    areCookiesEnabled() &&\n    'serviceWorker' in navigator &&\n    'PushManager' in window &&\n    'Notification' in window &&\n    'fetch' in window &&\n    ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n    PushSubscription.prototype.hasOwnProperty('getKey')\n  );\n}\n\n/**\n * Checks to see if the required APIs exist within SW Context.\n */\nfunction isSwSupported(): boolean {\n  return (\n    isIndexedDBAvailable() &&\n    'PushManager' in self &&\n    'Notification' in self &&\n    ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n    PushSubscription.prototype.hasOwnProperty('getKey')\n  );\n}\n\nexport class MessagingCompatImpl implements MessagingCompat, _FirebaseService {\n  constructor(readonly app: AppCompat, readonly _delegate: Messaging) {\n    this.app = app;\n    this._delegate = _delegate;\n  }\n\n  async getToken(options?: {\n    vapidKey?: string;\n    serviceWorkerRegistration?: ServiceWorkerRegistration;\n  }): Promise<string> {\n    return getToken(this._delegate, options);\n  }\n\n  async deleteToken(): Promise<boolean> {\n    return deleteToken(this._delegate);\n  }\n\n  onMessage(\n    nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n  ): Unsubscribe {\n    return onMessage(this._delegate, nextOrObserver);\n  }\n\n  onBackgroundMessage(\n    nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n  ): Unsubscribe {\n    return onBackgroundMessage(this._delegate, nextOrObserver);\n  }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  Component,\n  ComponentContainer,\n  ComponentType,\n  InstanceFactory\n} from '@firebase/component';\nimport { MessagingCompatImpl, isSupported } from './messaging-compat';\nimport firebase, { _FirebaseNamespace } from '@firebase/app-compat';\n\ndeclare module '@firebase/component' {\n  interface NameServiceMapping {\n    'messaging-compat': MessagingCompatImpl;\n  }\n}\n\nconst messagingCompatFactory: InstanceFactory<'messaging-compat'> = (\n  container: ComponentContainer\n) => {\n  if (self && 'ServiceWorkerGlobalScope' in self) {\n    // in sw\n    return new MessagingCompatImpl(\n      container.getProvider('app-compat').getImmediate(),\n      container.getProvider('messaging-sw').getImmediate()\n    );\n  } else {\n    // in window\n    return new MessagingCompatImpl(\n      container.getProvider('app-compat').getImmediate(),\n      container.getProvider('messaging').getImmediate()\n    );\n  }\n};\n\nconst NAMESPACE_EXPORTS = {\n  isSupported\n};\n\nexport function registerMessagingCompat(): void {\n  (firebase as _FirebaseNamespace).INTERNAL.registerComponent(\n    new Component(\n      'messaging-compat',\n      messagingCompatFactory,\n      ComponentType.PUBLIC\n    ).setServiceProps(NAMESPACE_EXPORTS)\n  );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { name, version } from '../package.json';\n\nimport firebase from '@firebase/app-compat';\nimport { registerMessagingCompat } from './registerMessagingCompat';\nimport { MessagingCompat } from './messaging-compat';\n\nregisterMessagingCompat();\nfirebase.registerVersion(name, version);\n\n/**\n * Define extension behavior of `registerMessaging`\n */\ndeclare module '@firebase/app-compat' {\n  interface FirebaseNamespace {\n    messaging: {\n      (app?: FirebaseApp): MessagingCompat;\n      isSupported(): boolean;\n    };\n  }\n  interface FirebaseApp {\n    messaging(): MessagingCompat;\n  }\n}\n"]}