"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["recent-commits-graph"],{"./web_src/js/components/RepoRecentCommits.vue":function(D,h,s){s.d(h,{default:function(){return I}});var e=s("./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js"),i=s("./node_modules/@vue/shared/dist/shared.esm-bundler.js");const E=t=>(_pushScopeId("data-v-33ced179"),t=t(),_popScopeId(),t),v={class:"ui header tw-flex tw-items-center tw-justify-between"},p={class:"tw-flex ui segment main-graph"},j={key:0,class:"gt-tc tw-m-auto"},g={key:0},f={key:1,class:"text red"};function y(t,o,r,c,l,m){const u=(0,e.g2)("SvgIcon"),R=(0,e.g2)("Bar");return(0,e.uX)(),(0,e.CE)("div",null,[(0,e.Lk)("div",v,(0,i.v_)(t.isLoading?r.locale.loadingTitle:t.errorText?r.locale.loadingTitleFailed:"Number of commits in the past year"),1),(0,e.Lk)("div",p,[t.isLoading||t.errorText!==""?((0,e.uX)(),(0,e.CE)("div",j,[t.isLoading?((0,e.uX)(),(0,e.CE)("div",g,[(0,e.bF)(u,{name:"octicon-sync",class:"tw-mr-2 job-status-rotate"}),(0,e.eW)(" "+(0,i.v_)(r.locale.loadingInfo),1)])):((0,e.uX)(),(0,e.CE)("div",f,[(0,e.bF)(u,{name:"octicon-x-circle-fill"}),(0,e.eW)(" "+(0,i.v_)(t.errorText),1)]))])):(0,e.Q3)("v-if",!0),t.data.length!==0?(0,e.bU)(t.data,()=>((0,e.uX)(),(0,e.Wv)(R,{key:1,data:m.toGraphData(t.data),options:m.getOptions()},null,8,["data","options"])),o,0):(0,e.Q3)("v-if",!0)])])}var w=s("./web_src/js/svg.js"),a=s("./node_modules/chart.js/dist/chart.js"),x=s("./web_src/js/modules/fetch.js"),b=s("./node_modules/vue-chartjs/dist/index.js"),n=s("./web_src/js/utils/time.js"),d=s("./web_src/js/utils/color.js"),k=s("./web_src/js/utils.js"),S=s("./node_modules/chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm.js");const{pageData:L}=window.config;a.t1.defaults.color=d.K.text,a.t1.defaults.borderColor=d.K.border,a.t1.register(a.UA,a.kc,a.E8,a.m_);var C={components:{Bar:b.yP,SvgIcon:w.Ah},props:{locale:{type:Object,required:!0}},data:()=>({isLoading:!1,errorText:"",repoLink:L.repoLink||[],data:[]}),mounted(){this.fetchGraphData()},methods:{async fetchGraphData(){this.isLoading=!0;try{let t;do t=await(0,x.fG)(`${this.repoLink}/activity/recent-commits/data`),t.status===202&&await(0,k.yy)(1e3);while(t.status===202);if(t.ok){const o=await t.json(),r=Object.values(o)[0].week,c=(0,n.Z1)(new Date),l=(0,n.Ex)(r,c);this.data=(0,n.a$)(l,o).slice(-52),this.errorText=""}else this.errorText=t.statusText}catch(t){this.errorText=t.message}finally{this.isLoading=!1}},toGraphData(t){return{datasets:[{data:t.map(o=>({x:o.week,y:o.commits})),label:"Commits",backgroundColor:d.K.commits,borderWidth:0,tension:.3}]}},getOptions(){return{responsive:!0,maintainAspectRatio:!1,animation:!0,scales:{x:{type:"time",grid:{display:!1},time:{minUnit:"week"},ticks:{maxRotation:0,maxTicksLimit:52}},y:{ticks:{maxTicksLimit:6}}}}}}},T=s("./node_modules/vue-loader/dist/exportHelper.js"),I=(0,T.A)(C,[["render",y],["__scopeId","data-v-33ced179"]])}}]);
