function varToggle(link,id){$('#v'+id).toggle();var s=link.getElementsByTagName('span')[0];var uarr=String.fromCharCode(0x25b6);var darr=String.fromCharCode(0x25bc);s.innerHTML=s.innerHTML==uarr?darr:uarr;return false;}
(function(){var prioritySortLow=function(a,b){return b.priority-a.priority;};var prioritySortHigh=function(a,b){return a.priority-b.priority;};Queue=function(options){var contents=[];var sorted=false;var sortStyle;if(options===undefined){options={};}
if(options.low){sortStyle=prioritySortLow;}else if(options.high){sortStyle=prioritySortHigh;}
var sort=function(){contents.sort(sortStyle);sorted=true;};var self={pop:function(){if(!sorted&&sortStyle){sort();}
var element=contents.pop();if(element){return element.object;}else{return undefined;}},top:function(){if(!sorted){sort();}
var element=contents[contents.length-1];if(element){return element.object;}else{return undefined;}},includes:function(object){for(var i=contents.length-1;i>=0;i--){if(contents[i].object===object){return true;}}
return false;},replace:function(object,priority,key){for(var i=contents.length-1;i>=0;i--){if(contents[i].object[key]===object[key]){contents[i]={object:object,priority:priority};return true;}}
self.push(object,priority);return false;},size:function(){return contents.length;},empty:function(){return contents.length===0;},push:function(object,priority){contents.push({object:object,priority:priority});sorted=false;}};return self;};})();(function(Date,undefined){var origParse=Date.parse,numericKeys=[1,4,5,6,7,10,11];Date.parse=function(date){var timestamp,struct,minutesOffset=0;if((struct=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date))){for(var i=0,k;(k=numericKeys[i]);++i){struct[k]=+struct[k]||0;}
struct[2]=(+struct[2]||1)-1;struct[3]=+struct[3]||1;if(struct[8]!=='Z'&&struct[9]!==undefined){minutesOffset=struct[10]*60+struct[11];if(struct[9]==='+'){minutesOffset=0-minutesOffset;}}
timestamp=Date.UTC(struct[1],struct[2],struct[3],struct[4],struct[5]+minutesOffset,struct[6],struct[7]);}
else{timestamp=origParse?origParse(date):NaN;}
return timestamp;};}(Date));if(Sentry===undefined){var Sentry={};}
(function(){Sentry.options={urlPrefix:'',mediaUrl:'/media/',defaultImage:'/media/images/sentry.png'};Sentry.config=function(data){$.each(data,function(k,v){Sentry.options[k]=v;});};Sentry.prettyDate=function(date_str){var time=Date.parse(date_str);var now=new Date();var now_utc=Date.UTC(now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate(),now.getUTCHours(),now.getUTCMinutes(),now.getUTCSeconds());var seconds=(now_utc-time)/1000;var token='ago';var time_formats=[[60,'just now','just now'],[120,'1 minute ago','1 minute from now'],[3600,'minutes',60],[7200,'1 hour ago','1 hour from now'],[86400,'hours',3600],[172800,'yesterday','tomorrow'],[604800,'days',86400],[1209600,'last week','next week'],[2419200,'weeks',604800],[4838400,'last month','next month'],[29030400,'months',2419200],[58060800,'last year','next year'],[2903040000,'years',29030400],[5806080000,'last century','next century'],[58060800000,'centuries',2903040000]];var list_choice=1;if(seconds<0)
{seconds=Math.abs(seconds);token='from now';list_choice=2;}
for(var i=0,format;(format=time_formats[i]);i++){if(seconds<format[0])
{if(typeof format[2]=='string')
return format[list_choice];else
return Math.floor(seconds/format[2])+' '+format[1]+' '+token;}}
return time;};Sentry.prettyDates=function(){$('.pretty-date').each(function(_,el){var $el=$(el);var title=$el.attr('title');if(title){var date=Sentry.prettyDate(title);if(date){$el.text(date);}}});};Sentry.toggle=function(el){var $el=$(el);$el.toggle();};Sentry.getQueryParams=function(){var vars={},hash;var href=window.location.href;if(href.indexOf('?')===-1){return vars;}
var hashes=href.slice(href.indexOf('?')+1,(href.indexOf('#')!==-1?href.indexOf('#'):href.length)).split('&');$.each(hashes,function(_,chunk){hash=chunk.split('=');if(!hash[0]&&!hash[1]){return;}
vars[hash[0]]=hash[1]?decodeURIComponent(hash[1]).replace(/\+/,' '):'';});return vars;};$(document).ready(function(){$('.filter').each(function(_,el){var $filter=$(el);var $input=$filter.find('input[type=text]');if($input.length>0){$input.select2({initSelection:function(el,callback){var $el=$(el);callback({id:$el.val(),text:$el.val()});},allowClear:true,minimumInputLength:3,ajax:{url:Sentry.options.urlPrefix+'/api/'+Sentry.options.projectId+'/tags/search/',dataType:'json',data:function(term,page){return{query:term,quietMillis:300,name:$input.attr('name'),limit:10};},results:function(data,page){var results=[];$(data.results).each(function(_,val){results.push({id:val,text:val});});return{results:results};}}});}else{$input=$filter.find('select').select2({allowClear:true});}
if($input.length){$input.on('change',function(e){var query=Sentry.getQueryParams();query[e.target.name]=e.val;window.location.href='?'+$.param(query);});}});setInterval(Sentry.prettyDates,5000);Sentry.prettyDates();});$(document).ajaxSend(function(event,xhr,settings){function getCookie(name){var cookieValue=null;if(document.cookie&&document.cookie!==''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}
function sameOrigin(url){var host=document.location.host;var protocol=document.location.protocol;var sr_origin='//'+host;var origin=protocol+sr_origin;return(url==origin||url.slice(0,origin.length+1)==origin+'/')||(url==sr_origin||url.slice(0,sr_origin.length+1)==sr_origin+'/')||!(/^(\/\/|http:|https:).*/.test(url));}
function safeMethod(method){return(/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));}
if(!safeMethod(settings.type)&&sameOrigin(settings.url)){xhr.setRequestHeader("X-CSRFToken",getCookie('csrftoken'));}});$('.popup').live('click',function(){var $this=$(this);var $window=$(window);var $container=$($this.attr('data-container'));var title=$this.attr('data-title')||'Untitled';var content=$container.html();var height=Math.min($window.height()-100,$container.height()+40);var width=Math.min($window.width()-100,$container.width()+40);var w=window.open("about:blank","dsqApiExpand","toolbar=0,status=0,location=0,menubar=0,height="+height+",width="+width);w.document.write("<!DOCTYPE html><html>"+"<head>"+"<title>"+title+"</title>"+"<link href=\""+Sentry.options.popupCss+"\" rel=\"stylesheet\" type=\"text/css\"/>"+"</head><body>"+"<div id=\"popup\">"+content+"</div></body>"+"</html>");});}());if(Sentry===undefined){var Sentry={};}
(function(){Sentry.charts={};Sentry.charts.render=function(el){var $sparkline=$(el);if($sparkline.length<1){return;}
$.ajax({url:$sparkline.attr('data-api-url'),type:'get',dataType:'json',data:{days:7,gid:$sparkline.attr('data-group')||undefined},success:function(data){$sparkline.height($sparkline.parent().height());$.plot($sparkline,[{data:data,color:'#3079d0',shadowSize:0,lines:{lineWidth:1,show:true,fill:true}}],{xaxis:{mode:"time"},yaxis:{min:0,tickFormatter:function(value){if(value>999999){return(value/1000000)+'mm';}
if(value>999){return(value/1000)+'k';}
return value;}},grid:{show:true,backgroundColor:'#f9f9f9',borderColor:'#eeeeee',borderWidth:1,tickColor:'#eeeeee'},hoverable:false,legend:{noColumns:5},lines:{show:false}});}});};}());if(Sentry===undefined){var Sentry={};}
(function(){Sentry.stream={};Sentry.stream.clear=function(project_id){if(confirm("Are you sure you want to mark all your stream as resolved?")){$.ajax({url:Sentry.options.urlPrefix+'/api/'+project_id+'/clear/',type:'post',dataType:'json',success:function(groups){window.location.reload();}});}};Sentry.stream.resolve=function(project_id,gid,remove){if(typeof(remove)=='undefined'){remove=true;}
$.ajax({url:Sentry.options.urlPrefix+'/api/'+project_id+'/resolve/',type:'post',dataType:'json',data:{gid:gid},success:function(groups){for(var i=groups.length-1,data,row;(data=groups[i]);i--){$('.event[data-group="'+data.id+'"]').remove();if(!remove){$('#event_list').prepend(data.html);$('.event[data-group="'+data.id+'"]').addClass('fresh');}}}});};Sentry.stream.bookmark=function(project_id,gid,el){$.ajax({url:Sentry.options.urlPrefix+'/api/'+project_id+'/bookmark/',type:'post',dataType:'json',data:{gid:gid},success:function(data){if(!el){return;}
var $el=$(el);if(data.bookmarked){$el.addClass('checked');}else{$el.removeClass('checked');}}});};}());