This repository has been archived on 2022-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
divi/includes/builder/frontend-builder/build/bundle.modals.38d79104.js

3 lines
1.5 MiB
JavaScript
Raw Normal View History

2021-12-07 11:08:05 +00:00
/*! For license information please see bundle.modals.38d79104.js.LICENSE.txt */
(window.webpackETJsonp=window.webpackETJsonp||[]).push([[6],Array(450).concat([function(e,t,n){e.exports=function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(){return++d}function n(){var e;h.debug&&(e=console).log.apply(e,arguments)}function r(e){var t=document.createElement("a");return t.href=e,t.origin||t.protocol+"//"+t.hostname}var o=window.navigator.userAgent.indexOf("Edge")>-1;function a(e,t){return(e.origin===t||o)&&"object"===u(e.data)&&"postmate"in e.data&&e.data.type===s&&!!{"handshake-reply":1,call:1,emit:1,reply:1,request:1}[e.data.postmate]}function i(e,t){var n="function"==typeof e[t]?e[t]():e[t];return h.Promise.resolve(n)}var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s="application/x-postmate-v1+json",c=Object.prototype.hasOwnProperty,d=0,f=function(){function r(t){var o=this;e(this,r),this.parent=t.parent,this.frame=t.frame,this.child=t.child,this.childOrigin=t.childOrigin,this.events={},n("Parent: Registering API"),n("Parent: Awaiting messages..."),this.listener=function(e){var t=((e||{}).data||{}).value||{},r=t.data,a=t.name;"emit"===e.data.postmate&&(n("Parent: Received event emission: "+a),a in o.events&&o.events[a].call(o,r))},this.parent.addEventListener("message",this.listener,!1),n("Parent: Awaiting event emissions from Child")}return l(r,[{key:"get",value:function(e){var n=this;return new h.Promise((function(r){var o=t(),a=function e(t){t.data.uid===o&&"reply"===t.data.postmate&&(n.parent.removeEventListener("message",e,!1),r(t.data.value))};n.parent.addEventListener("message",a,!1),n.child.postMessage({postmate:"request",type:s,property:e,uid:o},n.childOrigin)}))}},{key:"call",value:function(e,t){this.child.postMessage({postmate:"call",type:s,property:e,data:t},this.childOrigin)}},{key:"on",value:function(e,t){this.events[e]=t}},{key:"destroy",value:function(){n("Parent: Destroying Postmate instance"),window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)}}]),r}(),p=function(){function t(r){var o=this;e(this,t),this.model=r.model,this.parent=r.parent,this.parentOrigin=r.parentOrigin,this.child=r.child,n("Child: Registering API"),n("Child: Awaiting messages..."),this.child.addEventListener("message",(function(e){if(a(e,o.parentOrigin)){n("Child: Received request",e.data);var t=e.data,r=t.property,l=t.uid,u=t.data;if("call"===e.data.postmate)return void(r in o.model&&"function"==typeof o.model[r]&&o.model[r].call(o,u));i(o.model,r).then((function(t){return e.source.postMessage({property:r,postmate:"reply",type:s,uid:l,value:t},e.origin)}))}}))}return l(t,[{key:"emit",value:function(e,t){n('Child: Emitting Event "'+e+'"',t),this.parent.postMessage({postmate:"emit",type:s,value:{name:e,data:t}},this.parentOrigin)}}]),t}(),h=function(){function t(n){e(this,t);var r=n.container,o=void 0===r?void 0!==o?o:document.body:r,a=n.model,i=n.url;return this.parent=window,this.frame=document.createElement("iframe"),o.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=a||{},this.sendHandshake(i)}return l(t,[{key:"sendHandshake",value:function(e){var o=this,i=r(e),l=0,u=void 0;return new t.Promise((function(t,r){var c=function e(l){return!!a(l,i)&&("handshake-reply"===l.data.postmate?(clearInterval(u),n("Parent: Received handshake reply from Child"),o.parent.removeEventListener("message",e,!1),o.childOrigin=l.origin,n("Parent: Saving Child origin",o.childOrigin),t(new f(o))):(n("Parent: Invalid handshake reply"),r("Failed handshake")))};o.parent.addEventListener("message",c,!1);var d=function(){n("Parent: Sending handshake attempt "
//# sourceMappingURL=bundle.modals.38d79104.js.map