post-robot
Advanced tools
Comparing version 8.0.29 to 9.0.0
import 'zalgo-promise/src'; | ||
import { getParent, isWindowClosed } from 'cross-domain-utils/src'; | ||
import { noop } from 'belter/src'; | ||
import { CONSTANTS } from '../conf'; | ||
import { noop } from '../lib'; | ||
import { global } from '../global'; | ||
@@ -7,0 +7,0 @@ |
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { isSameDomain, getOpener, getFrames, getDomain, getFrameByName } from 'cross-domain-utils/src'; | ||
import { weakMapMemoize, noop } from 'belter/src'; | ||
import { CONSTANTS } from '../conf'; | ||
import { weakMapMemoize, noop } from '../lib'; | ||
import { global } from '../global'; | ||
@@ -7,0 +7,0 @@ |
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 { global } from '../global'; | ||
import { isRegex } from '../lib'; | ||
import { CONSTANTS } from '../conf'; | ||
@@ -8,0 +8,0 @@ |
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 { isWindowClosed } from 'cross-domain-utils/src'; | ||
import { addEventListener, noop } from 'belter/src'; | ||
import { CONSTANTS, POST_MESSAGE_NAMES_LIST } from '../../conf'; | ||
import { deserializeMethods, jsonParse, addEventListener, noop } from '../../lib'; | ||
import { deserializeMethods } from '../../lib'; | ||
import { global } from '../../global'; | ||
@@ -18,3 +19,3 @@ | ||
try { | ||
parsedMessage = jsonParse(message); | ||
parsedMessage = JSON.parse(message); | ||
} catch (err) { | ||
@@ -141,2 +142,3 @@ return; | ||
export function listenForMessages() { | ||
// $FlowFixMe | ||
addEventListener(window, 'message', messageListener); | ||
@@ -143,0 +145,0 @@ } |
@@ -7,5 +7,5 @@ var _RECEIVE_MESSAGE_TYPE; | ||
import { isWindowClosed, matchDomain, stringifyDomainPattern } from 'cross-domain-utils/src'; | ||
import { stringifyError, noop } from 'belter/src'; | ||
import { CONSTANTS } from '../../conf'; | ||
import { stringifyError, noop } from '../../lib'; | ||
import { sendMessage } from '../send'; | ||
@@ -12,0 +12,0 @@ import { getRequestListener, getResponseListener, deleteResponseListener, isResponseListenerErrored } from '../listeners'; |
@@ -5,5 +5,6 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { uniqueID, stringifyError } from 'belter/src'; | ||
import { CONSTANTS, CONFIG, POST_MESSAGE_NAMES_LIST } from '../../conf'; | ||
import { uniqueID, serializeMethods, getWindowType, jsonStringify, stringifyError } from '../../lib'; | ||
import { serializeMethods, getWindowType } from '../../lib'; | ||
@@ -29,3 +30,3 @@ import { SEND_MESSAGE_STRATEGIES } from './strategies'; | ||
return ZalgoPromise['try'](function () { | ||
var _jsonStringify; | ||
var _JSON$stringify; | ||
@@ -62,3 +63,3 @@ message = buildMessage(win, message, { | ||
var serializedMessage = jsonStringify((_jsonStringify = {}, _jsonStringify[CONSTANTS.WINDOW_PROPS.POSTROBOT] = message, _jsonStringify), null, 2); | ||
var serializedMessage = JSON.stringify((_JSON$stringify = {}, _JSON$stringify[CONSTANTS.WINDOW_PROPS.POSTROBOT] = message, _JSON$stringify), null, 2); | ||
@@ -65,0 +66,0 @@ return ZalgoPromise.map(Object.keys(SEND_MESSAGE_STRATEGIES), function (strategyName) { |
import { WeakMap } from 'cross-domain-safe-weakmap/src'; | ||
import { getAncestor } from 'cross-domain-utils/src'; | ||
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { noop } from 'belter/src'; | ||
@@ -8,4 +9,2 @@ import { CONSTANTS } from '../conf'; | ||
import { noop } from './util'; | ||
global.readyPromises = global.readyPromises || new WeakMap(); | ||
@@ -12,0 +11,0 @@ |
@@ -6,2 +6,3 @@ 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 { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { once, uniqueID, replaceObject, stringifyError, isRegex } from 'belter/src'; | ||
@@ -11,4 +12,2 @@ import { CONSTANTS } from '../conf'; | ||
import { once, uniqueID, replaceObject, stringifyError, isRegex } from './util'; | ||
global.methods = global.methods || new WeakMap(); | ||
@@ -134,2 +133,4 @@ | ||
} | ||
return item; | ||
}).obj; | ||
@@ -199,3 +200,3 @@ } | ||
if ((typeof item === 'undefined' ? 'undefined' : _typeof(item)) !== 'object' || item === null) { | ||
return; | ||
return item; | ||
} | ||
@@ -222,3 +223,5 @@ | ||
} | ||
return item; | ||
}).obj; | ||
} |
@@ -1,4 +0,1 @@ | ||
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 { WeakMap } from 'cross-domain-safe-weakmap/src'; | ||
import { isPopup, isIframe, getUserAgent } from 'cross-domain-utils/src'; | ||
@@ -8,197 +5,2 @@ | ||
export function stringifyError(err) { | ||
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
if (level >= 3) { | ||
return 'stringifyError stack overflow'; | ||
} | ||
try { | ||
if (!err) { | ||
return '<unknown error: ' + Object.prototype.toString.call(err) + '>'; | ||
} | ||
if (typeof err === 'string') { | ||
return err; | ||
} | ||
if (err instanceof Error) { | ||
var stack = err && err.stack; | ||
var message = err && err.message; | ||
if (stack && message) { | ||
if (stack.indexOf(message) !== -1) { | ||
return stack; | ||
} else { | ||
return message + '\n' + stack; | ||
} | ||
} else if (stack) { | ||
return stack; | ||
} else if (message) { | ||
return message; | ||
} | ||
} | ||
if (typeof err.toString === 'function') { | ||
return err.toString(); | ||
} | ||
return Object.prototype.toString.call(err); | ||
} catch (newErr) { | ||
// eslint-disable-line unicorn/catch-error-name | ||
return 'Error while stringifying error: ' + stringifyError(newErr, level + 1); | ||
} | ||
} | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
export var once = function once(method) { | ||
if (!method) { | ||
return method; | ||
} | ||
var called = false; | ||
return function onceWrapper() { | ||
if (!called) { | ||
called = true; | ||
return method.apply(this, arguments); | ||
} | ||
}; | ||
}; | ||
// eslint-disable-next-line no-unused-vars | ||
export function noop() { | ||
// pass | ||
} | ||
export function addEventListener(obj, event, handler) { | ||
if (obj.addEventListener) { | ||
obj.addEventListener(event, handler); | ||
} else { | ||
obj.attachEvent('on' + event, handler); | ||
} | ||
return { | ||
cancel: function cancel() { | ||
if (obj.removeEventListener) { | ||
obj.removeEventListener(event, handler); | ||
} else { | ||
obj.detachEvent('on' + event, handler); | ||
} | ||
} | ||
}; | ||
} | ||
export function uniqueID() { | ||
var chars = '0123456789abcdef'; | ||
return 'xxxxxxxxxx'.replace(/./g, function () { | ||
return chars.charAt(Math.floor(Math.random() * chars.length)); | ||
}); | ||
} | ||
export function eachArray(item, callback) { | ||
for (var i = 0; i < item.length; i++) { | ||
callback(item[i], i); | ||
} | ||
} | ||
export function eachObject(item, callback) { | ||
for (var _key in item) { | ||
if (item.hasOwnProperty(_key)) { | ||
callback(item[_key], _key); | ||
} | ||
} | ||
} | ||
export function each(item, callback) { | ||
if (Array.isArray(item)) { | ||
eachArray(item, callback); | ||
} else if ((typeof item === 'undefined' ? 'undefined' : _typeof(item)) === 'object' && item !== null) { | ||
eachObject(item, callback); | ||
} | ||
} | ||
export function replaceObject(item, callback) { | ||
var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; | ||
if (depth >= 100) { | ||
throw new Error('Self-referential object passed, or object contained too many layers'); | ||
} | ||
var newobj = void 0; | ||
if ((typeof item === 'undefined' ? 'undefined' : _typeof(item)) === 'object' && item !== null && !Array.isArray(item)) { | ||
newobj = {}; | ||
} else if (Array.isArray(item)) { | ||
newobj = []; | ||
} else { | ||
throw new TypeError('Invalid type: ' + (typeof item === 'undefined' ? 'undefined' : _typeof(item))); | ||
} | ||
each(item, function (childItem, key) { | ||
var result = callback(childItem, key); | ||
if (typeof result !== 'undefined') { | ||
// $FlowFixMe | ||
newobj[key] = result; | ||
} else if ((typeof childItem === 'undefined' ? 'undefined' : _typeof(childItem)) === 'object' && childItem !== null) { | ||
// $FlowFixMe | ||
newobj[key] = replaceObject(childItem, callback, depth + 1); | ||
} else { | ||
// $FlowFixMe | ||
newobj[key] = childItem; | ||
} | ||
}); | ||
// $FlowFixMe | ||
return newobj; | ||
} | ||
export function safeInterval(method, time) { | ||
var timeout = void 0; | ||
function runInterval() { | ||
timeout = setTimeout(runInterval, time); | ||
method.call(); | ||
} | ||
timeout = setTimeout(runInterval, time); | ||
return { | ||
cancel: function cancel() { | ||
clearTimeout(timeout); | ||
} | ||
}; | ||
} | ||
export function isRegex(item) { | ||
return Object.prototype.toString.call(item) === '[object RegExp]'; | ||
} | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
export var weakMapMemoize = function weakMapMemoize(method) { | ||
var weakmap = new WeakMap(); | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
return function weakmapMemoized(arg) { | ||
var result = weakmap.get(arg); | ||
if (typeof result !== 'undefined') { | ||
return result; | ||
} | ||
result = method.call(this, arg); | ||
if (typeof result !== 'undefined') { | ||
weakmap.set(arg, result); | ||
} | ||
return result; | ||
}; | ||
}; | ||
export function getWindowType() { | ||
@@ -214,56 +16,2 @@ if (isPopup()) { | ||
export function jsonStringify(obj, replacer, indent) { | ||
var objectToJSON = void 0; | ||
var arrayToJSON = void 0; | ||
try { | ||
if (JSON.stringify({}) !== '{}') { | ||
// $FlowFixMe | ||
objectToJSON = Object.prototype.toJSON; | ||
// $FlowFixMe | ||
delete Object.prototype.toJSON; | ||
} | ||
if (JSON.stringify({}) !== '{}') { | ||
throw new Error('Can not correctly serialize JSON objects'); | ||
} | ||
if (JSON.stringify([]) !== '[]') { | ||
// $FlowFixMe | ||
arrayToJSON = Array.prototype.toJSON; | ||
// $FlowFixMe | ||
delete Array.prototype.toJSON; | ||
} | ||
if (JSON.stringify([]) !== '[]') { | ||
throw new Error('Can not correctly serialize JSON objects'); | ||
} | ||
} catch (err) { | ||
throw new Error('Can not repair JSON.stringify: ' + err.message); | ||
} | ||
var result = JSON.stringify.call(this, obj, replacer, indent); | ||
try { | ||
if (objectToJSON) { | ||
// $FlowFixMe | ||
Object.prototype.toJSON = objectToJSON; // eslint-disable-line no-extend-native | ||
} | ||
if (arrayToJSON) { | ||
// $FlowFixMe | ||
Array.prototype.toJSON = arrayToJSON; // eslint-disable-line no-extend-native | ||
} | ||
} catch (err) { | ||
throw new Error('Can not repair JSON.stringify: ' + err.message); | ||
} | ||
return result; | ||
} | ||
export function jsonParse(item) { | ||
return JSON.parse(item); | ||
} | ||
export function needsGlobalMessagingForBrowser() { | ||
@@ -270,0 +18,0 @@ |
@@ -5,6 +5,7 @@ export { _send as send }; | ||
import { getAncestor, isAncestor, isWindowClosed, getDomain, matchDomain } from 'cross-domain-utils/src'; | ||
import { uniqueID, isRegex } from 'belter/src'; | ||
import { CONFIG, CONSTANTS } from '../conf'; | ||
import { sendMessage, addResponseListener, deleteResponseListener, markResponseListenerErrored } from '../drivers'; | ||
import { uniqueID, onChildWindowReady, sayHello, isRegex } from '../lib'; | ||
import { onChildWindowReady, sayHello } from '../lib'; | ||
import { global } from '../global'; | ||
@@ -11,0 +12,0 @@ |
@@ -7,4 +7,4 @@ export { _on as on }; | ||
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { once as onceFunction, safeInterval } from 'belter/src'; | ||
import { once as onceFunction, safeInterval } from '../lib'; | ||
import { addRequestListener } from '../drivers'; | ||
@@ -11,0 +11,0 @@ import { CONSTANTS } from '../conf'; |
@@ -1,3 +0,3 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("postRobot",[],n):"object"==typeof exports?exports.postRobot=n():e.postRobot=n()}("undefined"!=typeof self?self:this,function(){return function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="",r(r.s=8)}([function(e,n,r){"use strict";var t=r(9);r.d(n,"getActualDomain",function(){return t.a}),r.d(n,"getAncestor",function(){return t.b}),r.d(n,"getDomain",function(){return t.c}),r.d(n,"getDomainFromUrl",function(){return t.d}),r.d(n,"getFrameByName",function(){return t.e}),r.d(n,"getFrames",function(){return t.f}),r.d(n,"getOpener",function(){return t.g}),r.d(n,"getParent",function(){return t.h}),r.d(n,"getUserAgent",function(){return t.i}),r.d(n,"isActuallySameDomain",function(){return t.j}),r.d(n,"isAncestor",function(){return t.k}),r.d(n,"isIframe",function(){return t.l}),r.d(n,"isOpener",function(){return t.m}),r.d(n,"isPopup",function(){return t.n}),r.d(n,"isSameDomain",function(){return t.o}),r.d(n,"isSameTopWindow",function(){return t.p}),r.d(n,"isWindow",function(){return t.q}),r.d(n,"isWindowClosed",function(){return t.r}),r.d(n,"matchDomain",function(){return t.s}),r.d(n,"stringifyDomainPattern",function(){return t.t});var o=r(10);r.n(o)},function(e,n,r){"use strict";var t,o={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",HELLO:"postrobot_ready",OPEN_TUNNEL:"postrobot_open_tunnel"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method",ERROR:"postrobot_error",PROMISE:"postrobot_promise",ZALGO_PROMISE:"postrobot_zalgo_promise",REGEX:"regex"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",BRIDGE:"postrobot_bridge",GLOBAL:"postrobot_global"},MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",BRIDGE_NAME_PREFIX:"__postrobot_bridge__",POSTROBOT_PROXY:"__postrobot_proxy__",WILDCARD:"*"},i={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},a=Object.keys(i).map(function(e){return i[e]}),u={ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:-1!==window.navigator.userAgent.match(/MSIE/i)?2e3:1e3,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(t={},t[o.SEND_STRATEGIES.POST_MESSAGE]=!0,t[o.SEND_STRATEGIES.BRIDGE]=!0,t[o.SEND_STRATEGIES.GLOBAL]=!0,t),ALLOW_SAME_ORIGIN:!1};0===window.location.href.indexOf(o.FILE_PROTOCOL)&&(u.ALLOW_POSTMESSAGE_POPUP=!0),r.d(n,"a",function(){return u}),r.d(n,"b",function(){return o}),r.d(n,!1,function(){return i}),r.d(n,!1,function(){return a})},function(e,n,r){"use strict";function t(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var r=n.call(e);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}function o(){var e=void 0;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");e=window}var n=e.__zalgopromise__=e.__zalgopromise__||{};return n.flushPromises=n.flushPromises||[],n.activeCount=n.activeCount||0,n.possiblyUnhandledPromiseHandlers=n.possiblyUnhandledPromiseHandlers||[],n.dispatchedErrors=n.dispatchedErrors||[],n}var i=function(){function e(n){var r=this;if(function(n,r){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],n){var t=void 0,o=void 0,i=!1,a=!1,u=!1;try{n(function(e){u?r.resolve(e):(i=!0,t=e)},function(e){u?r.reject(e):(a=!0,o=e)})}catch(e){return void this.reject(e)}u=!0,i?this.resolve(t):a&&this.reject(o)}}return e.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(t(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},e.prototype.reject=function(e){var n=this;if(this.resolved||this.rejected)return this;if(t(e))throw new Error("Can not reject promise with another promise");if(!e){var r=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e);e=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){n.errorHandled||function(e,n){if(-1===o().dispatchedErrors.indexOf(e)){o().dispatchedErrors.push(e),setTimeout(function(){throw e},1);for(var r=0;r<o().possiblyUnhandledPromiseHandlers.length;r++)o().possiblyUnhandledPromiseHandlers[r](e,n)}}(e,n)},1),this.dispatch(),this},e.prototype.asyncReject=function(e){this.errorHandled=!0,this.reject(e)},e.prototype.dispatch=function(){var n=this,r=this.dispatching,i=this.resolved,a=this.rejected,u=this.handlers;if(!r&&(i||a)){this.dispatching=!0,o().activeCount+=1;for(var c=function(r){var o=u[r],c=o.onSuccess,s=o.onError,d=o.promise,f=void 0;if(i)try{f=c?c(n.value):n.value}catch(e){return d.reject(e),"continue"}else if(a){if(!s)return d.reject(n.error),"continue";try{f=s(n.error)}catch(e){return d.reject(e),"continue"}}f instanceof e&&(f.resolved||f.rejected)?(f.resolved?d.resolve(f.value):d.reject(f.error),f.errorHandled=!0):t(f)?f instanceof e&&(f.resolved||f.rejected)?f.resolved?d.resolve(f.value):d.reject(f.error):f.then(function(e){d.resolve(e)},function(e){d.reject(e)}):d.resolve(f)},s=0;s<u.length;s++)c(s);u.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&e.flushQueue()}},e.prototype.then=function(n,r){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var t=new e;return this.handlers.push({promise:t,onSuccess:n,onError:r}),this.errorHandled=!0,this.dispatch(),t},e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.finally=function(n){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(n).then(function(){return r})},function(r){return e.try(n).then(function(){throw r})})},e.prototype.timeout=function(e,n){var r=this;if(this.resolved||this.rejected)return this;var t=setTimeout(function(){r.resolved||r.rejected||r.reject(n||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(e){return clearTimeout(t),e})},e.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(n){return n instanceof e?n:t(n)?new e(function(e,r){return n.then(e,r)}):(new e).resolve(n)},e.reject=function(n){return(new e).reject(n)},e.all=function(n){var r=new e,o=n.length,i=[];if(!o)return r.resolve(i),r;for(var a=function(a){var u=n[a];if(u instanceof e){if(u.resolved)return i[a]=u.value,o-=1,"continue"}else if(!t(u))return i[a]=u,o-=1,"continue";e.resolve(u).then(function(e){i[a]=e,0==(o-=1)&&r.resolve(i)},function(e){r.reject(e)})},u=0;u<n.length;u++)a(u);return 0===o&&r.resolve(i),r},e.hash=function(n){var r={};return e.all(Object.keys(n).map(function(t){return e.resolve(n[t]).then(function(e){r[t]=e})})).then(function(){return r})},e.map=function(n,r){return e.all(n.map(r))},e.onPossiblyUnhandledException=function(e){return function(e){return o().possiblyUnhandledPromiseHandlers.push(e),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(e),1)}}}(e)},e.try=function(n,r,t){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=n.apply(r,t||[])}catch(n){return e.reject(n)}return e.resolve(o)},e.delay=function(n){return new e(function(e){setTimeout(e,n)})},e.isPromise=function(n){return!!(n&&n instanceof e)||t(n)},e.flush=function(){var n=new e;return o().flushPromises.push(n),0===o().activeCount&&e.flushQueue(),n},e.flushQueue=function(){var e=o().flushPromises;o().flushPromises=[];for(var n=0,r=null==e?0:e.length;n<r;n++)e[n].resolve()},e}();r.d(n,"a",function(){return i})},function(e,n,r){"use strict";r.d(n,"a",function(){return o});var t=r(1),o=window[t.b.WINDOW_PROPS.POSTROBOT]=window[t.b.WINDOW_PROPS.POSTROBOT]||{};o.registerSelf=function(){}},function(e,n,r){"use strict";var t=r(5),o=r(0),i=r(1),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function u(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n>=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,t=e&&e.message;if(r&&t)return-1!==r.indexOf(t)?r:t+"\n"+r;if(r)return r;if(t)return t}return"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(e){return"Error while stringifying error: "+u(e,n+1)}}var c=function(e){if(!e)return e;var n=!1;return function(){if(!n)return n=!0,e.apply(this,arguments)}};function s(){}function d(e,n,r){return e.addEventListener?e.addEventListener(n,r):e.attachEvent("on"+n,r),{cancel:function(){e.removeEventListener?e.removeEventListener(n,r):e.detachEvent("on"+n,r)}}}function f(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})}function w(e,n){for(var r=0;r<e.length;r++)n(e[r],r)}function l(e,n){for(var r in e)e.hasOwnProperty(r)&&n(e[r],r)}function m(e,n){Array.isArray(e)?w(e,n):"object"===(void 0===e?"undefined":a(e))&&null!==e&&l(e,n)}function p(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(r>=100)throw new Error("Self-referential object passed, or object contained too many layers");var t=void 0;if("object"!==(void 0===e?"undefined":a(e))||null===e||Array.isArray(e)){if(!Array.isArray(e))throw new TypeError("Invalid type: "+(void 0===e?"undefined":a(e)));t=[]}else t={};return m(e,function(e,o){var i=n(e,o);void 0!==i?t[o]=i:"object"===(void 0===e?"undefined":a(e))&&null!==e?t[o]=p(e,n,r+1):t[o]=e}),t}function h(e,n){var r=void 0;return r=setTimeout(function t(){r=setTimeout(t,n),e.call()},n),{cancel:function(){clearTimeout(r)}}}function O(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var g=function(e){var n=new t.a;return function(r){var t=n.get(r);return void 0!==t?t:(void 0!==(t=e.call(this,r))&&n.set(r,t),t)}};function y(){return Object(o.isPopup)()?i.b.WINDOW_TYPES.POPUP:Object(o.isIframe)()?i.b.WINDOW_TYPES.IFRAME:i.b.WINDOW_TYPES.FULLPAGE}function v(e,n,r){var t=void 0,o=void 0;try{if("{}"!==JSON.stringify({})&&(t=Object.prototype.toJSON,delete Object.prototype.toJSON),"{}"!==JSON.stringify({}))throw new Error("Can not correctly serialize JSON objects");if("[]"!==JSON.stringify([])&&(o=Array.prototype.toJSON,delete Array.prototype.toJSON),"[]"!==JSON.stringify([]))throw new Error("Can not correctly serialize JSON objects")}catch(e){throw new Error("Can not repair JSON.stringify: "+e.message)}var i=JSON.stringify.call(this,e,n,r);try{t&&(Object.prototype.toJSON=t),o&&(Array.prototype.toJSON=o)}catch(e){throw new Error("Can not repair JSON.stringify: "+e.message)}return i}function E(e){return JSON.parse(e)}function b(){return!!Object(o.getUserAgent)(window).match(/MSIE|trident|edge\/12|edge\/13/i)||!i.a.ALLOW_POSTMESSAGE_POPUP}var _=r(2),S=r(3),P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};S.a.methods=S.a.methods||new t.a;var T=c(function(){S.a.on(i.b.POST_MESSAGE_NAMES.METHOD,{origin:i.b.WILDCARD},function(e){var n=e.source,r=e.origin,t=e.data,i=S.a.methods.get(n);if(!i)throw new Error("Could not find any methods this window has privileges to call");var a=i[t.id];if(!a)throw new Error("Could not find method with id: "+t.id);if(!Object(o.matchDomain)(a.domain,r))throw new Error("Method domain "+a.domain+" does not match origin "+r);return _.a.try(function(){return a.method.apply({source:n,origin:r,data:t},t.args)}).then(function(e){return{result:e,id:t.id,name:t.name}})})});function A(e,n){return"object"===(void 0===e?"undefined":P(e))&&null!==e&&e.__type__===n}function W(e,n,r,t){var o=f(),a=S.a.methods.get(e);return a||(a={},S.a.methods.set(e,a)),a[o]={domain:n,method:r},{__type__:i.b.SERIALIZATION_TYPES.METHOD,__id__:o,__name__:t}}function j(e,n,r){return p({obj:r},function(r,t){return"function"==typeof r?W(e,n,r,t.toString()):r instanceof Error?(o=r,{__type__:i.b.SERIALIZATION_TYPES.ERROR,__message__:u(o),__code__:o.code}):window.Promise&&r instanceof window.Promise?function(e,n,r,t){return{__type__:i.b.SERIALIZATION_TYPES.PROMISE,__then__:W(e,n,function(e,n){return r.then(e,n)},t+".then")}}(e,n,r,t.toString()):_.a.isPromise(r)?function(e,n,r,t){return{__type__:i.b.SERIALIZATION_TYPES.ZALGO_PROMISE,__then__:W(e,n,function(e,n){return r.then(e,n)},t+".then")}}(e,n,r,t.toString()):O(r)?(a=r,{__type__:i.b.SERIALIZATION_TYPES.REGEX,__source__:a.source}):void 0;var o,a}).obj}function R(e,n,r){function t(){var t=Array.prototype.slice.call(arguments);return S.a.send(e,i.b.POST_MESSAGE_NAMES.METHOD,{id:r.__id__,name:r.__name__,args:t},{domain:n,timeout:-1}).then(function(e){return e.data.result},function(e){throw e})}return t.__name__=r.__name__,t.__xdomain__=!0,t.source=e,t.origin=n,t}function D(e,n,r){var t=new Error(r.__message__);return r.__code__&&(t.code=r.__code__),t}function I(e,n,r){return new _.a(function(t,o){return R(e,n,r.__then__)(t,o)})}function M(e,n,r){return window.Promise?new window.Promise(function(t,o){return R(e,n,r.__then__)(t,o)}):I(e,n,r)}function L(e,n,r){return new RegExp(r.__source__)}function C(e,n,r){return p({obj:r},function(r){if("object"===(void 0===r?"undefined":P(r))&&null!==r)return A(r,i.b.SERIALIZATION_TYPES.METHOD)?R(e,n,r):A(r,i.b.SERIALIZATION_TYPES.ERROR)?D(0,0,r):A(r,i.b.SERIALIZATION_TYPES.PROMISE)?M(e,n,r):A(r,i.b.SERIALIZATION_TYPES.ZALGO_PROMISE)?I(e,n,r):A(r,i.b.SERIALIZATION_TYPES.REGEX)?L(0,0,r):void 0}).obj}function N(e){S.a.on(i.b.POST_MESSAGE_NAMES.HELLO,{domain:i.b.WILDCARD},function(n){var r=n.source,t=n.origin;return e({source:r,origin:t})})}function B(e){return S.a.send(e,i.b.POST_MESSAGE_NAMES.HELLO,{},{domain:i.b.WILDCARD,timeout:-1}).then(function(e){return{origin:e.origin}})}function x(){N(function(e){var n=e.source,r=e.origin,t=S.a.readyPromises.get(n)||new _.a;t.resolve({origin:r}),S.a.readyPromises.set(n,t)});var e=Object(o.getAncestor)();e&&B(e).catch(s)}function k(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",t=S.a.readyPromises.get(e);return t||(t=new _.a,S.a.readyPromises.set(e,t),-1!==n&&setTimeout(function(){return t.reject(new Error(r+" did not load after "+n+"ms"))},n),t)}S.a.readyPromises=S.a.readyPromises||new t.a,r.d(n,"p",function(){return u}),r.d(n,"l",function(){return c}),r.d(n,"j",function(){return s}),r.d(n,"a",function(){return d}),r.d(n,"q",function(){return f}),r.d(n,!1,function(){return w}),r.d(n,!1,function(){return l}),r.d(n,!1,function(){return m}),r.d(n,!1,function(){return p}),r.d(n,"m",function(){return h}),r.d(n,"e",function(){return O}),r.d(n,"r",function(){return g}),r.d(n,"c",function(){return y}),r.d(n,"g",function(){return v}),r.d(n,"f",function(){return E}),r.d(n,"i",function(){return b}),r.d(n,"h",function(){return T}),r.d(n,!1,function(){return W}),r.d(n,"o",function(){return j}),r.d(n,!1,function(){return R}),r.d(n,!1,function(){return D}),r.d(n,!1,function(){return I}),r.d(n,!1,function(){return M}),r.d(n,!1,function(){return L}),r.d(n,"b",function(){return C}),r.d(n,!1,function(){return N}),r.d(n,"n",function(){return B}),r.d(n,"d",function(){return x}),r.d(n,"k",function(){return k})},function(e,n,r){"use strict";r.d({},"WeakMap",function(){return u});var t=r(0);function o(e,n){for(var r=0;r<e.length;r++)try{if(e[r]===n)return r}catch(e){}return-1}var i=Object.defineProperty,a=Date.now()%1e9,u=function(){function e(){if(function(n,r){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this),a+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+a,function(){if(!window.WeakMap)return!1;if(!window.Object.freeze)return!1;try{var e=new window.WeakMap,n={};return window.Object.freeze(n),e.set(n,"__testvalue__"),"__testvalue__"===e.get(n)}catch(e){return!1}}())try{this.weakmap=new window.WeakMap}catch(e){}this.keys=[],this.values=[]}return e.prototype._cleanupClosedWindows=function(){for(var e=this.weakmap,n=this.keys,r=0;r<n.length;r++){var o=n[r];if(Object(t.isWindow)(o)&&Object(t.isWindowClosed)(o)){if(e)try{e.delete(o)}catch(e){}n.splice(r,1),this.values.splice(r,1),r-=1}}},e.prototype.isSafeToReadWrite=function(e){if(Object(t.isWindow)(e))return!1;try{e&&e.self,e&&e[this.name]}catch(e){return!1}return!0},e.prototype.set=function(e,n){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(e,n)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var t=this.name,a=e[t];a&&a[0]===e?a[1]=n:i(e,t,{value:[e,n],writable:!0})}else{this._cleanupClosedWindows();var u=this.keys,c=this.values,s=o(u,e);-1===s?(u.push(e),c.push(n)):c[s]=n}},e.prototype.get=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{if(n.has(e))return n.get(e)}catch(e){delete this.weakmap}if(!this.isSafeToReadWrite(e)){this._cleanupClosedWindows();var r=o(this.keys,e);if(-1===r)return;return this.values[r]}var t=e[this.name];if(t&&t[0]===e)return t[1]},e.prototype.delete=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var r=e[this.name];r&&r[0]===e&&(r[0]=r[1]=void 0)}else{this._cleanupClosedWindows();var t=this.keys,i=o(t,e);-1!==i&&(t.splice(i,1),this.values.splice(i,1))}},e.prototype.has=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{return n.has(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var r=e[this.name];return!(!r||r[0]!==e)}return this._cleanupClosedWindows(),-1!==o(this.keys,e)},e}();r.d(n,"a",function(){return u})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(2),o=r(0),i=r(1),a=r(4),u=r(3);function c(e){try{u.a.tunnelWindows[e]&&delete u.a.tunnelWindows[e].source}catch(e){}delete u.a.tunnelWindows[e]}u.a.tunnelWindows=u.a.tunnelWindows||{},u.a.tunnelWindowId=0,u.a.openTunnelToParent=function(e){var n=e.name,r=e.source,t=e.canary,s=e.sendMessage,d=Object(o.getParent)(window);if(!d)throw new Error("No parent window found to open tunnel to");var f=function(e){var n=e.name,r=e.source,t=e.canary,i=e.sendMessage;return function(){for(var e=u.a.tunnelWindows,n=0,r=Object.keys(e),t=null==r?0:r.length;n<t;n++){var i=r[n],s=e[i];try{Object(a.j)(s.source)}catch(e){c(i);continue}Object(o.isWindowClosed)(s.source)&&c(i)}}(),u.a.tunnelWindowId+=1,u.a.tunnelWindows[u.a.tunnelWindowId]={name:n,source:r,canary:t,sendMessage:i},u.a.tunnelWindowId}({name:n,source:r,canary:t,sendMessage:s});return u.a.send(d,i.b.POST_MESSAGE_NAMES.OPEN_TUNNEL,{name:n,sendMessage:function(){var e=function(e){return u.a.tunnelWindows[e]}(f);try{Object(a.j)(e&&e.source)}catch(e){return void c(f)}if(e&&e.source&&!Object(o.isWindowClosed)(e.source)){try{e.canary()}catch(e){return}e.sendMessage.apply(this,arguments)}}},{domain:i.b.WILDCARD})};var s=r(5);function d(){return!!Object(o.getUserAgent)(window).match(/MSIE|trident|edge\/12|edge\/13/i)||!i.a.ALLOW_POSTMESSAGE_POPUP}function f(e){return!Object(o.isSameTopWindow)(window,e)}function w(e,n){if(e){if(Object(o.getDomain)()!==Object(o.getDomainFromUrl)(e))return!0}else if(n&&!Object(o.isSameDomain)(n))return!0;return!1}function l(e){var n=e.win,r=e.domain;return!(!d()||r&&!w(r,n)||n&&!f(n))}function m(e){var n=(e=e||Object(o.getDomainFromUrl)(e)).replace(/[^a-zA-Z0-9]+/g,"_");return i.b.BRIDGE_NAME_PREFIX+"_"+n}function p(){return Boolean(window.name&&window.name===m(Object(o.getDomain)()))}var h=new t.a(function(e){if(window.document&&window.document.body)return e(window.document.body);var n=setInterval(function(){if(window.document&&window.document.body)return clearInterval(n),e(window.document.body)},10)});function O(e){u.a.remoteWindows.set(e,{sendMessagePromise:new t.a})}function g(e){return u.a.remoteWindows.get(e)}function y(e,n,r){var i=g(e);if(!i)throw new Error("Window not found to register sendMessage to");var a=function(t,i,a){if(t!==e)throw new Error("Remote window does not match window");if(!Object(o.matchDomain)(a,n))throw new Error("Remote domain "+a+" does not match domain "+n);r(i)};i.sendMessagePromise.resolve(a),i.sendMessagePromise=t.a.resolve(a)}function v(e,n){var r=g(e);if(!r)throw new Error("Window not found on which to reject sendMessage");r.sendMessagePromise.asyncReject(n)}function E(e,n,r){var t=Object(o.isOpener)(window,e),i=Object(o.isOpener)(e,window);if(!t&&!i)throw new Error("Can only send messages to and from parent and popup windows");var a=g(e);if(!a)throw new Error("Window not found to send message to");return a.sendMessagePromise.then(function(t){return t(e,n,r)})}u.a.remoteWindows=u.a.remoteWindows||new s.a;var b=Object(a.r)(function(e){return t.a.try(function(){for(var n=0,r=Object(o.getFrames)(e),a=null==r?0:r.length;n<a;n++){var u=r[n];try{if(u&&u!==window&&Object(o.isSameDomain)(u)&&u[i.b.WINDOW_PROPS.POSTROBOT])return u}catch(e){continue}}try{var c=Object(o.getFrameByName)(e,m(Object(o.getDomain)()));if(!c)return;return Object(o.isSameDomain)(c)&&c[i.b.WINDOW_PROPS.POSTROBOT]?c:new t.a(function(e){var n=void 0,r=void 0;n=setInterval(function(){if(c&&Object(o.isSameDomain)(c)&&c[i.b.WINDOW_PROPS.POSTROBOT])return clearInterval(n),clearTimeout(r),e(c)},100),r=setTimeout(function(){return clearInterval(n),e()},2e3)})}catch(e){}})});function _(){return t.a.try(function(){var e=Object(o.getOpener)(window);if(e&&l({win:e}))return O(e),b(e).then(function(n){return n?window.name?n[i.b.WINDOW_PROPS.POSTROBOT].openTunnelToParent({name:window.name,source:window,canary:function(){},sendMessage:function(e){try{Object(a.j)(window)}catch(e){return}if(window&&!window.closed)try{u.a.receiveMessage({data:e,origin:this.origin,source:this.source})}catch(e){t.a.reject(e)}}}).then(function(n){var r=n.source,t=n.origin,o=n.data;if(r!==e)throw new Error("Source does not match opener");y(r,t,o.sendMessage)}).catch(function(n){throw v(e,n),n}):v(e,new Error("Can not register with opener: window does not have a name")):v(e,new Error("Can not register with opener: no bridge found in opener"))})})}function S(e,n){return n=n||Object(o.getDomainFromUrl)(e),Boolean(u.a.bridges[n])}function P(e,n){return n=n||Object(o.getDomainFromUrl)(e),u.a.bridges[n]?u.a.bridges[n]:(u.a.bridges[n]=t.a.try(function(){if(Object(o.getDomain)()===n)throw new Error("Can not open bridge on the same domain as current domain: "+n);var r=m(n);if(Object(o.getFrameByName)(window,r))throw new Error("Frame with name "+r+" already exists on page");var c=function(e,n){var r=document.createElement("iframe");return r.setAttribute("name",e),r.setAttribute("id",e),r.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),r.setAttribute("frameborder","0"),r.setAttribute("border","0"),r.setAttribute("scrolling","no"),r.setAttribute("allowTransparency","true"),r.setAttribute("tabindex","-1"),r.setAttribute("hidden","true"),r.setAttribute("title",""),r.setAttribute("role","presentation"),r.src=n,r}(r,e);return u.a.bridgeFrames[n]=c,h.then(function(r){r.appendChild(c);var o=c.contentWindow;return function(e,n){u.a.on(i.b.POST_MESSAGE_NAMES.OPEN_TUNNEL,{window:e,domain:n},function(e){var r=e.origin,o=e.data;if(r!==n)throw new Error("Domain "+n+" does not match origin "+r);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!==r)throw new Error("Message origin "+r+" does not matched registered window origin "+u.a.popupWindowsByName[o.name].domain);return y(u.a.popupWindowsByName[o.name].win,n,o.sendMessage),{sendMessage:function(e){if(window&&!window.closed){var n=u.a.popupWindowsByName[o.name];if(n)try{u.a.receiveMessage({data:e,origin:n.domain,source:n.win})}catch(e){t.a.reject(e)}}}}})}(o,n),new t.a(function(e,n){c.onload=e,c.onerror=n}).then(function(){return Object(a.k)(o,i.a.BRIDGE_TIMEOUT,"Bridge "+e)}).then(function(){return o})})}),u.a.bridges[n])}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 T=window.open;function A(e,n){var r=u.a.popupWindowsByWin.get(e);r&&(r.domain=Object(o.getDomainFromUrl)(n),O(e))}function W(){for(var e=0,n=Object.keys(u.a.bridgeFrames),r=null==n?0:n.length;e<r;e++){var t=n[e],o=u.a.bridgeFrames[t];o.parentNode&&o.parentNode.removeChild(o)}u.a.bridgeFrames={},u.a.bridges={}}window.open=function(e,n,r,t){var a=e;if(e&&0===e.indexOf(i.b.MOCK_PROTOCOL)){var c=e.split("|");a=c[0],e=c[1]}a&&(a=Object(o.getDomainFromUrl)(a));var s=T.call(this,e,n,r,t);if(!s)return s;e&&O(s);for(var d=0,f=Object.keys(u.a.popupWindowsByName),w=null==f?0:f.length;d<w;d++){var l=f[d];Object(o.isWindowClosed)(u.a.popupWindowsByName[l].win)&&delete u.a.popupWindowsByName[l]}if(n&&s){var m=u.a.popupWindowsByWin.get(s)||u.a.popupWindowsByName[n]||{};m.name=m.name||n,m.win=m.win||s,m.domain=m.domain||a,u.a.popupWindowsByWin.set(s,m),u.a.popupWindowsByName[n]=m}return s},r.d(n,"openTunnelToOpener",function(){return _}),r.d(n,"needsBridgeForBrowser",function(){return d}),r.d(n,"needsBridgeForWin",function(){return f}),r.d(n,"needsBridgeForDomain",function(){return w}),r.d(n,"needsBridge",function(){return l}),r.d(n,"getBridgeName",function(){return m}),r.d(n,"isBridge",function(){return p}),r.d(n,"documentBodyReady",function(){return h}),r.d(n,"registerRemoteWindow",function(){return O}),r.d(n,"findRemoteWindow",function(){return g}),r.d(n,"registerRemoteSendMessage",function(){return y}),r.d(n,"rejectRemoteSendMessage",function(){return v}),r.d(n,"sendBridgeMessage",function(){return E}),r.d(n,"hasBridge",function(){return S}),r.d(n,"openBridge",function(){return P}),r.d(n,"linkUrl",function(){return A}),r.d(n,"destroyBridges",function(){return W})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(0),o=r(1);function i(e,n){if(!o.a.ALLOW_POSTMESSAGE_POPUP&&!1===Object(t.isSameTopWindow)(e,n))throw new Error("Can not send and receive post messages between two different windows (disabled to emulate IE)")}r.d(n,"emulateIERestrictions",function(){return i})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t={};r.d(t,"cleanUpWindow",function(){return k}),r.d(t,"Promise",function(){return c.a}),r.d(t,"bridge",function(){return G}),r.d(t,"init",function(){return U}),r.d(t,"parent",function(){return x}),r.d(t,"send",function(){return j}),r.d(t,"request",function(){return W}),r.d(t,"sendToParent",function(){return R}),r.d(t,"client",function(){return D}),r.d(t,"on",function(){return L}),r.d(t,"listen",function(){return M}),r.d(t,"once",function(){return C}),r.d(t,"listener",function(){return N}),r.d(t,"CONFIG",function(){return a.a}),r.d(t,"CONSTANTS",function(){return a.b}),r.d(t,"disable",function(){return B});var o=r(4),i=r(0),a=r(1),u=r(3),c=r(2),s={};s[a.b.SEND_STRATEGIES.POST_MESSAGE]=function(e,n,t){try{r(7).emulateIERestrictions(window,e)}catch(e){return}(Array.isArray(t)?t:"string"==typeof t?[t]:[a.b.WILDCARD]).map(function(n){if(0===n.indexOf(a.b.MOCK_PROTOCOL)){if(window.location.protocol===a.b.FILE_PROTOCOL)return a.b.WILDCARD;if(!Object(i.isActuallySameDomain)(e))throw new Error("Attempting to send messsage to mock domain "+n+", but window is actually cross-domain");return Object(i.getActualDomain)(e)}return 0===n.indexOf(a.b.FILE_PROTOCOL)?a.b.WILDCARD:n}).forEach(function(r){return e.postMessage(n,r)})};var d=r(6),f=d.sendBridgeMessage,w=d.needsBridgeForBrowser,l=d.isBridge;s[a.b.SEND_STRATEGIES.BRIDGE]=function(e,n,r){if(w()||l()){if(Object(i.isSameDomain)(e))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==Object(i.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");return f(e,n,r)}},s[a.b.SEND_STRATEGIES.GLOBAL]=function(e,n){if(Object(o.i)()){if(!Object(i.isSameDomain)(e))throw new Error("Post message through global disabled between different domain windows");if(!1!==Object(i.isSameTopWindow)(window,e))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=e[a.b.WINDOW_PROPS.POSTROBOT];if(!r)throw new Error("Can not find postRobot global on foreign window");return r.receiveMessage({source:window,origin:Object(i.getDomain)(),data:n})}};var m=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e};function p(e,n,r){return c.a.try(function(){var t;if(n=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=Object(o.q)(),a=Object(o.c)(),u=Object(i.getDomain)(window);return m({},n,r,{sourceDomain:u,id:n.id||t,windowType:a})}(e,n,{data:Object(o.o)(e,r,n.data),domain:r}),e===window&&!a.a.ALLOW_SAME_ORIGIN)throw new Error("Attemping to send message to self");if(Object(i.isWindowClosed)(e))throw new Error("Window is closed");var u=[],d=Object(o.g)(((t={})[a.b.WINDOW_PROPS.POSTROBOT]=n,t),null,2);return c.a.map(Object.keys(s),function(n){return c.a.try(function(){if(!a.a.ALLOWED_POST_MESSAGE_METHODS[n])throw new Error("Strategy disallowed: "+n);return s[n](e,d,r)}).then(function(){return u.push(n+": success"),!0},function(e){return u.push(n+": "+Object(o.p)(e)+"\n"),!1})}).then(function(e){var r=e.some(Boolean),t=n.type+" "+n.name+" "+(r?"success":"error")+":\n - "+u.join("\n - ")+"\n";if(!r)throw new Error(t)})})}var h=r(5);u.a.responseListeners=u.a.responseListeners||{},u.a.requestListeners=u.a.requestListeners||{},u.a.WINDOW_WILDCARD=u.a.WINDOW_WILDCARD||new function(){},u.a.erroredResponseListeners=u.a.erroredResponseListeners||{};var O,g="__domain_regex__";function y(e){return u.a.responseListeners[e]}function v(e){delete u.a.responseListeners[e]}function E(e){return Boolean(u.a.erroredResponseListeners[e])}function b(e){var n=e.name,r=e.win,t=e.domain;if(r===a.b.WILDCARD&&(r=null),t===a.b.WILDCARD&&(t=null),!n)throw new Error("Name required to get request listener");var o=u.a.requestListeners[n];if(o)for(var c=0,s=[r,u.a.WINDOW_WILDCARD],d=null==s?0:s.length;c<d;c++){var f=s[c],w=f&&o.get(f);if(w){if(t&&"string"==typeof t){if(w[t])return w[t];if(w[g])for(var l=0,m=w[g],p=null==m?0:m.length;l<p;l++){var h=m[l],O=h.regex,y=h.listener;if(Object(i.matchDomain)(O,t))return y}}if(w[a.b.WILDCARD])return w[a.b.WILDCARD]}}}var _=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},S=((O={})[a.b.POST_MESSAGE_TYPE.ACK]=function(e,n,r){if(!E(r.hash)){var t=y(r.hash);if(!t)throw new Error("No handler found for post message ack for message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(t.domain,n))throw new Error("Ack origin "+n+" does not match domain "+t.domain.toString());t.ack=!0}},O[a.b.POST_MESSAGE_TYPE.REQUEST]=function(e,n,r){var t=b({name:r.name,win:e,domain:n});function u(t){return r.fireAndForget||Object(i.isWindowClosed)(e)?c.a.resolve():p(e,_({target:r.originalSource,hash:r.hash,name:r.name},t),n)}return c.a.all([u({type:a.b.POST_MESSAGE_TYPE.ACK}),c.a.try(function(){if(!t)throw new Error("No handler found for post message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(t.domain,n))throw new Error("Request origin "+n+" does not match domain "+t.domain.toString());var o=r.data;return t.handler({source:e,origin:n,data:o})}).then(function(e){return u({type:a.b.POST_MESSAGE_TYPE.RESPONSE,ack:a.b.POST_MESSAGE_ACK.SUCCESS,data:e})},function(e){var n=Object(o.p)(e).replace(/^Error: /,""),r=e.code;return u({type:a.b.POST_MESSAGE_TYPE.RESPONSE,ack:a.b.POST_MESSAGE_ACK.ERROR,error:n,code:r})})]).then(o.j).catch(function(e){if(t&&t.handleError)return t.handleError(e);throw e})},O[a.b.POST_MESSAGE_TYPE.RESPONSE]=function(e,n,r){if(!E(r.hash)){var t=y(r.hash);if(!t)throw new Error("No handler found for post message response for message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(t.domain,n))throw new Error("Response origin "+n+" does not match domain "+Object(i.stringifyDomainPattern)(t.domain));if(v(r.hash),r.ack===a.b.POST_MESSAGE_ACK.ERROR){var o=new Error(r.error);return r.code&&(o.code=r.code),t.respond(o,null)}if(r.ack===a.b.POST_MESSAGE_ACK.SUCCESS){var u=r.data||r.response;return t.respond(null,{source:e,origin:n,data:u})}}},O),P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function T(e){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!e.source)return}catch(e){return}var n=e.source,r=e.origin,t=function(e){var n=void 0;try{n=Object(o.f)(e)}catch(e){return}if(n&&"object"===(void 0===n?"undefined":P(n))&&null!==n&&(n=n[a.b.WINDOW_PROPS.POSTROBOT])&&"object"===(void 0===n?"undefined":P(n))&&null!==n&&n.type&&"string"==typeof n.type&&S[n.type])return n}(e.data);if(t){if(!t.sourceDomain||"string"!=typeof t.sourceDomain)throw new Error("Expected message to have sourceDomain");0!==t.sourceDomain.indexOf(a.b.MOCK_PROTOCOL)&&0!==t.sourceDomain.indexOf(a.b.FILE_PROTOCOL)||(r=t.sourceDomain),-1===u.a.receivedMessages.indexOf(t.id)&&(u.a.receivedMessages.push(t.id),Object(i.isWindowClosed)(n)&&!t.fireAndForget||(t.data&&(t.data=Object(o.b)(n,r,t.data)),S[t.type](n,r,t)))}}function A(e){try{Object(o.j)(e.source)}catch(e){return}var n={source:e.source||e.sourceElement,origin:e.origin||e.originalEvent&&e.originalEvent.origin,data:e.data};try{r(7).emulateIERestrictions(n.source,window)}catch(e){return}T(n)}function W(e){return c.a.try(function(){if(!e.name)throw new Error("Expected options.name");var n=e.name,r=void 0,t=void 0;if("string"==typeof e.window){var s=document.getElementById(e.window);if(!s)throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be a valid element id");if("iframe"!==s.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(!s.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");r=s.contentWindow}else if(e.window instanceof HTMLIFrameElement){if("iframe"!==e.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(e.window&&!e.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");e.window&&e.window.contentWindow&&(r=e.window.contentWindow)}else r=e.window;if(!r)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var d=r;t=e.domain||a.b.WILDCARD;var f=e.name+"_"+Object(o.q)();if(Object(i.isWindowClosed)(d))throw new Error("Target window is closed");var w=!1,l=u.a.requestPromises.get(d);l||(l=[],u.a.requestPromises.set(d,l));var m=c.a.try(function(){if(Object(i.isAncestor)(window,d))return Object(o.k)(d,e.timeout||a.a.CHILD_WINDOW_TIMEOUT)}).then(function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(Object(o.e)(t)&&!e)return Object(o.n)(d)}).then(function(){var r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(Object(o.e)(t)){if(!Object(i.matchDomain)(t,r))throw new Error("Remote window domain "+r+" does not match regex: "+t.toString());t=r}if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("Expected domain to be a string or array");var s=t;return new c.a(function(r,t){var o=void 0;if(e.fireAndForget||function(e,n){u.a.responseListeners[e]=n}(f,o={name:n,window:d,domain:s,respond:function(e,n){e||(w=!0,l.splice(l.indexOf(m,1))),e?t(e):r(n)}}),p(d,{type:a.b.POST_MESSAGE_TYPE.REQUEST,hash:f,name:n,data:e.data,fireAndForget:e.fireAndForget},s).catch(t),e.fireAndForget)return r();var c=a.a.ACK_TIMEOUT,h=e.timeout||a.a.RES_TIMEOUT,O=100;setTimeout(function r(){if(!w){if(Object(i.isWindowClosed)(d))return o.ack?t(new Error("Window closed for "+n+" before response")):t(new Error("Window closed for "+n+" before ack"));if(c=Math.max(c-O,0),-1!==h&&(h=Math.max(h-O,0)),o.ack){if(-1===h)return;O=Math.min(h,2e3)}else{if(0===c)return t(new Error("No ack for postMessage "+n+" in "+Object(i.getDomain)()+" in "+a.a.ACK_TIMEOUT+"ms"));if(0===h)return t(new Error("No response for postMessage "+n+" in "+Object(i.getDomain)()+" in "+(e.timeout||a.a.RES_TIMEOUT)+"ms"))}setTimeout(r,O)}},O)})});return m.catch(function(){!function(e){u.a.erroredResponseListeners[e]=!0}(f),v(f)}),l.push(m),m})}function j(e,n,r,t){return(t=t||{}).window=e,t.name=n,t.data=r,W(t)}function R(e,n,r){var t=Object(i.getAncestor)();return t?j(t,e,n,r):new c.a(function(e,n){return n(new Error("Window does not have a parent"))})}function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.window)throw new Error("Expected options.window");var n=e.window;return{send:function(r,t){return j(n,r,t,e)}}}u.a.receivedMessages=u.a.receivedMessages||[],u.a.receiveMessage=T,u.a.requestPromises=u.a.requestPromises||new h.a,u.a.send=j;var I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function M(e){if(!e.name)throw new Error("Expected options.name");if(!e.handler)throw new Error("Expected options.handler");var n=e.name,r=e.window,t=e.domain,c={handler:e.handler,handleError:e.errorHandler||function(e){throw e},window:r,domain:t||a.b.WILDCARD,name:n},s=function e(n,r){var t=n.name,i=n.win,c=n.domain;if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(i)){for(var s=[],d=0,f=i,w=null==f?0:f.length;d<w;d++){var l=f[d];s.push(e({name:t,domain:c,win:l},r))}return{cancel:function(){for(var e=0,n=null==s?0:s.length;e<n;e++)s[e].cancel()}}}if(Array.isArray(c)){for(var m=[],p=0,O=c,y=null==O?0:O.length;p<y;p++){var v=O[p];m.push(e({name:t,win:i,domain:v},r))}return{cancel:function(){for(var e=0,n=null==m?0:m.length;e<n;e++)m[e].cancel()}}}var E=b({name:t,win:i,domain:c});if(i&&i!==a.b.WILDCARD||(i=u.a.WINDOW_WILDCARD),c=c||a.b.WILDCARD,E)throw i&&c?new Error("Request listener already exists for "+t+" on domain "+c.toString()+" for "+(i===u.a.WINDOW_WILDCARD?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" for "+(i===u.a.WINDOW_WILDCARD?"wildcard":"specified")+" window"):c?new Error("Request listener already exists for "+t+" on domain "+c.toString()):new Error("Request listener already exists for "+t);var _=u.a.requestListeners,S=_[t];S||(S=new h.a,_[t]=S);var P=S.get(i);P||(P={},S.set(i,P));var T=c.toString(),A=P[g],W=void 0;return Object(o.e)(c)?(A||(A=[],P[g]=A),W={regex:c,listener:r},A.push(W)):P[T]=r,{cancel:function(){P&&(delete P[T],i&&0===Object.keys(P).length&&S.delete(i),W&&A.splice(A.indexOf(W,1)))}}}({name:n,win:r,domain:t},c);if(e.once){var d=c.handler;c.handler=Object(o.l)(function(){return s.cancel(),d.apply(this,arguments)})}if(c.window&&e.errorOnClose)var f=Object(o.m)(function(){r&&"object"===(void 0===r?"undefined":I(r))&&Object(i.isWindowClosed)(r)&&(f.cancel(),c.handleError(new Error("Post message target window is closed")))},50);return{cancel:function(){s.cancel()}}}function L(e,n,r){return"function"==typeof n&&(r=n,n={}),(n=n||{}).name=e,n.handler=r||n.handler,M(n)}function C(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];"function"==typeof n&&(r=n,n={}),n=n||{},r=r||n.handler;var t=n.errorHandler,o=new c.a(function(o,i){(n=n||{}).name=e,n.once=!0,n.handler=function(e){if(o(e),r)return r(e)},n.errorHandler=function(e){if(i(e),t)return t(e)}}),i=M(n);return o.cancel=i.cancel,o}function N(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(n,r){return L(n,e,r)}}}function B(){delete window[a.b.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",A)}u.a.on=L;var x=Object(i.getAncestor)();function k(e){var n=u.a.requestPromises.get(e);if(n)for(var r=0,t=null==n?0:n.length;r<t;r++)n[r].reject(new Error("No response from window - cleaned up"));u.a.popupWindowsByWin&&u.a.popupWindowsByWin.delete(e),u.a.remoteWindows&&u.a.remoteWindows.delete(e),u.a.requestPromises.delete(e),u.a.methods.delete(e),u.a.readyPromises.delete(e)}var G=r(11);function U(){u.a.initialized||(Object(o.a)(window,"message",A),r(6).openTunnelToOpener(),Object(o.d)(),Object(o.h)({on:L,send:j})),u.a.initialized=!0}U(),r.d(n,"cleanUpWindow",function(){return k}),r.d(n,"Promise",function(){return c.a}),r.d(n,"bridge",function(){return G}),r.d(n,"init",function(){return U}),r.d(n,"parent",function(){return x}),r.d(n,"send",function(){return j}),r.d(n,"request",function(){return W}),r.d(n,"sendToParent",function(){return R}),r.d(n,"client",function(){return D}),r.d(n,"on",function(){return L}),r.d(n,"listen",function(){return M}),r.d(n,"once",function(){return C}),r.d(n,"listener",function(){return N}),r.d(n,"CONFIG",function(){return a.a}),r.d(n,"CONSTANTS",function(){return a.b}),r.d(n,"disable",function(){return B}),n.default=t},function(e,n,r){"use strict";function t(e){return"[object RegExp]"===Object.prototype.toString.call(e)}n.h=u,n.g=c,n.a=d,n.c=f,n.j=w,n.o=l,n.f=p,n.r=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==i}if(n&&l(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var r=function(e,n){for(var r=0;r<e.length;r++)try{if(e[r]===n)return r}catch(e){}return-1}(y,e);if(-1!==r){var t=v[r];if(t&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var n=e.ownerDocument;return!(!n||!n.body||n.body.contains(e))}(t))return!0}return!1},n.i=function(e){return(e=e||window).navigator.mockUserAgent||e.navigator.userAgent},n.e=function(e,n){for(var r=p(e),t=0,o=null==r?0:r.length;t<o;t++){var i=r[t];try{if(l(i)&&i.name===n&&-1!==r.indexOf(i))return i}catch(e){}}try{if(-1!==r.indexOf(e.frames[n]))return e.frames[n]}catch(e){}try{if(-1!==r.indexOf(e[n]))return e[n]}catch(e){}},n.m=function(e,n){return e===c(n)},n.b=E,n.k=function(e,n){var r=E(n);if(r)return r===e;if(n===e)return!1;if(O(n)===n)return!1;for(var t=0,o=p(e),i=null==o?0:o.length;t<i;t++)if(o[t]===n)return!0;return!1},n.n=function(){return Boolean(c(window))},n.l=function(){return Boolean(u(window))},n.p=function(e,n){var r=O(e)||e,t=O(n)||n;try{if(r&&t)return r===t}catch(e){}var o=g(e),i=g(n);if(b(o,i))return!0;var a=c(r),u=c(t);return!(a&&b(g(a),i)||(u&&b(g(u),o),1))},n.s=function e(n,r){if("string"==typeof n){if("string"==typeof r)return n===o.WILDCARD||r===n;if(t(r))return!1;if(Array.isArray(r))return!1}return t(n)?t(r)?n.toString()===r.toString():!Array.isArray(r)&&Boolean(r.match(n)):!!Array.isArray(n)&&(Array.isArray(r)?JSON.stringify(n)===JSON.stringify(r):!t(r)&&n.some(function(n){return e(n,r)}))},n.t=function(e){return Array.isArray(e)?"("+e.join(" | ")+")":t(e)?"RegExp("+e.toString():e.toString()},n.d=function(e){return e.match(/^(https?|mock|file):\/\//)?e.split("/").slice(0,3).join("/"):f()},n.q=function(e){try{if(e===window)return!0}catch(e){if(e&&e.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(e))return!0}catch(e){if(e&&e.message===i)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===i)return!0}try{e&&e.__cross_domain_utils_window_check__}catch(e){return!0}return!1};var o={MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",ABOUT_PROTOCOL:"about:",WILDCARD:"*"},i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.ABOUT_PROTOCOL}function u(e){if(e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}function c(e){if(e&&!u(e))try{return e.opener}catch(e){}}function s(e){try{return e&&e.location&&e.location.href,!0}catch(e){}return!1}function d(e){var n=(e=e||window).location;if(!n)throw new Error("Can not read window location");var r=n.protocol;if(!r)throw new Error("Can not read window protocol");if(r===o.FILE_PROTOCOL)return o.FILE_PROTOCOL+"//";if(r===o.ABOUT_PROTOCOL){var t=u(e);return t&&s(t)?d(t):o.ABOUT_PROTOCOL+"//"}var i=n.host;if(!i)throw new Error("Can not read window host");return r+"//"+i}function f(e){var n=d(e=e||window);return n&&e.mockDomain&&0===e.mockDomain.indexOf(o.MOCK_PROTOCOL)?e.mockDomain:n}function w(e){try{if(e===window)return!0}catch(e){}try{var n=Object.getOwnPropertyDescriptor(e,"location");if(n&&!1===n.enumerable)return!1}catch(e){}try{if(a(e)&&s(e))return!0}catch(e){}try{if(d(e)===d(window))return!0}catch(e){}return!1}function l(e){if(!w(e))return!1;try{if(e===window)return!0;if(a(e)&&s(e))return!0;if(f(window)===f(e))return!0}catch(e){}return!1}function m(e,n){if(!e||!n)return!1;var r=u(n);return r?r===e:-1!==function(e){var n=[];try{for(;e.parent!==e;)n.push(e.parent),e=e.parent}catch(e){}return n}(n).indexOf(e)}function p(e){var n=[],r=void 0;try{r=e.frames}catch(n){r=e}var t=void 0;try{t=r.length}catch(e){}if(0===t)return n;if(t){for(var o=0;o<t;o++){var i=void 0;try{i=r[o]}catch(e){continue}n.push(i)}return n}for(var a=0;a<100;a++){var u=void 0;try{u=r[a]}catch(e){return n}if(!u)return n;n.push(u)}return n}function h(e){for(var n=[],r=0,t=p(e),o=null==t?0:t.length;r<o;r++){var i=t[r];n.push(i);for(var a=0,u=h(i),c=null==u?0:u.length;a<c;a++){var s=u[a];n.push(s)}}return n}function O(e){if(e){try{if(e.top)return e.top}catch(e){}if(u(e)===e)return e;try{if(m(window,e)&&window.top)return window.top}catch(e){}try{if(m(e,window)&&window.top)return window.top}catch(e){}for(var n=0,r=h(e),t=null==r?0:r.length;n<t;n++){var o=r[n];try{if(o.top)return o.top}catch(e){}if(u(o)===o)return o}}}function g(e){var n=O(e);if(!n)throw new Error("Can not determine top window");return[].concat(h(n),[n])}var y=[],v=[];function E(e){return c(e=e||window)||u(e)||void 0}function b(e,n){for(var r=0,t=null==e?0:e.length;r<t;r++)for(var o=e[r],i=0,a=null==n?0:n.length;i<a;i++)if(o===n[i])return!0;return!1}},function(e,n){},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(6);r.d(n,"openBridge",function(){return t.openBridge}),r.d(n,"linkUrl",function(){return t.linkUrl}),r.d(n,"isBridge",function(){return t.isBridge}),r.d(n,"needsBridge",function(){return t.needsBridge}),r.d(n,"needsBridgeForBrowser",function(){return t.needsBridgeForBrowser}),r.d(n,"hasBridge",function(){return t.hasBridge}),r.d(n,"needsBridgeForWin",function(){return t.needsBridgeForWin}),r.d(n,"needsBridgeForDomain",function(){return t.needsBridgeForDomain}),r.d(n,"openTunnelToOpener",function(){return t.openTunnelToOpener}),r.d(n,"destroyBridges",function(){return t.destroyBridges})}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("postRobot",[],n):"object"==typeof exports?exports.postRobot=n():e.postRobot=n()}("undefined"!=typeof self?self:this,function(){return function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="",r(r.s=13)}([function(e,n,r){"use strict";var t=r(14);r.d(n,"getActualDomain",function(){return t.a}),r.d(n,"getAncestor",function(){return t.b}),r.d(n,"getDomain",function(){return t.c}),r.d(n,"getDomainFromUrl",function(){return t.d}),r.d(n,"getFrameByName",function(){return t.e}),r.d(n,"getFrames",function(){return t.f}),r.d(n,"getOpener",function(){return t.g}),r.d(n,"getParent",function(){return t.h}),r.d(n,"getUserAgent",function(){return t.i}),r.d(n,"isActuallySameDomain",function(){return t.j}),r.d(n,"isAncestor",function(){return t.k}),r.d(n,"isIframe",function(){return t.l}),r.d(n,"isOpener",function(){return t.m}),r.d(n,"isPopup",function(){return t.n}),r.d(n,"isSameDomain",function(){return t.o}),r.d(n,"isSameTopWindow",function(){return t.p}),r.d(n,"isWindow",function(){return t.q}),r.d(n,"isWindowClosed",function(){return t.r}),r.d(n,"linkFrameWindow",function(){return t.s}),r.d(n,"matchDomain",function(){return t.t}),r.d(n,"stringifyDomainPattern",function(){return t.u});var o=r(15);r.n(o)},function(e,n,r){"use strict";var t,o={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",HELLO:"postrobot_ready",OPEN_TUNNEL:"postrobot_open_tunnel"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method",ERROR:"postrobot_error",PROMISE:"postrobot_promise",ZALGO_PROMISE:"postrobot_zalgo_promise",REGEX:"regex"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",BRIDGE:"postrobot_bridge",GLOBAL:"postrobot_global"},MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",BRIDGE_NAME_PREFIX:"__postrobot_bridge__",POSTROBOT_PROXY:"__postrobot_proxy__",WILDCARD:"*"},i={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},a=Object.keys(i).map(function(e){return i[e]}),u={ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:-1!==window.navigator.userAgent.match(/MSIE/i)?2e3:1e3,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(t={},t[o.SEND_STRATEGIES.POST_MESSAGE]=!0,t[o.SEND_STRATEGIES.BRIDGE]=!0,t[o.SEND_STRATEGIES.GLOBAL]=!0,t),ALLOW_SAME_ORIGIN:!1};0===window.location.href.indexOf(o.FILE_PROTOCOL)&&(u.ALLOW_POSTMESSAGE_POPUP=!0),r.d(n,"a",function(){return u}),r.d(n,"b",function(){return o}),r.d(n,!1,function(){return i}),r.d(n,!1,function(){return a})},function(e,n,r){"use strict";function t(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var r=n.call(e);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}function o(){var e=void 0;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");e=window}var n=e.__zalgopromise__=e.__zalgopromise__||{};return n.flushPromises=n.flushPromises||[],n.activeCount=n.activeCount||0,n.possiblyUnhandledPromiseHandlers=n.possiblyUnhandledPromiseHandlers||[],n.dispatchedErrors=n.dispatchedErrors||[],n}var i=function(){function e(n){var r=this;if(function(n,r){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],n){var t=void 0,o=void 0,i=!1,a=!1,u=!1;try{n(function(e){u?r.resolve(e):(i=!0,t=e)},function(e){u?r.reject(e):(a=!0,o=e)})}catch(e){return void this.reject(e)}u=!0,i?this.resolve(t):a&&this.reject(o)}}return e.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(t(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},e.prototype.reject=function(e){var n=this;if(this.resolved||this.rejected)return this;if(t(e))throw new Error("Can not reject promise with another promise");if(!e){var r=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e);e=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){n.errorHandled||function(e,n){if(-1===o().dispatchedErrors.indexOf(e)){o().dispatchedErrors.push(e),setTimeout(function(){throw e},1);for(var r=0;r<o().possiblyUnhandledPromiseHandlers.length;r++)o().possiblyUnhandledPromiseHandlers[r](e,n)}}(e,n)},1),this.dispatch(),this},e.prototype.asyncReject=function(e){this.errorHandled=!0,this.reject(e)},e.prototype.dispatch=function(){var n=this,r=this.dispatching,i=this.resolved,a=this.rejected,u=this.handlers;if(!r&&(i||a)){this.dispatching=!0,o().activeCount+=1;for(var c=function(r){var o=u[r],c=o.onSuccess,s=o.onError,d=o.promise,f=void 0;if(i)try{f=c?c(n.value):n.value}catch(e){return d.reject(e),"continue"}else if(a){if(!s)return d.reject(n.error),"continue";try{f=s(n.error)}catch(e){return d.reject(e),"continue"}}f instanceof e&&(f.resolved||f.rejected)?(f.resolved?d.resolve(f.value):d.reject(f.error),f.errorHandled=!0):t(f)?f instanceof e&&(f.resolved||f.rejected)?f.resolved?d.resolve(f.value):d.reject(f.error):f.then(function(e){d.resolve(e)},function(e){d.reject(e)}):d.resolve(f)},s=0;s<u.length;s++)c(s);u.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&e.flushQueue()}},e.prototype.then=function(n,r){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var t=new e;return this.handlers.push({promise:t,onSuccess:n,onError:r}),this.errorHandled=!0,this.dispatch(),t},e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.finally=function(n){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(n).then(function(){return r})},function(r){return e.try(n).then(function(){throw r})})},e.prototype.timeout=function(e,n){var r=this;if(this.resolved||this.rejected)return this;var t=setTimeout(function(){r.resolved||r.rejected||r.reject(n||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(e){return clearTimeout(t),e})},e.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(n){return n instanceof e?n:t(n)?new e(function(e,r){return n.then(e,r)}):(new e).resolve(n)},e.reject=function(n){return(new e).reject(n)},e.all=function(n){var r=new e,o=n.length,i=[];if(!o)return r.resolve(i),r;for(var a=function(a){var u=n[a];if(u instanceof e){if(u.resolved)return i[a]=u.value,o-=1,"continue"}else if(!t(u))return i[a]=u,o-=1,"continue";e.resolve(u).then(function(e){i[a]=e,0==(o-=1)&&r.resolve(i)},function(e){r.reject(e)})},u=0;u<n.length;u++)a(u);return 0===o&&r.resolve(i),r},e.hash=function(n){var r={};return e.all(Object.keys(n).map(function(t){return e.resolve(n[t]).then(function(e){r[t]=e})})).then(function(){return r})},e.map=function(n,r){return e.all(n.map(r))},e.onPossiblyUnhandledException=function(e){return function(e){return o().possiblyUnhandledPromiseHandlers.push(e),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(e),1)}}}(e)},e.try=function(n,r,t){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=n.apply(r,t||[])}catch(n){return e.reject(n)}return e.resolve(o)},e.delay=function(n){return new e(function(e){setTimeout(e,n)})},e.isPromise=function(n){return!!(n&&n instanceof e)||t(n)},e.flush=function(){var n=new e;return o().flushPromises.push(n),0===o().activeCount&&e.flushQueue(),n},e.flushQueue=function(){var e=o().flushPromises;o().flushPromises=[];for(var n=0,r=null==e?0:e.length;n<r;n++)e[n].resolve()},e}();r.d(n,"a",function(){return i})},function(e,n,r){"use strict";r.d(n,"a",function(){return o});var t=r(1),o=window[t.b.WINDOW_PROPS.POSTROBOT]=window[t.b.WINDOW_PROPS.POSTROBOT]||{};o.registerSelf=function(){}},function(e,n,r){"use strict";r(10);var t=r(8);r.d(n,"addEventListener",function(){return t.a}),r(16),r(17),r(18),r(11);var o=r(6);r.d(n,"isRegex",function(){return o.f}),r.d(n,"noop",function(){return o.h}),r.d(n,"once",function(){return o.i}),r.d(n,"replaceObject",function(){return o.m}),r.d(n,"safeInterval",function(){return o.n}),r.d(n,"stringifyError",function(){return o.p}),r.d(n,"uniqueID",function(){return o.r}),r.d(n,"weakMapMemoize",function(){return o.s}),r(19);var i=r(20);r.n(i),r(21),r(22)},function(e,n,r){"use strict";r.d({},"WeakMap",function(){return u});var t=r(0);function o(e,n){for(var r=0;r<e.length;r++)try{if(e[r]===n)return r}catch(e){}return-1}var i=Object.defineProperty,a=Date.now()%1e9,u=function(){function e(){if(function(n,r){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this),a+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+a,function(){if(!window.WeakMap)return!1;if(!window.Object.freeze)return!1;try{var e=new window.WeakMap,n={};return window.Object.freeze(n),e.set(n,"__testvalue__"),"__testvalue__"===e.get(n)}catch(e){return!1}}())try{this.weakmap=new window.WeakMap}catch(e){}this.keys=[],this.values=[]}return e.prototype._cleanupClosedWindows=function(){for(var e=this.weakmap,n=this.keys,r=0;r<n.length;r++){var o=n[r];if(Object(t.isWindow)(o)&&Object(t.isWindowClosed)(o)){if(e)try{e.delete(o)}catch(e){}n.splice(r,1),this.values.splice(r,1),r-=1}}},e.prototype.isSafeToReadWrite=function(e){if(Object(t.isWindow)(e))return!1;try{e&&e.self,e&&e[this.name]}catch(e){return!1}return!0},e.prototype.set=function(e,n){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(e,n)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var t=this.name,a=e[t];a&&a[0]===e?a[1]=n:i(e,t,{value:[e,n],writable:!0})}else{this._cleanupClosedWindows();var u=this.keys,c=this.values,s=o(u,e);-1===s?(u.push(e),c.push(n)):c[s]=n}},e.prototype.get=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{if(n.has(e))return n.get(e)}catch(e){delete this.weakmap}if(!this.isSafeToReadWrite(e)){this._cleanupClosedWindows();var r=o(this.keys,e);if(-1===r)return;return this.values[r]}var t=e[this.name];if(t&&t[0]===e)return t[1]},e.prototype.delete=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var r=e[this.name];r&&r[0]===e&&(r[0]=r[1]=void 0)}else{this._cleanupClosedWindows();var t=this.keys,i=o(t,e);-1!==i&&(t.splice(i,1),this.values.splice(i,1))}},e.prototype.has=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{return n.has(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var r=e[this.name];return!(!r||r[0]!==e)}return this._cleanupClosedWindows(),-1!==o(this.keys,e)},e.prototype.getOrSet=function(e,n){if(this.has(e))return this.get(e);var r=n();return this.set(e,r),r},e}();r.d(n,"a",function(){return u})},function(e,n,r){"use strict";n.r=u,n.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")},n.g=function(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=new o.a;function i(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];var u=t.getOrSet(r.thisNamespace?this:e,function(){return{}}),c=s(o),d=r.time;if(u[c]&&d&&Date.now()-u[c].time<d&&delete u[c],u[c])return u[c].value;i.__calling__=!0;var f=Date.now(),l=e.apply(this,arguments);return i.__calling__=!1,u[c]={time:f,value:l},u[c].value}return i.reset=function(){t.delete(r.thisNamespace?n:e)},r.name&&(i.displayName=r.name+":memoized"),i},n.j=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function r(){return t.a.try(e,this,arguments)}return n.name&&(r.displayName=n.name+":promisified"),r},n.e=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],t=e.__inline_memoize_cache__=e.__inline_memoize_cache__||{},o=s(r);return t.hasOwnProperty(o)?t[o]:t[o]=n.apply(void 0,r)},n.h=function(){},n.i=function(e){var n=!1;return function(){if(!n)return n=!0,e.apply(this,arguments)}},n.p=function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(r>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+Object.prototype.toString.call(n)+">";if("string"==typeof n)return n;if(n instanceof Error){var t=n&&n.stack,o=n&&n.message;if(t&&o)return-1!==t.indexOf(o)?t:o+"\n"+t;if(t)return t;if(o)return o}return"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n)}catch(n){return"Error while stringifying error: "+e(n,r+1)}},n.o=function(e){return"string"==typeof e?e:e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)},n.c=function(e,n){if(!n)return e;if(Object.assign)return Object.assign(e,n);for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e},n.k=function(e,n,r){var t=[];return e.replace(n,function(e){t.push(r?r.apply(null,arguments):e)}),t},n.q=function(e){return"data:image/svg+xml;base64,"+a(e)},n.l=function(e,n){var r=[];return e.replace(n,function(e){return r.push(e),""}),r},n.n=function(e,n){var r=void 0;return function t(){r=setTimeout(function(){e(),t()},n)}(),{cancel:function(){clearTimeout(r)}}},n.a=function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},n.m=function e(n,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(Array.isArray(n)){for(var o=n.length,i=[],a=function(o){d(i,o,function(){var i=t?t+"."+o:""+o,a=n[o],u=r(a,o,i);return(l(u)||Array.isArray(u))&&(u=e(u,r,i)),u})},u=0;u<o;u++)a(u);return i}if(l(n)){var c={},s=function(o){if(!n.hasOwnProperty(o))return"continue";d(c,o,function(){var i=t?t+"."+o:""+o,a=n[o],u=r(a,o,i);return(l(u)||Array.isArray(u))&&(u=e(u,r,i)),u})};for(var f in n)s(f);return c}throw new Error("Pass an object or array")},n.b=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,r=void 0;return function(){var t=this,o=arguments;clearTimeout(r),r=setTimeout(function(){return e.apply(t,o)},n)}},n.f=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},r.d(n,"s",function(){return w});var t=r(2),o=r(5),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function a(e){return window.btoa(e)}function u(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+a((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var c=void 0;function s(e){try{return JSON.stringify(Array.prototype.slice.call(e),function(e,n){return"function"==typeof n?"memoize["+function(e){if(c=c||new o.a,null===e||void 0===e||"object"!==(void 0===e?"undefined":i(e))&&"function"!=typeof e)throw new Error("Invalid object");var n=c.get(e);return n||(n=(void 0===e?"undefined":i(e))+":"+u(),c.set(e,n)),n}(n)+"]":n})}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}}function d(e,n,r){if(Array.isArray(e)){if("number"!=typeof n)throw new TypeError("Array key must be number")}else if("object"===(void 0===e?"undefined":i(e))&&null!==e&&"string"!=typeof n)throw new TypeError("Object key must be string");Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){delete e[n];var t=r();return e[n]=t,t},set:function(r){delete e[n],e[n]=r}})}function f(e){return"object"===(void 0===(n=e)?"undefined":i(n))&&null!==n&&"[object Object]"===Object.prototype.toString.call(e);var n}function l(e){if(!f(e))return!1;var n=e.constructor;if("function"!=typeof n)return!1;var r=n.prototype;return!!f(r)&&!!r.hasOwnProperty("isPrototypeOf")}var w=function(e){var n=new o.a;return function(r){var t=n.get(r);return void 0!==t?t:(void 0!==(t=e.call(this,r))&&n.set(r,t),t)}}},function(e,n,r){"use strict";var t=r(0),o=r(1);function i(){return Object(t.isPopup)()?o.b.WINDOW_TYPES.POPUP:Object(t.isIframe)()?o.b.WINDOW_TYPES.IFRAME:o.b.WINDOW_TYPES.FULLPAGE}function a(){return!!Object(t.getUserAgent)(window).match(/MSIE|trident|edge\/12|edge\/13/i)||!o.a.ALLOW_POSTMESSAGE_POPUP}var u=r(5),c=r(2),s=r(4),d=r(3),f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};d.a.methods=d.a.methods||new u.a;var l=Object(s.once)(function(){d.a.on(o.b.POST_MESSAGE_NAMES.METHOD,{origin:o.b.WILDCARD},function(e){var n=e.source,r=e.origin,o=e.data,i=d.a.methods.get(n);if(!i)throw new Error("Could not find any methods this window has privileges to call");var a=i[o.id];if(!a)throw new Error("Could not find method with id: "+o.id);if(!Object(t.matchDomain)(a.domain,r))throw new Error("Method domain "+a.domain+" does not match origin "+r);return c.a.try(function(){return a.method.apply({source:n,origin:r,data:o},o.args)}).then(function(e){return{result:e,id:o.id,name:o.name}})})});function w(e,n){return"object"===(void 0===e?"undefined":f(e))&&null!==e&&e.__type__===n}function p(e,n,r,t){var i=Object(s.uniqueID)(),a=d.a.methods.get(e);return a||(a={},d.a.methods.set(e,a)),a[i]={domain:n,method:r},{__type__:o.b.SERIALIZATION_TYPES.METHOD,__id__:i,__name__:t}}function h(e,n,r){return Object(s.replaceObject)({obj:r},function(r,t){return"function"==typeof r?p(e,n,r,t.toString()):r instanceof Error?(i=r,{__type__:o.b.SERIALIZATION_TYPES.ERROR,__message__:Object(s.stringifyError)(i),__code__:i.code}):window.Promise&&r instanceof window.Promise?function(e,n,r,t){return{__type__:o.b.SERIALIZATION_TYPES.PROMISE,__then__:p(e,n,function(e,n){return r.then(e,n)},t+".then")}}(e,n,r,t.toString()):c.a.isPromise(r)?function(e,n,r,t){return{__type__:o.b.SERIALIZATION_TYPES.ZALGO_PROMISE,__then__:p(e,n,function(e,n){return r.then(e,n)},t+".then")}}(e,n,r,t.toString()):Object(s.isRegex)(r)?(a=r,{__type__:o.b.SERIALIZATION_TYPES.REGEX,__source__:a.source}):r;var i,a}).obj}function m(e,n,r){function t(){var t=Array.prototype.slice.call(arguments);return d.a.send(e,o.b.POST_MESSAGE_NAMES.METHOD,{id:r.__id__,name:r.__name__,args:t},{domain:n,timeout:-1}).then(function(e){return e.data.result},function(e){throw e})}return t.__name__=r.__name__,t.__xdomain__=!0,t.source=e,t.origin=n,t}function g(e,n,r){var t=new Error(r.__message__);return r.__code__&&(t.code=r.__code__),t}function O(e,n,r){return new c.a(function(t,o){return m(e,n,r.__then__)(t,o)})}function v(e,n,r){return window.Promise?new window.Promise(function(t,o){return m(e,n,r.__then__)(t,o)}):O(e,n,r)}function y(e,n,r){return new RegExp(r.__source__)}function b(e,n,r){return Object(s.replaceObject)({obj:r},function(r){return"object"!==(void 0===r?"undefined":f(r))||null===r?r:w(r,o.b.SERIALIZATION_TYPES.METHOD)?m(e,n,r):w(r,o.b.SERIALIZATION_TYPES.ERROR)?g(0,0,r):w(r,o.b.SERIALIZATION_TYPES.PROMISE)?v(e,n,r):w(r,o.b.SERIALIZATION_TYPES.ZALGO_PROMISE)?O(e,n,r):w(r,o.b.SERIALIZATION_TYPES.REGEX)?y(0,0,r):r}).obj}function _(e){d.a.on(o.b.POST_MESSAGE_NAMES.HELLO,{domain:o.b.WILDCARD},function(n){var r=n.source,t=n.origin;return e({source:r,origin:t})})}function E(e){return d.a.send(e,o.b.POST_MESSAGE_NAMES.HELLO,{},{domain:o.b.WILDCARD,timeout:-1}).then(function(e){return{origin:e.origin}})}function S(){_(function(e){var n=e.source,r=e.origin,t=d.a.readyPromises.get(n)||new c.a;t.resolve({origin:r}),d.a.readyPromises.set(n,t)});var e=Object(t.getAncestor)();e&&E(e).catch(s.noop)}function P(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",t=d.a.readyPromises.get(e);return t||(t=new c.a,d.a.readyPromises.set(e,t),-1!==n&&setTimeout(function(){return t.reject(new Error(r+" did not load after "+n+"ms"))},n),t)}d.a.readyPromises=d.a.readyPromises||new u.a,r.d(n,"b",function(){return i}),r.d(n,"e",function(){return a}),r.d(n,"d",function(){return l}),r.d(n,!1,function(){return p}),r.d(n,"h",function(){return h}),r.d(n,!1,function(){return m}),r.d(n,!1,function(){return g}),r.d(n,!1,function(){return O}),r.d(n,!1,function(){return v}),r.d(n,!1,function(){return y}),r.d(n,"a",function(){return b}),r.d(n,!1,function(){return _}),r.d(n,"g",function(){return E}),r.d(n,"c",function(){return S}),r.d(n,"f",function(){return P})},function(e,n,r){"use strict";r(2),r(0),r(5);var t=r(6);r(10),n.d=function e(){return Object(t.e)(e,function(){try{if("undefined"==typeof window)return!1;if(window.localStorage){var e=Math.random().toString();window.localStorage.setItem("__test__localStorage__",e);var n=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),e===n)return!0}}catch(e){}return!1})},n.b=function(e,n){e.appendChild(n)},n.g=function(e,n){try{e.document.open(),e.document.write(n),e.document.close()}catch(r){try{e.location="javascript: document.open(); document.write("+JSON.stringify(n)+"); document.close();"}catch(e){}}},n.f=function(e,n){var r=n.tagName.toLowerCase();if("html"!==r)throw new Error("Expected element to be html, got "+r);for(var t=e.document.documentElement;t.children&&t.children.length;)t.removeChild(t.children[0]);for(;n.children.length;)t.appendChild(n.children[0])},n.e=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.document;e.styleSheet?e.styleSheet.cssText=n:e.appendChild(r.createTextNode(n))},n.a=function(e,n,r){return e.addEventListener(n,r),{cancel:function(){e.removeEventListener(n,r)}}},n.c=function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document,r=0,t=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document;return Array.prototype.slice.call(n.querySelectorAll(e))}("script",e),o=null==t?0:t.length;r<o;r++){var i=t[r],a=i.parentNode;if(a){var u=n.createElement("script");u.text=i.textContent,a.replaceChild(u,i)}}},"function"==typeof Symbol&&Symbol.iterator,Object.assign,Object.create(Error.prototype)},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(2),o=r(0),i=r(4),a=r(1),u=r(3);function c(e){try{u.a.tunnelWindows[e]&&delete u.a.tunnelWindows[e].source}catch(e){}delete u.a.tunnelWindows[e]}u.a.tunnelWindows=u.a.tunnelWindows||{},u.a.tunnelWindowId=0,u.a.openTunnelToParent=function(e){var n=e.name,r=e.source,t=e.canary,s=e.sendMessage,d=Object(o.getParent)(window);if(!d)throw new Error("No parent window found to open tunnel to");var f=function(e){var n=e.name,r=e.source,t=e.canary,a=e.sendMessage;return function(){for(var e=u.a.tunnelWindows,n=0,r=Object.keys(e),t=null==r?0:r.length;n<t;n++){var a=r[n],s=e[a];try{Object(i.noop)(s.source)}catch(e){c(a);continue}Object(o.isWindowClosed)(s.source)&&c(a)}}(),u.a.tunnelWindowId+=1,u.a.tunnelWindows[u.a.tunnelWindowId]={name:n,source:r,canary:t,sendMessage:a},u.a.tunnelWindowId}({name:n,source:r,canary:t,sendMessage:s});return u.a.send(d,a.b.POST_MESSAGE_NAMES.OPEN_TUNNEL,{name:n,sendMessage:function(){var e=function(e){return u.a.tunnelWindows[e]}(f);try{Object(i.noop)(e&&e.source)}catch(e){return void c(f)}if(e&&e.source&&!Object(o.isWindowClosed)(e.source)){try{e.canary()}catch(e){return}e.sendMessage.apply(this,arguments)}}},{domain:a.b.WILDCARD})};var s=r(5);function d(){return!!Object(o.getUserAgent)(window).match(/MSIE|trident|edge\/12|edge\/13/i)||!a.a.ALLOW_POSTMESSAGE_POPUP}function f(e){return!Object(o.isSameTopWindow)(window,e)}function l(e,n){if(e){if(Object(o.getDomain)()!==Object(o.getDomainFromUrl)(e))return!0}else if(n&&!Object(o.isSameDomain)(n))return!0;return!1}function w(e){var n=e.win,r=e.domain;return!(!d()||r&&!l(r,n)||n&&!f(n))}function p(e){var n=(e=e||Object(o.getDomainFromUrl)(e)).replace(/[^a-zA-Z0-9]+/g,"_");return a.b.BRIDGE_NAME_PREFIX+"_"+n}function h(){return Boolean(window.name&&window.name===p(Object(o.getDomain)()))}var m=new t.a(function(e){if(window.document&&window.document.body)return e(window.document.body);var n=setInterval(function(){if(window.document&&window.document.body)return clearInterval(n),e(window.document.body)},10)});function g(e){u.a.remoteWindows.set(e,{sendMessagePromise:new t.a})}function O(e){return u.a.remoteWindows.get(e)}function v(e,n,r){var i=O(e);if(!i)throw new Error("Window not found to register sendMessage to");var a=function(t,i,a){if(t!==e)throw new Error("Remote window does not match window");if(!Object(o.matchDomain)(a,n))throw new Error("Remote domain "+a+" does not match domain "+n);r(i)};i.sendMessagePromise.resolve(a),i.sendMessagePromise=t.a.resolve(a)}function y(e,n){var r=O(e);if(!r)throw new Error("Window not found on which to reject sendMessage");r.sendMessagePromise.asyncReject(n)}function b(e,n,r){var t=Object(o.isOpener)(window,e),i=Object(o.isOpener)(e,window);if(!t&&!i)throw new Error("Can only send messages to and from parent and popup windows");var a=O(e);if(!a)throw new Error("Window not found to send message to");return a.sendMessagePromise.then(function(t){return t(e,n,r)})}u.a.remoteWindows=u.a.remoteWindows||new s.a;var _=Object(i.weakMapMemoize)(function(e){return t.a.try(function(){for(var n=0,r=Object(o.getFrames)(e),i=null==r?0:r.length;n<i;n++){var u=r[n];try{if(u&&u!==window&&Object(o.isSameDomain)(u)&&u[a.b.WINDOW_PROPS.POSTROBOT])return u}catch(e){continue}}try{var c=Object(o.getFrameByName)(e,p(Object(o.getDomain)()));if(!c)return;return Object(o.isSameDomain)(c)&&c[a.b.WINDOW_PROPS.POSTROBOT]?c:new t.a(function(e){var n=void 0,r=void 0;n=setInterval(function(){if(c&&Object(o.isSameDomain)(c)&&c[a.b.WINDOW_PROPS.POSTROBOT])return clearInterval(n),clearTimeout(r),e(c)},100),r=setTimeout(function(){return clearInterval(n),e()},2e3)})}catch(e){}})});function E(){return t.a.try(function(){var e=Object(o.getOpener)(window);if(e&&w({win:e}))return g(e),_(e).then(function(n){return n?window.name?n[a.b.WINDOW_PROPS.POSTROBOT].openTunnelToParent({name:window.name,source:window,canary:function(){},sendMessage:function(e){try{Object(i.noop)(window)}catch(e){return}if(window&&!window.closed)try{u.a.receiveMessage({data:e,origin:this.origin,source:this.source})}catch(e){t.a.reject(e)}}}).then(function(n){var r=n.source,t=n.origin,o=n.data;if(r!==e)throw new Error("Source does not match opener");v(r,t,o.sendMessage)}).catch(function(n){throw y(e,n),n}):y(e,new Error("Can not register with opener: window does not have a name")):y(e,new Error("Can not register with opener: no bridge found in opener"))})})}var S=r(7);function P(e,n){return n=n||Object(o.getDomainFromUrl)(e),Boolean(u.a.bridges[n])}function T(e,n){return n=n||Object(o.getDomainFromUrl)(e),u.a.bridges[n]?u.a.bridges[n]:(u.a.bridges[n]=t.a.try(function(){if(Object(o.getDomain)()===n)throw new Error("Can not open bridge on the same domain as current domain: "+n);var r=p(n);if(Object(o.getFrameByName)(window,r))throw new Error("Frame with name "+r+" already exists on page");var i=function(e,n){var r=document.createElement("iframe");return r.setAttribute("name",e),r.setAttribute("id",e),r.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),r.setAttribute("frameborder","0"),r.setAttribute("border","0"),r.setAttribute("scrolling","no"),r.setAttribute("allowTransparency","true"),r.setAttribute("tabindex","-1"),r.setAttribute("hidden","true"),r.setAttribute("title",""),r.setAttribute("role","presentation"),r.src=n,r}(r,e);return u.a.bridgeFrames[n]=i,m.then(function(r){r.appendChild(i);var o=i.contentWindow;return function(e,n){u.a.on(a.b.POST_MESSAGE_NAMES.OPEN_TUNNEL,{window:e,domain:n},function(e){var r=e.origin,o=e.data;if(r!==n)throw new Error("Domain "+n+" does not match origin "+r);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!==r)throw new Error("Message origin "+r+" does not matched registered window origin "+u.a.popupWindowsByName[o.name].domain);return v(u.a.popupWindowsByName[o.name].win,n,o.sendMessage),{sendMessage:function(e){if(window&&!window.closed){var n=u.a.popupWindowsByName[o.name];if(n)try{u.a.receiveMessage({data:e,origin:n.domain,source:n.win})}catch(e){t.a.reject(e)}}}}})}(o,n),new t.a(function(e,n){i.onload=e,i.onerror=n}).then(function(){return Object(S.f)(o,a.a.BRIDGE_TIMEOUT,"Bridge "+e)}).then(function(){return o})})}),u.a.bridges[n])}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 j=window.open;function A(e,n){var r=u.a.popupWindowsByWin.get(e);r&&(r.domain=Object(o.getDomainFromUrl)(n),g(e))}function W(){for(var e=0,n=Object.keys(u.a.bridgeFrames),r=null==n?0:n.length;e<r;e++){var t=n[e],o=u.a.bridgeFrames[t];o.parentNode&&o.parentNode.removeChild(o)}u.a.bridgeFrames={},u.a.bridges={}}window.open=function(e,n,r,t){var i=e;if(e&&0===e.indexOf(a.b.MOCK_PROTOCOL)){var c=e.split("|");i=c[0],e=c[1]}i&&(i=Object(o.getDomainFromUrl)(i));var s=j.call(this,e,n,r,t);if(!s)return s;e&&g(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(n&&s){var p=u.a.popupWindowsByWin.get(s)||u.a.popupWindowsByName[n]||{};p.name=p.name||n,p.win=p.win||s,p.domain=p.domain||i,u.a.popupWindowsByWin.set(s,p),u.a.popupWindowsByName[n]=p}return s},r.d(n,"openTunnelToOpener",function(){return E}),r.d(n,"needsBridgeForBrowser",function(){return d}),r.d(n,"needsBridgeForWin",function(){return f}),r.d(n,"needsBridgeForDomain",function(){return l}),r.d(n,"needsBridge",function(){return w}),r.d(n,"getBridgeName",function(){return p}),r.d(n,"isBridge",function(){return h}),r.d(n,"documentBodyReady",function(){return m}),r.d(n,"registerRemoteWindow",function(){return g}),r.d(n,"findRemoteWindow",function(){return O}),r.d(n,"registerRemoteSendMessage",function(){return v}),r.d(n,"rejectRemoteSendMessage",function(){return y}),r.d(n,"sendBridgeMessage",function(){return b}),r.d(n,"hasBridge",function(){return P}),r.d(n,"openBridge",function(){return T}),r.d(n,"linkUrl",function(){return A}),r.d(n,"destroyBridges",function(){return W})},function(e,n,r){"use strict";n.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(e,n,r){"use strict";n.a=function e(n){var r=n.name,i=n.version,a=void 0===i?"latest":i,u=n.lifetime,c=void 0===u?3e5:u;return Object(t.e)(e,function(){var e="__"+r+"_"+a+"_storage__",n=void 0;function i(r){var i=Object(o.d)(),a=void 0;if(n&&(a=n),!a&&i){var u=window.localStorage.getItem(e);u&&(a=JSON.parse(u))}a||(a=Object(t.d)()[e]),a||(a={id:Object(t.r)()}),a.id||(a.id=Object(t.r)()),n=a;var c=r(a);return i?window.localStorage.setItem(e,JSON.stringify(a)):Object(t.d)()[e]=a,n=null,c}function u(e){return i(function(n){var r=n.__session__,o=Date.now();return r&&o-r.created>c&&(r=null),r||(r={guid:Object(t.r)(),created:o}),n.__session__=r,e(r)})}return{getState:i,getID:function(){return i(function(e){return e.id})},getSessionState:function(e){return u(function(n){return n.state=n.state||{},e(n.state)})},getSessionID:function(){return u(function(e){return e.guid})}}},[{name:r,version:a,lifetime:c}])};var t=r(6),o=r(8)},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(0),o=r(1);function i(e,n){if(!o.a.ALLOW_POSTMESSAGE_POPUP&&!1===Object(t.isSameTopWindow)(e,n))throw new Error("Can not send and receive post messages between two different windows (disabled to emulate IE)")}r.d(n,"emulateIERestrictions",function(){return i})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t={};r.d(t,"cleanUpWindow",function(){return G}),r.d(t,"Promise",function(){return s.a}),r.d(t,"bridge",function(){return U}),r.d(t,"init",function(){return F}),r.d(t,"parent",function(){return k}),r.d(t,"send",function(){return R}),r.d(t,"request",function(){return W}),r.d(t,"sendToParent",function(){return I}),r.d(t,"client",function(){return D}),r.d(t,"on",function(){return C}),r.d(t,"listen",function(){return L}),r.d(t,"once",function(){return N}),r.d(t,"listener",function(){return B}),r.d(t,"CONFIG",function(){return u.a}),r.d(t,"CONSTANTS",function(){return u.b}),r.d(t,"disable",function(){return x});var o=r(7),i=r(0),a=r(4),u=r(1),c=r(3),s=r(2),d={};d[u.b.SEND_STRATEGIES.POST_MESSAGE]=function(e,n,t){try{r(12).emulateIERestrictions(window,e)}catch(e){return}(Array.isArray(t)?t:"string"==typeof t?[t]:[u.b.WILDCARD]).map(function(n){if(0===n.indexOf(u.b.MOCK_PROTOCOL)){if(window.location.protocol===u.b.FILE_PROTOCOL)return u.b.WILDCARD;if(!Object(i.isActuallySameDomain)(e))throw new Error("Attempting to send messsage to mock domain "+n+", but window is actually cross-domain");return Object(i.getActualDomain)(e)}return 0===n.indexOf(u.b.FILE_PROTOCOL)?u.b.WILDCARD:n}).forEach(function(r){return e.postMessage(n,r)})};var f=r(9),l=f.sendBridgeMessage,w=f.needsBridgeForBrowser,p=f.isBridge;d[u.b.SEND_STRATEGIES.BRIDGE]=function(e,n,r){if(w()||p()){if(Object(i.isSameDomain)(e))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==Object(i.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");return l(e,n,r)}},d[u.b.SEND_STRATEGIES.GLOBAL]=function(e,n){if(Object(o.e)()){if(!Object(i.isSameDomain)(e))throw new Error("Post message through global disabled between different domain windows");if(!1!==Object(i.isSameTopWindow)(window,e))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=e[u.b.WINDOW_PROPS.POSTROBOT];if(!r)throw new Error("Can not find postRobot global on foreign window");return r.receiveMessage({source:window,origin:Object(i.getDomain)(),data:n})}};var h=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e};function m(e,n,r){return s.a.try(function(){var t;if(n=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=Object(a.uniqueID)(),u=Object(o.b)(),c=Object(i.getDomain)(window);return h({},n,r,{sourceDomain:c,id:n.id||t,windowType:u})}(e,n,{data:Object(o.h)(e,r,n.data),domain:r}),e===window&&!u.a.ALLOW_SAME_ORIGIN)throw new Error("Attemping to send message to self");if(Object(i.isWindowClosed)(e))throw new Error("Window is closed");var c=[],f=JSON.stringify(((t={})[u.b.WINDOW_PROPS.POSTROBOT]=n,t),null,2);return s.a.map(Object.keys(d),function(n){return s.a.try(function(){if(!u.a.ALLOWED_POST_MESSAGE_METHODS[n])throw new Error("Strategy disallowed: "+n);return d[n](e,f,r)}).then(function(){return c.push(n+": success"),!0},function(e){return c.push(n+": "+Object(a.stringifyError)(e)+"\n"),!1})}).then(function(e){var r=e.some(Boolean),t=n.type+" "+n.name+" "+(r?"success":"error")+":\n - "+c.join("\n - ")+"\n";if(!r)throw new Error(t)})})}var g=r(5);c.a.responseListeners=c.a.responseListeners||{},c.a.requestListeners=c.a.requestListeners||{},c.a.WINDOW_WILDCARD=c.a.WINDOW_WILDCARD||new function(){},c.a.erroredResponseListeners=c.a.erroredResponseListeners||{};var O,v="__domain_regex__";function y(e){return c.a.responseListeners[e]}function b(e){delete c.a.responseListeners[e]}function _(e){return Boolean(c.a.erroredResponseListeners[e])}function E(e){var n=e.name,r=e.win,t=e.domain;if(r===u.b.WILDCARD&&(r=null),t===u.b.WILDCARD&&(t=null),!n)throw new Error("Name required to get request listener");var o=c.a.requestListeners[n];if(o)for(var a=0,s=[r,c.a.WINDOW_WILDCARD],d=null==s?0:s.length;a<d;a++){var f=s[a],l=f&&o.get(f);if(l){if(t&&"string"==typeof t){if(l[t])return l[t];if(l[v])for(var w=0,p=l[v],h=null==p?0:p.length;w<h;w++){var m=p[w],g=m.regex,O=m.listener;if(Object(i.matchDomain)(g,t))return O}}if(l[u.b.WILDCARD])return l[u.b.WILDCARD]}}}var S=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},P=((O={})[u.b.POST_MESSAGE_TYPE.ACK]=function(e,n,r){if(!_(r.hash)){var t=y(r.hash);if(!t)throw new Error("No handler found for post message ack for message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(t.domain,n))throw new Error("Ack origin "+n+" does not match domain "+t.domain.toString());t.ack=!0}},O[u.b.POST_MESSAGE_TYPE.REQUEST]=function(e,n,r){var t=E({name:r.name,win:e,domain:n});function o(t){return r.fireAndForget||Object(i.isWindowClosed)(e)?s.a.resolve():m(e,S({target:r.originalSource,hash:r.hash,name:r.name},t),n)}return s.a.all([o({type:u.b.POST_MESSAGE_TYPE.ACK}),s.a.try(function(){if(!t)throw new Error("No handler found for post message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(t.domain,n))throw new Error("Request origin "+n+" does not match domain "+t.domain.toString());var o=r.data;return t.handler({source:e,origin:n,data:o})}).then(function(e){return o({type:u.b.POST_MESSAGE_TYPE.RESPONSE,ack:u.b.POST_MESSAGE_ACK.SUCCESS,data:e})},function(e){var n=Object(a.stringifyError)(e).replace(/^Error: /,""),r=e.code;return o({type:u.b.POST_MESSAGE_TYPE.RESPONSE,ack:u.b.POST_MESSAGE_ACK.ERROR,error:n,code:r})})]).then(a.noop).catch(function(e){if(t&&t.handleError)return t.handleError(e);throw e})},O[u.b.POST_MESSAGE_TYPE.RESPONSE]=function(e,n,r){if(!_(r.hash)){var t=y(r.hash);if(!t)throw new Error("No handler found for post message response for message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(t.domain,n))throw new Error("Response origin "+n+" does not match domain "+Object(i.stringifyDomainPattern)(t.domain));if(b(r.hash),r.ack===u.b.POST_MESSAGE_ACK.ERROR){var o=new Error(r.error);return r.code&&(o.code=r.code),t.respond(o,null)}if(r.ack===u.b.POST_MESSAGE_ACK.SUCCESS){var a=r.data||r.response;return t.respond(null,{source:e,origin:n,data:a})}}},O),T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function j(e){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!e.source)return}catch(e){return}var n=e.source,r=e.origin,t=function(e){var n=void 0;try{n=JSON.parse(e)}catch(e){return}if(n&&"object"===(void 0===n?"undefined":T(n))&&null!==n&&(n=n[u.b.WINDOW_PROPS.POSTROBOT])&&"object"===(void 0===n?"undefined":T(n))&&null!==n&&n.type&&"string"==typeof n.type&&P[n.type])return n}(e.data);if(t){if(!t.sourceDomain||"string"!=typeof t.sourceDomain)throw new Error("Expected message to have sourceDomain");0!==t.sourceDomain.indexOf(u.b.MOCK_PROTOCOL)&&0!==t.sourceDomain.indexOf(u.b.FILE_PROTOCOL)||(r=t.sourceDomain),-1===c.a.receivedMessages.indexOf(t.id)&&(c.a.receivedMessages.push(t.id),Object(i.isWindowClosed)(n)&&!t.fireAndForget||(t.data&&(t.data=Object(o.a)(n,r,t.data)),P[t.type](n,r,t)))}}function A(e){try{Object(a.noop)(e.source)}catch(e){return}var n={source:e.source||e.sourceElement,origin:e.origin||e.originalEvent&&e.originalEvent.origin,data:e.data};try{r(12).emulateIERestrictions(n.source,window)}catch(e){return}j(n)}function W(e){return s.a.try(function(){if(!e.name)throw new Error("Expected options.name");var n=e.name,r=void 0,t=void 0;if("string"==typeof e.window){var d=document.getElementById(e.window);if(!d)throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be a valid element id");if("iframe"!==d.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(!d.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");r=d.contentWindow}else if(e.window instanceof HTMLIFrameElement){if("iframe"!==e.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(e.window&&!e.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");e.window&&e.window.contentWindow&&(r=e.window.contentWindow)}else r=e.window;if(!r)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var f=r;t=e.domain||u.b.WILDCARD;var l=e.name+"_"+Object(a.uniqueID)();if(Object(i.isWindowClosed)(f))throw new Error("Target window is closed");var w=!1,p=c.a.requestPromises.get(f);p||(p=[],c.a.requestPromises.set(f,p));var h=s.a.try(function(){if(Object(i.isAncestor)(window,f))return Object(o.f)(f,e.timeout||u.a.CHILD_WINDOW_TIMEOUT)}).then(function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(Object(a.isRegex)(t)&&!e)return Object(o.g)(f)}).then(function(){var r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(Object(a.isRegex)(t)){if(!Object(i.matchDomain)(t,r))throw new Error("Remote window domain "+r+" does not match regex: "+t.toString());t=r}if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("Expected domain to be a string or array");var o=t;return new s.a(function(r,t){var a=void 0;if(e.fireAndForget||function(e,n){c.a.responseListeners[e]=n}(l,a={name:n,window:f,domain:o,respond:function(e,n){e||(w=!0,p.splice(p.indexOf(h,1))),e?t(e):r(n)}}),m(f,{type:u.b.POST_MESSAGE_TYPE.REQUEST,hash:l,name:n,data:e.data,fireAndForget:e.fireAndForget},o).catch(t),e.fireAndForget)return r();var s=u.a.ACK_TIMEOUT,d=e.timeout||u.a.RES_TIMEOUT,g=100;setTimeout(function r(){if(!w){if(Object(i.isWindowClosed)(f))return a.ack?t(new Error("Window closed for "+n+" before response")):t(new Error("Window closed for "+n+" before ack"));if(s=Math.max(s-g,0),-1!==d&&(d=Math.max(d-g,0)),a.ack){if(-1===d)return;g=Math.min(d,2e3)}else{if(0===s)return t(new Error("No ack for postMessage "+n+" in "+Object(i.getDomain)()+" in "+u.a.ACK_TIMEOUT+"ms"));if(0===d)return t(new Error("No response for postMessage "+n+" in "+Object(i.getDomain)()+" in "+(e.timeout||u.a.RES_TIMEOUT)+"ms"))}setTimeout(r,g)}},g)})});return h.catch(function(){!function(e){c.a.erroredResponseListeners[e]=!0}(l),b(l)}),p.push(h),h})}function R(e,n,r,t){return(t=t||{}).window=e,t.name=n,t.data=r,W(t)}function I(e,n,r){var t=Object(i.getAncestor)();return t?R(t,e,n,r):new s.a(function(e,n){return n(new Error("Window does not have a parent"))})}function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.window)throw new Error("Expected options.window");var n=e.window;return{send:function(r,t){return R(n,r,t,e)}}}c.a.receivedMessages=c.a.receivedMessages||[],c.a.receiveMessage=j,c.a.requestPromises=c.a.requestPromises||new g.a,c.a.send=R;var M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function L(e){if(!e.name)throw new Error("Expected options.name");if(!e.handler)throw new Error("Expected options.handler");var n=e.name,r=e.window,t=e.domain,o={handler:e.handler,handleError:e.errorHandler||function(e){throw e},window:r,domain:t||u.b.WILDCARD,name:n},s=function e(n,r){var t=n.name,o=n.win,i=n.domain;if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var s=[],d=0,f=o,l=null==f?0:f.length;d<l;d++){var w=f[d];s.push(e({name:t,domain:i,win:w},r))}return{cancel:function(){for(var e=0,n=null==s?0:s.length;e<n;e++)s[e].cancel()}}}if(Array.isArray(i)){for(var p=[],h=0,m=i,O=null==m?0:m.length;h<O;h++){var y=m[h];p.push(e({name:t,win:o,domain:y},r))}return{cancel:function(){for(var e=0,n=null==p?0:p.length;e<n;e++)p[e].cancel()}}}var b=E({name:t,win:o,domain:i});if(o&&o!==u.b.WILDCARD||(o=c.a.WINDOW_WILDCARD),i=i||u.b.WILDCARD,b)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===c.a.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===c.a.WINDOW_WILDCARD?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" on domain "+i.toString()):new Error("Request listener already exists for "+t);var _=c.a.requestListeners,S=_[t];S||(S=new g.a,_[t]=S);var P=S.get(o);P||(P={},S.set(o,P));var T=i.toString(),j=P[v],A=void 0;return Object(a.isRegex)(i)?(j||(j=[],P[v]=j),A={regex:i,listener:r},j.push(A)):P[T]=r,{cancel:function(){P&&(delete P[T],o&&0===Object.keys(P).length&&S.delete(o),A&&j.splice(j.indexOf(A,1)))}}}({name:n,win:r,domain:t},o);if(e.once){var d=o.handler;o.handler=Object(a.once)(function(){return s.cancel(),d.apply(this,arguments)})}if(o.window&&e.errorOnClose)var f=Object(a.safeInterval)(function(){r&&"object"===(void 0===r?"undefined":M(r))&&Object(i.isWindowClosed)(r)&&(f.cancel(),o.handleError(new Error("Post message target window is closed")))},50);return{cancel:function(){s.cancel()}}}function C(e,n,r){return"function"==typeof n&&(r=n,n={}),(n=n||{}).name=e,n.handler=r||n.handler,L(n)}function N(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];"function"==typeof n&&(r=n,n={}),n=n||{},r=r||n.handler;var t=n.errorHandler,o=new s.a(function(o,i){(n=n||{}).name=e,n.once=!0,n.handler=function(e){if(o(e),r)return r(e)},n.errorHandler=function(e){if(i(e),t)return t(e)}}),i=L(n);return o.cancel=i.cancel,o}function B(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(n,r){return C(n,e,r)}}}function x(){delete window[u.b.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",A)}c.a.on=C;var k=Object(i.getAncestor)();function G(e){var n=c.a.requestPromises.get(e);if(n)for(var r=0,t=null==n?0:n.length;r<t;r++)n[r].reject(new Error("No response from window - cleaned up"));c.a.popupWindowsByWin&&c.a.popupWindowsByWin.delete(e),c.a.remoteWindows&&c.a.remoteWindows.delete(e),c.a.requestPromises.delete(e),c.a.methods.delete(e),c.a.readyPromises.delete(e)}var U=r(23);function F(){c.a.initialized||(Object(a.addEventListener)(window,"message",A),r(9).openTunnelToOpener(),Object(o.c)(),Object(o.d)({on:C,send:R})),c.a.initialized=!0}F(),r.d(n,"cleanUpWindow",function(){return G}),r.d(n,"Promise",function(){return s.a}),r.d(n,"bridge",function(){return U}),r.d(n,"init",function(){return F}),r.d(n,"parent",function(){return k}),r.d(n,"send",function(){return R}),r.d(n,"request",function(){return W}),r.d(n,"sendToParent",function(){return I}),r.d(n,"client",function(){return D}),r.d(n,"on",function(){return C}),r.d(n,"listen",function(){return L}),r.d(n,"once",function(){return N}),r.d(n,"listener",function(){return B}),r.d(n,"CONFIG",function(){return u.a}),r.d(n,"CONSTANTS",function(){return u.b}),r.d(n,"disable",function(){return x}),n.default=t},function(e,n,r){"use strict";function t(e){return"[object RegExp]"===Object.prototype.toString.call(e)}n.h=u,n.g=c,n.a=d,n.c=f,n.j=l,n.o=w,n.f=h,n.r=_,n.s=function(e){if(function(){for(var e=0;e<b.length;e++)v(b[e])&&(b.splice(e,1),y.splice(e,1));for(var n=0;n<y.length;n++)_(y[n])&&(b.splice(n,1),y.splice(n,1))}(),e&&e.contentWindow)try{y.push(e.contentWindow),b.push(e)}catch(e){}},n.i=function(e){return(e=e||window).navigator.mockUserAgent||e.navigator.userAgent},n.e=function(e,n){for(var r=h(e),t=0,o=null==r?0:r.length;t<o;t++){var i=r[t];try{if(w(i)&&i.name===n&&-1!==r.indexOf(i))return i}catch(e){}}try{if(-1!==r.indexOf(e.frames[n]))return e.frames[n]}catch(e){}try{if(-1!==r.indexOf(e[n]))return e[n]}catch(e){}},n.m=function(e,n){return e===c(n)},n.b=E,n.k=function(e,n){var r=E(n);if(r)return r===e;if(n===e)return!1;if(g(n)===n)return!1;for(var t=0,o=h(e),i=null==o?0:o.length;t<i;t++)if(o[t]===n)return!0;return!1},n.n=function(){return Boolean(c(window))},n.l=function(){return Boolean(u(window))},n.p=function(e,n){var r=g(e)||e,t=g(n)||n;try{if(r&&t)return r===t}catch(e){}var o=O(e),i=O(n);if(S(o,i))return!0;var a=c(r),u=c(t);return!(a&&S(O(a),i)||(u&&S(O(u),o),1))},n.t=function e(n,r){if("string"==typeof n){if("string"==typeof r)return n===o.WILDCARD||r===n;if(t(r))return!1;if(Array.isArray(r))return!1}return t(n)?t(r)?n.toString()===r.toString():!Array.isArray(r)&&Boolean(r.match(n)):!!Array.isArray(n)&&(Array.isArray(r)?JSON.stringify(n)===JSON.stringify(r):!t(r)&&n.some(function(n){return e(n,r)}))},n.u=function(e){return Array.isArray(e)?"("+e.join(" | ")+")":t(e)?"RegExp("+e.toString():e.toString()},n.d=function(e){return e.match(/^(https?|mock|file):\/\//)?e.split("/").slice(0,3).join("/"):f()},n.q=function(e){try{if(e===window)return!0}catch(e){if(e&&e.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(e))return!0}catch(e){if(e&&e.message===i)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===i)return!0}try{e&&e.__cross_domain_utils_window_check__}catch(e){return!0}return!1};var o={MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",ABOUT_PROTOCOL:"about:",WILDCARD:"*"},i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.ABOUT_PROTOCOL}function u(e){if(e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}function c(e){if(e&&!u(e))try{return e.opener}catch(e){}}function s(e){try{return e&&e.location&&e.location.href,!0}catch(e){}return!1}function d(e){var n=(e=e||window).location;if(!n)throw new Error("Can not read window location");var r=n.protocol;if(!r)throw new Error("Can not read window protocol");if(r===o.FILE_PROTOCOL)return o.FILE_PROTOCOL+"//";if(r===o.ABOUT_PROTOCOL){var t=u(e);return t&&s(t)?d(t):o.ABOUT_PROTOCOL+"//"}var i=n.host;if(!i)throw new Error("Can not read window host");return r+"//"+i}function f(e){var n=d(e=e||window);return n&&e.mockDomain&&0===e.mockDomain.indexOf(o.MOCK_PROTOCOL)?e.mockDomain:n}function l(e){try{if(e===window)return!0}catch(e){}try{var n=Object.getOwnPropertyDescriptor(e,"location");if(n&&!1===n.enumerable)return!1}catch(e){}try{if(a(e)&&s(e))return!0}catch(e){}try{if(d(e)===d(window))return!0}catch(e){}return!1}function w(e){if(!l(e))return!1;try{if(e===window)return!0;if(a(e)&&s(e))return!0;if(f(window)===f(e))return!0}catch(e){}return!1}function p(e,n){if(!e||!n)return!1;var r=u(n);return r?r===e:-1!==function(e){var n=[];try{for(;e.parent!==e;)n.push(e.parent),e=e.parent}catch(e){}return n}(n).indexOf(e)}function h(e){var n=[],r=void 0;try{r=e.frames}catch(n){r=e}var t=void 0;try{t=r.length}catch(e){}if(0===t)return n;if(t){for(var o=0;o<t;o++){var i=void 0;try{i=r[o]}catch(e){continue}n.push(i)}return n}for(var a=0;a<100;a++){var u=void 0;try{u=r[a]}catch(e){return n}if(!u)return n;n.push(u)}return n}function m(e){for(var n=[],r=0,t=h(e),o=null==t?0:t.length;r<o;r++){var i=t[r];n.push(i);for(var a=0,u=m(i),c=null==u?0:u.length;a<c;a++){var s=u[a];n.push(s)}}return n}function g(e){if(e){try{if(e.top)return e.top}catch(e){}if(u(e)===e)return e;try{if(p(window,e)&&window.top)return window.top}catch(e){}try{if(p(e,window)&&window.top)return window.top}catch(e){}for(var n=0,r=m(e),t=null==r?0:r.length;n<t;n++){var o=r[n];try{if(o.top)return o.top}catch(e){}if(u(o)===o)return o}}}function O(e){var n=g(e);if(!n)throw new Error("Can not determine top window");return[].concat(m(n),[n])}function v(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var n=e.ownerDocument;return!(!n||!n.body||n.body.contains(e))}var y=[],b=[];function _(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==i}if(n&&w(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var r=function(e,n){for(var r=0;r<e.length;r++)try{if(e[r]===n)return r}catch(e){}return-1}(y,e);if(-1!==r){var t=b[r];if(t&&v(t))return!0}return!1}function E(e){return c(e=e||window)||u(e)||void 0}function S(e,n){for(var r=0,t=null==e?0:e.length;r<t;r++)for(var o=e[r],i=0,a=null==n?0:n.length;i<a;i++)if(o===n[i])return!0;return!1}},function(e,n){},function(e,n,r){"use strict";r(6),r(11)},function(e,n,r){"use strict";r(6)},function(e,n,r){"use strict";function t(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function o(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}r(6),r(8),"function"==typeof Symbol&&Symbol.iterator,Object.assign,function(e){function n(r){return t(this,n),function(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}(this,e.call(this,"",{},r))}(function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)})(n,e),n.prototype.toString=function(){return this.childrenToString()}}(function(){function e(n,r,o){t(this,e),this.name=n,this.props=r,this.children=o}return e.prototype.toString=function(){var e=this.name,n=this.propsToString(),r=this.childrenToString();return"<"+e+(n?" ":"")+n+">"+r+"</"+e+">"},e.prototype.propsToString=function(){var e=this.props;return e?Object.keys(e).filter(function(n){return"innerHTML"!==n&&e&&!1!==e[n]}).map(function(n){if(e){var r=e[n];if(!0===r)return""+o(n);if("string"==typeof r)return o(n)+'="'+o(r)+'"'}return""}).filter(Boolean).join(" "):""},e.prototype.childrenToString=function(){if(this.props&&this.props.innerHTML)return this.props.innerHTML;if(!this.children)return"";var n="";return function r(t){for(var i=0,a=null==t?0:t.length;i<a;i++){var u=t[i];null!==u&&void 0!==u&&(Array.isArray(u)?r(u):n+=u instanceof e?u.toString():o(u))}}(this.children),n},e}())},function(e,n,r){"use strict";r(2),r(0)},function(e,n){},function(e,n,r){"use strict";r(6)},function(e,n,r){"use strict"},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(9);r.d(n,"openBridge",function(){return t.openBridge}),r.d(n,"linkUrl",function(){return t.linkUrl}),r.d(n,"isBridge",function(){return t.isBridge}),r.d(n,"needsBridge",function(){return t.needsBridge}),r.d(n,"needsBridgeForBrowser",function(){return t.needsBridgeForBrowser}),r.d(n,"hasBridge",function(){return t.hasBridge}),r.d(n,"needsBridgeForWin",function(){return t.needsBridgeForWin}),r.d(n,"needsBridgeForDomain",function(){return t.needsBridgeForDomain}),r.d(n,"openTunnelToOpener",function(){return t.openTunnelToOpener}),r.d(n,"destroyBridges",function(){return t.destroyBridges})}])}); | ||
//# sourceMappingURL=post-robot.ie.min.js.map | ||
//# sourceMappingURL=post-robot.ie.min.js.map |
@@ -1,3 +0,3 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("postRobot",[],r):"object"==typeof exports?exports.postRobot=r():e.postRobot=r()}("undefined"!=typeof self?self:this,function(){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=1)}([function(e,r,n){"use strict";var t=n(2);n.d(r,"getActualDomain",function(){return t.a}),n.d(r,"getAncestor",function(){return t.b}),n.d(r,"getDomain",function(){return t.c}),n.d(r,"getUserAgent",function(){return t.d}),n.d(r,"isActuallySameDomain",function(){return t.e}),n.d(r,"isAncestor",function(){return t.f}),n.d(r,"isIframe",function(){return t.g}),n.d(r,"isPopup",function(){return t.h}),n.d(r,"isWindow",function(){return t.i}),n.d(r,"isWindowClosed",function(){return t.j}),n.d(r,"matchDomain",function(){return t.k}),n.d(r,"stringifyDomainPattern",function(){return t.l});var o=n(3);n.n(o)},function(e,r,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),n.d({},"WeakMap",function(){return u});var t={};n.d(t,"cleanUpWindow",function(){return ne}),n.d(t,"Promise",function(){return S}),n.d(t,"bridge",function(){return te}),n.d(t,"init",function(){return oe}),n.d(t,"parent",function(){return re}),n.d(t,"send",function(){return J}),n.d(t,"request",function(){return F}),n.d(t,"sendToParent",function(){return K}),n.d(t,"client",function(){return Z}),n.d(t,"on",function(){return X}),n.d(t,"listen",function(){return Q}),n.d(t,"once",function(){return V}),n.d(t,"listener",function(){return $}),n.d(t,"CONFIG",function(){return l}),n.d(t,"CONSTANTS",function(){return f}),n.d(t,"disable",function(){return ee});var o=n(0);function i(e,r){for(var n=0;n<e.length;n++)try{if(e[n]===r)return n}catch(e){}return-1}var a,s=Object.defineProperty,c=Date.now()%1e9,u=function(){function e(){if(function(r,n){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this),c+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+c,function(){if(!window.WeakMap)return!1;if(!window.Object.freeze)return!1;try{var e=new window.WeakMap,r={};return window.Object.freeze(r),e.set(r,"__testvalue__"),"__testvalue__"===e.get(r)}catch(e){return!1}}())try{this.weakmap=new window.WeakMap}catch(e){}this.keys=[],this.values=[]}return e.prototype._cleanupClosedWindows=function(){for(var e=this.weakmap,r=this.keys,n=0;n<r.length;n++){var t=r[n];if(Object(o.isWindow)(t)&&Object(o.isWindowClosed)(t)){if(e)try{e.delete(t)}catch(e){}r.splice(n,1),this.values.splice(n,1),n-=1}}},e.prototype.isSafeToReadWrite=function(e){if(Object(o.isWindow)(e))return!1;try{e&&e.self,e&&e[this.name]}catch(e){return!1}return!0},e.prototype.set=function(e,r){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.set(e,r)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var t=this.name,o=e[t];o&&o[0]===e?o[1]=r:s(e,t,{value:[e,r],writable:!0})}else{this._cleanupClosedWindows();var a=this.keys,c=this.values,u=i(a,e);-1===u?(a.push(e),c.push(r)):c[u]=r}},e.prototype.get=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(e))return r.get(e)}catch(e){delete this.weakmap}if(!this.isSafeToReadWrite(e)){this._cleanupClosedWindows();var n=i(this.keys,e);if(-1===n)return;return this.values[n]}var t=e[this.name];if(t&&t[0]===e)return t[1]},e.prototype.delete=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var n=e[this.name];n&&n[0]===e&&(n[0]=n[1]=void 0)}else{this._cleanupClosedWindows();var t=this.keys,o=i(t,e);-1!==o&&(t.splice(o,1),this.values.splice(o,1))}},e.prototype.has=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{return r.has(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var n=e[this.name];return!(!n||n[0]!==e)}return this._cleanupClosedWindows(),-1!==i(this.keys,e)},e}(),f={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",HELLO:"postrobot_ready",OPEN_TUNNEL:"postrobot_open_tunnel"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method",ERROR:"postrobot_error",PROMISE:"postrobot_promise",ZALGO_PROMISE:"postrobot_zalgo_promise",REGEX:"regex"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",BRIDGE:"postrobot_bridge",GLOBAL:"postrobot_global"},MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",BRIDGE_NAME_PREFIX:"__postrobot_bridge__",POSTROBOT_PROXY:"__postrobot_proxy__",WILDCARD:"*"},d={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},l=(Object.keys(d).map(function(e){return d[e]}),{ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:-1!==window.navigator.userAgent.match(/MSIE/i)?2e3:1e3,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(a={},a[f.SEND_STRATEGIES.POST_MESSAGE]=!0,a[f.SEND_STRATEGIES.BRIDGE]=!0,a[f.SEND_STRATEGIES.GLOBAL]=!0,a),ALLOW_SAME_ORIGIN:!1});0===window.location.href.indexOf(f.FILE_PROTOCOL)&&(l.ALLOW_POSTMESSAGE_POPUP=!0);var w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function h(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(r>=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 n=e&&e.stack,t=e&&e.message;if(n&&t)return-1!==n.indexOf(t)?n:t+"\n"+n;if(n)return n;if(t)return t}return"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(e){return"Error while stringifying error: "+h(e,r+1)}}var p=function(e){if(!e)return e;var r=!1;return function(){if(!r)return r=!0,e.apply(this,arguments)}};function m(){}function _(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})}function y(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n>=100)throw new Error("Self-referential object passed, or object contained too many layers");var t=void 0;if("object"!==(void 0===e?"undefined":w(e))||null===e||Array.isArray(e)){if(!Array.isArray(e))throw new TypeError("Invalid type: "+(void 0===e?"undefined":w(e)));t=[]}else t={};return function(e,r){Array.isArray(e)?function(e,r){for(var n=0;n<e.length;n++)r(e[n],n)}(e,r):"object"===(void 0===e?"undefined":w(e))&&null!==e&&function(e,r){for(var n in e)e.hasOwnProperty(n)&&r(e[n],n)}(e,r)}(e,function(e,o){var i=r(e,o);void 0!==i?t[o]=i:"object"===(void 0===e?"undefined":w(e))&&null!==e?t[o]=y(e,r,n+1):t[o]=e}),t}function E(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function O(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&e instanceof window.constructor)return!1;var r={}.toString;if(r){var n=r.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}function v(){var e=void 0;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");e=window}var r=e.__zalgopromise__=e.__zalgopromise__||{};return r.flushPromises=r.flushPromises||[],r.activeCount=r.activeCount||0,r.possiblyUnhandledPromiseHandlers=r.possiblyUnhandledPromiseHandlers||[],r.dispatchedErrors=r.dispatchedErrors||[],r}var S=function(){function e(r){var n=this;if(function(r,n){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],r){var t=void 0,o=void 0,i=!1,a=!1,s=!1;try{r(function(e){s?n.resolve(e):(i=!0,t=e)},function(e){s?n.reject(e):(a=!0,o=e)})}catch(e){return void this.reject(e)}s=!0,i?this.resolve(t):a&&this.reject(o)}}return e.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(O(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},e.prototype.reject=function(e){var r=this;if(this.resolved||this.rejected)return this;if(O(e))throw new Error("Can not reject promise with another promise");if(!e){var n=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e);e=new Error("Expected reject to be called with Error, got "+n)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){r.errorHandled||function(e,r){if(-1===v().dispatchedErrors.indexOf(e)){v().dispatchedErrors.push(e),setTimeout(function(){throw e},1);for(var n=0;n<v().possiblyUnhandledPromiseHandlers.length;n++)v().possiblyUnhandledPromiseHandlers[n](e,r)}}(e,r)},1),this.dispatch(),this},e.prototype.asyncReject=function(e){this.errorHandled=!0,this.reject(e)},e.prototype.dispatch=function(){var r=this,n=this.dispatching,t=this.resolved,o=this.rejected,i=this.handlers;if(!n&&(t||o)){this.dispatching=!0,v().activeCount+=1;for(var a=function(n){var a=i[n],s=a.onSuccess,c=a.onError,u=a.promise,f=void 0;if(t)try{f=s?s(r.value):r.value}catch(e){return u.reject(e),"continue"}else if(o){if(!c)return u.reject(r.error),"continue";try{f=c(r.error)}catch(e){return u.reject(e),"continue"}}f instanceof e&&(f.resolved||f.rejected)?(f.resolved?u.resolve(f.value):u.reject(f.error),f.errorHandled=!0):O(f)?f instanceof e&&(f.resolved||f.rejected)?f.resolved?u.resolve(f.value):u.reject(f.error):f.then(function(e){u.resolve(e)},function(e){u.reject(e)}):u.resolve(f)},s=0;s<i.length;s++)a(s);i.length=0,this.dispatching=!1,v().activeCount-=1,0===v().activeCount&&e.flushQueue()}},e.prototype.then=function(r,n){if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for success handler");if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for error handler");var t=new e;return this.handlers.push({promise:t,onSuccess:r,onError:n}),this.errorHandled=!0,this.dispatch(),t},e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.finally=function(r){if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.finally expected a function");return this.then(function(n){return e.try(r).then(function(){return n})},function(n){return e.try(r).then(function(){throw n})})},e.prototype.timeout=function(e,r){var n=this;if(this.resolved||this.rejected)return this;var t=setTimeout(function(){n.resolved||n.rejected||n.reject(r||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(e){return clearTimeout(t),e})},e.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(r){return r instanceof e?r:O(r)?new e(function(e,n){return r.then(e,n)}):(new e).resolve(r)},e.reject=function(r){return(new e).reject(r)},e.all=function(r){var n=new e,t=r.length,o=[];if(!t)return n.resolve(o),n;for(var i=function(i){var a=r[i];if(a instanceof e){if(a.resolved)return o[i]=a.value,t-=1,"continue"}else if(!O(a))return o[i]=a,t-=1,"continue";e.resolve(a).then(function(e){o[i]=e,0==(t-=1)&&n.resolve(o)},function(e){n.reject(e)})},a=0;a<r.length;a++)i(a);return 0===t&&n.resolve(o),n},e.hash=function(r){var n={};return e.all(Object.keys(r).map(function(t){return e.resolve(r[t]).then(function(e){n[t]=e})})).then(function(){return n})},e.map=function(r,n){return e.all(r.map(n))},e.onPossiblyUnhandledException=function(e){return function(e){return v().possiblyUnhandledPromiseHandlers.push(e),{cancel:function(){v().possiblyUnhandledPromiseHandlers.splice(v().possiblyUnhandledPromiseHandlers.indexOf(e),1)}}}(e)},e.try=function(r,n,t){if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=r.apply(n,t||[])}catch(r){return e.reject(r)}return e.resolve(o)},e.delay=function(r){return new e(function(e){setTimeout(e,r)})},e.isPromise=function(r){return!!(r&&r instanceof e)||O(r)},e.flush=function(){var r=new e;return v().flushPromises.push(r),0===v().activeCount&&e.flushQueue(),r},e.flushQueue=function(){var e=v().flushPromises;v().flushPromises=[];for(var r=0,n=null==e?0:e.length;r<n;r++)e[r].resolve()},e}(),g=window[f.WINDOW_PROPS.POSTROBOT]=window[f.WINDOW_PROPS.POSTROBOT]||{};g.registerSelf=function(){};var P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};g.methods=g.methods||new u;var A=p(function(){g.on(f.POST_MESSAGE_NAMES.METHOD,{origin:f.WILDCARD},function(e){var r=e.source,n=e.origin,t=e.data,i=g.methods.get(r);if(!i)throw new Error("Could not find any methods this window has privileges to call");var a=i[t.id];if(!a)throw new Error("Could not find method with id: "+t.id);if(!Object(o.matchDomain)(a.domain,n))throw new Error("Method domain "+a.domain+" does not match origin "+n);return S.try(function(){return a.method.apply({source:r,origin:n,data:t},t.args)}).then(function(e){return{result:e,id:t.id,name:t.name}})})});function b(e,r){return"object"===(void 0===e?"undefined":P(e))&&null!==e&&e.__type__===r}function T(e,r,n,t){var o=_(),i=g.methods.get(e);return i||(i={},g.methods.set(e,i)),i[o]={domain:r,method:n},{__type__:f.SERIALIZATION_TYPES.METHOD,__id__:o,__name__:t}}function R(e,r,n){function t(){var t=Array.prototype.slice.call(arguments);return g.send(e,f.POST_MESSAGE_NAMES.METHOD,{id:n.__id__,name:n.__name__,args:t},{domain:r,timeout:-1}).then(function(e){return e.data.result},function(e){throw e})}return t.__name__=n.__name__,t.__xdomain__=!0,t.source=e,t.origin=r,t}function I(e,r,n){return new S(function(t,o){return R(e,r,n.__then__)(t,o)})}function W(e){return g.send(e,f.POST_MESSAGE_NAMES.HELLO,{},{domain:f.WILDCARD,timeout:-1}).then(function(e){return{origin:e.origin}})}g.readyPromises=g.readyPromises||new u;var D={};D[f.SEND_STRATEGIES.POST_MESSAGE]=function(e,r,n){(Array.isArray(n)?n:"string"==typeof n?[n]:[f.WILDCARD]).map(function(r){if(0===r.indexOf(f.MOCK_PROTOCOL)){if(window.location.protocol===f.FILE_PROTOCOL)return f.WILDCARD;if(!Object(o.isActuallySameDomain)(e))throw new Error("Attempting to send messsage to mock domain "+r+", but window is actually cross-domain");return Object(o.getActualDomain)(e)}return 0===r.indexOf(f.FILE_PROTOCOL)?f.WILDCARD:r}).forEach(function(n){return e.postMessage(r,n)})};var L=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e};function j(e,r,n){return S.try(function(){var t;if(r=function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=_(),i=Object(o.isPopup)()?f.WINDOW_TYPES.POPUP:Object(o.isIframe)()?f.WINDOW_TYPES.IFRAME:f.WINDOW_TYPES.FULLPAGE,a=Object(o.getDomain)(window);return L({},r,n,{sourceDomain:a,id:r.id||t,windowType:i})}(e,r,{data:function(e,n,t){return y({obj:r.data},function(r,t){return"function"==typeof r?T(e,n,r,t.toString()):r instanceof Error?(o=r,{__type__:f.SERIALIZATION_TYPES.ERROR,__message__:h(o),__code__:o.code}):window.Promise&&r instanceof window.Promise?function(e,r,n,t){return{__type__:f.SERIALIZATION_TYPES.PROMISE,__then__:T(e,r,function(e,r){return n.then(e,r)},t+".then")}}(e,n,r,t.toString()):S.isPromise(r)?function(e,r,n,t){return{__type__:f.SERIALIZATION_TYPES.ZALGO_PROMISE,__then__:T(e,r,function(e,r){return n.then(e,r)},t+".then")}}(e,n,r,t.toString()):E(r)?(i=r,{__type__:f.SERIALIZATION_TYPES.REGEX,__source__:i.source}):void 0;var o,i}).obj}(e,n),domain:n}),e===window&&!l.ALLOW_SAME_ORIGIN)throw new Error("Attemping to send message to self");if(Object(o.isWindowClosed)(e))throw new Error("Window is closed");var i=[],a=function(e,r,n){var t=void 0,o=void 0;try{if("{}"!==JSON.stringify({})&&(t=Object.prototype.toJSON,delete Object.prototype.toJSON),"{}"!==JSON.stringify({}))throw new Error("Can not correctly serialize JSON objects");if("[]"!==JSON.stringify([])&&(o=Array.prototype.toJSON,delete Array.prototype.toJSON),"[]"!==JSON.stringify([]))throw new Error("Can not correctly serialize JSON objects")}catch(e){throw new Error("Can not repair JSON.stringify: "+e.message)}var i=JSON.stringify.call(this,e,null,2);try{t&&(Object.prototype.toJSON=t),o&&(Array.prototype.toJSON=o)}catch(e){throw new Error("Can not repair JSON.stringify: "+e.message)}return i}(((t={})[f.WINDOW_PROPS.POSTROBOT]=r,t));return S.map(Object.keys(D),function(r){return S.try(function(){if(!l.ALLOWED_POST_MESSAGE_METHODS[r])throw new Error("Strategy disallowed: "+r);return D[r](e,a,n)}).then(function(){return i.push(r+": success"),!0},function(e){return i.push(r+": "+h(e)+"\n"),!1})}).then(function(e){var n=e.some(Boolean),t=r.type+" "+r.name+" "+(n?"success":"error")+":\n - "+i.join("\n - ")+"\n";if(!n)throw new Error(t)})})}g.responseListeners=g.responseListeners||{},g.requestListeners=g.requestListeners||{},g.WINDOW_WILDCARD=g.WINDOW_WILDCARD||new function(){},g.erroredResponseListeners=g.erroredResponseListeners||{};var C,M="__domain_regex__";function N(e){return g.responseListeners[e]}function x(e){delete g.responseListeners[e]}function k(e){return Boolean(g.erroredResponseListeners[e])}function G(e){var r=e.name,n=e.win,t=e.domain;if(n===f.WILDCARD&&(n=null),t===f.WILDCARD&&(t=null),!r)throw new Error("Name required to get request listener");var i=g.requestListeners[r];if(i)for(var a=0,s=[n,g.WINDOW_WILDCARD],c=null==s?0:s.length;a<c;a++){var u=s[a],d=u&&i.get(u);if(d){if(t&&"string"==typeof t){if(d[t])return d[t];if(d[M])for(var l=0,w=d[M],h=null==w?0:w.length;l<h;l++){var p=w[l],m=p.regex,_=p.listener;if(Object(o.matchDomain)(m,t))return _}}if(d[f.WILDCARD])return d[f.WILDCARD]}}}var U=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},H=((C={})[f.POST_MESSAGE_TYPE.ACK]=function(e,r,n){if(!k(n.hash)){var t=N(n.hash);if(!t)throw new Error("No handler found for post message ack for message: "+n.name+" from "+r+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(t.domain,r))throw new Error("Ack origin "+r+" does not match domain "+t.domain.toString());t.ack=!0}},C[f.POST_MESSAGE_TYPE.REQUEST]=function(e,r,n){var t=G({name:n.name,win:e,domain:r});function i(t){return n.fireAndForget||Object(o.isWindowClosed)(e)?S.resolve():j(e,U({target:n.originalSource,hash:n.hash,name:n.name},t),r)}return S.all([i({type:f.POST_MESSAGE_TYPE.ACK}),S.try(function(){if(!t)throw new Error("No handler found for post message: "+n.name+" from "+r+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(t.domain,r))throw new Error("Request origin "+r+" does not match domain "+t.domain.toString());var i=n.data;return t.handler({source:e,origin:r,data:i})}).then(function(e){return i({type:f.POST_MESSAGE_TYPE.RESPONSE,ack:f.POST_MESSAGE_ACK.SUCCESS,data:e})},function(e){var r=h(e).replace(/^Error: /,""),n=e.code;return i({type:f.POST_MESSAGE_TYPE.RESPONSE,ack:f.POST_MESSAGE_ACK.ERROR,error:r,code:n})})]).then(m).catch(function(e){if(t&&t.handleError)return t.handleError(e);throw e})},C[f.POST_MESSAGE_TYPE.RESPONSE]=function(e,r,n){if(!k(n.hash)){var t=N(n.hash);if(!t)throw new Error("No handler found for post message response for message: "+n.name+" from "+r+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(o.matchDomain)(t.domain,r))throw new Error("Response origin "+r+" does not match domain "+Object(o.stringifyDomainPattern)(t.domain));if(x(n.hash),n.ack===f.POST_MESSAGE_ACK.ERROR){var i=new Error(n.error);return n.code&&(i.code=n.code),t.respond(i,null)}if(n.ack===f.POST_MESSAGE_ACK.SUCCESS){var a=n.data||n.response;return t.respond(null,{source:e,origin:r,data:a})}}},C),B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Y(e){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!e.source)return}catch(e){return}var r=e.source,n=e.origin,t=function(e){var r,n=void 0;try{r=e,n=JSON.parse(r)}catch(e){return}if(n&&"object"===(void 0===n?"undefined":B(n))&&null!==n&&(n=n[f.WINDOW_PROPS.POSTROBOT])&&"object"===(void 0===n?"undefined":B(n))&&null!==n&&n.type&&"string"==typeof n.type&&H[n.type])return n}(e.data);if(t){if(!t.sourceDomain||"string"!=typeof t.sourceDomain)throw new Error("Expected message to have sourceDomain");0!==t.sourceDomain.indexOf(f.MOCK_PROTOCOL)&&0!==t.sourceDomain.indexOf(f.FILE_PROTOCOL)||(n=t.sourceDomain),-1===g.receivedMessages.indexOf(t.id)&&(g.receivedMessages.push(t.id),Object(o.isWindowClosed)(r)&&!t.fireAndForget||(t.data&&(t.data=function(e,r,n){return y({obj:t.data},function(n){var t,o;if("object"===(void 0===n?"undefined":P(n))&&null!==n)return b(n,f.SERIALIZATION_TYPES.METHOD)?R(e,r,n):b(n,f.SERIALIZATION_TYPES.ERROR)?(t=n,o=new Error(t.__message__),t.__code__&&(o.code=t.__code__),o):b(n,f.SERIALIZATION_TYPES.PROMISE)?function(e,r,n){return window.Promise?new window.Promise(function(t,o){return R(e,r,n.__then__)(t,o)}):I(e,r,n)}(e,r,n):b(n,f.SERIALIZATION_TYPES.ZALGO_PROMISE)?I(e,r,n):b(n,f.SERIALIZATION_TYPES.REGEX)?function(e,r,n){return new RegExp(n.__source__)}(0,0,n):void 0}).obj}(r,n)),H[t.type](r,n,t)))}}function q(e){try{e.source}catch(e){return}Y({source:e.source||e.sourceElement,origin:e.origin||e.originalEvent&&e.originalEvent.origin,data:e.data})}function F(e){return S.try(function(){if(!e.name)throw new Error("Expected options.name");var r=e.name,n=void 0,t=void 0;if("string"==typeof e.window){var i=document.getElementById(e.window);if(!i)throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be a valid element id");if("iframe"!==i.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(!i.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");n=i.contentWindow}else if(e.window instanceof HTMLIFrameElement){if("iframe"!==e.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(e.window&&!e.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");e.window&&e.window.contentWindow&&(n=e.window.contentWindow)}else n=e.window;if(!n)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var a=n;t=e.domain||f.WILDCARD;var s=e.name+"_"+_();if(Object(o.isWindowClosed)(a))throw new Error("Target window is closed");var c=!1,u=g.requestPromises.get(a);u||(u=[],g.requestPromises.set(a,u));var d=S.try(function(){if(Object(o.isAncestor)(window,a))return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",t=g.readyPromises.get(e);return t||(t=new S,g.readyPromises.set(e,t),-1!==r&&setTimeout(function(){return t.reject(new Error(n+" did not load after "+r+"ms"))},r),t)}(a,e.timeout||l.CHILD_WINDOW_TIMEOUT)}).then(function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(E(t)&&!e)return W(a)}).then(function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(E(t)){if(!Object(o.matchDomain)(t,n))throw new Error("Remote window domain "+n+" does not match regex: "+t.toString());t=n}if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("Expected domain to be a string or array");var i=t;return new S(function(n,t){var w=void 0;if(e.fireAndForget||function(e,r){g.responseListeners[e]=r}(s,w={name:r,window:a,domain:i,respond:function(e,r){e||(c=!0,u.splice(u.indexOf(d,1))),e?t(e):n(r)}}),j(a,{type:f.POST_MESSAGE_TYPE.REQUEST,hash:s,name:r,data:e.data,fireAndForget:e.fireAndForget},i).catch(t),e.fireAndForget)return n();var h=l.ACK_TIMEOUT,p=e.timeout||l.RES_TIMEOUT,m=100;setTimeout(function n(){if(!c){if(Object(o.isWindowClosed)(a))return w.ack?t(new Error("Window closed for "+r+" before response")):t(new Error("Window closed for "+r+" before ack"));if(h=Math.max(h-m,0),-1!==p&&(p=Math.max(p-m,0)),w.ack){if(-1===p)return;m=Math.min(p,2e3)}else{if(0===h)return t(new Error("No ack for postMessage "+r+" in "+Object(o.getDomain)()+" in "+l.ACK_TIMEOUT+"ms"));if(0===p)return t(new Error("No response for postMessage "+r+" in "+Object(o.getDomain)()+" in "+(e.timeout||l.RES_TIMEOUT)+"ms"))}setTimeout(n,m)}},m)})});return d.catch(function(){!function(e){g.erroredResponseListeners[e]=!0}(s),x(s)}),u.push(d),d})}function J(e,r,n,t){return(t=t||{}).window=e,t.name=r,t.data=n,F(t)}function K(e,r,n){var t=Object(o.getAncestor)();return t?J(t,e,r,n):new S(function(e,r){return r(new Error("Window does not have a parent"))})}function Z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.window)throw new Error("Expected options.window");var r=e.window;return{send:function(n,t){return J(r,n,t,e)}}}g.receivedMessages=g.receivedMessages||[],g.receiveMessage=Y,g.requestPromises=g.requestPromises||new u,g.send=J;var z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Q(e){if(!e.name)throw new Error("Expected options.name");if(!e.handler)throw new Error("Expected options.handler");var r,n,t,i=e.name,a=e.window,s=e.domain,c={handler:e.handler,handleError:e.errorHandler||function(e){throw e},window:a,domain:s||f.WILDCARD,name:i},d=function e(r,n){var t=r.name,o=r.win,i=r.domain;if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],s=0,c=o,d=null==c?0:c.length;s<d;s++){var l=c[s];a.push(e({name:t,domain:i,win:l},n))}return{cancel:function(){for(var e=0,r=null==a?0:a.length;e<r;e++)a[e].cancel()}}}if(Array.isArray(i)){for(var w=[],h=0,p=i,m=null==p?0:p.length;h<m;h++){var _=p[h];w.push(e({name:t,win:o,domain:_},n))}return{cancel:function(){for(var e=0,r=null==w?0:w.length;e<r;e++)w[e].cancel()}}}var y=G({name:t,win:o,domain:i});if(o&&o!==f.WILDCARD||(o=g.WINDOW_WILDCARD),i=i||f.WILDCARD,y)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===g.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===g.WINDOW_WILDCARD?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" on domain "+i.toString()):new Error("Request listener already exists for "+t);var O=g.requestListeners,v=O[t];v||(v=new u,O[t]=v);var S=v.get(o);S||(S={},v.set(o,S));var P=i.toString(),A=S[M],b=void 0;return E(i)?(A||(A=[],S[M]=A),b={regex:i,listener:n},A.push(b)):S[P]=n,{cancel:function(){S&&(delete S[P],o&&0===Object.keys(S).length&&v.delete(o),b&&A.splice(A.indexOf(b,1)))}}}({name:i,win:a,domain:s},c);if(e.once){var l=c.handler;c.handler=p(function(){return d.cancel(),l.apply(this,arguments)})}if(c.window&&e.errorOnClose)var w=(r=function(){a&&"object"===(void 0===a?"undefined":z(a))&&Object(o.isWindowClosed)(a)&&(w.cancel(),c.handleError(new Error("Post message target window is closed")))},n=50,t=void 0,t=setTimeout(function e(){t=setTimeout(e,n),r.call()},n),{cancel:function(){clearTimeout(t)}});return{cancel:function(){d.cancel()}}}function X(e,r,n){return"function"==typeof r&&(n=r,r={}),(r=r||{}).name=e,r.handler=n||r.handler,Q(r)}function V(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"function"==typeof r&&(n=r,r={}),r=r||{},n=n||r.handler;var t=r.errorHandler,o=new S(function(o,i){(r=r||{}).name=e,r.once=!0,r.handler=function(e){if(o(e),n)return n(e)},r.errorHandler=function(e){if(i(e),t)return t(e)}}),i=Q(r);return o.cancel=i.cancel,o}function $(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(r,n){return X(r,e,n)}}}function ee(){delete window[f.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",q)}g.on=X;var re=Object(o.getAncestor)();function ne(e){var r=g.requestPromises.get(e);if(r)for(var n=0,t=null==r?0:r.length;n<t;n++)r[n].reject(new Error("No response from window - cleaned up"));g.popupWindowsByWin&&g.popupWindowsByWin.delete(e),g.remoteWindows&&g.remoteWindows.delete(e),g.requestPromises.delete(e),g.methods.delete(e),g.readyPromises.delete(e)}var te=null;function oe(){var e,r,n;g.initialized||(r="message",n=q,(e=window).addEventListener?e.addEventListener(r,n):e.attachEvent("on"+r,n),function(){var e;e=function(e){var r=e.source,n=e.origin,t=g.readyPromises.get(r)||new S;t.resolve({origin:n}),g.readyPromises.set(r,t)},g.on(f.POST_MESSAGE_NAMES.HELLO,{domain:f.WILDCARD},function(r){var n=r.source,t=r.origin;return e({source:n,origin:t})});var r=Object(o.getAncestor)();r&&W(r).catch(m)}(),A({on:X,send:J})),g.initialized=!0}oe(),n.d(r,"cleanUpWindow",function(){return ne}),n.d(r,"Promise",function(){return S}),n.d(r,"bridge",function(){return te}),n.d(r,"init",function(){return oe}),n.d(r,"parent",function(){return re}),n.d(r,"send",function(){return J}),n.d(r,"request",function(){return F}),n.d(r,"sendToParent",function(){return K}),n.d(r,"client",function(){return Z}),n.d(r,"on",function(){return X}),n.d(r,"listen",function(){return Q}),n.d(r,"once",function(){return V}),n.d(r,"listener",function(){return $}),n.d(r,"CONFIG",function(){return l}),n.d(r,"CONSTANTS",function(){return f}),n.d(r,"disable",function(){return ee}),r.default=t},function(e,r,n){"use strict";function t(e){return"[object RegExp]"===Object.prototype.toString.call(e)}r.a=f,r.c=d,r.e=l,r.j=function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==i}if(r&&function(e){if(!l(e))return!1;try{if(e===window)return!0;if(a(e)&&u(e))return!0;if(d(window)===d(e))return!0}catch(e){}return!1}(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var n=function(e,r){for(var n=0;n<e.length;n++)try{if(e[n]===r)return n}catch(e){}return-1}(p,e);if(-1!==n){var t=m[n];if(t&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var r=e.ownerDocument;return!(!r||!r.body||r.body.contains(e))}(t))return!0}return!1},r.d=function(e){return(e=e||window).navigator.mockUserAgent||e.navigator.userAgent},r.b=_,r.f=function(e,r){var n=_(r);if(n)return n===e;if(r===e)return!1;if(function(e){if(e){try{if(e.top)return e.top}catch(e){}if(s(e)===e)return e;try{if(w(window,e)&&window.top)return window.top}catch(e){}try{if(w(e,window)&&window.top)return window.top}catch(e){}for(var r=0,n=function e(r){for(var n=[],t=0,o=h(r),i=null==o?0:o.length;t<i;t++){var a=o[t];n.push(a);for(var s=0,c=e(a),u=null==c?0:c.length;s<u;s++){var f=c[s];n.push(f)}}return n}(e),t=null==n?0:n.length;r<t;r++){var o=n[r];try{if(o.top)return o.top}catch(e){}if(s(o)===o)return o}}}(r)===r)return!1;for(var t=0,o=h(e),i=null==o?0:o.length;t<i;t++)if(o[t]===r)return!0;return!1},r.h=function(){return Boolean(c(window))},r.g=function(){return Boolean(s(window))},r.k=function e(r,n){if("string"==typeof r){if("string"==typeof n)return r===o.WILDCARD||n===r;if(t(n))return!1;if(Array.isArray(n))return!1}return t(r)?t(n)?r.toString()===n.toString():!Array.isArray(n)&&Boolean(n.match(r)):!!Array.isArray(r)&&(Array.isArray(n)?JSON.stringify(r)===JSON.stringify(n):!t(n)&&r.some(function(r){return e(r,n)}))},r.l=function(e){return Array.isArray(e)?"("+e.join(" | ")+")":t(e)?"RegExp("+e.toString():e.toString()},r.i=function(e){try{if(e===window)return!0}catch(e){if(e&&e.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(e))return!0}catch(e){if(e&&e.message===i)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===i)return!0}try{e&&e.__cross_domain_utils_window_check__}catch(e){return!0}return!1};var o={MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",ABOUT_PROTOCOL:"about:",WILDCARD:"*"},i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.ABOUT_PROTOCOL}function s(e){if(e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}function c(e){if(e&&!s(e))try{return e.opener}catch(e){}}function u(e){try{return e&&e.location&&e.location.href,!0}catch(e){}return!1}function f(e){var r=(e=e||window).location;if(!r)throw new Error("Can not read window location");var n=r.protocol;if(!n)throw new Error("Can not read window protocol");if(n===o.FILE_PROTOCOL)return o.FILE_PROTOCOL+"//";if(n===o.ABOUT_PROTOCOL){var t=s(e);return t&&u(t)?f(t):o.ABOUT_PROTOCOL+"//"}var i=r.host;if(!i)throw new Error("Can not read window host");return n+"//"+i}function d(e){var r=f(e=e||window);return r&&e.mockDomain&&0===e.mockDomain.indexOf(o.MOCK_PROTOCOL)?e.mockDomain:r}function l(e){try{if(e===window)return!0}catch(e){}try{var r=Object.getOwnPropertyDescriptor(e,"location");if(r&&!1===r.enumerable)return!1}catch(e){}try{if(a(e)&&u(e))return!0}catch(e){}try{if(f(e)===f(window))return!0}catch(e){}return!1}function w(e,r){if(!e||!r)return!1;var n=s(r);return n?n===e:-1!==function(e){var r=[];try{for(;e.parent!==e;)r.push(e.parent),e=e.parent}catch(e){}return r}(r).indexOf(e)}function h(e){var r=[],n=void 0;try{n=e.frames}catch(r){n=e}var t=void 0;try{t=n.length}catch(e){}if(0===t)return r;if(t){for(var o=0;o<t;o++){var i=void 0;try{i=n[o]}catch(e){continue}r.push(i)}return r}for(var a=0;a<100;a++){var s=void 0;try{s=n[a]}catch(e){return r}if(!s)return r;r.push(s)}return r}var p=[],m=[];function _(e){return c(e=e||window)||s(e)||void 0}},function(e,r){}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("postRobot",[],n):"object"==typeof exports?exports.postRobot=n():e.postRobot=n()}("undefined"!=typeof self?self:this,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=8)}([function(e,n,t){"use strict";var r=t(9);t.d(n,"getActualDomain",function(){return r.a}),t.d(n,"getAncestor",function(){return r.b}),t.d(n,"getDomain",function(){return r.c}),t.d(n,"getUserAgent",function(){return r.d}),t.d(n,"isActuallySameDomain",function(){return r.e}),t.d(n,"isAncestor",function(){return r.f}),t.d(n,"isIframe",function(){return r.g}),t.d(n,"isPopup",function(){return r.h}),t.d(n,"isWindow",function(){return r.i}),t.d(n,"isWindowClosed",function(){return r.j}),t.d(n,"linkFrameWindow",function(){return r.k}),t.d(n,"matchDomain",function(){return r.l}),t.d(n,"stringifyDomainPattern",function(){return r.m});var o=t(10);t.n(o)},function(e,n,t){"use strict";function r(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var t=n.call(e);if("[object Window]"===t||"[object global]"===t||"[object DOMWindow]"===t)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}function o(){var e=void 0;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");e=window}var n=e.__zalgopromise__=e.__zalgopromise__||{};return n.flushPromises=n.flushPromises||[],n.activeCount=n.activeCount||0,n.possiblyUnhandledPromiseHandlers=n.possiblyUnhandledPromiseHandlers||[],n.dispatchedErrors=n.dispatchedErrors||[],n}var i=function(){function e(n){var t=this;if(function(n,t){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],n){var r=void 0,o=void 0,i=!1,a=!1,c=!1;try{n(function(e){c?t.resolve(e):(i=!0,r=e)},function(e){c?t.reject(e):(a=!0,o=e)})}catch(e){return void this.reject(e)}c=!0,i?this.resolve(r):a&&this.reject(o)}}return e.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(r(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},e.prototype.reject=function(e){var n=this;if(this.resolved||this.rejected)return this;if(r(e))throw new Error("Can not reject promise with another promise");if(!e){var t=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e);e=new Error("Expected reject to be called with Error, got "+t)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){n.errorHandled||function(e,n){if(-1===o().dispatchedErrors.indexOf(e)){o().dispatchedErrors.push(e),setTimeout(function(){throw e},1);for(var t=0;t<o().possiblyUnhandledPromiseHandlers.length;t++)o().possiblyUnhandledPromiseHandlers[t](e,n)}}(e,n)},1),this.dispatch(),this},e.prototype.asyncReject=function(e){this.errorHandled=!0,this.reject(e)},e.prototype.dispatch=function(){var n=this,t=this.dispatching,i=this.resolved,a=this.rejected,c=this.handlers;if(!t&&(i||a)){this.dispatching=!0,o().activeCount+=1;for(var u=function(t){var o=c[t],u=o.onSuccess,s=o.onError,f=o.promise,d=void 0;if(i)try{d=u?u(n.value):n.value}catch(e){return f.reject(e),"continue"}else if(a){if(!s)return f.reject(n.error),"continue";try{d=s(n.error)}catch(e){return f.reject(e),"continue"}}d instanceof e&&(d.resolved||d.rejected)?(d.resolved?f.resolve(d.value):f.reject(d.error),d.errorHandled=!0):r(d)?d instanceof e&&(d.resolved||d.rejected)?d.resolved?f.resolve(d.value):f.reject(d.error):d.then(function(e){f.resolve(e)},function(e){f.reject(e)}):f.resolve(d)},s=0;s<c.length;s++)u(s);c.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&e.flushQueue()}},e.prototype.then=function(n,t){if(n&&"function"!=typeof n&&!n.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 e;return this.handlers.push({promise:r,onSuccess:n,onError:t}),this.errorHandled=!0,this.dispatch(),r},e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.finally=function(n){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.finally expected a function");return this.then(function(t){return e.try(n).then(function(){return t})},function(t){return e.try(n).then(function(){throw t})})},e.prototype.timeout=function(e,n){var t=this;if(this.resolved||this.rejected)return this;var r=setTimeout(function(){t.resolved||t.rejected||t.reject(n||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(e){return clearTimeout(r),e})},e.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(n){return n instanceof e?n:r(n)?new e(function(e,t){return n.then(e,t)}):(new e).resolve(n)},e.reject=function(n){return(new e).reject(n)},e.all=function(n){var t=new e,o=n.length,i=[];if(!o)return t.resolve(i),t;for(var a=function(a){var c=n[a];if(c instanceof e){if(c.resolved)return i[a]=c.value,o-=1,"continue"}else if(!r(c))return i[a]=c,o-=1,"continue";e.resolve(c).then(function(e){i[a]=e,0==(o-=1)&&t.resolve(i)},function(e){t.reject(e)})},c=0;c<n.length;c++)a(c);return 0===o&&t.resolve(i),t},e.hash=function(n){var t={};return e.all(Object.keys(n).map(function(r){return e.resolve(n[r]).then(function(e){t[r]=e})})).then(function(){return t})},e.map=function(n,t){return e.all(n.map(t))},e.onPossiblyUnhandledException=function(e){return function(e){return o().possiblyUnhandledPromiseHandlers.push(e),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(e),1)}}}(e)},e.try=function(n,t,r){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=n.apply(t,r||[])}catch(n){return e.reject(n)}return e.resolve(o)},e.delay=function(n){return new e(function(e){setTimeout(e,n)})},e.isPromise=function(n){return!!(n&&n instanceof e)||r(n)},e.flush=function(){var n=new e;return o().flushPromises.push(n),0===o().activeCount&&e.flushQueue(),n},e.flushQueue=function(){var e=o().flushPromises;o().flushPromises=[];for(var n=0,t=null==e?0:e.length;n<t;n++)e[n].resolve()},e}();t.d(n,"a",function(){return i})},function(e,n,t){"use strict";t(6);var r=t(5);t.d(n,"addEventListener",function(){return r.a}),t(11),t(12),t(13),t(7);var o=t(3);t.d(n,"isRegex",function(){return o.f}),t.d(n,"noop",function(){return o.h}),t.d(n,"once",function(){return o.i}),t.d(n,"replaceObject",function(){return o.m}),t.d(n,"safeInterval",function(){return o.n}),t.d(n,"stringifyError",function(){return o.p}),t.d(n,"uniqueID",function(){return o.r}),t(14);var i=t(15);t.n(i),t(16),t(17)},function(e,n,t){"use strict";n.r=c,n.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")},n.g=function(e){var n=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new o.a;function i(){for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];var c=r.getOrSet(t.thisNamespace?this:e,function(){return{}}),u=s(o),f=t.time;if(c[u]&&f&&Date.now()-c[u].time<f&&delete c[u],c[u])return c[u].value;i.__calling__=!0;var d=Date.now(),l=e.apply(this,arguments);return i.__calling__=!1,c[u]={time:d,value:l},c[u].value}return i.reset=function(){r.delete(t.thisNamespace?n:e)},t.name&&(i.displayName=t.name+":memoized"),i},n.j=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function t(){return r.a.try(e,this,arguments)}return n.name&&(t.displayName=n.name+":promisified"),t},n.e=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=e.__inline_memoize_cache__=e.__inline_memoize_cache__||{},o=s(t);return r.hasOwnProperty(o)?r[o]:r[o]=n.apply(void 0,t)},n.h=function(){},n.i=function(e){var n=!1;return function(){if(!n)return n=!0,e.apply(this,arguments)}},n.p=function e(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(t>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+Object.prototype.toString.call(n)+">";if("string"==typeof n)return n;if(n instanceof Error){var r=n&&n.stack,o=n&&n.message;if(r&&o)return-1!==r.indexOf(o)?r:o+"\n"+r;if(r)return r;if(o)return o}return"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n)}catch(n){return"Error while stringifying error: "+e(n,t+1)}},n.o=function(e){return"string"==typeof e?e:e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)},n.c=function(e,n){if(!n)return e;if(Object.assign)return Object.assign(e,n);for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e},n.k=function(e,n,t){var r=[];return e.replace(n,function(e){r.push(t?t.apply(null,arguments):e)}),r},n.q=function(e){return"data:image/svg+xml;base64,"+a(e)},n.l=function(e,n){var t=[];return e.replace(n,function(e){return t.push(e),""}),t},n.n=function(e,n){var t=void 0;return function r(){t=setTimeout(function(){e(),r()},n)}(),{cancel:function(){clearTimeout(t)}}},n.a=function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},n.m=function e(n,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(Array.isArray(n)){for(var o=n.length,i=[],a=function(o){f(i,o,function(){var i=r?r+"."+o:""+o,a=n[o],c=t(a,o,i);return(l(c)||Array.isArray(c))&&(c=e(c,t,i)),c})},c=0;c<o;c++)a(c);return i}if(l(n)){var u={},s=function(o){if(!n.hasOwnProperty(o))return"continue";f(u,o,function(){var i=r?r+"."+o:""+o,a=n[o],c=t(a,o,i);return(l(c)||Array.isArray(c))&&(c=e(c,t,i)),c})};for(var d in n)s(d);return u}throw new Error("Pass an object or array")},n.b=function(e){var n=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 e.apply(r,o)},n)}},n.f=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)};var r=t(1),o=t(4),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function a(e){return window.btoa(e)}function c(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+a((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var u=void 0;function s(e){try{return JSON.stringify(Array.prototype.slice.call(e),function(e,n){return"function"==typeof n?"memoize["+function(e){if(u=u||new o.a,null===e||void 0===e||"object"!==(void 0===e?"undefined":i(e))&&"function"!=typeof e)throw new Error("Invalid object");var n=u.get(e);return n||(n=(void 0===e?"undefined":i(e))+":"+c(),u.set(e,n)),n}(n)+"]":n})}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}}function f(e,n,t){if(Array.isArray(e)){if("number"!=typeof n)throw new TypeError("Array key must be number")}else if("object"===(void 0===e?"undefined":i(e))&&null!==e&&"string"!=typeof n)throw new TypeError("Object key must be string");Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){delete e[n];var r=t();return e[n]=r,r},set:function(t){delete e[n],e[n]=t}})}function d(e){return"object"===(void 0===(n=e)?"undefined":i(n))&&null!==n&&"[object Object]"===Object.prototype.toString.call(e);var n}function l(e){if(!d(e))return!1;var n=e.constructor;if("function"!=typeof n)return!1;var t=n.prototype;return!!d(t)&&!!t.hasOwnProperty("isPrototypeOf")}},function(e,n,t){"use strict";t.d({},"WeakMap",function(){return c});var r=t(0);function o(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch(e){}return-1}var i=Object.defineProperty,a=Date.now()%1e9,c=function(){function e(){if(function(n,t){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this),a+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+a,function(){if(!window.WeakMap)return!1;if(!window.Object.freeze)return!1;try{var e=new window.WeakMap,n={};return window.Object.freeze(n),e.set(n,"__testvalue__"),"__testvalue__"===e.get(n)}catch(e){return!1}}())try{this.weakmap=new window.WeakMap}catch(e){}this.keys=[],this.values=[]}return e.prototype._cleanupClosedWindows=function(){for(var e=this.weakmap,n=this.keys,t=0;t<n.length;t++){var o=n[t];if(Object(r.isWindow)(o)&&Object(r.isWindowClosed)(o)){if(e)try{e.delete(o)}catch(e){}n.splice(t,1),this.values.splice(t,1),t-=1}}},e.prototype.isSafeToReadWrite=function(e){if(Object(r.isWindow)(e))return!1;try{e&&e.self,e&&e[this.name]}catch(e){return!1}return!0},e.prototype.set=function(e,n){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.set(e,n)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var r=this.name,a=e[r];a&&a[0]===e?a[1]=n:i(e,r,{value:[e,n],writable:!0})}else{this._cleanupClosedWindows();var c=this.keys,u=this.values,s=o(c,e);-1===s?(c.push(e),u.push(n)):u[s]=n}},e.prototype.get=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{if(n.has(e))return n.get(e)}catch(e){delete this.weakmap}if(!this.isSafeToReadWrite(e)){this._cleanupClosedWindows();var t=o(this.keys,e);if(-1===t)return;return this.values[t]}var r=e[this.name];if(r&&r[0]===e)return r[1]},e.prototype.delete=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var t=e[this.name];t&&t[0]===e&&(t[0]=t[1]=void 0)}else{this._cleanupClosedWindows();var r=this.keys,i=o(r,e);-1!==i&&(r.splice(i,1),this.values.splice(i,1))}},e.prototype.has=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{return n.has(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var t=e[this.name];return!(!t||t[0]!==e)}return this._cleanupClosedWindows(),-1!==o(this.keys,e)},e.prototype.getOrSet=function(e,n){if(this.has(e))return this.get(e);var t=n();return this.set(e,t),t},e}();t.d(n,"a",function(){return c})},function(e,n,t){"use strict";t(1),t(0),t(4);var r=t(3);t(6),n.d=function e(){return Object(r.e)(e,function(){try{if("undefined"==typeof window)return!1;if(window.localStorage){var e=Math.random().toString();window.localStorage.setItem("__test__localStorage__",e);var n=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),e===n)return!0}}catch(e){}return!1})},n.b=function(e,n){e.appendChild(n)},n.g=function(e,n){try{e.document.open(),e.document.write(n),e.document.close()}catch(t){try{e.location="javascript: document.open(); document.write("+JSON.stringify(n)+"); document.close();"}catch(e){}}},n.f=function(e,n){var t=n.tagName.toLowerCase();if("html"!==t)throw new Error("Expected element to be html, got "+t);for(var r=e.document.documentElement;r.children&&r.children.length;)r.removeChild(r.children[0]);for(;n.children.length;)r.appendChild(n.children[0])},n.e=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.document;e.styleSheet?e.styleSheet.cssText=n:e.appendChild(t.createTextNode(n))},n.a=function(e,n,t){return e.addEventListener(n,t),{cancel:function(){e.removeEventListener(n,t)}}},n.c=function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document,t=0,r=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document;return Array.prototype.slice.call(n.querySelectorAll(e))}("script",e),o=null==r?0:r.length;t<o;t++){var i=r[t],a=i.parentNode;if(a){var c=n.createElement("script");c.text=i.textContent,a.replaceChild(c,i)}}},"function"==typeof Symbol&&Symbol.iterator,Object.assign,Object.create(Error.prototype)},function(e,n,t){"use strict";n.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(e,n,t){"use strict";n.a=function e(n){var t=n.name,i=n.version,a=void 0===i?"latest":i,c=n.lifetime,u=void 0===c?3e5:c;return Object(r.e)(e,function(){var e="__"+t+"_"+a+"_storage__",n=void 0;function i(t){var i=Object(o.d)(),a=void 0;if(n&&(a=n),!a&&i){var c=window.localStorage.getItem(e);c&&(a=JSON.parse(c))}a||(a=Object(r.d)()[e]),a||(a={id:Object(r.r)()}),a.id||(a.id=Object(r.r)()),n=a;var u=t(a);return i?window.localStorage.setItem(e,JSON.stringify(a)):Object(r.d)()[e]=a,n=null,u}function c(e){return i(function(n){var t=n.__session__,o=Date.now();return t&&o-t.created>u&&(t=null),t||(t={guid:Object(r.r)(),created:o}),n.__session__=t,e(t)})}return{getState:i,getID:function(){return i(function(e){return e.id})},getSessionState:function(e){return c(function(n){return n.state=n.state||{},e(n.state)})},getSessionID:function(){return c(function(e){return e.guid})}}},[{name:t,version:a,lifetime:u}])};var r=t(3),o=t(5)},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={};t.d(r,"cleanUpWindow",function(){return Y}),t.d(r,"Promise",function(){return f.a}),t.d(r,"bridge",function(){return K}),t.d(r,"init",function(){return Z}),t.d(r,"parent",function(){return F}),t.d(r,"send",function(){return M}),t.d(r,"request",function(){return C}),t.d(r,"sendToParent",function(){return N}),t.d(r,"client",function(){return x}),t.d(r,"on",function(){return U}),t.d(r,"listen",function(){return G}),t.d(r,"once",function(){return H}),t.d(r,"listener",function(){return q}),t.d(r,"CONFIG",function(){return u}),t.d(r,"CONSTANTS",function(){return a}),t.d(r,"disable",function(){return B});var o,i=t(0),a={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",HELLO:"postrobot_ready",OPEN_TUNNEL:"postrobot_open_tunnel"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method",ERROR:"postrobot_error",PROMISE:"postrobot_promise",ZALGO_PROMISE:"postrobot_zalgo_promise",REGEX:"regex"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",BRIDGE:"postrobot_bridge",GLOBAL:"postrobot_global"},MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",BRIDGE_NAME_PREFIX:"__postrobot_bridge__",POSTROBOT_PROXY:"__postrobot_proxy__",WILDCARD:"*"},c={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},u=(Object.keys(c).map(function(e){return c[e]}),{ALLOW_POSTMESSAGE_POPUP:!("__ALLOW_POSTMESSAGE_POPUP__"in window)||window.__ALLOW_POSTMESSAGE_POPUP__,BRIDGE_TIMEOUT:5e3,CHILD_WINDOW_TIMEOUT:5e3,ACK_TIMEOUT:-1!==window.navigator.userAgent.match(/MSIE/i)?2e3:1e3,RES_TIMEOUT:-1,ALLOWED_POST_MESSAGE_METHODS:(o={},o[a.SEND_STRATEGIES.POST_MESSAGE]=!0,o[a.SEND_STRATEGIES.BRIDGE]=!0,o[a.SEND_STRATEGIES.GLOBAL]=!0,o),ALLOW_SAME_ORIGIN:!1});0===window.location.href.indexOf(a.FILE_PROTOCOL)&&(u.ALLOW_POSTMESSAGE_POPUP=!0);var s=t(4),f=t(1),d=t(2),l=window[a.WINDOW_PROPS.POSTROBOT]=window[a.WINDOW_PROPS.POSTROBOT]||{};l.registerSelf=function(){};var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};l.methods=l.methods||new s.a;var h=Object(d.once)(function(){l.on(a.POST_MESSAGE_NAMES.METHOD,{origin:a.WILDCARD},function(e){var n=e.source,t=e.origin,r=e.data,o=l.methods.get(n);if(!o)throw new Error("Could not find any methods this window has privileges to call");var a=o[r.id];if(!a)throw new Error("Could not find method with id: "+r.id);if(!Object(i.matchDomain)(a.domain,t))throw new Error("Method domain "+a.domain+" does not match origin "+t);return f.a.try(function(){return a.method.apply({source:n,origin:t,data:r},r.args)}).then(function(e){return{result:e,id:r.id,name:r.name}})})});function w(e,n){return"object"===(void 0===e?"undefined":p(e))&&null!==e&&e.__type__===n}function m(e,n,t,r){var o=Object(d.uniqueID)(),i=l.methods.get(e);return i||(i={},l.methods.set(e,i)),i[o]={domain:n,method:t},{__type__:a.SERIALIZATION_TYPES.METHOD,__id__:o,__name__:r}}function y(e,n,t){function r(){var r=Array.prototype.slice.call(arguments);return l.send(e,a.POST_MESSAGE_NAMES.METHOD,{id:t.__id__,name:t.__name__,args:r},{domain:n,timeout:-1}).then(function(e){return e.data.result},function(e){throw e})}return r.__name__=t.__name__,r.__xdomain__=!0,r.source=e,r.origin=n,r}function _(e,n,t){return new f.a(function(r,o){return y(e,n,t.__then__)(r,o)})}function v(e){return l.send(e,a.POST_MESSAGE_NAMES.HELLO,{},{domain:a.WILDCARD,timeout:-1}).then(function(e){return{origin:e.origin}})}l.readyPromises=l.readyPromises||new s.a;var O={};O[a.SEND_STRATEGIES.POST_MESSAGE]=function(e,n,t){(Array.isArray(t)?t:"string"==typeof t?[t]:[a.WILDCARD]).map(function(n){if(0===n.indexOf(a.MOCK_PROTOCOL)){if(window.location.protocol===a.FILE_PROTOCOL)return a.WILDCARD;if(!Object(i.isActuallySameDomain)(e))throw new Error("Attempting to send messsage to mock domain "+n+", but window is actually cross-domain");return Object(i.getActualDomain)(e)}return 0===n.indexOf(a.FILE_PROTOCOL)?a.WILDCARD:n}).forEach(function(t){return e.postMessage(n,t)})};var g=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};function E(e,n,t){return f.a.try(function(){var r;if(n=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Object(d.uniqueID)(),o=Object(i.isPopup)()?a.WINDOW_TYPES.POPUP:Object(i.isIframe)()?a.WINDOW_TYPES.IFRAME:a.WINDOW_TYPES.FULLPAGE,c=Object(i.getDomain)(window);return g({},n,t,{sourceDomain:c,id:n.id||r,windowType:o})}(e,n,{data:function(e,n,t){return Object(d.replaceObject)({obj:t},function(t,r){return"function"==typeof t?m(e,n,t,r.toString()):t instanceof Error?(o=t,{__type__:a.SERIALIZATION_TYPES.ERROR,__message__:Object(d.stringifyError)(o),__code__:o.code}):window.Promise&&t instanceof window.Promise?function(e,n,t,r){return{__type__:a.SERIALIZATION_TYPES.PROMISE,__then__:m(e,n,function(e,n){return t.then(e,n)},r+".then")}}(e,n,t,r.toString()):f.a.isPromise(t)?function(e,n,t,r){return{__type__:a.SERIALIZATION_TYPES.ZALGO_PROMISE,__then__:m(e,n,function(e,n){return t.then(e,n)},r+".then")}}(e,n,t,r.toString()):Object(d.isRegex)(t)?(i=t,{__type__:a.SERIALIZATION_TYPES.REGEX,__source__:i.source}):t;var o,i}).obj}(e,t,n.data),domain:t}),e===window&&!u.ALLOW_SAME_ORIGIN)throw new Error("Attemping to send message to self");if(Object(i.isWindowClosed)(e))throw new Error("Window is closed");var o=[],c=JSON.stringify(((r={})[a.WINDOW_PROPS.POSTROBOT]=n,r),null,2);return f.a.map(Object.keys(O),function(n){return f.a.try(function(){if(!u.ALLOWED_POST_MESSAGE_METHODS[n])throw new Error("Strategy disallowed: "+n);return O[n](e,c,t)}).then(function(){return o.push(n+": success"),!0},function(e){return o.push(n+": "+Object(d.stringifyError)(e)+"\n"),!1})}).then(function(e){var t=e.some(Boolean),r=n.type+" "+n.name+" "+(t?"success":"error")+":\n - "+o.join("\n - ")+"\n";if(!t)throw new Error(r)})})}l.responseListeners=l.responseListeners||{},l.requestListeners=l.requestListeners||{},l.WINDOW_WILDCARD=l.WINDOW_WILDCARD||new function(){},l.erroredResponseListeners=l.erroredResponseListeners||{};var S,b="__domain_regex__";function P(e){return l.responseListeners[e]}function T(e){delete l.responseListeners[e]}function A(e){return Boolean(l.erroredResponseListeners[e])}function j(e){var n=e.name,t=e.win,r=e.domain;if(t===a.WILDCARD&&(t=null),r===a.WILDCARD&&(r=null),!n)throw new Error("Name required to get request listener");var o=l.requestListeners[n];if(o)for(var c=0,u=[t,l.WINDOW_WILDCARD],s=null==u?0:u.length;c<s;c++){var f=u[c],d=f&&o.get(f);if(d){if(r&&"string"==typeof r){if(d[r])return d[r];if(d[b])for(var p=0,h=d[b],w=null==h?0:h.length;p<w;p++){var m=h[p],y=m.regex,_=m.listener;if(Object(i.matchDomain)(y,r))return _}}if(d[a.WILDCARD])return d[a.WILDCARD]}}}var R=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},I=((S={})[a.POST_MESSAGE_TYPE.ACK]=function(e,n,t){if(!A(t.hash)){var r=P(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(r.domain,n))throw new Error("Ack origin "+n+" does not match domain "+r.domain.toString());r.ack=!0}},S[a.POST_MESSAGE_TYPE.REQUEST]=function(e,n,t){var r=j({name:t.name,win:e,domain:n});function o(r){return t.fireAndForget||Object(i.isWindowClosed)(e)?f.a.resolve():E(e,R({target:t.originalSource,hash:t.hash,name:t.name},r),n)}return f.a.all([o({type:a.POST_MESSAGE_TYPE.ACK}),f.a.try(function(){if(!r)throw new Error("No handler found for post message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(r.domain,n))throw new Error("Request origin "+n+" does not match domain "+r.domain.toString());var o=t.data;return r.handler({source:e,origin:n,data:o})}).then(function(e){return o({type:a.POST_MESSAGE_TYPE.RESPONSE,ack:a.POST_MESSAGE_ACK.SUCCESS,data:e})},function(e){var n=Object(d.stringifyError)(e).replace(/^Error: /,""),t=e.code;return o({type:a.POST_MESSAGE_TYPE.RESPONSE,ack:a.POST_MESSAGE_ACK.ERROR,error:n,code:t})})]).then(d.noop).catch(function(e){if(r&&r.handleError)return r.handleError(e);throw e})},S[a.POST_MESSAGE_TYPE.RESPONSE]=function(e,n,t){if(!A(t.hash)){var r=P(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Object(i.matchDomain)(r.domain,n))throw new Error("Response origin "+n+" does not match domain "+Object(i.stringifyDomainPattern)(r.domain));if(T(t.hash),t.ack===a.POST_MESSAGE_ACK.ERROR){var o=new Error(t.error);return t.code&&(o.code=t.code),r.respond(o,null)}if(t.ack===a.POST_MESSAGE_ACK.SUCCESS){var c=t.data||t.response;return r.respond(null,{source:e,origin:n,data:c})}}},S),D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function W(e){if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!e.source)return}catch(e){return}var n=e.source,t=e.origin,r=function(e){var n=void 0;try{n=JSON.parse(e)}catch(e){return}if(n&&"object"===(void 0===n?"undefined":D(n))&&null!==n&&(n=n[a.WINDOW_PROPS.POSTROBOT])&&"object"===(void 0===n?"undefined":D(n))&&null!==n&&n.type&&"string"==typeof n.type&&I[n.type])return n}(e.data);if(r){if(!r.sourceDomain||"string"!=typeof r.sourceDomain)throw new Error("Expected message to have sourceDomain");0!==r.sourceDomain.indexOf(a.MOCK_PROTOCOL)&&0!==r.sourceDomain.indexOf(a.FILE_PROTOCOL)||(t=r.sourceDomain),-1===l.receivedMessages.indexOf(r.id)&&(l.receivedMessages.push(r.id),Object(i.isWindowClosed)(n)&&!r.fireAndForget||(r.data&&(r.data=function(e,n,t){return Object(d.replaceObject)({obj:t},function(t){return"object"!==(void 0===t?"undefined":p(t))||null===t?t:w(t,a.SERIALIZATION_TYPES.METHOD)?y(e,n,t):w(t,a.SERIALIZATION_TYPES.ERROR)?(r=t,o=new Error(r.__message__),r.__code__&&(o.code=r.__code__),o):w(t,a.SERIALIZATION_TYPES.PROMISE)?function(e,n,t){return window.Promise?new window.Promise(function(r,o){return y(e,n,t.__then__)(r,o)}):_(e,n,t)}(e,n,t):w(t,a.SERIALIZATION_TYPES.ZALGO_PROMISE)?_(e,n,t):w(t,a.SERIALIZATION_TYPES.REGEX)?function(e,n,t){return new RegExp(t.__source__)}(0,0,t):t;var r,o}).obj}(n,t,r.data)),I[r.type](n,t,r)))}}function L(e){try{Object(d.noop)(e.source)}catch(e){return}W({source:e.source||e.sourceElement,origin:e.origin||e.originalEvent&&e.originalEvent.origin,data:e.data})}function C(e){return f.a.try(function(){if(!e.name)throw new Error("Expected options.name");var n=e.name,t=void 0,r=void 0;if("string"==typeof e.window){var o=document.getElementById(e.window);if(!o)throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be a valid element id");if("iframe"!==o.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.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(e.window instanceof HTMLIFrameElement){if("iframe"!==e.window.tagName.toLowerCase())throw new Error("Expected options.window "+Object.prototype.toString.call(e.window)+" to be an iframe");if(e.window&&!e.window.contentWindow)throw new Error("Iframe must have contentWindow. Make sure it has a src attribute and is in the DOM.");e.window&&e.window.contentWindow&&(t=e.window.contentWindow)}else t=e.window;if(!t)throw new Error("Expected options.window to be a window object, iframe, or iframe element id.");var c=t;r=e.domain||a.WILDCARD;var s=e.name+"_"+Object(d.uniqueID)();if(Object(i.isWindowClosed)(c))throw new Error("Target window is closed");var p=!1,h=l.requestPromises.get(c);h||(h=[],l.requestPromises.set(c,h));var w=f.a.try(function(){if(Object(i.isAncestor)(window,c))return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Window",r=l.readyPromises.get(e);return r||(r=new f.a,l.readyPromises.set(e,r),-1!==n&&setTimeout(function(){return r.reject(new Error(t+" did not load after "+n+"ms"))},n),r)}(c,e.timeout||u.CHILD_WINDOW_TIMEOUT)}).then(function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(Object(d.isRegex)(r)&&!e)return v(c)}).then(function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).origin;if(Object(d.isRegex)(r)){if(!Object(i.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 f.a(function(t,r){var f=void 0;if(e.fireAndForget||function(e,n){l.responseListeners[e]=n}(s,f={name:n,window:c,domain:o,respond:function(e,n){e||(p=!0,h.splice(h.indexOf(w,1))),e?r(e):t(n)}}),E(c,{type:a.POST_MESSAGE_TYPE.REQUEST,hash:s,name:n,data:e.data,fireAndForget:e.fireAndForget},o).catch(r),e.fireAndForget)return t();var d=u.ACK_TIMEOUT,m=e.timeout||u.RES_TIMEOUT,y=100;setTimeout(function t(){if(!p){if(Object(i.isWindowClosed)(c))return f.ack?r(new Error("Window closed for "+n+" before response")):r(new Error("Window closed for "+n+" before ack"));if(d=Math.max(d-y,0),-1!==m&&(m=Math.max(m-y,0)),f.ack){if(-1===m)return;y=Math.min(m,2e3)}else{if(0===d)return r(new Error("No ack for postMessage "+n+" in "+Object(i.getDomain)()+" in "+u.ACK_TIMEOUT+"ms"));if(0===m)return r(new Error("No response for postMessage "+n+" in "+Object(i.getDomain)()+" in "+(e.timeout||u.RES_TIMEOUT)+"ms"))}setTimeout(t,y)}},y)})});return w.catch(function(){!function(e){l.erroredResponseListeners[e]=!0}(s),T(s)}),h.push(w),w})}function M(e,n,t,r){return(r=r||{}).window=e,r.name=n,r.data=t,C(r)}function N(e,n,t){var r=Object(i.getAncestor)();return r?M(r,e,n,t):new f.a(function(e,n){return n(new Error("Window does not have a parent"))})}function x(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.window)throw new Error("Expected options.window");var n=e.window;return{send:function(t,r){return M(n,t,r,e)}}}l.receivedMessages=l.receivedMessages||[],l.receiveMessage=W,l.requestPromises=l.requestPromises||new s.a,l.send=M;var k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function G(e){if(!e.name)throw new Error("Expected options.name");if(!e.handler)throw new Error("Expected options.handler");var n=e.name,t=e.window,r=e.domain,o={handler:e.handler,handleError:e.errorHandler||function(e){throw e},window:t,domain:r||a.WILDCARD,name:n},c=function e(n,t){var r=n.name,o=n.win,i=n.domain;if(!r||"string"!=typeof r)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var c=[],u=0,f=o,p=null==f?0:f.length;u<p;u++){var h=f[u];c.push(e({name:r,domain:i,win:h},t))}return{cancel:function(){for(var e=0,n=null==c?0:c.length;e<n;e++)c[e].cancel()}}}if(Array.isArray(i)){for(var w=[],m=0,y=i,_=null==y?0:y.length;m<_;m++){var v=y[m];w.push(e({name:r,win:o,domain:v},t))}return{cancel:function(){for(var e=0,n=null==w?0:w.length;e<n;e++)w[e].cancel()}}}var O=j({name:r,win:o,domain:i});if(o&&o!==a.WILDCARD||(o=l.WINDOW_WILDCARD),i=i||a.WILDCARD,O)throw o&&i?new Error("Request listener already exists for "+r+" on domain "+i.toString()+" for "+(o===l.WINDOW_WILDCARD?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+r+" for "+(o===l.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 g=l.requestListeners,E=g[r];E||(E=new s.a,g[r]=E);var S=E.get(o);S||(S={},E.set(o,S));var P=i.toString(),T=S[b],A=void 0;return Object(d.isRegex)(i)?(T||(T=[],S[b]=T),A={regex:i,listener:t},T.push(A)):S[P]=t,{cancel:function(){S&&(delete S[P],o&&0===Object.keys(S).length&&E.delete(o),A&&T.splice(T.indexOf(A,1)))}}}({name:n,win:t,domain:r},o);if(e.once){var u=o.handler;o.handler=Object(d.once)(function(){return c.cancel(),u.apply(this,arguments)})}if(o.window&&e.errorOnClose)var f=Object(d.safeInterval)(function(){t&&"object"===(void 0===t?"undefined":k(t))&&Object(i.isWindowClosed)(t)&&(f.cancel(),o.handleError(new Error("Post message target window is closed")))},50);return{cancel:function(){c.cancel()}}}function U(e,n,t){return"function"==typeof n&&(t=n,n={}),(n=n||{}).name=e,n.handler=t||n.handler,G(n)}function H(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments[2];"function"==typeof n&&(t=n,n={}),n=n||{},t=t||n.handler;var r=n.errorHandler,o=new f.a(function(o,i){(n=n||{}).name=e,n.once=!0,n.handler=function(e){if(o(e),t)return t(e)},n.errorHandler=function(e){if(i(e),r)return r(e)}}),i=G(n);return o.cancel=i.cancel,o}function q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{on:function(n,t){return U(n,e,t)}}}function B(){delete window[a.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",L)}l.on=U;var F=Object(i.getAncestor)();function Y(e){var n=l.requestPromises.get(e);if(n)for(var t=0,r=null==n?0:n.length;t<r;t++)n[t].reject(new Error("No response from window - cleaned up"));l.popupWindowsByWin&&l.popupWindowsByWin.delete(e),l.remoteWindows&&l.remoteWindows.delete(e),l.requestPromises.delete(e),l.methods.delete(e),l.readyPromises.delete(e)}var K=null;function Z(){l.initialized||(Object(d.addEventListener)(window,"message",L),function(){var e;e=function(e){var n=e.source,t=e.origin,r=l.readyPromises.get(n)||new f.a;r.resolve({origin:t}),l.readyPromises.set(n,r)},l.on(a.POST_MESSAGE_NAMES.HELLO,{domain:a.WILDCARD},function(n){var t=n.source,r=n.origin;return e({source:t,origin:r})});var n=Object(i.getAncestor)();n&&v(n).catch(d.noop)}(),h({on:U,send:M})),l.initialized=!0}Z(),t.d(n,"cleanUpWindow",function(){return Y}),t.d(n,"Promise",function(){return f.a}),t.d(n,"bridge",function(){return K}),t.d(n,"init",function(){return Z}),t.d(n,"parent",function(){return F}),t.d(n,"send",function(){return M}),t.d(n,"request",function(){return C}),t.d(n,"sendToParent",function(){return N}),t.d(n,"client",function(){return x}),t.d(n,"on",function(){return U}),t.d(n,"listen",function(){return G}),t.d(n,"once",function(){return H}),t.d(n,"listener",function(){return q}),t.d(n,"CONFIG",function(){return u}),t.d(n,"CONSTANTS",function(){return a}),t.d(n,"disable",function(){return B}),n.default=r},function(e,n,t){"use strict";function r(e){return"[object RegExp]"===Object.prototype.toString.call(e)}n.a=f,n.c=d,n.e=l,n.j=_,n.k=function(e){if(function(){for(var e=0;e<y.length;e++)w(y[e])&&(y.splice(e,1),m.splice(e,1));for(var n=0;n<m.length;n++)_(m[n])&&(y.splice(n,1),m.splice(n,1))}(),e&&e.contentWindow)try{m.push(e.contentWindow),y.push(e)}catch(e){}},n.d=function(e){return(e=e||window).navigator.mockUserAgent||e.navigator.userAgent},n.b=v,n.f=function(e,n){var t=v(n);if(t)return t===e;if(n===e)return!1;if(function(e){if(e){try{if(e.top)return e.top}catch(e){}if(c(e)===e)return e;try{if(p(window,e)&&window.top)return window.top}catch(e){}try{if(p(e,window)&&window.top)return window.top}catch(e){}for(var n=0,t=function e(n){for(var t=[],r=0,o=h(n),i=null==o?0:o.length;r<i;r++){var a=o[r];t.push(a);for(var c=0,u=e(a),s=null==u?0:u.length;c<s;c++){var f=u[c];t.push(f)}}return t}(e),r=null==t?0:t.length;n<r;n++){var o=t[n];try{if(o.top)return o.top}catch(e){}if(c(o)===o)return o}}}(n)===n)return!1;for(var r=0,o=h(e),i=null==o?0:o.length;r<i;r++)if(o[r]===n)return!0;return!1},n.h=function(){return Boolean(u(window))},n.g=function(){return Boolean(c(window))},n.l=function e(n,t){if("string"==typeof n){if("string"==typeof t)return n===o.WILDCARD||t===n;if(r(t))return!1;if(Array.isArray(t))return!1}return r(n)?r(t)?n.toString()===t.toString():!Array.isArray(t)&&Boolean(t.match(n)):!!Array.isArray(n)&&(Array.isArray(t)?JSON.stringify(n)===JSON.stringify(t):!r(t)&&n.some(function(n){return e(n,t)}))},n.m=function(e){return Array.isArray(e)?"("+e.join(" | ")+")":r(e)?"RegExp("+e.toString():e.toString()},n.i=function(e){try{if(e===window)return!0}catch(e){if(e&&e.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(e))return!0}catch(e){if(e&&e.message===i)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===i)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===i)return!0}try{e&&e.__cross_domain_utils_window_check__}catch(e){return!0}return!1};var o={MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",ABOUT_PROTOCOL:"about:",WILDCARD:"*"},i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===o.ABOUT_PROTOCOL}function c(e){if(e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}function u(e){if(e&&!c(e))try{return e.opener}catch(e){}}function s(e){try{return e&&e.location&&e.location.href,!0}catch(e){}return!1}function f(e){var n=(e=e||window).location;if(!n)throw new Error("Can not read window location");var t=n.protocol;if(!t)throw new Error("Can not read window protocol");if(t===o.FILE_PROTOCOL)return o.FILE_PROTOCOL+"//";if(t===o.ABOUT_PROTOCOL){var r=c(e);return r&&s(r)?f(r):o.ABOUT_PROTOCOL+"//"}var i=n.host;if(!i)throw new Error("Can not read window host");return t+"//"+i}function d(e){var n=f(e=e||window);return n&&e.mockDomain&&0===e.mockDomain.indexOf(o.MOCK_PROTOCOL)?e.mockDomain:n}function l(e){try{if(e===window)return!0}catch(e){}try{var n=Object.getOwnPropertyDescriptor(e,"location");if(n&&!1===n.enumerable)return!1}catch(e){}try{if(a(e)&&s(e))return!0}catch(e){}try{if(f(e)===f(window))return!0}catch(e){}return!1}function p(e,n){if(!e||!n)return!1;var t=c(n);return t?t===e:-1!==function(e){var n=[];try{for(;e.parent!==e;)n.push(e.parent),e=e.parent}catch(e){}return n}(n).indexOf(e)}function h(e){var n=[],t=void 0;try{t=e.frames}catch(n){t=e}var r=void 0;try{r=t.length}catch(e){}if(0===r)return n;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch(e){continue}n.push(i)}return n}for(var a=0;a<100;a++){var c=void 0;try{c=t[a]}catch(e){return n}if(!c)return n;n.push(c)}return n}function w(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var n=e.ownerDocument;return!(!n||!n.body||n.body.contains(e))}var m=[],y=[];function _(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==i}if(n&&function(e){if(!l(e))return!1;try{if(e===window)return!0;if(a(e)&&s(e))return!0;if(d(window)===d(e))return!0}catch(e){}return!1}(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var t=function(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch(e){}return-1}(m,e);if(-1!==t){var r=y[t];if(r&&w(r))return!0}return!1}function v(e){return u(e=e||window)||c(e)||void 0}},function(e,n){},function(e,n,t){"use strict";t(3),t(7)},function(e,n,t){"use strict";t(3)},function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function o(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}t(3),t(5),"function"==typeof Symbol&&Symbol.iterator,Object.assign,function(e){function n(t){return r(this,n),function(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}(this,e.call(this,"",{},t))}(function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)})(n,e),n.prototype.toString=function(){return this.childrenToString()}}(function(){function e(n,t,o){r(this,e),this.name=n,this.props=t,this.children=o}return e.prototype.toString=function(){var e=this.name,n=this.propsToString(),t=this.childrenToString();return"<"+e+(n?" ":"")+n+">"+t+"</"+e+">"},e.prototype.propsToString=function(){var e=this.props;return e?Object.keys(e).filter(function(n){return"innerHTML"!==n&&e&&!1!==e[n]}).map(function(n){if(e){var t=e[n];if(!0===t)return""+o(n);if("string"==typeof t)return o(n)+'="'+o(t)+'"'}return""}).filter(Boolean).join(" "):""},e.prototype.childrenToString=function(){if(this.props&&this.props.innerHTML)return this.props.innerHTML;if(!this.children)return"";var n="";return function t(r){for(var i=0,a=null==r?0:r.length;i<a;i++){var c=r[i];null!==c&&void 0!==c&&(Array.isArray(c)?t(c):n+=c instanceof e?c.toString():o(c))}}(this.children),n},e}())},function(e,n,t){"use strict";t(1),t(0)},function(e,n){},function(e,n,t){"use strict";t(3)},function(e,n,t){"use strict"}])}); | ||
//# sourceMappingURL=post-robot.min.js.map | ||
//# sourceMappingURL=post-robot.min.js.map |
{ | ||
"name": "post-robot", | ||
"version": "8.0.29", | ||
"version": "9.0.0", | ||
"description": "Simple postMessage based server.", | ||
@@ -56,2 +56,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"belter": "^1.0.41", | ||
"cross-domain-safe-weakmap": "^1.0.1", | ||
@@ -58,0 +59,0 @@ "cross-domain-utils": "^2.0.0", |
@@ -5,5 +5,5 @@ /* @flow */ | ||
import { getParent, isWindowClosed, type CrossDomainWindowType } from 'cross-domain-utils/src'; | ||
import { noop } from 'belter/src'; | ||
import { CONSTANTS } from '../conf'; | ||
import { noop } from '../lib'; | ||
import { global } from '../global'; | ||
@@ -10,0 +10,0 @@ |
@@ -5,5 +5,5 @@ /* @flow */ | ||
import { isSameDomain, getOpener, getFrames, getDomain, getFrameByName, type CrossDomainWindowType } from 'cross-domain-utils/src'; | ||
import { weakMapMemoize, noop } from 'belter/src'; | ||
import { CONSTANTS } from '../conf'; | ||
import { weakMapMemoize, noop } from '../lib'; | ||
import { global } from '../global'; | ||
@@ -10,0 +10,0 @@ |
@@ -6,5 +6,5 @@ /* @flow */ | ||
import { matchDomain, type CrossDomainWindowType } from 'cross-domain-utils/src'; | ||
import { isRegex } from 'belter/src'; | ||
import { global } from '../global'; | ||
import { isRegex } from '../lib'; | ||
import { CONSTANTS } from '../conf'; | ||
@@ -11,0 +11,0 @@ |
/* @flow */ | ||
import { isWindowClosed, type CrossDomainWindowType } from 'cross-domain-utils/src'; | ||
import { addEventListener, noop } from 'belter/src'; | ||
import { CONSTANTS, POST_MESSAGE_NAMES_LIST } from '../../conf'; | ||
import { deserializeMethods, jsonParse, addEventListener, noop } from '../../lib'; | ||
import { deserializeMethods } from '../../lib'; | ||
import { global } from '../../global'; | ||
@@ -24,3 +25,3 @@ | ||
try { | ||
parsedMessage = jsonParse(message); | ||
parsedMessage = JSON.parse(message); | ||
} catch (err) { | ||
@@ -145,2 +146,3 @@ return; | ||
export function listenForMessages() { | ||
// $FlowFixMe | ||
addEventListener(window, 'message', messageListener); | ||
@@ -147,0 +149,0 @@ } |
@@ -5,5 +5,5 @@ /* @flow */ | ||
import { isWindowClosed, matchDomain, stringifyDomainPattern, type CrossDomainWindowType } from 'cross-domain-utils/src'; | ||
import { stringifyError, noop } from 'belter/src'; | ||
import { CONSTANTS } from '../../conf'; | ||
import { stringifyError, noop } from '../../lib'; | ||
import { sendMessage } from '../send'; | ||
@@ -10,0 +10,0 @@ import { getRequestListener, getResponseListener, deleteResponseListener, isResponseListenerErrored } from '../listeners'; |
@@ -5,5 +5,6 @@ /* @flow */ | ||
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { uniqueID, stringifyError } from 'belter/src'; | ||
import { CONSTANTS, CONFIG, POST_MESSAGE_NAMES_LIST } from '../../conf'; | ||
import { uniqueID, serializeMethods, getWindowType, jsonStringify, stringifyError } from '../../lib'; | ||
import { serializeMethods, getWindowType } from '../../lib'; | ||
@@ -62,3 +63,3 @@ import { SEND_MESSAGE_STRATEGIES } from './strategies'; | ||
let serializedMessage = jsonStringify({ | ||
let serializedMessage = JSON.stringify({ | ||
[ CONSTANTS.WINDOW_PROPS.POSTROBOT ]: message | ||
@@ -65,0 +66,0 @@ }, null, 2); |
@@ -6,2 +6,3 @@ /* @flow */ | ||
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { noop } from 'belter/src'; | ||
@@ -11,3 +12,2 @@ import { CONSTANTS } from '../conf'; | ||
import { noop } from './util'; | ||
@@ -14,0 +14,0 @@ global.readyPromises = global.readyPromises || new WeakMap(); |
@@ -6,2 +6,3 @@ /* @flow */ | ||
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { once, uniqueID, replaceObject, stringifyError, isRegex } from 'belter/src'; | ||
@@ -11,3 +12,2 @@ import { CONSTANTS } from '../conf'; | ||
import { once, uniqueID, replaceObject, stringifyError, isRegex } from './util'; | ||
@@ -148,2 +148,4 @@ global.methods = global.methods || new WeakMap(); | ||
} | ||
return item; | ||
}).obj; | ||
@@ -207,3 +209,3 @@ } | ||
if (typeof item !== 'object' || item === null) { | ||
return; | ||
return item; | ||
} | ||
@@ -231,3 +233,4 @@ | ||
return item; | ||
}).obj; | ||
} |
/* @flow */ | ||
import { WeakMap } from 'cross-domain-safe-weakmap/src'; | ||
import { isPopup, isIframe, getUserAgent } from 'cross-domain-utils/src'; | ||
@@ -9,198 +8,2 @@ | ||
export function stringifyError(err : mixed, level : number = 1) : string { | ||
if (level >= 3) { | ||
return 'stringifyError stack overflow'; | ||
} | ||
try { | ||
if (!err) { | ||
return `<unknown error: ${ Object.prototype.toString.call(err) }>`; | ||
} | ||
if (typeof err === 'string') { | ||
return err; | ||
} | ||
if (err instanceof Error) { | ||
let stack = err && err.stack; | ||
let message = err && err.message; | ||
if (stack && message) { | ||
if (stack.indexOf(message) !== -1) { | ||
return stack; | ||
} else { | ||
return `${ message }\n${ stack }`; | ||
} | ||
} else if (stack) { | ||
return stack; | ||
} else if (message) { | ||
return message; | ||
} | ||
} | ||
if (typeof err.toString === 'function') { | ||
return err.toString(); | ||
} | ||
return Object.prototype.toString.call(err); | ||
} catch (newErr) { // eslint-disable-line unicorn/catch-error-name | ||
return `Error while stringifying error: ${ stringifyError(newErr, level + 1) }`; | ||
} | ||
} | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
export let once = <T>(method : Function) : ((...args : Array<any>) => T | void) => { | ||
if (!method) { | ||
return method; | ||
} | ||
let called = false; | ||
return function onceWrapper() : T | void { | ||
if (!called) { | ||
called = true; | ||
return method.apply(this, arguments); | ||
} | ||
}; | ||
}; | ||
// eslint-disable-next-line no-unused-vars | ||
export function noop(...args : Array<mixed>) { | ||
// pass | ||
} | ||
export function addEventListener(obj : Object, event : string, handler : Function) : { cancel : () => void } { | ||
if (obj.addEventListener) { | ||
obj.addEventListener(event, handler); | ||
} else { | ||
obj.attachEvent(`on${ event }`, handler); | ||
} | ||
return { | ||
cancel() { | ||
if (obj.removeEventListener) { | ||
obj.removeEventListener(event, handler); | ||
} else { | ||
obj.detachEvent(`on${ event }`, handler); | ||
} | ||
} | ||
}; | ||
} | ||
export function uniqueID() : string { | ||
let chars = '0123456789abcdef'; | ||
return 'xxxxxxxxxx'.replace(/./g, () => { | ||
return chars.charAt(Math.floor(Math.random() * chars.length)); | ||
}); | ||
} | ||
type MixedArrayType = Array<mixed>; | ||
export function eachArray(item : MixedArrayType, callback : (item : mixed, key : number) => mixed) { | ||
for (let i = 0; i < item.length; i++) { | ||
callback(item[i], i); | ||
} | ||
} | ||
export function eachObject(item : Object, callback : (item : mixed, key : string) => mixed) { | ||
for (let key in item) { | ||
if (item.hasOwnProperty(key)) { | ||
callback(item[key], key); | ||
} | ||
} | ||
} | ||
export function each<T : Object | MixedArrayType>(item : T, callback : (item : mixed, key : number | string) => mixed) { | ||
if (Array.isArray(item)) { | ||
eachArray(item, callback); | ||
} else if (typeof item === 'object' && item !== null) { | ||
eachObject(item, callback); | ||
} | ||
} | ||
export function replaceObject<T : Object | MixedArrayType>(item : T, callback : (item : mixed, key : number | string) => mixed, depth : number = 1) : T { | ||
if (depth >= 100) { | ||
throw new Error(`Self-referential object passed, or object contained too many layers`); | ||
} | ||
let newobj; | ||
if (typeof item === 'object' && item !== null && !Array.isArray(item)) { | ||
newobj = {}; | ||
} else if (Array.isArray(item)) { | ||
newobj = []; | ||
} else { | ||
throw new TypeError(`Invalid type: ${ typeof item }`); | ||
} | ||
each(item, (childItem, key) => { | ||
let result = callback(childItem, key); | ||
if (typeof result !== 'undefined') { | ||
// $FlowFixMe | ||
newobj[key] = result; | ||
} else if (typeof childItem === 'object' && childItem !== null) { | ||
// $FlowFixMe | ||
newobj[key] = replaceObject(childItem, callback, depth + 1); | ||
} else { | ||
// $FlowFixMe | ||
newobj[key] = childItem; | ||
} | ||
}); | ||
// $FlowFixMe | ||
return newobj; | ||
} | ||
export function safeInterval(method : Function, time : number) : { cancel : () => void } { | ||
let timeout; | ||
function runInterval() { | ||
timeout = setTimeout(runInterval, time); | ||
method.call(); | ||
} | ||
timeout = setTimeout(runInterval, time); | ||
return { | ||
cancel() { | ||
clearTimeout(timeout); | ||
} | ||
}; | ||
} | ||
export function isRegex(item : mixed) : boolean { | ||
return Object.prototype.toString.call(item) === '[object RegExp]'; | ||
} | ||
type FunctionProxy<T : Function> = (method : T) => T; | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
export let weakMapMemoize : FunctionProxy<*> = <R : mixed>(method : (arg : any) => R) : ((...args : Array<any>) => R) => { | ||
let weakmap = new WeakMap(); | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
return function weakmapMemoized(arg : any) : R { | ||
let result = weakmap.get(arg); | ||
if (typeof result !== 'undefined') { | ||
return result; | ||
} | ||
result = method.call(this, arg); | ||
if (typeof result !== 'undefined') { | ||
weakmap.set(arg, result); | ||
} | ||
return result; | ||
}; | ||
}; | ||
export function getWindowType() : string { | ||
@@ -216,59 +19,2 @@ if (isPopup()) { | ||
export function jsonStringify<T : mixed>(obj : T, replacer : ?Function, indent : number | void) : string { | ||
let objectToJSON; | ||
let arrayToJSON; | ||
try { | ||
if (JSON.stringify({}) !== '{}') { | ||
// $FlowFixMe | ||
objectToJSON = Object.prototype.toJSON; | ||
// $FlowFixMe | ||
delete Object.prototype.toJSON; | ||
} | ||
if (JSON.stringify({}) !== '{}') { | ||
throw new Error(`Can not correctly serialize JSON objects`); | ||
} | ||
if (JSON.stringify([]) !== '[]') { | ||
// $FlowFixMe | ||
arrayToJSON = Array.prototype.toJSON; | ||
// $FlowFixMe | ||
delete Array.prototype.toJSON; | ||
} | ||
if (JSON.stringify([]) !== '[]') { | ||
throw new Error(`Can not correctly serialize JSON objects`); | ||
} | ||
} catch (err) { | ||
throw new Error(`Can not repair JSON.stringify: ${ err.message }`); | ||
} | ||
let result = JSON.stringify.call(this, obj, replacer, indent); | ||
try { | ||
if (objectToJSON) { | ||
// $FlowFixMe | ||
Object.prototype.toJSON = objectToJSON; // eslint-disable-line no-extend-native | ||
} | ||
if (arrayToJSON) { | ||
// $FlowFixMe | ||
Array.prototype.toJSON = arrayToJSON; // eslint-disable-line no-extend-native | ||
} | ||
} catch (err) { | ||
throw new Error(`Can not repair JSON.stringify: ${ err.message }`); | ||
} | ||
return result; | ||
} | ||
export function jsonParse(item : string) : mixed { | ||
return JSON.parse(item); | ||
} | ||
export function needsGlobalMessagingForBrowser() : boolean { | ||
@@ -279,8 +25,8 @@ | ||
} | ||
if (!CONFIG.ALLOW_POSTMESSAGE_POPUP) { | ||
return true; | ||
} | ||
return false; | ||
} |
@@ -6,6 +6,8 @@ /* @flow */ | ||
import { getAncestor, isAncestor, isWindowClosed, getDomain, matchDomain, type CrossDomainWindowType } from 'cross-domain-utils/src'; | ||
import { uniqueID, isRegex } from 'belter/src'; | ||
import { CONFIG, CONSTANTS } from '../conf'; | ||
import { sendMessage, addResponseListener, deleteResponseListener, markResponseListenerErrored, type ResponseListenerType } from '../drivers'; | ||
import { uniqueID, onChildWindowReady, sayHello, isRegex } from '../lib'; | ||
import { onChildWindowReady, sayHello } from '../lib'; | ||
import { global } from '../global'; | ||
@@ -12,0 +14,0 @@ |
@@ -5,4 +5,4 @@ /* @flow */ | ||
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { once as onceFunction, safeInterval } from 'belter/src'; | ||
import { once as onceFunction, safeInterval } from '../lib'; | ||
import { addRequestListener, type RequestListenerType } from '../drivers'; | ||
@@ -9,0 +9,0 @@ import { CONSTANTS } from '../conf'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
527585
8729
4
+ Addedbelter@^1.0.41
+ Addedbelter@1.0.190(transitive)