!function(){var a=function(b,c,d){var e=a.resolve(b);if(null===e){d=d||b,c=c||"root";var f=new Error('Failed to require "'+d+'" from "'+c+'"');throw f.path=d,f.parent=c,f.require=!0,f}var g=a.modules[e];if(!g._resolving&&!g.exports){var h={};h.exports={},h.client=h.component=!0,g._resolving=!0,g.call(this,h.exports,a.relative(e),h),delete g._resolving,g.exports=h.exports}return g.exports};a.modules={},a.aliases={},a.resolve=function(b){"/"===b.charAt(0)&&(b=b.slice(1));for(var c=[b,b+".js",b+".json",b+"/index.js",b+"/index.json"],d=0;db;b++)if(b in this&&this[b]===a)return b;return-1};k=b("./require")._,h=b("./request"),g=b("./regex"),d=null,j=!1,f=[],e={host:"api.github.com",protocol:"https"},i={host:function(a){return k.isString(a)},protocol:function(a){return k.isString(a)&&a.match(/^http(s?)$/)},token:function(a){return k.isString(a)},off_days:function(a){var b,c,d;if(!k.isArray(a))return!1;for(c=0,d=a.length;d>c;c++)if(b=a[c],l.call([1,2,3,4,5,6,7],b)<0)return!1;return!0}},c.exports=function(a){return"undefined"==typeof window&&(d=null),d?a(null,d):(f.push(a),j?void 0:(j=!0,h.config(function(b,c){var h,l,m;j=!1,d=k.defaults(c||{},e),d.size_label=d.size_label?new RegExp(d.size_label):g.size_label;for(h in i)if(l=i[h],d[h]&&!l(d[h]))return a("Config field `"+h+"` misconfigured");for(m=[];f.length;)m.push(f.pop()(null,d));return m})))}}),b.require.register("ghbc/src/modules/graph.js",function(a,b,c){var d,e,f,g,h=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};g=b("./require"),f=g._,d=g.d3,e=b("./regex"),c.exports={actual:function(a,b,c,e){var g,h,i,j,k;return g=[{date:new Date(b),points:c}],i=+1/0,h=-1/0,k=f.map(a,function(a){var b,d;return d=a.size,b=a.closed_at,i>d&&(i=d),d>h&&(h=d),f.extend({},a,{date:new Date(b),points:c-=d})}),j=d.scale.linear().domain([i,h]).range([5,8]),k=f.map(k,function(a){return a.radius=j(a.size),a}),e(null,[].concat(g,k))},ideal:function(a,b,c,d,g){var i,j,k,l,m,n,o,p,q,r,s;return a>b&&(r=[a,b],b=r[0],a=r[1]),s=f.map(a.match(e.datetime)[1].split("-"),function(a){return parseInt(a)}),q=s[0],m=s[1],j=s[2],i=new Date(b),k=[],l=0,(o=function(a){var b,d;return b=new Date(q,m-1,j+a),(d=b.getDay())||(d=7),h.call(c,d)>=0?k.push({date:b,off_day:!0}):(l+=1,k.push({date:b})),b>i?void 0:o(a+1)})(0),p=d/(l-1),k=f.map(k,function(a,b){return a.points=d,k[b]&&!k[b].off_day&&(d-=p),a}),(n=new Date)>i&&k.push({date:n,points:0}),g(null,k)},trendline:function(a,b,c){var d,e,g,h,i,j,k,l,m,n,o,p;return o=+a[0].date,p=f.map(a,function(a){var b,c;return b=a.date,c=a.points,[+b-o,c]}),m=a[a.length-1],p.push([+new Date-o,m.points]),g=0,i=0,h=0,d=(l=p.length)*f.reduce(p,function(a,b){var c,d;return c=b[0],d=b[1],g+=c,i+=d,h+=Math.pow(c,2),a+c*d},0),n=(d-g*i)/(l*h-Math.pow(g,2)),k=(i-n*g)/l,j=function(a){return n*a+k},b=new Date(b),c=c?new Date(c):new Date,d=b-o,e=c-o,[{date:b,points:j(d)},{date:c,points:j(e)}]},render:function(a,b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;return c=a[0],f=a[1],m=a[2],document.querySelector("#svg").innerHTML="",s=document.querySelector("#graph").getBoundingClientRect(),e=s.height,n=s.width,j={top:30,right:30,bottom:40,left:50},n-=j.left+j.right,e-=j.top+j.bottom,o=d.time.scale().range([0,n]),q=d.scale.linear().range([e,0]),p=d.svg.axis().scale(o).orient("bottom").tickSize(-e).tickFormat(function(a){return a.getDate()}).tickPadding(10),r=d.svg.axis().scale(q).orient("left").tickSize(-n).ticks(5).tickPadding(10),g=d.svg.line().interpolate("linear").x(function(a){return o(a.date)}).y(function(a){return q(a.points)}),o.domain([f[0].date,f[f.length-1].date]),q.domain([0,f[0].points]).nice(),k=d.select("#svg").append("svg").attr("width",n+j.left+j.right).attr("height",e+j.top+j.bottom).append("g").attr("transform","translate("+j.left+","+j.top+")"),k.append("g").attr("class","x axis day").attr("transform","translate(0,"+e+")").call(p),h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=p.orient("top").tickSize(e).tickFormat(function(a){return h[a.getMonth()]}).ticks(2),k.append("g").attr("class","x axis month").attr("transform","translate(0,"+e+")").call(i),k.append("g").attr("class","y axis").call(r),k.append("svg:line").attr("class","today").attr("x1",o(new Date)).attr("y1",0).attr("x2",o(new Date)).attr("y2",e),k.append("path").attr("class","ideal line").attr("d",g.interpolate("basis")(f)),k.append("path").attr("class","trendline line").attr("d",g.interpolate("linear")(m)),k.append("path").attr("class","actual line").attr("d",g.interpolate("linear").y(function(a){return q(a.points)})(c)),l=d.tip().attr("class","d3-tip").html(function(a){var b,c;return b=a.number,c=a.title,"#"+b+": "+c}),k.call(l),k.selectAll("a.issue").data(c.slice(1)).enter().append("svg:a").attr("xlink:href",function(a){var b;return b=a.html_url}).attr("xlink:show","new").append("svg:circle").attr("cx",function(a){var b;return b=a.date,o(b)}).attr("cy",function(a){var b;return b=a.points,q(b)}).attr("r",function(a){var b;return b=a.radius,5}).on("mouseover",l.show).on("mouseout",l.hide),b(null)}}}),b.require.register("ghbc/src/modules/issues.js",function(a,b,c){var d,e,f,g,h;h=b("./require"),g=h._,d=h.async,f=b("./request"),e=b("./regex"),c.exports={get_all:function(a,b){var c;return c=function(b,c){var d,e;return e=[],(d=function(h){return f.all_issues(a,{milestone:a.milestone.number,state:b,page:h},function(a,b){return a?c(a):b.length?(e=e.concat(g.sortBy(b,"closed_at")),b.length<100?c(null,e):d(h+1)):c(null,e)})})(1)},d.parallel([g.partial(c,"open"),g.partial(c,"closed")],b)},filter:function(a,b,c){var d,e;return e=0,d=g.filter(a,function(a){var c;return(c=a.labels)?(a.size=g.reduce(c,function(a,c){var d;return(d=c.name.match(b))?a+=parseInt(d[1]):a},0),e+=a.size,!!a.size):!1}),c(null,d,e)}}}),b.require.register("ghbc/src/modules/milestones.js",function(a,b,c){var d,e,f,g;g=b("./require"),f=g._,d=g.marked,e=b("./request"),c.exports=function(a,b){var c;return c=function(a){return a.description&&(a.description=d(a.description).slice(3,-5)),a},a.milestone?e.one_milestone(a,a.milestone,function(a,d){return a?b(a):d.open_issues+d.closed_issues===0?b(null,"No issues for milestone `"+d.title+"`"):(d=c(d),b(null,null,d))}):e.all_milestones(a,function(d,e){var g;return d?b(d):e.length?(g=e[0],g=f.rest(e,{due_on:null}),g=g[0]?g[0]:e[0],g.open_issues+g.closed_issues===0?b(null,"No issues for milestone `"+g.title+"`"):(g=c(g),b(null,null,g))):b(null,"No open milestones for repo "+a.path)})}}),b.require.register("ghbc/src/modules/regex.js",function(a,b,c){c.exports={datetime:/^(\d{4}-\d{2}-\d{2})T(.*)/,size_label:/^size (\d+)$/,location:/^#!((\/[^\/]+){2,3})$/}}),b.require.register("ghbc/src/modules/render.js",function(a,b,c){c.exports=function(a,c,d){var e;return null==d&&(d={}),e=b("../templates/"+c),document.querySelector(a).innerHTML=e(d)}}),b.require.register("ghbc/src/modules/repo.js",function(a,b,c){var d,e,f,g,h,i,j,k;k=b("./require"),j=k._,d=k.async,g=b("./milestones"),f=b("./issues"),e=b("./graph"),h=b("./regex"),i=b("./render"),c.exports=function(a,b){return d.waterfall([function(b){return g(a,function(c,d,e){return c?b(c):d?b(d):(a.milestone=e,b(null))})},function(b){return f.get_all(a,b)},function(b,c){return d.map(b,function(b,c){return f.filter(b,a.size_label,function(a,b,d){return c(a,[b,d])})},function(b,d){var e,f;return f=d[0],e=d[1],b?c(b):f[1]+e[1]===0?c("No matching issues found"):(a.issues={closed:{points:e[1],data:e[0]},open:{points:f[1],data:f[0]}},c(null))})},function(b){var c,f;return c=100*a.issues.closed.points/(f=a.issues.open.points+a.issues.closed.points),d.parallel([j.partial(e.actual,a.issues.closed.data,a.milestone.created_at,f),j.partial(e.ideal,a.milestone.created_at,a.milestone.due_on,a.off_days||[],f)],function(d,f){var g;return i("body","graph",{repo:a.path,milestone:a.milestone}),i("#progress","progress",{progress:c}),f[0].length&&f.push(e.trendline(f[0],a.milestone.created_at,a.milestone.due_on)),(g=function(){return e.render(f,b)})(),"onresize"in window?window.onresize=g:void 0})}],b)}}),b.require.register("ghbc/src/modules/request.js",function(a,b,c){var d,e,f,g,h,i,j;j=b("./require"),h=j.superagent,i=j._,h.parse={"application/json":function(a){var b;try{return JSON.parse(a)}catch(c){return b=c,{}}}},c.exports={all_milestones:function(a,b){return f({protocol:a.protocol,host:a.host,path:"/repos/"+a.path+"/milestones",query:{state:"open",sort:"due_date",direction:"asc"},headers:e(a.token)},b)},one_milestone:function(a,b,c){return f({protocol:a.protocol,host:a.host,path:"/repos/"+a.path+"/milestones/"+b,query:{state:"open",sort:"due_date",direction:"asc"},headers:e(a.token)},c)},all_issues:function(a,b,c){return f({protocol:a.protocol,host:a.host,path:"/repos/"+a.path+"/issues",query:i.extend(b,{per_page:"100"}),headers:e(a.token)},c)},config:function(a){return f({protocol:"http",host:window.location.host,path:""+window.location.pathname+"config.json",headers:i.extend(e(),{Accept:"application/json"})},a)}},f=function(a,b){var c,d,e,f,i,j,k,l,m,n,o;j=a.protocol,e=a.host,i=a.path,l=a.query,d=a.headers,c=!1,k=l?"?"+function(){var a;a=[];for(f in l)o=l[f],a.push(""+f+"="+o);return a}().join("&"):"",m=h.get(""+j+"://"+e+i+k);for(f in d)o=d[f],m.set(f,o);return n=setTimeout(function(){return c=!0,b("Request has timed out")},1e4),m.end(function(a,d){return c?void 0:(c=!0,clearTimeout(n),g(a,d,b))})},g=function(a,b,c){var e;return a?c(d(a)):2!==b.statusType?c(null!=(null!=b&&null!=(e=b.body)?e.message:void 0)?b.body.message:b.error.message):c(null,b.body)},e=function(a){var b;return b=i.extend({},{"Content-Type":"application/json",Accept:"application/vnd.github.v3"}),null!=a&&(b.Authorization="token "+a),b},d=function(a){var b;switch(!1){case!i.isString(a):b=a;break;case!i.isArray(a):b=a[1];break;case!(i.isObject(a)&&i.isString(a.message)):b=a.message}if(!b)try{b=JSON.stringify(a)}catch(c){b=a.toString()}return b}}),b.require.register("ghbc/src/modules/require.js",function(a,b,c){c.exports={_:_,superagent:superagent,d3:d3,async:async,marked:marked}}),b.require.register("ghbc/src/templates/error.js",function(a,b,c){c.exports=function(a){a||(a={});var b,c=[],d=a.safe,e=a.escape;return b=a.safe=function(a){if(a&&a.ecoSafe)return a;("undefined"==typeof a||null==a)&&(a="");var b=new String(a);return b.ecoSafe=!0,b},e||(e=a.escape=function(a){return(""+a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){c.push('
\n

Trouble

\n

'),c.push(this.text),c.push("

\n
")}).call(this)}.call(a),a.safe=d,a.escape=e,c.join("")}}),b.require.register("ghbc/src/templates/graph.js",function(a,b,c){c.exports=function(a){a||(a={});var b,c=[],d=a.safe,e=a.escape;return b=a.safe=function(a){if(a&&a.ecoSafe)return a;("undefined"==typeof a||null==a)&&(a="");var b=new String(a);return b.ecoSafe=!0,b},e||(e=a.escape=function(a){return(""+a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){c.push('
\n

'),c.push(this.milestone.title),c.push("@"),c.push(this.repo),c.push("

\n "),this.milestone.description&&(c.push('\n

'),c.push(this.milestone.description),c.push("

\n ")),c.push('\n
\n
\n
\n
\n
\n
')}).call(this)}.call(a),a.safe=d,a.escape=e,c.join("")}}),b.require.register("ghbc/src/templates/info.js",function(a,b,c){c.exports=function(a){a||(a={});var b,c=[],d=a.safe,e=a.escape;return b=a.safe=function(a){if(a&&a.ecoSafe)return a;("undefined"==typeof a||null==a)&&(a="");var b=new String(a);return b.ecoSafe=!0,b},e||(e=a.escape=function(a){return(""+a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){c.push('
\n

GitHub Burndown Chart

\n

Use your browser\'s location hash to specify a repo: #!/radekstepan/disposable.

\n

You can choose a specific milestone like so: #!/radekstepan/disposable/1.

\n
')}).call(this)}.call(a),a.safe=d,a.escape=e,c.join("")}}),b.require.register("ghbc/src/templates/label.js",function(a,b,c){c.exports=function(a){a||(a={});var b,c=[],d=a.safe,e=a.escape;return b=a.safe=function(a){if(a&&a.ecoSafe)return a;("undefined"==typeof a||null==a)&&(a="");var b=new String(a);return b.ecoSafe=!0,b},e||(e=a.escape=function(a){return(""+a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){var a;a=Math.ceil(this.points),c.push("\n"),a>1?(c.push("\n "),c.push(a),c.push(" points left\n")):(c.push("\n "),c.push(1===a?"\n 1 point left\n ":"\n Done\n "),c.push("\n"))}).call(this)}.call(a),a.safe=d,a.escape=e,c.join("")}}),b.require.register("ghbc/src/templates/loading.js",function(a,b,c){c.exports=function(a){a||(a={});var b,c=[],d=a.safe,e=a.escape;return b=a.safe=function(a){if(a&&a.ecoSafe)return a;("undefined"==typeof a||null==a)&&(a="");var b=new String(a);return b.ecoSafe=!0,b},e||(e=a.escape=function(a){return(""+a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){c.push('
\n

GitHub Burndown Chart

\n

Loading #!/'),c.push(this.path),c.push(".

\n
")}).call(this)}.call(a),a.safe=d,a.escape=e,c.join("")}}),b.require.register("ghbc/src/templates/progress.js",function(a,b,c){c.exports=function(a){a||(a={});var b,c=[],d=function(a){return a&&a.ecoSafe?a:"undefined"!=typeof a&&null!=a?f(a):""},e=a.safe,f=a.escape;return b=a.safe=function(a){if(a&&a.ecoSafe)return a;("undefined"==typeof a||null==a)&&(a="");var b=new String(a);return b.ecoSafe=!0,b},f||(f=a.escape=function(a){return(""+a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){c.push('
\n '),100===this.progress?c.push('\n
\n '):(c.push('\n
\n ')),c.push('\n
\n
\n

Closed / '),c.push(d(Math.floor(this.progress))),c.push('%

\n

Open / '),c.push(d(100-Math.floor(this.progress))),c.push("%

")}).call(this)}.call(a),a.safe=e,a.escape=f,c.join("")}})}();var c=b.require("ghbc/src/app.js");"undefined"!=typeof define&&define.amd?(define("ghbc",[],function(){return c}),define("ghb",[],function(){return c}),define("github-burndown-chart",[],function(){return c})):"undefined"!=typeof module&&module.exports?module.exports=c:(b.ghbc=c,b.ghb=c,b["github-burndown-chart"]=c),b.require.alias("ghbc/src/app.js","ghbc/index.js"),b.require.alias("ghbc/src/app.js","ghb/index.js"),b.require.alias("ghbc/src/app.js","github-burndown-chart/index.js")}();