-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.min.js
1 lines (1 loc) · 16.6 KB
/
app.min.js
1
!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;d<c.length;d++){if(b=c[d],a.modules.hasOwnProperty(b))return b;if(a.aliases.hasOwnProperty(b))return a.aliases[b]}},a.normalize=function(a,b){var c=[];if("."!=b.charAt(0))return b;a=a.split("/"),b=b.split("/");for(var d=0;d<b.length;++d)".."==b[d]?a.pop():"."!==b[d]&&""!==b[d]&&c.push(b[d]);return a.concat(c).join("/")},a.register=function(b,c){a.modules[b]=c},a.alias=function(b,c){if(!a.modules.hasOwnProperty(b))throw new Error('Failed to alias "'+b+'", it does not exist');a.aliases[c]=b},a.relative=function(b){function c(a,b){for(var c=a.length;c--;)if(a[c]===b)return c;return-1}var d=a.normalize(b,".."),e=function(c){var d=e.resolve(c);return a(d,b,c)};return e.resolve=function(e){var f=e.charAt(0);if("/"==f)return e.slice(1);if("."==f)return a.normalize(d,e);var g=b.split("/"),h=c(g,"deps")+1;return h||(h=0),e=g.slice(0,h+1).join("/")+"/deps/"+e},e.exists=function(b){return a.modules.hasOwnProperty(e.resolve(b))},e};var b=this;b.require="undefined"!=typeof b.require?b.require:a,function(){b.require.register("ghbc/src/app.js",function(a,b,c){var d,e,f,g,h;d=b("./modules/config"),e=b("./modules/regex"),f=b("./modules/render"),g=b("./modules/repo"),h=function(){var a,b,c,h,i,j,k;return(b=window.location.hash.match(e.location))?(h=b[1].slice(1),f("body","loading",{path:h}),k=h.split("/"),j=k[0],i=k[1],a=k[2],c=a?{path:""+j+"/"+i,milestone:a}:{path:h},async.waterfall([d,function(a,b){return g(_.extend(c,a),b)}],function(a){return a?f("body","error",{text:a.toString()}):void 0})):f("body","info")},c.exports=function(){return"onhashchange"in window&&"hash"in window.location?(window.addEventListener("hashchange",h,!1),h()):f("body","error",{text:"URL fragment identifier not supported"})}}),b.require.register("ghbc/src/modules/config.js",function(a,b,c){var d,e,f,g,h,i,j,k,l=[].indexOf||function(a){for(var b=0,c=this.length;c>b;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?null!=(null!=b?null!=(e=b.body)?e.message:void 0:void 0)?c(b.body.message):c(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,">").replace(/"/g,""")}),function(){(function(){c.push('<div class="box error">\n <h2>Trouble</h2>\n <p>'),c.push(this.text),c.push("</p>\n</div>")}).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,">").replace(/"/g,""")}),function(){(function(){c.push('<div class="box">\n <h1>'),c.push(this.milestone.title),c.push("@"),c.push(this.repo),c.push("</h1>\n "),this.milestone.description&&(c.push('\n <p class="description">'),c.push(this.milestone.description),c.push("</p>\n ")),c.push('\n <div id="graph">\n <div id="tooltip"></div>\n <div id="svg"></div>\n </div>\n <div id="progress"></div>\n</div>')}).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,">").replace(/"/g,""")}),function(){(function(){c.push('<div class="box info">\n <h2>GitHub Burndown Chart</h2>\n <p>Use your browser\'s location hash to specify a <strong>repo</strong>: <a href="#!/radekstepan/disposable">#!/radekstepan/disposable</a>.</p>\n <p>You can choose a specific <strong>milestone</strong> like so: <a href="#!/radekstepan/disposable/1">#!/radekstepan/disposable/1</a>.</p>\n</div>')}).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,">").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 "),1===a?c.push("\n 1 point left\n "):c.push("\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,">").replace(/"/g,""")}),function(){(function(){c.push('<div class="box generic">\n <h2>GitHub Burndown Chart</h2>\n <p>Loading <a href="#!/'),c.push(this.path),c.push('">#!/'),c.push(this.path),c.push("</a>.</p>\n</div>")}).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,">").replace(/"/g,""")}),function(){(function(){c.push('<div class="bars">\n '),100===this.progress?c.push('\n <div class="closed done" style="width:100%"></div>\n '):(c.push('\n <div class="closed" style="width:'),c.push(d(this.progress)),c.push('%"></div>\n ')),c.push('\n <div class="opened"></div>\n</div>\n<h2 class="closed">Closed / '),c.push(d(Math.floor(this.progress))),c.push('%</h2>\n<h2 class="opened">Open / '),c.push(d(100-Math.floor(this.progress))),c.push("%</h2>")}).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")}();