UNPKG

fily-publish-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 86.4 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={74: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},366: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)e.hasOwnProperty(i)&&(t[i]=e[i])},o(t,e)},function(t,e){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.DDDraggable=void 0;var r=i(839),s=i(867),a=i(74),l=i(537),d=function(t){function e(e,i){void 0===i&&(i={});var o=t.call(this)||this;o.el=e,o.option=i;var n=i.handle.substring(1);return o.dragEl=e.classList.contains(n)?e:e.querySelector(i.handle)||e,o._mouseDown=o._mouseDown.bind(o),o._mouseMove=o._mouseMove.bind(o),o._mouseUp=o._mouseUp.bind(o),o.enable(),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.dragEl.addEventListener("mousedown",this._mouseDown),l.isTouch&&(this.dragEl.addEventListener("touchstart",l.touchstart),this.dragEl.addEventListener("pointerdown",l.pointerdown)),this.el.classList.remove("ui-draggable-disabled"),this.el.classList.add("ui-draggable"))},e.prototype.disable=function(e){void 0===e&&(e=!1),!0!==this.disabled&&(t.prototype.disable.call(this),this.dragEl.removeEventListener("mousedown",this._mouseDown),l.isTouch&&(this.dragEl.removeEventListener("touchstart",l.touchstart),this.dragEl.removeEventListener("pointerdown",l.pointerdown)),this.el.classList.remove("ui-draggable"),e||this.el.classList.add("ui-draggable-disabled"))},e.prototype.destroy=function(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.dragging&&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(!r.DDManager.mouseHandled){if(0!==t.button)return!0;var e=t.target.nodeName.toLowerCase();return["input","textarea","button","select","option"].find((function(t){return t===e}))||(this.mouseDownEvent=t,delete this.dragging,delete r.DDManager.dragElement,delete r.DDManager.dropElement,document.addEventListener("mousemove",this._mouseMove,!0),document.addEventListener("mouseup",this._mouseUp,!0),l.isTouch&&(this.dragEl.addEventListener("touchmove",l.touchmove),this.dragEl.addEventListener("touchend",l.touchend)),t.preventDefault(),r.DDManager.mouseHandled=!0),!0}},e.prototype._callDrag=function(t){if(this.dragging){var e=s.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.dragging)if(this._dragFollow(t),r.DDManager.pauseDrag){var n=Number.isInteger(r.DDManager.pauseDrag)?r.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,r.DDManager.dragElement=this;var a=null===(e=this.el.gridstackNode)||void 0===e?void 0:e.grid;a?r.DDManager.dropElement=a.el.ddElement.ddDroppable:delete r.DDManager.dropElement,this.helper=this._createHelper(t),this._setupHelperContainmentStyle(),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment);var l=s.Utils.initEvent(t,{target:this.el,type:"dragstart"});this._setupHelperStyle(t),this.option.start&&this.option.start(l,this.ui()),this.triggerEvent("dragstart",l)}return t.preventDefault(),!0},e.prototype._mouseUp=function(t){var e;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),l.isTouch&&(this.dragEl.removeEventListener("touchmove",l.touchmove,!0),this.dragEl.removeEventListener("touchend",l.touchend,!0)),this.dragging){delete this.dragging,(null===(e=r.DDManager.dropElement)||void 0===e?void 0:e.el)===this.el.parentElement&&delete r.DDManager.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper===this.el?this._removeHelperStyle():this.helper.remove();var i=s.Utils.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(i),this.triggerEvent("dragstop",i),r.DDManager.dropElement&&r.DDManager.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete r.DDManager.dragElement,delete r.DDManager.dropElement,delete r.DDManager.mouseHandled,t.preventDefault()},e.prototype._createHelper=function(t){var i=this,o=this.el;return"function"==typeof this.option.helper?o=this.option.helper(t):"clone"===this.option.helper&&(o=s.Utils.cloneNode(this.el)),document.body.contains(o)||s.Utils.appendTo(o,"parent"===this.option.appendTo?this.el.parentNode:this.option.appendTo),o===this.el&&(this.dragElementOriginStyle=e.originStyleProp.map((function(t){return i.el.style[t]}))),o},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["min-width"]=0,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(this.dragElementOriginStyle&&(!o||!o._isAboutToRemove)){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+"px",e.top=t.clientY+i.offsetTop-0+"px"},e.prototype._setupHelperContainmentStyle=function(){return this.helperContainment=this.helper.parentElement,"fixed"!==this.helper.style.position&&(this.parentOriginStylePosition=this.helperContainment.style.position,window.getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this},e.prototype._getDragOffset=function(t,e,i){var o=0,n=0;if(i){var r=document.createElement("div");s.Utils.addElStyles(r,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),i.appendChild(r);var a=r.getBoundingClientRect();i.removeChild(r),o=a.left,n=a.top}var l=e.getBoundingClientRect();return{left:l.left,top:l.top,offsetLeft:-t.clientX+l.left-o,offsetTop:-t.clientY+l.top-n,width:l.width,height:l.height}},e.prototype.ui=function(){var t=this.el.parentElement.getBoundingClientRect(),e=this.helper.getBoundingClientRect();return{position:{top:e.top-t.top,left:e.left-t.left}}},e.originStyleProp=["transition","pointerEvents","position","left","top"],e}(a.DDBaseImplement);e.DDDraggable=d},677: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)e.hasOwnProperty(i)&&(t[i]=e[i])},o(t,e)},function(t,e){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(839),a=i(74),l=i(867),d=i(537),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),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){var e;if(s.DDManager.dragElement&&s.DDManager.dropElement===this){t.preventDefault(),t.stopPropagation();var i=l.Utils.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(s.DDManager.dragElement)),this.triggerEvent("dropout",i),s.DDManager.dropElement===this){delete s.DDManager.dropElement;for(var o=void 0,n=this.el.parentElement;!o&&n;)o=null===(e=n.ddElement)||void 0===e?void 0:e.ddDroppable,n=n.parentElement;o&&o._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.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},259:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.DDElement=void 0;var o=i(904),n=i(366),r=i(677),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},502: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(855),r=i(324),s=i(867),a=i(839),l=i(259),d=function(){function t(){}return t.get=function(){return h},t.prototype.resizable=function(t,e,i,n){return this._getDDElements(t).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")?t.el.getAttribute("gs-resize-handles"):s.opts.resizable.handles,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).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).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){return!(!(t&&t.ddElement&&t.ddElement.ddDroppable)||t.ddElement.ddDroppable.disabled)},t.prototype.isDraggable=function(t){return!(!(t&&t.ddElement&&t.ddElement.ddDraggable)||t.ddElement.ddDraggable.disabled)},t.prototype.isResizable=function(t){return!(!(t&&t.ddElement&&t.ddElement.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,a.DDManager.dragElement?a.DDManager.dragElement.el:t.target,a.DDManager.dragElement?a.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){void 0===e&&(e=!0);var i=s.Utils.getElements(t);if(!i.length)return[];var o=i.map((function(t){return t.ddElement||(e?l.DDElement.init(t):null)}));return e||o.filter((function(t){return t})),o},t}();e.DDGridStack=d;var h=new d;function u(t,e){var i=t?t.gridstackNode:void 0;i&&i.grid&&(e?i._isAboutToRemove=!0:delete i._isAboutToRemove,e?t.classList.add("grid-stack-item-removing"):t.classList.remove("grid-stack-item-removing"))}r.GridStack.prototype._setupAcceptWidget=function(){var t,e,i=this;if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return h.droppable(this.el,"destroy"),this;var n=function(o,n,r){var a=n.gridstackNode;if(a){r=r||n;var l=i.el.getBoundingClientRect(),d=r.getBoundingClientRect(),u=d.top,p=d.left;p-=l.left;var c={position:{top:u-=l.top,left:p}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(p/e)),a.y=Math.max(0,Math.round(u/t)),delete a.autoPosition,i.engine.nodeBoundFix(a),!i.engine.willItFit(a)){if(a.autoPosition=!0,!i.engine.willItFit(a))return void h.off(n,"drag");a._willFitPos&&(s.Utils.copyPos(a,a._willFitPos),delete a._willFitPos)}i._onStartMoving(r,o,c,a,e,t)}else i._dragOrResize(r,o,c,a,e,t)}};return h.droppable(this.el,{accept:function(t){var e=t.gridstackNode;if((null==e?void 0:e.grid)===i)return!0;if(!i.opts.acceptWidgets)return!1;var o=!0;if("function"==typeof i.opts.acceptWidgets)o=i.opts.acceptWidgets(t);else{var n=!0===i.opts.acceptWidgets?".grid-stack-item":i.opts.acceptWidgets;o=t.matches(n)}if(o&&e&&i.opts.maxRow){var r={w:e.w,h:e.h,minW:e.minW,minH:e.minH};o=i.engine.willItFit(r)}return o}}).on(this.el,"dropover",(function(r,s,a){var l=s.gridstackNode;if((null==l?void 0:l.grid)===i&&!l._temporaryRemoved)return!1;(null==l?void 0:l.grid)&&l.grid!==i&&!l._temporaryRemoved&&l.grid._leave(s,a),e=i.cellWidth(),t=i.getCellHeight(!0),l||(l=i._readAttr(s)),l.grid||(l._isExternal=!0,s.gridstackNode=l),a=a||s;var d=l.w||Math.round(a.offsetWidth/e)||1,p=l.h||Math.round(a.offsetHeight/t)||1;return l.grid&&l.grid!==i?(s._gridstackNodeOrig||(s._gridstackNodeOrig=l),s.gridstackNode=l=o(o({},l),{w:d,h:p,grid:i}),i.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=d,l.h=p,l._temporaryRemoved=!0),u(l.el,!1),h.on(s,"drag",n),n(r,s,a),!1})).on(this.el,"dropout",(function(t,e,o){var n=e.gridstackNode;return!!n&&(n.grid&&n.grid!==i||(i._leave(e,o),i._isTemp&&i.removeAsSubGrid(n)),!1)})).on(this.el,"drop",(function(t,e,n){var r,a,l=e.gridstackNode;if((null==l?void 0:l.grid)===i&&!l._isExternal)return!1;var d=!!i.placeholder.parentElement;i.placeholder.remove();var u=e._gridstackNodeOrig;if(delete e._gridstackNodeOrig,d&&(null==u?void 0:u.grid)&&u.grid!==i){var p=u.grid;p.engine.removedNodes.push(u),p._triggerRemoveEvent(),p.parentGridItem&&!p.engine.nodes.length&&p.opts.subGridDynamic&&p.removeAsSubGrid()}if(!l)return!1;if(d&&(i.engine.cleanupNode(l),l.grid=i),h.off(e,"drag"),n!==e?(n.remove(),e.gridstackNode=u,d&&(e=e.cloneNode(!0))):i._removeDD(e),!d)return!1;e.gridstackNode=l,l.el=e;var c=null===(a=null===(r=l.subGrid)||void 0===r?void 0:r.el)||void 0===a?void 0:a.gridstack;return s.Utils.copyPos(l,i._readAttr(i.placeholder)),s.Utils.removePositioningStyles(e),i._writeAttr(e,l),c&&(c.parentGridItem=l,c.opts.styleInHead||c._updateStyles(!0)),i._updateContainerHeight(),i.engine.addedNodes.push(l),i._triggerAddEvent(),i._triggerChangeEvent(),i.engine.endUpdate(),i._gsEventHandler.dropped&&i._gsEventHandler.dropped(o(o({},t),{type:"dropped"}),u&&u.grid?u:void 0,l),window.setTimeout((function(){l.el&&l.el.parentElement?i._prepareDragDropByNode(l):i.engine.removeNode(l),delete l.grid._isTemp})),!1})),this},r.GridStack.prototype._setupRemoveDrop=function(){if(!this.opts.staticGrid&&"string"==typeof this.opts.removable){var t=document.querySelector(this.opts.removable);if(!t)return this;h.isDroppable(t)||h.droppable(t,this.opts.removableOptions).on(t,"dropover",(function(t,e){return u(e,!0)})).on(t,"dropout",(function(t,e){return u(e,!1)}))}return this},r.GridStack.setupDragIn=function(t,e){void 0!==(null==e?void 0:e.pause)&&(a.DDManager.pauseDrag=e.pause),"string"==typeof t&&(e=o(o({},n.dragInDefaultOptions),e||{}),s.Utils.getElements(t).forEach((function(t){h.isDraggable(t)||h.dragIn(t,e)})))},r.GridStack.prototype._prepareDragDropByNode=function(t){var e=this,i=t.el,o=t.noMove||this.opts.disableDrag,n=t.noResize||this.opts.disableResize;if(this.opts.staticGrid||o&&n)return t._initDD&&(this._removeDD(i),delete t._initDD),i.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!t._initDD){var r,a,l=function(o,n){e._gsEventHandler[o.type]&&e._gsEventHandler[o.type](o,o.target),r=e.cellWidth(),a=e.getCellHeight(!0),e._onStartMoving(i,o,n,t,r,a)},d=function(o,n){e._dragOrResize(i,o,n,t,r,a)},u=function(o){e.placeholder.remove(),delete t._moving,delete t._event,delete t._lastTried;var n=o.target;if(n.gridstackNode&&n.gridstackNode.grid===e){if(t.el=n,t._isAboutToRemove){var r=i.gridstackNode.grid;r._gsEventHandler[o.type]&&r._gsEventHandler[o.type](o,n),e._removeDD(i),r.engine.removedNodes.push(t),r._triggerRemoveEvent(),delete i.gridstackNode,delete t.el,i.remove()}else s.Utils.removePositioningStyles(n),t._temporaryRemoved?(s.Utils.copyPos(t,t._orig),e._writePosAttr(n,t),e.engine.addNode(t)):e._writePosAttr(n,t),e._gsEventHandler[o.type]&&e._gsEventHandler[o.type](o,n);e._extraDragRow=0,e._updateContainerHeight(),e._triggerChangeEvent(),e.engine.endUpdate()}};h.draggable(i,{start:l,stop:u,drag:d}).resizable(i,{start:l,stop:u,resize:d}),t._initDD=!0}return h.draggable(i,o?"disable":"enable").resizable(i,n?"disable":"enable"),this},r.GridStack.prototype._onStartMoving=function(t,e,i,o,n,r){this.engine.cleanNodes().beginUpdate(o),this._writePosAttr(this.placeholder,o),this.el.appendChild(this.placeholder),o.el=this.placeholder,o._lastUiPosition=i.position,o._prevYPix=i.position.top,o._moving="dragstart"===e.type,delete o._lastTried,"dropover"===e.type&&o._temporaryRemoved&&(this.engine.addNode(o),o._moving=!0),this.engine.cacheRects(n,r,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),"resizestart"===e.type&&(h.resizable(t,"option","minWidth",n*(o.minW||1)).resizable(t,"option","minHeight",r*(o.minH||1)),o.maxW&&h.resizable(t,"option","maxWidth",n*o.maxW),o.maxH&&h.resizable(t,"option","maxHeight",r*o.maxH))},r.GridStack.prototype._leave=function(t,e){var i=t.gridstackNode;i&&(h.off(t,"drag"),i._temporaryRemoved||(i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&e?e:t,!0===this.opts.removable&&u(t,!0),t._gridstackNodeOrig?(t.gridstackNode=t._gridstackNodeOrig,delete t._gridstackNodeOrig):i._isExternal&&(delete i.el,delete t.gridstackNode,this.engine.restoreInitial())))},r.GridStack.prototype._dragOrResize=function(t,e,i,n,r,a){var l,d=o({},n._orig),h=this.opts.marginLeft,u=this.opts.marginRight,p=this.opts.marginTop,c=this.opts.marginBottom,g=Math.round(.1*a),f=Math.round(.1*r);if(h=Math.min(h,f),u=Math.min(u,f),p=Math.min(p,g),c=Math.min(c,g),"drag"===e.type){if(n._temporaryRemoved)return;var m=i.position.top-n._prevYPix;n._prevYPix=i.position.top,s.Utils.updateScrollPosition(t,i.position,m);var v=i.position.left+(i.position.left>n._lastUiPosition.left?-u:h),y=i.position.top+(i.position.top>n._lastUiPosition.top?-c:p);d.x=Math.round(v/r),d.y=Math.round(y/a);var _=this._extraDragRow;if(this.engine.collide(n,d)){var b=this.getRow(),w=Math.max(0,d.y+n.h-b);this.opts.maxRow&&b+w>this.opts.maxRow&&(w=Math.max(0,this.opts.maxRow-b)),this._extraDragRow=w}else this._extraDragRow=0;if(this._extraDragRow!==_&&this._updateContainerHeight(),n.x===d.x&&n.y===d.y)return}else if("resize"===e.type){if(d.x<0)return;if(s.Utils.updateScrollResize(e,t,a),d.w=Math.round((i.size.width-h)/r),d.h=Math.round((i.size.height-p)/a),n.w===d.w&&n.h===d.h)return;if(n._lastTried&&n._lastTried.w===d.w&&n._lastTried.h===d.h)return;v=i.position.left+h;var E=i.position.top+p;d.x=Math.round(v/r),d.y=Math.round(E/a),l=!0}n._event=e,n._lastTried=d;var D={x:i.position.left+h,y:i.position.top+p,w:(i.size?i.size.width:n.w*r)-h-u,h:(i.size?i.size.height:n.h*a)-p-c};if(this.engine.moveNodeCheck(n,o(o({},d),{cellWidth:r,cellHeight:a,rect:D,resizing:l}))){n._lastUiPosition=i.position,this.engine.cacheRects(r,a,p,u,c,h),delete n._skipDown,l&&n.subGrid&&n.subGrid.onParentResize(),this._extraDragRow=0,this._updateContainerHeight();var x=e.target;this._writePosAttr(x,n),this._gsEventHandler[e.type]&&this._gsEventHandler[e.type](e,x)}},r.GridStack.prototype.movable=function(t,e){var i=this;return this.opts.staticGrid||r.GridStack.getElements(t).forEach((function(t){var o=t.gridstackNode;o&&(e?delete o.noMove:o.noMove=!0,i._prepareDragDropByNode(o))})),this},r.GridStack.prototype.resizable=function(t,e){var i=this;return this.opts.staticGrid||r.GridStack.getElements(t).forEach((function(t){var o=t.gridstackNode;o&&(e?delete o.noResize:o.noResize=!0,i._prepareDragDropByNode(o))})),this},r.GridStack.prototype.disable=function(){if(!this.opts.staticGrid)return this.enableMove(!1),this.enableResize(!1),this._triggerEvent("disable"),this},r.GridStack.prototype.enable=function(){if(!this.opts.staticGrid)return this.enableMove(!0),this.enableResize(!0),this._triggerEvent("enable"),this},r.GridStack.prototype.enableMove=function(t){var e=this;return this.opts.staticGrid||(this.opts.disableDrag=!t,this.engine.nodes.forEach((function(i){return e.movable(i.el,t)}))),this},r.GridStack.prototype.enableResize=function(t){var e=this;return this.opts.staticGrid||(this.opts.disableResize=!t,this.engine.nodes.forEach((function(i){return e.resizable(i.el,t)}))),this},r.GridStack.prototype._removeDD=function(t){return h.draggable(t,"destroy").resizable(t,"destroy"),t.gridstackNode&&delete t.gridstackNode._initDD,delete t.ddElement,this}},839:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DDManager=void 0;e.DDManager=function(){}},664:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.DDResizableHandle=void 0;var o=i(537),n=function(){function t(t,e,i){this.moving=!1,this.host=t,this.dir=e,this.option=i,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._init()}return t.prototype._init=function(){var e=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(""+t.prefix+this.dir),e.style.zIndex="100",e.style.userSelect="none",this.el=e,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,!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)),t.stopPropagation(),t.preventDefault()},t.prototype._mouseUp=function(t){this.moving&&this._triggerEvent("stop",t),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._triggerEvent=function(t,e){return this.option[t]&&this.option[t](e),this},t.prefix="ui-resizable-",t}();e.DDResizableHandle=n},904: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)e.hasOwnProperty(i)&&(t[i]=e[i])},o(t,e)},function(t,e){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(664),s=i(74),a=i(867),l=i(839),d=function(t){function e(e,i){void 0===i&&(i={});var o=t.call(this)||this;return 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,top:i.top-t.top},size:{width:i.width,height:i.height}}},o.el=e,o.option=i,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.add("ui-resizable"),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.el.classList.remove("ui-resizable"),this._setupAutoHide(!1)},e.prototype.destroy=function(){this._removeHandlers(),this._setupAutoHide(!1),this.el.classList.remove("ui-resizable"),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,e=this.option.handles||"e,s,se";return"all"===e&&(e="n,e,s,w,se,sw,ne,nw"),this.handlers=e.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.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.option.stop&&this.option.stop(e),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",e),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this},e.prototype._setupHelper=function(){var t=this;return this.elOriginStyleVal=e._originStyleProp.map((function(e){return t.el.style[e]})),this.parentOriginStylePosition=this.el.parentElement.style.position,window.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=this.startEvent,o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=t.clientX-i.clientX,r=t.clientY-i.clientY;e.indexOf("e")>-1?o.width+=n:e.indexOf("w")>-1&&(o.width-=n,o.left+=n),e.indexOf("s")>-1?o.height+=r:e.indexOf("n")>-1&&(o.height-=r,o.top+=r);var s=this._constrainSize(o.width,o.height);return Math.round(o.width)!==Math.round(s.width)&&(e.indexOf("w")>-1&&(o.left+=o.width-s.width),o.width=s.width),Math.round(o.height)!==Math.round(s.height)&&(e.indexOf("n")>-1&&(o.top+=o.height-s.height),o.height=s.height),o},e.prototype._constrainSize=function(t,e){var i=this.option.maxWidth||Number.MAX_SAFE_INTEGER,o=this.option.minWidth||t,n=this.option.maxHeight||Number.MAX_SAFE_INTEGER,r=this.option.minHeight||e;return{width:Math.min(i,Math.max(o,t)),height:Math.min(n,Math.max(r,e))}},e.prototype._applyChange=function(){var t=this,e={left:0,top:0,width:0,height:0};if("absolute"===this.el.style.position){var i=this.el.parentElement.getBoundingClientRect(),o=i.left,n=i.top;e={left:o,top:n,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach((function(i){var o=t.temporalRect[i];t.el.style[i]=o-e[i]+"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);e.DDResizable=d},537: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(839);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 n=function(){};function r(t,e){if(!(t.touches.length>1)){t.cancelable&&t.preventDefault();var i=t.changedTouches[0],o=document.createEvent("MouseEvents");o.initMouseEvent(e,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(o)}}function s(t,e){t.cancelable&&t.preventDefault();var i=document.createEvent("MouseEvents");i.initMouseEvent(e,!0,!0,window,1,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(i)}e.touchstart=function(t){n.touchHandled||(n.touchHandled=!0,r(t,"mousedown"))},e.touchmove=function(t){n.touchHandled&&r(t,"mousemove")},e.touchend=function(t){if(n.touchHandled){n.pointerLeaveTimeout&&(window.clearTimeout(n.pointerLeaveTimeout),delete n.pointerLeaveTimeout);var e=!!o.DDManager.dragElement;r(t,"mouseup"),e||r(t,"click"),n.touchHandled=!1}},e.pointerdown=function(t){t.target.releasePointerCapture(t.pointerId)},e.pointerenter=function(t){o.DDManager.dragElement&&s(t,"mouseenter")},e.pointerleave=function(t){o.DDManager.dragElement&&(n.pointerLeaveTimeout=window.setTimeout((function(){delete n.pointerLeaveTimeout,s(t,"mouseleave")}),10))}},506: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(867),r=function(){function t(t){void 0===t&&(t={}),this.addedNodes=[],this.removedNodes=[],this.column=t.column||12,this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}return t.prototype.batchUpdate=function(t){return void 0===t&&(t=!0),!!this.batchMode===t||(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,this._packNodes()._notify())),this},t.prototype._useEntireRowArea=function(t,e){return!this.float&&!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._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};i=i||this.collide(t,s,r.skip);){var d=void 0;if(i.locked||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,d=this.moveNode(t,o(o(o({},e),{y:i.y+i.h}),l)),i.locked&&d?n.Utils.copyPos(e,t):!i.locked&&d&&r.pack&&(this._packNodes(),e.y=i.y+i.h,n.Utils.copyPos(t,e)),a=a||d):d=this.moveNode(i,o(o(o({},i),{y:e.y+e.h,skip:t}),l)),!d)return a;i=void 0}return a},t.prototype.collide=function(t,e,i){return void 0===e&&(e=t),this.nodes.find((function(o){return o!==t&&o!==i&&n.Utils.isIntercepted(o,e)}))},t.prototype.collideAll=function(t,e,i){return void 0===e&&(e=t),this.nodes.filter((function(o){return o!==t&&o!==i&&n.Utils.isIntercepted(o,e)}))},t.prototype.directionCollideCoverage=function(t,e,i){if(e.rect&&t._rect){var n,r=t._rect,s=o({},e.rect);return 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,i.forEach((function(t){if(!t.locked&&t._rect){var e=t._rect,i=Number.MAX_VALUE,o=Number.MAX_VALUE,a=.5;r.y<e.y?i=(s.y+s.h-e.y)/e.h:r.y+r.h>e.y+e.h&&(i=(e.y+e.h-s.y)/e.h),r.x<e.x?o=(s.x+s.w-e.x)/e.w:r.x+r.w>e.x+e.w&&(o=(e.x+e.w-s.x)/e.w);var l=Math.min(o,i);l>a&&(a=l,n=t)}})),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(){var t=this;if(0===this.nodes.length)return this;this.batchUpdate().sortNodes();var e=this.nodes;return this.nodes=[],e.forEach((function(e){e.locked||(e.autoPosition=!0),t.addNode(e,!1),e._dirty=!0})),this.batchUpdate(!1)},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 this.nodes=n.Utils.sort(this.nodes,t,this.column),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){(e=e||{})._id=e._id||t._idSeq++,void 0!==e.x&&void 0!==e.y&&null!==e.x&&null!==e.y||(e.autoPosition=!0);var o={x:0,y:0,w:1,h:1};return n.Utils.defaults(e,o),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,"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=o.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=o.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=o.w),isNaN(e.h)&&(e.h=o.h),this.nodeBoundFix(e,i)},t.prototype.nodeBoundFix=function(t,e){var i=t._orig||n.Utils.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w,t.maxW)),t.maxH&&(t.h=Math.min(t.h,t.maxH)),t.minW&&t.minW<=this.column&&(t.w=Math.max(t.w,t.minW)),t.minH&&(t.h=Math.max(t.h,t.minH)),(1===this.column||t.x+t.w>this.column)&&this.column<12&&!this._inColumnResize&&!t.autoPosition&&t._id&&-1===this.findCacheLayout(t,12)){var r=o({},t);r.x=Math.min(11,r.x),r.w=Math.min(12,r.w),this.cacheOneLayout(r,12)}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),t},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){n.Utils.samePos(t,t._orig)||(n.Utils.copyPos(t,t._orig),t._dirty=!0)})),this._notify(),this},t.prototype.findEmptyPosition=function(t){this.sortNodes();for(var e=!1,i=function(i){var r=i%o.column,s=Math.floor(i/o.column);if(r+t.w>o.column)return"continue";var a={x:r,y:s,w:t.w,h:t.h};o.nodes.find((function(t){return n.Utils.isIntercepted(a,t)}))||(t.x=r,t.y=s,e=!0)},o=this,r=0;!e;++r)i(r);return e},t.prototype.addNode=function(t,e){return void 0===e&&(e=!1),this.nodes.find((function(e){return e._id===t._id}))||(delete(t=this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t))._temporaryRemoved,delete t._removeDOM,t.autoPosition&&this.findEmptyPosition(t)&&delete t.autoPosition,this.nodes.push(t),e&&this.addedNodes.push(t),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===t}))?(i&&this.removedNodes.push(t),e&&(t._removeDOM=!0),this.nodes=this.nodes.filter((function(e){return e!==t})),this._packNodes()._notify([t])):this},t.prototype.removeAll=function(t){return void 0===t&&(t=!0),delete this._layouts,0===this.nodes.length?this:(t&&this.nodes.forEach((function(t){return t._removeDOM=!0})),this.removedNodes=this.nodes,this.nodes=[],this._notify(this.removedNodes))},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===e?r=o({},t):o({},t)}))});if(!r)return!1;var l=a.moveNode(r,i)&&a.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&&(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),a=this.nodeBoundFix(a,s),n.Utils.copyPos(e,a),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,p=u?this.directionCollideCoverage(t,e,d):d[0];if(u&&p&&(null===(o=null===(i=t.grid)||void 0===i?void 0:i.opts)||void 0===o?void 0:o.subGridDynamic)&&!t.grid._isTemp){var c=n.Utils.areaIntercept(e.rect,p._rect),g=n.Utils.area(e.rect),f=n.Utils.area(p._rect);c/(g<f?g:f)>.8&&(p.grid.makeSubGrid(p.el,void 0,t),p=void 0)}p?h=!this._fixCollisions(t,a,p,e):(h=!1,r&&delete e.pack)}return h&&(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){var e;void 0===t&&(t=!0);var i=null===(e=this._layouts)||void 0===e?void 0:e.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,s=[];return this.sortNodes(),this.nodes.forEach((function(e){var i=null==r?void 0:r.find((function(t){return t._id===e._id})),a=o({},e);i&&(a.x=i.x,a.y=i.y,a.w=i.w),n.Utils.removeInternalForSave(a,!t),s.push(a)})),s},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&&(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.updateNodeWidths=function(t,e,i,o){var r,s=this;if(void 0===o&&(o="moveScale"),!this.nodes.length||!e||t===e)return this;this.cacheLayout(this.nodes,t),this.batchUpdate();var a=[],l=!1;if(1===e&&(null==i?void 0:i.length)){l=!0;var d=0;i.forEach((function(t){t.x=0,t.w=1,t.y=Math.max(t.y,d),d=t.y+t.h})),a=i,i=[]}else i=n.Utils.sort(this.nodes,-1,t);var h=[];if(e>t){h=this._layouts[e]||[];var u=this._layouts.length-1;!h.length&&t!==u&&(null===(r=this._layouts[u])||void 0===r?void 0:r.length)&&(t=u,this._layouts[u].forEach((function(t){var e=i.find((function(e){return e._id===t._id}));e&&(e.x=t.x,e.y=t.y,e.w=t.w)})))}if(h.forEach((function(t){var e=i.findIndex((function(e){return e._id===t._id}));-1!==e&&(i[e].x=t.x,i[e].y=t.y,i[e].w=t.w,a.push(i[e]),i.splice(e,1))})),i.length)if("function"==typeof o)o(e,t,a,i);else if(!l){var p=e/t,c="move"===o||"moveScale"===o,g="scale"===o||"moveScale"===o;i.forEach((function(i){i.x=1===e?0:c?Math.round(i.x*p):Math.min(i.x,e-1),i.w=1===e||1===t?1:g?Math.round(i.w*p)||1:Math.min(i.w,e),a.push(i)})),i=[]}return l||(a=n.Utils.sort(a,-1,e)),this._inColumnResize=!0,this.nodes=[],a.forEach((function(t){s.addNode(t,!1),delete t._orig})),this.batchUpdate(!1),delete this._inColumnResize,this},t.prototype.cacheLayout=function(e,i,o){void 0===o&&(o=!1);var n=[];return e.forEach((function(e,i){e._id=e._id||t._idSeq++,n[i]={x:e.x,y:e.y,w:e.w,_id:e._id}})),this._layouts=o?[]:this._layouts||[],this._layouts[i]=n,this},t.prototype.cacheOneLayout=function(e,i){e._id=e._id||t._idSeq++;var o={x:e.x,y:e.y,w:e.w,_id:e._id};this._layouts=this._layouts||[],this._layouts[i]=this._layouts[i]||[];var n=this.findCacheLayout(e,i);return-1===n?this._layouts[i].push(o):this._layouts[i][n]=o,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.cleanupNode=function(t){for(var e in t)"_"===e[0]&&"_id"!==e&&delete t[e];return this},t._idSeq=1,t}();e.GridStackEngine=r},324: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[