(function(){var l={warning:"z-icon-exclamation-circle",info:"z-icon-info-circle",error:"z-icon-times-circle"},m={u:"up",d:"down",l:"left",r:"right"};zul.wgt.Notification=zk.$extends(zul.wgt.Popup,{_keepVisible:!0,$init:function(a,b,c){this.$supers(zul.wgt.Notification,"$init",arguments);this.parent=a;this._msg=b;this._type=c.type;this._ref=c.ref;this._dur=c.dur;this._closable=c.closable},redraw:function(a){var b=this.uuid,c=this.$s("icon");a.push("<div",this.domAttrs_(),">");this._ref&&a.push('<div id="',
b,'-p" class="',this.$s("pointer"),'"></div>');a.push('<i id="',b,'-icon" class="',c," ",l[this._type],'"></i>');a.push('<div id="',b,'-cave" class="',this.$s("content"),'">',this._msg,"</div>");this._closable&&a.push('<div id="',b,'-cls" class="',this.$s("close"),'"><i id="',b,'-clsIcon" class="',c,' z-icon-times"></i></div>');a.push("</div>")},domClass_:function(a){var b=this._type,c=this.$supers(zul.wgt.Notification,"domClass_",arguments);b&&(c+=" "+this.$s(zUtl.encodeXML(b)));return c},doClick_:function(a){var b=
a.domTarget;b==this.$n("cls")||b==this.$n("clsIcon")?this.close():this.$supers("doClick_",arguments)},onFloatUp:function(a,b){if((!b||!b.triggerByFocus)&&this.isVisible()){a=a.origin;for(var c;a;a=a.parent){if(a==this){c||this.setTopmost();return}if(a==this.parent&&a.ignoreDescendantFloatUp_(this))return;c=c||a.isFloating_()}!this._closable&&0>=this._dur&&this.close({sendOnOpen:!0})}},open:function(a,b,c,d){this.$supers(zul.wgt.Notification,"open",arguments);this._fixarrow(a);zk(this).redoCSS(-1,
{fixFontIcon:!0})},position:function(a,b,c,d){if(!a||a.$n())this.$supers(zul.wgt.Notification,"position",arguments),this._fixarrow(a)},_posInfo:function(a,b,c,d){this._fixPadding(c);return this.$supers(zul.wgt.Notification,"_posInfo",arguments)},_fixPadding:function(a){var b=this.$n("p");if(b){var c=this.$n(),d=2+zk(b).borderWidth()/2||0;b=2+zk(b).borderHeight()/2||0;c.style.padding="0";switch(a){case "before_start":case "before_center":case "before_end":this._dir="d";c.style.paddingBottom=b+"px";
break;case "after_start":case "after_center":case "after_end":this._dir="u";c.style.paddingTop=b+"px";break;case "end_before":case "end_center":case "end_after":this._dir="l";c.style.paddingLeft=d+"px";break;case "start_before":case "start_center":case "start_after":this._dir="r";c.style.paddingRight=d+"px";break;case "top_left":case "top_center":case "top_right":case "middle_left":case "middle_center":case "middle_right":case "bottom_left":case "bottom_center":case "bottom_right":case "overlap":case "overlap_end":case "overlap_before":case "overlap_after":this._dir=
"n";break;default:this._dir="n"}}},_fixarrow:function(a){var b=this.$n("p");if(b){var c=this.$s("pointer"),d=this.$n();a=a.$n();var f=this._dir;var e=zk(b);var h=e.borderWidth(),k=e.borderHeight(),g=zk(d).revisedOffset(),n=zk(a).revisedOffset(),l=(a.offsetWidth-h)/2,p=(a.offsetHeight-k)/2;"n"!=f?("u"==f||"d"==f?(e="u"==f,h=(d.offsetWidth-h)/2||0,g=n[0]-g[0]+l||0,b.style.left=(a.offsetWidth>=d.offsetWidth?h:g)+"px",b.style[e?"top":"bottom"]=(2-k/2||0)+"px",b.style[e?"bottom":"top"]=""):(e="l"==f,k=
(d.offsetHeight-k)/2||0,g=n[1]-g[1]+p||0,b.style.top=(a.offsetHeight>=d.offsetHeight?k:g)+"px",b.style[e?"left":"right"]=(2-h/2||0)+"px",b.style[e?"right":"left"]=""),b.className=c+(m[f]?" "+this.$s(m[f]):""),jq(b).show()):(b.className=c,jq(b).hide())}},openAnima_:function(a,b,c,d){var f=this;jq(this.$n()).fadeIn(500,function(){f.afterOpenAnima_(a,b,c,d)})},closeAnima_:function(a){var b=this;jq(this.$n()).fadeOut(500,function(){b.afterCloseAnima_(a)})},afterCloseAnima_:function(a){a&&a.keepVisible?
(this.setVisible(!1),this.setFloating_(!1),a.sendOnOpen&&this.fire("onOpen",{open:!1})):this.detach()},getPositionArgs_:function(){return[this._fakeParent,null,this._nftPos,null]},reposition:function(){this.$supers("reposition",arguments);this._ref&&this._fixarrow(this._ref)}},{show:function(a,b,c){c||(c={});b=c.ref;var d=c.pos,f=c.dur,e=new zul.wgt.Notification(b,a,c);a=c.off;c=!0;b&&(c=b.$n("real")||b.$n(),c=zk(c).isRealScrollIntoView());c&&(d||a||(d=b?"end_center":"middle_center"),jq(document.body).append(e),
e._nftPos=d,e.open(b,a,d),0<f&&setTimeout(function(){e.desktop&&e.close()},f))}})})();
