(function(e){"function"===typeof define&&define.amd?define(["jquery","./core","./mouse","./widget"],e):e(jQuery)})(function(e){e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(a){return parseInt(a,
10)||0},_isNumber:function(a){return!isNaN(parseInt(a,10))},_hasScroll:function(a,b){if("hidden"===e(a).css("overflow"))return!1;var d=b&&"left"===b?"scrollLeft":"scrollTop",f=!1;if(0<a[d])return!0;a[d]=1;f=0<a[d];a[d]=0;return f},_create:function(){var a,b,d,f,c,g=this,h=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!h.aspectRatio,aspectRatio:h.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:h.helper||h.ghost||h.animate?h.helper||
"ui-resizable-helper":null});this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),
marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),
this._proportionallyResize());this.handles=h.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");this._handles=e();if(this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),a=this.handles.split(","),this.handles={},b=0;b<a.length;b++)d=e.trim(a[b]),c="ui-resizable-"+d,f=e("<div class='ui-resizable-handle "+
c+"'></div>"),f.css({zIndex:h.zIndex}),"se"===d&&f.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[d]=".ui-resizable-"+d,this.element.append(f);this._renderAxis=function(a){var b,c,d;a=a||this.element;for(b in this.handles){if(this.handles[b].constructor===String)this.handles[b]=this.element.children(this.handles[b]).first().show();else if(this.handles[b].jquery||this.handles[b].nodeType)this.handles[b]=e(this.handles[b]),this._on(this.handles[b],{mousedown:g._mouseDown});this.elementIsWrapper&&
this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(c=e(this.handles[b],this.element),d=/sw|ne|nw|se|n|s/.test(b)?c.outerHeight():c.outerWidth(),c=["padding",/ne|nw|n/.test(b)?"Top":/se|sw|s/.test(b)?"Bottom":/^e$/.test(b)?"Right":"Left"].join(""),a.css(c,d),this._proportionallyResize());this._handles=this._handles.add(this.handles[b])}};this._renderAxis(this.element);this._handles=this._handles.add(this.element.find(".ui-resizable-handle"));this._handles.disableSelection();
this._handles.mouseover(function(){g.resizing||(this.className&&(f=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),g.axis=f&&f[1]?f[1]:"se")});h.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){h.disabled||(e(this).removeClass("ui-resizable-autohide"),g._handles.show())}).mouseleave(function(){h.disabled||g.resizing||(e(this).addClass("ui-resizable-autohide"),g._handles.hide())}));this._mouseInit()},_destroy:function(){this._mouseDestroy();
var a,b=function(a){e(a).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};this.elementIsWrapper&&(b(this.element),a=this.element,this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")}).insertAfter(a),a.remove());this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);
return this},_mouseCapture:function(a){var b,d,f=!1;for(b in this.handles)if(d=e(this.handles[b])[0],d===a.target||e.contains(d,a.target))f=!0;return!this.options.disabled&&f},_mouseStart:function(a){var b,d,f=this.options,c=this.element;this.resizing=!0;this._renderProxy();b=this._num(this.helper.css("left"));d=this._num(this.helper.css("top"));f.containment&&(b+=e(f.containment).scrollLeft()||0,d+=e(f.containment).scrollTop()||0);this.offset=this.helper.offset();this.position={left:b,top:d};this.size=
this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:c.width(),height:c.height()};this.originalSize=this._helper?{width:c.outerWidth(),height:c.outerHeight()}:{width:c.width(),height:c.height()};this.sizeDiff={width:c.outerWidth()-c.width(),height:c.outerHeight()-c.height()};this.originalPosition={left:b,top:d};this.originalMousePosition={left:a.pageX,top:a.pageY};this.aspectRatio="number"===typeof f.aspectRatio?f.aspectRatio:this.originalSize.width/this.originalSize.height||
1;b=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor","auto"===b?this.axis+"-resize":b);c.addClass("ui-resizable-resizing");this._propagate("start",a);return!0},_mouseDrag:function(a){var b,d=this.originalMousePosition;b=a.pageX-d.left||0;var d=a.pageY-d.top||0,f=this._change[this.axis];this._updatePrevProperties();if(!f)return!1;b=f.apply(this,[a,b,d]);this._updateVirtualBoundaries(a.shiftKey);if(this._aspectRatio||a.shiftKey)b=this._updateRatio(b,a);b=this._respectSize(b,a);this._updateCache(b);
this._propagate("resize",a);b=this._applyChanges();!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();e.isEmptyObject(b)||(this._updatePrevProperties(),this._trigger("resize",a,this.ui()),this._applyChanges());return!1},_mouseStop:function(a){this.resizing=!1;var b,d,f,c=this.options;this._helper&&(b=this._proportionallyResizeElements,b=(d=b.length&&/textarea/i.test(b[0].nodeName))&&this._hasScroll(b[0],"left")?0:this.sizeDiff.height,d=d?0:this.sizeDiff.width,d=
{width:this.helper.width()-d,height:this.helper.height()-b},b=parseInt(this.element.css("left"),10)+(this.position.left-this.originalPosition.left)||null,f=parseInt(this.element.css("top"),10)+(this.position.top-this.originalPosition.top)||null,c.animate||this.element.css(e.extend(d,{top:f,left:b})),this.helper.height(this.size.height),this.helper.width(this.size.width),this._helper&&!c.animate&&this._proportionallyResize());e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");
this._propagate("stop",a);this._helper&&this.helper.remove();return!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left};this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var a={};this.position.top!==this.prevPosition.top&&(a.top=this.position.top+"px");this.position.left!==this.prevPosition.left&&(a.left=this.position.left+"px");this.size.width!==this.prevSize.width&&(a.width=this.size.width+"px");this.size.height!==
this.prevSize.height&&(a.height=this.size.height+"px");this.helper.css(a);return a},_updateVirtualBoundaries:function(a){var b,d,f,c;c=this.options;c={minWidth:this._isNumber(c.minWidth)?c.minWidth:0,maxWidth:this._isNumber(c.maxWidth)?c.maxWidth:Infinity,minHeight:this._isNumber(c.minHeight)?c.minHeight:0,maxHeight:this._isNumber(c.maxHeight)?c.maxHeight:Infinity};if(this._aspectRatio||a)a=c.minHeight*this.aspectRatio,d=c.minWidth/this.aspectRatio,b=c.maxHeight*this.aspectRatio,f=c.maxWidth/this.aspectRatio,
a>c.minWidth&&(c.minWidth=a),d>c.minHeight&&(c.minHeight=d),b<c.maxWidth&&(c.maxWidth=b),f<c.maxHeight&&(c.maxHeight=f);this._vBoundaries=c},_updateCache:function(a){this.offset=this.helper.offset();this._isNumber(a.left)&&(this.position.left=a.left);this._isNumber(a.top)&&(this.position.top=a.top);this._isNumber(a.height)&&(this.size.height=a.height);this._isNumber(a.width)&&(this.size.width=a.width)},_updateRatio:function(a){var b=this.position,d=this.size,f=this.axis;this._isNumber(a.height)?a.width=
a.height*this.aspectRatio:this._isNumber(a.width)&&(a.height=a.width/this.aspectRatio);"sw"===f&&(a.left=b.left+(d.width-a.width),a.top=null);"nw"===f&&(a.top=b.top+(d.height-a.height),a.left=b.left+(d.width-a.width));return a},_respectSize:function(a){var b=this._vBoundaries,d=this.axis,f=this._isNumber(a.width)&&b.maxWidth&&b.maxWidth<a.width,c=this._isNumber(a.height)&&b.maxHeight&&b.maxHeight<a.height,e=this._isNumber(a.width)&&b.minWidth&&b.minWidth>a.width,h=this._isNumber(a.height)&&b.minHeight&&
b.minHeight>a.height,k=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height,p=/sw|nw|w/.test(d),d=/nw|ne|n/.test(d);e&&(a.width=b.minWidth);h&&(a.height=b.minHeight);f&&(a.width=b.maxWidth);c&&(a.height=b.maxHeight);e&&p&&(a.left=k-b.minWidth);f&&p&&(a.left=k-b.maxWidth);h&&d&&(a.top=n-b.minHeight);c&&d&&(a.top=n-b.maxHeight);a.width||a.height||a.left||!a.top?a.width||a.height||a.top||!a.left||(a.left=null):a.top=null;return a},_getPaddingPlusBorderDimensions:function(a){var b=
0,d=[],e=[a.css("borderTopWidth"),a.css("borderRightWidth"),a.css("borderBottomWidth"),a.css("borderLeftWidth")];for(a=[a.css("paddingTop"),a.css("paddingRight"),a.css("paddingBottom"),a.css("paddingLeft")];4>b;b++)d[b]=parseInt(e[b],10)||0,d[b]+=parseInt(a[b],10)||0;return{height:d[0]+d[2],width:d[1]+d[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var a,b=0,d=this.helper||this.element;b<this._proportionallyResizeElements.length;b++)a=this._proportionallyResizeElements[b],
this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(a)),a.css({height:d.height()-this.outerDimensions.height||0,width:d.width()-this.outerDimensions.width||0})},_renderProxy:function(){var a=this.options;this.elementOffset=this.element.offset();this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+
"px",top:this.elementOffset.top+"px",zIndex:++a.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(a,b){return{width:this.originalSize.width+b}},w:function(a,b){return{left:this.originalPosition.left+b,width:this.originalSize.width-b}},n:function(a,b,d){return{top:this.originalPosition.top+d,height:this.originalSize.height-d}},s:function(a,b,d){return{height:this.originalSize.height+d}},se:function(a,b,d){return e.extend(this._change.s.apply(this,
arguments),this._change.e.apply(this,[a,b,d]))},sw:function(a,b,d){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[a,b,d]))},ne:function(a,b,d){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[a,b,d]))},nw:function(a,b,d){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[a,b,d]))}},_propagate:function(a,b){e.ui.plugin.call(this,a,[b,this.ui()]);"resize"!==a&&this._trigger(a,b,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,
element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.ui.plugin.add("resizable","animate",{stop:function(a){var b=e(this).resizable("instance"),d=b.options,f=b._proportionallyResizeElements,c=f.length&&/textarea/i.test(f[0].nodeName),g=c&&b._hasScroll(f[0],"left")?0:b.sizeDiff.height,c={width:b.size.width-(c?0:b.sizeDiff.width),height:b.size.height-g},g=parseInt(b.element.css("left"),10)+(b.position.left-
b.originalPosition.left)||null,h=parseInt(b.element.css("top"),10)+(b.position.top-b.originalPosition.top)||null;b.element.animate(e.extend(c,h&&g?{top:h,left:g}:{}),{duration:d.animateDuration,easing:d.animateEasing,step:function(){var c={width:parseInt(b.element.css("width"),10),height:parseInt(b.element.css("height"),10),top:parseInt(b.element.css("top"),10),left:parseInt(b.element.css("left"),10)};f&&f.length&&e(f[0]).css({width:c.width,height:c.height});b._updateCache(c);b._propagate("resize",
a)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var a,b,d,f,c,g=e(this).resizable("instance"),h=g.element;d=g.options.containment;if(h=d instanceof e?d.get(0):/parent/.test(d)?h.parent().get(0):d)g.containerElement=e(h),/document/.test(d)||d===document?(g.containerOffset={left:0,top:0},g.containerPosition={left:0,top:0},g.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(a=e(h),b=[],e(["Top",
"Right","Left","Bottom"]).each(function(c,d){b[c]=g._num(a.css("padding"+d))}),g.containerOffset=a.offset(),g.containerPosition=a.position(),g.containerSize={height:a.innerHeight()-b[3],width:a.innerWidth()-b[1]},d=g.containerOffset,f=g.containerSize.height,c=g.containerSize.width,c=g._hasScroll(h,"left")?h.scrollWidth:c,f=g._hasScroll(h)?h.scrollHeight:f,g.parentData={element:h,left:d.left,top:d.top,width:c,height:f})},resize:function(a){var b,d,f,c=e(this).resizable("instance");b=c.options;d=c.containerOffset;
f=c.position;a=c._aspectRatio||a.shiftKey;var g={top:0,left:0},h=c.containerElement,k=!0;h[0]!==document&&/static/.test(h.css("position"))&&(g=d);f.left<(c._helper?d.left:0)&&(c.size.width+=c._helper?c.position.left-d.left:c.position.left-g.left,a&&(c.size.height=c.size.width/c.aspectRatio,k=!1),c.position.left=b.helper?d.left:0);f.top<(c._helper?d.top:0)&&(c.size.height+=c._helper?c.position.top-d.top:c.position.top,a&&(c.size.width=c.size.height*c.aspectRatio,k=!1),c.position.top=c._helper?d.top:
0);b=c.containerElement.get(0)===c.element.parent().get(0);f=/relative|absolute/.test(c.containerElement.css("position"));b&&f?(c.offset.left=c.parentData.left+c.position.left,c.offset.top=c.parentData.top+c.position.top):(c.offset.left=c.element.offset().left,c.offset.top=c.element.offset().top);b=Math.abs(c.sizeDiff.width+(c._helper?c.offset.left-g.left:c.offset.left-d.left));d=Math.abs(c.sizeDiff.height+(c._helper?c.offset.top-g.top:c.offset.top-d.top));b+c.size.width>=c.parentData.width&&(c.size.width=
c.parentData.width-b,a&&(c.size.height=c.size.width/c.aspectRatio,k=!1));d+c.size.height>=c.parentData.height&&(c.size.height=c.parentData.height-d,a&&(c.size.width=c.size.height*c.aspectRatio,k=!1));k||(c.position.left=c.prevPosition.left,c.position.top=c.prevPosition.top,c.size.width=c.prevSize.width,c.size.height=c.prevSize.height)},stop:function(){var a=e(this).resizable("instance"),b=a.options,d=a.containerOffset,f=a.containerPosition,c=a.containerElement,g=e(a.helper),h=g.offset(),k=g.outerWidth()-
a.sizeDiff.width,g=g.outerHeight()-a.sizeDiff.height;a._helper&&!b.animate&&/relative/.test(c.css("position"))&&e(this).css({left:h.left-f.left-d.left,width:k,height:g});a._helper&&!b.animate&&/static/.test(c.css("position"))&&e(this).css({left:h.left-f.left-d.left,width:k,height:g})}});e.ui.plugin.add("resizable","alsoResize",{start:function(){var a=e(this).resizable("instance").options;e(a.alsoResize).each(function(){var a=e(this);a.data("ui-resizable-alsoresize",{width:parseInt(a.width(),10),height:parseInt(a.height(),
10),left:parseInt(a.css("left"),10),top:parseInt(a.css("top"),10)})})},resize:function(a,b){var d=e(this).resizable("instance"),f=d.originalSize,c=d.originalPosition,g={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-c.top||0,left:d.position.left-c.left||0};e(d.options.alsoResize).each(function(){var a=e(this),c=e(this).data("ui-resizable-alsoresize"),d={},f=a.parents(b.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(f,function(a,
b){var e=(c[b]||0)+(g[b]||0);e&&0<=e&&(d[b]=e||null)});a.css(d)})},stop:function(){e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","ghost",{start:function(){var a=e(this).resizable("instance"),b=a.options,d=a.size;a.ghost=a.originalElement.clone();a.ghost.css({opacity:.25,display:"block",position:"relative",height:d.height,width:d.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"===typeof b.ghost?b.ghost:"");a.ghost.appendTo(a.helper)},resize:function(){var a=
e(this).resizable("instance");a.ghost&&a.ghost.css({position:"relative",height:a.size.height,width:a.size.width})},stop:function(){var a=e(this).resizable("instance");a.ghost&&a.helper&&a.helper.get(0).removeChild(a.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var a,b=e(this).resizable("instance"),d=b.options,f=b.size,c=b.originalSize,g=b.originalPosition,h=b.axis,k="number"===typeof d.grid?[d.grid,d.grid]:d.grid,n=k[0]||1,p=k[1]||1,q=Math.round((f.width-c.width)/n)*n,f=
Math.round((f.height-c.height)/p)*p,l=c.width+q,m=c.height+f,r=d.maxWidth&&d.maxWidth<l,t=d.maxHeight&&d.maxHeight<m,u=d.minWidth&&d.minWidth>l,v=d.minHeight&&d.minHeight>m;d.grid=k;u&&(l+=n);v&&(m+=p);r&&(l-=n);t&&(m-=p);if(/^(se|s|e)$/.test(h))b.size.width=l,b.size.height=m;else if(/^(ne)$/.test(h))b.size.width=l,b.size.height=m,b.position.top=g.top-f;else if(/^(sw)$/.test(h))b.size.width=l,b.size.height=m,b.position.left=g.left-q;else{if(0>=m-p||0>=l-n)a=b._getPaddingPlusBorderDimensions(this);
0<m-p?(b.size.height=m,b.position.top=g.top-f):(m=p-a.height,b.size.height=m,b.position.top=g.top+c.height-m);0<l-n?(b.size.width=l,b.position.left=g.left-q):(l=n-a.width,b.size.width=l,b.position.left=g.left+c.width-l)}}});return e.ui.resizable});