"use strict";(self.webpackChunkforgejo=self.webpackChunkforgejo||[]).push([["node_modules_mermaid_dist_chunks_mermaid_core_pieDiagram-SKSYHLDU_mjs"],{"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs":(function(W,f,o){o.d(f,{S:function(){return _}});var v=o("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs");function _(c,r){c.accDescr&&r.setAccDescription?.(c.accDescr),c.accTitle&&r.setAccTitle?.(c.accTitle),c.title&&r.setDiagramTitle?.(c.title)}(0,v.K2)(_,"populateCommonDb")}),"./node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-SKSYHLDU.mjs":(function(W,f,o){o.d(f,{diagram:function(){return re}});var v=o("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-HHEYEP7N.mjs"),_=o("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-4BX2VUAB.mjs"),c=o("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-GEFDOKGD.mjs"),r=o("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-7R4GIKGN.mjs"),i=o("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs"),F=o("./node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs"),p=o("./node_modules/d3/src/index.js"),O=r.UI.pie,E={sections:new Map,showData:!1,config:O},h=E.sections,S=E.showData,b=structuredClone(O),N=(0,i.K2)(()=>structuredClone(b),"getConfig"),H=(0,i.K2)(()=>{h=new Map,S=E.showData,(0,r.IU)()},"clear"),z=(0,i.K2)(({label:e,value:a})=>{if(a<0)throw new Error(`"${e}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);h.has(e)||(h.set(e,a),i.Rm.debug(`added new section: ${e}, with value: ${a}`))},"addSection"),J=(0,i.K2)(()=>h,"getSections"),V=(0,i.K2)(e=>{S=e},"setShowData"),Y=(0,i.K2)(()=>S,"getShowData"),P={getConfig:N,clear:H,setDiagramTitle:r.ke,getDiagramTitle:r.ab,setAccTitle:r.SV,getAccTitle:r.iN,setAccDescription:r.EI,getAccDescription:r.m7,addSection:z,getSections:J,setShowData:V,getShowData:Y},X=(0,i.K2)((e,a)=>{(0,_.S)(e,a),a.setShowData(e.showData),e.sections.map(a.addSection)},"populateDb"),Z={parse:(0,i.K2)(async e=>{const a=await(0,F.qg)("pie",e);i.Rm.debug(a),X(a,P)},"parse")},Q=(0,i.K2)(e=>`
  .pieCircle{
    stroke: ${e.pieStrokeColor};
    stroke-width : ${e.pieStrokeWidth};
    opacity : ${e.pieOpacity};
  }
  .pieOuterCircle{
    stroke: ${e.pieOuterStrokeColor};
    stroke-width: ${e.pieOuterStrokeWidth};
    fill: none;
  }
  .pieTitleText {
    text-anchor: middle;
    font-size: ${e.pieTitleTextSize};
    fill: ${e.pieTitleTextColor};
    font-family: ${e.fontFamily};
  }
  .slice {
    font-family: ${e.fontFamily};
    fill: ${e.pieSectionTextColor};
    font-size:${e.pieSectionTextSize};
    // fill: white;
  }
  .legend text {
    fill: ${e.pieLegendTextColor};
    font-family: ${e.fontFamily};
    font-size: ${e.pieLegendTextSize};
  }
`,"getStyles"),q=Q,ee=(0,i.K2)(e=>{const a=[...e.values()].reduce((s,l)=>s+l,0),R=[...e.entries()].map(([s,l])=>({label:s,value:l})).filter(s=>s.value/a*100>=1).sort((s,l)=>l.value-s.value);return(0,p.rLf)().value(s=>s.value)(R)},"createPieArcs"),te=(0,i.K2)((e,a,R,$)=>{i.Rm.debug(`rendering pie chart
`+e);const s=$.db,l=(0,r.D7)(),M=(0,c.$t)(s.getConfig(),l.pie),y=40,d=18,g=4,m=450,k=m,A=(0,v.D)(a),u=A.append("g");u.attr("transform","translate("+k/2+","+m/2+")");const{themeVariables:n}=l;let[j]=(0,c.I5)(n.pieOuterStrokeWidth);j??(j=2);const B=M.textPosition,D=Math.min(k,m)/2-y,ie=(0,p.JLW)().innerRadius(0).outerRadius(D),se=(0,p.JLW)().innerRadius(D*B).outerRadius(D*B);u.append("circle").attr("cx",0).attr("cy",0).attr("r",D+j/2).attr("class","pieOuterCircle");const C=s.getSections(),ne=ee(C),oe=[n.pie1,n.pie2,n.pie3,n.pie4,n.pie5,n.pie6,n.pie7,n.pie8,n.pie9,n.pie10,n.pie11,n.pie12];let T=0;C.forEach(t=>{T+=t});const G=ne.filter(t=>(t.data.value/T*100).toFixed(0)!=="0"),x=(0,p.UMr)(oe);u.selectAll("mySlices").data(G).enter().append("path").attr("d",ie).attr("fill",t=>x(t.data.label)).attr("class","pieCircle"),u.selectAll("mySlices").data(G).enter().append("text").text(t=>(t.data.value/T*100).toFixed(0)+"%").attr("transform",t=>"translate("+se.centroid(t)+")").style("text-anchor","middle").attr("class","slice"),u.append("text").text(s.getDiagramTitle()).attr("x",0).attr("y",-(m-50)/2).attr("class","pieTitleText");const I=[...C.entries()].map(([t,w])=>({label:t,value:w})),K=u.selectAll(".legend").data(I).enter().append("g").attr("class","legend").attr("transform",(t,w)=>{const U=d+g,le=U*I.length/2,de=12*d,me=w*U-le;return"translate("+de+","+me+")"});K.append("rect").attr("width",d).attr("height",d).style("fill",t=>x(t.label)).style("stroke",t=>x(t.label)),K.append("text").attr("x",d+g).attr("y",d-g).text(t=>s.getShowData()?`${t.label} [${t.value}]`:t.label);const ce=Math.max(...K.selectAll("text").nodes().map(t=>t?.getBoundingClientRect().width??0)),L=k+y+d+g+ce;A.attr("viewBox",`0 0 ${L} ${m}`),(0,r.a$)(A,m,L,M.useMaxWidth)},"draw"),ae={draw:te},re={parser:Z,db:P,renderer:ae,styles:q}})}]);
