"],_default:[0,"",""]};bt.optgroup=bt.option,bt.tbody=bt.tfoot=bt.colgroup=bt.caption=bt.thead,bt.th=bt.td;function wt(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?w.merge([e],n):n}function Tt(e,t){for(var n=0,r=e.length;r>n;n++)Z.set(e[n],"globalEval",!t||Z.get(t[n],"globalEval"))}var Ct=/<|?\w+;/;function Et(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;h>d;d++)if(o=e[d],o||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(Ct.test(o)){a=a||f.appendChild(t.createElement("div")),s=(yt.exec(o)||["",""])[1].toLowerCase(),u=bt[s]||bt._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),a=f.firstChild,a.textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=lt(o),a=wt(f.appendChild(o),"script"),l&&Tt(a),n){c=0;while(o=a[c++])xt.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment(),t=e.appendChild(r.createElement("div")),n=r.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),h.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",h.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var kt=/^key/,St=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Nt=/^([^.]*)(?:\.(.+)|)/;function At(){return!0}function Dt(){return!1}function jt(e,t){return e===qt()==("focus"===t)}function qt(){try{return r.activeElement}catch(e){}}function Lt(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)Lt(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=Dt;else if(!i)return e;return 1===o&&(a=i,i=function(e){return w().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,m=Z.get(e);if(m){n.handler&&(o=n,n=o.handler,i=o.selector),i&&w.find.matchesSelector(ut,i),n.guid||(n.guid=w.guid++),(u=m.events)||(u=m.events={}),(a=m.handle)||(a=m.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(M)||[""],l=t.length;while(l--)s=Nt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||(p=u[d]=[],p.delegateCount=0,f.setup&&f.setup.call(e,r,h,a)!==!1||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,m=Z.hasData(e)&&Z.get(e);if(m&&(u=m.events)){t=(t||"").match(M)||[""],l=t.length;while(l--)if(s=Nt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},d=(r?f.delegateType:f.bindType)||d,p=u[d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&f.teardown.call(e,h,m.handle)!==!1||w.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&Z.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(Z.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||l.disabled!==!0)){for(o=[],a={},n=0;u>n;n++)r=t[n],i=r.selector+" ",void 0===a[i]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Pt=/');}});},setTriState:function(value,$checkbox){switch(value){case('1'):$checkbox.prop('checked',true).prop('indeterminate',false);break;case('0'):$checkbox.prop('checked',false).prop('indeterminate',false);break;case('unchanged'):$checkbox.prop('checked',false).prop('indeterminate',true);break;}},toggleMobileMenu:function(e){var $sidebar=$('#sidebar');var $target=$(e.target);var href=$target.attr('href');if(href){if(href!=='#'){$sidebar.removeClass('expanded');}}else if(!$target.is('input')){$sidebar.toggleClass('expanded');}},closeMobileMenu:function(e){var $search=$('#search');if(e.which===13&&$search.is(':focus')){$('#sidebar').removeClass('expanded');$search[0].blur();}},initializeControls:function(container){var $container=$(container);if($container.parent('.dashboard').length||$('#layout').hasClass('fullscreen-layout')){return;}
$container.find('.controls').each(function(){var $controls=$(this);if(!$controls.prev('.fake-controls').length){var $tabs=$controls.find('.tabs',$controls);if($tabs.length&&$controls.children().length>1&&!$tabs.next('.tabs-spacer').length){$tabs.after($(''));}
var $fakeControls=$('');$fakeControls.height($controls.height()).css({float:'right'});$controls.before($fakeControls).css({position:'fixed'});}});this.fixControls($container);},fixControls:function($container){var $layout=$('#layout');if($layout.hasClass('fullscreen-layout')){return;}
if(typeof $container==='undefined'){var $header=$('#header');var $headerLogo=$('#header-logo-container');var $main=$('#main');var $search=$('#search');var $sidebar=$('#sidebar');$header.css({height:'auto'});if($layout.hasClass('minimal-layout')){if(!this.mobileMenu&&$sidebar.length){$header.css({top:$sidebar.outerHeight()+'px'});$headerLogo.css({display:'none'});$main.css({top:$header.outerHeight()+$sidebar.outerHeight()});$sidebar.on('click',this.toggleMobileMenu).prepend($(''));$('#header-logo').clone().attr('id','mobile-menu-logo').appendTo('#mobile-menu-toggle');$(window).on('keypress',this.closeMobileMenu);this.mobileMenu=true;}}else{$headerLogo.css({top:$header.css('height')});$main.css({top:$header.css('height')});if(!!$headerLogo.length){$sidebar.css({top:$headerLogo.offset().top+$headerLogo.outerHeight()});}
if(this.mobileMenu){$header.css({top:0});$headerLogo.css({display:'block'});$sidebar.removeClass('expanded').off('click',this.toggleMobileMenu);$search.off('keypress',this.closeMobileMenu);$('#mobile-menu-toggle').remove();this.mobileMenu=false;}}
var _this=this;$('.container').each(function(){_this.fixControls($(this));});return;}
if($container.parent('.dashboard').length){return;}
$container.find('.controls').each(function(){var $controls=$(this);var $fakeControls=$controls.prev('.fake-controls');$fakeControls.css({float:'',height:$controls.height()});$controls.css({top:$container.offsetParent().position().top,width:$fakeControls.outerWidth()});});var $statusBar=$container.children('.monitoring-statusbar');if($statusBar.length){$statusBar.css({left:$container.offset().left,width:$container.width()});$statusBar.prev('.monitoring-statusbar-ghost').height($statusBar.outerHeight(true));}},toggleFullscreen:function(){$('#layout').toggleClass('fullscreen-layout');this.fixControls();},getUniqueContainerId:function($cont){if(typeof $cont==='undefined'||!$cont.length){return null;}
var containerId=$cont.data('icingaContainerId');if(typeof containerId==='undefined'){if($cont.attr('id')==='menu'||$cont.attr('id')==='col1'){return null;}
containerId=this.icinga.utils.generateId(6);$cont.data('icingaContainerId',containerId);}
return containerId;},getWindowId:function(){if(!this.hasWindowId()){return undefined;}
return window.name.match(/^Icinga-([a-zA-Z0-9]+)$/)[1];},hasWindowId:function(){var res=window.name.match(/^Icinga-([a-zA-Z0-9]+)$/);return typeof res==='object'&&null!==res;},setWindowId:function(id){this.icinga.logger.debug('Setting new window id',id);window.name='Icinga-'+id;},destroy:function(){this.icinga=null;this.debugTimer=null;this.timeCounterTimer=null;}};}(Icinga,jQuery));(function(Icinga,$){'use strict';Icinga.Timer=function(icinga){this.icinga=icinga;this.ticker=null;this.interval=250;this.observers=[];this.stepCounter=0;this.start=(new Date()).getTime();this.lastRuntime=[];this.isRunning=false;};Icinga.Timer.prototype={initialize:function(){this.isRunning=true;var _this=this;var f=function(){if(_this.isRunning){_this.tick();setTimeout(f,_this.interval);}};f();},tick:function(){var icinga=this.icinga;$.each(this.observers,function(idx,observer){if(observer.isDue()){observer.run();}else{}});icinga=null;},register:function(callback,scope,interval){var observer;try{if(typeof scope==='undefined'){observer=new Icinga.Timer.Interval(callback,interval);}else{observer=new Icinga.Timer.Interval(callback.bind(scope),interval);}
this.observers.push(observer);}catch(err){this.icinga.logger.error(err);}
return observer;},unregister:function(observer){var idx=$.inArray(observer,this.observers);if(idx>-1){this.observers.splice(idx,1);}
return this;},destroy:function(){this.isRunning=false;this.icinga=null;$.each(this.observers,function(idx,observer){observer.destroy();});this.observers=[];}};Icinga.Timer.Interval=function(callback,interval){if('undefined'===typeof interval){throw'Timer interval is required';}
if(interval<100){throw'Timer interval cannot be less than 100ms, got '+interval;}
this.lastRun=(new Date()).getTime();this.interval=interval;this.scheduledNextRun=this.lastRun+interval;this.callback=callback;};Icinga.Timer.Interval.prototype={isDue:function(){return this.scheduledNextRun<(new Date()).getTime();},run:function(){this.lastRun=(new Date()).getTime();while(this.scheduledNextRun0;},autorefresh:function(){var _this=this;$('.container').filter(this.filterAutorefreshingContainers).each(function(idx,el){var $el=$(el);var id=$el.attr('id');if(id!=='application-state'&&(!_this.autorefreshEnabled||_this.autorefreshSuspended)){return true;}
if(typeof _this.requests[id]!=='undefined'){_this.icinga.logger.debug('No refresh, request pending for ',id);return;}
var interval=$el.data('icingaRefresh');var lastUpdate=$el.data('lastUpdate');if(typeof interval==='undefined'||!interval){_this.icinga.logger.info('No interval, setting default',id);interval=10;}
if(typeof lastUpdate==='undefined'||!lastUpdate){_this.icinga.logger.info('No lastUpdate, setting one',id);$el.data('lastUpdate',(new Date()).getTime());return;}
interval=interval*1000;if((lastUpdate+interval)>(new Date()).getTime()){return;}
if(_this.loadUrl($el.data('icingaUrl'),$el,undefined,undefined,undefined,true)===false){_this.icinga.logger.debug('NOT autorefreshing '+id+', even if '+interval+' ms passed. Request pending?');}else{_this.icinga.logger.debug('Autorefreshing '+id+' '+interval+' ms passed');}
el=null;});},disableAutorefresh:function(){this.autorefreshEnabled=false;},enableAutorefresh:function(){this.autorefreshEnabled=true;},processNotificationHeader:function(req){var header=req.getResponseHeader('X-Icinga-Notification');var _this=this;if(!header)return false;var list=header.split('&');$.each(list,function(idx,el){var parts=decodeURIComponent(el).split(' ');_this.createNotice(parts.shift(),parts.join(' '));});return true;},addUrlFlag:function(url,flag){if(url.match(/\?/)){return url+'&'+flag;}else{return url+'?'+flag;}},processRedirectHeader:function(req){var icinga=this.icinga,redirect=req.getResponseHeader('X-Icinga-Redirect');if(!redirect){return false;}
redirect=decodeURIComponent(redirect);if(redirect.match(/__SELF__/)){if(req.autorefresh){redirect=redirect.replace(/__SELF__/,encodeURIComponent(document.location.pathname+document.location.search+document.location.hash));}else{redirect=redirect.replace(/__SELF__/,req.url);}}
var useHttp=req.getResponseHeader('X-Icinga-Redirect-Http');if(useHttp==='yes'){window.location.replace(redirect);return true;}
this.redirectToUrl(redirect,req.$target,req);return true;},redirectToUrl:function(url,$target,referrer){var icinga=this.icinga,rerenderLayout,autoRefreshInterval,forceFocus,origin;if(typeof referrer!=='undefined'){rerenderLayout=referrer.getResponseHeader('X-Icinga-Rerender-Layout');autoRefreshInterval=referrer.autoRefreshInterval;forceFocus=referrer.forceFocus;origin=referrer.url;}
icinga.logger.debug('Got redirect for ',$target,', URL was '+url);if(rerenderLayout){var parts=url.split(/#!/);url=parts.shift();var redirectionUrl=this.addUrlFlag(url,'renderLayout');var r=this.loadUrl(redirectionUrl,$('#layout'));r.historyUrl=url;if(parts.length){r.loadNext=parts;}else if(!!document.location.hash){parts=document.location.hash.split('#!').splice(1);if(parts.length){r.loadNext=$.grep(parts,function(url){if(url!==origin){icinga.logger.debug('Retaining detail url '+url);return true;}
icinga.logger.debug('Discarding detail url '+url+' as it\'s the origin of the redirect');return false;});}}}else{if(url.match(/#!/)){var parts=url.split(/#!/);icinga.ui.layout2col();this.loadUrl(parts.shift(),$('#col1'));this.loadUrl(parts.shift(),$('#col2'));}else{if($target.attr('id')==='col2'){if($('#col1').data('icingaUrl').split('?')[0]===url.split('?')[0]){icinga.ui.layout1col();$target=$('#col1');delete(this.requests['col2']);}}
var req=this.loadUrl(url,$target);req.forceFocus=url===origin?forceFocus:null;req.autoRefreshInterval=autoRefreshInterval;req.referrer=referrer;}}},cacheLoadedIcons:function($container){return;var _this=this;$('img.icon',$container).each(function(idx,img){var src=$(img).attr('src');if(typeof _this.iconCache[src]!=='undefined'){return;}
var cache=new Image();cache.src=src
_this.iconCache[src]=cache;});},onResponse:function(data,textStatus,req){var _this=this;if(this.failureNotice!==null){if(!this.failureNotice.hasClass('fading-out')){this.failureNotice.remove();}
this.failureNotice=null;}
this.icinga.logger.debug('Got response for ',req.$target,', URL was '+req.url);this.processNotificationHeader(req);var cssreload=req.getResponseHeader('X-Icinga-Reload-Css');if(cssreload){this.icinga.ui.reloadCss();}
if(req.getResponseHeader('X-Icinga-Redirect')){return;}
if(req.getResponseHeader('X-Icinga-Announcements')==='refresh'){_this.loadUrl(_this.url('/layout/announcements'),$('#announcements'));}
var $resp=$('
'+req.responseText+'
');var active=false;var rendered=false;var classes;if(req.autorefresh){active=$('[href].active',req.$target).attr('href');}
var target=req.getResponseHeader('X-Icinga-Container');var newBody=false;var oldNotifications=false;if(target){if(target==='ignore'){return;}
delete this.requests[req.$target.attr('id')];req.$target=$('#'+target);if(target==='layout'){oldNotifications=$('#notifications li').detach();}
this.icinga.ui.layout1col();newBody=true;}
if(target!=='layout'){var moduleName=req.getResponseHeader('X-Icinga-Module');classes=$.grep(req.$target.classes(),function(el){if(el==='icinga-module'||el.match(/^module\-/)){return false;}
return true;});if(moduleName){req.$target.data('icingaModule',moduleName);classes.push('icinga-module');classes.push('module-'+moduleName);}else{req.$target.removeData('icingaModule');if(req.$target.attr('data-icinga-module')){req.$target.removeAttr('data-icinga-module');}}
req.$target.attr('class',classes.join(' '));var refresh=req.autoRefreshInterval||req.getResponseHeader('X-Icinga-Refresh');if(refresh){req.$target.data('icingaRefresh',refresh);}else{req.$target.removeData('icingaRefresh');if(req.$target.attr('data-icinga-refresh')){req.$target.removeAttr('data-icinga-refresh');}}}
var title=req.getResponseHeader('X-Icinga-Title');if(title&&(target==='layout'||req.$target.is('#layout'))){this.icinga.ui.setTitle(decodeURIComponent(title));}else if(title&&!req.autorefresh&&req.$target.closest('.dashboard').length===0){req.$target.data('icingaTitle',decodeURIComponent(title));}
var windowId=req.getResponseHeader('X-Icinga-WindowId');if(windowId){this.icinga.ui.setWindowId(windowId);}
if(req.url.match(/^\/search/)&&req.$target.data('icingaUrl').match(/^\/search/)&&$('.dashboard',$resp).length>0&&$('.dashboard .container',req.$target).length>0){var targets=[];$('.dashboard .container',req.$target).each(function(idx,el){targets.push($(el));});var i=0;$('.dashboard .container',$resp).each(function(idx,el){var $el=$(el);if($el.hasClass('dashboard')){return;}
var url=$el.data('icingaUrl');targets[i].data('icingaUrl',url);var title=$('h1',$el).first();$('h1',targets[i]).first().replaceWith(title);_this.loadUrl(url,targets[i]);i++;});rendered=true;}
var referrer=req.referrer;if(typeof referrer==='undefined'){referrer=req;}
var autoSubmit=false;if(referrer.method==='POST'){var newUrl=this.icinga.utils.parseUrl(req.url);var currentUrl=this.icinga.utils.parseUrl(req.$target.data('icingaUrl'));if(newUrl.path===currentUrl.path&&this.icinga.utils.objectsEqual(newUrl.params,currentUrl.params)){autoSubmit=true;}}
req.$target.data('icingaUrl',req.url);this.icinga.ui.initializeTriStates($resp);if(rendered){return;}
if(typeof req.progressTimer!=='undefined'){this.icinga.timer.unregister(req.progressTimer);}
this.renderContentToContainer($resp.html(),req.$target,req.action,req.autorefresh,req.forceFocus,autoSubmit);if(oldNotifications){oldNotifications.appendTo($('#notifications'));}
if(newBody){this.icinga.ui.fixDebugVisibility().triggerWindowResize();}
_this.cacheLoadedIcons(req.$target);},onComplete:function(dataOrReq,textStatus,reqOrError){var req;if(typeof dataOrReq==='object'){req=dataOrReq;}else{req=reqOrError;}
if(req.$target.hasClass('impact')){req.$target.removeClass('impact');}
if(!req.autorefresh){var url=req.url;if(req.$target[0].id==='col1'){this.icinga.behaviors.navigation.trySetActiveAndSelectedByUrl(url);}
var $forms=$('[action="'+this.icinga.utils.parseUrl(url).path+'"]');var $matches=$.merge($('[href="'+url+'"]'),$forms);$matches.each(function(idx,el){var $el=$(el);if($el.closest('#menu').length){if($el.is('form')){$('input',$el).addClass('active');}
return false;}});}
if(!req.autorefresh&&req.addToHistory){if(req.$target.hasClass('container')){if(req.$target.parent().closest('.container').length===0){this.icinga.history.pushCurrentState();}}else{var url=typeof req.historyUrl!=='undefined'?req.historyUrl:req.url;this.icinga.history.pushUrl(url);}}
req.$target.data('lastUpdate',(new Date()).getTime());delete this.requests[req.$target.attr('id')];this.icinga.ui.fadeNotificationsAway();if(this.processRedirectHeader(req)){return;}
if(typeof req.loadNext!=='undefined'&&req.loadNext.length){if($('#col2').length){var r=this.loadUrl(req.loadNext[0],$('#col2'));r.addToHistory=req.addToHistory;this.icinga.ui.layout2col();}else{this.icinga.logger.error('Failed to load URL for #col2',req.loadNext);}}
req.$target.trigger('rendered');this.icinga.ui.refreshDebug();},onFailure:function(req,textStatus,errorThrown){var url=req.url;if(req.addToHistory&&!req.autorefresh){req.$target.data('icingaRefresh',0);req.$target.data('icingaUrl',url);icinga.history.pushCurrentState();}
if(typeof req.progressTimer!=='undefined'){this.icinga.timer.unregister(req.progressTimer);}
if(req.status>0){this.icinga.logger.error(req.status,errorThrown+':',$(req.responseText).text().replace(/\s+/g,' ').slice(0,100));this.renderContentToContainer(req.responseText,req.$target,req.action,req.autorefresh);}else{if(errorThrown==='abort'){this.icinga.logger.debug('Request to '+url+' has been aborted for ',req.$target);req.addToHistory=false;}else{if(this.failureNotice===null){var now=new Date();var padString=this.icinga.utils.padString;this.failureNotice=this.createNotice('error','The connection to the Icinga web server was lost at '
+now.getFullYear()
+'-'+padString(now.getMonth()+1,0,2)
+'-'+padString(now.getDate(),0,2)
+' '+padString(now.getHours(),0,2)
+':'+padString(now.getMinutes(),0,2)
+'.',true);this.icinga.ui.fixControls();}
this.icinga.logger.error('Failed to contact web server loading ',url,' for ',req.$target);}}},createNotice:function(severity,message,persist){var c=severity;if(persist){c+=' persist';}
var $notice=$('