New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

post-robot

Package Overview
Dependencies
Maintainers
2
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

post-robot - npm Package Compare versions

Comparing version 9.0.13 to 9.0.14

44

dist/module/bridge/bridge.js
import 'zalgo-promise/src';
import { getParent, isWindowClosed } from 'cross-domain-utils/src';
import { noop } from 'belter/src';
import { noop, uniqueID } from 'belter/src';
import { MESSAGE_NAME, WILDCARD } from '../conf';
import { global } from '../global';
import { global, globalStore } from '../global';

@@ -21,23 +21,7 @@ /*

global.tunnelWindows = global.tunnelWindows || {};
global.tunnelWindowId = 0;
var tunnelWindows = globalStore('tunnelWindows');
function deleteTunnelWindow(id) {
try {
if (global.tunnelWindows[id]) {
delete global.tunnelWindows[id].source;
}
} catch (err) {
// pass
}
delete global.tunnelWindows[id];
}
function cleanTunnelWindows() {
var tunnelWindows = global.tunnelWindows;
for (var _i2 = 0, _Object$keys2 = Object.keys(tunnelWindows), _length2 = _Object$keys2 == null ? 0 : _Object$keys2.length; _i2 < _length2; _i2++) {
var key = _Object$keys2[_i2];
for (var _i2 = 0, _tunnelWindows$keys2 = tunnelWindows.keys(), _length2 = _tunnelWindows$keys2 == null ? 0 : _tunnelWindows$keys2.length; _i2 < _length2; _i2++) {
var key = _tunnelWindows$keys2[_i2];
var tunnelWindow = tunnelWindows[key];

@@ -48,3 +32,3 @@

} catch (err) {
deleteTunnelWindow(key);
tunnelWindows.del(key);
continue;

@@ -54,3 +38,3 @@ }

if (isWindowClosed(tunnelWindow.source)) {
deleteTunnelWindow(key);
tunnelWindows.del(key);
}

@@ -67,11 +51,7 @@ }

cleanTunnelWindows();
global.tunnelWindowId += 1;
global.tunnelWindows[global.tunnelWindowId] = { name: name, source: source, canary: canary, sendMessage: sendMessage };
return global.tunnelWindowId;
var id = uniqueID();
tunnelWindows.set(id, { name: name, source: source, canary: canary, sendMessage: sendMessage });
return id;
}
function getTunnelWindow(id) {
return global.tunnelWindows[id];
}
global.openTunnelToParent = function openTunnelToParent(_ref2) {

@@ -98,3 +78,3 @@ var name = _ref2.name,

var tunnelWindow = getTunnelWindow(id);
var tunnelWindow = tunnelWindows.get(id);

@@ -105,3 +85,3 @@ try {

} catch (err) {
deleteTunnelWindow(id);
tunnelWindows.del(id);
return;

@@ -108,0 +88,0 @@ }

@@ -1,7 +0,7 @@

import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { ZalgoPromise } from 'zalgo-promise/src';
import { getDomain, isSameDomain, isOpener, isSameTopWindow, matchDomain, getUserAgent, getDomainFromUrl } from 'cross-domain-utils/src';
import { noop } from 'belter/src';
import { CONFIG, BRIDGE_NAME_PREFIX } from '../conf';
import { global } from '../global';
import { windowStore } from '../global';

@@ -94,22 +94,22 @@ export function needsBridgeForBrowser() {

global.remoteWindows = global.remoteWindows || new WeakMap();
var remoteWindows = windowStore('remoteWindows');
export function registerRemoteWindow(win) {
global.remoteWindows.set(win, { sendMessagePromise: new ZalgoPromise() });
remoteWindows.getOrSet(win, function () {
return new ZalgoPromise();
});
}
export function findRemoteWindow(win) {
return global.remoteWindows.get(win);
var remoteWin = remoteWindows.get(win);
if (!remoteWin) {
throw new Error('Remote window not found');
}
return remoteWin;
}
export function registerRemoteSendMessage(win, domain, sendMessage) {
var remoteWindow = findRemoteWindow(win);
if (!remoteWindow) {
throw new Error('Window not found to register sendMessage to');
}
var sendMessageWrapper = function sendMessageWrapper(remoteWin, remoteDomain, message) {
if (remoteWin !== win) {

@@ -126,15 +126,7 @@ throw new Error('Remote window does not match window');

remoteWindow.sendMessagePromise.resolve(sendMessageWrapper);
remoteWindow.sendMessagePromise = ZalgoPromise.resolve(sendMessageWrapper);
findRemoteWindow(win).resolve(sendMessageWrapper);
}
export function rejectRemoteSendMessage(win, err) {
var remoteWindow = findRemoteWindow(win);
if (!remoteWindow) {
throw new Error('Window not found on which to reject sendMessage');
}
remoteWindow.sendMessagePromise.asyncReject(err);
findRemoteWindow(win).reject(err)['catch'](noop);
}

@@ -151,11 +143,5 @@

var remoteWindow = findRemoteWindow(win);
if (!remoteWindow) {
throw new Error('Window not found to send message to');
}
return remoteWindow.sendMessagePromise.then(function (sendMessage) {
return findRemoteWindow(win).then(function (sendMessage) {
return sendMessage(win, domain, message);
});
}

@@ -1,2 +0,1 @@

import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { ZalgoPromise } from 'zalgo-promise/src';

@@ -7,12 +6,11 @@ import { getDomain, getFrameByName, isWindowClosed, getDomainFromUrl } from 'cross-domain-utils/src';

import { awaitWindowHello } from '../lib';
import { global } from '../global';
import { global, windowStore, globalStore } from '../global';
import { getBridgeName, documentBodyReady, registerRemoteSendMessage, registerRemoteWindow } from './common';
global.bridges = global.bridges || {};
global.bridgeFrames = global.bridgeFrames || {};
var bridges = globalStore('bridges');
var bridgeFrames = globalStore('bridgeFrames');
var popupWindowsByName = globalStore('popupWindowsByName');
var popupWindowsByWin = windowStore('popupWindowsByWin');
global.popupWindowsByWin = global.popupWindowsByWin || new WeakMap();
global.popupWindowsByName = global.popupWindowsByName || {};
function listenForRegister(source, domain) {

@@ -36,15 +34,19 @@ global.on(MESSAGE_NAME.OPEN_TUNNEL, { window: source, domain: domain }, function (_ref) {

if (!global.popupWindowsByName[data.name]) {
if (!popupWindowsByName.has(data.name)) {
throw new Error('Window with name ' + data.name + ' does not exist, or was not opened by this window');
}
if (!global.popupWindowsByName[data.name].domain) {
// $FlowFixMe
if (!popupWindowsByName.get(data.name).domain) {
throw new Error('We do not have a registered domain for window ' + data.name);
}
if (global.popupWindowsByName[data.name].domain !== origin) {
throw new Error('Message origin ' + origin + ' does not matched registered window origin ' + global.popupWindowsByName[data.name].domain);
// $FlowFixMe
if (popupWindowsByName.get(data.name).domain !== origin) {
// $FlowFixMe
throw new Error('Message origin ' + origin + ' does not matched registered window origin ' + popupWindowsByName.get(data.name).domain);
}
registerRemoteSendMessage(global.popupWindowsByName[data.name].win, domain, data.sendMessage);
// $FlowFixMe
registerRemoteSendMessage(popupWindowsByName.get(data.name).win, domain, data.sendMessage);

@@ -58,3 +60,3 @@ return {

var winDetails = global.popupWindowsByName[data.name];
var winDetails = popupWindowsByName.get(data.name);

@@ -103,53 +105,47 @@ if (!winDetails) {

export function hasBridge(url, domain) {
domain = domain || getDomainFromUrl(url);
return Boolean(global.bridges[domain]);
return bridges.has(domain || getDomainFromUrl(url));
}
export function openBridge(url, domain) {
domain = domain || getDomainFromUrl(url);
if (global.bridges[domain]) {
return global.bridges[domain];
}
return bridges.getOrSet(domain, function () {
return ZalgoPromise['try'](function () {
global.bridges[domain] = ZalgoPromise['try'](function () {
if (getDomain() === domain) {
throw new Error('Can not open bridge on the same domain as current domain: ' + domain);
}
if (getDomain() === domain) {
throw new Error('Can not open bridge on the same domain as current domain: ' + domain);
}
var name = getBridgeName(domain);
var frame = getFrameByName(window, name);
var name = getBridgeName(domain);
var frame = getFrameByName(window, name);
if (frame) {
throw new Error('Frame with name ' + name + ' already exists on page');
}
if (frame) {
throw new Error('Frame with name ' + name + ' already exists on page');
}
var iframe = openBridgeFrame(name, url);
bridgeFrames.set(domain, iframe);
var iframe = openBridgeFrame(name, url);
global.bridgeFrames[domain] = iframe;
return documentBodyReady.then(function (body) {
return documentBodyReady.then(function (body) {
body.appendChild(iframe);
body.appendChild(iframe);
var bridge = iframe.contentWindow;
var bridge = iframe.contentWindow;
listenForRegister(bridge, domain);
listenForRegister(bridge, domain);
return new ZalgoPromise(function (resolve, reject) {
return new ZalgoPromise(function (resolve, reject) {
iframe.onload = resolve;
iframe.onerror = reject;
}).then(function () {
iframe.onload = resolve;
iframe.onerror = reject;
}).then(function () {
return awaitWindowHello(bridge, CONFIG.BRIDGE_TIMEOUT, 'Bridge ' + url);
}).then(function () {
return awaitWindowHello(bridge, CONFIG.BRIDGE_TIMEOUT, 'Bridge ' + url);
}).then(function () {
return bridge;
return bridge;
});
});
});
});
return global.bridges[domain];
}

@@ -184,6 +180,7 @@

for (var _i2 = 0, _Object$keys2 = Object.keys(global.popupWindowsByName), _length2 = _Object$keys2 == null ? 0 : _Object$keys2.length; _i2 < _length2; _i2++) {
var winName = _Object$keys2[_i2];
if (isWindowClosed(global.popupWindowsByName[winName].win)) {
delete global.popupWindowsByName[winName];
for (var _i2 = 0, _popupWindowsByName$k2 = popupWindowsByName.keys(), _length2 = _popupWindowsByName$k2 == null ? 0 : _popupWindowsByName$k2.length; _i2 < _length2; _i2++) {
var winName = _popupWindowsByName$k2[_i2];
// $FlowFixMe
if (isWindowClosed(popupWindowsByName.get(winName).win)) {
popupWindowsByName.del(winName);
}

@@ -193,10 +190,15 @@ }

if (name && win) {
var winOptions = global.popupWindowsByWin.get(win) || global.popupWindowsByName[name] || {};
var winOptions = popupWindowsByWin.getOrSet(win, function () {
return {};
});
// $FlowFixMe
winOptions.name = winOptions.name || name;
// $FlowFixMe
winOptions.win = winOptions.win || win;
// $FlowFixMes
winOptions.domain = winOptions.domain || domain;
global.popupWindowsByWin.set(win, winOptions);
global.popupWindowsByName[name] = winOptions;
popupWindowsByWin.set(win, winOptions);
popupWindowsByName.set(name, winOptions);
}

@@ -208,7 +210,5 @@

export function linkUrl(win, url) {
var winOptions = global.popupWindowsByWin.get(win);
if (winOptions) {
winOptions.domain = getDomainFromUrl(url);
if (popupWindowsByWin.has(win)) {
// $FlowFixMe
popupWindowsByWin.get(win).domain = getDomainFromUrl(url);
registerRemoteWindow(win);

@@ -219,6 +219,6 @@ }

export function destroyBridges() {
for (var _i4 = 0, _Object$keys4 = Object.keys(global.bridgeFrames), _length4 = _Object$keys4 == null ? 0 : _Object$keys4.length; _i4 < _length4; _i4++) {
var domain = _Object$keys4[_i4];
var frame = global.bridgeFrames[domain];
if (frame.parentNode) {
for (var _i4 = 0, _bridgeFrames$keys2 = bridgeFrames.keys(), _length4 = _bridgeFrames$keys2 == null ? 0 : _bridgeFrames$keys2.length; _i4 < _length4; _i4++) {
var domain = _bridgeFrames$keys2[_i4];
var frame = bridgeFrames.get(domain);
if (frame && frame.parentNode) {
frame.parentNode.removeChild(frame);

@@ -228,4 +228,4 @@ }

global.bridgeFrames = {};
global.bridges = {};
bridgeFrames.reset();
bridges.reset();
}
import 'cross-domain-utils/src';
import { global } from './global';
import { requestPromises } from './public';
export function cleanUpWindow(win) {
// global.tunnelWindows
// global.bridges
// global.popupWindowsByName
// global.responseListeners
// global.requestListeners
var requestPromises = global.requestPromises.get(win);
if (requestPromises) {
for (var _i2 = 0, _length2 = requestPromises == null ? 0 : requestPromises.length; _i2 < _length2; _i2++) {
var promise = requestPromises[_i2];
promise.reject(new Error('No response from window - cleaned up'));
}
for (var _i2 = 0, _requestPromises$get2 = requestPromises.get(win, []), _length2 = _requestPromises$get2 == null ? 0 : _requestPromises$get2.length; _i2 < _length2; _i2++) {
var promise = _requestPromises$get2[_i2];
promise.reject(new Error('Window cleaned up before response'));
}
if (global.popupWindowsByWin) {
global.popupWindowsByWin['delete'](win);
}
if (global.remoteWindows) {
global.remoteWindows['delete'](win);
}
global.requestPromises['delete'](win);
global.methods['delete'](win);
global.helloPromises['delete'](win);
}
import 'zalgo-promise/src';
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { matchDomain } from 'cross-domain-utils/src';
import { isRegex } from 'belter/src';
import { isRegex, getOrSet } from 'belter/src';
import { global } from '../global';
import { global, globalStore, windowStore } from '../global';
import { WILDCARD } from '../conf';
var responseListeners = globalStore('responseListeners');
var requestListeners = windowStore('requestListeners');
var erroredResponseListeners = globalStore('erroredResponseListeners');
export function resetListeners() {
global.responseListeners = {};
global.requestListeners = {};
responseListeners.reset();
erroredResponseListeners.reset();
}
global.responseListeners = global.responseListeners || {};
global.requestListeners = global.requestListeners || {};
global.WINDOW_WILDCARD = global.WINDOW_WILDCARD || new function WindowWildcard() {/* pass */}();
global.erroredResponseListeners = global.erroredResponseListeners || {};
var __DOMAIN_REGEX__ = '__domain_regex__';
export function addResponseListener(hash, listener) {
global.responseListeners[hash] = listener;
responseListeners.set(hash, listener);
}
export function getResponseListener(hash) {
return global.responseListeners[hash];
return responseListeners.get(hash);
}
export function deleteResponseListener(hash) {
delete global.responseListeners[hash];
responseListeners.del(hash);
}
export function markResponseListenerErrored(hash) {
global.erroredResponseListeners[hash] = true;
erroredResponseListeners.set(hash, true);
}
export function isResponseListenerErrored(hash) {
return Boolean(global.erroredResponseListeners[hash]);
return erroredResponseListeners.has(hash);
}

@@ -60,25 +59,28 @@

var nameListeners = global.requestListeners[name];
if (!nameListeners) {
return;
}
for (var _i2 = 0, _ref3 = [win, global.WINDOW_WILDCARD], _length2 = _ref3 == null ? 0 : _ref3.length; _i2 < _length2; _i2++) {
var winQualifier = _ref3[_i2];
if (!winQualifier) {
continue;
}
var winListeners = winQualifier && nameListeners.get(winQualifier);
var nameListeners = requestListeners.get(winQualifier);
if (!winListeners) {
if (!nameListeners) {
continue;
}
var domainListeners = nameListeners[name];
if (!domainListeners) {
continue;
}
if (domain && typeof domain === 'string') {
if (winListeners[domain]) {
return winListeners[domain];
if (domainListeners[domain]) {
return domainListeners[domain];
}
if (winListeners[__DOMAIN_REGEX__]) {
for (var _i4 = 0, _winListeners$__DOMAI2 = winListeners[__DOMAIN_REGEX__], _length4 = _winListeners$__DOMAI2 == null ? 0 : _winListeners$__DOMAI2.length; _i4 < _length4; _i4++) {
var _ref5 = _winListeners$__DOMAI2[_i4];
if (domainListeners[__DOMAIN_REGEX__]) {
for (var _i4 = 0, _domainListeners$__DO2 = domainListeners[__DOMAIN_REGEX__], _length4 = _domainListeners$__DO2 == null ? 0 : _domainListeners$__DO2.length; _i4 < _length4; _i4++) {
var _ref5 = _domainListeners$__DO2[_i4];
var regex = _ref5.regex,

@@ -94,4 +96,4 @@ listener = _ref5.listener;

if (winListeners[WILDCARD]) {
return winListeners[WILDCARD];
if (domainListeners[WILDCARD]) {
return domainListeners[WILDCARD];
}

@@ -101,3 +103,2 @@ }

// eslint-disable-next-line complexity
export function addRequestListener(_ref6, listener) {

@@ -169,35 +170,23 @@ var name = _ref6.name,

var requestListeners = global.requestListeners;
var nameListeners = requestListeners.getOrSet(win, function () {
return {};
});
// $FlowFixMe
var domainListeners = getOrSet(nameListeners, name, function () {
return {};
});
var nameListeners = requestListeners[name];
if (!nameListeners) {
nameListeners = new WeakMap();
requestListeners[name] = nameListeners;
}
var winListeners = nameListeners.get(win);
if (!winListeners) {
winListeners = {};
nameListeners.set(win, winListeners);
}
var strDomain = domain.toString();
var regexListeners = winListeners[__DOMAIN_REGEX__];
var regexListeners = void 0;
var regexListener = void 0;
if (isRegex(domain)) {
if (!regexListeners) {
regexListeners = [];
winListeners[__DOMAIN_REGEX__] = regexListeners;
}
regexListeners = getOrSet(domainListeners, __DOMAIN_REGEX__, function () {
return [];
});
regexListener = { regex: domain, listener: listener };
regexListeners.push(regexListener);
} else {
winListeners[strDomain] = listener;
domainListeners[strDomain] = listener;
}

@@ -207,17 +196,23 @@

cancel: function cancel() {
if (!winListeners) {
return;
}
delete domainListeners[strDomain];
delete winListeners[strDomain];
if (regexListener) {
regexListeners.splice(regexListeners.indexOf(regexListener, 1));
if (win && Object.keys(winListeners).length === 0) {
nameListeners['delete'](win);
if (!regexListeners.length) {
delete domainListeners[__DOMAIN_REGEX__];
}
}
if (regexListener) {
regexListeners.splice(regexListeners.indexOf(regexListener, 1));
if (!Object.keys(domainListeners).length) {
// $FlowFixMe
delete nameListeners[name];
}
// $FlowFixMe
if (win && !Object.keys(nameListeners).length) {
requestListeners.del(win);
}
}
};
}

@@ -9,7 +9,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

import { deserializeMessage } from '../../serialize';
import { global } from '../../global';
import { global, globalStore } from '../../global';
import { RECEIVE_MESSAGE_TYPES } from './types';
global.receivedMessages = global.receivedMessages || [];
var receivedMessages = globalStore('receivedMessages');

@@ -83,8 +83,8 @@ function parseMessage(message, source, origin) {

if (global.receivedMessages.indexOf(message.id) === -1) {
global.receivedMessages.push(message.id);
} else {
if (receivedMessages.has(message.id)) {
return;
}
receivedMessages.set(message.id, true);
if (__DEBUG__) {

@@ -91,0 +91,0 @@ var level = void 0;

@@ -0,9 +1,90 @@

import 'cross-domain-utils/src';
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { getOrSet } from 'belter/src';
import { WINDOW_PROP } from './conf';
export var global = window[WINDOW_PROP.POSTROBOT] = window[WINDOW_PROP.POSTROBOT] || {};
var winStore = global.windowStore = global.windowStore || new WeakMap();
// Backwards compatibility
var getObj = function getObj() {
return {};
};
global.registerSelf = function () {
// pass
};
// $FlowFixMe
export function windowStore(key) {
var defStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getObj;
function getStore(win) {
return winStore.getOrSet(win, defStore);
}
return {
has: function has(win) {
var store = getStore(win);
return store.hasOwnProperty(key);
},
get: function get(win, defVal) {
var store = getStore(win);
// $FlowFixMe
return store.hasOwnProperty(key) ? store[key] : defVal;
},
set: function set(win, val) {
var store = getStore(win);
store[key] = val;
return val;
},
del: function del(win) {
var store = getStore(win);
delete store[key];
},
getOrSet: function getOrSet(win, getter) {
var store = getStore(win);
if (store.hasOwnProperty(key)) {
return store[key];
}
var val = getter();
store[key] = val;
return val;
}
};
}
// $FlowFixMe
export function globalStore(key) {
var defStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getObj;
var store = getOrSet(global, key, defStore);
return {
has: function has(storeKey) {
return store.hasOwnProperty(storeKey);
},
get: function get(storeKey, defVal) {
// $FlowFixMe
return store.hasOwnProperty(storeKey) ? store[storeKey] : defVal;
},
set: function set(storeKey, val) {
store[storeKey] = val;
return val;
},
del: function del(storeKey) {
delete store[storeKey];
},
getOrSet: function getOrSet(storeKey, getter) {
if (store.hasOwnProperty(storeKey)) {
return store[storeKey];
}
var val = getter();
store[storeKey] = val;
return val;
},
reset: function reset() {
store = defStore();
},
keys: function keys() {
return Object.keys(store);
}
};
}

@@ -1,2 +0,1 @@

import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { getAllWindows } from 'cross-domain-utils/src';

@@ -7,10 +6,9 @@ import { ZalgoPromise } from 'zalgo-promise/src';

import { MESSAGE_NAME, WILDCARD } from '../conf';
import { global } from '../global';
import { global, windowStore } from '../global';
global.instanceID = global.instanceID || uniqueID();
global.helloPromises = global.helloPromises || new WeakMap();
global.onHello = global.onHello || [];
var helloPromises = windowStore('helloPromises');
function getHelloPromise(win) {
return global.helloPromises.getOrSet(win, function () {
return helloPromises.getOrSet(win, function () {
return new ZalgoPromise();

@@ -17,0 +15,0 @@ });

@@ -1,12 +0,13 @@

import { WeakMap } from 'cross-domain-safe-weakmap/src';
import 'cross-domain-utils/src';
global.knownWindows = global.knownWindows || new WeakMap();
import { windowStore } from '../global';
var knownWindows = windowStore('knownWindows');
export function markWindowKnown(win) {
global.knownWindows.set(win, true);
knownWindows.set(win, true);
}
export function isWindowKnown(win) {
return global.knownWindows.get(win, false);
return knownWindows.get(win, false);
}
export { _send as send };
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { ZalgoPromise } from 'zalgo-promise/src';

@@ -10,5 +9,5 @@ import { getAncestor, isAncestor, isWindowClosed, getDomain, matchDomain } from 'cross-domain-utils/src';

import { awaitWindowHello, sayHello, isWindowKnown } from '../lib';
import { global } from '../global';
import { global, windowStore } from '../global';
global.requestPromises = global.requestPromises || new WeakMap();
export var requestPromises = windowStore('requestPromises');

@@ -79,9 +78,6 @@ export function request(options) {

var requestPromises = global.requestPromises.get(win);
var reqPromises = requestPromises.getOrSet(win, function () {
return [];
});
if (!requestPromises) {
requestPromises = [];
global.requestPromises.set(win, requestPromises);
}
var requestPromise = ZalgoPromise['try'](function () {

@@ -129,3 +125,3 @@

hasResult = true;
requestPromises.splice(requestPromises.indexOf(requestPromise, 1));
reqPromises.splice(reqPromises.indexOf(requestPromise, 1));
}

@@ -211,3 +207,3 @@

requestPromises.push(requestPromise);
reqPromises.push(requestPromise);

@@ -214,0 +210,0 @@ return requestPromise;

@@ -1,2 +0,1 @@

import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { matchDomain } from 'cross-domain-utils/src';

@@ -8,8 +7,8 @@ import { ZalgoPromise } from 'zalgo-promise/src';

import { MESSAGE_NAME, WILDCARD, SERIALIZATION_TYPE } from '../conf';
import { global } from '../global';
import { global, windowStore, globalStore } from '../global';
import { ProxyWindow } from './window';
global.methods = global.methods || new WeakMap();
global.proxyWindowMethods = global.proxyWindowMethods || {};
var methodStore = windowStore('methodStore');
var proxyWindowMethods = globalStore('proxyWindowMethods');
global.listeningForFunctions = global.listeningForFunctions || false;

@@ -33,4 +32,6 @@

return ZalgoPromise['try'](function () {
var methods = global.methods.get(source) || {};
var meth = methods[data.id] || global.proxyWindowMethods[id];
var methods = methodStore.get(source, function () {
return {};
});
var meth = methods[data.id] || proxyWindowMethods.get(id);

@@ -47,6 +48,7 @@ if (!meth) {

if (!matchDomain(domain, origin)) {
throw new Error('Method domain ' + meth.domain + ' does not match origin ' + origin);
throw new Error('Method domain ' + JSON.stringify(meth.domain) + ' does not match origin ' + origin);
}
if (proxy) {
// $FlowFixMe
return proxy.matchWindow(source).then(function (match) {

@@ -56,4 +58,2 @@ if (!match) {

}
delete global.proxyWindowMethods[id];
return val;

@@ -79,5 +79,14 @@ });

if (ProxyWindow.isProxyWindow(destination)) {
global.proxyWindowMethods[id] = { proxy: destination, domain: domain, val: val };
proxyWindowMethods.set(id, { proxy: destination, domain: domain, val: val });
// $FlowFixMe
destination.awaitWindow().then(function (win) {
proxyWindowMethods.del(id);
var methods = methodStore.getOrSet(win, function () {
return {};
});
methods[id] = { domain: domain, val: val };
});
} else {
var methods = global.methods.getOrSet(destination, function () {
// $FlowFixMe
var methods = methodStore.getOrSet(destination, function () {
return {};

@@ -84,0 +93,0 @@ });

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
import { isSameDomain, isWindowClosed } from 'cross-domain-utils/src';
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { ZalgoPromise } from 'zalgo-promise/src';
import { uniqueID, getOrSet, memoizePromise } from 'belter/src';
import { uniqueID, memoizePromise } from 'belter/src';
import { serializeType } from 'universal-serialize/src';
import { SERIALIZATION_TYPE } from '../conf';
import { global } from '../global';
import { windowStore, globalStore } from '../global';
import { getWindowInstanceID } from '../lib';
global.winToProxyWindow = global.winToProxyWindow || new WeakMap();
global.idToProxyWindow = global.idToProxyWindow || {};
var winToProxyWindow = windowStore('winToProxyWindow');
var idToProxyWindow = globalStore('idToProxyWindow');
function cleanupProxyWindows() {
for (var _i2 = 0, _idToProxyWindow$keys2 = idToProxyWindow.keys(), _length2 = _idToProxyWindow$keys2 == null ? 0 : _idToProxyWindow$keys2.length; _i2 < _length2; _i2++) {
var _id = _idToProxyWindow$keys2[_i2];
// $FlowFixMe
if (idToProxyWindow.get(_id).shouldClean()) {
delete idToProxyWindow[_id];
}
}
}
export var ProxyWindow = function () {

@@ -153,2 +162,6 @@ function ProxyWindow(serializedWindow, actualWindow) {

ProxyWindow.prototype.shouldClean = function shouldClean() {
return this.actualWindow && isWindowClosed(this.actualWindow);
};
ProxyWindow.unwrap = function unwrap(win) {

@@ -161,2 +174,4 @@ return ProxyWindow.isProxyWindow(win)

ProxyWindow.serialize = function serialize(win) {
cleanupProxyWindows();
return ProxyWindow.toProxyWindow(win).serialize();

@@ -166,3 +181,5 @@ };

ProxyWindow.deserialize = function deserialize(serializedWindow) {
return getOrSet(global.idToProxyWindow, serializedWindow.id, function () {
cleanupProxyWindows();
return idToProxyWindow.getOrSet(serializedWindow.id, function () {
return new ProxyWindow(serializedWindow);

@@ -177,2 +194,4 @@ });

ProxyWindow.toProxyWindow = function toProxyWindow(win) {
cleanupProxyWindows();
if (ProxyWindow.isProxyWindow(win)) {

@@ -183,6 +202,7 @@ // $FlowFixMe

return global.winToProxyWindow.getOrSet(win, function () {
// $FlowFixMe
return winToProxyWindow.getOrSet(win, function () {
var id = uniqueID();
global.idToProxyWindow[id] = new ProxyWindow({
return idToProxyWindow.set(id, new ProxyWindow({
id: id,

@@ -234,5 +254,3 @@ getInstanceID: function getInstanceID() {

// $FlowFixMe
}, win);
return global.idToProxyWindow[id];
}, win));
});

@@ -239,0 +257,0 @@ };

@@ -1,2 +0,2 @@

!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("postRobot",[],e):"object"==typeof exports?exports.postRobot=e():n.postRobot=e()}("undefined"!=typeof self?self:this,function(){return function(n){var e={};function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:r})},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=14)}([function(n,e,t){"use strict";var r=t(15);t.d(e,"getActualDomain",function(){return r.a}),t.d(e,"getAllWindows",function(){return r.b}),t.d(e,"getAncestor",function(){return r.c}),t.d(e,"getDomain",function(){return r.d}),t.d(e,"getDomainFromUrl",function(){return r.e}),t.d(e,"getFrameByName",function(){return r.f}),t.d(e,"getOpener",function(){return r.g}),t.d(e,"getParent",function(){return r.h}),t.d(e,"getUserAgent",function(){return r.i}),t.d(e,"isActuallySameDomain",function(){return r.j}),t.d(e,"isAncestor",function(){return r.k}),t.d(e,"isOpener",function(){return r.l}),t.d(e,"isSameDomain",function(){return r.m}),t.d(e,"isSameTopWindow",function(){return r.n}),t.d(e,"isWindow",function(){return r.o}),t.d(e,"isWindowClosed",function(){return r.p}),t.d(e,"linkFrameWindow",function(){return r.q}),t.d(e,"matchDomain",function(){return r.r}),t.d(e,"stringifyDomainPattern",function(){return r.s});var o=t(16);t.n(o),t(8)},function(n,e,t){"use strict";var r,o={REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},i={SUCCESS:"success",ERROR:"error"},a={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},u={POSTROBOT:"__postRobot__"},c={POST_MESSAGE:"postrobot_post_message",BRIDGE:"postrobot_bridge",GLOBAL:"postrobot_global"},s={MOCK:"mock:",FILE:"file:"},d={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"},f={ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:2e3,ACK_TIMEOUT_KNOWN:1e4,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(r={},r[c.POST_MESSAGE]=!0,r[c.BRIDGE]=!0,r[c.GLOBAL]=!0,r)};0===window.location.href.indexOf(s.FILE)&&(f.ALLOW_POSTMESSAGE_POPUP=!0),t.d(e,"b",function(){return f}),t.d(e,"e",function(){return o}),t.d(e,"c",function(){return i}),t.d(e,"d",function(){return a}),t.d(e,"j",function(){return u}),t.d(e,"g",function(){return c}),t.d(e,"f",function(){return s}),t.d(e,"a",function(){return"__postrobot_bridge__"}),t.d(e,!1,function(){return"__postrobot_proxy__"}),t.d(e,"i",function(){return"*"}),t.d(e,"h",function(){return d})},function(n,e,t){"use strict";function r(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var t=e.call(n);if("[object Window]"===t||"[object global]"===t||"[object DOMWindow]"===t)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}function o(){var n=void 0;if("undefined"!=typeof window)n=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");n=window}var e=n.__zalgopromise__=n.__zalgopromise__||{};return e.flushPromises=e.flushPromises||[],e.activeCount=e.activeCount||0,e.possiblyUnhandledPromiseHandlers=e.possiblyUnhandledPromiseHandlers||[],e.dispatchedErrors=e.dispatchedErrors||[],e}var i=function(){function n(e){var t=this;if(function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var r=void 0,o=void 0,i=!1,a=!1,u=!1;try{e(function(n){u?t.resolve(n):(i=!0,r=n)},function(n){u?t.reject(n):(a=!0,o=n)})}catch(n){return void this.reject(n)}u=!0,i?this.resolve(r):a&&this.reject(o)}}return n.prototype.resolve=function(n){if(this.resolved||this.rejected)return this;if(r(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},n.prototype.reject=function(n){var e=this;if(this.resolved||this.rejected)return this;if(r(n))throw new Error("Can not reject promise with another promise");if(!n){var t=n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n);n=new Error("Expected reject to be called with Error, got "+t)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout(function(){e.errorHandled||function(n,e){if(-1===o().dispatchedErrors.indexOf(n)){o().dispatchedErrors.push(n),setTimeout(function(){throw n},1);for(var t=0;t<o().possiblyUnhandledPromiseHandlers.length;t++)o().possiblyUnhandledPromiseHandlers[t](n,e)}}(n,e)},1),this.dispatch(),this},n.prototype.asyncReject=function(n){this.errorHandled=!0,this.reject(n)},n.prototype.dispatch=function(){var e=this,t=this.dispatching,i=this.resolved,a=this.rejected,u=this.handlers;if(!t&&(i||a)){this.dispatching=!0,o().activeCount+=1;for(var c=function(t){var o=u[t],c=o.onSuccess,s=o.onError,d=o.promise,f=void 0;if(i)try{f=c?c(e.value):e.value}catch(n){return d.reject(n),"continue"}else if(a){if(!s)return d.reject(e.error),"continue";try{f=s(e.error)}catch(n){return d.reject(n),"continue"}}f instanceof n&&(f.resolved||f.rejected)?(f.resolved?d.resolve(f.value):d.reject(f.error),f.errorHandled=!0):r(f)?f instanceof n&&(f.resolved||f.rejected)?f.resolved?d.resolve(f.value):d.reject(f.error):f.then(function(n){d.resolve(n)},function(n){d.reject(n)}):d.resolve(f)},s=0;s<u.length;s++)c(s);u.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&n.flushQueue()}},n.prototype.then=function(e,t){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for success handler");if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for error handler");var r=new n;return this.handlers.push({promise:r,onSuccess:e,onError:t}),this.errorHandled=!0,this.dispatch(),r},n.prototype.catch=function(n){return this.then(void 0,n)},n.prototype.finally=function(e){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(t){return n.try(e).then(function(){return t})},function(t){return n.try(e).then(function(){throw t})})},n.prototype.timeout=function(n,e){var t=this;if(this.resolved||this.rejected)return this;var r=setTimeout(function(){t.resolved||t.rejected||t.reject(e||new Error("Promise timed out after "+n+"ms"))},n);return this.then(function(n){return clearTimeout(r),n})},n.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.resolve=function(e){return e instanceof n?e:r(e)?new n(function(n,t){return e.then(n,t)}):(new n).resolve(e)},n.reject=function(e){return(new n).reject(e)},n.all=function(e){var t=new n,o=e.length,i=[];if(!o)return t.resolve(i),t;for(var a=function(a){var u=e[a];if(u instanceof n){if(u.resolved)return i[a]=u.value,o-=1,"continue"}else if(!r(u))return i[a]=u,o-=1,"continue";n.resolve(u).then(function(n){i[a]=n,0==(o-=1)&&t.resolve(i)},function(n){t.reject(n)})},u=0;u<e.length;u++)a(u);return 0===o&&t.resolve(i),t},n.hash=function(e){var t={};return n.all(Object.keys(e).map(function(r){return n.resolve(e[r]).then(function(n){t[r]=n})})).then(function(){return t})},n.map=function(e,t){return n.all(e.map(t))},n.onPossiblyUnhandledException=function(n){return function(n){return o().possiblyUnhandledPromiseHandlers.push(n),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(n),1)}}}(n)},n.try=function(e,t,r){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=e.apply(t,r||[])}catch(e){return n.reject(e)}return n.resolve(o)},n.delay=function(e){return new n(function(n){setTimeout(n,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||r(e)},n.flush=function(){var e=new n;return o().flushPromises.push(e),0===o().activeCount&&n.flushQueue(),e},n.flushQueue=function(){var n=o().flushPromises;o().flushPromises=[];for(var e=0,t=null==n?0:n.length;e<t;e++)n[e].resolve()},n}();t.d(e,"a",function(){return i})},function(n,e,t){"use strict";t.d(e,"a",function(){return o});var r=t(1),o=window[r.j.POSTROBOT]=window[r.j.POSTROBOT]||{};o.registerSelf=function(){}},function(n,e,t){"use strict";t(9);var r=t(10);t.d(e,"addEventListener",function(){return r.a}),t(17),t(18),t(11);var o=t(7);t.d(e,"getOrSet",function(){return o.e}),t.d(e,"isRegex",function(){return o.g}),t.d(e,"memoizePromise",function(){return o.i}),t.d(e,"noop",function(){return o.j}),t.d(e,"once",function(){return o.k}),t.d(e,"safeInterval",function(){return o.m}),t.d(e,"stringifyError",function(){return o.o}),t.d(e,"uniqueID",function(){return o.p}),t.d(e,"weakMapMemoize",function(){return o.q}),t.d(e,"weakMapMemoizePromise",function(){return o.r}),t(19);var i=t(20);t.n(i),t(21),t(22)},function(n,e,t){"use strict";t.d({},"WeakMap",function(){return u});var r=t(0);function o(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch(n){}return-1}var i=Object.defineProperty,a=Date.now()%1e9,u=function(){function n(){if(function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),a+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+a,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}return n.prototype._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,t=0;t<e.length;t++){var o=e[t];if(Object(r.isWindow)(o)&&Object(r.isWindowClosed)(o)){if(n)try{n.delete(o)}catch(n){}e.splice(t,1),this.values.splice(t,1),t-=1}}},n.prototype.isSafeToReadWrite=function(n){if(Object(r.isWindow)(n))return!1;try{n&&n.self,n&&n[this.name]}catch(n){return!1}return!0},n.prototype.set=function(n,e){if(!n)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.set(n,e)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=this.name,a=n[r];a&&a[0]===n?a[1]=e:i(n,r,{value:[n,e],writable:!0})}else{this._cleanupClosedWindows();var u=this.keys,c=this.values,s=o(u,n);-1===s?(u.push(n),c.push(e)):c[s]=e}},n.prototype.get=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return e.get(n)}catch(n){delete this.weakmap}if(!this.isSafeToReadWrite(n)){this._cleanupClosedWindows();var t=o(this.keys,n);if(-1===t)return;return this.values[t]}var r=n[this.name];if(r&&r[0]===n)return r[1]},n.prototype.delete=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=n[this.name];t&&t[0]===n&&(t[0]=t[1]=void 0)}else{this._cleanupClosedWindows();var r=this.keys,i=o(r,n);-1!==i&&(r.splice(i,1),this.values.splice(i,1))}},n.prototype.has=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{return e.has(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=n[this.name];return!(!t||t[0]!==n)}return this._cleanupClosedWindows(),-1!==o(this.keys,n)},n.prototype.getOrSet=function(n,e){if(this.has(n))return this.get(n);var t=e();return this.set(n,t),t},n}();t.d(e,"a",function(){return u})},function(n,e,t){"use strict";var r=t(5),o=t(0),i=t(2),a=t(4),u=t(1),c=t(3);function s(n){return c.a.helloPromises.getOrSet(n,function(){return new i.a})}c.a.instanceID=c.a.instanceID||Object(a.uniqueID)(),c.a.helloPromises=c.a.helloPromises||new r.a,c.a.onHello=c.a.onHello||[];var d=Object(a.once)(function(){c.a.on(u.d.HELLO,{domain:u.i},function(n){var e=n.source,t=n.origin;return s(e).resolve({win:e,domain:t}),{instanceID:c.a.instanceID}})});function f(n){return c.a.send(n,u.d.HELLO,{instanceID:c.a.instanceID},{domain:u.i,timeout:-1}).then(function(e){var t=e.origin,r=e.data.instanceID;return s(n).resolve({win:n,domain:t}),{win:n,domain:t,instanceID:r}})}var l=Object(a.weakMapMemoizePromise)(function(n){return f(n).then(function(n){return n.instanceID})});function w(){d();for(var n=0,e=Object(o.getAllWindows)(),t=null==e?0:e.length;n<t;n++){var r=e[n];r!==window&&f(r).catch(a.noop)}}function h(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",r=s(n);return-1!==e&&(r=r.timeout(e,new Error(t+" did not load after "+e+"ms"))),r}function p(){return!!Object(o.getUserAgent)(window).match(/MSIE|trident|edge\/12|edge\/13/i)||!u.b.ALLOW_POSTMESSAGE_POPUP}function m(n){window.knownWindows.set(n,!0)}function v(n){return window.knownWindows.get(n,!1)}window.knownWindows=window.knownWindows||new r.a,t.d(e,"g",function(){return f}),t.d(e,"b",function(){return l}),t.d(e,"c",function(){return w}),t.d(e,"a",function(){return h}),t.d(e,"f",function(){return p}),t.d(e,"e",function(){return m}),t.d(e,"d",function(){return v})},function(n,e,t){"use strict";e.p=a,e.d=function(){if("undefined"!=typeof window)return window;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("No global found")},e.h=function(n){var e=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new o.a;function i(){for(var e=arguments.length,o=Array(e),i=0;i<e;i++)o[i]=arguments[i];var a=r.getOrSet(t.thisNamespace?this:n,function(){return{}}),u=c(o),s=t.time;if(a[u]&&s&&Date.now()-a[u].time<s&&delete a[u],a[u])return a[u].value;var d=Date.now(),f=n.apply(this,arguments);return a[u]={time:d,value:f},a[u].value}return i.reset=function(){r.delete(t.thisNamespace?e:n)},t.name&&(i.displayName=t.name+":memoized"),i},e.i=function(n){var e={};function t(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var i=c(r);return e.hasOwnProperty(i)?e[i]:(e[i]=n.apply(this,arguments).finally(function(){delete e[i]}),e[i])}return t.reset=function(){e={}},t},e.l=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function t(){return r.a.try(n,this,arguments)}return e.name&&(t.displayName=e.name+":promisified"),t},e.f=function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=n.__inline_memoize_cache__=n.__inline_memoize_cache__||{},o=c(t);return r.hasOwnProperty(o)?r[o]:r[o]=e.apply(void 0,t)},e.j=function(){},e.k=function(n){var e=!1;return function(){if(!e)return e=!0,n.apply(this,arguments)}},e.o=function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(t>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+Object.prototype.toString.call(e)+">";if("string"==typeof e)return e;if(e instanceof Error){var r=e&&e.stack,o=e&&e.message;if(r&&o)return-1!==r.indexOf(o)?r:o+"\n"+r;if(r)return r;if(o)return o}return"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(e){return"Error while stringifying error: "+n(e,t+1)}},e.n=function(n){return"string"==typeof n?n:n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n)},e.c=function(n,e){if(!e)return n;if(Object.assign)return Object.assign(n,e);for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},e.m=function(n,e){var t=void 0;return function r(){t=setTimeout(function(){n(),r()},e)}(),{cancel:function(){clearTimeout(t)}}},e.a=function(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()},e.b=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,t=void 0;return function(){var r=this,o=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(r,o)},e)}},e.g=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},t.d(e,"q",function(){return s}),t.d(e,"r",function(){return d}),e.e=function(n,e,t){if(n.hasOwnProperty(e))return n[e];var r=t();return n[e]=r,r};var r=t(2),o=t(5),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function a(){var n,e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+(n=(new Date).toISOString().slice(11,19).replace("T","."),window.btoa(n)).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var u=void 0;function c(n){try{return JSON.stringify(Array.prototype.slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(u=u||new o.a,null===n||void 0===n||"object"!==(void 0===n?"undefined":i(n))&&"function"!=typeof n)throw new Error("Invalid object");var e=u.get(n);return e||(e=(void 0===n?"undefined":i(n))+":"+a(),u.set(n,e)),e}(e)+"]":e})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}var s=function(n){var e=new o.a;return function(t){var r=this;return e.getOrSet(t,function(){return n.call(r,t)})}},d=function(n){var e=new o.a;return function(t){var r=this;return e.getOrSet(t,function(){return n.call(r,t).finally(function(){e.delete(t)})})}}},function(n,e,t){"use strict";t.d(e,"a",function(){return r}),t.d(e,"b",function(){return o});var r={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},o="*"},function(n,e,t){"use strict";e.a=function(){return!!(window.navigator.mockUserAgent||window.navigator.userAgent).match(/Android|webOS|iPhone|iPad|iPod|bada|Symbian|Palm|CriOS|BlackBerry|IEMobile|WindowsMobile|Opera Mini/i)}},function(n,e,t){"use strict";t(2),t(0),t(5);var r=t(7);t(9),e.b=function n(){return Object(r.f)(n,function(){try{if("undefined"==typeof window)return!1;if(window.localStorage){var n=Math.random().toString();window.localStorage.setItem("__test__localStorage__",n);var e=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),n===e)return!0}}catch(n){}return!1})},e.a=function(n,e,t){return n.addEventListener(e,t),{cancel:function(){n.removeEventListener(e,t)}}},"function"==typeof Symbol&&Symbol.iterator,Object.assign,Object.create(Error.prototype)},function(n,e,t){"use strict";e.a=function n(e){var t=e.name,i=e.version,a=void 0===i?"latest":i,u=e.lifetime,c=void 0===u?3e5:u;return Object(r.f)(n,function(){var n="__"+t+"_"+a+"_storage__",e=void 0;function i(t){var i=Object(o.b)(),a=void 0;if(e&&(a=e),!a&&i){var u=window.localStorage.getItem(n);u&&(a=JSON.parse(u))}a||(a=Object(r.d)()[n]),a||(a={id:Object(r.p)()}),a.id||(a.id=Object(r.p)()),e=a;var c=t(a);return i?window.localStorage.setItem(n,JSON.stringify(a)):Object(r.d)()[n]=a,e=null,c}function u(n){return i(function(e){var t=e.__session__,o=Date.now();return t&&o-t.created>c&&(t=null),t||(t={guid:Object(r.p)(),created:o}),e.__session__=t,n(t)})}return{getState:i,getID:function(){return i(function(n){return n.id})},getSessionState:function(n){return u(function(e){return e.state=e.state||{},n(e.state)})},getSessionID:function(){return u(function(n){return n.guid})}}},[{name:t,version:a,lifetime:c}])};var r=t(7),o=t(10)},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(0),o=t(1);function i(n,e){if(!o.b.ALLOW_POSTMESSAGE_POPUP&&!1===Object(r.isSameTopWindow)(n,e))throw new Error("Can not send and receive post messages between two different windows (disabled to emulate IE)")}t.d(e,"emulateIERestrictions",function(){return i})},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(2),o=t(0),i=t(4),a=t(1),u=t(3);function c(n){try{u.a.tunnelWindows[n]&&delete u.a.tunnelWindows[n].source}catch(n){}delete u.a.tunnelWindows[n]}u.a.tunnelWindows=u.a.tunnelWindows||{},u.a.tunnelWindowId=0,u.a.openTunnelToParent=function(n){var e=n.name,t=n.source,r=n.canary,s=n.sendMessage,d=Object(o.getParent)(window);if(!d)throw new Error("No parent window found to open tunnel to");var f=function(n){var e=n.name,t=n.source,r=n.canary,a=n.sendMessage;return function(){for(var n=u.a.tunnelWindows,e=0,t=Object.keys(n),r=null==t?0:t.length;e<r;e++){var a=t[e],s=n[a];try{Object(i.noop)(s.source)}catch(n){c(a);continue}Object(o.isWindowClosed)(s.source)&&c(a)}}(),u.a.tunnelWindowId+=1,u.a.tunnelWindows[u.a.tunnelWindowId]={name:e,source:t,canary:r,sendMessage:a},u.a.tunnelWindowId}({name:e,source:t,canary:r,sendMessage:s});return u.a.send(d,a.d.OPEN_TUNNEL,{name:e,sendMessage:function(){var n=function(n){return u.a.tunnelWindows[n]}(f);try{Object(i.noop)(n&&n.source)}catch(n){return void c(f)}if(n&&n.source&&!Object(o.isWindowClosed)(n.source)){try{n.canary()}catch(n){return}n.sendMessage.apply(this,arguments)}}},{domain:a.i})};var s=t(5);function d(){return!!Object(o.getUserAgent)(window).match(/MSIE|trident|edge\/12|edge\/13/i)||!a.b.ALLOW_POSTMESSAGE_POPUP}function f(n){return!Object(o.isSameTopWindow)(window,n)}function l(n,e){if(n){if(Object(o.getDomain)()!==Object(o.getDomainFromUrl)(n))return!0}else if(e&&!Object(o.isSameDomain)(e))return!0;return!1}function w(n){var e=n.win,t=n.domain;return!(!d()||t&&!l(t,e)||e&&!f(e))}function h(n){var e=(n=n||Object(o.getDomainFromUrl)(n)).replace(/[^a-zA-Z0-9]+/g,"_");return a.a+"_"+e}function p(){return Boolean(window.name&&window.name===h(Object(o.getDomain)()))}var m=new r.a(function(n){if(window.document&&window.document.body)return n(window.document.body);var e=setInterval(function(){if(window.document&&window.document.body)return clearInterval(e),n(window.document.body)},10)});function v(n){u.a.remoteWindows.set(n,{sendMessagePromise:new r.a})}function g(n){return u.a.remoteWindows.get(n)}function y(n,e,t){var i=g(n);if(!i)throw new Error("Window not found to register sendMessage to");var a=function(r,i,a){if(r!==n)throw new Error("Remote window does not match window");if(!Object(o.matchDomain)(i,e))throw new Error("Remote domain "+i+" does not match domain "+e);t(a)};i.sendMessagePromise.resolve(a),i.sendMessagePromise=r.a.resolve(a)}function O(n,e){var t=g(n);if(!t)throw new Error("Window not found on which to reject sendMessage");t.sendMessagePromise.asyncReject(e)}function b(n,e,t){var r=Object(o.isOpener)(window,n),i=Object(o.isOpener)(n,window);if(!r&&!i)throw new Error("Can only send messages to and from parent and popup windows");var a=g(n);if(!a)throw new Error("Window not found to send message to");return a.sendMessagePromise.then(function(r){return r(n,e,t)})}u.a.remoteWindows=u.a.remoteWindows||new s.a;var E=Object(i.weakMapMemoize)(function(n){return r.a.try(function(){try{var e=Object(o.getFrameByName)(n,h(Object(o.getDomain)()));if(!e)return;return Object(o.isSameDomain)(e)&&e[a.j.POSTROBOT]?e:new r.a(function(n){var t=void 0,r=void 0;t=setInterval(function(){if(e&&Object(o.isSameDomain)(e)&&e[a.j.POSTROBOT])return clearInterval(t),clearTimeout(r),n(e)},100),r=setTimeout(function(){return clearInterval(t),n()},2e3)})}catch(n){}})});function _(){return r.a.try(function(){var n=Object(o.getOpener)(window);if(n&&w({win:n}))return v(n),E(n).then(function(e){return e?window.name?e[a.j.POSTROBOT].openTunnelToParent({name:window.name,source:window,canary:function(){},sendMessage:function(n){try{Object(i.noop)(window)}catch(n){return}if(window&&!window.closed)try{u.a.receiveMessage({data:n,origin:this.origin,source:this.source})}catch(n){r.a.reject(n)}}}).then(function(e){var t=e.source,r=e.origin,o=e.data;if(t!==n)throw new Error("Source does not match opener");y(t,r,o.sendMessage)}).catch(function(e){throw O(n,e),e}):O(n,new Error("Can not register with opener: window does not have a name")):O(n,new Error("Can not register with opener: no bridge found in opener"))})})}var W=t(6);function S(n,e){return e=e||Object(o.getDomainFromUrl)(n),Boolean(u.a.bridges[e])}function j(n,e){return e=e||Object(o.getDomainFromUrl)(n),u.a.bridges[e]?u.a.bridges[e]:(u.a.bridges[e]=r.a.try(function(){if(Object(o.getDomain)()===e)throw new Error("Can not open bridge on the same domain as current domain: "+e);var t=h(e);if(Object(o.getFrameByName)(window,t))throw new Error("Frame with name "+t+" already exists on page");var i=function(n,e){var t=document.createElement("iframe");return t.setAttribute("name",n),t.setAttribute("id",n),t.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),t.setAttribute("frameborder","0"),t.setAttribute("border","0"),t.setAttribute("scrolling","no"),t.setAttribute("allowTransparency","true"),t.setAttribute("tabindex","-1"),t.setAttribute("hidden","true"),t.setAttribute("title",""),t.setAttribute("role","presentation"),t.src=e,t}(t,n);return u.a.bridgeFrames[e]=i,m.then(function(t){t.appendChild(i);var o=i.contentWindow;return function(n,e){u.a.on(a.d.OPEN_TUNNEL,{window:n,domain:e},function(n){var t=n.origin,o=n.data;if(t!==e)throw new Error("Domain "+e+" does not match origin "+t);if(!o.name)throw new Error("Register window expected to be passed window name");if(!o.sendMessage)throw new Error("Register window expected to be passed sendMessage method");if(!u.a.popupWindowsByName[o.name])throw new Error("Window with name "+o.name+" does not exist, or was not opened by this window");if(!u.a.popupWindowsByName[o.name].domain)throw new Error("We do not have a registered domain for window "+o.name);if(u.a.popupWindowsByName[o.name].domain!==t)throw new Error("Message origin "+t+" does not matched registered window origin "+u.a.popupWindowsByName[o.name].domain);return y(u.a.popupWindowsByName[o.name].win,e,o.sendMessage),{sendMessage:function(n){if(window&&!window.closed){var e=u.a.popupWindowsByName[o.name];if(e)try{u.a.receiveMessage({data:n,origin:e.domain,source:e.win})}catch(n){r.a.reject(n)}}}}})}(o,e),new r.a(function(n,e){i.onload=n,i.onerror=e}).then(function(){return Object(W.a)(o,a.b.BRIDGE_TIMEOUT,"Bridge "+n)}).then(function(){return o})})}),u.a.bridges[e])}u.a.bridges=u.a.bridges||{},u.a.bridgeFrames=u.a.bridgeFrames||{},u.a.popupWindowsByWin=u.a.popupWindowsByWin||new s.a,u.a.popupWindowsByName=u.a.popupWindowsByName||{};var P=window.open;function T(n,e){var t=u.a.popupWindowsByWin.get(n);t&&(t.domain=Object(o.getDomainFromUrl)(e),v(n))}function A(){for(var n=0,e=Object.keys(u.a.bridgeFrames),t=null==e?0:e.length;n<t;n++){var r=e[n],o=u.a.bridgeFrames[r];o.parentNode&&o.parentNode.removeChild(o)}u.a.bridgeFrames={},u.a.bridges={}}window.open=function(n,e,t,r){var i=n;if(n&&0===n.indexOf(a.f.MOCK)){var c=n.split("|");i=c[0],n=c[1]}i&&(i=Object(o.getDomainFromUrl)(i));var s=P.call(this,n,e,t,r);if(!s)return s;n&&v(s);for(var d=0,f=Object.keys(u.a.popupWindowsByName),l=null==f?0:f.length;d<l;d++){var w=f[d];Object(o.isWindowClosed)(u.a.popupWindowsByName[w].win)&&delete u.a.popupWindowsByName[w]}if(e&&s){var h=u.a.popupWindowsByWin.get(s)||u.a.popupWindowsByName[e]||{};h.name=h.name||e,h.win=h.win||s,h.domain=h.domain||i,u.a.popupWindowsByWin.set(s,h),u.a.popupWindowsByName[e]=h}return s},t.d(e,"openTunnelToOpener",function(){return _}),t.d(e,"needsBridgeForBrowser",function(){return d}),t.d(e,"needsBridgeForWin",function(){return f}),t.d(e,"needsBridgeForDomain",function(){return l}),t.d(e,"needsBridge",function(){return w}),t.d(e,"getBridgeName",function(){return h}),t.d(e,"isBridge",function(){return p}),t.d(e,"documentBodyReady",function(){return m}),t.d(e,"registerRemoteWindow",function(){return v}),t.d(e,"findRemoteWindow",function(){return g}),t.d(e,"registerRemoteSendMessage",function(){return y}),t.d(e,"rejectRemoteSendMessage",function(){return O}),t.d(e,"sendBridgeMessage",function(){return b}),t.d(e,"hasBridge",function(){return S}),t.d(e,"openBridge",function(){return j}),t.d(e,"linkUrl",function(){return T}),t.d(e,"destroyBridges",function(){return A})},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={};t.d(r,"markWindowKnown",function(){return i.e}),t.d(r,"serializeMessage",function(){return S}),t.d(r,"deserializeMessage",function(){return j}),t.d(r,"ProxyWindow",function(){return E}),t.d(r,"cleanUpWindow",function(){return tn}),t.d(r,"Promise",function(){return O.a}),t.d(r,"bridge",function(){return rn}),t.d(r,"parent",function(){return en}),t.d(r,"send",function(){return K}),t.d(r,"request",function(){return H}),t.d(r,"sendToParent",function(){return J}),t.d(r,"client",function(){return Q}),t.d(r,"on",function(){return Y}),t.d(r,"listen",function(){return Z}),t.d(r,"once",function(){return V}),t.d(r,"listener",function(){return $}),t.d(r,"CONFIG",function(){return c.b}),t.d(r,"disable",function(){return nn});var o,i=t(6),a=t(0),u=t(4),c=t(1),s={FUNCTION:"function",ERROR:"error",PROMISE:"promise",REGEX:"regex",DATE:"date",ARRAY:"array",OBJECT:"object",STRING:"string",NUMBER:"number",BOOLEAN:"boolean",NULL:"null",UNDEFINED:"undefined"},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function f(n){return"object"===(void 0===n?"undefined":d(n))&&null!==n&&"string"==typeof n.__type__}function l(n){return void 0===n?s.UNDEFINED:null===n?s.NULL:Array.isArray(n)?s.ARRAY:"function"==typeof n?s.FUNCTION:"object"===(void 0===n?"undefined":d(n))?n instanceof Error?s.ERROR:"function"==typeof n.then?s.PROMISE:"[object RegExp]"===Object.prototype.toString.call(n)?s.REGEX:"[object Date]"===Object.prototype.toString.call(n)?s.DATE:s.OBJECT:"string"==typeof n?s.STRING:"number"==typeof n?s.NUMBER:"boolean"==typeof n?s.BOOLEAN:void 0}function w(n,e){return{__type__:n,__val__:e}}var h,p=((o={})[s.FUNCTION]=function(){},o[s.ERROR]=function(n){var e=n.message,t=n.stack,r=n.code;return w(s.ERROR,{message:e,stack:t,code:r})},o[s.PROMISE]=function(){},o[s.REGEX]=function(n){return w(s.REGEX,n.source)},o[s.DATE]=function(n){return w(s.DATE,n.toJSON())},o[s.ARRAY]=function(n){return n},o[s.OBJECT]=function(n){return n},o[s.STRING]=function(n){return n},o[s.NUMBER]=function(n){return n},o[s.BOOLEAN]=function(n){return n},o[s.NULL]=function(n){return n},o),m={},v=((h={})[s.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},h[s.ERROR]=function(n){var e=n.message,t=n.stack,r=n.code,o=new Error(e);return o.code=r,o.stack=t+"\n\n"+o.stack,o},h[s.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},h[s.REGEX]=function(n){return new RegExp(n)},h[s.DATE]=function(n){return new Date(n)},h[s.ARRAY]=function(n){return n},h[s.OBJECT]=function(n){return n},h[s.STRING]=function(n){return n},h[s.NUMBER]=function(n){return n},h[s.BOOLEAN]=function(n){return n},h[s.NULL]=function(n){return n},h),g={},y=t(5),O=t(2),b=t(3);b.a.winToProxyWindow=b.a.winToProxyWindow||new y.a,b.a.idToProxyWindow=b.a.idToProxyWindow||{};var E=function(){function n(e,t){!function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),this.serializedWindow=e,this.actualWindowPromise=new O.a,t&&this.setWindow(t),this.serializedWindow.getInstanceID=Object(u.memoizePromise)(this.serializedWindow.getInstanceID)}return n.prototype.setLocation=function(n){var e=this;return O.a.try(function(){if(!e.actualWindow)return e.serializedWindow.setLocation(n);e.actualWindow.location=n}).then(function(){return e})},n.prototype.setName=function(n){var e=this;return O.a.try(function(){if(!e.actualWindow)return e.serializedWindow.setName(n);if(!Object(a.isSameDomain)(e.actualWindow))throw new Error("Can not set name for window on different domain");e.actualWindow.name=n,e.actualWindow.frameElement&&e.actualWindow.frameElement.setAttribute("name",n)}).then(function(){return e})},n.prototype.close=function(){var n=this;return O.a.try(function(){if(!n.actualWindow)return n.serializedWindow.close();n.actualWindow.close()}).then(function(){return n})},n.prototype.focus=function(){var n=this;return O.a.try(function(){if(!n.actualWindow)return n.serializedWindow.focus();n.actualWindow.focus()}).then(function(){return n})},n.prototype.isClosed=function(){var n=this;return O.a.try(function(){return n.actualWindow?Object(a.isWindowClosed)(n.actualWindow):n.serializedWindow.isClosed()})},n.prototype.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(n)},n.prototype.matchWindow=function(n){var e=this;return O.a.try(function(){return e.actualWindow?n===e.actualWindow:O.a.all([e.getInstanceID(),Object(i.b)(n)]).then(function(t){var r=t[0]===t[1];return r&&e.setWindow(n),r})})},n.prototype.unwrap=function(){return this.actualWindow||this},n.prototype.awaitWindow=function(){return this.actualWindowPromise},n.prototype.getInstanceID=function(){return this.actualWindow?Object(i.b)(this.actualWindow):this.serializedWindow.getInstanceID()},n.prototype.serialize=function(){return this.serializedWindow},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e){return n.toProxyWindow(e).serialize()},n.deserialize=function(e){return Object(u.getOrSet)(b.a.idToProxyWindow,e.id,function(){return new n(e)})},n.isProxyWindow=function(e){return e instanceof n},n.toProxyWindow=function(e){return n.isProxyWindow(e)?e:b.a.winToProxyWindow.getOrSet(e,function(){var t=Object(u.uniqueID)();return b.a.idToProxyWindow[t]=new n({id:t,getInstanceID:function(){return Object(i.b)(e)},close:function(){return O.a.try(function(){e.close()})},focus:function(){return O.a.try(function(){e.focus()})},isClosed:function(){return O.a.try(function(){return Object(a.isWindowClosed)(e)})},setLocation:function(n){return O.a.try(function(){if(Object(a.isSameDomain)(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(n)}catch(n){}e.location=n})},setName:function(n){return O.a.try(function(){e.name=n})}},e),b.a.idToProxyWindow[t]})},n}();b.a.methods=b.a.methods||new y.a,b.a.proxyWindowMethods=b.a.proxyWindowMethods||{},b.a.listeningForFunctions=b.a.listeningForFunctions||!1;var _=Object(u.once)(function(){b.a.listeningForFunctions||(b.a.listeningForFunctions=!0,b.a.on(c.d.METHOD,{origin:c.i},function(n){var e=n.source,t=n.origin,r=n.data,o=r.id,i=r.name;return O.a.try(function(){var n=(b.a.methods.get(e)||{})[r.id]||b.a.proxyWindowMethods[o];if(!n)throw new Error("Could not find method with id: "+r.id);var i=n.proxy,u=n.domain,c=n.val;if(!Object(a.matchDomain)(u,t))throw new Error("Method domain "+n.domain+" does not match origin "+t);return i?i.matchWindow(e).then(function(n){if(!n)throw new Error("Proxy window does not match source");return delete b.a.proxyWindowMethods[o],c}):c}).then(function(n){return n.apply({source:e,origin:t,data:r},r.args)}).then(function(n){return{result:n,id:o,name:i}})}))});function W(n,e,t,r){_();var o=Object(u.uniqueID)();return n=E.unwrap(n),E.isProxyWindow(n)?b.a.proxyWindowMethods[o]={proxy:n,domain:e,val:t}:b.a.methods.getOrSet(n,function(){return{}})[o]={domain:e,val:t},w(c.h.CROSS_DOMAIN_FUNCTION,{id:o,name:t.name||r})}function S(n,e,t){var r;return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m,t=JSON.stringify(n,function(n){var t=this[n];if(f(this))return t;var r=l(t);if(!r)return t;var o=e[r]||p[r];return o?o(t,n):t});return void 0===t?s.UNDEFINED:t}(t,((r={})[s.PROMISE]=function(t,r){return function(n,e,t,r){return w(c.h.CROSS_DOMAIN_ZALGO_PROMISE,{then:W(n,e,function(n,e){return t.then(n,e)},r)})}(n,e,t,r)},r[s.FUNCTION]=function(t,r){return W(n,e,t,r)},r[s.OBJECT]=function(n){return Object(a.isWindow)(n)||E.isProxyWindow(n)?(e=n,w(c.h.CROSS_DOMAIN_WINDOW,E.serialize(e))):n;var e},r))}function j(n,e,t){var r;return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;if(n!==s.UNDEFINED)return JSON.parse(n,function(n,t){if(f(this))return t;var r=void 0,o=void 0;if(f(t)?(r=t.__type__,o=t.__val__):(r=l(t),o=t),!r)return o;var i=e[r]||v[r];return i?i(o,n):o})}(t,((r={})[c.h.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return e=n.then,new O.a(e);var e},r[c.h.CROSS_DOMAIN_FUNCTION]=function(t){return function(n,e,t){var r=t.id,o=t.name;function i(){var t=Array.prototype.slice.call(arguments);return b.a.send(n,c.d.METHOD,{id:r,name:o,args:t},{domain:e}).then(function(n){return n.data.result})}return i.fireAndForget=function(){var t=Array.prototype.slice.call(arguments);return b.a.send(n,c.d.METHOD,{id:r,name:o,args:t},{domain:e,fireAndForget:!0})},i.__name__=o,i.__xdomain__=!0,i.source=n,i.origin=e,i}(n,e,t)},r[c.h.CROSS_DOMAIN_WINDOW]=function(n){return e=n,E.deserialize(e);var e},r))}var P={};P[c.g.POST_MESSAGE]=function(n,e,r){try{t(12).emulateIERestrictions(window,n)}catch(n){return}(Array.isArray(r)?r:"string"==typeof r?[r]:[c.i]).map(function(e){if(0===e.indexOf(c.f.MOCK)){if(window.location.protocol===c.f.FILE)return c.i;if(!Object(a.isActuallySameDomain)(n))throw new Error("Attempting to send messsage to mock domain "+e+", but window is actually cross-domain");return Object(a.getActualDomain)(n)}return 0===e.indexOf(c.f.FILE)?c.i:e}).forEach(function(t){return n.postMessage(e,t)})};var T=t(13),A=T.sendBridgeMessage,D=T.needsBridgeForBrowser,M=T.isBridge;P[c.g.BRIDGE]=function(n,e,t){if(D()||M()){if(Object(a.isSameDomain)(n))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==Object(a.isSameTopWindow)(window,n))throw new Error("Can only use bridge to communicate between two different windows, not between frames");return A(n,t,e)}},P[c.g.GLOBAL]=function(n,e){if(Object(i.f)()){if(!Object(a.isSameDomain)(n))throw new Error("Post message through global disabled between different domain windows");if(!1!==Object(a.isSameTopWindow)(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var t=n[c.j.POSTROBOT];if(!t)throw new Error("Can not find postRobot global on foreign window");return t.receiveMessage({source:window,origin:Object(a.getDomain)(),data:e})}};var R=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n};function I(n,e,t){return O.a.try(function(){var r;if(Object(a.isWindowClosed)(n))throw new Error("Window is closed");var o=S(n,e,((r={})[c.j.POSTROBOT]=R({id:Object(u.uniqueID)()},t),r)),i=[];return O.a.map(Object.keys(P),function(t){return O.a.try(function(){if(!c.b.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);return P[t](n,o,e)}).then(function(){return i.push(t+": success"),!0},function(n){return i.push(t+": "+Object(u.stringifyError)(n)+"\n"),!1})}).then(function(n){var e=n.some(Boolean),r=t.type+" "+t.name+" "+(e?"success":"error")+":\n - "+i.join("\n - ")+"\n";if(!e)throw new Error(r)})})}b.a.responseListeners=b.a.responseListeners||{},b.a.requestListeners=b.a.requestListeners||{},b.a.WINDOW_WILDCARD=b.a.WINDOW_WILDCARD||new function(){},b.a.erroredResponseListeners=b.a.erroredResponseListeners||{};var N,C="__domain_regex__";function x(n){return b.a.responseListeners[n]}function B(n){delete b.a.responseListeners[n]}function L(n){return Boolean(b.a.erroredResponseListeners[n])}function k(n){var e=n.name,t=n.win,r=n.domain;if(t===c.i&&(t=null),r===c.i&&(r=null),!e)throw new Error("Name required to get request listener");var o=b.a.requestListeners[e];if(o)for(var i=0,u=[t,b.a.WINDOW_WILDCARD],s=null==u?0:u.length;i<s;i++){var d=u[i],f=d&&o.get(d);if(f){if(r&&"string"==typeof r){if(f[r])return f[r];if(f[C])for(var l=0,w=f[C],h=null==w?0:w.length;l<h;l++){var p=w[l],m=p.regex,v=p.listener;if(Object(a.matchDomain)(m,r))return v}}if(f[c.i])return f[c.i]}}}var U=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},F=((N={})[c.e.REQUEST]=function(n,e,t){var r=k({name:t.name,win:n,domain:e});function o(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.fireAndForget||Object(a.isWindowClosed)(n)?O.a.resolve():I(n,e,U({type:r,hash:t.hash,name:t.name},o))}return O.a.all([o(c.e.ACK),O.a.try(function(){if(!r)throw new Error("No handler found for post message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Request origin "+e+" does not match domain "+r.domain.toString());var o=t.data;return r.handler({source:n,origin:e,data:o})}).then(function(n){return o(c.e.RESPONSE,{ack:c.c.SUCCESS,data:n})},function(n){return o(c.e.RESPONSE,{ack:c.c.ERROR,error:n})})]).then(u.noop).catch(function(n){if(r&&r.handleError)return r.handleError(n);throw n})},N[c.e.ACK]=function(n,e,t){if(!L(t.hash)){var r=x(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Ack origin "+e+" does not match domain "+r.domain.toString());r.ack=!0}},N[c.e.RESPONSE]=function(n,e,t){if(!L(t.hash)){var r=x(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Response origin "+e+" does not match domain "+Object(a.stringifyDomainPattern)(r.domain));if(B(t.hash),t.ack===c.c.ERROR)return r.respond(t.error,null);if(t.ack===c.c.SUCCESS){var o=t.data;return r.respond(null,{source:n,origin:e,data:o})}}},N),z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function G(n){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var e=n.source,t=n.origin,r=function(n,e,t){var r=void 0;try{r=j(e,t,n)}catch(n){return}if(r&&"object"===(void 0===r?"undefined":z(r))&&null!==r&&(r=r[c.j.POSTROBOT])&&"object"===(void 0===r?"undefined":z(r))&&null!==r&&r.type&&"string"==typeof r.type&&F[r.type])return r}(n.data,e,t);r&&(Object(i.e)(e),-1===b.a.receivedMessages.indexOf(r.id)&&(b.a.receivedMessages.push(r.id),Object(a.isWindowClosed)(e)&&!r.fireAndForget||F[r.type](e,t,r)))}function q(n){try{Object(u.noop)(n.source)}catch(n){return}var e={source:n.source||n.sourceElement,origin:n.origin||n.originalEvent&&n.originalEvent.origin,data:n.data};try{t(12).emulateIERestrictions(e.source,window)}catch(n){return}G(e)}function H(n){return O.a.try(function(){if(!n.name)throw new Error("Expected options.name");var e=n.name,t=void 0,r=void 0;if("string"==typeof n.window){var o=document.getElementById(n.window);if(!o)throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be a valid element id");if("iframe"!==o.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be an iframe");if(!o.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");t=o.contentWindow}else if(n.window instanceof HTMLIFrameElement){if("iframe"!==n.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be an iframe");if(n.window&&!n.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");n.window&&n.window.contentWindow&&(t=n.window.contentWindow)}else t=n.window;if(!t)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var s=t;r=n.domain||c.i;var d=n.name+"_"+Object(u.uniqueID)();if(Object(a.isWindowClosed)(s))throw new Error("Target window is closed");var f=!1,l=b.a.requestPromises.get(s);l||(l=[],b.a.requestPromises.set(s,l));var w=O.a.try(function(){if(Object(a.isAncestor)(window,s))return Object(i.a)(s,n.timeout||c.b.CHILD_WINDOW_TIMEOUT)}).then(function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).domain;if(Object(u.isRegex)(r)&&!n)return Object(i.g)(s)}).then(function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).domain;if(Object(u.isRegex)(r)){if(!Object(a.matchDomain)(r,t))throw new Error("Remote window domain "+t+" does not match regex: "+r.toString());r=t}if("string"!=typeof r&&!Array.isArray(r))throw new TypeError("Expected domain to be a string or array");var o=r;return new O.a(function(t,r){var u=void 0;if(n.fireAndForget||function(n,e){b.a.responseListeners[n]=e}(d,u={name:e,window:s,domain:o,respond:function(n,e){n||(f=!0,l.splice(l.indexOf(w,1))),n?r(n):t(e)}}),I(s,o,{type:c.e.REQUEST,hash:d,name:e,data:n.data,fireAndForget:Boolean(n.fireAndForget)}).catch(r),n.fireAndForget)return t();var h=Object(i.d)(s)?c.b.ACK_TIMEOUT_KNOWN:c.b.ACK_TIMEOUT,p=n.timeout||c.b.RES_TIMEOUT,m=h,v=p,g=100;setTimeout(function n(){if(!f){if(Object(a.isWindowClosed)(s))return u.ack?r(new Error("Window closed for "+e+" before response")):r(new Error("Window closed for "+e+" before ack"));if(m=Math.max(m-g,0),-1!==v&&(v=Math.max(v-g,0)),u.ack){if(-1===v)return;g=Math.min(v,2e3)}else{if(0===m)return r(new Error("No ack for postMessage "+e+" in "+Object(a.getDomain)()+" in "+h+"ms"));if(0===v)return r(new Error("No response for postMessage "+e+" in "+Object(a.getDomain)()+" in "+p+"ms"))}setTimeout(n,g)}},g)})});return w.catch(function(){!function(n){b.a.erroredResponseListeners[n]=!0}(d),B(d)}),l.push(w),w})}function K(n,e,t,r){return(r=r||{}).window=n,r.name=e,r.data=t,H(r)}function J(n,e,t){var r=Object(a.getAncestor)();return r?K(r,n,e,t):new O.a(function(n,e){return e(new Error("Window does not have a parent"))})}function Q(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!n.window)throw new Error("Expected options.window");var e=n.window;return{send:function(t,r){return K(e,t,r,n)}}}b.a.receivedMessages=b.a.receivedMessages||[],b.a.receiveMessage=G,b.a.requestPromises=b.a.requestPromises||new y.a,b.a.send=K;var X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function Z(n){if(!n.name)throw new Error("Expected options.name");if(!n.handler)throw new Error("Expected options.handler");var e=n.name,t=n.window,r=n.domain,o={handler:n.handler,handleError:n.errorHandler||function(n){throw n},window:t,domain:r||c.i,name:e},i=function n(e,t){var r=e.name,o=e.win,i=e.domain;if(!r||"string"!=typeof r)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],s=0,d=o,f=null==d?0:d.length;s<f;s++){var l=d[s];a.push(n({name:r,domain:i,win:l},t))}return{cancel:function(){for(var n=0,e=null==a?0:a.length;n<e;n++)a[n].cancel()}}}if(Array.isArray(i)){for(var w=[],h=0,p=i,m=null==p?0:p.length;h<m;h++){var v=p[h];w.push(n({name:r,win:o,domain:v},t))}return{cancel:function(){for(var n=0,e=null==w?0:w.length;n<e;n++)w[n].cancel()}}}var g=k({name:r,win:o,domain:i});if(o&&o!==c.i||(o=b.a.WINDOW_WILDCARD),i=i||c.i,g)throw o&&i?new Error("Request listener already exists for "+r+" on domain "+i.toString()+" for "+(o===b.a.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+r+" for "+(o===b.a.WINDOW_WILDCARD?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+r+" on domain "+i.toString()):new Error("Request listener already exists for "+r);var O=b.a.requestListeners,E=O[r];E||(E=new y.a,O[r]=E);var _=E.get(o);_||(_={},E.set(o,_));var W=i.toString(),S=_[C],j=void 0;return Object(u.isRegex)(i)?(S||(S=[],_[C]=S),j={regex:i,listener:t},S.push(j)):_[W]=t,{cancel:function(){_&&(delete _[W],o&&0===Object.keys(_).length&&E.delete(o),j&&S.splice(S.indexOf(j,1)))}}}({name:e,win:t,domain:r},o);if(n.once){var s=o.handler;o.handler=Object(u.once)(function(){return i.cancel(),s.apply(this,arguments)})}if(o.window&&n.errorOnClose)var d=Object(u.safeInterval)(function(){t&&"object"===(void 0===t?"undefined":X(t))&&Object(a.isWindowClosed)(t)&&(d.cancel(),o.handleError(new Error("Post message target window is closed")))},50);return{cancel:function(){i.cancel()}}}function Y(n,e,t){return"function"==typeof e&&(t=e,e={}),(e=e||{}).name=n,e.handler=t||e.handler,Z(e)}function V(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments[2];"function"==typeof e&&(t=e,e={}),e=e||{},t=t||e.handler;var r=e.errorHandler,o=new O.a(function(o,i){(e=e||{}).name=n,e.once=!0,e.handler=function(n){if(o(n),t)return t(n)},e.errorHandler=function(n){if(i(n),r)return r(n)}}),i=Z(e);return o.cancel=i.cancel,o}function $(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(e,t){return Y(e,n,t)}}}function nn(){delete window[c.j.POSTROBOT],window.removeEventListener("message",q)}b.a.on=Y;var en=Object(a.getAncestor)();function tn(n){var e=b.a.requestPromises.get(n);if(e)for(var t=0,r=null==e?0:e.length;t<r;t++)e[t].reject(new Error("No response from window - cleaned up"));b.a.popupWindowsByWin&&b.a.popupWindowsByWin.delete(n),b.a.remoteWindows&&b.a.remoteWindows.delete(n),b.a.requestPromises.delete(n),b.a.methods.delete(n),b.a.helloPromises.delete(n)}var rn=t(23);b.a.initialized||(b.a.initialized=!0,Object(u.addEventListener)(window,"message",q),rn&&rn.openTunnelToOpener(),Object(i.c)()),t.d(e,"markWindowKnown",function(){return i.e}),t.d(e,"serializeMessage",function(){return S}),t.d(e,"deserializeMessage",function(){return j}),t.d(e,"ProxyWindow",function(){return E}),t.d(e,"cleanUpWindow",function(){return tn}),t.d(e,"Promise",function(){return O.a}),t.d(e,"bridge",function(){return rn}),t.d(e,"parent",function(){return en}),t.d(e,"send",function(){return K}),t.d(e,"request",function(){return H}),t.d(e,"sendToParent",function(){return J}),t.d(e,"client",function(){return Q}),t.d(e,"on",function(){return Y}),t.d(e,"listen",function(){return Z}),t.d(e,"once",function(){return V}),t.d(e,"listener",function(){return $}),t.d(e,"CONFIG",function(){return c.b}),t.d(e,"disable",function(){return nn}),e.default=r},function(n,e,t){"use strict";function r(n){return"[object RegExp]"===Object.prototype.toString.call(n)}var o=t(8);e.h=u,e.g=c,e.a=d,e.d=f,e.j=l,e.m=w,e.b=function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=g(e),r=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return c(v(n)||n)}(e);return r?[].concat(n(r),t):t},e.p=E,e.q=function(n){if(function(){for(var n=0;n<b.length;n++)y(b[n])&&(b.splice(n,1),O.splice(n,1));for(var e=0;e<O.length;e++)E(O[e])&&(b.splice(e,1),O.splice(e,1))}(),n&&n.contentWindow)try{O.push(n.contentWindow),b.push(n)}catch(n){}},e.i=function(n){return(n=n||window).navigator.mockUserAgent||n.navigator.userAgent},e.f=function(n,e){for(var t=p(n),r=0,o=null==t?0:t.length;r<o;r++){var i=t[r];try{if(w(i)&&i.name===e&&-1!==t.indexOf(i))return i}catch(n){}}try{if(-1!==t.indexOf(n.frames[e]))return n.frames[e]}catch(n){}try{if(-1!==t.indexOf(n[e]))return n[e]}catch(n){}},e.l=function(n,e){return n===c(e)},e.c=_,e.k=function(n,e){var t=_(e);if(t)return t===n;if(e===n)return!1;if(v(e)===e)return!1;for(var r=0,o=p(n),i=null==o?0:o.length;r<i;r++)if(o[r]===e)return!0;return!1},e.n=function(n,e){var t=v(n)||n,r=v(e)||e;try{if(t&&r)return t===r}catch(n){}var o=g(n),i=g(e);if(W(o,i))return!0;var a=c(t),u=c(r);return!(a&&W(g(a),i)||(u&&W(g(u),o),1))},e.r=function n(e,t){if("string"==typeof e){if("string"==typeof t)return e===o.b||t===e;if(r(t))return!1;if(Array.isArray(t))return!1}return r(e)?r(t)?e.toString()===t.toString():!Array.isArray(t)&&Boolean(t.match(e)):!!Array.isArray(e)&&(Array.isArray(t)?JSON.stringify(e)===JSON.stringify(t):!r(t)&&e.some(function(e){return n(e,t)}))},e.s=function(n){return Array.isArray(n)?"("+n.join(" | ")+")":r(n)?"RegExp("+n.toString():n.toString()},e.e=function(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):f()},e.o=function(n){try{if(n===window)return!0}catch(n){if(n&&n.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(n))return!0}catch(n){if(n&&n.message===i)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===i)return!0}try{n&&n.__cross_domain_utils_window_check__}catch(n){return!0}return!1};var i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.a.ABOUT}function u(n){if(n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function c(n){if(n&&!u(n))try{return n.opener}catch(n){}}function s(n){try{return n&&n.location&&n.location.href,!0}catch(n){}return!1}function d(n){var e=(n=n||window).location;if(!e)throw new Error("Can not read window location");var t=e.protocol;if(!t)throw new Error("Can not read window protocol");if(t===o.a.FILE)return o.a.FILE+"//";if(t===o.a.ABOUT){var r=u(n);return r&&s(r)?d(r):o.a.ABOUT+"//"}var i=e.host;if(!i)throw new Error("Can not read window host");return t+"//"+i}function f(n){var e=d(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(o.a.MOCK)?n.mockDomain:e}function l(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(a(n)&&s(n))return!0}catch(n){}try{if(d(n)===d(window))return!0}catch(n){}return!1}function w(n){if(!l(n))return!1;try{if(n===window)return!0;if(a(n)&&s(n))return!0;if(f(window)===f(n))return!0}catch(n){}return!1}function h(n,e){if(!n||!e)return!1;var t=u(e);return t?t===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function p(n){var e=[],t=void 0;try{t=n.frames}catch(e){t=n}var r=void 0;try{r=t.length}catch(n){}if(0===r)return e;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch(n){continue}e.push(i)}return e}for(var a=0;a<100;a++){var u=void 0;try{u=t[a]}catch(n){return e}if(!u)return e;e.push(u)}return e}function m(n){for(var e=[],t=0,r=p(n),o=null==r?0:r.length;t<o;t++){var i=r[t];e.push(i);for(var a=0,u=m(i),c=null==u?0:u.length;a<c;a++){var s=u[a];e.push(s)}}return e}function v(n){if(n){try{if(n.top)return n.top}catch(n){}if(u(n)===n)return n;try{if(h(window,n)&&window.top)return window.top}catch(n){}try{if(h(n,window)&&window.top)return window.top}catch(n){}for(var e=0,t=m(n),r=null==t?0:t.length;e<r;e++){var o=t[e];try{if(o.top)return o.top}catch(n){}if(u(o)===o)return o}}}function g(n){var e=v(n);if(!e)throw new Error("Can not determine top window");return[].concat(m(e),[e])}function y(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(n))}var O=[],b=[];function E(n){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==i}if(e&&w(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var t=function(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch(n){}return-1}(O,n);if(-1!==t){var r=b[t];if(r&&y(r))return!0}return!1}function _(n){return c(n=n||window)||u(n)||void 0}function W(n,e){for(var t=0,r=null==n?0:n.length;t<r;t++)for(var o=n[t],i=0,a=null==e?0:e.length;i<a;i++)if(o===e[i])return!0;return!1}},function(n,e){},function(n,e,t){"use strict";t(7),t(11)},function(n,e,t){"use strict";t(7)},function(n,e,t){"use strict";t(2),t(0)},function(n,e){},function(n,e,t){"use strict";t(7)},function(n,e,t){"use strict"},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(13);t.d(e,"openBridge",function(){return r.openBridge}),t.d(e,"linkUrl",function(){return r.linkUrl}),t.d(e,"isBridge",function(){return r.isBridge}),t.d(e,"needsBridge",function(){return r.needsBridge}),t.d(e,"needsBridgeForBrowser",function(){return r.needsBridgeForBrowser}),t.d(e,"hasBridge",function(){return r.hasBridge}),t.d(e,"needsBridgeForWin",function(){return r.needsBridgeForWin}),t.d(e,"needsBridgeForDomain",function(){return r.needsBridgeForDomain}),t.d(e,"openTunnelToOpener",function(){return r.openTunnelToOpener}),t.d(e,"destroyBridges",function(){return r.destroyBridges})}])});
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("postRobot",[],e):"object"==typeof exports?exports.postRobot=e():n.postRobot=e()}("undefined"!=typeof self?self:this,function(){return function(n){var e={};function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:r})},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=14)}([function(n,e,t){"use strict";var r=t(15);t.d(e,"getActualDomain",function(){return r.a}),t.d(e,"getAllWindows",function(){return r.b}),t.d(e,"getAncestor",function(){return r.c}),t.d(e,"getDomain",function(){return r.d}),t.d(e,"getDomainFromUrl",function(){return r.e}),t.d(e,"getFrameByName",function(){return r.f}),t.d(e,"getOpener",function(){return r.g}),t.d(e,"getParent",function(){return r.h}),t.d(e,"getUserAgent",function(){return r.i}),t.d(e,"isActuallySameDomain",function(){return r.j}),t.d(e,"isAncestor",function(){return r.k}),t.d(e,"isOpener",function(){return r.l}),t.d(e,"isSameDomain",function(){return r.m}),t.d(e,"isSameTopWindow",function(){return r.n}),t.d(e,"isWindow",function(){return r.o}),t.d(e,"isWindowClosed",function(){return r.p}),t.d(e,"linkFrameWindow",function(){return r.q}),t.d(e,"matchDomain",function(){return r.r}),t.d(e,"stringifyDomainPattern",function(){return r.s});var o=t(16);t.n(o),t(8)},function(n,e,t){"use strict";var r,o={REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},i={SUCCESS:"success",ERROR:"error"},a={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},u={POSTROBOT:"__postRobot__"},c={POST_MESSAGE:"postrobot_post_message",BRIDGE:"postrobot_bridge",GLOBAL:"postrobot_global"},s={MOCK:"mock:",FILE:"file:"},f={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"},d={ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:2e3,ACK_TIMEOUT_KNOWN:1e4,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(r={},r[c.POST_MESSAGE]=!0,r[c.BRIDGE]=!0,r[c.GLOBAL]=!0,r)};0===window.location.href.indexOf(s.FILE)&&(d.ALLOW_POSTMESSAGE_POPUP=!0),t.d(e,"b",function(){return d}),t.d(e,"e",function(){return o}),t.d(e,"c",function(){return i}),t.d(e,"d",function(){return a}),t.d(e,"j",function(){return u}),t.d(e,"g",function(){return c}),t.d(e,"f",function(){return s}),t.d(e,"a",function(){return"__postrobot_bridge__"}),t.d(e,!1,function(){return"__postrobot_proxy__"}),t.d(e,"i",function(){return"*"}),t.d(e,"h",function(){return f})},function(n,e,t){"use strict";function r(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var t=e.call(n);if("[object Window]"===t||"[object global]"===t||"[object DOMWindow]"===t)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}function o(){var n=void 0;if("undefined"!=typeof window)n=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");n=window}var e=n.__zalgopromise__=n.__zalgopromise__||{};return e.flushPromises=e.flushPromises||[],e.activeCount=e.activeCount||0,e.possiblyUnhandledPromiseHandlers=e.possiblyUnhandledPromiseHandlers||[],e.dispatchedErrors=e.dispatchedErrors||[],e}var i=function(){function n(e){var t=this;if(function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var r=void 0,o=void 0,i=!1,a=!1,u=!1;try{e(function(n){u?t.resolve(n):(i=!0,r=n)},function(n){u?t.reject(n):(a=!0,o=n)})}catch(n){return void this.reject(n)}u=!0,i?this.resolve(r):a&&this.reject(o)}}return n.prototype.resolve=function(n){if(this.resolved||this.rejected)return this;if(r(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},n.prototype.reject=function(n){var e=this;if(this.resolved||this.rejected)return this;if(r(n))throw new Error("Can not reject promise with another promise");if(!n){var t=n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n);n=new Error("Expected reject to be called with Error, got "+t)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout(function(){e.errorHandled||function(n,e){if(-1===o().dispatchedErrors.indexOf(n)){o().dispatchedErrors.push(n),setTimeout(function(){throw n},1);for(var t=0;t<o().possiblyUnhandledPromiseHandlers.length;t++)o().possiblyUnhandledPromiseHandlers[t](n,e)}}(n,e)},1),this.dispatch(),this},n.prototype.asyncReject=function(n){this.errorHandled=!0,this.reject(n)},n.prototype.dispatch=function(){var e=this,t=this.dispatching,i=this.resolved,a=this.rejected,u=this.handlers;if(!t&&(i||a)){this.dispatching=!0,o().activeCount+=1;for(var c=function(t){var o=u[t],c=o.onSuccess,s=o.onError,f=o.promise,d=void 0;if(i)try{d=c?c(e.value):e.value}catch(n){return f.reject(n),"continue"}else if(a){if(!s)return f.reject(e.error),"continue";try{d=s(e.error)}catch(n){return f.reject(n),"continue"}}d instanceof n&&(d.resolved||d.rejected)?(d.resolved?f.resolve(d.value):f.reject(d.error),d.errorHandled=!0):r(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?f.resolve(d.value):f.reject(d.error):d.then(function(n){f.resolve(n)},function(n){f.reject(n)}):f.resolve(d)},s=0;s<u.length;s++)c(s);u.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&n.flushQueue()}},n.prototype.then=function(e,t){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for success handler");if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for error handler");var r=new n;return this.handlers.push({promise:r,onSuccess:e,onError:t}),this.errorHandled=!0,this.dispatch(),r},n.prototype.catch=function(n){return this.then(void 0,n)},n.prototype.finally=function(e){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(t){return n.try(e).then(function(){return t})},function(t){return n.try(e).then(function(){throw t})})},n.prototype.timeout=function(n,e){var t=this;if(this.resolved||this.rejected)return this;var r=setTimeout(function(){t.resolved||t.rejected||t.reject(e||new Error("Promise timed out after "+n+"ms"))},n);return this.then(function(n){return clearTimeout(r),n})},n.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.resolve=function(e){return e instanceof n?e:r(e)?new n(function(n,t){return e.then(n,t)}):(new n).resolve(e)},n.reject=function(e){return(new n).reject(e)},n.all=function(e){var t=new n,o=e.length,i=[];if(!o)return t.resolve(i),t;for(var a=function(a){var u=e[a];if(u instanceof n){if(u.resolved)return i[a]=u.value,o-=1,"continue"}else if(!r(u))return i[a]=u,o-=1,"continue";n.resolve(u).then(function(n){i[a]=n,0==(o-=1)&&t.resolve(i)},function(n){t.reject(n)})},u=0;u<e.length;u++)a(u);return 0===o&&t.resolve(i),t},n.hash=function(e){var t={};return n.all(Object.keys(e).map(function(r){return n.resolve(e[r]).then(function(n){t[r]=n})})).then(function(){return t})},n.map=function(e,t){return n.all(e.map(t))},n.onPossiblyUnhandledException=function(n){return function(n){return o().possiblyUnhandledPromiseHandlers.push(n),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(n),1)}}}(n)},n.try=function(e,t,r){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=e.apply(t,r||[])}catch(e){return n.reject(e)}return n.resolve(o)},n.delay=function(e){return new n(function(n){setTimeout(n,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||r(e)},n.flush=function(){var e=new n;return o().flushPromises.push(e),0===o().activeCount&&n.flushQueue(),e},n.flushQueue=function(){var n=o().flushPromises;o().flushPromises=[];for(var e=0,t=null==n?0:n.length;e<t;e++)n[e].resolve()},n}();t.d(e,"a",function(){return i})},function(n,e,t){"use strict";t(9);var r=t(10);t.d(e,"addEventListener",function(){return r.a}),t(17),t(18),t(11);var o=t(6);t.d(e,"getOrSet",function(){return o.e}),t.d(e,"isRegex",function(){return o.g}),t.d(e,"memoizePromise",function(){return o.i}),t.d(e,"noop",function(){return o.j}),t.d(e,"once",function(){return o.k}),t.d(e,"safeInterval",function(){return o.m}),t.d(e,"stringifyError",function(){return o.o}),t.d(e,"uniqueID",function(){return o.p}),t.d(e,"weakMapMemoize",function(){return o.q}),t.d(e,"weakMapMemoizePromise",function(){return o.r}),t(19);var i=t(20);t.n(i),t(21),t(22)},function(n,e,t){"use strict";t.d(e,"a",function(){return a}),e.c=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;function t(n){return u.getOrSet(n,e)}return{has:function(e){return t(e).hasOwnProperty(n)},get:function(e,r){var o=t(e);return o.hasOwnProperty(n)?o[n]:r},set:function(e,r){return t(e)[n]=r,r},del:function(e){delete t(e)[n]},getOrSet:function(e,r){var o=t(e);if(o.hasOwnProperty(n))return o[n];var i=r();return o[n]=i,i}}},e.b=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c,t=Object(o.getOrSet)(a,n,e);return{has:function(n){return t.hasOwnProperty(n)},get:function(n,e){return t.hasOwnProperty(n)?t[n]:e},set:function(n,e){return t[n]=e,e},del:function(n){delete t[n]},getOrSet:function(n,e){if(t.hasOwnProperty(n))return t[n];var r=e();return t[n]=r,r},reset:function(){t=e()},keys:function(){return Object.keys(t)}}},t(0);var r=t(7),o=t(3),i=t(1),a=window[i.j.POSTROBOT]=window[i.j.POSTROBOT]||{},u=a.windowStore=a.windowStore||new r.a,c=function(){return{}}},function(n,e,t){"use strict";var r=t(0),o=t(2),i=t(3),a=t(1),u=t(4);u.a.instanceID=u.a.instanceID||Object(i.uniqueID)();var c=Object(u.c)("helloPromises");function s(n){return c.getOrSet(n,function(){return new o.a})}var f=Object(i.once)(function(){u.a.on(a.d.HELLO,{domain:a.i},function(n){var e=n.source,t=n.origin;return s(e).resolve({win:e,domain:t}),{instanceID:u.a.instanceID}})});function d(n){return u.a.send(n,a.d.HELLO,{instanceID:u.a.instanceID},{domain:a.i,timeout:-1}).then(function(e){var t=e.origin,r=e.data.instanceID;return s(n).resolve({win:n,domain:t}),{win:n,domain:t,instanceID:r}})}var l=Object(i.weakMapMemoizePromise)(function(n){return d(n).then(function(n){return n.instanceID})});function w(){f();for(var n=0,e=Object(r.getAllWindows)(),t=null==e?0:e.length;n<t;n++){var o=e[n];o!==window&&d(o).catch(i.noop)}}function h(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",r=s(n);return-1!==e&&(r=r.timeout(e,new Error(t+" did not load after "+e+"ms"))),r}function m(){return!!Object(r.getUserAgent)(window).match(/MSIE|trident|edge\/12|edge\/13/i)||!a.b.ALLOW_POSTMESSAGE_POPUP}var p=Object(u.c)("knownWindows");function v(n){p.set(n,!0)}function g(n){return p.get(n,!1)}t.d(e,"g",function(){return d}),t.d(e,"b",function(){return l}),t.d(e,"c",function(){return w}),t.d(e,"a",function(){return h}),t.d(e,"f",function(){return m}),t.d(e,"e",function(){return v}),t.d(e,"d",function(){return g})},function(n,e,t){"use strict";e.p=a,e.d=function(){if("undefined"!=typeof window)return window;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("No global found")},e.h=function(n){var e=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new o.a;function i(){for(var e=arguments.length,o=Array(e),i=0;i<e;i++)o[i]=arguments[i];var a=r.getOrSet(t.thisNamespace?this:n,function(){return{}}),u=c(o),s=t.time;if(a[u]&&s&&Date.now()-a[u].time<s&&delete a[u],a[u])return a[u].value;var f=Date.now(),d=n.apply(this,arguments);return a[u]={time:f,value:d},a[u].value}return i.reset=function(){r.delete(t.thisNamespace?e:n)},t.name&&(i.displayName=t.name+":memoized"),i},e.i=function(n){var e={};function t(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var i=c(r);return e.hasOwnProperty(i)?e[i]:(e[i]=n.apply(this,arguments).finally(function(){delete e[i]}),e[i])}return t.reset=function(){e={}},t},e.l=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function t(){return r.a.try(n,this,arguments)}return e.name&&(t.displayName=e.name+":promisified"),t},e.f=function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=n.__inline_memoize_cache__=n.__inline_memoize_cache__||{},o=c(t);return r.hasOwnProperty(o)?r[o]:r[o]=e.apply(void 0,t)},e.j=function(){},e.k=function(n){var e=!1;return function(){if(!e)return e=!0,n.apply(this,arguments)}},e.o=function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(t>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+Object.prototype.toString.call(e)+">";if("string"==typeof e)return e;if(e instanceof Error){var r=e&&e.stack,o=e&&e.message;if(r&&o)return-1!==r.indexOf(o)?r:o+"\n"+r;if(r)return r;if(o)return o}return"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(e){return"Error while stringifying error: "+n(e,t+1)}},e.n=function(n){return"string"==typeof n?n:n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n)},e.c=function(n,e){if(!e)return n;if(Object.assign)return Object.assign(n,e);for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},e.m=function(n,e){var t=void 0;return function r(){t=setTimeout(function(){n(),r()},e)}(),{cancel:function(){clearTimeout(t)}}},e.a=function(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()},e.b=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,t=void 0;return function(){var r=this,o=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(r,o)},e)}},e.g=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},t.d(e,"q",function(){return s}),t.d(e,"r",function(){return f}),e.e=function(n,e,t){if(n.hasOwnProperty(e))return n[e];var r=t();return n[e]=r,r};var r=t(2),o=t(7),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function a(){var n,e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+(n=(new Date).toISOString().slice(11,19).replace("T","."),window.btoa(n)).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var u=void 0;function c(n){try{return JSON.stringify(Array.prototype.slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(u=u||new o.a,null===n||void 0===n||"object"!==(void 0===n?"undefined":i(n))&&"function"!=typeof n)throw new Error("Invalid object");var e=u.get(n);return e||(e=(void 0===n?"undefined":i(n))+":"+a(),u.set(n,e)),e}(e)+"]":e})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}var s=function(n){var e=new o.a;return function(t){var r=this;return e.getOrSet(t,function(){return n.call(r,t)})}},f=function(n){var e=new o.a;return function(t){var r=this;return e.getOrSet(t,function(){return n.call(r,t).finally(function(){e.delete(t)})})}}},function(n,e,t){"use strict";t.d({},"WeakMap",function(){return u});var r=t(0);function o(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch(n){}return-1}var i=Object.defineProperty,a=Date.now()%1e9,u=function(){function n(){if(function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),a+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+a,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}return n.prototype._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,t=0;t<e.length;t++){var o=e[t];if(Object(r.isWindow)(o)&&Object(r.isWindowClosed)(o)){if(n)try{n.delete(o)}catch(n){}e.splice(t,1),this.values.splice(t,1),t-=1}}},n.prototype.isSafeToReadWrite=function(n){if(Object(r.isWindow)(n))return!1;try{n&&n.self,n&&n[this.name]}catch(n){return!1}return!0},n.prototype.set=function(n,e){if(!n)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.set(n,e)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=this.name,a=n[r];a&&a[0]===n?a[1]=e:i(n,r,{value:[n,e],writable:!0})}else{this._cleanupClosedWindows();var u=this.keys,c=this.values,s=o(u,n);-1===s?(u.push(n),c.push(e)):c[s]=e}},n.prototype.get=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return e.get(n)}catch(n){delete this.weakmap}if(!this.isSafeToReadWrite(n)){this._cleanupClosedWindows();var t=o(this.keys,n);if(-1===t)return;return this.values[t]}var r=n[this.name];if(r&&r[0]===n)return r[1]},n.prototype.delete=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=n[this.name];t&&t[0]===n&&(t[0]=t[1]=void 0)}else{this._cleanupClosedWindows();var r=this.keys,i=o(r,n);-1!==i&&(r.splice(i,1),this.values.splice(i,1))}},n.prototype.has=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{return e.has(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=n[this.name];return!(!t||t[0]!==n)}return this._cleanupClosedWindows(),-1!==o(this.keys,n)},n.prototype.getOrSet=function(n,e){if(this.has(n))return this.get(n);var t=e();return this.set(n,t),t},n}();t.d(e,"a",function(){return u})},function(n,e,t){"use strict";t.d(e,"a",function(){return r}),t.d(e,"b",function(){return o});var r={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},o="*"},function(n,e,t){"use strict";e.a=function(){return!!(window.navigator.mockUserAgent||window.navigator.userAgent).match(/Android|webOS|iPhone|iPad|iPod|bada|Symbian|Palm|CriOS|BlackBerry|IEMobile|WindowsMobile|Opera Mini/i)}},function(n,e,t){"use strict";t(2),t(0),t(7);var r=t(6);t(9),e.b=function n(){return Object(r.f)(n,function(){try{if("undefined"==typeof window)return!1;if(window.localStorage){var n=Math.random().toString();window.localStorage.setItem("__test__localStorage__",n);var e=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),n===e)return!0}}catch(n){}return!1})},e.a=function(n,e,t){return n.addEventListener(e,t),{cancel:function(){n.removeEventListener(e,t)}}},"function"==typeof Symbol&&Symbol.iterator,Object.assign,Object.create(Error.prototype)},function(n,e,t){"use strict";e.a=function n(e){var t=e.name,i=e.version,a=void 0===i?"latest":i,u=e.lifetime,c=void 0===u?3e5:u;return Object(r.f)(n,function(){var n="__"+t+"_"+a+"_storage__",e=void 0;function i(t){var i=Object(o.b)(),a=void 0;if(e&&(a=e),!a&&i){var u=window.localStorage.getItem(n);u&&(a=JSON.parse(u))}a||(a=Object(r.d)()[n]),a||(a={id:Object(r.p)()}),a.id||(a.id=Object(r.p)()),e=a;var c=t(a);return i?window.localStorage.setItem(n,JSON.stringify(a)):Object(r.d)()[n]=a,e=null,c}function u(n){return i(function(e){var t=e.__session__,o=Date.now();return t&&o-t.created>c&&(t=null),t||(t={guid:Object(r.p)(),created:o}),e.__session__=t,n(t)})}return{getState:i,getID:function(){return i(function(n){return n.id})},getSessionState:function(n){return u(function(e){return e.state=e.state||{},n(e.state)})},getSessionID:function(){return u(function(n){return n.guid})}}},[{name:t,version:a,lifetime:c}])};var r=t(6),o=t(10)},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(0),o=t(1);function i(n,e){if(!o.b.ALLOW_POSTMESSAGE_POPUP&&!1===Object(r.isSameTopWindow)(n,e))throw new Error("Can not send and receive post messages between two different windows (disabled to emulate IE)")}t.d(e,"emulateIERestrictions",function(){return i})},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(2),o=t(0),i=t(3),a=t(1),u=t(4),c=Object(u.b)("tunnelWindows");function s(){return!!Object(o.getUserAgent)(window).match(/MSIE|trident|edge\/12|edge\/13/i)||!a.b.ALLOW_POSTMESSAGE_POPUP}function f(n){return!Object(o.isSameTopWindow)(window,n)}function d(n,e){if(n){if(Object(o.getDomain)()!==Object(o.getDomainFromUrl)(n))return!0}else if(e&&!Object(o.isSameDomain)(e))return!0;return!1}function l(n){var e=n.win,t=n.domain;return!(!s()||t&&!d(t,e)||e&&!f(e))}function w(n){var e=(n=n||Object(o.getDomainFromUrl)(n)).replace(/[^a-zA-Z0-9]+/g,"_");return a.a+"_"+e}function h(){return Boolean(window.name&&window.name===w(Object(o.getDomain)()))}u.a.openTunnelToParent=function(n){var e=n.name,t=n.source,r=n.canary,s=n.sendMessage,f=Object(o.getParent)(window);if(!f)throw new Error("No parent window found to open tunnel to");var d=function(n){var e=n.name,t=n.source,r=n.canary,a=n.sendMessage;!function(){for(var n=0,e=c.keys(),t=null==e?0:e.length;n<t;n++){var r=e[n],a=c[r];try{Object(i.noop)(a.source)}catch(n){c.del(r);continue}Object(o.isWindowClosed)(a.source)&&c.del(r)}}();var u=Object(i.uniqueID)();return c.set(u,{name:e,source:t,canary:r,sendMessage:a}),u}({name:e,source:t,canary:r,sendMessage:s});return u.a.send(f,a.d.OPEN_TUNNEL,{name:e,sendMessage:function(){var n=c.get(d);try{Object(i.noop)(n&&n.source)}catch(n){return void c.del(d)}if(n&&n.source&&!Object(o.isWindowClosed)(n.source)){try{n.canary()}catch(n){return}n.sendMessage.apply(this,arguments)}}},{domain:a.i})};var m=new r.a(function(n){if(window.document&&window.document.body)return n(window.document.body);var e=setInterval(function(){if(window.document&&window.document.body)return clearInterval(e),n(window.document.body)},10)}),p=Object(u.c)("remoteWindows");function v(n){p.getOrSet(n,function(){return new r.a})}function g(n){var e=p.get(n);if(!e)throw new Error("Remote window not found");return e}function y(n,e,t){g(n).resolve(function(r,i,a){if(r!==n)throw new Error("Remote window does not match window");if(!Object(o.matchDomain)(i,e))throw new Error("Remote domain "+i+" does not match domain "+e);t(a)})}function O(n,e){g(n).reject(e).catch(i.noop)}function b(n,e,t){var r=Object(o.isOpener)(window,n),i=Object(o.isOpener)(n,window);if(!r&&!i)throw new Error("Can only send messages to and from parent and popup windows");return g(n).then(function(r){return r(n,e,t)})}var E=Object(i.weakMapMemoize)(function(n){return r.a.try(function(){try{var e=Object(o.getFrameByName)(n,w(Object(o.getDomain)()));if(!e)return;return Object(o.isSameDomain)(e)&&e[a.j.POSTROBOT]?e:new r.a(function(n){var t=void 0,r=void 0;t=setInterval(function(){if(e&&Object(o.isSameDomain)(e)&&e[a.j.POSTROBOT])return clearInterval(t),clearTimeout(r),n(e)},100),r=setTimeout(function(){return clearInterval(t),n()},2e3)})}catch(n){}})});function _(){return r.a.try(function(){var n=Object(o.getOpener)(window);if(n&&l({win:n}))return v(n),E(n).then(function(e){return e?window.name?e[a.j.POSTROBOT].openTunnelToParent({name:window.name,source:window,canary:function(){},sendMessage:function(n){try{Object(i.noop)(window)}catch(n){return}if(window&&!window.closed)try{u.a.receiveMessage({data:n,origin:this.origin,source:this.source})}catch(n){r.a.reject(n)}}}).then(function(e){var t=e.source,r=e.origin,o=e.data;if(t!==n)throw new Error("Source does not match opener");y(t,r,o.sendMessage)}).catch(function(e){throw O(n,e),e}):O(n,new Error("Can not register with opener: window does not have a name")):O(n,new Error("Can not register with opener: no bridge found in opener"))})})}var S=t(5),j=Object(u.b)("bridges"),W=Object(u.b)("bridgeFrames"),P=Object(u.b)("popupWindowsByName"),A=Object(u.c)("popupWindowsByWin");function D(n,e){return j.has(e||Object(o.getDomainFromUrl)(n))}function T(n,e){return e=e||Object(o.getDomainFromUrl)(n),j.getOrSet(e,function(){return r.a.try(function(){if(Object(o.getDomain)()===e)throw new Error("Can not open bridge on the same domain as current domain: "+e);var t=w(e);if(Object(o.getFrameByName)(window,t))throw new Error("Frame with name "+t+" already exists on page");var i=function(n,e){var t=document.createElement("iframe");return t.setAttribute("name",n),t.setAttribute("id",n),t.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),t.setAttribute("frameborder","0"),t.setAttribute("border","0"),t.setAttribute("scrolling","no"),t.setAttribute("allowTransparency","true"),t.setAttribute("tabindex","-1"),t.setAttribute("hidden","true"),t.setAttribute("title",""),t.setAttribute("role","presentation"),t.src=e,t}(t,n);return W.set(e,i),m.then(function(t){t.appendChild(i);var o=i.contentWindow;return function(n,e){u.a.on(a.d.OPEN_TUNNEL,{window:n,domain:e},function(n){var t=n.origin,o=n.data;if(t!==e)throw new Error("Domain "+e+" does not match origin "+t);if(!o.name)throw new Error("Register window expected to be passed window name");if(!o.sendMessage)throw new Error("Register window expected to be passed sendMessage method");if(!P.has(o.name))throw new Error("Window with name "+o.name+" does not exist, or was not opened by this window");if(!P.get(o.name).domain)throw new Error("We do not have a registered domain for window "+o.name);if(P.get(o.name).domain!==t)throw new Error("Message origin "+t+" does not matched registered window origin "+P.get(o.name).domain);return y(P.get(o.name).win,e,o.sendMessage),{sendMessage:function(n){if(window&&!window.closed){var e=P.get(o.name);if(e)try{u.a.receiveMessage({data:n,origin:e.domain,source:e.win})}catch(n){r.a.reject(n)}}}}})}(o,e),new r.a(function(n,e){i.onload=n,i.onerror=e}).then(function(){return Object(S.a)(o,a.b.BRIDGE_TIMEOUT,"Bridge "+n)}).then(function(){return o})})})})}var R=window.open;function I(n,e){A.has(n)&&(A.get(n).domain=Object(o.getDomainFromUrl)(e),v(n))}function M(){for(var n=0,e=W.keys(),t=null==e?0:e.length;n<t;n++){var r=e[n],o=W.get(r);o&&o.parentNode&&o.parentNode.removeChild(o)}W.reset(),j.reset()}window.open=function(n,e,t,r){var i=n;if(n&&0===n.indexOf(a.f.MOCK)){var u=n.split("|");i=u[0],n=u[1]}i&&(i=Object(o.getDomainFromUrl)(i));var c=R.call(this,n,e,t,r);if(!c)return c;n&&v(c);for(var s=0,f=P.keys(),d=null==f?0:f.length;s<d;s++){var l=f[s];Object(o.isWindowClosed)(P.get(l).win)&&P.del(l)}if(e&&c){var w=A.getOrSet(c,function(){return{}});w.name=w.name||e,w.win=w.win||c,w.domain=w.domain||i,A.set(c,w),P.set(e,w)}return c},t.d(e,"openTunnelToOpener",function(){return _}),t.d(e,"needsBridgeForBrowser",function(){return s}),t.d(e,"needsBridgeForWin",function(){return f}),t.d(e,"needsBridgeForDomain",function(){return d}),t.d(e,"needsBridge",function(){return l}),t.d(e,"getBridgeName",function(){return w}),t.d(e,"isBridge",function(){return h}),t.d(e,"documentBodyReady",function(){return m}),t.d(e,"registerRemoteWindow",function(){return v}),t.d(e,"findRemoteWindow",function(){return g}),t.d(e,"registerRemoteSendMessage",function(){return y}),t.d(e,"rejectRemoteSendMessage",function(){return O}),t.d(e,"sendBridgeMessage",function(){return b}),t.d(e,"hasBridge",function(){return D}),t.d(e,"openBridge",function(){return T}),t.d(e,"linkUrl",function(){return I}),t.d(e,"destroyBridges",function(){return M})},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={};t.d(r,"markWindowKnown",function(){return i.e}),t.d(r,"serializeMessage",function(){return D}),t.d(r,"deserializeMessage",function(){return T}),t.d(r,"ProxyWindow",function(){return S}),t.d(r,"cleanUpWindow",function(){return ln}),t.d(r,"Promise",function(){return y.a}),t.d(r,"bridge",function(){return wn}),t.d(r,"parent",function(){return dn}),t.d(r,"send",function(){return en}),t.d(r,"requestPromises",function(){return $}),t.d(r,"request",function(){return nn}),t.d(r,"sendToParent",function(){return tn}),t.d(r,"client",function(){return rn}),t.d(r,"on",function(){return un}),t.d(r,"listen",function(){return an}),t.d(r,"once",function(){return cn}),t.d(r,"listener",function(){return sn}),t.d(r,"CONFIG",function(){return c.b}),t.d(r,"disable",function(){return fn});var o,i=t(5),a=t(0),u=t(3),c=t(1),s={FUNCTION:"function",ERROR:"error",PROMISE:"promise",REGEX:"regex",DATE:"date",ARRAY:"array",OBJECT:"object",STRING:"string",NUMBER:"number",BOOLEAN:"boolean",NULL:"null",UNDEFINED:"undefined"},f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function d(n){return"object"===(void 0===n?"undefined":f(n))&&null!==n&&"string"==typeof n.__type__}function l(n){return void 0===n?s.UNDEFINED:null===n?s.NULL:Array.isArray(n)?s.ARRAY:"function"==typeof n?s.FUNCTION:"object"===(void 0===n?"undefined":f(n))?n instanceof Error?s.ERROR:"function"==typeof n.then?s.PROMISE:"[object RegExp]"===Object.prototype.toString.call(n)?s.REGEX:"[object Date]"===Object.prototype.toString.call(n)?s.DATE:s.OBJECT:"string"==typeof n?s.STRING:"number"==typeof n?s.NUMBER:"boolean"==typeof n?s.BOOLEAN:void 0}function w(n,e){return{__type__:n,__val__:e}}var h,m=((o={})[s.FUNCTION]=function(){},o[s.ERROR]=function(n){var e=n.message,t=n.stack,r=n.code;return w(s.ERROR,{message:e,stack:t,code:r})},o[s.PROMISE]=function(){},o[s.REGEX]=function(n){return w(s.REGEX,n.source)},o[s.DATE]=function(n){return w(s.DATE,n.toJSON())},o[s.ARRAY]=function(n){return n},o[s.OBJECT]=function(n){return n},o[s.STRING]=function(n){return n},o[s.NUMBER]=function(n){return n},o[s.BOOLEAN]=function(n){return n},o[s.NULL]=function(n){return n},o),p={},v=((h={})[s.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},h[s.ERROR]=function(n){var e=n.message,t=n.stack,r=n.code,o=new Error(e);return o.code=r,o.stack=t+"\n\n"+o.stack,o},h[s.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},h[s.REGEX]=function(n){return new RegExp(n)},h[s.DATE]=function(n){return new Date(n)},h[s.ARRAY]=function(n){return n},h[s.OBJECT]=function(n){return n},h[s.STRING]=function(n){return n},h[s.NUMBER]=function(n){return n},h[s.BOOLEAN]=function(n){return n},h[s.NULL]=function(n){return n},h),g={},y=t(2),O=t(4),b=Object(O.c)("winToProxyWindow"),E=Object(O.b)("idToProxyWindow");function _(){for(var n=0,e=E.keys(),t=null==e?0:e.length;n<t;n++){var r=e[n];E.get(r).shouldClean()&&delete E[r]}}var S=function(){function n(e,t){!function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),this.serializedWindow=e,this.actualWindowPromise=new y.a,t&&this.setWindow(t),this.serializedWindow.getInstanceID=Object(u.memoizePromise)(this.serializedWindow.getInstanceID)}return n.prototype.setLocation=function(n){var e=this;return y.a.try(function(){if(!e.actualWindow)return e.serializedWindow.setLocation(n);e.actualWindow.location=n}).then(function(){return e})},n.prototype.setName=function(n){var e=this;return y.a.try(function(){if(!e.actualWindow)return e.serializedWindow.setName(n);if(!Object(a.isSameDomain)(e.actualWindow))throw new Error("Can not set name for window on different domain");e.actualWindow.name=n,e.actualWindow.frameElement&&e.actualWindow.frameElement.setAttribute("name",n)}).then(function(){return e})},n.prototype.close=function(){var n=this;return y.a.try(function(){if(!n.actualWindow)return n.serializedWindow.close();n.actualWindow.close()}).then(function(){return n})},n.prototype.focus=function(){var n=this;return y.a.try(function(){if(!n.actualWindow)return n.serializedWindow.focus();n.actualWindow.focus()}).then(function(){return n})},n.prototype.isClosed=function(){var n=this;return y.a.try(function(){return n.actualWindow?Object(a.isWindowClosed)(n.actualWindow):n.serializedWindow.isClosed()})},n.prototype.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(n)},n.prototype.matchWindow=function(n){var e=this;return y.a.try(function(){return e.actualWindow?n===e.actualWindow:y.a.all([e.getInstanceID(),Object(i.b)(n)]).then(function(t){var r=t[0]===t[1];return r&&e.setWindow(n),r})})},n.prototype.unwrap=function(){return this.actualWindow||this},n.prototype.awaitWindow=function(){return this.actualWindowPromise},n.prototype.getInstanceID=function(){return this.actualWindow?Object(i.b)(this.actualWindow):this.serializedWindow.getInstanceID()},n.prototype.serialize=function(){return this.serializedWindow},n.prototype.shouldClean=function(){return this.actualWindow&&Object(a.isWindowClosed)(this.actualWindow)},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e){return _(),n.toProxyWindow(e).serialize()},n.deserialize=function(e){return _(),E.getOrSet(e.id,function(){return new n(e)})},n.isProxyWindow=function(e){return e instanceof n},n.toProxyWindow=function(e){return _(),n.isProxyWindow(e)?e:b.getOrSet(e,function(){var t=Object(u.uniqueID)();return E.set(t,new n({id:t,getInstanceID:function(){return Object(i.b)(e)},close:function(){return y.a.try(function(){e.close()})},focus:function(){return y.a.try(function(){e.focus()})},isClosed:function(){return y.a.try(function(){return Object(a.isWindowClosed)(e)})},setLocation:function(n){return y.a.try(function(){if(Object(a.isSameDomain)(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(n)}catch(n){}e.location=n})},setName:function(n){return y.a.try(function(){e.name=n})}},e))})},n}(),j=Object(O.c)("methodStore"),W=Object(O.b)("proxyWindowMethods");O.a.listeningForFunctions=O.a.listeningForFunctions||!1;var P=Object(u.once)(function(){O.a.listeningForFunctions||(O.a.listeningForFunctions=!0,O.a.on(c.d.METHOD,{origin:c.i},function(n){var e=n.source,t=n.origin,r=n.data,o=r.id,i=r.name;return y.a.try(function(){var n=j.get(e,function(){return{}})[r.id]||W.get(o);if(!n)throw new Error("Could not find method with id: "+r.id);var i=n.proxy,u=n.domain,c=n.val;if(!Object(a.matchDomain)(u,t))throw new Error("Method domain "+JSON.stringify(n.domain)+" does not match origin "+t);return i?i.matchWindow(e).then(function(n){if(!n)throw new Error("Proxy window does not match source");return c}):c}).then(function(n){return n.apply({source:e,origin:t,data:r},r.args)}).then(function(n){return{result:n,id:o,name:i}})}))});function A(n,e,t,r){P();var o=Object(u.uniqueID)();return n=S.unwrap(n),S.isProxyWindow(n)?(W.set(o,{proxy:n,domain:e,val:t}),n.awaitWindow().then(function(n){W.del(o),j.getOrSet(n,function(){return{}})[o]={domain:e,val:t}})):j.getOrSet(n,function(){return{}})[o]={domain:e,val:t},w(c.h.CROSS_DOMAIN_FUNCTION,{id:o,name:t.name||r})}function D(n,e,t){var r;return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p,t=JSON.stringify(n,function(n){var t=this[n];if(d(this))return t;var r=l(t);if(!r)return t;var o=e[r]||m[r];return o?o(t,n):t});return void 0===t?s.UNDEFINED:t}(t,((r={})[s.PROMISE]=function(t,r){return function(n,e,t,r){return w(c.h.CROSS_DOMAIN_ZALGO_PROMISE,{then:A(n,e,function(n,e){return t.then(n,e)},r)})}(n,e,t,r)},r[s.FUNCTION]=function(t,r){return A(n,e,t,r)},r[s.OBJECT]=function(n){return Object(a.isWindow)(n)||S.isProxyWindow(n)?(e=n,w(c.h.CROSS_DOMAIN_WINDOW,S.serialize(e))):n;var e},r))}function T(n,e,t){var r;return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;if(n!==s.UNDEFINED)return JSON.parse(n,function(n,t){if(d(this))return t;var r=void 0,o=void 0;if(d(t)?(r=t.__type__,o=t.__val__):(r=l(t),o=t),!r)return o;var i=e[r]||v[r];return i?i(o,n):o})}(t,((r={})[c.h.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return e=n.then,new y.a(e);var e},r[c.h.CROSS_DOMAIN_FUNCTION]=function(t){return function(n,e,t){var r=t.id,o=t.name;function i(){var t=Array.prototype.slice.call(arguments);return O.a.send(n,c.d.METHOD,{id:r,name:o,args:t},{domain:e}).then(function(n){return n.data.result})}return i.fireAndForget=function(){var t=Array.prototype.slice.call(arguments);return O.a.send(n,c.d.METHOD,{id:r,name:o,args:t},{domain:e,fireAndForget:!0})},i.__name__=o,i.__xdomain__=!0,i.source=n,i.origin=e,i}(n,e,t)},r[c.h.CROSS_DOMAIN_WINDOW]=function(n){return e=n,S.deserialize(e);var e},r))}var R={};R[c.g.POST_MESSAGE]=function(n,e,r){try{t(12).emulateIERestrictions(window,n)}catch(n){return}(Array.isArray(r)?r:"string"==typeof r?[r]:[c.i]).map(function(e){if(0===e.indexOf(c.f.MOCK)){if(window.location.protocol===c.f.FILE)return c.i;if(!Object(a.isActuallySameDomain)(n))throw new Error("Attempting to send messsage to mock domain "+e+", but window is actually cross-domain");return Object(a.getActualDomain)(n)}return 0===e.indexOf(c.f.FILE)?c.i:e}).forEach(function(t){return n.postMessage(e,t)})};var I=t(13),M=I.sendBridgeMessage,N=I.needsBridgeForBrowser,C=I.isBridge;R[c.g.BRIDGE]=function(n,e,t){if(N()||C()){if(Object(a.isSameDomain)(n))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==Object(a.isSameTopWindow)(window,n))throw new Error("Can only use bridge to communicate between two different windows, not between frames");return M(n,t,e)}},R[c.g.GLOBAL]=function(n,e){if(Object(i.f)()){if(!Object(a.isSameDomain)(n))throw new Error("Post message through global disabled between different domain windows");if(!1!==Object(a.isSameTopWindow)(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var t=n[c.j.POSTROBOT];if(!t)throw new Error("Can not find postRobot global on foreign window");return t.receiveMessage({source:window,origin:Object(a.getDomain)(),data:e})}};var x=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n};function k(n,e,t){return y.a.try(function(){var r;if(Object(a.isWindowClosed)(n))throw new Error("Window is closed");var o=D(n,e,((r={})[c.j.POSTROBOT]=x({id:Object(u.uniqueID)()},t),r)),i=[];return y.a.map(Object.keys(R),function(t){return y.a.try(function(){if(!c.b.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);return R[t](n,o,e)}).then(function(){return i.push(t+": success"),!0},function(n){return i.push(t+": "+Object(u.stringifyError)(n)+"\n"),!1})}).then(function(n){var e=n.some(Boolean),r=t.type+" "+t.name+" "+(e?"success":"error")+":\n - "+i.join("\n - ")+"\n";if(!e)throw new Error(r)})})}var B=Object(O.b)("responseListeners"),L=Object(O.c)("requestListeners"),U=Object(O.b)("erroredResponseListeners");O.a.WINDOW_WILDCARD=O.a.WINDOW_WILDCARD||new function(){};var F,z="__domain_regex__";function G(n){return B.get(n)}function H(n){B.del(n)}function q(n){return U.has(n)}function K(n){var e=n.name,t=n.win,r=n.domain;if(t===c.i&&(t=null),r===c.i&&(r=null),!e)throw new Error("Name required to get request listener");for(var o=0,i=[t,O.a.WINDOW_WILDCARD],u=null==i?0:i.length;o<u;o++){var s=i[o];if(s){var f=L.get(s);if(f){var d=f[e];if(d){if(r&&"string"==typeof r){if(d[r])return d[r];if(d[z])for(var l=0,w=d[z],h=null==w?0:w.length;l<h;l++){var m=w[l],p=m.regex,v=m.listener;if(Object(a.matchDomain)(p,r))return v}}if(d[c.i])return d[c.i]}}}}}var J=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Q=((F={})[c.e.REQUEST]=function(n,e,t){var r=K({name:t.name,win:n,domain:e});function o(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.fireAndForget||Object(a.isWindowClosed)(n)?y.a.resolve():k(n,e,J({type:r,hash:t.hash,name:t.name},o))}return y.a.all([o(c.e.ACK),y.a.try(function(){if(!r)throw new Error("No handler found for post message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Request origin "+e+" does not match domain "+r.domain.toString());var o=t.data;return r.handler({source:n,origin:e,data:o})}).then(function(n){return o(c.e.RESPONSE,{ack:c.c.SUCCESS,data:n})},function(n){return o(c.e.RESPONSE,{ack:c.c.ERROR,error:n})})]).then(u.noop).catch(function(n){if(r&&r.handleError)return r.handleError(n);throw n})},F[c.e.ACK]=function(n,e,t){if(!q(t.hash)){var r=G(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Ack origin "+e+" does not match domain "+r.domain.toString());r.ack=!0}},F[c.e.RESPONSE]=function(n,e,t){if(!q(t.hash)){var r=G(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Response origin "+e+" does not match domain "+Object(a.stringifyDomainPattern)(r.domain));if(H(t.hash),t.ack===c.c.ERROR)return r.respond(t.error,null);if(t.ack===c.c.SUCCESS){var o=t.data;return r.respond(null,{source:n,origin:e,data:o})}}},F),X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Z=Object(O.b)("receivedMessages");function Y(n){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var e=n.source,t=n.origin,r=function(n,e,t){var r=void 0;try{r=T(e,t,n)}catch(n){return}if(r&&"object"===(void 0===r?"undefined":X(r))&&null!==r&&(r=r[c.j.POSTROBOT])&&"object"===(void 0===r?"undefined":X(r))&&null!==r&&r.type&&"string"==typeof r.type&&Q[r.type])return r}(n.data,e,t);r&&(Object(i.e)(e),Z.has(r.id)||(Z.set(r.id,!0),Object(a.isWindowClosed)(e)&&!r.fireAndForget||Q[r.type](e,t,r)))}function V(n){try{Object(u.noop)(n.source)}catch(n){return}var e={source:n.source||n.sourceElement,origin:n.origin||n.originalEvent&&n.originalEvent.origin,data:n.data};try{t(12).emulateIERestrictions(e.source,window)}catch(n){return}Y(e)}O.a.receiveMessage=Y;var $=Object(O.c)("requestPromises");function nn(n){return y.a.try(function(){if(!n.name)throw new Error("Expected options.name");var e=n.name,t=void 0,r=void 0;if("string"==typeof n.window){var o=document.getElementById(n.window);if(!o)throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be a valid element id");if("iframe"!==o.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be an iframe");if(!o.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");t=o.contentWindow}else if(n.window instanceof HTMLIFrameElement){if("iframe"!==n.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be an iframe");if(n.window&&!n.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");n.window&&n.window.contentWindow&&(t=n.window.contentWindow)}else t=n.window;if(!t)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var s=t;r=n.domain||c.i;var f=n.name+"_"+Object(u.uniqueID)();if(Object(a.isWindowClosed)(s))throw new Error("Target window is closed");var d=!1,l=$.getOrSet(s,function(){return[]}),w=y.a.try(function(){if(Object(a.isAncestor)(window,s))return Object(i.a)(s,n.timeout||c.b.CHILD_WINDOW_TIMEOUT)}).then(function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).domain;if(Object(u.isRegex)(r)&&!n)return Object(i.g)(s)}).then(function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).domain;if(Object(u.isRegex)(r)){if(!Object(a.matchDomain)(r,t))throw new Error("Remote window domain "+t+" does not match regex: "+r.toString());r=t}if("string"!=typeof r&&!Array.isArray(r))throw new TypeError("Expected domain to be a string or array");var o=r;return new y.a(function(t,r){var u=void 0;if(n.fireAndForget||function(n,e){B.set(n,e)}(f,u={name:e,window:s,domain:o,respond:function(n,e){n||(d=!0,l.splice(l.indexOf(w,1))),n?r(n):t(e)}}),k(s,o,{type:c.e.REQUEST,hash:f,name:e,data:n.data,fireAndForget:Boolean(n.fireAndForget)}).catch(r),n.fireAndForget)return t();var h=Object(i.d)(s)?c.b.ACK_TIMEOUT_KNOWN:c.b.ACK_TIMEOUT,m=n.timeout||c.b.RES_TIMEOUT,p=h,v=m,g=100;setTimeout(function n(){if(!d){if(Object(a.isWindowClosed)(s))return u.ack?r(new Error("Window closed for "+e+" before response")):r(new Error("Window closed for "+e+" before ack"));if(p=Math.max(p-g,0),-1!==v&&(v=Math.max(v-g,0)),u.ack){if(-1===v)return;g=Math.min(v,2e3)}else{if(0===p)return r(new Error("No ack for postMessage "+e+" in "+Object(a.getDomain)()+" in "+h+"ms"));if(0===v)return r(new Error("No response for postMessage "+e+" in "+Object(a.getDomain)()+" in "+m+"ms"))}setTimeout(n,g)}},g)})});return w.catch(function(){!function(n){U.set(n,!0)}(f),H(f)}),l.push(w),w})}function en(n,e,t,r){return(r=r||{}).window=n,r.name=e,r.data=t,nn(r)}function tn(n,e,t){var r=Object(a.getAncestor)();return r?en(r,n,e,t):new y.a(function(n,e){return e(new Error("Window does not have a parent"))})}function rn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!n.window)throw new Error("Expected options.window");var e=n.window;return{send:function(t,r){return en(e,t,r,n)}}}O.a.send=en;var on="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function an(n){if(!n.name)throw new Error("Expected options.name");if(!n.handler)throw new Error("Expected options.handler");var e=n.name,t=n.window,r=n.domain,o={handler:n.handler,handleError:n.errorHandler||function(n){throw n},window:t,domain:r||c.i,name:e},i=function n(e,t){var r=e.name,o=e.win,i=e.domain;if(!r||"string"!=typeof r)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],s=0,f=o,d=null==f?0:f.length;s<d;s++){var l=f[s];a.push(n({name:r,domain:i,win:l},t))}return{cancel:function(){for(var n=0,e=null==a?0:a.length;n<e;n++)a[n].cancel()}}}if(Array.isArray(i)){for(var w=[],h=0,m=i,p=null==m?0:m.length;h<p;h++){var v=m[h];w.push(n({name:r,win:o,domain:v},t))}return{cancel:function(){for(var n=0,e=null==w?0:w.length;n<e;n++)w[n].cancel()}}}var g=K({name:r,win:o,domain:i});if(o&&o!==c.i||(o=O.a.WINDOW_WILDCARD),i=i||c.i,g)throw o&&i?new Error("Request listener already exists for "+r+" on domain "+i.toString()+" for "+(o===O.a.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+r+" for "+(o===O.a.WINDOW_WILDCARD?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+r+" on domain "+i.toString()):new Error("Request listener already exists for "+r);var y=L.getOrSet(o,function(){return{}}),b=Object(u.getOrSet)(y,r,function(){return{}}),E=i.toString(),_=void 0,S=void 0;return Object(u.isRegex)(i)?(_=Object(u.getOrSet)(b,z,function(){return[]}),S={regex:i,listener:t},_.push(S)):b[E]=t,{cancel:function(){delete b[E],S&&(_.splice(_.indexOf(S,1)),_.length||delete b[z]),Object.keys(b).length||delete y[r],o&&!Object.keys(y).length&&L.del(o)}}}({name:e,win:t,domain:r},o);if(n.once){var s=o.handler;o.handler=Object(u.once)(function(){return i.cancel(),s.apply(this,arguments)})}if(o.window&&n.errorOnClose)var f=Object(u.safeInterval)(function(){t&&"object"===(void 0===t?"undefined":on(t))&&Object(a.isWindowClosed)(t)&&(f.cancel(),o.handleError(new Error("Post message target window is closed")))},50);return{cancel:function(){i.cancel()}}}function un(n,e,t){return"function"==typeof e&&(t=e,e={}),(e=e||{}).name=n,e.handler=t||e.handler,an(e)}function cn(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments[2];"function"==typeof e&&(t=e,e={}),e=e||{},t=t||e.handler;var r=e.errorHandler,o=new y.a(function(o,i){(e=e||{}).name=n,e.once=!0,e.handler=function(n){if(o(n),t)return t(n)},e.errorHandler=function(n){if(i(n),r)return r(n)}}),i=an(e);return o.cancel=i.cancel,o}function sn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(e,t){return un(e,n,t)}}}function fn(){delete window[c.j.POSTROBOT],window.removeEventListener("message",V)}O.a.on=un;var dn=Object(a.getAncestor)();function ln(n){for(var e=0,t=$.get(n,[]),r=null==t?0:t.length;e<r;e++)t[e].reject(new Error("Window cleaned up before response"))}var wn=t(23);O.a.initialized||(O.a.initialized=!0,Object(u.addEventListener)(window,"message",V),wn&&wn.openTunnelToOpener(),Object(i.c)()),t.d(e,"markWindowKnown",function(){return i.e}),t.d(e,"serializeMessage",function(){return D}),t.d(e,"deserializeMessage",function(){return T}),t.d(e,"ProxyWindow",function(){return S}),t.d(e,"cleanUpWindow",function(){return ln}),t.d(e,"Promise",function(){return y.a}),t.d(e,"bridge",function(){return wn}),t.d(e,"parent",function(){return dn}),t.d(e,"send",function(){return en}),t.d(e,"requestPromises",function(){return $}),t.d(e,"request",function(){return nn}),t.d(e,"sendToParent",function(){return tn}),t.d(e,"client",function(){return rn}),t.d(e,"on",function(){return un}),t.d(e,"listen",function(){return an}),t.d(e,"once",function(){return cn}),t.d(e,"listener",function(){return sn}),t.d(e,"CONFIG",function(){return c.b}),t.d(e,"disable",function(){return fn}),e.default=r},function(n,e,t){"use strict";function r(n){return"[object RegExp]"===Object.prototype.toString.call(n)}var o=t(8);e.h=u,e.g=c,e.a=f,e.d=d,e.j=l,e.m=w,e.b=function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=g(e),r=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return c(v(n)||n)}(e);return r?[].concat(n(r),t):t},e.p=E,e.q=function(n){if(function(){for(var n=0;n<b.length;n++)y(b[n])&&(b.splice(n,1),O.splice(n,1));for(var e=0;e<O.length;e++)E(O[e])&&(b.splice(e,1),O.splice(e,1))}(),n&&n.contentWindow)try{O.push(n.contentWindow),b.push(n)}catch(n){}},e.i=function(n){return(n=n||window).navigator.mockUserAgent||n.navigator.userAgent},e.f=function(n,e){for(var t=m(n),r=0,o=null==t?0:t.length;r<o;r++){var i=t[r];try{if(w(i)&&i.name===e&&-1!==t.indexOf(i))return i}catch(n){}}try{if(-1!==t.indexOf(n.frames[e]))return n.frames[e]}catch(n){}try{if(-1!==t.indexOf(n[e]))return n[e]}catch(n){}},e.l=function(n,e){return n===c(e)},e.c=_,e.k=function(n,e){var t=_(e);if(t)return t===n;if(e===n)return!1;if(v(e)===e)return!1;for(var r=0,o=m(n),i=null==o?0:o.length;r<i;r++)if(o[r]===e)return!0;return!1},e.n=function(n,e){var t=v(n)||n,r=v(e)||e;try{if(t&&r)return t===r}catch(n){}var o=g(n),i=g(e);if(S(o,i))return!0;var a=c(t),u=c(r);return!(a&&S(g(a),i)||(u&&S(g(u),o),1))},e.r=function n(e,t){if("string"==typeof e){if("string"==typeof t)return e===o.b||t===e;if(r(t))return!1;if(Array.isArray(t))return!1}return r(e)?r(t)?e.toString()===t.toString():!Array.isArray(t)&&Boolean(t.match(e)):!!Array.isArray(e)&&(Array.isArray(t)?JSON.stringify(e)===JSON.stringify(t):!r(t)&&e.some(function(e){return n(e,t)}))},e.s=function(n){return Array.isArray(n)?"("+n.join(" | ")+")":r(n)?"RegExp("+n.toString():n.toString()},e.e=function(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):d()},e.o=function(n){try{if(n===window)return!0}catch(n){if(n&&n.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(n))return!0}catch(n){if(n&&n.message===i)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===i)return!0}try{n&&n.__cross_domain_utils_window_check__}catch(n){return!0}return!1};var i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.a.ABOUT}function u(n){if(n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function c(n){if(n&&!u(n))try{return n.opener}catch(n){}}function s(n){try{return n&&n.location&&n.location.href,!0}catch(n){}return!1}function f(n){var e=(n=n||window).location;if(!e)throw new Error("Can not read window location");var t=e.protocol;if(!t)throw new Error("Can not read window protocol");if(t===o.a.FILE)return o.a.FILE+"//";if(t===o.a.ABOUT){var r=u(n);return r&&s(r)?f(r):o.a.ABOUT+"//"}var i=e.host;if(!i)throw new Error("Can not read window host");return t+"//"+i}function d(n){var e=f(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(o.a.MOCK)?n.mockDomain:e}function l(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(a(n)&&s(n))return!0}catch(n){}try{if(f(n)===f(window))return!0}catch(n){}return!1}function w(n){if(!l(n))return!1;try{if(n===window)return!0;if(a(n)&&s(n))return!0;if(d(window)===d(n))return!0}catch(n){}return!1}function h(n,e){if(!n||!e)return!1;var t=u(e);return t?t===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function m(n){var e=[],t=void 0;try{t=n.frames}catch(e){t=n}var r=void 0;try{r=t.length}catch(n){}if(0===r)return e;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch(n){continue}e.push(i)}return e}for(var a=0;a<100;a++){var u=void 0;try{u=t[a]}catch(n){return e}if(!u)return e;e.push(u)}return e}function p(n){for(var e=[],t=0,r=m(n),o=null==r?0:r.length;t<o;t++){var i=r[t];e.push(i);for(var a=0,u=p(i),c=null==u?0:u.length;a<c;a++){var s=u[a];e.push(s)}}return e}function v(n){if(n){try{if(n.top)return n.top}catch(n){}if(u(n)===n)return n;try{if(h(window,n)&&window.top)return window.top}catch(n){}try{if(h(n,window)&&window.top)return window.top}catch(n){}for(var e=0,t=p(n),r=null==t?0:t.length;e<r;e++){var o=t[e];try{if(o.top)return o.top}catch(n){}if(u(o)===o)return o}}}function g(n){var e=v(n);if(!e)throw new Error("Can not determine top window");return[].concat(p(e),[e])}function y(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(n))}var O=[],b=[];function E(n){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==i}if(e&&w(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var t=function(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch(n){}return-1}(O,n);if(-1!==t){var r=b[t];if(r&&y(r))return!0}return!1}function _(n){return c(n=n||window)||u(n)||void 0}function S(n,e){for(var t=0,r=null==n?0:n.length;t<r;t++)for(var o=n[t],i=0,a=null==e?0:e.length;i<a;i++)if(o===e[i])return!0;return!1}},function(n,e){},function(n,e,t){"use strict";t(6),t(11)},function(n,e,t){"use strict";t(6)},function(n,e,t){"use strict";t(2),t(0)},function(n,e){},function(n,e,t){"use strict";t(6)},function(n,e,t){"use strict"},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(13);t.d(e,"openBridge",function(){return r.openBridge}),t.d(e,"linkUrl",function(){return r.linkUrl}),t.d(e,"isBridge",function(){return r.isBridge}),t.d(e,"needsBridge",function(){return r.needsBridge}),t.d(e,"needsBridgeForBrowser",function(){return r.needsBridgeForBrowser}),t.d(e,"hasBridge",function(){return r.hasBridge}),t.d(e,"needsBridgeForWin",function(){return r.needsBridgeForWin}),t.d(e,"needsBridgeForDomain",function(){return r.needsBridgeForDomain}),t.d(e,"openTunnelToOpener",function(){return r.openTunnelToOpener}),t.d(e,"destroyBridges",function(){return r.destroyBridges})}])});
//# sourceMappingURL=post-robot.ie.min.js.map

@@ -1,2 +0,2 @@

!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("postRobot",[],e):"object"==typeof exports?exports.postRobot=e():n.postRobot=e()}("undefined"!=typeof self?self:this,function(){return function(n){var e={};function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:r})},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=9)}([function(n,e,t){"use strict";var r=t(10);t.d(e,"getActualDomain",function(){return r.a}),t.d(e,"getAllWindows",function(){return r.b}),t.d(e,"getAncestor",function(){return r.c}),t.d(e,"getDomain",function(){return r.d}),t.d(e,"getUserAgent",function(){return r.e}),t.d(e,"isActuallySameDomain",function(){return r.f}),t.d(e,"isAncestor",function(){return r.g}),t.d(e,"isSameDomain",function(){return r.h}),t.d(e,"isWindow",function(){return r.i}),t.d(e,"isWindowClosed",function(){return r.j}),t.d(e,"linkFrameWindow",function(){return r.k}),t.d(e,"matchDomain",function(){return r.l}),t.d(e,"stringifyDomainPattern",function(){return r.m});var o=t(11);t.n(o),t(5)},function(n,e,t){"use strict";function r(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var t=e.call(n);if("[object Window]"===t||"[object global]"===t||"[object DOMWindow]"===t)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}function o(){var n=void 0;if("undefined"!=typeof window)n=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");n=window}var e=n.__zalgopromise__=n.__zalgopromise__||{};return e.flushPromises=e.flushPromises||[],e.activeCount=e.activeCount||0,e.possiblyUnhandledPromiseHandlers=e.possiblyUnhandledPromiseHandlers||[],e.dispatchedErrors=e.dispatchedErrors||[],e}var i=function(){function n(e){var t=this;if(function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var r=void 0,o=void 0,i=!1,a=!1,u=!1;try{e(function(n){u?t.resolve(n):(i=!0,r=n)},function(n){u?t.reject(n):(a=!0,o=n)})}catch(n){return void this.reject(n)}u=!0,i?this.resolve(r):a&&this.reject(o)}}return n.prototype.resolve=function(n){if(this.resolved||this.rejected)return this;if(r(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},n.prototype.reject=function(n){var e=this;if(this.resolved||this.rejected)return this;if(r(n))throw new Error("Can not reject promise with another promise");if(!n){var t=n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n);n=new Error("Expected reject to be called with Error, got "+t)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout(function(){e.errorHandled||function(n,e){if(-1===o().dispatchedErrors.indexOf(n)){o().dispatchedErrors.push(n),setTimeout(function(){throw n},1);for(var t=0;t<o().possiblyUnhandledPromiseHandlers.length;t++)o().possiblyUnhandledPromiseHandlers[t](n,e)}}(n,e)},1),this.dispatch(),this},n.prototype.asyncReject=function(n){this.errorHandled=!0,this.reject(n)},n.prototype.dispatch=function(){var e=this,t=this.dispatching,i=this.resolved,a=this.rejected,u=this.handlers;if(!t&&(i||a)){this.dispatching=!0,o().activeCount+=1;for(var c=function(t){var o=u[t],c=o.onSuccess,s=o.onError,f=o.promise,d=void 0;if(i)try{d=c?c(e.value):e.value}catch(n){return f.reject(n),"continue"}else if(a){if(!s)return f.reject(e.error),"continue";try{d=s(e.error)}catch(n){return f.reject(n),"continue"}}d instanceof n&&(d.resolved||d.rejected)?(d.resolved?f.resolve(d.value):f.reject(d.error),d.errorHandled=!0):r(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?f.resolve(d.value):f.reject(d.error):d.then(function(n){f.resolve(n)},function(n){f.reject(n)}):f.resolve(d)},s=0;s<u.length;s++)c(s);u.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&n.flushQueue()}},n.prototype.then=function(e,t){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for success handler");if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for error handler");var r=new n;return this.handlers.push({promise:r,onSuccess:e,onError:t}),this.errorHandled=!0,this.dispatch(),r},n.prototype.catch=function(n){return this.then(void 0,n)},n.prototype.finally=function(e){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(t){return n.try(e).then(function(){return t})},function(t){return n.try(e).then(function(){throw t})})},n.prototype.timeout=function(n,e){var t=this;if(this.resolved||this.rejected)return this;var r=setTimeout(function(){t.resolved||t.rejected||t.reject(e||new Error("Promise timed out after "+n+"ms"))},n);return this.then(function(n){return clearTimeout(r),n})},n.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.resolve=function(e){return e instanceof n?e:r(e)?new n(function(n,t){return e.then(n,t)}):(new n).resolve(e)},n.reject=function(e){return(new n).reject(e)},n.all=function(e){var t=new n,o=e.length,i=[];if(!o)return t.resolve(i),t;for(var a=function(a){var u=e[a];if(u instanceof n){if(u.resolved)return i[a]=u.value,o-=1,"continue"}else if(!r(u))return i[a]=u,o-=1,"continue";n.resolve(u).then(function(n){i[a]=n,0==(o-=1)&&t.resolve(i)},function(n){t.reject(n)})},u=0;u<e.length;u++)a(u);return 0===o&&t.resolve(i),t},n.hash=function(e){var t={};return n.all(Object.keys(e).map(function(r){return n.resolve(e[r]).then(function(n){t[r]=n})})).then(function(){return t})},n.map=function(e,t){return n.all(e.map(t))},n.onPossiblyUnhandledException=function(n){return function(n){return o().possiblyUnhandledPromiseHandlers.push(n),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(n),1)}}}(n)},n.try=function(e,t,r){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=e.apply(t,r||[])}catch(e){return n.reject(e)}return n.resolve(o)},n.delay=function(e){return new n(function(n){setTimeout(n,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||r(e)},n.flush=function(){var e=new n;return o().flushPromises.push(e),0===o().activeCount&&n.flushQueue(),e},n.flushQueue=function(){var n=o().flushPromises;o().flushPromises=[];for(var e=0,t=null==n?0:n.length;e<t;e++)n[e].resolve()},n}();t.d(e,"a",function(){return i})},function(n,e,t){"use strict";t(6);var r=t(7);t.d(e,"addEventListener",function(){return r.a}),t(12),t(13),t(8);var o=t(4);t.d(e,"getOrSet",function(){return o.e}),t.d(e,"isRegex",function(){return o.g}),t.d(e,"memoizePromise",function(){return o.i}),t.d(e,"noop",function(){return o.j}),t.d(e,"once",function(){return o.k}),t.d(e,"safeInterval",function(){return o.m}),t.d(e,"stringifyError",function(){return o.o}),t.d(e,"uniqueID",function(){return o.p}),t.d(e,"weakMapMemoizePromise",function(){return o.q}),t(14);var i=t(15);t.n(i),t(16),t(17)},function(n,e,t){"use strict";t.d({},"WeakMap",function(){return u});var r=t(0);function o(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch(n){}return-1}var i=Object.defineProperty,a=Date.now()%1e9,u=function(){function n(){if(function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),a+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+a,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}return n.prototype._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,t=0;t<e.length;t++){var o=e[t];if(Object(r.isWindow)(o)&&Object(r.isWindowClosed)(o)){if(n)try{n.delete(o)}catch(n){}e.splice(t,1),this.values.splice(t,1),t-=1}}},n.prototype.isSafeToReadWrite=function(n){if(Object(r.isWindow)(n))return!1;try{n&&n.self,n&&n[this.name]}catch(n){return!1}return!0},n.prototype.set=function(n,e){if(!n)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.set(n,e)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=this.name,a=n[r];a&&a[0]===n?a[1]=e:i(n,r,{value:[n,e],writable:!0})}else{this._cleanupClosedWindows();var u=this.keys,c=this.values,s=o(u,n);-1===s?(u.push(n),c.push(e)):c[s]=e}},n.prototype.get=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return e.get(n)}catch(n){delete this.weakmap}if(!this.isSafeToReadWrite(n)){this._cleanupClosedWindows();var t=o(this.keys,n);if(-1===t)return;return this.values[t]}var r=n[this.name];if(r&&r[0]===n)return r[1]},n.prototype.delete=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=n[this.name];t&&t[0]===n&&(t[0]=t[1]=void 0)}else{this._cleanupClosedWindows();var r=this.keys,i=o(r,n);-1!==i&&(r.splice(i,1),this.values.splice(i,1))}},n.prototype.has=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{return e.has(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=n[this.name];return!(!t||t[0]!==n)}return this._cleanupClosedWindows(),-1!==o(this.keys,n)},n.prototype.getOrSet=function(n,e){if(this.has(n))return this.get(n);var t=e();return this.set(n,t),t},n}();t.d(e,"a",function(){return u})},function(n,e,t){"use strict";e.p=a,e.d=function(){if("undefined"!=typeof window)return window;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("No global found")},e.h=function(n){var e=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new o.a;function i(){for(var e=arguments.length,o=Array(e),i=0;i<e;i++)o[i]=arguments[i];var a=r.getOrSet(t.thisNamespace?this:n,function(){return{}}),u=c(o),s=t.time;if(a[u]&&s&&Date.now()-a[u].time<s&&delete a[u],a[u])return a[u].value;var f=Date.now(),d=n.apply(this,arguments);return a[u]={time:f,value:d},a[u].value}return i.reset=function(){r.delete(t.thisNamespace?e:n)},t.name&&(i.displayName=t.name+":memoized"),i},e.i=function(n){var e={};function t(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var i=c(r);return e.hasOwnProperty(i)?e[i]:(e[i]=n.apply(this,arguments).finally(function(){delete e[i]}),e[i])}return t.reset=function(){e={}},t},e.l=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function t(){return r.a.try(n,this,arguments)}return e.name&&(t.displayName=e.name+":promisified"),t},e.f=function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=n.__inline_memoize_cache__=n.__inline_memoize_cache__||{},o=c(t);return r.hasOwnProperty(o)?r[o]:r[o]=e.apply(void 0,t)},e.j=function(){},e.k=function(n){var e=!1;return function(){if(!e)return e=!0,n.apply(this,arguments)}},e.o=function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(t>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+Object.prototype.toString.call(e)+">";if("string"==typeof e)return e;if(e instanceof Error){var r=e&&e.stack,o=e&&e.message;if(r&&o)return-1!==r.indexOf(o)?r:o+"\n"+r;if(r)return r;if(o)return o}return"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(e){return"Error while stringifying error: "+n(e,t+1)}},e.n=function(n){return"string"==typeof n?n:n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n)},e.c=function(n,e){if(!e)return n;if(Object.assign)return Object.assign(n,e);for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},e.m=function(n,e){var t=void 0;return function r(){t=setTimeout(function(){n(),r()},e)}(),{cancel:function(){clearTimeout(t)}}},e.a=function(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()},e.b=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,t=void 0;return function(){var r=this,o=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(r,o)},e)}},e.g=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},t.d(e,"q",function(){return s}),e.e=function(n,e,t){if(n.hasOwnProperty(e))return n[e];var r=t();return n[e]=r,r};var r=t(1),o=t(3),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function a(){var n,e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+(n=(new Date).toISOString().slice(11,19).replace("T","."),window.btoa(n)).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var u=void 0;function c(n){try{return JSON.stringify(Array.prototype.slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(u=u||new o.a,null===n||void 0===n||"object"!==(void 0===n?"undefined":i(n))&&"function"!=typeof n)throw new Error("Invalid object");var e=u.get(n);return e||(e=(void 0===n?"undefined":i(n))+":"+a(),u.set(n,e)),e}(e)+"]":e})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}var s=function(n){var e=new o.a;return function(t){var r=this;return e.getOrSet(t,function(){return n.call(r,t).finally(function(){e.delete(t)})})}}},function(n,e,t){"use strict";t.d(e,"a",function(){return r}),t.d(e,"b",function(){return o});var r={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},o="*"},function(n,e,t){"use strict";e.a=function(){return!!(window.navigator.mockUserAgent||window.navigator.userAgent).match(/Android|webOS|iPhone|iPad|iPod|bada|Symbian|Palm|CriOS|BlackBerry|IEMobile|WindowsMobile|Opera Mini/i)}},function(n,e,t){"use strict";t(1),t(0),t(3);var r=t(4);t(6),e.b=function n(){return Object(r.f)(n,function(){try{if("undefined"==typeof window)return!1;if(window.localStorage){var n=Math.random().toString();window.localStorage.setItem("__test__localStorage__",n);var e=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),n===e)return!0}}catch(n){}return!1})},e.a=function(n,e,t){return n.addEventListener(e,t),{cancel:function(){n.removeEventListener(e,t)}}},"function"==typeof Symbol&&Symbol.iterator,Object.assign,Object.create(Error.prototype)},function(n,e,t){"use strict";e.a=function n(e){var t=e.name,i=e.version,a=void 0===i?"latest":i,u=e.lifetime,c=void 0===u?3e5:u;return Object(r.f)(n,function(){var n="__"+t+"_"+a+"_storage__",e=void 0;function i(t){var i=Object(o.b)(),a=void 0;if(e&&(a=e),!a&&i){var u=window.localStorage.getItem(n);u&&(a=JSON.parse(u))}a||(a=Object(r.d)()[n]),a||(a={id:Object(r.p)()}),a.id||(a.id=Object(r.p)()),e=a;var c=t(a);return i?window.localStorage.setItem(n,JSON.stringify(a)):Object(r.d)()[n]=a,e=null,c}function u(n){return i(function(e){var t=e.__session__,o=Date.now();return t&&o-t.created>c&&(t=null),t||(t={guid:Object(r.p)(),created:o}),e.__session__=t,n(t)})}return{getState:i,getID:function(){return i(function(n){return n.id})},getSessionState:function(n){return u(function(e){return e.state=e.state||{},n(e.state)})},getSessionID:function(){return u(function(n){return n.guid})}}},[{name:t,version:a,lifetime:c}])};var r=t(4),o=t(7)},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={};t.d(r,"markWindowKnown",function(){return O}),t.d(r,"serializeMessage",function(){return M}),t.d(r,"deserializeMessage",function(){return C}),t.d(r,"ProxyWindow",function(){return R}),t.d(r,"cleanUpWindow",function(){return sn}),t.d(r,"Promise",function(){return u.a}),t.d(r,"bridge",function(){return fn}),t.d(r,"parent",function(){return cn}),t.d(r,"send",function(){return V}),t.d(r,"request",function(){return Z}),t.d(r,"sendToParent",function(){return $}),t.d(r,"client",function(){return nn}),t.d(r,"on",function(){return rn}),t.d(r,"listen",function(){return tn}),t.d(r,"once",function(){return on}),t.d(r,"listener",function(){return an}),t.d(r,"CONFIG",function(){return h}),t.d(r,"disable",function(){return un});var o,i=t(3),a=t(0),u=t(1),c=t(2),s={REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},f={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},d={POSTROBOT:"__postRobot__"},l="*",w={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"},h={ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:2e3,ACK_TIMEOUT_KNOWN:1e4,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(o={},o.postrobot_post_message=!0,o.postrobot_bridge=!0,o.postrobot_global=!0,o)};0===window.location.href.indexOf("file:")&&(h.ALLOW_POSTMESSAGE_POPUP=!0);var p=window[d.POSTROBOT]=window[d.POSTROBOT]||{};function m(n){return p.helloPromises.getOrSet(n,function(){return new u.a})}p.registerSelf=function(){},p.instanceID=p.instanceID||Object(c.uniqueID)(),p.helloPromises=p.helloPromises||new i.a,p.onHello=p.onHello||[];var v=Object(c.once)(function(){p.on(f.HELLO,{domain:l},function(n){var e=n.source,t=n.origin;return m(e).resolve({win:e,domain:t}),{instanceID:p.instanceID}})});function y(n){return p.send(n,f.HELLO,{instanceID:p.instanceID},{domain:l,timeout:-1}).then(function(e){var t=e.origin,r=e.data.instanceID;return m(n).resolve({win:n,domain:t}),{win:n,domain:t,instanceID:r}})}var g=Object(c.weakMapMemoizePromise)(function(n){return y(n).then(function(n){return n.instanceID})});function O(n){window.knownWindows.set(n,!0)}window.knownWindows=window.knownWindows||new i.a;var E,_={FUNCTION:"function",ERROR:"error",PROMISE:"promise",REGEX:"regex",DATE:"date",ARRAY:"array",OBJECT:"object",STRING:"string",NUMBER:"number",BOOLEAN:"boolean",NULL:"null",UNDEFINED:"undefined"},b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function S(n){return"object"===(void 0===n?"undefined":b(n))&&null!==n&&"string"==typeof n.__type__}function W(n){return void 0===n?_.UNDEFINED:null===n?_.NULL:Array.isArray(n)?_.ARRAY:"function"==typeof n?_.FUNCTION:"object"===(void 0===n?"undefined":b(n))?n instanceof Error?_.ERROR:"function"==typeof n.then?_.PROMISE:"[object RegExp]"===Object.prototype.toString.call(n)?_.REGEX:"[object Date]"===Object.prototype.toString.call(n)?_.DATE:_.OBJECT:"string"==typeof n?_.STRING:"number"==typeof n?_.NUMBER:"boolean"==typeof n?_.BOOLEAN:void 0}function j(n,e){return{__type__:n,__val__:e}}var P,A=((E={})[_.FUNCTION]=function(){},E[_.ERROR]=function(n){var e=n.message,t=n.stack,r=n.code;return j(_.ERROR,{message:e,stack:t,code:r})},E[_.PROMISE]=function(){},E[_.REGEX]=function(n){return j(_.REGEX,n.source)},E[_.DATE]=function(n){return j(_.DATE,n.toJSON())},E[_.ARRAY]=function(n){return n},E[_.OBJECT]=function(n){return n},E[_.STRING]=function(n){return n},E[_.NUMBER]=function(n){return n},E[_.BOOLEAN]=function(n){return n},E[_.NULL]=function(n){return n},E),D={},I=((P={})[_.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},P[_.ERROR]=function(n){var e=n.message,t=n.stack,r=n.code,o=new Error(e);return o.code=r,o.stack=t+"\n\n"+o.stack,o},P[_.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},P[_.REGEX]=function(n){return new RegExp(n)},P[_.DATE]=function(n){return new Date(n)},P[_.ARRAY]=function(n){return n},P[_.OBJECT]=function(n){return n},P[_.STRING]=function(n){return n},P[_.NUMBER]=function(n){return n},P[_.BOOLEAN]=function(n){return n},P[_.NULL]=function(n){return n},P),T={};p.winToProxyWindow=p.winToProxyWindow||new i.a,p.idToProxyWindow=p.idToProxyWindow||{};var R=function(){function n(e,t){!function(e,t){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this),this.serializedWindow=e,this.actualWindowPromise=new u.a,t&&this.setWindow(t),this.serializedWindow.getInstanceID=Object(c.memoizePromise)(this.serializedWindow.getInstanceID)}return n.prototype.setLocation=function(n){var e=this;return u.a.try(function(){if(!e.actualWindow)return e.serializedWindow.setLocation(n);e.actualWindow.location=n}).then(function(){return e})},n.prototype.setName=function(n){var e=this;return u.a.try(function(){if(!e.actualWindow)return e.serializedWindow.setName(n);if(!Object(a.isSameDomain)(e.actualWindow))throw new Error("Can not set name for window on different domain");e.actualWindow.name=n,e.actualWindow.frameElement&&e.actualWindow.frameElement.setAttribute("name",n)}).then(function(){return e})},n.prototype.close=function(){var n=this;return u.a.try(function(){if(!n.actualWindow)return n.serializedWindow.close();n.actualWindow.close()}).then(function(){return n})},n.prototype.focus=function(){var n=this;return u.a.try(function(){if(!n.actualWindow)return n.serializedWindow.focus();n.actualWindow.focus()}).then(function(){return n})},n.prototype.isClosed=function(){var n=this;return u.a.try(function(){return n.actualWindow?Object(a.isWindowClosed)(n.actualWindow):n.serializedWindow.isClosed()})},n.prototype.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(n)},n.prototype.matchWindow=function(n){var e=this;return u.a.try(function(){return e.actualWindow?n===e.actualWindow:u.a.all([e.getInstanceID(),g(n)]).then(function(t){var r=t[0]===t[1];return r&&e.setWindow(n),r})})},n.prototype.unwrap=function(){return this.actualWindow||this},n.prototype.awaitWindow=function(){return this.actualWindowPromise},n.prototype.getInstanceID=function(){return this.actualWindow?g(this.actualWindow):this.serializedWindow.getInstanceID()},n.prototype.serialize=function(){return this.serializedWindow},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e){return n.toProxyWindow(e).serialize()},n.deserialize=function(e){return Object(c.getOrSet)(p.idToProxyWindow,e.id,function(){return new n(e)})},n.isProxyWindow=function(e){return e instanceof n},n.toProxyWindow=function(e){return n.isProxyWindow(e)?e:p.winToProxyWindow.getOrSet(e,function(){var t=Object(c.uniqueID)();return p.idToProxyWindow[t]=new n({id:t,getInstanceID:function(){return g(e)},close:function(){return u.a.try(function(){e.close()})},focus:function(){return u.a.try(function(){e.focus()})},isClosed:function(){return u.a.try(function(){return Object(a.isWindowClosed)(e)})},setLocation:function(n){return u.a.try(function(){if(Object(a.isSameDomain)(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(n)}catch(n){}e.location=n})},setName:function(n){return u.a.try(function(){e.name=n})}},e),p.idToProxyWindow[t]})},n}();p.methods=p.methods||new i.a,p.proxyWindowMethods=p.proxyWindowMethods||{},p.listeningForFunctions=p.listeningForFunctions||!1;var N=Object(c.once)(function(){p.listeningForFunctions||(p.listeningForFunctions=!0,p.on(f.METHOD,{origin:l},function(n){var e=n.source,t=n.origin,r=n.data,o=r.id,i=r.name;return u.a.try(function(){var n=(p.methods.get(e)||{})[r.id]||p.proxyWindowMethods[o];if(!n)throw new Error("Could not find method with id: "+r.id);var i=n.proxy,u=n.domain,c=n.val;if(!Object(a.matchDomain)(u,t))throw new Error("Method domain "+n.domain+" does not match origin "+t);return i?i.matchWindow(e).then(function(n){if(!n)throw new Error("Proxy window does not match source");return delete p.proxyWindowMethods[o],c}):c}).then(function(n){return n.apply({source:e,origin:t,data:r},r.args)}).then(function(n){return{result:n,id:o,name:i}})}))});function x(n,e,t,r){N();var o=Object(c.uniqueID)();return n=R.unwrap(n),R.isProxyWindow(n)?p.proxyWindowMethods[o]={proxy:n,domain:e,val:t}:p.methods.getOrSet(n,function(){return{}})[o]={domain:e,val:t},j(w.CROSS_DOMAIN_FUNCTION,{id:o,name:t.name||r})}function M(n,e,t){var r;return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D,t=JSON.stringify(n,function(n){var t=this[n];if(S(this))return t;var r=W(t);if(!r)return t;var o=e[r]||A[r];return o?o(t,n):t});return void 0===t?_.UNDEFINED:t}(t,((r={})[_.PROMISE]=function(t,r){return function(n,e,t,r){return j(w.CROSS_DOMAIN_ZALGO_PROMISE,{then:x(n,e,function(n,e){return t.then(n,e)},r)})}(n,e,t,r)},r[_.FUNCTION]=function(t,r){return x(n,e,t,r)},r[_.OBJECT]=function(n){return Object(a.isWindow)(n)||R.isProxyWindow(n)?(e=n,j(w.CROSS_DOMAIN_WINDOW,R.serialize(e))):n;var e},r))}function C(n,e,t){var r;return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T;if(n!==_.UNDEFINED)return JSON.parse(n,function(n,t){if(S(this))return t;var r=void 0,o=void 0;if(S(t)?(r=t.__type__,o=t.__val__):(r=W(t),o=t),!r)return o;var i=e[r]||I[r];return i?i(o,n):o})}(t,((r={})[w.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return e=n.then,new u.a(e);var e},r[w.CROSS_DOMAIN_FUNCTION]=function(t){return function(n,e,t){var r=t.id,o=t.name;function i(){var t=Array.prototype.slice.call(arguments);return p.send(n,f.METHOD,{id:r,name:o,args:t},{domain:e}).then(function(n){return n.data.result})}return i.fireAndForget=function(){var t=Array.prototype.slice.call(arguments);return p.send(n,f.METHOD,{id:r,name:o,args:t},{domain:e,fireAndForget:!0})},i.__name__=o,i.__xdomain__=!0,i.source=n,i.origin=e,i}(n,e,t)},r[w.CROSS_DOMAIN_WINDOW]=function(n){return e=n,R.deserialize(e);var e},r))}var k={postrobot_post_message:function(n,e,t){(Array.isArray(t)?t:"string"==typeof t?[t]:[l]).map(function(e){if(0===e.indexOf("mock:")){if("file:"===window.location.protocol)return l;if(!Object(a.isActuallySameDomain)(n))throw new Error("Attempting to send messsage to mock domain "+e+", but window is actually cross-domain");return Object(a.getActualDomain)(n)}return 0===e.indexOf("file:")?l:e}).forEach(function(t){return n.postMessage(e,t)})}},L=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n};function U(n,e,t){return u.a.try(function(){var r;if(Object(a.isWindowClosed)(n))throw new Error("Window is closed");var o=M(n,e,((r={})[d.POSTROBOT]=L({id:Object(c.uniqueID)()},t),r)),i=[];return u.a.map(Object.keys(k),function(t){return u.a.try(function(){if(!h.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);return k[t](n,o,e)}).then(function(){return i.push(t+": success"),!0},function(n){return i.push(t+": "+Object(c.stringifyError)(n)+"\n"),!1})}).then(function(n){var e=n.some(Boolean),r=t.type+" "+t.name+" "+(e?"success":"error")+":\n - "+i.join("\n - ")+"\n";if(!e)throw new Error(r)})})}p.responseListeners=p.responseListeners||{},p.requestListeners=p.requestListeners||{},p.WINDOW_WILDCARD=p.WINDOW_WILDCARD||new function(){},p.erroredResponseListeners=p.erroredResponseListeners||{};var z,F="__domain_regex__";function B(n){return p.responseListeners[n]}function q(n){delete p.responseListeners[n]}function H(n){return Boolean(p.erroredResponseListeners[n])}function G(n){var e=n.name,t=n.win,r=n.domain;if(t===l&&(t=null),r===l&&(r=null),!e)throw new Error("Name required to get request listener");var o=p.requestListeners[e];if(o)for(var i=0,u=[t,p.WINDOW_WILDCARD],c=null==u?0:u.length;i<c;i++){var s=u[i],f=s&&o.get(s);if(f){if(r&&"string"==typeof r){if(f[r])return f[r];if(f[F])for(var d=0,w=f[F],h=null==w?0:w.length;d<h;d++){var m=w[d],v=m.regex,y=m.listener;if(Object(a.matchDomain)(v,r))return y}}if(f[l])return f[l]}}}var J=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},K=((z={})[s.REQUEST]=function(n,e,t){var r=G({name:t.name,win:n,domain:e});function o(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.fireAndForget||Object(a.isWindowClosed)(n)?u.a.resolve():U(n,e,J({type:r,hash:t.hash,name:t.name},o))}return u.a.all([o(s.ACK),u.a.try(function(){if(!r)throw new Error("No handler found for post message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Request origin "+e+" does not match domain "+r.domain.toString());var o=t.data;return r.handler({source:n,origin:e,data:o})}).then(function(n){return o(s.RESPONSE,{ack:"success",data:n})},function(n){return o(s.RESPONSE,{ack:"error",error:n})})]).then(c.noop).catch(function(n){if(r&&r.handleError)return r.handleError(n);throw n})},z[s.ACK]=function(n,e,t){if(!H(t.hash)){var r=B(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Ack origin "+e+" does not match domain "+r.domain.toString());r.ack=!0}},z[s.RESPONSE]=function(n,e,t){if(!H(t.hash)){var r=B(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(a.matchDomain)(r.domain,e))throw new Error("Response origin "+e+" does not match domain "+Object(a.stringifyDomainPattern)(r.domain));if(q(t.hash),"error"===t.ack)return r.respond(t.error,null);if("success"===t.ack){var o=t.data;return r.respond(null,{source:n,origin:e,data:o})}}},z),Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function X(n){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var e=n.source,t=n.origin,r=function(n,e,t){var r=void 0;try{r=C(e,t,n)}catch(n){return}if(r&&"object"===(void 0===r?"undefined":Q(r))&&null!==r&&(r=r[d.POSTROBOT])&&"object"===(void 0===r?"undefined":Q(r))&&null!==r&&r.type&&"string"==typeof r.type&&K[r.type])return r}(n.data,e,t);r&&(O(e),-1===p.receivedMessages.indexOf(r.id)&&(p.receivedMessages.push(r.id),Object(a.isWindowClosed)(e)&&!r.fireAndForget||K[r.type](e,t,r)))}function Y(n){try{Object(c.noop)(n.source)}catch(n){return}X({source:n.source||n.sourceElement,origin:n.origin||n.originalEvent&&n.originalEvent.origin,data:n.data})}function Z(n){return u.a.try(function(){if(!n.name)throw new Error("Expected options.name");var e=n.name,t=void 0,r=void 0;if("string"==typeof n.window){var o=document.getElementById(n.window);if(!o)throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be a valid element id");if("iframe"!==o.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be an iframe");if(!o.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");t=o.contentWindow}else if(n.window instanceof HTMLIFrameElement){if("iframe"!==n.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be an iframe");if(n.window&&!n.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");n.window&&n.window.contentWindow&&(t=n.window.contentWindow)}else t=n.window;if(!t)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var i=t;r=n.domain||l;var f=n.name+"_"+Object(c.uniqueID)();if(Object(a.isWindowClosed)(i))throw new Error("Target window is closed");var d=!1,w=p.requestPromises.get(i);w||(w=[],p.requestPromises.set(i,w));var v=u.a.try(function(){if(Object(a.isAncestor)(window,i))return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",r=m(n);return-1!==e&&(r=r.timeout(e,new Error(t+" did not load after "+e+"ms"))),r}(i,n.timeout||h.CHILD_WINDOW_TIMEOUT)}).then(function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).domain;if(Object(c.isRegex)(r)&&!n)return y(i)}).then(function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).domain;if(Object(c.isRegex)(r)){if(!Object(a.matchDomain)(r,t))throw new Error("Remote window domain "+t+" does not match regex: "+r.toString());r=t}if("string"!=typeof r&&!Array.isArray(r))throw new TypeError("Expected domain to be a string or array");var o=r;return new u.a(function(t,r){var u=void 0;if(n.fireAndForget||function(n,e){p.responseListeners[n]=e}(f,u={name:e,window:i,domain:o,respond:function(n,e){n||(d=!0,w.splice(w.indexOf(v,1))),n?r(n):t(e)}}),U(i,o,{type:s.REQUEST,hash:f,name:e,data:n.data,fireAndForget:Boolean(n.fireAndForget)}).catch(r),n.fireAndForget)return t();var c=function(n){return window.knownWindows.get(n,!1)}(i)?h.ACK_TIMEOUT_KNOWN:h.ACK_TIMEOUT,l=n.timeout||h.RES_TIMEOUT,m=c,y=l,g=100;setTimeout(function n(){if(!d){if(Object(a.isWindowClosed)(i))return u.ack?r(new Error("Window closed for "+e+" before response")):r(new Error("Window closed for "+e+" before ack"));if(m=Math.max(m-g,0),-1!==y&&(y=Math.max(y-g,0)),u.ack){if(-1===y)return;g=Math.min(y,2e3)}else{if(0===m)return r(new Error("No ack for postMessage "+e+" in "+Object(a.getDomain)()+" in "+c+"ms"));if(0===y)return r(new Error("No response for postMessage "+e+" in "+Object(a.getDomain)()+" in "+l+"ms"))}setTimeout(n,g)}},g)})});return v.catch(function(){!function(n){p.erroredResponseListeners[n]=!0}(f),q(f)}),w.push(v),v})}function V(n,e,t,r){return(r=r||{}).window=n,r.name=e,r.data=t,Z(r)}function $(n,e,t){var r=Object(a.getAncestor)();return r?V(r,n,e,t):new u.a(function(n,e){return e(new Error("Window does not have a parent"))})}function nn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!n.window)throw new Error("Expected options.window");var e=n.window;return{send:function(t,r){return V(e,t,r,n)}}}p.receivedMessages=p.receivedMessages||[],p.receiveMessage=X,p.requestPromises=p.requestPromises||new i.a,p.send=V;var en="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function tn(n){if(!n.name)throw new Error("Expected options.name");if(!n.handler)throw new Error("Expected options.handler");var e=n.name,t=n.window,r=n.domain,o={handler:n.handler,handleError:n.errorHandler||function(n){throw n},window:t,domain:r||l,name:e},u=function n(e,t){var r=e.name,o=e.win,a=e.domain;if(!r||"string"!=typeof r)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var u=[],s=0,f=o,d=null==f?0:f.length;s<d;s++){var w=f[s];u.push(n({name:r,domain:a,win:w},t))}return{cancel:function(){for(var n=0,e=null==u?0:u.length;n<e;n++)u[n].cancel()}}}if(Array.isArray(a)){for(var h=[],m=0,v=a,y=null==v?0:v.length;m<y;m++){var g=v[m];h.push(n({name:r,win:o,domain:g},t))}return{cancel:function(){for(var n=0,e=null==h?0:h.length;n<e;n++)h[n].cancel()}}}var O=G({name:r,win:o,domain:a});if(o&&o!==l||(o=p.WINDOW_WILDCARD),a=a||l,O)throw o&&a?new Error("Request listener already exists for "+r+" on domain "+a.toString()+" for "+(o===p.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+r+" for "+(o===p.WINDOW_WILDCARD?"wildcard":"specified")+" window"):a?new Error("Request listener already exists for "+r+" on domain "+a.toString()):new Error("Request listener already exists for "+r);var E=p.requestListeners,_=E[r];_||(_=new i.a,E[r]=_);var b=_.get(o);b||(b={},_.set(o,b));var S=a.toString(),W=b[F],j=void 0;return Object(c.isRegex)(a)?(W||(W=[],b[F]=W),j={regex:a,listener:t},W.push(j)):b[S]=t,{cancel:function(){b&&(delete b[S],o&&0===Object.keys(b).length&&_.delete(o),j&&W.splice(W.indexOf(j,1)))}}}({name:e,win:t,domain:r},o);if(n.once){var s=o.handler;o.handler=Object(c.once)(function(){return u.cancel(),s.apply(this,arguments)})}if(o.window&&n.errorOnClose)var f=Object(c.safeInterval)(function(){t&&"object"===(void 0===t?"undefined":en(t))&&Object(a.isWindowClosed)(t)&&(f.cancel(),o.handleError(new Error("Post message target window is closed")))},50);return{cancel:function(){u.cancel()}}}function rn(n,e,t){return"function"==typeof e&&(t=e,e={}),(e=e||{}).name=n,e.handler=t||e.handler,tn(e)}function on(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments[2];"function"==typeof e&&(t=e,e={}),e=e||{},t=t||e.handler;var r=e.errorHandler,o=new u.a(function(o,i){(e=e||{}).name=n,e.once=!0,e.handler=function(n){if(o(n),t)return t(n)},e.errorHandler=function(n){if(i(n),r)return r(n)}}),i=tn(e);return o.cancel=i.cancel,o}function an(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(e,t){return rn(e,n,t)}}}function un(){delete window[d.POSTROBOT],window.removeEventListener("message",Y)}p.on=rn;var cn=Object(a.getAncestor)();function sn(n){var e=p.requestPromises.get(n);if(e)for(var t=0,r=null==e?0:e.length;t<r;t++)e[t].reject(new Error("No response from window - cleaned up"));p.popupWindowsByWin&&p.popupWindowsByWin.delete(n),p.remoteWindows&&p.remoteWindows.delete(n),p.requestPromises.delete(n),p.methods.delete(n),p.helloPromises.delete(n)}var fn=null;p.initialized||(p.initialized=!0,Object(c.addEventListener)(window,"message",Y),fn&&fn.openTunnelToOpener(),function(){v();for(var n=0,e=Object(a.getAllWindows)(),t=null==e?0:e.length;n<t;n++){var r=e[n];r!==window&&y(r).catch(c.noop)}}()),t.d(e,"markWindowKnown",function(){return O}),t.d(e,"serializeMessage",function(){return M}),t.d(e,"deserializeMessage",function(){return C}),t.d(e,"ProxyWindow",function(){return R}),t.d(e,"cleanUpWindow",function(){return sn}),t.d(e,"Promise",function(){return u.a}),t.d(e,"bridge",function(){return fn}),t.d(e,"parent",function(){return cn}),t.d(e,"send",function(){return V}),t.d(e,"request",function(){return Z}),t.d(e,"sendToParent",function(){return $}),t.d(e,"client",function(){return nn}),t.d(e,"on",function(){return rn}),t.d(e,"listen",function(){return tn}),t.d(e,"once",function(){return on}),t.d(e,"listener",function(){return an}),t.d(e,"CONFIG",function(){return h}),t.d(e,"disable",function(){return un}),e.default=r},function(n,e,t){"use strict";function r(n){return"[object RegExp]"===Object.prototype.toString.call(n)}var o=t(5);e.a=f,e.d=d,e.f=l,e.h=w,e.b=function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=function(n){var e=v(n);if(!e)throw new Error("Can not determine top window");return[].concat(m(e),[e])}(e),r=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return c(v(n)||n)}(e);return r?[].concat(n(r),t):t},e.j=E,e.k=function(n){if(function(){for(var n=0;n<O.length;n++)y(O[n])&&(O.splice(n,1),g.splice(n,1));for(var e=0;e<g.length;e++)E(g[e])&&(O.splice(e,1),g.splice(e,1))}(),n&&n.contentWindow)try{g.push(n.contentWindow),O.push(n)}catch(n){}},e.e=function(n){return(n=n||window).navigator.mockUserAgent||n.navigator.userAgent},e.c=_,e.g=function(n,e){var t=_(e);if(t)return t===n;if(e===n)return!1;if(v(e)===e)return!1;for(var r=0,o=p(n),i=null==o?0:o.length;r<i;r++)if(o[r]===e)return!0;return!1},e.l=function n(e,t){if("string"==typeof e){if("string"==typeof t)return e===o.b||t===e;if(r(t))return!1;if(Array.isArray(t))return!1}return r(e)?r(t)?e.toString()===t.toString():!Array.isArray(t)&&Boolean(t.match(e)):!!Array.isArray(e)&&(Array.isArray(t)?JSON.stringify(e)===JSON.stringify(t):!r(t)&&e.some(function(e){return n(e,t)}))},e.m=function(n){return Array.isArray(n)?"("+n.join(" | ")+")":r(n)?"RegExp("+n.toString():n.toString()},e.i=function(n){try{if(n===window)return!0}catch(n){if(n&&n.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(n))return!0}catch(n){if(n&&n.message===i)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===i)return!0}try{n&&n.__cross_domain_utils_window_check__}catch(n){return!0}return!1};var i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.a.ABOUT}function u(n){if(n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function c(n){if(n&&!u(n))try{return n.opener}catch(n){}}function s(n){try{return n&&n.location&&n.location.href,!0}catch(n){}return!1}function f(n){var e=(n=n||window).location;if(!e)throw new Error("Can not read window location");var t=e.protocol;if(!t)throw new Error("Can not read window protocol");if(t===o.a.FILE)return o.a.FILE+"//";if(t===o.a.ABOUT){var r=u(n);return r&&s(r)?f(r):o.a.ABOUT+"//"}var i=e.host;if(!i)throw new Error("Can not read window host");return t+"//"+i}function d(n){var e=f(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(o.a.MOCK)?n.mockDomain:e}function l(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(a(n)&&s(n))return!0}catch(n){}try{if(f(n)===f(window))return!0}catch(n){}return!1}function w(n){if(!l(n))return!1;try{if(n===window)return!0;if(a(n)&&s(n))return!0;if(d(window)===d(n))return!0}catch(n){}return!1}function h(n,e){if(!n||!e)return!1;var t=u(e);return t?t===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function p(n){var e=[],t=void 0;try{t=n.frames}catch(e){t=n}var r=void 0;try{r=t.length}catch(n){}if(0===r)return e;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch(n){continue}e.push(i)}return e}for(var a=0;a<100;a++){var u=void 0;try{u=t[a]}catch(n){return e}if(!u)return e;e.push(u)}return e}function m(n){for(var e=[],t=0,r=p(n),o=null==r?0:r.length;t<o;t++){var i=r[t];e.push(i);for(var a=0,u=m(i),c=null==u?0:u.length;a<c;a++){var s=u[a];e.push(s)}}return e}function v(n){if(n){try{if(n.top)return n.top}catch(n){}if(u(n)===n)return n;try{if(h(window,n)&&window.top)return window.top}catch(n){}try{if(h(n,window)&&window.top)return window.top}catch(n){}for(var e=0,t=m(n),r=null==t?0:t.length;e<r;e++){var o=t[e];try{if(o.top)return o.top}catch(n){}if(u(o)===o)return o}}}function y(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(n))}var g=[],O=[];function E(n){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==i}if(e&&w(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var t=function(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch(n){}return-1}(g,n);if(-1!==t){var r=O[t];if(r&&y(r))return!0}return!1}function _(n){return c(n=n||window)||u(n)||void 0}},function(n,e){},function(n,e,t){"use strict";t(4),t(8)},function(n,e,t){"use strict";t(4)},function(n,e,t){"use strict";t(1),t(0)},function(n,e){},function(n,e,t){"use strict";t(4)},function(n,e,t){"use strict"}])});
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("postRobot",[],t):"object"==typeof exports?exports.postRobot=t():n.postRobot=t()}("undefined"!=typeof self?self:this,function(){return function(n){var t={};function e(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=n,e.c=t,e.d=function(n,t,r){e.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:r})},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="",e(e.s=9)}([function(n,t,e){"use strict";var r=e(10);e.d(t,"getActualDomain",function(){return r.a}),e.d(t,"getAllWindows",function(){return r.b}),e.d(t,"getAncestor",function(){return r.c}),e.d(t,"getDomain",function(){return r.d}),e.d(t,"getUserAgent",function(){return r.e}),e.d(t,"isActuallySameDomain",function(){return r.f}),e.d(t,"isAncestor",function(){return r.g}),e.d(t,"isSameDomain",function(){return r.h}),e.d(t,"isWindow",function(){return r.i}),e.d(t,"isWindowClosed",function(){return r.j}),e.d(t,"linkFrameWindow",function(){return r.k}),e.d(t,"matchDomain",function(){return r.l}),e.d(t,"stringifyDomainPattern",function(){return r.m});var o=e(11);e.n(o),e(5)},function(n,t,e){"use strict";function r(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&n instanceof window.constructor)return!1;var t={}.toString;if(t){var e=t.call(n);if("[object Window]"===e||"[object global]"===e||"[object DOMWindow]"===e)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}function o(){var n=void 0;if("undefined"!=typeof window)n=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");n=window}var t=n.__zalgopromise__=n.__zalgopromise__||{};return t.flushPromises=t.flushPromises||[],t.activeCount=t.activeCount||0,t.possiblyUnhandledPromiseHandlers=t.possiblyUnhandledPromiseHandlers||[],t.dispatchedErrors=t.dispatchedErrors||[],t}var i=function(){function n(t){var e=this;if(function(t,e){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],t){var r=void 0,o=void 0,i=!1,a=!1,u=!1;try{t(function(n){u?e.resolve(n):(i=!0,r=n)},function(n){u?e.reject(n):(a=!0,o=n)})}catch(n){return void this.reject(n)}u=!0,i?this.resolve(r):a&&this.reject(o)}}return n.prototype.resolve=function(n){if(this.resolved||this.rejected)return this;if(r(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},n.prototype.reject=function(n){var t=this;if(this.resolved||this.rejected)return this;if(r(n))throw new Error("Can not reject promise with another promise");if(!n){var e=n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n);n=new Error("Expected reject to be called with Error, got "+e)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout(function(){t.errorHandled||function(n,t){if(-1===o().dispatchedErrors.indexOf(n)){o().dispatchedErrors.push(n),setTimeout(function(){throw n},1);for(var e=0;e<o().possiblyUnhandledPromiseHandlers.length;e++)o().possiblyUnhandledPromiseHandlers[e](n,t)}}(n,t)},1),this.dispatch(),this},n.prototype.asyncReject=function(n){this.errorHandled=!0,this.reject(n)},n.prototype.dispatch=function(){var t=this,e=this.dispatching,i=this.resolved,a=this.rejected,u=this.handlers;if(!e&&(i||a)){this.dispatching=!0,o().activeCount+=1;for(var c=function(e){var o=u[e],c=o.onSuccess,s=o.onError,f=o.promise,d=void 0;if(i)try{d=c?c(t.value):t.value}catch(n){return f.reject(n),"continue"}else if(a){if(!s)return f.reject(t.error),"continue";try{d=s(t.error)}catch(n){return f.reject(n),"continue"}}d instanceof n&&(d.resolved||d.rejected)?(d.resolved?f.resolve(d.value):f.reject(d.error),d.errorHandled=!0):r(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?f.resolve(d.value):f.reject(d.error):d.then(function(n){f.resolve(n)},function(n){f.reject(n)}):f.resolve(d)},s=0;s<u.length;s++)c(s);u.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&n.flushQueue()}},n.prototype.then=function(t,e){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for error handler");var r=new n;return this.handlers.push({promise:r,onSuccess:t,onError:e}),this.errorHandled=!0,this.dispatch(),r},n.prototype.catch=function(n){return this.then(void 0,n)},n.prototype.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(e){return n.try(t).then(function(){return e})},function(e){return n.try(t).then(function(){throw e})})},n.prototype.timeout=function(n,t){var e=this;if(this.resolved||this.rejected)return this;var r=setTimeout(function(){e.resolved||e.rejected||e.reject(t||new Error("Promise timed out after "+n+"ms"))},n);return this.then(function(n){return clearTimeout(r),n})},n.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.resolve=function(t){return t instanceof n?t:r(t)?new n(function(n,e){return t.then(n,e)}):(new n).resolve(t)},n.reject=function(t){return(new n).reject(t)},n.all=function(t){var e=new n,o=t.length,i=[];if(!o)return e.resolve(i),e;for(var a=function(a){var u=t[a];if(u instanceof n){if(u.resolved)return i[a]=u.value,o-=1,"continue"}else if(!r(u))return i[a]=u,o-=1,"continue";n.resolve(u).then(function(n){i[a]=n,0==(o-=1)&&e.resolve(i)},function(n){e.reject(n)})},u=0;u<t.length;u++)a(u);return 0===o&&e.resolve(i),e},n.hash=function(t){var e={};return n.all(Object.keys(t).map(function(r){return n.resolve(t[r]).then(function(n){e[r]=n})})).then(function(){return e})},n.map=function(t,e){return n.all(t.map(e))},n.onPossiblyUnhandledException=function(n){return function(n){return o().possiblyUnhandledPromiseHandlers.push(n),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(n),1)}}}(n)},n.try=function(t,e,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=t.apply(e,r||[])}catch(t){return n.reject(t)}return n.resolve(o)},n.delay=function(t){return new n(function(n){setTimeout(n,t)})},n.isPromise=function(t){return!!(t&&t instanceof n)||r(t)},n.flush=function(){var t=new n;return o().flushPromises.push(t),0===o().activeCount&&n.flushQueue(),t},n.flushQueue=function(){var n=o().flushPromises;o().flushPromises=[];for(var t=0,e=null==n?0:n.length;t<e;t++)n[t].resolve()},n}();e.d(t,"a",function(){return i})},function(n,t,e){"use strict";e(6);var r=e(7);e.d(t,"addEventListener",function(){return r.a}),e(12),e(13),e(8);var o=e(3);e.d(t,"getOrSet",function(){return o.e}),e.d(t,"isRegex",function(){return o.g}),e.d(t,"memoizePromise",function(){return o.i}),e.d(t,"noop",function(){return o.j}),e.d(t,"once",function(){return o.k}),e.d(t,"safeInterval",function(){return o.m}),e.d(t,"stringifyError",function(){return o.o}),e.d(t,"uniqueID",function(){return o.p}),e.d(t,"weakMapMemoizePromise",function(){return o.q}),e(14);var i=e(15);e.n(i),e(16),e(17)},function(n,t,e){"use strict";t.p=a,t.d=function(){if("undefined"!=typeof window)return window;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("No global found")},t.h=function(n){var t=this,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new o.a;function i(){for(var t=arguments.length,o=Array(t),i=0;i<t;i++)o[i]=arguments[i];var a=r.getOrSet(e.thisNamespace?this:n,function(){return{}}),u=c(o),s=e.time;if(a[u]&&s&&Date.now()-a[u].time<s&&delete a[u],a[u])return a[u].value;var f=Date.now(),d=n.apply(this,arguments);return a[u]={time:f,value:d},a[u].value}return i.reset=function(){r.delete(e.thisNamespace?t:n)},e.name&&(i.displayName=e.name+":memoized"),i},t.i=function(n){var t={};function e(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];var i=c(r);return t.hasOwnProperty(i)?t[i]:(t[i]=n.apply(this,arguments).finally(function(){delete t[i]}),t[i])}return e.reset=function(){t={}},e},t.l=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function e(){return r.a.try(n,this,arguments)}return t.name&&(e.displayName=t.name+":promisified"),e},t.f=function(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=n.__inline_memoize_cache__=n.__inline_memoize_cache__||{},o=c(e);return r.hasOwnProperty(o)?r[o]:r[o]=t.apply(void 0,e)},t.j=function(){},t.k=function(n){var t=!1;return function(){if(!t)return t=!0,n.apply(this,arguments)}},t.o=function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(e>=3)return"stringifyError stack overflow";try{if(!t)return"<unknown error: "+Object.prototype.toString.call(t)+">";if("string"==typeof t)return t;if(t instanceof Error){var r=t&&t.stack,o=t&&t.message;if(r&&o)return-1!==r.indexOf(o)?r:o+"\n"+r;if(r)return r;if(o)return o}return"function"==typeof t.toString?t.toString():Object.prototype.toString.call(t)}catch(t){return"Error while stringifying error: "+n(t,e+1)}},t.n=function(n){return"string"==typeof n?n:n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n)},t.c=function(n,t){if(!t)return n;if(Object.assign)return Object.assign(n,t);for(var e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n},t.m=function(n,t){var e=void 0;return function r(){e=setTimeout(function(){n(),r()},t)}(),{cancel:function(){clearTimeout(e)}}},t.a=function(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()},t.b=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,e=void 0;return function(){var r=this,o=arguments;clearTimeout(e),e=setTimeout(function(){return n.apply(r,o)},t)}},t.g=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},e.d(t,"q",function(){return s}),t.e=function(n,t,e){if(n.hasOwnProperty(t))return n[t];var r=e();return n[t]=r,r};var r=e(1),o=e(4),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function a(){var n,t="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return t.charAt(Math.floor(Math.random()*t.length))})+"_"+(n=(new Date).toISOString().slice(11,19).replace("T","."),window.btoa(n)).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var u=void 0;function c(n){try{return JSON.stringify(Array.prototype.slice.call(n),function(n,t){return"function"==typeof t?"memoize["+function(n){if(u=u||new o.a,null===n||void 0===n||"object"!==(void 0===n?"undefined":i(n))&&"function"!=typeof n)throw new Error("Invalid object");var t=u.get(n);return t||(t=(void 0===n?"undefined":i(n))+":"+a(),u.set(n,t)),t}(t)+"]":t})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}var s=function(n){var t=new o.a;return function(e){var r=this;return t.getOrSet(e,function(){return n.call(r,e).finally(function(){t.delete(e)})})}}},function(n,t,e){"use strict";e.d({},"WeakMap",function(){return u});var r=e(0);function o(n,t){for(var e=0;e<n.length;e++)try{if(n[e]===t)return e}catch(n){}return-1}var i=Object.defineProperty,a=Date.now()%1e9,u=function(){function n(){if(function(t,e){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this),a+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+a,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,t={};return Object.freeze(t),n.set(t,"__testvalue__"),"__testvalue__"===n.get(t)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}return n.prototype._cleanupClosedWindows=function(){for(var n=this.weakmap,t=this.keys,e=0;e<t.length;e++){var o=t[e];if(Object(r.isWindow)(o)&&Object(r.isWindowClosed)(o)){if(n)try{n.delete(o)}catch(n){}t.splice(e,1),this.values.splice(e,1),e-=1}}},n.prototype.isSafeToReadWrite=function(n){if(Object(r.isWindow)(n))return!1;try{n&&n.self,n&&n[this.name]}catch(n){return!1}return!0},n.prototype.set=function(n,t){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.set(n,t)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=this.name,a=n[r];a&&a[0]===n?a[1]=t:i(n,r,{value:[n,t],writable:!0})}else{this._cleanupClosedWindows();var u=this.keys,c=this.values,s=o(u,n);-1===s?(u.push(n),c.push(t)):c[s]=t}},n.prototype.get=function(n){if(!n)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(n))return t.get(n)}catch(n){delete this.weakmap}if(!this.isSafeToReadWrite(n)){this._cleanupClosedWindows();var e=o(this.keys,n);if(-1===e)return;return this.values[e]}var r=n[this.name];if(r&&r[0]===n)return r[1]},n.prototype.delete=function(n){if(!n)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var e=n[this.name];e&&e[0]===n&&(e[0]=e[1]=void 0)}else{this._cleanupClosedWindows();var r=this.keys,i=o(r,n);-1!==i&&(r.splice(i,1),this.values.splice(i,1))}},n.prototype.has=function(n){if(!n)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{return t.has(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var e=n[this.name];return!(!e||e[0]!==n)}return this._cleanupClosedWindows(),-1!==o(this.keys,n)},n.prototype.getOrSet=function(n,t){if(this.has(n))return this.get(n);var e=t();return this.set(n,e),e},n}();e.d(t,"a",function(){return u})},function(n,t,e){"use strict";e.d(t,"a",function(){return r}),e.d(t,"b",function(){return o});var r={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},o="*"},function(n,t,e){"use strict";t.a=function(){return!!(window.navigator.mockUserAgent||window.navigator.userAgent).match(/Android|webOS|iPhone|iPad|iPod|bada|Symbian|Palm|CriOS|BlackBerry|IEMobile|WindowsMobile|Opera Mini/i)}},function(n,t,e){"use strict";e(1),e(0),e(4);var r=e(3);e(6),t.b=function n(){return Object(r.f)(n,function(){try{if("undefined"==typeof window)return!1;if(window.localStorage){var n=Math.random().toString();window.localStorage.setItem("__test__localStorage__",n);var t=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),n===t)return!0}}catch(n){}return!1})},t.a=function(n,t,e){return n.addEventListener(t,e),{cancel:function(){n.removeEventListener(t,e)}}},"function"==typeof Symbol&&Symbol.iterator,Object.assign,Object.create(Error.prototype)},function(n,t,e){"use strict";t.a=function n(t){var e=t.name,i=t.version,a=void 0===i?"latest":i,u=t.lifetime,c=void 0===u?3e5:u;return Object(r.f)(n,function(){var n="__"+e+"_"+a+"_storage__",t=void 0;function i(e){var i=Object(o.b)(),a=void 0;if(t&&(a=t),!a&&i){var u=window.localStorage.getItem(n);u&&(a=JSON.parse(u))}a||(a=Object(r.d)()[n]),a||(a={id:Object(r.p)()}),a.id||(a.id=Object(r.p)()),t=a;var c=e(a);return i?window.localStorage.setItem(n,JSON.stringify(a)):Object(r.d)()[n]=a,t=null,c}function u(n){return i(function(t){var e=t.__session__,o=Date.now();return e&&o-e.created>c&&(e=null),e||(e={guid:Object(r.p)(),created:o}),t.__session__=e,n(e)})}return{getState:i,getID:function(){return i(function(n){return n.id})},getSessionState:function(n){return u(function(t){return t.state=t.state||{},n(t.state)})},getSessionID:function(){return u(function(n){return n.guid})}}},[{name:e,version:a,lifetime:c}])};var r=e(3),o=e(7)},function(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={};e.d(r,"markWindowKnown",function(){return j}),e.d(r,"serializeMessage",function(){return J}),e.d(r,"deserializeMessage",function(){return K}),e.d(r,"ProxyWindow",function(){return F}),e.d(r,"cleanUpWindow",function(){return Wn}),e.d(r,"Promise",function(){return a.a}),e.d(r,"bridge",function(){return jn}),e.d(r,"parent",function(){return Sn}),e.d(r,"send",function(){return pn}),e.d(r,"requestPromises",function(){return wn}),e.d(r,"request",function(){return hn}),e.d(r,"sendToParent",function(){return mn}),e.d(r,"client",function(){return vn}),e.d(r,"on",function(){return On}),e.d(r,"listen",function(){return gn}),e.d(r,"once",function(){return En}),e.d(r,"listener",function(){return bn}),e.d(r,"CONFIG",function(){return w}),e.d(r,"disable",function(){return _n});var o,i=e(0),a=e(1),u=e(2),c={REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},s={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},f={POSTROBOT:"__postRobot__"},d="*",l={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"},w={ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:2e3,ACK_TIMEOUT_KNOWN:1e4,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(o={},o.postrobot_post_message=!0,o.postrobot_bridge=!0,o.postrobot_global=!0,o)};0===window.location.href.indexOf("file:")&&(w.ALLOW_POSTMESSAGE_POPUP=!0);var h=e(4),p=window[f.POSTROBOT]=window[f.POSTROBOT]||{},m=p.windowStore=p.windowStore||new h.a,v=function(){return{}};function y(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v;function e(n){return m.getOrSet(n,t)}return{has:function(t){return e(t).hasOwnProperty(n)},get:function(t,r){var o=e(t);return o.hasOwnProperty(n)?o[n]:r},set:function(t,r){return e(t)[n]=r,r},del:function(t){delete e(t)[n]},getOrSet:function(t,r){var o=e(t);if(o.hasOwnProperty(n))return o[n];var i=r();return o[n]=i,i}}}function g(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v,e=Object(u.getOrSet)(p,n,t);return{has:function(n){return e.hasOwnProperty(n)},get:function(n,t){return e.hasOwnProperty(n)?e[n]:t},set:function(n,t){return e[n]=t,t},del:function(n){delete e[n]},getOrSet:function(n,t){if(e.hasOwnProperty(n))return e[n];var r=t();return e[n]=r,r},reset:function(){e=t()},keys:function(){return Object.keys(e)}}}p.instanceID=p.instanceID||Object(u.uniqueID)();var O=y("helloPromises");function E(n){return O.getOrSet(n,function(){return new a.a})}var b=Object(u.once)(function(){p.on(s.HELLO,{domain:d},function(n){var t=n.source,e=n.origin;return E(t).resolve({win:t,domain:e}),{instanceID:p.instanceID}})});function _(n){return p.send(n,s.HELLO,{instanceID:p.instanceID},{domain:d,timeout:-1}).then(function(t){var e=t.origin,r=t.data.instanceID;return E(n).resolve({win:n,domain:e}),{win:n,domain:e,instanceID:r}})}var S=Object(u.weakMapMemoizePromise)(function(n){return _(n).then(function(n){return n.instanceID})}),W=y("knownWindows");function j(n){W.set(n,!0)}var A,P={FUNCTION:"function",ERROR:"error",PROMISE:"promise",REGEX:"regex",DATE:"date",ARRAY:"array",OBJECT:"object",STRING:"string",NUMBER:"number",BOOLEAN:"boolean",NULL:"null",UNDEFINED:"undefined"},D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function I(n){return"object"===(void 0===n?"undefined":D(n))&&null!==n&&"string"==typeof n.__type__}function T(n){return void 0===n?P.UNDEFINED:null===n?P.NULL:Array.isArray(n)?P.ARRAY:"function"==typeof n?P.FUNCTION:"object"===(void 0===n?"undefined":D(n))?n instanceof Error?P.ERROR:"function"==typeof n.then?P.PROMISE:"[object RegExp]"===Object.prototype.toString.call(n)?P.REGEX:"[object Date]"===Object.prototype.toString.call(n)?P.DATE:P.OBJECT:"string"==typeof n?P.STRING:"number"==typeof n?P.NUMBER:"boolean"==typeof n?P.BOOLEAN:void 0}function R(n,t){return{__type__:n,__val__:t}}var N,C=((A={})[P.FUNCTION]=function(){},A[P.ERROR]=function(n){var t=n.message,e=n.stack,r=n.code;return R(P.ERROR,{message:t,stack:e,code:r})},A[P.PROMISE]=function(){},A[P.REGEX]=function(n){return R(P.REGEX,n.source)},A[P.DATE]=function(n){return R(P.DATE,n.toJSON())},A[P.ARRAY]=function(n){return n},A[P.OBJECT]=function(n){return n},A[P.STRING]=function(n){return n},A[P.NUMBER]=function(n){return n},A[P.BOOLEAN]=function(n){return n},A[P.NULL]=function(n){return n},A),M={},x=((N={})[P.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},N[P.ERROR]=function(n){var t=n.message,e=n.stack,r=n.code,o=new Error(t);return o.code=r,o.stack=e+"\n\n"+o.stack,o},N[P.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},N[P.REGEX]=function(n){return new RegExp(n)},N[P.DATE]=function(n){return new Date(n)},N[P.ARRAY]=function(n){return n},N[P.OBJECT]=function(n){return n},N[P.STRING]=function(n){return n},N[P.NUMBER]=function(n){return n},N[P.BOOLEAN]=function(n){return n},N[P.NULL]=function(n){return n},N),k={},L=y("winToProxyWindow"),U=g("idToProxyWindow");function z(){for(var n=0,t=U.keys(),e=null==t?0:t.length;n<e;n++){var r=t[n];U.get(r).shouldClean()&&delete U[r]}}var F=function(){function n(t,e){!function(t,e){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this),this.serializedWindow=t,this.actualWindowPromise=new a.a,e&&this.setWindow(e),this.serializedWindow.getInstanceID=Object(u.memoizePromise)(this.serializedWindow.getInstanceID)}return n.prototype.setLocation=function(n){var t=this;return a.a.try(function(){if(!t.actualWindow)return t.serializedWindow.setLocation(n);t.actualWindow.location=n}).then(function(){return t})},n.prototype.setName=function(n){var t=this;return a.a.try(function(){if(!t.actualWindow)return t.serializedWindow.setName(n);if(!Object(i.isSameDomain)(t.actualWindow))throw new Error("Can not set name for window on different domain");t.actualWindow.name=n,t.actualWindow.frameElement&&t.actualWindow.frameElement.setAttribute("name",n)}).then(function(){return t})},n.prototype.close=function(){var n=this;return a.a.try(function(){if(!n.actualWindow)return n.serializedWindow.close();n.actualWindow.close()}).then(function(){return n})},n.prototype.focus=function(){var n=this;return a.a.try(function(){if(!n.actualWindow)return n.serializedWindow.focus();n.actualWindow.focus()}).then(function(){return n})},n.prototype.isClosed=function(){var n=this;return a.a.try(function(){return n.actualWindow?Object(i.isWindowClosed)(n.actualWindow):n.serializedWindow.isClosed()})},n.prototype.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(n)},n.prototype.matchWindow=function(n){var t=this;return a.a.try(function(){return t.actualWindow?n===t.actualWindow:a.a.all([t.getInstanceID(),S(n)]).then(function(e){var r=e[0]===e[1];return r&&t.setWindow(n),r})})},n.prototype.unwrap=function(){return this.actualWindow||this},n.prototype.awaitWindow=function(){return this.actualWindowPromise},n.prototype.getInstanceID=function(){return this.actualWindow?S(this.actualWindow):this.serializedWindow.getInstanceID()},n.prototype.serialize=function(){return this.serializedWindow},n.prototype.shouldClean=function(){return this.actualWindow&&Object(i.isWindowClosed)(this.actualWindow)},n.unwrap=function(t){return n.isProxyWindow(t)?t.unwrap():t},n.serialize=function(t){return z(),n.toProxyWindow(t).serialize()},n.deserialize=function(t){return z(),U.getOrSet(t.id,function(){return new n(t)})},n.isProxyWindow=function(t){return t instanceof n},n.toProxyWindow=function(t){return z(),n.isProxyWindow(t)?t:L.getOrSet(t,function(){var e=Object(u.uniqueID)();return U.set(e,new n({id:e,getInstanceID:function(){return S(t)},close:function(){return a.a.try(function(){t.close()})},focus:function(){return a.a.try(function(){t.focus()})},isClosed:function(){return a.a.try(function(){return Object(i.isWindowClosed)(t)})},setLocation:function(n){return a.a.try(function(){if(Object(i.isSameDomain)(t))try{if(t.location&&"function"==typeof t.location.replace)return void t.location.replace(n)}catch(n){}t.location=n})},setName:function(n){return a.a.try(function(){t.name=n})}},t))})},n}(),B=y("methodStore"),H=g("proxyWindowMethods");p.listeningForFunctions=p.listeningForFunctions||!1;var q=Object(u.once)(function(){p.listeningForFunctions||(p.listeningForFunctions=!0,p.on(s.METHOD,{origin:d},function(n){var t=n.source,e=n.origin,r=n.data,o=r.id,u=r.name;return a.a.try(function(){var n=B.get(t,function(){return{}})[r.id]||H.get(o);if(!n)throw new Error("Could not find method with id: "+r.id);var a=n.proxy,u=n.domain,c=n.val;if(!Object(i.matchDomain)(u,e))throw new Error("Method domain "+JSON.stringify(n.domain)+" does not match origin "+e);return a?a.matchWindow(t).then(function(n){if(!n)throw new Error("Proxy window does not match source");return c}):c}).then(function(n){return n.apply({source:t,origin:e,data:r},r.args)}).then(function(n){return{result:n,id:o,name:u}})}))});function G(n,t,e,r){q();var o=Object(u.uniqueID)();return n=F.unwrap(n),F.isProxyWindow(n)?(H.set(o,{proxy:n,domain:t,val:e}),n.awaitWindow().then(function(n){H.del(o),B.getOrSet(n,function(){return{}})[o]={domain:t,val:e}})):B.getOrSet(n,function(){return{}})[o]={domain:t,val:e},R(l.CROSS_DOMAIN_FUNCTION,{id:o,name:e.name||r})}function J(n,t,e){var r;return function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M,e=JSON.stringify(n,function(n){var e=this[n];if(I(this))return e;var r=T(e);if(!r)return e;var o=t[r]||C[r];return o?o(e,n):e});return void 0===e?P.UNDEFINED:e}(e,((r={})[P.PROMISE]=function(e,r){return function(n,t,e,r){return R(l.CROSS_DOMAIN_ZALGO_PROMISE,{then:G(n,t,function(n,t){return e.then(n,t)},r)})}(n,t,e,r)},r[P.FUNCTION]=function(e,r){return G(n,t,e,r)},r[P.OBJECT]=function(n){return Object(i.isWindow)(n)||F.isProxyWindow(n)?(t=n,R(l.CROSS_DOMAIN_WINDOW,F.serialize(t))):n;var t},r))}function K(n,t,e){var r;return function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:k;if(n!==P.UNDEFINED)return JSON.parse(n,function(n,e){if(I(this))return e;var r=void 0,o=void 0;if(I(e)?(r=e.__type__,o=e.__val__):(r=T(e),o=e),!r)return o;var i=t[r]||x[r];return i?i(o,n):o})}(e,((r={})[l.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return t=n.then,new a.a(t);var t},r[l.CROSS_DOMAIN_FUNCTION]=function(e){return function(n,t,e){var r=e.id,o=e.name;function i(){var e=Array.prototype.slice.call(arguments);return p.send(n,s.METHOD,{id:r,name:o,args:e},{domain:t}).then(function(n){return n.data.result})}return i.fireAndForget=function(){var e=Array.prototype.slice.call(arguments);return p.send(n,s.METHOD,{id:r,name:o,args:e},{domain:t,fireAndForget:!0})},i.__name__=o,i.__xdomain__=!0,i.source=n,i.origin=t,i}(n,t,e)},r[l.CROSS_DOMAIN_WINDOW]=function(n){return t=n,F.deserialize(t);var t},r))}var Q={postrobot_post_message:function(n,t,e){(Array.isArray(e)?e:"string"==typeof e?[e]:[d]).map(function(t){if(0===t.indexOf("mock:")){if("file:"===window.location.protocol)return d;if(!Object(i.isActuallySameDomain)(n))throw new Error("Attempting to send messsage to mock domain "+t+", but window is actually cross-domain");return Object(i.getActualDomain)(n)}return 0===t.indexOf("file:")?d:t}).forEach(function(e){return n.postMessage(t,e)})}},X=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n};function Y(n,t,e){return a.a.try(function(){var r;if(Object(i.isWindowClosed)(n))throw new Error("Window is closed");var o=J(n,t,((r={})[f.POSTROBOT]=X({id:Object(u.uniqueID)()},e),r)),c=[];return a.a.map(Object.keys(Q),function(e){return a.a.try(function(){if(!w.ALLOWED_POST_MESSAGE_METHODS[e])throw new Error("Strategy disallowed: "+e);return Q[e](n,o,t)}).then(function(){return c.push(e+": success"),!0},function(n){return c.push(e+": "+Object(u.stringifyError)(n)+"\n"),!1})}).then(function(n){var t=n.some(Boolean),r=e.type+" "+e.name+" "+(t?"success":"error")+":\n - "+c.join("\n - ")+"\n";if(!t)throw new Error(r)})})}var Z=g("responseListeners"),V=y("requestListeners"),$=g("erroredResponseListeners");p.WINDOW_WILDCARD=p.WINDOW_WILDCARD||new function(){};var nn,tn="__domain_regex__";function en(n){return Z.get(n)}function rn(n){Z.del(n)}function on(n){return $.has(n)}function an(n){var t=n.name,e=n.win,r=n.domain;if(e===d&&(e=null),r===d&&(r=null),!t)throw new Error("Name required to get request listener");for(var o=0,a=[e,p.WINDOW_WILDCARD],u=null==a?0:a.length;o<u;o++){var c=a[o];if(c){var s=V.get(c);if(s){var f=s[t];if(f){if(r&&"string"==typeof r){if(f[r])return f[r];if(f[tn])for(var l=0,w=f[tn],h=null==w?0:w.length;l<h;l++){var m=w[l],v=m.regex,y=m.listener;if(Object(i.matchDomain)(v,r))return y}}if(f[d])return f[d]}}}}}var un=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},cn=((nn={})[c.REQUEST]=function(n,t,e){var r=an({name:e.name,win:n,domain:t});function o(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.fireAndForget||Object(i.isWindowClosed)(n)?a.a.resolve():Y(n,t,un({type:r,hash:e.hash,name:e.name},o))}return a.a.all([o(c.ACK),a.a.try(function(){if(!r)throw new Error("No handler found for post message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(r.domain,t))throw new Error("Request origin "+t+" does not match domain "+r.domain.toString());var o=e.data;return r.handler({source:n,origin:t,data:o})}).then(function(n){return o(c.RESPONSE,{ack:"success",data:n})},function(n){return o(c.RESPONSE,{ack:"error",error:n})})]).then(u.noop).catch(function(n){if(r&&r.handleError)return r.handleError(n);throw n})},nn[c.ACK]=function(n,t,e){if(!on(e.hash)){var r=en(e.hash);if(!r)throw new Error("No handler found for post message ack for message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(r.domain,t))throw new Error("Ack origin "+t+" does not match domain "+r.domain.toString());r.ack=!0}},nn[c.RESPONSE]=function(n,t,e){if(!on(e.hash)){var r=en(e.hash);if(!r)throw new Error("No handler found for post message response for message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(r.domain,t))throw new Error("Response origin "+t+" does not match domain "+Object(i.stringifyDomainPattern)(r.domain));if(rn(e.hash),"error"===e.ack)return r.respond(e.error,null);if("success"===e.ack){var o=e.data;return r.respond(null,{source:n,origin:t,data:o})}}},nn),sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},fn=g("receivedMessages");function dn(n){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var t=n.source,e=n.origin,r=function(n,t,e){var r=void 0;try{r=K(t,e,n)}catch(n){return}if(r&&"object"===(void 0===r?"undefined":sn(r))&&null!==r&&(r=r[f.POSTROBOT])&&"object"===(void 0===r?"undefined":sn(r))&&null!==r&&r.type&&"string"==typeof r.type&&cn[r.type])return r}(n.data,t,e);r&&(j(t),fn.has(r.id)||(fn.set(r.id,!0),Object(i.isWindowClosed)(t)&&!r.fireAndForget||cn[r.type](t,e,r)))}function ln(n){try{Object(u.noop)(n.source)}catch(n){return}dn({source:n.source||n.sourceElement,origin:n.origin||n.originalEvent&&n.originalEvent.origin,data:n.data})}p.receiveMessage=dn;var wn=y("requestPromises");function hn(n){return a.a.try(function(){if(!n.name)throw new Error("Expected options.name");var t=n.name,e=void 0,r=void 0;if("string"==typeof n.window){var o=document.getElementById(n.window);if(!o)throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be a valid element id");if("iframe"!==o.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be an iframe");if(!o.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");e=o.contentWindow}else if(n.window instanceof HTMLIFrameElement){if("iframe"!==n.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(n.window)+" to be an iframe");if(n.window&&!n.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");n.window&&n.window.contentWindow&&(e=n.window.contentWindow)}else e=n.window;if(!e)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var s=e;r=n.domain||d;var f=n.name+"_"+Object(u.uniqueID)();if(Object(i.isWindowClosed)(s))throw new Error("Target window is closed");var l=!1,h=wn.getOrSet(s,function(){return[]}),p=a.a.try(function(){if(Object(i.isAncestor)(window,s))return function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",r=E(n);return-1!==t&&(r=r.timeout(t,new Error(e+" did not load after "+t+"ms"))),r}(s,n.timeout||w.CHILD_WINDOW_TIMEOUT)}).then(function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).domain;if(Object(u.isRegex)(r)&&!n)return _(s)}).then(function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).domain;if(Object(u.isRegex)(r)){if(!Object(i.matchDomain)(r,e))throw new Error("Remote window domain "+e+" does not match regex: "+r.toString());r=e}if("string"!=typeof r&&!Array.isArray(r))throw new TypeError("Expected domain to be a string or array");var o=r;return new a.a(function(e,r){var a=void 0;if(n.fireAndForget||function(n,t){Z.set(n,t)}(f,a={name:t,window:s,domain:o,respond:function(n,t){n||(l=!0,h.splice(h.indexOf(p,1))),n?r(n):e(t)}}),Y(s,o,{type:c.REQUEST,hash:f,name:t,data:n.data,fireAndForget:Boolean(n.fireAndForget)}).catch(r),n.fireAndForget)return e();var u=function(n){return W.get(n,!1)}(s)?w.ACK_TIMEOUT_KNOWN:w.ACK_TIMEOUT,d=n.timeout||w.RES_TIMEOUT,m=u,v=d,y=100;setTimeout(function n(){if(!l){if(Object(i.isWindowClosed)(s))return a.ack?r(new Error("Window closed for "+t+" before response")):r(new Error("Window closed for "+t+" before ack"));if(m=Math.max(m-y,0),-1!==v&&(v=Math.max(v-y,0)),a.ack){if(-1===v)return;y=Math.min(v,2e3)}else{if(0===m)return r(new Error("No ack for postMessage "+t+" in "+Object(i.getDomain)()+" in "+u+"ms"));if(0===v)return r(new Error("No response for postMessage "+t+" in "+Object(i.getDomain)()+" in "+d+"ms"))}setTimeout(n,y)}},y)})});return p.catch(function(){!function(n){$.set(n,!0)}(f),rn(f)}),h.push(p),p})}function pn(n,t,e,r){return(r=r||{}).window=n,r.name=t,r.data=e,hn(r)}function mn(n,t,e){var r=Object(i.getAncestor)();return r?pn(r,n,t,e):new a.a(function(n,t){return t(new Error("Window does not have a parent"))})}function vn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!n.window)throw new Error("Expected options.window");var t=n.window;return{send:function(e,r){return pn(t,e,r,n)}}}p.send=pn;var yn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function gn(n){if(!n.name)throw new Error("Expected options.name");if(!n.handler)throw new Error("Expected options.handler");var t=n.name,e=n.window,r=n.domain,o={handler:n.handler,handleError:n.errorHandler||function(n){throw n},window:e,domain:r||d,name:t},a=function n(t,e){var r=t.name,o=t.win,i=t.domain;if(!r||"string"!=typeof r)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],c=0,s=o,f=null==s?0:s.length;c<f;c++){var l=s[c];a.push(n({name:r,domain:i,win:l},e))}return{cancel:function(){for(var n=0,t=null==a?0:a.length;n<t;n++)a[n].cancel()}}}if(Array.isArray(i)){for(var w=[],h=0,m=i,v=null==m?0:m.length;h<v;h++){var y=m[h];w.push(n({name:r,win:o,domain:y},e))}return{cancel:function(){for(var n=0,t=null==w?0:w.length;n<t;n++)w[n].cancel()}}}var g=an({name:r,win:o,domain:i});if(o&&o!==d||(o=p.WINDOW_WILDCARD),i=i||d,g)throw o&&i?new Error("Request listener already exists for "+r+" on domain "+i.toString()+" for "+(o===p.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+r+" for "+(o===p.WINDOW_WILDCARD?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+r+" on domain "+i.toString()):new Error("Request listener already exists for "+r);var O=V.getOrSet(o,function(){return{}}),E=Object(u.getOrSet)(O,r,function(){return{}}),b=i.toString(),_=void 0,S=void 0;return Object(u.isRegex)(i)?(_=Object(u.getOrSet)(E,tn,function(){return[]}),S={regex:i,listener:e},_.push(S)):E[b]=e,{cancel:function(){delete E[b],S&&(_.splice(_.indexOf(S,1)),_.length||delete E[tn]),Object.keys(E).length||delete O[r],o&&!Object.keys(O).length&&V.del(o)}}}({name:t,win:e,domain:r},o);if(n.once){var c=o.handler;o.handler=Object(u.once)(function(){return a.cancel(),c.apply(this,arguments)})}if(o.window&&n.errorOnClose)var s=Object(u.safeInterval)(function(){e&&"object"===(void 0===e?"undefined":yn(e))&&Object(i.isWindowClosed)(e)&&(s.cancel(),o.handleError(new Error("Post message target window is closed")))},50);return{cancel:function(){a.cancel()}}}function On(n,t,e){return"function"==typeof t&&(e=t,t={}),(t=t||{}).name=n,t.handler=e||t.handler,gn(t)}function En(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments[2];"function"==typeof t&&(e=t,t={}),t=t||{},e=e||t.handler;var r=t.errorHandler,o=new a.a(function(o,i){(t=t||{}).name=n,t.once=!0,t.handler=function(n){if(o(n),e)return e(n)},t.errorHandler=function(n){if(i(n),r)return r(n)}}),i=gn(t);return o.cancel=i.cancel,o}function bn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(t,e){return On(t,n,e)}}}function _n(){delete window[f.POSTROBOT],window.removeEventListener("message",ln)}p.on=On;var Sn=Object(i.getAncestor)();function Wn(n){for(var t=0,e=wn.get(n,[]),r=null==e?0:e.length;t<r;t++)e[t].reject(new Error("Window cleaned up before response"))}var jn=null;p.initialized||(p.initialized=!0,Object(u.addEventListener)(window,"message",ln),jn&&jn.openTunnelToOpener(),function(){b();for(var n=0,t=Object(i.getAllWindows)(),e=null==t?0:t.length;n<e;n++){var r=t[n];r!==window&&_(r).catch(u.noop)}}()),e.d(t,"markWindowKnown",function(){return j}),e.d(t,"serializeMessage",function(){return J}),e.d(t,"deserializeMessage",function(){return K}),e.d(t,"ProxyWindow",function(){return F}),e.d(t,"cleanUpWindow",function(){return Wn}),e.d(t,"Promise",function(){return a.a}),e.d(t,"bridge",function(){return jn}),e.d(t,"parent",function(){return Sn}),e.d(t,"send",function(){return pn}),e.d(t,"requestPromises",function(){return wn}),e.d(t,"request",function(){return hn}),e.d(t,"sendToParent",function(){return mn}),e.d(t,"client",function(){return vn}),e.d(t,"on",function(){return On}),e.d(t,"listen",function(){return gn}),e.d(t,"once",function(){return En}),e.d(t,"listener",function(){return bn}),e.d(t,"CONFIG",function(){return w}),e.d(t,"disable",function(){return _n}),t.default=r},function(n,t,e){"use strict";function r(n){return"[object RegExp]"===Object.prototype.toString.call(n)}var o=e(5);t.a=f,t.d=d,t.f=l,t.h=w,t.b=function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=function(n){var t=v(n);if(!t)throw new Error("Can not determine top window");return[].concat(m(t),[t])}(t),r=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return c(v(n)||n)}(t);return r?[].concat(n(r),e):e},t.j=E,t.k=function(n){if(function(){for(var n=0;n<O.length;n++)y(O[n])&&(O.splice(n,1),g.splice(n,1));for(var t=0;t<g.length;t++)E(g[t])&&(O.splice(t,1),g.splice(t,1))}(),n&&n.contentWindow)try{g.push(n.contentWindow),O.push(n)}catch(n){}},t.e=function(n){return(n=n||window).navigator.mockUserAgent||n.navigator.userAgent},t.c=b,t.g=function(n,t){var e=b(t);if(e)return e===n;if(t===n)return!1;if(v(t)===t)return!1;for(var r=0,o=p(n),i=null==o?0:o.length;r<i;r++)if(o[r]===t)return!0;return!1},t.l=function n(t,e){if("string"==typeof t){if("string"==typeof e)return t===o.b||e===t;if(r(e))return!1;if(Array.isArray(e))return!1}return r(t)?r(e)?t.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(t)):!!Array.isArray(t)&&(Array.isArray(e)?JSON.stringify(t)===JSON.stringify(e):!r(e)&&t.some(function(t){return n(t,e)}))},t.m=function(n){return Array.isArray(n)?"("+n.join(" | ")+")":r(n)?"RegExp("+n.toString():n.toString()},t.i=function(n){try{if(n===window)return!0}catch(n){if(n&&n.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(n))return!0}catch(n){if(n&&n.message===i)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===i)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===i)return!0}try{n&&n.__cross_domain_utils_window_check__}catch(n){return!0}return!1};var i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.a.ABOUT}function u(n){if(n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function c(n){if(n&&!u(n))try{return n.opener}catch(n){}}function s(n){try{return n&&n.location&&n.location.href,!0}catch(n){}return!1}function f(n){var t=(n=n||window).location;if(!t)throw new Error("Can not read window location");var e=t.protocol;if(!e)throw new Error("Can not read window protocol");if(e===o.a.FILE)return o.a.FILE+"//";if(e===o.a.ABOUT){var r=u(n);return r&&s(r)?f(r):o.a.ABOUT+"//"}var i=t.host;if(!i)throw new Error("Can not read window host");return e+"//"+i}function d(n){var t=f(n=n||window);return t&&n.mockDomain&&0===n.mockDomain.indexOf(o.a.MOCK)?n.mockDomain:t}function l(n){try{if(n===window)return!0}catch(n){}try{var t=Object.getOwnPropertyDescriptor(n,"location");if(t&&!1===t.enumerable)return!1}catch(n){}try{if(a(n)&&s(n))return!0}catch(n){}try{if(f(n)===f(window))return!0}catch(n){}return!1}function w(n){if(!l(n))return!1;try{if(n===window)return!0;if(a(n)&&s(n))return!0;if(d(window)===d(n))return!0}catch(n){}return!1}function h(n,t){if(!n||!t)return!1;var e=u(t);return e?e===n:-1!==function(n){var t=[];try{for(;n.parent!==n;)t.push(n.parent),n=n.parent}catch(n){}return t}(t).indexOf(n)}function p(n){var t=[],e=void 0;try{e=n.frames}catch(t){e=n}var r=void 0;try{r=e.length}catch(n){}if(0===r)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch(n){continue}t.push(i)}return t}for(var a=0;a<100;a++){var u=void 0;try{u=e[a]}catch(n){return t}if(!u)return t;t.push(u)}return t}function m(n){for(var t=[],e=0,r=p(n),o=null==r?0:r.length;e<o;e++){var i=r[e];t.push(i);for(var a=0,u=m(i),c=null==u?0:u.length;a<c;a++){var s=u[a];t.push(s)}}return t}function v(n){if(n){try{if(n.top)return n.top}catch(n){}if(u(n)===n)return n;try{if(h(window,n)&&window.top)return window.top}catch(n){}try{if(h(n,window)&&window.top)return window.top}catch(n){}for(var t=0,e=m(n),r=null==e?0:e.length;t<r;t++){var o=e[t];try{if(o.top)return o.top}catch(n){}if(u(o)===o)return o}}}function y(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var t=n.ownerDocument;return!(!t||!t.documentElement||t.documentElement.contains(n))}var g=[],O=[];function E(n){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==i}if(t&&w(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var e=function(n,t){for(var e=0;e<n.length;e++)try{if(n[e]===t)return e}catch(n){}return-1}(g,n);if(-1!==e){var r=O[e];if(r&&y(r))return!0}return!1}function b(n){return c(n=n||window)||u(n)||void 0}},function(n,t){},function(n,t,e){"use strict";e(3),e(8)},function(n,t,e){"use strict";e(3)},function(n,t,e){"use strict";e(1),e(0)},function(n,t){},function(n,t,e){"use strict";e(3)},function(n,t,e){"use strict"}])});
//# sourceMappingURL=post-robot.min.js.map
{
"name": "post-robot",
"version": "9.0.13",
"version": "9.0.14",
"description": "Simple postMessage based server.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,6 +5,6 @@ /* @flow */

import { getParent, isWindowClosed, type CrossDomainWindowType } from 'cross-domain-utils/src';
import { noop } from 'belter/src';
import { noop, uniqueID } from 'belter/src';
import { MESSAGE_NAME, WILDCARD } from '../conf';
import { global } from '../global';
import { global, globalStore } from '../global';

@@ -24,22 +24,6 @@ /*

global.tunnelWindows = global.tunnelWindows || {};
global.tunnelWindowId = 0;
let tunnelWindows = globalStore('tunnelWindows');
function deleteTunnelWindow(id) {
try {
if (global.tunnelWindows[id]) {
delete global.tunnelWindows[id].source;
}
} catch (err) {
// pass
}
delete global.tunnelWindows[id];
}
function cleanTunnelWindows() {
let tunnelWindows = global.tunnelWindows;
for (let key of Object.keys(tunnelWindows)) {
for (let key of tunnelWindows.keys()) {
let tunnelWindow = tunnelWindows[key];

@@ -50,3 +34,3 @@

} catch (err) {
deleteTunnelWindow(key);
tunnelWindows.del(key);
continue;

@@ -56,3 +40,3 @@ }

if (isWindowClosed(tunnelWindow.source)) {
deleteTunnelWindow(key);
tunnelWindows.del(key);
}

@@ -69,13 +53,9 @@ }

function addTunnelWindow({ name, source, canary, sendMessage } : TunnelWindowDataType) : number {
function addTunnelWindow({ name, source, canary, sendMessage } : TunnelWindowDataType) : string {
cleanTunnelWindows();
global.tunnelWindowId += 1;
global.tunnelWindows[global.tunnelWindowId] = { name, source, canary, sendMessage };
return global.tunnelWindowId;
let id = uniqueID();
tunnelWindows.set(id, { name, source, canary, sendMessage });
return id;
}
function getTunnelWindow(id : number) : TunnelWindowDataType {
return global.tunnelWindows[id];
}
global.openTunnelToParent = function openTunnelToParent({ name, source, canary, sendMessage } : TunnelWindowDataType) : ZalgoPromise<{ source : CrossDomainWindowType, origin : string, data : Object }> {

@@ -97,3 +77,3 @@

let tunnelWindow = getTunnelWindow(id);
let tunnelWindow = tunnelWindows.get(id);

@@ -104,3 +84,3 @@ try {

} catch (err) {
deleteTunnelWindow(id);
tunnelWindows.del(id);
return;

@@ -107,0 +87,0 @@ }

/* @flow */
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { ZalgoPromise } from 'zalgo-promise/src';
import { getDomain, isSameDomain, isOpener, isSameTopWindow, matchDomain, getUserAgent, getDomainFromUrl, type CrossDomainWindowType } from 'cross-domain-utils/src';
import { noop } from 'belter/src';
import { CONFIG, BRIDGE_NAME_PREFIX } from '../conf';
import { global } from '../global';
import { windowStore } from '../global';

@@ -93,22 +93,20 @@ export function needsBridgeForBrowser() : boolean {

global.remoteWindows = global.remoteWindows || new WeakMap();
let remoteWindows = windowStore('remoteWindows');
export function registerRemoteWindow(win : CrossDomainWindowType) {
global.remoteWindows.set(win, { sendMessagePromise: new ZalgoPromise() });
remoteWindows.getOrSet(win, () => new ZalgoPromise());
}
export function findRemoteWindow(win : CrossDomainWindowType) : { sendMessagePromise : ZalgoPromise<(remoteWin : CrossDomainWindowType, message : string, remoteDomain : string) => void> } {
return global.remoteWindows.get(win);
export function findRemoteWindow(win : CrossDomainWindowType) : ZalgoPromise<(remoteWin : CrossDomainWindowType, message : string, remoteDomain : string) => void> {
let remoteWin = remoteWindows.get(win);
if (!remoteWin) {
throw new Error(`Remote window not found`);
}
return remoteWin;
}
export function registerRemoteSendMessage(win : CrossDomainWindowType, domain : string, sendMessage : (message : string) => void) {
let remoteWindow = findRemoteWindow(win);
if (!remoteWindow) {
throw new Error(`Window not found to register sendMessage to`);
}
let sendMessageWrapper = (remoteWin : CrossDomainWindowType, remoteDomain : string, message : string) => {
if (remoteWin !== win) {

@@ -125,15 +123,7 @@ throw new Error(`Remote window does not match window`);

remoteWindow.sendMessagePromise.resolve(sendMessageWrapper);
remoteWindow.sendMessagePromise = ZalgoPromise.resolve(sendMessageWrapper);
findRemoteWindow(win).resolve(sendMessageWrapper);
}
export function rejectRemoteSendMessage(win : CrossDomainWindowType, err : Error) {
let remoteWindow = findRemoteWindow(win);
if (!remoteWindow) {
throw new Error(`Window not found on which to reject sendMessage`);
}
remoteWindow.sendMessagePromise.asyncReject(err);
findRemoteWindow(win).reject(err).catch(noop);
}

@@ -150,11 +140,5 @@

let remoteWindow = findRemoteWindow(win);
if (!remoteWindow) {
throw new Error(`Window not found to send message to`);
}
return remoteWindow.sendMessagePromise.then(sendMessage => {
return findRemoteWindow(win).then(sendMessage => {
return sendMessage(win, domain, message);
});
}
/* @flow */
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { ZalgoPromise } from 'zalgo-promise/src';

@@ -9,12 +8,11 @@ import { getDomain, getFrameByName, isWindowClosed, getDomainFromUrl, type CrossDomainWindowType } from 'cross-domain-utils/src';

import { awaitWindowHello } from '../lib';
import { global } from '../global';
import { global, windowStore, globalStore } from '../global';
import { getBridgeName, documentBodyReady, registerRemoteSendMessage, registerRemoteWindow } from './common';
global.bridges = global.bridges || {};
global.bridgeFrames = global.bridgeFrames || {};
let bridges = globalStore('bridges');
let bridgeFrames = globalStore('bridgeFrames');
let popupWindowsByName = globalStore('popupWindowsByName');
let popupWindowsByWin = windowStore('popupWindowsByWin');
global.popupWindowsByWin = global.popupWindowsByWin || new WeakMap();
global.popupWindowsByName = global.popupWindowsByName || {};
function listenForRegister(source, domain) {

@@ -35,15 +33,19 @@ global.on(MESSAGE_NAME.OPEN_TUNNEL, { window: source, domain }, ({ origin, data }) => {

if (!global.popupWindowsByName[data.name]) {
if (!popupWindowsByName.has(data.name)) {
throw new Error(`Window with name ${ data.name } does not exist, or was not opened by this window`);
}
if (!global.popupWindowsByName[data.name].domain) {
// $FlowFixMe
if (!popupWindowsByName.get(data.name).domain) {
throw new Error(`We do not have a registered domain for window ${ data.name }`);
}
if (global.popupWindowsByName[data.name].domain !== origin) {
throw new Error(`Message origin ${ origin } does not matched registered window origin ${ global.popupWindowsByName[data.name].domain }`);
// $FlowFixMe
if (popupWindowsByName.get(data.name).domain !== origin) {
// $FlowFixMe
throw new Error(`Message origin ${ origin } does not matched registered window origin ${ popupWindowsByName.get(data.name).domain }`);
}
registerRemoteSendMessage(global.popupWindowsByName[data.name].win, domain, data.sendMessage);
// $FlowFixMe
registerRemoteSendMessage(popupWindowsByName.get(data.name).win, domain, data.sendMessage);

@@ -57,3 +59,3 @@ return {

let winDetails = global.popupWindowsByName[data.name];
let winDetails = popupWindowsByName.get(data.name);

@@ -102,16 +104,10 @@ if (!winDetails) {

export function hasBridge(url : string, domain : string) : boolean {
domain = domain || getDomainFromUrl(url);
return Boolean(global.bridges[domain]);
return bridges.has(domain || getDomainFromUrl(url));
}
export function openBridge(url : string, domain : string) : ZalgoPromise<CrossDomainWindowType> {
domain = domain || getDomainFromUrl(url);
return bridges.getOrSet(domain, () => ZalgoPromise.try(() => {
if (global.bridges[domain]) {
return global.bridges[domain];
}
global.bridges[domain] = ZalgoPromise.try(() => {
if (getDomain() === domain) {

@@ -129,3 +125,3 @@ throw new Error(`Can not open bridge on the same domain as current domain: ${ domain }`);

let iframe = openBridgeFrame(name, url);
global.bridgeFrames[domain] = iframe;
bridgeFrames.set(domain, iframe);

@@ -154,5 +150,3 @@ return documentBodyReady.then(body => {

});
});
return global.bridges[domain];
}));
}

@@ -184,5 +178,6 @@

for (let winName of Object.keys(global.popupWindowsByName)) {
if (isWindowClosed(global.popupWindowsByName[winName].win)) {
delete global.popupWindowsByName[winName];
for (let winName of popupWindowsByName.keys()) {
// $FlowFixMe
if (isWindowClosed(popupWindowsByName.get(winName).win)) {
popupWindowsByName.del(winName);
}

@@ -192,11 +187,13 @@ }

if (name && win) {
let winOptions = global.popupWindowsByWin.get(win) ||
global.popupWindowsByName[name] || {};
let winOptions = popupWindowsByWin.getOrSet(win, () => ({}));
// $FlowFixMe
winOptions.name = winOptions.name || name;
// $FlowFixMe
winOptions.win = winOptions.win || win;
// $FlowFixMes
winOptions.domain = winOptions.domain || domain;
global.popupWindowsByWin.set(win, winOptions);
global.popupWindowsByName[name] = winOptions;
popupWindowsByWin.set(win, winOptions);
popupWindowsByName.set(name, winOptions);
}

@@ -208,7 +205,5 @@

export function linkUrl(win : CrossDomainWindowType, url : string) {
let winOptions = global.popupWindowsByWin.get(win);
if (winOptions) {
winOptions.domain = getDomainFromUrl(url);
if (popupWindowsByWin.has(win)) {
// $FlowFixMe
popupWindowsByWin.get(win).domain = getDomainFromUrl(url);
registerRemoteWindow(win);

@@ -219,10 +214,10 @@ }

export function destroyBridges() {
for (let domain of Object.keys(global.bridgeFrames)) {
let frame = global.bridgeFrames[domain];
if (frame.parentNode) {
for (let domain of bridgeFrames.keys()) {
let frame = bridgeFrames.get(domain);
if (frame && frame.parentNode) {
frame.parentNode.removeChild(frame);
}
}
global.bridgeFrames = {};
global.bridges = {};
bridgeFrames.reset();
bridges.reset();
}

@@ -5,31 +5,8 @@ /* @flow */

import { global } from './global';
import { requestPromises } from './public';
export function cleanUpWindow(win : CrossDomainWindowType) {
// global.tunnelWindows
// global.bridges
// global.popupWindowsByName
// global.responseListeners
// global.requestListeners
let requestPromises = global.requestPromises.get(win);
if (requestPromises) {
for (let promise of requestPromises) {
promise.reject(new Error(`No response from window - cleaned up`));
}
for (let promise of requestPromises.get(win, [])) {
promise.reject(new Error(`Window cleaned up before response`));
}
if (global.popupWindowsByWin) {
global.popupWindowsByWin.delete(win);
}
if (global.remoteWindows) {
global.remoteWindows.delete(win);
}
global.requestPromises.delete(win);
global.methods.delete(win);
global.helloPromises.delete(win);
}
/* @flow */
import { type ZalgoPromise } from 'zalgo-promise/src';
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { matchDomain, type CrossDomainWindowType } from 'cross-domain-utils/src';
import { isRegex } from 'belter/src';
import { isRegex, getOrSet } from 'belter/src';
import { global } from '../global';
import { global, globalStore, windowStore } from '../global';
import { WILDCARD } from '../conf';
let responseListeners = globalStore('responseListeners');
let requestListeners = windowStore('requestListeners');
let erroredResponseListeners = globalStore('erroredResponseListeners');
export function resetListeners() {
global.responseListeners = {};
global.requestListeners = {};
responseListeners.reset();
erroredResponseListeners.reset();
}
global.responseListeners = global.responseListeners || {};
global.requestListeners = global.requestListeners || {};
global.WINDOW_WILDCARD = global.WINDOW_WILDCARD || new (function WindowWildcard() { /* pass */ })();
global.WINDOW_WILDCARD = global.WINDOW_WILDCARD || new (function WindowWildcard() { /* pass */ })();
global.erroredResponseListeners = global.erroredResponseListeners || {};
const __DOMAIN_REGEX__ = '__domain_regex__';

@@ -41,19 +40,19 @@

export function addResponseListener(hash : string, listener : ResponseListenerType) {
global.responseListeners[hash] = listener;
responseListeners.set(hash, listener);
}
export function getResponseListener(hash : string) : ResponseListenerType {
return global.responseListeners[hash];
export function getResponseListener(hash : string) : ?ResponseListenerType {
return responseListeners.get(hash);
}
export function deleteResponseListener(hash : string) {
delete global.responseListeners[hash];
responseListeners.del(hash);
}
export function markResponseListenerErrored(hash : string) {
global.erroredResponseListeners[hash] = true;
erroredResponseListeners.set(hash, true);
}
export function isResponseListenerErrored(hash : string) : boolean {
return Boolean(global.erroredResponseListeners[hash]);
return erroredResponseListeners.has(hash);
}

@@ -75,13 +74,16 @@

let nameListeners = global.requestListeners[name];
for (let winQualifier of [ win, global.WINDOW_WILDCARD ]) {
if (!winQualifier) {
continue;
}
if (!nameListeners) {
return;
}
let nameListeners = requestListeners.get(winQualifier);
for (let winQualifier of [ win, global.WINDOW_WILDCARD ]) {
if (!nameListeners) {
continue;
}
let winListeners = winQualifier && nameListeners.get(winQualifier);
let domainListeners = nameListeners[name];
if (!winListeners) {
if (!domainListeners) {
continue;

@@ -91,8 +93,8 @@ }

if (domain && typeof domain === 'string') {
if (winListeners[domain]) {
return winListeners[domain];
if (domainListeners[domain]) {
return domainListeners[domain];
}
if (winListeners[__DOMAIN_REGEX__]) {
for (let { regex, listener } of winListeners[__DOMAIN_REGEX__]) {
if (domainListeners[__DOMAIN_REGEX__]) {
for (let { regex, listener } of domainListeners[__DOMAIN_REGEX__]) {
if (matchDomain(regex, domain)) {

@@ -105,4 +107,4 @@ return listener;

if (winListeners[WILDCARD]) {
return winListeners[WILDCARD];
if (domainListeners[WILDCARD]) {
return domainListeners[WILDCARD];
}

@@ -112,3 +114,2 @@ }

// eslint-disable-next-line complexity
export function addRequestListener({ name, win, domain } : { name : string, win : ?CrossDomainWindowType, domain : ?(string | RegExp | Array<string>) }, listener : RequestListenerType) : { cancel : () => void } {

@@ -172,36 +173,17 @@

let requestListeners = global.requestListeners;
let nameListeners = requestListeners.getOrSet(win, () => ({}));
// $FlowFixMe
let domainListeners = getOrSet(nameListeners, name, () => ({}));
let nameListeners = requestListeners[name];
if (!nameListeners) {
nameListeners = new WeakMap();
requestListeners[name] = nameListeners;
}
let winListeners = nameListeners.get(win);
if (!winListeners) {
winListeners = {};
nameListeners.set(win, winListeners);
}
let strDomain = domain.toString();
let regexListeners = winListeners[__DOMAIN_REGEX__];
let regexListeners;
let regexListener;
if (isRegex(domain)) {
if (!regexListeners) {
regexListeners = [];
winListeners[__DOMAIN_REGEX__] = regexListeners;
}
regexListeners = getOrSet(domainListeners, __DOMAIN_REGEX__, () => []);
regexListener = { regex: domain, listener };
regexListeners.push(regexListener);
} else {
winListeners[strDomain] = listener;
domainListeners[strDomain] = listener;
}

@@ -211,18 +193,23 @@

cancel() {
if (!winListeners) {
return;
}
delete domainListeners[strDomain];
delete winListeners[strDomain];
if (regexListener) {
regexListeners.splice(regexListeners.indexOf(regexListener, 1));
if (win && Object.keys(winListeners).length === 0) {
nameListeners.delete(win);
if (!regexListeners.length) {
delete domainListeners[__DOMAIN_REGEX__];
}
}
if (regexListener) {
regexListeners.splice(regexListeners.indexOf(regexListener, 1));
if (!Object.keys(domainListeners).length) {
// $FlowFixMe
delete nameListeners[name];
}
// $FlowFixMe
if (win && !Object.keys(nameListeners).length) {
requestListeners.del(win);
}
}
};
}

@@ -9,7 +9,7 @@ /* @flow */

import { deserializeMessage } from '../../serialize';
import { global } from '../../global';
import { global, globalStore } from '../../global';
import { RECEIVE_MESSAGE_TYPES } from './types';
global.receivedMessages = global.receivedMessages || [];
let receivedMessages = globalStore('receivedMessages');

@@ -86,9 +86,9 @@ type MessageEvent = {

markWindowKnown(source);
if (global.receivedMessages.indexOf(message.id) === -1) {
global.receivedMessages.push(message.id);
} else {
if (receivedMessages.has(message.id)) {
return;
}
receivedMessages.set(message.id, true);
if (__DEBUG__) {

@@ -95,0 +95,0 @@ let level;

/* @flow */
import { type CrossDomainWindowType } from 'cross-domain-utils/src';
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { getOrSet } from 'belter/src';
import { WINDOW_PROP } from './conf';
export let global : Object = window[WINDOW_PROP.POSTROBOT] = window[WINDOW_PROP.POSTROBOT] || {};
let winStore = global.windowStore = global.windowStore || new WeakMap();
// Backwards compatibility
type WindowStore<T> = {|
get : ((CrossDomainWindowType, T) => T) & ((CrossDomainWindowType, void) => T | void),
set : (CrossDomainWindowType, T) => T,
has : (CrossDomainWindowType) => boolean,
del : (CrossDomainWindowType) => void,
getOrSet : (CrossDomainWindowType, () => T) => T
|};
global.registerSelf = () => {
// pass
};
type ObjectGetter = () => Object;
let getObj : ObjectGetter = () => ({});
// $FlowFixMe
export function windowStore<T>(key : string, defStore? : ObjectGetter = getObj) : WindowStore<T> {
function getStore(win : CrossDomainWindowType) : ObjectGetter {
return winStore.getOrSet(win, defStore);
}
return {
has: (win) => {
let store = getStore(win);
return store.hasOwnProperty(key);
},
get: (win, defVal) => {
let store = getStore(win);
// $FlowFixMe
return store.hasOwnProperty(key) ? store[key] : defVal;
},
set: (win, val) => {
let store = getStore(win);
store[key] = val;
return val;
},
del: (win) => {
let store = getStore(win);
delete store[key];
},
getOrSet: (win, getter) => {
let store = getStore(win);
if (store.hasOwnProperty(key)) {
return store[key];
}
let val = getter();
store[key] = val;
return val;
}
};
}
type GlobalStore<T> = {|
get : ((string, T) => T) & ((string, void) => T | void),
set : (string, T) => T,
has : (string) => boolean,
del : (string) => void,
getOrSet : (string, () => T) => T,
reset : () => void,
keys : () => $ReadOnlyArray<string>
|};
// $FlowFixMe
export function globalStore<T : mixed>(key : string, defStore? : ObjectGetter = getObj) : GlobalStore<T> {
let store = getOrSet(global, key, defStore);
return {
has: (storeKey) => {
return store.hasOwnProperty(storeKey);
},
get: (storeKey, defVal) => {
// $FlowFixMe
return store.hasOwnProperty(storeKey) ? store[storeKey] : defVal;
},
set: (storeKey, val) => {
store[storeKey] = val;
return val;
},
del: (storeKey) => {
delete store[storeKey];
},
getOrSet: (storeKey, getter) => {
if (store.hasOwnProperty(storeKey)) {
return store[storeKey];
}
let val = getter();
store[storeKey] = val;
return val;
},
reset: () => {
store = defStore();
},
keys: () => {
return Object.keys(store);
}
};
}
/* @flow */
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { getAllWindows, type CrossDomainWindowType } from 'cross-domain-utils/src';

@@ -9,10 +8,9 @@ import { ZalgoPromise } from 'zalgo-promise/src';

import { MESSAGE_NAME, WILDCARD } from '../conf';
import { global } from '../global';
import { global, windowStore } from '../global';
global.instanceID = global.instanceID || uniqueID();
global.helloPromises = global.helloPromises || new WeakMap();
global.onHello = global.onHello || [];
let helloPromises = windowStore('helloPromises');
function getHelloPromise(win : CrossDomainWindowType) : ZalgoPromise<{ win : CrossDomainWindowType, domain : string }> {
return global.helloPromises.getOrSet(win, () => new ZalgoPromise());
return helloPromises.getOrSet(win, () => new ZalgoPromise());
}

@@ -19,0 +17,0 @@

/* @flow */
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { type CrossDomainWindowType } from 'cross-domain-utils/src';
global.knownWindows = global.knownWindows || new WeakMap();
import { windowStore } from '../global';
let knownWindows = windowStore('knownWindows');
export function markWindowKnown(win : CrossDomainWindowType) {
global.knownWindows.set(win, true);
knownWindows.set(win, true);
}
export function isWindowKnown(win : CrossDomainWindowType) : boolean {
return global.knownWindows.get(win, false);
return knownWindows.get(win, false);
}
/* @flow */
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { ZalgoPromise } from 'zalgo-promise/src';

@@ -12,5 +11,5 @@ import { getAncestor, isAncestor, isWindowClosed, getDomain, matchDomain, type CrossDomainWindowType } from 'cross-domain-utils/src';

import { awaitWindowHello, sayHello, isWindowKnown } from '../lib';
import { global } from '../global';
import { global, windowStore } from '../global';
global.requestPromises = global.requestPromises || new WeakMap();
export let requestPromises = windowStore('requestPromises');

@@ -99,9 +98,4 @@ type WindowResolverType = CrossDomainWindowType | string | HTMLIFrameElement;

let requestPromises = global.requestPromises.get(win);
let reqPromises = requestPromises.getOrSet(win, () => []);
if (!requestPromises) {
requestPromises = [];
global.requestPromises.set(win, requestPromises);
}
let requestPromise = ZalgoPromise.try(() => {

@@ -147,3 +141,3 @@

hasResult = true;
requestPromises.splice(requestPromises.indexOf(requestPromise, 1));
reqPromises.splice(reqPromises.indexOf(requestPromise, 1));
}

@@ -231,3 +225,3 @@

requestPromises.push(requestPromise);
reqPromises.push(requestPromise);

@@ -234,0 +228,0 @@ return requestPromise;

/* @flow */
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { matchDomain, type CrossDomainWindowType } from 'cross-domain-utils/src';

@@ -10,8 +9,8 @@ import { ZalgoPromise } from 'zalgo-promise/src';

import { MESSAGE_NAME, WILDCARD, SERIALIZATION_TYPE } from '../conf';
import { global } from '../global';
import { global, windowStore, globalStore } from '../global';
import { ProxyWindow } from './window';
global.methods = global.methods || new WeakMap();
global.proxyWindowMethods = global.proxyWindowMethods || {};
let methodStore = windowStore('methodStore');
let proxyWindowMethods = globalStore('proxyWindowMethods');
global.listeningForFunctions = global.listeningForFunctions || false;

@@ -30,4 +29,4 @@

return ZalgoPromise.try(() => {
let methods = global.methods.get(source) || {};
let meth = methods[data.id] || global.proxyWindowMethods[id];
let methods = methodStore.get(source, () => ({}));
let meth = methods[data.id] || proxyWindowMethods.get(id);

@@ -41,6 +40,7 @@ if (!meth) {

if (!matchDomain(domain, origin)) {
throw new Error(`Method domain ${ meth.domain } does not match origin ${ origin }`);
throw new Error(`Method domain ${ JSON.stringify(meth.domain) } does not match origin ${ origin }`);
}
if (proxy) {
// $FlowFixMe
return proxy.matchWindow(source).then(match => {

@@ -50,4 +50,2 @@ if (!match) {

}
delete global.proxyWindowMethods[id];
return val;

@@ -80,5 +78,12 @@ });

if (ProxyWindow.isProxyWindow(destination)) {
global.proxyWindowMethods[id] = { proxy: destination, domain, val };
proxyWindowMethods.set(id, { proxy: destination, domain, val });
// $FlowFixMe
destination.awaitWindow().then(win => {
proxyWindowMethods.del(id);
let methods = methodStore.getOrSet(win, () => ({}));
methods[id] = { domain, val };
});
} else {
let methods = global.methods.getOrSet(destination, () => ({}));
// $FlowFixMe
let methods = methodStore.getOrSet(destination, () => ({}));
methods[id] = { domain, val };

@@ -85,0 +90,0 @@ }

/* @flow */
import { isSameDomain, isWindowClosed, type CrossDomainWindowType } from 'cross-domain-utils/src';
import { WeakMap } from 'cross-domain-safe-weakmap/src';
import { ZalgoPromise } from 'zalgo-promise/src';
import { uniqueID, getOrSet, memoizePromise } from 'belter/src';
import { uniqueID, memoizePromise } from 'belter/src';
import { serializeType, type CustomSerializedType } from 'universal-serialize/src';
import { SERIALIZATION_TYPE } from '../conf';
import { global } from '../global';
import { windowStore, globalStore } from '../global';
import { getWindowInstanceID } from '../lib';
global.winToProxyWindow = global.winToProxyWindow || new WeakMap();
global.idToProxyWindow = global.idToProxyWindow || {};
let winToProxyWindow = windowStore('winToProxyWindow');
let idToProxyWindow = globalStore('idToProxyWindow');
function cleanupProxyWindows() {
for (let id of idToProxyWindow.keys()) {
// $FlowFixMe
if (idToProxyWindow.get(id).shouldClean()) {
delete idToProxyWindow[id];
}
}
}
type SerializedProxyWindow = {|

@@ -146,2 +154,6 @@ close : () => ZalgoPromise<void>,

shouldClean() : boolean {
return this.actualWindow && isWindowClosed(this.actualWindow);
}
static unwrap(win : CrossDomainWindowType | ProxyWindow) : CrossDomainWindowType | ProxyWindow {

@@ -155,2 +167,4 @@ return ProxyWindow.isProxyWindow(win)

static serialize(win : CrossDomainWindowType | ProxyWindow) : SerializedProxyWindow {
cleanupProxyWindows();
return ProxyWindow.toProxyWindow(win).serialize();

@@ -160,3 +174,5 @@ }

static deserialize(serializedWindow : SerializedProxyWindow) : ProxyWindow {
return getOrSet(global.idToProxyWindow, serializedWindow.id, () => {
cleanupProxyWindows();
return idToProxyWindow.getOrSet(serializedWindow.id, () => {
return new ProxyWindow(serializedWindow);

@@ -171,2 +187,4 @@ });

static toProxyWindow(win : CrossDomainWindowType | ProxyWindow) : ProxyWindow {
cleanupProxyWindows();
if (ProxyWindow.isProxyWindow(win)) {

@@ -177,6 +195,7 @@ // $FlowFixMe

return global.winToProxyWindow.getOrSet(win, () => {
// $FlowFixMe
return winToProxyWindow.getOrSet(win, () => {
let id = uniqueID();
global.idToProxyWindow[id] = new ProxyWindow({
return idToProxyWindow.set(id, new ProxyWindow({
id,

@@ -216,5 +235,3 @@ getInstanceID: () => getWindowInstanceID(win),

// $FlowFixMe
}, win);
return global.idToProxyWindow[id];
}, win));
});

@@ -221,0 +238,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc