1import{j as a}from"./jsx-runtime-esm-DTyOgi_0.js";import{i as A,j as D,k as K,r as T,s as V}from"./user-avatar-D5dLrL9H.js";import{u as L}from"./useElementWidth-10iJPZvu.js";import{r as i}from"./index-CsMFFT-v.js";import{a as U,u as w}from"./useChartConfig-CXHE-gKL.js";import{P as $,a as k}from"./PieChart-CfOxsUwc.js";import{C as X,a as G,S as H}from"./generateCategoricalChart-CPwhb7HJ.js";import"./index-C_JZkldU.js";import"./Icon-CnFFSAzR.js";import"./_commonjsHelpers-BSwYQMY7.js";import"./index-DSDHQDTJ.js";import"./isEqual-fE_JfsU4.js";import"./normalizeDates-CHGcse8c.js";import"./SelectInput-BgIRIVwG.js";import"./PolarAngleAxis-CPBiJT3K.js";import"./utcYear-BPgsGuX-.js";import"./findIndex-DYOCllxm.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"5ee2174"},r._sentryModuleMetadata=r._sentryModuleMetadata||{},r._sentryModuleMetadata[new r.Error().stack]=(function(c){for(var d=1;d<arguments.length;d++){var u=arguments[d];if(u!=null)for(var f in u)u.hasOwnProperty(f)&&(c[f]=u[f])}return c})({},r._sentryModuleMetadata[new r.Error().stack],{"_sentryBundlerPluginAppKey:noloco-renderer":!0});var o=new r.Error().stack;o&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[o]="73a79314-1646-4086-a139-b6e897a7560b",r._sentryDebugIdIdentifier="sentry-dbid-73a79314-1646-4086-a139-b6e897a7560b")}catch{}})();const O=80,W=150,q=125,F=20,S=5,v=r=>{if(r===0)return"0%";const o=r*100;return`${Number(o.toFixed(1))}%`},de=({data:r,series:o,fills:c,primaryAxisFormatter:d,secondaryAxisFormatter:u,cellFillsMap:f,showPercentages:m=!1})=>{const b=i.useRef(null),h=U(r,c,f),E=w(o,h),y=L(b),g=i.useMemo(()=>{const e=m?q:W;if(!y)return e;const t=Math.min(y/4,e);return Math.max(t,O)},[y,m]),_=i.useMemo(()=>Math.max(g/4,F),[g]),l=i.useMemo(()=>r.map(e=>({...e,x:d(e.x)})),[r,d]),j=i.useMemo(()=>{const e={...E};return l.forEach(t=>{e[t.x]||(e[t.x]={label:t.x})}),e},[E,l]),[p,x]=i.useState(null),N=i.useMemo(()=>{const e=new Map;return l.forEach((t,n)=>{e.set(t.x,h[n%h.length])}),e},[l,h]),I=i.useMemo(()=>{if(p?.showCenterValue){const e=l[p.index],t=o[0];if(e&&t)return String(u(e[t.id]))}return null},[p,l,o,u]),P=i.useMemo(()=>m?o.reduce((e,t)=>{e[t.id]={};let n=0;const s={};return l.forEach(M=>{const C=M[t.id],R=typeof C=="number"?C:0;s[String(M.x)]=R,n+=R}),Object.entries(s).forEach(([M,C])=>{e[t.id][M]=C/n}),e},{}):{},[l,o,m]);return a.jsx(A,{className:"h-96",config:j,ref:b,children:a.jsxs($,{children:[a.jsx(D,{content:a.jsx(K,{labelFormatter:(e,t)=>t[0].dataKey?j[t[0].dataKey]?.label:null,valueFormatter:(e,t)=>{if(!m)return e;const n=(t.dataKey&&t.name?P[t.dataKey][t.name]:void 0)??0;return a.jsxs(a.Fragment,{children:[a.jsx("span",{children:u(e)}),a.jsxs("span",{className:"ml-1",children:["(",v(n),")"]})]})}})}),a.jsx(T,{align:"left",className:"flex flex-col items-start gap-0",content:a.jsx(V,{activeIndex:p?.index,itemClassName:"py-1",labelClassName:"max-w-[120px] truncate",nameKey:"x",onMouseEnterValue:e=>x({index:e,showCenterValue:!0}),onMouseLeaveValue:()=>x(null)}),layout:"vertical",payloadUniqBy:!0,verticalAlign:"top",wrapperStyle:{height:"100%",overflow:"auto"}}),o.map((e,t)=>a.jsxs(k,{activeIndex:p?.index,cornerRadius:2,data:l,dataKey:e.id,fill:e.color??`var(--color-${e.id})`,inactiveShape:({...n})=>a.jsx(H,{...n,className:"opacity-50"}),innerRadius:g-_*t-S*t,label:m&&t===0?n=>{const s=v(n.percent);return s==="0%"?"":s||""}:void 0,nameKey:"x",onMouseEnter:(n,s)=>x({index:s,seriesId:e.id}),onMouseLeave:()=>x(null),outerRadius:g-_*(t-1)-S*t,paddingAngle:2,children:[l.map((n,s)=>a.jsx(X,{className:"cursor-pointer",fill:N?.get(n.x)||c[s%c.length]},`cell-${e.id}-${n.x}-${s}`)),t===o.length-1&&a.jsx(G,{content:({viewBox:n})=>{if(n&&"cx"in n&&"cy"in n)return a.jsx("text",{className:"fill-foreground text-lg font-semibold",dominantBaseline:"middle",textAnchor:"middle",x:n.cx,y:n.cy,children:I})}})]},e.id))]})})};export{de as ProjectPieChart,de as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.