(function(f,j,i){var k=function(){},h=j.Notifier=j.Model.extend({defaults:{baseCls:"notifier",types:["warning","error","info","success"],dialog:!1,theme:"plastic",message:"",closeBtn:!1,title:void 0,hideOnClick:!0,type:null,cls:null,ms:1E4,loader:!1,destroy:!1,modal:!1,opacity:1,offsetY:0,fadeInMs:500,fadeOutMs:500,position:"top",screenOpacity:0.65,zIndex:1E4,width:void 0,modules:void 0},transitions:{top:{"in":function(a,b,c,d,g){a.css({display:"block",top:-1E3});a.css({top:-b.innerHeight()}).animate({top:c.offsetY, opacity:c.opacity},d,g||k)},out:function(a,b,c,d,g){a.animate({top:-b.innerHeight(),opacity:0},d,g||k)}},center:{"in":function(a,b,c,d,g){a.css({top:c.offsetY-40,display:"block"}).animate({top:"50%",marginTop:-b.innerHeight()/2,opacity:c.opacity},d,g||k)},out:function(a,b,c,d,g){a.animate({top:"0%",opacity:0},d,g||k)}},bottom:{"in":function(a,b,c,d,g){a.css({bottom:c.offsetY-40,top:"auto",display:"block"}).animate({bottom:b.innerHeight()+c.offsetY,opacity:c.opacity},d,g||k)},out:function(a,b,c,d, g){a.animate({bottom:-b.height(),opacity:0},d,g||k)}}},template:function(a){var b=['
','
',a.title?'
'+a.title+"
":"",a.closeBtn?'':""];a.dialog?b.push('
'+a.message+(a.loader?'
':"")+"
"):b.push('
'+a.message+"
", a.loader?'
':"");if(a.buttons){var c=f("
");i.each(a.buttons,function(a){c.append(f("
");return b.join("")},initEl:function(){var a=this.el?this.el:"body",a=i.isObject(a)?a:f(a);if(!a.length)return f(f.proxy(this.initEl,this));this.$el=a;this._cssPos=a.get(0)===document.body?"fixed":"absolute";a.get(0)!==document.body&&a.css("position","relative");"absolute"=== this._cssPos&&a.css("overflow","hidden")},initialize:function(a){var b=this;this.el=a&&a.el;this.initEl.call(this,a&&a.el);this.current={};b.NotificationView=j.View.extend({defaults:b.attributes,on:function(a,b){var c=b,d=this;i.isString(b)&&(c=function(){d[b].apply(d,arguments)});return j.View.prototype.on.call(this,a,c)}});var c=function(a){b[a]=b[a]||function(c){i.isString(c)&&(c={message:c});c=i.extend({},{type:""},c);c.type=c.type?a+" "+c.type:a;return b.notify(c)}};i.each(b.attributes.types, function(a){c(a)});if(b.attributes){var d=this.attributes.modules;d&&f.each(d,function(a,b){b.name=i.isArray(d)?b.name:a;h.regModule(b)});b.attributes.modules=void 0}},calcZIndex:function(){if("absolute"===this._cssPos)return this.attributes.zIndex;var a=this.attributes.zIndex+1;i.each(this.current,function(b){a=b.zIndex>a?b.zIndex:a});return++a},destroyAll:function(a,b){var c=0;i.isFunction(a)?i.each(this.current,function(b){a(b)&&(b.destroy.call(b),c++)}):void 0!==a?i.each(this.current,function(d){d.settings[a]=== b&&(d.destroy.call(d),c++)}):i.each(this.current,function(a){a.destroy.call(a);c++});return c},getWrapperCls:function(a){return f.trim(a.baseCls+" "+(a.type?a.type+" ":"")+("theme-"+a.theme+" ")+(a.dialog?"dialog ":"")+("pos-"+a.position+" ")+(a.buttons?"with-buttons ":"")+(a.loader?"with-loader ":"")+(a.closeBtn?"with-close-btn ":"")).split(" ").join(" "+a.baseCls+"-")+" "+(a.cls||"")},getSettings:function(a){i.isString(a)&&(a={message:a});var b=f.extend({},this.attributes,a);b.title&&void 0===a.dialog&& (b.dialog=!0);if((b.modal||b.dialog)&&void 0===a.hideOnClick)b.hideOnClick=!1;b.dialog&&void 0===a.ms&&(b.ms=null);b.dialog&&void 0===a.position&&(b.position="center");return b},notify:function(a){a=a||{};a.el&&(this.el=a&&a.el,this.initEl.call(this,a&&a.el));var b=this,c=this.getSettings(a);i.isObject(c.destroy)?c.destroy instanceof b.NotificationView?c.destroy.destroy():b.destroyAll.apply(b,i.isArray(c.destroy)?c.destroy:[c.destroy]):!0===c.destroy&&b.destroyAll();a=a.zIndex||b.calcZIndex.call(b); c.wrapperCls=b.getWrapperCls(c);c.innerCls=c.baseCls+"-inner";var d=f(b.template(c)),g=d.find("."+c.innerCls);c.width&&g.css({width:c.width});h._modulesBinder.trigger("beforeAppendMsgEl",b,c,d,g);d.css({display:"none",opacity:0,position:b._cssPos,zIndex:c.modal?++a:a}).prependTo(b.$el);var e=new b.NotificationView({el:d});e.settings=c;if(c.buttons||g.find("button").length)g.on("click","button[data-handler]",function(){var a=f(this).data("handler");(i.isFunction(a)?a:e[a]).apply(e,arguments)}),g.on("button click", function(a){e.trigger("click:"+f(a.target).data("role"))});var k=e.destroy=function(a){if(i.isObject(a)&&a.preventDefault){a.preventDefault();a.stopPropagation()}e.trigger("beforeHide",e,d);c.modal&&e.screenEl.fadeOut(300,function(){e.trigger("screenHide",e,d);e.screenEl.remove()});h._modulesBinder.trigger("beforeHideMsgEl",b,c,d,g,e);(f.isFunction(c.out)?c.out:b.transitions[c.position].out).call(b,d,g,c,c.fadeOutMs,function(){e.remove();e.trigger("destroy",e,d);h._modulesBinder.trigger("afterDestroyMsgEl", b,c,d,g,e);i.isFunction(a)&&a.call(e,e,d)});e.timeoutId&&clearTimeout(e.timeoutId);delete e.timeoutId;delete b.current[e.cid]},j=function(a){if(a){a.preventDefault();a.stopPropagation()}};c.modal&&(e.screenEl=f("
",{"class":c.baseCls+"-screen "+c.baseCls+"-theme-"+c.theme,css:{position:b._cssPos,top:0,left:0,width:"100%",height:"100%",opacity:0,zIndex:a-1}}).prependTo(b.$el).click(function(a){a.preventDefault();a.stopPropagation();return false}).fadeTo(300,c.screenOpacity));if(0