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