diff --git a/CHANGELOG.md b/CHANGELOG.md index ed8d9da..4d809ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.2.2] - 2021-03-09 +## Fixed +- Add check to ensure target is not null before sending message in connectionRecieved method +- fixed error in debug logging always setting `recieved` to `false` + +## Changed +- Changed console.error to console.warn when trying to parse JSON in postMessages to better reflect the behaviour + ## [3.2.1] - 2021-10-07 ### Added - This CHANGELOG diff --git a/dist/bellhop-umd.js b/dist/bellhop-umd.js index 81f63c4..ea11a23 100644 --- a/dist/bellhop-umd.js +++ b/dist/bellhop-umd.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).window=t.window||{})}(this,(function(t){"use strict";function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=e((function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(r){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=n=function(t){return e(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(r)}t.exports=n}));var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function o(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:0;this._listeners[t]||(this._listeners[t]=[]),e._priority=parseInt(n)||0,-1===this._listeners[t].indexOf(e)&&(this._listeners[t].push(e),this._listeners[t].length>1&&this._listeners[t].sort(this.listenerSorter))}},{key:"listenerSorter",value:function(t,e){return t._priority-e._priority}},{key:"off",value:function(t,e){if(void 0!==this._listeners[t])if(void 0!==e){var n=this._listeners[t].indexOf(e);-11&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t&&(t={type:t,data:"object"===n(e)&&null!==e?e:{}}),void 0!==this._listeners[t.type])for(var r=this._listeners[t.type].length-1;r>=0;r--)this._listeners[t.type][r](t)}},{key:"destroy",value:function(){this._listeners={}}}]),t}(),c=e((function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function a(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),s=new j(r||[]);return i._invoke=function(t,e,n){var r=h;return function(o,i){if(r===f)throw new Error("Generator is already running");if(r===p){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var c=O(s,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var a=u(t,e,n);if("normal"===a.type){if(r=n.done?p:l,a.arg===y)continue;return{value:a.arg,done:n.done}}"throw"===a.type&&(r=p,n.method="throw",n.arg=a.arg)}}}(t,n,s),i}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var h="suspendedStart",l="suspendedYield",f="executing",p="completed",y={};function d(){}function v(){}function g(){}var m={};m[i]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(S([])));b&&b!==n&&r.call(b,i)&&(m=b);var _=g.prototype=d.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function L(t){function e(n,o,i,s){var c=u(t[n],t,o);if("throw"!==c.type){var a=c.arg,h=a.value;return h&&"object"==typeof h&&r.call(h,"__await")?Promise.resolve(h.__await).then((function(t){e("next",t,i,s)}),(function(t){e("throw",t,i,s)})):Promise.resolve(h).then((function(t){a.value=t,i(a)}),(function(t){return e("throw",t,i,s)}))}s(c.arg)}var n;this._invoke=function(t,r){function o(){return new Promise((function(n,o){e(t,r,n,o)}))}return n=n?n.then(o,o):o()}}function O(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=u(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function n(){for(;++o=0;--i){var s=this.tryEntries[i],c=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var a=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(a&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:S(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));var a=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var u=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?a(t):e},h=e((function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(n)}t.exports=e}));var l=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t},f=e((function(t){function e(n,r,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=l(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}},e(n,r,o||n)}t.exports=e})),p=e((function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(n,r)}t.exports=e}));var y=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)},d=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100*Math.random()|0;return r(this,e),(t=u(this,h(e).call(this))).id="BELLHOP:".concat(n),t.connected=!1,t.isChild=!0,t.connecting=!1,t.debug=!1,t.origin="*",t._sendLater=[],t.iframe=null,t.receive=t.receive.bind(a(t)),t}return y(e,t),i(e,[{key:"receive",value:function(t){if(this.target===t.source)if(this.logDebugMessage(!0,t),"connected"===t.data)this.onConnectionReceived(t.data);else{var e=t.data;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){console.error("Bellhop error: ",t)}this.connected&&"object"===n(e)&&e.type&&this.trigger(e)}}},{key:"onConnectionReceived",value:function(t){this.connecting=!1,this.connected=!0,this.isChild||this.target.postMessage(t,this.origin);for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:"*";this.connecting||(this.disconnect(),this.connecting=!0,t instanceof HTMLIFrameElement&&(this.iframe=t),this.isChild=void 0===t,this.supported=!0,this.isChild&&(this.supported=window!=t),this.origin=e,window.addEventListener("message",this.receive),this.isChild&&(window===this.target?this.trigger("failed"):this.target.postMessage("connected",this.origin)))}},{key:"disconnect",value:function(){this.connected=!1,this.connecting=!1,this.origin=null,this.iframe=null,this.isChild=!0,this._sendLater.length=0,window.removeEventListener("message",this.receive)}},{key:"send",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw"The event type must be a string";var n={type:t,data:e};this.logDebugMessage(!1,n),this.connecting?this._sendLater.push(n):this.target.postMessage(JSON.stringify(n),this.origin)}},{key:"fetch",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.connecting&&!this.connected)throw"No connection, please call connect() first";var i=function t(r){o&&n.off(r.type,t),e(r)};this.on(t,i),this.send(t,r)}},{key:"respond",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this,o=function t(o){var i;return c.async((function(s){for(;;)switch(s.prev=s.next){case 0:return n&&r.off(o,t),"function"==typeof e&&(e=e()),s.next=4,c.awrap(e);case 4:i=s.sent,r.send(o.type,i);case 6:case"end":return s.stop()}}))};this.on(t,o)}},{key:"logDebugMessage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1?arguments[1]:void 0;this.debug&&"function"==typeof this.debug?this.debug({isChild:this.isChild,received:!1,message:e}):this.debug&&console.log("Bellhop Instance (".concat(this.isChild?"Child":"Parent",") ").concat(t?"Receieved":"Sent"),e)}},{key:"destroy",value:function(){f(h(e.prototype),"destroy",this).call(this),this.disconnect(),this._sendLater.length=0}},{key:"target",get:function(){return this.isChild?window.parent:this.iframe.contentWindow}}]),e}(s);t.Bellhop=d,t.BellhopEventDispatcher=s,Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).window=t.window||{})}(this,(function(t){"use strict";function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=e((function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(r){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=n=function(t){return e(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(r)}t.exports=n}));var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function o(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:0;this._listeners[t]||(this._listeners[t]=[]),e._priority=parseInt(n)||0,-1===this._listeners[t].indexOf(e)&&(this._listeners[t].push(e),this._listeners[t].length>1&&this._listeners[t].sort(this.listenerSorter))}},{key:"listenerSorter",value:function(t,e){return t._priority-e._priority}},{key:"off",value:function(t,e){if(void 0!==this._listeners[t])if(void 0!==e){var n=this._listeners[t].indexOf(e);-11&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t&&(t={type:t,data:"object"===n(e)&&null!==e?e:{}}),void 0!==this._listeners[t.type])for(var r=this._listeners[t.type].length-1;r>=0;r--)this._listeners[t.type][r](t)}},{key:"destroy",value:function(){this._listeners={}}}]),t}(),a=e((function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),s=new j(r||[]);return i._invoke=function(t,e,n){var r=h;return function(o,i){if(r===f)throw new Error("Generator is already running");if(r===p){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=O(s,n);if(a){if(a===y)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var c=u(t,e,n);if("normal"===c.type){if(r=n.done?p:l,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=p,n.method="throw",n.arg=c.arg)}}}(t,n,s),i}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",l="suspendedYield",f="executing",p="completed",y={};function d(){}function v(){}function g(){}var m={};m[i]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(S([])));b&&b!==n&&r.call(b,i)&&(m=b);var _=g.prototype=d.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function L(t){function e(n,o,i,s){var a=u(t[n],t,o);if("throw"!==a.type){var c=a.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?Promise.resolve(h.__await).then((function(t){e("next",t,i,s)}),(function(t){e("throw",t,i,s)})):Promise.resolve(h).then((function(t){c.value=t,i(c)}),(function(t){return e("throw",t,i,s)}))}s(a.arg)}var n;this._invoke=function(t,r){function o(){return new Promise((function(n,o){e(t,r,n,o)}))}return n=n?n.then(o,o):o()}}function O(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=u(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function n(){for(;++o=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:S(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));var c=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var u=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?c(t):e},h=e((function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(n)}t.exports=e}));var l=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t},f=e((function(t){function e(n,r,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=l(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}},e(n,r,o||n)}t.exports=e})),p=e((function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(n,r)}t.exports=e}));var y=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)},d=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100*Math.random()|0;return r(this,e),(t=u(this,h(e).call(this))).id="BELLHOP:".concat(n),t.connected=!1,t.isChild=!0,t.connecting=!1,t.debug=!1,t.origin="*",t._sendLater=[],t.iframe=null,t.receive=t.receive.bind(c(t)),t}return y(e,t),i(e,[{key:"receive",value:function(t){if(this.target===t.source)if(this.logDebugMessage(!0,t),"connected"===t.data)this.onConnectionReceived(t.data);else{var e=t.data;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){console.warn("Bellhop error: ",t)}this.connected&&"object"===n(e)&&e.type&&this.trigger(e)}}},{key:"onConnectionReceived",value:function(t){if(this.connecting=!1,this.connected=!0,!this.isChild){if(!this.target)return;this.target.postMessage(t,this.origin)}for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:"*";this.connecting||(this.disconnect(),this.connecting=!0,t instanceof HTMLIFrameElement&&(this.iframe=t),this.isChild=void 0===t,this.supported=!0,this.isChild&&(this.supported=window!=t),this.origin=e,window.addEventListener("message",this.receive),this.isChild&&(window===this.target?this.trigger("failed"):this.target.postMessage("connected",this.origin)))}},{key:"disconnect",value:function(){this.connected=!1,this.connecting=!1,this.origin=null,this.iframe=null,this.isChild=!0,this._sendLater.length=0,window.removeEventListener("message",this.receive)}},{key:"send",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw"The event type must be a string";var n={type:t,data:e};this.logDebugMessage(!1,n),this.connecting?this._sendLater.push(n):this.target.postMessage(JSON.stringify(n),this.origin)}},{key:"fetch",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.connecting&&!this.connected)throw"No connection, please call connect() first";var i=function t(r){o&&n.off(r.type,t),e(r)};this.on(t,i),this.send(t,r)}},{key:"respond",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this,o=function t(o){var i;return a.async((function(s){for(;;)switch(s.prev=s.next){case 0:return n&&r.off(o,t),"function"==typeof e&&(e=e()),s.next=4,a.awrap(e);case 4:i=s.sent,r.send(o.type,i);case 6:case"end":return s.stop()}}))};this.on(t,o)}},{key:"logDebugMessage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1?arguments[1]:void 0;this.debug&&"function"==typeof this.debug?this.debug({isChild:this.isChild,received:t,message:e}):this.debug&&console.log("Bellhop Instance (".concat(this.isChild?"Child":"Parent",") ").concat(t?"Receieved":"Sent"),e)}},{key:"destroy",value:function(){f(h(e.prototype),"destroy",this).call(this),this.disconnect(),this._sendLater.length=0}},{key:"target",get:function(){return this.isChild?window.parent:this.iframe.contentWindow}}]),e}(s);t.Bellhop=d,t.BellhopEventDispatcher=s,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=bellhop-umd.js.map diff --git a/dist/bellhop-umd.js.map b/dist/bellhop-umd.js.map index dd94927..682adb2 100644 --- a/dist/bellhop-umd.js.map +++ b/dist/bellhop-umd.js.map @@ -1 +1 @@ -{"version":3,"file":"bellhop-umd.js","sources":["../node_modules/@babel/runtime/helpers/typeof.js","../node_modules/@babel/runtime/helpers/classCallCheck.js","../node_modules/@babel/runtime/helpers/createClass.js","../src/BellhopEventDispatcher.js","../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js","../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../node_modules/@babel/runtime/helpers/superPropBase.js","../node_modules/@babel/runtime/helpers/get.js","../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/inherits.js","../src/Bellhop.js"],"sourcesContent":["function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","/**\n * Function with a added priority type\n * @typedef {Function} PriorityFunction\n * @property {number} _priority\n */\n\n/**\n * Generic event dispatcher\n * @class BellhopEventDispatcher\n */\nexport class BellhopEventDispatcher {\n /**\n * The collection of event listeners\n * @property {Object} _listeners\n * @private\n */\n constructor() {\n this._listeners = {};\n }\n\n /**\n * Add an event listener to listen to an event from either the parent or iframe\n * @method on\n * @param {String} name The name of the event to listen for\n * @param {PriorityFunction} callback The handler when an event is triggered\n * @param {number} [priority=0] The priority of the event listener. Higher numbers are handled first.\n */\n on(name, callback, priority = 0) {\n if (!this._listeners[name]) {\n this._listeners[name] = [];\n }\n callback._priority = parseInt(priority) || 0;\n\n // If callback is already set to this event\n if (-1 !== this._listeners[name].indexOf(callback)) {\n return;\n }\n\n this._listeners[name].push(callback);\n\n if (this._listeners[name].length > 1) {\n this._listeners[name].sort(this.listenerSorter);\n }\n }\n\n /**\n * Sorts listeners added by .on() by priority\n * @private\n * @param {PriorityFunction} a\n * @param {PriorityFunction} b\n * @returns {number};\n */\n listenerSorter(a, b) {\n return a._priority - b._priority;\n }\n\n /**\n * Remove an event listener\n * @method off\n * @param {String} name The name of event to listen for. If undefined, remove all listeners.\n * @param {Function} [callback] The optional handler when an event is triggered, if no callback\n * is set then all listeners by type are removed\n */\n off(name, callback) {\n if (this._listeners[name] === undefined) {\n return;\n }\n\n if (callback === undefined) {\n delete this._listeners[name];\n return;\n }\n\n const index = this._listeners[name].indexOf(callback);\n\n -1 < index ? this._listeners[name].splice(index, 1) : undefined;\n }\n\n /**\n * Trigger any event handlers for an event type\n * @method trigger\n * @param {object | String} event The event to send\n * @param {object} [data = {}] optional data to send to other areas in the app that are listening for this event\n */\n trigger(event, data = {}) {\n if (typeof event == 'string') {\n event = {\n type: event,\n data: 'object' === typeof data && null !== data ? data : {}\n };\n }\n\n if ('undefined' !== typeof this._listeners[event.type]) {\n for (let i = this._listeners[event.type].length - 1; i >= 0; i--) {\n this._listeners[event.type][i](event);\n }\n }\n }\n\n /**\n * Reset the listeners object\n * @method destroy\n */\n destroy() {\n this._listeners = {};\n }\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return Promise.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return Promise.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new Promise(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList) {\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList)\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","import { BellhopEventDispatcher } from './BellhopEventDispatcher.js';\n\n/**\n * Abstract communication layer between the iframe\n * and the parent DOM\n * @class Bellhop\n * @extends BellhopEventDispatcher\n */\nexport class Bellhop extends BellhopEventDispatcher {\n /**\n * Creates an instance of Bellhop.\n * @memberof Bellhop\n * @param { string | number } id the id of the Bellhop instance\n */\n constructor(id = (Math.random() * 100) | 0) {\n super();\n\n /**\n * The instance ID for bellhop\n * @property {string} id\n */\n this.id = `BELLHOP:${id}`;\n /**\n * If we are connected to another instance of bellhop\n * @property {Boolean} connected\n * @readOnly\n * @default false\n * @private\n */\n this.connected = false;\n\n /**\n * If this instance represents an iframe instance\n * @property {Boolean} isChild\n * @private\n * @default true\n */\n this.isChild = true;\n\n /**\n * If we are currently trying to connect\n * @property {Boolean} connecting\n * @default false\n * @private\n */\n this.connecting = false;\n\n /**\n * If debug mode is turned on\n * @property {Boolean} debug\n * @default false\n * @private\n */\n this.debug = false;\n\n /**\n * If using cross-domain, the domain to post to\n * @property {string} origin\n * @private\n * @default \"*\"\n */\n this.origin = '*';\n\n /**\n * Save any sends to wait until after we're done\n * @property {Array} _sendLater\n * @private\n */\n this._sendLater = [];\n\n /**\n * The iframe element\n * @property {HTMLIFrameElement} iframe\n * @private\n * @readOnly\n */\n this.iframe = null;\n\n /**\n * The bound receive function\n * @property {Function} receive\n * @private\n */\n this.receive = this.receive.bind(this);\n }\n\n /**\n * The connection has been established successfully\n * @event connected\n */\n\n /**\n * Connection could not be established\n * @event failed\n */\n\n /**\n * Handle messages in the window\n * @method receive\n * @param { MessageEvent } message the post message received from another bellhop instance\n * @private\n */\n receive(message) {\n // Ignore messages that don't originate from the target\n // we're connected to\n if (this.target !== message.source) {\n return;\n }\n\n this.logDebugMessage(true, message);\n\n // If this is not the initial connection message\n if (message.data !== 'connected') {\n let data = message.data;\n // Check to see if the data was sent as a stringified json\n if ('string' === typeof data) {\n try {\n data = JSON.parse(data);\n } catch (err) {\n console.error('Bellhop error: ', err);\n }\n }\n if (this.connected && 'object' === typeof data && data.type) {\n this.trigger(data);\n }\n return;\n }\n // Else setup the connection\n this.onConnectionReceived(message.data);\n }\n /**\n * Handle the initial connected message\n * @memberof Bellhop\n * @param {object} message the message received from the other bellhop instance\n * @private\n */\n onConnectionReceived(message) {\n this.connecting = false;\n this.connected = true;\n\n // Be polite and respond to the child that we're ready\n if (!this.isChild) {\n this.target.postMessage(message, this.origin);\n }\n\n // If we have any sends waiting to send\n // we are now connected and it should be okay\n for (let i = 0; i < this._sendLater.length; i++) {\n const { type, data } = this._sendLater[i];\n this.send(type, data);\n }\n this._sendLater.length = 0;\n\n // If there is a connection event assigned call it\n this.trigger('connected');\n }\n\n /**\n * Setup the connection\n * @method connect\n * @param {HTMLIFrameElement} iframe The iframe to communicate with. If no value is set, the assumption\n * is that we're the child trying to communcate with our window.parent\n * @param {String} [origin=\"*\"] The domain to communicate with if different from the current.\n * @return {Bellhop} Return instance of current object\n */\n connect(iframe, origin = '*') {\n // Ignore if we're already trying to connect\n if (this.connecting) {\n return;\n }\n\n // Disconnect from any existing connection\n this.disconnect();\n\n // We are trying to connect\n this.connecting = true;\n\n // The iframe if we're the parent\n if (iframe instanceof HTMLIFrameElement) {\n this.iframe = iframe;\n }\n\n // The instance of bellhop is inside the iframe\n this.isChild = iframe === undefined;\n\n this.supported = true;\n if (this.isChild) {\n // for child pages, the window passed must be a different window\n this.supported = window != iframe;\n }\n\n this.origin = origin;\n\n window.addEventListener('message', this.receive);\n\n if (this.isChild) {\n // No parent, can't connect\n if (window === this.target) {\n this.trigger('failed');\n } else {\n // If connect is called after the window is ready\n // we can go ahead and send the connect message\n this.target.postMessage('connected', this.origin);\n }\n }\n }\n\n /**\n * Disconnect if there are any open connections\n * @method disconnect\n */\n disconnect() {\n this.connected = false;\n this.connecting = false;\n this.origin = null;\n this.iframe = null;\n this.isChild = true;\n this._sendLater.length = 0;\n\n window.removeEventListener('message', this.receive);\n }\n\n /**\n * Send an event to the connected instance\n * @method send\n * @param {string} type name/type of the event\n * @param {*} [data = {}] Additional data to send along with event\n */\n send(type, data = {}) {\n if (typeof type !== 'string') {\n throw 'The event type must be a string';\n }\n\n const message = {\n type,\n data\n };\n\n this.logDebugMessage(false, message);\n\n if (this.connecting) {\n this._sendLater.push(message);\n } else {\n this.target.postMessage(JSON.stringify(message), this.origin);\n }\n }\n\n /**\n * A convenience method for sending and listening to create\n * a singular link for fetching data. This is the same as calling send\n * and then getting a response right away with the same event.\n * @method fetch\n * @param {String} event The name of the event\n * @param {Function} callback The callback to call after, takes event object as one argument\n * @param {Object} [data = {}] Optional data to pass along\n * @param {Boolean} [runOnce=false] If we only want to fetch once and then remove the listener\n */\n fetch(event, callback, data = {}, runOnce = false) {\n if (!this.connecting && !this.connected) {\n throw 'No connection, please call connect() first';\n }\n\n const internalCallback = e => {\n if (runOnce) {\n this.off(e.type, internalCallback);\n }\n\n callback(e);\n };\n\n this.on(event, internalCallback);\n this.send(event, data);\n }\n\n /**\n * A convience method for listening to an event and then responding with some data\n * right away. Automatically removes the listener\n * @method respond\n * @param {String} event The name of the event\n * @param {Object | function | Promise | string} [data = {}] The object to pass back.\n * \tMay also be a function; the return value will be sent as data in this case.\n * @param {Boolean} [runOnce=false] If we only want to respond once and then remove the listener\n *\n */\n respond(event, data = {}, runOnce = false) {\n const bellhop = this; //'this' for use inside async function\n /**\n * @ignore\n */\n const internalCallback = async function(event) {\n if (runOnce) {\n bellhop.off(event, internalCallback);\n }\n if (typeof data === 'function') {\n data = data();\n }\n const newData = await data;\n bellhop.send(event.type, newData);\n };\n this.on(event, internalCallback);\n }\n\n /**\n * Send either the default log message or the callback provided if debug\n * is enabled\n * @method logDebugMessage\n */\n logDebugMessage(received = false, message) {\n if (this.debug && typeof this.debug === 'function') {\n this.debug({ isChild: this.isChild, received: false, message: message });\n } else if (this.debug) {\n console.log(\n `Bellhop Instance (${this.isChild ? 'Child' : 'Parent'}) ${\n received ? 'Receieved' : 'Sent'\n }`,\n message\n );\n }\n }\n\n /**\n * Destroy and don't use after this\n * @method destroy\n */\n destroy() {\n super.destroy();\n this.disconnect();\n this._sendLater.length = 0;\n }\n\n /**\n *\n * Returns the correct parent element for Bellhop's context\n * @readonly\n * @memberof Bellhop\n */\n get target() {\n return this.isChild ? window.parent : this.iframe.contentWindow;\n }\n}\n"],"names":["_typeof2","obj","Symbol","iterator","constructor","prototype","_typeof","module","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","BellhopEventDispatcher","_listeners","name","callback","priority","this","_priority","parseInt","indexOf","push","sort","listenerSorter","a","b","undefined","index","splice","event","data","type","runtime","exports","Op","hasOwn","hasOwnProperty","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","state","GenStateSuspendedStart","method","arg","GenStateExecuting","Error","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","done","GenStateSuspendedYield","value","makeInvokeMethod","fn","call","err","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","invoke","resolve","reject","result","Promise","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","displayName","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","async","iter","toString","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","ReferenceError","assertThisInitialized","_getPrototypeOf","o","property","_get","receiver","Reflect","get","base","superPropBase","desc","getOwnPropertyDescriptor","_setPrototypeOf","p","subClass","superClass","Bellhop","id","Math","random","connected","isChild","connecting","debug","origin","_sendLater","iframe","receive","_this","bind","message","source","logDebugMessage","onConnectionReceived","JSON","parse","console","trigger","postMessage","send","disconnect","HTMLIFrameElement","supported","window","addEventListener","removeEventListener","stringify","runOnce","internalCallback","e","_this2","off","on","bellhop","newData","received","log","parent","contentWindow"],"mappings":"yS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J,OAAMD,yDAAO,MACI,iBAATC,OACH,sCAGF4J,EAAU,CACd5J,KAAAA,EACAD,KAAAA,QAGG+J,iBAAgB,EAAOF,GAExB1K,KAAKkK,gBACFG,WAAWjK,KAAKsK,QAEhB5L,OAAOoM,YAAYJ,KAAKY,UAAUhB,GAAU1K,KAAKoK,sCAcpDxJ,EAAOd,cAAUe,yDAAO,GAAI8K,8DAC3B3L,KAAKkK,aAAelK,KAAKgK,eACtB,iDAGF4B,EAAmB,SAAnBA,EAAmBC,GACnBF,GACFG,EAAKC,IAAIF,EAAE/K,KAAM8K,GAGnB9L,EAAS+L,SAGNG,GAAGpL,EAAOgL,QACVT,KAAKvK,EAAOC,mCAaXD,OAAOC,yDAAO,GAAI8K,0DAClBM,EAAUjM,KAIV4L,EAAmB,SAAnBA,EAAkChL,gFAClC+K,GACFM,EAAQF,IAAInL,EAAOgL,GAED,mBAAT/K,IACTA,EAAOA,sBAEaA,UAAhBqL,SACND,EAAQd,KAAKvK,EAAME,KAAMoL,8CAEtBF,GAAGpL,EAAOgL,iDAQDO,0DAAkBzB,yCAC5B1K,KAAKmK,OAA+B,mBAAfnK,KAAKmK,WACvBA,MAAM,CAAEF,QAASjK,KAAKiK,QAASkC,UAAU,EAAOzB,QAASA,IACrD1K,KAAKmK,OACda,QAAQoB,gCACepM,KAAKiK,QAAU,QAAU,sBAC5CkC,EAAW,YAAc,QAE3BzB,sFAWCU,kBACAf,WAAWpL,OAAS,wCAUlBe,KAAKiK,QAAUsB,OAAOc,OAASrM,KAAKsK,OAAOgC,oBAzUtD,CAA6B3M"} \ No newline at end of file +{"version":3,"file":"bellhop-umd.js","sources":["../node_modules/@babel/runtime/helpers/typeof.js","../node_modules/@babel/runtime/helpers/classCallCheck.js","../node_modules/@babel/runtime/helpers/createClass.js","../src/BellhopEventDispatcher.js","../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js","../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../node_modules/@babel/runtime/helpers/superPropBase.js","../node_modules/@babel/runtime/helpers/get.js","../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/inherits.js","../src/Bellhop.js"],"sourcesContent":["function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","/**\n * Function with a added priority type\n * @typedef {Function} PriorityFunction\n * @property {number} _priority\n */\n\n/**\n * Generic event dispatcher\n * @class BellhopEventDispatcher\n */\nexport class BellhopEventDispatcher {\n /**\n * The collection of event listeners\n * @property {Object} _listeners\n * @private\n */\n constructor() {\n this._listeners = {};\n }\n\n /**\n * Add an event listener to listen to an event from either the parent or iframe\n * @method on\n * @param {String} name The name of the event to listen for\n * @param {PriorityFunction} callback The handler when an event is triggered\n * @param {number} [priority=0] The priority of the event listener. Higher numbers are handled first.\n */\n on(name, callback, priority = 0) {\n if (!this._listeners[name]) {\n this._listeners[name] = [];\n }\n callback._priority = parseInt(priority) || 0;\n\n // If callback is already set to this event\n if (-1 !== this._listeners[name].indexOf(callback)) {\n return;\n }\n\n this._listeners[name].push(callback);\n\n if (this._listeners[name].length > 1) {\n this._listeners[name].sort(this.listenerSorter);\n }\n }\n\n /**\n * Sorts listeners added by .on() by priority\n * @private\n * @param {PriorityFunction} a\n * @param {PriorityFunction} b\n * @returns {number};\n */\n listenerSorter(a, b) {\n return a._priority - b._priority;\n }\n\n /**\n * Remove an event listener\n * @method off\n * @param {String} name The name of event to listen for. If undefined, remove all listeners.\n * @param {Function} [callback] The optional handler when an event is triggered, if no callback\n * is set then all listeners by type are removed\n */\n off(name, callback) {\n if (this._listeners[name] === undefined) {\n return;\n }\n\n if (callback === undefined) {\n delete this._listeners[name];\n return;\n }\n\n const index = this._listeners[name].indexOf(callback);\n\n -1 < index ? this._listeners[name].splice(index, 1) : undefined;\n }\n\n /**\n * Trigger any event handlers for an event type\n * @method trigger\n * @param {object | String} event The event to send\n * @param {object} [data = {}] optional data to send to other areas in the app that are listening for this event\n */\n trigger(event, data = {}) {\n if (typeof event == 'string') {\n event = {\n type: event,\n data: 'object' === typeof data && null !== data ? data : {}\n };\n }\n\n if ('undefined' !== typeof this._listeners[event.type]) {\n for (let i = this._listeners[event.type].length - 1; i >= 0; i--) {\n this._listeners[event.type][i](event);\n }\n }\n }\n\n /**\n * Reset the listeners object\n * @method destroy\n */\n destroy() {\n this._listeners = {};\n }\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return Promise.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return Promise.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new Promise(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList) {\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList)\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","import { BellhopEventDispatcher } from './BellhopEventDispatcher.js';\n\n/**\n * Abstract communication layer between the iframe\n * and the parent DOM\n * @class Bellhop\n * @extends BellhopEventDispatcher\n */\nexport class Bellhop extends BellhopEventDispatcher {\n /**\n * Creates an instance of Bellhop.\n * @memberof Bellhop\n * @param { string | number } id the id of the Bellhop instance\n */\n constructor(id = (Math.random() * 100) | 0) {\n super();\n\n /**\n * The instance ID for bellhop\n * @property {string} id\n */\n this.id = `BELLHOP:${id}`;\n /**\n * If we are connected to another instance of bellhop\n * @property {Boolean} connected\n * @readOnly\n * @default false\n * @private\n */\n this.connected = false;\n\n /**\n * If this instance represents an iframe instance\n * @property {Boolean} isChild\n * @private\n * @default true\n */\n this.isChild = true;\n\n /**\n * If we are currently trying to connect\n * @property {Boolean} connecting\n * @default false\n * @private\n */\n this.connecting = false;\n\n /**\n * If debug mode is turned on\n * @property {Boolean} debug\n * @default false\n * @private\n */\n this.debug = false;\n\n /**\n * If using cross-domain, the domain to post to\n * @property {string} origin\n * @private\n * @default \"*\"\n */\n this.origin = '*';\n\n /**\n * Save any sends to wait until after we're done\n * @property {Array} _sendLater\n * @private\n */\n this._sendLater = [];\n\n /**\n * The iframe element\n * @property {HTMLIFrameElement} iframe\n * @private\n * @readOnly\n */\n this.iframe = null;\n\n /**\n * The bound receive function\n * @property {Function} receive\n * @private\n */\n this.receive = this.receive.bind(this);\n }\n\n /**\n * The connection has been established successfully\n * @event connected\n */\n\n /**\n * Connection could not be established\n * @event failed\n */\n\n /**\n * Handle messages in the window\n * @method receive\n * @param { MessageEvent } message the post message received from another bellhop instance\n * @private\n */\n receive(message) {\n // Ignore messages that don't originate from the target\n // we're connected to\n if (this.target !== message.source) {\n return;\n }\n\n this.logDebugMessage(true, message);\n\n // If this is not the initial connection message\n if (message.data !== 'connected') {\n let data = message.data;\n // Check to see if the data was sent as a stringified json\n if ('string' === typeof data) {\n try {\n data = JSON.parse(data);\n } catch (err) {\n console.warn('Bellhop error: ', err);\n }\n }\n if (this.connected && 'object' === typeof data && data.type) {\n this.trigger(data);\n }\n return;\n }\n // Else setup the connection\n this.onConnectionReceived(message.data);\n }\n /**\n * Handle the initial connected message\n * @memberof Bellhop\n * @param {object} message the message received from the other bellhop instance\n * @private\n */\n onConnectionReceived(message) {\n this.connecting = false;\n this.connected = true;\n\n // Be polite and respond to the child that we're ready\n if (!this.isChild) {\n // Timing issue: this.iframe.contentWindow is null when parent closes child iframe before done with rendering\n if (!this.target) {\n return;\n }\n this.target.postMessage(message, this.origin);\n }\n\n // If we have any sends waiting to send\n // we are now connected and it should be okay\n for (let i = 0; i < this._sendLater.length; i++) {\n const { type, data } = this._sendLater[i];\n this.send(type, data);\n }\n this._sendLater.length = 0;\n\n // If there is a connection event assigned call it\n this.trigger('connected');\n }\n\n /**\n * Setup the connection\n * @method connect\n * @param {HTMLIFrameElement} iframe The iframe to communicate with. If no value is set, the assumption\n * is that we're the child trying to communcate with our window.parent\n * @param {String} [origin=\"*\"] The domain to communicate with if different from the current.\n * @return {Bellhop} Return instance of current object\n */\n connect(iframe, origin = '*') {\n // Ignore if we're already trying to connect\n if (this.connecting) {\n return;\n }\n\n // Disconnect from any existing connection\n this.disconnect();\n\n // We are trying to connect\n this.connecting = true;\n\n // The iframe if we're the parent\n if (iframe instanceof HTMLIFrameElement) {\n this.iframe = iframe;\n }\n\n // The instance of bellhop is inside the iframe\n this.isChild = iframe === undefined;\n\n this.supported = true;\n if (this.isChild) {\n // for child pages, the window passed must be a different window\n this.supported = window != iframe;\n }\n\n this.origin = origin;\n\n window.addEventListener('message', this.receive);\n\n if (this.isChild) {\n // No parent, can't connect\n if (window === this.target) {\n this.trigger('failed');\n } else {\n // If connect is called after the window is ready\n // we can go ahead and send the connect message\n this.target.postMessage('connected', this.origin);\n }\n }\n }\n\n /**\n * Disconnect if there are any open connections\n * @method disconnect\n */\n disconnect() {\n this.connected = false;\n this.connecting = false;\n this.origin = null;\n this.iframe = null;\n this.isChild = true;\n this._sendLater.length = 0;\n\n window.removeEventListener('message', this.receive);\n }\n\n /**\n * Send an event to the connected instance\n * @method send\n * @param {string} type name/type of the event\n * @param {*} [data = {}] Additional data to send along with event\n */\n send(type, data = {}) {\n if (typeof type !== 'string') {\n throw 'The event type must be a string';\n }\n\n const message = {\n type,\n data\n };\n\n this.logDebugMessage(false, message);\n\n if (this.connecting) {\n this._sendLater.push(message);\n } else {\n this.target.postMessage(JSON.stringify(message), this.origin);\n }\n }\n\n /**\n * A convenience method for sending and listening to create\n * a singular link for fetching data. This is the same as calling send\n * and then getting a response right away with the same event.\n * @method fetch\n * @param {String} event The name of the event\n * @param {Function} callback The callback to call after, takes event object as one argument\n * @param {Object} [data = {}] Optional data to pass along\n * @param {Boolean} [runOnce=false] If we only want to fetch once and then remove the listener\n */\n fetch(event, callback, data = {}, runOnce = false) {\n if (!this.connecting && !this.connected) {\n throw 'No connection, please call connect() first';\n }\n\n const internalCallback = e => {\n if (runOnce) {\n this.off(e.type, internalCallback);\n }\n\n callback(e);\n };\n\n this.on(event, internalCallback);\n this.send(event, data);\n }\n\n /**\n * A convience method for listening to an event and then responding with some data\n * right away. Automatically removes the listener\n * @method respond\n * @param {String} event The name of the event\n * @param {Object | function | Promise | string} [data = {}] The object to pass back.\n * \tMay also be a function; the return value will be sent as data in this case.\n * @param {Boolean} [runOnce=false] If we only want to respond once and then remove the listener\n *\n */\n respond(event, data = {}, runOnce = false) {\n const bellhop = this; //'this' for use inside async function\n /**\n * @ignore\n */\n const internalCallback = async function(event) {\n if (runOnce) {\n bellhop.off(event, internalCallback);\n }\n if (typeof data === 'function') {\n data = data();\n }\n const newData = await data;\n bellhop.send(event.type, newData);\n };\n this.on(event, internalCallback);\n }\n\n /**\n * Send either the default log message or the callback provided if debug\n * is enabled\n * @method logDebugMessage\n */\n logDebugMessage(received = false, message) {\n if (this.debug && typeof this.debug === 'function') {\n this.debug({ isChild: this.isChild, received, message: message });\n } else if (this.debug) {\n console.log(\n `Bellhop Instance (${this.isChild ? 'Child' : 'Parent'}) ${\n received ? 'Receieved' : 'Sent'\n }`,\n message\n );\n }\n }\n\n /**\n * Destroy and don't use after this\n * @method destroy\n */\n destroy() {\n super.destroy();\n this.disconnect();\n this._sendLater.length = 0;\n }\n\n /**\n *\n * Returns the correct parent element for Bellhop's context\n * @readonly\n * @memberof Bellhop\n */\n get target() {\n return this.isChild ? window.parent : this.iframe.contentWindow;\n }\n}\n"],"names":["_typeof2","obj","Symbol","iterator","constructor","prototype","_typeof","module","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","BellhopEventDispatcher","_listeners","name","callback","priority","this","_priority","parseInt","indexOf","push","sort","listenerSorter","a","b","undefined","index","splice","event","data","type","runtime","exports","Op","hasOwn","hasOwnProperty","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","state","GenStateSuspendedStart","method","arg","GenStateExecuting","Error","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","done","GenStateSuspendedYield","value","makeInvokeMethod","fn","call","err","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","invoke","resolve","reject","result","Promise","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","displayName","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","async","iter","toString","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","ReferenceError","assertThisInitialized","_getPrototypeOf","o","property","_get","receiver","Reflect","get","base","superPropBase","desc","getOwnPropertyDescriptor","_setPrototypeOf","p","subClass","superClass","Bellhop","id","Math","random","connected","isChild","connecting","debug","origin","_sendLater","iframe","receive","_this","bind","message","source","logDebugMessage","onConnectionReceived","JSON","parse","console","warn","trigger","postMessage","send","disconnect","HTMLIFrameElement","supported","window","addEventListener","removeEventListener","stringify","runOnce","internalCallback","e","_this2","off","on","bellhop","newData","received","log","parent","contentWindow"],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,oBAAoB,UAAW1L,KAAKuK,sCASxCzJ,OAAMD,yDAAO,MACI,iBAATC,OACH,sCAGF4J,EAAU,CACd5J,KAAAA,EACAD,KAAAA,QAGG+J,iBAAgB,EAAOF,GAExB1K,KAAKkK,gBACFG,WAAWjK,KAAKsK,QAEhB5L,OAAOqM,YAAYL,KAAKa,UAAUjB,GAAU1K,KAAKoK,sCAcpDxJ,EAAOd,cAAUe,yDAAO,GAAI+K,8DAC3B5L,KAAKkK,aAAelK,KAAKgK,eACtB,iDAGF6B,EAAmB,SAAnBA,EAAmBC,GACnBF,GACFG,EAAKC,IAAIF,EAAEhL,KAAM+K,GAGnB/L,EAASgM,SAGNG,GAAGrL,EAAOiL,QACVT,KAAKxK,EAAOC,mCAaXD,OAAOC,yDAAO,GAAI+K,0DAClBM,EAAUlM,KAIV6L,EAAmB,SAAnBA,EAAkCjL,gFAClCgL,GACFM,EAAQF,IAAIpL,EAAOiL,GAED,mBAAThL,IACTA,EAAOA,sBAEaA,UAAhBsL,SACND,EAAQd,KAAKxK,EAAME,KAAMqL,8CAEtBF,GAAGrL,EAAOiL,iDAQDO,0DAAkB1B,yCAC5B1K,KAAKmK,OAA+B,mBAAfnK,KAAKmK,WACvBA,MAAM,CAAEF,QAASjK,KAAKiK,QAASmC,SAAAA,EAAU1B,QAASA,IAC9C1K,KAAKmK,OACda,QAAQqB,gCACerM,KAAKiK,QAAU,QAAU,sBAC5CmC,EAAW,YAAc,QAE3B1B,sFAWCW,kBACAhB,WAAWpL,OAAS,wCAUlBe,KAAKiK,QAAUuB,OAAOc,OAAStM,KAAKsK,OAAOiC,oBA7UtD,CAA6B5M"} \ No newline at end of file diff --git a/dist/bellhop.js b/dist/bellhop.js index 769c0b1..8a8e621 100644 --- a/dist/bellhop.js +++ b/dist/bellhop.js @@ -1,2 +1,2 @@ -function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t((function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(r){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=n=function(t){return e(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(r)}t.exports=n}));var n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:0;this._listeners[t]||(this._listeners[t]=[]),e._priority=parseInt(n)||0,-1===this._listeners[t].indexOf(e)&&(this._listeners[t].push(e),this._listeners[t].length>1&&this._listeners[t].sort(this.listenerSorter))}},{key:"listenerSorter",value:function(t,e){return t._priority-e._priority}},{key:"off",value:function(t,e){if(void 0!==this._listeners[t])if(void 0!==e){var n=this._listeners[t].indexOf(e);-11&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t&&(t={type:t,data:"object"===e(n)&&null!==n?n:{}}),void 0!==this._listeners[t.type])for(var r=this._listeners[t.type].length-1;r>=0;r--)this._listeners[t.type][r](t)}},{key:"destroy",value:function(){this._listeners={}}}]),t}(),s=t((function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),s=new S(r||[]);return i._invoke=function(t,e,n){var r=h;return function(o,i){if(r===f)throw new Error("Generator is already running");if(r===p){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=O(s,n);if(a){if(a===y)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var c=u(t,e,n);if("normal"===c.type){if(r=n.done?p:l,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=p,n.method="throw",n.arg=c.arg)}}}(t,n,s),i}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",l="suspendedYield",f="executing",p="completed",y={};function d(){}function v(){}function g(){}var m={};m[i]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(j([])));b&&b!==n&&r.call(b,i)&&(m=b);var _=g.prototype=d.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function L(t){function e(n,o,i,s){var a=u(t[n],t,o);if("throw"!==a.type){var c=a.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?Promise.resolve(h.__await).then((function(t){e("next",t,i,s)}),(function(t){e("throw",t,i,s)})):Promise.resolve(h).then((function(t){c.value=t,i(c)}),(function(t){return e("throw",t,i,s)}))}s(a.arg)}var n;this._invoke=function(t,r){function o(){return new Promise((function(n,o){e(t,r,n,o)}))}return n=n?n.then(o,o):o()}}function O(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=u(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function n(){for(;++o=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:j(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));var a=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var c=function(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?a(t):n},u=t((function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(n)}t.exports=e}));var h=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t},l=t((function(t){function e(n,r,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=h(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}},e(n,r,o||n)}t.exports=e})),f=t((function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(n,r)}t.exports=e}));var p=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)},y=function(t){function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100*Math.random()|0;return n(this,r),(t=c(this,u(r).call(this))).id="BELLHOP:".concat(e),t.connected=!1,t.isChild=!0,t.connecting=!1,t.debug=!1,t.origin="*",t._sendLater=[],t.iframe=null,t.receive=t.receive.bind(a(t)),t}return p(r,i),o(r,[{key:"receive",value:function(t){if(this.target===t.source)if(this.logDebugMessage(!0,t),"connected"===t.data)this.onConnectionReceived(t.data);else{var n=t.data;if("string"==typeof n)try{n=JSON.parse(n)}catch(t){console.error("Bellhop error: ",t)}this.connected&&"object"===e(n)&&n.type&&this.trigger(n)}}},{key:"onConnectionReceived",value:function(t){this.connecting=!1,this.connected=!0,this.isChild||this.target.postMessage(t,this.origin);for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:"*";this.connecting||(this.disconnect(),this.connecting=!0,t instanceof HTMLIFrameElement&&(this.iframe=t),this.isChild=void 0===t,this.supported=!0,this.isChild&&(this.supported=window!=t),this.origin=e,window.addEventListener("message",this.receive),this.isChild&&(window===this.target?this.trigger("failed"):this.target.postMessage("connected",this.origin)))}},{key:"disconnect",value:function(){this.connected=!1,this.connecting=!1,this.origin=null,this.iframe=null,this.isChild=!0,this._sendLater.length=0,window.removeEventListener("message",this.receive)}},{key:"send",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw"The event type must be a string";var n={type:t,data:e};this.logDebugMessage(!1,n),this.connecting?this._sendLater.push(n):this.target.postMessage(JSON.stringify(n),this.origin)}},{key:"fetch",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.connecting&&!this.connected)throw"No connection, please call connect() first";var i=function t(r){o&&n.off(r.type,t),e(r)};this.on(t,i),this.send(t,r)}},{key:"respond",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this,o=function t(o){var i;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return n&&r.off(o,t),"function"==typeof e&&(e=e()),a.next=4,s.awrap(e);case 4:i=a.sent,r.send(o.type,i);case 6:case"end":return a.stop()}}))};this.on(t,o)}},{key:"logDebugMessage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1?arguments[1]:void 0;this.debug&&"function"==typeof this.debug?this.debug({isChild:this.isChild,received:!1,message:e}):this.debug&&console.log("Bellhop Instance (".concat(this.isChild?"Child":"Parent",") ").concat(t?"Receieved":"Sent"),e)}},{key:"destroy",value:function(){l(u(r.prototype),"destroy",this).call(this),this.disconnect(),this._sendLater.length=0}},{key:"target",get:function(){return this.isChild?window.parent:this.iframe.contentWindow}}]),r}();export{y as Bellhop,i as BellhopEventDispatcher}; +function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t((function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(r){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=n=function(t){return e(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(r)}t.exports=n}));var n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:0;this._listeners[t]||(this._listeners[t]=[]),e._priority=parseInt(n)||0,-1===this._listeners[t].indexOf(e)&&(this._listeners[t].push(e),this._listeners[t].length>1&&this._listeners[t].sort(this.listenerSorter))}},{key:"listenerSorter",value:function(t,e){return t._priority-e._priority}},{key:"off",value:function(t,e){if(void 0!==this._listeners[t])if(void 0!==e){var n=this._listeners[t].indexOf(e);-11&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t&&(t={type:t,data:"object"===e(n)&&null!==n?n:{}}),void 0!==this._listeners[t.type])for(var r=this._listeners[t.type].length-1;r>=0;r--)this._listeners[t.type][r](t)}},{key:"destroy",value:function(){this._listeners={}}}]),t}(),s=t((function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),s=new S(r||[]);return i._invoke=function(t,e,n){var r=h;return function(o,i){if(r===f)throw new Error("Generator is already running");if(r===p){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=O(s,n);if(a){if(a===y)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var c=u(t,e,n);if("normal"===c.type){if(r=n.done?p:l,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=p,n.method="throw",n.arg=c.arg)}}}(t,n,s),i}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",l="suspendedYield",f="executing",p="completed",y={};function d(){}function v(){}function g(){}var m={};m[i]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(j([])));b&&b!==n&&r.call(b,i)&&(m=b);var _=g.prototype=d.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function L(t){function e(n,o,i,s){var a=u(t[n],t,o);if("throw"!==a.type){var c=a.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?Promise.resolve(h.__await).then((function(t){e("next",t,i,s)}),(function(t){e("throw",t,i,s)})):Promise.resolve(h).then((function(t){c.value=t,i(c)}),(function(t){return e("throw",t,i,s)}))}s(a.arg)}var n;this._invoke=function(t,r){function o(){return new Promise((function(n,o){e(t,r,n,o)}))}return n=n?n.then(o,o):o()}}function O(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=u(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function n(){for(;++o=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:j(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));var a=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var c=function(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?a(t):n},u=t((function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(n)}t.exports=e}));var h=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t},l=t((function(t){function e(n,r,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=h(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}},e(n,r,o||n)}t.exports=e})),f=t((function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(n,r)}t.exports=e}));var p=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)},y=function(t){function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100*Math.random()|0;return n(this,r),(t=c(this,u(r).call(this))).id="BELLHOP:".concat(e),t.connected=!1,t.isChild=!0,t.connecting=!1,t.debug=!1,t.origin="*",t._sendLater=[],t.iframe=null,t.receive=t.receive.bind(a(t)),t}return p(r,i),o(r,[{key:"receive",value:function(t){if(this.target===t.source)if(this.logDebugMessage(!0,t),"connected"===t.data)this.onConnectionReceived(t.data);else{var n=t.data;if("string"==typeof n)try{n=JSON.parse(n)}catch(t){console.warn("Bellhop error: ",t)}this.connected&&"object"===e(n)&&n.type&&this.trigger(n)}}},{key:"onConnectionReceived",value:function(t){if(this.connecting=!1,this.connected=!0,!this.isChild){if(!this.target)return;this.target.postMessage(t,this.origin)}for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:"*";this.connecting||(this.disconnect(),this.connecting=!0,t instanceof HTMLIFrameElement&&(this.iframe=t),this.isChild=void 0===t,this.supported=!0,this.isChild&&(this.supported=window!=t),this.origin=e,window.addEventListener("message",this.receive),this.isChild&&(window===this.target?this.trigger("failed"):this.target.postMessage("connected",this.origin)))}},{key:"disconnect",value:function(){this.connected=!1,this.connecting=!1,this.origin=null,this.iframe=null,this.isChild=!0,this._sendLater.length=0,window.removeEventListener("message",this.receive)}},{key:"send",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw"The event type must be a string";var n={type:t,data:e};this.logDebugMessage(!1,n),this.connecting?this._sendLater.push(n):this.target.postMessage(JSON.stringify(n),this.origin)}},{key:"fetch",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.connecting&&!this.connected)throw"No connection, please call connect() first";var i=function t(r){o&&n.off(r.type,t),e(r)};this.on(t,i),this.send(t,r)}},{key:"respond",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this,o=function t(o){var i;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return n&&r.off(o,t),"function"==typeof e&&(e=e()),a.next=4,s.awrap(e);case 4:i=a.sent,r.send(o.type,i);case 6:case"end":return a.stop()}}))};this.on(t,o)}},{key:"logDebugMessage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1?arguments[1]:void 0;this.debug&&"function"==typeof this.debug?this.debug({isChild:this.isChild,received:t,message:e}):this.debug&&console.log("Bellhop Instance (".concat(this.isChild?"Child":"Parent",") ").concat(t?"Receieved":"Sent"),e)}},{key:"destroy",value:function(){l(u(r.prototype),"destroy",this).call(this),this.disconnect(),this._sendLater.length=0}},{key:"target",get:function(){return this.isChild?window.parent:this.iframe.contentWindow}}]),r}();export{y as Bellhop,i as BellhopEventDispatcher}; //# sourceMappingURL=bellhop.js.map diff --git a/dist/bellhop.js.map b/dist/bellhop.js.map index ff04638..beb84df 100644 --- a/dist/bellhop.js.map +++ b/dist/bellhop.js.map @@ -1 +1 @@ -{"version":3,"file":"bellhop.js","sources":["../node_modules/@babel/runtime/helpers/typeof.js","../node_modules/@babel/runtime/helpers/classCallCheck.js","../node_modules/@babel/runtime/helpers/createClass.js","../src/BellhopEventDispatcher.js","../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js","../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../node_modules/@babel/runtime/helpers/superPropBase.js","../node_modules/@babel/runtime/helpers/get.js","../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/inherits.js","../src/Bellhop.js"],"sourcesContent":["function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","/**\n * Function with a added priority type\n * @typedef {Function} PriorityFunction\n * @property {number} _priority\n */\n\n/**\n * Generic event dispatcher\n * @class BellhopEventDispatcher\n */\nexport class BellhopEventDispatcher {\n /**\n * The collection of event listeners\n * @property {Object} _listeners\n * @private\n */\n constructor() {\n this._listeners = {};\n }\n\n /**\n * Add an event listener to listen to an event from either the parent or iframe\n * @method on\n * @param {String} name The name of the event to listen for\n * @param {PriorityFunction} callback The handler when an event is triggered\n * @param {number} [priority=0] The priority of the event listener. Higher numbers are handled first.\n */\n on(name, callback, priority = 0) {\n if (!this._listeners[name]) {\n this._listeners[name] = [];\n }\n callback._priority = parseInt(priority) || 0;\n\n // If callback is already set to this event\n if (-1 !== this._listeners[name].indexOf(callback)) {\n return;\n }\n\n this._listeners[name].push(callback);\n\n if (this._listeners[name].length > 1) {\n this._listeners[name].sort(this.listenerSorter);\n }\n }\n\n /**\n * Sorts listeners added by .on() by priority\n * @private\n * @param {PriorityFunction} a\n * @param {PriorityFunction} b\n * @returns {number};\n */\n listenerSorter(a, b) {\n return a._priority - b._priority;\n }\n\n /**\n * Remove an event listener\n * @method off\n * @param {String} name The name of event to listen for. If undefined, remove all listeners.\n * @param {Function} [callback] The optional handler when an event is triggered, if no callback\n * is set then all listeners by type are removed\n */\n off(name, callback) {\n if (this._listeners[name] === undefined) {\n return;\n }\n\n if (callback === undefined) {\n delete this._listeners[name];\n return;\n }\n\n const index = this._listeners[name].indexOf(callback);\n\n -1 < index ? this._listeners[name].splice(index, 1) : undefined;\n }\n\n /**\n * Trigger any event handlers for an event type\n * @method trigger\n * @param {object | String} event The event to send\n * @param {object} [data = {}] optional data to send to other areas in the app that are listening for this event\n */\n trigger(event, data = {}) {\n if (typeof event == 'string') {\n event = {\n type: event,\n data: 'object' === typeof data && null !== data ? data : {}\n };\n }\n\n if ('undefined' !== typeof this._listeners[event.type]) {\n for (let i = this._listeners[event.type].length - 1; i >= 0; i--) {\n this._listeners[event.type][i](event);\n }\n }\n }\n\n /**\n * Reset the listeners object\n * @method destroy\n */\n destroy() {\n this._listeners = {};\n }\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return Promise.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return Promise.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new Promise(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList) {\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList)\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","import { BellhopEventDispatcher } from './BellhopEventDispatcher.js';\n\n/**\n * Abstract communication layer between the iframe\n * and the parent DOM\n * @class Bellhop\n * @extends BellhopEventDispatcher\n */\nexport class Bellhop extends BellhopEventDispatcher {\n /**\n * Creates an instance of Bellhop.\n * @memberof Bellhop\n * @param { string | number } id the id of the Bellhop instance\n */\n constructor(id = (Math.random() * 100) | 0) {\n super();\n\n /**\n * The instance ID for bellhop\n * @property {string} id\n */\n this.id = `BELLHOP:${id}`;\n /**\n * If we are connected to another instance of bellhop\n * @property {Boolean} connected\n * @readOnly\n * @default false\n * @private\n */\n this.connected = false;\n\n /**\n * If this instance represents an iframe instance\n * @property {Boolean} isChild\n * @private\n * @default true\n */\n this.isChild = true;\n\n /**\n * If we are currently trying to connect\n * @property {Boolean} connecting\n * @default false\n * @private\n */\n this.connecting = false;\n\n /**\n * If debug mode is turned on\n * @property {Boolean} debug\n * @default false\n * @private\n */\n this.debug = false;\n\n /**\n * If using cross-domain, the domain to post to\n * @property {string} origin\n * @private\n * @default \"*\"\n */\n this.origin = '*';\n\n /**\n * Save any sends to wait until after we're done\n * @property {Array} _sendLater\n * @private\n */\n this._sendLater = [];\n\n /**\n * The iframe element\n * @property {HTMLIFrameElement} iframe\n * @private\n * @readOnly\n */\n this.iframe = null;\n\n /**\n * The bound receive function\n * @property {Function} receive\n * @private\n */\n this.receive = this.receive.bind(this);\n }\n\n /**\n * The connection has been established successfully\n * @event connected\n */\n\n /**\n * Connection could not be established\n * @event failed\n */\n\n /**\n * Handle messages in the window\n * @method receive\n * @param { MessageEvent } message the post message received from another bellhop instance\n * @private\n */\n receive(message) {\n // Ignore messages that don't originate from the target\n // we're connected to\n if (this.target !== message.source) {\n return;\n }\n\n this.logDebugMessage(true, message);\n\n // If this is not the initial connection message\n if (message.data !== 'connected') {\n let data = message.data;\n // Check to see if the data was sent as a stringified json\n if ('string' === typeof data) {\n try {\n data = JSON.parse(data);\n } catch (err) {\n console.error('Bellhop error: ', err);\n }\n }\n if (this.connected && 'object' === typeof data && data.type) {\n this.trigger(data);\n }\n return;\n }\n // Else setup the connection\n this.onConnectionReceived(message.data);\n }\n /**\n * Handle the initial connected message\n * @memberof Bellhop\n * @param {object} message the message received from the other bellhop instance\n * @private\n */\n onConnectionReceived(message) {\n this.connecting = false;\n this.connected = true;\n\n // Be polite and respond to the child that we're ready\n if (!this.isChild) {\n this.target.postMessage(message, this.origin);\n }\n\n // If we have any sends waiting to send\n // we are now connected and it should be okay\n for (let i = 0; i < this._sendLater.length; i++) {\n const { type, data } = this._sendLater[i];\n this.send(type, data);\n }\n this._sendLater.length = 0;\n\n // If there is a connection event assigned call it\n this.trigger('connected');\n }\n\n /**\n * Setup the connection\n * @method connect\n * @param {HTMLIFrameElement} iframe The iframe to communicate with. If no value is set, the assumption\n * is that we're the child trying to communcate with our window.parent\n * @param {String} [origin=\"*\"] The domain to communicate with if different from the current.\n * @return {Bellhop} Return instance of current object\n */\n connect(iframe, origin = '*') {\n // Ignore if we're already trying to connect\n if (this.connecting) {\n return;\n }\n\n // Disconnect from any existing connection\n this.disconnect();\n\n // We are trying to connect\n this.connecting = true;\n\n // The iframe if we're the parent\n if (iframe instanceof HTMLIFrameElement) {\n this.iframe = iframe;\n }\n\n // The instance of bellhop is inside the iframe\n this.isChild = iframe === undefined;\n\n this.supported = true;\n if (this.isChild) {\n // for child pages, the window passed must be a different window\n this.supported = window != iframe;\n }\n\n this.origin = origin;\n\n window.addEventListener('message', this.receive);\n\n if (this.isChild) {\n // No parent, can't connect\n if (window === this.target) {\n this.trigger('failed');\n } else {\n // If connect is called after the window is ready\n // we can go ahead and send the connect message\n this.target.postMessage('connected', this.origin);\n }\n }\n }\n\n /**\n * Disconnect if there are any open connections\n * @method disconnect\n */\n disconnect() {\n this.connected = false;\n this.connecting = false;\n this.origin = null;\n this.iframe = null;\n this.isChild = true;\n this._sendLater.length = 0;\n\n window.removeEventListener('message', this.receive);\n }\n\n /**\n * Send an event to the connected instance\n * @method send\n * @param {string} type name/type of the event\n * @param {*} [data = {}] Additional data to send along with event\n */\n send(type, data = {}) {\n if (typeof type !== 'string') {\n throw 'The event type must be a string';\n }\n\n const message = {\n type,\n data\n };\n\n this.logDebugMessage(false, message);\n\n if (this.connecting) {\n this._sendLater.push(message);\n } else {\n this.target.postMessage(JSON.stringify(message), this.origin);\n }\n }\n\n /**\n * A convenience method for sending and listening to create\n * a singular link for fetching data. This is the same as calling send\n * and then getting a response right away with the same event.\n * @method fetch\n * @param {String} event The name of the event\n * @param {Function} callback The callback to call after, takes event object as one argument\n * @param {Object} [data = {}] Optional data to pass along\n * @param {Boolean} [runOnce=false] If we only want to fetch once and then remove the listener\n */\n fetch(event, callback, data = {}, runOnce = false) {\n if (!this.connecting && !this.connected) {\n throw 'No connection, please call connect() first';\n }\n\n const internalCallback = e => {\n if (runOnce) {\n this.off(e.type, internalCallback);\n }\n\n callback(e);\n };\n\n this.on(event, internalCallback);\n this.send(event, data);\n }\n\n /**\n * A convience method for listening to an event and then responding with some data\n * right away. Automatically removes the listener\n * @method respond\n * @param {String} event The name of the event\n * @param {Object | function | Promise | string} [data = {}] The object to pass back.\n * \tMay also be a function; the return value will be sent as data in this case.\n * @param {Boolean} [runOnce=false] If we only want to respond once and then remove the listener\n *\n */\n respond(event, data = {}, runOnce = false) {\n const bellhop = this; //'this' for use inside async function\n /**\n * @ignore\n */\n const internalCallback = async function(event) {\n if (runOnce) {\n bellhop.off(event, internalCallback);\n }\n if (typeof data === 'function') {\n data = data();\n }\n const newData = await data;\n bellhop.send(event.type, newData);\n };\n this.on(event, internalCallback);\n }\n\n /**\n * Send either the default log message or the callback provided if debug\n * is enabled\n * @method logDebugMessage\n */\n logDebugMessage(received = false, message) {\n if (this.debug && typeof this.debug === 'function') {\n this.debug({ isChild: this.isChild, received: false, message: message });\n } else if (this.debug) {\n console.log(\n `Bellhop Instance (${this.isChild ? 'Child' : 'Parent'}) ${\n received ? 'Receieved' : 'Sent'\n }`,\n message\n );\n }\n }\n\n /**\n * Destroy and don't use after this\n * @method destroy\n */\n destroy() {\n super.destroy();\n this.disconnect();\n this._sendLater.length = 0;\n }\n\n /**\n *\n * Returns the correct parent element for Bellhop's context\n * @readonly\n * @memberof Bellhop\n */\n get target() {\n return this.isChild ? window.parent : this.iframe.contentWindow;\n }\n}\n"],"names":["_typeof2","obj","Symbol","iterator","constructor","prototype","_typeof","module","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","BellhopEventDispatcher","_listeners","name","callback","priority","this","_priority","parseInt","indexOf","push","sort","listenerSorter","a","b","undefined","index","splice","event","data","type","runtime","exports","Op","hasOwn","hasOwnProperty","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","state","GenStateSuspendedStart","method","arg","GenStateExecuting","Error","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","done","GenStateSuspendedYield","value","makeInvokeMethod","fn","call","err","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","invoke","resolve","reject","result","Promise","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","displayName","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","async","iter","toString","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","ReferenceError","assertThisInitialized","_getPrototypeOf","o","property","_get","receiver","Reflect","get","base","superPropBase","desc","getOwnPropertyDescriptor","_setPrototypeOf","p","subClass","superClass","Bellhop","id","Math","random","connected","isChild","connecting","debug","origin","_sendLater","iframe","receive","_this","bind","message","source","logDebugMessage","onConnectionReceived","JSON","parse","console","trigger","postMessage","send","disconnect","HTMLIFrameElement","supported","window","addEventListener","removeEventListener","stringify","runOnce","internalCallback","e","_this2","off","on","bellhop","newData","received","log","parent","contentWindow"],"mappings":"2FAASA,EAASC,UAAkFD,EAArD,mBAAXE,QAAoD,iBAApBA,OAAOC,SAAoC,SAAkBF,iBAAqBA,GAA4B,SAAkBA,UAAcA,GAAyB,mBAAXC,QAAyBD,EAAIG,cAAgBF,QAAUD,IAAQC,OAAOG,UAAY,gBAAkBJ,IAA0BA,YAErVK,EAAQL,SACO,mBAAXC,QAAuD,WAA9BF,EAASE,OAAOC,UAClDI,UAAiBD,EAAU,SAAiBL,UACnCD,EAASC,IAGlBM,UAAiBD,EAAU,SAAiBL,UACnCA,GAAyB,mBAAXC,QAAyBD,EAAIG,cAAgBF,QAAUD,IAAQC,OAAOG,UAAY,SAAWL,EAASC,IAIxHK,EAAQL,GAGjBM,UAAiBD,KCVjB,MANA,SAAyBE,EAAUC,QAC3BD,aAAoBC,SAClB,IAAIC,UAAU,sCCFxB,SAASC,EAAkBC,EAAQC,OAC5B,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,KACjCE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EACtB,UAAWF,IAAYA,EAAWG,UAAW,GACjDC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAUlD,MANA,SAAsBP,EAAac,EAAYC,UACzCD,GAAYZ,EAAkBF,EAAYJ,UAAWkB,GACrDC,GAAab,EAAkBF,EAAae,GACzCf,GCHIgB,EAAb,uCAOSC,WAAa,wCAUjBC,EAAMC,OAAUC,yDA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AS,wCAUlBe,KAAKiK,QAAUsB,OAAOc,OAASrM,KAAKsK,OAAOgC,oBAzUtD"} \ No newline at end of file +{"version":3,"file":"bellhop.js","sources":["../node_modules/@babel/runtime/helpers/typeof.js","../node_modules/@babel/runtime/helpers/classCallCheck.js","../node_modules/@babel/runtime/helpers/createClass.js","../src/BellhopEventDispatcher.js","../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js","../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../node_modules/@babel/runtime/helpers/superPropBase.js","../node_modules/@babel/runtime/helpers/get.js","../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/inherits.js","../src/Bellhop.js"],"sourcesContent":["function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","/**\n * Function with a added priority type\n * @typedef {Function} PriorityFunction\n * @property {number} _priority\n */\n\n/**\n * Generic event dispatcher\n * @class BellhopEventDispatcher\n */\nexport class BellhopEventDispatcher {\n /**\n * The collection of event listeners\n * @property {Object} _listeners\n * @private\n */\n constructor() {\n this._listeners = {};\n }\n\n /**\n * Add an event listener to listen to an event from either the parent or iframe\n * @method on\n * @param {String} name The name of the event to listen for\n * @param {PriorityFunction} callback The handler when an event is triggered\n * @param {number} [priority=0] The priority of the event listener. Higher numbers are handled first.\n */\n on(name, callback, priority = 0) {\n if (!this._listeners[name]) {\n this._listeners[name] = [];\n }\n callback._priority = parseInt(priority) || 0;\n\n // If callback is already set to this event\n if (-1 !== this._listeners[name].indexOf(callback)) {\n return;\n }\n\n this._listeners[name].push(callback);\n\n if (this._listeners[name].length > 1) {\n this._listeners[name].sort(this.listenerSorter);\n }\n }\n\n /**\n * Sorts listeners added by .on() by priority\n * @private\n * @param {PriorityFunction} a\n * @param {PriorityFunction} b\n * @returns {number};\n */\n listenerSorter(a, b) {\n return a._priority - b._priority;\n }\n\n /**\n * Remove an event listener\n * @method off\n * @param {String} name The name of event to listen for. If undefined, remove all listeners.\n * @param {Function} [callback] The optional handler when an event is triggered, if no callback\n * is set then all listeners by type are removed\n */\n off(name, callback) {\n if (this._listeners[name] === undefined) {\n return;\n }\n\n if (callback === undefined) {\n delete this._listeners[name];\n return;\n }\n\n const index = this._listeners[name].indexOf(callback);\n\n -1 < index ? this._listeners[name].splice(index, 1) : undefined;\n }\n\n /**\n * Trigger any event handlers for an event type\n * @method trigger\n * @param {object | String} event The event to send\n * @param {object} [data = {}] optional data to send to other areas in the app that are listening for this event\n */\n trigger(event, data = {}) {\n if (typeof event == 'string') {\n event = {\n type: event,\n data: 'object' === typeof data && null !== data ? data : {}\n };\n }\n\n if ('undefined' !== typeof this._listeners[event.type]) {\n for (let i = this._listeners[event.type].length - 1; i >= 0; i--) {\n this._listeners[event.type][i](event);\n }\n }\n }\n\n /**\n * Reset the listeners object\n * @method destroy\n */\n destroy() {\n this._listeners = {};\n }\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return Promise.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return Promise.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new Promise(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList) {\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList)\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","import { BellhopEventDispatcher } from './BellhopEventDispatcher.js';\n\n/**\n * Abstract communication layer between the iframe\n * and the parent DOM\n * @class Bellhop\n * @extends BellhopEventDispatcher\n */\nexport class Bellhop extends BellhopEventDispatcher {\n /**\n * Creates an instance of Bellhop.\n * @memberof Bellhop\n * @param { string | number } id the id of the Bellhop instance\n */\n constructor(id = (Math.random() * 100) | 0) {\n super();\n\n /**\n * The instance ID for bellhop\n * @property {string} id\n */\n this.id = `BELLHOP:${id}`;\n /**\n * If we are connected to another instance of bellhop\n * @property {Boolean} connected\n * @readOnly\n * @default false\n * @private\n */\n this.connected = false;\n\n /**\n * If this instance represents an iframe instance\n * @property {Boolean} isChild\n * @private\n * @default true\n */\n this.isChild = true;\n\n /**\n * If we are currently trying to connect\n * @property {Boolean} connecting\n * @default false\n * @private\n */\n this.connecting = false;\n\n /**\n * If debug mode is turned on\n * @property {Boolean} debug\n * @default false\n * @private\n */\n this.debug = false;\n\n /**\n * If using cross-domain, the domain to post to\n * @property {string} origin\n * @private\n * @default \"*\"\n */\n this.origin = '*';\n\n /**\n * Save any sends to wait until after we're done\n * @property {Array} _sendLater\n * @private\n */\n this._sendLater = [];\n\n /**\n * The iframe element\n * @property {HTMLIFrameElement} iframe\n * @private\n * @readOnly\n */\n this.iframe = null;\n\n /**\n * The bound receive function\n * @property {Function} receive\n * @private\n */\n this.receive = this.receive.bind(this);\n }\n\n /**\n * The connection has been established successfully\n * @event connected\n */\n\n /**\n * Connection could not be established\n * @event failed\n */\n\n /**\n * Handle messages in the window\n * @method receive\n * @param { MessageEvent } message the post message received from another bellhop instance\n * @private\n */\n receive(message) {\n // Ignore messages that don't originate from the target\n // we're connected to\n if (this.target !== message.source) {\n return;\n }\n\n this.logDebugMessage(true, message);\n\n // If this is not the initial connection message\n if (message.data !== 'connected') {\n let data = message.data;\n // Check to see if the data was sent as a stringified json\n if ('string' === typeof data) {\n try {\n data = JSON.parse(data);\n } catch (err) {\n console.warn('Bellhop error: ', err);\n }\n }\n if (this.connected && 'object' === typeof data && data.type) {\n this.trigger(data);\n }\n return;\n }\n // Else setup the connection\n this.onConnectionReceived(message.data);\n }\n /**\n * Handle the initial connected message\n * @memberof Bellhop\n * @param {object} message the message received from the other bellhop instance\n * @private\n */\n onConnectionReceived(message) {\n this.connecting = false;\n this.connected = true;\n\n // Be polite and respond to the child that we're ready\n if (!this.isChild) {\n // Timing issue: this.iframe.contentWindow is null when parent closes child iframe before done with rendering\n if (!this.target) {\n return;\n }\n this.target.postMessage(message, this.origin);\n }\n\n // If we have any sends waiting to send\n // we are now connected and it should be okay\n for (let i = 0; i < this._sendLater.length; i++) {\n const { type, data } = this._sendLater[i];\n this.send(type, data);\n }\n this._sendLater.length = 0;\n\n // If there is a connection event assigned call it\n this.trigger('connected');\n }\n\n /**\n * Setup the connection\n * @method connect\n * @param {HTMLIFrameElement} iframe The iframe to communicate with. If no value is set, the assumption\n * is that we're the child trying to communcate with our window.parent\n * @param {String} [origin=\"*\"] The domain to communicate with if different from the current.\n * @return {Bellhop} Return instance of current object\n */\n connect(iframe, origin = '*') {\n // Ignore if we're already trying to connect\n if (this.connecting) {\n return;\n }\n\n // Disconnect from any existing connection\n this.disconnect();\n\n // We are trying to connect\n this.connecting = true;\n\n // The iframe if we're the parent\n if (iframe instanceof HTMLIFrameElement) {\n this.iframe = iframe;\n }\n\n // The instance of bellhop is inside the iframe\n this.isChild = iframe === undefined;\n\n this.supported = true;\n if (this.isChild) {\n // for child pages, the window passed must be a different window\n this.supported = window != iframe;\n }\n\n this.origin = origin;\n\n window.addEventListener('message', this.receive);\n\n if (this.isChild) {\n // No parent, can't connect\n if (window === this.target) {\n this.trigger('failed');\n } else {\n // If connect is called after the window is ready\n // we can go ahead and send the connect message\n this.target.postMessage('connected', this.origin);\n }\n }\n }\n\n /**\n * Disconnect if there are any open connections\n * @method disconnect\n */\n disconnect() {\n this.connected = false;\n this.connecting = false;\n this.origin = null;\n this.iframe = null;\n this.isChild = true;\n this._sendLater.length = 0;\n\n window.removeEventListener('message', this.receive);\n }\n\n /**\n * Send an event to the connected instance\n * @method send\n * @param {string} type name/type of the event\n * @param {*} [data = {}] Additional data to send along with event\n */\n send(type, data = {}) {\n if (typeof type !== 'string') {\n throw 'The event type must be a string';\n }\n\n const message = {\n type,\n data\n };\n\n this.logDebugMessage(false, message);\n\n if (this.connecting) {\n this._sendLater.push(message);\n } else {\n this.target.postMessage(JSON.stringify(message), this.origin);\n }\n }\n\n /**\n * A convenience method for sending and listening to create\n * a singular link for fetching data. This is the same as calling send\n * and then getting a response right away with the same event.\n * @method fetch\n * @param {String} event The name of the event\n * @param {Function} callback The callback to call after, takes event object as one argument\n * @param {Object} [data = {}] Optional data to pass along\n * @param {Boolean} [runOnce=false] If we only want to fetch once and then remove the listener\n */\n fetch(event, callback, data = {}, runOnce = false) {\n if (!this.connecting && !this.connected) {\n throw 'No connection, please call connect() first';\n }\n\n const internalCallback = e => {\n if (runOnce) {\n this.off(e.type, internalCallback);\n }\n\n callback(e);\n };\n\n this.on(event, internalCallback);\n this.send(event, data);\n }\n\n /**\n * A convience method for listening to an event and then responding with some data\n * right away. Automatically removes the listener\n * @method respond\n * @param {String} event The name of the event\n * @param {Object | function | Promise | string} [data = {}] The object to pass back.\n * \tMay also be a function; the return value will be sent as data in this case.\n * @param {Boolean} [runOnce=false] If we only want to respond once and then remove the listener\n *\n */\n respond(event, data = {}, runOnce = false) {\n const bellhop = this; //'this' for use inside async function\n /**\n * @ignore\n */\n const internalCallback = async function(event) {\n if (runOnce) {\n bellhop.off(event, internalCallback);\n }\n if (typeof data === 'function') {\n data = data();\n }\n const newData = await data;\n bellhop.send(event.type, newData);\n };\n this.on(event, internalCallback);\n }\n\n /**\n * Send either the default log message or the callback provided if debug\n * is enabled\n * @method logDebugMessage\n */\n logDebugMessage(received = false, message) {\n if (this.debug && typeof this.debug === 'function') {\n this.debug({ isChild: this.isChild, received, message: message });\n } else if (this.debug) {\n console.log(\n `Bellhop Instance (${this.isChild ? 'Child' : 'Parent'}) ${\n received ? 'Receieved' : 'Sent'\n }`,\n message\n );\n }\n }\n\n /**\n * Destroy and don't use after this\n * @method destroy\n */\n destroy() {\n super.destroy();\n this.disconnect();\n this._sendLater.length = 0;\n }\n\n /**\n *\n * Returns the correct parent element for Bellhop's context\n * @readonly\n * @memberof Bellhop\n */\n get target() {\n return this.isChild ? window.parent : this.iframe.contentWindow;\n }\n}\n"],"names":["_typeof2","obj","Symbol","iterator","constructor","prototype","_typeof","module","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","BellhopEventDispatcher","_listeners","name","callback","priority","this","_priority","parseInt","indexOf","push","sort","listenerSorter","a","b","undefined","index","splice","event","data","type","runtime","exports","Op","hasOwn","hasOwnProperty","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","state","GenStateSuspendedStart","method","arg","GenStateExecuting","Error","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","done","GenStateSuspendedYield","value","makeInvokeMethod","fn","call","err","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","invoke","resolve","reject","result","Promise","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","displayName","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","async","iter","toString","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","ReferenceError","assertThisInitialized","_getPrototypeOf","o","property","_get","receiver","Reflect","get","base","superPropBase","desc","getOwnPropertyDescriptor","_setPrototypeOf","p","subClass","superClass","Bellhop","id","Math","random","connected","isChild","connecting","debug","origin","_sendLater","iframe","receive","_this","bind","message","source","logDebugMessage","onConnectionReceived","JSON","parse","console","warn","trigger","postMessage","send","disconnect","HTMLIFrameElement","supported","window","addEventListener","removeEventListener","stringify","runOnce","internalCallback","e","_this2","off","on","bellhop","newData","received","log","parent","contentWindow"],"mappings":"2FAASA,EAASC,UAAkFD,EAArD,mBAAXE,QAAoD,iBAApBA,OAAOC,SAAoC,SAAkBF,iBAAqBA,GAA4B,SAAkBA,UAAcA,GAAyB,mBAAXC,QAAyBD,EAAIG,cAAgBF,QAAUD,IAAQC,OAAOG,UAAY,gBAAkBJ,IAA0BA,YAErVK,EAAQL,SACO,mBAAXC,QAAuD,WAA9BF,EAASE,OAAOC,UAClDI,UAAiBD,EAAU,SAAiBL,UACnCD,EAASC,IAGlBM,UAAiBD,EAAU,SAAiBL,UACnCA,GAAyB,mBAAXC,QAAyBD,EAAIG,cAAgBF,QAAUD,IAAQC,OAAOG,UAAY,SAAWL,EAASC,IAIxHK,EAAQL,GAGjBM,UAAiBD,KCVjB,MANA,SAAyBE,EAAUC,QAC3BD,aAAoBC,SAClB,IAAIC,UAAU,sCCFxB,SAASC,EAAkBC,EAAQC,OAC5B,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,KACjCE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EACtB,UAAWF,IAAYA,EAAWG,UAAW,GACjDC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAUlD,MANA,SAAsBP,EAAac,EAAYC,UACzCD,GAAYZ,EAAkBF,EAAYJ,UAAWkB,GACrDC,GAAab,EAAkBF,EAAae,GACzCf,GCHIgB,EAAb,uCAOSC,WAAa,wCAUjBC,EAAMC,OA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E3B1B,sFAWCW,kBACAhB,WAAWpL,OAAS,wCAUlBe,KAAKiK,QAAUuB,OAAOc,OAAStM,KAAKsK,OAAOiC,oBA7UtD"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c06dc57..15af105 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bellhop-iframe", - "version": "3.2.1", + "version": "3.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 89b398f..1dc4789 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bellhop-iframe", - "version": "3.2.1", + "version": "3.2.2", "main": "dist/bellhop.js", "module": "dist/bellhop.js", "browser": "dist/bellhop.js", diff --git a/src/Bellhop.js b/src/Bellhop.js index ea06a05..c26d921 100644 --- a/src/Bellhop.js +++ b/src/Bellhop.js @@ -117,7 +117,7 @@ export class Bellhop extends BellhopEventDispatcher { try { data = JSON.parse(data); } catch (err) { - console.error('Bellhop error: ', err); + console.warn('Bellhop error: ', err); } } if (this.connected && 'object' === typeof data && data.type) { @@ -140,6 +140,10 @@ export class Bellhop extends BellhopEventDispatcher { // Be polite and respond to the child that we're ready if (!this.isChild) { + // Timing issue: this.iframe.contentWindow is null when parent closes child iframe before done with rendering + if (!this.target) { + return; + } this.target.postMessage(message, this.origin); } @@ -307,7 +311,7 @@ export class Bellhop extends BellhopEventDispatcher { */ logDebugMessage(received = false, message) { if (this.debug && typeof this.debug === 'function') { - this.debug({ isChild: this.isChild, received: false, message: message }); + this.debug({ isChild: this.isChild, received, message: message }); } else if (this.debug) { console.log( `Bellhop Instance (${this.isChild ? 'Child' : 'Parent'}) ${