· 5 years ago · Jan 30, 2021, 07:32 PM
1(window["wpJsonpUD"] = window["wpJsonpUD"] || []).push([[7],{
2
3/***/ "1uHz":
4/***/ (function(module, __webpack_exports__, __webpack_require__) {
5
6"use strict";
7/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return base32Encode; });
8/* unused harmony export base32Decode */
9/* unused harmony export hexToArrayBuffer */
10const RFC4648 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
11const RFC4648_HEX = '0123456789ABCDEFGHIJKLMNOPQRSTUV';
12const CROCKFORD = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
13function base32Encode(buffer, variant = 'RFC4648', options = {}) {
14 let alphabet;
15 let defaultPadding;
16 switch (variant) {
17 case 'RFC3548':
18 case 'RFC4648':
19 alphabet = RFC4648;
20 defaultPadding = true;
21 break;
22 case 'RFC4648-HEX':
23 alphabet = RFC4648_HEX;
24 defaultPadding = true;
25 break;
26 case 'Crockford':
27 alphabet = CROCKFORD;
28 defaultPadding = false;
29 break;
30 default:
31 throw new Error(`Unknown base32 variant: ${variant}`);
32 }
33 const padding = options.padding === undefined ? defaultPadding : options.padding;
34 const length = buffer.byteLength;
35 const view = new Uint8Array(buffer);
36 let bits = 0;
37 let value = 0;
38 let output = '';
39 for (let i = 0; i < length; i++) {
40 value = (value << 8) | view[i];
41 bits += 8;
42 while (bits >= 5) {
43 output += alphabet[(value >>> (bits - 5)) & 31];
44 bits -= 5;
45 }
46 }
47 if (bits > 0) {
48 output += alphabet[(value << (5 - bits)) & 31];
49 }
50 if (padding) {
51 while (output.length % 8 !== 0) {
52 output += '=';
53 }
54 }
55 return output;
56}
57function readChar(alphabet, char) {
58 const idx = alphabet.indexOf(char);
59 if (idx === -1) {
60 throw new Error('Invalid character found: ' + char);
61 }
62 return idx;
63}
64function base32Decode(input, variant = 'RFC4648') {
65 let alphabet;
66 let cleanedInput;
67 switch (variant) {
68 case 'RFC3548':
69 case 'RFC4648':
70 alphabet = RFC4648;
71 // eslint-disable-next-line no-useless-escape
72 cleanedInput = input.toUpperCase().replace(/\=+$/, '');
73 break;
74 case 'RFC4648-HEX':
75 alphabet = RFC4648_HEX;
76 // eslint-disable-next-line no-useless-escape
77 cleanedInput = input.toUpperCase().replace(/\=+$/, '');
78 break;
79 case 'Crockford':
80 alphabet = CROCKFORD;
81 cleanedInput = input
82 .toUpperCase()
83 .replace(/O/g, '0')
84 .replace(/[IL]/g, '1');
85 break;
86 default:
87 throw new Error(`Unknown base32 variant: ${variant}`);
88 }
89 const { length } = cleanedInput;
90 let bits = 0;
91 let value = 0;
92 let index = 0;
93 const output = new Uint8Array(((length * 5) / 8) | 0);
94 for (let i = 0; i < length; i++) {
95 value = (value << 5) | readChar(alphabet, cleanedInput[i]);
96 bits += 5;
97 if (bits >= 8) {
98 output[index++] = (value >>> (bits - 8)) & 255;
99 bits -= 8;
100 }
101 }
102 return output.buffer;
103}
104/**
105 * Turn a string of hexadecimal characters into an ArrayBuffer
106 */
107function hexToArrayBuffer(hex) {
108 if (hex.length % 2 !== 0) {
109 throw new RangeError('Expected string to be an even number of characters');
110 }
111 const view = new Uint8Array(hex.length / 2);
112 for (let i = 0; i < hex.length; i += 2) {
113 view[i / 2] = parseInt(hex.substring(i, i + 2), 16);
114 }
115 return view.buffer;
116}
117//# sourceMappingURL=index.js.map
118
119/***/ }),
120
121/***/ "29q8":
122/***/ (function(module, exports, __webpack_require__) {
123
124(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;
125var _$src_1 = {};
126function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
127
128function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
129
130function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
131
132_$src_1 =
133/*#__PURE__*/
134function () {
135 function BugsnagPluginReact() {
136 // Fetch React from the window object, if it exists
137 var globalReact = typeof window !== 'undefined' && window.React;
138 this.name = 'react';
139 this.lazy = arguments.length === 0 && !globalReact;
140
141 if (!this.lazy) {
142 this.React = (arguments.length <= 0 ? undefined : arguments[0]) || globalReact;
143 if (!this.React) throw new Error('@bugsnag/plugin-react reference to `React` was undefined');
144 }
145 }
146
147 var _proto = BugsnagPluginReact.prototype;
148
149 _proto.load = function load(client) {
150 if (!this.lazy) {
151 var ErrorBoundary = createClass(this.React, client);
152
153 ErrorBoundary.createErrorBoundary = function () {
154 return ErrorBoundary;
155 };
156
157 return ErrorBoundary;
158 }
159
160 var BugsnagPluginReactLazyInitializer = function () {
161 throw new Error("@bugsnag/plugin-react was used incorrectly. Valid usage is as follows:\nPass React to the plugin constructor\n\n `Bugsnag.start({ plugins: [new BugsnagPluginReact(React)] })`\nand then call `const ErrorBoundary = Bugsnag.getPlugin('react').createErrorBoundary()`\n\nOr if React is not available until after Bugsnag has started,\nconstruct the plugin with no arguments\n `Bugsnag.start({ plugins: [new BugsnagPluginReact()] })`,\nthen pass in React when available to construct your error boundary\n `const ErrorBoundary = Bugsnag.getPlugin('react').createErrorBoundary(React)`");
162 };
163
164 BugsnagPluginReactLazyInitializer.createErrorBoundary = function (React) {
165 if (!React) throw new Error('@bugsnag/plugin-react reference to `React` was undefined');
166 return createClass(React, client);
167 };
168
169 return BugsnagPluginReactLazyInitializer;
170 };
171
172 return BugsnagPluginReact;
173}();
174
175var formatComponentStack = function (str) {
176 var lines = str.split(/\s*\n\s*/g);
177 var ret = '';
178
179 for (var line = 0, len = lines.length; line < len; line++) {
180 if (lines[line].length) ret += "" + (ret.length ? '\n' : '') + lines[line];
181 }
182
183 return ret;
184};
185
186var createClass = function (React, client) {
187 return (
188 /*#__PURE__*/
189 function (_React$Component) {
190 _inheritsLoose(ErrorBoundary, _React$Component);
191
192 function ErrorBoundary(props) {
193 var _this;
194
195 _this = _React$Component.call(this, props) || this;
196 _this.state = {
197 error: null,
198 info: null
199 };
200 _this.handleClearError = _this.handleClearError.bind(_assertThisInitialized(_this));
201 return _this;
202 }
203
204 var _proto2 = ErrorBoundary.prototype;
205
206 _proto2.handleClearError = function handleClearError() {
207 this.setState({
208 error: null,
209 info: null
210 });
211 };
212
213 _proto2.componentDidCatch = function componentDidCatch(error, info) {
214 var onError = this.props.onError;
215 var handledState = {
216 severity: 'error',
217 unhandled: true,
218 severityReason: {
219 type: 'unhandledException'
220 }
221 };
222 var event = client.Event.create(error, true, handledState, 1);
223 if (info && info.componentStack) info.componentStack = formatComponentStack(info.componentStack);
224 event.addMetadata('react', info);
225
226 client._notify(event, onError);
227
228 this.setState({
229 error: error,
230 info: info
231 });
232 };
233
234 _proto2.render = function render() {
235 var error = this.state.error;
236
237 if (error) {
238 var FallbackComponent = this.props.FallbackComponent;
239 if (FallbackComponent) return React.createElement(FallbackComponent, _extends({}, this.state, {
240 clearError: this.handleClearError
241 }));
242 return null;
243 }
244
245 return this.props.children;
246 };
247
248 return ErrorBoundary;
249 }(React.Component)
250 );
251};
252
253_$src_1.formatComponentStack = formatComponentStack;
254_$src_1["default"] = _$src_1;
255
256return _$src_1;
257
258});
259//# sourceMappingURL=bugsnag-react.js.map
260
261
262/***/ }),
263
264/***/ "8jRI":
265/***/ (function(module, exports, __webpack_require__) {
266
267"use strict";
268
269var token = '%[a-f0-9]{2}';
270var singleMatcher = new RegExp(token, 'gi');
271var multiMatcher = new RegExp('(' + token + ')+', 'gi');
272
273function decodeComponents(components, split) {
274 try {
275 // Try to decode the entire string first
276 return decodeURIComponent(components.join(''));
277 } catch (err) {
278 // Do nothing
279 }
280
281 if (components.length === 1) {
282 return components;
283 }
284
285 split = split || 1;
286
287 // Split the array in 2 parts
288 var left = components.slice(0, split);
289 var right = components.slice(split);
290
291 return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
292}
293
294function decode(input) {
295 try {
296 return decodeURIComponent(input);
297 } catch (err) {
298 var tokens = input.match(singleMatcher);
299
300 for (var i = 1; i < tokens.length; i++) {
301 input = decodeComponents(tokens, i).join('');
302
303 tokens = input.match(singleMatcher);
304 }
305
306 return input;
307 }
308}
309
310function customDecodeURIComponent(input) {
311 // Keep track of all the replacements and prefill the map with the `BOM`
312 var replaceMap = {
313 '%FE%FF': '\uFFFD\uFFFD',
314 '%FF%FE': '\uFFFD\uFFFD'
315 };
316
317 var match = multiMatcher.exec(input);
318 while (match) {
319 try {
320 // Decode as big chunks as possible
321 replaceMap[match[0]] = decodeURIComponent(match[0]);
322 } catch (err) {
323 var result = decode(match[0]);
324
325 if (result !== match[0]) {
326 replaceMap[match[0]] = result;
327 }
328 }
329
330 match = multiMatcher.exec(input);
331 }
332
333 // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
334 replaceMap['%C2'] = '\uFFFD';
335
336 var entries = Object.keys(replaceMap);
337
338 for (var i = 0; i < entries.length; i++) {
339 // Replace all decoded components
340 var key = entries[i];
341 input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
342 }
343
344 return input;
345}
346
347module.exports = function (encodedURI) {
348 if (typeof encodedURI !== 'string') {
349 throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
350 }
351
352 try {
353 encodedURI = encodedURI.replace(/\+/g, ' ');
354
355 // Try the built in decoder first
356 return decodeURIComponent(encodedURI);
357 } catch (err) {
358 // Fallback to a more advanced decoder
359 return customDecodeURIComponent(encodedURI);
360 }
361};
362
363
364/***/ }),
365
366/***/ "8mt6":
367/***/ (function(module, __webpack_exports__, __webpack_require__) {
368
369"use strict";
370/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getPeopleWatchingForDomain; });
371/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addItemToWatchList; });
372/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return removeItemFromWatchList; });
373/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return moveLocalWatchlistToDatabase; });
374/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getWatchlist; });
375/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getWatchersForWatchlist; });
376/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("o0o1");
377/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
378/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("HaE+");
379/* harmony import */ var _utils_domain__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("oFlI");
380/* harmony import */ var _analytics_cart__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("QwyX");
381/* harmony import */ var actions_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("Ue81");
382/* harmony import */ var analytics_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("a4XK");
383/* harmony import */ var utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("JGAB");
384
385
386
387
388
389
390
391var getPeopleWatchingForDomain = /*#__PURE__*/function () {
392 var _ref = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(domainName) {
393 var domain;
394 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {
395 while (1) {
396 switch (_context.prev = _context.next) {
397 case 0:
398 domain = Object(_utils_domain__WEBPACK_IMPORTED_MODULE_2__[/* getDomainFromName */ "c"])(domainName);
399 return _context.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/watchlist/get?label=".concat(domain.label, "&extension=").concat(domain.extension)).then(function (resp) {
400 return resp.json();
401 })["catch"](function (err) {
402 throw new Error(err);
403 }));
404
405 case 2:
406 case "end":
407 return _context.stop();
408 }
409 }
410 }, _callee);
411 }));
412
413 return function getPeopleWatchingForDomain(_x) {
414 return _ref.apply(this, arguments);
415 };
416}();
417var addItemToWatchList = function addItemToWatchList(domainName) {
418 return /*#__PURE__*/function () {
419 var _ref2 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(dispatch, getState) {
420 var domain, state, auth;
421 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {
422 while (1) {
423 switch (_context2.prev = _context2.next) {
424 case 0:
425 domain = Object(_utils_domain__WEBPACK_IMPORTED_MODULE_2__[/* getDomainFromName */ "c"])(domainName);
426 void Object(_analytics_cart__WEBPACK_IMPORTED_MODULE_3__[/* trackWatchlistUpdate */ "e"])(analytics_types__WEBPACK_IMPORTED_MODULE_5__[/* WATCHLIST_TRACK_DOMAIN_ADDED */ "eb"], domain);
427 state = getState();
428 auth = state.auth;
429
430 if (!auth.signedIn) {
431 _context2.next = 7;
432 break;
433 }
434
435 _context2.next = 7;
436 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/watchlist/add", {
437 auth: true,
438 method: 'POST',
439 headers: new Headers({
440 'Content-Type': 'application/json'
441 }),
442 body: JSON.stringify({
443 label: domain.label,
444 extension: domain.extension
445 })
446 })["catch"](function (err) {
447 throw new Error(err);
448 });
449
450 case 7:
451 dispatch({
452 type: actions_types__WEBPACK_IMPORTED_MODULE_4__[/* WATCHLIST_ADD_ITEM */ "L"],
453 payload: domain.name
454 });
455
456 case 8:
457 case "end":
458 return _context2.stop();
459 }
460 }
461 }, _callee2);
462 }));
463
464 return function (_x2, _x3) {
465 return _ref2.apply(this, arguments);
466 };
467 }();
468};
469var removeItemFromWatchList = function removeItemFromWatchList(domainName) {
470 return /*#__PURE__*/function () {
471 var _ref3 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(dispatch, getState) {
472 var domain, state, auth;
473 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) {
474 while (1) {
475 switch (_context3.prev = _context3.next) {
476 case 0:
477 domain = Object(_utils_domain__WEBPACK_IMPORTED_MODULE_2__[/* getDomainFromName */ "c"])(domainName);
478 void Object(_analytics_cart__WEBPACK_IMPORTED_MODULE_3__[/* trackWatchlistUpdate */ "e"])(analytics_types__WEBPACK_IMPORTED_MODULE_5__[/* WATCHLIST_TRACK_DOMAIN_REMOVED */ "fb"], domain);
479 state = getState();
480 auth = state.auth;
481
482 if (!auth.signedIn) {
483 _context3.next = 7;
484 break;
485 }
486
487 _context3.next = 7;
488 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/watchlist/remove", {
489 auth: true,
490 method: 'POST',
491 headers: new Headers({
492 'Content-Type': 'application/json'
493 }),
494 body: JSON.stringify({
495 label: domain.label,
496 extension: domain.extension
497 })
498 });
499
500 case 7:
501 dispatch({
502 type: actions_types__WEBPACK_IMPORTED_MODULE_4__[/* WATCHLIST_REMOVE_ITEM */ "M"],
503 payload: domain.name
504 });
505
506 case 8:
507 case "end":
508 return _context3.stop();
509 }
510 }
511 }, _callee3);
512 }));
513
514 return function (_x4, _x5) {
515 return _ref3.apply(this, arguments);
516 };
517 }();
518};
519var moveLocalWatchlistToDatabase = function moveLocalWatchlistToDatabase() {
520 return /*#__PURE__*/function () {
521 var _ref4 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(dispatch, getState) {
522 var state, domains;
523 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) {
524 while (1) {
525 switch (_context4.prev = _context4.next) {
526 case 0:
527 state = getState();
528 domains = state.watchlist.domains;
529 return _context4.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/watchlist/set", {
530 auth: true,
531 method: 'POST',
532 headers: new Headers({
533 'Content-Type': 'application/json'
534 }),
535 body: JSON.stringify({
536 domains: domains
537 })
538 }));
539
540 case 3:
541 case "end":
542 return _context4.stop();
543 }
544 }
545 }, _callee4);
546 }));
547
548 return function (_x6, _x7) {
549 return _ref4.apply(this, arguments);
550 };
551 }();
552};
553var getWatchlist = function getWatchlist() {
554 return /*#__PURE__*/function () {
555 var _ref5 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(dispatch, getState) {
556 var state, auth, data;
557 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) {
558 while (1) {
559 switch (_context5.prev = _context5.next) {
560 case 0:
561 state = getState();
562 auth = state.auth;
563
564 if (!auth.signedIn) {
565 _context5.next = 16;
566 break;
567 }
568
569 _context5.prev = 3;
570 _context5.next = 6;
571 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/watchlist", {
572 auth: true,
573 returnType: 'json'
574 });
575
576 case 6:
577 data = _context5.sent;
578
579 if (!(data === null || data === void 0 ? void 0 : data.domains)) {
580 _context5.next = 11;
581 break;
582 }
583
584 _context5.next = 10;
585 return dispatch({
586 type: actions_types__WEBPACK_IMPORTED_MODULE_4__[/* WATCHLIST_SET_ITEMS */ "N"],
587 payload: data.domains
588 });
589
590 case 10:
591 return _context5.abrupt("return", data.domains);
592
593 case 11:
594 _context5.next = 16;
595 break;
596
597 case 13:
598 _context5.prev = 13;
599 _context5.t0 = _context5["catch"](3);
600 return _context5.abrupt("return", []);
601
602 case 16:
603 return _context5.abrupt("return", []);
604
605 case 17:
606 case "end":
607 return _context5.stop();
608 }
609 }
610 }, _callee5, null, [[3, 13]]);
611 }));
612
613 return function (_x8, _x9) {
614 return _ref5.apply(this, arguments);
615 };
616 }();
617};
618var getWatchersForWatchlist = /*#__PURE__*/function () {
619 var _ref6 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(domains) {
620 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) {
621 while (1) {
622 switch (_context6.prev = _context6.next) {
623 case 0:
624 if (!(!domains || !domains.length)) {
625 _context6.next = 2;
626 break;
627 }
628
629 return _context6.abrupt("return");
630
631 case 2:
632 _context6.next = 4;
633 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/watchlist/watchers", {
634 method: 'POST',
635 headers: new Headers({
636 'Content-Type': 'application/json'
637 }),
638 body: JSON.stringify({
639 domains: domains
640 }),
641 returnType: 'json'
642 });
643
644 case 4:
645 return _context6.abrupt("return", _context6.sent);
646
647 case 5:
648 case "end":
649 return _context6.stop();
650 }
651 }
652 }, _callee6);
653 }));
654
655 return function getWatchersForWatchlist(_x10) {
656 return _ref6.apply(this, arguments);
657 };
658}();
659
660/***/ }),
661
662/***/ "8yz6":
663/***/ (function(module, exports, __webpack_require__) {
664
665"use strict";
666
667
668module.exports = (string, separator) => {
669 if (!(typeof string === 'string' && typeof separator === 'string')) {
670 throw new TypeError('Expected the arguments to be of type `string`');
671 }
672
673 if (separator === '') {
674 return [string];
675 }
676
677 const separatorIndex = string.indexOf(separator);
678
679 if (separatorIndex === -1) {
680 return [string];
681 }
682
683 return [
684 string.slice(0, separatorIndex),
685 string.slice(separatorIndex + separator.length)
686 ];
687};
688
689
690/***/ }),
691
692/***/ 9:
693/***/ (function(module, exports) {
694
695/* (ignored) */
696
697/***/ }),
698
699/***/ "ASyH":
700/***/ (function(module, exports, __webpack_require__) {
701
702(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;
703var _$breadcrumbTypes_8 = ['navigation', 'request', 'process', 'log', 'user', 'state', 'error', 'manual'];
704
705// Array#reduce
706var _$reduce_17 = function (arr, fn, accum) {
707 var val = accum;
708
709 for (var i = 0, len = arr.length; i < len; i++) {
710 val = fn(val, arr[i], i, arr);
711 }
712
713 return val;
714};
715
716/* removed: var _$reduce_17 = require('./reduce'); */; // Array#filter
717
718
719var _$filter_12 = function (arr, fn) {
720 return _$reduce_17(arr, function (accum, item, i, arr) {
721 return !fn(item, i, arr) ? accum : accum.concat(item);
722 }, []);
723};
724
725/* removed: var _$reduce_17 = require('./reduce'); */; // Array#includes
726
727
728var _$includes_13 = function (arr, x) {
729 return _$reduce_17(arr, function (accum, item, i, arr) {
730 return accum === true || item === x;
731 }, false);
732};
733
734// Array#isArray
735var _$isArray_14 = function (obj) {
736 return Object.prototype.toString.call(obj) === '[object Array]';
737};
738
739/* eslint-disable-next-line no-prototype-builtins */
740var _hasDontEnumBug = !{
741 toString: null
742}.propertyIsEnumerable('toString');
743
744var _dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor']; // Object#keys
745
746var _$keys_15 = function (obj) {
747 // stripped down version of
748 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/Keys
749 var result = [];
750 var prop;
751
752 for (prop in obj) {
753 if (Object.prototype.hasOwnProperty.call(obj, prop)) result.push(prop);
754 }
755
756 if (!_hasDontEnumBug) return result;
757
758 for (var i = 0, len = _dontEnums.length; i < len; i++) {
759 if (Object.prototype.hasOwnProperty.call(obj, _dontEnums[i])) result.push(_dontEnums[i]);
760 }
761
762 return result;
763};
764
765var _$intRange_24 = function (min, max) {
766 if (min === void 0) {
767 min = 1;
768 }
769
770 if (max === void 0) {
771 max = Infinity;
772 }
773
774 return function (value) {
775 return typeof value === 'number' && parseInt('' + value, 10) === value && value >= min && value <= max;
776 };
777};
778
779/* removed: var _$filter_12 = require('../es-utils/filter'); */;
780
781/* removed: var _$isArray_14 = require('../es-utils/is-array'); */;
782
783var _$listOfFunctions_25 = function (value) {
784 return typeof value === 'function' || _$isArray_14(value) && _$filter_12(value, function (f) {
785 return typeof f === 'function';
786 }).length === value.length;
787};
788
789var _$stringWithLength_26 = function (value) {
790 return typeof value === 'string' && !!value.length;
791};
792
793var _$config_5 = {};
794/* removed: var _$filter_12 = require('./lib/es-utils/filter'); */;
795
796/* removed: var _$reduce_17 = require('./lib/es-utils/reduce'); */;
797
798/* removed: var _$keys_15 = require('./lib/es-utils/keys'); */;
799
800/* removed: var _$isArray_14 = require('./lib/es-utils/is-array'); */;
801
802/* removed: var _$includes_13 = require('./lib/es-utils/includes'); */;
803
804/* removed: var _$intRange_24 = require('./lib/validators/int-range'); */;
805
806/* removed: var _$stringWithLength_26 = require('./lib/validators/string-with-length'); */;
807
808/* removed: var _$listOfFunctions_25 = require('./lib/validators/list-of-functions'); */;
809
810/* removed: var _$breadcrumbTypes_8 = require('./lib/breadcrumb-types'); */;
811
812var defaultErrorTypes = function () {
813 return {
814 unhandledExceptions: true,
815 unhandledRejections: true
816 };
817};
818
819_$config_5.schema = {
820 apiKey: {
821 defaultValue: function () {
822 return null;
823 },
824 message: 'is required',
825 validate: _$stringWithLength_26
826 },
827 appVersion: {
828 defaultValue: function () {
829 return undefined;
830 },
831 message: 'should be a string',
832 validate: function (value) {
833 return value === undefined || _$stringWithLength_26(value);
834 }
835 },
836 appType: {
837 defaultValue: function () {
838 return undefined;
839 },
840 message: 'should be a string',
841 validate: function (value) {
842 return value === undefined || _$stringWithLength_26(value);
843 }
844 },
845 autoDetectErrors: {
846 defaultValue: function () {
847 return true;
848 },
849 message: 'should be true|false',
850 validate: function (value) {
851 return value === true || value === false;
852 }
853 },
854 enabledErrorTypes: {
855 defaultValue: function () {
856 return defaultErrorTypes();
857 },
858 message: 'should be an object containing the flags { unhandledExceptions:true|false, unhandledRejections:true|false }',
859 allowPartialObject: true,
860 validate: function (value) {
861 // ensure we have an object
862 if (typeof value !== 'object' || !value) return false;
863 var providedKeys = _$keys_15(value);
864 var defaultKeys = _$keys_15(defaultErrorTypes()); // ensure it only has a subset of the allowed keys
865
866 if (_$filter_12(providedKeys, function (k) {
867 return _$includes_13(defaultKeys, k);
868 }).length < providedKeys.length) return false; // ensure all of the values are boolean
869
870 if (_$filter_12(_$keys_15(value), function (k) {
871 return typeof value[k] !== 'boolean';
872 }).length > 0) return false;
873 return true;
874 }
875 },
876 onError: {
877 defaultValue: function () {
878 return [];
879 },
880 message: 'should be a function or array of functions',
881 validate: _$listOfFunctions_25
882 },
883 onSession: {
884 defaultValue: function () {
885 return [];
886 },
887 message: 'should be a function or array of functions',
888 validate: _$listOfFunctions_25
889 },
890 onBreadcrumb: {
891 defaultValue: function () {
892 return [];
893 },
894 message: 'should be a function or array of functions',
895 validate: _$listOfFunctions_25
896 },
897 endpoints: {
898 defaultValue: function () {
899 return {
900 notify: 'https://notify.bugsnag.com',
901 sessions: 'https://sessions.bugsnag.com'
902 };
903 },
904 message: 'should be an object containing endpoint URLs { notify, sessions }',
905 validate: function (val) {
906 return (// first, ensure it's an object
907 val && typeof val === 'object' && // notify and sessions must always be set
908 _$stringWithLength_26(val.notify) && _$stringWithLength_26(val.sessions) && // ensure no keys other than notify/session are set on endpoints object
909 _$filter_12(_$keys_15(val), function (k) {
910 return !_$includes_13(['notify', 'sessions'], k);
911 }).length === 0
912 );
913 }
914 },
915 autoTrackSessions: {
916 defaultValue: function (val) {
917 return true;
918 },
919 message: 'should be true|false',
920 validate: function (val) {
921 return val === true || val === false;
922 }
923 },
924 enabledReleaseStages: {
925 defaultValue: function () {
926 return null;
927 },
928 message: 'should be an array of strings',
929 validate: function (value) {
930 return value === null || _$isArray_14(value) && _$filter_12(value, function (f) {
931 return typeof f === 'string';
932 }).length === value.length;
933 }
934 },
935 releaseStage: {
936 defaultValue: function () {
937 return 'production';
938 },
939 message: 'should be a string',
940 validate: function (value) {
941 return typeof value === 'string' && value.length;
942 }
943 },
944 maxBreadcrumbs: {
945 defaultValue: function () {
946 return 25;
947 },
948 message: 'should be a number ≤100',
949 validate: function (value) {
950 return _$intRange_24(0, 100)(value);
951 }
952 },
953 enabledBreadcrumbTypes: {
954 defaultValue: function () {
955 return _$breadcrumbTypes_8;
956 },
957 message: "should be null or a list of available breadcrumb types (" + _$breadcrumbTypes_8.join(',') + ")",
958 validate: function (value) {
959 return value === null || _$isArray_14(value) && _$reduce_17(value, function (accum, maybeType) {
960 if (accum === false) return accum;
961 return _$includes_13(_$breadcrumbTypes_8, maybeType);
962 }, true);
963 }
964 },
965 context: {
966 defaultValue: function () {
967 return undefined;
968 },
969 message: 'should be a string',
970 validate: function (value) {
971 return value === undefined || typeof value === 'string';
972 }
973 },
974 user: {
975 defaultValue: function () {
976 return {};
977 },
978 message: 'should be an object with { id, email, name } properties',
979 validate: function (value) {
980 return value === null || value && _$reduce_17(_$keys_15(value), function (accum, key) {
981 return accum && _$includes_13(['id', 'email', 'name'], key);
982 }, true);
983 }
984 },
985 metadata: {
986 defaultValue: function () {
987 return {};
988 },
989 message: 'should be an object',
990 validate: function (value) {
991 return typeof value === 'object' && value !== null;
992 }
993 },
994 logger: {
995 defaultValue: function () {
996 return undefined;
997 },
998 message: 'should be null or an object with methods { debug, info, warn, error }',
999 validate: function (value) {
1000 return !value || value && _$reduce_17(['debug', 'info', 'warn', 'error'], function (accum, method) {
1001 return accum && typeof value[method] === 'function';
1002 }, true);
1003 }
1004 },
1005 redactedKeys: {
1006 defaultValue: function () {
1007 return ['password'];
1008 },
1009 message: 'should be an array of strings|regexes',
1010 validate: function (value) {
1011 return _$isArray_14(value) && value.length === _$filter_12(value, function (s) {
1012 return typeof s === 'string' || s && typeof s.test === 'function';
1013 }).length;
1014 }
1015 },
1016 plugins: {
1017 defaultValue: function () {
1018 return [];
1019 },
1020 message: 'should be an array of plugin objects',
1021 validate: function (value) {
1022 return _$isArray_14(value) && value.length === _$filter_12(value, function (p) {
1023 return p && typeof p === 'object' && typeof p.load === 'function';
1024 }).length;
1025 }
1026 }
1027};
1028
1029// extends helper from babel
1030// https://github.com/babel/babel/blob/916429b516e6466fd06588ee820e40e025d7f3a3/packages/babel-helpers/src/helpers.js#L377-L393
1031var _$assign_11 = function (target) {
1032 for (var i = 1; i < arguments.length; i++) {
1033 var source = arguments[i];
1034
1035 for (var key in source) {
1036 if (Object.prototype.hasOwnProperty.call(source, key)) {
1037 target[key] = source[key];
1038 }
1039 }
1040 }
1041
1042 return target;
1043};
1044
1045/* removed: var _$reduce_17 = require('./reduce'); */; // Array#map
1046
1047
1048var _$map_16 = function (arr, fn) {
1049 return _$reduce_17(arr, function (accum, item, i, arr) {
1050 return accum.concat(fn(item, i, arr));
1051 }, []);
1052};
1053
1054var schema = _$config_5.schema;
1055
1056/* removed: var _$map_16 = require('@bugsnag/core/lib/es-utils/map'); */;
1057
1058/* removed: var _$assign_11 = require('@bugsnag/core/lib/es-utils/assign'); */;
1059
1060var _$config_1 = {
1061 releaseStage: _$assign_11({}, schema.releaseStage, {
1062 defaultValue: function () {
1063 if (/^localhost(:\d+)?$/.test(window.location.host)) return 'development';
1064 return 'production';
1065 }
1066 }),
1067 logger: _$assign_11({}, schema.logger, {
1068 defaultValue: function () {
1069 return (// set logger based on browser capability
1070 typeof console !== 'undefined' && typeof console.debug === 'function' ? getPrefixedConsole() : undefined
1071 );
1072 }
1073 })
1074};
1075
1076var getPrefixedConsole = function () {
1077 var logger = {};
1078 var consoleLog = console.log;
1079 _$map_16(['debug', 'info', 'warn', 'error'], function (method) {
1080 var consoleMethod = console[method];
1081 logger[method] = typeof consoleMethod === 'function' ? consoleMethod.bind(console, '[bugsnag]') : consoleLog.bind(console, '[bugsnag]');
1082 });
1083 return logger;
1084};
1085
1086var Breadcrumb =
1087/*#__PURE__*/
1088function () {
1089 function Breadcrumb(message, metadata, type, timestamp) {
1090 if (timestamp === void 0) {
1091 timestamp = new Date();
1092 }
1093
1094 this.type = type;
1095 this.message = message;
1096 this.metadata = metadata;
1097 this.timestamp = timestamp;
1098 }
1099
1100 var _proto = Breadcrumb.prototype;
1101
1102 _proto.toJSON = function toJSON() {
1103 return {
1104 type: this.type,
1105 name: this.message,
1106 timestamp: this.timestamp,
1107 metaData: this.metadata
1108 };
1109 };
1110
1111 return Breadcrumb;
1112}();
1113
1114var _$Breadcrumb_3 = Breadcrumb;
1115
1116var _$stackframe_34 = {};
1117(function (root, factory) {
1118 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
1119
1120 /* istanbul ignore next */
1121
1122 if (typeof define === 'function' && define.amd) {
1123 define('stackframe', [], factory);
1124 } else if (typeof _$stackframe_34 === 'object') {
1125 _$stackframe_34 = factory();
1126 } else {
1127 root.StackFrame = factory();
1128 }
1129})(this, function () {
1130 'use strict';
1131
1132 function _isNumber(n) {
1133 return !isNaN(parseFloat(n)) && isFinite(n);
1134 }
1135
1136 function _capitalize(str) {
1137 return str.charAt(0).toUpperCase() + str.substring(1);
1138 }
1139
1140 function _getter(p) {
1141 return function () {
1142 return this[p];
1143 };
1144 }
1145
1146 var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];
1147 var numericProps = ['columnNumber', 'lineNumber'];
1148 var stringProps = ['fileName', 'functionName', 'source'];
1149 var arrayProps = ['args'];
1150 var props = booleanProps.concat(numericProps, stringProps, arrayProps);
1151
1152 function StackFrame(obj) {
1153 if (obj instanceof Object) {
1154 for (var i = 0; i < props.length; i++) {
1155 if (obj.hasOwnProperty(props[i]) && obj[props[i]] !== undefined) {
1156 this['set' + _capitalize(props[i])](obj[props[i]]);
1157 }
1158 }
1159 }
1160 }
1161
1162 StackFrame.prototype = {
1163 getArgs: function () {
1164 return this.args;
1165 },
1166 setArgs: function (v) {
1167 if (Object.prototype.toString.call(v) !== '[object Array]') {
1168 throw new TypeError('Args must be an Array');
1169 }
1170
1171 this.args = v;
1172 },
1173 getEvalOrigin: function () {
1174 return this.evalOrigin;
1175 },
1176 setEvalOrigin: function (v) {
1177 if (v instanceof StackFrame) {
1178 this.evalOrigin = v;
1179 } else if (v instanceof Object) {
1180 this.evalOrigin = new StackFrame(v);
1181 } else {
1182 throw new TypeError('Eval Origin must be an Object or StackFrame');
1183 }
1184 },
1185 toString: function () {
1186 var functionName = this.getFunctionName() || '{anonymous}';
1187 var args = '(' + (this.getArgs() || []).join(',') + ')';
1188 var fileName = this.getFileName() ? '@' + this.getFileName() : '';
1189 var lineNumber = _isNumber(this.getLineNumber()) ? ':' + this.getLineNumber() : '';
1190 var columnNumber = _isNumber(this.getColumnNumber()) ? ':' + this.getColumnNumber() : '';
1191 return functionName + args + fileName + lineNumber + columnNumber;
1192 }
1193 };
1194
1195 for (var i = 0; i < booleanProps.length; i++) {
1196 StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);
1197
1198 StackFrame.prototype['set' + _capitalize(booleanProps[i])] = function (p) {
1199 return function (v) {
1200 this[p] = Boolean(v);
1201 };
1202 }(booleanProps[i]);
1203 }
1204
1205 for (var j = 0; j < numericProps.length; j++) {
1206 StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);
1207
1208 StackFrame.prototype['set' + _capitalize(numericProps[j])] = function (p) {
1209 return function (v) {
1210 if (!_isNumber(v)) {
1211 throw new TypeError(p + ' must be a Number');
1212 }
1213
1214 this[p] = Number(v);
1215 };
1216 }(numericProps[j]);
1217 }
1218
1219 for (var k = 0; k < stringProps.length; k++) {
1220 StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);
1221
1222 StackFrame.prototype['set' + _capitalize(stringProps[k])] = function (p) {
1223 return function (v) {
1224 this[p] = String(v);
1225 };
1226 }(stringProps[k]);
1227 }
1228
1229 return StackFrame;
1230});
1231
1232var _$errorStackParser_31 = {};
1233(function (root, factory) {
1234 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
1235
1236 /* istanbul ignore next */
1237
1238 if (typeof define === 'function' && define.amd) {
1239 define('error-stack-parser', ['stackframe'], factory);
1240 } else if (typeof _$errorStackParser_31 === 'object') {
1241 _$errorStackParser_31 = factory(_$stackframe_34);
1242 } else {
1243 root.ErrorStackParser = factory(root.StackFrame);
1244 }
1245})(this, function ErrorStackParser(StackFrame) {
1246 'use strict';
1247
1248 var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+\:\d+/;
1249 var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+\:\d+|\(native\))/m;
1250 var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/;
1251 return {
1252 /**
1253 * Given an Error object, extract the most information from it.
1254 *
1255 * @param {Error} error object
1256 * @return {Array} of StackFrames
1257 */
1258 parse: function ErrorStackParser$$parse(error) {
1259 if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
1260 return this.parseOpera(error);
1261 } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
1262 return this.parseV8OrIE(error);
1263 } else if (error.stack) {
1264 return this.parseFFOrSafari(error);
1265 } else {
1266 throw new Error('Cannot parse given Error object');
1267 }
1268 },
1269 // Separate line and column numbers from a string of the form: (URI:Line:Column)
1270 extractLocation: function ErrorStackParser$$extractLocation(urlLike) {
1271 // Fail-fast but return locations like "(native)"
1272 if (urlLike.indexOf(':') === -1) {
1273 return [urlLike];
1274 }
1275
1276 var regExp = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/;
1277 var parts = regExp.exec(urlLike.replace(/[\(\)]/g, ''));
1278 return [parts[1], parts[2] || undefined, parts[3] || undefined];
1279 },
1280 parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
1281 var filtered = error.stack.split('\n').filter(function (line) {
1282 return !!line.match(CHROME_IE_STACK_REGEXP);
1283 }, this);
1284 return filtered.map(function (line) {
1285 if (line.indexOf('(eval ') > -1) {
1286 // Throw away eval information until we implement stacktrace.js/stackframe#8
1287 line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, '');
1288 }
1289
1290 var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '('); // capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in
1291 // case it has spaces in it, as the string is split on \s+ later on
1292
1293 var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/); // remove the parenthesized location from the line, if it was matched
1294
1295 sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
1296 var tokens = sanitizedLine.split(/\s+/).slice(1); // if a location was matched, pass it to extractLocation() otherwise pop the last token
1297
1298 var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
1299 var functionName = tokens.join(' ') || undefined;
1300 var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
1301 return new StackFrame({
1302 functionName: functionName,
1303 fileName: fileName,
1304 lineNumber: locationParts[1],
1305 columnNumber: locationParts[2],
1306 source: line
1307 });
1308 }, this);
1309 },
1310 parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {
1311 var filtered = error.stack.split('\n').filter(function (line) {
1312 return !line.match(SAFARI_NATIVE_CODE_REGEXP);
1313 }, this);
1314 return filtered.map(function (line) {
1315 // Throw away eval information until we implement stacktrace.js/stackframe#8
1316 if (line.indexOf(' > eval') > -1) {
1317 line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g, ':$1');
1318 }
1319
1320 if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {
1321 // Safari eval frames only have function names and nothing else
1322 return new StackFrame({
1323 functionName: line
1324 });
1325 } else {
1326 var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
1327 var matches = line.match(functionNameRegex);
1328 var functionName = matches && matches[1] ? matches[1] : undefined;
1329 var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));
1330 return new StackFrame({
1331 functionName: functionName,
1332 fileName: locationParts[0],
1333 lineNumber: locationParts[1],
1334 columnNumber: locationParts[2],
1335 source: line
1336 });
1337 }
1338 }, this);
1339 },
1340 parseOpera: function ErrorStackParser$$parseOpera(e) {
1341 if (!e.stacktrace || e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length) {
1342 return this.parseOpera9(e);
1343 } else if (!e.stack) {
1344 return this.parseOpera10(e);
1345 } else {
1346 return this.parseOpera11(e);
1347 }
1348 },
1349 parseOpera9: function ErrorStackParser$$parseOpera9(e) {
1350 var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
1351 var lines = e.message.split('\n');
1352 var result = [];
1353
1354 for (var i = 2, len = lines.length; i < len; i += 2) {
1355 var match = lineRE.exec(lines[i]);
1356
1357 if (match) {
1358 result.push(new StackFrame({
1359 fileName: match[2],
1360 lineNumber: match[1],
1361 source: lines[i]
1362 }));
1363 }
1364 }
1365
1366 return result;
1367 },
1368 parseOpera10: function ErrorStackParser$$parseOpera10(e) {
1369 var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
1370 var lines = e.stacktrace.split('\n');
1371 var result = [];
1372
1373 for (var i = 0, len = lines.length; i < len; i += 2) {
1374 var match = lineRE.exec(lines[i]);
1375
1376 if (match) {
1377 result.push(new StackFrame({
1378 functionName: match[3] || undefined,
1379 fileName: match[2],
1380 lineNumber: match[1],
1381 source: lines[i]
1382 }));
1383 }
1384 }
1385
1386 return result;
1387 },
1388 // Opera 10.65+ Error.stack very similar to FF/Safari
1389 parseOpera11: function ErrorStackParser$$parseOpera11(error) {
1390 var filtered = error.stack.split('\n').filter(function (line) {
1391 return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
1392 }, this);
1393 return filtered.map(function (line) {
1394 var tokens = line.split('@');
1395 var locationParts = this.extractLocation(tokens.pop());
1396 var functionCall = tokens.shift() || '';
1397 var functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, '$2').replace(/\([^\)]*\)/g, '') || undefined;
1398 var argsRaw;
1399
1400 if (functionCall.match(/\(([^\)]*)\)/)) {
1401 argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, '$1');
1402 }
1403
1404 var args = argsRaw === undefined || argsRaw === '[arguments not available]' ? undefined : argsRaw.split(',');
1405 return new StackFrame({
1406 functionName: functionName,
1407 args: args,
1408 fileName: locationParts[0],
1409 lineNumber: locationParts[1],
1410 columnNumber: locationParts[2],
1411 source: line
1412 });
1413 }, this);
1414 }
1415 };
1416});
1417
1418var _$errorStackParser_10 = _$errorStackParser_31;
1419
1420// Given `err` which may be an error, does it have a stack property which is a string?
1421var _$hasStack_18 = function (err) {
1422 return !!err && (!!err.stack || !!err.stacktrace || !!err['opera#sourceloc']) && typeof (err.stack || err.stacktrace || err['opera#sourceloc']) === 'string' && err.stack !== err.name + ": " + err.message;
1423};
1424
1425/**
1426 * Expose `isError`.
1427 */
1428var _$isError_32 = isError;
1429/**
1430 * Test whether `value` is error object.
1431 *
1432 * @param {*} value
1433 * @returns {boolean}
1434 */
1435
1436function isError(value) {
1437 switch (Object.prototype.toString.call(value)) {
1438 case '[object Error]':
1439 return true;
1440
1441 case '[object Exception]':
1442 return true;
1443
1444 case '[object DOMException]':
1445 return true;
1446
1447 default:
1448 return value instanceof Error;
1449 }
1450}
1451
1452var _$iserror_19 = _$isError_32;
1453
1454var _$jsRuntime_20 = "yes" ? 'browserjs' : undefined;
1455
1456/* removed: var _$assign_11 = require('./es-utils/assign'); */;
1457
1458var add = function (state, section, keyOrObj, maybeVal) {
1459 var _updates;
1460
1461 if (!section) return;
1462 var updates; // addMetadata("section", null) -> clears section
1463
1464 if (keyOrObj === null) return clear(state, section); // normalise the two supported input types into object form
1465
1466 if (typeof keyOrObj === 'object') updates = keyOrObj;
1467 if (typeof keyOrObj === 'string') updates = (_updates = {}, _updates[keyOrObj] = maybeVal, _updates); // exit if we don't have an updates object at this point
1468
1469 if (!updates) return; // ensure a section with this name exists
1470
1471 if (!state[section]) state[section] = {}; // merge the updates with the existing section
1472
1473 state[section] = _$assign_11({}, state[section], updates);
1474};
1475
1476var get = function (state, section, key) {
1477 if (typeof section !== 'string') return undefined;
1478
1479 if (!key) {
1480 return state[section];
1481 }
1482
1483 if (state[section]) {
1484 return state[section][key];
1485 }
1486
1487 return undefined;
1488};
1489
1490var clear = function (state, section, key) {
1491 if (typeof section !== 'string') return; // clear an entire section
1492
1493 if (!key) {
1494 delete state[section];
1495 return;
1496 } // clear a single value from a section
1497
1498
1499 if (state[section]) {
1500 delete state[section][key];
1501 }
1502};
1503
1504var _$metadataDelegate_22 = {
1505 add: add,
1506 get: get,
1507 clear: clear
1508};
1509
1510var _$stackGenerator_33 = {};
1511(function (root, factory) {
1512 'use strict'; // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
1513
1514 /* istanbul ignore next */
1515
1516 if (typeof define === 'function' && define.amd) {
1517 define('stack-generator', ['stackframe'], factory);
1518 } else if (typeof _$stackGenerator_33 === 'object') {
1519 _$stackGenerator_33 = factory(_$stackframe_34);
1520 } else {
1521 root.StackGenerator = factory(root.StackFrame);
1522 }
1523})(this, function (StackFrame) {
1524 return {
1525 backtrace: function StackGenerator$$backtrace(opts) {
1526 var stack = [];
1527 var maxStackSize = 10;
1528
1529 if (typeof opts === 'object' && typeof opts.maxStackSize === 'number') {
1530 maxStackSize = opts.maxStackSize;
1531 }
1532
1533 var curr = arguments.callee;
1534
1535 while (curr && stack.length < maxStackSize && curr['arguments']) {
1536 // Allow V8 optimizations
1537 var args = new Array(curr['arguments'].length);
1538
1539 for (var i = 0; i < args.length; ++i) {
1540 args[i] = curr['arguments'][i];
1541 }
1542
1543 if (/function(?:\s+([\w$]+))+\s*\(/.test(curr.toString())) {
1544 stack.push(new StackFrame({
1545 functionName: RegExp.$1 || undefined,
1546 args: args
1547 }));
1548 } else {
1549 stack.push(new StackFrame({
1550 args: args
1551 }));
1552 }
1553
1554 try {
1555 curr = curr.caller;
1556 } catch (e) {
1557 break;
1558 }
1559 }
1560
1561 return stack;
1562 }
1563 };
1564});
1565
1566/* removed: var _$errorStackParser_10 = require('./lib/error-stack-parser'); */;
1567
1568/* removed: var _$stackGenerator_33 = require('stack-generator'); */;
1569
1570/* removed: var _$hasStack_18 = require('./lib/has-stack'); */;
1571
1572/* removed: var _$map_16 = require('./lib/es-utils/map'); */;
1573
1574/* removed: var _$reduce_17 = require('./lib/es-utils/reduce'); */;
1575
1576/* removed: var _$filter_12 = require('./lib/es-utils/filter'); */;
1577
1578/* removed: var _$assign_11 = require('./lib/es-utils/assign'); */;
1579
1580/* removed: var _$jsRuntime_20 = require('./lib/js-runtime'); */;
1581
1582/* removed: var _$metadataDelegate_22 = require('./lib/metadata-delegate'); */;
1583
1584/* removed: var _$iserror_19 = require('./lib/iserror'); */;
1585
1586var Event =
1587/*#__PURE__*/
1588function () {
1589 function Event(errorClass, errorMessage, stacktrace, handledState, originalError) {
1590 if (stacktrace === void 0) {
1591 stacktrace = [];
1592 }
1593
1594 if (handledState === void 0) {
1595 handledState = defaultHandledState();
1596 }
1597
1598 this.apiKey = undefined;
1599 this.context = undefined;
1600 this.groupingHash = undefined;
1601 this.originalError = originalError;
1602 this._handledState = handledState;
1603 this.severity = this._handledState.severity;
1604 this.unhandled = this._handledState.unhandled;
1605 this.app = {};
1606 this.device = {};
1607 this.request = {};
1608 this.breadcrumbs = [];
1609 this.threads = [];
1610 this._metadata = {};
1611 this._user = {};
1612 this._session = undefined;
1613 this.errors = [{
1614 errorClass: ensureString(errorClass),
1615 errorMessage: ensureString(errorMessage),
1616 type: _$jsRuntime_20,
1617 stacktrace: _$reduce_17(stacktrace, function (accum, frame) {
1618 var f = formatStackframe(frame); // don't include a stackframe if none of its properties are defined
1619
1620 try {
1621 if (JSON.stringify(f) === '{}') return accum;
1622 return accum.concat(f);
1623 } catch (e) {
1624 return accum;
1625 }
1626 }, [])
1627 }]; // Flags.
1628 // Note these are not initialised unless they are used
1629 // to save unnecessary bytes in the browser bundle
1630
1631 /* this.attemptImmediateDelivery, default: true */
1632 }
1633
1634 var _proto = Event.prototype;
1635
1636 _proto.addMetadata = function addMetadata(section, keyOrObj, maybeVal) {
1637 return _$metadataDelegate_22.add(this._metadata, section, keyOrObj, maybeVal);
1638 };
1639
1640 _proto.getMetadata = function getMetadata(section, key) {
1641 return _$metadataDelegate_22.get(this._metadata, section, key);
1642 };
1643
1644 _proto.clearMetadata = function clearMetadata(section, key) {
1645 return _$metadataDelegate_22.clear(this._metadata, section, key);
1646 };
1647
1648 _proto.getUser = function getUser() {
1649 return this._user;
1650 };
1651
1652 _proto.setUser = function setUser(id, email, name) {
1653 this._user = {
1654 id: id,
1655 email: email,
1656 name: name
1657 };
1658 };
1659
1660 _proto.toJSON = function toJSON() {
1661 return {
1662 payloadVersion: '4',
1663 exceptions: _$map_16(this.errors, function (er) {
1664 return _$assign_11({}, er, {
1665 message: er.errorMessage
1666 });
1667 }),
1668 severity: this.severity,
1669 unhandled: this._handledState.unhandled,
1670 severityReason: this._handledState.severityReason,
1671 app: this.app,
1672 device: this.device,
1673 request: this.request,
1674 breadcrumbs: this.breadcrumbs,
1675 context: this.context,
1676 groupingHash: this.groupingHash,
1677 metaData: this._metadata,
1678 user: this._user,
1679 session: this._session
1680 };
1681 };
1682
1683 return Event;
1684}(); // takes a stacktrace.js style stackframe (https://github.com/stacktracejs/stackframe)
1685// and returns a Bugsnag compatible stackframe (https://docs.bugsnag.com/api/error-reporting/#json-payload)
1686
1687
1688var formatStackframe = function (frame) {
1689 var f = {
1690 file: frame.fileName,
1691 method: normaliseFunctionName(frame.functionName),
1692 lineNumber: frame.lineNumber,
1693 columnNumber: frame.columnNumber,
1694 code: undefined,
1695 inProject: undefined
1696 }; // Some instances result in no file:
1697 // - calling notify() from chrome's terminal results in no file/method.
1698 // - non-error exception thrown from global code in FF
1699 // This adds one.
1700
1701 if (f.lineNumber > -1 && !f.file && !f.method) {
1702 f.file = 'global code';
1703 }
1704
1705 return f;
1706};
1707
1708var normaliseFunctionName = function (name) {
1709 return /^global code$/i.test(name) ? 'global code' : name;
1710};
1711
1712var defaultHandledState = function () {
1713 return {
1714 unhandled: false,
1715 severity: 'warning',
1716 severityReason: {
1717 type: 'handledException'
1718 }
1719 };
1720};
1721
1722var ensureString = function (str) {
1723 return typeof str === 'string' ? str : '';
1724}; // Helpers
1725
1726
1727Event.getStacktrace = function (error, errorFramesToSkip, backtraceFramesToSkip) {
1728 if (_$hasStack_18(error)) return _$errorStackParser_10.parse(error).slice(errorFramesToSkip); // error wasn't provided or didn't have a stacktrace so try to walk the callstack
1729
1730 try {
1731 return _$filter_12(_$stackGenerator_33.backtrace(), function (frame) {
1732 return (frame.functionName || '').indexOf('StackGenerator$$') === -1;
1733 }).slice(1 + backtraceFramesToSkip);
1734 } catch (e) {
1735 return [];
1736 }
1737};
1738
1739Event.create = function (maybeError, tolerateNonErrors, handledState, component, errorFramesToSkip, logger) {
1740 if (errorFramesToSkip === void 0) {
1741 errorFramesToSkip = 0;
1742 }
1743
1744 var _normaliseError = normaliseError(maybeError, tolerateNonErrors, component, logger),
1745 error = _normaliseError[0],
1746 internalFrames = _normaliseError[1];
1747
1748 var event;
1749
1750 try {
1751 var stacktrace = Event.getStacktrace(error, // if an error was created/throw in the normaliseError() function, we need to
1752 // tell the getStacktrace() function to skip the number of frames we know will
1753 // be from our own functions. This is added to the number of frames deep we
1754 // were told about
1755 internalFrames > 0 ? 1 + internalFrames + errorFramesToSkip : 0, // if there's no stacktrace, the callstack may be walked to generated one.
1756 // this is how many frames should be removed because they come from our library
1757 1 + errorFramesToSkip);
1758 event = new Event(error.name, error.message, stacktrace, handledState, maybeError);
1759 } catch (e) {
1760 event = new Event(error.name, error.message, [], handledState, maybeError);
1761 }
1762
1763 if (error.name === 'InvalidError') {
1764 event.addMetadata("" + component, 'non-error parameter', makeSerialisable(maybeError));
1765 }
1766
1767 return event;
1768};
1769
1770var makeSerialisable = function (err) {
1771 if (err === null) return 'null';
1772 if (err === undefined) return 'undefined';
1773 return err;
1774};
1775
1776var normaliseError = function (maybeError, tolerateNonErrors, component, logger) {
1777 var error;
1778 var internalFrames = 0;
1779
1780 var createAndLogInputError = function (reason) {
1781 if (logger) logger.warn(component + " received a non-error: \"" + reason + "\"");
1782 var err = new Error(component + " received a non-error. See \"" + component + "\" tab for more detail.");
1783 err.name = 'InvalidError';
1784 return err;
1785 }; // In some cases:
1786 //
1787 // - the promise rejection handler (both in the browser and node)
1788 // - the node uncaughtException handler
1789 //
1790 // We are really limited in what we can do to get a stacktrace. So we use the
1791 // tolerateNonErrors option to ensure that the resulting error communicates as
1792 // such.
1793
1794
1795 if (!tolerateNonErrors) {
1796 if (_$iserror_19(maybeError)) {
1797 error = maybeError;
1798 } else {
1799 error = createAndLogInputError(typeof maybeError);
1800 internalFrames += 2;
1801 }
1802 } else {
1803 switch (typeof maybeError) {
1804 case 'string':
1805 case 'number':
1806 case 'boolean':
1807 error = new Error(String(maybeError));
1808 internalFrames += 1;
1809 break;
1810
1811 case 'function':
1812 error = createAndLogInputError('function');
1813 internalFrames += 2;
1814 break;
1815
1816 case 'object':
1817 if (maybeError !== null && _$iserror_19(maybeError)) {
1818 error = maybeError;
1819 } else if (maybeError !== null && hasNecessaryFields(maybeError)) {
1820 error = new Error(maybeError.message || maybeError.errorMessage);
1821 error.name = maybeError.name || maybeError.errorClass;
1822 internalFrames += 1;
1823 } else {
1824 error = createAndLogInputError(maybeError === null ? 'null' : 'unsupported object');
1825 internalFrames += 2;
1826 }
1827
1828 break;
1829
1830 default:
1831 error = createAndLogInputError('nothing');
1832 internalFrames += 2;
1833 }
1834 }
1835
1836 if (!_$hasStack_18(error)) {
1837 // in IE10/11 a new Error() doesn't have a stacktrace until you throw it, so try that here
1838 try {
1839 throw error;
1840 } catch (e) {
1841 if (_$hasStack_18(e)) {
1842 error = e; // if the error only got a stacktrace after we threw it here, we know it
1843 // will only have one extra internal frame from this function, regardless
1844 // of whether it went through createAndLogInputError() or not
1845
1846 internalFrames = 1;
1847 }
1848 }
1849 }
1850
1851 return [error, internalFrames];
1852};
1853
1854var hasNecessaryFields = function (error) {
1855 return (typeof error.name === 'string' || typeof error.errorClass === 'string') && (typeof error.message === 'string' || typeof error.errorMessage === 'string');
1856};
1857
1858var _$Event_6 = Event;
1859
1860// This is a heavily modified/simplified version of
1861// https://github.com/othiym23/async-some
1862// with the logic flipped so that it is akin to the
1863// synchronous "every" method instead of "some".
1864// run the asynchronous test function (fn) over each item in the array (arr)
1865// in series until:
1866// - fn(item, cb) => calls cb(null, false)
1867// - or the end of the array is reached
1868// the callback (cb) will be passed (null, false) if any of the items in arr
1869// caused fn to call back with false, otherwise it will be passed (null, true)
1870var _$asyncEvery_7 = function (arr, fn, cb) {
1871 var index = 0;
1872
1873 var next = function () {
1874 if (index >= arr.length) return cb(null, true);
1875 fn(arr[index], function (err, result) {
1876 if (err) return cb(err);
1877 if (result === false) return cb(null, false);
1878 index++;
1879 next();
1880 });
1881 };
1882
1883 next();
1884};
1885
1886/* removed: var _$asyncEvery_7 = require('./async-every'); */;
1887
1888var _$callbackRunner_9 = function (callbacks, event, onCallbackError, cb) {
1889 // This function is how we support different kinds of callback:
1890 // - synchronous - return value
1891 // - node-style async with callback - cb(err, value)
1892 // - promise/thenable - resolve(value)
1893 // It normalises each of these into the lowest common denominator – a node-style callback
1894 var runMaybeAsyncCallback = function (fn, cb) {
1895 if (typeof fn !== 'function') return cb(null);
1896
1897 try {
1898 // if function appears sync…
1899 if (fn.length !== 2) {
1900 var ret = fn(event); // check if it returned a "thenable" (promise)
1901
1902 if (ret && typeof ret.then === 'function') {
1903 return ret.then( // resolve
1904 function (val) {
1905 return setTimeout(function () {
1906 return cb(null, val);
1907 });
1908 }, // reject
1909 function (err) {
1910 setTimeout(function () {
1911 onCallbackError(err);
1912 return cb(null, true);
1913 });
1914 });
1915 }
1916
1917 return cb(null, ret);
1918 } // if function is async…
1919
1920
1921 fn(event, function (err, result) {
1922 if (err) {
1923 onCallbackError(err);
1924 return cb(null);
1925 }
1926
1927 cb(null, result);
1928 });
1929 } catch (e) {
1930 onCallbackError(e);
1931 cb(null);
1932 }
1933 };
1934
1935 _$asyncEvery_7(callbacks, runMaybeAsyncCallback, cb);
1936};
1937
1938var _$syncCallbackRunner_23 = function (callbacks, callbackArg, callbackType, logger) {
1939 var ignore = false;
1940 var cbs = callbacks.slice();
1941
1942 while (!ignore) {
1943 if (!cbs.length) break;
1944
1945 try {
1946 ignore = cbs.pop()(callbackArg) === false;
1947 } catch (e) {
1948 logger.error("Error occurred in " + callbackType + " callback, continuing anyway\u2026");
1949 logger.error(e);
1950 }
1951 }
1952
1953 return ignore;
1954};
1955
1956var _$pad_29 = function pad(num, size) {
1957 var s = '000000000' + num;
1958 return s.substr(s.length - size);
1959};
1960
1961/* removed: var _$pad_29 = require('./pad.js'); */;
1962
1963var env = typeof window === 'object' ? window : self;
1964var globalCount = 0;
1965
1966for (var prop in env) {
1967 if (Object.hasOwnProperty.call(env, prop)) globalCount++;
1968}
1969
1970var mimeTypesLength = navigator.mimeTypes ? navigator.mimeTypes.length : 0;
1971var clientId = _$pad_29((mimeTypesLength + navigator.userAgent.length).toString(36) + globalCount.toString(36), 4);
1972
1973var _$fingerprint_28 = function fingerprint() {
1974 return clientId;
1975};
1976
1977/**
1978 * cuid.js
1979 * Collision-resistant UID generator for browsers and node.
1980 * Sequential for fast db lookups and recency sorting.
1981 * Safe for element IDs and server-side lookups.
1982 *
1983 * Extracted from CLCTR
1984 *
1985 * Copyright (c) Eric Elliott 2012
1986 * MIT License
1987 */
1988/* removed: var _$fingerprint_28 = require('./lib/fingerprint.js'); */;
1989
1990/* removed: var _$pad_29 = require('./lib/pad.js'); */;
1991
1992var c = 0,
1993 blockSize = 4,
1994 base = 36,
1995 discreteValues = Math.pow(base, blockSize);
1996
1997function randomBlock() {
1998 return _$pad_29((Math.random() * discreteValues << 0).toString(base), blockSize);
1999}
2000
2001function safeCounter() {
2002 c = c < discreteValues ? c : 0;
2003 c++; // this is not subliminal
2004
2005 return c - 1;
2006}
2007
2008function cuid() {
2009 // Starting with a lowercase letter makes
2010 // it HTML element ID friendly.
2011 var letter = 'c',
2012 // hard-coded allows for sequential access
2013 // timestamp
2014 // warning: this exposes the exact date and time
2015 // that the uid was created.
2016 timestamp = new Date().getTime().toString(base),
2017 // Prevent same-machine collisions.
2018 counter = _$pad_29(safeCounter().toString(base), blockSize),
2019 // A few chars to generate distinct ids for different
2020 // clients (so different computers are far less
2021 // likely to generate the same id)
2022 print = _$fingerprint_28(),
2023 // Grab some more chars from Math.random()
2024 random = randomBlock() + randomBlock();
2025 return letter + timestamp + counter + print + random;
2026}
2027
2028cuid.fingerprint = _$fingerprint_28;
2029var _$cuid_27 = cuid;
2030
2031/* removed: var _$cuid_27 = require('@bugsnag/cuid'); */;
2032
2033var Session =
2034/*#__PURE__*/
2035function () {
2036 function Session() {
2037 this.id = _$cuid_27();
2038 this.startedAt = new Date();
2039 this._handled = 0;
2040 this._unhandled = 0;
2041 this._user = {};
2042 this.app = {};
2043 this.device = {};
2044 }
2045
2046 var _proto = Session.prototype;
2047
2048 _proto.getUser = function getUser() {
2049 return this._user;
2050 };
2051
2052 _proto.setUser = function setUser(id, email, name) {
2053 this._user = {
2054 id: id,
2055 email: email,
2056 name: name
2057 };
2058 };
2059
2060 _proto.toJSON = function toJSON() {
2061 return {
2062 id: this.id,
2063 startedAt: this.startedAt,
2064 events: {
2065 handled: this._handled,
2066 unhandled: this._unhandled
2067 }
2068 };
2069 };
2070
2071 _proto._track = function _track(event) {
2072 this[event._handledState.unhandled ? '_unhandled' : '_handled'] += 1;
2073 };
2074
2075 return Session;
2076}();
2077
2078var _$Session_35 = Session;
2079
2080/* removed: var _$config_5 = require('./config'); */;
2081
2082/* removed: var _$Event_6 = require('./event'); */;
2083
2084/* removed: var _$Breadcrumb_3 = require('./breadcrumb'); */;
2085
2086/* removed: var _$Session_35 = require('./session'); */;
2087
2088/* removed: var _$map_16 = require('./lib/es-utils/map'); */;
2089
2090/* removed: var _$includes_13 = require('./lib/es-utils/includes'); */;
2091
2092/* removed: var _$filter_12 = require('./lib/es-utils/filter'); */;
2093
2094/* removed: var _$reduce_17 = require('./lib/es-utils/reduce'); */;
2095
2096/* removed: var _$keys_15 = require('./lib/es-utils/keys'); */;
2097
2098/* removed: var _$assign_11 = require('./lib/es-utils/assign'); */;
2099
2100/* removed: var _$callbackRunner_9 = require('./lib/callback-runner'); */;
2101
2102/* removed: var _$metadataDelegate_22 = require('./lib/metadata-delegate'); */;
2103
2104/* removed: var _$syncCallbackRunner_23 = require('./lib/sync-callback-runner'); */;
2105
2106/* removed: var _$breadcrumbTypes_8 = require('./lib/breadcrumb-types'); */;
2107
2108var noop = function () {};
2109
2110var Client =
2111/*#__PURE__*/
2112function () {
2113 function Client(configuration, schema, internalPlugins, notifier) {
2114 var _this = this;
2115
2116 if (schema === void 0) {
2117 schema = _$config_5.schema;
2118 }
2119
2120 if (internalPlugins === void 0) {
2121 internalPlugins = [];
2122 }
2123
2124 // notifier id
2125 this._notifier = notifier; // intialise opts and config
2126
2127 this._config = {};
2128 this._schema = schema; // i/o
2129
2130 this._delivery = {
2131 sendSession: noop,
2132 sendEvent: noop
2133 };
2134 this._logger = {
2135 debug: noop,
2136 info: noop,
2137 warn: noop,
2138 error: noop
2139 }; // plugins
2140
2141 this._plugins = {}; // state
2142
2143 this._breadcrumbs = [];
2144 this._session = null;
2145 this._metadata = {};
2146 this._context = undefined;
2147 this._user = {}; // callbacks:
2148 // e: onError
2149 // s: onSession
2150 // sp: onSessionPayload
2151 // b: onBreadcrumb
2152 // (note these names are minified by hand because object
2153 // properties are not safe to minify automatically)
2154
2155 this._cbs = {
2156 e: [],
2157 s: [],
2158 sp: [],
2159 b: []
2160 }; // expose internal constructors
2161
2162 this.Client = Client;
2163 this.Event = _$Event_6;
2164 this.Breadcrumb = _$Breadcrumb_3;
2165 this.Session = _$Session_35;
2166 this._config = this._configure(configuration, internalPlugins);
2167 _$map_16(internalPlugins.concat(this._config.plugins), function (pl) {
2168 if (pl) _this._loadPlugin(pl);
2169 }); // when notify() is called we need to know how many frames are from our own source
2170 // this inital value is 1 not 0 because we wrap notify() to ensure it is always
2171 // bound to have the client as its `this` value – see below.
2172
2173 this._depth = 1;
2174 var self = this;
2175 var notify = this.notify;
2176
2177 this.notify = function () {
2178 return notify.apply(self, arguments);
2179 };
2180 }
2181
2182 var _proto = Client.prototype;
2183
2184 _proto.addMetadata = function addMetadata(section, keyOrObj, maybeVal) {
2185 return _$metadataDelegate_22.add(this._metadata, section, keyOrObj, maybeVal);
2186 };
2187
2188 _proto.getMetadata = function getMetadata(section, key) {
2189 return _$metadataDelegate_22.get(this._metadata, section, key);
2190 };
2191
2192 _proto.clearMetadata = function clearMetadata(section, key) {
2193 return _$metadataDelegate_22.clear(this._metadata, section, key);
2194 };
2195
2196 _proto.getContext = function getContext() {
2197 return this._context;
2198 };
2199
2200 _proto.setContext = function setContext(c) {
2201 this._context = c;
2202 };
2203
2204 _proto._configure = function _configure(opts, internalPlugins) {
2205 var schema = _$reduce_17(internalPlugins, function (schema, plugin) {
2206 if (plugin && plugin.configSchema) return _$assign_11({}, schema, plugin.configSchema);
2207 return schema;
2208 }, this._schema); // accumulate configuration and error messages
2209
2210 var _reduce = _$reduce_17(_$keys_15(schema), function (accum, key) {
2211 var defaultValue = schema[key].defaultValue(opts[key]);
2212
2213 if (opts[key] !== undefined) {
2214 var valid = schema[key].validate(opts[key]);
2215
2216 if (!valid) {
2217 accum.errors[key] = schema[key].message;
2218 accum.config[key] = defaultValue;
2219 } else {
2220 if (schema[key].allowPartialObject) {
2221 accum.config[key] = _$assign_11(defaultValue, opts[key]);
2222 } else {
2223 accum.config[key] = opts[key];
2224 }
2225 }
2226 } else {
2227 accum.config[key] = defaultValue;
2228 }
2229
2230 return accum;
2231 }, {
2232 errors: {},
2233 config: {}
2234 }),
2235 errors = _reduce.errors,
2236 config = _reduce.config;
2237
2238 if (schema.apiKey) {
2239 // missing api key is the only fatal error
2240 if (!config.apiKey) throw new Error('No Bugsnag API Key set'); // warn about an apikey that is not of the expected format
2241
2242 if (!/^[0-9a-f]{32}$/i.test(config.apiKey)) errors.apiKey = 'should be a string of 32 hexadecimal characters';
2243 } // update and elevate some options
2244
2245
2246 this._metadata = _$assign_11({}, config.metadata);
2247 this._user = _$assign_11({}, config.user);
2248 this._context = config.context;
2249 if (config.logger) this._logger = config.logger; // add callbacks
2250
2251 if (config.onError) this._cbs.e = this._cbs.e.concat(config.onError);
2252 if (config.onBreadcrumb) this._cbs.b = this._cbs.b.concat(config.onBreadcrumb);
2253 if (config.onSession) this._cbs.s = this._cbs.s.concat(config.onSession); // finally warn about any invalid config where we fell back to the default
2254
2255 if (_$keys_15(errors).length) {
2256 this._logger.warn(generateConfigErrorMessage(errors, opts));
2257 }
2258
2259 return config;
2260 };
2261
2262 _proto.getUser = function getUser() {
2263 return this._user;
2264 };
2265
2266 _proto.setUser = function setUser(id, email, name) {
2267 this._user = {
2268 id: id,
2269 email: email,
2270 name: name
2271 };
2272 };
2273
2274 _proto._loadPlugin = function _loadPlugin(plugin) {
2275 var result = plugin.load(this); // JS objects are not the safest way to store arbitrarily keyed values,
2276 // so bookend the key with some characters that prevent tampering with
2277 // stuff like __proto__ etc. (only store the result if the plugin had a
2278 // name)
2279
2280 if (plugin.name) this._plugins["~" + plugin.name + "~"] = result;
2281 return this;
2282 };
2283
2284 _proto.getPlugin = function getPlugin(name) {
2285 return this._plugins["~" + name + "~"];
2286 };
2287
2288 _proto._setDelivery = function _setDelivery(d) {
2289 this._delivery = d(this);
2290 };
2291
2292 _proto.startSession = function startSession() {
2293 var session = new _$Session_35();
2294 session.app.releaseStage = this._config.releaseStage;
2295 session.app.version = this._config.appVersion;
2296 session.app.type = this._config.appType;
2297 session._user = _$assign_11({}, this._user); // run onSession callbacks
2298
2299 var ignore = _$syncCallbackRunner_23(this._cbs.s, session, 'onSession', this._logger);
2300
2301 if (ignore) {
2302 this._logger.debug('Session not started due to onSession callback');
2303
2304 return this;
2305 }
2306
2307 return this._sessionDelegate.startSession(this, session);
2308 };
2309
2310 _proto.addOnError = function addOnError(fn, front) {
2311 if (front === void 0) {
2312 front = false;
2313 }
2314
2315 this._cbs.e[front ? 'unshift' : 'push'](fn);
2316 };
2317
2318 _proto.removeOnError = function removeOnError(fn) {
2319 this._cbs.e = _$filter_12(this._cbs.e, function (f) {
2320 return f !== fn;
2321 });
2322 };
2323
2324 _proto._addOnSessionPayload = function _addOnSessionPayload(fn) {
2325 this._cbs.sp.push(fn);
2326 };
2327
2328 _proto.addOnSession = function addOnSession(fn) {
2329 this._cbs.s.push(fn);
2330 };
2331
2332 _proto.removeOnSession = function removeOnSession(fn) {
2333 this._cbs.s = _$filter_12(this._cbs.s, function (f) {
2334 return f !== fn;
2335 });
2336 };
2337
2338 _proto.addOnBreadcrumb = function addOnBreadcrumb(fn, front) {
2339 if (front === void 0) {
2340 front = false;
2341 }
2342
2343 this._cbs.b[front ? 'unshift' : 'push'](fn);
2344 };
2345
2346 _proto.removeOnBreadcrumb = function removeOnBreadcrumb(fn) {
2347 this._cbs.b = _$filter_12(this._cbs.b, function (f) {
2348 return f !== fn;
2349 });
2350 };
2351
2352 _proto.pauseSession = function pauseSession() {
2353 return this._sessionDelegate.pauseSession(this);
2354 };
2355
2356 _proto.resumeSession = function resumeSession() {
2357 return this._sessionDelegate.resumeSession(this);
2358 };
2359
2360 _proto.leaveBreadcrumb = function leaveBreadcrumb(message, metadata, type) {
2361 // coerce bad values so that the defaults get set
2362 message = typeof message === 'string' ? message : '';
2363 type = typeof type === 'string' && _$includes_13(_$breadcrumbTypes_8, type) ? type : 'manual';
2364 metadata = typeof metadata === 'object' && metadata !== null ? metadata : {}; // if no message, discard
2365
2366 if (!message) return;
2367 var crumb = new _$Breadcrumb_3(message, metadata, type); // run onBreadcrumb callbacks
2368
2369 var ignore = _$syncCallbackRunner_23(this._cbs.b, crumb, 'onBreadcrumb', this._logger);
2370
2371 if (ignore) {
2372 this._logger.debug('Breadcrumb not attached due to onBreadcrumb callback');
2373
2374 return;
2375 } // push the valid crumb onto the queue and maintain the length
2376
2377
2378 this._breadcrumbs.push(crumb);
2379
2380 if (this._breadcrumbs.length > this._config.maxBreadcrumbs) {
2381 this._breadcrumbs = this._breadcrumbs.slice(this._breadcrumbs.length - this._config.maxBreadcrumbs);
2382 }
2383 };
2384
2385 _proto.notify = function notify(maybeError, onError, cb) {
2386 if (cb === void 0) {
2387 cb = noop;
2388 }
2389
2390 var event = _$Event_6.create(maybeError, true, undefined, 'notify()', this._depth + 1, this._logger);
2391
2392 this._notify(event, onError, cb);
2393 };
2394
2395 _proto._notify = function _notify(event, onError, cb) {
2396 var _this2 = this;
2397
2398 if (cb === void 0) {
2399 cb = noop;
2400 }
2401
2402 event.app = _$assign_11({}, event.app, {
2403 releaseStage: this._config.releaseStage,
2404 version: this._config.appVersion,
2405 type: this._config.appType
2406 });
2407 event.context = event.context || this._context;
2408 event._metadata = _$assign_11({}, event._metadata, this._metadata);
2409 event._user = _$assign_11({}, event._user, this._user);
2410 event.breadcrumbs = this._breadcrumbs.slice(); // exit early if events should not be sent on the current releaseStage
2411
2412 if (this._config.enabledReleaseStages !== null && !_$includes_13(this._config.enabledReleaseStages, this._config.releaseStage)) {
2413 this._logger.warn('Event not sent due to releaseStage/enabledReleaseStages configuration');
2414
2415 return cb(null, event);
2416 }
2417
2418 var originalSeverity = event.severity;
2419
2420 var onCallbackError = function (err) {
2421 // errors in callbacks are tolerated but we want to log them out
2422 _this2._logger.error('Error occurred in onError callback, continuing anyway…');
2423
2424 _this2._logger.error(err);
2425 };
2426
2427 var callbacks = [].concat(this._cbs.e).concat(onError);
2428 _$callbackRunner_9(callbacks, event, onCallbackError, function (err, shouldSend) {
2429 if (err) onCallbackError(err);
2430
2431 if (!shouldSend) {
2432 _this2._logger.debug('Event not sent due to onError callback');
2433
2434 return cb(null, event);
2435 }
2436
2437 if (_$includes_13(_this2._config.enabledBreadcrumbTypes, 'error')) {
2438 // only leave a crumb for the error if actually got sent
2439 Client.prototype.leaveBreadcrumb.call(_this2, event.errors[0].errorClass, {
2440 errorClass: event.errors[0].errorClass,
2441 errorMessage: event.errors[0].errorMessage,
2442 severity: event.severity
2443 }, 'error');
2444 }
2445
2446 if (originalSeverity !== event.severity) {
2447 event._handledState.severityReason = {
2448 type: 'userCallbackSetSeverity'
2449 };
2450 }
2451
2452 if (event.unhandled !== event._handledState.unhandled) {
2453 event._handledState.severityReason.unhandledOverridden = true;
2454 event._handledState.unhandled = event.unhandled;
2455 }
2456
2457 if (_this2._session) {
2458 _this2._session._track(event);
2459
2460 event._session = _this2._session;
2461 }
2462
2463 _this2._delivery.sendEvent({
2464 apiKey: event.apiKey || _this2._config.apiKey,
2465 notifier: _this2._notifier,
2466 events: [event]
2467 }, function (err) {
2468 return cb(err, event);
2469 });
2470 });
2471 };
2472
2473 return Client;
2474}();
2475
2476var generateConfigErrorMessage = function (errors, rawInput) {
2477 var er = new Error("Invalid configuration\n" + _$map_16(_$keys_15(errors), function (key) {
2478 return " - " + key + " " + errors[key] + ", got " + stringify(rawInput[key]);
2479 }).join('\n\n'));
2480 return er;
2481};
2482
2483var stringify = function (val) {
2484 switch (typeof val) {
2485 case 'string':
2486 case 'number':
2487 case 'object':
2488 return JSON.stringify(val);
2489
2490 default:
2491 return String(val);
2492 }
2493};
2494
2495var _$Client_4 = Client;
2496
2497var _$safeJsonStringify_30 = function (data, replacer, space, opts) {
2498 var redactedKeys = opts && opts.redactedKeys ? opts.redactedKeys : [];
2499 var redactedPaths = opts && opts.redactedPaths ? opts.redactedPaths : [];
2500 return JSON.stringify(prepareObjForSerialization(data, redactedKeys, redactedPaths), replacer, space);
2501};
2502
2503var MAX_DEPTH = 20;
2504var MAX_EDGES = 25000;
2505var MIN_PRESERVED_DEPTH = 8;
2506var REPLACEMENT_NODE = '...';
2507
2508function __isError_30(o) {
2509 return o instanceof Error || /^\[object (Error|(Dom)?Exception)\]$/.test(Object.prototype.toString.call(o));
2510}
2511
2512function throwsMessage(err) {
2513 return '[Throws: ' + (err ? err.message : '?') + ']';
2514}
2515
2516function find(haystack, needle) {
2517 for (var i = 0, len = haystack.length; i < len; i++) {
2518 if (haystack[i] === needle) return true;
2519 }
2520
2521 return false;
2522} // returns true if the string `path` starts with any of the provided `paths`
2523
2524
2525function isDescendent(paths, path) {
2526 for (var i = 0, len = paths.length; i < len; i++) {
2527 if (path.indexOf(paths[i]) === 0) return true;
2528 }
2529
2530 return false;
2531}
2532
2533function shouldRedact(patterns, key) {
2534 for (var i = 0, len = patterns.length; i < len; i++) {
2535 if (typeof patterns[i] === 'string' && patterns[i].toLowerCase() === key.toLowerCase()) return true;
2536 if (patterns[i] && typeof patterns[i].test === 'function' && patterns[i].test(key)) return true;
2537 }
2538
2539 return false;
2540}
2541
2542function __isArray_30(obj) {
2543 return Object.prototype.toString.call(obj) === '[object Array]';
2544}
2545
2546function safelyGetProp(obj, prop) {
2547 try {
2548 return obj[prop];
2549 } catch (err) {
2550 return throwsMessage(err);
2551 }
2552}
2553
2554function prepareObjForSerialization(obj, redactedKeys, redactedPaths) {
2555 var seen = []; // store references to objects we have seen before
2556
2557 var edges = 0;
2558
2559 function visit(obj, path) {
2560 function edgesExceeded() {
2561 return path.length > MIN_PRESERVED_DEPTH && edges > MAX_EDGES;
2562 }
2563
2564 edges++;
2565 if (path.length > MAX_DEPTH) return REPLACEMENT_NODE;
2566 if (edgesExceeded()) return REPLACEMENT_NODE;
2567 if (obj === null || typeof obj !== 'object') return obj;
2568 if (find(seen, obj)) return '[Circular]';
2569 seen.push(obj);
2570
2571 if (typeof obj.toJSON === 'function') {
2572 try {
2573 // we're not going to count this as an edge because it
2574 // replaces the value of the currently visited object
2575 edges--;
2576 var fResult = visit(obj.toJSON(), path);
2577 seen.pop();
2578 return fResult;
2579 } catch (err) {
2580 return throwsMessage(err);
2581 }
2582 }
2583
2584 var er = __isError_30(obj);
2585
2586 if (er) {
2587 edges--;
2588 var eResult = visit({
2589 name: obj.name,
2590 message: obj.message
2591 }, path);
2592 seen.pop();
2593 return eResult;
2594 }
2595
2596 if (__isArray_30(obj)) {
2597 var aResult = [];
2598
2599 for (var i = 0, len = obj.length; i < len; i++) {
2600 if (edgesExceeded()) {
2601 aResult.push(REPLACEMENT_NODE);
2602 break;
2603 }
2604
2605 aResult.push(visit(obj[i], path.concat('[]')));
2606 }
2607
2608 seen.pop();
2609 return aResult;
2610 }
2611
2612 var result = {};
2613
2614 try {
2615 for (var prop in obj) {
2616 if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue;
2617
2618 if (isDescendent(redactedPaths, path.join('.')) && shouldRedact(redactedKeys, prop)) {
2619 result[prop] = '[REDACTED]';
2620 continue;
2621 }
2622
2623 if (edgesExceeded()) {
2624 result[prop] = REPLACEMENT_NODE;
2625 break;
2626 }
2627
2628 result[prop] = visit(safelyGetProp(obj, prop), path.concat(prop));
2629 }
2630 } catch (e) {}
2631
2632 seen.pop();
2633 return result;
2634 }
2635
2636 return visit(obj, []);
2637}
2638
2639var _$jsonPayload_21 = {};
2640/* removed: var _$safeJsonStringify_30 = require('@bugsnag/safe-json-stringify'); */;
2641
2642var EVENT_REDACTION_PATHS = ['events.[].metaData', 'events.[].breadcrumbs.[].metaData', 'events.[].request'];
2643
2644_$jsonPayload_21.event = function (event, redactedKeys) {
2645 var payload = _$safeJsonStringify_30(event, null, null, {
2646 redactedPaths: EVENT_REDACTION_PATHS,
2647 redactedKeys: redactedKeys
2648 });
2649
2650 if (payload.length > 10e5) {
2651 event.events[0]._metadata = {
2652 notifier: "WARNING!\nSerialized payload was " + payload.length / 10e5 + "MB (limit = 1MB)\nmetadata was removed"
2653 };
2654 payload = _$safeJsonStringify_30(event, null, null, {
2655 redactedPaths: EVENT_REDACTION_PATHS,
2656 redactedKeys: redactedKeys
2657 });
2658 if (payload.length > 10e5) throw new Error('payload exceeded 1MB limit');
2659 }
2660
2661 return payload;
2662};
2663
2664_$jsonPayload_21.session = function (event, redactedKeys) {
2665 var payload = _$safeJsonStringify_30(event, null, null);
2666 if (payload.length > 10e5) throw new Error('payload exceeded 1MB limit');
2667 return payload;
2668};
2669
2670var _$delivery_36 = {};
2671/* removed: var _$jsonPayload_21 = require('@bugsnag/core/lib/json-payload'); */;
2672
2673_$delivery_36 = function (client, win) {
2674 if (win === void 0) {
2675 win = window;
2676 }
2677
2678 return {
2679 sendEvent: function (event, cb) {
2680 if (cb === void 0) {
2681 cb = function () {};
2682 }
2683
2684 var url = getApiUrl(client._config, 'notify', '4', win);
2685 var req = new win.XDomainRequest();
2686
2687 req.onload = function () {
2688 cb(null);
2689 };
2690
2691 req.open('POST', url);
2692 setTimeout(function () {
2693 try {
2694 req.send(_$jsonPayload_21.event(event, client._config.redactedKeys));
2695 } catch (e) {
2696 client._logger.error(e);
2697
2698 cb(e);
2699 }
2700 }, 0);
2701 },
2702 sendSession: function (session, cb) {
2703 if (cb === void 0) {
2704 cb = function () {};
2705 }
2706
2707 var url = getApiUrl(client._config, 'sessions', '1', win);
2708 var req = new win.XDomainRequest();
2709
2710 req.onload = function () {
2711 cb(null);
2712 };
2713
2714 req.open('POST', url);
2715 setTimeout(function () {
2716 try {
2717 req.send(_$jsonPayload_21.session(session, client._config.redactedKeys));
2718 } catch (e) {
2719 client._logger.error(e);
2720
2721 cb(e);
2722 }
2723 }, 0);
2724 }
2725 };
2726};
2727
2728var getApiUrl = function (config, endpoint, version, win) {
2729 // IE8 doesn't support Date.prototype.toISOstring(), but it does convert a date
2730 // to an ISO string when you use JSON stringify. Simply parsing the result of
2731 // JSON.stringify is smaller than using a toISOstring() polyfill.
2732 var isoDate = JSON.parse(JSON.stringify(new Date()));
2733 var url = matchPageProtocol(config.endpoints[endpoint], win.location.protocol);
2734 return url + "?apiKey=" + encodeURIComponent(config.apiKey) + "&payloadVersion=" + version + "&sentAt=" + encodeURIComponent(isoDate);
2735};
2736
2737var matchPageProtocol = _$delivery_36._matchPageProtocol = function (endpoint, pageProtocol) {
2738 return pageProtocol === 'http:' ? endpoint.replace(/^https:/, 'http:') : endpoint;
2739};
2740
2741/* removed: var _$jsonPayload_21 = require('@bugsnag/core/lib/json-payload'); */;
2742
2743var _$delivery_37 = function (client, win) {
2744 if (win === void 0) {
2745 win = window;
2746 }
2747
2748 return {
2749 sendEvent: function (event, cb) {
2750 if (cb === void 0) {
2751 cb = function () {};
2752 }
2753
2754 try {
2755 var url = client._config.endpoints.notify;
2756 var req = new win.XMLHttpRequest();
2757
2758 req.onreadystatechange = function () {
2759 if (req.readyState === win.XMLHttpRequest.DONE) cb(null);
2760 };
2761
2762 req.open('POST', url);
2763 req.setRequestHeader('Content-Type', 'application/json');
2764 req.setRequestHeader('Bugsnag-Api-Key', event.apiKey || client._config.apiKey);
2765 req.setRequestHeader('Bugsnag-Payload-Version', '4');
2766 req.setRequestHeader('Bugsnag-Sent-At', new Date().toISOString());
2767 req.send(_$jsonPayload_21.event(event, client._config.redactedKeys));
2768 } catch (e) {
2769 client._logger.error(e);
2770 }
2771 },
2772 sendSession: function (session, cb) {
2773 if (cb === void 0) {
2774 cb = function () {};
2775 }
2776
2777 try {
2778 var url = client._config.endpoints.sessions;
2779 var req = new win.XMLHttpRequest();
2780
2781 req.onreadystatechange = function () {
2782 if (req.readyState === win.XMLHttpRequest.DONE) cb(null);
2783 };
2784
2785 req.open('POST', url);
2786 req.setRequestHeader('Content-Type', 'application/json');
2787 req.setRequestHeader('Bugsnag-Api-Key', client._config.apiKey);
2788 req.setRequestHeader('Bugsnag-Payload-Version', '1');
2789 req.setRequestHeader('Bugsnag-Sent-At', new Date().toISOString());
2790 req.send(_$jsonPayload_21.session(session, client._config.redactedKeys));
2791 } catch (e) {
2792 client._logger.error(e);
2793 }
2794 }
2795 };
2796};
2797
2798var appStart = new Date();
2799var _$app_38 = {
2800 load: function (client) {
2801 client.addOnError(function (event) {
2802 var now = new Date();
2803 event.app.duration = now - appStart;
2804 }, true);
2805 }
2806};
2807
2808/*
2809 * Sets the default context to be the current URL
2810 */
2811var _$context_39 = function (win) {
2812 if (win === void 0) {
2813 win = window;
2814 }
2815
2816 return {
2817 load: function (client) {
2818 client.addOnError(function (event) {
2819 if (event.context !== undefined) return;
2820 event.context = win.location.pathname;
2821 }, true);
2822 }
2823 };
2824};
2825
2826var _$pad_43 = function pad(num, size) {
2827 var s = '000000000' + num;
2828 return s.substr(s.length - size);
2829};
2830
2831/* removed: var _$pad_43 = require('./pad.js'); */;
2832
2833var __env_42 = typeof window === 'object' ? window : self;
2834var __globalCount_42 = 0;
2835
2836for (var __prop_42 in __env_42) {
2837 if (Object.hasOwnProperty.call(__env_42, __prop_42)) __globalCount_42++;
2838}
2839
2840var __mimeTypesLength_42 = navigator.mimeTypes ? navigator.mimeTypes.length : 0;
2841var __clientId_42 = _$pad_43((__mimeTypesLength_42 + navigator.userAgent.length).toString(36) + __globalCount_42.toString(36), 4);
2842
2843var _$fingerprint_42 = function fingerprint() {
2844 return __clientId_42;
2845};
2846
2847/**
2848 * cuid.js
2849 * Collision-resistant UID generator for browsers and node.
2850 * Sequential for fast db lookups and recency sorting.
2851 * Safe for element IDs and server-side lookups.
2852 *
2853 * Extracted from CLCTR
2854 *
2855 * Copyright (c) Eric Elliott 2012
2856 * MIT License
2857 */
2858/* removed: var _$fingerprint_42 = require('./lib/fingerprint.js'); */;
2859
2860/* removed: var _$pad_43 = require('./lib/pad.js'); */;
2861
2862var __c_41 = 0,
2863 __blockSize_41 = 4,
2864 __base_41 = 36,
2865 __discreteValues_41 = Math.pow(__base_41, __blockSize_41);
2866
2867function __randomBlock_41() {
2868 return _$pad_43((Math.random() * __discreteValues_41 << 0).toString(__base_41), __blockSize_41);
2869}
2870
2871function __safeCounter_41() {
2872 __c_41 = __c_41 < __discreteValues_41 ? __c_41 : 0;
2873 __c_41++; // this is not subliminal
2874
2875 return __c_41 - 1;
2876}
2877
2878function __cuid_41() {
2879 // Starting with a lowercase letter makes
2880 // it HTML element ID friendly.
2881 var letter = 'c',
2882 // hard-coded allows for sequential access
2883 // timestamp
2884 // warning: this exposes the exact date and time
2885 // that the uid was created.
2886 timestamp = new Date().getTime().toString(__base_41),
2887 // Prevent same-machine collisions.
2888 counter = _$pad_43(__safeCounter_41().toString(__base_41), __blockSize_41),
2889 // A few chars to generate distinct ids for different
2890 // clients (so different computers are far less
2891 // likely to generate the same id)
2892 print = _$fingerprint_42(),
2893 // Grab some more chars from Math.random()
2894 random = __randomBlock_41() + __randomBlock_41();
2895 return letter + timestamp + counter + print + random;
2896}
2897
2898__cuid_41.fingerprint = _$fingerprint_42;
2899var _$cuid_41 = __cuid_41;
2900
2901/* removed: var _$cuid_41 = require('@bugsnag/cuid'); */;
2902
2903/* removed: var _$assign_11 = require('@bugsnag/core/lib/es-utils/assign'); */;
2904
2905var BUGSNAG_ANONYMOUS_ID_KEY = 'bugsnag-anonymous-id';
2906
2907var getDeviceId = function () {
2908 try {
2909 var storage = window.localStorage;
2910 var id = storage.getItem(BUGSNAG_ANONYMOUS_ID_KEY); // If we get an ID, make sure it looks like a valid cuid. The length can
2911 // fluctuate slightly, so some leeway is built in
2912
2913 if (id && /^c[a-z0-9]{20,32}$/.test(id)) {
2914 return id;
2915 }
2916
2917 id = _$cuid_41();
2918 storage.setItem(BUGSNAG_ANONYMOUS_ID_KEY, id);
2919 return id;
2920 } catch (err) {// If localStorage is not available (e.g. because it's disabled) then give up
2921 }
2922};
2923/*
2924 * Automatically detects browser device details
2925 */
2926
2927
2928var _$device_40 = function (nav, screen) {
2929 if (nav === void 0) {
2930 nav = navigator;
2931 }
2932
2933 if (screen === void 0) {
2934 screen = window.screen;
2935 }
2936
2937 return {
2938 load: function (client) {
2939 var device = {
2940 locale: nav.browserLanguage || nav.systemLanguage || nav.userLanguage || nav.language,
2941 userAgent: nav.userAgent
2942 };
2943
2944 if (screen && screen.orientation && screen.orientation.type) {
2945 device.orientation = screen.orientation.type;
2946 } else {
2947 device.orientation = document.documentElement.clientWidth > document.documentElement.clientHeight ? 'landscape' : 'portrait';
2948 }
2949
2950 if (client._config.generateAnonymousId) {
2951 device.id = getDeviceId();
2952 }
2953
2954 client.addOnSession(function (session) {
2955 session.device = _$assign_11({}, session.device, device);
2956 }); // add time just as the event is sent
2957
2958 client.addOnError(function (event) {
2959 event.device = _$assign_11({}, event.device, device, {
2960 time: new Date()
2961 });
2962 }, true);
2963 },
2964 configSchema: {
2965 generateAnonymousId: {
2966 validate: function (value) {
2967 return value === true || value === false;
2968 },
2969 defaultValue: function () {
2970 return true;
2971 },
2972 message: 'should be true|false'
2973 }
2974 }
2975 };
2976};
2977
2978/* removed: var _$assign_11 = require('@bugsnag/core/lib/es-utils/assign'); */;
2979/*
2980 * Sets the event request: { url } to be the current href
2981 */
2982
2983
2984var _$request_44 = function (win) {
2985 if (win === void 0) {
2986 win = window;
2987 }
2988
2989 return {
2990 load: function (client) {
2991 client.addOnError(function (event) {
2992 if (event.request && event.request.url) return;
2993 event.request = _$assign_11({}, event.request, {
2994 url: win.location.href
2995 });
2996 }, true);
2997 }
2998 };
2999};
3000
3001/* removed: var _$includes_13 = require('@bugsnag/core/lib/es-utils/includes'); */;
3002
3003var _$session_45 = {
3004 load: function (client) {
3005 client._sessionDelegate = sessionDelegate;
3006 }
3007};
3008var sessionDelegate = {
3009 startSession: function (client, session) {
3010 var sessionClient = client;
3011 sessionClient._session = session;
3012 sessionClient._pausedSession = null; // exit early if the current releaseStage is not enabled
3013
3014 if (sessionClient._config.enabledReleaseStages !== null && !_$includes_13(sessionClient._config.enabledReleaseStages, sessionClient._config.releaseStage)) {
3015 sessionClient._logger.warn('Session not sent due to releaseStage/enabledReleaseStages configuration');
3016
3017 return sessionClient;
3018 }
3019
3020 sessionClient._delivery.sendSession({
3021 notifier: sessionClient._notifier,
3022 device: session.device,
3023 app: session.app,
3024 sessions: [{
3025 id: session.id,
3026 startedAt: session.startedAt,
3027 user: session._user
3028 }]
3029 });
3030
3031 return sessionClient;
3032 },
3033 resumeSession: function (client) {
3034 if (client._pausedSession) {
3035 client._session = client._pausedSession;
3036 client._pausedSession = null;
3037 return client;
3038 } else {
3039 return client.startSession();
3040 }
3041 },
3042 pauseSession: function (client) {
3043 client._pausedSession = client._session;
3044 client._session = null;
3045 }
3046};
3047
3048/* removed: var _$assign_11 = require('@bugsnag/core/lib/es-utils/assign'); */;
3049/*
3050 * Prevent collection of user IPs
3051 */
3052
3053
3054var _$clientIp_46 = {
3055 load: function (client) {
3056 if (client._config.collectUserIp) return;
3057 client.addOnError(function (event) {
3058 // If user.id is explicitly undefined, it will be missing from the payload. It needs
3059 // removing so that the following line replaces it
3060 if (event._user && typeof event._user.id === 'undefined') delete event._user.id;
3061 event._user = _$assign_11({
3062 id: '[REDACTED]'
3063 }, event._user);
3064 event.request = _$assign_11({
3065 clientIp: '[REDACTED]'
3066 }, event.request);
3067 });
3068 },
3069 configSchema: {
3070 collectUserIp: {
3071 defaultValue: function () {
3072 return true;
3073 },
3074 message: 'should be true|false',
3075 validate: function (value) {
3076 return value === true || value === false;
3077 }
3078 }
3079 }
3080};
3081
3082var _$consoleBreadcrumbs_47 = {};
3083/* removed: var _$map_16 = require('@bugsnag/core/lib/es-utils/map'); */;
3084
3085/* removed: var _$reduce_17 = require('@bugsnag/core/lib/es-utils/reduce'); */;
3086
3087/* removed: var _$filter_12 = require('@bugsnag/core/lib/es-utils/filter'); */;
3088
3089/* removed: var _$includes_13 = require('@bugsnag/core/lib/es-utils/includes'); */;
3090/*
3091 * Leaves breadcrumbs when console log methods are called
3092 */
3093
3094
3095_$consoleBreadcrumbs_47.load = function (client) {
3096 var isDev = /^dev(elopment)?$/.test(client._config.releaseStage);
3097 if (!client._config.enabledBreadcrumbTypes || !_$includes_13(client._config.enabledBreadcrumbTypes, 'log') || isDev) return;
3098 _$map_16(CONSOLE_LOG_METHODS, function (method) {
3099 var original = console[method];
3100
3101 console[method] = function () {
3102 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3103 args[_key] = arguments[_key];
3104 }
3105
3106 client.leaveBreadcrumb('Console output', _$reduce_17(args, function (accum, arg, i) {
3107 // do the best/simplest stringification of each argument
3108 var stringified = '[Unknown value]'; // this may fail if the input is:
3109 // - an object whose [[Prototype]] is null (no toString)
3110 // - an object with a broken toString or @@toPrimitive implementation
3111
3112 try {
3113 stringified = String(arg);
3114 } catch (e) {} // if it stringifies to [object Object] attempt to JSON stringify
3115
3116
3117 if (stringified === '[object Object]') {
3118 // catch stringify errors and fallback to [object Object]
3119 try {
3120 stringified = JSON.stringify(arg);
3121 } catch (e) {}
3122 }
3123
3124 accum["[" + i + "]"] = stringified;
3125 return accum;
3126 }, {
3127 severity: method.indexOf('group') === 0 ? 'log' : method
3128 }), 'log');
3129 original.apply(console, args);
3130 };
3131
3132 console[method]._restore = function () {
3133 console[method] = original;
3134 };
3135 });
3136};
3137
3138if (false) {}
3139
3140var CONSOLE_LOG_METHODS = _$filter_12(['log', 'debug', 'info', 'warn', 'error'], function (method) {
3141 return typeof console !== 'undefined' && typeof console[method] === 'function';
3142});
3143
3144/* removed: var _$map_16 = require('@bugsnag/core/lib/es-utils/map'); */;
3145
3146/* removed: var _$reduce_17 = require('@bugsnag/core/lib/es-utils/reduce'); */;
3147
3148/* removed: var _$filter_12 = require('@bugsnag/core/lib/es-utils/filter'); */;
3149
3150var MAX_LINE_LENGTH = 200;
3151var MAX_SCRIPT_LENGTH = 500000;
3152
3153var _$inlineScriptContent_48 = function (doc, win) {
3154 if (doc === void 0) {
3155 doc = document;
3156 }
3157
3158 if (win === void 0) {
3159 win = window;
3160 }
3161
3162 return {
3163 load: function (client) {
3164 if (!client._config.trackInlineScripts) return;
3165 var originalLocation = win.location.href;
3166 var html = '';
3167 var DOMContentLoaded = false;
3168
3169 var getHtml = function () {
3170 return doc.documentElement.outerHTML;
3171 }; // get whatever HTML exists at this point in time
3172
3173
3174 html = getHtml();
3175 var prev = doc.onreadystatechange; // then update it when the DOM content has loaded
3176
3177 doc.onreadystatechange = function () {
3178 // IE8 compatible alternative to document#DOMContentLoaded
3179 if (doc.readyState === 'interactive') {
3180 html = getHtml();
3181 DOMContentLoaded = true;
3182 }
3183
3184 try {
3185 prev.apply(this, arguments);
3186 } catch (e) {}
3187 };
3188
3189 var _lastScript = null;
3190
3191 var updateLastScript = function (script) {
3192 _lastScript = script;
3193 };
3194
3195 var getCurrentScript = function () {
3196 var script = doc.currentScript || _lastScript;
3197
3198 if (!script && !DOMContentLoaded) {
3199 var scripts = doc.scripts || doc.getElementsByTagName('script');
3200 script = scripts[scripts.length - 1];
3201 }
3202
3203 return script;
3204 };
3205
3206 var addSurroundingCode = function (lineNumber) {
3207 // get whatever html has rendered at this point
3208 if (!DOMContentLoaded || !html) html = getHtml(); // simulate the raw html
3209
3210 var htmlLines = ['<!-- DOC START -->'].concat(html.split('\n'));
3211 var zeroBasedLine = lineNumber - 1;
3212 var start = Math.max(zeroBasedLine - 3, 0);
3213 var end = Math.min(zeroBasedLine + 3, htmlLines.length);
3214 return _$reduce_17(htmlLines.slice(start, end), function (accum, line, i) {
3215 accum[start + 1 + i] = line.length <= MAX_LINE_LENGTH ? line : line.substr(0, MAX_LINE_LENGTH);
3216 return accum;
3217 }, {});
3218 };
3219
3220 client.addOnError(function (event) {
3221 // remove any of our own frames that may be part the stack this
3222 // happens before the inline script check as it happens for all errors
3223 event.errors[0].stacktrace = _$filter_12(event.errors[0].stacktrace, function (f) {
3224 return !/__trace__$/.test(f.method);
3225 });
3226 var frame = event.errors[0].stacktrace[0]; // if frame.file exists and is not the original location of the page, this can't be an inline script
3227
3228 if (frame && frame.file && frame.file.replace(/#.*$/, '') !== originalLocation.replace(/#.*$/, '')) return; // grab the last script known to have run
3229
3230 var currentScript = getCurrentScript();
3231
3232 if (currentScript) {
3233 var content = currentScript.innerHTML;
3234 event.addMetadata('script', 'content', content.length <= MAX_SCRIPT_LENGTH ? content : content.substr(0, MAX_SCRIPT_LENGTH));
3235 } // only attempt to grab some surrounding code if we have a line number
3236
3237
3238 if (!frame || !frame.lineNumber) return;
3239 frame.code = addSurroundingCode(frame.lineNumber);
3240 }, true); // Proxy all the timer functions whose callback is their 0th argument.
3241 // Keep a reference to the original setTimeout because we need it later
3242
3243 var _map = _$map_16(['setTimeout', 'setInterval', 'setImmediate', 'requestAnimationFrame'], function (fn) {
3244 return __proxy(win, fn, function (original) {
3245 return __traceOriginalScript(original, function (args) {
3246 return {
3247 get: function () {
3248 return args[0];
3249 },
3250 replace: function (fn) {
3251 args[0] = fn;
3252 }
3253 };
3254 });
3255 });
3256 }),
3257 _setTimeout = _map[0]; // Proxy all the host objects whose prototypes have an addEventListener function
3258
3259
3260 _$map_16(['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'], function (o) {
3261 if (!win[o] || !win[o].prototype || !Object.prototype.hasOwnProperty.call(win[o].prototype, 'addEventListener')) return;
3262
3263 __proxy(win[o].prototype, 'addEventListener', function (original) {
3264 return __traceOriginalScript(original, eventTargetCallbackAccessor);
3265 });
3266
3267 __proxy(win[o].prototype, 'removeEventListener', function (original) {
3268 return __traceOriginalScript(original, eventTargetCallbackAccessor, true);
3269 });
3270 });
3271
3272 function __traceOriginalScript(fn, callbackAccessor, alsoCallOriginal) {
3273 if (alsoCallOriginal === void 0) {
3274 alsoCallOriginal = false;
3275 }
3276
3277 return function () {
3278 // this is required for removeEventListener to remove anything added with
3279 // addEventListener before the functions started being wrapped by Bugsnag
3280 var args = [].slice.call(arguments);
3281
3282 try {
3283 var cba = callbackAccessor(args);
3284 var cb = cba.get();
3285 if (alsoCallOriginal) fn.apply(this, args);
3286 if (typeof cb !== 'function') return fn.apply(this, args);
3287
3288 if (cb.__trace__) {
3289 cba.replace(cb.__trace__);
3290 } else {
3291 var script = getCurrentScript(); // this function mustn't be annonymous due to a bug in the stack
3292 // generation logic, meaning it gets tripped up
3293 // see: https://github.com/stacktracejs/stack-generator/issues/6
3294
3295 cb.__trace__ = function __trace__() {
3296 // set the script that called this function
3297 updateLastScript(script); // immediately unset the currentScript synchronously below, however
3298 // if this cb throws an error the line after will not get run so schedule
3299 // an almost-immediate aysnc update too
3300
3301 _setTimeout(function () {
3302 updateLastScript(null);
3303 }, 0);
3304
3305 var ret = cb.apply(this, arguments);
3306 updateLastScript(null);
3307 return ret;
3308 };
3309
3310 cb.__trace__.__trace__ = cb.__trace__;
3311 cba.replace(cb.__trace__);
3312 }
3313 } catch (e) {} // swallow these errors on Selenium:
3314 // Permission denied to access property '__trace__'
3315 // WebDriverException: Message: Permission denied to access property "handleEvent"
3316 // IE8 doesn't let you call .apply() on setTimeout/setInterval
3317
3318
3319 if (fn.apply) return fn.apply(this, args);
3320
3321 switch (args.length) {
3322 case 1:
3323 return fn(args[0]);
3324
3325 case 2:
3326 return fn(args[0], args[1]);
3327
3328 default:
3329 return fn();
3330 }
3331 };
3332 }
3333 },
3334 configSchema: {
3335 trackInlineScripts: {
3336 validate: function (value) {
3337 return value === true || value === false;
3338 },
3339 defaultValue: function () {
3340 return true;
3341 },
3342 message: 'should be true|false'
3343 }
3344 }
3345 };
3346};
3347
3348function __proxy(host, name, replacer) {
3349 var original = host[name];
3350 if (!original) return original;
3351 var replacement = replacer(original);
3352 host[name] = replacement;
3353 return original;
3354}
3355
3356function eventTargetCallbackAccessor(args) {
3357 var isEventHandlerObj = !!args[1] && typeof args[1].handleEvent === 'function';
3358 return {
3359 get: function () {
3360 return isEventHandlerObj ? args[1].handleEvent : args[1];
3361 },
3362 replace: function (fn) {
3363 if (isEventHandlerObj) {
3364 args[1].handleEvent = fn;
3365 } else {
3366 args[1] = fn;
3367 }
3368 }
3369 };
3370}
3371
3372/* removed: var _$includes_13 = require('@bugsnag/core/lib/es-utils/includes'); */;
3373/*
3374 * Leaves breadcrumbs when the user interacts with the DOM
3375 */
3376
3377
3378var _$interactionBreadcrumbs_49 = function (win) {
3379 if (win === void 0) {
3380 win = window;
3381 }
3382
3383 return {
3384 load: function (client) {
3385 if (!('addEventListener' in win)) return;
3386 if (!client._config.enabledBreadcrumbTypes || !_$includes_13(client._config.enabledBreadcrumbTypes, 'user')) return;
3387 win.addEventListener('click', function (event) {
3388 var targetText, targetSelector;
3389
3390 try {
3391 targetText = getNodeText(event.target);
3392 targetSelector = getNodeSelector(event.target, win);
3393 } catch (e) {
3394 targetText = '[hidden]';
3395 targetSelector = '[hidden]';
3396
3397 client._logger.error('Cross domain error when tracking click event. See docs: https://tinyurl.com/yy3rn63z');
3398 }
3399
3400 client.leaveBreadcrumb('UI click', {
3401 targetText: targetText,
3402 targetSelector: targetSelector
3403 }, 'user');
3404 }, true);
3405 }
3406 };
3407}; // extract text content from a element
3408
3409
3410var getNodeText = function (el) {
3411 var text = el.textContent || el.innerText || '';
3412 if (!text && (el.type === 'submit' || el.type === 'button')) text = el.value;
3413 text = text.replace(/^\s+|\s+$/g, ''); // trim whitespace
3414
3415 return truncate(text, 140);
3416}; // Create a label from tagname, id and css class of the element
3417
3418
3419function getNodeSelector(el, win) {
3420 var parts = [el.tagName];
3421 if (el.id) parts.push('#' + el.id);
3422 if (el.className && el.className.length) parts.push("." + el.className.split(' ').join('.')); // Can't get much more advanced with the current browser
3423
3424 if (!win.document.querySelectorAll || !Array.prototype.indexOf) return parts.join('');
3425
3426 try {
3427 if (win.document.querySelectorAll(parts.join('')).length === 1) return parts.join('');
3428 } catch (e) {
3429 // Sometimes the query selector can be invalid just return it as-is
3430 return parts.join('');
3431 } // try to get a more specific selector if this one matches more than one element
3432
3433
3434 if (el.parentNode.childNodes.length > 1) {
3435 var index = Array.prototype.indexOf.call(el.parentNode.childNodes, el) + 1;
3436 parts.push(":nth-child(" + index + ")");
3437 }
3438
3439 if (win.document.querySelectorAll(parts.join('')).length === 1) return parts.join(''); // try prepending the parent node selector
3440
3441 if (el.parentNode) return getNodeSelector(el.parentNode, win) + " > " + parts.join('');
3442 return parts.join('');
3443}
3444
3445function truncate(value, length) {
3446 var ommision = '(...)';
3447 if (value && value.length <= length) return value;
3448 return value.slice(0, length - ommision.length) + ommision;
3449}
3450
3451var _$navigationBreadcrumbs_50 = {};
3452/* removed: var _$includes_13 = require('@bugsnag/core/lib/es-utils/includes'); */;
3453/*
3454* Leaves breadcrumbs when navigation methods are called or events are emitted
3455*/
3456
3457
3458_$navigationBreadcrumbs_50 = function (win) {
3459 if (win === void 0) {
3460 win = window;
3461 }
3462
3463 var plugin = {
3464 load: function (client) {
3465 if (!('addEventListener' in win)) return;
3466 if (!client._config.enabledBreadcrumbTypes || !_$includes_13(client._config.enabledBreadcrumbTypes, 'navigation')) return; // returns a function that will drop a breadcrumb with a given name
3467
3468 var drop = function (name) {
3469 return function () {
3470 return client.leaveBreadcrumb(name, {}, 'navigation');
3471 };
3472 }; // simple drops – just names, no meta
3473
3474
3475 win.addEventListener('pagehide', drop('Page hidden'), true);
3476 win.addEventListener('pageshow', drop('Page shown'), true);
3477 win.addEventListener('load', drop('Page loaded'), true);
3478 win.document.addEventListener('DOMContentLoaded', drop('DOMContentLoaded'), true); // some browsers like to emit popstate when the page loads, so only add the popstate listener after that
3479
3480 win.addEventListener('load', function () {
3481 return win.addEventListener('popstate', drop('Navigated back'), true);
3482 }); // hashchange has some metadata that we care about
3483
3484 win.addEventListener('hashchange', function (event) {
3485 var metadata = event.oldURL ? {
3486 from: relativeLocation(event.oldURL, win),
3487 to: relativeLocation(event.newURL, win),
3488 state: getCurrentState(win)
3489 } : {
3490 to: relativeLocation(win.location.href, win)
3491 };
3492 client.leaveBreadcrumb('Hash changed', metadata, 'navigation');
3493 }, true); // the only way to know about replaceState/pushState is to wrap them… >_<
3494
3495 if (win.history.replaceState) wrapHistoryFn(client, win.history, 'replaceState', win);
3496 if (win.history.pushState) wrapHistoryFn(client, win.history, 'pushState', win);
3497 client.leaveBreadcrumb('Bugsnag loaded', {}, 'navigation');
3498 }
3499 };
3500
3501 if (false) {}
3502
3503 return plugin;
3504};
3505
3506if (false) {} // takes a full url like http://foo.com:1234/pages/01.html?yes=no#section-2 and returns
3507// just the path and hash parts, e.g. /pages/01.html?yes=no#section-2
3508
3509
3510var relativeLocation = function (url, win) {
3511 var a = win.document.createElement('A');
3512 a.href = url;
3513 return "" + a.pathname + a.search + a.hash;
3514};
3515
3516var stateChangeToMetadata = function (win, state, title, url) {
3517 var currentPath = relativeLocation(win.location.href, win);
3518 return {
3519 title: title,
3520 state: state,
3521 prevState: getCurrentState(win),
3522 to: url || currentPath,
3523 from: currentPath
3524 };
3525};
3526
3527var wrapHistoryFn = function (client, target, fn, win) {
3528 var orig = target[fn];
3529
3530 target[fn] = function (state, title, url) {
3531 client.leaveBreadcrumb("History " + fn, stateChangeToMetadata(win, state, title, url), 'navigation'); // if throttle plugin is in use, reset the event sent count
3532
3533 if (typeof client.resetEventCount === 'function') client.resetEventCount(); // if the client is operating in auto session-mode, a new route should trigger a new session
3534
3535 if (client._config.autoTrackSessions) client.startSession(); // Internet Explorer will convert `undefined` to a string when passed, causing an unintended redirect
3536 // to '/undefined'. therefore we only pass the url if it's not undefined.
3537
3538 orig.apply(target, [state, title].concat(url !== undefined ? url : []));
3539 };
3540
3541 if (false) {}
3542};
3543
3544var getCurrentState = function (win) {
3545 try {
3546 return win.history.state;
3547 } catch (e) {}
3548};
3549
3550var BREADCRUMB_TYPE = 'request'; // keys to safely store metadata on the request object
3551
3552var REQUEST_SETUP_KEY = 'BS~~S';
3553var REQUEST_URL_KEY = 'BS~~U';
3554var REQUEST_METHOD_KEY = 'BS~~M';
3555
3556/* removed: var _$includes_13 = require('@bugsnag/core/lib/es-utils/includes'); */;
3557/*
3558 * Leaves breadcrumbs when network requests occur
3559 */
3560
3561
3562var _$networkBreadcrumbs_51 = function (_ignoredUrls, win) {
3563 if (_ignoredUrls === void 0) {
3564 _ignoredUrls = [];
3565 }
3566
3567 if (win === void 0) {
3568 win = window;
3569 }
3570
3571 var restoreFunctions = [];
3572 var plugin = {
3573 load: function (client) {
3574 if (!client._config.enabledBreadcrumbTypes || !_$includes_13(client._config.enabledBreadcrumbTypes, 'request')) return;
3575 var ignoredUrls = [client._config.endpoints.notify, client._config.endpoints.sessions].concat(_ignoredUrls);
3576 monkeyPatchXMLHttpRequest();
3577 monkeyPatchFetch(); // XMLHttpRequest monkey patch
3578
3579 function monkeyPatchXMLHttpRequest() {
3580 if (!('addEventListener' in win.XMLHttpRequest.prototype)) return;
3581 var nativeOpen = win.XMLHttpRequest.prototype.open; // override native open()
3582
3583 win.XMLHttpRequest.prototype.open = function open(method, url) {
3584 // store url and HTTP method for later
3585 this[REQUEST_URL_KEY] = url;
3586 this[REQUEST_METHOD_KEY] = method; // if we have already setup listeners, it means open() was called twice, we need to remove
3587 // the listeners and recreate them
3588
3589 if (this[REQUEST_SETUP_KEY]) {
3590 this.removeEventListener('load', handleXHRLoad);
3591 this.removeEventListener('error', handleXHRError);
3592 } // attach load event listener
3593
3594
3595 this.addEventListener('load', handleXHRLoad); // attach error event listener
3596
3597 this.addEventListener('error', handleXHRError);
3598 this[REQUEST_SETUP_KEY] = true;
3599 nativeOpen.apply(this, arguments);
3600 };
3601
3602 if (false) {}
3603 }
3604
3605 function handleXHRLoad() {
3606 if (_$includes_13(ignoredUrls, this[REQUEST_URL_KEY])) {
3607 // don't leave a network breadcrumb from bugsnag notify calls
3608 return;
3609 }
3610
3611 var metadata = {
3612 status: this.status,
3613 request: this[REQUEST_METHOD_KEY] + " " + this[REQUEST_URL_KEY]
3614 };
3615
3616 if (this.status >= 400) {
3617 // contacted server but got an error response
3618 client.leaveBreadcrumb('XMLHttpRequest failed', metadata, BREADCRUMB_TYPE);
3619 } else {
3620 client.leaveBreadcrumb('XMLHttpRequest succeeded', metadata, BREADCRUMB_TYPE);
3621 }
3622 }
3623
3624 function handleXHRError() {
3625 if (_$includes_13(ignoredUrls, this[REQUEST_URL_KEY])) {
3626 // don't leave a network breadcrumb from bugsnag notify calls
3627 return;
3628 } // failed to contact server
3629
3630
3631 client.leaveBreadcrumb('XMLHttpRequest error', {
3632 request: this[REQUEST_METHOD_KEY] + " " + this[REQUEST_URL_KEY]
3633 }, BREADCRUMB_TYPE);
3634 } // window.fetch monkey patch
3635
3636
3637 function monkeyPatchFetch() {
3638 // only patch it if it exists and if it is not a polyfill (patching a polyfilled
3639 // fetch() results in duplicate breadcrumbs for the same request because the
3640 // implementation uses XMLHttpRequest which is also patched)
3641 if (!('fetch' in win) || win.fetch.polyfill) return;
3642 var oldFetch = win.fetch;
3643
3644 win.fetch = function fetch() {
3645 var _arguments = arguments;
3646 var urlOrRequest = arguments[0];
3647 var options = arguments[1];
3648 var method;
3649 var url = null;
3650
3651 if (urlOrRequest && typeof urlOrRequest === 'object') {
3652 url = urlOrRequest.url;
3653
3654 if (options && 'method' in options) {
3655 method = options.method;
3656 } else if (urlOrRequest && 'method' in urlOrRequest) {
3657 method = urlOrRequest.method;
3658 }
3659 } else {
3660 url = urlOrRequest;
3661
3662 if (options && 'method' in options) {
3663 method = options.method;
3664 }
3665 }
3666
3667 if (method === undefined) {
3668 method = 'GET';
3669 }
3670
3671 return new Promise(function (resolve, reject) {
3672 // pass through to native fetch
3673 oldFetch.apply(void 0, _arguments).then(function (response) {
3674 handleFetchSuccess(response, method, url);
3675 resolve(response);
3676 })["catch"](function (error) {
3677 handleFetchError(method, url);
3678 reject(error);
3679 });
3680 });
3681 };
3682
3683 if (false) {}
3684 }
3685
3686 var handleFetchSuccess = function (response, method, url) {
3687 var metadata = {
3688 status: response.status,
3689 request: method + " " + url
3690 };
3691
3692 if (response.status >= 400) {
3693 // when the request comes back with a 4xx or 5xx status it does not reject the fetch promise,
3694 client.leaveBreadcrumb('fetch() failed', metadata, BREADCRUMB_TYPE);
3695 } else {
3696 client.leaveBreadcrumb('fetch() succeeded', metadata, BREADCRUMB_TYPE);
3697 }
3698 };
3699
3700 var handleFetchError = function (method, url) {
3701 client.leaveBreadcrumb('fetch() error', {
3702 request: method + " " + url
3703 }, BREADCRUMB_TYPE);
3704 };
3705 }
3706 };
3707
3708 if (false) {}
3709
3710 return plugin;
3711};
3712
3713/* removed: var _$intRange_24 = require('@bugsnag/core/lib/validators/int-range'); */;
3714/*
3715 * Throttles and dedupes events
3716 */
3717
3718
3719var _$throttle_52 = {
3720 load: function (client) {
3721 // track sent events for each init of the plugin
3722 var n = 0; // add onError hook
3723
3724 client.addOnError(function (event) {
3725 // have max events been sent already?
3726 if (n >= client._config.maxEvents) return false;
3727 n++;
3728 });
3729
3730 client.resetEventCount = function () {
3731 n = 0;
3732 };
3733 },
3734 configSchema: {
3735 maxEvents: {
3736 defaultValue: function () {
3737 return 10;
3738 },
3739 message: 'should be a positive integer ≤100',
3740 validate: function (val) {
3741 return _$intRange_24(1, 100)(val);
3742 }
3743 }
3744 }
3745};
3746
3747var _$stripQueryString_53 = {};
3748/*
3749 * Remove query strings (and fragments) from stacktraces
3750 */
3751/* removed: var _$map_16 = require('@bugsnag/core/lib/es-utils/map'); */;
3752
3753/* removed: var _$reduce_17 = require('@bugsnag/core/lib/es-utils/reduce'); */;
3754
3755_$stripQueryString_53 = {
3756 load: function (client) {
3757 client.addOnError(function (event) {
3758 var allFrames = _$reduce_17(event.errors, function (accum, er) {
3759 return accum.concat(er.stacktrace);
3760 }, []);
3761 _$map_16(allFrames, function (frame) {
3762 frame.file = strip(frame.file);
3763 });
3764 });
3765 }
3766};
3767
3768var strip = _$stripQueryString_53._strip = function (str) {
3769 return typeof str === 'string' ? str.replace(/\?.*$/, '').replace(/#.*$/, '') : str;
3770};
3771
3772/*
3773 * Automatically notifies Bugsnag when window.onerror is called
3774 */
3775var _$onerror_54 = function (win) {
3776 if (win === void 0) {
3777 win = window;
3778 }
3779
3780 return {
3781 load: function (client) {
3782 if (!client._config.autoDetectErrors) return;
3783 if (!client._config.enabledErrorTypes.unhandledExceptions) return;
3784
3785 function onerror(messageOrEvent, url, lineNo, charNo, error) {
3786 // Ignore errors with no info due to CORS settings
3787 if (lineNo === 0 && /Script error\.?/.test(messageOrEvent)) {
3788 client._logger.warn('Ignoring cross-domain or eval script error. See docs: https://tinyurl.com/yy3rn63z');
3789 } else {
3790 // any error sent to window.onerror is unhandled and has severity=error
3791 var handledState = {
3792 severity: 'error',
3793 unhandled: true,
3794 severityReason: {
3795 type: 'unhandledException'
3796 }
3797 };
3798 var event; // window.onerror can be called in a number of ways. This big if-else is how we
3799 // figure out which arguments were supplied, and what kind of values it received.
3800
3801 if (error) {
3802 // if the last parameter (error) was supplied, this is a modern browser's
3803 // way of saying "this value was thrown and not caught"
3804 event = client.Event.create(error, true, handledState, 'window onerror', 1);
3805 decorateStack(event.errors[0].stacktrace, url, lineNo, charNo);
3806 } else if ( // This complex case detects "error" events that are typically synthesised
3807 // by jquery's trigger method (although can be created in other ways). In
3808 // order to detect this:
3809 // - the first argument (message) must exist and be an object (most likely it's a jQuery event)
3810 // - the second argument (url) must either not exist or be something other than a string (if it
3811 // exists and is not a string, it'll be the extraParameters argument from jQuery's trigger()
3812 // function)
3813 // - the third, fourth and fifth arguments must not exist (lineNo, charNo and error)
3814 typeof messageOrEvent === 'object' && messageOrEvent !== null && (!url || typeof url !== 'string') && !lineNo && !charNo && !error) {
3815 // The jQuery event may have a "type" property, if so use it as part of the error message
3816 var name = messageOrEvent.type ? "Event: " + messageOrEvent.type : 'Error'; // attempt to find a message from one of the conventional properties, but
3817 // default to empty string (the event will fill it with a placeholder)
3818
3819 var message = messageOrEvent.message || messageOrEvent.detail || '';
3820 event = client.Event.create({
3821 name: name,
3822 message: message
3823 }, true, handledState, 'window onerror', 1); // provide the original thing onerror received – not our error-like object we passed to _notify
3824
3825 event.originalError = messageOrEvent; // include the raw input as metadata – it might contain more info than we extracted
3826
3827 event.addMetadata('window onerror', {
3828 event: messageOrEvent,
3829 extraParameters: url
3830 });
3831 } else {
3832 // Lastly, if there was no "error" parameter this event was probably from an old
3833 // browser that doesn't support that. Instead we need to generate a stacktrace.
3834 event = client.Event.create(messageOrEvent, true, handledState, 'window onerror', 1);
3835 decorateStack(event.errors[0].stacktrace, url, lineNo, charNo);
3836 }
3837
3838 client._notify(event);
3839 }
3840
3841 if (typeof prevOnError === 'function') prevOnError.apply(this, arguments);
3842 }
3843
3844 var prevOnError = win.onerror;
3845 win.onerror = onerror;
3846 }
3847 };
3848}; // Sometimes the stacktrace has less information than was passed to window.onerror.
3849// This function will augment the first stackframe with any useful info that was
3850// received as arguments to the onerror callback.
3851
3852
3853var decorateStack = function (stack, url, lineNo, charNo) {
3854 if (!stack[0]) stack.push({});
3855 var culprit = stack[0];
3856 if (!culprit.file && typeof url === 'string') culprit.file = url;
3857 if (!culprit.lineNumber && isActualNumber(lineNo)) culprit.lineNumber = lineNo;
3858
3859 if (!culprit.columnNumber) {
3860 if (isActualNumber(charNo)) {
3861 culprit.columnNumber = charNo;
3862 } else if (window.event && isActualNumber(window.event.errorCharacter)) {
3863 culprit.columnNumber = window.event.errorCharacter;
3864 }
3865 }
3866};
3867
3868var isActualNumber = function (n) {
3869 return typeof n === 'number' && String.call(n) !== 'NaN';
3870};
3871
3872/* removed: var _$map_16 = require('@bugsnag/core/lib/es-utils/map'); */;
3873
3874/* removed: var _$iserror_19 = require('@bugsnag/core/lib/iserror'); */;
3875
3876var _listener;
3877/*
3878 * Automatically notifies Bugsnag when window.onunhandledrejection is called
3879 */
3880
3881
3882var _$unhandledRejection_55 = function (win) {
3883 if (win === void 0) {
3884 win = window;
3885 }
3886
3887 var plugin = {
3888 load: function (client) {
3889 if (!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections) return;
3890
3891 var listener = function (evt) {
3892 var error = evt.reason;
3893 var isBluebird = false; // accessing properties on evt.detail can throw errors (see #394)
3894
3895 try {
3896 if (evt.detail && evt.detail.reason) {
3897 error = evt.detail.reason;
3898 isBluebird = true;
3899 }
3900 } catch (e) {}
3901
3902 var event = client.Event.create(error, false, {
3903 severity: 'error',
3904 unhandled: true,
3905 severityReason: {
3906 type: 'unhandledPromiseRejection'
3907 }
3908 }, 'unhandledrejection handler', 1, client._logger);
3909
3910 if (isBluebird) {
3911 _$map_16(event.errors[0].stacktrace, fixBluebirdStacktrace(error));
3912 }
3913
3914 client._notify(event, function (event) {
3915 if (_$iserror_19(event.originalError) && !event.originalError.stack) {
3916 var _event$addMetadata;
3917
3918 event.addMetadata('unhandledRejection handler', (_event$addMetadata = {}, _event$addMetadata[Object.prototype.toString.call(event.originalError)] = {
3919 name: event.originalError.name,
3920 message: event.originalError.message,
3921 code: event.originalError.code
3922 }, _event$addMetadata));
3923 }
3924 });
3925 };
3926
3927 if ('addEventListener' in win) {
3928 win.addEventListener('unhandledrejection', listener);
3929 } else {
3930 win.onunhandledrejection = function (reason, promise) {
3931 listener({
3932 detail: {
3933 reason: reason,
3934 promise: promise
3935 }
3936 });
3937 };
3938 }
3939
3940 _listener = listener;
3941 }
3942 };
3943
3944 if (false) {}
3945
3946 return plugin;
3947}; // The stack parser on bluebird stacks in FF get a suprious first frame:
3948//
3949// Error: derp
3950// b@http://localhost:5000/bluebird.html:22:24
3951// a@http://localhost:5000/bluebird.html:18:9
3952// @http://localhost:5000/bluebird.html:14:9
3953//
3954// results in
3955// […]
3956// 0: Object { file: "Error: derp", method: undefined, lineNumber: undefined, … }
3957// 1: Object { file: "http://localhost:5000/bluebird.html", method: "b", lineNumber: 22, … }
3958// 2: Object { file: "http://localhost:5000/bluebird.html", method: "a", lineNumber: 18, … }
3959// 3: Object { file: "http://localhost:5000/bluebird.html", lineNumber: 14, columnNumber: 9, … }
3960//
3961// so the following reduce/accumulator function removes such frames
3962//
3963// Bluebird pads method names with spaces so trim that too…
3964// https://github.com/petkaantonov/bluebird/blob/b7f21399816d02f979fe434585334ce901dcaf44/src/debuggability.js#L568-L571
3965
3966
3967var fixBluebirdStacktrace = function (error) {
3968 return function (frame) {
3969 if (frame.file === error.toString()) return;
3970
3971 if (frame.method) {
3972 frame.method = frame.method.replace(/^\s+/, '');
3973 }
3974 };
3975};
3976
3977var _$notifier_2 = {};
3978var name = 'Bugsnag JavaScript';
3979var version = '7.5.4';
3980var url = 'https://github.com/bugsnag/bugsnag-js';
3981
3982/* removed: var _$Client_4 = require('@bugsnag/core/client'); */;
3983
3984/* removed: var _$Event_6 = require('@bugsnag/core/event'); */;
3985
3986/* removed: var _$Session_35 = require('@bugsnag/core/session'); */;
3987
3988/* removed: var _$Breadcrumb_3 = require('@bugsnag/core/breadcrumb'); */;
3989
3990/* removed: var _$map_16 = require('@bugsnag/core/lib/es-utils/map'); */;
3991
3992/* removed: var _$keys_15 = require('@bugsnag/core/lib/es-utils/keys'); */;
3993
3994/* removed: var _$assign_11 = require('@bugsnag/core/lib/es-utils/assign'); */; // extend the base config schema with some browser-specific options
3995
3996
3997var __schema_2 = _$assign_11({}, _$config_5.schema, _$config_1);
3998
3999/* removed: var _$onerror_54 = require('@bugsnag/plugin-window-onerror'); */;
4000
4001/* removed: var _$unhandledRejection_55 = require('@bugsnag/plugin-window-unhandled-rejection'); */;
4002
4003/* removed: var _$app_38 = require('@bugsnag/plugin-app-duration'); */;
4004
4005/* removed: var _$device_40 = require('@bugsnag/plugin-browser-device'); */;
4006
4007/* removed: var _$context_39 = require('@bugsnag/plugin-browser-context'); */;
4008
4009/* removed: var _$request_44 = require('@bugsnag/plugin-browser-request'); */;
4010
4011/* removed: var _$throttle_52 = require('@bugsnag/plugin-simple-throttle'); */;
4012
4013/* removed: var _$consoleBreadcrumbs_47 = require('@bugsnag/plugin-console-breadcrumbs'); */;
4014
4015/* removed: var _$networkBreadcrumbs_51 = require('@bugsnag/plugin-network-breadcrumbs'); */;
4016
4017/* removed: var _$navigationBreadcrumbs_50 = require('@bugsnag/plugin-navigation-breadcrumbs'); */;
4018
4019/* removed: var _$interactionBreadcrumbs_49 = require('@bugsnag/plugin-interaction-breadcrumbs'); */;
4020
4021/* removed: var _$inlineScriptContent_48 = require('@bugsnag/plugin-inline-script-content'); */;
4022
4023/* removed: var _$session_45 = require('@bugsnag/plugin-browser-session'); */;
4024
4025/* removed: var _$clientIp_46 = require('@bugsnag/plugin-client-ip'); */;
4026
4027/* removed: var _$stripQueryString_53 = require('@bugsnag/plugin-strip-query-string'); */; // delivery mechanisms
4028
4029
4030/* removed: var _$delivery_36 = require('@bugsnag/delivery-x-domain-request'); */;
4031
4032/* removed: var _$delivery_37 = require('@bugsnag/delivery-xml-http-request'); */;
4033
4034var Bugsnag = {
4035 _client: null,
4036 createClient: function (opts) {
4037 // handle very simple use case where user supplies just the api key as a string
4038 if (typeof opts === 'string') opts = {
4039 apiKey: opts
4040 };
4041 if (!opts) opts = {};
4042 var internalPlugins = [// add browser-specific plugins
4043 _$app_38, _$device_40(), _$context_39(), _$request_44(), _$throttle_52, _$session_45, _$clientIp_46, _$stripQueryString_53, _$onerror_54(), _$unhandledRejection_55(), _$navigationBreadcrumbs_50(), _$interactionBreadcrumbs_49(), _$networkBreadcrumbs_51(), _$consoleBreadcrumbs_47, // this one added last to avoid wrapping functionality before bugsnag uses it
4044 _$inlineScriptContent_48()]; // configure a client with user supplied options
4045
4046 var bugsnag = new _$Client_4(opts, __schema_2, internalPlugins, {
4047 name: name,
4048 version: version,
4049 url: url
4050 }); // set delivery based on browser capability (IE 8+9 have an XDomainRequest object)
4051
4052 bugsnag._setDelivery(window.XDomainRequest ? _$delivery_36 : _$delivery_37);
4053
4054 bugsnag._logger.debug('Loaded!');
4055
4056 return bugsnag._config.autoTrackSessions ? bugsnag.startSession() : bugsnag;
4057 },
4058 start: function (opts) {
4059 if (Bugsnag._client) {
4060 Bugsnag._client._logger.warn('Bugsnag.start() was called more than once. Ignoring.');
4061
4062 return Bugsnag._client;
4063 }
4064
4065 Bugsnag._client = Bugsnag.createClient(opts);
4066 return Bugsnag._client;
4067 }
4068};
4069_$map_16(['resetEventCount'].concat(_$keys_15(_$Client_4.prototype)), function (m) {
4070 if (/^_/.test(m)) return;
4071
4072 Bugsnag[m] = function () {
4073 if (!Bugsnag._client) return console.log("Bugsnag." + m + "() was called before Bugsnag.start()");
4074 Bugsnag._client._depth += 1;
4075
4076 var ret = Bugsnag._client[m].apply(Bugsnag._client, arguments);
4077
4078 Bugsnag._client._depth -= 1;
4079 return ret;
4080 };
4081});
4082_$notifier_2 = Bugsnag;
4083_$notifier_2.Client = _$Client_4;
4084_$notifier_2.Event = _$Event_6;
4085_$notifier_2.Session = _$Session_35;
4086_$notifier_2.Breadcrumb = _$Breadcrumb_3; // Export a "default" property for compatibility with ESM imports
4087
4088_$notifier_2["default"] = Bugsnag;
4089
4090return _$notifier_2;
4091
4092});
4093//# sourceMappingURL=bugsnag.js.map
4094
4095
4096/***/ }),
4097
4098/***/ "B9Yq":
4099/***/ (function(module, exports) {
4100
4101module.exports = function() {
4102 throw new Error("define cannot be used indirect");
4103};
4104
4105
4106/***/ }),
4107
4108/***/ "EhIR":
4109/***/ (function(module, exports, __webpack_require__) {
4110
4111/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010
4112// http://baagoe.com/en/RandomMusings/javascript/
4113// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror
4114// Original work is under MIT license -
4115
4116// Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>
4117//
4118// Permission is hereby granted, free of charge, to any person obtaining a copy
4119// of this software and associated documentation files (the "Software"), to deal
4120// in the Software without restriction, including without limitation the rights
4121// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4122// copies of the Software, and to permit persons to whom the Software is
4123// furnished to do so, subject to the following conditions:
4124//
4125// The above copyright notice and this permission notice shall be included in
4126// all copies or substantial portions of the Software.
4127//
4128// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4129// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4130// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4131// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4132// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4133// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4134// THE SOFTWARE.
4135
4136
4137
4138(function(global, module, define) {
4139
4140function Alea(seed) {
4141 var me = this, mash = Mash();
4142
4143 me.next = function() {
4144 var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32
4145 me.s0 = me.s1;
4146 me.s1 = me.s2;
4147 return me.s2 = t - (me.c = t | 0);
4148 };
4149
4150 // Apply the seeding algorithm from Baagoe.
4151 me.c = 1;
4152 me.s0 = mash(' ');
4153 me.s1 = mash(' ');
4154 me.s2 = mash(' ');
4155 me.s0 -= mash(seed);
4156 if (me.s0 < 0) { me.s0 += 1; }
4157 me.s1 -= mash(seed);
4158 if (me.s1 < 0) { me.s1 += 1; }
4159 me.s2 -= mash(seed);
4160 if (me.s2 < 0) { me.s2 += 1; }
4161 mash = null;
4162}
4163
4164function copy(f, t) {
4165 t.c = f.c;
4166 t.s0 = f.s0;
4167 t.s1 = f.s1;
4168 t.s2 = f.s2;
4169 return t;
4170}
4171
4172function impl(seed, opts) {
4173 var xg = new Alea(seed),
4174 state = opts && opts.state,
4175 prng = xg.next;
4176 prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }
4177 prng.double = function() {
4178 return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53
4179 };
4180 prng.quick = prng;
4181 if (state) {
4182 if (typeof(state) == 'object') copy(state, xg);
4183 prng.state = function() { return copy(xg, {}); }
4184 }
4185 return prng;
4186}
4187
4188function Mash() {
4189 var n = 0xefc8249d;
4190
4191 var mash = function(data) {
4192 data = String(data);
4193 for (var i = 0; i < data.length; i++) {
4194 n += data.charCodeAt(i);
4195 var h = 0.02519603282416938 * n;
4196 n = h >>> 0;
4197 h -= n;
4198 h *= n;
4199 n = h >>> 0;
4200 h -= n;
4201 n += h * 0x100000000; // 2^32
4202 }
4203 return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
4204 };
4205
4206 return mash;
4207}
4208
4209
4210if (module && module.exports) {
4211 module.exports = impl;
4212} else if (__webpack_require__("B9Yq") && __webpack_require__("PDX0")) {
4213 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),
4214 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
4215} else {
4216 this.alea = impl;
4217}
4218
4219})(
4220 this,
4221 true && module, // present in node.js
4222 __webpack_require__("B9Yq") // present with an AMD loader
4223);
4224
4225
4226
4227/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("YuTi")(module)))
4228
4229/***/ }),
4230
4231/***/ "GYWy":
4232/***/ (function(module, exports, __webpack_require__) {
4233
4234/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
4235;(function(root) {
4236
4237 /** Detect free variables */
4238 var freeExports = true && exports &&
4239 !exports.nodeType && exports;
4240 var freeModule = true && module &&
4241 !module.nodeType && module;
4242 var freeGlobal = typeof global == 'object' && global;
4243 if (
4244 freeGlobal.global === freeGlobal ||
4245 freeGlobal.window === freeGlobal ||
4246 freeGlobal.self === freeGlobal
4247 ) {
4248 root = freeGlobal;
4249 }
4250
4251 /**
4252 * The `punycode` object.
4253 * @name punycode
4254 * @type Object
4255 */
4256 var punycode,
4257
4258 /** Highest positive signed 32-bit float value */
4259 maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
4260
4261 /** Bootstring parameters */
4262 base = 36,
4263 tMin = 1,
4264 tMax = 26,
4265 skew = 38,
4266 damp = 700,
4267 initialBias = 72,
4268 initialN = 128, // 0x80
4269 delimiter = '-', // '\x2D'
4270
4271 /** Regular expressions */
4272 regexPunycode = /^xn--/,
4273 regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
4274 regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
4275
4276 /** Error messages */
4277 errors = {
4278 'overflow': 'Overflow: input needs wider integers to process',
4279 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
4280 'invalid-input': 'Invalid input'
4281 },
4282
4283 /** Convenience shortcuts */
4284 baseMinusTMin = base - tMin,
4285 floor = Math.floor,
4286 stringFromCharCode = String.fromCharCode,
4287
4288 /** Temporary variable */
4289 key;
4290
4291 /*--------------------------------------------------------------------------*/
4292
4293 /**
4294 * A generic error utility function.
4295 * @private
4296 * @param {String} type The error type.
4297 * @returns {Error} Throws a `RangeError` with the applicable error message.
4298 */
4299 function error(type) {
4300 throw new RangeError(errors[type]);
4301 }
4302
4303 /**
4304 * A generic `Array#map` utility function.
4305 * @private
4306 * @param {Array} array The array to iterate over.
4307 * @param {Function} callback The function that gets called for every array
4308 * item.
4309 * @returns {Array} A new array of values returned by the callback function.
4310 */
4311 function map(array, fn) {
4312 var length = array.length;
4313 var result = [];
4314 while (length--) {
4315 result[length] = fn(array[length]);
4316 }
4317 return result;
4318 }
4319
4320 /**
4321 * A simple `Array#map`-like wrapper to work with domain name strings or email
4322 * addresses.
4323 * @private
4324 * @param {String} domain The domain name or email address.
4325 * @param {Function} callback The function that gets called for every
4326 * character.
4327 * @returns {Array} A new string of characters returned by the callback
4328 * function.
4329 */
4330 function mapDomain(string, fn) {
4331 var parts = string.split('@');
4332 var result = '';
4333 if (parts.length > 1) {
4334 // In email addresses, only the domain name should be punycoded. Leave
4335 // the local part (i.e. everything up to `@`) intact.
4336 result = parts[0] + '@';
4337 string = parts[1];
4338 }
4339 // Avoid `split(regex)` for IE8 compatibility. See #17.
4340 string = string.replace(regexSeparators, '\x2E');
4341 var labels = string.split('.');
4342 var encoded = map(labels, fn).join('.');
4343 return result + encoded;
4344 }
4345
4346 /**
4347 * Creates an array containing the numeric code points of each Unicode
4348 * character in the string. While JavaScript uses UCS-2 internally,
4349 * this function will convert a pair of surrogate halves (each of which
4350 * UCS-2 exposes as separate characters) into a single code point,
4351 * matching UTF-16.
4352 * @see `punycode.ucs2.encode`
4353 * @see <https://mathiasbynens.be/notes/javascript-encoding>
4354 * @memberOf punycode.ucs2
4355 * @name decode
4356 * @param {String} string The Unicode input string (UCS-2).
4357 * @returns {Array} The new array of code points.
4358 */
4359 function ucs2decode(string) {
4360 var output = [],
4361 counter = 0,
4362 length = string.length,
4363 value,
4364 extra;
4365 while (counter < length) {
4366 value = string.charCodeAt(counter++);
4367 if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
4368 // high surrogate, and there is a next character
4369 extra = string.charCodeAt(counter++);
4370 if ((extra & 0xFC00) == 0xDC00) { // low surrogate
4371 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
4372 } else {
4373 // unmatched surrogate; only append this code unit, in case the next
4374 // code unit is the high surrogate of a surrogate pair
4375 output.push(value);
4376 counter--;
4377 }
4378 } else {
4379 output.push(value);
4380 }
4381 }
4382 return output;
4383 }
4384
4385 /**
4386 * Creates a string based on an array of numeric code points.
4387 * @see `punycode.ucs2.decode`
4388 * @memberOf punycode.ucs2
4389 * @name encode
4390 * @param {Array} codePoints The array of numeric code points.
4391 * @returns {String} The new Unicode string (UCS-2).
4392 */
4393 function ucs2encode(array) {
4394 return map(array, function(value) {
4395 var output = '';
4396 if (value > 0xFFFF) {
4397 value -= 0x10000;
4398 output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
4399 value = 0xDC00 | value & 0x3FF;
4400 }
4401 output += stringFromCharCode(value);
4402 return output;
4403 }).join('');
4404 }
4405
4406 /**
4407 * Converts a basic code point into a digit/integer.
4408 * @see `digitToBasic()`
4409 * @private
4410 * @param {Number} codePoint The basic numeric code point value.
4411 * @returns {Number} The numeric value of a basic code point (for use in
4412 * representing integers) in the range `0` to `base - 1`, or `base` if
4413 * the code point does not represent a value.
4414 */
4415 function basicToDigit(codePoint) {
4416 if (codePoint - 48 < 10) {
4417 return codePoint - 22;
4418 }
4419 if (codePoint - 65 < 26) {
4420 return codePoint - 65;
4421 }
4422 if (codePoint - 97 < 26) {
4423 return codePoint - 97;
4424 }
4425 return base;
4426 }
4427
4428 /**
4429 * Converts a digit/integer into a basic code point.
4430 * @see `basicToDigit()`
4431 * @private
4432 * @param {Number} digit The numeric value of a basic code point.
4433 * @returns {Number} The basic code point whose value (when used for
4434 * representing integers) is `digit`, which needs to be in the range
4435 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
4436 * used; else, the lowercase form is used. The behavior is undefined
4437 * if `flag` is non-zero and `digit` has no uppercase form.
4438 */
4439 function digitToBasic(digit, flag) {
4440 // 0..25 map to ASCII a..z or A..Z
4441 // 26..35 map to ASCII 0..9
4442 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
4443 }
4444
4445 /**
4446 * Bias adaptation function as per section 3.4 of RFC 3492.
4447 * https://tools.ietf.org/html/rfc3492#section-3.4
4448 * @private
4449 */
4450 function adapt(delta, numPoints, firstTime) {
4451 var k = 0;
4452 delta = firstTime ? floor(delta / damp) : delta >> 1;
4453 delta += floor(delta / numPoints);
4454 for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
4455 delta = floor(delta / baseMinusTMin);
4456 }
4457 return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
4458 }
4459
4460 /**
4461 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
4462 * symbols.
4463 * @memberOf punycode
4464 * @param {String} input The Punycode string of ASCII-only symbols.
4465 * @returns {String} The resulting string of Unicode symbols.
4466 */
4467 function decode(input) {
4468 // Don't use UCS-2
4469 var output = [],
4470 inputLength = input.length,
4471 out,
4472 i = 0,
4473 n = initialN,
4474 bias = initialBias,
4475 basic,
4476 j,
4477 index,
4478 oldi,
4479 w,
4480 k,
4481 digit,
4482 t,
4483 /** Cached calculation results */
4484 baseMinusT;
4485
4486 // Handle the basic code points: let `basic` be the number of input code
4487 // points before the last delimiter, or `0` if there is none, then copy
4488 // the first basic code points to the output.
4489
4490 basic = input.lastIndexOf(delimiter);
4491 if (basic < 0) {
4492 basic = 0;
4493 }
4494
4495 for (j = 0; j < basic; ++j) {
4496 // if it's not a basic code point
4497 if (input.charCodeAt(j) >= 0x80) {
4498 error('not-basic');
4499 }
4500 output.push(input.charCodeAt(j));
4501 }
4502
4503 // Main decoding loop: start just after the last delimiter if any basic code
4504 // points were copied; start at the beginning otherwise.
4505
4506 for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
4507
4508 // `index` is the index of the next character to be consumed.
4509 // Decode a generalized variable-length integer into `delta`,
4510 // which gets added to `i`. The overflow checking is easier
4511 // if we increase `i` as we go, then subtract off its starting
4512 // value at the end to obtain `delta`.
4513 for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
4514
4515 if (index >= inputLength) {
4516 error('invalid-input');
4517 }
4518
4519 digit = basicToDigit(input.charCodeAt(index++));
4520
4521 if (digit >= base || digit > floor((maxInt - i) / w)) {
4522 error('overflow');
4523 }
4524
4525 i += digit * w;
4526 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
4527
4528 if (digit < t) {
4529 break;
4530 }
4531
4532 baseMinusT = base - t;
4533 if (w > floor(maxInt / baseMinusT)) {
4534 error('overflow');
4535 }
4536
4537 w *= baseMinusT;
4538
4539 }
4540
4541 out = output.length + 1;
4542 bias = adapt(i - oldi, out, oldi == 0);
4543
4544 // `i` was supposed to wrap around from `out` to `0`,
4545 // incrementing `n` each time, so we'll fix that now:
4546 if (floor(i / out) > maxInt - n) {
4547 error('overflow');
4548 }
4549
4550 n += floor(i / out);
4551 i %= out;
4552
4553 // Insert `n` at position `i` of the output
4554 output.splice(i++, 0, n);
4555
4556 }
4557
4558 return ucs2encode(output);
4559 }
4560
4561 /**
4562 * Converts a string of Unicode symbols (e.g. a domain name label) to a
4563 * Punycode string of ASCII-only symbols.
4564 * @memberOf punycode
4565 * @param {String} input The string of Unicode symbols.
4566 * @returns {String} The resulting Punycode string of ASCII-only symbols.
4567 */
4568 function encode(input) {
4569 var n,
4570 delta,
4571 handledCPCount,
4572 basicLength,
4573 bias,
4574 j,
4575 m,
4576 q,
4577 k,
4578 t,
4579 currentValue,
4580 output = [],
4581 /** `inputLength` will hold the number of code points in `input`. */
4582 inputLength,
4583 /** Cached calculation results */
4584 handledCPCountPlusOne,
4585 baseMinusT,
4586 qMinusT;
4587
4588 // Convert the input in UCS-2 to Unicode
4589 input = ucs2decode(input);
4590
4591 // Cache the length
4592 inputLength = input.length;
4593
4594 // Initialize the state
4595 n = initialN;
4596 delta = 0;
4597 bias = initialBias;
4598
4599 // Handle the basic code points
4600 for (j = 0; j < inputLength; ++j) {
4601 currentValue = input[j];
4602 if (currentValue < 0x80) {
4603 output.push(stringFromCharCode(currentValue));
4604 }
4605 }
4606
4607 handledCPCount = basicLength = output.length;
4608
4609 // `handledCPCount` is the number of code points that have been handled;
4610 // `basicLength` is the number of basic code points.
4611
4612 // Finish the basic string - if it is not empty - with a delimiter
4613 if (basicLength) {
4614 output.push(delimiter);
4615 }
4616
4617 // Main encoding loop:
4618 while (handledCPCount < inputLength) {
4619
4620 // All non-basic code points < n have been handled already. Find the next
4621 // larger one:
4622 for (m = maxInt, j = 0; j < inputLength; ++j) {
4623 currentValue = input[j];
4624 if (currentValue >= n && currentValue < m) {
4625 m = currentValue;
4626 }
4627 }
4628
4629 // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
4630 // but guard against overflow
4631 handledCPCountPlusOne = handledCPCount + 1;
4632 if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
4633 error('overflow');
4634 }
4635
4636 delta += (m - n) * handledCPCountPlusOne;
4637 n = m;
4638
4639 for (j = 0; j < inputLength; ++j) {
4640 currentValue = input[j];
4641
4642 if (currentValue < n && ++delta > maxInt) {
4643 error('overflow');
4644 }
4645
4646 if (currentValue == n) {
4647 // Represent delta as a generalized variable-length integer
4648 for (q = delta, k = base; /* no condition */; k += base) {
4649 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
4650 if (q < t) {
4651 break;
4652 }
4653 qMinusT = q - t;
4654 baseMinusT = base - t;
4655 output.push(
4656 stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
4657 );
4658 q = floor(qMinusT / baseMinusT);
4659 }
4660
4661 output.push(stringFromCharCode(digitToBasic(q, 0)));
4662 bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
4663 delta = 0;
4664 ++handledCPCount;
4665 }
4666 }
4667
4668 ++delta;
4669 ++n;
4670
4671 }
4672 return output.join('');
4673 }
4674
4675 /**
4676 * Converts a Punycode string representing a domain name or an email address
4677 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
4678 * it doesn't matter if you call it on a string that has already been
4679 * converted to Unicode.
4680 * @memberOf punycode
4681 * @param {String} input The Punycoded domain name or email address to
4682 * convert to Unicode.
4683 * @returns {String} The Unicode representation of the given Punycode
4684 * string.
4685 */
4686 function toUnicode(input) {
4687 return mapDomain(input, function(string) {
4688 return regexPunycode.test(string)
4689 ? decode(string.slice(4).toLowerCase())
4690 : string;
4691 });
4692 }
4693
4694 /**
4695 * Converts a Unicode string representing a domain name or an email address to
4696 * Punycode. Only the non-ASCII parts of the domain name will be converted,
4697 * i.e. it doesn't matter if you call it with a domain that's already in
4698 * ASCII.
4699 * @memberOf punycode
4700 * @param {String} input The domain name or email address to convert, as a
4701 * Unicode string.
4702 * @returns {String} The Punycode representation of the given domain name or
4703 * email address.
4704 */
4705 function toASCII(input) {
4706 return mapDomain(input, function(string) {
4707 return regexNonASCII.test(string)
4708 ? 'xn--' + encode(string)
4709 : string;
4710 });
4711 }
4712
4713 /*--------------------------------------------------------------------------*/
4714
4715 /** Define the public API */
4716 punycode = {
4717 /**
4718 * A string representing the current Punycode.js version number.
4719 * @memberOf punycode
4720 * @type String
4721 */
4722 'version': '1.4.1',
4723 /**
4724 * An object of methods to convert from JavaScript's internal character
4725 * representation (UCS-2) to Unicode code points, and back.
4726 * @see <https://mathiasbynens.be/notes/javascript-encoding>
4727 * @memberOf punycode
4728 * @type Object
4729 */
4730 'ucs2': {
4731 'decode': ucs2decode,
4732 'encode': ucs2encode
4733 },
4734 'decode': decode,
4735 'encode': encode,
4736 'toASCII': toASCII,
4737 'toUnicode': toUnicode
4738 };
4739
4740 /** Expose `punycode` */
4741 // Some AMD build optimizers, like r.js, check for specific condition patterns
4742 // like the following:
4743 if (
4744 true
4745 ) {
4746 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
4747 return punycode;
4748 }).call(exports, __webpack_require__, exports, module),
4749 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
4750 } else {}
4751
4752}(this));
4753
4754/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("YuTi")(module), __webpack_require__("yLpj")))
4755
4756/***/ }),
4757
4758/***/ "JGAB":
4759/***/ (function(module, __webpack_exports__, __webpack_require__) {
4760
4761"use strict";
4762/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return fetchApiWithPassword; });
4763/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return fetchApiForAdmin; });
4764/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("Ff2n");
4765/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("o0o1");
4766/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
4767/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("HaE+");
4768/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("20a2");
4769/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(next_router__WEBPACK_IMPORTED_MODULE_3__);
4770/* harmony import */ var query_string__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("cr+I");
4771/* harmony import */ var query_string__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(query_string__WEBPACK_IMPORTED_MODULE_4__);
4772/* harmony import */ var _actions_authActions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("fQHC");
4773/* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("hXAY");
4774
4775
4776
4777
4778
4779
4780
4781
4782var signOutAndRedirectToAuth = /*#__PURE__*/function () {
4783 var _ref = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee(errorMessage) {
4784 var redirect, url;
4785 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) {
4786 while (1) {
4787 switch (_context.prev = _context.next) {
4788 case 0:
4789 _context.next = 2;
4790 return window.__NEXT_REDUX_WRAPPER_STORE__.dispatch(Object(_actions_authActions__WEBPACK_IMPORTED_MODULE_5__[/* signOutUser */ "i"])(next_router__WEBPACK_IMPORTED_MODULE_3___default.a, true));
4791
4792 case 2:
4793 if (window) {
4794 redirect = window.location.pathname.replace('/', '');
4795 url = encodeURI("/auth?error=".concat(errorMessage, "&redirect=").concat(redirect));
4796 window.location.assign(url);
4797 }
4798
4799 case 3:
4800 case "end":
4801 return _context.stop();
4802 }
4803 }
4804 }, _callee);
4805 }));
4806
4807 return function signOutAndRedirectToAuth(_x) {
4808 return _ref.apply(this, arguments);
4809 };
4810}();
4811
4812var fetchApi = /*#__PURE__*/function () {
4813 var _ref2 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee3(path) {
4814 var options,
4815 url,
4816 auth,
4817 returnType,
4818 fetchOptions,
4819 query,
4820 _args3 = arguments;
4821 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee3$(_context3) {
4822 while (1) {
4823 switch (_context3.prev = _context3.next) {
4824 case 0:
4825 options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
4826 url = "".concat("https://unstoppabledomains.com", "/api").concat(path);
4827 auth = options.auth, returnType = options.returnType, fetchOptions = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(options, ["auth", "returnType"]);
4828
4829 if (auth) {
4830 fetchOptions.credentials = 'include';
4831 }
4832
4833 query = query_string__WEBPACK_IMPORTED_MODULE_4__["stringify"](options.query || {});
4834
4835 if (!query) {
4836 _context3.next = 9;
4837 break;
4838 }
4839
4840 if (!url.includes('?')) {
4841 _context3.next = 8;
4842 break;
4843 }
4844
4845 throw new Error("URL ".concat(url, " query parameters and query option can not be used together"));
4846
4847 case 8:
4848 url = [url, query].join('?');
4849
4850 case 9:
4851 return _context3.abrupt("return", fetch(url, fetchOptions).then( /*#__PURE__*/function () {
4852 var _ref3 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(res) {
4853 var status, _yield$res$json, error, message, _error$message;
4854
4855 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) {
4856 while (1) {
4857 switch (_context2.prev = _context2.next) {
4858 case 0:
4859 if (res.ok) {
4860 _context2.next = 21;
4861 break;
4862 }
4863
4864 status = res.status;
4865
4866 if (!(status === 403)) {
4867 _context2.next = 4;
4868 break;
4869 }
4870
4871 throw new _error__WEBPACK_IMPORTED_MODULE_6__[/* ApiError */ "a"](status, 'Attempt to Access Forbidden Route');
4872
4873 case 4:
4874 _context2.next = 6;
4875 return res.json();
4876
4877 case 6:
4878 _yield$res$json = _context2.sent;
4879 error = _yield$res$json.error;
4880
4881 if (typeof error === 'object') {
4882 message = (_error$message = error.message) !== null && _error$message !== void 0 ? _error$message : JSON.stringify(error);
4883 } else if (typeof error === 'string') {
4884 message = error;
4885 } else {
4886 message = "Request failed";
4887 }
4888
4889 _context2.t0 = status;
4890 _context2.next = _context2.t0 === 401 ? 12 : 20;
4891 break;
4892
4893 case 12:
4894 if (!message.includes('Missing')) {
4895 _context2.next = 17;
4896 break;
4897 }
4898
4899 _context2.next = 15;
4900 return signOutAndRedirectToAuth('Missing Session Cookie');
4901
4902 case 15:
4903 _context2.next = 19;
4904 break;
4905
4906 case 17:
4907 _context2.next = 19;
4908 return signOutAndRedirectToAuth('Invalid Session Cookie');
4909
4910 case 19:
4911 return _context2.abrupt("break", 20);
4912
4913 case 20:
4914 throw new _error__WEBPACK_IMPORTED_MODULE_6__[/* ApiError */ "a"](status, message);
4915
4916 case 21:
4917 if (!(returnType === 'json')) {
4918 _context2.next = 25;
4919 break;
4920 }
4921
4922 return _context2.abrupt("return", res.json());
4923
4924 case 25:
4925 if (!(returnType === 'text')) {
4926 _context2.next = 29;
4927 break;
4928 }
4929
4930 return _context2.abrupt("return", res.text());
4931
4932 case 29:
4933 return _context2.abrupt("return", res);
4934
4935 case 30:
4936 case "end":
4937 return _context2.stop();
4938 }
4939 }
4940 }, _callee2);
4941 }));
4942
4943 return function (_x3) {
4944 return _ref3.apply(this, arguments);
4945 };
4946 }()));
4947
4948 case 10:
4949 case "end":
4950 return _context3.stop();
4951 }
4952 }
4953 }, _callee3);
4954 }));
4955
4956 return function fetchApi(_x2) {
4957 return _ref2.apply(this, arguments);
4958 };
4959}();
4960
4961/* harmony default export */ __webpack_exports__["a"] = (fetchApi);
4962var fetchApiWithPassword = function fetchApiWithPassword(path) {
4963 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4964 var password = prompt('Please enter password', '');
4965 options.auth = true;
4966 options.headers = new Headers({
4967 'Content-Type': 'application/json',
4968 'Admin-Password': password
4969 });
4970 return fetchApiForAdmin(path, options);
4971};
4972var fetchApiForAdmin = /*#__PURE__*/function () {
4973 var _ref4 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee4(path) {
4974 var options,
4975 _args4 = arguments;
4976 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee4$(_context4) {
4977 while (1) {
4978 switch (_context4.prev = _context4.next) {
4979 case 0:
4980 options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
4981 _context4.prev = 1;
4982 _context4.next = 4;
4983 return fetchApi(path, options);
4984
4985 case 4:
4986 return _context4.abrupt("return", _context4.sent);
4987
4988 case 7:
4989 _context4.prev = 7;
4990 _context4.t0 = _context4["catch"](1);
4991
4992 if (!(_context4.t0.message === 'Attempt to Access Forbidden Route')) {
4993 _context4.next = 14;
4994 break;
4995 }
4996
4997 window.alert('Your account does not have access to this feature.');
4998 return _context4.abrupt("return", Promise.reject(_context4.t0.message));
4999
5000 case 14:
5001 throw _context4.t0;
5002
5003 case 15:
5004 case "end":
5005 return _context4.stop();
5006 }
5007 }
5008 }, _callee4, null, [[1, 7]]);
5009 }));
5010
5011 return function fetchApiForAdmin(_x4) {
5012 return _ref4.apply(this, arguments);
5013 };
5014}();
5015
5016/***/ }),
5017
5018/***/ "Jgta":
5019/***/ (function(module, __webpack_exports__, __webpack_require__) {
5020
5021"use strict";
5022/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("zIRd");
5023/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _firebase_app__WEBPACK_IMPORTED_MODULE_0__["a"]; });
5024
5025
5026
5027
5028var name = "firebase";
5029var version = "8.2.4";
5030
5031/**
5032 * @license
5033 * Copyright 2018 Google LLC
5034 *
5035 * Licensed under the Apache License, Version 2.0 (the "License");
5036 * you may not use this file except in compliance with the License.
5037 * You may obtain a copy of the License at
5038 *
5039 * http://www.apache.org/licenses/LICENSE-2.0
5040 *
5041 * Unless required by applicable law or agreed to in writing, software
5042 * distributed under the License is distributed on an "AS IS" BASIS,
5043 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5044 * See the License for the specific language governing permissions and
5045 * limitations under the License.
5046 */
5047_firebase_app__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].registerVersion(name, version, 'app');
5048//# sourceMappingURL=index.esm.js.map
5049
5050
5051/***/ }),
5052
5053/***/ "LpT6":
5054/***/ (function(module, __webpack_exports__, __webpack_require__) {
5055
5056"use strict";
5057
5058// EXPORTS
5059__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ identify; });
5060__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ page; });
5061__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ common_track; });
5062__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ common_getAnonymousId; });
5063__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ backendTrack; });
5064
5065// EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
5066var regenerator = __webpack_require__("o0o1");
5067var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
5068
5069// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
5070var defineProperty = __webpack_require__("rePB");
5071
5072// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
5073var asyncToGenerator = __webpack_require__("HaE+");
5074
5075// EXTERNAL MODULE: ./node_modules/react-cookies/build/cookie.js
5076var cookie = __webpack_require__("Po8q");
5077var cookie_default = /*#__PURE__*/__webpack_require__.n(cookie);
5078
5079// EXTERNAL MODULE: ./utils/fetchApi.ts
5080var fetchApi = __webpack_require__("JGAB");
5081
5082// EXTERNAL MODULE: ./analytics/helpers.ts
5083var helpers = __webpack_require__("jpLA");
5084
5085// CONCATENATED MODULE: ./utils/abTesting.ts
5086
5087var abTest = {
5088 experiment: '',
5089 variants: ['']
5090};
5091var abTesting_getVariantFromInitialProps = function getVariantFromInitialProps(ctx) {
5092 var variant; // Check for existing cookie
5093
5094 if (ctx.req) {
5095 var _ctx$res;
5096
5097 var cookieHeaders = ctx.req.headers.cookie;
5098
5099 if ((_ctx$res = ctx.res) === null || _ctx$res === void 0 ? void 0 : _ctx$res.getHeaders()['set-cookie']) {
5100 var _ctx$res2;
5101
5102 // Check for server set cookie
5103 cookieHeaders = ((_ctx$res2 = ctx.res) === null || _ctx$res2 === void 0 ? void 0 : _ctx$res2.getHeaders()['set-cookie']).find(function (cookieHeader) {
5104 return cookieHeader.includes(abTest.experiment);
5105 });
5106 }
5107
5108 if (cookieHeaders) {
5109 var abCookie = cookieHeaders.split(';').find(function (item) {
5110 return item.trimLeft().startsWith(abTest.experiment);
5111 });
5112 variant = abCookie ? abCookie.split('=')[1] : abTest.variants[0];
5113 }
5114 } else {
5115 variant = cookie_default.a.load(abTest.experiment);
5116 }
5117
5118 if (!variant || !abTest.variants.includes(variant)) {
5119 // Default to first variant
5120 variant = abTest.variants[0];
5121 }
5122
5123 return variant;
5124};
5125// CONCATENATED MODULE: ./analytics/common.ts
5126
5127
5128
5129
5130function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
5131
5132function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5133
5134
5135
5136
5137
5138
5139var common_getAbTraits = function getAbTraits() {
5140 // A|B Testing
5141 if (abTest.experiment) {
5142 var abEnv = cookie_default.a.load(abTest.experiment);
5143
5144 if (typeof abEnv !== 'undefined') {
5145 return {
5146 experiment_name: abTest.experiment,
5147 variation_name: abEnv
5148 };
5149 }
5150 }
5151
5152 return {};
5153};
5154
5155var identify = /*#__PURE__*/function () {
5156 var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee(traits) {
5157 var state, signedIn, abTraits, _state$profile, uid, email, name;
5158
5159 return regenerator_default.a.wrap(function _callee$(_context) {
5160 while (1) {
5161 switch (_context.prev = _context.next) {
5162 case 0:
5163 if (true) {
5164 _context.next = 2;
5165 break;
5166 }
5167
5168 return _context.abrupt("return");
5169
5170 case 2:
5171 _context.next = 4;
5172 return window.__NEXT_REDUX_WRAPPER_STORE__.getState();
5173
5174 case 4:
5175 state = _context.sent;
5176 signedIn = state.auth.signedIn;
5177 abTraits = common_getAbTraits();
5178
5179 if (signedIn) {
5180 _state$profile = state.profile, uid = _state$profile.uid, email = _state$profile.email;
5181 name = state.profile.displayName || '';
5182 window.rudderanalytics.identify(uid, _objectSpread(_objectSpread({
5183 name: name,
5184 email: email
5185 }, abTraits), traits));
5186 } else {
5187 window.rudderanalytics.identify(undefined, _objectSpread(_objectSpread({}, abTraits), traits));
5188 }
5189
5190 case 8:
5191 case "end":
5192 return _context.stop();
5193 }
5194 }
5195 }, _callee);
5196 }));
5197
5198 return function identify(_x) {
5199 return _ref.apply(this, arguments);
5200 };
5201}();
5202var page = function page() {
5203 if (false) {}
5204
5205 window.rudderanalytics.page();
5206};
5207var common_track = function track(name, properties) {
5208 if (false) {}
5209
5210 if (name === 'New User Registered') {
5211 Object(helpers["c" /* trackReddit */])('track', 'SignUp'); // Reddit Ads Tracking
5212 }
5213
5214 var abTraits = common_getAbTraits();
5215 window.rudderanalytics.track(name, _objectSpread({}, properties), {
5216 traits: abTraits
5217 });
5218};
5219var common_getAnonymousId = function getAnonymousId() {
5220 if (false) {}
5221
5222 var anonymousId = cookie_default.a.load('anonymousId');
5223
5224 if (!anonymousId || anonymousId === 'undefined') {
5225 anonymousId = window.rudderanalytics.getAnonymousId();
5226 cookie_default.a.save('anonymousId', anonymousId);
5227 }
5228
5229 return anonymousId;
5230};
5231var backendTrack = /*#__PURE__*/function () {
5232 var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2(event, properties) {
5233 var state, signedIn, anonymousId;
5234 return regenerator_default.a.wrap(function _callee2$(_context2) {
5235 while (1) {
5236 switch (_context2.prev = _context2.next) {
5237 case 0:
5238 if (true) {
5239 _context2.next = 2;
5240 break;
5241 }
5242
5243 return _context2.abrupt("return");
5244
5245 case 2:
5246 _context2.next = 4;
5247 return window.__NEXT_REDUX_WRAPPER_STORE__.getState();
5248
5249 case 4:
5250 state = _context2.sent;
5251 signedIn = state.auth.signedIn;
5252
5253 if (!signedIn) {
5254 anonymousId = common_getAnonymousId();
5255 }
5256
5257 void Object(fetchApi["a" /* default */])("/track", {
5258 method: 'POST',
5259 headers: new Headers({
5260 'Content-Type': 'application/json'
5261 }),
5262 body: JSON.stringify({
5263 event: event,
5264 properties: properties || undefined,
5265 userId: signedIn && state.profile ? state.profile.uid : undefined,
5266 anonymousId: !signedIn ? anonymousId : undefined
5267 })
5268 });
5269
5270 case 8:
5271 case "end":
5272 return _context2.stop();
5273 }
5274 }
5275 }, _callee2);
5276 }));
5277
5278 return function backendTrack(_x2, _x3) {
5279 return _ref2.apply(this, arguments);
5280 };
5281}();
5282
5283/***/ }),
5284
5285/***/ "Ls3p":
5286/***/ (function(module, __webpack_exports__, __webpack_require__) {
5287
5288"use strict";
5289/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getAuth; });
5290/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("o0o1");
5291/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
5292/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("HaE+");
5293/* harmony import */ var firebase_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("Jgta");
5294
5295
5296
5297function getAuth() {
5298 return _getAuth.apply(this, arguments);
5299}
5300
5301function _getAuth() {
5302 _getAuth = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() {
5303 var config;
5304 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {
5305 while (1) {
5306 switch (_context.prev = _context.next) {
5307 case 0:
5308 config = {
5309 apiKey: "AIzaSyDCFkfYnUbfSS6rZ_xeG4B8htmwsXBxMQY".toString(),
5310 authDomain: "unstoppable-domains.firebaseapp.com".toString()
5311 };
5312
5313 if (!firebase_app__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].apps.length) {
5314 _context.next = 3;
5315 break;
5316 }
5317
5318 return _context.abrupt("return", firebase_app__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].apps[0].auth());
5319
5320 case 3:
5321 _context.next = 5;
5322 return Promise.all(/* import() */[__webpack_require__.e(54), __webpack_require__.e(196)]).then(__webpack_require__.bind(null, "6nsN"));
5323
5324 case 5:
5325 firebase_app__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].initializeApp(config);
5326 return _context.abrupt("return", firebase_app__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].auth());
5327
5328 case 7:
5329 case "end":
5330 return _context.stop();
5331 }
5332 }
5333 }, _callee);
5334 }));
5335 return _getAuth.apply(this, arguments);
5336}
5337
5338/* unused harmony default export */ var _unused_webpack_default_export = ({
5339 getAuth: getAuth
5340});
5341
5342/***/ }),
5343
5344/***/ "NTr2":
5345/***/ (function(module, exports, __webpack_require__) {
5346
5347module.exports = __webpack_require__("ASyH")
5348
5349
5350/***/ }),
5351
5352/***/ "PDX0":
5353/***/ (function(module, exports) {
5354
5355/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {/* globals __webpack_amd_options__ */
5356module.exports = __webpack_amd_options__;
5357
5358/* WEBPACK VAR INJECTION */}.call(this, {}))
5359
5360/***/ }),
5361
5362/***/ "QwyX":
5363/***/ (function(module, __webpack_exports__, __webpack_require__) {
5364
5365"use strict";
5366/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return trackCartUpdate; });
5367/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return trackWatchlistUpdate; });
5368/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return trackCart; });
5369/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return trackCheckout; });
5370/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return trackCheckoutCompleted; });
5371/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("rePB");
5372/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("o0o1");
5373/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
5374/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("HaE+");
5375/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("a4XK");
5376/* harmony import */ var react_cookies__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("Po8q");
5377/* harmony import */ var react_cookies__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_cookies__WEBPACK_IMPORTED_MODULE_4__);
5378/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("jpLA");
5379/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("LpT6");
5380/* harmony import */ var utils_localStorageFallback__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("D3hz");
5381
5382
5383
5384
5385function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
5386
5387function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5388
5389
5390
5391
5392
5393
5394var PaymentTypeToMethod = {
5395 CreditCard: 'Credit Card',
5396 Crypto: 'Crypto Currency',
5397 StoreCredit: 'Store Credit',
5398 PayPal: 'PayPal'
5399};
5400var trackCartUpdate = /*#__PURE__*/function () {
5401 var _ref = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee(name, item) {
5402 var isRecommended,
5403 itemInfo,
5404 _args = arguments;
5405 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) {
5406 while (1) {
5407 switch (_context.prev = _context.next) {
5408 case 0:
5409 isRecommended = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
5410 _context.next = 3;
5411 return Object(_helpers__WEBPACK_IMPORTED_MODULE_5__[/* createProduct */ "a"])(item, isRecommended);
5412
5413 case 3:
5414 itemInfo = _context.sent;
5415 Object(_common__WEBPACK_IMPORTED_MODULE_6__[/* track */ "e"])(name, itemInfo);
5416
5417 if (name === _types__WEBPACK_IMPORTED_MODULE_3__[/* CART_DOMAIN_ADDED */ "i"]) {
5418 Object(_helpers__WEBPACK_IMPORTED_MODULE_5__[/* trackReddit */ "c"])('track', 'AddToCart'); // Reddit Ads Tracking
5419 }
5420
5421 case 6:
5422 case "end":
5423 return _context.stop();
5424 }
5425 }
5426 }, _callee);
5427 }));
5428
5429 return function trackCartUpdate(_x, _x2) {
5430 return _ref.apply(this, arguments);
5431 };
5432}();
5433var trackWatchlistUpdate = /*#__PURE__*/function () {
5434 var _ref2 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(name, domain) {
5435 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) {
5436 while (1) {
5437 switch (_context2.prev = _context2.next) {
5438 case 0:
5439 Object(_common__WEBPACK_IMPORTED_MODULE_6__[/* track */ "e"])(name, {
5440 domain: domain.name,
5441 label: domain.label,
5442 extension: domain.extension
5443 });
5444
5445 case 1:
5446 case "end":
5447 return _context2.stop();
5448 }
5449 }
5450 }, _callee2);
5451 }));
5452
5453 return function trackWatchlistUpdate(_x3, _x4) {
5454 return _ref2.apply(this, arguments);
5455 };
5456}();
5457var trackCart = /*#__PURE__*/function () {
5458 var _ref3 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee3(name, properties) {
5459 var cart, checkout_id;
5460 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee3$(_context3) {
5461 while (1) {
5462 switch (_context3.prev = _context3.next) {
5463 case 0:
5464 if (true) {
5465 _context3.next = 2;
5466 break;
5467 }
5468
5469 return _context3.abrupt("return");
5470
5471 case 2:
5472 _context3.next = 4;
5473 return Object(_helpers__WEBPACK_IMPORTED_MODULE_5__[/* parseCart */ "b"])(properties.value);
5474
5475 case 4:
5476 cart = _context3.sent;
5477 checkout_id = utils_localStorageFallback__WEBPACK_IMPORTED_MODULE_7__[/* softStorage */ "b"].getItem('checkout_id');
5478 Object(_common__WEBPACK_IMPORTED_MODULE_6__[/* track */ "e"])(name, _objectSpread(_objectSpread({}, cart), {}, {
5479 checkout_id: checkout_id
5480 }));
5481
5482 case 7:
5483 case "end":
5484 return _context3.stop();
5485 }
5486 }
5487 }, _callee3);
5488 }));
5489
5490 return function trackCart(_x5, _x6) {
5491 return _ref3.apply(this, arguments);
5492 };
5493}();
5494var trackCheckout = /*#__PURE__*/function () {
5495 var _ref4 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee4(name, properties) {
5496 var checkout_id, payment_method, checkout;
5497 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee4$(_context4) {
5498 while (1) {
5499 switch (_context4.prev = _context4.next) {
5500 case 0:
5501 if (true) {
5502 _context4.next = 2;
5503 break;
5504 }
5505
5506 return _context4.abrupt("return");
5507
5508 case 2:
5509 checkout_id = utils_localStorageFallback__WEBPACK_IMPORTED_MODULE_7__[/* softStorage */ "b"].getItem('checkout_id');
5510 payment_method = PaymentTypeToMethod[properties.method];
5511 checkout = {
5512 checkout_id: checkout_id,
5513 payment_method: payment_method,
5514 label: "Step #".concat(properties.step),
5515 step: properties.step
5516 };
5517 Object(_common__WEBPACK_IMPORTED_MODULE_6__[/* track */ "e"])(name, checkout);
5518
5519 case 6:
5520 case "end":
5521 return _context4.stop();
5522 }
5523 }
5524 }, _callee4);
5525 }));
5526
5527 return function trackCheckout(_x7, _x8) {
5528 return _ref4.apply(this, arguments);
5529 };
5530}();
5531var trackCheckoutCompleted = /*#__PURE__*/function () {
5532 var _ref5 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee5(properties) {
5533 var cart, checkout_id, campaign_code, payment_method, order;
5534 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee5$(_context5) {
5535 while (1) {
5536 switch (_context5.prev = _context5.next) {
5537 case 0:
5538 _context5.next = 2;
5539 return Object(_helpers__WEBPACK_IMPORTED_MODULE_5__[/* parseCart */ "b"])(properties.value);
5540
5541 case 2:
5542 cart = _context5.sent;
5543 checkout_id = utils_localStorageFallback__WEBPACK_IMPORTED_MODULE_7__[/* softStorage */ "b"].getItem('checkout_id');
5544 utils_localStorageFallback__WEBPACK_IMPORTED_MODULE_7__[/* softStorage */ "b"].removeItem('checkout_id');
5545 campaign_code = react_cookies__WEBPACK_IMPORTED_MODULE_4___default.a.load('campaignCode') || '';
5546 payment_method = PaymentTypeToMethod[properties.paymentType];
5547 order = _objectSpread(_objectSpread({}, cart), {}, {
5548 checkout_id: checkout_id,
5549 campaign_code: campaign_code,
5550 label: 'Revenue',
5551 order_id: properties.order_id,
5552 payment_method: payment_method,
5553 step: 5,
5554 revenue: cart.value,
5555 // Twitter ad properties
5556 currency: 'USD' // FB value
5557
5558 });
5559 Object(_common__WEBPACK_IMPORTED_MODULE_6__[/* track */ "e"])(_types__WEBPACK_IMPORTED_MODULE_3__[/* ORDER_COMPLETE */ "Q"], order);
5560 Object(_helpers__WEBPACK_IMPORTED_MODULE_5__[/* trackReddit */ "c"])('track', 'Purchase'); // Reddit Ads Tracking
5561
5562 case 10:
5563 case "end":
5564 return _context5.stop();
5565 }
5566 }
5567 }, _callee5);
5568 }));
5569
5570 return function trackCheckoutCompleted(_x9) {
5571 return _ref5.apply(this, arguments);
5572 };
5573}();
5574
5575/***/ }),
5576
5577/***/ "Ue81":
5578/***/ (function(module, __webpack_exports__, __webpack_require__) {
5579
5580"use strict";
5581/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return AUTH_SIGNIN_START; });
5582/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return AUTH_SIGNIN_SUCCESS; });
5583/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return AUTH_SIGNIN_FAILURE; });
5584/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return AUTH_SIGNIN_FALSE; });
5585/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return AUTH_UPDATE_START; });
5586/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return AUTH_UPDATE_SUCCESS; });
5587/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return AUTH_UPDATE_FAILURE; });
5588/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return AUTH_SIGNOUT; });
5589/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return AUTH_CREATE_START; });
5590/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return AUTH_CREATE_SUCCESS; });
5591/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AUTH_CREATE_FAILURE; });
5592/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return AUTH_SET_ERROR; });
5593/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return CART_ADD_ITEM; });
5594/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return CART_REMOVE_ITEM; });
5595/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return CART_SET_ITEMS; });
5596/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return CART_SET_ITEM_PRICE; });
5597/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return CART_SET_TRADEMARK; });
5598/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return CART_SET_AUCTION_DOMAIN; });
5599/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return CART_CLEAR_ITEMS; });
5600/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return CART_SET_ALL; });
5601/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return CLAIM_SET_DOMAINS; });
5602/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return CLAIM_ADD_DOMAIN; });
5603/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AUCTION_SET_DOMAIN; });
5604/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return WATCHLIST_ADD_ITEM; });
5605/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return WATCHLIST_REMOVE_ITEM; });
5606/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return WATCHLIST_SET_ITEMS; });
5607/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return PROFILE_SET_DATA; });
5608/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return PROFILE_SET_LOADING; });
5609/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return PROFILE_CLEAR; });
5610/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return PROFILE_SET_ERROR; });
5611/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return WARNINGS_SET_HIGH_ETH_GAS_PRICE; });
5612/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return FEATURE_FLAGS_SET_DATA; });
5613/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return GUEST_REQUEST_NEW_RESOLVER; });
5614/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return GUEST_ADD_PENDING_TXS; });
5615/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return GUEST_SET_CURRENT_TX_HASH; });
5616/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return GUEST_COMPLETE_TX; });
5617/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return GUEST_FAIL_TX; });
5618/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return GUEST_RESET; });
5619/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return WEBSITE_SORT_OPTIONS; });
5620/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return WEBSITE_SORT_KEYS; });
5621/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return ConfirmOperation; });
5622/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return ConfirmStatus; });
5623var AUTH_SIGNIN_START = 'AUTH_SIGNIN_START';
5624var AUTH_SIGNIN_SUCCESS = 'AUTH_SIGNIN_SUCCESS';
5625var AUTH_SIGNIN_FAILURE = 'AUTH_SIGNIN_FAILURE';
5626var AUTH_SIGNIN_FALSE = 'AUTH_SIGNIN_FALSE';
5627var AUTH_UPDATE_START = 'AUTH_UPDATE_START';
5628var AUTH_UPDATE_SUCCESS = 'AUTH_UPDATE_SUCCESS';
5629var AUTH_UPDATE_FAILURE = 'AUTH_UPDATE_FAILURE';
5630var AUTH_SIGNOUT = 'AUTH_SIGNOUT';
5631var AUTH_CREATE_START = 'AUTH_CREATE_START';
5632var AUTH_CREATE_SUCCESS = 'AUTH_CREATE_SUCCESS';
5633var AUTH_CREATE_FAILURE = 'AUTH_CREATE_FAILURE';
5634var AUTH_SET_ERROR = 'AUTH_SET_ERROR';
5635var CART_ADD_ITEM = 'CART_ADD_ITEM';
5636var CART_REMOVE_ITEM = 'CART_REMOVE_ITEM';
5637var CART_SET_ITEMS = 'CART_SET_ITEMS';
5638var CART_SET_ITEM_PRICE = 'CART_SET_ITEM_PRICE';
5639var CART_SET_TRADEMARK = 'CART_SET_TRADEMARK';
5640var CART_SET_AUCTION_DOMAIN = 'CART_SET_AUCTION_DOMAIN';
5641var CART_CLEAR_ITEMS = 'CART_CLEAR_ITEMS';
5642var CART_SET_ALL = 'CART_SET_ALL';
5643var CLAIM_SET_DOMAINS = 'CLAIM_SET_DOMAINS';
5644var CLAIM_ADD_DOMAIN = 'CLAIM_ADD_DOMAIN';
5645var AUCTION_SET_DOMAIN = 'AUCTION_SET_DOMAIN';
5646var WATCHLIST_ADD_ITEM = 'WATCHLIST_ADD_ITEM';
5647var WATCHLIST_REMOVE_ITEM = 'WATCHLIST_REMOVE_ITEM';
5648var WATCHLIST_SET_ITEMS = 'WATCHLIST_SET_ITEMS';
5649var PROFILE_SET_DATA = 'PROFILE_SET_DATA';
5650var PROFILE_SET_LOADING = 'PROFILE_SET_LOADING';
5651var PROFILE_CLEAR = 'PROFILE_CLEAR';
5652var PROFILE_SET_ERROR = 'PROFILE_SET_ERROR';
5653var WARNINGS_SET_HIGH_ETH_GAS_PRICE = 'WARNINGS_SET_HIGH_ETH_GAS_PRICE';
5654var FEATURE_FLAGS_SET_DATA = 'FEATURE_FLAGS_SET_DATA';
5655var GUEST_REQUEST_NEW_RESOLVER = 'GUEST_REQUEST_NEW_RESOLVER';
5656var GUEST_ADD_PENDING_TXS = 'GUEST_ADD_PENDING_TXS';
5657var GUEST_SET_CURRENT_TX_HASH = 'GUEST_SET_CURRENT_TX_HASH';
5658var GUEST_COMPLETE_TX = 'GUEST_COMPLETE_TX';
5659var GUEST_FAIL_TX = 'GUEST_FAIL_TX';
5660var GUEST_RESET = 'GUEST_RESET';
5661var WEBSITE_SORT_OPTIONS;
5662
5663(function (WEBSITE_SORT_OPTIONS) {
5664 WEBSITE_SORT_OPTIONS[WEBSITE_SORT_OPTIONS["name"] = 0] = "name";
5665 WEBSITE_SORT_OPTIONS[WEBSITE_SORT_OPTIONS["length"] = 1] = "length";
5666})(WEBSITE_SORT_OPTIONS || (WEBSITE_SORT_OPTIONS = {}));
5667
5668var WEBSITE_SORT_KEYS = ['name', 'length'];
5669var ConfirmOperation;
5670
5671(function (ConfirmOperation) {
5672 ConfirmOperation["Claim"] = "Claim";
5673 ConfirmOperation["AddWallet"] = "AddWallet";
5674 ConfirmOperation["ChangeEmail"] = "ChangeEmail";
5675})(ConfirmOperation || (ConfirmOperation = {}));
5676
5677var ConfirmStatus; // Transaction Types
5678
5679(function (ConfirmStatus) {
5680 ConfirmStatus["None"] = "None";
5681 ConfirmStatus["Pending"] = "Pending";
5682 ConfirmStatus["Confirmed"] = "Confirmed";
5683})(ConfirmStatus || (ConfirmStatus = {}));
5684
5685/***/ }),
5686
5687/***/ "YSVl":
5688/***/ (function(module, exports, __webpack_require__) {
5689
5690// A library of seedable RNGs implemented in Javascript.
5691//
5692// Usage:
5693//
5694// var seedrandom = require('seedrandom');
5695// var random = seedrandom(1); // or any seed.
5696// var x = random(); // 0 <= x < 1. Every bit is random.
5697// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.
5698
5699// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.
5700// Period: ~2^116
5701// Reported to pass all BigCrush tests.
5702var alea = __webpack_require__("EhIR");
5703
5704// xor128, a pure xor-shift generator by George Marsaglia.
5705// Period: 2^128-1.
5706// Reported to fail: MatrixRank and LinearComp.
5707var xor128 = __webpack_require__("uDiL");
5708
5709// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.
5710// Period: 2^192-2^32
5711// Reported to fail: CollisionOver, SimpPoker, and LinearComp.
5712var xorwow = __webpack_require__("pJ6O");
5713
5714// xorshift7, by François Panneton and Pierre L'ecuyer, takes
5715// a different approach: it adds robustness by allowing more shifts
5716// than Marsaglia's original three. It is a 7-shift generator
5717// with 256 bits, that passes BigCrush with no systmatic failures.
5718// Period 2^256-1.
5719// No systematic BigCrush failures reported.
5720var xorshift7 = __webpack_require__("yuCN");
5721
5722// xor4096, by Richard Brent, is a 4096-bit xor-shift with a
5723// very long period that also adds a Weyl generator. It also passes
5724// BigCrush with no systematic failures. Its long period may
5725// be useful if you have many generators and need to avoid
5726// collisions.
5727// Period: 2^4128-2^32.
5728// No systematic BigCrush failures reported.
5729var xor4096 = __webpack_require__("euyF");
5730
5731// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random
5732// number generator derived from ChaCha, a modern stream cipher.
5733// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf
5734// Period: ~2^127
5735// No systematic BigCrush failures reported.
5736var tychei = __webpack_require__("ie1u");
5737
5738// The original ARC4-based prng included in this library.
5739// Period: ~2^1600
5740var sr = __webpack_require__("pJ3+");
5741
5742sr.alea = alea;
5743sr.xor128 = xor128;
5744sr.xorwow = xorwow;
5745sr.xorshift7 = xorshift7;
5746sr.xor4096 = xor4096;
5747sr.tychei = tychei;
5748
5749module.exports = sr;
5750
5751
5752/***/ }),
5753
5754/***/ "ZFOp":
5755/***/ (function(module, exports, __webpack_require__) {
5756
5757"use strict";
5758
5759module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
5760
5761
5762/***/ }),
5763
5764/***/ "a4XK":
5765/***/ (function(module, __webpack_exports__, __webpack_require__) {
5766
5767"use strict";
5768/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return DOMAIN_SEARCHED; });
5769/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return SET_DOMAIN_RECORD; });
5770/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return DELETE_DOMAIN_RECORD; });
5771/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return KEY_GENERATED; });
5772/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return PASS_PHRASE_GENERATED; });
5773/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return KEY_DOWNLOADED; });
5774/* unused harmony export DOMAIN_LIST_VIEWED */
5775/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return CART_DOMAIN_ADDED; });
5776/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return CART_DOMAIN_REMOVED; });
5777/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return CART_VIEWED; });
5778/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return CHECKOUT_STARTED; });
5779/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return CHECKOUT_STEP_VIEWED; });
5780/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return CHECKOUT_STEP_COMPLETED; });
5781/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return ORDER_COMPLETE; });
5782/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return PAYMENT_INFO_ENTERED; });
5783/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return CHECKOUT_STEP_ERROR; });
5784/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "eb", function() { return WATCHLIST_TRACK_DOMAIN_ADDED; });
5785/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fb", function() { return WATCHLIST_TRACK_DOMAIN_REMOVED; });
5786/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return DOMAIN_TAG_CLICKED; });
5787/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return TELEGRAM_CLICKED; });
5788/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return FAQ_CLICKED; });
5789/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return REFERRAL_CODE_COPIED; });
5790/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return REFERRAL_CODE_REQUESTED; });
5791/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return USER_REGISTERED; });
5792/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return BULK_SEARCH_CLICKED; });
5793/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return SEARCH_CSV_UPLOADED; });
5794/* unused harmony export JOB_APPLICATION_SUBMITTED */
5795/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AD_REFERRAL; });
5796/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return EMAIL_POPUP_VIEWED; });
5797/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return AFFILIATE_SIGN_UP_STARTED; });
5798/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AFFILIATE_AGREEMENT_SIGNED; });
5799/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return AFFILIATE_SOCIAL_FORM_COMPLETED; });
5800/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return FDG_LANDING; });
5801/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return FDG_ROLL_DOMAIN_BUTTON_CLICKED; });
5802/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return FDG_CHECK_AVAILABILITY_CLICKED; });
5803/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return FDG_CLAIM_BUTTON_CLICKED; });
5804/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return FDG_SKIP_RECORD_BUTTON_CLICKED; });
5805/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return FDG_WEB3_BUTTON_CLICKED; });
5806/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return FDG_DOMAIN_SELECTED; });
5807/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return FDG_ACCOUNT_SIGNUP; });
5808/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return FDG_BACK_BUTTON_CLICKED; });
5809/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return FDG_SEARCH_BUTTON_CLICKED; });
5810/* unused harmony export AB_ORDER */
5811/* unused harmony export AB_REGISTER */
5812/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return MAC_BROWSER_DOWNLOAD; });
5813/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "gb", function() { return WINDOWS_BROWSER_DOWNLOAD; });
5814/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return CHROME_EXTENSION_CLICK; });
5815/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return METAMASK_CONNECTED; });
5816/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return TRUST_WALLET_DAPP_BROWSER_CONNECTED; });
5817/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return OPERA_BROWSER_CONNECTED; });
5818/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return CLAIM_WITH_METAMASK; });
5819/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return CLAIM_WITHOUT_METAMASK; });
5820/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return OPERA_GET_IT_ON_GOOGLE_PLAY_CLICK; });
5821/* unused harmony export OPERA_BANNER_CLICK */
5822/* unused harmony export OPERA_HOMEPAGE_CLICK */
5823/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return OPERA_LANDING; });
5824/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return IPFS_FILE_UPLOADED; });
5825/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "db", function() { return WALLET_CONNECT_CONNECTED; });
5826/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return BLOG_CREATED; });
5827/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cb", function() { return VISIT_APP_CLICK; });
5828/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return SUBMIT_APP_CLICK; });
5829/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return APP_SUBMITTED; });
5830/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return APP_EDIT_CLICK; });
5831/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return NEWLY_ADDED_APP_CLICK; });
5832/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bb", function() { return VIEW_APPLICATIONS_CLICK; });
5833/* unused harmony export PaymentTypeToMethod */
5834var DOMAIN_SEARCHED = 'Products Searched';
5835var SET_DOMAIN_RECORD = 'Domain Record Set';
5836var DELETE_DOMAIN_RECORD = 'Domain Record Deleted';
5837var KEY_GENERATED = 'Private Key Generated';
5838var PASS_PHRASE_GENERATED = 'Passphrase Generated';
5839var KEY_DOWNLOADED = 'Key Store Downloaded';
5840var DOMAIN_LIST_VIEWED = 'Product List Viewed';
5841var CART_DOMAIN_ADDED = 'Product Added';
5842var CART_DOMAIN_REMOVED = 'Product Removed';
5843var CART_VIEWED = 'Cart Viewed';
5844var CHECKOUT_STARTED = 'Checkout Started';
5845var CHECKOUT_STEP_VIEWED = 'Checkout Step Viewed';
5846var CHECKOUT_STEP_COMPLETED = 'Checkout Step Completed';
5847var ORDER_COMPLETE = 'Order Complete';
5848var PAYMENT_INFO_ENTERED = 'Payment Info Entered';
5849var CHECKOUT_STEP_ERROR = 'Checkout Step Error';
5850var WATCHLIST_TRACK_DOMAIN_ADDED = 'Product Added to Watchlist';
5851var WATCHLIST_TRACK_DOMAIN_REMOVED = 'Product Removed from Watchlist';
5852var DOMAIN_TAG_CLICKED = 'Domain Tag Clicked';
5853var TELEGRAM_CLICKED = 'Telegram Clicked';
5854var FAQ_CLICKED = 'FAQ Clicked';
5855var REFERRAL_CODE_COPIED = 'Referral Code Copied';
5856var REFERRAL_CODE_REQUESTED = 'Custom Referral Code Requested';
5857var USER_REGISTERED = 'New User Registered';
5858var BULK_SEARCH_CLICKED = 'Bulk Search Clicked';
5859var SEARCH_CSV_UPLOADED = 'Search CSV Uploaded';
5860var JOB_APPLICATION_SUBMITTED = 'Job Application Submitted';
5861var AD_REFERRAL = 'Ad Referral';
5862var EMAIL_POPUP_VIEWED = 'Email Popup Viewed';
5863var AFFILIATE_SIGN_UP_STARTED = 'Affiliate Sign Up Started';
5864var AFFILIATE_AGREEMENT_SIGNED = 'Affiliate Agreement Signed';
5865var AFFILIATE_SOCIAL_FORM_COMPLETED = 'Affiliate Social Form Completed';
5866var FDG_LANDING = 'Free Domain Giveaway Landing';
5867var FDG_ROLL_DOMAIN_BUTTON_CLICKED = 'Free Domain Giveaway Roll Domain Button Clicked';
5868var FDG_CHECK_AVAILABILITY_CLICKED = 'Free Domain Giveaway Check Domain Availability Clicked';
5869var FDG_CLAIM_BUTTON_CLICKED = 'Free Domain Giveaway Claim Button Clicked';
5870var FDG_SKIP_RECORD_BUTTON_CLICKED = 'Free Domain Giveaway Skip Record Button Clicked';
5871var FDG_WEB3_BUTTON_CLICKED = 'Free Domain Giveaway Web3 Button Clicked';
5872var FDG_DOMAIN_SELECTED = 'Free Domain Giveaway Domain Selected';
5873var FDG_ACCOUNT_SIGNUP = 'Free Domain Giveaway Account Created';
5874var FDG_BACK_BUTTON_CLICKED = 'Free Domain Giveaway Back Button Clicked';
5875var FDG_SEARCH_BUTTON_CLICKED = 'Free Domain Giveaway Search Button Clicked';
5876var AB_ORDER = 'AB Order';
5877var AB_REGISTER = 'AB Registration';
5878var MAC_BROWSER_DOWNLOAD = 'Mac browser download';
5879var WINDOWS_BROWSER_DOWNLOAD = 'Windows browser download';
5880var CHROME_EXTENSION_CLICK = 'Chrome extension clicked';
5881var METAMASK_CONNECTED = 'Metamask connected';
5882var TRUST_WALLET_DAPP_BROWSER_CONNECTED = 'Trust Wallet Dapp Browser connected';
5883var OPERA_BROWSER_CONNECTED = 'Opera Browser connected';
5884var CLAIM_WITH_METAMASK = 'Domains claimed with Metamask';
5885var CLAIM_WITHOUT_METAMASK = 'Domains claimed without Metamask';
5886var OPERA_GET_IT_ON_GOOGLE_PLAY_CLICK = 'Opera Page - Get it on google play clicked';
5887var OPERA_BANNER_CLICK = 'Opera Page - Banner clicked';
5888var OPERA_HOMEPAGE_CLICK = 'Opera Page - Homepage clicked';
5889var OPERA_LANDING = 'Opera Page - Landing';
5890var IPFS_FILE_UPLOADED = 'IPFS file uploaded';
5891var WALLET_CONNECT_CONNECTED = 'WalletConnect Connected';
5892var BLOG_CREATED = 'Blog Created';
5893var VISIT_APP_CLICK = 'App Page - Visit Application clicked';
5894var SUBMIT_APP_CLICK = 'Submit Application clicked';
5895var APP_SUBMITTED = 'App Application submitted';
5896var APP_EDIT_CLICK = 'Application edit clicked';
5897var NEWLY_ADDED_APP_CLICK = 'Newly added app link clicked';
5898var VIEW_APPLICATIONS_CLICK = 'View applications clicked';
5899var PaymentTypeToMethod = {
5900 CreditCard: 'Credit Card',
5901 Crypto: 'Crypto Currency',
5902 StoreCredit: 'Store Credit',
5903 PayPal: 'PayPal',
5904 CryptoDotCom: 'Crypto Dot Com',
5905 Web3: 'Web3'
5906}; // Event properties sent to Analytics.ts
5907
5908/***/ }),
5909
5910/***/ "aa/f":
5911/***/ (function(module, __webpack_exports__, __webpack_require__) {
5912
5913"use strict";
5914/* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("q1tI");
5915/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5916/* harmony import */ var _bugsnag_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("NTr2");
5917/* harmony import */ var _bugsnag_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_bugsnag_js__WEBPACK_IMPORTED_MODULE_1__);
5918/* harmony import */ var _bugsnag_plugin_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("29q8");
5919/* harmony import */ var _bugsnag_plugin_react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_bugsnag_plugin_react__WEBPACK_IMPORTED_MODULE_2__);
5920
5921
5922
5923var bugsnag = process.env.IS_TEST === 'true' && process.env.IS_SERVE_TEST !== 'true' ? {} : _bugsnag_js__WEBPACK_IMPORTED_MODULE_1___default.a.createClient({
5924 apiKey: "6de0f8d94542ae246541d7d650bd7d46",
5925 releaseStage: process.env.IS_STAGING === 'true' ? 'staging' : "production",
5926 enabledReleaseStages: ['production', 'staging'],
5927 appVersion: "2021-01-29t16-41-23utc-b088768",
5928 plugins: [new _bugsnag_plugin_react__WEBPACK_IMPORTED_MODULE_2___default.a(react__WEBPACK_IMPORTED_MODULE_0___default.a)]
5929});
5930/* harmony default export */ __webpack_exports__["a"] = (bugsnag);
5931/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
5932
5933/***/ }),
5934
5935/***/ "cr+I":
5936/***/ (function(module, exports, __webpack_require__) {
5937
5938"use strict";
5939
5940const strictUriEncode = __webpack_require__("ZFOp");
5941const decodeComponent = __webpack_require__("8jRI");
5942const splitOnFirst = __webpack_require__("8yz6");
5943
5944const isNullOrUndefined = value => value === null || value === undefined;
5945
5946function encoderForArrayFormat(options) {
5947 switch (options.arrayFormat) {
5948 case 'index':
5949 return key => (result, value) => {
5950 const index = result.length;
5951
5952 if (
5953 value === undefined ||
5954 (options.skipNull && value === null) ||
5955 (options.skipEmptyString && value === '')
5956 ) {
5957 return result;
5958 }
5959
5960 if (value === null) {
5961 return [...result, [encode(key, options), '[', index, ']'].join('')];
5962 }
5963
5964 return [
5965 ...result,
5966 [encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
5967 ];
5968 };
5969
5970 case 'bracket':
5971 return key => (result, value) => {
5972 if (
5973 value === undefined ||
5974 (options.skipNull && value === null) ||
5975 (options.skipEmptyString && value === '')
5976 ) {
5977 return result;
5978 }
5979
5980 if (value === null) {
5981 return [...result, [encode(key, options), '[]'].join('')];
5982 }
5983
5984 return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
5985 };
5986
5987 case 'comma':
5988 case 'separator':
5989 return key => (result, value) => {
5990 if (value === null || value === undefined || value.length === 0) {
5991 return result;
5992 }
5993
5994 if (result.length === 0) {
5995 return [[encode(key, options), '=', encode(value, options)].join('')];
5996 }
5997
5998 return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
5999 };
6000
6001 default:
6002 return key => (result, value) => {
6003 if (
6004 value === undefined ||
6005 (options.skipNull && value === null) ||
6006 (options.skipEmptyString && value === '')
6007 ) {
6008 return result;
6009 }
6010
6011 if (value === null) {
6012 return [...result, encode(key, options)];
6013 }
6014
6015 return [...result, [encode(key, options), '=', encode(value, options)].join('')];
6016 };
6017 }
6018}
6019
6020function parserForArrayFormat(options) {
6021 let result;
6022
6023 switch (options.arrayFormat) {
6024 case 'index':
6025 return (key, value, accumulator) => {
6026 result = /\[(\d*)\]$/.exec(key);
6027
6028 key = key.replace(/\[\d*\]$/, '');
6029
6030 if (!result) {
6031 accumulator[key] = value;
6032 return;
6033 }
6034
6035 if (accumulator[key] === undefined) {
6036 accumulator[key] = {};
6037 }
6038
6039 accumulator[key][result[1]] = value;
6040 };
6041
6042 case 'bracket':
6043 return (key, value, accumulator) => {
6044 result = /(\[\])$/.exec(key);
6045 key = key.replace(/\[\]$/, '');
6046
6047 if (!result) {
6048 accumulator[key] = value;
6049 return;
6050 }
6051
6052 if (accumulator[key] === undefined) {
6053 accumulator[key] = [value];
6054 return;
6055 }
6056
6057 accumulator[key] = [].concat(accumulator[key], value);
6058 };
6059
6060 case 'comma':
6061 case 'separator':
6062 return (key, value, accumulator) => {
6063 const isArray = typeof value === 'string' && value.split('').indexOf(options.arrayFormatSeparator) > -1;
6064 const newValue = isArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
6065 accumulator[key] = newValue;
6066 };
6067
6068 default:
6069 return (key, value, accumulator) => {
6070 if (accumulator[key] === undefined) {
6071 accumulator[key] = value;
6072 return;
6073 }
6074
6075 accumulator[key] = [].concat(accumulator[key], value);
6076 };
6077 }
6078}
6079
6080function validateArrayFormatSeparator(value) {
6081 if (typeof value !== 'string' || value.length !== 1) {
6082 throw new TypeError('arrayFormatSeparator must be single character string');
6083 }
6084}
6085
6086function encode(value, options) {
6087 if (options.encode) {
6088 return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
6089 }
6090
6091 return value;
6092}
6093
6094function decode(value, options) {
6095 if (options.decode) {
6096 return decodeComponent(value);
6097 }
6098
6099 return value;
6100}
6101
6102function keysSorter(input) {
6103 if (Array.isArray(input)) {
6104 return input.sort();
6105 }
6106
6107 if (typeof input === 'object') {
6108 return keysSorter(Object.keys(input))
6109 .sort((a, b) => Number(a) - Number(b))
6110 .map(key => input[key]);
6111 }
6112
6113 return input;
6114}
6115
6116function removeHash(input) {
6117 const hashStart = input.indexOf('#');
6118 if (hashStart !== -1) {
6119 input = input.slice(0, hashStart);
6120 }
6121
6122 return input;
6123}
6124
6125function getHash(url) {
6126 let hash = '';
6127 const hashStart = url.indexOf('#');
6128 if (hashStart !== -1) {
6129 hash = url.slice(hashStart);
6130 }
6131
6132 return hash;
6133}
6134
6135function extract(input) {
6136 input = removeHash(input);
6137 const queryStart = input.indexOf('?');
6138 if (queryStart === -1) {
6139 return '';
6140 }
6141
6142 return input.slice(queryStart + 1);
6143}
6144
6145function parseValue(value, options) {
6146 if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
6147 value = Number(value);
6148 } else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
6149 value = value.toLowerCase() === 'true';
6150 }
6151
6152 return value;
6153}
6154
6155function parse(input, options) {
6156 options = Object.assign({
6157 decode: true,
6158 sort: true,
6159 arrayFormat: 'none',
6160 arrayFormatSeparator: ',',
6161 parseNumbers: false,
6162 parseBooleans: false
6163 }, options);
6164
6165 validateArrayFormatSeparator(options.arrayFormatSeparator);
6166
6167 const formatter = parserForArrayFormat(options);
6168
6169 // Create an object with no prototype
6170 const ret = Object.create(null);
6171
6172 if (typeof input !== 'string') {
6173 return ret;
6174 }
6175
6176 input = input.trim().replace(/^[?#&]/, '');
6177
6178 if (!input) {
6179 return ret;
6180 }
6181
6182 for (const param of input.split('&')) {
6183 let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '=');
6184
6185 // Missing `=` should be `null`:
6186 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
6187 value = value === undefined ? null : ['comma', 'separator'].includes(options.arrayFormat) ? value : decode(value, options);
6188 formatter(decode(key, options), value, ret);
6189 }
6190
6191 for (const key of Object.keys(ret)) {
6192 const value = ret[key];
6193 if (typeof value === 'object' && value !== null) {
6194 for (const k of Object.keys(value)) {
6195 value[k] = parseValue(value[k], options);
6196 }
6197 } else {
6198 ret[key] = parseValue(value, options);
6199 }
6200 }
6201
6202 if (options.sort === false) {
6203 return ret;
6204 }
6205
6206 return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
6207 const value = ret[key];
6208 if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
6209 // Sort object keys, not values
6210 result[key] = keysSorter(value);
6211 } else {
6212 result[key] = value;
6213 }
6214
6215 return result;
6216 }, Object.create(null));
6217}
6218
6219exports.extract = extract;
6220exports.parse = parse;
6221
6222exports.stringify = (object, options) => {
6223 if (!object) {
6224 return '';
6225 }
6226
6227 options = Object.assign({
6228 encode: true,
6229 strict: true,
6230 arrayFormat: 'none',
6231 arrayFormatSeparator: ','
6232 }, options);
6233
6234 validateArrayFormatSeparator(options.arrayFormatSeparator);
6235
6236 const shouldFilter = key => (
6237 (options.skipNull && isNullOrUndefined(object[key])) ||
6238 (options.skipEmptyString && object[key] === '')
6239 );
6240
6241 const formatter = encoderForArrayFormat(options);
6242
6243 const objectCopy = {};
6244
6245 for (const key of Object.keys(object)) {
6246 if (!shouldFilter(key)) {
6247 objectCopy[key] = object[key];
6248 }
6249 }
6250
6251 const keys = Object.keys(objectCopy);
6252
6253 if (options.sort !== false) {
6254 keys.sort(options.sort);
6255 }
6256
6257 return keys.map(key => {
6258 const value = object[key];
6259
6260 if (value === undefined) {
6261 return '';
6262 }
6263
6264 if (value === null) {
6265 return encode(key, options);
6266 }
6267
6268 if (Array.isArray(value)) {
6269 return value
6270 .reduce(formatter(key), [])
6271 .join('&');
6272 }
6273
6274 return encode(key, options) + '=' + encode(value, options);
6275 }).filter(x => x.length > 0).join('&');
6276};
6277
6278exports.parseUrl = (input, options) => {
6279 options = Object.assign({
6280 decode: true
6281 }, options);
6282
6283 const [url, hash] = splitOnFirst(input, '#');
6284
6285 return Object.assign(
6286 {
6287 url: url.split('?')[0] || '',
6288 query: parse(extract(input), options)
6289 },
6290 options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
6291 );
6292};
6293
6294exports.stringifyUrl = (input, options) => {
6295 options = Object.assign({
6296 encode: true,
6297 strict: true
6298 }, options);
6299
6300 const url = removeHash(input.url).split('?')[0] || '';
6301 const queryFromUrl = exports.extract(input.url);
6302 const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
6303
6304 const query = Object.assign(parsedQueryFromUrl, input.query);
6305 let queryString = exports.stringify(query, options);
6306 if (queryString) {
6307 queryString = `?${queryString}`;
6308 }
6309
6310 let hash = getHash(input.url);
6311 if (input.fragmentIdentifier) {
6312 hash = `#${encode(input.fragmentIdentifier, options)}`;
6313 }
6314
6315 return `${url}${queryString}${hash}`;
6316};
6317
6318
6319/***/ }),
6320
6321/***/ "euyF":
6322/***/ (function(module, exports, __webpack_require__) {
6323
6324/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.
6325//
6326// This fast non-cryptographic random number generator is designed for
6327// use in Monte-Carlo algorithms. It combines a long-period xorshift
6328// generator with a Weyl generator, and it passes all common batteries
6329// of stasticial tests for randomness while consuming only a few nanoseconds
6330// for each prng generated. For background on the generator, see Brent's
6331// paper: "Some long-period random number generators using shifts and xors."
6332// http://arxiv.org/pdf/1004.3115v1.pdf
6333//
6334// Usage:
6335//
6336// var xor4096 = require('xor4096');
6337// random = xor4096(1); // Seed with int32 or string.
6338// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.
6339// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.
6340//
6341// For nonzero numeric keys, this impelementation provides a sequence
6342// identical to that by Brent's xorgens 3 implementaion in C. This
6343// implementation also provides for initalizing the generator with
6344// string seeds, or for saving and restoring the state of the generator.
6345//
6346// On Chrome, this prng benchmarks about 2.1 times slower than
6347// Javascript's built-in Math.random().
6348
6349(function(global, module, define) {
6350
6351function XorGen(seed) {
6352 var me = this;
6353
6354 // Set up generator function.
6355 me.next = function() {
6356 var w = me.w,
6357 X = me.X, i = me.i, t, v;
6358 // Update Weyl generator.
6359 me.w = w = (w + 0x61c88647) | 0;
6360 // Update xor generator.
6361 v = X[(i + 34) & 127];
6362 t = X[i = ((i + 1) & 127)];
6363 v ^= v << 13;
6364 t ^= t << 17;
6365 v ^= v >>> 15;
6366 t ^= t >>> 12;
6367 // Update Xor generator array state.
6368 v = X[i] = v ^ t;
6369 me.i = i;
6370 // Result is the combination.
6371 return (v + (w ^ (w >>> 16))) | 0;
6372 };
6373
6374 function init(me, seed) {
6375 var t, v, i, j, w, X = [], limit = 128;
6376 if (seed === (seed | 0)) {
6377 // Numeric seeds initialize v, which is used to generates X.
6378 v = seed;
6379 seed = null;
6380 } else {
6381 // String seeds are mixed into v and X one character at a time.
6382 seed = seed + '\0';
6383 v = 0;
6384 limit = Math.max(limit, seed.length);
6385 }
6386 // Initialize circular array and weyl value.
6387 for (i = 0, j = -32; j < limit; ++j) {
6388 // Put the unicode characters into the array, and shuffle them.
6389 if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);
6390 // After 32 shuffles, take v as the starting w value.
6391 if (j === 0) w = v;
6392 v ^= v << 10;
6393 v ^= v >>> 15;
6394 v ^= v << 4;
6395 v ^= v >>> 13;
6396 if (j >= 0) {
6397 w = (w + 0x61c88647) | 0; // Weyl.
6398 t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.
6399 i = (0 == t) ? i + 1 : 0; // Count zeroes.
6400 }
6401 }
6402 // We have detected all zeroes; make the key nonzero.
6403 if (i >= 128) {
6404 X[(seed && seed.length || 0) & 127] = -1;
6405 }
6406 // Run the generator 512 times to further mix the state before using it.
6407 // Factoring this as a function slows the main generator, so it is just
6408 // unrolled here. The weyl generator is not advanced while warming up.
6409 i = 127;
6410 for (j = 4 * 128; j > 0; --j) {
6411 v = X[(i + 34) & 127];
6412 t = X[i = ((i + 1) & 127)];
6413 v ^= v << 13;
6414 t ^= t << 17;
6415 v ^= v >>> 15;
6416 t ^= t >>> 12;
6417 X[i] = v ^ t;
6418 }
6419 // Storing state as object members is faster than using closure variables.
6420 me.w = w;
6421 me.X = X;
6422 me.i = i;
6423 }
6424
6425 init(me, seed);
6426}
6427
6428function copy(f, t) {
6429 t.i = f.i;
6430 t.w = f.w;
6431 t.X = f.X.slice();
6432 return t;
6433};
6434
6435function impl(seed, opts) {
6436 if (seed == null) seed = +(new Date);
6437 var xg = new XorGen(seed),
6438 state = opts && opts.state,
6439 prng = function() { return (xg.next() >>> 0) / 0x100000000; };
6440 prng.double = function() {
6441 do {
6442 var top = xg.next() >>> 11,
6443 bot = (xg.next() >>> 0) / 0x100000000,
6444 result = (top + bot) / (1 << 21);
6445 } while (result === 0);
6446 return result;
6447 };
6448 prng.int32 = xg.next;
6449 prng.quick = prng;
6450 if (state) {
6451 if (state.X) copy(state, xg);
6452 prng.state = function() { return copy(xg, {}); }
6453 }
6454 return prng;
6455}
6456
6457if (module && module.exports) {
6458 module.exports = impl;
6459} else if (__webpack_require__("B9Yq") && __webpack_require__("PDX0")) {
6460 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),
6461 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
6462} else {
6463 this.xor4096 = impl;
6464}
6465
6466})(
6467 this, // window object or global
6468 true && module, // present in node.js
6469 __webpack_require__("B9Yq") // present with an AMD loader
6470);
6471
6472/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("YuTi")(module)))
6473
6474/***/ }),
6475
6476/***/ "fQHC":
6477/***/ (function(module, __webpack_exports__, __webpack_require__) {
6478
6479"use strict";
6480/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return accountExists; });
6481/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return signInOauth; });
6482/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return signInUser; });
6483/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return createSession; });
6484/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return createUser; });
6485/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return resetPassword; });
6486/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return updateUserPassword; });
6487/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return signOutUser; });
6488/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return setAuthError; });
6489/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return changeEmail; });
6490/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("o0o1");
6491/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
6492/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("HaE+");
6493/* harmony import */ var analytics_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("LpT6");
6494/* harmony import */ var analytics_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("a4XK");
6495/* harmony import */ var config_bugsnag__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("aa/f");
6496/* harmony import */ var config_firebase__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("Ls3p");
6497/* harmony import */ var firebase_app__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("Jgta");
6498/* harmony import */ var react_cookies__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("Po8q");
6499/* harmony import */ var react_cookies__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_cookies__WEBPACK_IMPORTED_MODULE_7__);
6500/* harmony import */ var utils_error__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("hXAY");
6501/* harmony import */ var utils_fetchApi__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("JGAB");
6502/* harmony import */ var _cartActions__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("iNqv");
6503/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("Ue81");
6504/* harmony import */ var _userActions__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("ruEg");
6505/* harmony import */ var _watchlistActions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("8mt6");
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520var accountExists = /*#__PURE__*/function () {
6521 var _ref = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(email) {
6522 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {
6523 while (1) {
6524 switch (_context.prev = _context.next) {
6525 case 0:
6526 return _context.abrupt("return", Object(config_firebase__WEBPACK_IMPORTED_MODULE_5__[/* getAuth */ "a"])().then(function (auth) {
6527 return auth.fetchSignInMethodsForEmail(email);
6528 }).then(function (methods) {
6529 return methods.length > 0;
6530 }));
6531
6532 case 1:
6533 case "end":
6534 return _context.stop();
6535 }
6536 }
6537 }, _callee);
6538 }));
6539
6540 return function accountExists(_x) {
6541 return _ref.apply(this, arguments);
6542 };
6543}(); // login for OAuth component
6544
6545var signInOauth = function signInOauth(referralCode) {
6546 return function (dispatch) {
6547 dispatch({
6548 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_SIGNIN_START */ "h"]
6549 });
6550 Object(config_firebase__WEBPACK_IMPORTED_MODULE_5__[/* getAuth */ "a"])().then(function (auth) {
6551 return auth.signInWithPopup(new firebase_app__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].auth.GoogleAuthProvider());
6552 }).then(function (credentials) {
6553 dispatch(signInUser(credentials.user, referralCode));
6554 })["catch"](function (e) {
6555 void Object(config_firebase__WEBPACK_IMPORTED_MODULE_5__[/* getAuth */ "a"])().then(function (auth) {
6556 return auth.signOut();
6557 });
6558 dispatch({
6559 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_SIGNIN_FAILURE */ "f"],
6560 payload: 'auth.signInUnsuccessful'
6561 });
6562 });
6563 };
6564};
6565var signInUser = function signInUser(user, refCode) {
6566 return function (dispatch, getState) {
6567 dispatch({
6568 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_SIGNIN_START */ "h"]
6569 });
6570 var referralCode = react_cookies__WEBPACK_IMPORTED_MODULE_7___default.a.load('resellerPurchase') || refCode || '';
6571 var campaignCode = react_cookies__WEBPACK_IMPORTED_MODULE_7___default.a.load('campaignCode');
6572 var idToken;
6573 var newUser = false;
6574 user.getIdToken().then(function (token) {
6575 idToken = token;
6576 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])("/user/identity", {
6577 method: 'POST',
6578 headers: new Headers({
6579 'Content-Type': 'application/json'
6580 }),
6581 body: JSON.stringify({
6582 idToken: idToken,
6583 referralCode: referralCode,
6584 campaignCode: campaignCode
6585 }),
6586 returnType: 'json'
6587 });
6588 }).then(function (userData) {
6589 newUser = userData.newUser;
6590 return createSession(idToken);
6591 }).then( /*#__PURE__*/Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() {
6592 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {
6593 while (1) {
6594 switch (_context2.prev = _context2.next) {
6595 case 0:
6596 // ! Is the auth state guaranteed to be properly set at this point?
6597 if (newUser) {
6598 Object(analytics_common__WEBPACK_IMPORTED_MODULE_2__[/* track */ "e"])(analytics_types__WEBPACK_IMPORTED_MODULE_3__[/* USER_REGISTERED */ "ab"], {
6599 category: 'user',
6600 action: 'registered',
6601 label: 'New user',
6602 type: 'google',
6603 email: user.email,
6604 referer: referralCode,
6605 campaign: campaignCode
6606 });
6607 }
6608
6609 _context2.next = 3;
6610 return dispatch(Object(_cartActions__WEBPACK_IMPORTED_MODULE_10__[/* mergeCarts */ "e"])());
6611
6612 case 3:
6613 _context2.next = 5;
6614 return dispatch(Object(_watchlistActions__WEBPACK_IMPORTED_MODULE_13__[/* moveLocalWatchlistToDatabase */ "e"])());
6615
6616 case 5:
6617 _context2.next = 7;
6618 return dispatch(Object(_userActions__WEBPACK_IMPORTED_MODULE_12__[/* getAndSetUserProfile */ "b"])());
6619
6620 case 7:
6621 dispatch({
6622 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_SIGNIN_SUCCESS */ "i"]
6623 });
6624
6625 case 8:
6626 case "end":
6627 return _context2.stop();
6628 }
6629 }
6630 }, _callee2);
6631 })))["catch"](function (e) {
6632 void Object(config_firebase__WEBPACK_IMPORTED_MODULE_5__[/* getAuth */ "a"])().then(function (auth) {
6633 return auth.signOut();
6634 }); // Login does not work when third party cookies are disabled.
6635 // This is the default configuration in incognito Chrome
6636
6637 if (e.error === 'popup_closed_by_user') {
6638 dispatch({
6639 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_SIGNIN_FAILURE */ "f"],
6640 payload: 'auth.signInUnsuccessfulVerifyCookies'
6641 }); // if we start seeing too many of these warnings recorded then maybe we
6642 // need to use a different protocol auth flow
6643
6644 config_bugsnag__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].notify(new Error('Login does not work when third party cookies are disabled'));
6645 } else {
6646 dispatch({
6647 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_SIGNIN_FAILURE */ "f"],
6648 payload: 'auth.signInUnsuccessful'
6649 });
6650 }
6651 });
6652 };
6653};
6654var createSession = function createSession(idToken) {
6655 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('/user/session', {
6656 auth: true,
6657 method: 'POST',
6658 headers: new Headers({
6659 'Content-Type': 'application/json'
6660 }),
6661 body: JSON.stringify({
6662 idToken: idToken
6663 })
6664 });
6665};
6666var createUser = function createUser(email, password, refCode) {
6667 return /*#__PURE__*/function () {
6668 var _ref3 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(dispatch) {
6669 var referralCode, campaignCode, auth;
6670 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) {
6671 while (1) {
6672 switch (_context4.prev = _context4.next) {
6673 case 0:
6674 referralCode = react_cookies__WEBPACK_IMPORTED_MODULE_7___default.a.load('resellerPurchase') || refCode || '';
6675 campaignCode = react_cookies__WEBPACK_IMPORTED_MODULE_7___default.a.load('campaignCode') || '';
6676 _context4.next = 4;
6677 return Object(config_firebase__WEBPACK_IMPORTED_MODULE_5__[/* getAuth */ "a"])();
6678
6679 case 4:
6680 auth = _context4.sent;
6681 dispatch({
6682 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_CREATE_START */ "c"]
6683 });
6684 return _context4.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])("/user/new", {
6685 method: 'POST',
6686 headers: new Headers({
6687 'Content-Type': 'application/json'
6688 }),
6689 body: JSON.stringify({
6690 email: email,
6691 password: password,
6692 referralCode: referralCode,
6693 campaignCode: campaignCode
6694 }),
6695 returnType: 'json'
6696 }).then(function (token) {
6697 if (token.error) {
6698 throw token.error;
6699 }
6700
6701 return auth.signInWithCustomToken(token);
6702 }).then(function (credentials) {
6703 var _credentials$user;
6704
6705 return (_credentials$user = credentials.user) === null || _credentials$user === void 0 ? void 0 : _credentials$user.getIdToken();
6706 }).then(function (idToken) {
6707 return createSession(idToken);
6708 }).then( /*#__PURE__*/Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3() {
6709 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) {
6710 while (1) {
6711 switch (_context3.prev = _context3.next) {
6712 case 0:
6713 _context3.next = 2;
6714 return dispatch(Object(_cartActions__WEBPACK_IMPORTED_MODULE_10__[/* mergeCarts */ "e"])());
6715
6716 case 2:
6717 _context3.next = 4;
6718 return dispatch(Object(_watchlistActions__WEBPACK_IMPORTED_MODULE_13__[/* moveLocalWatchlistToDatabase */ "e"])());
6719
6720 case 4:
6721 _context3.next = 6;
6722 return dispatch(Object(_userActions__WEBPACK_IMPORTED_MODULE_12__[/* getAndSetUserProfile */ "b"])());
6723
6724 case 6:
6725 _context3.next = 8;
6726 return dispatch({
6727 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_CREATE_SUCCESS */ "d"]
6728 });
6729
6730 case 8:
6731 // ! Is the auth state guaranteed to be properly set at this point?
6732 Object(analytics_common__WEBPACK_IMPORTED_MODULE_2__[/* track */ "e"])(analytics_types__WEBPACK_IMPORTED_MODULE_3__[/* USER_REGISTERED */ "ab"], {
6733 category: 'user',
6734 action: 'registered',
6735 label: 'New user',
6736 type: 'email',
6737 email: email,
6738 referer: referralCode,
6739 campaign: campaignCode
6740 });
6741
6742 case 9:
6743 case "end":
6744 return _context3.stop();
6745 }
6746 }
6747 }, _callee3);
6748 })))["catch"](function (e) {
6749 dispatch({
6750 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_CREATE_FAILURE */ "b"],
6751 payload: e.message
6752 });
6753 }));
6754
6755 case 7:
6756 case "end":
6757 return _context4.stop();
6758 }
6759 }
6760 }, _callee4);
6761 }));
6762
6763 return function (_x2) {
6764 return _ref3.apply(this, arguments);
6765 };
6766 }();
6767};
6768var resetPassword = /*#__PURE__*/function () {
6769 var _ref5 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(email) {
6770 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) {
6771 while (1) {
6772 switch (_context5.prev = _context5.next) {
6773 case 0:
6774 return _context5.abrupt("return", Object(config_firebase__WEBPACK_IMPORTED_MODULE_5__[/* getAuth */ "a"])().then(function (auth) {
6775 return auth.sendPasswordResetEmail(email);
6776 }));
6777
6778 case 1:
6779 case "end":
6780 return _context5.stop();
6781 }
6782 }
6783 }, _callee5);
6784 }));
6785
6786 return function resetPassword(_x3) {
6787 return _ref5.apply(this, arguments);
6788 };
6789}();
6790var updateUserPassword = function updateUserPassword(password) {
6791 return /*#__PURE__*/function () {
6792 var _ref6 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(dispatch, getState) {
6793 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) {
6794 while (1) {
6795 switch (_context6.prev = _context6.next) {
6796 case 0:
6797 dispatch({
6798 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_UPDATE_START */ "l"]
6799 });
6800 _context6.prev = 1;
6801 _context6.next = 4;
6802 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('/user/update-password', {
6803 auth: true,
6804 method: 'POST',
6805 headers: new Headers({
6806 'Content-Type': 'application/json'
6807 }),
6808 body: JSON.stringify({
6809 password: password
6810 })
6811 });
6812
6813 case 4:
6814 dispatch({
6815 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_UPDATE_SUCCESS */ "m"]
6816 });
6817 _context6.next = 10;
6818 break;
6819
6820 case 7:
6821 _context6.prev = 7;
6822 _context6.t0 = _context6["catch"](1);
6823 dispatch({
6824 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_UPDATE_FAILURE */ "k"]
6825 });
6826
6827 case 10:
6828 case "end":
6829 return _context6.stop();
6830 }
6831 }
6832 }, _callee6, null, [[1, 7]]);
6833 }));
6834
6835 return function (_x4, _x5) {
6836 return _ref6.apply(this, arguments);
6837 };
6838 }();
6839};
6840var signOutUser = function signOutUser(Router, doNotRedirect, email) {
6841 return /*#__PURE__*/function () {
6842 var _ref7 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(dispatch) {
6843 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7) {
6844 while (1) {
6845 switch (_context7.prev = _context7.next) {
6846 case 0:
6847 _context7.prev = 0;
6848 _context7.next = 3;
6849 return Object(config_firebase__WEBPACK_IMPORTED_MODULE_5__[/* getAuth */ "a"])().then(function (auth) {
6850 return auth.signOut();
6851 });
6852
6853 case 3:
6854 _context7.next = 8;
6855 break;
6856
6857 case 5:
6858 _context7.prev = 5;
6859 _context7.t0 = _context7["catch"](0);
6860 Object(utils_error__WEBPACK_IMPORTED_MODULE_8__[/* notifyBugsnag */ "e"])(_context7.t0);
6861
6862 case 8:
6863 _context7.prev = 8;
6864 _context7.next = 11;
6865 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('/user/session/clear', {
6866 auth: true,
6867 method: 'POST'
6868 });
6869
6870 case 11:
6871 _context7.next = 16;
6872 break;
6873
6874 case 13:
6875 _context7.prev = 13;
6876 _context7.t1 = _context7["catch"](8);
6877 Object(utils_error__WEBPACK_IMPORTED_MODULE_8__[/* notifyBugsnag */ "e"])(_context7.t1);
6878
6879 case 16:
6880 dispatch({
6881 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_SIGNOUT */ "j"]
6882 });
6883
6884 if (email) {
6885 void Router.push({
6886 pathname: '/auth',
6887 query: {
6888 redirect: '',
6889 error: "Email has been changed, to sign back in use ".concat(email)
6890 }
6891 });
6892 } else if (!doNotRedirect) {
6893 void Router.push('/auth');
6894 }
6895
6896 case 18:
6897 case "end":
6898 return _context7.stop();
6899 }
6900 }
6901 }, _callee7, null, [[0, 5], [8, 13]]);
6902 }));
6903
6904 return function (_x6) {
6905 return _ref7.apply(this, arguments);
6906 };
6907 }();
6908};
6909var setAuthError = function setAuthError(error) {
6910 return function (dispatch) {
6911 dispatch({
6912 type: _types__WEBPACK_IMPORTED_MODULE_11__[/* AUTH_SET_ERROR */ "e"],
6913 payload: error
6914 });
6915 };
6916};
6917var changeEmail = function changeEmail(newEmail) {
6918 return function (dispatch) {
6919 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])("/user/change-email", {
6920 auth: true,
6921 method: 'POST',
6922 headers: new Headers({
6923 'Content-Type': 'application/json'
6924 }),
6925 body: JSON.stringify({
6926 newEmail: newEmail
6927 })
6928 }).then(function (resp) {
6929 if (!resp.ok) {
6930 throw new Error('Failed to change email address');
6931 }
6932
6933 return;
6934 });
6935 };
6936};
6937
6938/***/ }),
6939
6940/***/ "hXAY":
6941/***/ (function(module, __webpack_exports__, __webpack_require__) {
6942
6943"use strict";
6944/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return errorBoundaryOnError; });
6945/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return handleTransactionError; });
6946/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return notifyBugsnag; });
6947/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return HttpErrorMessages; });
6948/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ApiError; });
6949/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("1OyB");
6950/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("JX7q");
6951/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("Ji7U");
6952/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("md7G");
6953/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("foSv");
6954/* harmony import */ var _babel_runtime_helpers_esm_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("kHIg");
6955/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("rePB");
6956/* harmony import */ var config_bugsnag__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("aa/f");
6957/* harmony import */ var analytics_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("LpT6");
6958
6959
6960
6961
6962
6963
6964
6965
6966var _HttpErrorMessages;
6967
6968function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(this, result); }; }
6969
6970function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
6971
6972
6973
6974// Allows editing of events caught by ErrorBoundary before it is sent to bugsnag
6975// - Add metadata
6976// - Update event details
6977// - Prevent errors by returning false
6978// ** Error boundaries do not catch errors inside event handlers. **
6979var errorBoundaryOnError = function errorBoundaryOnError(store) {
6980 return function (bugsnagEvent) {
6981 var _ref = store.getState(),
6982 auth = _ref.auth;
6983
6984 if (!auth.signedIn) {
6985 bugsnagEvent.setUser(Object(analytics_common__WEBPACK_IMPORTED_MODULE_8__[/* getAnonymousId */ "b"])());
6986 }
6987
6988 var expectedAuthError = false;
6989 bugsnagEvent.breadcrumbs.forEach(function (breadCrumb) {
6990 // Check if error is from a server error
6991 if (breadCrumb.type === 'request') {
6992 var status = breadCrumb.metadata.status;
6993
6994 if (status >= 500) {
6995 // Change context so that errors are grouped by page and status
6996 bugsnagEvent.groupingHash = "".concat(window.location.pathname, "-").concat(HttpErrorMessages[breadCrumb.metadata.status]);
6997 } else if (status === 401 && !auth.signedIn) {
6998 // Ignore auth errors if user isn't signed in
6999 expectedAuthError = true;
7000 }
7001 }
7002 });
7003
7004 if (expectedAuthError) {
7005 return false;
7006 } // Only send events to BugSnag if Staging or Production
7007
7008
7009 return process.env.IS_STAGING === 'true' || true;
7010 };
7011};
7012var handleTransactionError = function handleTransactionError(error, domain) {
7013 var guest = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7014 var message = error.message;
7015
7016 if (!message.includes('always failing') && !message.includes('cancelled') && !message.includes('denied') && !message.includes('rejected')) {
7017 if (guest && !message.includes('no balance') && !message.includes('not enough') && !message.includes('funds') || !guest) {
7018 window.alert("Error: ".concat(error.message || error, ". Please try again, or contact support if the error persists."));
7019 console.error(error);
7020 notifyBugsnag(error, {
7021 Extras: {
7022 domain: domain
7023 }
7024 });
7025 }
7026 }
7027};
7028var notifyBugsnag = function notifyBugsnag(error, additionalMetaData) {
7029 if (process.env.IS_STAGING === 'true' || true) {
7030 config_bugsnag__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"].notify(error, function (event) {
7031 if (additionalMetaData) {
7032 Object.keys(additionalMetaData).forEach(function (key) {
7033 event.addMetadata(key, additionalMetaData[key]);
7034 });
7035 }
7036 });
7037 }
7038};
7039var HttpErrorMessages = (_HttpErrorMessages = {}, Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 400, 'Bad Request'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 401, 'Unauthorized'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 402, 'Payment Required'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 403, 'Forbidden'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 404, 'Not Found'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 405, 'Method Not Allowed'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 406, 'Not Acceptable'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 407, 'Proxy Authentication Required'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 408, 'Request Timeout'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 409, 'Conflict'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 410, 'Gone'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 411, 'Length Required'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 412, 'Precondition Failed'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 413, 'Payload Too Large'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 414, 'Uri Too Long'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 415, 'Unsupported Media Type'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 416, 'Range Not Satisfiable'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 417, 'Expectation Failed'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 422, 'Unprocessable Entity'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 423, 'Locked'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 424, 'Failed Dependency'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 426, 'Upgrade Required'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 428, 'Precondition Required'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 429, 'Too Many Requests'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 431, 'Request Header Fields Too Large'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 451, 'Unavailable For Legal Reasons'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 500, 'Internal Server Error'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 501, 'Not Implemented'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 502, 'Bad Gateway'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 503, 'Service Unavailable'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 504, 'Gateway Time-Out'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 505, 'Http Version Not Supported'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 506, 'Variant Also Negotiates'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 507, 'Insufficient Storage'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_HttpErrorMessages, 511, 'Network Authentication Required'), _HttpErrorMessages);
7040var ApiError = /*#__PURE__*/function (_Error) {
7041 Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(ApiError, _Error);
7042
7043 var _super = _createSuper(ApiError);
7044
7045 function ApiError(status) {
7046 var _this;
7047
7048 Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(this, ApiError);
7049
7050 for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
7051 params[_key - 1] = arguments[_key];
7052 }
7053
7054 _this = _super.call.apply(_super, [this].concat(params));
7055
7056 Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_this), "status", void 0);
7057
7058 _this.status = status;
7059 return _this;
7060 }
7061
7062 return ApiError;
7063}( /*#__PURE__*/Object(_babel_runtime_helpers_esm_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(Error));
7064/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
7065
7066/***/ }),
7067
7068/***/ "iNqv":
7069/***/ (function(module, __webpack_exports__, __webpack_require__) {
7070
7071"use strict";
7072/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return addItemsToCart; });
7073/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addItemToCart; });
7074/* unused harmony export findGeminiCustodyByProductCode */
7075/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return addProductToCart; });
7076/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return removeItemsFromCart; });
7077/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return removeItemFromCart; });
7078/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return setReduxCart; });
7079/* unused harmony export fetchProductPrice */
7080/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return areItemsAvailable; });
7081/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return mergeCarts; });
7082/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return refreshCart; });
7083/* unused harmony export moveLocalCartToDatabase */
7084/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("o0o1");
7085/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
7086/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("HaE+");
7087/* harmony import */ var analytics_cart__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("QwyX");
7088/* harmony import */ var analytics_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("a4XK");
7089/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("Ue81");
7090/* harmony import */ var utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("JGAB");
7091/* harmony import */ var analytics_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("LpT6");
7092
7093
7094
7095function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
7096
7097function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7098
7099function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7100
7101
7102
7103
7104
7105
7106var addItemsToCart = function addItemsToCart(items) {
7107 var isRecommended = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7108 return /*#__PURE__*/function () {
7109 var _ref = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(dispatch, getState) {
7110 var state, newItems, productIds, _iterator, _step, item;
7111
7112 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {
7113 while (1) {
7114 switch (_context.prev = _context.next) {
7115 case 0:
7116 state = getState();
7117 newItems = items.filter(function (po) {
7118 return !state.cart.items.find(function (cpo) {
7119 return cpo.productId === po.productId;
7120 });
7121 });
7122 _context.prev = 2;
7123
7124 if (!newItems.length) {
7125 _context.next = 11;
7126 break;
7127 }
7128
7129 productIds = newItems.map(function (po) {
7130 return po.productId;
7131 });
7132 _context.next = 7;
7133 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('/cart/add', {
7134 auth: true,
7135 method: 'POST',
7136 headers: new Headers({
7137 'Content-Type': 'application/json'
7138 }),
7139 body: JSON.stringify({
7140 productIds: productIds,
7141 guestUuid: state.auth.signedIn ? null : Object(analytics_common__WEBPACK_IMPORTED_MODULE_6__[/* getAnonymousId */ "b"])()
7142 })
7143 });
7144
7145 case 7:
7146 _iterator = _createForOfIteratorHelper(newItems);
7147
7148 try {
7149 for (_iterator.s(); !(_step = _iterator.n()).done;) {
7150 item = _step.value;
7151 void Object(analytics_cart__WEBPACK_IMPORTED_MODULE_2__[/* trackCartUpdate */ "b"])(analytics_types__WEBPACK_IMPORTED_MODULE_3__[/* CART_DOMAIN_ADDED */ "i"], item, isRecommended);
7152 }
7153 } catch (err) {
7154 _iterator.e(err);
7155 } finally {
7156 _iterator.f();
7157 }
7158
7159 _context.next = 11;
7160 return dispatch({
7161 type: _types__WEBPACK_IMPORTED_MODULE_4__[/* CART_ADD_ITEM */ "n"],
7162 payload: newItems
7163 });
7164
7165 case 11:
7166 return _context.abrupt("return", newItems.length);
7167
7168 case 14:
7169 _context.prev = 14;
7170 _context.t0 = _context["catch"](2);
7171 return _context.abrupt("return", 0);
7172
7173 case 17:
7174 case "end":
7175 return _context.stop();
7176 }
7177 }
7178 }, _callee, null, [[2, 14]]);
7179 }));
7180
7181 return function (_x, _x2) {
7182 return _ref.apply(this, arguments);
7183 };
7184 }();
7185};
7186var addItemToCart = function addItemToCart(item) {
7187 var isRecommended = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7188 return /*#__PURE__*/function () {
7189 var _ref2 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(dispatch) {
7190 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {
7191 while (1) {
7192 switch (_context2.prev = _context2.next) {
7193 case 0:
7194 _context2.next = 2;
7195 return dispatch(addItemsToCart([item], isRecommended));
7196
7197 case 2:
7198 return _context2.abrupt("return", _context2.sent);
7199
7200 case 3:
7201 case "end":
7202 return _context2.stop();
7203 }
7204 }
7205 }, _callee2);
7206 }));
7207
7208 return function (_x3) {
7209 return _ref2.apply(this, arguments);
7210 };
7211 }();
7212};
7213var findGeminiCustodyByProductCode = function findGeminiCustodyByProductCode(productCode, cart) {
7214 return cart.find(function (po) {
7215 return po.productType === 'GeminiCustodyProduct' && po.productCode === productCode;
7216 });
7217};
7218var addProductToCart = function addProductToCart(type, domainNames) {
7219 return /*#__PURE__*/function () {
7220 var _ref3 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(dispatch, getState) {
7221 var _yield$fetchApi, productObjects;
7222
7223 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) {
7224 while (1) {
7225 switch (_context3.prev = _context3.next) {
7226 case 0:
7227 _context3.prev = 0;
7228 _context3.next = 3;
7229 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('/product', {
7230 auth: true,
7231 method: 'POST',
7232 headers: new Headers({
7233 'Content-Type': 'application/json'
7234 }),
7235 body: JSON.stringify({
7236 type: type,
7237 domainNames: domainNames,
7238 guestUuid: getState().auth.signedIn ? null : Object(analytics_common__WEBPACK_IMPORTED_MODULE_6__[/* getAnonymousId */ "b"])()
7239 }),
7240 returnType: 'json'
7241 });
7242
7243 case 3:
7244 _yield$fetchApi = _context3.sent;
7245 productObjects = _yield$fetchApi.productObjects;
7246 _context3.next = 7;
7247 return dispatch(addItemsToCart(productObjects));
7248
7249 case 7:
7250 void dispatch(refreshCart());
7251 return _context3.abrupt("return", true);
7252
7253 case 11:
7254 _context3.prev = 11;
7255 _context3.t0 = _context3["catch"](0);
7256 return _context3.abrupt("return", false);
7257
7258 case 14:
7259 case "end":
7260 return _context3.stop();
7261 }
7262 }
7263 }, _callee3, null, [[0, 11]]);
7264 }));
7265
7266 return function (_x4, _x5) {
7267 return _ref3.apply(this, arguments);
7268 };
7269 }();
7270};
7271var removeItemsFromCart = function removeItemsFromCart(items) {
7272 var refresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7273 return /*#__PURE__*/function () {
7274 var _ref4 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(dispatch, getState) {
7275 var productIds, _iterator2, _step2, item;
7276
7277 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) {
7278 while (1) {
7279 switch (_context4.prev = _context4.next) {
7280 case 0:
7281 productIds = items.map(function (po) {
7282 return po.productId;
7283 });
7284 _context4.prev = 1;
7285 _context4.next = 4;
7286 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('/cart/remove', {
7287 auth: true,
7288 method: 'POST',
7289 headers: new Headers({
7290 'Content-Type': 'application/json'
7291 }),
7292 body: JSON.stringify({
7293 productIds: productIds,
7294 guestUuid: getState().auth.signedIn ? null : Object(analytics_common__WEBPACK_IMPORTED_MODULE_6__[/* getAnonymousId */ "b"])()
7295 })
7296 });
7297
7298 case 4:
7299 _iterator2 = _createForOfIteratorHelper(items);
7300
7301 try {
7302 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
7303 item = _step2.value;
7304 void Object(analytics_cart__WEBPACK_IMPORTED_MODULE_2__[/* trackCartUpdate */ "b"])(analytics_types__WEBPACK_IMPORTED_MODULE_3__[/* CART_DOMAIN_REMOVED */ "j"], item);
7305 }
7306 } catch (err) {
7307 _iterator2.e(err);
7308 } finally {
7309 _iterator2.f();
7310 }
7311
7312 _context4.next = 8;
7313 return dispatch({
7314 type: _types__WEBPACK_IMPORTED_MODULE_4__[/* CART_REMOVE_ITEM */ "p"],
7315 payload: items
7316 });
7317
7318 case 8:
7319 if (refresh) {
7320 void dispatch(refreshCart());
7321 }
7322
7323 return _context4.abrupt("return", true);
7324
7325 case 12:
7326 _context4.prev = 12;
7327 _context4.t0 = _context4["catch"](1);
7328 return _context4.abrupt("return", false);
7329
7330 case 15:
7331 case "end":
7332 return _context4.stop();
7333 }
7334 }
7335 }, _callee4, null, [[1, 12]]);
7336 }));
7337
7338 return function (_x6, _x7) {
7339 return _ref4.apply(this, arguments);
7340 };
7341 }();
7342};
7343var removeItemFromCart = function removeItemFromCart(item) {
7344 return /*#__PURE__*/function () {
7345 var _ref5 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(dispatch) {
7346 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) {
7347 while (1) {
7348 switch (_context5.prev = _context5.next) {
7349 case 0:
7350 _context5.next = 2;
7351 return dispatch(removeItemsFromCart([item]));
7352
7353 case 2:
7354 return _context5.abrupt("return", _context5.sent);
7355
7356 case 3:
7357 case "end":
7358 return _context5.stop();
7359 }
7360 }
7361 }, _callee5);
7362 }));
7363
7364 return function (_x8) {
7365 return _ref5.apply(this, arguments);
7366 };
7367 }();
7368};
7369var setReduxCart = function setReduxCart(cart) {
7370 return /*#__PURE__*/function () {
7371 var _ref6 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(dispatch) {
7372 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) {
7373 while (1) {
7374 switch (_context6.prev = _context6.next) {
7375 case 0:
7376 return _context6.abrupt("return", dispatch({
7377 type: 'CART_SET_ITEMS',
7378 payload: cart
7379 }));
7380
7381 case 1:
7382 case "end":
7383 return _context6.stop();
7384 }
7385 }
7386 }, _callee6);
7387 }));
7388
7389 return function (_x9) {
7390 return _ref6.apply(this, arguments);
7391 };
7392 }();
7393};
7394var fetchProductPrice = function fetchProductPrice(product) {
7395 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])("/product/price?productId=".concat(product.productId), {
7396 returnType: 'json'
7397 });
7398};
7399var areItemsAvailable = /*#__PURE__*/function () {
7400 var _ref7 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(props) {
7401 var productIds, items, body;
7402 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7) {
7403 while (1) {
7404 switch (_context7.prev = _context7.next) {
7405 case 0:
7406 productIds = props.productIds, items = props.items;
7407
7408 if (!(!productIds && !items)) {
7409 _context7.next = 3;
7410 break;
7411 }
7412
7413 throw new Error('must provide productIds or items');
7414
7415 case 3:
7416 if (!(productIds && !productIds.length || items && !items.length)) {
7417 _context7.next = 5;
7418 break;
7419 }
7420
7421 return _context7.abrupt("return", {
7422 items: []
7423 });
7424
7425 case 5:
7426 body = productIds ? {
7427 productIds: productIds
7428 } : {
7429 items: items
7430 };
7431 return _context7.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('/availability', {
7432 method: 'POST',
7433 headers: new Headers({
7434 'Content-Type': 'application/json'
7435 }),
7436 body: JSON.stringify(body),
7437 returnType: 'json'
7438 }));
7439
7440 case 7:
7441 case "end":
7442 return _context7.stop();
7443 }
7444 }
7445 }, _callee7);
7446 }));
7447
7448 return function areItemsAvailable(_x10) {
7449 return _ref7.apply(this, arguments);
7450 };
7451}();
7452var mergeCarts = function mergeCarts() {
7453 return /*#__PURE__*/function () {
7454 var _ref8 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(dispatch) {
7455 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8) {
7456 while (1) {
7457 switch (_context8.prev = _context8.next) {
7458 case 0:
7459 void Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('/user/cart/merge', {
7460 auth: true,
7461 method: 'POST',
7462 headers: new Headers({
7463 'Content-Type': 'application/json'
7464 }),
7465 body: JSON.stringify({
7466 sourceCartGuestUuid: Object(analytics_common__WEBPACK_IMPORTED_MODULE_6__[/* getAnonymousId */ "b"])()
7467 }),
7468 returnType: 'json'
7469 }).then(function (resp) {
7470 return dispatch(setReduxCart(resp.cart));
7471 });
7472
7473 case 1:
7474 case "end":
7475 return _context8.stop();
7476 }
7477 }
7478 }, _callee8);
7479 }));
7480
7481 return function (_x11) {
7482 return _ref8.apply(this, arguments);
7483 };
7484 }();
7485};
7486
7487var getCartFromDb = function getCartFromDb(signedIn) {
7488 var path = signedIn ? '/cart' : "/cart?guestUuid=".concat(Object(analytics_common__WEBPACK_IMPORTED_MODULE_6__[/* getAnonymousId */ "b"])());
7489 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(path, {
7490 auth: true,
7491 returnType: 'json'
7492 });
7493};
7494
7495var refreshCart = function refreshCart() {
7496 var assumeGuest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7497 return /*#__PURE__*/function () {
7498 var _ref9 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(dispatch, getState) {
7499 var signedIn, result;
7500 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9) {
7501 while (1) {
7502 switch (_context9.prev = _context9.next) {
7503 case 0:
7504 signedIn = getState().auth.signedIn;
7505 _context9.next = 3;
7506 return getCartFromDb(assumeGuest ? false : signedIn);
7507
7508 case 3:
7509 result = _context9.sent;
7510 _context9.next = 6;
7511 return dispatch(setReduxCart(result.cart));
7512
7513 case 6:
7514 return _context9.abrupt("return", result.removed);
7515
7516 case 7:
7517 case "end":
7518 return _context9.stop();
7519 }
7520 }
7521 }, _callee9);
7522 }));
7523
7524 return function (_x12, _x13) {
7525 return _ref9.apply(this, arguments);
7526 };
7527 }();
7528};
7529var moveLocalCartToDatabase = function moveLocalCartToDatabase() {
7530 var assumeSignedIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7531 return /*#__PURE__*/function () {
7532 var _ref10 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(dispatch, getState) {
7533 var state, auth, items;
7534 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10) {
7535 while (1) {
7536 switch (_context10.prev = _context10.next) {
7537 case 0:
7538 state = getState();
7539 auth = state.auth;
7540 items = state.cart.items;
7541 void Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('/cart/set', {
7542 auth: true,
7543 method: 'POST',
7544 headers: new Headers({
7545 'Content-Type': 'application/json'
7546 }),
7547 body: JSON.stringify({
7548 productIds: items.map(function (po) {
7549 return po.productId;
7550 }),
7551 guestUuid: auth.signedIn || assumeSignedIn ? null : Object(analytics_common__WEBPACK_IMPORTED_MODULE_6__[/* getAnonymousId */ "b"])()
7552 })
7553 });
7554 return _context10.abrupt("return");
7555
7556 case 5:
7557 case "end":
7558 return _context10.stop();
7559 }
7560 }
7561 }, _callee10);
7562 }));
7563
7564 return function (_x14, _x15) {
7565 return _ref10.apply(this, arguments);
7566 };
7567 }();
7568};
7569
7570/***/ }),
7571
7572/***/ "ie1u":
7573/***/ (function(module, exports, __webpack_require__) {
7574
7575/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of the "Tyche-i" prng algorithm by
7576// Samuel Neves and Filipe Araujo.
7577// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf
7578
7579(function(global, module, define) {
7580
7581function XorGen(seed) {
7582 var me = this, strseed = '';
7583
7584 // Set up generator function.
7585 me.next = function() {
7586 var b = me.b, c = me.c, d = me.d, a = me.a;
7587 b = (b << 25) ^ (b >>> 7) ^ c;
7588 c = (c - d) | 0;
7589 d = (d << 24) ^ (d >>> 8) ^ a;
7590 a = (a - b) | 0;
7591 me.b = b = (b << 20) ^ (b >>> 12) ^ c;
7592 me.c = c = (c - d) | 0;
7593 me.d = (d << 16) ^ (c >>> 16) ^ a;
7594 return me.a = (a - b) | 0;
7595 };
7596
7597 /* The following is non-inverted tyche, which has better internal
7598 * bit diffusion, but which is about 25% slower than tyche-i in JS.
7599 me.next = function() {
7600 var a = me.a, b = me.b, c = me.c, d = me.d;
7601 a = (me.a + me.b | 0) >>> 0;
7602 d = me.d ^ a; d = d << 16 ^ d >>> 16;
7603 c = me.c + d | 0;
7604 b = me.b ^ c; b = b << 12 ^ d >>> 20;
7605 me.a = a = a + b | 0;
7606 d = d ^ a; me.d = d = d << 8 ^ d >>> 24;
7607 me.c = c = c + d | 0;
7608 b = b ^ c;
7609 return me.b = (b << 7 ^ b >>> 25);
7610 }
7611 */
7612
7613 me.a = 0;
7614 me.b = 0;
7615 me.c = 2654435769 | 0;
7616 me.d = 1367130551;
7617
7618 if (seed === Math.floor(seed)) {
7619 // Integer seed.
7620 me.a = (seed / 0x100000000) | 0;
7621 me.b = seed | 0;
7622 } else {
7623 // String seed.
7624 strseed += seed;
7625 }
7626
7627 // Mix in string seed, then discard an initial batch of 64 values.
7628 for (var k = 0; k < strseed.length + 20; k++) {
7629 me.b ^= strseed.charCodeAt(k) | 0;
7630 me.next();
7631 }
7632}
7633
7634function copy(f, t) {
7635 t.a = f.a;
7636 t.b = f.b;
7637 t.c = f.c;
7638 t.d = f.d;
7639 return t;
7640};
7641
7642function impl(seed, opts) {
7643 var xg = new XorGen(seed),
7644 state = opts && opts.state,
7645 prng = function() { return (xg.next() >>> 0) / 0x100000000; };
7646 prng.double = function() {
7647 do {
7648 var top = xg.next() >>> 11,
7649 bot = (xg.next() >>> 0) / 0x100000000,
7650 result = (top + bot) / (1 << 21);
7651 } while (result === 0);
7652 return result;
7653 };
7654 prng.int32 = xg.next;
7655 prng.quick = prng;
7656 if (state) {
7657 if (typeof(state) == 'object') copy(state, xg);
7658 prng.state = function() { return copy(xg, {}); }
7659 }
7660 return prng;
7661}
7662
7663if (module && module.exports) {
7664 module.exports = impl;
7665} else if (__webpack_require__("B9Yq") && __webpack_require__("PDX0")) {
7666 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),
7667 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
7668} else {
7669 this.tychei = impl;
7670}
7671
7672})(
7673 this,
7674 true && module, // present in node.js
7675 __webpack_require__("B9Yq") // present with an AMD loader
7676);
7677
7678
7679
7680/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("YuTi")(module)))
7681
7682/***/ }),
7683
7684/***/ "jpLA":
7685/***/ (function(module, __webpack_exports__, __webpack_require__) {
7686
7687"use strict";
7688/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return trackReddit; });
7689/* unused harmony export getReferralCode */
7690/* unused harmony export getReferralTier */
7691/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createProduct; });
7692/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return parseCart; });
7693/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("KQm4");
7694/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("o0o1");
7695/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
7696/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("HaE+");
7697/* harmony import */ var react_cookies__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("Po8q");
7698/* harmony import */ var react_cookies__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_cookies__WEBPACK_IMPORTED_MODULE_3__);
7699/* harmony import */ var utils_fetchApi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("JGAB");
7700
7701
7702
7703
7704function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
7705
7706function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7707
7708function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7709
7710// import {getFireUserProfile} from 'actions/userActions';
7711
7712
7713var trackReddit = function trackReddit(action, name) {
7714 if (window.rdt) {
7715 window.rdt(action, name);
7716 }
7717};
7718var getReferralCode = /*#__PURE__*/function () {
7719 var _ref = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee() {
7720 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) {
7721 while (1) {
7722 switch (_context.prev = _context.next) {
7723 case 0:
7724 return _context.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])("/referrals/user", {
7725 auth: true
7726 }).then(function (res) {
7727 return res.text();
7728 }).then(function (res) {
7729 return res.replace(/['"]+/g, '');
7730 })["catch"](function () {
7731 return '';
7732 }));
7733
7734 case 1:
7735 case "end":
7736 return _context.stop();
7737 }
7738 }
7739 }, _callee);
7740 }));
7741
7742 return function getReferralCode() {
7743 return _ref.apply(this, arguments);
7744 };
7745}();
7746var getReferralTier = /*#__PURE__*/function () {
7747 var _ref2 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(code) {
7748 var response;
7749 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) {
7750 while (1) {
7751 switch (_context2.prev = _context2.next) {
7752 case 0:
7753 if (!(typeof code !== 'undefined' && code !== '')) {
7754 _context2.next = 7;
7755 break;
7756 }
7757
7758 _context2.next = 3;
7759 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])("/referrals/code-tier?code=".concat(code), {
7760 method: 'GET'
7761 }).then(function (res) {
7762 return res.text();
7763 }).then(function (res) {
7764 return res.replace(/['"]+/g, '');
7765 })["catch"](function () {
7766 return 'Failed to fetch';
7767 });
7768
7769 case 3:
7770 response = _context2.sent;
7771 return _context2.abrupt("return", response);
7772
7773 case 7:
7774 return _context2.abrupt("return", 'none');
7775
7776 case 8:
7777 case "end":
7778 return _context2.stop();
7779 }
7780 }
7781 }, _callee2);
7782 }));
7783
7784 return function getReferralTier(_x) {
7785 return _ref2.apply(this, arguments);
7786 };
7787}();
7788var createProduct = /*#__PURE__*/function () {
7789 var _ref3 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee3(item) {
7790 var _item$domain, _item$domain2;
7791
7792 var isRecommended,
7793 price,
7794 product,
7795 _args3 = arguments;
7796 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee3$(_context3) {
7797 while (1) {
7798 switch (_context3.prev = _context3.next) {
7799 case 0:
7800 isRecommended = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
7801 price = item.price / 100;
7802 product = {
7803 product_id: "".concat(item.productId),
7804 product_code: item.productCode,
7805 product_type: item.productType,
7806 name: ((_item$domain = item.domain) === null || _item$domain === void 0 ? void 0 : _item$domain.name) || '',
7807 label: ((_item$domain2 = item.domain) === null || _item$domain2 === void 0 ? void 0 : _item$domain2.name) || '',
7808 category: item.productType,
7809 price: price,
7810 value: price,
7811 currency: 'USD',
7812 quantity: 1,
7813 is_recommended: isRecommended
7814 };
7815 return _context3.abrupt("return", product);
7816
7817 case 4:
7818 case "end":
7819 return _context3.stop();
7820 }
7821 }
7822 }, _callee3);
7823 }));
7824
7825 return function createProduct(_x2) {
7826 return _ref3.apply(this, arguments);
7827 };
7828}();
7829var parseCart = /*#__PURE__*/function () {
7830 var _ref4 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee4(value) {
7831 var state, cartItems, signedIn, code, affiliate_tier, products, total, _iterator, _step, product, cart;
7832
7833 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee4$(_context4) {
7834 while (1) {
7835 switch (_context4.prev = _context4.next) {
7836 case 0:
7837 _context4.next = 2;
7838 return window.__NEXT_REDUX_WRAPPER_STORE__.getState();
7839
7840 case 2:
7841 state = _context4.sent;
7842
7843 if (state.cart.items) {
7844 _context4.next = 5;
7845 break;
7846 }
7847
7848 throw new Error('Cart not found');
7849
7850 case 5:
7851 cartItems = Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(state.cart.items);
7852 signedIn = state.auth.signedIn; // 1. Get referral properties
7853
7854 if (!signedIn) {
7855 _context4.next = 13;
7856 break;
7857 }
7858
7859 _context4.next = 10;
7860 return getReferralCode();
7861
7862 case 10:
7863 _context4.t0 = _context4.sent;
7864 _context4.next = 16;
7865 break;
7866
7867 case 13:
7868 _context4.next = 15;
7869 return react_cookies__WEBPACK_IMPORTED_MODULE_3___default.a.load('referralCode');
7870
7871 case 15:
7872 _context4.t0 = _context4.sent;
7873
7874 case 16:
7875 code = _context4.t0;
7876 _context4.next = 19;
7877 return getReferralTier(code);
7878
7879 case 19:
7880 affiliate_tier = _context4.sent;
7881 _context4.next = 22;
7882 return Promise.all(cartItems.map(function (ci) {
7883 return createProduct(ci);
7884 }));
7885
7886 case 22:
7887 products = _context4.sent;
7888 // 3. Calculate cart total
7889 // Total value of products in cart (Includes store credit)
7890 total = 0;
7891 _iterator = _createForOfIteratorHelper(products);
7892
7893 try {
7894 for (_iterator.s(); !(_step = _iterator.n()).done;) {
7895 product = _step.value;
7896 total += product.price;
7897 }
7898 } catch (err) {
7899 _iterator.e(err);
7900 } finally {
7901 _iterator.f();
7902 }
7903
7904 cart = {
7905 products: products,
7906 cart_quantity: products.length,
7907 total: total,
7908 // Total value of products in cart (Includes store credit)
7909 affiliation: code !== 'null' ? code : 'none',
7910 affiliate_tier: affiliate_tier,
7911 value: value / 100 // Value of purchase (No store credit)
7912
7913 };
7914 return _context4.abrupt("return", cart);
7915
7916 case 28:
7917 case "end":
7918 return _context4.stop();
7919 }
7920 }
7921 }, _callee4);
7922 }));
7923
7924 return function parseCart(_x3) {
7925 return _ref4.apply(this, arguments);
7926 };
7927}();
7928
7929/***/ }),
7930
7931/***/ "kHIg":
7932/***/ (function(module, __webpack_exports__, __webpack_require__) {
7933
7934"use strict";
7935
7936// EXPORTS
7937__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ wrapNativeSuper_wrapNativeSuper; });
7938
7939// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
7940var getPrototypeOf = __webpack_require__("foSv");
7941
7942// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
7943var setPrototypeOf = __webpack_require__("s4An");
7944
7945// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
7946function _isNativeFunction(fn) {
7947 return Function.toString.call(fn).indexOf("[native code]") !== -1;
7948}
7949// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
7950function _isNativeReflectConstruct() {
7951 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
7952 if (Reflect.construct.sham) return false;
7953 if (typeof Proxy === "function") return true;
7954
7955 try {
7956 Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
7957 return true;
7958 } catch (e) {
7959 return false;
7960 }
7961}
7962// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/construct.js
7963
7964
7965function construct_construct(Parent, args, Class) {
7966 if (_isNativeReflectConstruct()) {
7967 construct_construct = Reflect.construct;
7968 } else {
7969 construct_construct = function _construct(Parent, args, Class) {
7970 var a = [null];
7971 a.push.apply(a, args);
7972 var Constructor = Function.bind.apply(Parent, a);
7973 var instance = new Constructor();
7974 if (Class) Object(setPrototypeOf["a" /* default */])(instance, Class.prototype);
7975 return instance;
7976 };
7977 }
7978
7979 return construct_construct.apply(null, arguments);
7980}
7981// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
7982
7983
7984
7985
7986function wrapNativeSuper_wrapNativeSuper(Class) {
7987 var _cache = typeof Map === "function" ? new Map() : undefined;
7988
7989 wrapNativeSuper_wrapNativeSuper = function _wrapNativeSuper(Class) {
7990 if (Class === null || !_isNativeFunction(Class)) return Class;
7991
7992 if (typeof Class !== "function") {
7993 throw new TypeError("Super expression must either be null or a function");
7994 }
7995
7996 if (typeof _cache !== "undefined") {
7997 if (_cache.has(Class)) return _cache.get(Class);
7998
7999 _cache.set(Class, Wrapper);
8000 }
8001
8002 function Wrapper() {
8003 return construct_construct(Class, arguments, Object(getPrototypeOf["a" /* default */])(this).constructor);
8004 }
8005
8006 Wrapper.prototype = Object.create(Class.prototype, {
8007 constructor: {
8008 value: Wrapper,
8009 enumerable: false,
8010 writable: true,
8011 configurable: true
8012 }
8013 });
8014 return Object(setPrototypeOf["a" /* default */])(Wrapper, Class);
8015 };
8016
8017 return wrapNativeSuper_wrapNativeSuper(Class);
8018}
8019
8020/***/ }),
8021
8022/***/ "mrSG":
8023/***/ (function(module, __webpack_exports__, __webpack_require__) {
8024
8025"use strict";
8026__webpack_require__.r(__webpack_exports__);
8027/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
8028/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
8029/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
8030/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
8031/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
8032/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
8033/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
8034/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
8035/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__createBinding", function() { return __createBinding; });
8036/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
8037/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
8038/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
8039/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
8040/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
8041/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
8042/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
8043/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
8044/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
8045/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
8046/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
8047/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
8048/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
8049/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
8050/*! *****************************************************************************
8051Copyright (c) Microsoft Corporation.
8052
8053Permission to use, copy, modify, and/or distribute this software for any
8054purpose with or without fee is hereby granted.
8055
8056THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8057REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8058AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
8059INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
8060LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
8061OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
8062PERFORMANCE OF THIS SOFTWARE.
8063***************************************************************************** */
8064/* global Reflect, Promise */
8065
8066var extendStatics = function(d, b) {
8067 extendStatics = Object.setPrototypeOf ||
8068 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8069 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8070 return extendStatics(d, b);
8071};
8072
8073function __extends(d, b) {
8074 extendStatics(d, b);
8075 function __() { this.constructor = d; }
8076 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8077}
8078
8079var __assign = function() {
8080 __assign = Object.assign || function __assign(t) {
8081 for (var s, i = 1, n = arguments.length; i < n; i++) {
8082 s = arguments[i];
8083 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8084 }
8085 return t;
8086 }
8087 return __assign.apply(this, arguments);
8088}
8089
8090function __rest(s, e) {
8091 var t = {};
8092 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
8093 t[p] = s[p];
8094 if (s != null && typeof Object.getOwnPropertySymbols === "function")
8095 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8096 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8097 t[p[i]] = s[p[i]];
8098 }
8099 return t;
8100}
8101
8102function __decorate(decorators, target, key, desc) {
8103 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8104 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8105 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8106 return c > 3 && r && Object.defineProperty(target, key, r), r;
8107}
8108
8109function __param(paramIndex, decorator) {
8110 return function (target, key) { decorator(target, key, paramIndex); }
8111}
8112
8113function __metadata(metadataKey, metadataValue) {
8114 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
8115}
8116
8117function __awaiter(thisArg, _arguments, P, generator) {
8118 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8119 return new (P || (P = Promise))(function (resolve, reject) {
8120 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8121 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8122 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8123 step((generator = generator.apply(thisArg, _arguments || [])).next());
8124 });
8125}
8126
8127function __generator(thisArg, body) {
8128 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
8129 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
8130 function verb(n) { return function (v) { return step([n, v]); }; }
8131 function step(op) {
8132 if (f) throw new TypeError("Generator is already executing.");
8133 while (_) try {
8134 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
8135 if (y = 0, t) op = [op[0] & 2, t.value];
8136 switch (op[0]) {
8137 case 0: case 1: t = op; break;
8138 case 4: _.label++; return { value: op[1], done: false };
8139 case 5: _.label++; y = op[1]; op = [0]; continue;
8140 case 7: op = _.ops.pop(); _.trys.pop(); continue;
8141 default:
8142 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
8143 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
8144 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
8145 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
8146 if (t[2]) _.ops.pop();
8147 _.trys.pop(); continue;
8148 }
8149 op = body.call(thisArg, _);
8150 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
8151 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
8152 }
8153}
8154
8155function __createBinding(o, m, k, k2) {
8156 if (k2 === undefined) k2 = k;
8157 o[k2] = m[k];
8158}
8159
8160function __exportStar(m, exports) {
8161 for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
8162}
8163
8164function __values(o) {
8165 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
8166 if (m) return m.call(o);
8167 if (o && typeof o.length === "number") return {
8168 next: function () {
8169 if (o && i >= o.length) o = void 0;
8170 return { value: o && o[i++], done: !o };
8171 }
8172 };
8173 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
8174}
8175
8176function __read(o, n) {
8177 var m = typeof Symbol === "function" && o[Symbol.iterator];
8178 if (!m) return o;
8179 var i = m.call(o), r, ar = [], e;
8180 try {
8181 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8182 }
8183 catch (error) { e = { error: error }; }
8184 finally {
8185 try {
8186 if (r && !r.done && (m = i["return"])) m.call(i);
8187 }
8188 finally { if (e) throw e.error; }
8189 }
8190 return ar;
8191}
8192
8193function __spread() {
8194 for (var ar = [], i = 0; i < arguments.length; i++)
8195 ar = ar.concat(__read(arguments[i]));
8196 return ar;
8197}
8198
8199function __spreadArrays() {
8200 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
8201 for (var r = Array(s), k = 0, i = 0; i < il; i++)
8202 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
8203 r[k] = a[j];
8204 return r;
8205};
8206
8207function __await(v) {
8208 return this instanceof __await ? (this.v = v, this) : new __await(v);
8209}
8210
8211function __asyncGenerator(thisArg, _arguments, generator) {
8212 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
8213 var g = generator.apply(thisArg, _arguments || []), i, q = [];
8214 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
8215 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
8216 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
8217 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
8218 function fulfill(value) { resume("next", value); }
8219 function reject(value) { resume("throw", value); }
8220 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
8221}
8222
8223function __asyncDelegator(o) {
8224 var i, p;
8225 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
8226 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
8227}
8228
8229function __asyncValues(o) {
8230 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
8231 var m = o[Symbol.asyncIterator], i;
8232 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
8233 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
8234 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
8235}
8236
8237function __makeTemplateObject(cooked, raw) {
8238 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
8239 return cooked;
8240};
8241
8242function __importStar(mod) {
8243 if (mod && mod.__esModule) return mod;
8244 var result = {};
8245 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
8246 result.default = mod;
8247 return result;
8248}
8249
8250function __importDefault(mod) {
8251 return (mod && mod.__esModule) ? mod : { default: mod };
8252}
8253
8254function __classPrivateFieldGet(receiver, privateMap) {
8255 if (!privateMap.has(receiver)) {
8256 throw new TypeError("attempted to get private field on non-instance");
8257 }
8258 return privateMap.get(receiver);
8259}
8260
8261function __classPrivateFieldSet(receiver, privateMap, value) {
8262 if (!privateMap.has(receiver)) {
8263 throw new TypeError("attempted to set private field on non-instance");
8264 }
8265 privateMap.set(receiver, value);
8266 return value;
8267}
8268
8269
8270/***/ }),
8271
8272/***/ "oFlI":
8273/***/ (function(module, __webpack_exports__, __webpack_require__) {
8274
8275"use strict";
8276/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DomainSuffix; });
8277/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return belongsToZone; });
8278/* unused harmony export isKnownDomainZone */
8279/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return splitDomain; });
8280/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getDomainFromName; });
8281/* harmony import */ var punycode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GYWy");
8282/* harmony import */ var punycode__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(punycode__WEBPACK_IMPORTED_MODULE_0__);
8283
8284var DomainSuffix;
8285
8286(function (DomainSuffix) {
8287 DomainSuffix["Crypto"] = "crypto";
8288 DomainSuffix["Zil"] = "zil";
8289 DomainSuffix["Eth"] = "eth";
8290})(DomainSuffix || (DomainSuffix = {}));
8291
8292var belongsToZone = function belongsToZone(domain, domainSuffix) {
8293 return domain.endsWith(domainSuffix);
8294};
8295var isKnownDomainZone = function isKnownDomainZone(domain) {
8296 var domainZone = Object.values(DomainSuffix).find(function (domainSuffix) {
8297 return belongsToZone(domain, domainSuffix);
8298 });
8299 return domainZone !== undefined;
8300};
8301var splitDomain = function splitDomain(domain) {
8302 var splitted = domain.split('.');
8303 var extension = splitted.pop();
8304 var label = splitted.join('.');
8305 return {
8306 label: label,
8307 extension: extension
8308 };
8309};
8310var getDomainFromName = function getDomainFromName(domainName) {
8311 var name = punycode__WEBPACK_IMPORTED_MODULE_0___default.a.toASCII(domainName);
8312
8313 var _splitDomain = splitDomain(name),
8314 label = _splitDomain.label,
8315 extension = _splitDomain.extension;
8316
8317 return {
8318 name: name,
8319 label: label,
8320 extension: extension
8321 };
8322};
8323
8324/***/ }),
8325
8326/***/ "pJ3+":
8327/***/ (function(module, exports, __webpack_require__) {
8328
8329var __WEBPACK_AMD_DEFINE_RESULT__;/*
8330Copyright 2019 David Bau.
8331
8332Permission is hereby granted, free of charge, to any person obtaining
8333a copy of this software and associated documentation files (the
8334"Software"), to deal in the Software without restriction, including
8335without limitation the rights to use, copy, modify, merge, publish,
8336distribute, sublicense, and/or sell copies of the Software, and to
8337permit persons to whom the Software is furnished to do so, subject to
8338the following conditions:
8339
8340The above copyright notice and this permission notice shall be
8341included in all copies or substantial portions of the Software.
8342
8343THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
8344EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8345MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
8346IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
8347CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
8348TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
8349SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8350
8351*/
8352
8353(function (global, pool, math) {
8354//
8355// The following constants are related to IEEE 754 limits.
8356//
8357
8358var width = 256, // each RC4 output is 0 <= x < 256
8359 chunks = 6, // at least six RC4 outputs for each double
8360 digits = 52, // there are 52 significant digits in a double
8361 rngname = 'random', // rngname: name for Math.random and Math.seedrandom
8362 startdenom = math.pow(width, chunks),
8363 significance = math.pow(2, digits),
8364 overflow = significance * 2,
8365 mask = width - 1,
8366 nodecrypto; // node.js crypto module, initialized at the bottom.
8367
8368//
8369// seedrandom()
8370// This is the seedrandom function described above.
8371//
8372function seedrandom(seed, options, callback) {
8373 var key = [];
8374 options = (options == true) ? { entropy: true } : (options || {});
8375
8376 // Flatten the seed string or build one from local entropy if needed.
8377 var shortseed = mixkey(flatten(
8378 options.entropy ? [seed, tostring(pool)] :
8379 (seed == null) ? autoseed() : seed, 3), key);
8380
8381 // Use the seed to initialize an ARC4 generator.
8382 var arc4 = new ARC4(key);
8383
8384 // This function returns a random double in [0, 1) that contains
8385 // randomness in every bit of the mantissa of the IEEE 754 value.
8386 var prng = function() {
8387 var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
8388 d = startdenom, // and denominator d = 2 ^ 48.
8389 x = 0; // and no 'extra last byte'.
8390 while (n < significance) { // Fill up all significant digits by
8391 n = (n + x) * width; // shifting numerator and
8392 d *= width; // denominator and generating a
8393 x = arc4.g(1); // new least-significant-byte.
8394 }
8395 while (n >= overflow) { // To avoid rounding up, before adding
8396 n /= 2; // last byte, shift everything
8397 d /= 2; // right using integer math until
8398 x >>>= 1; // we have exactly the desired bits.
8399 }
8400 return (n + x) / d; // Form the number within [0, 1).
8401 };
8402
8403 prng.int32 = function() { return arc4.g(4) | 0; }
8404 prng.quick = function() { return arc4.g(4) / 0x100000000; }
8405 prng.double = prng;
8406
8407 // Mix the randomness into accumulated entropy.
8408 mixkey(tostring(arc4.S), pool);
8409
8410 // Calling convention: what to return as a function of prng, seed, is_math.
8411 return (options.pass || callback ||
8412 function(prng, seed, is_math_call, state) {
8413 if (state) {
8414 // Load the arc4 state from the given state if it has an S array.
8415 if (state.S) { copy(state, arc4); }
8416 // Only provide the .state method if requested via options.state.
8417 prng.state = function() { return copy(arc4, {}); }
8418 }
8419
8420 // If called as a method of Math (Math.seedrandom()), mutate
8421 // Math.random because that is how seedrandom.js has worked since v1.0.
8422 if (is_math_call) { math[rngname] = prng; return seed; }
8423
8424 // Otherwise, it is a newer calling convention, so return the
8425 // prng directly.
8426 else return prng;
8427 })(
8428 prng,
8429 shortseed,
8430 'global' in options ? options.global : (this == math),
8431 options.state);
8432}
8433
8434//
8435// ARC4
8436//
8437// An ARC4 implementation. The constructor takes a key in the form of
8438// an array of at most (width) integers that should be 0 <= x < (width).
8439//
8440// The g(count) method returns a pseudorandom integer that concatenates
8441// the next (count) outputs from ARC4. Its return value is a number x
8442// that is in the range 0 <= x < (width ^ count).
8443//
8444function ARC4(key) {
8445 var t, keylen = key.length,
8446 me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
8447
8448 // The empty key [] is treated as [0].
8449 if (!keylen) { key = [keylen++]; }
8450
8451 // Set up S using the standard key scheduling algorithm.
8452 while (i < width) {
8453 s[i] = i++;
8454 }
8455 for (i = 0; i < width; i++) {
8456 s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
8457 s[j] = t;
8458 }
8459
8460 // The "g" method returns the next (count) outputs as one number.
8461 (me.g = function(count) {
8462 // Using instance members instead of closure state nearly doubles speed.
8463 var t, r = 0,
8464 i = me.i, j = me.j, s = me.S;
8465 while (count--) {
8466 t = s[i = mask & (i + 1)];
8467 r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
8468 }
8469 me.i = i; me.j = j;
8470 return r;
8471 // For robust unpredictability, the function call below automatically
8472 // discards an initial batch of values. This is called RC4-drop[256].
8473 // See http://google.com/search?q=rsa+fluhrer+response&btnI
8474 })(width);
8475}
8476
8477//
8478// copy()
8479// Copies internal state of ARC4 to or from a plain object.
8480//
8481function copy(f, t) {
8482 t.i = f.i;
8483 t.j = f.j;
8484 t.S = f.S.slice();
8485 return t;
8486};
8487
8488//
8489// flatten()
8490// Converts an object tree to nested arrays of strings.
8491//
8492function flatten(obj, depth) {
8493 var result = [], typ = (typeof obj), prop;
8494 if (depth && typ == 'object') {
8495 for (prop in obj) {
8496 try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}
8497 }
8498 }
8499 return (result.length ? result : typ == 'string' ? obj : obj + '\0');
8500}
8501
8502//
8503// mixkey()
8504// Mixes a string seed into a key that is an array of integers, and
8505// returns a shortened string seed that is equivalent to the result key.
8506//
8507function mixkey(seed, key) {
8508 var stringseed = seed + '', smear, j = 0;
8509 while (j < stringseed.length) {
8510 key[mask & j] =
8511 mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
8512 }
8513 return tostring(key);
8514}
8515
8516//
8517// autoseed()
8518// Returns an object for autoseeding, using window.crypto and Node crypto
8519// module if available.
8520//
8521function autoseed() {
8522 try {
8523 var out;
8524 if (nodecrypto && (out = nodecrypto.randomBytes)) {
8525 // The use of 'out' to remember randomBytes makes tight minified code.
8526 out = out(width);
8527 } else {
8528 out = new Uint8Array(width);
8529 (global.crypto || global.msCrypto).getRandomValues(out);
8530 }
8531 return tostring(out);
8532 } catch (e) {
8533 var browser = global.navigator,
8534 plugins = browser && browser.plugins;
8535 return [+new Date, global, plugins, global.screen, tostring(pool)];
8536 }
8537}
8538
8539//
8540// tostring()
8541// Converts an array of charcodes to a string
8542//
8543function tostring(a) {
8544 return String.fromCharCode.apply(0, a);
8545}
8546
8547//
8548// When seedrandom.js is loaded, we immediately mix a few bits
8549// from the built-in RNG into the entropy pool. Because we do
8550// not want to interfere with deterministic PRNG state later,
8551// seedrandom will not call math.random on its own again after
8552// initialization.
8553//
8554mixkey(math.random(), pool);
8555
8556//
8557// Nodejs and AMD support: export the implementation as a module using
8558// either convention.
8559//
8560if ( true && module.exports) {
8561 module.exports = seedrandom;
8562 // When in node.js, try using crypto package for autoseeding.
8563 try {
8564 nodecrypto = __webpack_require__(9);
8565 } catch (ex) {}
8566} else if (true) {
8567 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return seedrandom; }).call(exports, __webpack_require__, exports, module),
8568 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
8569} else {}
8570
8571
8572// End anonymous scope, and pass initial values.
8573})(
8574 // global: `self` in browsers (including strict mode and web workers),
8575 // otherwise `this` in Node and other environments
8576 (typeof self !== 'undefined') ? self : this,
8577 [], // pool: entropy pool starts empty
8578 Math // math: package containing random, pow, and seedrandom
8579);
8580
8581
8582/***/ }),
8583
8584/***/ "pJ6O":
8585/***/ (function(module, exports, __webpack_require__) {
8586
8587/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of the "xorwow" prng algorithm by
8588// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper
8589
8590(function(global, module, define) {
8591
8592function XorGen(seed) {
8593 var me = this, strseed = '';
8594
8595 // Set up generator function.
8596 me.next = function() {
8597 var t = (me.x ^ (me.x >>> 2));
8598 me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;
8599 return (me.d = (me.d + 362437 | 0)) +
8600 (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;
8601 };
8602
8603 me.x = 0;
8604 me.y = 0;
8605 me.z = 0;
8606 me.w = 0;
8607 me.v = 0;
8608
8609 if (seed === (seed | 0)) {
8610 // Integer seed.
8611 me.x = seed;
8612 } else {
8613 // String seed.
8614 strseed += seed;
8615 }
8616
8617 // Mix in string seed, then discard an initial batch of 64 values.
8618 for (var k = 0; k < strseed.length + 64; k++) {
8619 me.x ^= strseed.charCodeAt(k) | 0;
8620 if (k == strseed.length) {
8621 me.d = me.x << 10 ^ me.x >>> 4;
8622 }
8623 me.next();
8624 }
8625}
8626
8627function copy(f, t) {
8628 t.x = f.x;
8629 t.y = f.y;
8630 t.z = f.z;
8631 t.w = f.w;
8632 t.v = f.v;
8633 t.d = f.d;
8634 return t;
8635}
8636
8637function impl(seed, opts) {
8638 var xg = new XorGen(seed),
8639 state = opts && opts.state,
8640 prng = function() { return (xg.next() >>> 0) / 0x100000000; };
8641 prng.double = function() {
8642 do {
8643 var top = xg.next() >>> 11,
8644 bot = (xg.next() >>> 0) / 0x100000000,
8645 result = (top + bot) / (1 << 21);
8646 } while (result === 0);
8647 return result;
8648 };
8649 prng.int32 = xg.next;
8650 prng.quick = prng;
8651 if (state) {
8652 if (typeof(state) == 'object') copy(state, xg);
8653 prng.state = function() { return copy(xg, {}); }
8654 }
8655 return prng;
8656}
8657
8658if (module && module.exports) {
8659 module.exports = impl;
8660} else if (__webpack_require__("B9Yq") && __webpack_require__("PDX0")) {
8661 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),
8662 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
8663} else {
8664 this.xorwow = impl;
8665}
8666
8667})(
8668 this,
8669 true && module, // present in node.js
8670 __webpack_require__("B9Yq") // present with an AMD loader
8671);
8672
8673
8674
8675/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("YuTi")(module)))
8676
8677/***/ }),
8678
8679/***/ "qOnz":
8680/***/ (function(module, __webpack_exports__, __webpack_require__) {
8681
8682"use strict";
8683/* WEBPACK VAR INJECTION */(function(global) {/* unused harmony export CONSTANTS */
8684/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Deferred; });
8685/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ErrorFactory; });
8686/* unused harmony export FirebaseError */
8687/* unused harmony export MAX_VALUE_MILLIS */
8688/* unused harmony export RANDOM_FACTOR */
8689/* unused harmony export Sha1 */
8690/* unused harmony export areCookiesEnabled */
8691/* unused harmony export assert */
8692/* unused harmony export assertionError */
8693/* unused harmony export async */
8694/* unused harmony export base64 */
8695/* unused harmony export base64Decode */
8696/* unused harmony export base64Encode */
8697/* unused harmony export calculateBackoffMillis */
8698/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return contains; });
8699/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return createSubscribe; });
8700/* unused harmony export decode */
8701/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return deepCopy; });
8702/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return deepExtend; });
8703/* unused harmony export errorPrefix */
8704/* unused harmony export getUA */
8705/* unused harmony export isAdmin */
8706/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isBrowser; });
8707/* unused harmony export isBrowserExtension */
8708/* unused harmony export isElectron */
8709/* unused harmony export isEmpty */
8710/* unused harmony export isIE */
8711/* unused harmony export isIndexedDBAvailable */
8712/* unused harmony export isMobileCordova */
8713/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isNode; });
8714/* unused harmony export isNodeSdk */
8715/* unused harmony export isReactNative */
8716/* unused harmony export isSafari */
8717/* unused harmony export isUWP */
8718/* unused harmony export isValidFormat */
8719/* unused harmony export isValidTimestamp */
8720/* unused harmony export issuedAtTime */
8721/* unused harmony export jsonEval */
8722/* unused harmony export map */
8723/* unused harmony export ordinal */
8724/* unused harmony export querystring */
8725/* unused harmony export querystringDecode */
8726/* unused harmony export safeGet */
8727/* unused harmony export stringLength */
8728/* unused harmony export stringToByteArray */
8729/* unused harmony export stringify */
8730/* unused harmony export validateArgCount */
8731/* unused harmony export validateCallback */
8732/* unused harmony export validateContextObject */
8733/* unused harmony export validateIndexedDBOpenable */
8734/* unused harmony export validateNamespace */
8735/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("mrSG");
8736
8737
8738/**
8739 * @license
8740 * Copyright 2017 Google LLC
8741 *
8742 * Licensed under the Apache License, Version 2.0 (the "License");
8743 * you may not use this file except in compliance with the License.
8744 * You may obtain a copy of the License at
8745 *
8746 * http://www.apache.org/licenses/LICENSE-2.0
8747 *
8748 * Unless required by applicable law or agreed to in writing, software
8749 * distributed under the License is distributed on an "AS IS" BASIS,
8750 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8751 * See the License for the specific language governing permissions and
8752 * limitations under the License.
8753 */
8754/**
8755 * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time.
8756 */
8757var CONSTANTS = {
8758 /**
8759 * @define {boolean} Whether this is the client Node.js SDK.
8760 */
8761 NODE_CLIENT: false,
8762 /**
8763 * @define {boolean} Whether this is the Admin Node.js SDK.
8764 */
8765 NODE_ADMIN: false,
8766 /**
8767 * Firebase SDK Version
8768 */
8769 SDK_VERSION: '${JSCORE_VERSION}'
8770};
8771
8772/**
8773 * @license
8774 * Copyright 2017 Google LLC
8775 *
8776 * Licensed under the Apache License, Version 2.0 (the "License");
8777 * you may not use this file except in compliance with the License.
8778 * You may obtain a copy of the License at
8779 *
8780 * http://www.apache.org/licenses/LICENSE-2.0
8781 *
8782 * Unless required by applicable law or agreed to in writing, software
8783 * distributed under the License is distributed on an "AS IS" BASIS,
8784 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8785 * See the License for the specific language governing permissions and
8786 * limitations under the License.
8787 */
8788/**
8789 * Throws an error if the provided assertion is falsy
8790 */
8791var assert = function (assertion, message) {
8792 if (!assertion) {
8793 throw assertionError(message);
8794 }
8795};
8796/**
8797 * Returns an Error object suitable for throwing.
8798 */
8799var assertionError = function (message) {
8800 return new Error('Firebase Database (' +
8801 CONSTANTS.SDK_VERSION +
8802 ') INTERNAL ASSERT FAILED: ' +
8803 message);
8804};
8805
8806/**
8807 * @license
8808 * Copyright 2017 Google LLC
8809 *
8810 * Licensed under the Apache License, Version 2.0 (the "License");
8811 * you may not use this file except in compliance with the License.
8812 * You may obtain a copy of the License at
8813 *
8814 * http://www.apache.org/licenses/LICENSE-2.0
8815 *
8816 * Unless required by applicable law or agreed to in writing, software
8817 * distributed under the License is distributed on an "AS IS" BASIS,
8818 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8819 * See the License for the specific language governing permissions and
8820 * limitations under the License.
8821 */
8822var stringToByteArray = function (str) {
8823 // TODO(user): Use native implementations if/when available
8824 var out = [];
8825 var p = 0;
8826 for (var i = 0; i < str.length; i++) {
8827 var c = str.charCodeAt(i);
8828 if (c < 128) {
8829 out[p++] = c;
8830 }
8831 else if (c < 2048) {
8832 out[p++] = (c >> 6) | 192;
8833 out[p++] = (c & 63) | 128;
8834 }
8835 else if ((c & 0xfc00) === 0xd800 &&
8836 i + 1 < str.length &&
8837 (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
8838 // Surrogate Pair
8839 c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff);
8840 out[p++] = (c >> 18) | 240;
8841 out[p++] = ((c >> 12) & 63) | 128;
8842 out[p++] = ((c >> 6) & 63) | 128;
8843 out[p++] = (c & 63) | 128;
8844 }
8845 else {
8846 out[p++] = (c >> 12) | 224;
8847 out[p++] = ((c >> 6) & 63) | 128;
8848 out[p++] = (c & 63) | 128;
8849 }
8850 }
8851 return out;
8852};
8853/**
8854 * Turns an array of numbers into the string given by the concatenation of the
8855 * characters to which the numbers correspond.
8856 * @param bytes Array of numbers representing characters.
8857 * @return Stringification of the array.
8858 */
8859var byteArrayToString = function (bytes) {
8860 // TODO(user): Use native implementations if/when available
8861 var out = [];
8862 var pos = 0, c = 0;
8863 while (pos < bytes.length) {
8864 var c1 = bytes[pos++];
8865 if (c1 < 128) {
8866 out[c++] = String.fromCharCode(c1);
8867 }
8868 else if (c1 > 191 && c1 < 224) {
8869 var c2 = bytes[pos++];
8870 out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
8871 }
8872 else if (c1 > 239 && c1 < 365) {
8873 // Surrogate Pair
8874 var c2 = bytes[pos++];
8875 var c3 = bytes[pos++];
8876 var c4 = bytes[pos++];
8877 var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) -
8878 0x10000;
8879 out[c++] = String.fromCharCode(0xd800 + (u >> 10));
8880 out[c++] = String.fromCharCode(0xdc00 + (u & 1023));
8881 }
8882 else {
8883 var c2 = bytes[pos++];
8884 var c3 = bytes[pos++];
8885 out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
8886 }
8887 }
8888 return out.join('');
8889};
8890// We define it as an object literal instead of a class because a class compiled down to es5 can't
8891// be treeshaked. https://github.com/rollup/rollup/issues/1691
8892// Static lookup maps, lazily populated by init_()
8893var base64 = {
8894 /**
8895 * Maps bytes to characters.
8896 */
8897 byteToCharMap_: null,
8898 /**
8899 * Maps characters to bytes.
8900 */
8901 charToByteMap_: null,
8902 /**
8903 * Maps bytes to websafe characters.
8904 * @private
8905 */
8906 byteToCharMapWebSafe_: null,
8907 /**
8908 * Maps websafe characters to bytes.
8909 * @private
8910 */
8911 charToByteMapWebSafe_: null,
8912 /**
8913 * Our default alphabet, shared between
8914 * ENCODED_VALS and ENCODED_VALS_WEBSAFE
8915 */
8916 ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789',
8917 /**
8918 * Our default alphabet. Value 64 (=) is special; it means "nothing."
8919 */
8920 get ENCODED_VALS() {
8921 return this.ENCODED_VALS_BASE + '+/=';
8922 },
8923 /**
8924 * Our websafe alphabet.
8925 */
8926 get ENCODED_VALS_WEBSAFE() {
8927 return this.ENCODED_VALS_BASE + '-_.';
8928 },
8929 /**
8930 * Whether this browser supports the atob and btoa functions. This extension
8931 * started at Mozilla but is now implemented by many browsers. We use the
8932 * ASSUME_* variables to avoid pulling in the full useragent detection library
8933 * but still allowing the standard per-browser compilations.
8934 *
8935 */
8936 HAS_NATIVE_SUPPORT: typeof atob === 'function',
8937 /**
8938 * Base64-encode an array of bytes.
8939 *
8940 * @param input An array of bytes (numbers with
8941 * value in [0, 255]) to encode.
8942 * @param webSafe Boolean indicating we should use the
8943 * alternative alphabet.
8944 * @return The base64 encoded string.
8945 */
8946 encodeByteArray: function (input, webSafe) {
8947 if (!Array.isArray(input)) {
8948 throw Error('encodeByteArray takes an array as a parameter');
8949 }
8950 this.init_();
8951 var byteToCharMap = webSafe
8952 ? this.byteToCharMapWebSafe_
8953 : this.byteToCharMap_;
8954 var output = [];
8955 for (var i = 0; i < input.length; i += 3) {
8956 var byte1 = input[i];
8957 var haveByte2 = i + 1 < input.length;
8958 var byte2 = haveByte2 ? input[i + 1] : 0;
8959 var haveByte3 = i + 2 < input.length;
8960 var byte3 = haveByte3 ? input[i + 2] : 0;
8961 var outByte1 = byte1 >> 2;
8962 var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4);
8963 var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6);
8964 var outByte4 = byte3 & 0x3f;
8965 if (!haveByte3) {
8966 outByte4 = 64;
8967 if (!haveByte2) {
8968 outByte3 = 64;
8969 }
8970 }
8971 output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]);
8972 }
8973 return output.join('');
8974 },
8975 /**
8976 * Base64-encode a string.
8977 *
8978 * @param input A string to encode.
8979 * @param webSafe If true, we should use the
8980 * alternative alphabet.
8981 * @return The base64 encoded string.
8982 */
8983 encodeString: function (input, webSafe) {
8984 // Shortcut for Mozilla browsers that implement
8985 // a native base64 encoder in the form of "btoa/atob"
8986 if (this.HAS_NATIVE_SUPPORT && !webSafe) {
8987 return btoa(input);
8988 }
8989 return this.encodeByteArray(stringToByteArray(input), webSafe);
8990 },
8991 /**
8992 * Base64-decode a string.
8993 *
8994 * @param input to decode.
8995 * @param webSafe True if we should use the
8996 * alternative alphabet.
8997 * @return string representing the decoded value.
8998 */
8999 decodeString: function (input, webSafe) {
9000 // Shortcut for Mozilla browsers that implement
9001 // a native base64 encoder in the form of "btoa/atob"
9002 if (this.HAS_NATIVE_SUPPORT && !webSafe) {
9003 return atob(input);
9004 }
9005 return byteArrayToString(this.decodeStringToByteArray(input, webSafe));
9006 },
9007 /**
9008 * Base64-decode a string.
9009 *
9010 * In base-64 decoding, groups of four characters are converted into three
9011 * bytes. If the encoder did not apply padding, the input length may not
9012 * be a multiple of 4.
9013 *
9014 * In this case, the last group will have fewer than 4 characters, and
9015 * padding will be inferred. If the group has one or two characters, it decodes
9016 * to one byte. If the group has three characters, it decodes to two bytes.
9017 *
9018 * @param input Input to decode.
9019 * @param webSafe True if we should use the web-safe alphabet.
9020 * @return bytes representing the decoded value.
9021 */
9022 decodeStringToByteArray: function (input, webSafe) {
9023 this.init_();
9024 var charToByteMap = webSafe
9025 ? this.charToByteMapWebSafe_
9026 : this.charToByteMap_;
9027 var output = [];
9028 for (var i = 0; i < input.length;) {
9029 var byte1 = charToByteMap[input.charAt(i++)];
9030 var haveByte2 = i < input.length;
9031 var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0;
9032 ++i;
9033 var haveByte3 = i < input.length;
9034 var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64;
9035 ++i;
9036 var haveByte4 = i < input.length;
9037 var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64;
9038 ++i;
9039 if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) {
9040 throw Error();
9041 }
9042 var outByte1 = (byte1 << 2) | (byte2 >> 4);
9043 output.push(outByte1);
9044 if (byte3 !== 64) {
9045 var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2);
9046 output.push(outByte2);
9047 if (byte4 !== 64) {
9048 var outByte3 = ((byte3 << 6) & 0xc0) | byte4;
9049 output.push(outByte3);
9050 }
9051 }
9052 }
9053 return output;
9054 },
9055 /**
9056 * Lazy static initialization function. Called before
9057 * accessing any of the static map variables.
9058 * @private
9059 */
9060 init_: function () {
9061 if (!this.byteToCharMap_) {
9062 this.byteToCharMap_ = {};
9063 this.charToByteMap_ = {};
9064 this.byteToCharMapWebSafe_ = {};
9065 this.charToByteMapWebSafe_ = {};
9066 // We want quick mappings back and forth, so we precompute two maps.
9067 for (var i = 0; i < this.ENCODED_VALS.length; i++) {
9068 this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i);
9069 this.charToByteMap_[this.byteToCharMap_[i]] = i;
9070 this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i);
9071 this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i;
9072 // Be forgiving when decoding and correctly decode both encodings.
9073 if (i >= this.ENCODED_VALS_BASE.length) {
9074 this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i;
9075 this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i;
9076 }
9077 }
9078 }
9079 }
9080};
9081/**
9082 * URL-safe base64 encoding
9083 */
9084var base64Encode = function (str) {
9085 var utf8Bytes = stringToByteArray(str);
9086 return base64.encodeByteArray(utf8Bytes, true);
9087};
9088/**
9089 * URL-safe base64 decoding
9090 *
9091 * NOTE: DO NOT use the global atob() function - it does NOT support the
9092 * base64Url variant encoding.
9093 *
9094 * @param str To be decoded
9095 * @return Decoded result, if possible
9096 */
9097var base64Decode = function (str) {
9098 try {
9099 return base64.decodeString(str, true);
9100 }
9101 catch (e) {
9102 console.error('base64Decode failed: ', e);
9103 }
9104 return null;
9105};
9106
9107/**
9108 * @license
9109 * Copyright 2017 Google LLC
9110 *
9111 * Licensed under the Apache License, Version 2.0 (the "License");
9112 * you may not use this file except in compliance with the License.
9113 * You may obtain a copy of the License at
9114 *
9115 * http://www.apache.org/licenses/LICENSE-2.0
9116 *
9117 * Unless required by applicable law or agreed to in writing, software
9118 * distributed under the License is distributed on an "AS IS" BASIS,
9119 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9120 * See the License for the specific language governing permissions and
9121 * limitations under the License.
9122 */
9123/**
9124 * Do a deep-copy of basic JavaScript Objects or Arrays.
9125 */
9126function deepCopy(value) {
9127 return deepExtend(undefined, value);
9128}
9129/**
9130 * Copy properties from source to target (recursively allows extension
9131 * of Objects and Arrays). Scalar values in the target are over-written.
9132 * If target is undefined, an object of the appropriate type will be created
9133 * (and returned).
9134 *
9135 * We recursively copy all child properties of plain Objects in the source- so
9136 * that namespace- like dictionaries are merged.
9137 *
9138 * Note that the target can be a function, in which case the properties in
9139 * the source Object are copied onto it as static properties of the Function.
9140 *
9141 * Note: we don't merge __proto__ to prevent prototype pollution
9142 */
9143function deepExtend(target, source) {
9144 if (!(source instanceof Object)) {
9145 return source;
9146 }
9147 switch (source.constructor) {
9148 case Date:
9149 // Treat Dates like scalars; if the target date object had any child
9150 // properties - they will be lost!
9151 var dateValue = source;
9152 return new Date(dateValue.getTime());
9153 case Object:
9154 if (target === undefined) {
9155 target = {};
9156 }
9157 break;
9158 case Array:
9159 // Always copy the array source and overwrite the target.
9160 target = [];
9161 break;
9162 default:
9163 // Not a plain Object - treat it as a scalar.
9164 return source;
9165 }
9166 for (var prop in source) {
9167 // use isValidKey to guard against prototype pollution. See https://snyk.io/vuln/SNYK-JS-LODASH-450202
9168 if (!source.hasOwnProperty(prop) || !isValidKey(prop)) {
9169 continue;
9170 }
9171 target[prop] = deepExtend(target[prop], source[prop]);
9172 }
9173 return target;
9174}
9175function isValidKey(key) {
9176 return key !== '__proto__';
9177}
9178
9179/**
9180 * @license
9181 * Copyright 2017 Google LLC
9182 *
9183 * Licensed under the Apache License, Version 2.0 (the "License");
9184 * you may not use this file except in compliance with the License.
9185 * You may obtain a copy of the License at
9186 *
9187 * http://www.apache.org/licenses/LICENSE-2.0
9188 *
9189 * Unless required by applicable law or agreed to in writing, software
9190 * distributed under the License is distributed on an "AS IS" BASIS,
9191 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9192 * See the License for the specific language governing permissions and
9193 * limitations under the License.
9194 */
9195var Deferred = /** @class */ (function () {
9196 function Deferred() {
9197 var _this = this;
9198 this.reject = function () { };
9199 this.resolve = function () { };
9200 this.promise = new Promise(function (resolve, reject) {
9201 _this.resolve = resolve;
9202 _this.reject = reject;
9203 });
9204 }
9205 /**
9206 * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around
9207 * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback
9208 * and returns a node-style callback which will resolve or reject the Deferred's promise.
9209 */
9210 Deferred.prototype.wrapCallback = function (callback) {
9211 var _this = this;
9212 return function (error, value) {
9213 if (error) {
9214 _this.reject(error);
9215 }
9216 else {
9217 _this.resolve(value);
9218 }
9219 if (typeof callback === 'function') {
9220 // Attaching noop handler just in case developer wasn't expecting
9221 // promises
9222 _this.promise.catch(function () { });
9223 // Some of our callbacks don't expect a value and our own tests
9224 // assert that the parameter length is 1
9225 if (callback.length === 1) {
9226 callback(error);
9227 }
9228 else {
9229 callback(error, value);
9230 }
9231 }
9232 };
9233 };
9234 return Deferred;
9235}());
9236
9237/**
9238 * @license
9239 * Copyright 2017 Google LLC
9240 *
9241 * Licensed under the Apache License, Version 2.0 (the "License");
9242 * you may not use this file except in compliance with the License.
9243 * You may obtain a copy of the License at
9244 *
9245 * http://www.apache.org/licenses/LICENSE-2.0
9246 *
9247 * Unless required by applicable law or agreed to in writing, software
9248 * distributed under the License is distributed on an "AS IS" BASIS,
9249 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9250 * See the License for the specific language governing permissions and
9251 * limitations under the License.
9252 */
9253/**
9254 * Returns navigator.userAgent string or '' if it's not defined.
9255 * @return user agent string
9256 */
9257function getUA() {
9258 if (typeof navigator !== 'undefined' &&
9259 typeof navigator['userAgent'] === 'string') {
9260 return navigator['userAgent'];
9261 }
9262 else {
9263 return '';
9264 }
9265}
9266/**
9267 * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device.
9268 *
9269 * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap
9270 * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally
9271 * wait for a callback.
9272 */
9273function isMobileCordova() {
9274 return (typeof window !== 'undefined' &&
9275 // @ts-ignore Setting up an broadly applicable index signature for Window
9276 // just to deal with this case would probably be a bad idea.
9277 !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) &&
9278 /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA()));
9279}
9280/**
9281 * Detect Node.js.
9282 *
9283 * @return true if Node.js environment is detected.
9284 */
9285// Node detection logic from: https://github.com/iliakan/detect-node/
9286function isNode() {
9287 try {
9288 return (Object.prototype.toString.call(global.process) === '[object process]');
9289 }
9290 catch (e) {
9291 return false;
9292 }
9293}
9294/**
9295 * Detect Browser Environment
9296 */
9297function isBrowser() {
9298 return typeof self === 'object' && self.self === self;
9299}
9300function isBrowserExtension() {
9301 var runtime = typeof chrome === 'object'
9302 ? chrome.runtime
9303 : typeof browser === 'object'
9304 ? browser.runtime
9305 : undefined;
9306 return typeof runtime === 'object' && runtime.id !== undefined;
9307}
9308/**
9309 * Detect React Native.
9310 *
9311 * @return true if ReactNative environment is detected.
9312 */
9313function isReactNative() {
9314 return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');
9315}
9316/** Detects Electron apps. */
9317function isElectron() {
9318 return getUA().indexOf('Electron/') >= 0;
9319}
9320/** Detects Internet Explorer. */
9321function isIE() {
9322 var ua = getUA();
9323 return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
9324}
9325/** Detects Universal Windows Platform apps. */
9326function isUWP() {
9327 return getUA().indexOf('MSAppHost/') >= 0;
9328}
9329/**
9330 * Detect whether the current SDK build is the Node version.
9331 *
9332 * @return true if it's the Node SDK build.
9333 */
9334function isNodeSdk() {
9335 return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true;
9336}
9337/** Returns true if we are running in Safari. */
9338function isSafari() {
9339 return (!isNode() &&
9340 navigator.userAgent.includes('Safari') &&
9341 !navigator.userAgent.includes('Chrome'));
9342}
9343/**
9344 * This method checks if indexedDB is supported by current browser/service worker context
9345 * @return true if indexedDB is supported by current browser/service worker context
9346 */
9347function isIndexedDBAvailable() {
9348 return 'indexedDB' in self && indexedDB != null;
9349}
9350/**
9351 * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject
9352 * if errors occur during the database open operation.
9353 */
9354function validateIndexedDBOpenable() {
9355 return new Promise(function (resolve, reject) {
9356 try {
9357 var preExist_1 = true;
9358 var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module';
9359 var request_1 = window.indexedDB.open(DB_CHECK_NAME_1);
9360 request_1.onsuccess = function () {
9361 request_1.result.close();
9362 // delete database only when it doesn't pre-exist
9363 if (!preExist_1) {
9364 window.indexedDB.deleteDatabase(DB_CHECK_NAME_1);
9365 }
9366 resolve(true);
9367 };
9368 request_1.onupgradeneeded = function () {
9369 preExist_1 = false;
9370 };
9371 request_1.onerror = function () {
9372 var _a;
9373 reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || '');
9374 };
9375 }
9376 catch (error) {
9377 reject(error);
9378 }
9379 });
9380}
9381/**
9382 *
9383 * This method checks whether cookie is enabled within current browser
9384 * @return true if cookie is enabled within current browser
9385 */
9386function areCookiesEnabled() {
9387 if (!navigator || !navigator.cookieEnabled) {
9388 return false;
9389 }
9390 return true;
9391}
9392
9393/**
9394 * @license
9395 * Copyright 2017 Google LLC
9396 *
9397 * Licensed under the Apache License, Version 2.0 (the "License");
9398 * you may not use this file except in compliance with the License.
9399 * You may obtain a copy of the License at
9400 *
9401 * http://www.apache.org/licenses/LICENSE-2.0
9402 *
9403 * Unless required by applicable law or agreed to in writing, software
9404 * distributed under the License is distributed on an "AS IS" BASIS,
9405 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9406 * See the License for the specific language governing permissions and
9407 * limitations under the License.
9408 */
9409var ERROR_NAME = 'FirebaseError';
9410// Based on code from:
9411// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types
9412var FirebaseError = /** @class */ (function (_super) {
9413 Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FirebaseError, _super);
9414 function FirebaseError(code, message, customData) {
9415 var _this = _super.call(this, message) || this;
9416 _this.code = code;
9417 _this.customData = customData;
9418 _this.name = ERROR_NAME;
9419 // Fix For ES5
9420 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
9421 Object.setPrototypeOf(_this, FirebaseError.prototype);
9422 // Maintains proper stack trace for where our error was thrown.
9423 // Only available on V8.
9424 if (Error.captureStackTrace) {
9425 Error.captureStackTrace(_this, ErrorFactory.prototype.create);
9426 }
9427 return _this;
9428 }
9429 return FirebaseError;
9430}(Error));
9431var ErrorFactory = /** @class */ (function () {
9432 function ErrorFactory(service, serviceName, errors) {
9433 this.service = service;
9434 this.serviceName = serviceName;
9435 this.errors = errors;
9436 }
9437 ErrorFactory.prototype.create = function (code) {
9438 var data = [];
9439 for (var _i = 1; _i < arguments.length; _i++) {
9440 data[_i - 1] = arguments[_i];
9441 }
9442 var customData = data[0] || {};
9443 var fullCode = this.service + "/" + code;
9444 var template = this.errors[code];
9445 var message = template ? replaceTemplate(template, customData) : 'Error';
9446 // Service Name: Error message (service/code).
9447 var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ").";
9448 var error = new FirebaseError(fullCode, fullMessage, customData);
9449 return error;
9450 };
9451 return ErrorFactory;
9452}());
9453function replaceTemplate(template, data) {
9454 return template.replace(PATTERN, function (_, key) {
9455 var value = data[key];
9456 return value != null ? String(value) : "<" + key + "?>";
9457 });
9458}
9459var PATTERN = /\{\$([^}]+)}/g;
9460
9461/**
9462 * @license
9463 * Copyright 2017 Google LLC
9464 *
9465 * Licensed under the Apache License, Version 2.0 (the "License");
9466 * you may not use this file except in compliance with the License.
9467 * You may obtain a copy of the License at
9468 *
9469 * http://www.apache.org/licenses/LICENSE-2.0
9470 *
9471 * Unless required by applicable law or agreed to in writing, software
9472 * distributed under the License is distributed on an "AS IS" BASIS,
9473 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9474 * See the License for the specific language governing permissions and
9475 * limitations under the License.
9476 */
9477/**
9478 * Evaluates a JSON string into a javascript object.
9479 *
9480 * @param {string} str A string containing JSON.
9481 * @return {*} The javascript object representing the specified JSON.
9482 */
9483function jsonEval(str) {
9484 return JSON.parse(str);
9485}
9486/**
9487 * Returns JSON representing a javascript object.
9488 * @param {*} data Javascript object to be stringified.
9489 * @return {string} The JSON contents of the object.
9490 */
9491function stringify(data) {
9492 return JSON.stringify(data);
9493}
9494
9495/**
9496 * @license
9497 * Copyright 2017 Google LLC
9498 *
9499 * Licensed under the Apache License, Version 2.0 (the "License");
9500 * you may not use this file except in compliance with the License.
9501 * You may obtain a copy of the License at
9502 *
9503 * http://www.apache.org/licenses/LICENSE-2.0
9504 *
9505 * Unless required by applicable law or agreed to in writing, software
9506 * distributed under the License is distributed on an "AS IS" BASIS,
9507 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9508 * See the License for the specific language governing permissions and
9509 * limitations under the License.
9510 */
9511/**
9512 * Decodes a Firebase auth. token into constituent parts.
9513 *
9514 * Notes:
9515 * - May return with invalid / incomplete claims if there's no native base64 decoding support.
9516 * - Doesn't check if the token is actually valid.
9517 */
9518var decode = function (token) {
9519 var header = {}, claims = {}, data = {}, signature = '';
9520 try {
9521 var parts = token.split('.');
9522 header = jsonEval(base64Decode(parts[0]) || '');
9523 claims = jsonEval(base64Decode(parts[1]) || '');
9524 signature = parts[2];
9525 data = claims['d'] || {};
9526 delete claims['d'];
9527 }
9528 catch (e) { }
9529 return {
9530 header: header,
9531 claims: claims,
9532 data: data,
9533 signature: signature
9534 };
9535};
9536/**
9537 * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the
9538 * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims.
9539 *
9540 * Notes:
9541 * - May return a false negative if there's no native base64 decoding support.
9542 * - Doesn't check if the token is actually valid.
9543 */
9544var isValidTimestamp = function (token) {
9545 var claims = decode(token).claims;
9546 var now = Math.floor(new Date().getTime() / 1000);
9547 var validSince = 0, validUntil = 0;
9548 if (typeof claims === 'object') {
9549 if (claims.hasOwnProperty('nbf')) {
9550 validSince = claims['nbf'];
9551 }
9552 else if (claims.hasOwnProperty('iat')) {
9553 validSince = claims['iat'];
9554 }
9555 if (claims.hasOwnProperty('exp')) {
9556 validUntil = claims['exp'];
9557 }
9558 else {
9559 // token will expire after 24h by default
9560 validUntil = validSince + 86400;
9561 }
9562 }
9563 return (!!now &&
9564 !!validSince &&
9565 !!validUntil &&
9566 now >= validSince &&
9567 now <= validUntil);
9568};
9569/**
9570 * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise.
9571 *
9572 * Notes:
9573 * - May return null if there's no native base64 decoding support.
9574 * - Doesn't check if the token is actually valid.
9575 */
9576var issuedAtTime = function (token) {
9577 var claims = decode(token).claims;
9578 if (typeof claims === 'object' && claims.hasOwnProperty('iat')) {
9579 return claims['iat'];
9580 }
9581 return null;
9582};
9583/**
9584 * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time.
9585 *
9586 * Notes:
9587 * - May return a false negative if there's no native base64 decoding support.
9588 * - Doesn't check if the token is actually valid.
9589 */
9590var isValidFormat = function (token) {
9591 var decoded = decode(token), claims = decoded.claims;
9592 return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat');
9593};
9594/**
9595 * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion.
9596 *
9597 * Notes:
9598 * - May return a false negative if there's no native base64 decoding support.
9599 * - Doesn't check if the token is actually valid.
9600 */
9601var isAdmin = function (token) {
9602 var claims = decode(token).claims;
9603 return typeof claims === 'object' && claims['admin'] === true;
9604};
9605
9606/**
9607 * @license
9608 * Copyright 2017 Google LLC
9609 *
9610 * Licensed under the Apache License, Version 2.0 (the "License");
9611 * you may not use this file except in compliance with the License.
9612 * You may obtain a copy of the License at
9613 *
9614 * http://www.apache.org/licenses/LICENSE-2.0
9615 *
9616 * Unless required by applicable law or agreed to in writing, software
9617 * distributed under the License is distributed on an "AS IS" BASIS,
9618 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9619 * See the License for the specific language governing permissions and
9620 * limitations under the License.
9621 */
9622function contains(obj, key) {
9623 return Object.prototype.hasOwnProperty.call(obj, key);
9624}
9625function safeGet(obj, key) {
9626 if (Object.prototype.hasOwnProperty.call(obj, key)) {
9627 return obj[key];
9628 }
9629 else {
9630 return undefined;
9631 }
9632}
9633function isEmpty(obj) {
9634 for (var key in obj) {
9635 if (Object.prototype.hasOwnProperty.call(obj, key)) {
9636 return false;
9637 }
9638 }
9639 return true;
9640}
9641function map(obj, fn, contextObj) {
9642 var res = {};
9643 for (var key in obj) {
9644 if (Object.prototype.hasOwnProperty.call(obj, key)) {
9645 res[key] = fn.call(contextObj, obj[key], key, obj);
9646 }
9647 }
9648 return res;
9649}
9650
9651/**
9652 * @license
9653 * Copyright 2017 Google LLC
9654 *
9655 * Licensed under the Apache License, Version 2.0 (the "License");
9656 * you may not use this file except in compliance with the License.
9657 * You may obtain a copy of the License at
9658 *
9659 * http://www.apache.org/licenses/LICENSE-2.0
9660 *
9661 * Unless required by applicable law or agreed to in writing, software
9662 * distributed under the License is distributed on an "AS IS" BASIS,
9663 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9664 * See the License for the specific language governing permissions and
9665 * limitations under the License.
9666 */
9667/**
9668 * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a
9669 * params object (e.g. {arg: 'val', arg2: 'val2'})
9670 * Note: You must prepend it with ? when adding it to a URL.
9671 */
9672function querystring(querystringParams) {
9673 var params = [];
9674 var _loop_1 = function (key, value) {
9675 if (Array.isArray(value)) {
9676 value.forEach(function (arrayVal) {
9677 params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal));
9678 });
9679 }
9680 else {
9681 params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
9682 }
9683 };
9684 for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) {
9685 var _b = _a[_i], key = _b[0], value = _b[1];
9686 _loop_1(key, value);
9687 }
9688 return params.length ? '&' + params.join('&') : '';
9689}
9690/**
9691 * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object
9692 * (e.g. {arg: 'val', arg2: 'val2'})
9693 */
9694function querystringDecode(querystring) {
9695 var obj = {};
9696 var tokens = querystring.replace(/^\?/, '').split('&');
9697 tokens.forEach(function (token) {
9698 if (token) {
9699 var key = token.split('=');
9700 obj[key[0]] = key[1];
9701 }
9702 });
9703 return obj;
9704}
9705
9706/**
9707 * @license
9708 * Copyright 2017 Google LLC
9709 *
9710 * Licensed under the Apache License, Version 2.0 (the "License");
9711 * you may not use this file except in compliance with the License.
9712 * You may obtain a copy of the License at
9713 *
9714 * http://www.apache.org/licenses/LICENSE-2.0
9715 *
9716 * Unless required by applicable law or agreed to in writing, software
9717 * distributed under the License is distributed on an "AS IS" BASIS,
9718 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9719 * See the License for the specific language governing permissions and
9720 * limitations under the License.
9721 */
9722/**
9723 * @fileoverview SHA-1 cryptographic hash.
9724 * Variable names follow the notation in FIPS PUB 180-3:
9725 * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf.
9726 *
9727 * Usage:
9728 * var sha1 = new sha1();
9729 * sha1.update(bytes);
9730 * var hash = sha1.digest();
9731 *
9732 * Performance:
9733 * Chrome 23: ~400 Mbit/s
9734 * Firefox 16: ~250 Mbit/s
9735 *
9736 */
9737/**
9738 * SHA-1 cryptographic hash constructor.
9739 *
9740 * The properties declared here are discussed in the above algorithm document.
9741 * @constructor
9742 * @final
9743 * @struct
9744 */
9745var Sha1 = /** @class */ (function () {
9746 function Sha1() {
9747 /**
9748 * Holds the previous values of accumulated variables a-e in the compress_
9749 * function.
9750 * @private
9751 */
9752 this.chain_ = [];
9753 /**
9754 * A buffer holding the partially computed hash result.
9755 * @private
9756 */
9757 this.buf_ = [];
9758 /**
9759 * An array of 80 bytes, each a part of the message to be hashed. Referred to
9760 * as the message schedule in the docs.
9761 * @private
9762 */
9763 this.W_ = [];
9764 /**
9765 * Contains data needed to pad messages less than 64 bytes.
9766 * @private
9767 */
9768 this.pad_ = [];
9769 /**
9770 * @private {number}
9771 */
9772 this.inbuf_ = 0;
9773 /**
9774 * @private {number}
9775 */
9776 this.total_ = 0;
9777 this.blockSize = 512 / 8;
9778 this.pad_[0] = 128;
9779 for (var i = 1; i < this.blockSize; ++i) {
9780 this.pad_[i] = 0;
9781 }
9782 this.reset();
9783 }
9784 Sha1.prototype.reset = function () {
9785 this.chain_[0] = 0x67452301;
9786 this.chain_[1] = 0xefcdab89;
9787 this.chain_[2] = 0x98badcfe;
9788 this.chain_[3] = 0x10325476;
9789 this.chain_[4] = 0xc3d2e1f0;
9790 this.inbuf_ = 0;
9791 this.total_ = 0;
9792 };
9793 /**
9794 * Internal compress helper function.
9795 * @param buf Block to compress.
9796 * @param offset Offset of the block in the buffer.
9797 * @private
9798 */
9799 Sha1.prototype.compress_ = function (buf, offset) {
9800 if (!offset) {
9801 offset = 0;
9802 }
9803 var W = this.W_;
9804 // get 16 big endian words
9805 if (typeof buf === 'string') {
9806 for (var i = 0; i < 16; i++) {
9807 // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS
9808 // have a bug that turns the post-increment ++ operator into pre-increment
9809 // during JIT compilation. We have code that depends heavily on SHA-1 for
9810 // correctness and which is affected by this bug, so I've removed all uses
9811 // of post-increment ++ in which the result value is used. We can revert
9812 // this change once the Safari bug
9813 // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and
9814 // most clients have been updated.
9815 W[i] =
9816 (buf.charCodeAt(offset) << 24) |
9817 (buf.charCodeAt(offset + 1) << 16) |
9818 (buf.charCodeAt(offset + 2) << 8) |
9819 buf.charCodeAt(offset + 3);
9820 offset += 4;
9821 }
9822 }
9823 else {
9824 for (var i = 0; i < 16; i++) {
9825 W[i] =
9826 (buf[offset] << 24) |
9827 (buf[offset + 1] << 16) |
9828 (buf[offset + 2] << 8) |
9829 buf[offset + 3];
9830 offset += 4;
9831 }
9832 }
9833 // expand to 80 words
9834 for (var i = 16; i < 80; i++) {
9835 var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
9836 W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff;
9837 }
9838 var a = this.chain_[0];
9839 var b = this.chain_[1];
9840 var c = this.chain_[2];
9841 var d = this.chain_[3];
9842 var e = this.chain_[4];
9843 var f, k;
9844 // TODO(user): Try to unroll this loop to speed up the computation.
9845 for (var i = 0; i < 80; i++) {
9846 if (i < 40) {
9847 if (i < 20) {
9848 f = d ^ (b & (c ^ d));
9849 k = 0x5a827999;
9850 }
9851 else {
9852 f = b ^ c ^ d;
9853 k = 0x6ed9eba1;
9854 }
9855 }
9856 else {
9857 if (i < 60) {
9858 f = (b & c) | (d & (b | c));
9859 k = 0x8f1bbcdc;
9860 }
9861 else {
9862 f = b ^ c ^ d;
9863 k = 0xca62c1d6;
9864 }
9865 }
9866 var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff;
9867 e = d;
9868 d = c;
9869 c = ((b << 30) | (b >>> 2)) & 0xffffffff;
9870 b = a;
9871 a = t;
9872 }
9873 this.chain_[0] = (this.chain_[0] + a) & 0xffffffff;
9874 this.chain_[1] = (this.chain_[1] + b) & 0xffffffff;
9875 this.chain_[2] = (this.chain_[2] + c) & 0xffffffff;
9876 this.chain_[3] = (this.chain_[3] + d) & 0xffffffff;
9877 this.chain_[4] = (this.chain_[4] + e) & 0xffffffff;
9878 };
9879 Sha1.prototype.update = function (bytes, length) {
9880 // TODO(johnlenz): tighten the function signature and remove this check
9881 if (bytes == null) {
9882 return;
9883 }
9884 if (length === undefined) {
9885 length = bytes.length;
9886 }
9887 var lengthMinusBlock = length - this.blockSize;
9888 var n = 0;
9889 // Using local instead of member variables gives ~5% speedup on Firefox 16.
9890 var buf = this.buf_;
9891 var inbuf = this.inbuf_;
9892 // The outer while loop should execute at most twice.
9893 while (n < length) {
9894 // When we have no data in the block to top up, we can directly process the
9895 // input buffer (assuming it contains sufficient data). This gives ~25%
9896 // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that
9897 // the data is provided in large chunks (or in multiples of 64 bytes).
9898 if (inbuf === 0) {
9899 while (n <= lengthMinusBlock) {
9900 this.compress_(bytes, n);
9901 n += this.blockSize;
9902 }
9903 }
9904 if (typeof bytes === 'string') {
9905 while (n < length) {
9906 buf[inbuf] = bytes.charCodeAt(n);
9907 ++inbuf;
9908 ++n;
9909 if (inbuf === this.blockSize) {
9910 this.compress_(buf);
9911 inbuf = 0;
9912 // Jump to the outer loop so we use the full-block optimization.
9913 break;
9914 }
9915 }
9916 }
9917 else {
9918 while (n < length) {
9919 buf[inbuf] = bytes[n];
9920 ++inbuf;
9921 ++n;
9922 if (inbuf === this.blockSize) {
9923 this.compress_(buf);
9924 inbuf = 0;
9925 // Jump to the outer loop so we use the full-block optimization.
9926 break;
9927 }
9928 }
9929 }
9930 }
9931 this.inbuf_ = inbuf;
9932 this.total_ += length;
9933 };
9934 /** @override */
9935 Sha1.prototype.digest = function () {
9936 var digest = [];
9937 var totalBits = this.total_ * 8;
9938 // Add pad 0x80 0x00*.
9939 if (this.inbuf_ < 56) {
9940 this.update(this.pad_, 56 - this.inbuf_);
9941 }
9942 else {
9943 this.update(this.pad_, this.blockSize - (this.inbuf_ - 56));
9944 }
9945 // Add # bits.
9946 for (var i = this.blockSize - 1; i >= 56; i--) {
9947 this.buf_[i] = totalBits & 255;
9948 totalBits /= 256; // Don't use bit-shifting here!
9949 }
9950 this.compress_(this.buf_);
9951 var n = 0;
9952 for (var i = 0; i < 5; i++) {
9953 for (var j = 24; j >= 0; j -= 8) {
9954 digest[n] = (this.chain_[i] >> j) & 255;
9955 ++n;
9956 }
9957 }
9958 return digest;
9959 };
9960 return Sha1;
9961}());
9962
9963/**
9964 * Helper to make a Subscribe function (just like Promise helps make a
9965 * Thenable).
9966 *
9967 * @param executor Function which can make calls to a single Observer
9968 * as a proxy.
9969 * @param onNoObservers Callback when count of Observers goes to zero.
9970 */
9971function createSubscribe(executor, onNoObservers) {
9972 var proxy = new ObserverProxy(executor, onNoObservers);
9973 return proxy.subscribe.bind(proxy);
9974}
9975/**
9976 * Implement fan-out for any number of Observers attached via a subscribe
9977 * function.
9978 */
9979var ObserverProxy = /** @class */ (function () {
9980 /**
9981 * @param executor Function which can make calls to a single Observer
9982 * as a proxy.
9983 * @param onNoObservers Callback when count of Observers goes to zero.
9984 */
9985 function ObserverProxy(executor, onNoObservers) {
9986 var _this = this;
9987 this.observers = [];
9988 this.unsubscribes = [];
9989 this.observerCount = 0;
9990 // Micro-task scheduling by calling task.then().
9991 this.task = Promise.resolve();
9992 this.finalized = false;
9993 this.onNoObservers = onNoObservers;
9994 // Call the executor asynchronously so subscribers that are called
9995 // synchronously after the creation of the subscribe function
9996 // can still receive the very first value generated in the executor.
9997 this.task
9998 .then(function () {
9999 executor(_this);
10000 })
10001 .catch(function (e) {
10002 _this.error(e);
10003 });
10004 }
10005 ObserverProxy.prototype.next = function (value) {
10006 this.forEachObserver(function (observer) {
10007 observer.next(value);
10008 });
10009 };
10010 ObserverProxy.prototype.error = function (error) {
10011 this.forEachObserver(function (observer) {
10012 observer.error(error);
10013 });
10014 this.close(error);
10015 };
10016 ObserverProxy.prototype.complete = function () {
10017 this.forEachObserver(function (observer) {
10018 observer.complete();
10019 });
10020 this.close();
10021 };
10022 /**
10023 * Subscribe function that can be used to add an Observer to the fan-out list.
10024 *
10025 * - We require that no event is sent to a subscriber sychronously to their
10026 * call to subscribe().
10027 */
10028 ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) {
10029 var _this = this;
10030 var observer;
10031 if (nextOrObserver === undefined &&
10032 error === undefined &&
10033 complete === undefined) {
10034 throw new Error('Missing Observer.');
10035 }
10036 // Assemble an Observer object when passed as callback functions.
10037 if (implementsAnyMethods(nextOrObserver, [
10038 'next',
10039 'error',
10040 'complete'
10041 ])) {
10042 observer = nextOrObserver;
10043 }
10044 else {
10045 observer = {
10046 next: nextOrObserver,
10047 error: error,
10048 complete: complete
10049 };
10050 }
10051 if (observer.next === undefined) {
10052 observer.next = noop;
10053 }
10054 if (observer.error === undefined) {
10055 observer.error = noop;
10056 }
10057 if (observer.complete === undefined) {
10058 observer.complete = noop;
10059 }
10060 var unsub = this.unsubscribeOne.bind(this, this.observers.length);
10061 // Attempt to subscribe to a terminated Observable - we
10062 // just respond to the Observer with the final error or complete
10063 // event.
10064 if (this.finalized) {
10065 // eslint-disable-next-line @typescript-eslint/no-floating-promises
10066 this.task.then(function () {
10067 try {
10068 if (_this.finalError) {
10069 observer.error(_this.finalError);
10070 }
10071 else {
10072 observer.complete();
10073 }
10074 }
10075 catch (e) {
10076 // nothing
10077 }
10078 return;
10079 });
10080 }
10081 this.observers.push(observer);
10082 return unsub;
10083 };
10084 // Unsubscribe is synchronous - we guarantee that no events are sent to
10085 // any unsubscribed Observer.
10086 ObserverProxy.prototype.unsubscribeOne = function (i) {
10087 if (this.observers === undefined || this.observers[i] === undefined) {
10088 return;
10089 }
10090 delete this.observers[i];
10091 this.observerCount -= 1;
10092 if (this.observerCount === 0 && this.onNoObservers !== undefined) {
10093 this.onNoObservers(this);
10094 }
10095 };
10096 ObserverProxy.prototype.forEachObserver = function (fn) {
10097 if (this.finalized) {
10098 // Already closed by previous event....just eat the additional values.
10099 return;
10100 }
10101 // Since sendOne calls asynchronously - there is no chance that
10102 // this.observers will become undefined.
10103 for (var i = 0; i < this.observers.length; i++) {
10104 this.sendOne(i, fn);
10105 }
10106 };
10107 // Call the Observer via one of it's callback function. We are careful to
10108 // confirm that the observe has not been unsubscribed since this asynchronous
10109 // function had been queued.
10110 ObserverProxy.prototype.sendOne = function (i, fn) {
10111 var _this = this;
10112 // Execute the callback asynchronously
10113 // eslint-disable-next-line @typescript-eslint/no-floating-promises
10114 this.task.then(function () {
10115 if (_this.observers !== undefined && _this.observers[i] !== undefined) {
10116 try {
10117 fn(_this.observers[i]);
10118 }
10119 catch (e) {
10120 // Ignore exceptions raised in Observers or missing methods of an
10121 // Observer.
10122 // Log error to console. b/31404806
10123 if (typeof console !== 'undefined' && console.error) {
10124 console.error(e);
10125 }
10126 }
10127 }
10128 });
10129 };
10130 ObserverProxy.prototype.close = function (err) {
10131 var _this = this;
10132 if (this.finalized) {
10133 return;
10134 }
10135 this.finalized = true;
10136 if (err !== undefined) {
10137 this.finalError = err;
10138 }
10139 // Proxy is no longer needed - garbage collect references
10140 // eslint-disable-next-line @typescript-eslint/no-floating-promises
10141 this.task.then(function () {
10142 _this.observers = undefined;
10143 _this.onNoObservers = undefined;
10144 });
10145 };
10146 return ObserverProxy;
10147}());
10148/** Turn synchronous function into one called asynchronously. */
10149// eslint-disable-next-line @typescript-eslint/ban-types
10150function async(fn, onError) {
10151 return function () {
10152 var args = [];
10153 for (var _i = 0; _i < arguments.length; _i++) {
10154 args[_i] = arguments[_i];
10155 }
10156 Promise.resolve(true)
10157 .then(function () {
10158 fn.apply(void 0, args);
10159 })
10160 .catch(function (error) {
10161 if (onError) {
10162 onError(error);
10163 }
10164 });
10165 };
10166}
10167/**
10168 * Return true if the object passed in implements any of the named methods.
10169 */
10170function implementsAnyMethods(obj, methods) {
10171 if (typeof obj !== 'object' || obj === null) {
10172 return false;
10173 }
10174 for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) {
10175 var method = methods_1[_i];
10176 if (method in obj && typeof obj[method] === 'function') {
10177 return true;
10178 }
10179 }
10180 return false;
10181}
10182function noop() {
10183 // do nothing
10184}
10185
10186/**
10187 * @license
10188 * Copyright 2017 Google LLC
10189 *
10190 * Licensed under the Apache License, Version 2.0 (the "License");
10191 * you may not use this file except in compliance with the License.
10192 * You may obtain a copy of the License at
10193 *
10194 * http://www.apache.org/licenses/LICENSE-2.0
10195 *
10196 * Unless required by applicable law or agreed to in writing, software
10197 * distributed under the License is distributed on an "AS IS" BASIS,
10198 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10199 * See the License for the specific language governing permissions and
10200 * limitations under the License.
10201 */
10202/**
10203 * Check to make sure the appropriate number of arguments are provided for a public function.
10204 * Throws an error if it fails.
10205 *
10206 * @param fnName The function name
10207 * @param minCount The minimum number of arguments to allow for the function call
10208 * @param maxCount The maximum number of argument to allow for the function call
10209 * @param argCount The actual number of arguments provided.
10210 */
10211var validateArgCount = function (fnName, minCount, maxCount, argCount) {
10212 var argError;
10213 if (argCount < minCount) {
10214 argError = 'at least ' + minCount;
10215 }
10216 else if (argCount > maxCount) {
10217 argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount;
10218 }
10219 if (argError) {
10220 var error = fnName +
10221 ' failed: Was called with ' +
10222 argCount +
10223 (argCount === 1 ? ' argument.' : ' arguments.') +
10224 ' Expects ' +
10225 argError +
10226 '.';
10227 throw new Error(error);
10228 }
10229};
10230/**
10231 * Generates a string to prefix an error message about failed argument validation
10232 *
10233 * @param fnName The function name
10234 * @param argumentNumber The index of the argument
10235 * @param optional Whether or not the argument is optional
10236 * @return The prefix to add to the error thrown for validation.
10237 */
10238function errorPrefix(fnName, argumentNumber, optional) {
10239 var argName = '';
10240 switch (argumentNumber) {
10241 case 1:
10242 argName = optional ? 'first' : 'First';
10243 break;
10244 case 2:
10245 argName = optional ? 'second' : 'Second';
10246 break;
10247 case 3:
10248 argName = optional ? 'third' : 'Third';
10249 break;
10250 case 4:
10251 argName = optional ? 'fourth' : 'Fourth';
10252 break;
10253 default:
10254 throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?');
10255 }
10256 var error = fnName + ' failed: ';
10257 error += argName + ' argument ';
10258 return error;
10259}
10260/**
10261 * @param fnName
10262 * @param argumentNumber
10263 * @param namespace
10264 * @param optional
10265 */
10266function validateNamespace(fnName, argumentNumber, namespace, optional) {
10267 if (optional && !namespace) {
10268 return;
10269 }
10270 if (typeof namespace !== 'string') {
10271 //TODO: I should do more validation here. We only allow certain chars in namespaces.
10272 throw new Error(errorPrefix(fnName, argumentNumber, optional) +
10273 'must be a valid firebase namespace.');
10274 }
10275}
10276function validateCallback(fnName, argumentNumber,
10277// eslint-disable-next-line @typescript-eslint/ban-types
10278callback, optional) {
10279 if (optional && !callback) {
10280 return;
10281 }
10282 if (typeof callback !== 'function') {
10283 throw new Error(errorPrefix(fnName, argumentNumber, optional) +
10284 'must be a valid function.');
10285 }
10286}
10287function validateContextObject(fnName, argumentNumber, context, optional) {
10288 if (optional && !context) {
10289 return;
10290 }
10291 if (typeof context !== 'object' || context === null) {
10292 throw new Error(errorPrefix(fnName, argumentNumber, optional) +
10293 'must be a valid context object.');
10294 }
10295}
10296
10297/**
10298 * @license
10299 * Copyright 2017 Google LLC
10300 *
10301 * Licensed under the Apache License, Version 2.0 (the "License");
10302 * you may not use this file except in compliance with the License.
10303 * You may obtain a copy of the License at
10304 *
10305 * http://www.apache.org/licenses/LICENSE-2.0
10306 *
10307 * Unless required by applicable law or agreed to in writing, software
10308 * distributed under the License is distributed on an "AS IS" BASIS,
10309 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10310 * See the License for the specific language governing permissions and
10311 * limitations under the License.
10312 */
10313// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they
10314// automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs,
10315// so it's been modified.
10316// Note that not all Unicode characters appear as single characters in JavaScript strings.
10317// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters
10318// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first
10319// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate
10320// pair).
10321// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3
10322/**
10323 * @param {string} str
10324 * @return {Array}
10325 */
10326var stringToByteArray$1 = function (str) {
10327 var out = [];
10328 var p = 0;
10329 for (var i = 0; i < str.length; i++) {
10330 var c = str.charCodeAt(i);
10331 // Is this the lead surrogate in a surrogate pair?
10332 if (c >= 0xd800 && c <= 0xdbff) {
10333 var high = c - 0xd800; // the high 10 bits.
10334 i++;
10335 assert(i < str.length, 'Surrogate pair missing trail surrogate.');
10336 var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits.
10337 c = 0x10000 + (high << 10) + low;
10338 }
10339 if (c < 128) {
10340 out[p++] = c;
10341 }
10342 else if (c < 2048) {
10343 out[p++] = (c >> 6) | 192;
10344 out[p++] = (c & 63) | 128;
10345 }
10346 else if (c < 65536) {
10347 out[p++] = (c >> 12) | 224;
10348 out[p++] = ((c >> 6) & 63) | 128;
10349 out[p++] = (c & 63) | 128;
10350 }
10351 else {
10352 out[p++] = (c >> 18) | 240;
10353 out[p++] = ((c >> 12) & 63) | 128;
10354 out[p++] = ((c >> 6) & 63) | 128;
10355 out[p++] = (c & 63) | 128;
10356 }
10357 }
10358 return out;
10359};
10360/**
10361 * Calculate length without actually converting; useful for doing cheaper validation.
10362 * @param {string} str
10363 * @return {number}
10364 */
10365var stringLength = function (str) {
10366 var p = 0;
10367 for (var i = 0; i < str.length; i++) {
10368 var c = str.charCodeAt(i);
10369 if (c < 128) {
10370 p++;
10371 }
10372 else if (c < 2048) {
10373 p += 2;
10374 }
10375 else if (c >= 0xd800 && c <= 0xdbff) {
10376 // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent.
10377 p += 4;
10378 i++; // skip trail surrogate.
10379 }
10380 else {
10381 p += 3;
10382 }
10383 }
10384 return p;
10385};
10386
10387/**
10388 * @license
10389 * Copyright 2019 Google LLC
10390 *
10391 * Licensed under the Apache License, Version 2.0 (the "License");
10392 * you may not use this file except in compliance with the License.
10393 * You may obtain a copy of the License at
10394 *
10395 * http://www.apache.org/licenses/LICENSE-2.0
10396 *
10397 * Unless required by applicable law or agreed to in writing, software
10398 * distributed under the License is distributed on an "AS IS" BASIS,
10399 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10400 * See the License for the specific language governing permissions and
10401 * limitations under the License.
10402 */
10403/**
10404 * The amount of milliseconds to exponentially increase.
10405 */
10406var DEFAULT_INTERVAL_MILLIS = 1000;
10407/**
10408 * The factor to backoff by.
10409 * Should be a number greater than 1.
10410 */
10411var DEFAULT_BACKOFF_FACTOR = 2;
10412/**
10413 * The maximum milliseconds to increase to.
10414 *
10415 * <p>Visible for testing
10416 */
10417var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android.
10418/**
10419 * The percentage of backoff time to randomize by.
10420 * See
10421 * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic
10422 * for context.
10423 *
10424 * <p>Visible for testing
10425 */
10426var RANDOM_FACTOR = 0.5;
10427/**
10428 * Based on the backoff method from
10429 * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js.
10430 * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around.
10431 */
10432function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) {
10433 if (intervalMillis === void 0) { intervalMillis = DEFAULT_INTERVAL_MILLIS; }
10434 if (backoffFactor === void 0) { backoffFactor = DEFAULT_BACKOFF_FACTOR; }
10435 // Calculates an exponentially increasing value.
10436 // Deviation: calculates value from count and a constant interval, so we only need to save value
10437 // and count to restore state.
10438 var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount);
10439 // A random "fuzz" to avoid waves of retries.
10440 // Deviation: randomFactor is required.
10441 var randomWait = Math.round(
10442 // A fraction of the backoff value to add/subtract.
10443 // Deviation: changes multiplication order to improve readability.
10444 RANDOM_FACTOR *
10445 currBaseValue *
10446 // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines
10447 // if we add or subtract.
10448 (Math.random() - 0.5) *
10449 2);
10450 // Limits backoff to max to avoid effectively permanent backoff.
10451 return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait);
10452}
10453
10454/**
10455 * @license
10456 * Copyright 2020 Google LLC
10457 *
10458 * Licensed under the Apache License, Version 2.0 (the "License");
10459 * you may not use this file except in compliance with the License.
10460 * You may obtain a copy of the License at
10461 *
10462 * http://www.apache.org/licenses/LICENSE-2.0
10463 *
10464 * Unless required by applicable law or agreed to in writing, software
10465 * distributed under the License is distributed on an "AS IS" BASIS,
10466 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10467 * See the License for the specific language governing permissions and
10468 * limitations under the License.
10469 */
10470/**
10471 * Provide English ordinal letters after a number
10472 */
10473function ordinal(i) {
10474 if (!Number.isFinite(i)) {
10475 return "" + i;
10476 }
10477 return i + indicator(i);
10478}
10479function indicator(i) {
10480 i = Math.abs(i);
10481 var cent = i % 100;
10482 if (cent >= 10 && cent <= 20) {
10483 return 'th';
10484 }
10485 var dec = i % 10;
10486 if (dec === 1) {
10487 return 'st';
10488 }
10489 if (dec === 2) {
10490 return 'nd';
10491 }
10492 if (dec === 3) {
10493 return 'rd';
10494 }
10495 return 'th';
10496}
10497
10498
10499//# sourceMappingURL=index.esm.js.map
10500
10501/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("yLpj")))
10502
10503/***/ }),
10504
10505/***/ "ruEg":
10506/***/ (function(module, __webpack_exports__, __webpack_require__) {
10507
10508"use strict";
10509/* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getAndSetUserProfile; });
10510/* unused harmony export getReferFriendQualify */
10511/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getUserCartCalculations; });
10512/* unused harmony export addDomainToClaim */
10513/* unused harmony export setDomainsToClaim */
10514/* unused harmony export requestForSecondaryAddress */
10515/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getUserDomains; });
10516/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getUserSubscriptions; });
10517/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getUserUnverifiedDomains; });
10518/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getUserCredits; });
10519/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getUserOrders; });
10520/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return getUserWebsites; });
10521/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return sendNewConfirmCode; });
10522/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getConfirmStatus; });
10523/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return submitConfirmCode; });
10524/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return setUserLang; });
10525/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scheduleWithdrawalForDomain; });
10526/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return generateTwitterVerificationCode; });
10527/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ODXe");
10528/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("rePB");
10529/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("o0o1");
10530/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__);
10531/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("HaE+");
10532/* harmony import */ var analytics_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("LpT6");
10533/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("Ue81");
10534/* harmony import */ var utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("JGAB");
10535/* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("YSVl");
10536/* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(seedrandom__WEBPACK_IMPORTED_MODULE_7__);
10537/* harmony import */ var _ctrl_ts_base32__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("1uHz");
10538/* harmony import */ var react_cookies__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("Po8q");
10539/* harmony import */ var react_cookies__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react_cookies__WEBPACK_IMPORTED_MODULE_9__);
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550var getAndSetUserProfile = function getAndSetUserProfile() {
10551 return /*#__PURE__*/function () {
10552 var _ref = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee(dispatch) {
10553 var profile;
10554 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee$(_context) {
10555 while (1) {
10556 switch (_context.prev = _context.next) {
10557 case 0:
10558 dispatch({
10559 type: _types__WEBPACK_IMPORTED_MODULE_5__[/* PROFILE_SET_LOADING */ "J"]
10560 });
10561 _context.next = 3;
10562 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/profile", {
10563 auth: true,
10564 returnType: 'json'
10565 });
10566
10567 case 3:
10568 profile = _context.sent;
10569 dispatch({
10570 type: _types__WEBPACK_IMPORTED_MODULE_5__[/* PROFILE_SET_DATA */ "H"],
10571 payload: profile
10572 });
10573
10574 if (!(profile.watchlist && profile.watchlist.length > 0)) {
10575 _context.next = 8;
10576 break;
10577 }
10578
10579 _context.next = 8;
10580 return dispatch({
10581 type: _types__WEBPACK_IMPORTED_MODULE_5__[/* WATCHLIST_SET_ITEMS */ "N"],
10582 payload: profile.watchlist
10583 });
10584
10585 case 8:
10586 return _context.abrupt("return");
10587
10588 case 9:
10589 case "end":
10590 return _context.stop();
10591 }
10592 }
10593 }, _callee);
10594 }));
10595
10596 return function (_x) {
10597 return _ref.apply(this, arguments);
10598 };
10599 }();
10600};
10601var getReferFriendQualify = function getReferFriendQualify() {
10602 return /*#__PURE__*/function () {
10603 var _ref2 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee2(dispatch) {
10604 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee2$(_context2) {
10605 while (1) {
10606 switch (_context2.prev = _context2.next) {
10607 case 0:
10608 return _context2.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/refer-a-friend/does-qualify", {
10609 auth: true,
10610 returnType: 'json'
10611 }));
10612
10613 case 1:
10614 case "end":
10615 return _context2.stop();
10616 }
10617 }
10618 }, _callee2);
10619 }));
10620
10621 return function (_x2) {
10622 return _ref2.apply(this, arguments);
10623 };
10624 }();
10625};
10626var getUserCartCalculations = function getUserCartCalculations(paymentType, guest) {
10627 return /*#__PURE__*/function () {
10628 var _ref3 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee3(dispatch, getState) {
10629 var _paymentTypeMap;
10630
10631 var paymentTypeMap, paymentMethod, path;
10632 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee3$(_context3) {
10633 while (1) {
10634 switch (_context3.prev = _context3.next) {
10635 case 0:
10636 paymentTypeMap = (_paymentTypeMap = {}, Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_paymentTypeMap, 'CryptoDotCom', 'crypto-dot-com'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_paymentTypeMap, 'Crypto', 'coinbase'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_paymentTypeMap, 'CreditCard', 'stripe'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_paymentTypeMap, 'StoreCredit', 'store-credits'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_paymentTypeMap, 'PayPal', 'paypal'), _paymentTypeMap);
10637 paymentMethod = paymentType ? paymentTypeMap[paymentType] || paymentType : '';
10638 path = "/user/cart/calculations?paymentMethod=".concat(paymentMethod);
10639
10640 if (guest || !getState().auth.signedIn) {
10641 path = "".concat(path, "&guestUuid=").concat(Object(analytics_common__WEBPACK_IMPORTED_MODULE_4__[/* getAnonymousId */ "b"])());
10642 }
10643
10644 return _context3.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(path, {
10645 auth: true,
10646 returnType: 'json'
10647 }));
10648
10649 case 5:
10650 case "end":
10651 return _context3.stop();
10652 }
10653 }
10654 }, _callee3);
10655 }));
10656
10657 return function (_x3, _x4) {
10658 return _ref3.apply(this, arguments);
10659 };
10660 }();
10661};
10662var addDomainToClaim = function addDomainToClaim(domain) {
10663 return /*#__PURE__*/function () {
10664 var _ref4 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee4(dispatch, getState) {
10665 var _domain$split, _domain$split2, label, extension, state, exist;
10666
10667 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee4$(_context4) {
10668 while (1) {
10669 switch (_context4.prev = _context4.next) {
10670 case 0:
10671 _domain$split = domain.split('.'), _domain$split2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_domain$split, 2), label = _domain$split2[0], extension = _domain$split2[1];
10672 state = getState();
10673 exist = state.claim.domains.map(function (d) {
10674 return d.extension === extension && d.label === label;
10675 }).includes(true);
10676
10677 if (exist) {
10678 _context4.next = 5;
10679 break;
10680 }
10681
10682 return _context4.abrupt("return", dispatch({
10683 type: _types__WEBPACK_IMPORTED_MODULE_5__[/* CLAIM_ADD_DOMAIN */ "v"],
10684 payload: {
10685 label: label,
10686 extension: extension
10687 }
10688 }));
10689
10690 case 5:
10691 return _context4.abrupt("return", null);
10692
10693 case 6:
10694 case "end":
10695 return _context4.stop();
10696 }
10697 }
10698 }, _callee4);
10699 }));
10700
10701 return function (_x5, _x6) {
10702 return _ref4.apply(this, arguments);
10703 };
10704 }();
10705};
10706var setDomainsToClaim = function setDomainsToClaim(domains) {
10707 return /*#__PURE__*/function () {
10708 var _ref5 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee5(dispatch, getState) {
10709 var uniqueList;
10710 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee5$(_context5) {
10711 while (1) {
10712 switch (_context5.prev = _context5.next) {
10713 case 0:
10714 uniqueList = domains.filter(function (v, i, a) {
10715 return a.indexOf(v) === i;
10716 }).map(function (d) {
10717 return {
10718 label: d.split('.')[0],
10719 extension: d.split('.')[1]
10720 };
10721 });
10722 return _context5.abrupt("return", dispatch({
10723 type: _types__WEBPACK_IMPORTED_MODULE_5__[/* CLAIM_SET_DOMAINS */ "w"],
10724 payload: uniqueList
10725 }));
10726
10727 case 2:
10728 case "end":
10729 return _context5.stop();
10730 }
10731 }
10732 }, _callee5);
10733 }));
10734
10735 return function (_x7, _x8) {
10736 return _ref5.apply(this, arguments);
10737 };
10738 }();
10739};
10740var requestForSecondaryAddress = function requestForSecondaryAddress() {
10741 return /*#__PURE__*/function () {
10742 var _ref6 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee6(dispatch, getState) {
10743 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee6$(_context6) {
10744 while (1) {
10745 switch (_context6.prev = _context6.next) {
10746 case 0:
10747 return _context6.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/mobile/0.0.1/new-request", {
10748 auth: true,
10749 method: 'POST',
10750 headers: new Headers({
10751 'Content-Type': 'application/json'
10752 }),
10753 body: JSON.stringify({
10754 requestType: 'RequestToAssignSecondaryKey'
10755 })
10756 }));
10757
10758 case 1:
10759 case "end":
10760 return _context6.stop();
10761 }
10762 }
10763 }, _callee6);
10764 }));
10765
10766 return function (_x9, _x10) {
10767 return _ref6.apply(this, arguments);
10768 };
10769 }();
10770};
10771var getUserDomains = function getUserDomains() {
10772 return /*#__PURE__*/function () {
10773 var _ref7 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee7(dispatch, getState) {
10774 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee7$(_context7) {
10775 while (1) {
10776 switch (_context7.prev = _context7.next) {
10777 case 0:
10778 return _context7.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/domains", {
10779 auth: true,
10780 returnType: 'json'
10781 }));
10782
10783 case 1:
10784 case "end":
10785 return _context7.stop();
10786 }
10787 }
10788 }, _callee7);
10789 }));
10790
10791 return function (_x11, _x12) {
10792 return _ref7.apply(this, arguments);
10793 };
10794 }();
10795};
10796var getUserSubscriptions = function getUserSubscriptions(subType) {
10797 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/subscriptions?subType=".concat(subType), {
10798 auth: true,
10799 returnType: 'json'
10800 });
10801};
10802var getUserUnverifiedDomains = function getUserUnverifiedDomains() {
10803 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/domains/unverified", {
10804 auth: true,
10805 returnType: 'json'
10806 });
10807};
10808var getUserCredits = function getUserCredits() {
10809 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/credits", {
10810 auth: true,
10811 returnType: 'json'
10812 });
10813};
10814var getUserOrders = function getUserOrders(page, rowsPerPage) {
10815 return /*#__PURE__*/function () {
10816 var _ref8 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee8(dispatch, getState) {
10817 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee8$(_context8) {
10818 while (1) {
10819 switch (_context8.prev = _context8.next) {
10820 case 0:
10821 return _context8.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/orders?page=".concat(page, "&perPage=").concat(rowsPerPage), {
10822 auth: true,
10823 returnType: 'json'
10824 }));
10825
10826 case 1:
10827 case "end":
10828 return _context8.stop();
10829 }
10830 }
10831 }, _callee8);
10832 }));
10833
10834 return function (_x13, _x14) {
10835 return _ref8.apply(this, arguments);
10836 };
10837 }();
10838};
10839var getUserWebsites = /*#__PURE__*/function () {
10840 var _ref9 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee9(page, rowsPerPage, extension, sortIndex, searchTerm) {
10841 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee9$(_context9) {
10842 while (1) {
10843 switch (_context9.prev = _context9.next) {
10844 case 0:
10845 return _context9.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/websites?page=".concat(page + 1, "&perPage=").concat(rowsPerPage, "&extensionFilter=").concat(extension || '', "&sort=").concat(sortIndex ? _types__WEBPACK_IMPORTED_MODULE_5__[/* WEBSITE_SORT_KEYS */ "O"][sortIndex] : '', "&searchTerm=").concat(searchTerm || ''), {
10846 auth: true,
10847 returnType: 'json'
10848 }));
10849
10850 case 1:
10851 case "end":
10852 return _context9.stop();
10853 }
10854 }
10855 }, _callee9);
10856 }));
10857
10858 return function getUserWebsites(_x15, _x16, _x17, _x18, _x19) {
10859 return _ref9.apply(this, arguments);
10860 };
10861}();
10862var sendNewConfirmCode = function sendNewConfirmCode(operation) {
10863 return /*#__PURE__*/function () {
10864 var _ref10 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee10(dispatch) {
10865 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee10$(_context10) {
10866 while (1) {
10867 switch (_context10.prev = _context10.next) {
10868 case 0:
10869 return _context10.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/confirm-code/create", {
10870 auth: true,
10871 method: 'POST',
10872 headers: new Headers({
10873 'Content-Type': 'application/json'
10874 }),
10875 body: JSON.stringify({
10876 operation: operation
10877 }),
10878 returnType: 'json'
10879 }));
10880
10881 case 1:
10882 case "end":
10883 return _context10.stop();
10884 }
10885 }
10886 }, _callee10);
10887 }));
10888
10889 return function (_x20) {
10890 return _ref10.apply(this, arguments);
10891 };
10892 }();
10893};
10894var getConfirmStatus = function getConfirmStatus(operation) {
10895 return /*#__PURE__*/function () {
10896 var _ref11 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee11(dispatch) {
10897 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee11$(_context11) {
10898 while (1) {
10899 switch (_context11.prev = _context11.next) {
10900 case 0:
10901 return _context11.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/confirm-code/status?operation=".concat(operation), {
10902 auth: true,
10903 returnType: 'json'
10904 }));
10905
10906 case 1:
10907 case "end":
10908 return _context11.stop();
10909 }
10910 }
10911 }, _callee11);
10912 }));
10913
10914 return function (_x21) {
10915 return _ref11.apply(this, arguments);
10916 };
10917 }();
10918};
10919var submitConfirmCode = function submitConfirmCode(operation, code) {
10920 return /*#__PURE__*/function () {
10921 var _ref12 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee12(dispatch) {
10922 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee12$(_context12) {
10923 while (1) {
10924 switch (_context12.prev = _context12.next) {
10925 case 0:
10926 return _context12.abrupt("return", Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/user/confirm-code/confirm", {
10927 auth: true,
10928 method: 'POST',
10929 headers: new Headers({
10930 'Content-Type': 'application/json'
10931 }),
10932 body: JSON.stringify({
10933 operation: operation,
10934 code: code
10935 }),
10936 returnType: 'json'
10937 }));
10938
10939 case 1:
10940 case "end":
10941 return _context12.stop();
10942 }
10943 }
10944 }, _callee12);
10945 }));
10946
10947 return function (_x22) {
10948 return _ref12.apply(this, arguments);
10949 };
10950 }();
10951};
10952var setUserLang = function setUserLang(langCode) {
10953 return /*#__PURE__*/function () {
10954 var _ref13 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee13(dispatch, getState) {
10955 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee13$(_context13) {
10956 while (1) {
10957 switch (_context13.prev = _context13.next) {
10958 case 0:
10959 void Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])('/user/set-lang', {
10960 auth: true,
10961 method: 'POST',
10962 headers: new Headers({
10963 'Content-Type': 'application/json'
10964 }),
10965 body: JSON.stringify({
10966 guestUuid: getState().auth.signedIn ? null : Object(analytics_common__WEBPACK_IMPORTED_MODULE_4__[/* getAnonymousId */ "b"])(),
10967 langCode: langCode
10968 })
10969 });
10970
10971 case 1:
10972 case "end":
10973 return _context13.stop();
10974 }
10975 }
10976 }, _callee13);
10977 }));
10978
10979 return function (_x23, _x24) {
10980 return _ref13.apply(this, arguments);
10981 };
10982 }();
10983};
10984var scheduleWithdrawalForDomain = function scheduleWithdrawalForDomain(domainName) {
10985 return Object(utils_fetchApi__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])("/gemini-custody/withdraw", {
10986 auth: true,
10987 method: 'POST',
10988 headers: new Headers({
10989 'Content-Type': 'application/json'
10990 }),
10991 body: JSON.stringify({
10992 domainName: domainName
10993 })
10994 });
10995};
10996var generateTwitterVerificationCode = function generateTwitterVerificationCode(domainName, ownerAddress) {
10997 var generateRandomNumber = seedrandom__WEBPACK_IMPORTED_MODULE_7___default()("".concat(domainName).concat(ownerAddress).concat(getUserSeed()), {
10998 global: false
10999 });
11000 var uniqueNumber = generateRandomNumber.int32();
11001 return Object(_ctrl_ts_base32__WEBPACK_IMPORTED_MODULE_8__[/* base32Encode */ "a"])(Buffer.from(String(uniqueNumber)), undefined, {
11002 padding: false
11003 });
11004};
11005
11006var getUserSeed = function getUserSeed() {
11007 var seedCookieName = 'userSeed';
11008 var seed = react_cookies__WEBPACK_IMPORTED_MODULE_9___default.a.load(seedCookieName);
11009
11010 if (!seed) {
11011 var prng = seedrandom__WEBPACK_IMPORTED_MODULE_7___default()(undefined, {
11012 global: false
11013 });
11014 seed = prng["double"]();
11015 var expires = new Date();
11016 expires.setDate(expires.getDate() + 7);
11017 react_cookies__WEBPACK_IMPORTED_MODULE_9___default.a.save(seedCookieName, seed, {
11018 path: '/',
11019 expires: expires
11020 });
11021 }
11022
11023 return seed;
11024};
11025/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("HDXh").Buffer))
11026
11027/***/ }),
11028
11029/***/ "uDiL":
11030/***/ (function(module, exports, __webpack_require__) {
11031
11032/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of the "xor128" prng algorithm by
11033// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper
11034
11035(function(global, module, define) {
11036
11037function XorGen(seed) {
11038 var me = this, strseed = '';
11039
11040 me.x = 0;
11041 me.y = 0;
11042 me.z = 0;
11043 me.w = 0;
11044
11045 // Set up generator function.
11046 me.next = function() {
11047 var t = me.x ^ (me.x << 11);
11048 me.x = me.y;
11049 me.y = me.z;
11050 me.z = me.w;
11051 return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);
11052 };
11053
11054 if (seed === (seed | 0)) {
11055 // Integer seed.
11056 me.x = seed;
11057 } else {
11058 // String seed.
11059 strseed += seed;
11060 }
11061
11062 // Mix in string seed, then discard an initial batch of 64 values.
11063 for (var k = 0; k < strseed.length + 64; k++) {
11064 me.x ^= strseed.charCodeAt(k) | 0;
11065 me.next();
11066 }
11067}
11068
11069function copy(f, t) {
11070 t.x = f.x;
11071 t.y = f.y;
11072 t.z = f.z;
11073 t.w = f.w;
11074 return t;
11075}
11076
11077function impl(seed, opts) {
11078 var xg = new XorGen(seed),
11079 state = opts && opts.state,
11080 prng = function() { return (xg.next() >>> 0) / 0x100000000; };
11081 prng.double = function() {
11082 do {
11083 var top = xg.next() >>> 11,
11084 bot = (xg.next() >>> 0) / 0x100000000,
11085 result = (top + bot) / (1 << 21);
11086 } while (result === 0);
11087 return result;
11088 };
11089 prng.int32 = xg.next;
11090 prng.quick = prng;
11091 if (state) {
11092 if (typeof(state) == 'object') copy(state, xg);
11093 prng.state = function() { return copy(xg, {}); }
11094 }
11095 return prng;
11096}
11097
11098if (module && module.exports) {
11099 module.exports = impl;
11100} else if (__webpack_require__("B9Yq") && __webpack_require__("PDX0")) {
11101 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),
11102 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
11103} else {
11104 this.xor128 = impl;
11105}
11106
11107})(
11108 this,
11109 true && module, // present in node.js
11110 __webpack_require__("B9Yq") // present with an AMD loader
11111);
11112
11113
11114
11115/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("YuTi")(module)))
11116
11117/***/ }),
11118
11119/***/ "yuCN":
11120/***/ (function(module, exports, __webpack_require__) {
11121
11122/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of the "xorshift7" algorithm by
11123// François Panneton and Pierre L'ecuyer:
11124// "On the Xorgshift Random Number Generators"
11125// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf
11126
11127(function(global, module, define) {
11128
11129function XorGen(seed) {
11130 var me = this;
11131
11132 // Set up generator function.
11133 me.next = function() {
11134 // Update xor generator.
11135 var X = me.x, i = me.i, t, v, w;
11136 t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);
11137 t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);
11138 t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);
11139 t = X[(i + 4) & 7]; v ^= t ^ (t << 7);
11140 t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);
11141 X[i] = v;
11142 me.i = (i + 1) & 7;
11143 return v;
11144 };
11145
11146 function init(me, seed) {
11147 var j, w, X = [];
11148
11149 if (seed === (seed | 0)) {
11150 // Seed state array using a 32-bit integer.
11151 w = X[0] = seed;
11152 } else {
11153 // Seed state using a string.
11154 seed = '' + seed;
11155 for (j = 0; j < seed.length; ++j) {
11156 X[j & 7] = (X[j & 7] << 15) ^
11157 (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);
11158 }
11159 }
11160 // Enforce an array length of 8, not all zeroes.
11161 while (X.length < 8) X.push(0);
11162 for (j = 0; j < 8 && X[j] === 0; ++j);
11163 if (j == 8) w = X[7] = -1; else w = X[j];
11164
11165 me.x = X;
11166 me.i = 0;
11167
11168 // Discard an initial 256 values.
11169 for (j = 256; j > 0; --j) {
11170 me.next();
11171 }
11172 }
11173
11174 init(me, seed);
11175}
11176
11177function copy(f, t) {
11178 t.x = f.x.slice();
11179 t.i = f.i;
11180 return t;
11181}
11182
11183function impl(seed, opts) {
11184 if (seed == null) seed = +(new Date);
11185 var xg = new XorGen(seed),
11186 state = opts && opts.state,
11187 prng = function() { return (xg.next() >>> 0) / 0x100000000; };
11188 prng.double = function() {
11189 do {
11190 var top = xg.next() >>> 11,
11191 bot = (xg.next() >>> 0) / 0x100000000,
11192 result = (top + bot) / (1 << 21);
11193 } while (result === 0);
11194 return result;
11195 };
11196 prng.int32 = xg.next;
11197 prng.quick = prng;
11198 if (state) {
11199 if (state.x) copy(state, xg);
11200 prng.state = function() { return copy(xg, {}); }
11201 }
11202 return prng;
11203}
11204
11205if (module && module.exports) {
11206 module.exports = impl;
11207} else if (__webpack_require__("B9Yq") && __webpack_require__("PDX0")) {
11208 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),
11209 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
11210} else {
11211 this.xorshift7 = impl;
11212}
11213
11214})(
11215 this,
11216 true && module, // present in node.js
11217 __webpack_require__("B9Yq") // present with an AMD loader
11218);
11219
11220
11221/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("YuTi")(module)))
11222
11223/***/ }),
11224
11225/***/ "zIRd":
11226/***/ (function(module, __webpack_exports__, __webpack_require__) {
11227
11228"use strict";
11229
11230// UNUSED EXPORTS: firebase
11231
11232// EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.js
11233var tslib_es6 = __webpack_require__("mrSG");
11234
11235// EXTERNAL MODULE: ./node_modules/@firebase/util/dist/index.esm.js
11236var index_esm = __webpack_require__("qOnz");
11237
11238// CONCATENATED MODULE: ./node_modules/@firebase/component/dist/index.esm.js
11239
11240
11241
11242/**
11243 * Component for service name T, e.g. `auth`, `auth-internal`
11244 */
11245var Component = /** @class */ (function () {
11246 /**
11247 *
11248 * @param name The public service name, e.g. app, auth, firestore, database
11249 * @param instanceFactory Service factory responsible for creating the public interface
11250 * @param type whether the service provided by the component is public or private
11251 */
11252 function Component(name, instanceFactory, type) {
11253 this.name = name;
11254 this.instanceFactory = instanceFactory;
11255 this.type = type;
11256 this.multipleInstances = false;
11257 /**
11258 * Properties to be added to the service namespace
11259 */
11260 this.serviceProps = {};
11261 this.instantiationMode = "LAZY" /* LAZY */;
11262 }
11263 Component.prototype.setInstantiationMode = function (mode) {
11264 this.instantiationMode = mode;
11265 return this;
11266 };
11267 Component.prototype.setMultipleInstances = function (multipleInstances) {
11268 this.multipleInstances = multipleInstances;
11269 return this;
11270 };
11271 Component.prototype.setServiceProps = function (props) {
11272 this.serviceProps = props;
11273 return this;
11274 };
11275 return Component;
11276}());
11277
11278/**
11279 * @license
11280 * Copyright 2019 Google LLC
11281 *
11282 * Licensed under the Apache License, Version 2.0 (the "License");
11283 * you may not use this file except in compliance with the License.
11284 * You may obtain a copy of the License at
11285 *
11286 * http://www.apache.org/licenses/LICENSE-2.0
11287 *
11288 * Unless required by applicable law or agreed to in writing, software
11289 * distributed under the License is distributed on an "AS IS" BASIS,
11290 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11291 * See the License for the specific language governing permissions and
11292 * limitations under the License.
11293 */
11294var DEFAULT_ENTRY_NAME = '[DEFAULT]';
11295
11296/**
11297 * @license
11298 * Copyright 2019 Google LLC
11299 *
11300 * Licensed under the Apache License, Version 2.0 (the "License");
11301 * you may not use this file except in compliance with the License.
11302 * You may obtain a copy of the License at
11303 *
11304 * http://www.apache.org/licenses/LICENSE-2.0
11305 *
11306 * Unless required by applicable law or agreed to in writing, software
11307 * distributed under the License is distributed on an "AS IS" BASIS,
11308 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11309 * See the License for the specific language governing permissions and
11310 * limitations under the License.
11311 */
11312/**
11313 * Provider for instance for service name T, e.g. 'auth', 'auth-internal'
11314 * NameServiceMapping[T] is an alias for the type of the instance
11315 */
11316var index_esm_Provider = /** @class */ (function () {
11317 function Provider(name, container) {
11318 this.name = name;
11319 this.container = container;
11320 this.component = null;
11321 this.instances = new Map();
11322 this.instancesDeferred = new Map();
11323 }
11324 /**
11325 * @param identifier A provider can provide mulitple instances of a service
11326 * if this.component.multipleInstances is true.
11327 */
11328 Provider.prototype.get = function (identifier) {
11329 if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; }
11330 // if multipleInstances is not supported, use the default name
11331 var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);
11332 if (!this.instancesDeferred.has(normalizedIdentifier)) {
11333 var deferred = new index_esm["a" /* Deferred */]();
11334 this.instancesDeferred.set(normalizedIdentifier, deferred);
11335 // If the service instance is available, resolve the promise with it immediately
11336 try {
11337 var instance = this.getOrInitializeService(normalizedIdentifier);
11338 if (instance) {
11339 deferred.resolve(instance);
11340 }
11341 }
11342 catch (e) {
11343 // when the instance factory throws an exception during get(), it should not cause
11344 // a fatal error. We just return the unresolved promise in this case.
11345 }
11346 }
11347 return this.instancesDeferred.get(normalizedIdentifier).promise;
11348 };
11349 Provider.prototype.getImmediate = function (options) {
11350 var _a = Object(tslib_es6["__assign"])({ identifier: DEFAULT_ENTRY_NAME, optional: false }, options), identifier = _a.identifier, optional = _a.optional;
11351 // if multipleInstances is not supported, use the default name
11352 var normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);
11353 try {
11354 var instance = this.getOrInitializeService(normalizedIdentifier);
11355 if (!instance) {
11356 if (optional) {
11357 return null;
11358 }
11359 throw Error("Service " + this.name + " is not available");
11360 }
11361 return instance;
11362 }
11363 catch (e) {
11364 if (optional) {
11365 return null;
11366 }
11367 else {
11368 throw e;
11369 }
11370 }
11371 };
11372 Provider.prototype.getComponent = function () {
11373 return this.component;
11374 };
11375 Provider.prototype.setComponent = function (component) {
11376 var e_1, _a;
11377 if (component.name !== this.name) {
11378 throw Error("Mismatching Component " + component.name + " for Provider " + this.name + ".");
11379 }
11380 if (this.component) {
11381 throw Error("Component for " + this.name + " has already been provided");
11382 }
11383 this.component = component;
11384 // if the service is eager, initialize the default instance
11385 if (isComponentEager(component)) {
11386 try {
11387 this.getOrInitializeService(DEFAULT_ENTRY_NAME);
11388 }
11389 catch (e) {
11390 // when the instance factory for an eager Component throws an exception during the eager
11391 // initialization, it should not cause a fatal error.
11392 // TODO: Investigate if we need to make it configurable, because some component may want to cause
11393 // a fatal error in this case?
11394 }
11395 }
11396 try {
11397 // Create service instances for the pending promises and resolve them
11398 // NOTE: if this.multipleInstances is false, only the default instance will be created
11399 // and all promises with resolve with it regardless of the identifier.
11400 for (var _b = Object(tslib_es6["__values"])(this.instancesDeferred.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
11401 var _d = Object(tslib_es6["__read"])(_c.value, 2), instanceIdentifier = _d[0], instanceDeferred = _d[1];
11402 var normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);
11403 try {
11404 // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy.
11405 var instance = this.getOrInitializeService(normalizedIdentifier);
11406 instanceDeferred.resolve(instance);
11407 }
11408 catch (e) {
11409 // when the instance factory throws an exception, it should not cause
11410 // a fatal error. We just leave the promise unresolved.
11411 }
11412 }
11413 }
11414 catch (e_1_1) { e_1 = { error: e_1_1 }; }
11415 finally {
11416 try {
11417 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
11418 }
11419 finally { if (e_1) throw e_1.error; }
11420 }
11421 };
11422 Provider.prototype.clearInstance = function (identifier) {
11423 if (identifier === void 0) { identifier = DEFAULT_ENTRY_NAME; }
11424 this.instancesDeferred.delete(identifier);
11425 this.instances.delete(identifier);
11426 };
11427 // app.delete() will call this method on every provider to delete the services
11428 // TODO: should we mark the provider as deleted?
11429 Provider.prototype.delete = function () {
11430 return Object(tslib_es6["__awaiter"])(this, void 0, void 0, function () {
11431 var services;
11432 return Object(tslib_es6["__generator"])(this, function (_a) {
11433 switch (_a.label) {
11434 case 0:
11435 services = Array.from(this.instances.values());
11436 return [4 /*yield*/, Promise.all(Object(tslib_es6["__spread"])(services
11437 .filter(function (service) { return 'INTERNAL' in service; }) // legacy services
11438 // eslint-disable-next-line @typescript-eslint/no-explicit-any
11439 .map(function (service) { return service.INTERNAL.delete(); }), services
11440 .filter(function (service) { return '_delete' in service; }) // modularized services
11441 // eslint-disable-next-line @typescript-eslint/no-explicit-any
11442 .map(function (service) { return service._delete(); })))];
11443 case 1:
11444 _a.sent();
11445 return [2 /*return*/];
11446 }
11447 });
11448 });
11449 };
11450 Provider.prototype.isComponentSet = function () {
11451 return this.component != null;
11452 };
11453 Provider.prototype.getOrInitializeService = function (identifier) {
11454 var instance = this.instances.get(identifier);
11455 if (!instance && this.component) {
11456 instance = this.component.instanceFactory(this.container, normalizeIdentifierForFactory(identifier));
11457 this.instances.set(identifier, instance);
11458 }
11459 return instance || null;
11460 };
11461 Provider.prototype.normalizeInstanceIdentifier = function (identifier) {
11462 if (this.component) {
11463 return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME;
11464 }
11465 else {
11466 return identifier; // assume multiple instances are supported before the component is provided.
11467 }
11468 };
11469 return Provider;
11470}());
11471// undefined should be passed to the service factory for the default instance
11472function normalizeIdentifierForFactory(identifier) {
11473 return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier;
11474}
11475function isComponentEager(component) {
11476 return component.instantiationMode === "EAGER" /* EAGER */;
11477}
11478
11479/**
11480 * @license
11481 * Copyright 2019 Google LLC
11482 *
11483 * Licensed under the Apache License, Version 2.0 (the "License");
11484 * you may not use this file except in compliance with the License.
11485 * You may obtain a copy of the License at
11486 *
11487 * http://www.apache.org/licenses/LICENSE-2.0
11488 *
11489 * Unless required by applicable law or agreed to in writing, software
11490 * distributed under the License is distributed on an "AS IS" BASIS,
11491 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11492 * See the License for the specific language governing permissions and
11493 * limitations under the License.
11494 */
11495/**
11496 * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal`
11497 */
11498var ComponentContainer = /** @class */ (function () {
11499 function ComponentContainer(name) {
11500 this.name = name;
11501 this.providers = new Map();
11502 }
11503 /**
11504 *
11505 * @param component Component being added
11506 * @param overwrite When a component with the same name has already been registered,
11507 * if overwrite is true: overwrite the existing component with the new component and create a new
11508 * provider with the new component. It can be useful in tests where you want to use different mocks
11509 * for different tests.
11510 * if overwrite is false: throw an exception
11511 */
11512 ComponentContainer.prototype.addComponent = function (component) {
11513 var provider = this.getProvider(component.name);
11514 if (provider.isComponentSet()) {
11515 throw new Error("Component " + component.name + " has already been registered with " + this.name);
11516 }
11517 provider.setComponent(component);
11518 };
11519 ComponentContainer.prototype.addOrOverwriteComponent = function (component) {
11520 var provider = this.getProvider(component.name);
11521 if (provider.isComponentSet()) {
11522 // delete the existing provider from the container, so we can register the new component
11523 this.providers.delete(component.name);
11524 }
11525 this.addComponent(component);
11526 };
11527 /**
11528 * getProvider provides a type safe interface where it can only be called with a field name
11529 * present in NameServiceMapping interface.
11530 *
11531 * Firebase SDKs providing services should extend NameServiceMapping interface to register
11532 * themselves.
11533 */
11534 ComponentContainer.prototype.getProvider = function (name) {
11535 if (this.providers.has(name)) {
11536 return this.providers.get(name);
11537 }
11538 // create a Provider for a service that hasn't registered with Firebase
11539 var provider = new index_esm_Provider(name, this);
11540 this.providers.set(name, provider);
11541 return provider;
11542 };
11543 ComponentContainer.prototype.getProviders = function () {
11544 return Array.from(this.providers.values());
11545 };
11546 return ComponentContainer;
11547}());
11548
11549
11550//# sourceMappingURL=index.esm.js.map
11551
11552// CONCATENATED MODULE: ./node_modules/@firebase/logger/dist/index.esm.js
11553/*! *****************************************************************************
11554Copyright (c) Microsoft Corporation. All rights reserved.
11555Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11556this file except in compliance with the License. You may obtain a copy of the
11557License at http://www.apache.org/licenses/LICENSE-2.0
11558
11559THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11560KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
11561WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11562MERCHANTABLITY OR NON-INFRINGEMENT.
11563
11564See the Apache Version 2.0 License for specific language governing permissions
11565and limitations under the License.
11566***************************************************************************** */
11567
11568function __spreadArrays() {
11569 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
11570 for (var r = Array(s), k = 0, i = 0; i < il; i++)
11571 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
11572 r[k] = a[j];
11573 return r;
11574}
11575
11576/**
11577 * @license
11578 * Copyright 2017 Google LLC
11579 *
11580 * Licensed under the Apache License, Version 2.0 (the "License");
11581 * you may not use this file except in compliance with the License.
11582 * You may obtain a copy of the License at
11583 *
11584 * http://www.apache.org/licenses/LICENSE-2.0
11585 *
11586 * Unless required by applicable law or agreed to in writing, software
11587 * distributed under the License is distributed on an "AS IS" BASIS,
11588 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11589 * See the License for the specific language governing permissions and
11590 * limitations under the License.
11591 */
11592var index_esm_a;
11593/**
11594 * A container for all of the Logger instances
11595 */
11596var instances = [];
11597/**
11598 * The JS SDK supports 5 log levels and also allows a user the ability to
11599 * silence the logs altogether.
11600 *
11601 * The order is a follows:
11602 * DEBUG < VERBOSE < INFO < WARN < ERROR
11603 *
11604 * All of the log types above the current log level will be captured (i.e. if
11605 * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and
11606 * `VERBOSE` logs will not)
11607 */
11608var LogLevel;
11609(function (LogLevel) {
11610 LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
11611 LogLevel[LogLevel["VERBOSE"] = 1] = "VERBOSE";
11612 LogLevel[LogLevel["INFO"] = 2] = "INFO";
11613 LogLevel[LogLevel["WARN"] = 3] = "WARN";
11614 LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
11615 LogLevel[LogLevel["SILENT"] = 5] = "SILENT";
11616})(LogLevel || (LogLevel = {}));
11617var levelStringToEnum = {
11618 'debug': LogLevel.DEBUG,
11619 'verbose': LogLevel.VERBOSE,
11620 'info': LogLevel.INFO,
11621 'warn': LogLevel.WARN,
11622 'error': LogLevel.ERROR,
11623 'silent': LogLevel.SILENT
11624};
11625/**
11626 * The default log level
11627 */
11628var defaultLogLevel = LogLevel.INFO;
11629/**
11630 * By default, `console.debug` is not displayed in the developer console (in
11631 * chrome). To avoid forcing users to have to opt-in to these logs twice
11632 * (i.e. once for firebase, and once in the console), we are sending `DEBUG`
11633 * logs to the `console.log` function.
11634 */
11635var ConsoleMethod = (index_esm_a = {},
11636 index_esm_a[LogLevel.DEBUG] = 'log',
11637 index_esm_a[LogLevel.VERBOSE] = 'log',
11638 index_esm_a[LogLevel.INFO] = 'info',
11639 index_esm_a[LogLevel.WARN] = 'warn',
11640 index_esm_a[LogLevel.ERROR] = 'error',
11641 index_esm_a);
11642/**
11643 * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR
11644 * messages on to their corresponding console counterparts (if the log method
11645 * is supported by the current log level)
11646 */
11647var defaultLogHandler = function (instance, logType) {
11648 var args = [];
11649 for (var _i = 2; _i < arguments.length; _i++) {
11650 args[_i - 2] = arguments[_i];
11651 }
11652 if (logType < instance.logLevel) {
11653 return;
11654 }
11655 var now = new Date().toISOString();
11656 var method = ConsoleMethod[logType];
11657 if (method) {
11658 console[method].apply(console, __spreadArrays(["[" + now + "] " + instance.name + ":"], args));
11659 }
11660 else {
11661 throw new Error("Attempted to log a message with an invalid logType (value: " + logType + ")");
11662 }
11663};
11664var Logger = /** @class */ (function () {
11665 /**
11666 * Gives you an instance of a Logger to capture messages according to
11667 * Firebase's logging scheme.
11668 *
11669 * @param name The name that the logs will be associated with
11670 */
11671 function Logger(name) {
11672 this.name = name;
11673 /**
11674 * The log level of the given Logger instance.
11675 */
11676 this._logLevel = defaultLogLevel;
11677 /**
11678 * The main (internal) log handler for the Logger instance.
11679 * Can be set to a new function in internal package code but not by user.
11680 */
11681 this._logHandler = defaultLogHandler;
11682 /**
11683 * The optional, additional, user-defined log handler for the Logger instance.
11684 */
11685 this._userLogHandler = null;
11686 /**
11687 * Capture the current instance for later use
11688 */
11689 instances.push(this);
11690 }
11691 Object.defineProperty(Logger.prototype, "logLevel", {
11692 get: function () {
11693 return this._logLevel;
11694 },
11695 set: function (val) {
11696 if (!(val in LogLevel)) {
11697 throw new TypeError("Invalid value \"" + val + "\" assigned to `logLevel`");
11698 }
11699 this._logLevel = val;
11700 },
11701 enumerable: false,
11702 configurable: true
11703 });
11704 // Workaround for setter/getter having to be the same type.
11705 Logger.prototype.setLogLevel = function (val) {
11706 this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;
11707 };
11708 Object.defineProperty(Logger.prototype, "logHandler", {
11709 get: function () {
11710 return this._logHandler;
11711 },
11712 set: function (val) {
11713 if (typeof val !== 'function') {
11714 throw new TypeError('Value assigned to `logHandler` must be a function');
11715 }
11716 this._logHandler = val;
11717 },
11718 enumerable: false,
11719 configurable: true
11720 });
11721 Object.defineProperty(Logger.prototype, "userLogHandler", {
11722 get: function () {
11723 return this._userLogHandler;
11724 },
11725 set: function (val) {
11726 this._userLogHandler = val;
11727 },
11728 enumerable: false,
11729 configurable: true
11730 });
11731 /**
11732 * The functions below are all based on the `console` interface
11733 */
11734 Logger.prototype.debug = function () {
11735 var args = [];
11736 for (var _i = 0; _i < arguments.length; _i++) {
11737 args[_i] = arguments[_i];
11738 }
11739 this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.DEBUG], args));
11740 this._logHandler.apply(this, __spreadArrays([this, LogLevel.DEBUG], args));
11741 };
11742 Logger.prototype.log = function () {
11743 var args = [];
11744 for (var _i = 0; _i < arguments.length; _i++) {
11745 args[_i] = arguments[_i];
11746 }
11747 this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.VERBOSE], args));
11748 this._logHandler.apply(this, __spreadArrays([this, LogLevel.VERBOSE], args));
11749 };
11750 Logger.prototype.info = function () {
11751 var args = [];
11752 for (var _i = 0; _i < arguments.length; _i++) {
11753 args[_i] = arguments[_i];
11754 }
11755 this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.INFO], args));
11756 this._logHandler.apply(this, __spreadArrays([this, LogLevel.INFO], args));
11757 };
11758 Logger.prototype.warn = function () {
11759 var args = [];
11760 for (var _i = 0; _i < arguments.length; _i++) {
11761 args[_i] = arguments[_i];
11762 }
11763 this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.WARN], args));
11764 this._logHandler.apply(this, __spreadArrays([this, LogLevel.WARN], args));
11765 };
11766 Logger.prototype.error = function () {
11767 var args = [];
11768 for (var _i = 0; _i < arguments.length; _i++) {
11769 args[_i] = arguments[_i];
11770 }
11771 this._userLogHandler && this._userLogHandler.apply(this, __spreadArrays([this, LogLevel.ERROR], args));
11772 this._logHandler.apply(this, __spreadArrays([this, LogLevel.ERROR], args));
11773 };
11774 return Logger;
11775}());
11776function setLogLevel(level) {
11777 instances.forEach(function (inst) {
11778 inst.setLogLevel(level);
11779 });
11780}
11781function setUserLogHandler(logCallback, options) {
11782 var _loop_1 = function (instance) {
11783 var customLogLevel = null;
11784 if (options && options.level) {
11785 customLogLevel = levelStringToEnum[options.level];
11786 }
11787 if (logCallback === null) {
11788 instance.userLogHandler = null;
11789 }
11790 else {
11791 instance.userLogHandler = function (instance, level) {
11792 var args = [];
11793 for (var _i = 2; _i < arguments.length; _i++) {
11794 args[_i - 2] = arguments[_i];
11795 }
11796 var message = args
11797 .map(function (arg) {
11798 if (arg == null) {
11799 return null;
11800 }
11801 else if (typeof arg === 'string') {
11802 return arg;
11803 }
11804 else if (typeof arg === 'number' || typeof arg === 'boolean') {
11805 return arg.toString();
11806 }
11807 else if (arg instanceof Error) {
11808 return arg.message;
11809 }
11810 else {
11811 try {
11812 return JSON.stringify(arg);
11813 }
11814 catch (ignored) {
11815 return null;
11816 }
11817 }
11818 })
11819 .filter(function (arg) { return arg; })
11820 .join(' ');
11821 if (level >= (customLogLevel !== null && customLogLevel !== void 0 ? customLogLevel : instance.logLevel)) {
11822 logCallback({
11823 level: LogLevel[level].toLowerCase(),
11824 message: message,
11825 args: args,
11826 type: instance.name
11827 });
11828 }
11829 };
11830 }
11831 };
11832 for (var _i = 0, instances_1 = instances; _i < instances_1.length; _i++) {
11833 var instance = instances_1[_i];
11834 _loop_1(instance);
11835 }
11836}
11837
11838
11839//# sourceMappingURL=index.esm.js.map
11840
11841// CONCATENATED MODULE: ./node_modules/@firebase/app/dist/index.esm.js
11842
11843
11844
11845
11846
11847/**
11848 * @license
11849 * Copyright 2019 Google LLC
11850 *
11851 * Licensed under the Apache License, Version 2.0 (the "License");
11852 * you may not use this file except in compliance with the License.
11853 * You may obtain a copy of the License at
11854 *
11855 * http://www.apache.org/licenses/LICENSE-2.0
11856 *
11857 * Unless required by applicable law or agreed to in writing, software
11858 * distributed under the License is distributed on an "AS IS" BASIS,
11859 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11860 * See the License for the specific language governing permissions and
11861 * limitations under the License.
11862 */
11863var dist_index_esm_a;
11864var ERRORS = (dist_index_esm_a = {},
11865 dist_index_esm_a["no-app" /* NO_APP */] = "No Firebase App '{$appName}' has been created - " +
11866 'call Firebase App.initializeApp()',
11867 dist_index_esm_a["bad-app-name" /* BAD_APP_NAME */] = "Illegal App name: '{$appName}",
11868 dist_index_esm_a["duplicate-app" /* DUPLICATE_APP */] = "Firebase App named '{$appName}' already exists",
11869 dist_index_esm_a["app-deleted" /* APP_DELETED */] = "Firebase App named '{$appName}' already deleted",
11870 dist_index_esm_a["invalid-app-argument" /* INVALID_APP_ARGUMENT */] = 'firebase.{$appName}() takes either no argument or a ' +
11871 'Firebase App instance.',
11872 dist_index_esm_a["invalid-log-argument" /* INVALID_LOG_ARGUMENT */] = 'First argument to `onLog` must be null or a function.',
11873 dist_index_esm_a);
11874var ERROR_FACTORY = new index_esm["b" /* ErrorFactory */]('app', 'Firebase', ERRORS);
11875
11876var name$1 = "@firebase/app";
11877var index_esm_version = "0.6.13";
11878
11879var name$2 = "@firebase/analytics";
11880
11881var name$3 = "@firebase/auth";
11882
11883var name$4 = "@firebase/database";
11884
11885var name$5 = "@firebase/functions";
11886
11887var name$6 = "@firebase/installations";
11888
11889var name$7 = "@firebase/messaging";
11890
11891var name$8 = "@firebase/performance";
11892
11893var name$9 = "@firebase/remote-config";
11894
11895var name$a = "@firebase/storage";
11896
11897var name$b = "@firebase/firestore";
11898
11899var name$c = "firebase-wrapper";
11900
11901/**
11902 * @license
11903 * Copyright 2019 Google LLC
11904 *
11905 * Licensed under the Apache License, Version 2.0 (the "License");
11906 * you may not use this file except in compliance with the License.
11907 * You may obtain a copy of the License at
11908 *
11909 * http://www.apache.org/licenses/LICENSE-2.0
11910 *
11911 * Unless required by applicable law or agreed to in writing, software
11912 * distributed under the License is distributed on an "AS IS" BASIS,
11913 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11914 * See the License for the specific language governing permissions and
11915 * limitations under the License.
11916 */
11917var _a$1;
11918var index_esm_DEFAULT_ENTRY_NAME = '[DEFAULT]';
11919var PLATFORM_LOG_STRING = (_a$1 = {},
11920 _a$1[name$1] = 'fire-core',
11921 _a$1[name$2] = 'fire-analytics',
11922 _a$1[name$3] = 'fire-auth',
11923 _a$1[name$4] = 'fire-rtdb',
11924 _a$1[name$5] = 'fire-fn',
11925 _a$1[name$6] = 'fire-iid',
11926 _a$1[name$7] = 'fire-fcm',
11927 _a$1[name$8] = 'fire-perf',
11928 _a$1[name$9] = 'fire-rc',
11929 _a$1[name$a] = 'fire-gcs',
11930 _a$1[name$b] = 'fire-fst',
11931 _a$1['fire-js'] = 'fire-js',
11932 _a$1[name$c] = 'fire-js-all',
11933 _a$1);
11934
11935/**
11936 * @license
11937 * Copyright 2019 Google LLC
11938 *
11939 * Licensed under the Apache License, Version 2.0 (the "License");
11940 * you may not use this file except in compliance with the License.
11941 * You may obtain a copy of the License at
11942 *
11943 * http://www.apache.org/licenses/LICENSE-2.0
11944 *
11945 * Unless required by applicable law or agreed to in writing, software
11946 * distributed under the License is distributed on an "AS IS" BASIS,
11947 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11948 * See the License for the specific language governing permissions and
11949 * limitations under the License.
11950 */
11951var logger = new Logger('@firebase/app');
11952
11953/**
11954 * @license
11955 * Copyright 2017 Google LLC
11956 *
11957 * Licensed under the Apache License, Version 2.0 (the "License");
11958 * you may not use this file except in compliance with the License.
11959 * You may obtain a copy of the License at
11960 *
11961 * http://www.apache.org/licenses/LICENSE-2.0
11962 *
11963 * Unless required by applicable law or agreed to in writing, software
11964 * distributed under the License is distributed on an "AS IS" BASIS,
11965 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11966 * See the License for the specific language governing permissions and
11967 * limitations under the License.
11968 */
11969/**
11970 * Global context object for a collection of services using
11971 * a shared authentication state.
11972 */
11973var index_esm_FirebaseAppImpl = /** @class */ (function () {
11974 function FirebaseAppImpl(options, config, firebase_) {
11975 var e_1, _a;
11976 var _this = this;
11977 this.firebase_ = firebase_;
11978 this.isDeleted_ = false;
11979 this.name_ = config.name;
11980 this.automaticDataCollectionEnabled_ =
11981 config.automaticDataCollectionEnabled || false;
11982 this.options_ = Object(index_esm["e" /* deepCopy */])(options);
11983 this.container = new ComponentContainer(config.name);
11984 // add itself to container
11985 this._addComponent(new Component('app', function () { return _this; }, "PUBLIC" /* PUBLIC */));
11986 try {
11987 // populate ComponentContainer with existing components
11988 for (var _b = Object(tslib_es6["__values"])(this.firebase_.INTERNAL.components.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
11989 var component = _c.value;
11990 this._addComponent(component);
11991 }
11992 }
11993 catch (e_1_1) { e_1 = { error: e_1_1 }; }
11994 finally {
11995 try {
11996 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
11997 }
11998 finally { if (e_1) throw e_1.error; }
11999 }
12000 }
12001 Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", {
12002 get: function () {
12003 this.checkDestroyed_();
12004 return this.automaticDataCollectionEnabled_;
12005 },
12006 set: function (val) {
12007 this.checkDestroyed_();
12008 this.automaticDataCollectionEnabled_ = val;
12009 },
12010 enumerable: false,
12011 configurable: true
12012 });
12013 Object.defineProperty(FirebaseAppImpl.prototype, "name", {
12014 get: function () {
12015 this.checkDestroyed_();
12016 return this.name_;
12017 },
12018 enumerable: false,
12019 configurable: true
12020 });
12021 Object.defineProperty(FirebaseAppImpl.prototype, "options", {
12022 get: function () {
12023 this.checkDestroyed_();
12024 return this.options_;
12025 },
12026 enumerable: false,
12027 configurable: true
12028 });
12029 FirebaseAppImpl.prototype.delete = function () {
12030 var _this = this;
12031 return new Promise(function (resolve) {
12032 _this.checkDestroyed_();
12033 resolve();
12034 })
12035 .then(function () {
12036 _this.firebase_.INTERNAL.removeApp(_this.name_);
12037 return Promise.all(_this.container.getProviders().map(function (provider) { return provider.delete(); }));
12038 })
12039 .then(function () {
12040 _this.isDeleted_ = true;
12041 });
12042 };
12043 /**
12044 * Return a service instance associated with this app (creating it
12045 * on demand), identified by the passed instanceIdentifier.
12046 *
12047 * NOTE: Currently storage and functions are the only ones that are leveraging this
12048 * functionality. They invoke it by calling:
12049 *
12050 * ```javascript
12051 * firebase.app().storage('STORAGE BUCKET ID')
12052 * ```
12053 *
12054 * The service name is passed to this already
12055 * @internal
12056 */
12057 FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) {
12058 if (instanceIdentifier === void 0) { instanceIdentifier = index_esm_DEFAULT_ENTRY_NAME; }
12059 this.checkDestroyed_();
12060 // getImmediate will always succeed because _getService is only called for registered components.
12061 return this.container.getProvider(name).getImmediate({
12062 identifier: instanceIdentifier
12063 });
12064 };
12065 /**
12066 * Remove a service instance from the cache, so we will create a new instance for this service
12067 * when people try to get this service again.
12068 *
12069 * NOTE: currently only firestore is using this functionality to support firestore shutdown.
12070 *
12071 * @param name The service name
12072 * @param instanceIdentifier instance identifier in case multiple instances are allowed
12073 * @internal
12074 */
12075 FirebaseAppImpl.prototype._removeServiceInstance = function (name, instanceIdentifier) {
12076 if (instanceIdentifier === void 0) { instanceIdentifier = index_esm_DEFAULT_ENTRY_NAME; }
12077 // eslint-disable-next-line @typescript-eslint/no-explicit-any
12078 this.container.getProvider(name).clearInstance(instanceIdentifier);
12079 };
12080 /**
12081 * @param component the component being added to this app's container
12082 */
12083 FirebaseAppImpl.prototype._addComponent = function (component) {
12084 try {
12085 this.container.addComponent(component);
12086 }
12087 catch (e) {
12088 logger.debug("Component " + component.name + " failed to register with FirebaseApp " + this.name, e);
12089 }
12090 };
12091 FirebaseAppImpl.prototype._addOrOverwriteComponent = function (component) {
12092 this.container.addOrOverwriteComponent(component);
12093 };
12094 /**
12095 * This function will throw an Error if the App has already been deleted -
12096 * use before performing API actions on the App.
12097 */
12098 FirebaseAppImpl.prototype.checkDestroyed_ = function () {
12099 if (this.isDeleted_) {
12100 throw ERROR_FACTORY.create("app-deleted" /* APP_DELETED */, { appName: this.name_ });
12101 }
12102 };
12103 return FirebaseAppImpl;
12104}());
12105// Prevent dead-code elimination of these methods w/o invalid property
12106// copying.
12107(index_esm_FirebaseAppImpl.prototype.name && index_esm_FirebaseAppImpl.prototype.options) ||
12108 index_esm_FirebaseAppImpl.prototype.delete ||
12109 console.log('dc');
12110
12111var version$1 = "8.0.1";
12112
12113/**
12114 * @license
12115 * Copyright 2019 Google LLC
12116 *
12117 * Licensed under the Apache License, Version 2.0 (the "License");
12118 * you may not use this file except in compliance with the License.
12119 * You may obtain a copy of the License at
12120 *
12121 * http://www.apache.org/licenses/LICENSE-2.0
12122 *
12123 * Unless required by applicable law or agreed to in writing, software
12124 * distributed under the License is distributed on an "AS IS" BASIS,
12125 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12126 * See the License for the specific language governing permissions and
12127 * limitations under the License.
12128 */
12129/**
12130 * Because auth can't share code with other components, we attach the utility functions
12131 * in an internal namespace to share code.
12132 * This function return a firebase namespace object without
12133 * any utility functions, so it can be shared between the regular firebaseNamespace and
12134 * the lite version.
12135 */
12136function createFirebaseNamespaceCore(firebaseAppImpl) {
12137 var apps = {};
12138 // eslint-disable-next-line @typescript-eslint/no-explicit-any
12139 var components = new Map();
12140 // A namespace is a plain JavaScript Object.
12141 var namespace = {
12142 // Hack to prevent Babel from modifying the object returned
12143 // as the firebase namespace.
12144 // @ts-ignore
12145 __esModule: true,
12146 initializeApp: initializeApp,
12147 // @ts-ignore
12148 app: app,
12149 registerVersion: registerVersion,
12150 setLogLevel: setLogLevel,
12151 onLog: onLog,
12152 // @ts-ignore
12153 apps: null,
12154 SDK_VERSION: version$1,
12155 INTERNAL: {
12156 registerComponent: registerComponent,
12157 removeApp: removeApp,
12158 components: components,
12159 useAsService: useAsService
12160 }
12161 };
12162 // Inject a circular default export to allow Babel users who were previously
12163 // using:
12164 //
12165 // import firebase from 'firebase';
12166 // which becomes: var firebase = require('firebase').default;
12167 //
12168 // instead of
12169 //
12170 // import * as firebase from 'firebase';
12171 // which becomes: var firebase = require('firebase');
12172 // eslint-disable-next-line @typescript-eslint/no-explicit-any
12173 namespace['default'] = namespace;
12174 // firebase.apps is a read-only getter.
12175 Object.defineProperty(namespace, 'apps', {
12176 get: getApps
12177 });
12178 /**
12179 * Called by App.delete() - but before any services associated with the App
12180 * are deleted.
12181 */
12182 function removeApp(name) {
12183 delete apps[name];
12184 }
12185 /**
12186 * Get the App object for a given name (or DEFAULT).
12187 */
12188 function app(name) {
12189 name = name || index_esm_DEFAULT_ENTRY_NAME;
12190 if (!Object(index_esm["c" /* contains */])(apps, name)) {
12191 throw ERROR_FACTORY.create("no-app" /* NO_APP */, { appName: name });
12192 }
12193 return apps[name];
12194 }
12195 // @ts-ignore
12196 app['App'] = firebaseAppImpl;
12197 function initializeApp(options, rawConfig) {
12198 if (rawConfig === void 0) { rawConfig = {}; }
12199 if (typeof rawConfig !== 'object' || rawConfig === null) {
12200 var name_1 = rawConfig;
12201 rawConfig = { name: name_1 };
12202 }
12203 var config = rawConfig;
12204 if (config.name === undefined) {
12205 config.name = index_esm_DEFAULT_ENTRY_NAME;
12206 }
12207 var name = config.name;
12208 if (typeof name !== 'string' || !name) {
12209 throw ERROR_FACTORY.create("bad-app-name" /* BAD_APP_NAME */, {
12210 appName: String(name)
12211 });
12212 }
12213 if (Object(index_esm["c" /* contains */])(apps, name)) {
12214 throw ERROR_FACTORY.create("duplicate-app" /* DUPLICATE_APP */, { appName: name });
12215 }
12216 var app = new firebaseAppImpl(options, config, namespace);
12217 apps[name] = app;
12218 return app;
12219 }
12220 /*
12221 * Return an array of all the non-deleted FirebaseApps.
12222 */
12223 function getApps() {
12224 // Make a copy so caller cannot mutate the apps list.
12225 return Object.keys(apps).map(function (name) { return apps[name]; });
12226 }
12227 function registerComponent(component) {
12228 var e_1, _a;
12229 var componentName = component.name;
12230 if (components.has(componentName)) {
12231 logger.debug("There were multiple attempts to register component " + componentName + ".");
12232 return component.type === "PUBLIC" /* PUBLIC */
12233 ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
12234 namespace[componentName]
12235 : null;
12236 }
12237 components.set(componentName, component);
12238 // create service namespace for public components
12239 if (component.type === "PUBLIC" /* PUBLIC */) {
12240 // The Service namespace is an accessor function ...
12241 var serviceNamespace = function (appArg) {
12242 if (appArg === void 0) { appArg = app(); }
12243 // eslint-disable-next-line @typescript-eslint/no-explicit-any
12244 if (typeof appArg[componentName] !== 'function') {
12245 // Invalid argument.
12246 // This happens in the following case: firebase.storage('gs:/')
12247 throw ERROR_FACTORY.create("invalid-app-argument" /* INVALID_APP_ARGUMENT */, {
12248 appName: componentName
12249 });
12250 }
12251 // Forward service instance lookup to the FirebaseApp.
12252 // eslint-disable-next-line @typescript-eslint/no-explicit-any
12253 return appArg[componentName]();
12254 };
12255 // ... and a container for service-level properties.
12256 if (component.serviceProps !== undefined) {
12257 Object(index_esm["f" /* deepExtend */])(serviceNamespace, component.serviceProps);
12258 }
12259 // eslint-disable-next-line @typescript-eslint/no-explicit-any
12260 namespace[componentName] = serviceNamespace;
12261 // Patch the FirebaseAppImpl prototype
12262 // eslint-disable-next-line @typescript-eslint/no-explicit-any
12263 firebaseAppImpl.prototype[componentName] =
12264 // TODO: The eslint disable can be removed and the 'ignoreRestArgs'
12265 // option added to the no-explicit-any rule when ESlint releases it.
12266 // eslint-disable-next-line @typescript-eslint/no-explicit-any
12267 function () {
12268 var args = [];
12269 for (var _i = 0; _i < arguments.length; _i++) {
12270 args[_i] = arguments[_i];
12271 }
12272 var serviceFxn = this._getService.bind(this, componentName);
12273 return serviceFxn.apply(this, component.multipleInstances ? args : []);
12274 };
12275 }
12276 try {
12277 // add the component to existing app instances
12278 for (var _b = Object(tslib_es6["__values"])(Object.keys(apps)), _c = _b.next(); !_c.done; _c = _b.next()) {
12279 var appName = _c.value;
12280 apps[appName]._addComponent(component);
12281 }
12282 }
12283 catch (e_1_1) { e_1 = { error: e_1_1 }; }
12284 finally {
12285 try {
12286 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
12287 }
12288 finally { if (e_1) throw e_1.error; }
12289 }
12290 return component.type === "PUBLIC" /* PUBLIC */
12291 ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
12292 namespace[componentName]
12293 : null;
12294 }
12295 function registerVersion(libraryKeyOrName, version, variant) {
12296 var _a;
12297 // TODO: We can use this check to whitelist strings when/if we set up
12298 // a good whitelist system.
12299 var library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;
12300 if (variant) {
12301 library += "-" + variant;
12302 }
12303 var libraryMismatch = library.match(/\s|\//);
12304 var versionMismatch = version.match(/\s|\//);
12305 if (libraryMismatch || versionMismatch) {
12306 var warning = [
12307 "Unable to register library \"" + library + "\" with version \"" + version + "\":"
12308 ];
12309 if (libraryMismatch) {
12310 warning.push("library name \"" + library + "\" contains illegal characters (whitespace or \"/\")");
12311 }
12312 if (libraryMismatch && versionMismatch) {
12313 warning.push('and');
12314 }
12315 if (versionMismatch) {
12316 warning.push("version name \"" + version + "\" contains illegal characters (whitespace or \"/\")");
12317 }
12318 logger.warn(warning.join(' '));
12319 return;
12320 }
12321 registerComponent(new Component(library + "-version", function () { return ({ library: library, version: version }); }, "VERSION" /* VERSION */));
12322 }
12323 function onLog(logCallback, options) {
12324 if (logCallback !== null && typeof logCallback !== 'function') {
12325 throw ERROR_FACTORY.create("invalid-log-argument" /* INVALID_LOG_ARGUMENT */, {
12326 appName: name
12327 });
12328 }
12329 setUserLogHandler(logCallback, options);
12330 }
12331 // Map the requested service to a registered service name
12332 // (used to map auth to serverAuth service when needed).
12333 function useAsService(app, name) {
12334 if (name === 'serverAuth') {
12335 return null;
12336 }
12337 var useService = name;
12338 return useService;
12339 }
12340 return namespace;
12341}
12342
12343/**
12344 * @license
12345 * Copyright 2019 Google LLC
12346 *
12347 * Licensed under the Apache License, Version 2.0 (the "License");
12348 * you may not use this file except in compliance with the License.
12349 * You may obtain a copy of the License at
12350 *
12351 * http://www.apache.org/licenses/LICENSE-2.0
12352 *
12353 * Unless required by applicable law or agreed to in writing, software
12354 * distributed under the License is distributed on an "AS IS" BASIS,
12355 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12356 * See the License for the specific language governing permissions and
12357 * limitations under the License.
12358 */
12359/**
12360 * Return a firebase namespace object.
12361 *
12362 * In production, this will be called exactly once and the result
12363 * assigned to the 'firebase' global. It may be called multiple times
12364 * in unit tests.
12365 */
12366function createFirebaseNamespace() {
12367 var namespace = createFirebaseNamespaceCore(index_esm_FirebaseAppImpl);
12368 namespace.INTERNAL = Object(tslib_es6["__assign"])(Object(tslib_es6["__assign"])({}, namespace.INTERNAL), { createFirebaseNamespace: createFirebaseNamespace,
12369 extendNamespace: extendNamespace,
12370 createSubscribe: index_esm["d" /* createSubscribe */],
12371 ErrorFactory: index_esm["b" /* ErrorFactory */],
12372 deepExtend: index_esm["f" /* deepExtend */] });
12373 /**
12374 * Patch the top-level firebase namespace with additional properties.
12375 *
12376 * firebase.INTERNAL.extendNamespace()
12377 */
12378 function extendNamespace(props) {
12379 Object(index_esm["f" /* deepExtend */])(namespace, props);
12380 }
12381 return namespace;
12382}
12383var index_esm_firebase = createFirebaseNamespace();
12384
12385/**
12386 * @license
12387 * Copyright 2019 Google LLC
12388 *
12389 * Licensed under the Apache License, Version 2.0 (the "License");
12390 * you may not use this file except in compliance with the License.
12391 * You may obtain a copy of the License at
12392 *
12393 * http://www.apache.org/licenses/LICENSE-2.0
12394 *
12395 * Unless required by applicable law or agreed to in writing, software
12396 * distributed under the License is distributed on an "AS IS" BASIS,
12397 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12398 * See the License for the specific language governing permissions and
12399 * limitations under the License.
12400 */
12401var PlatformLoggerService = /** @class */ (function () {
12402 function PlatformLoggerService(container) {
12403 this.container = container;
12404 }
12405 // In initial implementation, this will be called by installations on
12406 // auth token refresh, and installations will send this string.
12407 PlatformLoggerService.prototype.getPlatformInfoString = function () {
12408 var providers = this.container.getProviders();
12409 // Loop through providers and get library/version pairs from any that are
12410 // version components.
12411 return providers
12412 .map(function (provider) {
12413 if (isVersionServiceProvider(provider)) {
12414 var service = provider.getImmediate();
12415 return service.library + "/" + service.version;
12416 }
12417 else {
12418 return null;
12419 }
12420 })
12421 .filter(function (logString) { return logString; })
12422 .join(' ');
12423 };
12424 return PlatformLoggerService;
12425}());
12426/**
12427 *
12428 * @param provider check if this provider provides a VersionService
12429 *
12430 * NOTE: Using Provider<'app-version'> is a hack to indicate that the provider
12431 * provides VersionService. The provider is not necessarily a 'app-version'
12432 * provider.
12433 */
12434function isVersionServiceProvider(provider) {
12435 var component = provider.getComponent();
12436 return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* VERSION */;
12437}
12438
12439/**
12440 * @license
12441 * Copyright 2019 Google LLC
12442 *
12443 * Licensed under the Apache License, Version 2.0 (the "License");
12444 * you may not use this file except in compliance with the License.
12445 * You may obtain a copy of the License at
12446 *
12447 * http://www.apache.org/licenses/LICENSE-2.0
12448 *
12449 * Unless required by applicable law or agreed to in writing, software
12450 * distributed under the License is distributed on an "AS IS" BASIS,
12451 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12452 * See the License for the specific language governing permissions and
12453 * limitations under the License.
12454 */
12455function registerCoreComponents(firebase, variant) {
12456 firebase.INTERNAL.registerComponent(new Component('platform-logger', function (container) { return new PlatformLoggerService(container); }, "PRIVATE" /* PRIVATE */));
12457 // Register `app` package.
12458 firebase.registerVersion(name$1, index_esm_version, variant);
12459 // Register platform SDK identifier (no version).
12460 firebase.registerVersion('fire-js', '');
12461}
12462
12463/**
12464 * @license
12465 * Copyright 2017 Google LLC
12466 *
12467 * Licensed under the Apache License, Version 2.0 (the "License");
12468 * you may not use this file except in compliance with the License.
12469 * You may obtain a copy of the License at
12470 *
12471 * http://www.apache.org/licenses/LICENSE-2.0
12472 *
12473 * Unless required by applicable law or agreed to in writing, software
12474 * distributed under the License is distributed on an "AS IS" BASIS,
12475 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12476 * See the License for the specific language governing permissions and
12477 * limitations under the License.
12478 */
12479// Firebase Lite detection test
12480// eslint-disable-next-line @typescript-eslint/no-explicit-any
12481if (Object(index_esm["g" /* isBrowser */])() && self.firebase !== undefined) {
12482 logger.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n ");
12483 // eslint-disable-next-line
12484 var sdkVersion = self.firebase.SDK_VERSION;
12485 if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) {
12486 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 ");
12487 }
12488}
12489var index_esm_initializeApp = index_esm_firebase.initializeApp;
12490// TODO: This disable can be removed and the 'ignoreRestArgs' option added to
12491// the no-explicit-any rule when ESlint releases it.
12492// eslint-disable-next-line @typescript-eslint/no-explicit-any
12493index_esm_firebase.initializeApp = function () {
12494 var args = [];
12495 for (var _i = 0; _i < arguments.length; _i++) {
12496 args[_i] = arguments[_i];
12497 }
12498 // Environment check before initializing app
12499 // Do the check in initializeApp, so people have a chance to disable it by setting logLevel
12500 // in @firebase/logger
12501 if (Object(index_esm["h" /* isNode */])()) {
12502 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 ");
12503 }
12504 return index_esm_initializeApp.apply(undefined, args);
12505};
12506var firebase$1 = index_esm_firebase;
12507registerCoreComponents(firebase$1);
12508
12509/* harmony default export */ var dist_index_esm = __webpack_exports__["a"] = (firebase$1);
12510
12511//# sourceMappingURL=index.esm.js.map
12512
12513
12514/***/ })
12515
12516}]);