-
Notifications
You must be signed in to change notification settings - Fork 0
/
99.render-page.js
3372 lines (3290 loc) · 126 KB
/
99.render-page.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"use strict";
exports.id = 99;
exports.ids = [99];
exports.modules = {
/***/ 6099:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* unused harmony export firebase */
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(655);
/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4589);
/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(909);
/* harmony import */ var _firebase_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4594);
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var _a$1;
var ERRORS = (_a$1 = {},
_a$1["no-app" /* NO_APP */] = "No Firebase App '{$appName}' has been created - " +
'call Firebase App.initializeApp()',
_a$1["bad-app-name" /* BAD_APP_NAME */] = "Illegal App name: '{$appName}",
_a$1["duplicate-app" /* DUPLICATE_APP */] = "Firebase App named '{$appName}' already exists",
_a$1["app-deleted" /* APP_DELETED */] = "Firebase App named '{$appName}' already deleted",
_a$1["invalid-app-argument" /* INVALID_APP_ARGUMENT */] = 'firebase.{$appName}() takes either no argument or a ' +
'Firebase App instance.',
_a$1["invalid-log-argument" /* INVALID_LOG_ARGUMENT */] = 'First argument to `onLog` must be null or a function.',
_a$1);
var ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .ErrorFactory */ .LL('app', 'Firebase', ERRORS);
var name$c = "@firebase/app";
var version$1 = "0.6.30";
var name$b = "@firebase/analytics";
var name$a = "@firebase/app-check";
var name$9 = "@firebase/auth";
var name$8 = "@firebase/database";
var name$7 = "@firebase/functions";
var name$6 = "@firebase/installations";
var name$5 = "@firebase/messaging";
var name$4 = "@firebase/performance";
var name$3 = "@firebase/remote-config";
var name$2 = "@firebase/storage";
var name$1 = "@firebase/firestore";
var name = "firebase-wrapper";
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var _a;
var DEFAULT_ENTRY_NAME = '[DEFAULT]';
var PLATFORM_LOG_STRING = (_a = {},
_a[name$c] = 'fire-core',
_a[name$b] = 'fire-analytics',
_a[name$a] = 'fire-app-check',
_a[name$9] = 'fire-auth',
_a[name$8] = 'fire-rtdb',
_a[name$7] = 'fire-fn',
_a[name$6] = 'fire-iid',
_a[name$5] = 'fire-fcm',
_a[name$4] = 'fire-perf',
_a[name$3] = 'fire-rc',
_a[name$2] = 'fire-gcs',
_a[name$1] = 'fire-fst',
_a['fire-js'] = 'fire-js',
_a[name] = 'fire-js-all',
_a);
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var logger = new _firebase_logger__WEBPACK_IMPORTED_MODULE_2__/* .Logger */ .Yd('@firebase/app');
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Global context object for a collection of services using
* a shared authentication state.
*/
var FirebaseAppImpl = /** @class */ (function () {
function FirebaseAppImpl(options, config, firebase_) {
var _this = this;
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.name_ = config.name;
this.automaticDataCollectionEnabled_ =
config.automaticDataCollectionEnabled || false;
this.options_ = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .deepCopy */ .p$)(options);
this.container = new _firebase_component__WEBPACK_IMPORTED_MODULE_1__/* .ComponentContainer */ .H0(config.name);
// add itself to container
this._addComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__/* .Component */ .wA('app', function () { return _this; }, "PUBLIC" /* PUBLIC */));
// populate ComponentContainer with existing components
this.firebase_.INTERNAL.components.forEach(function (component) {
return _this._addComponent(component);
});
}
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", {
get: function () {
this.checkDestroyed_();
return this.automaticDataCollectionEnabled_;
},
set: function (val) {
this.checkDestroyed_();
this.automaticDataCollectionEnabled_ = val;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "name", {
get: function () {
this.checkDestroyed_();
return this.name_;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "options", {
get: function () {
this.checkDestroyed_();
return this.options_;
},
enumerable: false,
configurable: true
});
FirebaseAppImpl.prototype.delete = function () {
var _this = this;
return new Promise(function (resolve) {
_this.checkDestroyed_();
resolve();
})
.then(function () {
_this.firebase_.INTERNAL.removeApp(_this.name_);
return Promise.all(_this.container.getProviders().map(function (provider) { return provider.delete(); }));
})
.then(function () {
_this.isDeleted_ = true;
});
};
/**
* Return a service instance associated with this app (creating it
* on demand), identified by the passed instanceIdentifier.
*
* NOTE: Currently storage and functions are the only ones that are leveraging this
* functionality. They invoke it by calling:
*
* ```javascript
* firebase.app().storage('STORAGE BUCKET ID')
* ```
*
* The service name is passed to this already
* @internal
*/
FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) {
var _a;
if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }
this.checkDestroyed_();
// Initialize instance if InstatiationMode is `EXPLICIT`.
var provider = this.container.getProvider(name);
if (!provider.isInitialized() &&
((_a = provider.getComponent()) === null || _a === void 0 ? void 0 : _a.instantiationMode) === "EXPLICIT" /* EXPLICIT */) {
provider.initialize();
}
// getImmediate will always succeed because _getService is only called for registered components.
return provider.getImmediate({
identifier: instanceIdentifier
});
};
/**
* Remove a service instance from the cache, so we will create a new instance for this service
* when people try to get this service again.
*
* NOTE: currently only firestore is using this functionality to support firestore shutdown.
*
* @param name The service name
* @param instanceIdentifier instance identifier in case multiple instances are allowed
* @internal
*/
FirebaseAppImpl.prototype._removeServiceInstance = function (name, instanceIdentifier) {
if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.container.getProvider(name).clearInstance(instanceIdentifier);
};
/**
* @param component the component being added to this app's container
*/
FirebaseAppImpl.prototype._addComponent = function (component) {
try {
this.container.addComponent(component);
}
catch (e) {
logger.debug("Component " + component.name + " failed to register with FirebaseApp " + this.name, e);
}
};
FirebaseAppImpl.prototype._addOrOverwriteComponent = function (component) {
this.container.addOrOverwriteComponent(component);
};
FirebaseAppImpl.prototype.toJSON = function () {
return {
name: this.name,
automaticDataCollectionEnabled: this.automaticDataCollectionEnabled,
options: this.options
};
};
/**
* This function will throw an Error if the App has already been deleted -
* use before performing API actions on the App.
*/
FirebaseAppImpl.prototype.checkDestroyed_ = function () {
if (this.isDeleted_) {
throw ERROR_FACTORY.create("app-deleted" /* APP_DELETED */, { appName: this.name_ });
}
};
return FirebaseAppImpl;
}());
// Prevent dead-code elimination of these methods w/o invalid property
// copying.
(FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||
FirebaseAppImpl.prototype.delete ||
console.log('dc');
var version = "8.10.0";
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Because auth can't share code with other components, we attach the utility functions
* in an internal namespace to share code.
* This function return a firebase namespace object without
* any utility functions, so it can be shared between the regular firebaseNamespace and
* the lite version.
*/
function createFirebaseNamespaceCore(firebaseAppImpl) {
var apps = {};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var components = new Map();
// A namespace is a plain JavaScript Object.
var namespace = {
// Hack to prevent Babel from modifying the object returned
// as the firebase namespace.
// @ts-ignore
__esModule: true,
initializeApp: initializeApp,
// @ts-ignore
app: app,
registerVersion: registerVersion,
setLogLevel: _firebase_logger__WEBPACK_IMPORTED_MODULE_2__/* .setLogLevel */ .Ub,
onLog: onLog,
// @ts-ignore
apps: null,
SDK_VERSION: version,
INTERNAL: {
registerComponent: registerComponent,
removeApp: removeApp,
components: components,
useAsService: useAsService
}
};
// Inject a circular default export to allow Babel users who were previously
// using:
//
// import firebase from 'firebase';
// which becomes: var firebase = require('firebase').default;
//
// instead of
//
// import * as firebase from 'firebase';
// which becomes: var firebase = require('firebase');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
namespace['default'] = namespace;
// firebase.apps is a read-only getter.
Object.defineProperty(namespace, 'apps', {
get: getApps
});
/**
* Called by App.delete() - but before any services associated with the App
* are deleted.
*/
function removeApp(name) {
delete apps[name];
}
/**
* Get the App object for a given name (or DEFAULT).
*/
function app(name) {
name = name || DEFAULT_ENTRY_NAME;
if (!(0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .contains */ .r3)(apps, name)) {
throw ERROR_FACTORY.create("no-app" /* NO_APP */, { appName: name });
}
return apps[name];
}
// @ts-ignore
app['App'] = firebaseAppImpl;
function initializeApp(options, rawConfig) {
if (rawConfig === void 0) { rawConfig = {}; }
if (typeof rawConfig !== 'object' || rawConfig === null) {
var name_1 = rawConfig;
rawConfig = { name: name_1 };
}
var config = rawConfig;
if (config.name === undefined) {
config.name = DEFAULT_ENTRY_NAME;
}
var name = config.name;
if (typeof name !== 'string' || !name) {
throw ERROR_FACTORY.create("bad-app-name" /* BAD_APP_NAME */, {
appName: String(name)
});
}
if ((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .contains */ .r3)(apps, name)) {
throw ERROR_FACTORY.create("duplicate-app" /* DUPLICATE_APP */, { appName: name });
}
var app = new firebaseAppImpl(options, config, namespace);
apps[name] = app;
return app;
}
/*
* Return an array of all the non-deleted FirebaseApps.
*/
function getApps() {
// Make a copy so caller cannot mutate the apps list.
return Object.keys(apps).map(function (name) { return apps[name]; });
}
function registerComponent(component) {
var componentName = component.name;
if (components.has(componentName)) {
logger.debug("There were multiple attempts to register component " + componentName + ".");
return component.type === "PUBLIC" /* PUBLIC */
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
namespace[componentName]
: null;
}
components.set(componentName, component);
// create service namespace for public components
if (component.type === "PUBLIC" /* PUBLIC */) {
// The Service namespace is an accessor function ...
var serviceNamespace = function (appArg) {
if (appArg === void 0) { appArg = app(); }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (typeof appArg[componentName] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
throw ERROR_FACTORY.create("invalid-app-argument" /* INVALID_APP_ARGUMENT */, {
appName: componentName
});
}
// Forward service instance lookup to the FirebaseApp.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return appArg[componentName]();
};
// ... and a container for service-level properties.
if (component.serviceProps !== undefined) {
(0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .deepExtend */ .ZB)(serviceNamespace, component.serviceProps);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
namespace[componentName] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
// eslint-disable-next-line @typescript-eslint/no-explicit-any
firebaseAppImpl.prototype[componentName] =
// TODO: The eslint disable can be removed and the 'ignoreRestArgs'
// option added to the no-explicit-any rule when ESlint releases it.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var serviceFxn = this._getService.bind(this, componentName);
return serviceFxn.apply(this, component.multipleInstances ? args : []);
};
}
// add the component to existing app instances
for (var _i = 0, _a = Object.keys(apps); _i < _a.length; _i++) {
var appName = _a[_i];
apps[appName]._addComponent(component);
}
return component.type === "PUBLIC" /* PUBLIC */
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
namespace[componentName]
: null;
}
function registerVersion(libraryKeyOrName, version, variant) {
var _a;
// TODO: We can use this check to whitelist strings when/if we set up
// a good whitelist system.
var library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;
if (variant) {
library += "-" + variant;
}
var libraryMismatch = library.match(/\s|\//);
var versionMismatch = version.match(/\s|\//);
if (libraryMismatch || versionMismatch) {
var warning = [
"Unable to register library \"" + library + "\" with version \"" + version + "\":"
];
if (libraryMismatch) {
warning.push("library name \"" + library + "\" contains illegal characters (whitespace or \"/\")");
}
if (libraryMismatch && versionMismatch) {
warning.push('and');
}
if (versionMismatch) {
warning.push("version name \"" + version + "\" contains illegal characters (whitespace or \"/\")");
}
logger.warn(warning.join(' '));
return;
}
registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__/* .Component */ .wA(library + "-version", function () { return ({ library: library, version: version }); }, "VERSION" /* VERSION */));
}
function onLog(logCallback, options) {
if (logCallback !== null && typeof logCallback !== 'function') {
throw ERROR_FACTORY.create("invalid-log-argument" /* INVALID_LOG_ARGUMENT */);
}
(0,_firebase_logger__WEBPACK_IMPORTED_MODULE_2__/* .setUserLogHandler */ .Am)(logCallback, options);
}
// Map the requested service to a registered service name
// (used to map auth to serverAuth service when needed).
function useAsService(app, name) {
if (name === 'serverAuth') {
return null;
}
var useService = name;
return useService;
}
return namespace;
}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Return a firebase namespace object.
*
* In production, this will be called exactly once and the result
* assigned to the 'firebase' global. It may be called multiple times
* in unit tests.
*/
function createFirebaseNamespace() {
var namespace = createFirebaseNamespaceCore(FirebaseAppImpl);
namespace.INTERNAL = (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__assign */ .pi)((0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__assign */ .pi)({}, namespace.INTERNAL), { createFirebaseNamespace: createFirebaseNamespace,
extendNamespace: extendNamespace,
createSubscribe: _firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .createSubscribe */ .ne,
ErrorFactory: _firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .ErrorFactory */ .LL,
deepExtend: _firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .deepExtend */ .ZB });
/**
* Patch the top-level firebase namespace with additional properties.
*
* firebase.INTERNAL.extendNamespace()
*/
function extendNamespace(props) {
(0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .deepExtend */ .ZB)(namespace, props);
}
return namespace;
}
var firebase$1 = createFirebaseNamespace();
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var PlatformLoggerService = /** @class */ (function () {
function PlatformLoggerService(container) {
this.container = container;
}
// In initial implementation, this will be called by installations on
// auth token refresh, and installations will send this string.
PlatformLoggerService.prototype.getPlatformInfoString = function () {
var providers = this.container.getProviders();
// Loop through providers and get library/version pairs from any that are
// version components.
return providers
.map(function (provider) {
if (isVersionServiceProvider(provider)) {
var service = provider.getImmediate();
return service.library + "/" + service.version;
}
else {
return null;
}
})
.filter(function (logString) { return logString; })
.join(' ');
};
return PlatformLoggerService;
}());
/**
*
* @param provider check if this provider provides a VersionService
*
* NOTE: Using Provider<'app-version'> is a hack to indicate that the provider
* provides VersionService. The provider is not necessarily a 'app-version'
* provider.
*/
function isVersionServiceProvider(provider) {
var component = provider.getComponent();
return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* VERSION */;
}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function registerCoreComponents(firebase, variant) {
firebase.INTERNAL.registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__/* .Component */ .wA('platform-logger', function (container) { return new PlatformLoggerService(container); }, "PRIVATE" /* PRIVATE */));
// Register `app` package.
firebase.registerVersion(name$c, version$1, variant);
// Register platform SDK identifier (no version).
firebase.registerVersion('fire-js', '');
}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Firebase Lite detection test
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if ((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .isBrowser */ .jU)() && self.firebase !== undefined) {
logger.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n ");
// eslint-disable-next-line
var sdkVersion = self.firebase.SDK_VERSION;
if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) {
logger.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ");
}
}
var initializeApp = firebase$1.initializeApp;
// TODO: This disable can be removed and the 'ignoreRestArgs' option added to
// the no-explicit-any rule when ESlint releases it.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
firebase$1.initializeApp = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
// Environment check before initializing app
// Do the check in initializeApp, so people have a chance to disable it by setting logLevel
// in @firebase/logger
if ((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .isNode */ .UG)()) {
logger.warn("\n Warning: This is a browser-targeted Firebase bundle but it appears it is being\n run in a Node environment. If running in a Node environment, make sure you\n are using the bundle specified by the \"main\" field in package.json.\n \n If you are using Webpack, you can specify \"main\" as the first item in\n \"resolve.mainFields\":\n https://webpack.js.org/configuration/resolve/#resolvemainfields\n \n If using Rollup, use the @rollup/plugin-node-resolve plugin and specify \"main\"\n as the first item in \"mainFields\", e.g. ['main', 'module'].\n https://github.com/rollup/@rollup/plugin-node-resolve\n ");
}
return initializeApp.apply(undefined, args);
};
var firebase = firebase$1;
registerCoreComponents(firebase);
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (firebase);
//# sourceMappingURL=index.esm.js.map
/***/ }),
/***/ 909:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "wA": () => (/* binding */ Component),
/* harmony export */ "H0": () => (/* binding */ ComponentContainer)
/* harmony export */ });
/* unused harmony export Provider */
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(655);
/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4589);
/**
* Component for service name T, e.g. `auth`, `auth-internal`
*/
var Component = /** @class */ (function () {
/**
*
* @param name The public service name, e.g. app, auth, firestore, database
* @param instanceFactory Service factory responsible for creating the public interface
* @param type whether the service provided by the component is public or private
*/
function Component(name, instanceFactory, type) {
this.name = name;
this.instanceFactory = instanceFactory;
this.type = type;
this.multipleInstances = false;
/**
* Properties to be added to the service namespace
*/
this.serviceProps = {};
this.instantiationMode = "LAZY" /* LAZY */;
this.onInstanceCreated = null;
}
Component.prototype.setInstantiationMode = function (mode) {
this.instantiationMode = mode;
return this;
};
Component.prototype.setMultipleInstances = function (multipleInstances) {
this.multipleInstances = multipleInstances;
return this;
};
Component.prototype.setServiceProps = function (props) {
this.serviceProps = props;
return this;
};
Component.prototype.setInstanceCreatedCallback = function (callback) {
this.onInstanceCreated = callback;
return this;
};
return Component;
}());
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var DEFAULT_ENTRY_NAME = '[DEFAULT]';
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Provider for instance for service name T, e.g. 'auth', 'auth-internal'
* NameServiceMapping[T] is an alias for the type of the instance
*/
var Provider = /** @class */ (function () {
function Provider(name, container) {
this.name = name;
this.container = container;
this.component = null;
this.instances = new Map();
this.instancesDeferred = new Map();
this.instancesOptions = new Map();
this.onInitCallbacks = new Map();
}
/**
* @param identifier A provider can provide mulitple instances of a service
* if this.component.multipleInstances is true.
*/
Provider.prototype.get = function (identifier) {
// if multipleInstances is not supported, use the default name
var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);
if (!this.instancesDeferred.has(normalizedIdentifier)) {
var deferred = new _firebase_util__WEBPACK_IMPORTED_MODULE_0__/* .Deferred */ .BH();
this.instancesDeferred.set(normalizedIdentifier, deferred);
if (this.isInitialized(normalizedIdentifier) ||
this.shouldAutoInitialize()) {
// initialize the service if it can be auto-initialized
try {
var instance = this.getOrInitializeService({
instanceIdentifier: normalizedIdentifier
});
if (instance) {
deferred.resolve(instance);
}
}
catch (e) {
// when the instance factory throws an exception during get(), it should not cause
// a fatal error. We just return the unresolved promise in this case.
}
}
}
return this.instancesDeferred.get(normalizedIdentifier).promise;
};
Provider.prototype.getImmediate = function (options) {
var _a;
// if multipleInstances is not supported, use the default name
var normalizedIdentifier = this.normalizeInstanceIdentifier(options === null || options === void 0 ? void 0 : options.identifier);
var optional = (_a = options === null || options === void 0 ? void 0 : options.optional) !== null && _a !== void 0 ? _a : false;
if (this.isInitialized(normalizedIdentifier) ||
this.shouldAutoInitialize()) {
try {
return this.getOrInitializeService({
instanceIdentifier: normalizedIdentifier
});
}
catch (e) {
if (optional) {
return null;
}
else {
throw e;
}
}
}
else {
// In case a component is not initialized and should/can not be auto-initialized at the moment, return null if the optional flag is set, or throw
if (optional) {
return null;
}
else {
throw Error("Service " + this.name + " is not available");
}
}
};
Provider.prototype.getComponent = function () {
return this.component;
};
Provider.prototype.setComponent = function (component) {
var e_1, _a;
if (component.name !== this.name) {
throw Error("Mismatching Component " + component.name + " for Provider " + this.name + ".");
}
if (this.component) {
throw Error("Component for " + this.name + " has already been provided");
}
this.component = component;
// return early without attempting to initialize the component if the component requires explicit initialization (calling `Provider.initialize()`)
if (!this.shouldAutoInitialize()) {
return;
}
// if the service is eager, initialize the default instance
if (isComponentEager(component)) {
try {
this.getOrInitializeService({ instanceIdentifier: DEFAULT_ENTRY_NAME });
}
catch (e) {
// when the instance factory for an eager Component throws an exception during the eager
// initialization, it should not cause a fatal error.
// TODO: Investigate if we need to make it configurable, because some component may want to cause
// a fatal error in this case?
}
}
try {
// Create service instances for the pending promises and resolve them
// NOTE: if this.multipleInstances is false, only the default instance will be created
// and all promises with resolve with it regardless of the identifier.
for (var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__values */ .XA)(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__read */ .CR)(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1];
var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);
try {
// `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy.
var instance = this.getOrInitializeService({
instanceIdentifier: normalizedIdentifier
});
instanceDeferred.resolve(instance);
}
catch (e) {
// when the instance factory throws an exception, it should not cause
// a fatal error. We just leave the promise unresolved.
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
Provider.prototype.clearInstance = function (identifier) {
if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; }
this.instancesDeferred.delete(identifier);
this.instancesOptions.delete(identifier);
this.instances.delete(identifier);
};
// app.delete() will call this method on every provider to delete the services
// TODO: should we mark the provider as deleted?
Provider.prototype.delete = function () {
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__awaiter */ .mG)(this, void 0, void 0, function () {
var services;
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__generator */ .Jh)(this, function (_a) {
switch (_a.label) {
case 0:
services = Array.from(this.instances.values());
return [4 /*yield*/, Promise.all((0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__spreadArray */ .ev)((0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__spreadArray */ .ev)([], (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__read */ .CR)(services
.filter(function (service) { return 'INTERNAL' in service; }) // legacy services
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.map(function (service) { return service.INTERNAL.delete(); }))), (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__read */ .CR)(services
.filter(function (service) { return '_delete' in service; }) // modularized services
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.map(function (service) { return service._delete(); }))))];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
};
Provider.prototype.isComponentSet = function () {
return this.component != null;
};
Provider.prototype.isInitialized = function (identifier) {
if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; }
return this.instances.has(identifier);
};
Provider.prototype.getOptions = function (identifier) {
if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; }
return this.instancesOptions.get(identifier) || {};
};
Provider.prototype.initialize = function (opts) {
var e_2, _a;
if (opts === void 0) { opts = {}; }
var _b = opts.options, options = _b === void 0 ? {} : _b;
var normalizedIdentifier = this.normalizeInstanceIdentifier(opts.instanceIdentifier);
if (this.isInitialized(normalizedIdentifier)) {
throw Error(this.name + "(" + normalizedIdentifier + ") has already been initialized");
}
if (!this.isComponentSet()) {
throw Error("Component " + this.name + " has not been registered yet");
}
var instance = this.getOrInitializeService({
instanceIdentifier: normalizedIdentifier,
options: options
});
try {
// resolve any pending promise waiting for the service instance
for (var _c = (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__values */ .XA)(this.instancesDeferred.entries()), _d = _c.next(); !_d.done; _d = _c.next()) {
var _e = (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__read */ .CR)(_d.value, 2), instanceIdentifier = _e[0], instanceDeferred = _e[1];
var normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);
if (normalizedIdentifier === normalizedDeferredIdentifier) {
instanceDeferred.resolve(instance);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_2) throw e_2.error; }
}
return instance;
};
/**
*
* @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().
* The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.
*
* @param identifier An optional instance identifier
* @returns a function to unregister the callback
*/
Provider.prototype.onInit = function (callback, identifier) {
var _a;
var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);
var existingCallbacks = (_a = this.onInitCallbacks.get(normalizedIdentifier)) !== null && _a !== void 0 ? _a : new Set();
existingCallbacks.add(callback);
this.onInitCallbacks.set(normalizedIdentifier, existingCallbacks);
var existingInstance = this.instances.get(normalizedIdentifier);
if (existingInstance) {
callback(existingInstance, normalizedIdentifier);
}
return function () {
existingCallbacks.delete(callback);
};
};
/**
* Invoke onInit callbacks synchronously