1(() => { 2 var __defProp = Object.defineProperty; 3 var __defProps = Object.defineProperties; 4 var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 5 var __getOwnPropSymbols = Object.getOwnPropertySymbols; 6 var __hasOwnProp = Object.prototype.hasOwnProperty; 7 var __propIsEnum = Object.prototype.propertyIsEnumerable; 8 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 9 var __spreadValues = (a, b) => { 10 for (var prop in b || (b = {})) 11 if (__hasOwnProp.call(b, prop)) 12 __defNormalProp(a, prop, b[prop]); 13 if (__getOwnPropSymbols) 14 for (var prop of __getOwnPropSymbols(b)) { 15 if (__propIsEnum.call(b, prop)) 16 __defNormalProp(a, prop, b[prop]); 17 } 18 return a; 19 }; 20 var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 21 22
vendor: 104 bytes, lines 22-25
22// node_modules/@firebase/util/dist/postinstall.mjs 23 var getDefaultsFromPostinstall = () => void 0; 24 25
vendor: 14,479 bytes, lines 25-481
25// node_modules/@firebase/util/dist/index.esm.js 26 var stringToByteArray$1 = function(str) { 27 const out = []; 28 let p = 0; 29 for (let i = 0; i < str.length; i++) { 30 let c = str.charCodeAt(i); 31 if (c < 128) { 32 out[p++] = c; 33 } else if (c < 2048) { 34 out[p++] = c >> 6 | 192; 35 out[p++] = c & 63 | 128; 36 } else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) { 37 c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023); 38 out[p++] = c >> 18 | 240; 39 out[p++] = c >> 12 & 63 | 128; 40 out[p++] = c >> 6 & 63 | 128; 41 out[p++] = c & 63 | 128; 42 } else { 43 out[p++] = c >> 12 | 224; 44 out[p++] = c >> 6 & 63 | 128; 45 out[p++] = c & 63 | 128; 46 } 47 } 48 return out; 49 }; 50 var byteArrayToString = function(bytes) { 51 const out = []; 52 let pos = 0, c = 0; 53 while (pos < bytes.length) { 54 const c1 = bytes[pos++]; 55 if (c1 < 128) { 56 out[c++] = String.fromCharCode(c1); 57 } else if (c1 > 191 && c1 < 224) { 58 const c2 = bytes[pos++]; 59 out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63); 60 } else if (c1 > 239 && c1 < 365) { 61 const c2 = bytes[pos++]; 62 const c3 = bytes[pos++]; 63 const c4 = bytes[pos++]; 64 const u = ((c1 & 7) << 18 | (c2 & 63) << 12 | (c3 & 63) << 6 | c4 & 63) - 65536; 65 out[c++] = String.fromCharCode(55296 + (u >> 10)); 66 out[c++] = String.fromCharCode(56320 + (u & 1023)); 67 } else { 68 const c2 = bytes[pos++]; 69 const c3 = bytes[pos++]; 70 out[c++] = String.fromCharCode((c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63); 71 } 72 } 73 return out.join(""); 74 }; 75 var base64 = { 76 /** 77 * Maps bytes to characters. 78 */ 79 byteToCharMap_: null, 80 /** 81 * Maps characters to bytes. 82 */ 83 charToByteMap_: null, 84 /** 85 * Maps bytes to websafe characters. 86 * @private 87 */ 88 byteToCharMapWebSafe_: null, 89 /** 90 * Maps websafe characters to bytes. 91 * @private 92 */ 93 charToByteMapWebSafe_: null, 94 /** 95 * Our default alphabet, shared between 96 * ENCODED_VALS and ENCODED_VALS_WEBSAFE 97 */ 98 ENCODED_VALS_BASE: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 99 /** 100 * Our default alphabet. Value 64 (=) is special; it means "nothing." 101 */ 102 get ENCODED_VALS() { 103 return this.ENCODED_VALS_BASE + "+/="; 104 }, 105 /** 106 * Our websafe alphabet. 107 */ 108 get ENCODED_VALS_WEBSAFE() { 109 return this.ENCODED_VALS_BASE + "-_."; 110 }, 111 /** 112 * Whether this browser supports the atob and btoa functions. This extension 113 * started at Mozilla but is now implemented by many browsers. We use the 114 * ASSUME_* variables to avoid pulling in the full useragent detection library 115 * but still allowing the standard per-browser compilations. 116 * 117 */ 118 HAS_NATIVE_SUPPORT: typeof atob === "function", 119 /** 120 * Base64-encode an array of bytes. 121 * 122 * @param input An array of bytes (numbers with 123 * value in [0, 255]) to encode. 124 * @param webSafe Boolean indicating we should use the 125 * alternative alphabet. 126 * @return The base64 encoded string. 127 */ 128 encodeByteArray(input, webSafe) { 129 if (!Array.isArray(input)) { 130 throw Error("encodeByteArray takes an array as a parameter"); 131 } 132 this.init_(); 133 const byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; 134 const output = []; 135 for (let i = 0; i < input.length; i += 3) { 136 const byte1 = input[i]; 137 const haveByte2 = i + 1 < input.length; 138 const byte2 = haveByte2 ? input[i + 1] : 0; 139 const haveByte3 = i + 2 < input.length; 140 const byte3 = haveByte3 ? input[i + 2] : 0; 141 const outByte1 = byte1 >> 2; 142 const outByte2 = (byte1 & 3) << 4 | byte2 >> 4; 143 let outByte3 = (byte2 & 15) << 2 | byte3 >> 6; 144 let outByte4 = byte3 & 63; 145 if (!haveByte3) { 146 outByte4 = 64; 147 if (!haveByte2) { 148 outByte3 = 64; 149 } 150 } 151 output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); 152 } 153 return output.join(""); 154 }, 155 /** 156 * Base64-encode a string. 157 * 158 * @param input A string to encode. 159 * @param webSafe If true, we should use the 160 * alternative alphabet. 161 * @return The base64 encoded string. 162 */ 163 encodeString(input, webSafe) { 164 if (this.HAS_NATIVE_SUPPORT && !webSafe) { 165 return btoa(input); 166 } 167 return this.encodeByteArray(stringToByteArray$1(input), webSafe); 168 }, 169 /** 170 * Base64-decode a string. 171 * 172 * @param input to decode. 173 * @param webSafe True if we should use the 174 * alternative alphabet. 175 * @return string representing the decoded value. 176 */ 177 decodeString(input, webSafe) { 178 if (this.HAS_NATIVE_SUPPORT && !webSafe) { 179 return atob(input); 180 } 181 return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); 182 }, 183 /** 184 * Base64-decode a string. 185 * 186 * In base-64 decoding, groups of four characters are converted into three 187 * bytes. If the encoder did not apply padding, the input length may not 188 * be a multiple of 4. 189 * 190 * In this case, the last group will have fewer than 4 characters, and 191 * padding will be inferred. If the group has one or two characters, it decodes 192 * to one byte. If the group has three characters, it decodes to two bytes. 193 * 194 * @param input Input to decode. 195 * @param webSafe True if we should use the web-safe alphabet. 196 * @return bytes representing the decoded value. 197 */ 198 decodeStringToByteArray(input, webSafe) { 199 this.init_(); 200 const charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; 201 const output = []; 202 for (let i = 0; i < input.length; ) { 203 const byte1 = charToByteMap[input.charAt(i++)]; 204 const haveByte2 = i < input.length; 205 const byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; 206 ++i; 207 const haveByte3 = i < input.length; 208 const byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; 209 ++i; 210 const haveByte4 = i < input.length; 211 const byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; 212 ++i; 213 if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { 214 throw new DecodeBase64StringError(); 215 } 216 const outByte1 = byte1 << 2 | byte2 >> 4; 217 output.push(outByte1); 218 if (byte3 !== 64) { 219 const outByte2 = byte2 << 4 & 240 | byte3 >> 2; 220 output.push(outByte2); 221 if (byte4 !== 64) { 222 const outByte3 = byte3 << 6 & 192 | byte4; 223 output.push(outByte3); 224 } 225 } 226 } 227 return output; 228 }, 229 /** 230 * Lazy static initialization function. Called before 231 * accessing any of the static map variables. 232 * @private 233 */ 234 init_() { 235 if (!this.byteToCharMap_) { 236 this.byteToCharMap_ = {}; 237 this.charToByteMap_ = {}; 238 this.byteToCharMapWebSafe_ = {}; 239 this.charToByteMapWebSafe_ = {}; 240 for (let i = 0; i < this.ENCODED_VALS.length; i++) { 241 this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); 242 this.charToByteMap_[this.byteToCharMap_[i]] = i; 243 this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); 244 this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; 245 if (i >= this.ENCODED_VALS_BASE.length) { 246 this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; 247 this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; 248 } 249 } 250 } 251 } 252 }; 253 var DecodeBase64StringError = class extends Error { 254 constructor() { 255 super(...arguments); 256 this.name = "DecodeBase64StringError"; 257 } 258 }; 259 var base64Encode = function(str) { 260 const utf8Bytes = stringToByteArray$1(str); 261 return base64.encodeByteArray(utf8Bytes, true); 262 }; 263 var base64urlEncodeWithoutPadding = function(str) { 264 return base64Encode(str).replace(/\./g, ""); 265 }; 266 var base64Decode = function(str) { 267 try { 268 return base64.decodeString(str, true); 269 } catch (e) { 270 console.error("base64Decode failed: ", e); 271 } 272 return null; 273 }; 274 function getGlobal() { 275 if (typeof self !== "undefined") { 276 return self; 277 } 278 if (typeof window !== "undefined") { 279 return window; 280 } 281 if (typeof global !== "undefined") { 282 return global; 283 } 284 throw new Error("Unable to locate global object."); 285 } 286 var getDefaultsFromGlobal = () => getGlobal().__FIREBASE_DEFAULTS__; 287 var getDefaultsFromEnvVariable = () => { 288 if (typeof process === "undefined" || typeof process.env === "undefined") { 289 return; 290 } 291 const defaultsJsonString = process.env.__FIREBASE_DEFAULTS__; 292 if (defaultsJsonString) { 293 return JSON.parse(defaultsJsonString); 294 } 295 }; 296 var getDefaultsFromCookie = () => { 297 if (typeof document === "undefined") { 298 return; 299 } 300 let match; 301 try { 302 match = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/); 303 } catch (e) { 304 return; 305 } 306 const decoded = match && base64Decode(match[1]); 307 return decoded && JSON.parse(decoded); 308 }; 309 var getDefaults = () => { 310 try { 311 return getDefaultsFromPostinstall() || getDefaultsFromGlobal() || getDefaultsFromEnvVariable() || getDefaultsFromCookie(); 312 } catch (e) { 313 console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`); 314 return; 315 } 316 }; 317 var getDefaultAppConfig = () => { 318 var _a; 319 return (_a = getDefaults()) == null ? void 0 : _a.config; 320 }; 321 var Deferred = class { 322 constructor() { 323 this.reject = () => { 324 }; 325 this.resolve = () => { 326 }; 327 this.promise = new Promise((resolve, reject) => { 328 this.resolve = resolve; 329 this.reject = reject; 330 }); 331 } 332 /** 333 * Our API internals are not promisified and cannot because our callback APIs have subtle expectations around 334 * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback 335 * and returns a node-style callback which will resolve or reject the Deferred's promise. 336 */ 337 wrapCallback(callback) { 338 return (error, value) => { 339 if (error) { 340 this.reject(error); 341 } else { 342 this.resolve(value); 343 } 344 if (typeof callback === "function") { 345 this.promise.catch(() => { 346 }); 347 if (callback.length === 1) { 348 callback(error); 349 } else { 350 callback(error, value); 351 } 352 } 353 }; 354 } 355 }; 356 function isIndexedDBAvailable() { 357 try { 358 return typeof indexedDB === "object"; 359 } catch (e) { 360 return false; 361 } 362 } 363 function validateIndexedDBOpenable() { 364 return new Promise((resolve, reject) => { 365 try { 366 let preExist = true; 367 const DB_CHECK_NAME = "validate-browser-context-for-indexeddb-analytics-module"; 368 const request = self.indexedDB.open(DB_CHECK_NAME); 369 request.onsuccess = () => { 370 request.result.close(); 371 if (!preExist) { 372 self.indexedDB.deleteDatabase(DB_CHECK_NAME); 373 } 374 resolve(true); 375 }; 376 request.onupgradeneeded = () => { 377 preExist = false; 378 }; 379 request.onerror = () => { 380 var _a; 381 reject(((_a = request.error) == null ? void 0 : _a.message) || ""); 382 }; 383 } catch (error) { 384 reject(error); 385 } 386 }); 387 } 388 var ERROR_NAME = "FirebaseError"; 389 var FirebaseError = class _FirebaseError extends Error { 390 constructor(code, message, customData) { 391 super(message); 392 this.code = code; 393 this.customData = customData; 394 this.name = ERROR_NAME; 395 Object.setPrototypeOf(this, _FirebaseError.prototype); 396 if (Error.captureStackTrace) { 397 Error.captureStackTrace(this, ErrorFactory.prototype.create); 398 } 399 } 400 }; 401 var ErrorFactory = class { 402 constructor(service, serviceName, errors) { 403 this.service = service; 404 this.serviceName = serviceName; 405 this.errors = errors; 406 } 407 create(code, ...data) { 408 const customData = data[0] || {}; 409 const fullCode = `${this.service}/${code}`; 410 const template = this.errors[code]; 411 const message = template ? replaceTemplate(template, customData) : "Error"; 412 const fullMessage = `${this.serviceName}: ${message} (${fullCode}).`; 413 const error = new FirebaseError(fullCode, fullMessage, customData); 414 return error; 415 } 416 }; 417 function replaceTemplate(template, data) { 418 try { 419 let ptr = 0; 420 let result = ""; 421 while (ptr < template.length) { 422 const start = template.indexOf("{$", ptr); 423 if (start === -1) { 424 result += template.substring(ptr); 425 break; 426 } 427 const end = template.indexOf("}", start + 2); 428 if (end === -1) { 429 result += template.substring(ptr); 430 break; 431 } 432 const key = template.substring(start + 2, end); 433 const value = data[key]; 434 result += template.substring(ptr, start) + (value != null ? String(value) : `<${key}?>`); 435 ptr = end + 1; 436 } 437 return result; 438 } catch (e) { 439 return template; 440 } 441 } 442 function deepEqual(a, b) { 443 if (a === b) { 444 return true; 445 } 446 const aKeys = Object.keys(a); 447 const bKeys = Object.keys(b); 448 for (const k of aKeys) { 449 if (!bKeys.includes(k)) { 450 return false; 451 } 452 const aProp = a[k]; 453 const bProp = b[k]; 454 if (isObject(aProp) && isObject(bProp)) { 455 if (!deepEqual(aProp, bProp)) { 456 return false; 457 } 458 } else if (aProp !== bProp) { 459 return false; 460 } 461 } 462 for (const k of bKeys) { 463 if (!aKeys.includes(k)) { 464 return false; 465 } 466 } 467 return true; 468 } 469 function isObject(thing) { 470 return thing !== null && typeof thing === "object"; 471 } 472 var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1e3; 473 function getModularInstance(service) { 474 if (service && service._delegate) { 475 return service._delegate; 476 } else { 477 return service; 478 } 479 } 480 481
vendor: 10,520 bytes, lines 481-770
481// node_modules/@firebase/component/dist/esm/index.esm.js 482 var Component = class { 483 /** 484 * 485 * @param name The public service name, e.g. app, auth, firestore, database 486 * @param instanceFactory Service factory responsible for creating the public interface 487 * @param type whether the service provided by the component is public or private 488 */ 489 constructor(name4, instanceFactory, type) { 490 this.name = name4; 491 this.instanceFactory = instanceFactory; 492 this.type = type; 493 this.multipleInstances = false; 494 this.serviceProps = {}; 495 this.instantiationMode = "LAZY"; 496 this.onInstanceCreated = null; 497 } 498 setInstantiationMode(mode) { 499 this.instantiationMode = mode; 500 return this; 501 } 502 setMultipleInstances(multipleInstances) { 503 this.multipleInstances = multipleInstances; 504 return this; 505 } 506 setServiceProps(props) { 507 this.serviceProps = props; 508 return this; 509 } 510 setInstanceCreatedCallback(callback) { 511 this.onInstanceCreated = callback; 512 return this; 513 } 514 }; 515 var DEFAULT_ENTRY_NAME = "[DEFAULT]"; 516 var Provider = class { 517 constructor(name4, container) { 518 this.name = name4; 519 this.container = container; 520 this.component = null; 521 this.instances = /* @__PURE__ */ new Map(); 522 this.instancesDeferred = /* @__PURE__ */ new Map(); 523 this.instancesOptions = /* @__PURE__ */ new Map(); 524 this.onInitCallbacks = /* @__PURE__ */ new Map(); 525 } 526 /** 527 * @param identifier A provider can provide multiple instances of a service 528 * if this.component.multipleInstances is true. 529 */ 530 get(identifier) { 531 const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); 532 if (!this.instancesDeferred.has(normalizedIdentifier)) { 533 const deferred = new Deferred(); 534 this.instancesDeferred.set(normalizedIdentifier, deferred); 535 if (this.isInitialized(normalizedIdentifier) || this.shouldAutoInitialize()) { 536 try { 537 const instance = this.getOrInitializeService({ 538 instanceIdentifier: normalizedIdentifier 539 }); 540 if (instance) { 541 deferred.resolve(instance); 542 } 543 } catch (e) { 544 } 545 } 546 } 547 return this.instancesDeferred.get(normalizedIdentifier).promise; 548 } 549 getImmediate(options) { 550 var _a; 551 const normalizedIdentifier = this.normalizeInstanceIdentifier(options == null ? void 0 : options.identifier); 552 const optional = (_a = options == null ? void 0 : options.optional) != null ? _a : false; 553 if (this.isInitialized(normalizedIdentifier) || this.shouldAutoInitialize()) { 554 try { 555 return this.getOrInitializeService({ 556 instanceIdentifier: normalizedIdentifier 557 }); 558 } catch (e) { 559 if (optional) { 560 return null; 561 } else { 562 throw e; 563 } 564 } 565 } else { 566 if (optional) { 567 return null; 568 } else { 569 throw Error(`Service ${this.name} is not available`); 570 } 571 } 572 } 573 getComponent() { 574 return this.component; 575 } 576 setComponent(component) { 577 if (component.name !== this.name) { 578 throw Error(`Mismatching Component ${component.name} for Provider ${this.name}.`); 579 } 580 if (this.component) { 581 throw Error(`Component for ${this.name} has already been provided`); 582 } 583 this.component = component; 584 if (!this.shouldAutoInitialize()) { 585 return; 586 } 587 if (isComponentEager(component)) { 588 try { 589 this.getOrInitializeService({ instanceIdentifier: DEFAULT_ENTRY_NAME }); 590 } catch (e) { 591 } 592 } 593 for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) { 594 const normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); 595 try { 596 const instance = this.getOrInitializeService({ 597 instanceIdentifier: normalizedIdentifier 598 }); 599 instanceDeferred.resolve(instance); 600 } catch (e) { 601 } 602 } 603 } 604 clearInstance(identifier = DEFAULT_ENTRY_NAME) { 605 this.instancesDeferred.delete(identifier); 606 this.instancesOptions.delete(identifier); 607 this.instances.delete(identifier); 608 } 609 // app.delete() will call this method on every provider to delete the services 610 // TODO: should we mark the provider as deleted? 611 async delete() { 612 const services = Array.from(this.instances.values()); 613 await Promise.all([ 614 ...services.filter((service) => "INTERNAL" in service).map((service) => service.INTERNAL.delete()), 615 ...services.filter((service) => "_delete" in service).map((service) => service._delete()) 616 ]); 617 } 618 isComponentSet() { 619 return this.component != null; 620 } 621 isInitialized(identifier = DEFAULT_ENTRY_NAME) { 622 return this.instances.has(identifier); 623 } 624 getOptions(identifier = DEFAULT_ENTRY_NAME) { 625 return this.instancesOptions.get(identifier) || {}; 626 } 627 initialize(opts = {}) { 628 const { options = {} } = opts; 629 const normalizedIdentifier = this.normalizeInstanceIdentifier(opts.instanceIdentifier); 630 if (this.isInitialized(normalizedIdentifier)) { 631 throw Error(`${this.name}(${normalizedIdentifier}) has already been initialized`); 632 } 633 if (!this.isComponentSet()) { 634 throw Error(`Component ${this.name} has not been registered yet`); 635 } 636 const instance = this.getOrInitializeService({ 637 instanceIdentifier: normalizedIdentifier, 638 options 639 }); 640 for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) { 641 const normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier); 642 if (normalizedIdentifier === normalizedDeferredIdentifier) { 643 instanceDeferred.resolve(instance); 644 } 645 } 646 return instance; 647 } 648 /** 649 * 650 * @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize(). 651 * The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program. 652 * 653 * @param identifier An optional instance identifier 654 * @returns a function to unregister the callback 655 */ 656 onInit(callback, identifier) { 657 var _a; 658 const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier); 659 const existingCallbacks = (_a = this.onInitCallbacks.get(normalizedIdentifier)) != null ? _a : /* @__PURE__ */ new Set(); 660 existingCallbacks.add(callback); 661 this.onInitCallbacks.set(normalizedIdentifier, existingCallbacks); 662 const existingInstance = this.instances.get(normalizedIdentifier); 663 if (existingInstance) { 664 callback(existingInstance, normalizedIdentifier); 665 } 666 return () => { 667 existingCallbacks.delete(callback); 668 }; 669 } 670 /** 671 * Invoke onInit callbacks synchronously 672 * @param instance the service instance` 673 */ 674 invokeOnInitCallbacks(instance, identifier) { 675 const callbacks = this.onInitCallbacks.get(identifier); 676 if (!callbacks) { 677 return; 678 } 679 for (const callback of callbacks) { 680 try { 681 callback(instance, identifier); 682 } catch (e) { 683 } 684 } 685 } 686 getOrInitializeService({ instanceIdentifier, options = {} }) { 687 let instance = this.instances.get(instanceIdentifier); 688 if (!instance && this.component) { 689 instance = this.component.instanceFactory(this.container, { 690 instanceIdentifier: normalizeIdentifierForFactory(instanceIdentifier), 691 options 692 }); 693 this.instances.set(instanceIdentifier, instance); 694 this.instancesOptions.set(instanceIdentifier, options); 695 this.invokeOnInitCallbacks(instance, instanceIdentifier); 696 if (this.component.onInstanceCreated) { 697 try { 698 this.component.onInstanceCreated(this.container, instanceIdentifier, instance); 699 } catch (e) { 700 } 701 } 702 } 703 return instance || null; 704 } 705 normalizeInstanceIdentifier(identifier = DEFAULT_ENTRY_NAME) { 706 if (this.component) { 707 return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME; 708 } else { 709 return identifier; 710 } 711 } 712 shouldAutoInitialize() { 713 return !!this.component && this.component.instantiationMode !== "EXPLICIT"; 714 } 715 }; 716 function normalizeIdentifierForFactory(identifier) { 717 return identifier === DEFAULT_ENTRY_NAME ? void 0 : identifier; 718 } 719 function isComponentEager(component) { 720 return component.instantiationMode === "EAGER"; 721 } 722 var ComponentContainer = class { 723 constructor(name4) { 724 this.name = name4; 725 this.providers = /* @__PURE__ */ new Map(); 726 } 727 /** 728 * 729 * @param component Component being added 730 * @param overwrite When a component with the same name has already been registered, 731 * if overwrite is true: overwrite the existing component with the new component and create a new 732 * provider with the new component. It can be useful in tests where you want to use different mocks 733 * for different tests. 734 * if overwrite is false: throw an exception 735 */ 736 addComponent(component) { 737 const provider = this.getProvider(component.name); 738 if (provider.isComponentSet()) { 739 throw new Error(`Component ${component.name} has already been registered with ${this.name}`); 740 } 741 provider.setComponent(component); 742 } 743 addOrOverwriteComponent(component) { 744 const provider = this.getProvider(component.name); 745 if (provider.isComponentSet()) { 746 this.providers.delete(component.name); 747 } 748 this.addComponent(component); 749 } 750 /** 751 * getProvider provides a type safe interface where it can only be called with a field name 752 * present in NameServiceMapping interface. 753 * 754 * Firebase SDKs providing services should extend NameServiceMapping interface to register 755 * themselves. 756 */ 757 getProvider(name4) { 758 if (this.providers.has(name4)) { 759 return this.providers.get(name4); 760 } 761 const provider = new Provider(name4, this); 762 this.providers.set(name4, provider); 763 return provider; 764 } 765 getProviders() { 766 return Array.from(this.providers.values()); 767 } 768 }; 769 770
vendor: 3,428 bytes, lines 770-876
770// node_modules/@firebase/logger/dist/esm/index.esm.js 771 var instances = []; 772 var LogLevel; 773 (function(LogLevel2) { 774 LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG"; 775 LogLevel2[LogLevel2["VERBOSE"] = 1] = "VERBOSE"; 776 LogLevel2[LogLevel2["INFO"] = 2] = "INFO"; 777 LogLevel2[LogLevel2["WARN"] = 3] = "WARN"; 778 LogLevel2[LogLevel2["ERROR"] = 4] = "ERROR"; 779 LogLevel2[LogLevel2["SILENT"] = 5] = "SILENT"; 780 })(LogLevel || (LogLevel = {})); 781 var levelStringToEnum = { 782 "debug": LogLevel.DEBUG, 783 "verbose": LogLevel.VERBOSE, 784 "info": LogLevel.INFO, 785 "warn": LogLevel.WARN, 786 "error": LogLevel.ERROR, 787 "silent": LogLevel.SILENT 788 }; 789 var defaultLogLevel = LogLevel.INFO; 790 var ConsoleMethod = { 791 [LogLevel.DEBUG]: "log", 792 [LogLevel.VERBOSE]: "log", 793 [LogLevel.INFO]: "info", 794 [LogLevel.WARN]: "warn", 795 [LogLevel.ERROR]: "error" 796 }; 797 var defaultLogHandler = (instance, logType, ...args) => { 798 if (logType < instance.logLevel) { 799 return; 800 } 801 const now = (/* @__PURE__ */ new Date()).toISOString(); 802 const method = ConsoleMethod[logType]; 803 if (method) { 804 console[method](`[${now}] ${instance.name}:`, ...args); 805 } else { 806 throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`); 807 } 808 }; 809 var Logger = class { 810 /** 811 * Gives you an instance of a Logger to capture messages according to 812 * Firebase's logging scheme. 813 * 814 * @param name The name that the logs will be associated with 815 */ 816 constructor(name4) { 817 this.name = name4; 818 this._logLevel = defaultLogLevel; 819 this._logHandler = defaultLogHandler; 820 this._userLogHandler = null; 821 instances.push(this); 822 } 823 get logLevel() { 824 return this._logLevel; 825 } 826 set logLevel(val) { 827 if (!(val in LogLevel)) { 828 throw new TypeError(`Invalid value "${val}" assigned to \`logLevel\``); 829 } 830 this._logLevel = val; 831 } 832 // Workaround for setter/getter having to be the same type. 833 setLogLevel(val) { 834 this._logLevel = typeof val === "string" ? levelStringToEnum[val] : val; 835 } 836 get logHandler() { 837 return this._logHandler; 838 } 839 set logHandler(val) { 840 if (typeof val !== "function") { 841 throw new TypeError("Value assigned to `logHandler` must be a function"); 842 } 843 this._logHandler = val; 844 } 845 get userLogHandler() { 846 return this._userLogHandler; 847 } 848 set userLogHandler(val) { 849 this._userLogHandler = val; 850 } 851 /** 852 * The functions below are all based on the `console` interface 853 */ 854 debug(...args) { 855 this._userLogHandler && this._userLogHandler(this, LogLevel.DEBUG, ...args); 856 this._logHandler(this, LogLevel.DEBUG, ...args); 857 } 858 log(...args) { 859 this._userLogHandler && this._userLogHandler(this, LogLevel.VERBOSE, ...args); 860 this._logHandler(this, LogLevel.VERBOSE, ...args); 861 } 862 info(...args) { 863 this._userLogHandler && this._userLogHandler(this, LogLevel.INFO, ...args); 864 this._logHandler(this, LogLevel.INFO, ...args); 865 } 866 warn(...args) { 867 this._userLogHandler && this._userLogHandler(this, LogLevel.WARN, ...args); 868 this._logHandler(this, LogLevel.WARN, ...args); 869 } 870 error(...args) { 871 this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args); 872 this._logHandler(this, LogLevel.ERROR, ...args); 873 } 874 }; 875 876
vendor: 4,707 bytes, lines 876-1019
876// node_modules/idb/build/wrap-idb-value.js 877 var instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c); 878 var idbProxyableTypes; 879 var cursorAdvanceMethods; 880 function getIdbProxyableTypes() { 881 return idbProxyableTypes || (idbProxyableTypes = [ 882 IDBDatabase, 883 IDBObjectStore, 884 IDBIndex, 885 IDBCursor, 886 IDBTransaction 887 ]); 888 } 889 function getCursorAdvanceMethods() { 890 return cursorAdvanceMethods || (cursorAdvanceMethods = [ 891 IDBCursor.prototype.advance, 892 IDBCursor.prototype.continue, 893 IDBCursor.prototype.continuePrimaryKey 894 ]); 895 } 896 var cursorRequestMap = /* @__PURE__ */ new WeakMap(); 897 var transactionDoneMap = /* @__PURE__ */ new WeakMap(); 898 var transactionStoreNamesMap = /* @__PURE__ */ new WeakMap(); 899 var transformCache = /* @__PURE__ */ new WeakMap(); 900 var reverseTransformCache = /* @__PURE__ */ new WeakMap(); 901 function promisifyRequest(request) { 902 const promise = new Promise((resolve, reject) => { 903 const unlisten = () => { 904 request.removeEventListener("success", success); 905 request.removeEventListener("error", error); 906 }; 907 const success = () => { 908 resolve(wrap(request.result)); 909 unlisten(); 910 }; 911 const error = () => { 912 reject(request.error); 913 unlisten(); 914 }; 915 request.addEventListener("success", success); 916 request.addEventListener("error", error); 917 }); 918 promise.then((value) => { 919 if (value instanceof IDBCursor) { 920 cursorRequestMap.set(value, request); 921 } 922 }).catch(() => { 923 }); 924 reverseTransformCache.set(promise, request); 925 return promise; 926 } 927 function cacheDonePromiseForTransaction(tx) { 928 if (transactionDoneMap.has(tx)) 929 return; 930 const done = new Promise((resolve, reject) => { 931 const unlisten = () => { 932 tx.removeEventListener("complete", complete); 933 tx.removeEventListener("error", error); 934 tx.removeEventListener("abort", error); 935 }; 936 const complete = () => { 937 resolve(); 938 unlisten(); 939 }; 940 const error = () => { 941 reject(tx.error || new DOMException("AbortError", "AbortError")); 942 unlisten(); 943 }; 944 tx.addEventListener("complete", complete); 945 tx.addEventListener("error", error); 946 tx.addEventListener("abort", error); 947 }); 948 transactionDoneMap.set(tx, done); 949 } 950 var idbProxyTraps = { 951 get(target, prop, receiver) { 952 if (target instanceof IDBTransaction) { 953 if (prop === "done") 954 return transactionDoneMap.get(target); 955 if (prop === "objectStoreNames") { 956 return target.objectStoreNames || transactionStoreNamesMap.get(target); 957 } 958 if (prop === "store") { 959 return receiver.objectStoreNames[1] ? void 0 : receiver.objectStore(receiver.objectStoreNames[0]); 960 } 961 } 962 return wrap(target[prop]); 963 }, 964 set(target, prop, value) { 965 target[prop] = value; 966 return true; 967 }, 968 has(target, prop) { 969 if (target instanceof IDBTransaction && (prop === "done" || prop === "store")) { 970 return true; 971 } 972 return prop in target; 973 } 974 }; 975 function replaceTraps(callback) { 976 idbProxyTraps = callback(idbProxyTraps); 977 } 978 function wrapFunction(func) { 979 if (func === IDBDatabase.prototype.transaction && !("objectStoreNames" in IDBTransaction.prototype)) { 980 return function(storeNames, ...args) { 981 const tx = func.call(unwrap(this), storeNames, ...args); 982 transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]); 983 return wrap(tx); 984 }; 985 } 986 if (getCursorAdvanceMethods().includes(func)) { 987 return function(...args) { 988 func.apply(unwrap(this), args); 989 return wrap(cursorRequestMap.get(this)); 990 }; 991 } 992 return function(...args) { 993 return wrap(func.apply(unwrap(this), args)); 994 }; 995 } 996 function transformCachableValue(value) { 997 if (typeof value === "function") 998 return wrapFunction(value); 999 if (value instanceof IDBTransaction) 1000 cacheDonePromiseForTransaction(value); 1001 if (instanceOfAny(value, getIdbProxyableTypes())) 1002 return new Proxy(value, idbProxyTraps); 1003 return value; 1004 } 1005 function wrap(value) { 1006 if (value instanceof IDBRequest) 1007 return promisifyRequest(value); 1008 if (transformCache.has(value)) 1009 return transformCache.get(value); 1010 const newValue = transformCachableValue(value); 1011 if (newValue !== value) { 1012 transformCache.set(value, newValue); 1013 reverseTransformCache.set(newValue, value); 1014 } 1015 return newValue; 1016 } 1017 var unwrap = (value) => reverseTransformCache.get(value); 1018 1019
vendor: 2,864 bytes, lines 1019-1093
1019// node_modules/idb/build/index.js 1020 function openDB(name4, version4, { blocked, upgrade, blocking, terminated } = {}) { 1021 const request = indexedDB.open(name4, version4); 1022 const openPromise = wrap(request); 1023 if (upgrade) { 1024 request.addEventListener("upgradeneeded", (event) => { 1025 upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event); 1026 }); 1027 } 1028 if (blocked) { 1029 request.addEventListener("blocked", (event) => blocked( 1030 // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405 1031 event.oldVersion, 1032 event.newVersion, 1033 event 1034 )); 1035 } 1036 openPromise.then((db) => { 1037 if (terminated) 1038 db.addEventListener("close", () => terminated()); 1039 if (blocking) { 1040 db.addEventListener("versionchange", (event) => blocking(event.oldVersion, event.newVersion, event)); 1041 } 1042 }).catch(() => { 1043 }); 1044 return openPromise; 1045 } 1046 function deleteDB(name4, { blocked } = {}) { 1047 const request = indexedDB.deleteDatabase(name4); 1048 if (blocked) { 1049 request.addEventListener("blocked", (event) => blocked( 1050 // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405 1051 event.oldVersion, 1052 event 1053 )); 1054 } 1055 return wrap(request).then(() => void 0); 1056 } 1057 var readMethods = ["get", "getKey", "getAll", "getAllKeys", "count"]; 1058 var writeMethods = ["put", "add", "delete", "clear"]; 1059 var cachedMethods = /* @__PURE__ */ new Map(); 1060 function getMethod(target, prop) { 1061 if (!(target instanceof IDBDatabase && !(prop in target) && typeof prop === "string")) { 1062 return; 1063 } 1064 if (cachedMethods.get(prop)) 1065 return cachedMethods.get(prop); 1066 const targetFuncName = prop.replace(/FromIndex$/, ""); 1067 const useIndex = prop !== targetFuncName; 1068 const isWrite = writeMethods.includes(targetFuncName); 1069 if ( 1070 // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge. 1071 !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) || !(isWrite || readMethods.includes(targetFuncName)) 1072 ) { 1073 return; 1074 } 1075 const method = async function(storeName, ...args) { 1076 const tx = this.transaction(storeName, isWrite ? "readwrite" : "readonly"); 1077 let target2 = tx.store; 1078 if (useIndex) 1079 target2 = target2.index(args.shift()); 1080 return (await Promise.all([ 1081 target2[targetFuncName](...args), 1082 isWrite && tx.done 1083 ]))[0]; 1084 }; 1085 cachedMethods.set(prop, method); 1086 return method; 1087 } 1088 replaceTraps((oldTraps) => __spreadProps(__spreadValues({}, oldTraps), { 1089 get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver), 1090 has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop) 1091 })); 1092 1093
vendor: 20,538 bytes, lines 1093-1689
1093// node_modules/@firebase/app/dist/esm/index.esm.js 1094 var PlatformLoggerServiceImpl = class { 1095 constructor(container) { 1096 this.container = container; 1097 } 1098 // In initial implementation, this will be called by installations on 1099 // auth token refresh, and installations will send this string. 1100 getPlatformInfoString() { 1101 const providers = this.container.getProviders(); 1102 return providers.map((provider) => { 1103 if (isVersionServiceProvider(provider)) { 1104 const service = provider.getImmediate(); 1105 return `${service.library}/${service.version}`; 1106 } else { 1107 return null; 1108 } 1109 }).filter((logString) => logString).join(" "); 1110 } 1111 }; 1112 function isVersionServiceProvider(provider) { 1113 const component = provider.getComponent(); 1114 return (component == null ? void 0 : component.type) === "VERSION"; 1115 } 1116 var name$q = "@firebase/app"; 1117 var version$1 = "0.16.2"; 1118 var logger = new Logger("@firebase/app"); 1119 var name$p = "@firebase/app-compat"; 1120 var name$o = "@firebase/analytics-compat"; 1121 var name$n = "@firebase/analytics"; 1122 var name$m = "@firebase/app-check-compat"; 1123 var name$l = "@firebase/app-check"; 1124 var name$k = "@firebase/auth"; 1125 var name$j = "@firebase/auth-compat"; 1126 var name$i = "@firebase/database"; 1127 var name$h = "@firebase/data-connect"; 1128 var name$g = "@firebase/database-compat"; 1129 var name$f = "@firebase/functions"; 1130 var name$e = "@firebase/functions-compat"; 1131 var name$d = "@firebase/installations"; 1132 var name$c = "@firebase/installations-compat"; 1133 var name$b = "@firebase/messaging"; 1134 var name$a = "@firebase/messaging-compat"; 1135 var name$9 = "@firebase/performance"; 1136 var name$8 = "@firebase/performance-compat"; 1137 var name$7 = "@firebase/remote-config"; 1138 var name$6 = "@firebase/remote-config-compat"; 1139 var name$5 = "@firebase/storage"; 1140 var name$4 = "@firebase/storage-compat"; 1141 var name$3 = "@firebase/firestore"; 1142 var name$2 = "@firebase/ai"; 1143 var name$1 = "@firebase/firestore-compat"; 1144 var name = "firebase"; 1145 var DEFAULT_ENTRY_NAME2 = "[DEFAULT]"; 1146 var PLATFORM_LOG_STRING = { 1147 [name$q]: "fire-core", 1148 [name$p]: "fire-core-compat", 1149 [name$n]: "fire-analytics", 1150 [name$o]: "fire-analytics-compat", 1151 [name$l]: "fire-app-check", 1152 [name$m]: "fire-app-check-compat", 1153 [name$k]: "fire-auth", 1154 [name$j]: "fire-auth-compat", 1155 [name$i]: "fire-rtdb", 1156 [name$h]: "fire-data-connect", 1157 [name$g]: "fire-rtdb-compat", 1158 [name$f]: "fire-fn", 1159 [name$e]: "fire-fn-compat", 1160 [name$d]: "fire-iid", 1161 [name$c]: "fire-iid-compat", 1162 [name$b]: "fire-fcm", 1163 [name$a]: "fire-fcm-compat", 1164 [name$9]: "fire-perf", 1165 [name$8]: "fire-perf-compat", 1166 [name$7]: "fire-rc", 1167 [name$6]: "fire-rc-compat", 1168 [name$5]: "fire-gcs", 1169 [name$4]: "fire-gcs-compat", 1170 [name$3]: "fire-fst", 1171 [name$1]: "fire-fst-compat", 1172 [name$2]: "fire-vertex", 1173 "fire-js": "fire-js", 1174 // Platform identifier for JS SDK. 1175 [name]: "fire-js-all" 1176 }; 1177 var _apps = /* @__PURE__ */ new Map(); 1178 var _serverApps = /* @__PURE__ */ new Map(); 1179 var _components = /* @__PURE__ */ new Map(); 1180 function _addComponent(app2, component) { 1181 try { 1182 app2.container.addComponent(component); 1183 } catch (e) { 1184 logger.debug(`Component ${component.name} failed to register with FirebaseApp ${app2.name}`, e); 1185 } 1186 } 1187 function _registerComponent(component) { 1188 const componentName = component.name; 1189 if (_components.has(componentName)) { 1190 logger.debug(`There were multiple attempts to register component ${componentName}.`); 1191 return false; 1192 } 1193 _components.set(componentName, component); 1194 for (const app2 of _apps.values()) { 1195 _addComponent(app2, component); 1196 } 1197 for (const serverApp of _serverApps.values()) { 1198 _addComponent(serverApp, component); 1199 } 1200 return true; 1201 } 1202 function _getProvider(app2, name4) { 1203 const heartbeatController = app2.container.getProvider("heartbeat").getImmediate({ optional: true }); 1204 if (heartbeatController) { 1205 void heartbeatController.triggerHeartbeat(); 1206 } 1207 return app2.container.getProvider(name4); 1208 } 1209 var ERRORS = { 1210 [ 1211 "no-app" 1212 /* AppError.NO_APP */ 1213 ]: "No Firebase App '{$appName}' has been created - call initializeApp() first", 1214 [ 1215 "bad-app-name" 1216 /* AppError.BAD_APP_NAME */ 1217 ]: "Illegal App name: '{$appName}'", 1218 [ 1219 "duplicate-app" 1220 /* AppError.DUPLICATE_APP */ 1221 ]: "Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.", 1222 [ 1223 "app-deleted" 1224 /* AppError.APP_DELETED */ 1225 ]: "Firebase App named '{$appName}' already deleted", 1226 [ 1227 "server-app-deleted" 1228 /* AppError.SERVER_APP_DELETED */ 1229 ]: "Firebase Server App has been deleted", 1230 [ 1231 "no-options" 1232 /* AppError.NO_OPTIONS */ 1233 ]: "Need to provide options, when not being deployed to hosting via source.", 1234 [ 1235 "invalid-app-argument" 1236 /* AppError.INVALID_APP_ARGUMENT */ 1237 ]: "firebase.{$appName}() takes either no argument or a Firebase App instance.", 1238 [ 1239 "invalid-log-argument" 1240 /* AppError.INVALID_LOG_ARGUMENT */ 1241 ]: "First argument to `onLog` must be null or a function.", 1242 [ 1243 "idb-open" 1244 /* AppError.IDB_OPEN */ 1245 ]: "Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.", 1246 [ 1247 "idb-get" 1248 /* AppError.IDB_GET */ 1249 ]: "Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.", 1250 [ 1251 "idb-set" 1252 /* AppError.IDB_WRITE */ 1253 ]: "Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.", 1254 [ 1255 "idb-delete" 1256 /* AppError.IDB_DELETE */ 1257 ]: "Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.", 1258 [ 1259 "finalization-registry-not-supported" 1260 /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */ 1261 ]: "FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.", 1262 [ 1263 "invalid-server-app-environment" 1264 /* AppError.INVALID_SERVER_APP_ENVIRONMENT */ 1265 ]: "FirebaseServerApp is not for use in browser environments." 1266 }; 1267 var ERROR_FACTORY = new ErrorFactory("app", "Firebase", ERRORS); 1268 var FirebaseAppImpl = class { 1269 constructor(options, config, container) { 1270 this._isDeleted = false; 1271 this._options = __spreadValues({}, options); 1272 this._config = __spreadValues({}, config); 1273 this._name = config.name; 1274 this._automaticDataCollectionEnabled = config.automaticDataCollectionEnabled; 1275 this._container = container; 1276 this.container.addComponent(new Component( 1277 "app", 1278 () => this, 1279 "PUBLIC" 1280 /* ComponentType.PUBLIC */ 1281 )); 1282 } 1283 get automaticDataCollectionEnabled() { 1284 this.checkDestroyed(); 1285 return this._automaticDataCollectionEnabled; 1286 } 1287 set automaticDataCollectionEnabled(val) { 1288 this.checkDestroyed(); 1289 this._automaticDataCollectionEnabled = val; 1290 } 1291 get name() { 1292 this.checkDestroyed(); 1293 return this._name; 1294 } 1295 get options() { 1296 this.checkDestroyed(); 1297 return this._options; 1298 } 1299 get config() { 1300 this.checkDestroyed(); 1301 return this._config; 1302 } 1303 get container() { 1304 return this._container; 1305 } 1306 get isDeleted() { 1307 return this._isDeleted; 1308 } 1309 set isDeleted(val) { 1310 this._isDeleted = val; 1311 } 1312 /** 1313 * This function will throw an Error if the App has already been deleted - 1314 * use before performing API actions on the App. 1315 */ 1316 checkDestroyed() { 1317 if (this.isDeleted) { 1318 throw ERROR_FACTORY.create("app-deleted", { appName: this._name }); 1319 } 1320 } 1321 }; 1322 function initializeApp(_options, rawConfig = {}) { 1323 let options = _options; 1324 if (typeof rawConfig !== "object") { 1325 const name5 = rawConfig; 1326 rawConfig = { name: name5 }; 1327 } 1328 const config = __spreadValues({ 1329 name: DEFAULT_ENTRY_NAME2, 1330 automaticDataCollectionEnabled: true 1331 }, rawConfig); 1332 const name4 = config.name; 1333 if (typeof name4 !== "string" || !name4) { 1334 throw ERROR_FACTORY.create("bad-app-name", { 1335 appName: String(name4) 1336 }); 1337 } 1338 options || (options = getDefaultAppConfig()); 1339 if (!options) { 1340 throw ERROR_FACTORY.create( 1341 "no-options" 1342 /* AppError.NO_OPTIONS */ 1343 ); 1344 } 1345 const existingApp = _apps.get(name4); 1346 if (existingApp) { 1347 if (!deepEqual(options, existingApp.options)) { 1348 throw ERROR_FACTORY.create("duplicate-app", { 1349 appName: name4, 1350 mismatchedParam: "options", 1351 oldValue: JSON.stringify(existingApp.options), 1352 newValue: JSON.stringify(options) 1353 }); 1354 } else if (!deepEqual(config, existingApp.config)) { 1355 throw ERROR_FACTORY.create("duplicate-app", { 1356 appName: name4, 1357 mismatchedParam: "config", 1358 oldValue: JSON.stringify(existingApp.config), 1359 newValue: JSON.stringify(config) 1360 }); 1361 } else { 1362 return existingApp; 1363 } 1364 } 1365 const container = new ComponentContainer(name4); 1366 for (const component of _components.values()) { 1367 container.addComponent(component); 1368 } 1369 const newApp = new FirebaseAppImpl(options, config, container); 1370 _apps.set(name4, newApp); 1371 return newApp; 1372 } 1373 function getApp(name4 = DEFAULT_ENTRY_NAME2) { 1374 const app2 = _apps.get(name4); 1375 if (!app2 && name4 === DEFAULT_ENTRY_NAME2 && getDefaultAppConfig()) { 1376 return initializeApp(); 1377 } 1378 if (!app2) { 1379 throw ERROR_FACTORY.create("no-app", { appName: name4 }); 1380 } 1381 return app2; 1382 } 1383 function registerVersion(libraryKeyOrName, version4, variant) { 1384 var _a; 1385 let library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) != null ? _a : libraryKeyOrName; 1386 if (variant) { 1387 library += `-${variant}`; 1388 } 1389 const libraryMismatch = library.match(/\s|\//); 1390 const versionMismatch = version4.match(/\s|\//); 1391 if (libraryMismatch || versionMismatch) { 1392 const warning = [ 1393 `Unable to register library "${library}" with version "${version4}":` 1394 ]; 1395 if (libraryMismatch) { 1396 warning.push(`library name "${library}" contains illegal characters (whitespace or "/")`); 1397 } 1398 if (libraryMismatch && versionMismatch) { 1399 warning.push("and"); 1400 } 1401 if (versionMismatch) { 1402 warning.push(`version name "${version4}" contains illegal characters (whitespace or "/")`); 1403 } 1404 logger.warn(warning.join(" ")); 1405 return; 1406 } 1407 _registerComponent(new Component( 1408 `${library}-version`, 1409 () => ({ library, version: version4 }), 1410 "VERSION" 1411 /* ComponentType.VERSION */ 1412 )); 1413 } 1414 var DB_NAME = "firebase-heartbeat-database"; 1415 var DB_VERSION = 1; 1416 var STORE_NAME = "firebase-heartbeat-store"; 1417 var dbPromise = null; 1418 function getDbPromise() { 1419 if (!dbPromise) { 1420 dbPromise = openDB(DB_NAME, DB_VERSION, { 1421 upgrade: (db, oldVersion) => { 1422 switch (oldVersion) { 1423 case 0: 1424 try { 1425 db.createObjectStore(STORE_NAME); 1426 } catch (e) { 1427 console.warn(e); 1428 } 1429 } 1430 } 1431 }).catch((e) => { 1432 throw ERROR_FACTORY.create("idb-open", { 1433 originalErrorMessage: e.message 1434 }); 1435 }); 1436 } 1437 return dbPromise; 1438 } 1439 async function readHeartbeatsFromIndexedDB(app2) { 1440 try { 1441 const db = await getDbPromise(); 1442 const tx = db.transaction(STORE_NAME); 1443 const result = await tx.objectStore(STORE_NAME).get(computeKey(app2)); 1444 await tx.done; 1445 return result; 1446 } catch (e) { 1447 if (e instanceof FirebaseError) { 1448 logger.warn(e.message); 1449 } else { 1450 const idbGetError = ERROR_FACTORY.create("idb-get", { 1451 originalErrorMessage: e == null ? void 0 : e.message 1452 }); 1453 logger.warn(idbGetError.message); 1454 } 1455 } 1456 } 1457 async function writeHeartbeatsToIndexedDB(app2, heartbeatObject) { 1458 try { 1459 const db = await getDbPromise(); 1460 const tx = db.transaction(STORE_NAME, "readwrite"); 1461 const objectStore = tx.objectStore(STORE_NAME); 1462 await objectStore.put(heartbeatObject, computeKey(app2)); 1463 await tx.done; 1464 } catch (e) { 1465 if (e instanceof FirebaseError) { 1466 logger.warn(e.message); 1467 } else { 1468 const idbGetError = ERROR_FACTORY.create("idb-set", { 1469 originalErrorMessage: e == null ? void 0 : e.message 1470 }); 1471 logger.warn(idbGetError.message); 1472 } 1473 } 1474 } 1475 function computeKey(app2) { 1476 return `${app2.name}!${app2.options.appId}`; 1477 } 1478 var MAX_HEADER_BYTES = 1024; 1479 var MAX_NUM_STORED_HEARTBEATS = 30; 1480 var HeartbeatServiceImpl = class { 1481 constructor(container) { 1482 this.container = container; 1483 this._heartbeatsCache = null; 1484 const app2 = this.container.getProvider("app").getImmediate(); 1485 this._storage = new HeartbeatStorageImpl(app2); 1486 this._heartbeatsCachePromise = this._storage.read().then((result) => { 1487 this._heartbeatsCache = result; 1488 return result; 1489 }); 1490 } 1491 /** 1492 * Called to report a heartbeat. The function will generate 1493 * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it 1494 * to IndexedDB. 1495 * Note that we only store one heartbeat per day. So if a heartbeat for today is 1496 * already logged, subsequent calls to this function in the same day will be ignored. 1497 */ 1498 async triggerHeartbeat() { 1499 var _a, _b; 1500 try { 1501 const platformLogger = this.container.getProvider("platform-logger").getImmediate(); 1502 const agent = platformLogger.getPlatformInfoString(); 1503 const date = getUTCDateString(); 1504 if (((_a = this._heartbeatsCache) == null ? void 0 : _a.heartbeats) == null) { 1505 this._heartbeatsCache = await this._heartbeatsCachePromise; 1506 if (((_b = this._heartbeatsCache) == null ? void 0 : _b.heartbeats) == null) { 1507 return; 1508 } 1509 } 1510 if (this._heartbeatsCache.lastSentHeartbeatDate === date || this._heartbeatsCache.heartbeats.some((singleDateHeartbeat) => singleDateHeartbeat.date === date)) { 1511 return; 1512 } else { 1513 this._heartbeatsCache.heartbeats.push({ date, agent }); 1514 if (this._heartbeatsCache.heartbeats.length > MAX_NUM_STORED_HEARTBEATS) { 1515 const earliestHeartbeatIdx = getEarliestHeartbeatIdx(this._heartbeatsCache.heartbeats); 1516 this._heartbeatsCache.heartbeats.splice(earliestHeartbeatIdx, 1); 1517 } 1518 } 1519 return this._storage.overwrite(this._heartbeatsCache); 1520 } catch (e) { 1521 logger.warn(e); 1522 } 1523 } 1524 /** 1525 * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly. 1526 * It also clears all heartbeats from memory as well as in IndexedDB. 1527 * 1528 * NOTE: Consuming product SDKs should not send the header if this method 1529 * returns an empty string. 1530 */ 1531 async getHeartbeatsHeader() { 1532 var _a; 1533 try { 1534 if (this._heartbeatsCache === null) { 1535 await this._heartbeatsCachePromise; 1536 } 1537 if (((_a = this._heartbeatsCache) == null ? void 0 : _a.heartbeats) == null || this._heartbeatsCache.heartbeats.length === 0) { 1538 return ""; 1539 } 1540 const date = getUTCDateString(); 1541 const { heartbeatsToSend, unsentEntries } = extractHeartbeatsForHeader(this._heartbeatsCache.heartbeats); 1542 const headerString = base64urlEncodeWithoutPadding(JSON.stringify({ version: 2, heartbeats: heartbeatsToSend })); 1543 this._heartbeatsCache.lastSentHeartbeatDate = date; 1544 if (unsentEntries.length > 0) { 1545 this._heartbeatsCache.heartbeats = unsentEntries; 1546 await this._storage.overwrite(this._heartbeatsCache); 1547 } else { 1548 this._heartbeatsCache.heartbeats = []; 1549 void this._storage.overwrite(this._heartbeatsCache); 1550 } 1551 return headerString; 1552 } catch (e) { 1553 logger.warn(e); 1554 return ""; 1555 } 1556 } 1557 }; 1558 function getUTCDateString() { 1559 const today = /* @__PURE__ */ new Date(); 1560 return today.toISOString().substring(0, 10); 1561 } 1562 function extractHeartbeatsForHeader(heartbeatsCache, maxSize = MAX_HEADER_BYTES) { 1563 const heartbeatsToSend = []; 1564 let unsentEntries = heartbeatsCache.slice(); 1565 for (const singleDateHeartbeat of heartbeatsCache) { 1566 const heartbeatEntry = heartbeatsToSend.find((hb) => hb.agent === singleDateHeartbeat.agent); 1567 if (!heartbeatEntry) { 1568 heartbeatsToSend.push({ 1569 agent: singleDateHeartbeat.agent, 1570 dates: [singleDateHeartbeat.date] 1571 }); 1572 if (countBytes(heartbeatsToSend) > maxSize) { 1573 heartbeatsToSend.pop(); 1574 break; 1575 } 1576 } else { 1577 heartbeatEntry.dates.push(singleDateHeartbeat.date); 1578 if (countBytes(heartbeatsToSend) > maxSize) { 1579 heartbeatEntry.dates.pop(); 1580 break; 1581 } 1582 } 1583 unsentEntries = unsentEntries.slice(1); 1584 } 1585 return { 1586 heartbeatsToSend, 1587 unsentEntries 1588 }; 1589 } 1590 var HeartbeatStorageImpl = class { 1591 constructor(app2) { 1592 this.app = app2; 1593 this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck(); 1594 } 1595 async runIndexedDBEnvironmentCheck() { 1596 if (!isIndexedDBAvailable()) { 1597 return false; 1598 } else { 1599 return validateIndexedDBOpenable().then(() => true).catch(() => false); 1600 } 1601 } 1602 /** 1603 * Read all heartbeats. 1604 */ 1605 async read() { 1606 const canUseIndexedDB = await this._canUseIndexedDBPromise; 1607 if (!canUseIndexedDB) { 1608 return { heartbeats: [] }; 1609 } else { 1610 const idbHeartbeatObject = await readHeartbeatsFromIndexedDB(this.app); 1611 if (idbHeartbeatObject == null ? void 0 : idbHeartbeatObject.heartbeats) { 1612 return idbHeartbeatObject; 1613 } else { 1614 return { heartbeats: [] }; 1615 } 1616 } 1617 } 1618 // overwrite the storage with the provided heartbeats 1619 async overwrite(heartbeatsObject) { 1620 var _a; 1621 const canUseIndexedDB = await this._canUseIndexedDBPromise; 1622 if (!canUseIndexedDB) { 1623 return; 1624 } else { 1625 const existingHeartbeatsObject = await this.read(); 1626 return writeHeartbeatsToIndexedDB(this.app, { 1627 lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) != null ? _a : existingHeartbeatsObject.lastSentHeartbeatDate, 1628 heartbeats: heartbeatsObject.heartbeats 1629 }); 1630 } 1631 } 1632 // add heartbeats 1633 async add(heartbeatsObject) { 1634 var _a; 1635 const canUseIndexedDB = await this._canUseIndexedDBPromise; 1636 if (!canUseIndexedDB) { 1637 return; 1638 } else { 1639 const existingHeartbeatsObject = await this.read(); 1640 return writeHeartbeatsToIndexedDB(this.app, { 1641 lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) != null ? _a : existingHeartbeatsObject.lastSentHeartbeatDate, 1642 heartbeats: [ 1643 ...existingHeartbeatsObject.heartbeats, 1644 ...heartbeatsObject.heartbeats 1645 ] 1646 }); 1647 } 1648 } 1649 }; 1650 function countBytes(heartbeatsCache) { 1651 return base64urlEncodeWithoutPadding( 1652 // heartbeatsCache wrapper properties 1653 JSON.stringify({ version: 2, heartbeats: heartbeatsCache }) 1654 ).length; 1655 } 1656 function getEarliestHeartbeatIdx(heartbeats) { 1657 if (heartbeats.length === 0) { 1658 return -1; 1659 } 1660 let earliestHeartbeatIdx = 0; 1661 let earliestHeartbeatDate = heartbeats[0].date; 1662 for (let i = 1; i < heartbeats.length; i++) { 1663 if (heartbeats[i].date < earliestHeartbeatDate) { 1664 earliestHeartbeatDate = heartbeats[i].date; 1665 earliestHeartbeatIdx = i; 1666 } 1667 } 1668 return earliestHeartbeatIdx; 1669 } 1670 function registerCoreComponents(variant) { 1671 _registerComponent(new Component( 1672 "platform-logger", 1673 (container) => new PlatformLoggerServiceImpl(container), 1674 "PRIVATE" 1675 /* ComponentType.PRIVATE */ 1676 )); 1677 _registerComponent(new Component( 1678 "heartbeat", 1679 (container) => new HeartbeatServiceImpl(container), 1680 "PRIVATE" 1681 /* ComponentType.PRIVATE */ 1682 )); 1683 registerVersion(name$q, version$1, variant); 1684 registerVersion(name$q, version$1, "esm2020"); 1685 registerVersion("fire-js", ""); 1686 } 1687 registerCoreComponents(""); 1688 1689
vendor: 149 bytes, lines 1689-1694
1689// node_modules/firebase/app/dist/esm/index.esm.js 1690 var name2 = "firebase"; 1691 var version = "12.19.0"; 1692 registerVersion(name2, version, "app"); 1693 1694
vendor: 20,237 bytes, lines 1694-2287
1694// node_modules/@firebase/installations/dist/esm/index.esm.js 1695 var name3 = "@firebase/installations"; 1696 var version2 = "0.6.24"; 1697 var PENDING_TIMEOUT_MS = 1e4; 1698 var PACKAGE_VERSION = `w:${version2}`; 1699 var INTERNAL_AUTH_VERSION = "FIS_v2"; 1700 var INSTALLATIONS_API_URL = "https://firebaseinstallations.googleapis.com/v1"; 1701 var TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1e3; 1702 var SERVICE = "installations"; 1703 var SERVICE_NAME = "Installations"; 1704 var ERROR_DESCRIPTION_MAP = { 1705 [ 1706 "missing-app-config-values" 1707 /* ErrorCode.MISSING_APP_CONFIG_VALUES */ 1708 ]: 'Missing App configuration value: "{$valueName}"', 1709 [ 1710 "not-registered" 1711 /* ErrorCode.NOT_REGISTERED */ 1712 ]: "Firebase Installation is not registered.", 1713 [ 1714 "installation-not-found" 1715 /* ErrorCode.INSTALLATION_NOT_FOUND */ 1716 ]: "Firebase Installation not found.", 1717 [ 1718 "request-failed" 1719 /* ErrorCode.REQUEST_FAILED */ 1720 ]: '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"', 1721 [ 1722 "app-offline" 1723 /* ErrorCode.APP_OFFLINE */ 1724 ]: "Could not process request. Application offline.", 1725 [ 1726 "delete-pending-registration" 1727 /* ErrorCode.DELETE_PENDING_REGISTRATION */ 1728 ]: "Can't delete installation while there is a pending registration request." 1729 }; 1730 var ERROR_FACTORY2 = new ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP); 1731 function isServerError(error) { 1732 return error instanceof FirebaseError && error.code.includes( 1733 "request-failed" 1734 /* ErrorCode.REQUEST_FAILED */ 1735 ); 1736 } 1737 function getInstallationsEndpoint({ projectId }) { 1738 return `${INSTALLATIONS_API_URL}/projects/${projectId}/installations`; 1739 } 1740 function extractAuthTokenInfoFromResponse(response) { 1741 return { 1742 token: response.token, 1743 requestStatus: 2, 1744 expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn), 1745 creationTime: Date.now() 1746 }; 1747 } 1748 async function getErrorFromResponse(requestName, response) { 1749 const responseJson = await response.json(); 1750 const errorData = responseJson.error; 1751 return ERROR_FACTORY2.create("request-failed", { 1752 requestName, 1753 serverCode: errorData.code, 1754 serverMessage: errorData.message, 1755 serverStatus: errorData.status 1756 }); 1757 } 1758 function getHeaders({ apiKey }) { 1759 return new Headers({ 1760 "Content-Type": "application/json", 1761 Accept: "application/json", 1762 "x-goog-api-key": apiKey 1763 }); 1764 } 1765 function getHeadersWithAuth(appConfig, { refreshToken }) { 1766 const headers = getHeaders(appConfig); 1767 headers.append("Authorization", getAuthorizationHeader(refreshToken)); 1768 return headers; 1769 } 1770 async function retryIfServerError(fn) { 1771 const result = await fn(); 1772 if (result.status >= 500 && result.status < 600) { 1773 return fn(); 1774 } 1775 return result; 1776 } 1777 function getExpiresInFromResponseExpiresIn(responseExpiresIn) { 1778 return Number(responseExpiresIn.replace("s", "000")); 1779 } 1780 function getAuthorizationHeader(refreshToken) { 1781 return `${INTERNAL_AUTH_VERSION} ${refreshToken}`; 1782 } 1783 async function createInstallationRequest({ appConfig, heartbeatServiceProvider }, { fid }) { 1784 const endpoint = getInstallationsEndpoint(appConfig); 1785 const headers = getHeaders(appConfig); 1786 const heartbeatService = heartbeatServiceProvider.getImmediate({ 1787 optional: true 1788 }); 1789 if (heartbeatService) { 1790 const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader(); 1791 if (heartbeatsHeader) { 1792 headers.append("x-firebase-client", heartbeatsHeader); 1793 } 1794 } 1795 const body = { 1796 fid, 1797 authVersion: INTERNAL_AUTH_VERSION, 1798 appId: appConfig.appId, 1799 sdkVersion: PACKAGE_VERSION 1800 }; 1801 const request = { 1802 method: "POST", 1803 headers, 1804 body: JSON.stringify(body) 1805 }; 1806 const response = await retryIfServerError(() => fetch(endpoint, request)); 1807 if (response.ok) { 1808 const responseValue = await response.json(); 1809 const registeredInstallationEntry = { 1810 fid: responseValue.fid || fid, 1811 registrationStatus: 2, 1812 refreshToken: responseValue.refreshToken, 1813 authToken: extractAuthTokenInfoFromResponse(responseValue.authToken) 1814 }; 1815 return registeredInstallationEntry; 1816 } else { 1817 throw await getErrorFromResponse("Create Installation", response); 1818 } 1819 } 1820 function sleep(ms) { 1821 return new Promise((resolve) => { 1822 setTimeout(resolve, ms); 1823 }); 1824 } 1825 function bufferToBase64UrlSafe(array) { 1826 const b64 = btoa(String.fromCharCode(...array)); 1827 return b64.replace(/\+/g, "-").replace(/\//g, "_"); 1828 } 1829 var VALID_FID_PATTERN = /^[cdef][\w-]{21}$/; 1830 var INVALID_FID = ""; 1831 function generateFid() { 1832 try { 1833 const fidByteArray = new Uint8Array(17); 1834 const crypto2 = self.crypto || self.msCrypto; 1835 crypto2.getRandomValues(fidByteArray); 1836 fidByteArray[0] = 112 + fidByteArray[0] % 16; 1837 const fid = encode(fidByteArray); 1838 return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID; 1839 } catch (e) { 1840 return INVALID_FID; 1841 } 1842 } 1843 function encode(fidByteArray) { 1844 const b64String = bufferToBase64UrlSafe(fidByteArray); 1845 return b64String.substr(0, 22); 1846 } 1847 function getKey(appConfig) { 1848 return `${appConfig.appName}!${appConfig.appId}`; 1849 } 1850 var fidChangeCallbacks = /* @__PURE__ */ new Map(); 1851 function fidChanged(appConfig, fid) { 1852 const key = getKey(appConfig); 1853 callFidChangeCallbacks(key, fid); 1854 broadcastFidChange(key, fid); 1855 } 1856 function callFidChangeCallbacks(key, fid) { 1857 const callbacks = fidChangeCallbacks.get(key); 1858 if (!callbacks) { 1859 return; 1860 } 1861 for (const callback of callbacks) { 1862 callback(fid); 1863 } 1864 } 1865 function broadcastFidChange(key, fid) { 1866 const channel = getBroadcastChannel(); 1867 if (channel) { 1868 channel.postMessage({ key, fid }); 1869 } 1870 closeBroadcastChannel(); 1871 } 1872 var broadcastChannel = null; 1873 function getBroadcastChannel() { 1874 if (!broadcastChannel && "BroadcastChannel" in self) { 1875 broadcastChannel = new BroadcastChannel("[Firebase] FID Change"); 1876 broadcastChannel.onmessage = (e) => { 1877 callFidChangeCallbacks(e.data.key, e.data.fid); 1878 }; 1879 } 1880 return broadcastChannel; 1881 } 1882 function closeBroadcastChannel() { 1883 if (fidChangeCallbacks.size === 0 && broadcastChannel) { 1884 broadcastChannel.close(); 1885 broadcastChannel = null; 1886 } 1887 } 1888 var DATABASE_NAME = "firebase-installations-database"; 1889 var DATABASE_VERSION = 1; 1890 var OBJECT_STORE_NAME = "firebase-installations-store"; 1891 var dbPromise2 = null; 1892 function getDbPromise2() { 1893 if (!dbPromise2) { 1894 dbPromise2 = openDB(DATABASE_NAME, DATABASE_VERSION, { 1895 upgrade: (db, oldVersion) => { 1896 switch (oldVersion) { 1897 case 0: 1898 db.createObjectStore(OBJECT_STORE_NAME); 1899 } 1900 } 1901 }); 1902 } 1903 return dbPromise2; 1904 } 1905 async function set(appConfig, value) { 1906 const key = getKey(appConfig); 1907 const db = await getDbPromise2(); 1908 const tx = db.transaction(OBJECT_STORE_NAME, "readwrite"); 1909 const objectStore = tx.objectStore(OBJECT_STORE_NAME); 1910 const oldValue = await objectStore.get(key); 1911 await objectStore.put(value, key); 1912 await tx.done; 1913 if (!oldValue || oldValue.fid !== value.fid) { 1914 fidChanged(appConfig, value.fid); 1915 } 1916 return value; 1917 } 1918 async function remove(appConfig) { 1919 const key = getKey(appConfig); 1920 const db = await getDbPromise2(); 1921 const tx = db.transaction(OBJECT_STORE_NAME, "readwrite"); 1922 await tx.objectStore(OBJECT_STORE_NAME).delete(key); 1923 await tx.done; 1924 } 1925 async function update(appConfig, updateFn) { 1926 const key = getKey(appConfig); 1927 const db = await getDbPromise2(); 1928 const tx = db.transaction(OBJECT_STORE_NAME, "readwrite"); 1929 const store = tx.objectStore(OBJECT_STORE_NAME); 1930 const oldValue = await store.get(key); 1931 const newValue = updateFn(oldValue); 1932 if (newValue === void 0) { 1933 await store.delete(key); 1934 } else { 1935 await store.put(newValue, key); 1936 } 1937 await tx.done; 1938 if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) { 1939 fidChanged(appConfig, newValue.fid); 1940 } 1941 return newValue; 1942 } 1943 async function getInstallationEntry(installations) { 1944 let registrationPromise; 1945 const installationEntry = await update(installations.appConfig, (oldEntry) => { 1946 const installationEntry2 = updateOrCreateInstallationEntry(oldEntry); 1947 const entryWithPromise = triggerRegistrationIfNecessary(installations, installationEntry2); 1948 registrationPromise = entryWithPromise.registrationPromise; 1949 return entryWithPromise.installationEntry; 1950 }); 1951 if (installationEntry.fid === INVALID_FID) { 1952 return { installationEntry: await registrationPromise }; 1953 } 1954 return { 1955 installationEntry, 1956 registrationPromise 1957 }; 1958 } 1959 function updateOrCreateInstallationEntry(oldEntry) { 1960 const entry = oldEntry || { 1961 fid: generateFid(), 1962 registrationStatus: 0 1963 /* RequestStatus.NOT_STARTED */ 1964 }; 1965 return clearTimedOutRequest(entry); 1966 } 1967 function triggerRegistrationIfNecessary(installations, installationEntry) { 1968 if (installationEntry.registrationStatus === 0) { 1969 if (!navigator.onLine) { 1970 const registrationPromiseWithError = Promise.reject(ERROR_FACTORY2.create( 1971 "app-offline" 1972 /* ErrorCode.APP_OFFLINE */ 1973 )); 1974 return { 1975 installationEntry, 1976 registrationPromise: registrationPromiseWithError 1977 }; 1978 } 1979 const inProgressEntry = { 1980 fid: installationEntry.fid, 1981 registrationStatus: 1, 1982 registrationTime: Date.now() 1983 }; 1984 const registrationPromise = registerInstallation(installations, inProgressEntry); 1985 return { installationEntry: inProgressEntry, registrationPromise }; 1986 } else if (installationEntry.registrationStatus === 1) { 1987 return { 1988 installationEntry, 1989 registrationPromise: waitUntilFidRegistration(installations) 1990 }; 1991 } else { 1992 return { installationEntry }; 1993 } 1994 } 1995 async function registerInstallation(installations, installationEntry) { 1996 try { 1997 const registeredInstallationEntry = await createInstallationRequest(installations, installationEntry); 1998 return set(installations.appConfig, registeredInstallationEntry); 1999 } catch (e) { 2000 if (isServerError(e) && e.customData.serverCode === 409) { 2001 await remove(installations.appConfig); 2002 } else { 2003 await set(installations.appConfig, { 2004 fid: installationEntry.fid, 2005 registrationStatus: 0 2006 /* RequestStatus.NOT_STARTED */ 2007 }); 2008 } 2009 throw e; 2010 } 2011 } 2012 async function waitUntilFidRegistration(installations) { 2013 let entry = await updateInstallationRequest(installations.appConfig); 2014 while (entry.registrationStatus === 1) { 2015 await sleep(100); 2016 entry = await updateInstallationRequest(installations.appConfig); 2017 } 2018 if (entry.registrationStatus === 0) { 2019 const { installationEntry, registrationPromise } = await getInstallationEntry(installations); 2020 if (registrationPromise) { 2021 return registrationPromise; 2022 } else { 2023 return installationEntry; 2024 } 2025 } 2026 return entry; 2027 } 2028 function updateInstallationRequest(appConfig) { 2029 return update(appConfig, (oldEntry) => { 2030 if (!oldEntry) { 2031 throw ERROR_FACTORY2.create( 2032 "installation-not-found" 2033 /* ErrorCode.INSTALLATION_NOT_FOUND */ 2034 ); 2035 } 2036 return clearTimedOutRequest(oldEntry); 2037 }); 2038 } 2039 function clearTimedOutRequest(entry) { 2040 if (hasInstallationRequestTimedOut(entry)) { 2041 return { 2042 fid: entry.fid, 2043 registrationStatus: 0 2044 /* RequestStatus.NOT_STARTED */ 2045 }; 2046 } 2047 return entry; 2048 } 2049 function hasInstallationRequestTimedOut(installationEntry) { 2050 return installationEntry.registrationStatus === 1 && installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now(); 2051 } 2052 async function generateAuthTokenRequest({ appConfig, heartbeatServiceProvider }, installationEntry) { 2053 const endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry); 2054 const headers = getHeadersWithAuth(appConfig, installationEntry); 2055 const heartbeatService = heartbeatServiceProvider.getImmediate({ 2056 optional: true 2057 }); 2058 if (heartbeatService) { 2059 const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader(); 2060 if (heartbeatsHeader) { 2061 headers.append("x-firebase-client", heartbeatsHeader); 2062 } 2063 } 2064 const body = { 2065 installation: { 2066 sdkVersion: PACKAGE_VERSION, 2067 appId: appConfig.appId 2068 } 2069 }; 2070 const request = { 2071 method: "POST", 2072 headers, 2073 body: JSON.stringify(body) 2074 }; 2075 const response = await retryIfServerError(() => fetch(endpoint, request)); 2076 if (response.ok) { 2077 const responseValue = await response.json(); 2078 const completedAuthToken = extractAuthTokenInfoFromResponse(responseValue); 2079 return completedAuthToken; 2080 } else { 2081 throw await getErrorFromResponse("Generate Auth Token", response); 2082 } 2083 } 2084 function getGenerateAuthTokenEndpoint(appConfig, { fid }) { 2085 return `${getInstallationsEndpoint(appConfig)}/${fid}/authTokens:generate`; 2086 } 2087 async function refreshAuthToken(installations, forceRefresh = false) { 2088 let tokenPromise; 2089 const entry = await update(installations.appConfig, (oldEntry) => { 2090 if (!isEntryRegistered(oldEntry)) { 2091 throw ERROR_FACTORY2.create( 2092 "not-registered" 2093 /* ErrorCode.NOT_REGISTERED */ 2094 ); 2095 } 2096 const oldAuthToken = oldEntry.authToken; 2097 if (!forceRefresh && isAuthTokenValid(oldAuthToken)) { 2098 return oldEntry; 2099 } else if (oldAuthToken.requestStatus === 1) { 2100 tokenPromise = waitUntilAuthTokenRequest(installations, forceRefresh); 2101 return oldEntry; 2102 } else { 2103 if (!navigator.onLine) { 2104 throw ERROR_FACTORY2.create( 2105 "app-offline" 2106 /* ErrorCode.APP_OFFLINE */ 2107 ); 2108 } 2109 const inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry); 2110 tokenPromise = fetchAuthTokenFromServer(installations, inProgressEntry); 2111 return inProgressEntry; 2112 } 2113 }); 2114 const authToken = tokenPromise ? await tokenPromise : entry.authToken; 2115 return authToken; 2116 } 2117 async function waitUntilAuthTokenRequest(installations, forceRefresh) { 2118 let entry = await updateAuthTokenRequest(installations.appConfig); 2119 while (entry.authToken.requestStatus === 1) { 2120 await sleep(100); 2121 entry = await updateAuthTokenRequest(installations.appConfig); 2122 } 2123 const authToken = entry.authToken; 2124 if (authToken.requestStatus === 0) { 2125 return refreshAuthToken(installations, forceRefresh); 2126 } else { 2127 return authToken; 2128 } 2129 } 2130 function updateAuthTokenRequest(appConfig) { 2131 return update(appConfig, (oldEntry) => { 2132 if (!isEntryRegistered(oldEntry)) { 2133 throw ERROR_FACTORY2.create( 2134 "not-registered" 2135 /* ErrorCode.NOT_REGISTERED */ 2136 ); 2137 } 2138 const oldAuthToken = oldEntry.authToken; 2139 if (hasAuthTokenRequestTimedOut(oldAuthToken)) { 2140 return __spreadProps(__spreadValues({}, oldEntry), { 2141 authToken: { 2142 requestStatus: 0 2143 /* RequestStatus.NOT_STARTED */ 2144 } 2145 }); 2146 } 2147 return oldEntry; 2148 }); 2149 } 2150 async function fetchAuthTokenFromServer(installations, installationEntry) { 2151 try { 2152 const authToken = await generateAuthTokenRequest(installations, installationEntry); 2153 const updatedInstallationEntry = __spreadProps(__spreadValues({}, installationEntry), { 2154 authToken 2155 }); 2156 await set(installations.appConfig, updatedInstallationEntry); 2157 return authToken; 2158 } catch (e) { 2159 if (isServerError(e) && (e.customData.serverCode === 401 || e.customData.serverCode === 404)) { 2160 await remove(installations.appConfig); 2161 } else { 2162 const updatedInstallationEntry = __spreadProps(__spreadValues({}, installationEntry), { 2163 authToken: { 2164 requestStatus: 0 2165 /* RequestStatus.NOT_STARTED */ 2166 } 2167 }); 2168 await set(installations.appConfig, updatedInstallationEntry); 2169 } 2170 throw e; 2171 } 2172 } 2173 function isEntryRegistered(installationEntry) { 2174 return installationEntry !== void 0 && installationEntry.registrationStatus === 2; 2175 } 2176 function isAuthTokenValid(authToken) { 2177 return authToken.requestStatus === 2 && !isAuthTokenExpired(authToken); 2178 } 2179 function isAuthTokenExpired(authToken) { 2180 const now = Date.now(); 2181 return now < authToken.creationTime || authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER; 2182 } 2183 function makeAuthTokenRequestInProgressEntry(oldEntry) { 2184 const inProgressAuthToken = { 2185 requestStatus: 1, 2186 requestTime: Date.now() 2187 }; 2188 return __spreadProps(__spreadValues({}, oldEntry), { 2189 authToken: inProgressAuthToken 2190 }); 2191 } 2192 function hasAuthTokenRequestTimedOut(authToken) { 2193 return authToken.requestStatus === 1 && authToken.requestTime + PENDING_TIMEOUT_MS < Date.now(); 2194 } 2195 async function getId(installations) { 2196 const installationsImpl = installations; 2197 const { installationEntry, registrationPromise } = await getInstallationEntry(installationsImpl); 2198 if (registrationPromise) { 2199 registrationPromise.catch(console.error); 2200 } else { 2201 refreshAuthToken(installationsImpl).catch(console.error); 2202 } 2203 return installationEntry.fid; 2204 } 2205 async function getToken(installations, forceRefresh = false) { 2206 const installationsImpl = installations; 2207 await completeInstallationRegistration(installationsImpl); 2208 const authToken = await refreshAuthToken(installationsImpl, forceRefresh); 2209 return authToken.token; 2210 } 2211 async function completeInstallationRegistration(installations) { 2212 const { registrationPromise } = await getInstallationEntry(installations); 2213 if (registrationPromise) { 2214 await registrationPromise; 2215 } 2216 } 2217 function extractAppConfig(app2) { 2218 if (!app2 || !app2.options) { 2219 throw getMissingValueError("App Configuration"); 2220 } 2221 if (!app2.name) { 2222 throw getMissingValueError("App Name"); 2223 } 2224 const configKeys = [ 2225 "projectId", 2226 "apiKey", 2227 "appId" 2228 ]; 2229 for (const keyName of configKeys) { 2230 if (!app2.options[keyName]) { 2231 throw getMissingValueError(keyName); 2232 } 2233 } 2234 return { 2235 appName: app2.name, 2236 projectId: app2.options.projectId, 2237 apiKey: app2.options.apiKey, 2238 appId: app2.options.appId 2239 }; 2240 } 2241 function getMissingValueError(valueName) { 2242 return ERROR_FACTORY2.create("missing-app-config-values", { 2243 valueName 2244 }); 2245 } 2246 var INSTALLATIONS_NAME = "installations"; 2247 var INSTALLATIONS_NAME_INTERNAL = "installations-internal"; 2248 var publicFactory = (container) => { 2249 const app2 = container.getProvider("app").getImmediate(); 2250 const appConfig = extractAppConfig(app2); 2251 const heartbeatServiceProvider = _getProvider(app2, "heartbeat"); 2252 const installationsImpl = { 2253 app: app2, 2254 appConfig, 2255 heartbeatServiceProvider, 2256 _delete: () => Promise.resolve() 2257 }; 2258 return installationsImpl; 2259 }; 2260 var internalFactory = (container) => { 2261 const app2 = container.getProvider("app").getImmediate(); 2262 const installations = _getProvider(app2, INSTALLATIONS_NAME).getImmediate(); 2263 const installationsInternal = { 2264 getId: () => getId(installations), 2265 getToken: (forceRefresh) => getToken(installations, forceRefresh) 2266 }; 2267 return installationsInternal; 2268 }; 2269 function registerInstallations() { 2270 _registerComponent(new Component( 2271 INSTALLATIONS_NAME, 2272 publicFactory, 2273 "PUBLIC" 2274 /* ComponentType.PUBLIC */ 2275 )); 2276 _registerComponent(new Component( 2277 INSTALLATIONS_NAME_INTERNAL, 2278 internalFactory, 2279 "PRIVATE" 2280 /* ComponentType.PRIVATE */ 2281 )); 2282 } 2283 registerInstallations(); 2284 registerVersion(name3, version2); 2285 registerVersion(name3, version2, "esm2020"); 2286 2287
vendor: 47,236 bytes, lines 2287-3564
2287// node_modules/@firebase/messaging/dist/esm/index.sw.esm.js 2288 var DEFAULT_VAPID_KEY = "BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4"; 2289 var ENDPOINT = "https://fcmregistrations.googleapis.com/v1"; 2290 var FCM_MSG = "FCM_MSG"; 2291 var CONSOLE_CAMPAIGN_ID = "google.c.a.c_id"; 2292 var MAX_NUMBER_OF_EVENTS_PER_LOG_REQUEST = 1e3; 2293 var MAX_RETRIES = 3; 2294 var LOG_INTERVAL_IN_MS = 864e5; 2295 var DEFAULT_BACKOFF_TIME_MS = 5e3; 2296 var FCM_LOG_SOURCE = 1249; 2297 var SDK_PLATFORM_WEB = 3; 2298 var EVENT_MESSAGE_DELIVERED = 1; 2299 var MessageType$1; 2300 (function(MessageType2) { 2301 MessageType2[MessageType2["DATA_MESSAGE"] = 1] = "DATA_MESSAGE"; 2302 MessageType2[MessageType2["DISPLAY_NOTIFICATION"] = 3] = "DISPLAY_NOTIFICATION"; 2303 })(MessageType$1 || (MessageType$1 = {})); 2304 var MessageType; 2305 (function(MessageType2) { 2306 MessageType2["PUSH_RECEIVED"] = "push-received"; 2307 MessageType2["NOTIFICATION_CLICKED"] = "notification-clicked"; 2308 MessageType2["FID_REGISTERED"] = "fid-registered"; 2309 })(MessageType || (MessageType = {})); 2310 function arrayToBase64(array) { 2311 const uint8Array = new Uint8Array(array); 2312 const base64String = btoa(String.fromCharCode(...uint8Array)); 2313 return base64String.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_"); 2314 } 2315 function base64ToArray(base64String) { 2316 const padding = "=".repeat((4 - base64String.length % 4) % 4); 2317 const base642 = (base64String + padding).replace(/\-/g, "+").replace(/_/g, "/"); 2318 const rawData = atob(base642); 2319 const outputArray = new Uint8Array(rawData.length); 2320 for (let i = 0; i < rawData.length; ++i) { 2321 outputArray[i] = rawData.charCodeAt(i); 2322 } 2323 return outputArray; 2324 } 2325 var OLD_DB_NAME = "fcm_token_details_db"; 2326 var OLD_DB_VERSION = 5; 2327 var OLD_OBJECT_STORE_NAME = "fcm_token_object_Store"; 2328 async function migrateOldDatabase(senderId) { 2329 if ("databases" in indexedDB) { 2330 const databases = await indexedDB.databases(); 2331 const dbNames = databases.map((db2) => db2.name); 2332 if (!dbNames.includes(OLD_DB_NAME)) { 2333 return null; 2334 } 2335 } 2336 let tokenDetails = null; 2337 const db = await openDB(OLD_DB_NAME, OLD_DB_VERSION, { 2338 upgrade: async (db2, oldVersion, newVersion, upgradeTransaction) => { 2339 var _a; 2340 if (oldVersion < 2) { 2341 return; 2342 } 2343 if (!db2.objectStoreNames.contains(OLD_OBJECT_STORE_NAME)) { 2344 return; 2345 } 2346 const objectStore = upgradeTransaction.objectStore(OLD_OBJECT_STORE_NAME); 2347 const value = await objectStore.index("fcmSenderId").get(senderId); 2348 await objectStore.clear(); 2349 if (!value) { 2350 return; 2351 } 2352 if (oldVersion === 2) { 2353 const oldDetails = value; 2354 if (!oldDetails.auth || !oldDetails.p256dh || !oldDetails.endpoint) { 2355 return; 2356 } 2357 tokenDetails = { 2358 token: oldDetails.fcmToken, 2359 createTime: (_a = oldDetails.createTime) != null ? _a : Date.now(), 2360 subscriptionOptions: { 2361 auth: oldDetails.auth, 2362 p256dh: oldDetails.p256dh, 2363 endpoint: oldDetails.endpoint, 2364 swScope: oldDetails.swScope, 2365 vapidKey: typeof oldDetails.vapidKey === "string" ? oldDetails.vapidKey : arrayToBase64(oldDetails.vapidKey) 2366 } 2367 }; 2368 } else if (oldVersion === 3) { 2369 const oldDetails = value; 2370 tokenDetails = { 2371 token: oldDetails.fcmToken, 2372 createTime: oldDetails.createTime, 2373 subscriptionOptions: { 2374 auth: arrayToBase64(oldDetails.auth), 2375 p256dh: arrayToBase64(oldDetails.p256dh), 2376 endpoint: oldDetails.endpoint, 2377 swScope: oldDetails.swScope, 2378 vapidKey: arrayToBase64(oldDetails.vapidKey) 2379 } 2380 }; 2381 } else if (oldVersion === 4) { 2382 const oldDetails = value; 2383 tokenDetails = { 2384 token: oldDetails.fcmToken, 2385 createTime: oldDetails.createTime, 2386 subscriptionOptions: { 2387 auth: arrayToBase64(oldDetails.auth), 2388 p256dh: arrayToBase64(oldDetails.p256dh), 2389 endpoint: oldDetails.endpoint, 2390 swScope: oldDetails.swScope, 2391 vapidKey: arrayToBase64(oldDetails.vapidKey) 2392 } 2393 }; 2394 } 2395 } 2396 }); 2397 db.close(); 2398 await deleteDB(OLD_DB_NAME); 2399 await deleteDB("fcm_vapid_details_db"); 2400 await deleteDB("undefined"); 2401 return checkTokenDetails(tokenDetails) ? tokenDetails : null; 2402 } 2403 function checkTokenDetails(tokenDetails) { 2404 if (!tokenDetails || !tokenDetails.subscriptionOptions) { 2405 return false; 2406 } 2407 const { subscriptionOptions } = tokenDetails; 2408 return typeof tokenDetails.createTime === "number" && tokenDetails.createTime > 0 && typeof tokenDetails.token === "string" && tokenDetails.token.length > 0 && typeof subscriptionOptions.auth === "string" && subscriptionOptions.auth.length > 0 && typeof subscriptionOptions.p256dh === "string" && subscriptionOptions.p256dh.length > 0 && typeof subscriptionOptions.endpoint === "string" && subscriptionOptions.endpoint.length > 0 && typeof subscriptionOptions.swScope === "string" && subscriptionOptions.swScope.length > 0 && typeof subscriptionOptions.vapidKey === "string" && subscriptionOptions.vapidKey.length > 0; 2409 } 2410 var ERROR_MAP = { 2411 [ 2412 "missing-app-config-values" 2413 /* ErrorCode.MISSING_APP_CONFIG_VALUES */ 2414 ]: 'Missing App configuration value: "{$valueName}"', 2415 [ 2416 "only-available-in-window" 2417 /* ErrorCode.AVAILABLE_IN_WINDOW */ 2418 ]: "This method is available in a Window context.", 2419 [ 2420 "only-available-in-sw" 2421 /* ErrorCode.AVAILABLE_IN_SW */ 2422 ]: "This method is available in a service worker context.", 2423 [ 2424 "permission-default" 2425 /* ErrorCode.PERMISSION_DEFAULT */ 2426 ]: "The notification permission was not granted and dismissed instead.", 2427 [ 2428 "permission-blocked" 2429 /* ErrorCode.PERMISSION_BLOCKED */ 2430 ]: "The notification permission was not granted and blocked instead.", 2431 [ 2432 "unsupported-browser" 2433 /* ErrorCode.UNSUPPORTED_BROWSER */ 2434 ]: "This browser doesn't support the API's required to use the Firebase SDK.", 2435 [ 2436 "indexed-db-unsupported" 2437 /* ErrorCode.INDEXED_DB_UNSUPPORTED */ 2438 ]: "This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)", 2439 [ 2440 "failed-service-worker-registration" 2441 /* ErrorCode.FAILED_DEFAULT_REGISTRATION */ 2442 ]: "We are unable to register the default service worker. {$browserErrorMessage}", 2443 [ 2444 "token-subscribe-failed" 2445 /* ErrorCode.TOKEN_SUBSCRIBE_FAILED */ 2446 ]: "A problem occurred while subscribing the user to FCM: {$errorInfo}", 2447 [ 2448 "token-subscribe-no-token" 2449 /* ErrorCode.TOKEN_SUBSCRIBE_NO_TOKEN */ 2450 ]: "FCM returned no token when subscribing the user to push.", 2451 [ 2452 "fid-registration-failed" 2453 /* ErrorCode.FID_REGISTRATION_FAILED */ 2454 ]: "A problem occurred while creating an FCM registration via FID: {$errorInfo}", 2455 [ 2456 "fid-unregister-failed" 2457 /* ErrorCode.FID_UNREGISTER_FAILED */ 2458 ]: "A problem occurred while unregistering the FCM registration via FID: {$errorInfo}", 2459 [ 2460 "fid-registration-idb-schema-unavailable" 2461 /* ErrorCode.FID_REGISTRATION_IDB_SCHEMA_UNAVAILABLE */ 2462 ]: "Unable to read or persist FID registration metadata because the messaging IndexedDB schema is unavailable (for example, the database could not be upgraded to the latest version).", 2463 [ 2464 "token-unsubscribe-failed" 2465 /* ErrorCode.TOKEN_UNSUBSCRIBE_FAILED */ 2466 ]: "A problem occurred while unsubscribing the user from FCM: {$errorInfo}", 2467 [ 2468 "token-update-failed" 2469 /* ErrorCode.TOKEN_UPDATE_FAILED */ 2470 ]: "A problem occurred while updating the user from FCM: {$errorInfo}", 2471 [ 2472 "token-update-no-token" 2473 /* ErrorCode.TOKEN_UPDATE_NO_TOKEN */ 2474 ]: "FCM returned no token when updating the user to push.", 2475 [ 2476 "use-sw-after-get-token" 2477 /* ErrorCode.USE_SW_AFTER_GET_TOKEN */ 2478 ]: "The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.", 2479 [ 2480 "invalid-sw-registration" 2481 /* ErrorCode.INVALID_SW_REGISTRATION */ 2482 ]: "The input to useServiceWorker() must be a ServiceWorkerRegistration.", 2483 [ 2484 "invalid-bg-handler" 2485 /* ErrorCode.INVALID_BG_HANDLER */ 2486 ]: "The input to setBackgroundMessageHandler() must be a function.", 2487 [ 2488 "invalid-vapid-key" 2489 /* ErrorCode.INVALID_VAPID_KEY */ 2490 ]: "The public VAPID key must be a string.", 2491 [ 2492 "use-vapid-key-after-get-token" 2493 /* ErrorCode.USE_VAPID_KEY_AFTER_GET_TOKEN */ 2494 ]: "The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used.", 2495 [ 2496 "invalid-on-registered-handler" 2497 /* ErrorCode.INVALID_ON_REGISTERED_HANDLER */ 2498 ]: "No onRegistered callback handler was provided or registered. Implement onRegistered() before register()." 2499 }; 2500 var ERROR_FACTORY3 = new ErrorFactory("messaging", "Messaging", ERROR_MAP); 2501 var DATABASE_NAME2 = "firebase-messaging-database"; 2502 var DATABASE_VERSION2 = 2; 2503 var TOKEN_OBJECT_STORE_NAME = "firebase-messaging-store"; 2504 var FID_REGISTRATION_OBJECT_STORE_NAME = "firebase-messaging-fid-registration-store"; 2505 var defaultIdb = { openDB, deleteDB }; 2506 var idbImpl = defaultIdb; 2507 var dbPromise3 = null; 2508 function migrateMessagingDb(upgradeDb, oldVersion, targetSchemaVersion) { 2509 switch (oldVersion) { 2510 case 0: 2511 upgradeDb.createObjectStore(TOKEN_OBJECT_STORE_NAME); 2512 if (targetSchemaVersion === 1) { 2513 break; 2514 } 2515 case 1: 2516 if (targetSchemaVersion === 2) { 2517 upgradeDb.createObjectStore(FID_REGISTRATION_OBJECT_STORE_NAME); 2518 } 2519 } 2520 } 2521 function createOpenDbOptions(targetSchemaVersion) { 2522 return { 2523 upgrade: (upgradeDb, oldVersion) => { 2524 migrateMessagingDb(upgradeDb, oldVersion, targetSchemaVersion); 2525 }, 2526 blocked: () => { 2527 }, 2528 blocking: (_currentVersion, _blockedVersion, event) => { 2529 var _a; 2530 dbPromise3 = null; 2531 (_a = event.target) == null ? void 0 : _a.close(); 2532 }, 2533 terminated: () => { 2534 dbPromise3 = null; 2535 } 2536 }; 2537 } 2538 function getDbPromise3() { 2539 if (!dbPromise3) { 2540 const openLatest = idbImpl.openDB(DATABASE_NAME2, DATABASE_VERSION2, createOpenDbOptions(2)); 2541 dbPromise3 = openLatest.catch(() => idbImpl.openDB(DATABASE_NAME2, DATABASE_VERSION2 - 1, createOpenDbOptions(1))); 2542 } 2543 return dbPromise3; 2544 } 2545 function hasObjectStore(db, storeName) { 2546 return db.objectStoreNames.contains(storeName); 2547 } 2548 function assertFidRegistrationObjectStore(db) { 2549 if (!hasObjectStore(db, FID_REGISTRATION_OBJECT_STORE_NAME)) { 2550 throw ERROR_FACTORY3.create( 2551 "fid-registration-idb-schema-unavailable" 2552 /* ErrorCode.FID_REGISTRATION_IDB_SCHEMA_UNAVAILABLE */ 2553 ); 2554 } 2555 } 2556 async function dbGet(firebaseDependencies) { 2557 const key = getKey2(firebaseDependencies); 2558 const db = await getDbPromise3(); 2559 const tokenDetails = await db.transaction(TOKEN_OBJECT_STORE_NAME).objectStore(TOKEN_OBJECT_STORE_NAME).get(key); 2560 if (tokenDetails) { 2561 return tokenDetails; 2562 } else { 2563 const oldTokenDetails = await migrateOldDatabase(firebaseDependencies.appConfig.senderId); 2564 if (oldTokenDetails) { 2565 await dbSet(firebaseDependencies, oldTokenDetails); 2566 return oldTokenDetails; 2567 } 2568 } 2569 } 2570 async function dbSet(firebaseDependencies, tokenDetails) { 2571 const key = getKey2(firebaseDependencies); 2572 const db = await getDbPromise3(); 2573 const stores = [TOKEN_OBJECT_STORE_NAME]; 2574 const hasFidStore = hasObjectStore(db, FID_REGISTRATION_OBJECT_STORE_NAME); 2575 if (hasFidStore) { 2576 stores.push(FID_REGISTRATION_OBJECT_STORE_NAME); 2577 } 2578 const tx = db.transaction(stores, "readwrite"); 2579 await tx.objectStore(TOKEN_OBJECT_STORE_NAME).put(tokenDetails, key); 2580 if (hasFidStore) { 2581 await tx.objectStore(FID_REGISTRATION_OBJECT_STORE_NAME).delete(key); 2582 } 2583 await tx.done; 2584 return tokenDetails; 2585 } 2586 async function dbRemove(firebaseDependencies) { 2587 const key = getKey2(firebaseDependencies); 2588 const db = await getDbPromise3(); 2589 const tx = db.transaction(TOKEN_OBJECT_STORE_NAME, "readwrite"); 2590 await tx.objectStore(TOKEN_OBJECT_STORE_NAME).delete(key); 2591 await tx.done; 2592 } 2593 async function dbGetFidRegistration(firebaseDependencies) { 2594 const key = getKey2(firebaseDependencies); 2595 const db = await getDbPromise3(); 2596 assertFidRegistrationObjectStore(db); 2597 return await db.transaction(FID_REGISTRATION_OBJECT_STORE_NAME).objectStore(FID_REGISTRATION_OBJECT_STORE_NAME).get(key); 2598 } 2599 async function dbSetFidRegistration(firebaseDependencies, details) { 2600 const key = getKey2(firebaseDependencies); 2601 const db = await getDbPromise3(); 2602 assertFidRegistrationObjectStore(db); 2603 const tx = db.transaction([TOKEN_OBJECT_STORE_NAME, FID_REGISTRATION_OBJECT_STORE_NAME], "readwrite"); 2604 await tx.objectStore(FID_REGISTRATION_OBJECT_STORE_NAME).put(details, key); 2605 await tx.objectStore(TOKEN_OBJECT_STORE_NAME).delete(key); 2606 await tx.done; 2607 return details; 2608 } 2609 async function dbRemoveFidRegistration(firebaseDependencies) { 2610 const key = getKey2(firebaseDependencies); 2611 const db = await getDbPromise3(); 2612 assertFidRegistrationObjectStore(db); 2613 const tx = db.transaction(FID_REGISTRATION_OBJECT_STORE_NAME, "readwrite"); 2614 await tx.objectStore(FID_REGISTRATION_OBJECT_STORE_NAME).delete(key); 2615 await tx.done; 2616 } 2617 function getKey2({ appConfig }) { 2618 return appConfig.appId; 2619 } 2620 var version3 = "0.13.3"; 2621 var FID_REGISTRATION_FETCH_MAX_ATTEMPTS = 3; 2622 var FID_REGISTRATION_FETCH_BASE_BACKOFF_MS = 1e3; 2623 async function requestGetToken(firebaseDependencies, subscriptionOptions) { 2624 const headers = await getHeaders2(firebaseDependencies); 2625 const body = getBody( 2626 subscriptionOptions, 2627 firebaseDependencies.appConfig.appName, 2628 /* includeSdkVersion= */ 2629 false 2630 ); 2631 const subscribeOptions = { 2632 method: "POST", 2633 headers, 2634 body: JSON.stringify(body) 2635 }; 2636 let responseData; 2637 try { 2638 const response = await fetch(getEndpoint(firebaseDependencies.appConfig), subscribeOptions); 2639 responseData = await response.json(); 2640 } catch (err) { 2641 throw ERROR_FACTORY3.create("token-subscribe-failed", { 2642 errorInfo: err == null ? void 0 : err.toString() 2643 }); 2644 } 2645 if (responseData.error) { 2646 const message = responseData.error.message; 2647 throw ERROR_FACTORY3.create("token-subscribe-failed", { 2648 errorInfo: message 2649 }); 2650 } 2651 if (!responseData.token) { 2652 throw ERROR_FACTORY3.create( 2653 "token-subscribe-no-token" 2654 /* ErrorCode.TOKEN_SUBSCRIBE_NO_TOKEN */ 2655 ); 2656 } 2657 return responseData.token; 2658 } 2659 async function requestCreateRegistration(firebaseDependencies, subscriptionOptions) { 2660 var _a, _b; 2661 const headers = await getHeaders2(firebaseDependencies); 2662 const body = getBody( 2663 subscriptionOptions, 2664 firebaseDependencies.appConfig.appName, 2665 /* includeSdkVersion= */ 2666 true 2667 ); 2668 const subscribeOptions = { 2669 method: "POST", 2670 headers, 2671 body: JSON.stringify(body) 2672 }; 2673 let response; 2674 try { 2675 response = await fetchWithExponentialRetry(() => fetch(getEndpoint(firebaseDependencies.appConfig), subscribeOptions), FID_REGISTRATION_FETCH_MAX_ATTEMPTS, FID_REGISTRATION_FETCH_BASE_BACKOFF_MS); 2676 } catch (err) { 2677 throw ERROR_FACTORY3.create("fid-registration-failed", { 2678 errorInfo: err == null ? void 0 : err.toString() 2679 }); 2680 } 2681 if (response.ok) { 2682 const responseFid = await parseCreateRegistrationSuccessFid(response); 2683 return { responseFid }; 2684 } 2685 let responseData; 2686 try { 2687 responseData = await response.json(); 2688 } catch (err) { 2689 throw ERROR_FACTORY3.create("fid-registration-failed", { 2690 errorInfo: response.statusText 2691 }); 2692 } 2693 const message = (_b = (_a = responseData.error) == null ? void 0 : _a.message) != null ? _b : response.statusText; 2694 throw ERROR_FACTORY3.create("fid-registration-failed", { 2695 errorInfo: message 2696 }); 2697 } 2698 async function requestDeleteRegistration(firebaseDependencies, fid) { 2699 var _a, _b; 2700 const headers = await getHeaders2(firebaseDependencies); 2701 const options = { 2702 method: "DELETE", 2703 headers 2704 }; 2705 let response; 2706 try { 2707 response = await fetch(`${getEndpoint(firebaseDependencies.appConfig)}/${fid}`, options); 2708 } catch (err) { 2709 throw ERROR_FACTORY3.create("fid-unregister-failed", { 2710 errorInfo: err == null ? void 0 : err.toString() 2711 }); 2712 } 2713 if (response.ok) { 2714 return; 2715 } 2716 try { 2717 const responseData = await response.json(); 2718 const message = (_b = (_a = responseData.error) == null ? void 0 : _a.message) != null ? _b : response.statusText; 2719 throw message; 2720 } catch (err) { 2721 throw ERROR_FACTORY3.create("fid-unregister-failed", { 2722 errorInfo: typeof err === "string" && err || response.statusText || (err == null ? void 0 : err.toString()) 2723 }); 2724 } 2725 } 2726 async function parseCreateRegistrationSuccessFid(response) { 2727 const text = await response.text(); 2728 if (!text.trim()) { 2729 throw ERROR_FACTORY3.create("fid-registration-failed", { 2730 errorInfo: "CreateRegistration succeeded but response body is empty" 2731 }); 2732 } 2733 let data; 2734 try { 2735 data = JSON.parse(text); 2736 } catch (e) { 2737 throw ERROR_FACTORY3.create("fid-registration-failed", { 2738 errorInfo: "CreateRegistration succeeded but response body is not valid JSON" 2739 }); 2740 } 2741 const name4 = data.name; 2742 if (typeof name4 !== "string" || name4.length === 0) { 2743 throw ERROR_FACTORY3.create("fid-registration-failed", { 2744 errorInfo: "CreateRegistration succeeded but response did not include a non-empty name" 2745 }); 2746 } 2747 return parseFidFromRegistrationResourceName(name4); 2748 } 2749 var REGISTRATIONS_NAME_SEGMENT = "/registrations/"; 2750 function parseFidFromRegistrationResourceName(name4) { 2751 const segmentIndex = name4.indexOf(REGISTRATIONS_NAME_SEGMENT); 2752 if (segmentIndex !== -1) { 2753 const fid = name4.slice(segmentIndex + REGISTRATIONS_NAME_SEGMENT.length); 2754 if (fid.length > 0) { 2755 return fid; 2756 } 2757 } 2758 throw ERROR_FACTORY3.create("fid-registration-failed", { 2759 errorInfo: "CreateRegistration succeeded but response name is not a valid registration resource name" 2760 }); 2761 } 2762 async function requestUpdateToken(firebaseDependencies, tokenDetails) { 2763 const headers = await getHeaders2(firebaseDependencies); 2764 const body = getBody( 2765 tokenDetails.subscriptionOptions, 2766 firebaseDependencies.appConfig.appName, 2767 /* includeSdkVersion= */ 2768 false 2769 ); 2770 const updateOptions = { 2771 method: "PATCH", 2772 headers, 2773 body: JSON.stringify(body) 2774 }; 2775 let responseData; 2776 try { 2777 const response = await fetch(`${getEndpoint(firebaseDependencies.appConfig)}/${tokenDetails.token}`, updateOptions); 2778 responseData = await response.json(); 2779 } catch (err) { 2780 throw ERROR_FACTORY3.create("token-update-failed", { 2781 errorInfo: err == null ? void 0 : err.toString() 2782 }); 2783 } 2784 if (responseData.error) { 2785 const message = responseData.error.message; 2786 throw ERROR_FACTORY3.create("token-update-failed", { 2787 errorInfo: message 2788 }); 2789 } 2790 if (!responseData.token) { 2791 throw ERROR_FACTORY3.create( 2792 "token-update-no-token" 2793 /* ErrorCode.TOKEN_UPDATE_NO_TOKEN */ 2794 ); 2795 } 2796 return responseData.token; 2797 } 2798 async function requestDeleteToken(firebaseDependencies, token) { 2799 const headers = await getHeaders2(firebaseDependencies); 2800 const unsubscribeOptions = { 2801 method: "DELETE", 2802 headers 2803 }; 2804 try { 2805 const response = await fetch(`${getEndpoint(firebaseDependencies.appConfig)}/${token}`, unsubscribeOptions); 2806 const responseData = await response.json(); 2807 if (responseData.error) { 2808 const message = responseData.error.message; 2809 throw ERROR_FACTORY3.create("token-unsubscribe-failed", { 2810 errorInfo: message 2811 }); 2812 } 2813 } catch (err) { 2814 throw ERROR_FACTORY3.create("token-unsubscribe-failed", { 2815 errorInfo: err == null ? void 0 : err.toString() 2816 }); 2817 } 2818 } 2819 async function fetchWithExponentialRetry(operation, maxAttempts, baseBackoffMs) { 2820 let lastError; 2821 for (let attempt = 0; attempt < maxAttempts; attempt++) { 2822 try { 2823 return await operation(); 2824 } catch (err) { 2825 lastError = err; 2826 if (attempt < maxAttempts - 1) { 2827 const delayMs = baseBackoffMs * Math.pow(2, attempt); 2828 await new Promise((resolve) => setTimeout(resolve, delayMs)); 2829 } 2830 } 2831 } 2832 throw lastError; 2833 } 2834 function getEndpoint({ projectId }) { 2835 return `${ENDPOINT}/projects/${projectId}/registrations`; 2836 } 2837 async function getHeaders2({ appConfig, installations }) { 2838 const authToken = await installations.getToken(); 2839 return new Headers({ 2840 "Content-Type": "application/json", 2841 Accept: "application/json", 2842 "x-goog-api-key": appConfig.apiKey, 2843 "x-goog-firebase-installations-auth": `FIS ${authToken}` 2844 }); 2845 } 2846 function getRegistrationOrigin(swScope, appNameFallback) { 2847 var _a, _b; 2848 try { 2849 if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(swScope)) { 2850 return new URL(swScope).host; 2851 } 2852 } catch (e) { 2853 } 2854 try { 2855 if (typeof self !== "undefined" && ((_a = self.location) == null ? void 0 : _a.href)) { 2856 return new URL(swScope, self.location.origin).host; 2857 } 2858 } catch (e) { 2859 } 2860 if (typeof self !== "undefined" && ((_b = self.location) == null ? void 0 : _b.host)) { 2861 return self.location.host; 2862 } 2863 return appNameFallback; 2864 } 2865 function getBody({ p256dh, auth, endpoint, vapidKey, swScope }, appNameFallback, includeSdkVersion) { 2866 const body = { 2867 web: { 2868 origin: getRegistrationOrigin(swScope, appNameFallback), 2869 endpoint, 2870 auth, 2871 p256dh 2872 } 2873 }; 2874 if (includeSdkVersion) { 2875 body.fcm_sdk_version = version3; 2876 } 2877 if (vapidKey !== DEFAULT_VAPID_KEY) { 2878 body.web.applicationPubKey = vapidKey; 2879 } 2880 return body; 2881 } 2882 var TOKEN_EXPIRATION_MS = 7 * 24 * 60 * 60 * 1e3; 2883 async function getTokenInternal(messaging2) { 2884 const pushSubscription = await getPushSubscription$1(messaging2.swRegistration, messaging2.vapidKey); 2885 const subscriptionOptions = { 2886 vapidKey: messaging2.vapidKey, 2887 swScope: messaging2.swRegistration.scope, 2888 endpoint: pushSubscription.endpoint, 2889 auth: arrayToBase64(pushSubscription.getKey("auth")), 2890 p256dh: arrayToBase64(pushSubscription.getKey("p256dh")) 2891 }; 2892 const tokenDetails = await dbGet(messaging2.firebaseDependencies); 2893 if (!tokenDetails) { 2894 return getNewToken(messaging2.firebaseDependencies, subscriptionOptions); 2895 } else if (!isTokenValid(tokenDetails.subscriptionOptions, subscriptionOptions)) { 2896 try { 2897 await requestDeleteToken(messaging2.firebaseDependencies, tokenDetails.token); 2898 } catch (e) { 2899 console.warn(e); 2900 } 2901 return getNewToken(messaging2.firebaseDependencies, subscriptionOptions); 2902 } else if (Date.now() >= tokenDetails.createTime + TOKEN_EXPIRATION_MS) { 2903 return updateToken(messaging2, { 2904 token: tokenDetails.token, 2905 createTime: Date.now(), 2906 subscriptionOptions 2907 }); 2908 } else { 2909 return tokenDetails.token; 2910 } 2911 } 2912 async function revokeLegacyFcmTokenAndClearCaches(messaging2, tokenDetails) { 2913 await requestDeleteToken(messaging2.firebaseDependencies, tokenDetails.token); 2914 await dbRemove(messaging2.firebaseDependencies); 2915 await removeFidRegistrationBestEffort(messaging2.firebaseDependencies); 2916 } 2917 async function revokeFidRegistrationIfStored(messaging2) { 2918 const stored = await dbGetFidRegistration(messaging2.firebaseDependencies).catch(() => void 0); 2919 const fid = stored == null ? void 0 : stored.fid; 2920 if (fid) { 2921 await requestDeleteRegistration(messaging2.firebaseDependencies, fid); 2922 } 2923 await removeFidRegistrationBestEffort(messaging2.firebaseDependencies); 2924 if (fid) { 2925 notifyOnUnregistered(messaging2, fid); 2926 } 2927 } 2928 async function revokeRegistrationInternal(messaging2) { 2929 const tokenDetails = await dbGet(messaging2.firebaseDependencies); 2930 if (tokenDetails) { 2931 await revokeLegacyFcmTokenAndClearCaches(messaging2, tokenDetails); 2932 } else { 2933 await revokeFidRegistrationIfStored(messaging2); 2934 } 2935 const pushSubscription = await messaging2.swRegistration.pushManager.getSubscription(); 2936 if (pushSubscription) { 2937 return pushSubscription.unsubscribe(); 2938 } 2939 return true; 2940 } 2941 async function updateToken(messaging2, tokenDetails) { 2942 try { 2943 const updatedToken = await requestUpdateToken(messaging2.firebaseDependencies, tokenDetails); 2944 const updatedTokenDetails = __spreadProps(__spreadValues({}, tokenDetails), { 2945 token: updatedToken, 2946 createTime: Date.now() 2947 }); 2948 await dbSet(messaging2.firebaseDependencies, updatedTokenDetails); 2949 return updatedToken; 2950 } catch (e) { 2951 throw e; 2952 } 2953 } 2954 async function getNewToken(firebaseDependencies, subscriptionOptions) { 2955 const token = await requestGetToken(firebaseDependencies, subscriptionOptions); 2956 const tokenDetails = { 2957 token, 2958 createTime: Date.now(), 2959 subscriptionOptions 2960 }; 2961 await dbSet(firebaseDependencies, tokenDetails); 2962 return tokenDetails.token; 2963 } 2964 async function getPushSubscription$1(swRegistration, vapidKey) { 2965 const subscription = await swRegistration.pushManager.getSubscription(); 2966 if (subscription) { 2967 return subscription; 2968 } 2969 return swRegistration.pushManager.subscribe({ 2970 userVisibleOnly: true, 2971 // Chrome <= 75 doesn't support base64-encoded VAPID key. For backward compatibility, VAPID key 2972 // submitted to pushManager#subscribe must be of type Uint8Array. 2973 applicationServerKey: base64ToArray(vapidKey) 2974 }); 2975 } 2976 function isTokenValid(dbOptions, currentOptions) { 2977 const isVapidKeyEqual = currentOptions.vapidKey === dbOptions.vapidKey; 2978 const isEndpointEqual = currentOptions.endpoint === dbOptions.endpoint; 2979 const isAuthEqual = currentOptions.auth === dbOptions.auth; 2980 const isP256dhEqual = currentOptions.p256dh === dbOptions.p256dh; 2981 return isVapidKeyEqual && isEndpointEqual && isAuthEqual && isP256dhEqual; 2982 } 2983 async function removeFidRegistrationBestEffort(firebaseDependencies) { 2984 try { 2985 await dbRemoveFidRegistration(firebaseDependencies); 2986 } catch (e) { 2987 } 2988 } 2989 function notifyOnRegistered(messaging2, fid) { 2990 const handler = messaging2.onRegisteredHandler; 2991 if (!handler) { 2992 return; 2993 } 2994 if (typeof handler === "function") { 2995 handler(fid); 2996 } else { 2997 handler.next(fid); 2998 } 2999 } 3000 function notifyOnUnregistered(messaging2, fid) { 3001 const handler = messaging2.onUnregisteredHandler; 3002 if (!handler) { 3003 return; 3004 } 3005 if (typeof handler === "function") { 3006 handler(fid); 3007 } else { 3008 handler.next(fid); 3009 } 3010 } 3011 async function updateVapidKey(messaging2, vapidKey) { 3012 if (!!vapidKey) { 3013 messaging2.vapidKey = vapidKey; 3014 } else if (!messaging2.vapidKey) { 3015 messaging2.vapidKey = DEFAULT_VAPID_KEY; 3016 } 3017 } 3018 var FID_REGISTRATION_FID_MATCH_MAX_ATTEMPTS = 3; 3019 async function registerFcmRegistrationWithFid(messaging2, expectedFid) { 3020 const pushSubscription = await getPushSubscription(messaging2.swRegistration, messaging2.vapidKey); 3021 const subscriptionOptions = { 3022 vapidKey: messaging2.vapidKey, 3023 swScope: messaging2.swRegistration.scope, 3024 endpoint: pushSubscription.endpoint, 3025 auth: arrayToBase64(pushSubscription.getKey("auth")), 3026 p256dh: arrayToBase64(pushSubscription.getKey("p256dh")) 3027 }; 3028 const installations = messaging2.firebaseDependencies.installations; 3029 for (let attempt = 0; attempt < FID_REGISTRATION_FID_MATCH_MAX_ATTEMPTS; attempt++) { 3030 const { responseFid } = await requestCreateRegistration(messaging2.firebaseDependencies, subscriptionOptions); 3031 if (responseFid === expectedFid) { 3032 return; 3033 } 3034 if (attempt < FID_REGISTRATION_FID_MATCH_MAX_ATTEMPTS - 1) { 3035 await installations.getToken(true); 3036 } 3037 } 3038 throw ERROR_FACTORY3.create("fid-registration-failed", { 3039 errorInfo: "CreateRegistration response FID does not match Firebase Installation ID" 3040 }); 3041 } 3042 async function getPushSubscription(swRegistration, vapidKey) { 3043 const subscription = await swRegistration.pushManager.getSubscription(); 3044 if (subscription) { 3045 return subscription; 3046 } 3047 return swRegistration.pushManager.subscribe({ 3048 userVisibleOnly: true, 3049 // `PushManager.subscribe` expects a `BufferSource`; `base64ToArray` produces a typed array. 3050 // Cast to satisfy the lib typing differences across TS DOM versions. 3051 applicationServerKey: base64ToArray(vapidKey) 3052 }); 3053 } 3054 async function refreshFidRegistrationIfStored(messaging2) { 3055 const stored = await dbGetFidRegistration(messaging2.firebaseDependencies).catch(() => void 0); 3056 if (!stored) { 3057 return void 0; 3058 } 3059 await updateVapidKey(messaging2, stored.vapidKey); 3060 const fid = await messaging2.firebaseDependencies.installations.getId(); 3061 await registerFcmRegistrationWithFid(messaging2, fid); 3062 await dbSetFidRegistration(messaging2.firebaseDependencies, { 3063 fid, 3064 lastRegisterTime: Date.now(), 3065 vapidKey: messaging2.vapidKey 3066 }); 3067 notifyOnRegistered(messaging2, fid); 3068 return fid; 3069 } 3070 function externalizePayload(internalPayload) { 3071 const payload = { 3072 from: internalPayload.from, 3073 // eslint-disable-next-line camelcase 3074 collapseKey: internalPayload.collapse_key, 3075 // eslint-disable-next-line camelcase 3076 messageId: internalPayload.fcmMessageId 3077 }; 3078 propagateNotificationPayload(payload, internalPayload); 3079 propagateDataPayload(payload, internalPayload); 3080 propagateFcmOptions(payload, internalPayload); 3081 return payload; 3082 } 3083 function propagateNotificationPayload(payload, messagePayloadInternal) { 3084 if (!messagePayloadInternal.notification) { 3085 return; 3086 } 3087 payload.notification = {}; 3088 const title = messagePayloadInternal.notification.title; 3089 if (!!title) { 3090 payload.notification.title = title; 3091 } 3092 const body = messagePayloadInternal.notification.body; 3093 if (!!body) { 3094 payload.notification.body = body; 3095 } 3096 const image = messagePayloadInternal.notification.image; 3097 if (!!image) { 3098 payload.notification.image = image; 3099 } 3100 const icon = messagePayloadInternal.notification.icon; 3101 if (!!icon) { 3102 payload.notification.icon = icon; 3103 } 3104 } 3105 function propagateDataPayload(payload, messagePayloadInternal) { 3106 if (!messagePayloadInternal.data) { 3107 return; 3108 } 3109 payload.data = messagePayloadInternal.data; 3110 } 3111 function propagateFcmOptions(payload, messagePayloadInternal) { 3112 var _a, _b, _c, _d, _e; 3113 if (!messagePayloadInternal.fcmOptions && !((_a = messagePayloadInternal.notification) == null ? void 0 : _a.click_action)) { 3114 return; 3115 } 3116 payload.fcmOptions = {}; 3117 const link = (_d = (_b = messagePayloadInternal.fcmOptions) == null ? void 0 : _b.link) != null ? _d : (_c = messagePayloadInternal.notification) == null ? void 0 : _c.click_action; 3118 if (!!link) { 3119 payload.fcmOptions.link = link; 3120 } 3121 const analyticsLabel = (_e = messagePayloadInternal.fcmOptions) == null ? void 0 : _e.analytics_label; 3122 if (!!analyticsLabel) { 3123 payload.fcmOptions.analyticsLabel = analyticsLabel; 3124 } 3125 } 3126 function isConsoleMessage(data) { 3127 return typeof data === "object" && !!data && CONSOLE_CAMPAIGN_ID in data; 3128 } 3129 function sleep2(ms) { 3130 return new Promise((resolve) => { 3131 setTimeout(resolve, ms); 3132 }); 3133 } 3134 var LOG_ENDPOINT = "https://play.google.com/log?format=json_proto3"; 3135 var INITIAL_LOG_FLUSH_DELAY_MS = 0; 3136 var FCM_TRANSPORT_KEY = _mergeStrings("AzSCbw63g1R0nCw85jG8", "Iaya3yLKwmgvh7cF0q4"); 3137 function startLoggingService(messaging2) { 3138 if (messaging2.logQueue.state === "stopped" && messaging2.logEvents.length > 0) { 3139 _processQueue(messaging2, INITIAL_LOG_FLUSH_DELAY_MS); 3140 } 3141 } 3142 function _processQueue(messaging2, offsetInMs) { 3143 if (messaging2.logQueue.state === "scheduled") { 3144 clearTimeout(messaging2.logQueue.timerId); 3145 } 3146 messaging2.logQueue = { state: "stopped" }; 3147 if (!messaging2.deliveryMetricsExportedToBigQueryEnabled) { 3148 messaging2.logEvents = []; 3149 return; 3150 } 3151 messaging2.logQueue = { 3152 state: "scheduled", 3153 timerId: setTimeout(async () => { 3154 messaging2.logQueue = { state: "flushing" }; 3155 if (!messaging2.logEvents.length) { 3156 return _processQueue(messaging2, LOG_INTERVAL_IN_MS); 3157 } 3158 await _dispatchLogEvents(messaging2); 3159 }, offsetInMs) 3160 }; 3161 } 3162 async function _dispatchLogEvents(messaging2) { 3163 const eventsToSend = messaging2.logEvents; 3164 messaging2.logEvents = []; 3165 for (let i = 0, n = eventsToSend.length; i < n; i += MAX_NUMBER_OF_EVENTS_PER_LOG_REQUEST) { 3166 const batch = eventsToSend.slice(i, i + MAX_NUMBER_OF_EVENTS_PER_LOG_REQUEST); 3167 if (!batch.length) { 3168 break; 3169 } 3170 const logRequest = _createLogRequest(batch); 3171 let retryCount = 0, response = {}; 3172 do { 3173 try { 3174 response = await fetch(LOG_ENDPOINT.concat("&key=", FCM_TRANSPORT_KEY), { 3175 method: "POST", 3176 body: JSON.stringify(logRequest) 3177 }); 3178 if (response.ok || !response.ok && !isRetriableError(response)) { 3179 break; 3180 } 3181 if (!response.ok && isRetriableError(response)) { 3182 throw new Error("a retriable Non-200 code is returned in fetch to Firelog endpoint. Retry"); 3183 } 3184 } catch (error) { 3185 const isLastAttempt = retryCount === MAX_RETRIES; 3186 if (isLastAttempt) { 3187 break; 3188 } 3189 } 3190 let delayInMs; 3191 try { 3192 delayInMs = Number((await response.json()).nextRequestWaitMillis); 3193 } catch (e) { 3194 delayInMs = DEFAULT_BACKOFF_TIME_MS; 3195 } 3196 await new Promise((resolve) => setTimeout(resolve, delayInMs)); 3197 retryCount++; 3198 } while (retryCount < MAX_RETRIES); 3199 } 3200 _processQueue(messaging2, messaging2.logEvents.length ? INITIAL_LOG_FLUSH_DELAY_MS : LOG_INTERVAL_IN_MS); 3201 } 3202 function isRetriableError(response) { 3203 const httpStatus = response.status; 3204 return httpStatus === 429 || httpStatus === 500 || httpStatus === 503 || httpStatus === 504; 3205 } 3206 async function stageLog(messaging2, internalPayload) { 3207 const fcmEvent = createFcmEvent(internalPayload, await messaging2.firebaseDependencies.installations.getId()); 3208 createAndEnqueueLogEvent(messaging2, fcmEvent, internalPayload.productId); 3209 startLoggingService(messaging2); 3210 } 3211 function createFcmEvent(internalPayload, fid) { 3212 var _a, _b; 3213 const fcmEvent = {}; 3214 if (!!internalPayload.from) { 3215 fcmEvent.project_number = internalPayload.from; 3216 } 3217 if (!!internalPayload.fcmMessageId) { 3218 fcmEvent.message_id = internalPayload.fcmMessageId; 3219 } 3220 fcmEvent.instance_id = fid; 3221 if (!!internalPayload.notification) { 3222 fcmEvent.message_type = MessageType$1.DISPLAY_NOTIFICATION.toString(); 3223 } else { 3224 fcmEvent.message_type = MessageType$1.DATA_MESSAGE.toString(); 3225 } 3226 fcmEvent.sdk_platform = SDK_PLATFORM_WEB.toString(); 3227 fcmEvent.package_name = self.origin.replace(/(^\w+:|^)\/\//, ""); 3228 if (!!internalPayload.collapse_key) { 3229 fcmEvent.collapse_key = internalPayload.collapse_key; 3230 } 3231 fcmEvent.event = EVENT_MESSAGE_DELIVERED.toString(); 3232 if (!!((_a = internalPayload.fcmOptions) == null ? void 0 : _a.analytics_label)) { 3233 fcmEvent.analytics_label = (_b = internalPayload.fcmOptions) == null ? void 0 : _b.analytics_label; 3234 } 3235 return fcmEvent; 3236 } 3237 function createAndEnqueueLogEvent(messaging2, fcmEvent, productId) { 3238 const logEvent = {}; 3239 logEvent.event_time_ms = Math.floor(Date.now()).toString(); 3240 logEvent.source_extension_json_proto3 = JSON.stringify({ 3241 messaging_client_event: fcmEvent 3242 }); 3243 if (!!productId) { 3244 logEvent.compliance_data = buildComplianceData(productId); 3245 } 3246 messaging2.logEvents.push(logEvent); 3247 } 3248 function buildComplianceData(productId) { 3249 const complianceData = { 3250 privacy_context: { 3251 prequest: { 3252 origin_associated_product_id: productId 3253 } 3254 } 3255 }; 3256 return complianceData; 3257 } 3258 function _createLogRequest(logEventQueue) { 3259 const logRequest = {}; 3260 logRequest.log_source = FCM_LOG_SOURCE.toString(); 3261 logRequest.log_event = logEventQueue; 3262 return logRequest; 3263 } 3264 function _mergeStrings(s1, s2) { 3265 const resultArray = []; 3266 for (let i = 0; i < s1.length; i++) { 3267 resultArray.push(s1.charAt(i)); 3268 if (i < s2.length) { 3269 resultArray.push(s2.charAt(i)); 3270 } 3271 } 3272 return resultArray.join(""); 3273 } 3274 async function onSubChange(event, messaging2) { 3275 var _a, _b; 3276 if (!messaging2.swRegistration) { 3277 messaging2.swRegistration = self.registration; 3278 } 3279 const { newSubscription } = event; 3280 if (!newSubscription) { 3281 await revokeRegistrationInternal(messaging2); 3282 return; 3283 } 3284 const storedFid = await dbGetFidRegistration(messaging2.firebaseDependencies).catch(() => void 0); 3285 if (storedFid) { 3286 const fid = await refreshFidRegistrationIfStored(messaging2).catch(() => { 3287 return void 0; 3288 }); 3289 if (fid) { 3290 const clientList = await getClientList(); 3291 if (hasVisibleClients(clientList)) { 3292 sendFidRegisteredToWindows(clientList, fid); 3293 } 3294 } 3295 return; 3296 } 3297 const tokenDetails = await dbGet(messaging2.firebaseDependencies); 3298 await revokeRegistrationInternal(messaging2); 3299 messaging2.vapidKey = (_b = (_a = tokenDetails == null ? void 0 : tokenDetails.subscriptionOptions) == null ? void 0 : _a.vapidKey) != null ? _b : DEFAULT_VAPID_KEY; 3300 await getTokenInternal(messaging2); 3301 } 3302 async function onPush(event, messaging2) { 3303 const internalPayload = getMessagePayloadInternal(event); 3304 if (!internalPayload) { 3305 return; 3306 } 3307 if (messaging2.deliveryMetricsExportedToBigQueryEnabled) { 3308 await stageLog(messaging2, internalPayload); 3309 } 3310 const clientList = await getClientList(); 3311 if (hasVisibleClients(clientList)) { 3312 return sendMessagePayloadInternalToWindows(clientList, internalPayload); 3313 } 3314 if (!!internalPayload.notification) { 3315 await showNotification(wrapInternalPayload(internalPayload)); 3316 } 3317 if (!messaging2) { 3318 return; 3319 } 3320 if (!!messaging2.onBackgroundMessageHandler) { 3321 const payload = externalizePayload(internalPayload); 3322 if (typeof messaging2.onBackgroundMessageHandler === "function") { 3323 await messaging2.onBackgroundMessageHandler(payload); 3324 } else { 3325 messaging2.onBackgroundMessageHandler.next(payload); 3326 } 3327 } 3328 } 3329 async function onNotificationClick(event) { 3330 var _a, _b; 3331 const internalPayload = (_b = (_a = event.notification) == null ? void 0 : _a.data) == null ? void 0 : _b[FCM_MSG]; 3332 if (!internalPayload) { 3333 return; 3334 } else if (event.action) { 3335 return; 3336 } 3337 event.stopImmediatePropagation(); 3338 event.notification.close(); 3339 const link = getLink(internalPayload); 3340 if (!link) { 3341 return; 3342 } 3343 const url = new URL(link, self.location.href); 3344 const originUrl = new URL(self.location.origin); 3345 if (url.host !== originUrl.host) { 3346 return; 3347 } 3348 let client = await getWindowClient(url); 3349 if (!client) { 3350 client = await self.clients.openWindow(link); 3351 await sleep2(3e3); 3352 } else { 3353 client = await client.focus(); 3354 } 3355 if (!client) { 3356 return; 3357 } 3358 internalPayload.messageType = MessageType.NOTIFICATION_CLICKED; 3359 internalPayload.isFirebaseMessaging = true; 3360 return client.postMessage(internalPayload); 3361 } 3362 function wrapInternalPayload(internalPayload) { 3363 const wrappedInternalPayload = __spreadValues({}, internalPayload.notification); 3364 wrappedInternalPayload.data = { 3365 [FCM_MSG]: internalPayload 3366 }; 3367 return wrappedInternalPayload; 3368 } 3369 function getMessagePayloadInternal({ data }) { 3370 if (!data) { 3371 return null; 3372 } 3373 try { 3374 return data.json(); 3375 } catch (err) { 3376 return null; 3377 } 3378 } 3379 async function getWindowClient(url) { 3380 const clientList = await getClientList(); 3381 for (const client of clientList) { 3382 const clientUrl = new URL(client.url, self.location.href); 3383 if (url.host === clientUrl.host) { 3384 return client; 3385 } 3386 } 3387 return null; 3388 } 3389 function hasVisibleClients(clientList) { 3390 return clientList.some((client) => client.visibilityState === "visible" && // Ignore chrome-extension clients as that matches the background pages of extensions, which 3391 // are always considered visible for some reason. 3392 !client.url.startsWith("chrome-extension://")); 3393 } 3394 function sendMessagePayloadInternalToWindows(clientList, internalPayload) { 3395 internalPayload.isFirebaseMessaging = true; 3396 internalPayload.messageType = MessageType.PUSH_RECEIVED; 3397 for (const client of clientList) { 3398 client.postMessage(internalPayload); 3399 } 3400 } 3401 function sendFidRegisteredToWindows(clientList, fid) { 3402 const payload = { 3403 isFirebaseMessaging: true, 3404 messageType: MessageType.FID_REGISTERED, 3405 fid 3406 }; 3407 for (const client of clientList) { 3408 client.postMessage(payload); 3409 } 3410 } 3411 function getClientList() { 3412 return self.clients.matchAll({ 3413 type: "window", 3414 includeUncontrolled: true 3415 // TS doesn't know that "type: 'window'" means it'll return WindowClient[] 3416 }); 3417 } 3418 function showNotification(notificationPayloadInternal) { 3419 var _a; 3420 const { actions } = notificationPayloadInternal; 3421 const { maxActions } = Notification; 3422 if (actions && maxActions && actions.length > maxActions) { 3423 console.warn(`This browser only supports ${maxActions} actions. The remaining actions will not be displayed.`); 3424 } 3425 return self.registration.showNotification( 3426 /* title= */ 3427 (_a = notificationPayloadInternal.title) != null ? _a : "", 3428 notificationPayloadInternal 3429 ); 3430 } 3431 function getLink(payload) { 3432 var _a, _b, _c; 3433 const link = (_c = (_a = payload.fcmOptions) == null ? void 0 : _a.link) != null ? _c : (_b = payload.notification) == null ? void 0 : _b.click_action; 3434 if (link) { 3435 return link; 3436 } 3437 if (isConsoleMessage(payload.data)) { 3438 return self.location.origin; 3439 } else { 3440 return null; 3441 } 3442 } 3443 function extractAppConfig2(app2) { 3444 if (!app2 || !app2.options) { 3445 throw getMissingValueError2("App Configuration Object"); 3446 } 3447 if (!app2.name) { 3448 throw getMissingValueError2("App Name"); 3449 } 3450 const configKeys = [ 3451 "projectId", 3452 "apiKey", 3453 "appId", 3454 "messagingSenderId" 3455 ]; 3456 const { options } = app2; 3457 for (const keyName of configKeys) { 3458 if (!options[keyName]) { 3459 throw getMissingValueError2(keyName); 3460 } 3461 } 3462 return { 3463 appName: app2.name, 3464 projectId: options.projectId, 3465 apiKey: options.apiKey, 3466 appId: options.appId, 3467 senderId: options.messagingSenderId 3468 }; 3469 } 3470 function getMissingValueError2(valueName) { 3471 return ERROR_FACTORY3.create("missing-app-config-values", { 3472 valueName 3473 }); 3474 } 3475 var MessagingService = class { 3476 constructor(app2, installations, analyticsProvider) { 3477 this.deliveryMetricsExportedToBigQueryEnabled = false; 3478 this.onBackgroundMessageHandler = null; 3479 this.onMessageHandler = null; 3480 this.onRegisteredHandler = null; 3481 this.onUnregisteredHandler = null; 3482 this._registerNotifyChain = Promise.resolve(); 3483 this._fidChangeUnsubscribe = null; 3484 this.logEvents = []; 3485 this.logQueue = { state: "stopped" }; 3486 const appConfig = extractAppConfig2(app2); 3487 this.firebaseDependencies = { 3488 app: app2, 3489 appConfig, 3490 installations, 3491 analyticsProvider 3492 }; 3493 } 3494 _delete() { 3495 if (this._fidChangeUnsubscribe) { 3496 this._fidChangeUnsubscribe(); 3497 this._fidChangeUnsubscribe = null; 3498 } 3499 if (this.logQueue.state === "scheduled") { 3500 clearTimeout(this.logQueue.timerId); 3501 } 3502 this.logQueue = { state: "stopped" }; 3503 return Promise.resolve(); 3504 } 3505 }; 3506 var SwMessagingFactory = (container) => { 3507 const messaging2 = new MessagingService(container.getProvider("app").getImmediate(), container.getProvider("installations-internal").getImmediate(), container.getProvider("analytics-internal")); 3508 self.addEventListener("push", (e) => { 3509 e.waitUntil(onPush(e, messaging2)); 3510 }); 3511 self.addEventListener("pushsubscriptionchange", (e) => { 3512 e.waitUntil(onSubChange(e, messaging2)); 3513 }); 3514 self.addEventListener("notificationclick", (e) => { 3515 e.waitUntil(onNotificationClick(e)); 3516 }); 3517 return messaging2; 3518 }; 3519 function registerMessagingInSw() { 3520 _registerComponent(new Component( 3521 "messaging-sw", 3522 SwMessagingFactory, 3523 "PUBLIC" 3524 /* ComponentType.PUBLIC */ 3525 )); 3526 } 3527 async function isSwSupported() { 3528 return isIndexedDBAvailable() && await validateIndexedDBOpenable() && "PushManager" in self && "Notification" in self && ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification") && PushSubscription.prototype.hasOwnProperty("getKey"); 3529 } 3530 function onBackgroundMessage$1(messaging2, nextOrObserver) { 3531 if (self.document !== void 0) { 3532 throw ERROR_FACTORY3.create( 3533 "only-available-in-sw" 3534 /* ErrorCode.AVAILABLE_IN_SW */ 3535 ); 3536 } 3537 messaging2.onBackgroundMessageHandler = nextOrObserver; 3538 return () => { 3539 messaging2.onBackgroundMessageHandler = null; 3540 }; 3541 } 3542 function getMessagingInSw(app2 = getApp()) { 3543 isSwSupported().then((isSupported) => { 3544 if (!isSupported) { 3545 throw ERROR_FACTORY3.create( 3546 "unsupported-browser" 3547 /* ErrorCode.UNSUPPORTED_BROWSER */ 3548 ); 3549 } 3550 }, (_) => { 3551 throw ERROR_FACTORY3.create( 3552 "indexed-db-unsupported" 3553 /* ErrorCode.INDEXED_DB_UNSUPPORTED */ 3554 ); 3555 }); 3556 return _getProvider(getModularInstance(app2), "messaging-sw").getImmediate(); 3557 } 3558 function onBackgroundMessage(messaging2, nextOrObserver) { 3559 messaging2 = getModularInstance(messaging2); 3560 return onBackgroundMessage$1(messaging2, nextOrObserver); 3561 } 3562 registerMessagingInSw(); 3563 3564
3564// public/js/firebase-messaging-sw.js 3565 var firebaseConfig = { 3566 apiKey: "AIzaSyC3LVr14rt1aYDy5GYvE5NHB1Qjd3oCcLM", 3567 authDomain: "clarinwebpush.firebaseapp.com", 3568 databaseURL: "https://clarinwebpush.firebaseio.com", 3569 projectId: "clarinwebpush", 3570 storageBucket: "clarinwebpush.firebasestorage.app", 3571 messagingSenderId: "738620085847", 3572 appId: "1:738620085847:web:8c6fb0e621d3ab258c7512" 3573 }; 3574 var app = initializeApp(firebaseConfig); 3575 var messaging = getMessagingInSw(app); 3576 self.addEventListener("install", (event) => { 3577 console.log("[SW] Instalando nueva versi\xF3n del Service Worker..."); 3578 self.skipWaiting(); 3579 }); 3580 self.addEventListener("activate", (event) => { 3581 console.log("[SW] Service Worker activado y tomando control..."); 3582 event.waitUntil(clients.claim()); 3583 }); 3584 function saveNotificationToIDB(notification) { 3585 const request = indexedDB.open("notifications-db", 1); 3586 request.onupgradeneeded = function(event) { 3587 const db = event.target.result; 3588 if (!db.objectStoreNames.contains("notifications")) { 3589 db.createObjectStore("notifications", { keyPath: "id" }); 3590 } 3591 }; 3592 request.onsuccess = function(event) { 3593 const db = event.target.result; 3594 if (!db.objectStoreNames.contains("notifications")) { 3595 const currentVersion = db.version; 3596 db.close(); 3597 const upgradeReq = indexedDB.open("notifications-db", currentVersion + 1); 3598 upgradeReq.onupgradeneeded = function(ev) { 3599 const upDb = ev.target.result; 3600 if (!upDb.objectStoreNames.contains("notifications")) { 3601 upDb.createObjectStore("notifications", { keyPath: "id" }); 3602 } 3603 }; 3604 upgradeReq.onsuccess = function(ev) { 3605 const upDb = ev.target.result; 3606 const tx2 = upDb.transaction("notifications", "readwrite"); 3607 const store2 = tx2.objectStore("notifications"); 3608 const getAll2 = store2.getAll(); 3609 getAll2.onsuccess = function() { 3610 let notifications = getAll2.result || []; 3611 notifications.unshift(notification); 3612 notifications = notifications.slice(0, 10); 3613 store2.clear().onsuccess = function() { 3614 notifications.forEach((n) => store2.put(n)); 3615 }; 3616 }; 3617 tx2.oncomplete = function() { 3618 upDb.close(); 3619 }; 3620 }; 3621 upgradeReq.onerror = function() { 3622 console.error("Error creando object store para guardar"); 3623 }; 3624 return; 3625 } 3626 const tx = db.transaction("notifications", "readwrite"); 3627 const store = tx.objectStore("notifications"); 3628 const getAll = store.getAll(); 3629 getAll.onsuccess = function() { 3630 let notifications = getAll.result || []; 3631 notifications.unshift(notification); 3632 notifications = notifications.slice(0, 10); 3633 store.clear().onsuccess = function() { 3634 notifications.forEach((n) => store.put(n)); 3635 }; 3636 }; 3637 tx.oncomplete = function() { 3638 db.close(); 3639 }; 3640 }; 3641 } 3642 onBackgroundMessage(messaging, async (payload) => { 3643 var _a, _b, _c, _d, _e; 3644 console.log("[SW] ========================================"); 3645 console.log("[SW] Mensaje de FCM recibido en segundo plano:", payload); 3646 const notificationTitle = ((_a = payload.notification) == null ? void 0 : _a.title) || ""; 3647 const notificationOptions = { 3648 body: ((_b = payload.notification) == null ? void 0 : _b.body) || "", 3649 icon: ((_c = payload.notification) == null ? void 0 : _c.icon) || "/img/clarin-sharing.png", 3650 image: ((_d = payload.notification) == null ? void 0 : _d.image) || ((_e = payload.data) == null ? void 0 : _e.icon), 3651 data: payload.data || {}, 3652 topic: payload.topic || null 3653 }; 3654 const notificationToSave = { 3655 id: Date.now(), 3656 title: notificationTitle, 3657 body: notificationOptions.body, 3658 icon: notificationOptions.icon, 3659 image: notificationOptions.image, 3660 data: notificationOptions.data, 3661 topic: notificationOptions.topic, 3662 timestamp: (/* @__PURE__ */ new Date()).toISOString(), 3663 read: false 3664 }; 3665 saveNotificationToIDB(notificationToSave); 3666 self.registration.showNotification(notificationTitle, notificationOptions); 3667 }); 3668 self.addEventListener("notificationclick", (event) => { 3669 var _a;
3670 console.log("[SW] Notificaci\xF3n clicada:", event.notification); 3671 event.notification.close(); 3672 const clickAction = ((_a = event.notification.data) == null ? void 0 : _a.click_action) || "/"; 3673 event.waitUntil( 3674 clients.matchAll({ type: "window", includeUncontrolled: true }).then((clientList) => { 3675 for (const client of clientList) { 3676 if (client.url === clickAction && "focus" in client) { 3677 return client.focus(); 3678 } 3679 } 3680 if (clients.openWindow) { 3681 return clients.openWindow(clickAction); 3682 } 3683 }) 3684 ); 3685 }); 3686})(); 3687/*! Bundled license information: 3688 3689@firebase/util/dist/index.esm.js: 3690 (** 3691 * @license 3692 * Copyright 2017 Google LLC 3693 * 3694 * Licensed under the Apache License, Version 2.0 (the "License"); 3695 * you may not use this file except in compliance with the License. 3696 * You may obtain a copy of the License at 3697 * 3698 * http://www.apache.org/licenses/LICENSE-2.0 3699 * 3700 * Unless required by applicable law or agreed to in writing, software 3701 * distributed under the License is distributed on an "AS IS" BASIS, 3702 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3703 * See the License for the specific language governing permissions and 3704 * limitations under the License. 3705 *) 3706 3707@firebase/util/dist/index.esm.js: 3708 (** 3709 * @license 3710 * Copyright 2017 Google LLC 3711 * 3712 * Licensed under the Apache License, Version 2.0 (the "License"); 3713 * you may not use this file except in compliance with the License. 3714 * You may obtain a copy of the License at 3715 * 3716 * http://www.apache.org/licenses/LICENSE-2.0 3717 * 3718 * Unless required by applicable law or agreed to in writing, software 3719 * distributed under the License is distributed on an "AS IS" BASIS, 3720 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3721 * See the License for the specific language governing permissions and 3722 * limitations under the License. 3723 *) 3724 3725@firebase/util/dist/index.esm.js: 3726 (** 3727 * @license 3728 * Copyright 2017 Google LLC 3729 * 3730 * Licensed under the Apache License, Version 2.0 (the "License"); 3731 * you may not use this file except in compliance with the License. 3732 * You may obtain a copy of the License at 3733 * 3734 * http://www.apache.org/licenses/LICENSE-2.0 3735 * 3736 * Unless required by applicable law or agreed to in writing, software 3737 * distributed under the License is distributed on an "AS IS" BASIS, 3738 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3739 * See the License for the specific language governing permissions and 3740 * limitations under the License. 3741 *) 3742 3743@firebase/util/dist/index.esm.js: 3744 (** 3745 * @license 3746 * Copyright 2022 Google LLC 3747 * 3748 * Licensed under the Apache License, Version 2.0 (the "License"); 3749 * you may not use this file except in compliance with the License. 3750 * You may obtain a copy of the License at 3751 * 3752 * http://www.apache.org/licenses/LICENSE-2.0 3753 * 3754 * Unless required by applicable law or agreed to in writing, software 3755 * distributed under the License is distributed on an "AS IS" BASIS, 3756 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3757 * See the License for the specific language governing permissions and 3758 * limitations under the License. 3759 *) 3760 3761@firebase/util/dist/index.esm.js: 3762 (** 3763 * @license 3764 * Copyright 2017 Google LLC 3765 * 3766 * Licensed under the Apache License, Version 2.0 (the "License"); 3767 * you may not use this file except in compliance with the License. 3768 * You may obtain a copy of the License at 3769 * 3770 * http://www.apache.org/licenses/LICENSE-2.0 3771 * 3772 * Unless required by applicable law or agreed to in writing, software 3773 * distributed under the License is distributed on an "AS IS" BASIS, 3774 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3775 * See the License for the specific language governing permissions and 3776 * limitations under the License. 3777 *) 3778 (** 3779 * @license 3780 * Copyright 2021 Google LLC 3781 * 3782 * Licensed under the Apache License, Version 2.0 (the "License");
3783 * you may not use this file except in compliance with the License. 3784 * You may obtain a copy of the License at 3785 * 3786 * http://www.apache.org/licenses/LICENSE-2.0 3787 * 3788 * Unless required by applicable law or agreed to in writing, software 3789 * distributed under the License is distributed on an "AS IS" BASIS, 3790 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3791 * See the License for the specific language governing permissions and 3792 * limitations under the License. 3793 *) 3794 3795@firebase/util/dist/index.esm.js: 3796 (** 3797 * @license 3798 * Copyright 2017 Google LLC 3799 * 3800 * Licensed under the Apache License, Version 2.0 (the "License"); 3801 * you may not use this file except in compliance with the License. 3802 * You may obtain a copy of the License at 3803 * 3804 * http://www.apache.org/licenses/LICENSE-2.0 3805 * 3806 * Unless required by applicable law or agreed to in writing, software 3807 * distributed under the License is distributed on an "AS IS" BASIS, 3808 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3809 * See the License for the specific language governing permissions and 3810 * limitations under the License. 3811 *) 3812 3813@firebase/util/dist/index.esm.js: 3814 (** 3815 * @license 3816 * Copyright 2017 Google LLC 3817 * 3818 * Licensed under the Apache License, Version 2.0 (the "License"); 3819 * you may not use this file except in compliance with the License. 3820 * You may obtain a copy of the License at 3821 * 3822 * http://www.apache.org/licenses/LICENSE-2.0 3823 * 3824 * Unless required by applicable law or agreed to in writing, software 3825 * distributed under the License is distributed on an "AS IS" BASIS, 3826 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3827 * See the License for the specific language governing permissions and 3828 * limitations under the License. 3829 *) 3830 3831@firebase/util/dist/index.esm.js: 3832 (** 3833 * @license 3834 * Copyright 2017 Google LLC 3835 * 3836 * Licensed under the Apache License, Version 2.0 (the "License"); 3837 * you may not use this file except in compliance with the License. 3838 * You may obtain a copy of the License at 3839 * 3840 * http://www.apache.org/licenses/LICENSE-2.0 3841 * 3842 * Unless required by applicable law or agreed to in writing, software 3843 * distributed under the License is distributed on an "AS IS" BASIS, 3844 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3845 * See the License for the specific language governing permissions and 3846 * limitations under the License. 3847 *) 3848 3849@firebase/util/dist/index.esm.js: 3850 (** 3851 * @license 3852 * Copyright 2017 Google LLC 3853 * 3854 * Licensed under the Apache License, Version 2.0 (the "License"); 3855 * you may not use this file except in compliance with the License. 3856 * You may obtain a copy of the License at 3857 * 3858 * http://www.apache.org/licenses/LICENSE-2.0 3859 * 3860 * Unless required by applicable law or agreed to in writing, software 3861 * distributed under the License is distributed on an "AS IS" BASIS, 3862 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3863 * See the License for the specific language governing permissions and 3864 * limitations under the License. 3865 *) 3866 3867@firebase/util/dist/index.esm.js: 3868 (** 3869 * @license 3870 * Copyright 2022 Google LLC 3871 * 3872 * Licensed under the Apache License, Version 2.0 (the "License"); 3873 * you may not use this file except in compliance with the License. 3874 * You may obtain a copy of the License at 3875 * 3876 * http://www.apache.org/licenses/LICENSE-2.0 3877 * 3878 * Unless required by applicable law or agreed to in writing, software 3879 * distributed under the License is distributed on an "AS IS" BASIS, 3880 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3881 * See the License for the specific language governing permissions and 3882 * limitations under the License. 3883 *) 3884 3885@firebase/util/dist/index.esm.js: 3886 (** 3887 * @license 3888 * Copyright 2017 Google LLC 3889 * 3890 * Licensed under the Apache License, Version 2.0 (the "License"); 3891 * you may not use this file except in compliance with the License. 3892 * You may obtain a copy of the License at 3893 * 3894 * http://www.apache.org/licenses/LICENSE-2.0 3895 * 3896 * Unless required by applicable law or agreed to in writing, softw
3896are 3897 * distributed under the License is distributed on an "AS IS" BASIS, 3898 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3899 * See the License for the specific language governing permissions and 3900 * limitations under the License. 3901 *) 3902 3903@firebase/util/dist/index.esm.js: 3904 (** 3905 * @license 3906 * Copyright 2017 Google LLC 3907 * 3908 * Licensed under the Apache License, Version 2.0 (the "License"); 3909 * you may not use this file except in compliance with the License. 3910 * You may obtain a copy of the License at 3911 * 3912 * http://www.apache.org/licenses/LICENSE-2.0 3913 * 3914 * Unless required by applicable law or agreed to in writing, software 3915 * distributed under the License is distributed on an "AS IS" BASIS, 3916 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3917 * See the License for the specific language governing permissions and 3918 * limitations under the License. 3919 *) 3920 3921@firebase/util/dist/index.esm.js: 3922 (** 3923 * @license 3924 * Copyright 2017 Google LLC 3925 * 3926 * Licensed under the Apache License, Version 2.0 (the "License"); 3927 * you may not use this file except in compliance with the License. 3928 * You may obtain a copy of the License at 3929 * 3930 * http://www.apache.org/licenses/LICENSE-2.0 3931 * 3932 * Unless required by applicable law or agreed to in writing, software 3933 * distributed under the License is distributed on an "AS IS" BASIS, 3934 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3935 * See the License for the specific language governing permissions and 3936 * limitations under the License. 3937 *) 3938 3939@firebase/util/dist/index.esm.js: 3940 (** 3941 * @license 3942 * Copyright 2017 Google LLC 3943 * 3944 * Licensed under the Apache License, Version 2.0 (the "License"); 3945 * you may not use this file except in compliance with the License. 3946 * You may obtain a copy of the License at 3947 * 3948 * http://www.apache.org/licenses/LICENSE-2.0 3949 * 3950 * Unless required by applicable law or agreed to in writing, software 3951 * distributed under the License is distributed on an "AS IS" BASIS, 3952 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3953 * See the License for the specific language governing permissions and 3954 * limitations under the License. 3955 *) 3956 3957@firebase/util/dist/index.esm.js: 3958 (** 3959 * @license 3960 * Copyright 2019 Google LLC 3961 * 3962 * Licensed under the Apache License, Version 2.0 (the "License"); 3963 * you may not use this file except in compliance with the License. 3964 * You may obtain a copy of the License at 3965 * 3966 * http://www.apache.org/licenses/LICENSE-2.0 3967 * 3968 * Unless required by applicable law or agreed to in writing, software 3969 * distributed under the License is distributed on an "AS IS" BASIS, 3970 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3971 * See the License for the specific language governing permissions and 3972 * limitations under the License. 3973 *) 3974 3975@firebase/util/dist/index.esm.js: 3976 (** 3977 * @license 3978 * Copyright 2020 Google LLC 3979 * 3980 * Licensed under the Apache License, Version 2.0 (the "License"); 3981 * you may not use this file except in compliance with the License. 3982 * You may obtain a copy of the License at 3983 * 3984 * http://www.apache.org/licenses/LICENSE-2.0 3985 * 3986 * Unless required by applicable law or agreed to in writing, software 3987 * distributed under the License is distributed on an "AS IS" BASIS, 3988 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3989 * See the License for the specific language governing permissions and 3990 * limitations under the License. 3991 *) 3992 3993@firebase/util/dist/index.esm.js: 3994 (** 3995 * @license 3996 * Copyright 2021 Google LLC 3997 * 3998 * Licensed under the Apache License, Version 2.0 (the "License"); 3999 * you may not use this file except in compliance with the License. 4000 * You may obtain a copy of the License at 4001 * 4002 * http://www.apache.org/licenses/LICENSE-2.0 4003 * 4004 * Unless required by applicable law or agreed to in writing, software 4005 * distributed under the License is distributed on an "AS IS" BASIS, 4006 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4007 * See the License for the specific language governing permissions and 4008 * limitations under the License. 4009 *) 4010 (** 4011 * @license 4012 * Copyright 2025 Google LLC 4013 * 4014 * Licensed under the Apache License, Version 2.0 (the "License");
4015 * you may not use this file except in compliance with the License. 4016 * You may obtain a copy of the License at 4017 * 4018 * http://www.apache.org/licenses/LICENSE-2.0 4019 * 4020 * Unless required by applicable law or agreed to in writing, software 4021 * distributed under the License is distributed on an "AS IS" BASIS, 4022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4023 * See the License for the specific language governing permissions and 4024 * limitations under the License. 4025 *) 4026 4027@firebase/util/dist/index.esm.js: 4028 (** 4029 * @license 4030 * Copyright 2025 Google LLC 4031 * 4032 * Licensed under the Apache License, Version 2.0 (the "License"); 4033 * you may not use this file except in compliance with the License. 4034 * You may obtain a copy of the License at 4035 * 4036 * http://www.apache.org/licenses/LICENSE-2.0 4037 * 4038 * Unless required by applicable law or agreed to in writing, software 4039 * distributed under the License is distributed on an "AS IS" BASIS, 4040 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4041 * See the License for the specific language governing permissions and 4042 * limitations under the License. 4043 *) 4044 4045@firebase/component/dist/esm/index.esm.js: 4046 (** 4047 * @license 4048 * Copyright 2019 Google LLC 4049 * 4050 * Licensed under the Apache License, Version 2.0 (the "License"); 4051 * you may not use this file except in compliance with the License. 4052 * You may obtain a copy of the License at 4053 * 4054 * http://www.apache.org/licenses/LICENSE-2.0 4055 * 4056 * Unless required by applicable law or agreed to in writing, software 4057 * distributed under the License is distributed on an "AS IS" BASIS, 4058 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4059 * See the License for the specific language governing permissions and 4060 * limitations under the License. 4061 *) 4062 4063@firebase/logger/dist/esm/index.esm.js: 4064 (** 4065 * @license 4066 * Copyright 2017 Google LLC 4067 * 4068 * Licensed under the Apache License, Version 2.0 (the "License"); 4069 * you may not use this file except in compliance with the License. 4070 * You may obtain a copy of the License at 4071 * 4072 * http://www.apache.org/licenses/LICENSE-2.0 4073 * 4074 * Unless required by applicable law or agreed to in writing, software 4075 * distributed under the License is distributed on an "AS IS" BASIS, 4076 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4077 * See the License for the specific language governing permissions and 4078 * limitations under the License. 4079 *) 4080 4081@firebase/app/dist/esm/index.esm.js: 4082 (** 4083 * @license 4084 * Copyright 2019 Google LLC 4085 * 4086 * Licensed under the Apache License, Version 2.0 (the "License"); 4087 * you may not use this file except in compliance with the License. 4088 * You may obtain a copy of the License at 4089 * 4090 * http://www.apache.org/licenses/LICENSE-2.0 4091 * 4092 * Unless required by applicable law or agreed to in writing, software 4093 * distributed under the License is distributed on an "AS IS" BASIS, 4094 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4095 * See the License for the specific language governing permissions and 4096 * limitations under the License. 4097 *) 4098 4099@firebase/app/dist/esm/index.esm.js: 4100 (** 4101 * @license 4102 * Copyright 2019 Google LLC 4103 * 4104 * Licensed under the Apache License, Version 2.0 (the "License"); 4105 * you may not use this file except in compliance with the License. 4106 * You may obtain a copy of the License at 4107 * 4108 * http://www.apache.org/licenses/LICENSE-2.0 4109 * 4110 * Unless required by applicable law or agreed to in writing, software 4111 * distributed under the License is distributed on an "AS IS" BASIS, 4112 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4113 * See the License for the specific language governing permissions and 4114 * limitations under the License. 4115 *) 4116 4117@firebase/app/dist/esm/index.esm.js: 4118 (** 4119 * @license 4120 * Copyright 2019 Google LLC 4121 * 4122 * Licensed under the Apache License, Version 2.0 (the "License"); 4123 * you may not use this file except in compliance with the License. 4124 * You may obtain a copy of the License at 4125 * 4126 * http://www.apache.org/licenses/LICENSE-2.0 4127 * 4128 * Unless required by applicable law or agreed to in writing, softw
4128are 4129 * distributed under the License is distributed on an "AS IS" BASIS, 4130 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4131 * See the License for the specific language governing permissions and 4132 * limitations under the License. 4133 *) 4134 (** 4135 * @license 4136 * Copyright 2023 Google LLC 4137 * 4138 * Licensed under the Apache License, Version 2.0 (the "License"); 4139 * you may not use this file except in compliance with the License. 4140 * You may obtain a copy of the License at 4141 * 4142 * http://www.apache.org/licenses/LICENSE-2.0 4143 * 4144 * Unless required by applicable law or agreed to in writing, software 4145 * distributed under the License is distributed on an "AS IS" BASIS, 4146 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4147 * See the License for the specific language governing permissions and 4148 * limitations under the License. 4149 *) 4150 4151@firebase/app/dist/esm/index.esm.js: 4152 (** 4153 * @license 4154 * Copyright 2019 Google LLC 4155 * 4156 * Licensed under the Apache License, Version 2.0 (the "License"); 4157 * you may not use this file except in compliance with the License. 4158 * You may obtain a copy of the License at 4159 * 4160 * http://www.apache.org/licenses/LICENSE-2.0 4161 * 4162 * Unless required by applicable law or agreed to in writing, software 4163 * distributed under the License is distributed on an "AS IS" BASIS, 4164 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4165 * See the License for the specific language governing permissions and 4166 * limitations under the License. 4167 *) 4168 4169@firebase/app/dist/esm/index.esm.js: 4170 (** 4171 * @license 4172 * Copyright 2021 Google LLC 4173 * 4174 * Licensed under the Apache License, Version 2.0 (the "License"); 4175 * you may not use this file except in compliance with the License. 4176 * You may obtain a copy of the License at 4177 * 4178 * http://www.apache.org/licenses/LICENSE-2.0 4179 * 4180 * Unless required by applicable law or agreed to in writing, software 4181 * distributed under the License is distributed on an "AS IS" BASIS, 4182 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4183 * See the License for the specific language governing permissions and 4184 * limitations under the License. 4185 *) 4186 (** 4187 * @license 4188 * Copyright 2019 Google LLC 4189 * 4190 * Licensed under the Apache License, Version 2.0 (the "License"); 4191 * you may not use this file except in compliance with the License. 4192 * You may obtain a copy of the License at 4193 * 4194 * http://www.apache.org/licenses/LICENSE-2.0 4195 * 4196 * Unless required by applicable law or agreed to in writing, software 4197 * distributed under the License is distributed on an "AS IS" BASIS, 4198 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4199 * See the License for the specific language governing permissions and 4200 * limitations under the License. 4201 *) 4202 4203firebase/app/dist/esm/index.esm.js: 4204 (** 4205 * @license 4206 * Copyright 2020 Google LLC 4207 * 4208 * Licensed under the Apache License, Version 2.0 (the "License"); 4209 * you may not use this file except in compliance with the License. 4210 * You may obtain a copy of the License at 4211 * 4212 * http://www.apache.org/licenses/LICENSE-2.0 4213 * 4214 * Unless required by applicable law or agreed to in writing, software 4215 * distributed under the License is distributed on an "AS IS" BASIS, 4216 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4217 * See the License for the specific language governing permissions and 4218 * limitations under the License. 4219 *) 4220 4221@firebase/installations/dist/esm/index.esm.js: 4222 (** 4223 * @license 4224 * Copyright 2019 Google LLC 4225 * 4226 * Licensed under the Apache License, Version 2.0 (the "License"); 4227 * you may not use this file except in compliance with the License. 4228 * You may obtain a copy of the License at 4229 * 4230 * http://www.apache.org/licenses/LICENSE-2.0 4231 * 4232 * Unless required by applicable law or agreed to in writing, software 4233 * distributed under the License is distributed on an "AS IS" BASIS, 4234 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4235 * See the License for the specific language governing permissions and 4236 * limitations under the License. 4237 *) 4238 4239@firebase/installations/dist/esm/index.esm.js: 4240 (** 4241 * @license 4242 * Copyright 2019 Google LLC 4243 * 4244 * Licensed under the Apache License, Version 2.0 (the "License");
4245 * you may not use this file except in compliance with the License. 4246 * You may obtain a copy of the License at 4247 * 4248 * http://www.apache.org/licenses/LICENSE-2.0 4249 * 4250 * Unless required by applicable law or agreed to in writing, software 4251 * distributed under the License is distributed on an "AS IS" BASIS, 4252 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4253 * See the License for the specific language governing permissions and 4254 * limitations under the License. 4255 *) 4256 4257@firebase/installations/dist/esm/index.esm.js: 4258 (** 4259 * @license 4260 * Copyright 2019 Google LLC 4261 * 4262 * Licensed under the Apache License, Version 2.0 (the "License"); 4263 * you may not use this file except in compliance with the License. 4264 * You may obtain a copy of the License at 4265 * 4266 * http://www.apache.org/licenses/LICENSE-2.0 4267 * 4268 * Unless required by applicable law or agreed to in writing, software 4269 * distributed under the License is distributed on an "AS IS" BASIS, 4270 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4271 * See the License for the specific language governing permissions and 4272 * limitations under the License. 4273 *) 4274 4275@firebase/installations/dist/esm/index.esm.js: 4276 (** 4277 * @license 4278 * Copyright 2019 Google LLC 4279 * 4280 * Licensed under the Apache License, Version 2.0 (the "License"); 4281 * you may not use this file except in compliance with the License. 4282 * You may obtain a copy of the License at 4283 * 4284 * http://www.apache.org/licenses/LICENSE-2.0 4285 * 4286 * Unless required by applicable law or agreed to in writing, software 4287 * distributed under the License is distributed on an "AS IS" BASIS, 4288 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4289 * See the License for the specific language governing permissions and 4290 * limitations under the License. 4291 *) 4292 4293@firebase/installations/dist/esm/index.esm.js: 4294 (** 4295 * @license 4296 * Copyright 2020 Google LLC 4297 * 4298 * Licensed under the Apache License, Version 2.0 (the "License"); 4299 * you may not use this file except in compliance with the License. 4300 * You may obtain a copy of the License at 4301 * 4302 * http://www.apache.org/licenses/LICENSE-2.0 4303 * 4304 * Unless required by applicable law or agreed to in writing, software 4305 * distributed under the License is distributed on an "AS IS" BASIS, 4306 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4307 * See the License for the specific language governing permissions and 4308 * limitations under the License. 4309 *) 4310 4311@firebase/installations/dist/esm/index.esm.js: 4312 (** 4313 * @license 4314 * Copyright 2019 Google LLC 4315 * 4316 * Licensed under the Apache License, Version 2.0 (the "License"); 4317 * you may not use this file except in compliance with the License. 4318 * You may obtain a copy of the License at 4319 * 4320 * http://www.apache.org/licenses/LICENSE-2.0 4321 * 4322 * Unless required by applicable law or agreed to in writing, software 4323 * distributed under the License is distributed on an "AS IS" BASIS, 4324 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4325 * See the License for the specific language governing permissions and 4326 * limitations under the License. 4327 *) 4328 (** 4329 * @license 4330 * Copyright 2020 Google LLC 4331 * 4332 * Licensed under the Apache License, Version 2.0 (the "License"); 4333 * you may not use this file except in compliance with the License. 4334 * You may obtain a copy of the License at 4335 * 4336 * http://www.apache.org/licenses/LICENSE-2.0 4337 * 4338 * Unless required by applicable law or agreed to in writing, software 4339 * distributed under the License is distributed on an "AS IS" BASIS, 4340 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4341 * See the License for the specific language governing permissions and 4342 * limitations under the License. 4343 *) 4344 4345@firebase/messaging/dist/esm/index.sw.esm.js: 4346 (** 4347 * @license 4348 * Copyright 2019 Google LLC 4349 * 4350 * Licensed under the Apache License, Version 2.0 (the "License"); 4351 * you may not use this file except in compliance with the License. 4352 * You may obtain a copy of the License at 4353 * 4354 * http://www.apache.org/licenses/LICENSE-2.0 4355 * 4356 * Unless required by applicable law or agreed to in writing, softw
4356are 4357 * distributed under the License is distributed on an "AS IS" BASIS, 4358 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4359 * See the License for the specific language governing permissions and 4360 * limitations under the License. 4361 *) 4362 (** 4363 * @license 4364 * Copyright 2018 Google LLC 4365 * 4366 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 4367 * in compliance with the License. You may obtain a copy of the License at 4368 * 4369 * http://www.apache.org/licenses/LICENSE-2.0 4370 * 4371 * Unless required by applicable law or agreed to in writing, software distributed under the License 4372 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 4373 * or implied. See the License for the specific language governing permissions and limitations under 4374 * the License. 4375 *) 4376 (** 4377 * @license 4378 * Copyright 2017 Google LLC 4379 * 4380 * Licensed under the Apache License, Version 2.0 (the "License"); 4381 * you may
4381not use this file except in compliance with the License. 4382 * You may obtain a copy of the License at 4383 * 4384 * http://www.apache.org/licenses/LICENSE-2.0 4385 * 4386 * Unless required by applicable law or agreed to in writing, software 4387 * distributed under the License is distributed on an "AS IS" BASIS, 4388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4389 * See the License for the specific language governing permissions and 4390 * limitations under the License. 4391 *) 4392 (** 4393 * @license 4394 * Copyright 2020 Google LLC 4395 * 4396 * Licensed under the Apache License, Version 2.0 (the "License"); 4397 * you may not use this file except in compliance with the License. 4398 * You may obtain a copy of the License at 4399 * 4400 * http://www.apache.org/licenses/LICENSE-2.0 4401 * 4402 * Unless required by applicable law or agreed to in writing, software 4403 * distributed under the License is distributed on an "AS IS" BASIS, 4404 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4405 * See the License for the specific language governing permissions and 4406 * limitations under the License. 4407 *) 4408 (** 4409 * @license 4410 * Copyright 2026 Google LLC 4411 * 4412 * Licensed under the Apache License, Version 2.0 (the "License"); 4413 * you may not use this file except in compliance with the License. 4414 * You may obtain a copy of the License at 4415 * 4416 * http://www.apache.org/licenses/LICENSE-2.0 4417 * 4418 * Unless required by applicable law or agreed to in writing, software 4419 * distributed under the License is distributed on an "AS IS" BASIS, 4420 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4421 * See the License for the specific language governing permissions and 4422 * limitations under the License. 4423 *) 4424 4425@firebase/messaging/dist/esm/index.sw.esm.js: 4426 (** 4427 * @license 4428 * Copyright 2017 Google LLC 4429 * 4430 * Licensed under the Apache License, Version 2.0 (the "License"); 4431 * you may not use this file except in compliance with the License. 4432 * You may obtain a copy of the License at 4433 * 4434 * http://www.apache.org/licenses/LICENSE-2.0 4435 * 4436 * Unless required by applicable law or agreed to in writing, software 4437 * distributed under the License is distributed on an "AS IS" BASIS, 4438 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4439 * See the License for the specific language governing permissions and 4440 * limitations under the License. 4441 *) 4442 (** 4443 * @license 4444 * Copyright 2019 Google LLC 4445 * 4446 * Licensed under the Apache License, Version 2.0 (the "License"); 4447 * you may not use this file except in compliance with the License. 4448 * You may obtain a copy of the License at 4449 * 4450 * http://www.apache.org/licenses/LICENSE-2.0 4451 * 4452 * Unless required by applicable law or agreed to in writing, software 4453 * distributed under the License is distributed on an "AS IS" BASIS, 4454 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4455 * See the License for the specific language governing permissions and 4456 * limitations under the License. 4457 *) 4458 (** 4459 * @license 4460 * Copyright 2020 Google LLC 4461 * 4462 * Licensed under the Apache License, Version 2.0 (the "License"); 4463 * you may not use this file except in compliance with the License. 4464 * You may obtain a copy of the License at 4465 * 4466 * http://www.apache.org/licenses/LICENSE-2.0 4467 * 4468 * Unless required by applicable law or agreed to in writing, software 4469 * distributed under the License is distributed on an "AS IS" BASIS, 4470 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4471 * See the License for the specific language governing permissions and 4472 * limitations under the License. 4473 *) 4474 4475@firebase/messaging/dist/esm/index.sw.esm.js: 4476 (** 4477 * @license 4478 * Copyright 2026 Google LLC 4479 * 4480 * Licensed under the Apache License, Version 2.0 (the "License"); 4481 * you may not use this file except in compliance with the License. 4482 * You may obtain a copy of the License at 4483 * 4484 * http://www.apache.org/licenses/LICENSE-2.0 4485 * 4486 * Unless required by applicable law or agreed to in writing, softw
4486are 4487 * distributed under the License is distributed on an "AS IS" BASIS, 4488 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4489 * See the License for the specific language governing permissions and 4490 * limitations under the License. 4491 *) 4492 4493@firebase/messaging/dist/esm/index.sw.esm.js: 4494 (** 4495 * @license 4496 * Copyright 2020 Google LLC 4497 * 4498 * Licensed under the Apache License, Version 2.0 (the "License"); 4499 * you may not use this file except in compliance with the License. 4500 * You may obtain a copy of the License at 4501 * 4502 * http://www.apache.org/licenses/LICENSE-2.0 4503 * 4504 * Unless required by applicable law or agreed to in writing, software 4505 * distributed under the License is distributed on an "AS IS" BASIS, 4506 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4507 * See the License for the specific language governing permissions and 4508 * limitations under the License. 4509 *) 4510 4511@firebase/messaging/dist/esm/index.sw.esm.js: 4512 (** 4513 * @license 4514 * Copyright 2017 Google LLC 4515 * 4516 * Licensed under the Apache License, Version 2.0 (the "License"); 4517 * you may not use this file except in compliance with the License. 4518 * You may obtain a copy of the License at 4519 * 4520 * http://www.apache.org/licenses/LICENSE-2.0 4521 * 4522 * Unless required by applicable law or agreed to in writing, software 4523 * distributed under the License is distributed on an "AS IS" BASIS, 4524 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4525 * See the License for the specific language governing permissions and 4526 * limitations under the License. 4527 *) 4528 4529@firebase/messaging/dist/esm/index.sw.esm.js: 4530 (** 4531 * @license 4532 * Copyright 2017 Google LLC 4533 * 4534 * Licensed under the Apache License, Version 2.0 (the "License"); 4535 * you may not use this file except in compliance with the License. 4536 * You may obtain a copy of the License at 4537 * 4538 * http://www.apache.org/licenses/LICENSE-2.0 4539 * 4540 * Unless required by applicable law or agreed to in writing, software 4541 * distributed under the License is distributed on an "AS IS" BASIS, 4542 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4543 * See the License for the specific language governing permissions and 4544 * limitations under the License. 4545 *) 4546*/ 4547//# sourceMappingURL=firebase-messaging-sw.js.map
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.