AUI.add("aui-dialog",function(q){var k=q.Lang,I=k.isBoolean,C=k.isArray,N=k.isObject,v="",m="bodyContent",S="boundingBox",W="button",d="buttons",T="close",O="closethick",J="constrain2view",b="container",e="dd",P="default",U="destroyOnClose",x="dialog",y=".",n="draggable",l="dragInstance",h="footerContent",Q="hd",H="height",F="icon",c="icons",t="io",w="loading",B="modal",X="proxy",f="resizable",o="resizableInstance",E="stack",g="width",r="resize:resize",M="resize:end",i=q.ClassNameManager.getClassName,z=i(x),j=i(x,W),D=i(x,W,b),R=i(x,W,P),a=i(x,Q),u=i(F,w),p=i(e),G=document.createTextNode(""),K='<button class="'+j+'"></button>',V='<div class="'+D+'"></div>';var s=function(A){if(!q.DialogMask){q.DialogMask=new q.OverlayMask().render();}};q.mix(s,{NAME:x,ATTRS:{bodyContent:{value:G},buttons:{value:[],validator:C},close:{value:true},constrain2view:{value:false,validator:I},destroyOnClose:{value:false,validator:I},draggable:{lazyAdd:true,value:true,setter:function(A){return this._setDraggable(A);}},dragInstance:{value:null},modal:{setter:function(A){return this._setModal(A);},lazyAdd:false,value:false,validator:I},resizable:{setter:function(A){return this._setResizable(A);},value:true},resizableInstance:{value:null},stack:{lazyAdd:true,value:true,setter:function(A){return this._setStack(A);},validator:I}}});s.prototype={initializer:function(Y){var A=this;var Z=A.get(c);var ab=A.get(T);var aa=A.get(d);if(aa&&aa.length&&!A.get(h)){A.set(h,G);}if(ab){var L={icon:O,id:O,handler:{fn:A.close,context:A}};if(Z){Z.push(L);}A.set(c,Z);}A.after("render",A._afterRenderer);},bindUI:function(){var A=this;A._bindLazyComponents();A.publish("close",{defaultFn:A._close});A.on("visibleChange",A._afterSetVisible);},destructor:function(){var A=this;var L=A.get(S);q.Event.purgeElement(L,true);q.DialogManager.remove(A);},_bindLazyComponents:function(){var A=this;var L=A.get(S);L.on("mouseenter",q.bind(A._initLazyComponents,A));},close:function(){var A=this;A.fire("close");},_afterConstrain2viewChange:function(L){var A=this;A._setConstrain2view(L.newVal);},_afterRenderer:function(L){var A=this;A._initButtons();A.get(E);A.get(t);},_close:function(){var A=this;if(A.get(U)){A.destroy();}else{A.hide();}if(A.get(B)){q.DialogMask.hide();}},_initButtons:function(){var A=this;var Y=A.get(d);var L=q.Node.create(V);var Z=q.Node.create(K);q.each(Y,function(ac,ab){var af=Z.clone();if(ac.isDefault){af.addClass(R);}if(ac.handler){var ae=ac.handler;var ad=ae.fn||ae;var aa=ae.context||A;af.on("click",ad,aa);}af.html(ac.text||v);L.append(af);});if(Y.length){A.set(h,L);}},_initLazyComponents:function(){var A=this;if(!A.get(l)&&A.get(n)){A.get(n);}if(!A.get(o)&&A.get(f)){A.get(f);}},_setConstrain2view:function(L){var A=this;var Y=A.get(l);if(Y){if(L){Y.plug(q.Plugin.DDConstrained,{constrain2view:A.get(J)});}else{Y.unplug(q.Plugin.DDConstrained);}}},_setDraggable:function(aa){var A=this;var Y=A.get(S);var Z=function(){var ad=A.get(l);if(ad){ad.destroy();ad.unplug(q.Plugin.DDConstrained);}};q.DD.DDM.CSS_PREFIX=p;if(aa){var ab={node:Y,handles:[y+a]};var L=q.merge(ab,aa||{});if(L.on){q.each(L.on,function(ae,ad){L.on[ad]=q.bind(ae,A);});}Z();var ac=new q.DD.Drag(L);A.set(l,ac);A.after("constrain2viewChange",A._afterConstrain2viewChange,A);A._setConstrain2view(A.get("constrain2view"));}else{Z();}return aa;},_setModal:function(L){var A=this;if(L){q.DialogMask.show();}else{q.DialogMask.hide();}return L;},_setResizable:function(aa){var A=this;var ab=A.get(o);var Z=function(){if(ab){ab.destroy();}};if(aa){var Y=function(ad){var ac=ad.type;var ae=ad.info;if((ac==M)||((ac==r)&&!ad.currentTarget.get(X))){A.set(H,ae.offsetHeight);A.set(g,ae.offsetWidth);}};Z();var L=new q.Resize(q.merge({handles:"r,br,b",minHeight:100,minWidth:200,constrain2view:true,node:A.get(S),proxy:true},aa||{}));L.after("end",Y);L.after("resize",Y);A.set(o,L);return aa;}else{Z();}},_setStack:function(L){var A=this;if(L){q.DialogManager.register(A);}else{q.DialogManager.remove(A);}return L;},_afterSetVisible:function(L){var A=this;if(A.get(B)){if(L.newVal){q.DialogMask.show();}else{q.DialogMask.hide();}}}};q.Dialog=q.Base.build(x,q.Panel,[s,q.WidgetPosition,q.WidgetStack,q.WidgetPositionAlign,q.WidgetPositionConstrain]);q.DialogManager=new q.OverlayManager({zIndexBase:1000});q.mix(q.DialogManager,{findByChild:function(A){return q.Widget.getByNode(q.one(A).ancestor(y+z,true));},closeByChild:function(A){return q.DialogManager.findByChild(A).close();},refreshByChild:function(L){var A=q.DialogManager.findByChild(L);if(A&&A.io){A.io.start();}}});},"1.0.1",{requires:["aui-panel","dd-constrain","aui-button-item","aui-overlay-manager","aui-overlay-mask","aui-io-plugin","aui-resize"],skinnable:true});