text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("angular-resizable-element",["exports","tslib","@angular/core","rxjs","rxjs/operators"],t):t(e["angular-resizable-element"]={},e.tslib,e.ng.core,null,e.Rx.Observable.prototype)}(this,function(e,u,i,a,p){"use strict";function l(e,t,n){return void 0===n&&(n=3),Math.abs(e-t)<n}function r(e,t,n,i){var r={top:e.top,bottom:e.bottom,left:e.left,right:e.right};return t.top&&(r.top+=i),t.bottom&&(r.bottom+=i),t.left&&(r.left+=n),t.right&&(r.right+=n),r.height=r.bottom-r.top,r.width=r.right-r.left,r}function d(e){var t=e.clientY,n=e.rect;return t>=n.top&&t<=n.bottom}function h(e){var t=e.clientX,n=e.rect;return t>=n.left&&t<=n.right}function c(e){var t=e.clientX,n=e.clientY,i=e.elm,r=e.allowedEdges,o=e.cursorPrecision,s=i.nativeElement.getBoundingClientRect(),c={};return r.left&&l(t,s.left,o)&&d({clientY:n,rect:s})&&(c.left=!0),r.right&&l(t,s.right,o)&&d({clientY:n,rect:s})&&(c.right=!0),r.top&&l(n,s.top,o)&&h({clientX:t,rect:s})&&(c.top=!0),r.bottom&&l(n,s.bottom,o)&&h({clientX:t,rect:s})&&(c.bottom=!0),c}var m=Object.freeze({topLeft:"nw-resize",topRight:"ne-resize",bottomLeft:"sw-resize",bottomRight:"se-resize",leftOrRight:"ew-resize",topOrBottom:"ns-resize"});function f(e,t){return e.left&&e.top?t.topLeft:e.right&&e.top?t.topRight:e.left&&e.bottom?t.bottomLeft:e.right&&e.bottom?t.bottomRight:e.left||e.right?t.leftOrRight:e.top||e.bottom?t.topOrBottom:""}function g(e){var t=e.edges,n=e.initialRectangle,i=e.newRectangle,r={};return Object.keys(t).forEach(function(e){r[e]=(i[e]||0)-(n[e]||0)}),r}var v="resize-active",t=function(){function e(e,t,n){this.renderer=e,this.elm=t,this.zone=n,this.resizeEdges={},this.enableGhostResize=!1,this.resizeSnapGrid={},this.resizeCursors=m,this.resizeCursorPrecision=3,this.ghostElementPositioning="fixed",this.resizeStart=new i.EventEmitter,this.resizing=new i.EventEmitter,this.resizeEnd=new i.EventEmitter,this.mouseup=new a.Subject,this.mousedown=new a.Subject,this.mousemove=new a.Subject,this.pointerEventListenerSubscriptions={},this.pointerEventListeners=o.getInstance(e,n)}return e.prototype.ngOnInit=function(){var o,s=this;this.pointerEventListenerSubscriptions.pointerDown=this.pointerEventListeners.pointerDown.subscribe(function(e){var t=e.clientX,n=e.clientY;s.mousedown.next({clientX:t,clientY:n})}),this.pointerEventListenerSubscriptions.pointerMove=this.pointerEventListeners.pointerMove.subscribe(function(e){var t=e.clientX,n=e.clientY,i=e.event;s.mousemove.next({clientX:t,clientY:n,event:i})}),this.pointerEventListenerSubscriptions.pointerUp=this.pointerEventListeners.pointerUp.subscribe(function(e){var t=e.clientX,n=e.clientY;s.mouseup.next({clientX:t,clientY:n})});var i=function(){o&&o.clonedNode&&(s.elm.nativeElement.parentElement.removeChild(o.clonedNode),s.renderer.setStyle(s.elm.nativeElement,"visibility","inherit"))},e=this.mousemove.pipe(p.share());e.pipe(p.filter(function(){return!!o})).subscribe(function(e){e.event.preventDefault()}),e.pipe(p.throttle(function(){return a.interval(50)})).subscribe(function(e){var t=c({clientX:e.clientX,clientY:e.clientY,elm:s.elm,allowedEdges:s.resizeEdges,cursorPrecision:s.resizeCursorPrecision}),n=Object.assign({},m,s.resizeCursors);if(o){var i=f(o.edges,n);s.renderer.setStyle(document.body,"cursor",i)}else{i=f(t,n);s.renderer.setStyle(s.elm.nativeElement,"cursor",i)}s.setElementClass(s.elm,v,!!o),s.setElementClass(s.elm,"resize-left-hover",!0===t.left),s.setElementClass(s.elm,"resize-right-hover",!0===t.right),s.setElementClass(s.elm,"resize-top-hover",!0===t.top),s.setElementClass(s.elm,"resize-bottom-hover",!0===t.bottom)}),this.mousedown.pipe(p.mergeMap(function(t){function r(e){return{clientX:e.clientX-t.clientX,clientY:e.clientY-t.clientY}}var c=function(){var e={x:1,y:1};return o&&(s.resizeSnapGrid.left&&o.edges.left?e.x=+s.resizeSnapGrid.left:s.resizeSnapGrid.right&&o.edges.right&&(e.x=+s.resizeSnapGrid.right),s.resizeSnapGrid.top&&o.edges.top?e.y=+s.resizeSnapGrid.top:s.resizeSnapGrid.bottom&&o.edges.bottom&&(e.y=+s.resizeSnapGrid.bottom)),e};function l(e,t){return{x:Math.ceil(e.clientX/t.x),y:Math.ceil(e.clientY/t.y)}}return a.merge(e.pipe(p.take(1)).pipe(p.map(function(e){return[,e]})),e.pipe(p.pairwise())).pipe(p.map(function(e){var t=u.__read(e,2),n=t[0],i=t[1];return[n?r(n):n,r(i)]})).pipe(p.filter(function(e){var t=u.__read(e,2),n=t[0],i=t[1];if(!n)return!0;var r=c(),o=l(n,r),s=l(i,r);return o.x!==s.x||o.y!==s.y})).pipe(p.map(function(e){var t=u.__read(e,2)[1],n=c();return{clientX:Math.round(t.clientX/n.x)*n.x,clientY:Math.round(t.clientY/n.y)*n.y}})).pipe(p.takeUntil(a.merge(s.mouseup,s.mousedown)))})).pipe(p.filter(function(){return!!o})).pipe(p.map(function(e){var t=e.clientX,n=e.clientY;return r(o.startingRect,o.edges,t,n)})).pipe(p.filter(function(e){return!!(e.height&&e.width&&0<e.height&&0<e.width)})).pipe(p.filter(function(e){return!s.validateResize||s.validateResize({rectangle:e,edges:g({edges:o.edges,initialRectangle:o.startingRect,newRectangle:e})})})).subscribe(function(e){o&&o.clonedNode&&(s.renderer.setStyle(o.clonedNode,"height",e.height+"px"),s.renderer.setStyle(o.clonedNode,"width",e.width+"px"),s.renderer.setStyle(o.clonedNode,"top",e.top+"px"),s.renderer.setStyle(o.clonedNode,"left",e.left+"px")),s.zone.run(function(){s.resizing.emit({edges:g({edges:o.edges,initialRectangle:o.startingRect,newRectangle:e}),rectangle:e})}),o.currentRect=e}),this.mousedown.pipe(p.map(function(e){var t=e.clientX,n=e.clientY;return e.edges||c({clientX:t,clientY:n,elm:s.elm,allowedEdges:s.resizeEdges,cursorPrecision:s.resizeCursorPrecision})})).pipe(p.filter(function(e){return 0<Object.keys(e).length})).subscribe(function(e){o&&i();var t=function(e,t){var n=0,i=0,r=e.nativeElement.style,o=["transform","-ms-transform","-moz-transform","-o-transform"].map(function(e){return r[e]}).find(function(e){return!!e});if(o&&o.includes("translate")&&(n=o.replace(/.*translate\((.*)px, (.*)px\).*/,"$1"),i=o.replace(/.*translate\((.*)px, (.*)px\).*/,"$2")),"absolute"===t)return{height:e.nativeElement.offsetHeight,width:e.nativeElement.offsetWidth,top:e.nativeElement.offsetTop-i,bottom:e.nativeElement.offsetHeight+e.nativeElement.offsetTop-i,left:e.nativeElement.offsetLeft-n,right:e.nativeElement.offsetWidth+e.nativeElement.offsetLeft-n};var s=e.nativeElement.getBoundingClientRect();return{height:s.height,width:s.width,top:s.top-i,bottom:s.bottom-i,left:s.left-n,right:s.right-n,scrollTop:e.nativeElement.scrollTop,scrollLeft:e.nativeElement.scrollLeft}}(s.elm,s.ghostElementPositioning);if(o={edges:e,startingRect:t,currentRect:t},s.enableGhostResize){o.clonedNode=s.elm.nativeElement.cloneNode(!0);var n=Object.assign({},m,s.resizeCursors);s.elm.nativeElement.parentElement.appendChild(o.clonedNode),s.renderer.setStyle(s.elm.nativeElement,"visibility","hidden"),s.renderer.setStyle(o.clonedNode,"position",s.ghostElementPositioning),s.renderer.setStyle(o.clonedNode,"left",o.startingRect.left+"px"),s.renderer.setStyle(o.clonedNode,"top",o.startingRect.top+"px"),s.renderer.setStyle(o.clonedNode,"height",o.startingRect.height+"px"),s.renderer.setStyle(o.clonedNode,"width",o.startingRect.width+"px"),s.renderer.setStyle(o.clonedNode,"cursor",f(o.edges,n)),s.renderer.addClass(o.clonedNode,"resize-ghost-element"),o.clonedNode.scrollTop=o.startingRect.scrollTop,o.clonedNode.scrollLeft=o.startingRect.scrollLeft}s.zone.run(function(){s.resizeStart.emit({edges:g({edges:e,initialRectangle:t,newRectangle:t}),rectangle:r(t,{},0,0)})})}),this.mouseup.subscribe(function(){o&&(s.renderer.removeClass(s.elm.nativeElement,v),s.renderer.setStyle(document.body,"cursor",""),s.renderer.setStyle(s.elm.nativeElement,"cursor",""),s.zone.run(function(){s.resizeEnd.emit({edges:g({edges:o.edges,initialRectangle:o.startingRect,newRectangle:o.currentRect}),rectangle:o.currentRect})}),i(),o=null)})},e.prototype.ngOnDestroy=function(){this.mousedown.complete(),this.mouseup.complete(),this.mousemove.complete(),this.pointerEventListenerSubscriptions.pointerDown.unsubscribe(),this.pointerEventListenerSubscriptions.pointerMove.unsubscribe(),this.pointerEventListenerSubscriptions.pointerUp.unsubscribe()},e.prototype.setElementClass=function(e,t,n){n?this.renderer.addClass(e.nativeElement,t):this.renderer.removeClass(e.nativeElement,t)},e}();t.decorators=[{type:i.Directive,args:[{selector:"[mwlResizable]"}]}],t.ctorParameters=function(){return[{type:i.Renderer2},{type:i.ElementRef},{type:i.NgZone}]},t.propDecorators={validateResize:[{type:i.Input}],resizeEdges:[{type:i.Input}],enableGhostResize:[{type:i.Input}],resizeSnapGrid:[{type:i.Input}],resizeCursors:[{type:i.Input}],resizeCursorPrecision:[{type:i.Input}],ghostElementPositioning:[{type:i.Input}],resizeStart:[{type:i.Output}],resizing:[{type:i.Output}],resizeEnd:[{type:i.Output}]};var o=function(){function n(r,o){this.pointerDown=new a.Observable(function(t){var e,n;return o.runOutsideAngular(function(){e=r.listen("document","mousedown",function(e){t.next({clientX:e.clientX,clientY:e.clientY,event:e})}),n=r.listen("document","touchstart",function(e){t.next({clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,event:e})})}),function(){e(),n()}}).pipe(p.share()),this.pointerMove=new a.Observable(function(t){var e,n;return o.runOutsideAngular(function(){e=r.listen("document","mousemove",function(e){t.next({clientX:e.clientX,clientY:e.clientY,event:e})}),n=r.listen("document","touchmove",function(e){t.next({clientX:e.targetTouches[0].clientX,clientY:e.targetTouches[0].clientY,event:e})})}),function(){e(),n()}}).pipe(p.share()),this.pointerUp=new a.Observable(function(t){var e,n,i;return o.runOutsideAngular(function(){e=r.listen("document","mouseup",function(e){t.next({clientX:e.clientX,clientY:e.clientY,event:e})}),n=r.listen("document","touchend",function(e){t.next({clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY,event:e})}),i=r.listen("document","touchcancel",function(e){t.next({clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY,event:e})})}),function(){e(),n(),i()}}).pipe(p.share())}return n.getInstance=function(e,t){return n.instance||(n.instance=new n(e,t)),n.instance},n}(),n=function(){function e(e,t,n,i){this.renderer=e,this.element=t,this.zone=n,this.resizable=i,this.resizeEdges={},this.eventListeners={}}return e.prototype.ngOnDestroy=function(){this.unsubscribeEventListeners()},e.prototype.onMousedown=function(e,t,n){var i=this;e.preventDefault(),this.zone.runOutsideAngular(function(){i.eventListeners.touchmove||(i.eventListeners.touchmove=i.renderer.listen(i.element.nativeElement,"touchmove",function(e){i.onMousemove(e,e.targetTouches[0].clientX,e.targetTouches[0].clientY)})),i.eventListeners.mousemove||(i.eventListeners.mousemove=i.renderer.listen(i.element.nativeElement,"mousemove",function(e){i.onMousemove(e,e.clientX,e.clientY)})),i.resizable.mousedown.next({clientX:t,clientY:n,edges:i.resizeEdges})})},e.prototype.onMouseup=function(e,t){var n=this;this.zone.runOutsideAngular(function(){n.unsubscribeEventListeners(),n.resizable.mouseup.next({clientX:e,clientY:t,edges:n.resizeEdges})})},e.prototype.onMousemove=function(e,t,n){this.resizable.mousemove.next({clientX:t,clientY:n,edges:this.resizeEdges,event:e})},e.prototype.unsubscribeEventListeners=function(){var t=this;Object.keys(this.eventListeners).forEach(function(e){t.eventListeners[e](),delete t.eventListeners[e]})},e}();n.decorators=[{type:i.Directive,args:[{selector:"[mwlResizeHandle]"}]}],n.ctorParameters=function(){return[{type:i.Renderer2},{type:i.ElementRef},{type:i.NgZone},{type:t}]},n.propDecorators={resizeEdges:[{type:i.Input}],onMousedown:[{type:i.HostListener,args:["touchstart",["$event","$event.touches[0].clientX","$event.touches[0].clientY"]]},{type:i.HostListener,args:["mousedown",["$event","$event.clientX","$event.clientY"]]}],onMouseup:[{type:i.HostListener,args:["touchend",["$event.changedTouches[0].clientX","$event.changedTouches[0].clientY"]]},{type:i.HostListener,args:["touchcancel",["$event.changedTouches[0].clientX","$event.changedTouches[0].clientY"]]},{type:i.HostListener,args:["mouseup",["$event.clientX","$event.clientY"]]}]};var s=function(){};s.decorators=[{type:i.NgModule,args:[{declarations:[t,n],exports:[t,n]}]}],e.ResizableDirective=t,e.ResizeHandleDirective=n,e.ResizableModule=s,Object.defineProperty(e,"__esModule",{value:!0})});
  //# sourceMappingURL=angular-resizable-element.umd.min.js.map
  