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

post-robot

Package Overview
Dependencies
Maintainers
2
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

post-robot - npm Package Compare versions

Comparing version 2.0.41 to 3.0.0

2

bower.json
{
"name": "post-robot",
"main": "index.js",
"version": "2.0.41",
"version": "3.0.0",
"authors": [

@@ -6,0 +6,0 @@ "Daniel Brain <dbrain@paypal.com>"

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

!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("postRobot",[],n):"object"==typeof exports?exports.postRobot=n():e.postRobot=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){"use strict";function t(){u.global.initialized||(i.util.listen(window,"message",a.messageListener),(0,i.initOnReady)(),(0,i.listenForMethods)()),u.global.initialized=!0}Object.defineProperty(n,"__esModule",{value:!0}),n.Promise=void 0;var o=r(1);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(8);Object.defineProperty(n,"Promise",{enumerable:!0,get:function(){return i.Promise}});var a=r(6),u=r(15);t(),n["default"]=e.exports},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.linkUrl=n.util=n.openBridge=n.reset=n.parent=void 0;var t=r(2);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(26);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(27);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})});var a=r(6);Object.defineProperty(n,"reset",{enumerable:!0,get:function(){return a.resetListeners}});var u=r(19);Object.defineProperty(n,"openBridge",{enumerable:!0,get:function(){return u.openBridge}});var s=r(12);Object.defineProperty(n,"util",{enumerable:!0,get:function(){return s.util}});var c=r(14);Object.defineProperty(n,"linkUrl",{enumerable:!0,get:function(){return c.linkUrl}});n.parent=(0,c.getParentWindow)()},function(e,n,r){"use strict";function t(e){return s.promise.nodeify(new s.promise.Promise(function(n,r){if(!e.name)throw new Error("Expected options.name");if(!e.window)throw new Error("Expected options.window");if(a.CONFIG.MOCK_MODE)e.window=window;else if("string"==typeof e.window){var t=document.getElementById(e.window);if(!t)throw new Error("Expected options.window "+e.window+" to be a valid element id");if("iframe"!==t.tagName.toLowerCase())throw new Error("Expected options.window "+e.window+" to be an iframe");if(e.window=t.contentWindow,!e.window)throw new Error("Expected options.window")}var o=e.name+"_"+s.util.uniqueID();if(u.listeners.response[o]=e,(0,s.isWindowClosed)(e.window))throw new Error("Target window is closed");var i=!1;return e.respond=function(e,t){return e||(i=!0),e?r(e):n(t)},s.promise.run(function(){if((0,s.isParentWindow)(e.window,window))return(0,s.onWindowReady)(e.window)}).then(function(){if((0,u.sendMessage)(e.window,{hash:o,type:a.CONSTANTS.POST_MESSAGE_TYPE.REQUEST,name:e.name,data:e.data,fireAndForget:e.fireAndForget},e.domain||"*")["catch"](r),e.fireAndForget)return n();var t=s.util.intervalTimeout(a.CONFIG.ACK_TIMEOUT,100,function(n){return e.ack||(0,s.isWindowClosed)(e.window)?t.cancel():n?void 0:r(new Error("No ack for postMessage "+e.name+" in "+a.CONFIG.ACK_TIMEOUT+"ms"))});e.timeout&&!function(){var n=s.util.intervalTimeout(e.timeout,100,function(t){return i||(0,s.isWindowClosed)(e.window)?n.cancel():t?void 0:r(new Error("Post message response timed out after "+e.timeout+" ms"))},e.timeout)}()})["catch"](r)}),e.callback)}function o(e,n,r,o,i){return i||(!o&&r instanceof Function?(i=r,o={},r={}):o instanceof Function&&(i=o,o={})),o=o||{},o.window=e,o.name=n,o.data=r,o.callback=i,t(o)}function i(e,n,r,t){var i=(0,s.getParentWindow)();return i?o(i,e,n,r,t):new s.promise.Promise(function(e,n){return n(new Error("Window does not have a parent"))})}Object.defineProperty(n,"__esModule",{value:!0}),n.request=t,n.send=o,n.sendToParent=i;var a=r(3),u=r(6),s=r(8)},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(4);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(5);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})})},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.CONFIG=void 0;var o,i=r(5);n.CONFIG={ALLOW_POSTMESSAGE_POPUP:!1,LOG_LEVEL:"info",ACK_TIMEOUT:1e3,LOG_TO_PAGE:!1,MOCK_MODE:!1,ALLOWED_POST_MESSAGE_METHODS:(o={},t(o,i.CONSTANTS.SEND_STRATEGIES.POST_MESSAGE,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.GLOBAL_METHOD,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.REMOTE_BRIDGE,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.LOCAL_BRIDGE,!0),o)}},function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=n.CONSTANTS={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",READY:"postrobot_ready"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",GLOBAL_METHOD:"postrobot_global_method",REMOTE_BRIDGE:"postrobot_remote_bridge",LOCAL_BRIDGE:"postrobot_local_bridge"},MOCK_PROTOCOL:"mock://"};n.POST_MESSAGE_NAMES_LIST=Object.keys(r.POST_MESSAGE_NAMES).map(function(e){return r.POST_MESSAGE_NAMES[e]})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(7);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(22);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(25);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,n,r){"use strict";function t(e){try{e=JSON.parse(e)}catch(n){return}if(e.type&&w.RECEIVE_MESSAGE_TYPES[e.type])return e}function o(e,n){var r={"window.parent":function(e){return(0,c.getParent)(window)},"window.opener":function(e){return(0,c.getOpener)(window)},"window.parent.opener":function(e){return(0,c.getOpener)((0,c.getParent)(window))},"window.opener.parent":function(e){return(0,c.getParent)((0,c.getOpener)(window))}},t=void 0;try{t=r[e](n)}catch(o){throw new Error("Can not get "+e+": "+o.message)}if(!t)throw new Error("Can not get "+e+": not available");return t}function i(e,n){if(n.targetHint){var r=o(n.targetHint,n.target);return delete n.targetHint,r}if(n.target&&n.target!==(0,c.getWindowId)(window)){var t=(0,c.getWindowById)(n.target);if(!t)throw new Error("Unable to find window to proxy message to: "+n.target);return t}}function a(e){try{if(!e.source)return}catch(n){return}var r=e.source,a=e.origin,u=e.data,g=t(u);if(g&&(0===g.sourceDomain.indexOf(s.CONSTANTS.MOCK_PROTOCOL)&&(a=g.sourceDomain),l.global.receivedMessages.indexOf(g.id)===-1)){if(l.global.receivedMessages.push(g.id),g.sourceDomain!==a)throw new Error("Message source domain "+g.sourceDomain+" does not match message origin "+a);if(g.originalSourceDomain!==a&&!(0,c.isSameDomain)(r))throw new Error("Message original source domain "+g.originalSourceDomain+" does not match message origin "+a);(0,c.registerWindow)(g.source,r,a);var m=void 0;try{m=i(r,g)}catch(n){return c.log.debug(n.message)}var p=void 0;if(p=s.POST_MESSAGE_NAMES_LIST.indexOf(g.name)!==-1||g.type===s.CONSTANTS.POST_MESSAGE_TYPE.ACK||m?"debug":"error"===g.ack?"error":"info",c.log.logLevel(p,[m?"#receiveproxy":"#receive",g.type,g.name,g]),m)return(0,c.isWindowClosed)(m)?c.log.debug("Target window is closed: "+g.target+" - can not proxy "+g.type+" "+g.name):(delete g.target,(0,f.sendMessage)(m,g,g.domain||"*",!0));var h=r;if(g.originalSource!==g.source){if(g.sourceHint)h=o(g.sourceHint,g.originalSource),delete g.sourceHint;else if(h=(0,c.getWindowById)(g.originalSource),!h)throw new Error("Can not find original message source: "+g.originalSource);(0,c.registerWindow)(g.originalSource,h,g.originalSourceDomain)}if(h!==r&&(0,d.registerBridge)(r,h),(0,c.isWindowClosed)(h))return c.log.debug("Source window is closed: "+g.originalSource+" - can not send "+g.type+" "+g.name);if(s.CONFIG.MOCK_MODE)return w.RECEIVE_MESSAGE_TYPES[g.type](h,g,g.originalSourceDomain);g.data&&(g.data=(0,c.deserializeMethods)(h,g.data)),w.RECEIVE_MESSAGE_TYPES[g.type](h,g,g.originalSourceDomain)}}function u(e){try{e.source}catch(n){return}e={source:e.source||e.sourceElement,origin:e.origin||e.originalEvent.origin,data:e.data};try{(0,d.emulateIERestrictions)(e.source,window)}catch(n){return}a(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.receiveMessage=a,n.messageListener=u;var s=r(3),c=r(8),d=r(18),l=r(15),f=r(22),w=r(24);l.global.receivedMessages=l.global.receivedMessages||[]},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(9);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(12);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(13);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})});var a=r(14);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(16);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return u[e]}})});var s=r(11);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return s[e]}})});var c=r(17);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return c[e]}})})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.promise=n.Promise=void 0;var t=r(10),o=r(11),i=n.Promise=t.SyncPromise,a=n.promise={Promise:i,run:function(e){return i.resolve().then(e)},nextTick:function(e){return new i(function(n,r){(0,o.nextTick)(function(){return a.run(e).then(n,r)})})},method:function(e){return function(){var n=this,r=arguments;return i.resolve().then(function(){return e.apply(n,r)})}},nodeify:function(e,n){return n?void e.then(function(e){n(null,e)},function(e){n(e)}):e},deNodeify:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;t<n;t++)r[t-1]=arguments[t];return new i(function(n,t){try{return r.length<e.length?e.apply(void 0,r.concat([function(e,r){return e?t(e):n(r)}])):a.run(function(){return e.apply(void 0,r)}).then(n,t)}catch(o){return t(o)}})},map:function(e,n){for(var r=[],t=function(t){r.push(a.run(function(){return n(e[t])}))},o=0;o<e.length;o++)t(o);return i.all(r)}}},function(e,n){"use strict";function r(e,n,r){function t(){if(a){if(s)return r(o);if(u)return n(i)}}var o,i,a=!1,u=!1,s=!1;try{e(function(e){i=e,u=!0,t()},function(e){o=e,s=!0,t()})}catch(c){return r(c)}a=!0,t()}function t(e){d.push(e),s=s||setTimeout(o,1)}function o(){s=null;var e=d;d=[];for(var n=0;n<e.length;n++){var r=e[n];r.hasHandlers||(r.handlers.push({onError:function(e){if(!r.hasHandlers){i(e);for(var n=0;n<c.length;n++)c[n](r.value)}}}),r.dispatch())}}function i(e){setTimeout(function(){throw e},1)}function a(e){try{if(!e)return!1;if(window.Window&&e instanceof window.Window)return!1;if(window.constructor&&e instanceof window.constructor)return!1;if(l){var n=l.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if(e&&e.then instanceof Function)return!0}catch(r){return!1}return!1}function u(){window.Promise=f}Object.defineProperty(n,"__esModule",{value:!0}),n.patchPromise=u;var s,c=[],d=[],l={}.toString,f=n.SyncPromise=function(e){if(this.resolved=!1,this.rejected=!1,this.hasHandlers=!1,this.handlers=[],t(this),e){var n=this;r(e,function(e){return n.resolve(e)},function(e){return n.reject(e)})}};f.resolve=function(e){return a(e)?e:(new f).resolve(e)},f.reject=function(e){return(new f).reject(e)},f.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(a(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},f.prototype.reject=function(e){if(this.resolved||this.rejected)return this;if(a(e))throw new Error("Can not reject promise with another promise");return this.rejected=!0,this.value=e,this.dispatch(),this},f.prototype.dispatch=function(){var e=this;if(this.resolved||this.rejected)for(var n=function(){var n=e.handlers.shift();try{e.resolved?r=n.onSuccess?n.onSuccess(e.value):e.value:n.onError?r=n.onError(e.value):t=e.value}catch(o){t=o}if(r===e)throw new Error("Can not return a promise from the the then handler of the same promise");return n.promise?void(t?n.promise.reject(t):a(r)?r.then(function(e){n.promise.resolve(e)},function(e){n.promise.reject(e)}):n.promise.resolve(r)):"continue"};this.handlers.length;){var r,t;n()}},f.prototype.then=function(e,n){var r=new f(null,this);return this.handlers.push({promise:r,onSuccess:e,onError:n}),this.hasHandlers=!0,this.dispatch(),r},f.prototype["catch"]=function(e){return this.then(null,e)},f.prototype["finally"]=function(e){return this.then(function(n){return e(),n},function(n){throw e(),n})},f.all=function(e){for(var n=new f,r=e.length,t=[],o=function(o){var i=a(e[o])?e[o]:f.resolve(e[o]);i.then(function(e){t[o]=e,r-=1,0===r&&n.resolve(t)},function(e){n.reject(e)})},i=0;i<e.length;i++)o(i);return n},f.onPossiblyUnhandledException=function(e){c.push(e)}},function(e,n,r){"use strict";function t(e){a.push(e),window.postMessage(i,"*")}Object.defineProperty(n,"__esModule",{value:!0}),n.nextTick=t;var o=r(12),i="__nextTick__postRobot__"+o.util.uniqueID(),a=[];window.addEventListener("message",function(e){if(e.data===i){var n=a.shift();n.call()}})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.util=void 0;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(3),i=n.util={once:function(e){if(!e)return e;var n=!1;return function(){if(!n)return n=!0,e.apply(this,arguments)}},noop:function(){},safeHasProp:function(e,n){try{return!!e[n]}catch(r){return!1}},safeGetProp:function(e,n){try{return e[n]}catch(r){return}},listen:function(e,n,r){return e.addEventListener?e.addEventListener(n,r):e.attachEvent("on"+n,r),{cancel:function(){e.removeEventListener?e.removeEventListener(n,r):e.detachEvent("on"+n,r)}}},apply:function(e,n,r){return e.apply instanceof Function?e.apply(n,r):e(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9])},find:function(e,n,r){if(!e)return r;for(var t=0;t<e.length;t++)if(n(e[t]))return e[t];return r},map:function(e,n){for(var r=[],t=0;t<e.length;t++)r.push(n(e[t]));return r},some:function(e,n){n=n||Boolean;for(var r=0;r<e.length;r++)if(n(e[r]))return!0;return!1},keys:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(r);return n},values:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(e[r]);return n},getByValue:function(e,n){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===n)return r},uniqueID:function(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})},memoize:function(e){var n={};return function(){var r=JSON.stringify(Array.prototype.slice.call(arguments));return n.hasOwnProperty(r)||(n[r]=e.apply(this,arguments)),n[r]}},extend:function(e,n){if(!n)return e;for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e},each:function(e,n){if(e instanceof Array)for(var r=0;r<e.length;r++)n(e[r],r);else if(e instanceof Object&&!(e instanceof Function))for(var t in e)e.hasOwnProperty(t)&&n(e[t],t)},replaceObject:function(e,n){var r=e instanceof Array?[]:{};return i.each(e,function(e,o){var a=n(e,o);void 0!==a?r[o]=a:"object"===("undefined"==typeof e?"undefined":t(e))&&null!==e?r[o]=i.replaceObject(e,n):r[o]=e}),r},safeInterval:function(e,n){function r(){t=setTimeout(r,n),e.call()}var t=void 0;return t=setTimeout(r,n),{cancel:function(){clearTimeout(t)}}},intervalTimeout:function(e,n,r){var t=i.safeInterval(function(){e-=n,e=e<=0?0:e,0===e&&t.cancel(),r(e)},n);return t},getDomain:function(e){return e=e||window,e.mockDomain&&0===e.mockDomain.indexOf(o.CONSTANTS.MOCK_PROTOCOL)?e.mockDomain:e.location.protocol+"//"+e.location.host},getDomainFromUrl:function(e){var n=void 0;return 0!==e.indexOf("http://")&&0!==e.indexOf("https://")?this.getDomain():(n=e,n=n.split("/").slice(0,3).join("/"))}}},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.log=void 0;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(12),i=r(14),a=r(3),u=["debug","info","warn","error"];Function.prototype.bind&&window.console&&"object"===t(console.log)&&["log","info","warn","error"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call);var s=n.log={clearLogs:function(){if(window.console&&window.console.clear&&window.console.clear(),a.CONFIG.LOG_TO_PAGE){var e=document.getElementById("postRobotLogs");e&&e.parentNode.removeChild(e)}},writeToPage:function(e,n){setTimeout(function(){var r=document.getElementById("postRobotLogs");r||(r=document.createElement("div"),r.id="postRobotLogs",r.style.cssText="width: 800px; font-family: monospace; white-space: pre-wrap;",document.body.appendChild(r));var t=document.createElement("div"),i=(new Date).toString().split(" ")[4],a=o.util.map(n,function(e){if("string"==typeof e)return e;if(!e)return toString.call(e);var n=void 0;try{n=JSON.stringify(e,0,2)}catch(r){n="[object]"}return"\n\n"+n+"\n\n"}).join(" "),u=i+" "+e+" "+a;t.innerHTML=u;var s={log:"#ddd",warn:"orange",error:"red",info:"blue",debug:"#aaa"}[e];t.style.cssText="margin-top: 10px; color: "+s+";",r.childNodes.length?r.insertBefore(t,r.childNodes[0]):r.appendChild(t)})},logLevel:function(e,n){u.indexOf(e)<u.indexOf(a.CONFIG.LOG_LEVEL)||(n=Array.prototype.slice.call(n),n.unshift(window.location.pathname),n.unshift(window.location.host),n.unshift("<"+(0,i.getWindowType)().toLowerCase()+">"),n.unshift("[post-robot]"),a.CONFIG.LOG_TO_PAGE&&s.writeToPage(e,n),window.console&&(window.console[e]||(e="log"),window.console[e]&&window.console[e].apply(window.console,n)))},debug:function(){s.logLevel("debug",arguments)},info:function(){s.logLevel("info",arguments)},warn:function(){s.logLevel("warn",arguments)},error:function(){s.logLevel("error",arguments)}}},function(e,n,r){"use strict";function t(e,n){var r=void 0;try{r=e[n]}catch(t){}return r}function o(e){for(var n=P.global.domainMatches,r=Array.isArray(n),t=0,n=r?n:n[Symbol.iterator]();;){var o;if(r){if(t>=n.length)break;o=n[t++]}else{if(t=n.next(),t.done)break;o=t.value}var i=o;if(i.win===e)return i.match}var a=!1;try{T.util.getDomain(window)===T.util.getDomain(e)&&(a=!0)}catch(u){}return P.global.domainMatches.push({win:e,match:a}),M||(M=setTimeout(function(){P.global.domainMatches=[],M=null},1)),a}function i(e){try{return!e||e.closed||"undefined"==typeof e.closed||o(e)&&t(e,"mockclosed")}catch(n){return!0}}function a(e){if(e)try{return e.opener}catch(n){return}}function u(e){if(e)try{if(e.parent&&e.parent!==e)return e.parent}catch(n){return}}function s(e){if(e)try{return e.top}catch(n){return}}function c(e,n){try{return e.frames[n]}catch(r){}try{return e[n]}catch(r){}}function d(e){var n=[],r=void 0;try{r=e.frames}catch(t){r=e}var o=void 0;try{o=r.length}catch(t){}if(0===o)return n;if(o)for(var i=0;i<o;i++){var a=void 0;try{a=r[i]}catch(t){continue}n.push(a)}else for(var u=0;;){var s=void 0;try{s=r[u]}catch(t){return n}if(!s)return n;if(n.push(s),u+=1,u>20)return n}return n}function l(e,n){try{var r=u(n);if(r)return r===e}catch(t){}try{var o=d(e);if(!o||!o.length)return!1;for(var i=0;i<o.length;i++)if(o[i]===n)return!0}catch(t){}return!1}function f(e){e=e||window;var n=a(e);if(n)return n;var r=u(e);return r?r:void 0}function w(e,n){n=n||window;var r=f(e);if(r)return r===n;if(e===window)return f(e)===n;if(e===n)return!1;if(s(e)===e)return!1;var t=d(n);if(t&&t.length)for(var o=0;o<t.length;o++)if(t[o]===e)return!0;return!1}function g(){return Boolean(a(window))}function m(){return Boolean(u(window))}function p(){return Boolean(!m()&&!g())}function h(){return g()?A.CONSTANTS.WINDOW_TYPES.POPUP:m()?A.CONSTANTS.WINDOW_TYPES.IFRAME:A.CONSTANTS.WINDOW_TYPES.FULLPAGE}function S(e){if(e===window)return N;for(var n=P.global.windows.length-1;n>=0;n--){var r=P.global.windows[n];try{if(r.win===e)return r.id}catch(t){continue}}}function O(e){if(e===window.name||e===N)return window;if(window.frames&&window.frames[e])return window.frames[e];for(var n=P.global.windows.length-1;n>=0;n--){var r=P.global.windows[n];try{if(r.id===e)return r.win}catch(t){continue}}}function v(e){if(e===window)return T.util.getDomain(window);for(var n=P.global.windows.length-1;n>=0;n--){var r=P.global.windows[n];try{if(r.win===e&&r.domain)return r.domain}catch(t){continue}}}function E(e,n,r){for(var t=P.global.windows,o=Array.isArray(t),a=0,t=o?t:t[Symbol.iterator]();;){var u;if(o){if(a>=t.length)break;u=t[a++]}else{if(a=t.next(),a.done)break;u=a.value}var s=u;try{if(s.id===e&&s.win===n)return void(s.domain=r)}catch(c){continue}if(s.id===e&&s.win!==n&&!i(s.win))throw new Error("Can not register a duplicate window with name "+e)}P.global.windows.push({id:e,win:n,domain:r})}function b(e,n){if(e===n)return!0;var r=S(e),t=S(n);return!(!r||!t||r!==t)}function _(e,n){var r=s(e),t=s(n);try{return r&&t&&r===t}catch(o){return!1}}function y(e,n,r){var t=T.util.getDomainFromUrl(r);E(e,n,t),P.global.domainMatches.push({win:n,match:T.util.getDomain()===t})}Object.defineProperty(n,"__esModule",{value:!0}),n.isSameDomain=o,n.isWindowClosed=i,n.getOpener=a,n.getParent=u,n.getTop=s,n.getFrameByName=c,n.getFrames=d,n.isFrameOwnedBy=l,n.getParentWindow=f,n.isParentWindow=w,n.isPopup=g,n.isIframe=m,n.isFullpage=p,n.getWindowType=h,n.getWindowId=S,n.getWindowById=O,n.getWindowDomain=v,n.registerWindow=E,n.isWindowEqual=b,n.isSameTopWindow=_,n.linkUrl=y;var T=r(12),P=r(15),A=r(3);P.global.domainMatches=P.global.domainMatches||[];var M=void 0;P.global.windows=P.global.windows||[];var N=window.name||h()+"_"+T.util.uniqueID(),C=window.open;window.open=function(e,n,r,t){n||(n=T.util.uniqueID(),arguments[1]=n);var o=T.util.apply(C,this,arguments);return e?y(n,o,e):E(n,o),o}},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.global=void 0;var t=r(3);n.global=window[t.CONSTANTS.WINDOW_PROPS.POSTROBOT]=window[t.CONSTANTS.WINDOW_PROPS.POSTROBOT]||{}},function(e,n,r){"use strict";function t(e){return e instanceof Object&&e.__type__===s.CONSTANTS.SERIALIZATION_TYPES.METHOD&&e.__id__}function o(e,n,r){var t=c.util.uniqueID();return w.global.methods[t]={win:e,method:n},{__type__:s.CONSTANTS.SERIALIZATION_TYPES.METHOD,__id__:t,__name__:r}}function i(e,n){return c.util.replaceObject({obj:n},function(n,r){if(n instanceof Function)return o(e,n,r)}).obj}function a(e,n){function r(){var r=Array.prototype.slice.call(arguments);return l.log.debug("Call foreign method",n.__name__,r),(0,d.send)(e,s.CONSTANTS.POST_MESSAGE_NAMES.METHOD,{id:n.__id__,name:n.__name__,args:r}).then(function(e){return l.log.debug("Got foreign method result",n.__name__,e.result),e.result})}return r.__name__=n.__name__,r}function u(e,n){return c.util.replaceObject({obj:n},function(n,r){if(t(n))return a(e,n)}).obj}Object.defineProperty(n,"__esModule",{value:!0}),n.listenForMethods=void 0,n.serializeMethod=o,n.serializeMethods=i,n.deserializeMethod=a,n.deserializeMethods=u;var s=r(3),c=r(12),d=r(1),l=r(13),f=r(9),w=r(15);w.global.methods=w.global.methods||{};n.listenForMethods=c.util.once(function(){(0,d.on)(s.CONSTANTS.POST_MESSAGE_NAMES.METHOD,function(e,n){if(!w.global.methods[n.id])throw new Error("Could not find method with id: "+n.id);if(w.global.methods[n.id].win!==e)throw new Error("Method window does not match");var r=w.global.methods[n.id].method;return l.log.debug("Call local method",n.name,n.args),f.promise.run(function(){return r.apply(null,n.args)}).then(function(e){return{result:e,id:n.id,name:n.name}})})})},function(e,n,r){"use strict";function t(){(0,u.on)(i.CONSTANTS.POST_MESSAGE_NAMES.READY,function(e,n){for(var r=d.global.readyPromises,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.win===e)return void a.promise.resolve(e)}d.global.readyPromises.push({win:e,promise:(new c.SyncPromise).resolve(e)})});var e=(0,a.getParentWindow)();e&&(0,u.send)(e,i.CONSTANTS.POST_MESSAGE_NAMES.READY,{})["catch"](function(e){s.log.debug(e.stack||e.toString())})}function o(e){for(var n=arguments.length<=1||void 0===arguments[1]?5e3:arguments[1],r=arguments.length<=2||void 0===arguments[2]?"Window":arguments[2],t=d.global.readyPromises,o=Array.isArray(t),i=0,t=o?t:t[Symbol.iterator]();;){var a;if(o){if(i>=t.length)break;a=t[i++]}else{if(i=t.next(),i.done)break;a=i.value}var u=a;if(u.win===e)return u.promise}var s=new c.SyncPromise;return d.global.readyPromises.push({win:e,promise:s}),setTimeout(function(){return s.reject(new Error(r+" did not load after "+n+"ms"))},n),s}Object.defineProperty(n,"__esModule",{value:!0}),n.initOnReady=t,n.onWindowReady=o;var i=r(3),a=r(14),u=r(1),s=r(13),c=r(10),d=r(15);d.global.readyPromises=d.global.readyPromises||[]},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(19);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(20);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(21);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,n,r){"use strict";function t(e){e=e||g.util.getDomainFromUrl(e||window.location.href);var n=e.replace(/[^a-zA-Z0-9]+/g,"_"),r=m+"_"+n;return r}function o(){return new g.promise.Promise(function(e){return window.document&&window.document.body?e(window.document):void window.document.addEventListener("DOMContentLoaded",function(n){return e(window.document)})})}function i(e){var n=arguments.length<=1||void 0===arguments[1]?S.LOCAL:arguments[1];return g.promise.run(function(){if(n===S.LOCAL&&p[e])return p[e];for(var r=h,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.domain===e&&a.zone===n)return a.bridge}}).then(function(e){return e&&n===S.LOCAL?(0,g.onWindowReady)(e):e})}function a(e){var n=arguments.length<=1||void 0===arguments[1]?S.LOCAL:arguments[1];return g.promise.run(function(){if((0,g.getOpener)(e)===window)return(0,g.onWindowReady)(e)}).then(function(){for(var r=h,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var a;if(t){if(o>=r.length)break;a=r[o++]}else{if(o=r.next(),o.done)break;a=o.value}var u=a;if(u.win===e&&u.zone===n)return u.bridge}var s=(0,g.getWindowDomain)(e);if(s)return i(s,n)}).then(function(e){return e&&n===S.LOCAL?(0,g.onWindowReady)(e):e})}function u(e){return i(e,S.LOCAL)}function s(e){return a(e,S.LOCAL)}function c(e){return i(e,S.REMOTE)}function d(e){return g.promise.run(function(){return a(e,S.REMOTE)}).then(function(n){if(n)return n;var r=t(window.location.href);try{if(e[r])return e[r]}catch(o){}try{var i=(0,g.getFrames)(e);if(!i||!i.length)return;for(var a=0;a<i.length;a++)try{var u=i[a];if(u&&u!==window&&(0,g.isSameDomain)(u)&&u[w.CONSTANTS.WINDOW_PROPS.POSTROBOT])return u}catch(o){continue}}catch(o){}})}function l(e,n){for(var r=void 0,t=h,o=Array.isArray(t),i=0,t=o?t:t[Symbol.iterator]();;){var a;if(o){if(i>=t.length)break;a=t[i++]}else{if(i=t.next(),i.done)break;a=i.value}var u=a;if(u.bridge===e){r=u;break}}if(!r){var s=(0,g.isFrameOwnedBy)(window,e)?S.LOCAL:S.REMOTE;r={bridge:e,domain:(0,g.getWindowDomain)(e),windows:[],zone:s},h.push(r)}n&&r.windows.indexOf(n)===-1&&r.windows.push(n)}function f(e,n){n=n||g.util.getDomainFromUrl(e);var r=g.promise.run(function(){return u(n)}).then(function(r){if(r)return r;if(g.util.getDomain()!==n){var i=t(n),a=(0,g.getFrameByName)(window,i);if(a)return(0,g.onWindowReady)(a,5e3,"Bridge "+e);g.log.debug("Opening bridge:",e);var u=document.createElement("iframe");return u.setAttribute("name",i),u.setAttribute("id",i),u.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),u.setAttribute("frameborder","0"),u.setAttribute("border","0"),u.setAttribute("scrolling","no"),u.setAttribute("allowTransparency","true"),u.setAttribute("tabindex","-1"),u.setAttribute("hidden","true"),u.setAttribute("title",""),u.setAttribute("role","presentation"),u.src=e,o().then(function(r){r.body.appendChild(u);var t=u.contentWindow;return(0,g.registerWindow)(i,t,n),l(t),delete p[n],new g.promise.Promise(function(e,n){u.onload=e,u.onerror=n}).then(function(){return(0,g.onWindowReady)(t,5e3,"Bridge "+e)}).then(function(){return t})})}});return p[n]=r,r}Object.defineProperty(n,"__esModule",{value:!0}),n.getLocalBridgeForDomain=u,n.getLocalBridgeForWindow=s,n.getRemoteBridgeForDomain=c,n.getRemoteBridgeForWindow=d,n.registerBridge=l,n.openBridge=f;var w=r(3),g=r(8),m="__postrobot_bridge__",p={},h=[],S={LOCAL:"local",REMOTE:"remote"}},function(e,n,r){"use strict";var t=r(15),o=r(6);t.global.postMessage=t.global.postMessage||function(e){(0,o.receiveMessage)(e)}},function(e,n,r){"use strict";function t(e,n){if(!o.CONFIG.ALLOW_POSTMESSAGE_POPUP){if((0,i.isSameDomain)(e)&&(0,i.isSameDomain)(n))return;if(!(0,i.isSameTopWindow)(e,n))throw new Error("Can not send and receive post messages between two different windows (disabled to emulate IE)")}}Object.defineProperty(n,"__esModule",{value:!0}),n.emulateIERestrictions=t;var o=r(3),i=r(8)},function(e,n,r){"use strict";function t(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],t=u.util.uniqueID(),o=(0,u.getWindowId)(window),a=(0,u.getWindowType)(),s=(0,u.getWindowId)(e),c=u.util.getDomain(window);return i({},n,r,{id:n.id||t,source:o,originalSource:n.originalSource||o,sourceDomain:c,originalSourceDomain:n.originalSourceDomain||c,windowType:a,originalWindowType:n.originalWindowType||a,target:n.target||s})}function o(e,n,r,o){return u.promise.run(function(){n=t(e,n,{data:(0,u.serializeMethods)(e,n.data),domain:r});var i=void 0;if(i=a.POST_MESSAGE_NAMES_LIST.indexOf(n.name)!==-1||n.type===a.CONSTANTS.POST_MESSAGE_TYPE.ACK||o?"debug":"error"===n.ack?"error":"info",u.log.logLevel(i,[o?"#sendproxy":"#send",n.type,n.name,n]),a.CONFIG.MOCK_MODE)return delete n.target,window[a.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:u.util.getDomain(window),source:window,data:JSON.stringify(n)});if(e===window)throw new Error("Attemping to send message to self");if((0,u.isWindowClosed)(e))throw new Error("Window is closed");u.log.debug("Running send message strategies",n);var c=[];return u.promise.map(u.util.keys(s.SEND_MESSAGE_STRATEGIES),function(t){return u.promise.run(function(){if(!a.CONFIG.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);
return s.SEND_MESSAGE_STRATEGIES[t](e,n,r)}).then(function(){return c.push(t+": success"),!0},function(e){return c.push(t+": "+e.message),!1})}).then(function(e){var r=u.util.some(e),t=n.type+" "+n.name+" "+(r?"success":"error")+":\n - "+c.join("\n - ")+"\n";if(u.log.debug(t),!r)throw new Error(t)})})}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e};n.buildMessage=t,n.sendMessage=o;var a=r(3),u=r(8),s=r(23)},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.SEND_MESSAGE_STRATEGIES=void 0;var o,i=r(3),a=r(8),u=r(18);n.SEND_MESSAGE_STRATEGIES=(o={},t(o,i.CONSTANTS.SEND_STRATEGIES.POST_MESSAGE,function(e,n,r){return(0,u.emulateIERestrictions)(window,e),r&&0===r.indexOf(i.CONSTANTS.MOCK_PROTOCOL)&&(r=e.location.protocol+"//"+e.location.host),e.postMessage(JSON.stringify(n,0,2),r)}),t(o,i.CONSTANTS.SEND_STRATEGIES.GLOBAL_METHOD,function(e,n,r){if(!(0,a.isSameDomain)(e))throw new Error("Window is not on the same domain");if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use global method to communicate between two different windows, not between frames");var t=a.util.getDomain(window),o=void 0;try{o=a.util.getDomain(e)}catch(u){throw new Error("Can not read target window domain: "+u.message)}if(t!==o)throw new Error("Can not send global message - source "+t+" does not match target "+o);if("*"!==r&&o!==r)throw new Error("Can post post through global method - specified domain "+r+" does not match target domain "+o);if(!a.util.safeHasProp(e,i.CONSTANTS.WINDOW_PROPS.POSTROBOT))throw new Error("post-robot not available on target window at "+o);e[i.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:a.util.getDomain(window),source:window,data:JSON.stringify(n,0,2)})}),t(o,i.CONSTANTS.SEND_STRATEGIES.REMOTE_BRIDGE,function(e,n,r){if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");return(0,u.getRemoteBridgeForWindow)(e).then(function(t){if(!t)throw new Error("No bridge available in window");var o=a.util.getDomain(window),u=void 0;try{u=a.util.getDomain(t)}catch(s){throw new Error("Can not read bridge window domain: "+s.message)}if(o!==u)throw new Error("Can not accept global message through bridge - source "+o+" does not match bridge "+u);if(!a.util.safeHasProp(t,i.CONSTANTS.WINDOW_PROPS.POSTROBOT))throw new Error("post-robot not available on bridge at "+u);n.targetHint="window.parent",window===(0,a.getOpener)(e)&&(n.sourceHint="window.opener"),t[i.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:a.util.getDomain(window),source:window,data:JSON.stringify(n,0,2)},r)})}),t(o,i.CONSTANTS.SEND_STRATEGIES.LOCAL_BRIDGE,function(e,n,r){if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");if(e===(0,a.getOpener)(window)&&(n.targetHint="window.parent.opener"),!n.target&&!n.targetHint)throw new Error("Can not post message down through bridge without target or targetHint");var t=(0,a.getOpener)(e);if(t&&window===t)n.sourceHint="window.opener";else{var o=t&&(0,a.getParent)(t);o&&window===o&&(n.sourceHint="window.opener.parent")}return(0,u.getLocalBridgeForWindow)(e).then(function(t){if(!t)throw new Error("Bridge not initialized");if(e===t)throw new Error("Message target is bridge");r&&0===r.indexOf(i.CONSTANTS.MOCK_PROTOCOL)&&(r=t.location.protocol+"//"+t.location.host),t.postMessage(JSON.stringify(n,0,2),r)})}),o)},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.RECEIVE_MESSAGE_TYPES=void 0;var o,i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},a=r(3),u=r(8),s=r(22),c=r(25);n.RECEIVE_MESSAGE_TYPES=(o={},t(o,a.CONSTANTS.POST_MESSAGE_TYPE.ACK,function(e,n,r){var t=c.listeners.response[n.hash];if(!t)throw new Error("No handler found for post message ack for message: "+n.name+" in "+window.location.href);t.ack=!0}),t(o,a.CONSTANTS.POST_MESSAGE_TYPE.REQUEST,function(e,n,r){function t(t){return n.fireAndForget||(0,u.isWindowClosed)(e)?u.promise.Promise.resolve():(0,s.sendMessage)(e,i({target:n.originalSource,hash:n.hash,name:n.name},t),r)}var o=(0,c.getRequestListener)(n.name,e);return u.promise.Promise.all([t({type:a.CONSTANTS.POST_MESSAGE_TYPE.ACK}),u.promise.run(function(){if(!o)throw new Error("No postmessage request handler for "+n.name+" in "+window.location.href);if(o.domain){var t="string"==typeof o.domain&&r===o.domain||o.domain instanceof RegExp&&r.match(o.domain);if(!t)throw new Error("Message origin "+r+" does not match domain "+o.domain)}return u.promise.deNodeify(o.handler,e,n.data)}).then(function(e){return t({type:a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,ack:a.CONSTANTS.POST_MESSAGE_ACK.SUCCESS,data:e})},function(e){return t({type:a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,ack:a.CONSTANTS.POST_MESSAGE_ACK.ERROR,error:e.stack?e.message+"\n"+e.stack:e.toString()})})])["catch"](function(e){return o&&o.handleError?o.handleError(e):void u.log.error(e.stack||e.toString())})}),t(o,a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,function(e,n,r){var t=c.listeners.response[n.hash];if(!t)throw new Error("No response handler found for post message response "+n.name+" in "+window.location.href);return delete c.listeners.response[n.hash],n.ack===a.CONSTANTS.POST_MESSAGE_ACK.ERROR?t.respond(new Error(n.error)):n.ack===a.CONSTANTS.POST_MESSAGE_ACK.SUCCESS?t.respond(null,n.data||n.response):void 0}),o)},function(e,n,r){"use strict";function t(){s.global.listeners.request=[],s.global.listeners.response=[]}function o(e,n){for(var r=s.global.listeners.request,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.name===e){if(!a.win)return a.options;if(n&&(0,u.isWindowEqual)(n,a.win))return a.options}}}function i(e){for(var n=void 0,r=s.global.listeners.request,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.options===e){n=a;break}}n&&s.global.listeners.request.splice(s.global.listeners.request.indexOf(n),1)}function a(e,n,r,t){var a=o(e,n);if(a){if(!t)throw new Error("Request listener already exists for "+e);i(a)}c.request.push({name:e,win:n,options:r})}Object.defineProperty(n,"__esModule",{value:!0}),n.listeners=void 0,n.resetListeners=t,n.getRequestListener=o,n.removeRequestListener=i,n.addRequestListener=a;var u=r(8),s=r(15);s.global.listeners=s.global.listeners||{request:[],response:[]};var c=n.listeners=s.global.listeners},function(e,n,r){"use strict";function t(e){if(!e.name)throw new Error("Expected options.name");e.handler=e.handler||u.util.noop,e.errorHandler=e.errorHandler||function(e){throw e},e.once&&!function(){var n=e.handler;e.handler=u.util.once(function(){return(0,s.removeRequestListener)(e),n.apply(this,arguments)})}();var n=e.override||a.CONFIG.MOCK_MODE;return(0,s.addRequestListener)(e.name,e.window,e,n),e.handleError=function(n){e.errorHandler(n)},e.window&&e.errorOnClose&&!function(){var n=u.util.safeInterval(function(){(0,u.isWindowClosed)(e.window)&&(n.cancel(),e.handleError(new Error("Post message target window is closed")))},50)}(),{cancel:function(){(0,s.removeRequestListener)(e)}}}function o(e,n,r,o){return n instanceof Function&&(o=r,r=n,n={}),n=n||{},n.name=e,n.handler=r||n.handler,n.errorHandler=o||n.errorHandler,t(n)}function i(e,n,r,o){n instanceof Function&&(o=r,r=n,n={}),n=n||{},n.name=e,n.handler=r||n.handler,n.errorHandler=o||n.errorHandler,n.once=!0;var i=new u.promise.Promise(function(e,r){n.handler=n.handler||function(n,r){return e(r)},n.errorHandler=n.errorHandler||r}),a=t(n);return u.util.extend(i,a),i}Object.defineProperty(n,"__esModule",{value:!0}),n.listen=t,n.on=o,n.once=i;var a=r(3),u=r(8),s=r(6)},function(e,n,r){"use strict";function t(){a.CONFIG.MOCK_MODE=!0}function o(){a.CONFIG.MOCK_MODE=!1}function i(){delete window[a.CONSTANTS.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",u.messageListener)}Object.defineProperty(n,"__esModule",{value:!0}),n.CONSTANTS=n.CONFIG=void 0,n.enableMockMode=t,n.disableMockMode=o;var a=r(3);Object.defineProperty(n,"CONFIG",{enumerable:!0,get:function(){return a.CONFIG}}),Object.defineProperty(n,"CONSTANTS",{enumerable:!0,get:function(){return a.CONSTANTS}}),n.disable=i;var u=r(6)}])});
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("postRobot",[],n):"object"==typeof exports?exports.postRobot=n():e.postRobot=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){"use strict";function t(){u.global.initialized||(i.util.listen(window,"message",a.messageListener),(0,i.initOnReady)(),(0,i.listenForMethods)()),u.global.initialized=!0}Object.defineProperty(n,"__esModule",{value:!0}),n.Promise=void 0;var o=r(1);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(8);Object.defineProperty(n,"Promise",{enumerable:!0,get:function(){return i.Promise}});var a=r(6),u=r(15);t(),n["default"]=e.exports},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.linkUrl=n.util=n.openBridge=n.reset=n.parent=void 0;var t=r(2);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(26);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(27);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})});var a=r(6);Object.defineProperty(n,"reset",{enumerable:!0,get:function(){return a.resetListeners}});var u=r(19);Object.defineProperty(n,"openBridge",{enumerable:!0,get:function(){return u.openBridge}});var s=r(12);Object.defineProperty(n,"util",{enumerable:!0,get:function(){return s.util}});var c=r(14);Object.defineProperty(n,"linkUrl",{enumerable:!0,get:function(){return c.linkUrl}});n.parent=(0,c.getParentWindow)()},function(e,n,r){"use strict";function t(e){return s.promise.nodeify(new s.promise.Promise(function(n,r){if(!e.name)throw new Error("Expected options.name");if(!e.window)throw new Error("Expected options.window");if(a.CONFIG.MOCK_MODE)e.window=window;else if("string"==typeof e.window){var t=document.getElementById(e.window);if(!t)throw new Error("Expected options.window "+e.window+" to be a valid element id");if("iframe"!==t.tagName.toLowerCase())throw new Error("Expected options.window "+e.window+" to be an iframe");if(e.window=t.contentWindow,!e.window)throw new Error("Expected options.window")}var o=e.name+"_"+s.util.uniqueID();if(u.listeners.response[o]=e,(0,s.isWindowClosed)(e.window))throw new Error("Target window is closed");var i=!1;return e.respond=function(e,t){return e||(i=!0),e?r(e):n(t)},s.promise.run(function(){if((0,s.isParentWindow)(e.window,window))return(0,s.onWindowReady)(e.window)}).then(function(){if((0,u.sendMessage)(e.window,{hash:o,type:a.CONSTANTS.POST_MESSAGE_TYPE.REQUEST,name:e.name,data:e.data,fireAndForget:e.fireAndForget},e.domain||"*")["catch"](r),e.fireAndForget)return n();var t=s.util.intervalTimeout(a.CONFIG.ACK_TIMEOUT,100,function(n){return e.ack||(0,s.isWindowClosed)(e.window)?t.cancel():n?void 0:r(new Error("No ack for postMessage "+e.name+" in "+a.CONFIG.ACK_TIMEOUT+"ms"))});e.timeout&&!function(){var n=s.util.intervalTimeout(e.timeout,100,function(t){return i||(0,s.isWindowClosed)(e.window)?n.cancel():t?void 0:r(new Error("Post message response timed out after "+e.timeout+" ms"))},e.timeout)}()})["catch"](r)}),e.callback)}function o(e,n,r,o,i){return i||(!o&&r instanceof Function?(i=r,o={},r={}):o instanceof Function&&(i=o,o={})),o=o||{},o.window=e,o.name=n,o.data=r,o.callback=i,t(o)}function i(e,n,r,t){var i=(0,s.getParentWindow)();return i?o(i,e,n,r,t):new s.promise.Promise(function(e,n){return n(new Error("Window does not have a parent"))})}Object.defineProperty(n,"__esModule",{value:!0}),n.request=t,n.send=o,n.sendToParent=i;var a=r(3),u=r(6),s=r(8)},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(4);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(5);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})})},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.CONFIG=void 0;var o,i=r(5),a=n.CONFIG={ALLOW_POSTMESSAGE_POPUP:!1,LOG_LEVEL:"info",ACK_TIMEOUT:1e3,LOG_TO_PAGE:!1,MOCK_MODE:!1,ALLOWED_POST_MESSAGE_METHODS:(o={},t(o,i.CONSTANTS.SEND_STRATEGIES.POST_MESSAGE,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.GLOBAL_METHOD,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.REMOTE_BRIDGE,!0),t(o,i.CONSTANTS.SEND_STRATEGIES.LOCAL_BRIDGE,!0),o)};0===window.location.href.indexOf(i.CONSTANTS.FILE_PROTOCOL)&&(a.ALLOW_POSTMESSAGE_POPUP=!0)},function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=n.CONSTANTS={POST_MESSAGE_TYPE:{REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},POST_MESSAGE_ACK:{SUCCESS:"success",ERROR:"error"},POST_MESSAGE_NAMES:{METHOD:"postrobot_method",READY:"postrobot_ready"},WINDOW_TYPES:{FULLPAGE:"fullpage",POPUP:"popup",IFRAME:"iframe"},WINDOW_PROPS:{POSTROBOT:"__postRobot__"},SERIALIZATION_TYPES:{METHOD:"postrobot_method"},SEND_STRATEGIES:{POST_MESSAGE:"postrobot_post_message",GLOBAL_METHOD:"postrobot_global_method",REMOTE_BRIDGE:"postrobot_remote_bridge",LOCAL_BRIDGE:"postrobot_local_bridge"},MOCK_PROTOCOL:"mock://",FILE_PROTOCOL:"file://"};n.POST_MESSAGE_NAMES_LIST=Object.keys(r.POST_MESSAGE_NAMES).map(function(e){return r.POST_MESSAGE_NAMES[e]})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(7);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(22);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(25);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,n,r){"use strict";function t(e){try{e=JSON.parse(e)}catch(n){return}if(e.type&&w.RECEIVE_MESSAGE_TYPES[e.type])return e}function o(e,n){var r={"window.parent":function(e){return(0,c.getParent)(window)},"window.opener":function(e){return(0,c.getOpener)(window)},"window.parent.opener":function(e){return(0,c.getOpener)((0,c.getParent)(window))},"window.opener.parent":function(e){return(0,c.getParent)((0,c.getOpener)(window))}},t=void 0;try{t=r[e](n)}catch(o){throw new Error("Can not get "+e+": "+o.message)}if(!t)throw new Error("Can not get "+e+": not available");return t}function i(e,n){if(n.targetHint){var r=o(n.targetHint,n.target);return delete n.targetHint,r}if(n.target&&n.target!==(0,c.getWindowId)(window)){var t=(0,c.getWindowById)(n.target);if(!t)throw new Error("Unable to find window to proxy message to: "+n.target);return t}}function a(e){try{if(!e.source)return}catch(n){return}var r=e.source,a=e.origin,u=e.data,g=t(u);if(g&&(0===g.sourceDomain.indexOf(s.CONSTANTS.MOCK_PROTOCOL)&&(a=g.sourceDomain),0===g.sourceDomain.indexOf(s.CONSTANTS.FILE_PROTOCOL)&&(a=g.sourceDomain),f.global.receivedMessages.indexOf(g.id)===-1)){if(f.global.receivedMessages.push(g.id),g.sourceDomain!==a)throw new Error("Message source domain "+g.sourceDomain+" does not match message origin "+a);if(g.originalSourceDomain!==a&&!(0,c.isSameDomain)(r))throw new Error("Message original source domain "+g.originalSourceDomain+" does not match message origin "+a);(0,c.registerWindow)(g.source,r,a);var m=void 0;try{m=i(r,g)}catch(n){return c.log.debug(n.message)}var p=void 0;if(p=s.POST_MESSAGE_NAMES_LIST.indexOf(g.name)!==-1||g.type===s.CONSTANTS.POST_MESSAGE_TYPE.ACK||m?"debug":"error"===g.ack?"error":"info",c.log.logLevel(p,[m?"#receiveproxy":"#receive",g.type,g.name,g]),m)return(0,c.isWindowClosed)(m)?c.log.debug("Target window is closed: "+g.target+" - can not proxy "+g.type+" "+g.name):(delete g.target,(0,l.sendMessage)(m,g,g.domain||"*",!0));var O=r;if(g.originalSource!==g.source){if(g.sourceHint)O=o(g.sourceHint,g.originalSource),delete g.sourceHint;else if(O=(0,c.getWindowById)(g.originalSource),!O)throw new Error("Can not find original message source: "+g.originalSource);(0,c.registerWindow)(g.originalSource,O,g.originalSourceDomain)}if(O!==r&&(0,d.registerBridge)(r,O),(0,c.isWindowClosed)(O))return c.log.debug("Source window is closed: "+g.originalSource+" - can not send "+g.type+" "+g.name);if(s.CONFIG.MOCK_MODE)return w.RECEIVE_MESSAGE_TYPES[g.type](O,g,g.originalSourceDomain);g.data&&(g.data=(0,c.deserializeMethods)(O,g.originalSourceDomain,g.data)),w.RECEIVE_MESSAGE_TYPES[g.type](O,g,g.originalSourceDomain)}}function u(e){try{e.source}catch(n){return}e={source:e.source||e.sourceElement,origin:e.origin||e.originalEvent.origin,data:e.data};try{(0,d.emulateIERestrictions)(e.source,window)}catch(n){return}a(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.receiveMessage=a,n.messageListener=u;var s=r(3),c=r(8),d=r(18),f=r(15),l=r(22),w=r(24);f.global.receivedMessages=f.global.receivedMessages||[]},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(9);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(12);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(13);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})});var a=r(14);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(16);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return u[e]}})});var s=r(11);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return s[e]}})});var c=r(17);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return c[e]}})})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.promise=n.Promise=void 0;var t=r(10),o=r(11),i=n.Promise=t.SyncPromise,a=n.promise={Promise:i,run:function(e){return i.resolve().then(e)},nextTick:function(e){return new i(function(n,r){(0,o.nextTick)(function(){return a.run(e).then(n,r)})})},method:function(e){return function(){var n=this,r=arguments;return i.resolve().then(function(){return e.apply(n,r)})}},nodeify:function(e,n){return n?void e.then(function(e){n(null,e)},function(e){n(e)}):e},deNodeify:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),t=1;t<n;t++)r[t-1]=arguments[t];return new i(function(n,t){try{return r.length<e.length?e.apply(void 0,r.concat([function(e,r){return e?t(e):n(r)}])):a.run(function(){return e.apply(void 0,r)}).then(n,t)}catch(o){return t(o)}})},map:function(e,n){for(var r=[],t=function(t){r.push(a.run(function(){return n(e[t])}))},o=0;o<e.length;o++)t(o);return i.all(r)}}},function(e,n){"use strict";function r(e,n,r){function t(){if(a){if(s)return r(o);if(u)return n(i)}}var o,i,a=!1,u=!1,s=!1;try{e(function(e){i=e,u=!0,t()},function(e){o=e,s=!0,t()})}catch(c){return r(c)}a=!0,t()}function t(e){d.push(e),s=s||setTimeout(o,1)}function o(){s=null;var e=d;d=[];for(var n=0;n<e.length;n++){var r=e[n];r.hasHandlers||(r.handlers.push({onError:function(e){if(!r.hasHandlers){i(e);for(var n=0;n<c.length;n++)c[n](r.value)}}}),r.dispatch())}}function i(e){setTimeout(function(){throw e},1)}function a(e){try{if(!e)return!1;if(window.Window&&e instanceof window.Window)return!1;if(window.constructor&&e instanceof window.constructor)return!1;if(f){var n=f.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if(e&&e.then instanceof Function)return!0}catch(r){return!1}return!1}function u(){window.Promise=l}Object.defineProperty(n,"__esModule",{value:!0}),n.patchPromise=u;var s,c=[],d=[],f={}.toString,l=n.SyncPromise=function(e){if(this.resolved=!1,this.rejected=!1,this.hasHandlers=!1,this.handlers=[],t(this),e){var n=this;r(e,function(e){return n.resolve(e)},function(e){return n.reject(e)})}};l.resolve=function(e){return a(e)?e:(new l).resolve(e)},l.reject=function(e){return(new l).reject(e)},l.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(a(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},l.prototype.reject=function(e){if(this.resolved||this.rejected)return this;if(a(e))throw new Error("Can not reject promise with another promise");return this.rejected=!0,this.value=e,this.dispatch(),this},l.prototype.dispatch=function(){var e=this;if(this.resolved||this.rejected)for(var n=function(){var n=e.handlers.shift();try{e.resolved?r=n.onSuccess?n.onSuccess(e.value):e.value:n.onError?r=n.onError(e.value):t=e.value}catch(o){t=o}if(r===e)throw new Error("Can not return a promise from the the then handler of the same promise");return n.promise?void(t?n.promise.reject(t):a(r)?r.then(function(e){n.promise.resolve(e)},function(e){n.promise.reject(e)}):n.promise.resolve(r)):"continue"};this.handlers.length;){var r,t;n()}},l.prototype.then=function(e,n){var r=new l(null,this);return this.handlers.push({promise:r,onSuccess:e,onError:n}),this.hasHandlers=!0,this.dispatch(),r},l.prototype["catch"]=function(e){return this.then(null,e)},l.prototype["finally"]=function(e){return this.then(function(n){return e(),n},function(n){throw e(),n})},l.all=function(e){for(var n=new l,r=e.length,t=[],o=function(o){var i=a(e[o])?e[o]:l.resolve(e[o]);i.then(function(e){t[o]=e,r-=1,0===r&&n.resolve(t)},function(e){n.reject(e)})},i=0;i<e.length;i++)o(i);return n},l.onPossiblyUnhandledException=function(e){c.push(e)}},function(e,n,r){"use strict";function t(e){a.push(e),window.postMessage(i,"*")}Object.defineProperty(n,"__esModule",{value:!0}),n.nextTick=t;var o=r(12),i="__nextTick__postRobot__"+o.util.uniqueID(),a=[];window.addEventListener("message",function(e){if(e.data===i){var n=a.shift();n.call()}})},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.util=void 0;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(3),i=n.util={once:function(e){if(!e)return e;var n=!1;return function(){if(!n)return n=!0,e.apply(this,arguments)}},noop:function(){},safeHasProp:function(e,n){try{return!!e[n]}catch(r){return!1}},safeGetProp:function(e,n){try{return e[n]}catch(r){return}},listen:function(e,n,r){return e.addEventListener?e.addEventListener(n,r):e.attachEvent("on"+n,r),{cancel:function(){e.removeEventListener?e.removeEventListener(n,r):e.detachEvent("on"+n,r)}}},apply:function(e,n,r){return e.apply instanceof Function?e.apply(n,r):e(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9])},find:function(e,n,r){if(!e)return r;for(var t=0;t<e.length;t++)if(n(e[t]))return e[t];return r},map:function(e,n){for(var r=[],t=0;t<e.length;t++)r.push(n(e[t]));return r},some:function(e,n){n=n||Boolean;for(var r=0;r<e.length;r++)if(n(e[r]))return!0;return!1},keys:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(r);return n},values:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(e[r]);return n},getByValue:function(e,n){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===n)return r},uniqueID:function(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})},memoize:function(e){var n={};return function(){var r=JSON.stringify(Array.prototype.slice.call(arguments));return n.hasOwnProperty(r)||(n[r]=e.apply(this,arguments)),n[r]}},extend:function(e,n){if(!n)return e;for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e},each:function(e,n){if(e instanceof Array)for(var r=0;r<e.length;r++)n(e[r],r);else if(e instanceof Object&&!(e instanceof Function))for(var t in e)e.hasOwnProperty(t)&&n(e[t],t)},replaceObject:function(e,n){var r=e instanceof Array?[]:{};return i.each(e,function(e,o){var a=n(e,o);void 0!==a?r[o]=a:"object"===("undefined"==typeof e?"undefined":t(e))&&null!==e?r[o]=i.replaceObject(e,n):r[o]=e}),r},safeInterval:function(e,n){function r(){t=setTimeout(r,n),e.call()}var t=void 0;return t=setTimeout(r,n),{cancel:function(){clearTimeout(t)}}},intervalTimeout:function(e,n,r){var t=i.safeInterval(function(){e-=n,e=e<=0?0:e,0===e&&t.cancel(),r(e)},n);return t},getDomain:function(e){return e=e||window,e.mockDomain&&0===e.mockDomain.indexOf(o.CONSTANTS.MOCK_PROTOCOL)?e.mockDomain:e.location.protocol+"//"+e.location.host},getDomainFromUrl:function(e){var n=void 0;return 0!==e.indexOf("http://")&&0!==e.indexOf("https://")?this.getDomain():(n=e,n=n.split("/").slice(0,3).join("/"))}}},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.log=void 0;var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(12),i=r(14),a=r(3),u=["debug","info","warn","error"];Function.prototype.bind&&window.console&&"object"===t(console.log)&&["log","info","warn","error"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call);var s=n.log={clearLogs:function(){if(window.console&&window.console.clear&&window.console.clear(),a.CONFIG.LOG_TO_PAGE){var e=document.getElementById("postRobotLogs");e&&e.parentNode.removeChild(e)}},writeToPage:function(e,n){setTimeout(function(){var r=document.getElementById("postRobotLogs");r||(r=document.createElement("div"),r.id="postRobotLogs",r.style.cssText="width: 800px; font-family: monospace; white-space: pre-wrap;",document.body.appendChild(r));var t=document.createElement("div"),i=(new Date).toString().split(" ")[4],a=o.util.map(n,function(e){if("string"==typeof e)return e;if(!e)return toString.call(e);var n=void 0;try{n=JSON.stringify(e,0,2)}catch(r){n="[object]"}return"\n\n"+n+"\n\n"}).join(" "),u=i+" "+e+" "+a;t.innerHTML=u;var s={log:"#ddd",warn:"orange",error:"red",info:"blue",debug:"#aaa"}[e];t.style.cssText="margin-top: 10px; color: "+s+";",r.childNodes.length?r.insertBefore(t,r.childNodes[0]):r.appendChild(t)})},logLevel:function(e,n){u.indexOf(e)<u.indexOf(a.CONFIG.LOG_LEVEL)||(n=Array.prototype.slice.call(n),n.unshift(window.location.pathname),n.unshift(window.location.host),n.unshift("<"+(0,i.getWindowType)().toLowerCase()+">"),n.unshift("[post-robot]"),a.CONFIG.LOG_TO_PAGE&&s.writeToPage(e,n),window.console&&(window.console[e]||(e="log"),window.console[e]&&window.console[e].apply(window.console,n)))},debug:function(){s.logLevel("debug",arguments)},info:function(){s.logLevel("info",arguments)},warn:function(){s.logLevel("warn",arguments)},error:function(){s.logLevel("error",arguments)}}},function(e,n,r){"use strict";function t(e,n){var r=void 0;try{r=e[n]}catch(t){}return r}function o(e){for(var n=P.global.domainMatches,r=Array.isArray(n),t=0,n=r?n:n[Symbol.iterator]();;){var o;if(r){if(t>=n.length)break;o=n[t++]}else{if(t=n.next(),t.done)break;o=t.value}var i=o;if(i.win===e)return i.match}var a=!1;try{T.util.getDomain(window)===T.util.getDomain(e)&&(a=!0)}catch(u){}return P.global.domainMatches.push({win:e,match:a}),M||(M=setTimeout(function(){P.global.domainMatches=[],M=null},1)),a}function i(e){try{return!e||e.closed||"undefined"==typeof e.closed||o(e)&&t(e,"mockclosed")}catch(n){return!0}}function a(e){if(e)try{return e.opener}catch(n){return}}function u(e){if(e)try{if(e.parent&&e.parent!==e)return e.parent}catch(n){return}}function s(e){if(e)try{return e.top}catch(n){return}}function c(e,n){try{return e.frames[n]}catch(r){}try{return e[n]}catch(r){}}function d(e){var n=[],r=void 0;try{r=e.frames}catch(t){r=e}var o=void 0;try{o=r.length}catch(t){}if(0===o)return n;if(o)for(var i=0;i<o;i++){var a=void 0;try{a=r[i]}catch(t){continue}n.push(a)}else for(var u=0;;){var s=void 0;try{s=r[u]}catch(t){return n}if(!s)return n;if(n.push(s),u+=1,u>20)return n}return n}function f(e,n){try{var r=u(n);if(r)return r===e}catch(t){}try{var o=d(e);if(!o||!o.length)return!1;for(var i=0;i<o.length;i++)if(o[i]===n)return!0}catch(t){}return!1}function l(e){e=e||window;var n=a(e);if(n)return n;var r=u(e);return r?r:void 0}function w(e,n){n=n||window;var r=l(e);if(r)return r===n;if(e===window)return l(e)===n;if(e===n)return!1;if(s(e)===e)return!1;var t=d(n);if(t&&t.length)for(var o=0;o<t.length;o++)if(t[o]===e)return!0;return!1}function g(){return Boolean(a(window))}function m(){return Boolean(u(window))}function p(){return Boolean(!m()&&!g())}function O(){return g()?A.CONSTANTS.WINDOW_TYPES.POPUP:m()?A.CONSTANTS.WINDOW_TYPES.IFRAME:A.CONSTANTS.WINDOW_TYPES.FULLPAGE}function S(e){if(e===window)return N;for(var n=P.global.windows.length-1;n>=0;n--){var r=P.global.windows[n];try{if(r.win===e)return r.id}catch(t){continue}}}function h(e){if(e===window.name||e===N)return window;if(window.frames&&window.frames[e])return window.frames[e];for(var n=P.global.windows.length-1;n>=0;n--){var r=P.global.windows[n];try{if(r.id===e)return r.win}catch(t){continue}}}function v(e){if(e===window)return T.util.getDomain(window);for(var n=P.global.windows.length-1;n>=0;n--){var r=P.global.windows[n];try{if(r.win===e&&r.domain)return r.domain}catch(t){continue}}}function E(e,n,r){for(var t=P.global.windows,o=Array.isArray(t),a=0,t=o?t:t[Symbol.iterator]();;){var u;if(o){if(a>=t.length)break;u=t[a++]}else{if(a=t.next(),a.done)break;u=a.value}var s=u;try{if(s.id===e&&s.win===n)return void(s.domain=r)}catch(c){continue}if(s.id===e&&s.win!==n&&!i(s.win))throw new Error("Can not register a duplicate window with name "+e)}P.global.windows.push({id:e,win:n,domain:r})}function b(e,n){if(e===n)return!0;var r=S(e),t=S(n);return!(!r||!t||r!==t)}function _(e,n){var r=s(e),t=s(n);try{return r&&t&&r===t}catch(o){return!1}}function y(e,n,r){var t=T.util.getDomainFromUrl(r);E(e,n,t),P.global.domainMatches.push({win:n,match:T.util.getDomain()===t})}Object.defineProperty(n,"__esModule",{value:!0}),n.isSameDomain=o,n.isWindowClosed=i,n.getOpener=a,n.getParent=u,n.getTop=s,n.getFrameByName=c,n.getFrames=d,n.isFrameOwnedBy=f,n.getParentWindow=l,n.isParentWindow=w,n.isPopup=g,n.isIframe=m,n.isFullpage=p,n.getWindowType=O,n.getWindowId=S,n.getWindowById=h,n.getWindowDomain=v,n.registerWindow=E,n.isWindowEqual=b,n.isSameTopWindow=_,n.linkUrl=y;var T=r(12),P=r(15),A=r(3);P.global.domainMatches=P.global.domainMatches||[];var M=void 0;P.global.windows=P.global.windows||[];var N=window.name||O()+"_"+T.util.uniqueID(),C=window.open;window.open=function(e,n,r,t){n||(n=T.util.uniqueID(),arguments[1]=n);var o=T.util.apply(C,this,arguments);return e?y(n,o,e):E(n,o),o}},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.global=void 0;var t=r(3);n.global=window[t.CONSTANTS.WINDOW_PROPS.POSTROBOT]=window[t.CONSTANTS.WINDOW_PROPS.POSTROBOT]||{}},function(e,n,r){"use strict";function t(e){return e instanceof Object&&e.__type__===s.CONSTANTS.SERIALIZATION_TYPES.METHOD&&e.__id__}function o(e,n,r,t){var o=c.util.uniqueID();return w.global.methods[o]={destination:e,domain:n,method:r},{__type__:s.CONSTANTS.SERIALIZATION_TYPES.METHOD,__id__:o,__name__:t}}function i(e,n,r){return c.util.replaceObject({obj:r},function(r,t){if(r instanceof Function)return o(e,n,r,t)}).obj}function a(e,n,r){function t(){var t=Array.prototype.slice.call(arguments);return f.log.debug("Call foreign method",r.__name__,t),(0,d.send)(e,s.CONSTANTS.POST_MESSAGE_NAMES.METHOD,{id:r.__id__,name:r.__name__,args:t},{domain:n}).then(function(e){var n=e.data;return f.log.debug("Got foreign method result",r.__name__,n.result),n.result})}return t.__name__=r.__name__,t}function u(e,n,r){return c.util.replaceObject({obj:r},function(r,o){if(t(r))return a(e,n,r)}).obj}Object.defineProperty(n,"__esModule",{value:!0}),n.listenForMethods=void 0,n.serializeMethod=o,n.serializeMethods=i,n.deserializeMethod=a,n.deserializeMethods=u;var s=r(3),c=r(12),d=r(1),f=r(13),l=r(9),w=r(15);w.global.methods=w.global.methods||{};n.listenForMethods=c.util.once(function(){(0,d.on)(s.CONSTANTS.POST_MESSAGE_NAMES.METHOD,function(e){var n=e.source,r=e.origin,t=e.data,o=w.global.methods[t.id];if(!o)throw new Error("Could not find method with id: "+t.id);if(o.destination!==n)throw new Error("Method window does not match");if(o.domain&&"*"!==o.domain&&r!==o.domain)throw new Error("Method domain "+o.domain+" does not match origin "+r);return f.log.debug("Call local method",t.name,t.args),l.promise.run(function(){return o.method.apply(null,t.args)}).then(function(e){return{result:e,id:t.id,name:t.name}})})})},function(e,n,r){"use strict";function t(){(0,u.on)(i.CONSTANTS.POST_MESSAGE_NAMES.READY,function(e){for(var n=e.source,r=(e.data,d.global.readyPromises),t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.win===n)return void a.promise.resolve(n)}d.global.readyPromises.push({win:n,promise:(new c.SyncPromise).resolve(n)})});var e=(0,a.getParentWindow)();e&&(0,u.send)(e,i.CONSTANTS.POST_MESSAGE_NAMES.READY,{})["catch"](function(e){s.log.debug(e.stack||e.toString())})}function o(e){for(var n=arguments.length<=1||void 0===arguments[1]?5e3:arguments[1],r=arguments.length<=2||void 0===arguments[2]?"Window":arguments[2],t=d.global.readyPromises,o=Array.isArray(t),i=0,t=o?t:t[Symbol.iterator]();;){var a;if(o){if(i>=t.length)break;a=t[i++]}else{if(i=t.next(),i.done)break;a=i.value}var u=a;if(u.win===e)return u.promise}var s=new c.SyncPromise;return d.global.readyPromises.push({win:e,promise:s}),setTimeout(function(){return s.reject(new Error(r+" did not load after "+n+"ms"))},n),s}Object.defineProperty(n,"__esModule",{value:!0}),n.initOnReady=t,n.onWindowReady=o;var i=r(3),a=r(14),u=r(1),s=r(13),c=r(10),d=r(15);d.global.readyPromises=d.global.readyPromises||[]},function(e,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=r(19);Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})});var o=r(20);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})});var i=r(21);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,n,r){"use strict";function t(e){e=e||g.util.getDomainFromUrl(e||window.location.href);var n=e.replace(/[^a-zA-Z0-9]+/g,"_"),r=m+"_"+n;return r}function o(){return new g.promise.Promise(function(e){return window.document&&window.document.body?e(window.document):void window.document.addEventListener("DOMContentLoaded",function(n){return e(window.document)})})}function i(e){var n=arguments.length<=1||void 0===arguments[1]?S.LOCAL:arguments[1];return g.promise.run(function(){if(n===S.LOCAL&&p[e])return p[e];for(var r=O,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.domain===e&&a.zone===n)return a.bridge}}).then(function(e){return e&&n===S.LOCAL?(0,g.onWindowReady)(e):e})}function a(e){var n=arguments.length<=1||void 0===arguments[1]?S.LOCAL:arguments[1];return g.promise.run(function(){if((0,g.getOpener)(e)===window)return(0,g.onWindowReady)(e)}).then(function(){for(var r=O,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var a;if(t){if(o>=r.length)break;a=r[o++]}else{if(o=r.next(),o.done)break;a=o.value}var u=a;if(u.win===e&&u.zone===n)return u.bridge}var s=(0,g.getWindowDomain)(e);if(s)return i(s,n)}).then(function(e){return e&&n===S.LOCAL?(0,g.onWindowReady)(e):e})}function u(e){return i(e,S.LOCAL)}function s(e){return a(e,S.LOCAL)}function c(e){return i(e,S.REMOTE)}function d(e){return g.promise.run(function(){return a(e,S.REMOTE)}).then(function(n){if(n)return n;var r=t(window.location.href);try{if(e[r])return e[r]}catch(o){}try{var i=(0,g.getFrames)(e);if(!i||!i.length)return;for(var a=0;a<i.length;a++)try{var u=i[a];if(u&&u!==window&&(0,g.isSameDomain)(u)&&u[w.CONSTANTS.WINDOW_PROPS.POSTROBOT])return u}catch(o){continue}}catch(o){}})}function f(e,n){for(var r=void 0,t=O,o=Array.isArray(t),i=0,t=o?t:t[Symbol.iterator]();;){var a;if(o){if(i>=t.length)break;a=t[i++]}else{if(i=t.next(),i.done)break;a=i.value}var u=a;if(u.bridge===e){r=u;break}}if(!r){var s=(0,g.isFrameOwnedBy)(window,e)?S.LOCAL:S.REMOTE;r={bridge:e,domain:(0,g.getWindowDomain)(e),windows:[],zone:s},O.push(r)}n&&r.windows.indexOf(n)===-1&&r.windows.push(n)}function l(e,n){n=n||g.util.getDomainFromUrl(e);var r=g.promise.run(function(){return u(n)}).then(function(r){if(r)return r;if(g.util.getDomain()!==n){var i=t(n),a=(0,g.getFrameByName)(window,i);if(a)return(0,g.onWindowReady)(a,5e3,"Bridge "+e);g.log.debug("Opening bridge:",e);var u=document.createElement("iframe");return u.setAttribute("name",i),u.setAttribute("id",i),u.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),u.setAttribute("frameborder","0"),u.setAttribute("border","0"),u.setAttribute("scrolling","no"),u.setAttribute("allowTransparency","true"),u.setAttribute("tabindex","-1"),u.setAttribute("hidden","true"),u.setAttribute("title",""),u.setAttribute("role","presentation"),u.src=e,o().then(function(r){r.body.appendChild(u);var t=u.contentWindow;return(0,g.registerWindow)(i,t,n),f(t),delete p[n],new g.promise.Promise(function(e,n){u.onload=e,u.onerror=n}).then(function(){return(0,g.onWindowReady)(t,5e3,"Bridge "+e)}).then(function(){return t})})}});return p[n]=r,r}Object.defineProperty(n,"__esModule",{value:!0}),n.getLocalBridgeForDomain=u,n.getLocalBridgeForWindow=s,n.getRemoteBridgeForDomain=c,n.getRemoteBridgeForWindow=d,n.registerBridge=f,n.openBridge=l;var w=r(3),g=r(8),m="__postrobot_bridge__",p={},O=[],S={LOCAL:"local",REMOTE:"remote"}},function(e,n,r){"use strict";var t=r(15),o=r(6);t.global.postMessage=t.global.postMessage||function(e){(0,o.receiveMessage)(e)}},function(e,n,r){"use strict";function t(e,n){if(!o.CONFIG.ALLOW_POSTMESSAGE_POPUP){if((0,i.isSameDomain)(e)&&(0,i.isSameDomain)(n))return;if(!(0,i.isSameTopWindow)(e,n))throw new Error("Can not send and receive post messages between two different windows (disabled to emulate IE)")}}Object.defineProperty(n,"__esModule",{value:!0}),n.emulateIERestrictions=t;var o=r(3),i=r(8)},function(e,n,r){"use strict";function t(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],t=u.util.uniqueID(),o=(0,u.getWindowId)(window),a=(0,u.getWindowType)(),s=(0,u.getWindowId)(e),c=u.util.getDomain(window);return i({},n,r,{id:n.id||t,source:o,originalSource:n.originalSource||o,sourceDomain:c,originalSourceDomain:n.originalSourceDomain||c,windowType:a,originalWindowType:n.originalWindowType||a,target:n.target||s})}function o(e,n,r,o){return u.promise.run(function(){n=t(e,n,{data:(0,u.serializeMethods)(e,r,n.data),domain:r});var i=void 0;if(i=a.POST_MESSAGE_NAMES_LIST.indexOf(n.name)!==-1||n.type===a.CONSTANTS.POST_MESSAGE_TYPE.ACK||o?"debug":"error"===n.ack?"error":"info",u.log.logLevel(i,[o?"#sendproxy":"#send",n.type,n.name,n]),a.CONFIG.MOCK_MODE)return delete n.target,window[a.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:u.util.getDomain(window),source:window,
data:JSON.stringify(n)});if(e===window)throw new Error("Attemping to send message to self");if((0,u.isWindowClosed)(e))throw new Error("Window is closed");u.log.debug("Running send message strategies",n);var c=[];return u.promise.map(u.util.keys(s.SEND_MESSAGE_STRATEGIES),function(t){return u.promise.run(function(){if(!a.CONFIG.ALLOWED_POST_MESSAGE_METHODS[t])throw new Error("Strategy disallowed: "+t);return s.SEND_MESSAGE_STRATEGIES[t](e,n,r)}).then(function(){return c.push(t+": success"),!0},function(e){return c.push(t+": "+e.message),!1})}).then(function(e){var r=u.util.some(e),t=n.type+" "+n.name+" "+(r?"success":"error")+":\n - "+c.join("\n - ")+"\n";if(u.log.debug(t),!r)throw new Error(t)})})}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e};n.buildMessage=t,n.sendMessage=o;var a=r(3),u=r(8),s=r(23)},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.SEND_MESSAGE_STRATEGIES=void 0;var o,i=r(3),a=r(8),u=r(18);n.SEND_MESSAGE_STRATEGIES=(o={},t(o,i.CONSTANTS.SEND_STRATEGIES.POST_MESSAGE,function(e,n,r){return(0,u.emulateIERestrictions)(window,e),r&&0===r.indexOf(i.CONSTANTS.MOCK_PROTOCOL)&&(r=e.location.protocol+"//"+e.location.host),r&&0===r.indexOf(i.CONSTANTS.FILE_PROTOCOL)&&(r="*"),e.postMessage(JSON.stringify(n,0,2),r)}),t(o,i.CONSTANTS.SEND_STRATEGIES.GLOBAL_METHOD,function(e,n,r){if(!(0,a.isSameDomain)(e))throw new Error("Window is not on the same domain");if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use global method to communicate between two different windows, not between frames");var t=a.util.getDomain(window),o=void 0;try{o=a.util.getDomain(e)}catch(u){throw new Error("Can not read target window domain: "+u.message)}if(t!==o)throw new Error("Can not send global message - source "+t+" does not match target "+o);if("*"!==r&&o!==r)throw new Error("Can post post through global method - specified domain "+r+" does not match target domain "+o);if(!a.util.safeHasProp(e,i.CONSTANTS.WINDOW_PROPS.POSTROBOT))throw new Error("post-robot not available on target window at "+o);e[i.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:a.util.getDomain(window),source:window,data:JSON.stringify(n,0,2)})}),t(o,i.CONSTANTS.SEND_STRATEGIES.REMOTE_BRIDGE,function(e,n,r){if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");return(0,u.getRemoteBridgeForWindow)(e).then(function(t){if(!t)throw new Error("No bridge available in window");var o=a.util.getDomain(window),u=void 0;try{u=a.util.getDomain(t)}catch(s){throw new Error("Can not read bridge window domain: "+s.message)}if(o!==u)throw new Error("Can not accept global message through bridge - source "+o+" does not match bridge "+u);if(!a.util.safeHasProp(t,i.CONSTANTS.WINDOW_PROPS.POSTROBOT))throw new Error("post-robot not available on bridge at "+u);n.targetHint="window.parent",window===(0,a.getOpener)(e)&&(n.sourceHint="window.opener"),t[i.CONSTANTS.WINDOW_PROPS.POSTROBOT].postMessage({origin:a.util.getDomain(window),source:window,data:JSON.stringify(n,0,2)},r)})}),t(o,i.CONSTANTS.SEND_STRATEGIES.LOCAL_BRIDGE,function(e,n,r){if((0,a.isSameTopWindow)(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");if(e===(0,a.getOpener)(window)&&(n.targetHint="window.parent.opener"),!n.target&&!n.targetHint)throw new Error("Can not post message down through bridge without target or targetHint");var t=(0,a.getOpener)(e);if(t&&window===t)n.sourceHint="window.opener";else{var o=t&&(0,a.getParent)(t);o&&window===o&&(n.sourceHint="window.opener.parent")}return(0,u.getLocalBridgeForWindow)(e).then(function(t){if(!t)throw new Error("Bridge not initialized");if(e===t)throw new Error("Message target is bridge");r&&0===r.indexOf(i.CONSTANTS.MOCK_PROTOCOL)&&(r=t.location.protocol+"//"+t.location.host),r&&0===r.indexOf(i.CONSTANTS.FILE_PROTOCOL)&&(r="*"),t.postMessage(JSON.stringify(n,0,2),r)})}),o)},function(e,n,r){"use strict";function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}Object.defineProperty(n,"__esModule",{value:!0}),n.RECEIVE_MESSAGE_TYPES=void 0;var o,i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},a=r(3),u=r(8),s=r(22),c=r(25);n.RECEIVE_MESSAGE_TYPES=(o={},t(o,a.CONSTANTS.POST_MESSAGE_TYPE.ACK,function(e,n,r){var t=c.listeners.response[n.hash];if(!t)throw new Error("No handler found for post message ack for message: "+n.name+" in "+window.location.href);t.ack=!0}),t(o,a.CONSTANTS.POST_MESSAGE_TYPE.REQUEST,function(e,n,r){function t(t){return n.fireAndForget||(0,u.isWindowClosed)(e)?u.promise.Promise.resolve():(0,s.sendMessage)(e,i({target:n.originalSource,hash:n.hash,name:n.name},t),r)}var o=(0,c.getRequestListener)(n.name,e);return u.promise.Promise.all([t({type:a.CONSTANTS.POST_MESSAGE_TYPE.ACK}),u.promise.run(function(){if(!o)throw new Error("No postmessage request handler for "+n.name+" in "+window.location.href);if(o.domain){var t="string"==typeof o.domain&&r===o.domain||o.domain instanceof RegExp&&r.match(o.domain);if(!t)throw new Error("Message origin "+r+" does not match domain "+o.domain)}var i=n.data;return u.promise.deNodeify(o.handler,{source:e,origin:r,data:i})}).then(function(e){return t({type:a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,ack:a.CONSTANTS.POST_MESSAGE_ACK.SUCCESS,data:e})},function(e){return t({type:a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,ack:a.CONSTANTS.POST_MESSAGE_ACK.ERROR,error:e.stack?e.message+"\n"+e.stack:e.toString()})})])["catch"](function(e){return o&&o.handleError?o.handleError(e):void u.log.error(e.stack||e.toString())})}),t(o,a.CONSTANTS.POST_MESSAGE_TYPE.RESPONSE,function(e,n,r){var t=c.listeners.response[n.hash];if(!t)throw new Error("No response handler found for post message response "+n.name+" in "+window.location.href);if(delete c.listeners.response[n.hash],n.ack===a.CONSTANTS.POST_MESSAGE_ACK.ERROR)return t.respond(new Error(n.error));if(n.ack===a.CONSTANTS.POST_MESSAGE_ACK.SUCCESS){var o=n.data||n.response;return t.respond(null,{source:e,origin:r,data:o})}}),o)},function(e,n,r){"use strict";function t(){s.global.listeners.request=[],s.global.listeners.response=[]}function o(e,n){for(var r=s.global.listeners.request,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.name===e){if(!a.win)return a.options;if(n&&(0,u.isWindowEqual)(n,a.win))return a.options}}}function i(e){for(var n=void 0,r=s.global.listeners.request,t=Array.isArray(r),o=0,r=t?r:r[Symbol.iterator]();;){var i;if(t){if(o>=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var a=i;if(a.options===e){n=a;break}}n&&s.global.listeners.request.splice(s.global.listeners.request.indexOf(n),1)}function a(e,n,r,t){var a=o(e,n);if(a){if(!t)throw new Error("Request listener already exists for "+e);i(a)}c.request.push({name:e,win:n,options:r})}Object.defineProperty(n,"__esModule",{value:!0}),n.listeners=void 0,n.resetListeners=t,n.getRequestListener=o,n.removeRequestListener=i,n.addRequestListener=a;var u=r(8),s=r(15);s.global.listeners=s.global.listeners||{request:[],response:[]};var c=n.listeners=s.global.listeners},function(e,n,r){"use strict";function t(e){if(!e.name)throw new Error("Expected options.name");e.handler=e.handler||u.util.noop,e.errorHandler=e.errorHandler||function(e){throw e},e.once&&!function(){var n=e.handler;e.handler=u.util.once(function(){return(0,s.removeRequestListener)(e),n.apply(this,arguments)})}();var n=e.override||a.CONFIG.MOCK_MODE;return(0,s.addRequestListener)(e.name,e.window,e,n),e.handleError=function(n){e.errorHandler(n)},e.window&&e.errorOnClose&&!function(){var n=u.util.safeInterval(function(){(0,u.isWindowClosed)(e.window)&&(n.cancel(),e.handleError(new Error("Post message target window is closed")))},50)}(),{cancel:function(){(0,s.removeRequestListener)(e)}}}function o(e,n,r,o){return n instanceof Function&&(o=r,r=n,n={}),n=n||{},n.name=e,n.handler=r||n.handler,n.errorHandler=o||n.errorHandler,t(n)}function i(e,n,r,o){n instanceof Function&&(o=r,r=n,n={}),n=n||{},n.name=e,n.handler=r||n.handler,n.errorHandler=o||n.errorHandler,n.once=!0;var i=new u.promise.Promise(function(e,r){n.handler=n.handler||function(n){return e(n)},n.errorHandler=n.errorHandler||r}),a=t(n);return u.util.extend(i,a),i}Object.defineProperty(n,"__esModule",{value:!0}),n.listen=t,n.on=o,n.once=i;var a=r(3),u=r(8),s=r(6)},function(e,n,r){"use strict";function t(){a.CONFIG.MOCK_MODE=!0}function o(){a.CONFIG.MOCK_MODE=!1}function i(){delete window[a.CONSTANTS.WINDOW_PROPS.POSTROBOT],window.removeEventListener("message",u.messageListener)}Object.defineProperty(n,"__esModule",{value:!0}),n.CONSTANTS=n.CONFIG=void 0,n.enableMockMode=t,n.disableMockMode=o;var a=r(3);Object.defineProperty(n,"CONFIG",{enumerable:!0,get:function(){return a.CONFIG}}),Object.defineProperty(n,"CONSTANTS",{enumerable:!0,get:function(){return a.CONSTANTS}}),n.disable=i;var u=r(6)}])});
{
"name": "post-robot",
"version": "2.0.41",
"version": "3.0.0",
"description": "Simple postMessage based server.",

@@ -5,0 +5,0 @@ "main": "dist/post-robot.min.js",

@@ -29,3 +29,3 @@ # post-robot [:]-\\-<

```javascript
postRobot.on('getCart', function(data, callback) {
postRobot.on('getCart', function(event, callback) {
return callback({

@@ -38,4 +38,4 @@ foo: 'bar'

```javascript
postRobot.send(window, 'getCart', function(err, data) {
console.log(data);
postRobot.send(window, 'getCart', function(err, event) {
console.log(event.data);
});

@@ -47,3 +47,3 @@ ```

```javascript
postRobot.once('init', function(source, data, callback) {
postRobot.once('init', function(event, callback) {
...

@@ -56,3 +56,3 @@ });

```javascript
postRobot.on('init', { window: window.parent }, function(source, data, callback) {
postRobot.on('init', { window: window.parent }, function(event, callback) {
...

@@ -65,4 +65,4 @@ });

```javascript
postRobot.send(window, 'getCart', { timeout: 5000 }, function(err, data) {
console.log(data);
postRobot.send(window, 'getCart', { timeout: 5000 }, function(err, event) {
console.log(event.data);
});

@@ -74,4 +74,4 @@ ```

```javascript
postRobot.sendToParent('getCart', function(err, data) {
console.log(data);
postRobot.sendToParent('getCart', function(err, event) {
console.log(event.data);
});

@@ -85,4 +85,4 @@ ```

```javascript
postRobot.on('getCart', function(source, data) {
return getFoo(data).then(function(bar) {
postRobot.on('getCart', function(event) {
return getFoo(event.data).then(function(bar) {
return {

@@ -96,3 +96,3 @@ bar: bar

```javascript
postRobot.once('getCart').then(function(data) {
postRobot.once('getCart').then(function(event) {
...

@@ -105,3 +105,3 @@ }).catch(function(err) {

```javascript
postRobot.send(window, 'getCart').then(function(data) {
postRobot.send(window, 'getCart').then(function(event) {
...

@@ -116,3 +116,3 @@ }).catch(function(err) {

```javascript
postRobot.on('getCart', async function(source, data) {
postRobot.on('getCart', async function(event) {
return {

@@ -127,3 +127,3 @@ bar: await bar

try {
let data = await postRobot.once('getCart');
let event = await postRobot.once('getCart');
} catch (err) {

@@ -136,3 +136,3 @@ ...

try {
let data = await postRobot.send(window, 'getCart');
let event = await postRobot.send(window, 'getCart');
} catch (err) {

@@ -152,3 +152,3 @@ ...

postRobot.on('getFoo', function(source, data) {
postRobot.on('getFoo', function(event) {
return {

@@ -163,4 +163,4 @@ bar: function() {

postRobot.send(myWindow, 'getFoo').then(function(source, data) {
data.bar();
postRobot.send(myWindow, 'getFoo').then(function(event) {
event.data.bar();
});

@@ -167,0 +167,0 @@ ```

@@ -22,2 +22,6 @@

}
};
};
if (window.location.href.indexOf(CONSTANTS.FILE_PROTOCOL) === 0) {
CONFIG.ALLOW_POSTMESSAGE_POPUP = true;
}

@@ -41,5 +41,6 @@

MOCK_PROTOCOL: 'mock://'
MOCK_PROTOCOL: 'mock://',
FILE_PROTOCOL: 'file://'
};
export let POST_MESSAGE_NAMES_LIST = Object.keys(CONSTANTS.POST_MESSAGE_NAMES).map(key => CONSTANTS.POST_MESSAGE_NAMES[key]);

@@ -99,2 +99,6 @@

if (message.sourceDomain.indexOf(CONSTANTS.FILE_PROTOCOL) === 0) {
origin = message.sourceDomain;
}
if (global.receivedMessages.indexOf(message.id) === -1) {

@@ -180,3 +184,3 @@ global.receivedMessages.push(message.id);

if (message.data) {
message.data = deserializeMethods(originalSource, message.data);
message.data = deserializeMethods(originalSource, message.originalSourceDomain, message.data);
}

@@ -183,0 +187,0 @@

@@ -60,4 +60,6 @@

return promise.deNodeify(options.handler, source, message.data);
let data = message.data;
return promise.deNodeify(options.handler, { source, origin, data });
}).then(data => {

@@ -103,5 +105,7 @@

} else if (message.ack === CONSTANTS.POST_MESSAGE_ACK.SUCCESS) {
return options.respond(null, message.data || message.response);
let data = message.data || message.response;
return options.respond(null, { source, origin, data });
}
}
};

@@ -35,3 +35,3 @@

message = buildMessage(win, message, {
data: serializeMethods(win, message.data),
data: serializeMethods(win, domain, message.data),
domain

@@ -38,0 +38,0 @@ });

@@ -16,2 +16,6 @@

if (domain && domain.indexOf(CONSTANTS.FILE_PROTOCOL) === 0) {
domain = `*`;
}
return win.postMessage(JSON.stringify(message, 0, 2), domain);

@@ -148,2 +152,6 @@ },

if (domain && domain.indexOf(CONSTANTS.FILE_PROTOCOL) === 0) {
domain = `*`;
}
bridge.postMessage(JSON.stringify(message, 0, 2), domain);

@@ -150,0 +158,0 @@ });

@@ -84,3 +84,3 @@

let prom = new promise.Promise((resolve, reject) => {
options.handler = options.handler || ((source, data) => resolve(data));
options.handler = options.handler || (event => resolve(event));
options.errorHandler = options.errorHandler || reject;

@@ -87,0 +87,0 @@ });

@@ -12,13 +12,17 @@

export let listenForMethods = util.once(() => {
on(CONSTANTS.POST_MESSAGE_NAMES.METHOD, (source, data) => {
on(CONSTANTS.POST_MESSAGE_NAMES.METHOD, ({ source, origin, data }) => {
if (!global.methods[data.id]) {
let meth = global.methods[data.id];
if (!meth) {
throw new Error(`Could not find method with id: ${data.id}`);
}
if (global.methods[data.id].win !== source) {
throw new Error('Method window does not match');
if (meth.destination !== source) {
throw new Error(`Method window does not match`);
}
let method = global.methods[data.id].method;
if (meth.domain && meth.domain !== '*' && origin !== meth.domain) {
throw new Error(`Method domain ${meth.domain} does not match origin ${origin}`);
}

@@ -28,3 +32,3 @@ log.debug('Call local method', data.name, data.args);

return promise.run(() => {
return method.apply(null, data.args);
return meth.method.apply(null, data.args);

@@ -46,3 +50,3 @@ }).then(result => {

export function serializeMethod(destination, method, name) {
export function serializeMethod(destination, domain, method, name) {

@@ -52,3 +56,4 @@ let id = util.uniqueID();

global.methods[id] = {
win: destination,
destination,
domain,
method

@@ -64,7 +69,7 @@ };

export function serializeMethods(destination, obj) {
export function serializeMethods(destination, domain, obj) {
return util.replaceObject({ obj }, (item, key) => {
if (item instanceof Function) {
return serializeMethod(destination, item, key);
return serializeMethod(destination, domain, item, key);
}

@@ -74,3 +79,3 @@ }).obj;

export function deserializeMethod(source, obj) {
export function deserializeMethod(source, origin, obj) {

@@ -85,3 +90,3 @@ function wrapper() {

}).then(data => {
}, { domain: origin }).then(({ data }) => {

@@ -98,9 +103,9 @@ log.debug('Got foreign method result', obj.__name__, data.result);

export function deserializeMethods(source, obj) {
export function deserializeMethods(source, origin, obj) {
return util.replaceObject({ obj }, (item, key) => {
if (isSerializedMethod(item)) {
return deserializeMethod(source, item);
return deserializeMethod(source, origin, item);
}
}).obj;
}

@@ -13,7 +13,7 @@

on(CONSTANTS.POST_MESSAGE_NAMES.READY, (win, data) => {
on(CONSTANTS.POST_MESSAGE_NAMES.READY, ({ source, data }) => {
for (let item of global.readyPromises) {
if (item.win === win) {
item.promise.resolve(win);
if (item.win === source) {
item.promise.resolve(source);
return;

@@ -24,4 +24,4 @@ }

global.readyPromises.push({
win,
promise: new Promise().resolve(win)
win: source,
promise: new Promise().resolve(source)
});

@@ -28,0 +28,0 @@ });

@@ -7,7 +7,7 @@

postRobot.on('sendMessageToParent', function(source, data) {
postRobot.on('sendMessageToParent', function({ source, data }) {
return postRobot.sendToParent(data.messageName, data.data);
});
postRobot.on('setupListener', function(source, data) {
postRobot.on('setupListener', function({ source, data }) {
postRobot.once(data.messageName, function() {

@@ -18,3 +18,3 @@ return data.handler ? data.handler() : data.data;

postRobot.on('waitForMessage', function(source, data) {
postRobot.on('waitForMessage', function({ source, data }) {
return postRobot.once(data.messageName, function() {

@@ -21,0 +21,0 @@ return data.handler ? data.handler() : data.data;

window.console.karma = function() {
var karma = window.karma || (window.top && window.top.karma) || (window.opener && window.opener.karma);
karma.log('debug', arguments);
if (karma) {
karma.log('debug', arguments);
}
console.log.apply(console, arguments);
};

@@ -98,3 +98,3 @@

return postRobot.send(childFrame, 'foo').then(function(data) {
return postRobot.send(childFrame, 'foo').then(function({ data }) {
assert.equal(data.foo, 'bar');

@@ -116,4 +116,4 @@ });

return postRobot.send(childFrame, 'foo', function(err, data) {
assert.equal(data.foo, 'bar2');
return postRobot.send(childFrame, 'foo', function(err, event) {
assert.equal(event.data.foo, 'bar2');
done();

@@ -136,3 +136,3 @@ });

return postRobot.send(childFrame, 'foo').then(function(data) {
return postRobot.send(childFrame, 'foo').then(function({ data }) {
data.done();

@@ -158,3 +158,3 @@ });

return postRobot.send('childframe', 'foo').then(function(data) {
return postRobot.send('childframe', 'foo').then(function({ data }) {
assert.equal(data.foo, 'bar');

@@ -190,3 +190,3 @@ });

postRobot.once('foobu', { override: true }, function(source, data) {
postRobot.once('foobu', { override: true }, function({ source, data }) {
count += data.add;

@@ -202,3 +202,3 @@ });

postRobot.once('foobu', { override: true }, function(source, data) {
postRobot.once('foobu', { override: true }, function({ source, data }) {
count += data.add;

@@ -258,3 +258,3 @@ });

return postRobot.send(childFrame, 'doesntexist').then(function(data) {
return postRobot.send(childFrame, 'doesntexist').then(function({ data }) {
throw new Error('Expected success handler to not be called');

@@ -268,6 +268,6 @@ }, function(err) {

postRobot.send(childFrame, 'doesntexist', function(err, data) {
postRobot.send(childFrame, 'doesntexist', function(err, event) {
assert.ok(err);
if (data) {
throw new Error('Expected data to be blank');
if (event) {
throw new Error('Expected event to be blank');
}

@@ -395,3 +395,3 @@ done();

return postRobot.send(childWindow, 'foo').then(function(data) {
return postRobot.send(childWindow, 'foo').then(function({ data }) {
assert.equal(data.foo, 'bar');

@@ -430,3 +430,3 @@ });

return postRobot.send(bridge, 'foo').then(function(data) {
return postRobot.send(bridge, 'foo').then(function({ data }) {
assert.equal(data.foo, 'bar');

@@ -433,0 +433,0 @@ });

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc