text: (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){const proxy=require("window-post-message-proxy");window.createPostMessageProxy=function(){return new proxy.WindowPostMessageProxy}},{"window-post-message-proxy":2}],2:[function(require,module,exports){(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["window-post-message-proxy"]=factory();else root["window-post-message-proxy"]=factory()})(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)}([function(module,exports){"use strict";var WindowPostMessageProxy=function(){function WindowPostMessageProxy(options){var _this=this;if(options===void 0){options={processTrackingProperties:{addTrackingProperties:WindowPostMessageProxy.defaultAddTrackingProperties,getTrackingProperties:WindowPostMessageProxy.defaultGetTrackingProperties},isErrorMessage:WindowPostMessageProxy.defaultIsErrorMessage,receiveWindow:window,name:WindowPostMessageProxy.createRandomString()}}this.pendingRequestPromises={};this.addTrackingProperties=options.processTrackingProperties&&options.processTrackingProperties.addTrackingProperties||WindowPostMessageProxy.defaultAddTrackingProperties;this.getTrackingProperties=options.processTrackingProperties&&options.processTrackingProperties.getTrackingProperties||WindowPostMessageProxy.defaultGetTrackingProperties;this.isErrorMessage=options.isErrorMessage||WindowPostMessageProxy.defaultIsErrorMessage;this.receiveWindow=options.receiveWindow||window;this.name=options.name||WindowPostMessageProxy.createRandomString();this.logMessages=options.logMessages||false;this.eventSourceOverrideWindow=options.eventSourceOverrideWindow;this.suppressWarnings=options.suppressWarnings||false;if(this.logMessages){console.log("new WindowPostMessageProxy created with name: "+this.name+" receiving on window: "+this.receiveWindow.document.title)}this.handlers=[];this.windowMessageHandler=function(event){return _this.onMessageReceived(event)};this.start()}WindowPostMessageProxy.defaultAddTrackingProperties=function(message,trackingProperties){message[WindowPostMessageProxy.messagePropertyName]=trackingProperties;return message};WindowPostMessageProxy.defaultGetTrackingProperties=function(message){return message[WindowPostMessageProxy.messagePropertyName]};WindowPostMessageProxy.defaultIsErrorMessage=function(message){return!!message.error};WindowPostMessageProxy.createDeferred=function(){var deferred={resolve:null,reject:null,promise:null};var promise=new Promise(function(resolve,reject){deferred.resolve=resolve;deferred.reject=reject});deferred.promise=promise;return deferred};WindowPostMessageProxy.createRandomString=function(){var cryptoObj=window.crypto||window.msCrypto;var randomValueArray=new Uint32Array(1);cryptoObj.getRandomValues(randomValueArray);return randomValueArray[0].toString(36).substring(1)};WindowPostMessageProxy.prototype.addHandler=function(handler){this.handlers.push(handler)};WindowPostMessageProxy.prototype.removeHandler=function(handler){var handlerIndex=this.handlers.indexOf(handler);if(handlerIndex===-1){throw new Error("You attempted to remove a handler but no matching handler was found.")}this.handlers.splice(handlerIndex,1)};WindowPostMessageProxy.prototype.start=function(){this.receiveWindow.addEventListener("message",this.windowMessageHandler)};WindowPostMessageProxy.prototype.stop=function(){this.receiveWindow.removeEventListener("message",this.windowMessageHandler)};WindowPostMessageProxy.prototype.postMessage=function(targetWindow,message){var trackingProperties={id:WindowPostMessageProxy.createRandomString()};this.addTrackingProperties(message,trackingProperties);if(this.logMessages){console.log(this.name+" Posting message:");console.log(JSON.stringify(message,null,"  "))}targetWindow.postMessage(message,"*");var deferred=WindowPostMessageProxy.createDeferred();this.pendingRequestPromises[trackingProperties.id]=deferred;return deferred.promise};WindowPostMessageProxy.prototype.sendResponse=function(targetWindow,message,trackingProperties){this.addTrackingProperties(message,trackingProperties);if(this.logMessages){console.log(this.name+" Sending response:");console.log(JSON.stringify(message,null,"  "))}targetWindow.postMessage(message,"*")};WindowPostMessageProxy.prototype.onMessageReceived=function(event){var _this=this;if(this.logMessages){console.log(this.name+" Received message:");console.log("type: "+event.type);console.log(JSON.stringify(event.data,null,"  "))}var sendingWindow=this.eventSourceOverrideWindow||event.source;var message=event.data;if(typeof message!=="object"){if(!this.suppressWarnings){console.warn("Proxy("+this.name+"): Received message that was not an object. Discarding message")}return}var trackingProperties;try{trackingProperties=this.getTrackingProperties(message)}catch(e){if(!this.suppressWarnings){console.warn("Proxy("+this.name+"): Error occurred when attempting to get tracking properties from incoming message:",JSON.stringify(message,null,"  "),"Error: ",e)}}var deferred;if(trackingProperties){deferred=this.pendingRequestPromises[trackingProperties.id]}if(!deferred){var handled=this.handlers.some(function(handler){var canMessageBeHandled=false;try{canMessageBeHandled=handler.test(message)}catch(e){if(!_this.suppressWarnings){console.warn("Proxy("+_this.name+"): Error occurred when handler was testing incoming message:",JSON.stringify(message,null,"  "),"Error: ",e)}}if(canMessageBeHandled){var responseMessagePromise=void 0;try{responseMessagePromise=Promise.resolve(handler.handle(message))}catch(e){if(!_this.suppressWarnings){console.warn("Proxy("+_this.name+"): Error occurred when handler was processing incoming message:",JSON.stringify(message,null,"  "),"Error: ",e)}responseMessagePromise=Promise.resolve()}responseMessagePromise.then(function(responseMessage){if(!responseMessage){var warningMessage="Handler for message: "+JSON.stringify(message,null,"  ")+" did not return a response message. The default response message will be returned instead.";if(!_this.suppressWarnings){console.warn("Proxy("+_this.name+"): "+warningMessage)}responseMessage={warning:warningMessage}}_this.sendResponse(sendingWindow,responseMessage,trackingProperties)});return true}});if(!handled&&!this.suppressWarnings){console.warn("Proxy("+this.name+") did not handle message. Handlers: "+this.handlers.length+"  Message: "+JSON.stringify(message,null,"")+".")}}else{var isErrorMessage=true;try{isErrorMessage=this.isErrorMessage(message)}catch(e){console.warn("Proxy("+this.name+") Error occurred when trying to determine if message is consider an error response. Message: ",JSON.stringify(message,null,""),"Error: ",e)}if(isErrorMessage){deferred.reject(message)}else{deferred.resolve(message)}delete this.pendingRequestPromises[trackingProperties.id]}};WindowPostMessageProxy.messagePropertyName="windowPostMessageProxy";return WindowPostMessageProxy}();exports.WindowPostMessageProxy=WindowPostMessageProxy}])})},{}]},{},[1]);
  