UNPKG

gridstack

Version:

TypeScript/JS lib for dashboard layout and creation, responsive, mobile support, no external dependencies, with many wrappers (React, Angular, Vue, Ember, knockout...)

2 lines 101 kB
/*! For license information please see gridstack-all.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.GridStack=e():t.GridStack=e()}(self,(function(){return function(){"use strict";var t={174:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DDBaseImplement=void 0;var i=function(){function t(){this._eventRegister={}}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this._disabled},enumerable:!1,configurable:!0}),t.prototype.on=function(t,e){this._eventRegister[t]=e},t.prototype.off=function(t){delete this._eventRegister[t]},t.prototype.enable=function(){this._disabled=!1},t.prototype.disable=function(){this._disabled=!0},t.prototype.destroy=function(){delete this._eventRegister},t.prototype.triggerEvent=function(t,e){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](e)},t}();e.DDBaseImplement=i},219:function(t,e,i){var o,n=this&&this.__extends||(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.DDDraggable=void 0;var s=i(727),a=i(116),l=i(174),d=i(135);e.DDDraggable=function(t){function e(e,i){void 0===i&&(i={});var o,n=this;(n=t.call(this)||this).el=e,n.option=i,n.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};var r=null===(o=null==i?void 0:i.handle)||void 0===o?void 0:o.substring(1),s=e.gridstackNode;return n.dragEls=!r||e.classList.contains(r)?[e]:(null==s?void 0:s.subGrid)?[e.querySelector(i.handle)||e]:Array.from(e.querySelectorAll(i.handle)),0===n.dragEls.length&&(n.dragEls=[e]),n._mouseDown=n._mouseDown.bind(n),n._mouseMove=n._mouseMove.bind(n),n._mouseUp=n._mouseUp.bind(n),n._keyEvent=n._keyEvent.bind(n),n.enable(),n}return n(e,t),e.prototype.on=function(e,i){t.prototype.on.call(this,e,i)},e.prototype.off=function(e){t.prototype.off.call(this,e)},e.prototype.enable=function(){var e=this;!1!==this.disabled&&(t.prototype.enable.call(this),this.dragEls.forEach((function(t){t.addEventListener("mousedown",e._mouseDown),d.isTouch&&(t.addEventListener("touchstart",d.touchstart),t.addEventListener("pointerdown",d.pointerdown))})),this.el.classList.remove("ui-draggable-disabled"))},e.prototype.disable=function(e){var i=this;void 0===e&&(e=!1),!0!==this.disabled&&(t.prototype.disable.call(this),this.dragEls.forEach((function(t){t.removeEventListener("mousedown",i._mouseDown),d.isTouch&&(t.removeEventListener("touchstart",d.touchstart),t.removeEventListener("pointerdown",d.pointerdown))})),e||this.el.classList.add("ui-draggable-disabled"))},e.prototype.destroy=function(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,t.prototype.destroy.call(this)},e.prototype.updateOption=function(t){var e=this;return Object.keys(t).forEach((function(i){return e.option[i]=t[i]})),this},e.prototype._mouseDown=function(t){if(!s.DDManager.mouseHandled)return 0!==t.button||!this.dragEls.find((function(e){return e===t.target}))&&t.target.closest('input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle')||this.option.cancel&&t.target.closest(this.option.cancel)||(this.mouseDownEvent=t,delete this.dragging,delete s.DDManager.dragElement,delete s.DDManager.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),d.isTouch&&(t.currentTarget.addEventListener("touchmove",d.touchmove),t.currentTarget.addEventListener("touchend",d.touchend)),t.preventDefault(),document.activeElement&&document.activeElement.blur(),s.DDManager.mouseHandled=!0),!0},e.prototype._callDrag=function(t){if(this.dragging){var e=a.Utils.initEvent(t,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(e,this.ui()),this.triggerEvent("drag",e)}},e.prototype._mouseMove=function(t){var e,i=this,o=this.mouseDownEvent;if(this.lastDrag=t,this.dragging)if(this._dragFollow(t),s.DDManager.pauseDrag){var n=Number.isInteger(s.DDManager.pauseDrag)?s.DDManager.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout((function(){return i._callDrag(t)}),n)}else this._callDrag(t);else if(Math.abs(t.x-o.x)+Math.abs(t.y-o.y)>3){this.dragging=!0,s.DDManager.dragElement=this;var r=null===(e=this.el.gridstackNode)||void 0===e?void 0:e.grid;r?s.DDManager.dropElement=r.el.ddElement.ddDroppable:delete s.DDManager.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=a.Utils.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment),this._setupHelperStyle(t);var l=a.Utils.initEvent(t,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(l,this.ui()),this.triggerEvent("dragstart",l),document.addEventListener("keydown",this._keyEvent)}return!0},e.prototype._mouseUp=function(t){var e,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),d.isTouch&&t.currentTarget&&(t.currentTarget.removeEventListener("touchmove",d.touchmove,!0),t.currentTarget.removeEventListener("touchend",d.touchend,!0)),this.dragging){delete this.dragging,null===(e=this.el.gridstackNode)||void 0===e||delete e._origRotate,document.removeEventListener("keydown",this._keyEvent),(null===(i=s.DDManager.dropElement)||void 0===i?void 0:i.el)===this.el.parentElement&&delete s.DDManager.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();var o=a.Utils.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(o),this.triggerEvent("dragstop",o),s.DDManager.dropElement&&s.DDManager.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete s.DDManager.dragElement,delete s.DDManager.dropElement,delete s.DDManager.mouseHandled,t.preventDefault()},e.prototype._keyEvent=function(t){var e,i,o=this.el.gridstackNode,n=(null==o?void 0:o.grid)||(null===(i=null===(e=s.DDManager.dropElement)||void 0===e?void 0:e.el)||void 0===i?void 0:i.gridstack);if("Escape"===t.key)o&&o._origRotate&&(o._orig=o._origRotate,delete o._origRotate),null==n||n.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(o&&n&&("r"===t.key||"R"===t.key)){if(!a.Utils.canBeRotated(o))return;o._origRotate=o._origRotate||r({},o._orig),delete o._moving,n.setAnimation(!1).rotate(o.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),o._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,o.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",a.Utils.swap(o._orig,"w","h"),delete o._rect,this._mouseMove(this.lastDrag)}},e.prototype._createHelper=function(){var t=this,i=this.el;return"function"==typeof this.option.helper?i=this.option.helper(this.el):"clone"===this.option.helper&&(i=a.Utils.cloneNode(this.el)),i.parentElement||a.Utils.appendTo(i,"parent"===this.option.appendTo?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=e.originStyleProp.map((function(e){return t.el.style[e]})),i},e.prototype._setupHelperStyle=function(t){var e=this;this.helper.classList.add("ui-draggable-dragging");var i=this.helper.style;return i.pointerEvents="none",i.width=this.dragOffset.width+"px",i.height=this.dragOffset.height+"px",i.willChange="left, top",i.position="fixed",this._dragFollow(t),i.transition="none",setTimeout((function(){e.helper&&(i.transition=null)}),0),this},e.prototype._removeHelperStyle=function(){var t,i=this;this.helper.classList.remove("ui-draggable-dragging");var o=null===(t=this.helper)||void 0===t?void 0:t.gridstackNode;if(!(null==o?void 0:o._isAboutToRemove)&&this.dragElementOriginStyle){var n=this.helper,r=this.dragElementOriginStyle.transition||null;n.style.transition=this.dragElementOriginStyle.transition="none",e.originStyleProp.forEach((function(t){return n.style[t]=i.dragElementOriginStyle[t]||null})),setTimeout((function(){return n.style.transition=r}),50)}return delete this.dragElementOriginStyle,this},e.prototype._dragFollow=function(t){var e=this.helper.style,i=this.dragOffset;e.left=(t.clientX+i.offsetLeft-0)*this.dragTransform.xScale+"px",e.top=(t.clientY+i.offsetTop-0)*this.dragTransform.yScale+"px"},e.prototype._setupHelperContainmentStyle=function(){return this.helperContainment=this.helper.parentElement,"fixed"!==this.helper.style.position&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this},e.prototype._getDragOffset=function(t,e,i){var o=0,n=0;i&&(o=this.dragTransform.xOffset,n=this.dragTransform.yOffset);var r=e.getBoundingClientRect();return{left:r.left,top:r.top,offsetLeft:-t.clientX+r.left-o,offsetTop:-t.clientY+r.top-n,width:r.width*this.dragTransform.xScale,height:r.height*this.dragTransform.yScale}},e.prototype.ui=function(){var t=this.el.parentElement.getBoundingClientRect(),e=this.helper.getBoundingClientRect();return{position:{top:(e.top-t.top)*this.dragTransform.yScale,left:(e.left-t.left)*this.dragTransform.xScale}}},e.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"],e}(l.DDBaseImplement)},183:function(t,e,i){var o,n=this&&this.__extends||(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.DDDroppable=void 0;var s=i(727),a=i(174),l=i(116),d=i(135),h=function(t){function e(e,i){void 0===i&&(i={});var o=t.call(this)||this;return o.el=e,o.option=i,o._mouseEnter=o._mouseEnter.bind(o),o._mouseLeave=o._mouseLeave.bind(o),o.enable(),o._setupAccept(),o}return n(e,t),e.prototype.on=function(e,i){t.prototype.on.call(this,e,i)},e.prototype.off=function(e){t.prototype.off.call(this,e)},e.prototype.enable=function(){!1!==this.disabled&&(t.prototype.enable.call(this),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),d.isTouch&&(this.el.addEventListener("pointerenter",d.pointerenter),this.el.addEventListener("pointerleave",d.pointerleave)))},e.prototype.disable=function(e){void 0===e&&(e=!1),!0!==this.disabled&&(t.prototype.disable.call(this),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),d.isTouch&&(this.el.removeEventListener("pointerenter",d.pointerenter),this.el.removeEventListener("pointerleave",d.pointerleave)))},e.prototype.destroy=function(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),t.prototype.destroy.call(this)},e.prototype.updateOption=function(t){var e=this;return Object.keys(t).forEach((function(i){return e.option[i]=t[i]})),this._setupAccept(),this},e.prototype._mouseEnter=function(t){if(s.DDManager.dragElement&&this._canDrop(s.DDManager.dragElement.el)){t.preventDefault(),t.stopPropagation(),s.DDManager.dropElement&&s.DDManager.dropElement!==this&&s.DDManager.dropElement._mouseLeave(t,!0),s.DDManager.dropElement=this;var e=l.Utils.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(e,this._ui(s.DDManager.dragElement)),this.triggerEvent("dropover",e),this.el.classList.add("ui-droppable-over")}},e.prototype._mouseLeave=function(t,e){var i;if(void 0===e&&(e=!1),s.DDManager.dragElement&&s.DDManager.dropElement===this){t.preventDefault(),t.stopPropagation();var o=l.Utils.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(o,this._ui(s.DDManager.dragElement)),this.triggerEvent("dropout",o),s.DDManager.dropElement===this&&(delete s.DDManager.dropElement,!e)){for(var n=void 0,r=this.el.parentElement;!n&&r;)n=null===(i=r.ddElement)||void 0===i?void 0:i.ddDroppable,r=r.parentElement;n&&n._mouseEnter(t)}}},e.prototype.drop=function(t){t.preventDefault();var e=l.Utils.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(e,this._ui(s.DDManager.dragElement)),this.triggerEvent("drop",e)},e.prototype._canDrop=function(t){return t&&(!this.accept||this.accept(t))},e.prototype._setupAccept=function(){var t=this;return this.option.accept?("string"==typeof this.option.accept?this.accept=function(e){return e.classList.contains(t.option.accept)||e.matches(t.option.accept)}:this.accept=this.option.accept,this):this},e.prototype._ui=function(t){return r({draggable:t.el},t.ui())},e}(a.DDBaseImplement);e.DDDroppable=h},536:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.DDElement=void 0;var o=i(585),n=i(219),r=i(183),s=function(){function t(t){this.el=t}return t.init=function(e){return e.ddElement||(e.ddElement=new t(e)),e.ddElement},t.prototype.on=function(t,e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.on(t,e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.on(t,e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.on(t,e),this},t.prototype.off=function(t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.off(t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.off(t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.off(t),this},t.prototype.setupDraggable=function(t){return this.ddDraggable?this.ddDraggable.updateOption(t):this.ddDraggable=new n.DDDraggable(this.el,t),this},t.prototype.cleanDraggable=function(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this},t.prototype.setupResizable=function(t){return this.ddResizable?this.ddResizable.updateOption(t):this.ddResizable=new o.DDResizable(this.el,t),this},t.prototype.cleanResizable=function(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this},t.prototype.setupDroppable=function(t){return this.ddDroppable?this.ddDroppable.updateOption(t):this.ddDroppable=new r.DDDroppable(this.el,t),this},t.prototype.cleanDroppable=function(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this},t}();e.DDElement=s},735:function(t,e,i){var o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},o.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.DDGridStack=void 0;var n=i(116),r=i(727),s=i(536),a=function(){function t(){}return t.prototype.resizable=function(t,e,i,n){return this._getDDElements(t,e).forEach((function(t){var r;if("disable"===e||"enable"===e)t.ddResizable&&t.ddResizable[e]();else if("destroy"===e)t.ddResizable&&t.cleanResizable();else if("option"===e)t.setupResizable(((r={})[i]=n,r));else{var s=t.el.gridstackNode.grid,a=t.el.getAttribute("gs-resize-handles")||s.opts.resizable.handles||"e,s,se";"all"===a&&(a="n,e,s,w,se,sw,ne,nw");var l=!s.opts.alwaysShowResizeHandle;t.setupResizable(o(o(o({},s.opts.resizable),{handles:a,autoHide:l}),{start:e.start,stop:e.stop,resize:e.resize}))}})),this},t.prototype.draggable=function(t,e,i,n){return this._getDDElements(t,e).forEach((function(t){var r;if("disable"===e||"enable"===e)t.ddDraggable&&t.ddDraggable[e]();else if("destroy"===e)t.ddDraggable&&t.cleanDraggable();else if("option"===e)t.setupDraggable(((r={})[i]=n,r));else{var s=t.el.gridstackNode.grid;t.setupDraggable(o(o({},s.opts.draggable),{start:e.start,stop:e.stop,drag:e.drag}))}})),this},t.prototype.dragIn=function(t,e){return this._getDDElements(t).forEach((function(t){return t.setupDraggable(e)})),this},t.prototype.droppable=function(t,e,i,o){return"function"!=typeof e.accept||e._accept||(e._accept=e.accept,e.accept=function(t){return e._accept(t)}),this._getDDElements(t,e).forEach((function(t){var n;"disable"===e||"enable"===e?t.ddDroppable&&t.ddDroppable[e]():"destroy"===e?t.ddDroppable&&t.cleanDroppable():"option"===e?t.setupDroppable(((n={})[i]=o,n)):t.setupDroppable(e)})),this},t.prototype.isDroppable=function(t){var e;return!(!(null===(e=null==t?void 0:t.ddElement)||void 0===e?void 0:e.ddDroppable)||t.ddElement.ddDroppable.disabled)},t.prototype.isDraggable=function(t){var e;return!(!(null===(e=null==t?void 0:t.ddElement)||void 0===e?void 0:e.ddDraggable)||t.ddElement.ddDraggable.disabled)},t.prototype.isResizable=function(t){var e;return!(!(null===(e=null==t?void 0:t.ddElement)||void 0===e?void 0:e.ddResizable)||t.ddElement.ddResizable.disabled)},t.prototype.on=function(t,e,i){return this._getDDElements(t).forEach((function(t){return t.on(e,(function(t){i(t,r.DDManager.dragElement?r.DDManager.dragElement.el:t.target,r.DDManager.dragElement?r.DDManager.dragElement.helper:null)}))})),this},t.prototype.off=function(t,e){return this._getDDElements(t).forEach((function(t){return t.off(e)})),this},t.prototype._getDDElements=function(t,e){var i=t.gridstack||"destroy"!==e&&"disable"!==e,o=n.Utils.getElements(t);return o.length?o.map((function(t){return t.ddElement||(i?s.DDElement.init(t):null)})).filter((function(t){return t})):[]},t}();e.DDGridStack=a},727:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DDManager=void 0;e.DDManager=function(){}},784:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.DDResizableHandle=void 0;var o=i(135);e.DDResizableHandle=function(){function t(t,e,i){this.host=t,this.dir=e,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}return t.prototype._init=function(){var e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add("".concat(t.prefix).concat(this.dir)),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),o.isTouch&&(this.el.addEventListener("touchstart",o.touchstart),this.el.addEventListener("pointerdown",o.pointerdown)),this},t.prototype.destroy=function(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),o.isTouch&&(this.el.removeEventListener("touchstart",o.touchstart),this.el.removeEventListener("pointerdown",o.pointerdown)),this.host.removeChild(this.el),delete this.el,delete this.host,this},t.prototype._mouseDown=function(t){this.mouseDownEvent=t,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),o.isTouch&&(this.el.addEventListener("touchmove",o.touchmove),this.el.addEventListener("touchend",o.touchend)),t.stopPropagation(),t.preventDefault()},t.prototype._mouseMove=function(t){var e=this.mouseDownEvent;this.moving?this._triggerEvent("move",t):Math.abs(t.x-e.x)+Math.abs(t.y-e.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",t),document.addEventListener("keydown",this._keyEvent)),t.stopPropagation()},t.prototype._mouseUp=function(t){this.moving&&(this._triggerEvent("stop",t),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),o.isTouch&&(this.el.removeEventListener("touchmove",o.touchmove),this.el.removeEventListener("touchend",o.touchend)),delete this.moving,delete this.mouseDownEvent,t.stopPropagation(),t.preventDefault()},t.prototype._keyEvent=function(t){var e,i;"Escape"===t.key&&(null===(i=null===(e=this.host.gridstackNode)||void 0===e?void 0:e.grid)||void 0===i||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))},t.prototype._triggerEvent=function(t,e){return this.option[t]&&this.option[t](e),this},t.prefix="ui-resizable-",t}()},585:function(t,e,i){var o,n=this&&this.__extends||(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.DDResizable=void 0;var r=i(784),s=i(174),a=i(116),l=i(727);e.DDResizable=function(t){function e(e,i){void 0===i&&(i={});var o=t.call(this)||this;return o.el=e,o.option=i,o.rectScale={x:1,y:1},o._ui=function(){var t=o.el.parentElement.getBoundingClientRect(),e={width:o.originalRect.width,height:o.originalRect.height+o.scrolled,left:o.originalRect.left,top:o.originalRect.top-o.scrolled},i=o.temporalRect||e;return{position:{left:(i.left-t.left)*o.rectScale.x,top:(i.top-t.top)*o.rectScale.y},size:{width:i.width*o.rectScale.x,height:i.height*o.rectScale.y}}},o._mouseOver=o._mouseOver.bind(o),o._mouseOut=o._mouseOut.bind(o),o.enable(),o._setupAutoHide(o.option.autoHide),o._setupHandlers(),o}return n(e,t),e.prototype.on=function(e,i){t.prototype.on.call(this,e,i)},e.prototype.off=function(e){t.prototype.off.call(this,e)},e.prototype.enable=function(){t.prototype.enable.call(this),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)},e.prototype.disable=function(){t.prototype.disable.call(this),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)},e.prototype.destroy=function(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,t.prototype.destroy.call(this)},e.prototype.updateOption=function(t){var e=this,i=t.handles&&t.handles!==this.option.handles,o=t.autoHide&&t.autoHide!==this.option.autoHide;return Object.keys(t).forEach((function(i){return e.option[i]=t[i]})),i&&(this._removeHandlers(),this._setupHandlers()),o&&this._setupAutoHide(this.option.autoHide),this},e.prototype._setupAutoHide=function(t){return t?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),l.DDManager.overResizeElement===this&&delete l.DDManager.overResizeElement),this},e.prototype._mouseOver=function(t){l.DDManager.overResizeElement||l.DDManager.dragElement||(l.DDManager.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))},e.prototype._mouseOut=function(t){l.DDManager.overResizeElement===this&&(delete l.DDManager.overResizeElement,this.el.classList.add("ui-resizable-autohide"))},e.prototype._setupHandlers=function(){var t=this;return this.handlers=this.option.handles.split(",").map((function(t){return t.trim()})).map((function(e){return new r.DDResizableHandle(t.el,e,{start:function(e){t._resizeStart(e)},stop:function(e){t._resizeStop(e)},move:function(i){t._resizing(i,e)}})})),this},e.prototype._resizeStart=function(t){this.sizeToContent=a.Utils.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=a.Utils.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=t,this._setupHelper(),this._applyChange();var e=a.Utils.initEvent(t,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(e,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",e),this},e.prototype._resizing=function(t,e){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(t,e),this._applyChange();var i=a.Utils.initEvent(t,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this},e.prototype._resizeStop=function(t){var e=a.Utils.initEvent(t,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(e),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",e),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this},e.prototype._setupHelper=function(){var t=this;this.elOriginStyleVal=e._originStyleProp.map((function(e){return t.el.style[e]})),this.parentOriginStylePosition=this.el.parentElement.style.position;var i=this.el.parentElement,o=a.Utils.getValuesFromTransformedElement(i);return this.rectScale={x:o.xScale,y:o.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this},e.prototype._cleanHelper=function(){var t=this;return e._originStyleProp.forEach((function(e,i){t.el.style[e]=t.elOriginStyleVal[i]||null})),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this},e.prototype._getChange=function(t,e){var i,o,n=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},s=t.clientX-n.clientX,a=this.sizeToContent?0:t.clientY-n.clientY;e.indexOf("e")>-1?r.width+=s:e.indexOf("w")>-1&&(r.width-=s,r.left+=s,i=!0),e.indexOf("s")>-1?r.height+=a:e.indexOf("n")>-1&&(r.height-=a,r.top+=a,o=!0);var l=this._constrainSize(r.width,r.height,i,o);return Math.round(r.width)!==Math.round(l.width)&&(e.indexOf("w")>-1&&(r.left+=r.width-l.width),r.width=l.width),Math.round(r.height)!==Math.round(l.height)&&(e.indexOf("n")>-1&&(r.top+=r.height-l.height),r.height=l.height),r},e.prototype._constrainSize=function(t,e,i,o){var n=this.option,r=(i?n.maxWidthMoveLeft:n.maxWidth)||Number.MAX_SAFE_INTEGER,s=n.minWidth/this.rectScale.x||t,a=(o?n.maxHeightMoveUp:n.maxHeight)||Number.MAX_SAFE_INTEGER,l=n.minHeight/this.rectScale.y||e;return{width:Math.min(r,Math.max(s,t)),height:Math.min(a,Math.max(l,e))}},e.prototype._applyChange=function(){var t,e=this,i={left:0,top:0,width:0,height:0};if("absolute"===this.el.style.position){var o=(t=this.el.parentElement.getBoundingClientRect()).left,n=t.top;i={left:o,top:n,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach((function(t){var o=e.temporalRect[t],n="width"===t||"left"===t?e.rectScale.x:"height"===t||"top"===t?e.rectScale.y:1;e.el.style[t]=(o-i[t])*n+"px"})),this):this},e.prototype._removeHandlers=function(){return this.handlers.forEach((function(t){return t.destroy()})),delete this.handlers,this},e._originStyleProp=["width","height","position","left","top","opacity","zIndex"],e}(s.DDBaseImplement)},135:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.pointerleave=e.pointerenter=e.pointerdown=e.touchend=e.touchmove=e.touchstart=e.isTouch=void 0;var o=i(727),n=i(116);e.isTouch="undefined"!=typeof window&&"undefined"!=typeof document&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);var r=function(){};function s(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),n.Utils.simulateMouseEvent(t.changedTouches[0],e))}function a(t,e){t.cancelable&&t.preventDefault(),n.Utils.simulateMouseEvent(t,e)}e.touchstart=function(t){r.touchHandled||(r.touchHandled=!0,s(t,"mousedown"))},e.touchmove=function(t){r.touchHandled&&s(t,"mousemove")},e.touchend=function(t){if(r.touchHandled){r.pointerLeaveTimeout&&(window.clearTimeout(r.pointerLeaveTimeout),delete r.pointerLeaveTimeout);var e=!!o.DDManager.dragElement;s(t,"mouseup"),e||s(t,"click"),r.touchHandled=!1}},e.pointerdown=function(t){"mouse"!==t.pointerType&&t.target.releasePointerCapture(t.pointerId)},e.pointerenter=function(t){o.DDManager.dragElement&&"mouse"!==t.pointerType&&a(t,"mouseenter")},e.pointerleave=function(t){o.DDManager.dragElement&&"mouse"!==t.pointerType&&(r.pointerLeaveTimeout=window.setTimeout((function(){delete r.pointerLeaveTimeout,a(t,"mouseleave")}),10))}},472:function(t,e,i){var o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},o.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.GridStackEngine=void 0;var n=i(116);e.GridStackEngine=function(){function t(t){void 0===t&&(t={}),this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=t.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}return t.prototype.batchUpdate=function(t,e){return void 0===t&&(t=!0),void 0===e&&(e=!0),!!this.batchMode===t||(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,e&&this._packNodes(),this._notify())),this},t.prototype._useEntireRowArea=function(t,e){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!t._moving||t._skipDown||e.y<=t.y)},t.prototype._fixCollisions=function(t,e,i,r){if(void 0===e&&(e=t),void 0===r&&(r={}),this.sortNodes(-1),!(i=i||this.collide(t,e)))return!1;if(t._moving&&!r.nested&&!this.float&&this.swap(t,i))return!0;var s=e;!this._loading&&this._useEntireRowArea(t,e)&&(s={x:0,w:this.column,y:e.y,h:e.h},i=this.collide(t,s,r.skip));for(var a=!1,l={nested:!0,pack:!1},d=0;i=i||this.collide(t,s,r.skip);){if(d++>2*this.nodes.length)throw new Error("Infinite collide check");var h=void 0;if(i.locked||this._loading||t._moving&&!t._skipDown&&e.y>t.y&&!this.float&&(!this.collide(i,o(o({},i),{y:t.y}),t)||!this.collide(i,o(o({},i),{y:e.y-i.h}),t))){t._skipDown=t._skipDown||e.y>t.y;var u=o(o(o({},e),{y:i.y+i.h}),l);h=!(!this._loading||!n.Utils.samePos(t,u))||this.moveNode(t,u),(i.locked||this._loading)&&h?n.Utils.copyPos(e,t):!i.locked&&h&&r.pack&&(this._packNodes(),e.y=i.y+i.h,n.Utils.copyPos(t,e)),a=a||h}else h=this.moveNode(i,o(o(o({},i),{y:e.y+e.h,skip:t}),l));if(!h)return a;i=void 0}return a},t.prototype.collide=function(t,e,i){void 0===e&&(e=t);var o=t._id,r=null==i?void 0:i._id;return this.nodes.find((function(t){return t._id!==o&&t._id!==r&&n.Utils.isIntercepted(t,e)}))},t.prototype.collideAll=function(t,e,i){void 0===e&&(e=t);var o=t._id,r=null==i?void 0:i._id;return this.nodes.filter((function(t){return t._id!==o&&t._id!==r&&n.Utils.isIntercepted(t,e)}))},t.prototype.directionCollideCoverage=function(t,e,i){if(e.rect&&t._rect){var n,r=t._rect,s=o({},e.rect);s.y>r.y?(s.h+=s.y-r.y,s.y=r.y):s.h+=r.y-s.y,s.x>r.x?(s.w+=s.x-r.x,s.x=r.x):s.w+=r.x-s.x;for(var a=.5,l=0,d=i;l<d.length;l++){var h=d[l];if(h.locked||!h._rect)break;var u=h._rect,c=Number.MAX_VALUE,p=Number.MAX_VALUE;r.y<u.y?c=(s.y+s.h-u.y)/u.h:r.y+r.h>u.y+u.h&&(c=(u.y+u.h-s.y)/u.h),r.x<u.x?p=(s.x+s.w-u.x)/u.w:r.x+r.w>u.x+u.w&&(p=(u.x+u.w-s.x)/u.w);var g=Math.min(p,c);g>a&&(a=g,n=h)}return e.collide=n,n}},t.prototype.cacheRects=function(t,e,i,o,n,r){return this.nodes.forEach((function(s){return s._rect={y:s.y*e+i,x:s.x*t+r,w:s.w*t-r-o,h:s.h*e-i-n}})),this},t.prototype.swap=function(t,e){if(!e||e.locked||!t||t.locked)return!1;function i(){var i=e.x,o=e.y;return e.x=t.x,e.y=t.y,t.h!=e.h?(t.x=i,t.y=e.y+e.h):t.w!=e.w?(t.x=e.x+e.w,t.y=o):(t.x=i,t.y=o),t._dirty=e._dirty=!0,!0}var o;if(t.w===e.w&&t.h===e.h&&(t.x===e.x||t.y===e.y)&&(o=n.Utils.isTouching(t,e)))return i();if(!1!==o){if(t.w===e.w&&t.x===e.x&&(o||(o=n.Utils.isTouching(t,e)))){if(e.y<t.y){var r=t;t=e,e=r}return i()}if(!1!==o)return!(t.h!==e.h||t.y!==e.y||!o&&!(o=n.Utils.isTouching(t,e)))&&(e.x<t.x&&(r=t,t=e,e=r),i())}},t.prototype.isAreaEmpty=function(t,e,i,o){var n={x:t||0,y:e||0,w:i||1,h:o||1};return!this.collide(n)},t.prototype.compact=function(t,e){var i=this;if(void 0===t&&(t="compact"),void 0===e&&(e=!0),0===this.nodes.length)return this;e&&this.sortNodes();var o=this.batchMode;o||this.batchUpdate();var n=this._inColumnResize;n||(this._inColumnResize=!0);var r=this.nodes;return this.nodes=[],r.forEach((function(e,o,n){var r;e.locked||(e.autoPosition=!0,"list"===t&&o&&(r=n[o-1])),i.addNode(e,!1,r)})),n||delete this._inColumnResize,o||this.batchUpdate(!1),this},Object.defineProperty(t.prototype,"float",{get:function(){return this._float||!1},set:function(t){this._float!==t&&(this._float=t||!1,t||this._packNodes()._notify())},enumerable:!1,configurable:!0}),t.prototype.sortNodes=function(t){return void 0===t&&(t=1),this.nodes=n.Utils.sort(this.nodes,t),this},t.prototype._packNodes=function(){var t=this;return this.batchMode||(this.sortNodes(),this.float?this.nodes.forEach((function(e){if(!e._updating&&void 0!==e._orig&&e.y!==e._orig.y)for(var i=e.y;i>e._orig.y;)--i,t.collide(e,{x:e.x,y:i,w:e.w,h:e.h})||(e._dirty=!0,e.y=i)})):this.nodes.forEach((function(e,i){if(!e.locked)for(;e.y>0;){var o=0===i?0:e.y-1;if(0!==i&&t.collide(e,{x:e.x,y:o,w:e.w,h:e.h}))break;e._dirty=e.y!==o,e.y=o}}))),this},t.prototype.prepareNode=function(e,i){var o;e._id=null!==(o=e._id)&&void 0!==o?o:t._idSeq++;var r=e.id;if(r)for(var s=1;this.nodes.find((function(t){return t.id===e.id&&t!==e}));)e.id=r+"_"+s++;void 0!==e.x&&void 0!==e.y&&null!==e.x&&null!==e.y||(e.autoPosition=!0);var a={x:0,y:0,w:1,h:1};return n.Utils.defaults(e,a),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,n.Utils.sanitizeMinMax(e),"string"==typeof e.x&&(e.x=Number(e.x)),"string"==typeof e.y&&(e.y=Number(e.y)),"string"==typeof e.w&&(e.w=Number(e.w)),"string"==typeof e.h&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=a.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=a.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=a.w),isNaN(e.h)&&(e.h=a.h),this.nodeBoundFix(e,i),e},t.prototype.nodeBoundFix=function(t,e){var i=t._orig||n.Utils.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w||1,t.maxW)),t.maxH&&(t.h=Math.min(t.h||1,t.maxH)),t.minW&&(t.w=Math.max(t.w||1,t.minW)),t.minH&&(t.h=Math.max(t.h||1,t.minH)),(t.x||0)+(t.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&t._id&&-1===this.findCacheLayout(t,this.defaultColumn)){var r=o({},t);r.autoPosition||void 0===r.x?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,this.defaultColumn)}return t.w>this.column?t.w=this.column:t.w<1&&(t.w=1),this.maxRow&&t.h>this.maxRow?t.h=this.maxRow:t.h<1&&(t.h=1),t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.w>this.column&&(e?t.w=this.column-t.x:t.x=this.column-t.w),this.maxRow&&t.y+t.h>this.maxRow&&(e?t.h=this.maxRow-t.y:t.y=this.maxRow-t.h),n.Utils.samePos(t,i)||(t._dirty=!0),this},t.prototype.getDirtyNodes=function(t){return t?this.nodes.filter((function(t){return t._dirty&&!n.Utils.samePos(t,t._orig)})):this.nodes.filter((function(t){return t._dirty}))},t.prototype._notify=function(t){if(this.batchMode||!this.onChange)return this;var e=(t||[]).concat(this.getDirtyNodes());return this.onChange(e),this},t.prototype.cleanNodes=function(){return this.batchMode||this.nodes.forEach((function(t){delete t._dirty,delete t._lastTried})),this},t.prototype.saveInitial=function(){return this.nodes.forEach((function(t){t._orig=n.Utils.copyPos({},t),delete t._dirty})),this._hasLocked=this.nodes.some((function(t){return t.locked})),this},t.prototype.restoreInitial=function(){return this.nodes.forEach((function(t){t._orig&&!n.Utils.samePos(t,t._orig)&&(n.Utils.copyPos(t,t._orig),t._dirty=!0)})),this._notify(),this},t.prototype.findEmptyPosition=function(t,e,i,o){void 0===e&&(e=this.nodes),void 0===i&&(i=this.column);for(var r=o?o.y*i+(o.x+o.w):0,s=!1,a=function(o){var r=o%i,a=Math.floor(o/i);if(r+t.w>i)return"continue";var l={x:r,y:a,w:t.w,h:t.h};e.find((function(t){return n.Utils.isIntercepted(l,t)}))||(t.x===r&&t.y===a||(t._dirty=!0),t.x=r,t.y=a,delete t.autoPosition,s=!0)},l=r;!s;++l)a(l);return s},t.prototype.addNode=function(t,e,i){var o;return void 0===e&&(e=!1),this.nodes.find((function(e){return e._id===t._id}))||(this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t),delete t._temporaryRemoved,delete t._removeDOM,t.autoPosition&&this.findEmptyPosition(t,this.nodes,this.column,i)&&(delete t.autoPosition,o=!0),this.nodes.push(t),e&&this.addedNodes.push(t),o||this._fixCollisions(t),this.batchMode||this._packNodes()._notify(),t)},t.prototype.removeNode=function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!1),this.nodes.find((function(e){return e._id===t._id}))?(i&&this.removedNodes.push(t),e&&(t._removeDOM=!0),this.nodes=this.nodes.filter((function(e){return e._id!==t._id})),t._isAboutToRemove||this._packNodes(),this._notify([t]),this):this},t.prototype.removeAll=function(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!0),delete this._layouts,!this.nodes.length)return this;t&&this.nodes.forEach((function(t){return t._removeDOM=!0}));var i=this.nodes;return this.removedNodes=e?i:[],this.nodes=[],this._notify(i)},t.prototype.moveNodeCheck=function(e,i){var r,s=this;if(!this.changedPosConstrain(e,i))return!1;if(i.pack=!0,!this.maxRow)return this.moveNode(e,i);var a=new t({column:this.column,float:this.float,nodes:this.nodes.map((function(t){return t._id===e._id?r=o({},t):o({},t)}))});if(!r)return!1;var l=a.moveNode(r,i)&&a.getRow()<=Math.max(this.getRow(),this.maxRow);if(!l&&!i.resizing&&i.collide){var d=i.collide.el.gridstackNode;if(this.swap(e,d))return this._notify(),!0}return!!l&&(a.nodes.filter((function(t){return t._dirty})).forEach((function(t){var e=s.nodes.find((function(e){return e._id===t._id}));e&&(n.Utils.copyPos(e,t),e._dirty=!0)})),this._notify(),!0)},t.prototype.willItFit=function(e){if(delete e._willFitPos,!this.maxRow)return!0;var i=new t({column:this.column,float:this.float,nodes:this.nodes.map((function(t){return o({},t)}))}),r=o({},e);return this.cleanupNode(r),delete r.el,delete r._id,delete r.content,delete r.grid,i.addNode(r),i.getRow()<=this.maxRow&&(e._willFitPos=n.Utils.copyPos({},r),!0)},t.prototype.changedPosConstrain=function(t,e){return e.w=e.w||t.w,e.h=e.h||t.h,t.x!==e.x||t.y!==e.y||(t.maxW&&(e.w=Math.min(e.w,t.maxW)),t.maxH&&(e.h=Math.min(e.h,t.maxH)),t.minW&&(e.w=Math.max(e.w,t.minW)),t.minH&&(e.h=Math.max(e.h,t.minH)),t.w!==e.w||t.h!==e.h)},t.prototype.moveNode=function(t,e){var i,o,r;if(!t||!e)return!1;void 0!==e.pack||this.batchMode||(r=e.pack=!0),"number"!=typeof e.x&&(e.x=t.x),"number"!=typeof e.y&&(e.y=t.y),"number"!=typeof e.w&&(e.w=t.w),"number"!=typeof e.h&&(e.h=t.h);var s=t.w!==e.w||t.h!==e.h,a=n.Utils.copyPos({},t,!0);if(n.Utils.copyPos(a,e),this.nodeBoundFix(a,s),n.Utils.copyPos(e,a),!e.forceCollide&&n.Utils.samePos(t,e))return!1;var l=n.Utils.copyPos({},t),d=this.collideAll(t,a,e.skip),h=!0;if(d.length){var u=t._moving&&!e.nested,c=u?this.directionCollideCoverage(t,e,d):d[0];if(u&&c&&(null===(o=null===(i=t.grid)||void 0===i?void 0:i.opts)||void 0===o?void 0:o.subGridDynamic)&&!t.grid._isTemp){var p=n.Utils.areaIntercept(e.rect,c._rect),g=n.Utils.area(e.rect),v=n.Utils.area(c._rect);p/(g<v?g:v)>.8&&(c.grid.makeSubGrid(c.el,void 0,t),c=void 0)}c?h=!this._fixCollisions(t,a,c,e):(h=!1,r&&delete e.pack)}return h&&!n.Utils.samePos(t,a)&&(t._dirty=!0,n.Utils.copyPos(t,a)),e.pack&&this._packNodes()._notify(),!n.Utils.samePos(t,l)},t.prototype.getRow=function(){return this.nodes.reduce((function(t,e){return Math.max(t,e.y+e.h)}),0)},t.prototype.beginUpdate=function(t){return t._updating||(t._updating=!0,delete t._skipDown,this.batchMode||this.saveInitial()),this},t.prototype.endUpdate=function(){var t=this.nodes.find((function(t){return t._updating}));return t&&(delete t._updating,delete t._skipDown),this},t.prototype.save=function(t,e){var i;void 0===t&&(t=!0);var r=null===(i=this._layouts)||void 0===i?void 0:i.length,s=r&&this.column!==r-1?this._layouts[r-1]:null,a=[];return this.sortNodes(),this.nodes.forEach((function(i){var r=null==s?void 0:s.find((function(t){return t._id===i._id})),l=o(o({},i),r||{});n.Utils.removeInternalForSave(l,!t),e&&e(i,l),a.push(l)})),a},t.prototype.layoutsNodesChange=function(t){var e=this;return!this._layouts||this._inColumnResize||this._layouts.forEach((function(i,o){if(!i||o===e.column)return e;if(o<e.column)e._layouts[o]=void 0;else{var n=o/e.column;t.forEach((function(t){if(t._orig){var e=i.find((function(e){return e._id===t._id}));e&&(e.y>=0&&t.y!==t._orig.y&&(e.y+=t.y-t._orig.y),t.x!==t._orig.x&&(e.x=Math.round(t.x*n)),t.w!==t._orig.w&&(e.w=Math.round(t.w*n)))}}))}})),this},t.prototype.columnChanged=function(t,e,i){var o,r=this;if(void 0===i&&(i="moveScale"),!this.nodes.length||!e||t===e)return this;var s="compact"===i||"list"===i;s&&this.sortNodes(1),e<t&&this.cacheLayout(this.nodes,t),this.batchUpdate();var a=[],l=s?this.nodes:n.Utils.sort(this.nodes,-1);if(e>t&&this._layouts){var d=this._layouts[e]||[],h=this._layouts.length-1;!d.length&&t!==h&&(null===(o=this._layouts[h])||void 0===o?void 0:o.length)&&(t=h,this._layouts[h].forEach((function(t){var e,i,o,n=l.find((function(e){return e._id===t._id}));n&&(s||t.autoPosition||(n.x=null!==(e=t.x)&&void 0!==e?e:n.x,n.y=null!==(i=t.y)&&void 0!==i?i:n.y),n.w=null!==(o=t.w)&&void 0!==o?o:n.w,null!=t.x&&void 0!==t.y||(n.autoPosition=!0))}))),d.forEach((function(t){var e,i,o,n=l.findIndex((function(e){return e._id===t._id}));if(-1!==n){var d=l[n];if(s)return void(d.w=t.w);(t.autoPosition||isNaN(t.x)||isNaN(t.y))&&r.findEmptyPosition(t,a),t.autoPosition||(d.x=null!==(e=t.x)&&void 0!==e?e:d.x,d.y=null!==(i=t.y)&&void 0!==i?i:d.y,d.w=null!==(o=t.w)&&void 0!==o?o:d.w,a.push(d)),l.splice(n,1)}}))}if(s)this.compact(i,!1);else{if(l.length)if("function"==typeof i)i(e,t,a,l);else{var u=s||"none"===i?1:e/t,c="move"===i||"moveScale"===i,p="scale"===i||"moveScale"===i;l.forEach((function(i){i.x=1===e?0:c?Math.round(i.x*u):Math.min(i.x,e-1),i.w=1===e||1===t?1:p?Math.round(i.w*u)||1:Math.min(i.w,e),a.push(i)})),l=[]}a=n.Utils.sort(a,-1),this._inColumnResize=!0,this.nodes=[],a.forEach((function(t){r.addNode(t,!1),delete t._orig}))}return this.nodes.forEach((function(t){return delete t._orig})),this.batchUpdate(!1,!s),delete this._inColumnResize,this},t.prototype.cacheLayout=function(e,i,o){var n=this;void 0===o&&(o=!1);var r=[];return e.forEach((function(e,i){var o;if(void 0===e._id){var s=e.id?n.nodes.find((function(t){return t.id===e.id})):void 0;e._id=null!==(o=null==s?void 0:s._id)&&void 0!==o?o:t._idSeq++}r[i]={x:e.x,y:e.y,w:e.w,_id:e._id}})),this._layouts=o?[]:this._layouts||[],this._layouts[i]=r,this},t.prototype.cacheOneLayout=function(e,i){var o;e._id=null!==(o=e._id)&&void 0!==o?o:t._idSeq++;var n={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||void 0===e.x)&&(delete n.x,delete n.y,e.autoPosition&&(n.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[i]=this._layouts[i]||[];var r=this.findCacheLayout(e,i);return-1===r?this._layouts[i].push(n):this._layouts[i][r]=n,this},t.prototype.findCacheLayout=function(t,e){var i,o,n;return null!==(n=null===(o=null===(i=this._layouts)||void 0===i?void 0:i[e])||void 0===o?void 0:o.findIndex((function(e){return e._id===t._id})))&&void 0!==n?n:-1},t.prototype.removeNodeFromLayoutCache=function(t){if(this._layouts)for(var e=0;e<this._layouts.length;e++){var i=this.findCacheLayout(t,e);-1!==i&&this._layouts[e].splice(i,1)}},t.prototype.cleanupNode=function(t){for(var e in t)"_"===e[0]&&"_id"!==e&&delete t[e];return this},t._idSeq=0,t}()},593:function(t,e,i){var o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},o.apply(this,arguments)},n=this&&this.__createBinding||(Object.create?function(t,e,i,o){void 0===o&&(o=i);var n=Object.getOwnPropertyDescriptor(e,i);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,o,n)}:function(t,e,i,o){void 0===o&&(o=i),t[o]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},s=this&&this.__spreadArray||function(t,e,i){if(i||2===arguments.length)for(var o,n=0,r=e.length;n<r;n++)!o&&n in e||(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.GridStack=void 0;var a=i(472),l=i(116),d=i(696),h=i(735),u=i(135),c=i(727),p=new h.DDGridStack;r(i(696),e),r(i(116),e),r(i(472),e),r(i(735),e),e.GridStack=function(){function t(e,i){void 0===i&&(i={});var n,r,s,h=this;this.el=e,this.opts=i,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=i=i||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),i.row&&(i.minRow=i.maxRow=i.row,delete i.row);var p=l.Utils.toNumber(e.getAttribute("gs-row"));"auto"===i.column&&delete i.column,void 0!==i.alwaysShowResizeHandle&&(i._alwaysShowResizeHandle=i.alwaysShowResizeHandle);var g=null===(n=i.columnOpts)||void 0===n?void 0:n.breakpoints,v=i;if(v.oneColumnModeDomSort&&(delete v.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),v.oneColumnSize||!1===v.disableOneColumnMode){var f=v.oneColumnSize||768;delete v.oneColumnSize,delete v.disableOneColumnMode,i.columnOpts=i.columnOpts||{};var m=(g=i.columnOpts.breakpoints=i.columnOpts.breakpoints||[]).find((function(t){return 1===t.c}));m?m.w=f:(m={c:1,w:f},g.push(m,{c:12,w:f+1}))}var y=i.columnOpts;y&&(y.columnWidth||(null===(r=y.breakpoints)||void 0===r?void 0:r.length)?y.columnMax=y.columnMax||12:(delete i.columnOpts,g=void 0)),(null==g?void 0:g.length)>1&&g.sort((function(t,e){return(e.w||0)-(t.w||0)}));var _=o(o({},l.Utils.cloneDeep(d.gridDefaults)),{column:l.Utils.toNumber(e.getAttribute("gs-column"))||d.gridDefaults.column,minRow:p||l.Utils.toNumber(e.getAttribute("gs-min-row"))||d.gridDefaults.minRow,maxRow:p||l.Utils.toNumber(e.getAttribute("gs-max-row"))||d.gridDefaults.maxRow,staticGrid:l.Utils.toBool(e.getAttribute("gs-static"))||d.gridDefaults.staticGrid,sizeToContent:l.Utils.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(i.handleClass?"."+i.handleClass:i.handle?i.handle:"")||d.gridDefaults.draggable.handle},removableOptions:{accept:i.itemClass||d.gridDefaults.removableOptions.accept,decline:d.gridDefaults.removableOptions.decline}});e.getAttribute("gs-animate")&&(_.animate=l.Utils.toBool(e.getAttribute("gs-animate"))),i=l.Utils.defaults(i,_),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(i),"auto"===i.rtl&&(i.rtl="rtl"===e.style.direction),i.rtl&&this.el.classList.add("grid-stack-rtl");var b=this.el.closest("."+d.gridDefaults.itemClass),w=null==b?void 0:b.gridstackNode;if(w&&(w.subGrid=this,this.parentGridNode=w,this.el.classList.add("grid-stack-nested"),w.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight="auto"===i.cellHeight,this._isAutoCellHeight||"initial"===i.cellHeight)this.cellHeight(void 0);else{"number"==typeof i.cellHeight&&i.cellHeightUnit&&i.cellHeightUnit!==d.gridDefaults.cellHeightUnit&&(i.cellHeight=i.cellHeight+i.cellHeightUnit,delete i.cellHeightUnit);var E=i.cellHeight;delete i.cellHeight,this.cellHeight(E)}"mobile"===i.alwaysShowResizeHandle&&(i.alwaysShowResizeHandle=u.isTouch),this._setStaticClass();var D=i.engineClass||t.engineClass||a.GridStackEngine;if(this.engine=new D({column:this.getColumn(),float:i.float,maxRow:i.maxRow,onChange:function(t){t.forEach((function(t){var e=t.el;e&&(t._removeDOM?(e&&e.remove(),delete t._removeDOM):h._writePosAttr(e,t))})),h._updateContainerHeight()}}),i.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach((function(t){return h._prepareElement(t)})),delete this.engine._loading,this.batchUpdate(!1)),i.children){var x=i.children;delete i.children,x.length&&this.load(x)}this.setAnimation(),i.subGridDynamic&&!c.DDManager.pauseDrag&&(c.DDManager.pauseDrag=!0),void 0!==(null===(s=i.draggable)||void 0===s?void 0:s.pause)&&(c.DDManager.pauseDrag=i.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResiz