!function(){"use strict";var e={n:function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,{a:t}),t},d:function(n,t){for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{Draggable:function(){return s}});var t=window.vendor.React,o=e.n(t),r=window.lodash,i=window.divi.window,a=window.vendor.ReactDOM;const l=()=>(0,a.createPortal)(o().createElement("div",{className:"et-vb-app-frame-draggable-overlay"}),(0,i.topWindowPortalDomTarget)()),s=e=>{const{children:n,className:a,isTopWindow:s,style:d,onContextMenu:c,onElementClick:u,onElementDrag:m,onElementRelease:v,type:p,disable:f,hasWrapper:w}=e,g=s?i.topWindow:window,y=(0,t.useRef)(null),[b,E]=(0,t.useState)(!1),M=e=>{const n=g.document.body;if("start"===e)return E(!0),void n.classList.add("et-vb-dragging");E(!1),n.classList.remove("et-vb-dragging")},D=e=>{if(f)return;M("start");const n=e.clientX,t=e.clientY,o=y.current.getBoundingClientRect(),i=(0,r.now)();u({ref:y,domRect:o,event:e});const a=e=>{const r={x:e.clientX-n,y:e.clientY-t};0===r.x&&0===r.y||m({ref:y,sinceMouseDown:r,domRect:o,onClickTimestamp:i,event:e})},l=e=>{const r={x:e.clientX-n,y:e.clientY-t};M("end"),v({ref:y,sinceMouseDown:r,domRect:o,onClickTimestamp:i,event:e}),g.removeEventListener("mousemove",a),g.removeEventListener("mouseup",l)};g.addEventListener("mousemove",a),g.addEventListener("mouseup",l)},R=s&&b?o().createElement(l,{key:"app-frame-overlay"}):"";return!w&&(0,t.isValidElement)(n)?(0,t.cloneElement)(n,{onContextMenu:c,onMouseDown:D,ref:y,className:a,style:d},R):(0,t.createElement)(p,{onContextMenu:c,onMouseDown:D,ref:y,className:a,style:d},[n,R])};s.defaultProps={isTopWindow:!0,className:"",onElementClick:r.noop,onElementDrag:r.noop,onElementRelease:r.noop,type:"div",disable:!1,style:{},hasWrapper:!0},(window.divi=window.divi||{}).draggable=n}();