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