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