text: !function(root, factory) {
      "object" == typeof exports && "object" == typeof module ? module.exports = factory() : "function" == typeof define && define.amd ? define("spbNativePopup", [], factory) : "object" == typeof exports ? exports.spbNativePopup = factory() : root.spbNativePopup = factory();
  }("undefined" != typeof self ? self : this, (function() {
      return function(modules) {
          var installedModules = {};
          function __webpack_require__(moduleId) {
              if (installedModules[moduleId]) return installedModules[moduleId].exports;
              var module = installedModules[moduleId] = {
                  i: moduleId,
                  l: !1,
                  exports: {}
              };
              modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
              module.l = !0;
              return module.exports;
          }
          __webpack_require__.m = modules;
          __webpack_require__.c = installedModules;
          __webpack_require__.d = function(exports, name, getter) {
              __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
                  enumerable: !0,
                  get: getter
              });
          };
          __webpack_require__.r = function(exports) {
              "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
                  value: "Module"
              });
              Object.defineProperty(exports, "__esModule", {
                  value: !0
              });
          };
          __webpack_require__.t = function(value, mode) {
              1 & mode && (value = __webpack_require__(value));
              if (8 & mode) return value;
              if (4 & mode && "object" == typeof value && value && value.__esModule) return value;
              var ns = Object.create(null);
              __webpack_require__.r(ns);
              Object.defineProperty(ns, "default", {
                  enumerable: !0,
                  value: value
              });
              if (2 & mode && "string" != typeof value) for (var key in value) __webpack_require__.d(ns, key, function(key) {
                  return value[key];
              }.bind(null, key));
              return ns;
          };
          __webpack_require__.n = function(module) {
              var getter = module && module.__esModule ? function() {
                  return module.default;
              } : function() {
                  return module;
              };
              __webpack_require__.d(getter, "a", getter);
              return getter;
          };
          __webpack_require__.o = function(object, property) {
              return {}.hasOwnProperty.call(object, property);
          };
          __webpack_require__.p = "";
          return __webpack_require__(__webpack_require__.s = 0);
      }([ function(module, __webpack_exports__, __webpack_require__) {
          "use strict";
          __webpack_require__.r(__webpack_exports__);
          __webpack_require__.d(__webpack_exports__, "setupNativePopup", (function() {
              return setupNativePopup;
          }));
          __webpack_require__.d(__webpack_exports__, "NativePopup", (function() {
              return NativePopup;
          }));
          function _extends() {
              return (_extends = Object.assign || function(target) {
                  for (var i = 1; i < arguments.length; i++) {
                      var source = arguments[i];
                      for (var key in source) ({}).hasOwnProperty.call(source, key) && (target[key] = source[key]);
                  }
                  return target;
              }).apply(this, arguments);
          }
          var iPhoneScreenHeightMatrix = {
              926: {
                  device: "iPhone 12 Pro Max",
                  textSizeHeights: [ 752, 748, 744, 738 ],
                  zoomHeight: {
                      1.15: [ 752, 747, 744, 738 ],
                      1.25: [ 753, 748, 744, 738 ],
                      1.5: [ 752, 749, 744, 738 ],
                      1.75: [ 753, 747, 744, 739 ],
                      2: [ 752, 748, 744 ],
                      2.5: [ 753, 748 ],
                      3: [ 753, 744 ]
                  },
                  maybeSafari: {
                      2: [ 738 ],
                      2.5: [ 745, 738 ],
                      3: [ 747, 738 ]
                  }
              },
              896: {
                  device: "iPhone XS Max, iPhone 11 Pro Max, iPhone XR, iPhone 11",
                  textSizeHeights: [ 721, 717, 713, 707 ],
                  zoomHeight: {
                      1.15: [ 721, 716, 713, 707 ],
                      1.25: [ 721, 718, 713, 708 ],
                      1.5: [ 722, 717, 713 ],
                      1.75: [ 721, 718, 712, 707 ],
                      2: [ 722, 718, 714, 708 ],
                      2.5: [ 720, 718, 713, 708 ],
                      3: [ 720, 717, 708 ]
                  },
                  maybeSafari: {
                      1.5: [ 707 ],
                      3: [ 714 ]
                  }
              },
              844: {
                  device: "iPhone 12, iPhone 12 Pro",
                  textSizeHeights: [ 670, 666, 662, 656 ],
                  zoomHeight: {
                      1.15: [ 670, 666, 662 ],
                      1.25: [ 670, 666, 663, 656 ],
                      1.5: [ 671, 666, 662 ],
                      1.75: [ 670, 667, 662, 656 ],
                      2: [ 670, 666, 662 ],
                      2.5: [ 670, 663 ],
                      3: [ 669, 666, 663, 657 ]
                  },
                  maybeSafari: {
                      1.15: [ 656 ],
                      1.5: [ 656 ],
                      2: [ 656 ],
                      2.5: [ 665, 655 ],
                      3: [ 663 ]
                  }
              },
              812: {
                  device: "iPhone X, iPhone XS, iPhone 11 Pro, iPhone 12 Mini",
                  textSizeHeights: [ 641, 637, 633, 627 ],
                  zoomHeight: {
                      1.15: [ 641, 637, 633, 627 ],
                      1.25: [ 641, 638, 633, 628 ],
                      1.5: [ 641, 638, 633, 627 ],
                      1.75: [ 641, 637, 634 ],
                      2: [ 642, 638, 634, 628 ],
                      2.5: [ 640, 638, 633, 628 ],
                      3: [ 642, 633 ]
                  },
                  maybeSafari: {
                      1.75: [ 627 ],
                      3: [ 636, 627 ]
                  }
              },
              736: {
                  device: "iPhone 6 Plus, iPhone 6S Plus, iPhone 7 Plus, iPhone 8 Plus",
                  textSizeHeights: [ 628, 624, 620, 614 ],
                  zoomHeight: {
                      1.15: [ 628, 624, 620, 614 ],
                      1.25: [ 628, 624, 620, 614 ],
                      1.5: [ 629, 624, 620 ],
                      1.75: [ 628, 625, 620, 614 ],
                      2: [ 628, 624, 620 ],
                      2.5: [ 628, 625, 620, 615 ],
                      3: [ 627, 624, 615 ]
                  },
                  maybeSafari: {
                      1.5: [ 614 ],
                      2: [ 614 ],
                      3: [ 621 ]
                  }
              },
              667: {
                  device: "iPhone 6, iPhone 6S, iPhone 7, iPhone 8,  iPhone SE2",
                  textSizeHeights: [ 559, 555, 551, 545 ],
                  zoomHeight: {
                      1.15: [ 559, 555, 551, 545 ],
                      1.25: [ 559, 555, 551, 545 ],
                      1.5: [ 560, 555, 551 ],
                      1.75: [ 558, 555, 551 ],
                      2: [ 560, 556, 552, 546 ],
                      2.5: [ 560, 555, 550 ],
                      3: [ 558, 555, 546 ]
                  },
                  maybeSafari: {
                      1.5: [ 545 ],
                      1.75: [ 544 ],
                      2.5: [ 545 ],
                      3: [ 552 ]
                  }
              }
          };
          function getUserAgent() {
              return window.navigator.mockUserAgent || window.navigator.userAgent;
          }
          function isAndroid(ua) {
              void 0 === ua && (ua = getUserAgent());
              return /Android/.test(ua);
          }
          function isIos(ua) {
              void 0 === ua && (ua = getUserAgent());
              return /iPhone|iPod|iPad/.test(ua);
          }
          function isSFVC(ua) {
              void 0 === ua && (ua = getUserAgent());
              if (isIos(ua)) {
                  var device = iPhoneScreenHeightMatrix[window.outerHeight];
                  if (!device) return !1;
                  var height = window.innerHeight;
                  var scale = Math.round(window.screen.width / window.innerWidth * 100) / 100;
                  var computedHeight = Math.round(height * scale);
                  return scale > 1 && device.zoomHeight[scale] ? -1 !== device.zoomHeight[scale].indexOf(computedHeight) : -1 !== device.textSizeHeights.indexOf(computedHeight);
              }
              return !1;
          }
          function isChrome(ua) {
              void 0 === ua && (ua = getUserAgent());
              return /Chrome|Chromium|CriOS/.test(ua);
          }
          function utils_isPromise(item) {
              try {
                  if (!item) return !1;
                  if ("undefined" != typeof Promise && item instanceof Promise) return !0;
                  if ("undefined" != typeof window && "function" == typeof window.Window && item instanceof window.Window) return !1;
                  if ("undefined" != typeof window && "function" == typeof window.constructor && item instanceof window.constructor) return !1;
                  var _toString = {}.toString;
                  if (_toString) {
                      var name = _toString.call(item);
                      if ("[object Window]" === name || "[object global]" === name || "[object DOMWindow]" === name) return !1;
                  }
                  if ("function" == typeof item.then) return !0;
              } catch (err) {
                  return !1;
              }
              return !1;
          }
          var dispatchedErrors = [];
          var possiblyUnhandledPromiseHandlers = [];
          var activeCount = 0;
          var flushPromise;
          function flushActive() {
              if (!activeCount && flushPromise) {
                  var promise = flushPromise;
                  flushPromise = null;
                  promise.resolve();
              }
          }
          function startActive() {
              activeCount += 1;
          }
          function endActive() {
              activeCount -= 1;
              flushActive();
          }
          var promise_ZalgoPromise = function() {
              function ZalgoPromise(handler) {
                  var _this = this;
                  this.resolved = void 0;
                  this.rejected = void 0;
                  this.errorHandled = void 0;
                  this.value = void 0;
                  this.error = void 0;
                  this.handlers = void 0;
                  this.dispatching = void 0;
                  this.stack = void 0;
                  this.resolved = !1;
                  this.rejected = !1;
                  this.errorHandled = !1;
                  this.handlers = [];
                  if (handler) {
                      var _result;
                      var _error;
                      var resolved = !1;
                      var rejected = !1;
                      var isAsync = !1;
                      startActive();
                      try {
                          handler((function(res) {
                              if (isAsync) _this.resolve(res); else {
                                  resolved = !0;
                                  _result = res;
                              }
                          }), (function(err) {
                              if (isAsync) _this.reject(err); else {
                                  rejected = !0;
                                  _error = err;
                              }
                          }));
                      } catch (err) {
                          endActive();
                          this.reject(err);
                          return;
                      }
                      endActive();
                      isAsync = !0;
                      resolved ? this.resolve(_result) : rejected && this.reject(_error);
                  }
              }
              var _proto = ZalgoPromise.prototype;
              _proto.resolve = function(result) {
                  if (this.resolved || this.rejected) return this;
                  if (utils_isPromise(result)) throw new Error("Can not resolve promise with another promise");
                  this.resolved = !0;
                  this.value = result;
                  this.dispatch();
                  return this;
              };
              _proto.reject = function(error) {
                  var _this2 = this;
                  if (this.resolved || this.rejected) return this;
                  if (utils_isPromise(error)) throw new Error("Can not reject promise with another promise");
                  if (!error) {
                      var _err = error && "function" == typeof error.toString ? error.toString() : {}.toString.call(error);
                      error = new Error("Expected reject to be called with Error, got " + _err);
                  }
                  this.rejected = !0;
                  this.error = error;
                  this.errorHandled || setTimeout((function() {
                      _this2.errorHandled || function(err, promise) {
                          if (-1 === dispatchedErrors.indexOf(err)) {
                              dispatchedErrors.push(err);
                              setTimeout((function() {
                                  throw err;
                              }), 1);
                              for (var j = 0; j < possiblyUnhandledPromiseHandlers.length; j++) possiblyUnhandledPromiseHandlers[j](err, promise);
                          }
                      }(error, _this2);
                  }), 1);
                  this.dispatch();
                  return this;
              };
              _proto.asyncReject = function(error) {
                  this.errorHandled = !0;
                  this.reject(error);
                  return this;
              };
              _proto.dispatch = function() {
                  var resolved = this.resolved, rejected = this.rejected, handlers = this.handlers;
                  if (!this.dispatching && (resolved || rejected)) {
                      this.dispatching = !0;
                      startActive();
                      var chain = function(firstPromise, secondPromise) {
                          return firstPromise.then((function(res) {
                              secondPromise.resolve(res);
                          }), (function(err) {
                              secondPromise.reject(err);
                          }));
                      };
                      for (var i = 0; i < handlers.length; i++) {
                          var _handlers$i = handlers[i], onSuccess = _handlers$i.onSuccess, onError = _handlers$i.onError, promise = _handlers$i.promise;
                          var _result2 = void 0;
                          if (resolved) try {
                              _result2 = onSuccess ? onSuccess(this.value) : this.value;
                          } catch (err) {
                              promise.reject(err);
                              continue;
                          } else if (rejected) {
                              if (!onError) {
                                  promise.reject(this.error);
                                  continue;
                              }
                              try {
                                  _result2 = onError(this.error);
                              } catch (err) {
                                  promise.reject(err);
                                  continue;
                              }
                          }
                          if (_result2 instanceof ZalgoPromise && (_result2.resolved || _result2.rejected)) {
                              var promiseResult = _result2;
                              promiseResult.resolved ? promise.resolve(promiseResult.value) : promise.reject(promiseResult.error);
                              promiseResult.errorHandled = !0;
                          } else utils_isPromise(_result2) ? _result2 instanceof ZalgoPromise && (_result2.resolved || _result2.rejected) ? _result2.resolved ? promise.resolve(_result2.value) : promise.reject(_result2.error) : chain(_result2, promise) : promise.resolve(_result2);
                      }
                      handlers.length = 0;
                      this.dispatching = !1;
                      endActive();
                  }
              };
              _proto.then = function(onSuccess, onError) {
                  if (onSuccess && "function" != typeof onSuccess && !onSuccess.call) throw new Error("Promise.then expected a function for success handler");
                  if (onError && "function" != typeof onError && !onError.call) throw new Error("Promise.then expected a function for error handler");
                  var promise = new ZalgoPromise;
                  this.handlers.push({
                      promise: promise,
                      onSuccess: onSuccess,
                      onError: onError
                  });
                  this.errorHandled = !0;
                  this.dispatch();
                  return promise;
              };
              _proto.catch = function(onError) {
                  return this.then(void 0, onError);
              };
              _proto.finally = function(onFinally) {
                  if (onFinally && "function" != typeof onFinally && !onFinally.call) throw new Error("Promise.finally expected a function");
                  return this.then((function(result) {
                      return ZalgoPromise.try(onFinally).then((function() {
                          return result;
                      }));
                  }), (function(err) {
                      return ZalgoPromise.try(onFinally).then((function() {
                          throw err;
                      }));
                  }));
              };
              _proto.timeout = function(time, err) {
                  var _this3 = this;
                  if (this.resolved || this.rejected) return this;
                  var timeout = setTimeout((function() {
                      _this3.resolved || _this3.rejected || _this3.reject(err || new Error("Promise timed out after " + time + "ms"));
                  }), time);
                  return this.then((function(result) {
                      clearTimeout(timeout);
                      return result;
                  }));
              };
              _proto.toPromise = function() {
                  if ("undefined" == typeof Promise) throw new TypeError("Could not find Promise");
                  return Promise.resolve(this);
              };
              ZalgoPromise.resolve = function(value) {
                  return value instanceof ZalgoPromise ? value : utils_isPromise(value) ? new ZalgoPromise((function(resolve, reject) {
                      return value.then(resolve, reject);
                  })) : (new ZalgoPromise).resolve(value);
              };
              ZalgoPromise.reject = function(error) {
                  return (new ZalgoPromise).reject(error);
              };
              ZalgoPromise.asyncReject = function(error) {
                  return (new ZalgoPromise).asyncReject(error);
              };
              ZalgoPromise.all = function(promises) {
                  var promise = new ZalgoPromise;
                  var count = promises.length;
                  var results = [].slice();
                  if (!count) {
                      promise.resolve(results);
                      return promise;
                  }
                  var chain = function(i, firstPromise, secondPromise) {
                      return firstPromise.then((function(res) {
                          results[i] = res;
                          0 == (count -= 1) && promise.resolve(results);
                      }), (function(err) {
                          secondPromise.reject(err);
                      }));
                  };
                  for (var i = 0; i < promises.length; i++) {
                      var prom = promises[i];
                      if (prom instanceof ZalgoPromise) {
                          if (prom.resolved) {
                              results[i] = prom.value;
                              count -= 1;
                              continue;
                          }
                      } else if (!utils_isPromise(prom)) {
                          results[i] = prom;
                          count -= 1;
                          continue;
                      }
                      chain(i, ZalgoPromise.resolve(prom), promise);
                  }
                  0 === count && promise.resolve(results);
                  return promise;
              };
              ZalgoPromise.hash = function(promises) {
                  var result = {};
                  var awaitPromises = [];
                  var _loop = function(key) {
                      if (promises.hasOwnProperty(key)) {
                          var value = promises[key];
                          utils_isPromise(value) ? awaitPromises.push(value.then((function(res) {
                              result[key] = res;
                          }))) : result[key] = value;
                      }
                  };
                  for (var key in promises) _loop(key);
                  return ZalgoPromise.all(awaitPromises).then((function() {
                      return result;
                  }));
              };
              ZalgoPromise.map = function(items, method) {
                  return ZalgoPromise.all(items.map(method));
              };
              ZalgoPromise.onPossiblyUnhandledException = function(handler) {
                  return function(handler) {
                      possiblyUnhandledPromiseHandlers.push(handler);
                      return {
                          cancel: function() {
                              possiblyUnhandledPromiseHandlers.splice(possiblyUnhandledPromiseHandlers.indexOf(handler), 1);
                          }
                      };
                  }(handler);
              };
              ZalgoPromise.try = function(method, context, args) {
                  if (method && "function" != typeof method && !method.call) throw new Error("Promise.try expected a function");
                  var result;
                  startActive();
                  try {
                      result = method.apply(context, args || []);
                  } catch (err) {
                      endActive();
                      return ZalgoPromise.reject(err);
                  }
                  endActive();
                  return ZalgoPromise.resolve(result);
              };
              ZalgoPromise.delay = function(_delay) {
                  return new ZalgoPromise((function(resolve) {
                      setTimeout(resolve, _delay);
                  }));
              };
              ZalgoPromise.isPromise = function(value) {
                  return !!(value && value instanceof ZalgoPromise) || utils_isPromise(value);
              };
              ZalgoPromise.flush = function() {
                  return function(Zalgo) {
                      var promise = flushPromise = flushPromise || new Zalgo;
                      flushActive();
                      return promise;
                  }(ZalgoPromise);
              };
              return ZalgoPromise;
          }();
          var IE_WIN_ACCESS_ERROR = "Call was rejected by callee.\r\n";
          function isAboutProtocol(win) {
              void 0 === win && (win = window);
              return "about:" === win.location.protocol;
          }
          function canReadFromWindow(win) {
              try {
                  return !0;
              } catch (err) {}
              return !1;
          }
          function getActualDomain(win) {
              void 0 === win && (win = window);
              var location = win.location;
              if (!location) throw new Error("Can not read window location");
              var protocol = location.protocol;
              if (!protocol) throw new Error("Can not read window protocol");
              if ("file:" === protocol) return "file://";
              if ("about:" === protocol) {
                  var parent = function(win) {
                      void 0 === win && (win = window);
                      if (win) try {
                          if (win.parent && win.parent !== win) return win.parent;
                      } catch (err) {}
                  }(win);
                  return parent && canReadFromWindow() ? getActualDomain(parent) : "about://";
              }
              var host = location.host;
              if (!host) throw new Error("Can not read window host");
              return protocol + "//" + host;
          }
          function getDomain(win) {
              void 0 === win && (win = window);
              var domain = getActualDomain(win);
              return domain && win.mockDomain && 0 === win.mockDomain.indexOf("mock:") ? win.mockDomain : domain;
          }
          var iframeWindows = [];
          var iframeFrames = [];
          function isWindowClosed(win, allowMock) {
              void 0 === allowMock && (allowMock = !0);
              try {
                  if (win === window) return !1;
              } catch (err) {
                  return !0;
              }
              try {
                  if (!win) return !0;
              } catch (err) {
                  return !0;
              }
              try {
                  if (win.closed) return !0;
              } catch (err) {
                  return !err || err.message !== IE_WIN_ACCESS_ERROR;
              }
              if (allowMock && function(win) {
                  if (!function(win) {
                      try {
                          if (win === window) return !0;
                      } catch (err) {}
                      try {
                          var desc = Object.getOwnPropertyDescriptor(win, "location");
                          if (desc && !1 === desc.enumerable) return !1;
                      } catch (err) {}
                      try {
                          if (isAboutProtocol(win) && canReadFromWindow()) return !0;
                      } catch (err) {}
                      try {
                          if (getActualDomain(win) === getActualDomain(window)) return !0;
                      } catch (err) {}
                      return !1;
                  }(win)) return !1;
                  try {
                      if (win === window) return !0;
                      if (isAboutProtocol(win) && canReadFromWindow()) return !0;
                      if (getDomain(window) === getDomain(win)) return !0;
                  } catch (err) {}
                  return !1;
              }(win)) try {
                  if (win.mockclosed) return !0;
              } catch (err) {}
              try {
                  if (!win.parent || !win.top) return !0;
              } catch (err) {}
              var iframeIndex = function(collection, item) {
                  for (var i = 0; i < collection.length; i++) try {
                      if (collection[i] === item) return i;
                  } catch (err) {}
                  return -1;
              }(iframeWindows, win);
              if (-1 !== iframeIndex) {
                  var frame = iframeFrames[iframeIndex];
                  if (frame && function(frame) {
                      if (!frame.contentWindow) return !0;
                      if (!frame.parentNode) return !0;
                      var doc = frame.ownerDocument;
                      if (doc && doc.documentElement && !doc.documentElement.contains(frame)) {
                          var parent = frame;
                          for (;parent.parentNode && parent.parentNode !== parent; ) parent = parent.parentNode;
                          if (!parent.host || !doc.documentElement.contains(parent.host)) return !0;
                      }
                      return !1;
                  }(frame)) return !0;
              }
              return !1;
          }
          function isWindow(obj) {
              try {
                  if (obj === window) return !0;
              } catch (err) {
                  if (err && err.message === IE_WIN_ACCESS_ERROR) return !0;
              }
              try {
                  if ("[object Window]" === {}.toString.call(obj)) return !0;
              } catch (err) {
                  if (err && err.message === IE_WIN_ACCESS_ERROR) return !0;
              }
              try {
                  if (window.Window && obj instanceof window.Window) return !0;
              } catch (err) {
                  if (err && err.message === IE_WIN_ACCESS_ERROR) return !0;
              }
              try {
                  if (obj && obj.self === obj) return !0;
              } catch (err) {
                  if (err && err.message === IE_WIN_ACCESS_ERROR) return !0;
              }
              try {
                  if (obj && obj.parent === obj) return !0;
              } catch (err) {
                  if (err && err.message === IE_WIN_ACCESS_ERROR) return !0;
              }
              try {
                  if (obj && obj.top === obj) return !0;
              } catch (err) {
                  if (err && err.message === IE_WIN_ACCESS_ERROR) return !0;
              }
              try {
                  if (obj && "__unlikely_value__" === obj.__cross_domain_utils_window_check__) return !1;
              } catch (err) {
                  return !0;
              }
              try {
                  if ("postMessage" in obj && "self" in obj && "location" in obj) return !0;
              } catch (err) {}
              return !1;
          }
          function util_safeIndexOf(collection, item) {
              for (var i = 0; i < collection.length; i++) try {
                  if (collection[i] === item) return i;
              } catch (err) {}
              return -1;
          }
          var weakmap_CrossDomainSafeWeakMap = function() {
              function CrossDomainSafeWeakMap() {
                  this.name = void 0;
                  this.weakmap = void 0;
                  this.keys = void 0;
                  this.values = void 0;
                  this.name = "__weakmap_" + (1e9 * Math.random() >>> 0) + "__";
                  if (function() {
                      if ("undefined" == typeof WeakMap) return !1;
                      if (void 0 === Object.freeze) return !1;
                      try {
                          var testWeakMap = new WeakMap;
                          var testKey = {};
                          Object.freeze(testKey);
                          testWeakMap.set(testKey, "__testvalue__");
                          return "__testvalue__" === testWeakMap.get(testKey);
                      } catch (err) {
                          return !1;
                      }
                  }()) try {
                      this.weakmap = new WeakMap;
                  } catch (err) {}
                  this.keys = [];
                  this.values = [];
              }
              var _proto = CrossDomainSafeWeakMap.prototype;
              _proto._cleanupClosedWindows = function() {
                  var weakmap = this.weakmap;
                  var keys = this.keys;
                  for (var i = 0; i < keys.length; i++) {
                      var value = keys[i];
                      if (isWindow(value) && isWindowClosed(value)) {
                          if (weakmap) try {
                              weakmap.delete(value);
                          } catch (err) {}
                          keys.splice(i, 1);
                          this.values.splice(i, 1);
                          i -= 1;
                      }
                  }
              };
              _proto.isSafeToReadWrite = function(key) {
                  return !isWindow(key);
              };
              _proto.set = function(key, value) {
                  if (!key) throw new Error("WeakMap expected key");
                  var weakmap = this.weakmap;
                  if (weakmap) try {
                      weakmap.set(key, value);
                  } catch (err) {
                      delete this.weakmap;
                  }
                  if (this.isSafeToReadWrite(key)) try {
                      var name = this.name;
                      var entry = key[name];
                      entry && entry[0] === key ? entry[1] = value : Object.defineProperty(key, name, {
                          value: [ key, value ],
                          writable: !0
                      });
                      return;
                  } catch (err) {}
                  this._cleanupClosedWindows();
                  var keys = this.keys;
                  var values = this.values;
                  var index = util_safeIndexOf(keys, key);
                  if (-1 === index) {
                      keys.push(key);
                      values.push(value);
                  } else values[index] = value;
              };
              _proto.get = function(key) {
                  if (!key) throw new Error("WeakMap expected key");
                  var weakmap = this.weakmap;
                  if (weakmap) try {
                      if (weakmap.has(key)) return weakmap.get(key);
                  } catch (err) {
                      delete this.weakmap;
                  }
                  if (this.isSafeToReadWrite(key)) try {
                      var entry = key[this.name];
                      return entry && entry[0] === key ? entry[1] : void 0;
                  } catch (err) {}
                  this._cleanupClosedWindows();
                  var index = util_safeIndexOf(this.keys, key);
                  if (-1 !== index) return this.values[index];
              };
              _proto.delete = function(key) {
                  if (!key) throw new Error("WeakMap expected key");
                  var weakmap = this.weakmap;
                  if (weakmap) try {
                      weakmap.delete(key);
                  } catch (err) {
                      delete this.weakmap;
                  }
                  if (this.isSafeToReadWrite(key)) try {
                      var entry = key[this.name];
                      entry && entry[0] === key && (entry[0] = entry[1] = void 0);
                  } catch (err) {}
                  this._cleanupClosedWindows();
                  var keys = this.keys;
                  var index = util_safeIndexOf(keys, key);
                  if (-1 !== index) {
                      keys.splice(index, 1);
                      this.values.splice(index, 1);
                  }
              };
              _proto.has = function(key) {
                  if (!key) throw new Error("WeakMap expected key");
                  var weakmap = this.weakmap;
                  if (weakmap) try {
                      if (weakmap.has(key)) return !0;
                  } catch (err) {
                      delete this.weakmap;
                  }
                  if (this.isSafeToReadWrite(key)) try {
                      var entry = key[this.name];
                      return !(!entry || entry[0] !== key);
                  } catch (err) {}
                  this._cleanupClosedWindows();
                  return -1 !== util_safeIndexOf(this.keys, key);
              };
              _proto.getOrSet = function(key, getter) {
                  if (this.has(key)) return this.get(key);
                  var value = getter();
                  this.set(key, value);
                  return value;
              };
              return CrossDomainSafeWeakMap;
          }();
          function getFunctionName(fn) {
              return fn.name || fn.__name__ || fn.displayName || "anonymous";
          }
          function setFunctionName(fn, name) {
              try {
                  delete fn.name;
                  fn.name = name;
              } catch (err) {}
              fn.__name__ = fn.displayName = name;
              return fn;
          }
          function base64encode(str) {
              if ("function" == typeof btoa) return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (function(m, p1) {
                  return String.fromCharCode(parseInt(p1, 16));
              }))).replace(/[=]/g, "");
              if ("undefined" != typeof Buffer) return Buffer.from(str, "utf8").toString("base64").replace(/[=]/g, "");
              throw new Error("Can not find window.btoa or Buffer");
          }
          function uniqueID() {
              var chars = "0123456789abcdef";
              return "uid_" + "xxxxxxxxxx".replace(/./g, (function() {
                  return chars.charAt(Math.floor(Math.random() * chars.length));
              })) + "_" + base64encode((new Date).toISOString().slice(11, 19).replace("T", ".")).replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
          }
          function getGlobal() {
              if ("undefined" != typeof window) return window;
              if ("undefined" != typeof window) return window;
              if ("undefined" != typeof global) return global;
              throw new Error("No global found");
          }
          var objectIDs;
          function serializeArgs(args) {
              try {
                  return JSON.stringify([].slice.call(args), (function(subkey, val) {
                      return "function" == typeof val ? "memoize[" + function(obj) {
                          objectIDs = objectIDs || new weakmap_CrossDomainSafeWeakMap;
                          if (null == obj || "object" != typeof obj && "function" != typeof obj) throw new Error("Invalid object");
                          var uid = objectIDs.get(obj);
                          if (!uid) {
                              uid = typeof obj + ":" + uniqueID();
                              objectIDs.set(obj, uid);
                          }
                          return uid;
                      }(val) + "]" : val;
                  }));
              } catch (err) {
                  throw new Error("Arguments not serializable -- can not be used to memoize");
              }
          }
          function getEmptyObject() {
              return {};
          }
          var memoizeGlobalIndex = 0;
          var memoizeGlobalIndexValidFrom = 0;
          function memoize(method, options) {
              void 0 === options && (options = {});
              var _options$thisNamespac = options.thisNamespace, thisNamespace = void 0 !== _options$thisNamespac && _options$thisNamespac, cacheTime = options.time;
              var simpleCache;
              var thisCache;
              var memoizeIndex = memoizeGlobalIndex;
              memoizeGlobalIndex += 1;
              var memoizedFunction = function() {
                  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
                  if (memoizeIndex < memoizeGlobalIndexValidFrom) {
                      simpleCache = null;
                      thisCache = null;
                      memoizeIndex = memoizeGlobalIndex;
                      memoizeGlobalIndex += 1;
                  }
                  var cache;
                  cache = thisNamespace ? (thisCache = thisCache || new weakmap_CrossDomainSafeWeakMap).getOrSet(this, getEmptyObject) : simpleCache = simpleCache || {};
                  var cacheKey = serializeArgs(args);
                  var cacheResult = cache[cacheKey];
                  if (cacheResult && cacheTime && Date.now() - cacheResult.time < cacheTime) {
                      delete cache[cacheKey];
                      cacheResult = null;
                  }
                  if (cacheResult) return cacheResult.value;
                  var time = Date.now();
                  var value = method.apply(this, arguments);
                  cache[cacheKey] = {
                      time: time,
                      value: value
                  };
                  return value;
              };
              memoizedFunction.reset = function() {
                  simpleCache = null;
                  thisCache = null;
              };
              return setFunctionName(memoizedFunction, (options.name || getFunctionName(method)) + "::memoized");
          }
          memoize.clear = function() {
              memoizeGlobalIndexValidFrom = memoizeGlobalIndex;
          };
          function inlineMemoize(method, logic, args) {
              void 0 === args && (args = []);
              var cache = method.__inline_memoize_cache__ = method.__inline_memoize_cache__ || {};
              var key = serializeArgs(args);
              return cache.hasOwnProperty(key) ? cache[key] : cache[key] = logic.apply(void 0, args);
          }
          function src_util_noop() {}
          function stringifyError(err, level) {
              void 0 === level && (level = 1);
              if (level >= 3) return "stringifyError stack overflow";
              try {
                  if (!err) return "<unknown error: " + {}.toString.call(err) + ">";
                  if ("string" == typeof err) return err;
                  if (err instanceof Error) {
                      var stack = err && err.stack;
                      var message = err && err.message;
                      if (stack && message) return -1 !== stack.indexOf(message) ? stack : message + "\n" + stack;
                      if (stack) return stack;
                      if (message) return message;
                  }
                  return err && err.toString && "function" == typeof err.toString ? err.toString() : {}.toString.call(err);
              } catch (newErr) {
                  return "Error while stringifying error: " + stringifyError(newErr, level + 1);
              }
          }
          function stringifyErrorMessage(err) {
              var defaultMessage = "<unknown error: " + {}.toString.call(err) + ">";
              return err ? err instanceof Error ? err.message || defaultMessage : "string" == typeof err.message && err.message || defaultMessage : defaultMessage;
          }
          memoize((function(obj) {
              if (Object.values) return Object.values(obj);
              var result = [];
              for (var key in obj) obj.hasOwnProperty(key) && result.push(obj[key]);
              return result;
          }));
          function objFilter(obj, filter) {
              void 0 === filter && (filter = Boolean);
              var result = {};
              for (var key in obj) obj.hasOwnProperty(key) && filter(obj[key], key) && (result[key] = obj[key]);
              return result;
          }
          Error;
          function isDocumentReady() {
              return Boolean(document.body) && "complete" === document.readyState;
          }
          function isDocumentInteractive() {
              return Boolean(document.body) && "interactive" === document.readyState;
          }
          var waitForDocumentReady = memoize((function() {
              return new promise_ZalgoPromise((function(resolve) {
                  if (isDocumentReady() || isDocumentInteractive()) return resolve();
                  var interval = setInterval((function() {
                      if (isDocumentReady() || isDocumentInteractive()) {
                          clearInterval(interval);
                          return resolve();
                      }
                  }), 10);
              }));
          }));
          function parseQuery(queryString) {
              return inlineMemoize(parseQuery, (function() {
                  var params = {};
                  if (!queryString) return params;
                  if (-1 === queryString.indexOf("=")) return params;
                  for (var _i2 = 0, _queryString$split2 = queryString.split("&"); _i2 < _queryString$split2.length; _i2++) {
                      var pair = _queryString$split2[_i2];
                      (pair = pair.split("="))[0] && pair[1] && (params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]));
                  }
                  return params;
              }), [ queryString ]);
          }
          function getPerformance() {
              return inlineMemoize(getPerformance, (function() {
                  var performance = window.performance;
                  if (performance && performance.now && performance.timing && performance.timing.connectEnd && performance.timing.navigationStart && Math.abs(performance.now() - Date.now()) > 1e3 && performance.now() - (performance.timing.connectEnd - performance.timing.navigationStart) > 0) return performance;
              }));
          }
          function dom_isBrowser() {
              return "undefined" != typeof window && void 0 !== window.location;
          }
          function isLocalStorageEnabled() {
              return inlineMemoize(isLocalStorageEnabled, (function() {
                  try {
                      if ("undefined" == typeof window) return !1;
                      if (window.localStorage) {
                          var value = Math.random().toString();
                          window.localStorage.setItem("__test__localStorage__", value);
                          var result = window.localStorage.getItem("__test__localStorage__");
                          window.localStorage.removeItem("__test__localStorage__");
                          if (value === result) return !0;
                      }
                  } catch (err) {}
                  return !1;
              }));
          }
          var currentScript = "undefined" != typeof document ? document.currentScript : null;
          var getCurrentScript = memoize((function() {
              if (currentScript) return currentScript;
              if (currentScript = function() {
                  try {
                      var stack = function() {
                          try {
                              throw new Error("_");
                          } catch (err) {
                              return err.stack || "";
                          }
                      }();
                      var stackDetails = /.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(stack);
                      var scriptLocation = stackDetails && stackDetails[1];
                      if (!scriptLocation) return;
                      for (var _i22 = 0, _Array$prototype$slic2 = [].slice.call(document.getElementsByTagName("script")).reverse(); _i22 < _Array$prototype$slic2.length; _i22++) {
                          var script = _Array$prototype$slic2[_i22];
                          if (script.src && script.src === scriptLocation) return script;
                      }
                  } catch (err) {}
              }()) return currentScript;
              throw new Error("Can not determine current script");
          }));
          var currentUID = uniqueID();
          memoize((function() {
              var script;
              try {
                  script = getCurrentScript();
              } catch (err) {
                  return currentUID;
              }
              var uid = script.getAttribute("data-uid");
              if (uid && "string" == typeof uid) return uid;
              if ((uid = script.getAttribute("data-uid-auto")) && "string" == typeof uid) return uid;
              if (script.src) {
                  var hashedString = function(str) {
                      var hash = "";
                      for (var i = 0; i < str.length; i++) {
                          var total = str[i].charCodeAt(0) * i;
                          str[i + 1] && (total += str[i + 1].charCodeAt(0) * (i - 1));
                          hash += String.fromCharCode(97 + Math.abs(total) % 26);
                      }
                      return hash;
                  }(JSON.stringify({
                      src: script.src,
                      dataset: script.dataset
                  }));
                  uid = "uid_" + hashedString.slice(hashedString.length - 30);
              } else uid = uniqueID();
              script.setAttribute("data-uid-auto", uid);
              return uid;
          }));
          function getStorage(_ref) {
              var name = _ref.name, _ref$lifetime = _ref.lifetime, lifetime = void 0 === _ref$lifetime ? 12e5 : _ref$lifetime;
              return inlineMemoize(getStorage, (function() {
                  var STORAGE_KEY = "__" + name + "_storage__";
                  var newStateID = uniqueID();
                  var accessedStorage;
                  function getState(handler) {
                      var localStorageEnabled = isLocalStorageEnabled();
                      var storage;
                      accessedStorage && (storage = accessedStorage);
                      if (!storage && localStorageEnabled) {
                          var rawStorage = window.localStorage.getItem(STORAGE_KEY);
                          rawStorage && (storage = JSON.parse(rawStorage));
                      }
                      storage || (storage = getGlobal()[STORAGE_KEY]);
                      storage || (storage = {
                          id: newStateID
                      });
                      storage.id || (storage.id = newStateID);
                      accessedStorage = storage;
                      var result = handler(storage);
                      localStorageEnabled ? window.localStorage.setItem(STORAGE_KEY, JSON.stringify(storage)) : getGlobal()[STORAGE_KEY] = storage;
                      accessedStorage = null;
                      return result;
                  }
                  function getID() {
                      return getState((function(storage) {
                          return storage.id;
                      }));
                  }
                  function getSession(handler) {
                      return getState((function(storage) {
                          var session = storage.__session__;
                          var now = Date.now();
                          session && now - session.created > lifetime && (session = null);
                          session || (session = {
                              guid: uniqueID(),
                              created: now
                          });
                          storage.__session__ = session;
                          return handler(session);
                      }));
                  }
                  return {
                      getState: getState,
                      getID: getID,
                      isStateFresh: function() {
                          return getID() === newStateID;
                      },
                      getSessionState: function(handler) {
                          return getSession((function(session) {
                              session.state = session.state || {};
                              return handler(session.state);
                          }));
                      },
                      getSessionID: function() {
                          return getSession((function(session) {
                              return session.guid;
                          }));
                      }
                  };
              }), [ {
                  name: name,
                  lifetime: lifetime
              } ]);
          }
          var http_headerBuilders = [];
          var AUTO_FLUSH_LEVEL = [ "warn", "error" ];
          var LOG_LEVEL_PRIORITY = [ "error", "warn", "info", "debug" ];
          var sendBeacon = function(_ref2) {
              var url = _ref2.url, data = _ref2.data, _ref2$useBlob = _ref2.useBlob, useBlob = void 0 === _ref2$useBlob || _ref2$useBlob;
              try {
                  var json = JSON.stringify(data);
                  if (useBlob) {
                      var blob = new Blob([ json ], {
                          type: "application/json"
                      });
                      return window.navigator.sendBeacon(url, blob);
                  }
                  return window.navigator.sendBeacon(url, json);
              } catch (e) {
                  return !1;
              }
          };
          function httpTransport(_ref) {
              var url = _ref.url, method = _ref.method, headers = _ref.headers, json = _ref.json, _ref$enableSendBeacon = _ref.enableSendBeacon, enableSendBeacon = void 0 !== _ref$enableSendBeacon && _ref$enableSendBeacon;
              return promise_ZalgoPromise.try((function() {
                  var beaconResult = !1;
                  (function(_ref) {
                      var headers = _ref.headers, enableSendBeacon = _ref.enableSendBeacon;
                      var hasHeaders = headers && Object.keys(headers).length;
                      return !!(window && window.navigator.sendBeacon && !hasHeaders && enableSendBeacon && window.Blob);
                  })({
                      headers: headers,
                      enableSendBeacon: enableSendBeacon
                  }) && (beaconResult = function(url) {
                      return "https://api2.amplitude.com/2/httpapi" === url;
                  }(url) ? sendBeacon({
                      url: url,
                      data: json,
                      useBlob: !1
                  }) : sendBeacon({
                      url: url,
                      data: json,
                      useBlob: !0
                  }));
                  return beaconResult || function(_ref) {
                      var url = _ref.url, _ref$method = _ref.method, method = void 0 === _ref$method ? "get" : _ref$method, _ref$headers = _ref.headers, headers = void 0 === _ref$headers ? {} : _ref$headers, json = _ref.json, data = _ref.data, body = _ref.body, _ref$win = _ref.win, win = void 0 === _ref$win ? window : _ref$win, _ref$timeout = _ref.timeout, timeout = void 0 === _ref$timeout ? 0 : _ref$timeout;
                      return new promise_ZalgoPromise((function(resolve, reject) {
                          if (json && data || json && body || data && json) throw new Error("Only options.json or options.data or options.body should be passed");
                          var normalizedHeaders = {};
                          for (var _i4 = 0, _Object$keys2 = Object.keys(headers); _i4 < _Object$keys2.length; _i4++) {
                              var _key2 = _Object$keys2[_i4];
                              normalizedHeaders[_key2.toLowerCase()] = headers[_key2];
                          }
                          json ? normalizedHeaders["content-type"] = normalizedHeaders["content-type"] || "application/json" : (data || body) && (normalizedHeaders["content-type"] = normalizedHeaders["content-type"] || "application/x-www-form-urlencoded; charset=utf-8");
                          normalizedHeaders.accept = normalizedHeaders.accept || "application/json";
                          for (var _i6 = 0; _i6 < http_headerBuilders.length; _i6++) {
                              var builtHeaders = (0, http_headerBuilders[_i6])();
                              for (var _i8 = 0, _Object$keys4 = Object.keys(builtHeaders); _i8 < _Object$keys4.length; _i8++) {
                                  var _key3 = _Object$keys4[_i8];
                                  normalizedHeaders[_key3.toLowerCase()] = builtHeaders[_key3];
                              }
                          }
                          var xhr = new win.XMLHttpRequest;
                          xhr.addEventListener("load", (function() {
                              var responseHeaders = function(rawHeaders) {
                                  void 0 === rawHeaders && (rawHeaders = "");
                                  var result = {};
                                  for (var _i2 = 0, _rawHeaders$trim$spli2 = rawHeaders.trim().split("\n"); _i2 < _rawHeaders$trim$spli2.length; _i2++) {
                                      var _line$split = _rawHeaders$trim$spli2[_i2].split(":"), _key = _line$split[0], values = _line$split.slice(1);
                                      result[_key.toLowerCase()] = values.join(":").trim();
                                  }
                                  return result;
                              }(this.getAllResponseHeaders());
                              if (!this.status) return reject(new Error("Request to " + method.toLowerCase() + " " + url + " failed: no response status code."));
                              var contentType = responseHeaders["content-type"];
                              var isJSON = contentType && (0 === contentType.indexOf("application/json") || 0 === contentType.indexOf("text/json"));
                              var responseBody = this.responseText;
                              try {
                                  responseBody = JSON.parse(responseBody);
                              } catch (err) {
                                  if (isJSON) return reject(new Error("Invalid json: " + this.responseText + "."));
                              }
                              return resolve({
                                  status: this.status,
                                  headers: responseHeaders,
                                  body: responseBody
                              });
                          }), !1);
                          xhr.addEventListener("error", (function(evt) {
                              reject(new Error("Request to " + method.toLowerCase() + " " + url + " failed: " + evt.toString() + "."));
                          }), !1);
                          xhr.open(method, url, !0);
                          for (var _key4 in normalizedHeaders) normalizedHeaders.hasOwnProperty(_key4) && xhr.setRequestHeader(_key4, normalizedHeaders[_key4]);
                          json ? body = JSON.stringify(json) : data && (body = Object.keys(data).map((function(key) {
                              return encodeURIComponent(key) + "=" + (data ? encodeURIComponent(data[key]) : "");
                          })).join("&"));
                          xhr.timeout = timeout;
                          xhr.ontimeout = function() {
                              reject(new Error("Request to " + method.toLowerCase() + " " + url + " has timed out"));
                          };
                          xhr.send(body);
                      }));
                  }({
                      url: url,
                      method: method,
                      headers: headers,
                      json: json
                  });
              })).then(src_util_noop);
          }
          function extendIfDefined(target, source) {
              for (var key in source) source.hasOwnProperty(key) && source[key] && !target[key] && (target[key] = source[key]);
          }
          var _FUNDING_SKIP_LOGIN, _AMPLITUDE_API_KEY;
          (_FUNDING_SKIP_LOGIN = {}).paypal = "paypal", _FUNDING_SKIP_LOGIN.paylater = "paypal", 
          _FUNDING_SKIP_LOGIN.credit = "paypal";
          var AMPLITUDE_API_KEY = ((_AMPLITUDE_API_KEY = {}).test = "a23fb4dfae56daf7c3212303b53a8527", 
          _AMPLITUDE_API_KEY.local = "a23fb4dfae56daf7c3212303b53a8527", _AMPLITUDE_API_KEY.stage = "a23fb4dfae56daf7c3212303b53a8527", 
          _AMPLITUDE_API_KEY.sandbox = "a23fb4dfae56daf7c3212303b53a8527", _AMPLITUDE_API_KEY.production = "ce423f79daba95faeb0694186170605c", 
          _AMPLITUDE_API_KEY);
          function getLogger() {
              return inlineMemoize(getLogger, (function() {
                  return function(_ref2) {
                      var url = _ref2.url, prefix = _ref2.prefix, _ref2$logLevel = _ref2.logLevel, logLevel = void 0 === _ref2$logLevel ? "warn" : _ref2$logLevel, _ref2$transport = _ref2.transport, transport = void 0 === _ref2$transport ? httpTransport : _ref2$transport, amplitudeApiKey = _ref2.amplitudeApiKey, _ref2$flushInterval = _ref2.flushInterval, flushInterval = void 0 === _ref2$flushInterval ? 6e4 : _ref2$flushInterval, _ref2$enableSendBeaco = _ref2.enableSendBeacon, enableSendBeacon = void 0 !== _ref2$enableSendBeaco && _ref2$enableSendBeaco;
                      var events = [];
                      var tracking = [];
                      var payloadBuilders = [];
                      var metaBuilders = [];
                      var trackingBuilders = [];
                      var headerBuilders = [];
                      function print(level, event, payload) {
                          if (dom_isBrowser() && window.console && window.console.log && !(LOG_LEVEL_PRIORITY.indexOf(level) > LOG_LEVEL_PRIORITY.indexOf(logLevel))) {
                              var args = [ event ];
                              args.push(payload);
                              (payload.error || payload.warning) && args.push("\n\n", payload.error || payload.warning);
                              try {
                                  window.console[level] && window.console[level].apply ? window.console[level].apply(window.console, args) : window.console.log && window.console.log.apply && window.console.log.apply(window.console, args);
                              } catch (err) {}
                          }
                      }
                      function immediateFlush() {
                          return promise_ZalgoPromise.try((function() {
                              if (dom_isBrowser() && "file:" !== window.location.protocol && (events.length || tracking.length)) {
                                  var meta = {};
                                  for (var _i2 = 0; _i2 < metaBuilders.length; _i2++) extendIfDefined(meta, (0, metaBuilders[_i2])(meta));
                                  var headers = {};
                                  for (var _i4 = 0; _i4 < headerBuilders.length; _i4++) extendIfDefined(headers, (0, 
                                  headerBuilders[_i4])(headers));
                                  var res;
                                  url && (res = transport({
                                      method: "POST",
                                      url: url,
                                      headers: headers,
                                      json: {
                                          events: events,
                                          meta: meta,
                                          tracking: tracking
                                      },
                                      enableSendBeacon: enableSendBeacon
                                  }).catch(src_util_noop));
                                  amplitudeApiKey && transport({
                                      method: "POST",
                                      url: "https://api2.amplitude.com/2/httpapi",
                                      headers: {},
                                      json: {
                                          api_key: amplitudeApiKey,
                                          events: tracking.map((function(payload) {
                                              return _extends({
                                                  event_type: payload.transition_name || "event",
                                                  event_properties: payload
                                              }, payload);
                                          }))
                                      },
                                      enableSendBeacon: enableSendBeacon
                                  }).catch(src_util_noop);
                                  events = [];
                                  tracking = [];
                                  return promise_ZalgoPromise.resolve(res).then(src_util_noop);
                              }
                          }));
                      }
                      var flush = function(method, delay) {
                          void 0 === delay && (delay = 50);
                          var promise;
                          var timeout;
                          return setFunctionName((function() {
                              timeout && clearTimeout(timeout);
                              var localPromise = promise = promise || new promise_ZalgoPromise;
                              timeout = setTimeout((function() {
                                  promise = null;
                                  timeout = null;
                                  promise_ZalgoPromise.try(method).then((function(result) {
                                      localPromise.resolve(result);
                                  }), (function(err) {
                                      localPromise.reject(err);
                                  }));
                              }), delay);
                              return localPromise;
                          }), getFunctionName(method) + "::promiseDebounced");
                      }(immediateFlush);
                      function log(level, event, payload) {
                          void 0 === payload && (payload = {});
                          if (!dom_isBrowser()) return logger;
                          prefix && (event = prefix + "_" + event);
                          var logPayload = _extends({}, objFilter(payload), {
                              timestamp: Date.now().toString()
                          });
                          for (var _i6 = 0; _i6 < payloadBuilders.length; _i6++) extendIfDefined(logPayload, (0, 
                          payloadBuilders[_i6])(logPayload));
                          !function(level, event, payload) {
                              events.push({
                                  level: level,
                                  event: event,
                                  payload: payload
                              });
                              -1 !== AUTO_FLUSH_LEVEL.indexOf(level) && flush();
                          }(level, event, logPayload);
                          print(level, event, logPayload);
                          return logger;
                      }
                      function addBuilder(builders, builder) {
                          builders.push(builder);
                          return logger;
                      }
                      dom_isBrowser() && (method = flush, time = flushInterval, function loop() {
                          setTimeout((function() {
                              method();
                              loop();
                          }), time);
                      }());
                      var method, time;
                      if ("object" == typeof window) {
                          window.addEventListener("beforeunload", (function() {
                              immediateFlush();
                          }));
                          window.addEventListener("unload", (function() {
                              immediateFlush();
                          }));
                          window.addEventListener("pagehide", (function() {
                              immediateFlush();
                          }));
                      }
                      var logger = {
                          debug: function(event, payload) {
                              return log("debug", event, payload);
                          },
                          info: function(event, payload) {
                              return log("info", event, payload);
                          },
                          warn: function(event, payload) {
                              return log("warn", event, payload);
                          },
                          error: function(event, payload) {
                              return log("error", event, payload);
                          },
                          track: function(payload) {
                              void 0 === payload && (payload = {});
                              if (!dom_isBrowser()) return logger;
                              var trackingPayload = objFilter(payload);
                              for (var _i8 = 0; _i8 < trackingBuilders.length; _i8++) extendIfDefined(trackingPayload, (0, 
                              trackingBuilders[_i8])(trackingPayload));
                              print("debug", "track", trackingPayload);
                              tracking.push(trackingPayload);
                              return logger;
                          },
                          flush: flush,
                          immediateFlush: immediateFlush,
                          addPayloadBuilder: function(builder) {
                              return addBuilder(payloadBuilders, builder);
                          },
                          addMetaBuilder: function(builder) {
                              return addBuilder(metaBuilders, builder);
                          },
                          addTrackingBuilder: function(builder) {
                              return addBuilder(trackingBuilders, builder);
                          },
                          addHeaderBuilder: function(builder) {
                              return addBuilder(headerBuilders, builder);
                          },
                          setTransport: function(newTransport) {
                              transport = newTransport;
                              return logger;
                          },
                          configure: function(opts) {
                              opts.url && (url = opts.url);
                              opts.prefix && (prefix = opts.prefix);
                              opts.logLevel && (logLevel = opts.logLevel);
                              opts.transport && (transport = opts.transport);
                              opts.amplitudeApiKey && (amplitudeApiKey = opts.amplitudeApiKey);
                              opts.flushInterval && (flushInterval = opts.flushInterval);
                              opts.enableSendBeacon && (enableSendBeacon = opts.enableSendBeacon);
                              return logger;
                          }
                      };
                      return logger;
                  }({
                      url: "/xoplatform/logger/api/logger",
                      enableSendBeacon: !0
                  });
              }));
          }
          function isIOSSafari() {
              return isIos() && function(ua) {
                  void 0 === ua && (ua = getUserAgent());
                  return /Safari/.test(ua) && !isChrome(ua);
              }();
          }
          function getPayPal() {
              if (!window.paypal) throw new Error("paypal not found");
              return window.paypal;
          }
          function isAndroidAppInstalled(appId) {
              return window.navigator && window.navigator.getInstalledRelatedApps ? window.navigator.getInstalledRelatedApps().then((function(result) {
                  if (result && result.length) {
                      var apps = result.filter((function(app) {
                          return app.id === appId;
                      }));
                      return promise_ZalgoPromise.resolve(apps && apps.length ? {
                          id: apps[0].id,
                          installed: !0,
                          version: apps[0].version
                      } : {
                          installed: !1
                      });
                  }
                  return promise_ZalgoPromise.resolve({
                      installed: !0
                  });
              })) : promise_ZalgoPromise.resolve({
                  installed: !0
              });
          }
          function setupNativePopup(_ref) {
              var _logger$info$track;
              var parentDomain = _ref.parentDomain, env = _ref.env, sessionID = _ref.sessionID, buttonSessionID = _ref.buttonSessionID, sdkCorrelationID = _ref.sdkCorrelationID, clientID = _ref.clientID, fundingSource = _ref.fundingSource, locale = _ref.locale, buyerCountry = _ref.buyerCountry;
              var appInstalledPromise = promise_ZalgoPromise.resolve({
                  installed: !0
              });
              var logger = function(_ref) {
                  var env = _ref.env, sessionID = _ref.sessionID, buttonSessionID = _ref.buttonSessionID, sdkCorrelationID = _ref.sdkCorrelationID, clientID = _ref.clientID, fundingSource = _ref.fundingSource, sdkVersion = _ref.sdkVersion, locale = _ref.locale, buyerCountry = _ref.buyerCountry;
                  var logger = getLogger();
                  !function(_ref2) {
                      var env = _ref2.env, sessionID = _ref2.sessionID, clientID = _ref2.clientID, sdkCorrelationID = _ref2.sdkCorrelationID, buyerCountry = _ref2.buyerCountry, locale = _ref2.locale, sdkVersion = _ref2.sdkVersion, fundingSource = _ref2.fundingSource;
                      var logger = getLogger();
                      logger.addPayloadBuilder((function() {
                          return {
                              referer: window.location.host,
                              sdkCorrelationID: sdkCorrelationID,
                              sessionID: sessionID,
                              clientID: clientID,
                              env: env
                          };
                      }));
                      logger.addTrackingBuilder((function() {
                          var _ref3;
                          var lang = locale.lang, country = locale.country;
                          return (_ref3 = {}).feed_name = "payments_sdk", _ref3.serverside_data_source = "checkout", 
                          _ref3.client_id = clientID, _ref3.page_session_id = sessionID, _ref3.referer_url = window.location.host, 
                          _ref3.buyer_cntry = buyerCountry, _ref3.locale = lang + "_" + country, _ref3.integration_identifier = clientID, 
                          _ref3.sdk_environment = isIos() ? "iOS" : isAndroid() ? "android" : null, _ref3.sdk_name = "payments_sdk", 
                          _ref3.sdk_version = sdkVersion, _ref3.user_agent = window.navigator && window.navigator.userAgent, 
                          _ref3.context_correlation_id = sdkCorrelationID, _ref3.t = Date.now().toString(), 
                          _ref3.selected_payment_method = fundingSource, _ref3;
                      }));
                      promise_ZalgoPromise.onPossiblyUnhandledException((function(err) {
                          var _logger$track;
                          logger.track(((_logger$track = {}).ext_error_code = "payments_sdk_error", _logger$track.ext_error_desc = stringifyErrorMessage(err), 
                          _logger$track));
                          logger.error("unhandled_error", {
                              err: stringifyError(err)
                          });
                          logger.flush().catch(src_util_noop);
                      }));
                  }({
                      env: env,
                      sessionID: sessionID,
                      clientID: clientID,
                      sdkCorrelationID: sdkCorrelationID,
                      locale: locale,
                      sdkVersion: sdkVersion,
                      buyerCountry: buyerCountry,
                      fundingSource: fundingSource
                  });
                  !function(_ref) {
                      var env = _ref.env;
                      getLogger().configure({
                          amplitudeApiKey: AMPLITUDE_API_KEY[env]
                      });
                  }({
                      env: env
                  });
                  logger.addPayloadBuilder((function() {
                      var _ref2;
                      return (_ref2 = {
                          buttonSessionID: buttonSessionID
                      }).user_id = buttonSessionID, _ref2;
                  }));
                  logger.addTrackingBuilder((function() {
                      var _ref3;
                      return (_ref3 = {}).state_name = "smart_button", _ref3.context_type = "button_session_id", 
                      _ref3.context_id = buttonSessionID, _ref3.button_session_id = buttonSessionID, _ref3.button_version = "5.0.51", 
                      _ref3.user_id = buttonSessionID, _ref3;
                  }));
                  (function() {
                      if (window.document.documentMode) try {
                          var status = window.status;
                          window.status = "testIntranetMode";
                          if ("testIntranetMode" === window.status) {
                              window.status = status;
                              return !0;
                          }
                          return !1;
                      } catch (err) {
                          return !1;
                      }
                      return !1;
                  })() && logger.warn("button_child_intranet_mode");
                  promise_ZalgoPromise.hash({
                      pageRenderTime: waitForDocumentReady().then((function() {
                          var performance = getPerformance();
                          if (performance) {
                              var timing = performance.timing;
                              return timing.connectEnd && timing.domInteractive ? timing.domInteractive - timing.connectEnd : void 0;
                          }
                      }))
                  }).then((function(_ref4) {
                      var _logger$track;
                      var pageRenderTime = _ref4.pageRenderTime;
                      logger.track(((_logger$track = {}).transition_name = "process_button_load", _logger$track.merchant_selected_funding_source = fundingSource, 
                      _logger$track.page_load_time = pageRenderTime ? pageRenderTime.toString() : "", 
                      _logger$track));
                      logger.flush();
                  }));
                  return logger;
              }({
                  env: env,
                  sessionID: sessionID,
                  buttonSessionID: buttonSessionID,
                  sdkCorrelationID: sdkCorrelationID,
                  clientID: clientID,
                  fundingSource: fundingSource,
                  sdkVersion: getPayPal().version,
                  locale: locale,
                  buyerCountry: buyerCountry
              });
              logger.info("native_popup_init", {
                  buttonSessionID: buttonSessionID,
                  href: base64encode(window.location.href)
              }).track((_logger$info$track = {}, _logger$info$track.transition_name = "native_popup_init", 
              _logger$info$track.info_msg = base64encode(window.location.href), _logger$info$track)).flush();
              var sfvc = isSFVC();
              var sfvcOrSafari = !sfvc && function(ua) {
                  void 0 === ua && (ua = getUserAgent());
                  if (isIos(ua)) {
                      var sfvc = isSFVC(ua);
                      var device = iPhoneScreenHeightMatrix[window.outerHeight];
                      if (!device) return !1;
                      var height = window.innerHeight;
                      var scale = Math.round(window.screen.width / window.innerWidth * 100) / 100;
                      var computedHeight = Math.round(height * scale);
                      var possibleSafariSizes = device.maybeSafari;
                      var maybeSafari = !1;
                      scale > 1 && possibleSafariSizes[scale] && -1 !== possibleSafariSizes[scale].indexOf(computedHeight) && (maybeSafari = !0);
                      return sfvc || maybeSafari;
                  }
                  return !1;
              }();
              var logMessage = sfvc ? "sfvc" : sfvcOrSafari ? "sfvcOrSafari" : "browser";
              if (isIOSSafari()) {
                  var _logger$info$track2;
                  var height = window.innerHeight;
                  var scale = Math.round(window.screen.width / window.innerWidth * 100) / 100;
                  var computedHeight = Math.round(height * scale);
                  var log = "native_popup_init_" + logMessage;
                  logger.info(log).track((_logger$info$track2 = {}, _logger$info$track2.transition_name = log, 
                  _logger$info$track2.info_msg = "computed height: " + computedHeight + ", height: " + window.outerHeight + ", width: " + window.outerWidth + ", innerHeight: " + height + ", scale: " + scale, 
                  _logger$info$track2)).flush();
              }
              window.addEventListener("beforeunload", (function() {
                  var _logger$info$track3;
                  logger.info("native_popup_beforeunload").track((_logger$info$track3 = {}, _logger$info$track3.transition_name = "native_popup_beforeunload", 
                  _logger$info$track3)).flush();
              }));
              window.addEventListener("unload", (function() {
                  var _logger$info$track4;
                  logger.info("native_popup_unload").track((_logger$info$track4 = {}, _logger$info$track4.transition_name = "native_popup_unload", 
                  _logger$info$track4)).flush();
              }));
              window.addEventListener("pagehide", (function() {
                  var _logger$info$track5;
                  logger.info("native_popup_pagehide").track((_logger$info$track5 = {}, _logger$info$track5.transition_name = "native_popup_pagehide", 
                  _logger$info$track5)).flush();
              }));
              isAndroid() && isChrome() && ("paypal" === fundingSource ? appInstalledPromise = isAndroidAppInstalled("com.paypal.android.p2pmobile").then((function(app) {
                  return _extends({}, app);
              })).catch((function(err) {
                  var _logger$info$track6;
                  logger.info("native_popup_android_paypal_app_installed_error").track((_logger$info$track6 = {}, 
                  _logger$info$track6.transition_name = "native_popup_android_paypal_app_installed_error", 
                  _logger$info$track6.int_error_desc = "Error: " + stringifyErrorMessage(err), _logger$info$track6)).flush();
                  return {
                      installed: !0
                  };
              })) : "venmo" === fundingSource && (appInstalledPromise = isAndroidAppInstalled("com.venmo").then((function(app) {
                  return _extends({}, app);
              })).catch((function(err) {
                  var _logger$info$track7;
                  logger.info("native_popup_android_venmo_app_installed_error").track((_logger$info$track7 = {}, 
                  _logger$info$track7.transition_name = "native_popup_android_venmo_app_installed_error", 
                  _logger$info$track7.int_error_desc = "Error: " + stringifyErrorMessage(err), _logger$info$track7)).flush();
                  return {
                      installed: !0
                  };
              }))));
              var replaceHash = function(hash) {
                  return window.location.replace("#" + hash.replace(/^#/, ""));
              };
              var closeWindow = function() {
                  window.close();
                  replaceHash("closed");
              };
              var getRawHash = function() {
                  return (window.location.hash || "none").replace(/^#/, "").replace(/\?.+/, "");
              };
              var opener = window.opener;
              if (!opener) {
                  var _logger$info$info$tra;
                  if (isIOSSafari()) {
                      var _logger$info$track8;
                      var _log = "popup_no_opener_hash_" + getRawHash() + "_" + logMessage;
                      logger.info(_log).track((_logger$info$track8 = {}, _logger$info$track8.transition_name = _log, 
                      _logger$info$track8)).flush();
                  }
                  logger.info("native_popup_no_opener", {
                      buttonSessionID: buttonSessionID,
                      href: base64encode(window.location.href)
                  }).info("native_popup_no_opener_hash_" + getRawHash()).track((_logger$info$info$tra = {}, 
                  _logger$info$info$tra.transition_name = "popup_no_opener_hash_" + getRawHash(), 
                  _logger$info$info$tra.info_msg = "location: " + base64encode(window.location.href), 
                  _logger$info$info$tra)).flush().then(closeWindow);
                  throw new Error("Expected window to have opener");
              }
              !function(win, callback, delay, maxtime) {
                  void 0 === delay && (delay = 1e3);
                  void 0 === maxtime && (maxtime = 1 / 0);
                  var timeout;
                  !function check() {
                      if (isWindowClosed(win)) {
                          timeout && clearTimeout(timeout);
                          logger.info("native_popup_opener_detect_close").track((_logger$info$track9 = {}, 
                          _logger$info$track9.transition_name = "native_popup_opener_detect_close", _logger$info$track9)).flush().then(closeWindow);
                      } else {
                          var _logger$info$track9;
                          if (maxtime <= 0) clearTimeout(timeout); else {
                              maxtime -= delay;
                              timeout = setTimeout(check, delay);
                          }
                      }
                  }();
              }(window.opener, 0, 500);
              var clean = (tasks = [], cleaned = !1, cleaner = {
                  set: function(name, item) {
                      if (!cleaned) {
                          (void 0)[name] = item;
                          cleaner.register((function() {
                              delete (void 0)[name];
                          }));
                      }
                      return item;
                  },
                  register: function(method) {
                      cleaned ? method(cleanErr) : tasks.push(function(method) {
                          var called = !1;
                          return setFunctionName((function() {
                              if (!called) {
                                  called = !0;
                                  return method.apply(this, arguments);
                              }
                          }), getFunctionName(method) + "::once");
                      }((function() {
                          return method(cleanErr);
                      })));
                  },
                  all: function(err) {
                      cleanErr = err;
                      var results = [];
                      cleaned = !0;
                      for (;tasks.length; ) {
                          var task = tasks.shift();
                          results.push(task());
                      }
                      return promise_ZalgoPromise.all(results).then(src_util_noop);
                  }
              });
              var tasks, cleaned, cleanErr, cleaner;
              var postRobot = function() {
                  var paypal = getPayPal();
                  if (!paypal.postRobot) throw new Error("paypal.postRobot not found");
                  return paypal.postRobot;
              }();
              var sendToParent = function(event, payload) {
                  void 0 === payload && (payload = {});
                  return postRobot.send(opener, event, payload, {
                      domain: parentDomain
                  }).then((function(_ref2) {
                      return _ref2.data;
                  }));
              };
              var handleHash = function() {
                  var _logger$info$track10;
                  if (window.location.hash && "#" !== window.location.hash) {
                      var _hashString$split = (window.location.hash && window.location.hash.slice(1)).split("?"), hash = _hashString$split[0], queryString = _hashString$split[1];
                      var _parseQuery = parseQuery(queryString), appVersion = _parseQuery.appVersion, bundleIdentifier = _parseQuery.bundleIdentifier;
                      logger.info("native_popup_hashchange", {
                          hash: hash,
                          queryString: queryString
                      }).track((_logger$info$track10 = {}, _logger$info$track10.transition_name = "popup_hashchange", 
                      _logger$info$track10.mobile_app_version = appVersion, _logger$info$track10.mapv = bundleIdentifier, 
                      _logger$info$track10.info_msg = "" + window.location.href, _logger$info$track10)).flush();
                      switch (hash) {
                        case "init":
                        case "loaded":
                        case "appswitch":
                        case "webswitch":
                        case "closed":
                          break;
  
                        case "onApprove":
                          var _parseQuery2 = parseQuery(queryString);
                          sendToParent("onApprove", {
                              payerID: _parseQuery2.payerID,
                              paymentID: _parseQuery2.paymentID,
                              billingToken: _parseQuery2.billingToken
                          }).finally(closeWindow);
                          break;
  
                        case "onCancel":
                          sendToParent("onCancel").finally(closeWindow);
                          break;
  
                        case "fallback":
                          var _parseQuery3 = parseQuery(queryString);
                          sendToParent("onFallback", {
                              type: _parseQuery3.type,
                              skip_native_duration: _parseQuery3.skip_native_duration,
                              fallback_reason: _parseQuery3.fallback_reason
                          });
                          break;
  
                        case "onError":
                          var _parseQuery4 = parseQuery(queryString);
                          sendToParent("onError", {
                              message: _parseQuery4.message
                          }).finally(closeWindow);
                          break;
  
                        case "close":
                          sendToParent("onComplete").finally(closeWindow);
                          break;
  
                        case "test":
                          break;
  
                        default:
                          sendToParent("onError", {
                              message: "Invalid event sent from native, " + hash + ", from URL, " + window.location.href
                          }).finally(closeWindow);
                      }
                  }
              };
              window.addEventListener("hashchange", handleHash);
              clean.register((function() {
                  return window.removeEventListener("hashchange", handleHash);
              }));
              replaceHash("loaded");
              handleHash();
              var stickinessID = getStorage({
                  name: "paypal"
              }).getID();
              var pageUrl = window.location.href.split("#")[0] + "#close";
              appInstalledPromise.then((function(app) {
                  sendToParent("awaitRedirect", {
                      app: app,
                      pageUrl: pageUrl,
                      sfvc: sfvc = !!sfvc || !0 === sfvcOrSafari,
                      stickinessID: stickinessID
                  }).then((function(_ref3) {
                      var _ref3$redirect = _ref3.redirect, redirectUrl = _ref3.redirectUrl, _ref3$appSwitch = _ref3.appSwitch, appSwitch = void 0 === _ref3$appSwitch || _ref3$appSwitch;
                      if (void 0 === _ref3$redirect || _ref3$redirect) {
                          replaceHash(appSwitch ? "appswitch" : "webswitch");
                          window.location.replace(redirectUrl);
                          var didRedirect = !1;
                          var markRedirect = function() {
                              didRedirect = !0;
                          };
                          window.addEventListener("beforeunload", markRedirect);
                          clean.register((function() {
                              return window.removeEventListener("beforeunload", markRedirect);
                          }));
                          window.addEventListener("unload", markRedirect);
                          clean.register((function() {
                              return window.removeEventListener("unload", markRedirect);
                          }));
                          window.addEventListener("pagehide", markRedirect);
                          clean.register((function() {
                              return window.removeEventListener("pagehide", markRedirect);
                          }));
                          if (appSwitch) {
                              var timer = setTimeout((function() {
                                  didRedirect || sendToParent("detectAppSwitch");
                              }), 1500);
                              clean.register((function() {
                                  return clearTimeout(timer);
                              }));
                          }
                      }
                  }));
              }));
              return {
                  destroy: function() {
                      return clean.all();
                  }
              };
          }
          function _renderChildren(children, renderer) {
              var result = [];
              for (var _i2 = 0; _i2 < children.length; _i2++) {
                  var renderedChild = children[_i2].render(renderer);
                  if (renderedChild) if (Array.isArray(renderedChild)) for (var _i4 = 0; _i4 < renderedChild.length; _i4++) {
                      var subchild = renderedChild[_i4];
                      subchild && result.push(subchild);
                  } else result.push(renderedChild);
              }
              return result;
          }
          var node_ElementNode = function() {
              function ElementNode(name, props, children) {
                  this.type = "element";
                  this.name = void 0;
                  this.props = void 0;
                  this.children = void 0;
                  this.onRender = void 0;
                  this.name = name;
                  this.props = props || {};
                  this.children = children;
                  var onRender = this.props.onRender;
                  if ("function" == typeof onRender) {
                      this.onRender = onRender;
                      delete props.onRender;
                  }
              }
              var _proto = ElementNode.prototype;
              _proto.render = function(renderer) {
                  var el = renderer(this);
                  this.onRender && this.onRender(el);
                  return el;
              };
              _proto.renderChildren = function(renderer) {
                  return _renderChildren(this.children, renderer);
              };
              return ElementNode;
          }();
          var node_FragmentNode = function() {
              function FragmentNode(children) {
                  this.type = "fragment";
                  this.children = void 0;
                  this.children = children;
              }
              FragmentNode.prototype.render = function(renderer) {
                  return _renderChildren(this.children, renderer);
              };
              return FragmentNode;
          }();
          var node_TextNode = function() {
              function TextNode(text) {
                  this.type = "text";
                  this.text = void 0;
                  this.text = text;
              }
              TextNode.prototype.render = function(renderer) {
                  return renderer(this);
              };
              return TextNode;
          }();
          var node_ComponentNode = function() {
              function ComponentNode(component, props, children) {
                  this.type = "component";
                  this.component = void 0;
                  this.props = void 0;
                  this.children = void 0;
                  this.component = component;
                  this.props = props || {};
                  this.children = children;
                  this.props.children = children;
              }
              var _proto4 = ComponentNode.prototype;
              _proto4.renderComponent = function(renderer) {
                  var child = function(child) {
                      var children = normalizeChildren(Array.isArray(child) ? child : [ child ]);
                      return 1 === children.length ? children[0] : children.length > 1 ? new node_FragmentNode(children) : void 0;
                  }(this.component(this.props, this.children));
                  if (child) return child.render(renderer);
              };
              _proto4.render = function(renderer) {
                  return renderer(this);
              };
              _proto4.renderChildren = function(renderer) {
                  return _renderChildren(this.children, renderer);
              };
              return ComponentNode;
          }();
          function normalizeChildren(children) {
              var result = [];
              for (var _i6 = 0; _i6 < children.length; _i6++) {
                  var child = children[_i6];
                  if (child) if ("string" == typeof child || "number" == typeof child) result.push(new node_TextNode(child.toString())); else {
                      if ("boolean" == typeof child) continue;
                      if (Array.isArray(child)) for (var _i8 = 0, _normalizeChildren2 = normalizeChildren(child); _i8 < _normalizeChildren2.length; _i8++) result.push(_normalizeChildren2[_i8]); else {
                          if (!child || "element" !== child.type && "text" !== child.type && "component" !== child.type) throw new TypeError("Unrecognized node type: " + typeof child);
                          result.push(child);
                      }
                  }
              }
              return result;
          }
          var node_node = function(element, props) {
              for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) children[_key - 2] = arguments[_key];
              children = normalizeChildren(children);
              if ("string" == typeof element) return new node_ElementNode(element, props, children);
              if ("function" == typeof element) return new node_ComponentNode(element, props, children);
              throw new TypeError("Expected jsx element to be a string or a function");
          };
          var Fragment = function(props, children) {
              return children;
          };
          var _ADD_CHILDREN;
          var ADD_CHILDREN = ((_ADD_CHILDREN = {}).iframe = function(el, node) {
              var firstChild = node.children[0];
              if (1 !== node.children.length || !firstChild || "element" !== firstChild.type || "html" !== firstChild.name) throw new Error("Expected only single html element node as child of iframe element");
              el.addEventListener("load", (function() {
                  var win = el.contentWindow;
                  if (!win) throw new Error("Expected frame to have contentWindow");
                  var doc = win.document;
                  var docElement = doc.documentElement;
                  for (;docElement.children && docElement.children.length; ) docElement.removeChild(docElement.children[0]);
                  var child = firstChild.render(function(opts) {
                      void 0 === opts && (opts = {});
                      var _opts$doc = opts.doc, doc = void 0 === _opts$doc ? document : _opts$doc;
                      return function domRenderer(node) {
                          if ("component" === node.type) return node.renderComponent(domRenderer);
                          if ("text" === node.type) return function(doc, node) {
                              return doc.createTextNode(node.text);
                          }(doc, node);
                          if ("element" === node.type) {
                              var el = function(doc, node) {
                                  return node.props.el ? node.props.el : doc.createElement(node.name);
                              }(doc, node);
                              !function(el, node) {
                                  var props = node.props;
                                  for (var _i4 = 0, _Object$keys2 = Object.keys(props); _i4 < _Object$keys2.length; _i4++) {
                                      var prop = _Object$keys2[_i4];
                                      var val = props[prop];
                                      null != val && "el" !== prop && "innerHTML" !== prop && (prop.match(/^on[A-Z][a-z]/) && "function" == typeof val ? el.addEventListener(prop.slice(2).toLowerCase(), val) : "string" == typeof val || "number" == typeof val ? el.setAttribute(prop, val.toString()) : "boolean" == typeof val && !0 === val && el.setAttribute(prop, ""));
                                  }
                                  "iframe" !== el.tagName.toLowerCase() || props.id || el.setAttribute("id", "jsx-iframe-" + "xxxxxxxxxx".replace(/./g, (function() {
                                      return "0123456789abcdef".charAt(Math.floor(Math.random() * "0123456789abcdef".length));
                                  })));
                              }(el, node);
                              !function(el, node, doc, renderer) {
                                  if (node.props.hasOwnProperty("innerHTML")) {
                                      if (node.children.length) throw new Error("Expected no children to be passed when innerHTML prop is set");
                                      var html = node.props.innerHTML;
                                      if ("string" != typeof html) throw new TypeError("innerHTML prop must be string");
                                      if ("script" === node.name) el.text = html; else {
                                          el.innerHTML = html;
                                          !function(el, doc) {
                                              void 0 === doc && (doc = window.document);
                                              for (var _i2 = 0, _el$querySelectorAll2 = el.querySelectorAll("script"); _i2 < _el$querySelectorAll2.length; _i2++) {
                                                  var script = _el$querySelectorAll2[_i2];
                                                  var parentNode = script.parentNode;
                                                  if (parentNode) {
                                                      var newScript = doc.createElement("script");
                                                      newScript.text = script.textContent;
                                                      parentNode.replaceChild(newScript, script);
                                                  }
                                              }
                                          }(el, doc);
                                      }
                                  } else (ADD_CHILDREN[node.name] || ADD_CHILDREN.default)(el, node, renderer);
                              }(el, node, doc, domRenderer);
                              return el;
                          }
                          throw new TypeError("Unhandleable node");
                      };
                  }({
                      doc: doc
                  }));
                  for (;child.children.length; ) docElement.appendChild(child.children[0]);
              }));
          }, _ADD_CHILDREN.script = function(el, node) {
              var firstChild = node.children[0];
              if (1 !== node.children.length || !firstChild || "text" !== firstChild.type) throw new Error("Expected only single text node as child of script element");
              el.text = firstChild.text;
          }, _ADD_CHILDREN.default = function(el, node, renderer) {
              for (var _i6 = 0, _node$renderChildren2 = node.renderChildren(renderer); _i6 < _node$renderChildren2.length; _i6++) el.appendChild(_node$renderChildren2[_i6]);
          }, _ADD_CHILDREN);
          function Spinner(_ref) {
              return node_node("div", {
                  class: "preloader spinner"
              }, node_node("style", {
                  nonce: _ref.nonce,
                  innerHTML: "\n\n    body {\n        width: 100%;\n        height: 100%;\n        overflow: hidden;\n        position: fixed;\n        top: 0;\n        left: 0;\n        margin: 0;\n    }\n\n    .spinner {\n        height: 100%;\n        width: 100%;\n        position: absolute;\n        z-index: 10\n    }\n\n    .spinner .spinWrap {\n        width: 200px;\n        height: 100px;\n        position: absolute;\n        top: 50%;\n        left: 50%;\n        margin-left: -100px;\n        margin-top: -50px\n    }\n\n    .spinner .loader,\n    .spinner .spinnerImage {\n        height: 100px;\n        width: 100px;\n        position: absolute;\n        top: 0;\n        left: 50%;\n        opacity: 1;\n        filter: alpha(opacity=100)\n    }\n\n    .spinner .spinnerImage {\n        margin: 28px 0 0 -25px;\n        background: url(https://www.paypalobjects.com/images/checkout/hermes/icon_ot_spin_lock_skinny.png) no-repeat\n    }\n\n    .spinner .loader {\n        margin: 0 0 0 -55px;\n        background-color: transparent;\n        animation: rotation .7s infinite linear;\n        border-left: 5px solid #cbcbca;\n        border-right: 5px solid #cbcbca;\n        border-bottom: 5px solid #cbcbca;\n        border-top: 5px solid #2380be;\n        border-radius: 100%\n    }\n\n    @keyframes rotation {\n        from {\n            transform: rotate(0deg)\n        }\n        to {\n            transform: rotate(359deg)\n        }\n    }\n"
              }), node_node("div", {
                  class: "spinWrap"
              }, node_node("p", {
                  class: "spinnerImage"
              }), node_node("p", {
                  class: "loader"
              })));
          }
          function VenmoSpinner(_ref) {
              return node_node(Fragment, null, node_node("style", {
                  nonce: _ref.nonce,
                  innerHTML: '\n    body {\n        width: 100%;\n        height: 100%;\n        overflow: hidden;\n        position: fixed;\n        top: 0;\n        left: 0;\n        margin: 0;\n    }\n    .spinner {\n        color: official;\n        display: inline-block;\n        width: 80px;\n        height: 80px;\n        position: absolute;\n        left: 50%;\n        top: 50%;\n        -webkit-transform: translate(-50%, -50%);\n        transform: translate(-50%, -50%);\n    }\n    .spinner div {\n        transform-origin: 40px 40px;\n        animation: spinner 1.2s linear infinite;\n    }\n    .spinner div:after {\n        content: " ";\n        display: block;\n        position: absolute;\n        top: 20px;\n        left: 37px;\n        width: 3px;\n        height: 10px;\n        border-radius: 30%;\n        background: #808080;\n    }\n    .spinner div:nth-child(1) {\n        transform: rotate(0deg);\n        animation-delay: -1.1s;\n    }\n    .spinner div:nth-child(2) {\n        transform: rotate(30deg);\n        animation-delay: -1s;\n    }\n    .spinner div:nth-child(3) {\n        transform: rotate(60deg);\n        animation-delay: -0.9s;\n    }\n    .spinner div:nth-child(4) {\n        transform: rotate(90deg);\n        animation-delay: -0.8s;\n    }\n    .spinner div:nth-child(5) {\n        transform: rotate(120deg);\n        animation-delay: -0.7s;\n    }\n    .spinner div:nth-child(6) {\n        transform: rotate(150deg);\n        animation-delay: -0.6s;\n    }\n    .spinner div:nth-child(7) {\n        transform: rotate(180deg);\n        animation-delay: -0.5s;\n    }\n    .spinner div:nth-child(8) {\n        transform: rotate(210deg);\n        animation-delay: -0.4s;\n    }\n    .spinner div:nth-child(9) {\n        transform: rotate(240deg);\n        animation-delay: -0.3s;\n    }\n    .spinner div:nth-child(10) {\n        transform: rotate(270deg);\n        animation-delay: -0.2s;\n    }\n    .spinner div:nth-child(11) {\n        transform: rotate(300deg);\n        animation-delay: -0.1s;\n    }\n    .spinner div:nth-child(12) {\n        transform: rotate(330deg);\n        animation-delay: 0s;\n    }\n    @keyframes spinner {\n        0% {\n            opacity: 1;\n        }\n        100% {\n            opacity: 0;\n        }\n    }\n'
              }), node_node("div", {
                  class: "spinner"
              }, node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null), node_node("div", null)));
          }
          function NativePopup(_ref) {
              return node_node("venmo" === _ref.fundingSource ? VenmoSpinner : Spinner, {
                  nonce: _ref.cspNonce
              });
          }
      } ]);
  }));