text: /*! kibana - v3.1.2 - 2015-03-05
   * Copyright (c) 2015 Rashid Khan; Licensed Apache License */
  
  (function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===o)a._value=0;else{for("."!==m[n].delimiters.decimal&&(b=b.replace(/\./g,"").replace(m[n].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+m[n].abbreviations.thousand+"(?:\\)|(\\"+m[n].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+m[n].abbreviations.million+"(?:\\)|(\\"+m[n].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+m[n].abbreviations.billion+"(?:\\)|(\\"+m[n].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+m[n].abbreviations.trillion+"(?:\\)|(\\"+m[n].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e=b.indexOf("$")<=1?!0:!1,f="";return b.indexOf(" $")>-1?(f=" ",b=b.replace(" $","")):b.indexOf("$ ")>-1?(f=" ",b=b.replace("$ ","")):b=b.replace("$",""),d=i(a._value,b,c),e?d.indexOf("(")>-1||d.indexOf("-")>-1?(d=d.split(""),d.splice(1,0,m[n].currency.symbol+f),d=d.join("")):d=m[n].currency.symbol+f+d:d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,f+m[n].currency.symbol),d=d.join("")):d=d+f+m[n].currency.symbol,d}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d){var e,f,g,h,i,j,k=!1,l=!1,p=!1,q="",r="",s="",t=Math.abs(a),u=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],v="",w=!1;if(0===a&&null!==o)return o;if(c.indexOf("(")>-1?(k=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(l=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1&&(c.indexOf(" a")>-1?(q=" ",c=c.replace(" a","")):c=c.replace("a",""),t>=Math.pow(10,12)?(q+=m[n].abbreviations.trillion,a/=Math.pow(10,12)):t<Math.pow(10,12)&&t>=Math.pow(10,9)?(q+=m[n].abbreviations.billion,a/=Math.pow(10,9)):t<Math.pow(10,9)&&t>=Math.pow(10,6)?(q+=m[n].abbreviations.million,a/=Math.pow(10,6)):t<Math.pow(10,6)&&t>=Math.pow(10,3)&&(q+=m[n].abbreviations.thousand,a/=Math.pow(10,3))),c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(r=" ",c=c.replace(" b","")):c=c.replace("b",""),g=0;g<=u.length;g++)if(e=Math.pow(1024,g),f=Math.pow(1024,g+1),a>=e&&f>a){r+=u[g],e>0&&(a/=e);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(s=" ",c=c.replace(" o","")):c=c.replace("o",""),s+=m[n].ordinal(a)),c.indexOf("[.]")>-1&&(p=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],j=c.indexOf(","),i?(i.indexOf("[")>-1?(i=i.replace("]",""),i=i.split("["),v=b(a,i[0].length+i[1].length,d,i[1].length)):v=b(a,i.length,d),h=v.split(".")[0],v=v.split(".")[1].length?m[n].delimiters.decimal+v.split(".")[1]:"",p&&0===Number(v.slice(1))&&(v="")):h=b(a,null,d),h.indexOf("-")>-1&&(h=h.slice(1),w=!0),j>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m[n].delimiters.thousands)),0===c.indexOf(".")&&(h=""),(k&&w?"(":"")+(!k&&w?"-":"")+(!w&&l?"+":"")+h+v+(s?s:"")+(q?q:"")+(r?r:"")+(k&&w?")":"")}function j(a,b){m[a]=b}var k,l="1.5.2",m={},n="en",o=null,p="0,0",q="undefined"!=typeof module&&module.exports;k=function(b){return k.isNumeral(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=k.fn.unformat(b)),new a(Number(b))},k.version=l,k.isNumeral=function(b){return b instanceof a},k.language=function(a,b){if(!a)return n;if(a&&!b){if(!m[a])throw new Error("Unknown language : "+a);n=a}return(b||!m[a])&&j(a,b),k},k.languageData=function(a){if(!a)return m[n];if(!m[a])throw new Error("Unknown language : "+a);return m[a]},k.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),k.zeroFormat=function(a){o="string"==typeof a?a:null},k.defaultFormat=function(a){p="string"==typeof a?a:"0.0"},k.fn=a.prototype={clone:function(){return k(this)},format:function(a,b){return c(this,a?a:p,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:p)},value:function(){return this._value},valueOf:function(){return this._value},set:function(a){return this._value=Number(a),this},add:function(a){return this._value=this._value+Number(a),this},subtract:function(a){return this._value=this._value-Number(a),this},multiply:function(a){return this._value=this._value*Number(a),this},divide:function(a){return this._value=this._value/Number(a),this},difference:function(a){var b=this._value-Number(a);return 0>b&&(b=-b),b}},q&&(module.exports=k),"undefined"==typeof ender&&(this.numeral=k),"function"==typeof define&&define.amd&&define("numeral",[],function(){return k})}).call(this),define("panels/marvel/stats_table/lib/detectSplitBrain",["require","lodash"],function(a){var b=a("lodash");return function(a){var c={master:null,status:"green",yellow:[],red:[],series:{}},d=null,e=function(a){return a.id};b.each(a.facets,function(a,d){b.each(a.entries,function(a){var e=b.clone(a);e.id=d,b.isArray(c.series[a.time])||(c.series[a.time]=[]),c.series[a.time].push(e)})});var f=b.keys(c.series).sort(),g=b.last(f,2),h=c.series[g[1]];if(c.series[g[0]].length>1&&c.series[g[1]].length>1){var i=g[1]-g[0]===6e4,j=b.map(c.series[g[0]],e),k=b.map(c.series[g[1]],e),l=b.intersection(j,k),m=l.length>1;i&&m&&c.red.push({from:g[0],to:g[1],nodes:l})}return b.each(f,function(a){if(d&&c.series[d].length>1&&c.series[a].length>1){var f=a-d===6e4,g=b.map(c.series[d],e),h=b.map(c.series[a],e),i=b.intersection(g,h),j=i.length>1;if(f&&j){var k=b.find(c.red,{from:d,to:a});k||c.yellow.push({from:d,to:a,nodes:b.map(c.series[a],e)})}}d=a}),0!==c.red.length?c.status="red":0!==c.yellow.length&&(c.status="yellow"),c.master=h.length>1?"red"===c.status?c.red[0].nodes:[b.max(h,function(a){return a.max}).id]:[h[0].id],c}}),define("panels/marvel/stats_table/lib/splitBrainHistogram",["require","lodash","config"],function(a){var b=a("lodash"),c=a("config");return function(a,d,e){return e=b.isUndefined(e)?"node.ip_port":e,function(f,g){var h={query:{filtered:{filter:{range:{"@timestamp":{from:g+"-10m/m",to:g+"/m"}}}}},facets:{}};b.each(f,function(a){h.facets[a]={date_histogram:{key_field:"@timestamp",value_field:"@timestamp",interval:"minute"},facet_filter:{bool:{must:[{term:{}},{term:{"node.master":!0}}]}}},h.facets[a].facet_filter.bool.must[0].term[e]=a});var i=c.elasticsearch+"/"+d.indices.join(",")+"/node_stats/_search?search_type=count";return a.post(i,h).then(function(a){return a.data})}}}),function(a){function b(a,b){return b*Math.floor(a/b)}function c(a,b,c,d){if("function"==typeof a.strftime)return a.strftime(b);var e=function(a,b){return a=""+a,b=""+(null==b?"0":b),1==a.length?b+a:a},f=[],g=!1,h=a.getHours(),i=12>h;null==c&&(c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),null==d&&(d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);var j;j=h>12?h-12:0==h?12:h;for(var k=0;k<b.length;++k){var l=b.charAt(k);if(g){switch(l){case"a":l=""+d[a.getDay()];break;case"b":l=""+c[a.getMonth()];break;case"d":l=e(a.getDate());break;case"e":l=e(a.getDate()," ");break;case"h":case"H":l=e(h);break;case"I":l=e(j);break;case"l":l=e(j," ");break;case"m":l=e(a.getMonth()+1);break;case"M":l=e(a.getMinutes());break;case"q":l=""+(Math.floor(a.getMonth()/3)+1);break;case"S":l=e(a.getSeconds());break;case"y":l=e(a.getFullYear()%100);break;case"Y":l=""+a.getFullYear();break;case"p":l=i?"am":"pm";break;case"P":l=i?"AM":"PM";break;case"w":l=""+a.getDay()}f.push(l),g=!1}else"%"==l?g=!0:f.push(l)}return f.join("")}function d(a){function b(a,b,c,d){a[b]=function(){return c[d].apply(c,arguments)}}var c={date:a};void 0!=a.strftime&&b(c,"strftime",a,"strftime"),b(c,"getTime",a,"getTime"),b(c,"setTime",a,"setTime");for(var d=["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds"],e=0;e<d.length;e++)b(c,"get"+d[e],a,"getUTC"+d[e]),b(c,"set"+d[e],a,"setUTC"+d[e]);return c}function e(a,b){if("browser"==b.timezone)return new Date(a);if(b.timezone&&"utc"!=b.timezone){if("undefined"!=typeof timezoneJS&&"undefined"!=typeof timezoneJS.Date){var c=new timezoneJS.Date;return c.setTimezone(b.timezone),c.setTime(a),c}return d(new Date(a))}return d(new Date(a))}function f(d){d.hooks.processOptions.push(function(d){a.each(d.getAxes(),function(a,d){var f=d.options;"time"==f.mode&&(d.tickGenerator=function(a){var c=[],d=e(a.min,f),g=0,i=f.tickSize&&"quarter"===f.tickSize[1]||f.minTickSize&&"quarter"===f.minTickSize[1]?k:j;null!=f.minTickSize&&(g="number"==typeof f.tickSize?f.tickSize:f.minTickSize[0]*h[f.minTickSize[1]]);for(var l=0;l<i.length-1&&!(a.delta<(i[l][0]*h[i[l][1]]+i[l+1][0]*h[i[l+1][1]])/2&&i[l][0]*h[i[l][1]]>=g);++l);var m=i[l][0],n=i[l][1];if("year"==n){if(null!=f.minTickSize&&"year"==f.minTickSize[1])m=Math.floor(f.minTickSize[0]);else{var o=Math.pow(10,Math.floor(Math.log(a.delta/h.year)/Math.LN10)),p=a.delta/h.year/o;m=1.5>p?1:3>p?2:7.5>p?5:10,m*=o}1>m&&(m=1)}a.tickSize=f.tickSize||[m,n];var q=a.tickSize[0];n=a.tickSize[1];var r=q*h[n];"second"==n?d.setSeconds(b(d.getSeconds(),q)):"minute"==n?d.setMinutes(b(d.getMinutes(),q)):"hour"==n?d.setHours(b(d.getHours(),q)):"month"==n?d.setMonth(b(d.getMonth(),q)):"quarter"==n?d.setMonth(3*b(d.getMonth()/3,q)):"year"==n&&d.setFullYear(b(d.getFullYear(),q)),d.setMilliseconds(0),r>=h.minute&&d.setSeconds(0),r>=h.hour&&d.setMinutes(0),r>=h.day&&d.setHours(0),r>=4*h.day&&d.setDate(1),r>=2*h.month&&d.setMonth(b(d.getMonth(),3)),r>=2*h.quarter&&d.setMonth(b(d.getMonth(),6)),r>=h.year&&d.setMonth(0);var s,t=0,u=Number.NaN;do if(s=u,u=d.getTime(),c.push(u),"month"==n||"quarter"==n)if(1>q){d.setDate(1);var v=d.getTime();d.setMonth(d.getMonth()+("quarter"==n?3:1));var w=d.getTime();d.setTime(u+t*h.hour+(w-v)*q),t=d.getHours(),d.setHours(0)}else d.setMonth(d.getMonth()+q*("quarter"==n?3:1));else"year"==n?d.setFullYear(d.getFullYear()+q):d.setTime(u+r);while(u<a.max&&u!=s);return c},d.tickFormatter=function(a,b){var d=e(a,b.options);if(null!=f.timeformat)return c(d,f.timeformat,f.monthNames,f.dayNames);var g,i=b.options.tickSize&&"quarter"==b.options.tickSize[1]||b.options.minTickSize&&"quarter"==b.options.minTickSize[1],j=b.tickSize[0]*h[b.tickSize[1]],k=b.max-b.min,l=f.twelveHourClock?" %p":"",m=f.twelveHourClock?"%I":"%H";g=j<h.minute?m+":%M:%S"+l:j<h.day?k<2*h.day?m+":%M"+l:"%b %d "+m+":%M"+l:j<h.month?"%b %d":i&&j<h.quarter||!i&&j<h.year?k<h.year?"%b":"%b %Y":i&&j<h.year?k<h.year?"Q%q":"Q%q %Y":"%Y";var n=c(d,g,f.monthNames,f.dayNames);return n})})})}var g={xaxis:{timezone:null,timeformat:null,twelveHourClock:!1,monthNames:null}},h={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,quarter:7776e6,year:525949.2*60*1e3},i=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"]],j=i.concat([[3,"month"],[6,"month"],[1,"year"]]),k=i.concat([[1,"quarter"],[2,"quarter"],[1,"year"]]);a.plot.plugins.push({init:f,options:g,name:"time",version:"1.0"}),a.plot.formatDate=c}(jQuery),define("jquery.flot.time",function(){}),define("lib/ClusterState/popFirstIndexAndReturnEndpoint",[],function(){return function(a){var b=a.shift();return"/"+b+"/cluster_state/_search"}}),define("lib/ClusterState/getState",["require","lib/ClusterState/popFirstIndexAndReturnEndpoint"],function(a){var b=a("lib/ClusterState/popFirstIndexAndReturnEndpoint");return function c(a,d,e){if(0===e.length)throw new Error("Cluster State could not be found");var f=d.elasticsearch+b(e),g={size:1,sort:{"@timestamp":{order:"desc"}}},h=function(b){var f;return 0!==b.data.hits.total?(f=b.data.hits.hits[0]._source,f._id=b.data.hits.hits[0]._id,f._index=b.data.hits.hits[0]._index,f._type=b.data.hits.hits[0]._type,f):c(a,d,e)},i=function(){return c(a,d,e)};return a.post(f,g).then(h,i)}}),define("lib/ClusterState/getIndices",["require","moment"],function(a){var b=a("moment");return function(a,c){var d=b.utc(),e=b.utc().subtract(c.current.index.interval,3),f=c.current.index.interval,g=c.current.index.pattern;return a.indices(e,d,g,f)}}),define("lib/ClusterState/refreshState",[],function(){return function(a,b,c){return c().then(function(c){var d=function(b){return b&&b["@timestamp"]!==a.version&&(a.state=b,a.version=b["@timestamp"],a.$emit("update",b)),b},e=function(b){return a.$emit("error",b),b};return b(c).then(d,e)})}}),define("lib/ClusterState/filterShards",["require","lodash"],function(a){var b=a("lodash");return function(a,c,d){return d=b.isUndefined(d)?!1:d,function(e){var f="INITIALIZING"===e.state&&!b.isEmpty(e.relocating_node);return e.state===a&&e.primary===c&&(d||!f)}}}),define("lib/ClusterState/incrementIndexShardStatusCount",[],function(){return function(a){return function(b,c){return b[c.index]||(b[c.index]={}),b[c.index][a]?b[c.index][a]+=1:b[c.index][a]=1,b}}}),define("lib/extractShards",["require","lodash"],function(a){var b=a("lodash"),c=function(a){function c(b){var c=a.nodes[b.node];return b.nodeName=c&&c.name||null,b.type="shard","INITIALIZING"===b.state&&b.relocating_node&&(b.relocating_message="Relocating from "+a.nodes[b.relocating_node].name),"RELOCATING"===b.state&&(b.relocating_message="Relocating to "+a.nodes[b.relocating_node].name),b}if(!a)return[];var d=function(a){e.push(c(a))},e=[];return b.each(a.routing_nodes.nodes,function(a){b.each(a,d)}),b.each(a.routing_nodes.unassigned,d),e},d=function(a){return a&&a._id};return b.memoize(c,d)}),define("lib/ClusterState/groupIndicesByState",["require","lodash","./filterShards","./incrementIndexShardStatusCount","lib/extractShards"],function(a){var b=a("lodash"),c=a("./filterShards"),d=a("./incrementIndexShardStatusCount"),e=a("lib/extractShards"),f=function(a,e,f,g,h){var i="red"===f;return h=h||{},b.chain(a).filter(function(a){return b.isUndefined(h[a.index])}).filter(c(g.toUpperCase(),i)).reduce(d(g.toLowerCase()),e[f]).value()};return function(a){var c=e(a.state),d={red:{},yellow:{},green:{}},g=b.partial(f,c,d);d.red=g("red","UNASSIGNED"),d.red=g("red","INITIALIZING"),d.yellow=g("yellow","UNASSIGNED",d.red),d.yellow=g("yellow","INITIALIZING",d.red);var h=b.merge({},d.red,d.yellow);return d.green=g("green","STARTED",h),d}}),define("lib/ClusterState/explainStatus",["require","./groupIndicesByState","lodash"],function(a){var b=a("./groupIndicesByState"),c=a("lodash"),d=function(a,b,d){var e=c.templateSettings;c.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};var f="",g={status:a,index:b,counts:d};return g.type="red"===a?{single:"primary",multi:"primaries"}:{single:"replica",multi:"replicas"},f+="<%- index %> has ",f+=d.unassigned?1===d.unassigned?"an unassigned <%- type.single %>":"<%= counts.unassigned %> unassigned <%- type.multi %>":1===d.initializing?"an initializing <%- type.single %>":"<%= counts.initializing %> initializing <%- type.multi %>",f=c.template(f,g),c.templateSettings=e,f},e=function(a){return function(b){return a===b}},f=function(a){return[/^\./.test(a),a]};return function(a,g,h){h||(h=b(a));var i=c(h.yellow).keys().sortBy(f).value(),j=c(h.red).keys().sortBy(f).value();c.isUndefined(g)||(j=c.filter(j,e(g)),i=c.filter(i,e(g))),i=c.difference(i,j);var k=[];return c.each(j,function(a){k.push(d("red",a,h.red[a]))}),c.each(i,function(a){k.push(d("yellow",a,h.yellow[a]))}),k}}),define("services/../../../common/PhoneHome",["require","lodash","jquery"],function(a){function b(a){this._id=a._id||"marvelOpts",this._type=a._type||"appdata",this.client=a.client||d,this.baseUrl=a.baseUrl,this.index=a.index,this.attributes=c.defaults({},e),this.events={},this.currentBaseUrl=this.baseUrl,this.fieldsToES=["registrationData","status","version","report"],this.fieldsToBrowser=["trialTimestamp","lastReport","registrationSent","report","status"];var b=this;this.on("change:data",function(a){b.sendIfDue(a),b.checkAndSendRegistrationData()})}var c=a("lodash"),d=a("jquery"),e={report:!0,status:"trial"};return b.prototype={on:function(a,b){c.isArray(this.events[a])||(this.events[a]=[]),this.events[a].push(b)},clear:function(a){delete this.events[a]},trigger:function(){var a=Array.prototype.slice.call(arguments),b=a.shift();this.events[b]&&c.each(this.events[b],function(b){b.apply(null,a)})},setBaseUrl:function(a){this.baseUrl=a},set:function(a,b){var d,e=this;"object"==typeof a?(d=c.pick(this.attributes,c.keys(a)),this.attributes=c.assign(this.attributes,a),c.each(a,function(a,b){e.trigger("change:"+b,a,d[b])})):(d=this.attributes[a],this.attributes[a]=b,this.trigger("change:"+a,b,d))},get:function(a){return c.isUndefined(a)?this.attributes:this.attributes[a]},setTrialTimestamp:function(a){this.set("trialTimestamp",a),this.saveToBrowser()},saveToES:function(){var a=c.pick(this.attributes,this.fieldsToES),b=this.baseUrl+"/"+this.index+"/"+this._type+"/"+this._id;return this.client.put(b,a)},saveToBrowser:function(){var a=c.pick(this.attributes,this.fieldsToBrowser);localStorage.setItem(this._id,JSON.stringify(a))},saveAll:function(){return this.saveToBrowser(),this.saveToES()},destroy:function(){var a=this.baseUrl+"/"+this.index+"/"+this._type+"/"+this._id;return localStorage.removeItem(this._id),this.client["delete"](a)},checkReportStatus:function(){var a=864e5,b=!1,d=!c.isEmpty(this.currentBaseUrl)&&this.currentBaseUrl!==this.baseUrl;return this.currentBaseUrl=this.baseUrl,this.get("version")&&this.get("report")&&(d&&(b=!0),this.get("lastReport")||(b=!0),(new Date).getTime()-parseInt(this.get("lastReport"),10)>a&&(b=!0)),b?!0:!1},checkRegistratonStatus:function(){var a=6048e5,b=(new Date).getTime()-parseInt(this.get("trialTimestamp"),10)>a;return"trial"===this.get("status")&&b},sendIfDue:function(a){var b=this;return this.checkReportStatus()?this.client.post(this.getStatsReportUrl(),a).then(function(){b.set("lastReport",(new Date).getTime()),b.saveToBrowser()}):void 0},register:function(a){var b=this;return a.creationDate=(new Date).toISOString(),this.set("registrationData",a),this.set("status","registered"),b.saveToBrowser(),b.saveToES()},confirmPurchase:function(a){var b=this;return a.creationDate=(new Date).toISOString(),this.set("registrationData",a),this.set("status","purchased"),this.set("registrationSent",!1),b.saveToBrowser(),b.saveToES()},checkAndSendRegistrationData:function(){var a=this,b=this.get("registrationData"),c=this.get("data"),d=this.getRegistrationUrl();return!this.get("registrationSent")&&b&&c&&c.uuid?(b.uuid=c.uuid,"purchased"===this.get("status")&&(d=this.getPurchaseConfirmationUrl()),this.client.post(d,b).then(function(){a.set("registrationSent",!0),a.saveToBrowser()})):void 0},fetch:function(){var a,b=this;try{a=JSON.parse(localStorage.getItem(b._id)),this.set(a)}catch(d){}var f=c.transform(b.fieldsToES,function(a,b){a[b]=e[b]},{});delete f.report;var g=this.baseUrl+"/"+this.index+"/"+this._type+"/"+this._id;return this.client.get(g).then(function(a){var d=c.defaults(a.data._source,f);return b.set(d),b.saveToBrowser(),b.attributes},function(){b.set(f),b.saveToBrowser()})},getStatsReportUrl:function(){return"https://marvel-stats.elasticsearch.com/"},getRegistrationUrl:function(){return"https://marvel-stats.elasticsearch.com/registration"},getPurchaseConfirmationUrl:function(){return"https://marvel-stats.elasticsearch.com/purchase_confirmation"}},b}),define("services/marvel/index",["require","angular","app","config","lodash","lib/ClusterState/getState","lib/ClusterState/getIndices","lib/ClusterState/refreshState","lib/ClusterState/explainStatus","lib/ClusterState/groupIndicesByState","../../../../common/PhoneHome"],function(a){var b=a("angular"),c=a("app"),d=a("config"),e=a("lodash"),f=a("lib/ClusterState/getState"),g=a("lib/ClusterState/getIndices"),h=a("lib/ClusterState/refreshState"),i=a("lib/ClusterState/explainStatus"),j=a("lib/ClusterState/groupIndicesByState"),k=a("../../../../common/PhoneHome"),l=b.module("marvel.services",[]);return c.useModule(l),l.factory("$clusterState",["$rootScope","$http","kbnIndex","dashboard",function(a,b,c,k){var l=e.partial(f,b,d),m=e.partial(g,c,k),n=a.$new(!0);n.state=!1,n.version=0;var o=e.partial(h,n,l,m);return n.refresh=o,n.refresh(),a.$on("refresh",n.refresh),n.explainStatus=i.bind(null,n),n.groupIndicesByState=j.bind(null,n),n}]),l.factory("$phoneHome",["$http",function(a){return new k({client:a,baseUrl:d.elasticsearch,index:d.kibana_index})}]),l}),define("panels/marvel/stats_table/module",["angular","app","kbn","lodash","jquery","numeral","./lib/detectSplitBrain","./lib/splitBrainHistogram","jquery.flot","jquery.flot.time","services/marvel/index"],function(a,b,c,d,e,f,g,h){function i(a,b){return!d.isNaN(a)&&d.isFinite(a)&&d.isNumber(a)?"bytes"===b.y_format?f(a).format("0.0 b"):"short"===b.y_format?f(a).format("0.0 a"):a.toFixed(b.decimals):a}function j(a){return a.replace(/\.raw$/,"")}var k=a.module("kibana.panels.marvel.stats_table",[]);b.useModule(k),f.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"K",million:"M",billion:"B",trillion:"T"},currency:{symbol:"$"}});var l;l=function(){},k.controller("marvel.stats_table",["$scope","dashboard","filterSrv","esVersion","$clusterState","$filter","alertSrv","$http","$location",function(a,b,e,k,m,n,o,p,q){function r(b,c){a.meta={masterCount:d.filter(c,{master:!0,alive:!0}).length},a.rows=b,a.data=c,a.updateUIFeaturesBasedOnData(),a.panelMeta.loading=!1,a.calculateWarnings()}function s(a){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}a.panelMeta={modals:[],editorTabs:[],status:"Stable",description:"A stats table for nodes or nodes"};var t={compact:!1,mode:"nodes",sort:null,full_view_row_limit_on_high_refresh:5,data_limit_for_high_refresh:50,data_limit_for_display_names:50,show_hidden:!0};d.defaults(a.panel,t),a.metricEditor={index:-1,add:void 0},a.staleIntervalCount=5,a.modeInfo={nodes:{defaults:{display_field:"node.name",persistent_field:"node.ip_port.raw",metrics:["os.cpu.usage","os.load_average.1m","jvm.mem.heap_used_percent","fs.total.available_in_bytes","fs.total.disk_io_op"],show_hidden:!0},availableMetrics:[{name:"OS CPU (%)",field:"os.cpu.usage",warning:60,error:90},{name:"Load (1m)",field:"os.load_average.1m",warning:8,error:10},{name:"JVM Mem (%)",field:"jvm.mem.heap_used_percent",warning:90,error:95},{name:"Disk Free Space",field:"fs.total.available_in_bytes",warning:{threshold:53687091200,type:"lower_bound"},error:{threshold:21474836480,type:"lower_bound"},y_format:"bytes"},{name:"IOps",field:"fs.total.disk_io_op",derivative:!0}]},indices:{defaults:{display_field:null,persistent_field:"index.raw",metrics:["primaries.docs.count","primaries.indexing.index_total","total.search.query_total","total.merges.total_size_in_bytes","total.fielddata.memory_size_in_bytes"],show_hidden:!1},availableMetrics:[{name:"Documents",field:"primaries.docs.count",decimals:0,y_format:"short"},{name:"Index Rate",field:"primaries.indexing.index_total",derivative:!0,y_format:"short"},{name:"Search Rate",field:"total.search.query_total",derivative:!0,y_format:"short"},{name:"Merge Rate",field:"total.merges.total_size_in_bytes",derivative:!0,y_format:"bytes"},{name:"Field Data",field:"total.fielddata.memory_size_in_bytes",y_format:"bytes"}]}};var u=function(b){if(d.isUndefined(a.modeInfo[a.panel.mode]))return[];d.isString(b)&&(b={field:b}),b=d.defaults(b,d.findWhere(a.modeInfo[a.panel.mode].availableMetrics,{field:b.field}));var c={field:"",decimals:1,y_format:"none",derivative:!1};return b=d.defaults(b,c),d.isNumber(b.error)&&(b.error={threshold:b.error,type:"upper_bound"}),d.isNumber(b.warning)&&(b.warning={threshold:b.warning,type:"upper_bound"}),b};d.defaults(a.panel,a.modeInfo[a.panel.mode].defaults),a.panel.metrics=d.map(a.panel.metrics,function(a){return u(a)}),a.$watch("panel.mode",function(b,c){b===c||d.isUndefined(b)||(a.panel.display_field=a.modeInfo[b].defaults.display_field,a.panel.persistent_field=a.modeInfo[b].defaults.persistent_field,a.panel.metrics=d.map(a.modeInfo[b].defaults.metrics,function(a){return u(a)}))}),a.$watch("dashboard.current.refresh",function(){a.updateUIFeaturesBasedOnData()}),a.updateUIFeaturesBasedOnData=function(){var e=a.rows.length;e>a.panel.full_view_row_limit_on_high_refresh&&c.interval_to_seconds(b.current.refresh||"1y")<120?(a.panel.compact=!0,a.sparkLines=!0,a.viewSelect=!1):(a.viewSelect=!0,a.sparkLines=!0),d.size(a.data)>a.panel.data_limit_for_high_refresh&&c.interval_to_seconds(b.current.refresh||"1y")<120&&(b.set_interval("2m"),o.set("Refresh rate","Due to the large size of your cluster, the refresh rate has been adjusted to 2m","info",3e4))},a.init=function(){a.dashboard=b,a.rowLimit=20,a.sparkLines=!0,a.viewSelect=!0,a.warnLevels={},a.rows=[],a.data={},a.$on("refresh",function(){a.get_data()}),a.get_data()},a.get_mode_filter=function(){return a.ejs.TermFilter("_type","nodes"===a.panel.mode?"node_stats":"index_stats")},a.get_summary_key=function(a,b){return a+"_"+b.field},a.get_history_key=function(a,b){return a+"_"+b.field+"_history"},a._register_data_start=function(){var b=new Date;return a._ongoing_data_retrieval?b-a._ongoing_data_retrieval>6e4?(console.log("previous data retrieval didn't finish within 1m. executing current request (previous: "+a._ongoing_data_retrieval+")"),a._ongoing_data_retrieval=b,!0):(a._pending_data_retrieval||(l("queueing data start for "+b),a._pending_data_retrieval=b,setTimeout(function(){a._pending_data_retrieval===b&&(console.log("Retrying call from "+b),a._pending_data_retrieval=null,a.get_data())},2e4)),!1):(a._ongoing_data_retrieval=b,l("marking data start for "+b),!0)},a._register_data_end=function(){if(l("end of data retrieval "+a._ongoing_data_retrieval),a._pending_data_retrieval){var b=a._pending_data_retrieval;setTimeout(function(){return a._ongoing_data_retrieval=null,b!==a._pending_data_retrieval?void l("firing pending retrieval canceled as it was picked up: "+b):(l("firing pending retrieval "+a._pending_data_retrieval),a._pending_data_retrieval=null,void a.get_data())},5e3)}else a._ongoing_data_retrieval=null},a.get_data=function(){if(0!==b.indices.length&&a._register_data_start()){a.panel.error=!1;var f,i,l,n;i=a.ejs.BoolFilter();var o,q;o=q=e.timeRange(!1).to,o=c.parseDate(o).getTime(),"now"!==q&&(q=c.parseDate(q).valueOf()+"||"),i.must(a.get_mode_filter()).must(a.ejs.RangeFilter("@timestamp").from(q+"-10m/m").to(q+"/m")),f=a.ejs.Request().indices(b.indices).size(10),f.query(a.ejs.FilteredQuery(a.ejs.MatchAllQuery(),i)),f.facet(a.ejs.TermStatsFacet("timestamp").keyField(a.panel.persistent_field).valueField("@timestamp").order("term").size(2e3)),"nodes"===a.panel.mode&&f.facet(a.ejs.TermsFacet("master_nodes").field(a.panel.persistent_field).facetFilter(a.ejs.TermFilter("node.master","true")).size(2e3)),d.each(a.panel.metrics,function(b){f.facet(a.ejs.TermStatsFacet(b.field).keyField(a.panel.persistent_field).valueField(b.field).order("term").size(2e3))}),l=f.doSearch(),l.then(function(e){var f,l;if(l={},!d.isUndefined(e.error))return void(a.panel.error=a.parse_error(e.error));if(d.each(e.facets.timestamp.terms,function(b){if(a.panel.show_hidden||"."!==b.term[0]){var d=(b.max-b.min)/b.count/1e3,e=(o-b.max)/1e3;0>=d&&(d=5);var f=e<Math.min(3e5,a.staleIntervalCount*d);l[b.term]={id:b.term,time_span:(b.max-b.min)/1e3,reporting_interval:d/1e3,data_age_in_seconds:e,data_age_display:c.secondsToHms(Math.floor(e)),alive:f,selected:(a.data[b.term]||{}).selected,alert_level:0,id_alert_level:f?0:1}}}),e.facets.master_nodes&&(n=e.facets.master_nodes,1===n.terms.length&&(l[n.terms[0].term].master=!0)),"indices"===a.panel.mode){if(!m.state&&l){var r;r=m.$on("update",function(){r(),a.get_data()})}var s=m.groupIndicesByState();d.each(l,function(a){a.status=s.red[a.id]?"red":s.yellow[a.id]?"yellow":"green","green"!==a.status&&(a.statusExplain=m.explainStatus(a.id,s))})}return d.each(a.panel.metrics,function(b){d.each(e.facets[b.field].terms,function(c){var d=l[c.term];if(d){var e={mean:null,max:null,min:null};if(b.derivative){if(!d.time_span)return void(d[b.field]=e);e.value=(c.max-c.min)/d.time_span,b.scale&&1!==b.scale&&(e.value/=b.scale)}else e.min=c.min,e.max=c.max,e.value=c.mean,b.scale&&1!==b.scale&&(e.value/=b.scale,e.max/=b.scale,e.min/=b.scale);d[b.field]=e,e.alert_level=a.alertLevel(b,e.value),e.alert_level>d.alert_level&&(d.alert_level=e.alert_level)}})}),d.isEmpty(l)?(a._register_data_end(),void a.select_display_data_and_enrich(l)):!a.panel.display_field||a.panel.display_field===a.panel.persistent_field||d.size(l)>a.panel.data_limit_for_display_names?(d.each(l,function(a){a.display_name=a.id}),a._register_data_end(),void a.select_display_data_and_enrich(l)):(f=a.ejs.MultiSearchRequest().indices(b.indices),d.each(l,function(b){var c=a.ejs.Request().filter(i);c.query(a.ejs.ConstantScoreQuery().query(a.ejs.TermQuery(a.panel.persistent_field,b.id))),c.size(1).fields(d.unique([j(a.panel.display_field),j(a.panel.persistent_field)])),c.sort("@timestamp","desc"),f.requests(c)}),void f.doSearch(function(c){k.is(">=1.0.0.RC1").then(function(e){var f,i,k;if(d.each(c.responses,function(b){0!==b.hits.hits.length&&(f=b.hits.hits[0],e?(i=(f.fields[j(a.panel.display_field)]||[void 0])[0],k=(f.fields[j(a.panel.persistent_field)]||[void 0])[0]):(i=f.fields[j(a.panel.display_field)],k=f.fields[j(a.panel.persistent_field)]),(l[k]||{}).display_name=i)}),1!==n.terms.length){var m=d.map(n.terms,function(a){return a.term}),o=h(p,b,a.panel.persistent_field),r=function(b){var c=g(b);d.each(c.master,function(a){l[a].master=!0}),d.each(c.red,function(a){d.each(a.nodes,function(a){l[a].alert_level=l[a].id_alert_level=2})}),a._register_data_end(),a.select_display_data_and_enrich(l)},s=function(b){a.error=b.data.error,a._register_data_end(),a.select_display_data_and_enrich(l)};o(m,q).then(r,s)}else a._register_data_end(),a.select_display_data_and_enrich(l)})},a._register_data_end))},a._register_data_end)}},a.select_display_data_and_enrich=function(f){function g(a,b){var c=f[a],d=f[b];return c.selected&&!d.selected?-1:!c.selected&&d.selected?1:0}function h(a,b){var c=f[a],d=f[b];return c.alert_level>d.alert_level?-1:c.alert_level<d.alert_level?1:0}function i(a,b){var c=f[a],d=f[b];return!c.alive&&d.alive?-1:c.alive&&!d.alive?1:0}function j(a,b){var c=f[a],d=f[b];return"."===c.display_name.charAt(0)&&"."!==d.display_name.charAt(0)?1:"."!==c.display_name.charAt(0)&&"."===d.display_name.charAt(0)?-1:c.display_name<d.display_name?-1:c.display_name>d.display_name?1:0}function k(a,b){var c=f[a],d=f[b];return c.master&&!d.master?-1:!c.master&&d.master?1:0}function l(a,b){var c={red:2,yellow:1,green:0},d=f[a],e=f[b];if(!d.status)return 0;var g=c[d.status],h=c[e.status];return g>h?-1:h>g?1:0}function m(b,c){var d=a.get_sort_value(b,f),e=a.get_sort_value(c,f),g=0;return e>d?g=-1:d>e&&(g=1),"desc"===a.panel.sort[1]&&(g*=-1),g}function n(){var a=arguments;return function(b,c){for(var d=0;d<a.length;d++){var e=a[d].call(this,b,c);if(0!==e)return e}return 0}}if(d.isUndefined(f)&&(f=a.data),0===b.indices.length||d.isEmpty(f))return void r([],{});
  a.panelMeta.loading=!0;var o,p,q,s;if(s=[],a.panel.rowFilter){var t=a.panel.rowFilter.toLowerCase();d.each(f,function(a){var b=a.id.toLowerCase();return b.indexOf(t)>=0?void s.push(a.id):(b=a.display_name.toLowerCase(),void(b.indexOf(t)>=0&&s.push(a.id)))})}else d.each(f,function(a){s.push(a.id)});a.panel.sort?(s.sort(n(m,l,h,i,g,k)),s=s.slice(0,a.rowLimit)):(s.sort(n(g,l,h,i,k,j)),s=s.slice(0,a.rowLimit),s.sort(n(l,h,j))),q=d.map(s,function(a){return f[a]}),o=a.ejs.Request().indices(b.indices);var u=e.timeRange(!1).to;"now"!==u&&(u=c.parseDate(u).valueOf()+"||");var w=a.ejs.BoolFilter().must(a.ejs.RangeFilter("@timestamp").from(u+"-10m/m").to(u+"/m")).must(a.get_mode_filter());return o.query(a.ejs.FilteredQuery(a.ejs.MatchAllQuery(),w)).size(0),d.each(q,function(b){d.each(a.panel.metrics,function(c){b[c.field]&&!b[c.field].series&&o.facet(a.ejs.DateHistogramFacet(a.get_history_key(b.id,c)).keyField("@timestamp").valueField(c.field).interval("1m").facetFilter(a.ejs.TermFilter(a.panel.persistent_field,b.id)))})}),o.facet()&&0!==o.facet().length?(p=o.doSearch(),void p.then(function(b){v(b.facets,q,f,a.panel.metrics);var c;c=a.panel.sort?n(m,l,h,i,g,k):n(l,h,j),q.sort(function(a,b){return c(a.id,b.id)}),r(q,f)})):void r(q,f)};var v=function(b,c,e,f){return d.each(f,function(e){d.each(c,function(c){var f=a.get_history_key(c.id,e),g=b[f];if(g){var h=d.pluck(g.entries,e.derivative?"min":"mean"),i=d.pluck(g.entries,"time"),j=c[e.field];e.scale&&1!==e.scale&&(h=d.map(h,function(a){return a/e.scale})),e.derivative?(h=d.map(h,function(a,b){var c;if(0===b)c=null;else{var d=(i[b]-i[b-1])/1e3;c=(a-h[b-1])/d}return c>=0?c:null}),j.max=d.reduce(h,function(a,b){return b>a&&null!=b?b:a},Number.NEGATIVE_INFINITY),j.min=d.reduce(h,function(a,b){return a>b&&null!=b?b:a},Number.POSITIVE_INFINITY),j.max===Number.NEGATIVE_INFINITY&&(j.max=null),j.min===Number.POSITIVE_INFINITY&&(j.min=null)):(j.max=d.isNumber(j.max)?j.max:null,j.min=d.isNumber(j.min)?j.min:null),j.series=d.zip(i,h),j.value=null===j.max||null===j.min?null:h[h.length-1],j.alert_level=a.alertLevel(e,j.value),j.alert_level>c.alert_level&&(c.alert_level=j.alert_level)}})}),b};a.hasSelected=function(b){return d.some(b||a.data,function(a){return a.selected})},a.selectedData=function(b){return d.filter(b||a.data,function(a){return a.selected})},a.get_sort_value=function(b,c){return c||(c=a.data),b=c[b],"__name__"===a.panel.sort[0]?b.display_name:b[a.panel.sort[0]].value},a.set_sort=function(b){a.panel.sort&&a.panel.sort[0]===b?"asc"===a.panel.sort[1]?a.panel.sort[1]="desc":"desc"===a.panel.sort[1]?a.panel.sort=null:a.panel.sort[1]="asc":a.panel.sort=[b,"asc"],a.select_display_data_and_enrich()},a.showFullTable=function(){return a.panel.compact?!1:!0},a.rowClick=function(b,c){var d=a.detailViewLink([b],c?[c.field]:void 0,!0);q.path(d.path).search(d.search)},a.formatAlert=function(a,b){if(!a)return"";var c=i(a.threshold,b);return("upper_bound"===a.type?">":"<")+c},a.detailViewLink=function(b,c,f){var g,h,i,j,k;return d.isUndefined(b)&&(b=a.selectedData()),b=d.map(b,function(b){return g=a.panel.persistent_field+':"'+b.id+'"',{q:g,a:b.display_name}}),0===b.length?null:(b=JSON.stringify(b),h=e.timeRange(!1),i=d.isUndefined(c)?"":"&show="+c.join(","),j=d.isDate(h.from)?h.from.toISOString():h.from,k=d.isDate(h.to)?h.to.toISOString():h.to,f?{path:"/dashboard/script/marvel."+a.panel.mode+"_stats.js",search:{queries:b,from:j,to:k,show:d.isUndefined(c)?"":c.join(",")}}:"#/dashboard/script/marvel."+a.panel.mode+"_stats.js?queries="+s(b)+"&from="+j+"&to="+k+i)},a.detailViewTip=function(){return"nodes"===a.panel.mode?a.hasSelected(a.rows)?"Open node statistics dashboard for selected nodes":"Select nodes and click to open the node statistics dashboard":a.hasSelected(a.rows)?"Open index stats dashboard for selected indices":"Select indices and click to open the index stats dashboard"},a.calculateWarnings=function(){a.warnLevels={},d.each(a.panel.metrics,function(b){a.warnLevels[b.field]=0,d.each(a.data,function(c){var e=(c[b.field]||{}).alert_level;!d.isUndefined(e)&&e>a.warnLevels[b.field]&&(a.warnLevels[b.field]=e)})})},a.alertLevel=function(a,b){function c(a,b){return a&&d.isNumber(b)?"upper_bound"===a.type?b>a.threshold:b<a.threshold:!1}var e=0;if(a.scale&&(b/=a.scale),c(a.error,b)?e=2:c(a.warning,b)&&(e=1),document.location.search.match(/panic_demo/)){var f=Math.random();f>.9?e=2:f>.8&&(e=1)}return e},a.alertClass=function(a){return a>=2?["text-error"]:a>=1?["text-warning"]:[]},a.alertClassForId=function(a){var b=a.id_alert_level;return"red"===a.status?["text-error"]:b>=2?["text-error"]:b>=1?["text-warning"]:[]},a.alertClassForIndexStatusInfo=function(a){return"red"===a?["text-error"]:"yellow"===a?["text-warning"]:void 0},a.parseAlert=function(a,b){if(!a)return null;var c={type:"upper_bound"};return"<"===a[0]?(c.type="lower_bound",a=a.substr(1)):">"===a[0]&&(a=a.substr(1)),"bytes"===b.y_format&&/\d+\s*[KkGgMmTt]?[bB]/.test(a)&&(a=f().unformat(a)),"short"===b.y_format&&/\d+\s*[KkBbMmTt]/.test(a)&&(a=f().unformat(a.toUpperCase())),c.threshold=parseFloat(a),isNaN(c.threshold)?null:c},a.addMetric=function(b,c){c=c||{},c=u(c),b.metrics.push(c),c.field||(a.metricEditor.index=b.metrics.length-1)},a.addMetricOptions=function(b){if(d.isUndefined(a.modeInfo[b]))return[];var c=d.pluck(a.panel.metrics,"field");return d.filter(a.modeInfo[b].availableMetrics,function(a){return!d.contains(c,a.field)})},a.needs_refresh=function(b){d.isUndefined(b)&&(b=!0),a._needs_refresh=b},a.close_edit=function(){a.metricEditor={index:-1},a._needs_refresh&&a.get_data(),a._needs_refresh=!1,a.$emit("render")},a.deleteMetric=function(a,b){a.metrics=d.without(a.metrics,a.metrics[b])},a.onRowFilterChange=d.debounce(function(){a.$apply(function(b){a.select_display_data_and_enrich(b.data)})},500)}]),k.filter("metric_format",function(){return i}),k.directive("alertValue",function(){return{require:"ngModel",link:function(a,b,c,d){d.$parsers.unshift(function(b){return/(<>)?\d+(.\d+)?/.test(b)?(d.$setValidity("alertValue",!0),a.parseAlert(b,a.metric)):void d.$setValidity("alertValue",!1)}),d.$formatters.unshift(function(b){return a.formatAlert(b,a.metric)})}}}),k.directive("marvelStatsSparkline",function(){return{restrict:"C",scope:{series:"=",panel:"=",field:"="},template:"<div></div>",link:function(a,b){function c(){var c={legend:{show:!1},series:{lines:{show:!0,fill:0,lineWidth:2,steps:!1},shadowSize:1},yaxis:{show:!1},xaxis:{show:!1,mode:"time"},grid:{hoverable:!1,show:!1}};if(!d.isUndefined(a.series)){var f={data:a.series,color:b.css("color")};e.plot(b,[f],c)}}a.$watch("series",function(){c()})}}})});