"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["code-frequency-graph"],{"./web_src/js/components/RepoCodeFrequency.vue":(function(I,p,s){s.d(p,{default:function(){return C}});var e=s("./node_modules/.pnpm/@vue+runtime-core@3.5.21/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js"),u=s("./node_modules/.pnpm/@vue+shared@3.5.21/node_modules/@vue/shared/dist/shared.esm-bundler.js"),n=s("./node_modules/.pnpm/@vue+reactivity@3.5.21/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js"),v=s("./web_src/js/svg.ts"),o=s("./node_modules/.pnpm/chart.js@4.5.0/node_modules/chart.js/dist/chart.js"),h=s("./web_src/js/modules/fetch.ts"),y=s("./node_modules/.pnpm/vue-chartjs@5.3.2_chart.js@4.5.0_vue@3.5.21_typescript@5.9.2_/node_modules/vue-chartjs/dist/index.js"),c=s("./web_src/js/utils/time.ts"),l=s("./web_src/js/utils/color.ts"),f=s("./web_src/js/utils.ts"),W=s("./node_modules/.pnpm/chartjs-adapter-dayjs-4@1.0.4_chart.js@4.5.0_dayjs@1.11.18/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:"tw-m-auto"},w={key:0},x={key:1,class:"text red"};var k=(0,e.pM)({__name:"RepoCodeFrequency",props:{locale:{}},setup(H){const{pageData:R}=window.config;o.t1.defaults.color=l.K.text,o.t1.defaults.borderColor=l.K.border,o.t1.register(o.UA,o.kc,o.s$,o.FN,o.No,o.dN);const i=(0,n.IJ)(!1),d=(0,n.IJ)(""),m=R.repoLink,r=(0,n.IJ)([]);(0,e.sV)(()=>{F()});async function F(){i.value=!0;try{let t;do t=await(0,h.fG)(`${m}/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),d.value=""}else d.value=t.statusText}catch(t){d.value=t.message}finally{i.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:l.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:l.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_)(i.value?t.locale.loadingTitle:d.value?t.locale.loadingTitleFailed:`Code frequency over the history of ${(0,n.R1)(m).slice(1)}`),1),(0,e.Lk)("div",g,[i.value||d.value!==""?((0,e.uX)(),(0,e.CE)("div",b,[i.value?((0,e.uX)(),(0,e.CE)("div",w,[(0,e.bF)((0,n.R1)(v.Ah),{name:"gitea-running",class:"tw-mr-2 rotate-clockwise"}),(0,e.eW)(" "+(0,u.v_)(t.locale.loadingInfo),1)])):((0,e.uX)(),(0,e.CE)("div",x,[(0,e.bF)((0,n.R1)(v.Ah),{name:"octicon-x-circle-fill"}),(0,e.eW)(" "+(0,u.v_)(d.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)])]))}}),_=s("./node_modules/.pnpm/vue-loader@17.4.2_vue@3.5.21_typescript@5.9.2__webpack@5.101.3/node_modules/vue-loader/dist/exportHelper.js"),C=(0,_.A)(k,[["__scopeId","data-v-4bd863ce"]])})}]);
