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