@divami-artefacts/ai-design-system 1.0.51 → 1.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`react-dom/client`),t=require(`react`),n=require(`react/jsx-runtime`);function r({children:e,className:t=``}){return(0,n.jsx)(`div`,{className:`d3-chart ${t}`.trim(),children:e})}var i={bg:`#0C0E12`,bgL:`#0C1420`,sf:`#13161B`,bd:`#22262F`,blue:`#4C93D9`,cyan:`#36BFFA`,orange:`#EC772A`,red:`#EC772A`,green:`#5DA537`,purple:`#818FF8`,amber:`#EEBF3B`,teal:`#69DFE9`,tealDark:`#00818F`,t1:`#F7F9FA`,t2:`#B3B5B6`,t3:`#94979C`,t4:`#334155`},a={teal:[`#00818F`,`#69DFE9`],violet:[`#5B3CB1`,`#C8B6F3`],mint:[`#27837A`,`#81E8CE`],magenta:[`#8732A7`,`#E7A1F0`],sky:[`#0068BE`,`#8EC2F6`],blue:[`#084CF0`,`#8BA9FF`],purple:[`#5C42B8`,`#9DA5FD`],royal:[`#2556C8`,`#A9B1F8`],success:[`#58B21C`,`#97F558`],warning:[`#FFD974`,`#E4AA0D`],error:[`#EC8C42`,`#E46A0D`]},o={teal:`#69DFE9`,violet:`#C8B6F3`,mint:`#81E8CE`,magenta:`#E7A1F0`,sky:`#0068BE`,blue:`#084CF0`,purple:`#5C42B8`,royal:`#2556C8`,success:`#58B21C`,warning:`#E4AA0D`,error:`#E46A0D`},s=[i.blue,i.amber,i.purple,i.green,i.red],c=[i.teal,i.purple,i.amber,i.blue,i.green],l={font:`400 16px 'Satoshi Variable', 'DM Sans', sans-serif`,color:`#F7F7F7`,letterSpacing:`0px`},u={font:`500 16px 'Satoshi Variable', 'DM Sans', sans-serif`,color:`#F7F7F7`},d={font:`400 18px 'Satoshi Variable', 'DM Sans', sans-serif`,color:`#B3B5B6`,letterSpacing:`0px`};function f(e,t=1){let n=e.replace(`#`,``);return`rgba(${parseInt(n.substring(0,2),16)},${parseInt(n.substring(2,4),16)},${parseInt(n.substring(4,6),16)},${t})`}function p(e,t,n){return e+(t-e)*n}function m(e,t,n){let r=e=>{let t=e.replace(`#`,``);return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]},[i,a,o]=r(e),[s,c,l]=r(t),u=e=>Math.max(0,Math.min(255,Math.round(e)));return[u(p(i,s,n)),u(p(a,c,n)),u(p(o,l,n))].map(e=>e.toString(16).padStart(2,`0`)).join(``).replace(/^/,`#`)}function h(e,t,n,r=2){e.width=t*r,e.height=n*r;let i=e.getContext(`2d`);return i.scale(r,r),i}function g(e,t,n,r,i,a=.3){let o=e.createRadialGradient(t,n,0,t,n,r);o.addColorStop(0,f(i,a)),o.addColorStop(1,f(i,0)),e.fillStyle=o,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill()}function _(e,t,n,r,a=50,o=f(i.blue,.05)){for(let i=0;i<a;i++)e.beginPath(),e.arc((Math.sin(r*.001+i*23)*.5+.5)*t,(Math.cos(r*8e-4+i*37)*.5+.5)*n,.6,0,Math.PI*2),e.fillStyle=o,e.fill()}function v(e,t,n,r,i=.015){e.fillStyle=`rgba(0,0,0,${i})`;let a=r*.5%6;for(let r=a;r<n;r+=3)e.fillRect(0,r,t,1)}function y(e,t,n,r,a=f(i.t1,.08)){e.strokeStyle=a,e.lineWidth=1,e.setLineDash([3,3]),e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.stroke(),e.setLineDash([])}function b({visible:e,x:r,y:a,content:o,parentW:s,parentH:c}){let l=(0,t.useRef)(null);if((0,t.useLayoutEffect)(()=>{let t=l.current;if(!t)return;let n=t.offsetWidth,u=t.offsetHeight,d=s??400,f=c??800,p=r+14,m=a-u-14;p+n>d-4&&(p=r-n-14),m<4&&(m=a+14),p<4&&(p=4),m+u>f-4&&(m=f-u-4),t.style.transform=`translate(${p}px, ${m}px)`,t.style.opacity=e?`1`:`0`;let h=o&&typeof o==`object`&&o.color?o.color:i.blue;t.style.setProperty(`--tooltip-accent`,h??i.blue)},[e,r,a,s,o]),!o)return null;let u=typeof o==`object`,d=u?o.label:null,f=u?o.value:o,p=u?o.sublabel:null;return(0,n.jsxs)(`div`,{ref:l,style:{position:`absolute`,top:0,left:0,minWidth:80,pointerEvents:`none`,background:i.sf,border:`1px solid ${i.bd}`,borderLeft:`2px solid var(--tooltip-accent)`,borderRadius:6,padding:`8px 12px`,opacity:0,transition:`opacity 0.15s ease`,zIndex:20,fontFamily:`'Satoshi Variable', 'DM Sans', sans-serif`},children:[d&&(0,n.jsx)(`div`,{style:{fontSize:14,fontWeight:400,color:i.t2,marginBottom:3,whiteSpace:`nowrap`,lineHeight:`20px`},children:d}),f&&(0,n.jsx)(`div`,{style:{fontSize:16,fontWeight:500,color:i.t1,whiteSpace:`nowrap`,lineHeight:`22px`},children:f}),p&&(0,n.jsx)(`div`,{style:{fontSize:14,fontWeight:400,color:`var(--tooltip-accent)`,marginTop:3,whiteSpace:`nowrap`,lineHeight:`20px`},children:p})]})}function x(e,{width:n,height:r,onClick:i,enabled:a=!0}){let o=(0,t.useRef)({x:-1,y:-1,over:!1}),s=(0,t.useRef)(null),c=(0,t.useRef)([]),[l,u]=(0,t.useState)({visible:!1,x:0,y:0,content:null}),d=(0,t.useCallback)((e,t,n)=>{u({visible:!0,x:e,y:t,content:n})},[]),f=(0,t.useCallback)(()=>{u(e=>e.visible?{visible:!1,x:e.x,y:e.y,content:e.content}:e)},[]);return(0,t.useEffect)(()=>{let t=e.current;if(!t||!a)return;let l=e=>{let i=t.getBoundingClientRect(),a=n/i.width,l=r/i.height;o.current.x=(e.clientX-i.left)*a,o.current.y=(e.clientY-i.top)*l,o.current.over=!0;let u=null,p=c.current;for(let e=p.length-1;e>=0;e--)if(p[e].test(o.current.x,o.current.y)){u=p[e];break}let m=s.current;s.current=u?u.id:null,t.style.cursor=u?`pointer`:`default`,u?d((e.clientX-i.left)*a,(e.clientY-i.top)*l,u.data):m&&f()},u=()=>{o.current={x:-1,y:-1,over:!1},s.current&&(s.current=null,t.style.cursor=`default`,f())},p=()=>{if(s.current&&i){let e=c.current.find(e=>e.id===s.current);e&&i(e.id,e.data)}};return t.addEventListener(`mousemove`,l),t.addEventListener(`mouseleave`,u),t.addEventListener(`click`,p),()=>{t.removeEventListener(`mousemove`,l),t.removeEventListener(`mouseleave`,u),t.removeEventListener(`click`,p)}},[e,n,r,a,i,d,f]),{mouseRef:o,hoveredRef:s,tooltip:l,showTooltip:d,hideTooltip:f,hitZonesRef:c}}function S(e,t,n,r,i,a){e.push({id:t,data:a,test:(e,t)=>(e-n)**2+(t-r)**2<=i*i})}function C(e,t,n,r,i,a,o){e.push({id:t,data:o,test:(e,t)=>e>=n&&e<=n+i&&t>=r&&t<=r+a})}var w=e=>1-(1-e)**3,T=e=>1-(1-e)**4,E=e=>e===1?1:1-2**(-10*e),D=e=>{let t=1.70158;return 1+(t+1)*(e-1)**3+t*(e-1)**2},O=(e,t=.04,n=.001)=>Math.sin(e*t)*Math.exp(-Math.min(e*n,4)),k=(e,t,n,r=w)=>{let i=Math.min(.06,.5/n),a=t*i,o=1-(n-1)*i;return r(Math.max(0,Math.min((e-a)/o,1)))};function A(e,t,n=.12){e.forEach((r,i)=>{let a=i===t?1:0,o=r+(a-r)*n;Math.abs(o-a)<.005?a===0?e.delete(i):e.set(i,1):e.set(i,o)}),t&&!e.has(t)&&e.set(t,0)}var j=760,M=250;function N({rows:e=[],variant:a,className:o,colors:s}){let c=(0,t.useRef)(null),l=(0,t.useRef)(new Map),u=(0,t.useRef)(0),{mouseRef:d,hoveredRef:p,tooltip:m,hitZonesRef:_}=x(c,{width:j,height:M});return(0,t.useEffect)(()=>{let t=c.current;if(!t)return;let n=h(t,j,M);u.current=0;let r=s?.line??i.blue,o=s?.point??i.blue,m=s?.axisLine??i.bd,v=s?.areaFill??i.blue,b={top:24,right:24,bottom:44,left:24},x=j-b.left-b.right,C=M-b.top-b.bottom,w,T=()=>{u.current++;let t=u.current;if(n.clearRect(0,0,j,M),e.length<2){w=requestAnimationFrame(T);return}let s=e.map(e=>e.pricing??0),c=Math.max(100,...s),h=t=>b.left+t/(e.length-1)*x,D=e=>b.top+(1-e/c)*C,k=E(Math.min(t/48,1)),N=Math.max(2,Math.floor(k*e.length));A(l.current,p.current),_.current=[],n.strokeStyle=f(i.bd,.2),n.lineWidth=.5;for(let e=0;e<=4;e++){let t=b.top+e/4*C;n.beginPath(),n.moveTo(b.left,t),n.lineTo(b.left+x,t),n.stroke()}if(n.strokeStyle=f(m,.4),n.lineWidth=1,n.setLineDash([]),n.beginPath(),n.moveTo(b.left,D(0)),n.lineTo(b.left+x,D(0)),n.stroke(),d.current.over&&p.current){let e=parseInt(p.current.split(`-`)[1]);isNaN(e)||y(n,h(e),b.top,b.top+C)}if(a===`area`&&N>1){let t=n.createLinearGradient(0,b.top,0,b.top+C);t.addColorStop(0,f(v,.12)),t.addColorStop(1,f(v,0)),n.fillStyle=t,n.beginPath(),n.moveTo(h(0),b.top+C);for(let t=0;t<N;t++)n.lineTo(h(t),D(e[t].pricing??0));n.lineTo(h(N-1),b.top+C),n.closePath(),n.fill()}if(N>1){n.strokeStyle=f(r,.85),n.lineWidth=2,n.setLineDash([]),n.beginPath();for(let t=0;t<N;t++){let r=h(t),i=D(e[t].pricing??0);t===0?n.moveTo(r,i):n.lineTo(r,i)}n.stroke()}for(let r=0;r<N;r++){let s=h(r),c=D(e[r].pricing??0),u=`sc-${r}`,d=l.current.get(u)??0,p=r===e.length-1;S(_.current,u,s,c,12,{label:e[r].vendor,value:String(e[r].pricing??0),color:p?i.red:o}),d>0&&g(n,s,c,16*d,o,.2*d);let m=p?O(t,.05,5e-4):0,v=a===`area`?5:6;p?(n.shadowColor=f(i.red,.5),n.shadowBlur=(8+m*4)*(1+d*.5),n.fillStyle=i.red,n.beginPath(),n.arc(s,c,(v+m*1.5)*(1+d*.3),0,Math.PI*2),n.fill(),n.shadowBlur=0):(n.fillStyle=f(o,.7+d*.3),n.beginPath(),n.arc(s,c,v+d*2,0,Math.PI*2),n.fill()),n.font=`10px 'JetBrains Mono', monospace`,n.fillStyle=f(i.t3,.6+d*.3),n.textAlign=`center`,n.fillText(e[r].vendor,s,M-14)}w=requestAnimationFrame(T)};return T(),()=>cancelAnimationFrame(w)},[e,a,s]),(0,n.jsx)(r,{className:o,children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:j,height:M},children:[(0,n.jsx)(`canvas`,{ref:c,role:`img`,"aria-label":`${a} chart`,style:{width:j,height:M,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...m,parentW:j,parentH:M})]})})}function P({rows:e=[],className:t,colors:r}){return(0,n.jsx)(N,{rows:e,variant:`area`,className:t,colors:r})}var F=760,ee=280;function te({rows:e=[],className:a,colors:o}){let c=(0,t.useRef)(null),l=(0,t.useRef)(new Map),u=(0,t.useRef)(0),{hoveredRef:d,tooltip:p,hitZonesRef:m}=x(c,{width:F,height:ee});return(0,t.useEffect)(()=>{let t=c.current;if(!t)return;let n=h(t,F,ee);u.current=0;let r=o?.bars??s,a=o?.axisLine??i.bd,p=o?.valueLabel??i.t2,_={top:24,right:24,bottom:56,left:24},v=ee-_.top-_.bottom,y=(F-_.left-_.right)/Math.max(e.length,1),b=Math.max(100,...e.map(e=>e.pricing??0)),x=_.top+v,S,w=()=>{u.current++;let t=u.current;n.clearRect(0,0,F,ee);let o=T(Math.min(t/48,1));A(l.current,d.current),m.current=[],n.strokeStyle=f(a,.4),n.lineWidth=1,n.setLineDash([]),n.beginPath(),n.moveTo(_.left,x),n.lineTo(F-_.right,x),n.stroke(),e.forEach((t,a)=>{let s=_.left+a*y,c=k(o,a,e.length,T),u=b>0?(t.pricing??0)/b*v:0,d=Math.max(u>0?4:0,u*c),h=r[a%r.length],S=l.current.get(t.id??`bar-${a}`)??0;C(m.current,t.id??`bar-${a}`,s+4,x-d,y-8,d,{label:t.vendor,value:String(t.pricing??0),color:h}),d>0&&(S>0&&g(n,s+y/2,x-d/2,y*.8,h,.12*S),n.shadowColor=f(h,.2*(S>0?S:0)),n.shadowBlur=S>0?6:0,n.fillStyle=f(h,.5+S*.25),n.beginPath(),n.roundRect(s+4,x-d,y-8,d,[4,4,0,0]),n.fill(),n.shadowBlur=0,S>0&&(n.strokeStyle=f(h,.4*S),n.lineWidth=1,n.beginPath(),n.roundRect(s+4,x-d,y-8,d,[4,4,0,0]),n.stroke())),c>.5&&d>0&&(n.globalAlpha=Math.min(1,(c-.5)*2),n.font=`bold 10px 'JetBrains Mono', monospace`,n.fillStyle=S>0?h:f(p,.7),n.textAlign=`center`,n.fillText(String(t.pricing??``),s+y/2,x-d-6),n.globalAlpha=1),n.font=`${S>0?`bold `:``}9px 'JetBrains Mono', monospace`,n.fillStyle=S>0?h:f(i.t3,.6),n.textAlign=`center`,n.fillText(t.vendor,s+y/2,ee-14)}),S=requestAnimationFrame(w)};return w(),()=>cancelAnimationFrame(S)},[e,o]),(0,n.jsx)(r,{className:a,children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:F,height:ee},children:[(0,n.jsx)(`canvas`,{ref:c,role:`img`,"aria-label":`bar chart`,style:{width:F,height:ee,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...p,parentW:F,parentH:ee})]})})}function I({width:e,height:t,message:r=`No data available`,"data-testid":i}){return(0,n.jsx)(`div`,{"data-testid":i,style:{width:e,height:t,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:8,background:`rgba(255,255,255,0.03)`,color:`rgba(255,255,255,0.35)`,fontSize:14,fontFamily:`'Satoshi Variable', 'DM Sans', sans-serif`},children:r})}function ne({expanded:e,onToggle:t,labelExpanded:r=`View Less`,labelCollapsed:i=`View More`,"data-testid":a}){return(0,n.jsxs)(`button`,{type:`button`,"data-testid":a,onClick:t,style:{display:`flex`,width:90,height:20,justifyContent:`center`,alignItems:`center`,gap:4,boxSizing:`border-box`,border:`none`,borderRadius:6,color:`#69DFE9`,fontSize:14,fontFamily:`'Satoshi Variable', 'DM Sans', sans-serif`,fontStyle:`normal`,fontWeight:400,lineHeight:`19.5px`,textAlign:`center`,cursor:`pointer`,userSelect:`none`},children:[e?r:i,(0,n.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,style:{transform:e?`rotate(180deg)`:`rotate(0deg)`},children:(0,n.jsx)(`path`,{d:`M2 3.5L5 6.5L8 3.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]})}var L=660,re=6,ie=30,ae=24,oe=24,se=8;function ce(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(r+`…`).width>n;)r=r.slice(0,-1);return r+`…`}function le({items:e=[],colorOffset:r=0,"data-testid":a}){let o=(0,t.useRef)(null),s=(0,t.useRef)(0),d=(0,t.useRef)(new Map),[p,m]=(0,t.useState)(!1),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),T=(0,t.useMemo)(()=>[...y].sort((e,t)=>(t.percentage??0)-(e.percentage??0)),[y]),E=(0,t.useMemo)(()=>p?T:T.slice(0,se),[T,p]),D=E.length,O=ae+oe+D*re+Math.max(0,D-1)*ie,{hoveredRef:k,tooltip:A,hitZonesRef:j}=x(o,{width:L,height:O});return(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=h(e,L,O);s.current=0;let n=L-150-80,a=c[r%c.length],p,m=()=>{s.current++;let e=s.current;t.clearRect(0,0,L,O),t.letterSpacing=l.letterSpacing,j.current=[],d.current.forEach((e,t)=>{let n=t===k.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?d.current.delete(t):d.current.set(t,1):d.current.set(t,r)}),k.current&&!d.current.has(k.current)&&d.current.set(k.current,0),_(t,L,O,e,40,f(i.blue,.04)),E.forEach((r,o)=>{let s=d.current.get(r.id)??0,c=ae+o*(re+ie),p=t.createLinearGradient(150,0,150+n,0);p.addColorStop(0,f(i.tealDark,.55+s*.1)),p.addColorStop(1,f(i.tealDark,.22+s*.08)),t.fillStyle=p,t.beginPath(),t.rect(150,c,n,re),t.fill();let m=(r.percentage??0)/100,h=150+n*Math.min(m,m*w(Math.min(1,e*.005)));if(h>152){let e=t.createLinearGradient(150,0,h,0);e.addColorStop(0,f(a,.55)),e.addColorStop(1,f(a,.9)),t.fillStyle=e,t.beginPath(),t.rect(150,c,h-150,re),t.fill()}s>0&&g(t,h,c+re/2,12*s,a,.35*s);let _={label:r.name,value:`${r.percentage??0}%`,sublabel:r.totalLabel??(r.total==null?void 0:String(r.total)),color:a};C(j.current,r.id,0,c-ie/2,150+n,re+ie,_),S(j.current,r.id,h,c+re/2,10,_),t.font=u.font,t.fillStyle=s>0?f(a,1):f(i.t1,.85),t.textAlign=`left`,t.textBaseline=`middle`,t.fillText(`${r.percentage??0}%`,150+n+32,c+re/2),t.font=l.font,t.fillStyle=s>0?f(a,1):l.color,t.textAlign=`right`,t.fillText(ce(t,r.name??r.abbreviation??``,134),142,c+re/2)}),v(t,L,O,e,.015),p=requestAnimationFrame(m)};return m(),()=>cancelAnimationFrame(p)},[E,O,r]),T.length===0?(0,n.jsx)(I,{width:L,height:160,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,style:{width:L},children:[(0,n.jsxs)(`div`,{style:{position:`relative`},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Commitment race — contractors ranked by commitment percentage`,style:{width:L,height:O,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...A,parentW:L,parentH:O})]}),y.length>se&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(ne,{expanded:p,onToggle:()=>m(e=>!e)})})]})}var ue=480,de=310,fe=18,pe=[`#00818F`,`#5C42B8`,`#C87B0A`,`#2563EB`,`#166534`];function me(e,t,n){let r=t.split(` `),i=[],a=``;for(let t of r){let r=a?`${a} ${t}`:t;e.measureText(r).width>n&&a?(i.push(a),a=t):a=r}return a&&i.push(a),i}function he({confirmed:e,total:r,label:a,colorOffset:o=0,"data-testid":s}){let u=(0,t.useRef)(null),p=(0,t.useRef)(0);return(0,t.useEffect)(()=>{let t=u.current;if(!t)return;let n=h(t,ue,de);p.current=0;let s=o%c.length,m=c[s],_=pe[s],v=ue/2,y=Math.PI,b=2*Math.PI,x=Math.PI,S,C=()=>{p.current++;let t=p.current;n.clearRect(0,0,ue,de),n.letterSpacing=l.letterSpacing;let o=w(Math.min(t/80,1)),s=D(Math.min(t/72,1)),c=Math.round((e??0)/(r||1)*100),u=y+c/100*x*o;n.beginPath(),n.arc(v,175,148,y,b),n.strokeStyle=f(m,.28),n.lineWidth=4,n.lineCap=`round`,n.stroke(),n.lineCap=`butt`,n.beginPath(),n.moveTo(v,175),n.arc(v,175,133,y,u),n.closePath(),n.fillStyle=f(_,.35*o),n.fill();let h=v+Math.cos(u)*148,T=175+Math.sin(u)*148;g(n,h,T,10,m,.3*o);let E=n.createLinearGradient(v+Math.cos(y)*148,175+Math.sin(y)*148,h,T);E.addColorStop(0,f(_,.9*o)),E.addColorStop(1,f(m,1*o)),n.beginPath(),n.arc(v,175,148,y,u),n.strokeStyle=E,n.lineWidth=4,n.lineCap=`round`,n.stroke(),n.lineCap=`butt`;let O=y+c/100*x*s,k=v+Math.cos(O)*133,A=175+Math.sin(O)*133,j=v-Math.cos(O)*24,M=175-Math.sin(O)*24,N=-Math.sin(O),P=Math.cos(O),F=2.5*s;n.beginPath(),n.moveTo(k,A),n.lineTo(v+N*F,175+P*F),n.lineTo(j+N*1,M+P*1),n.lineTo(j-N*1,M-P*1),n.lineTo(v-N*F,175-P*F),n.closePath(),n.fillStyle=f(i.t1,s),n.fill(),n.beginPath(),n.arc(v,175,11,0,Math.PI*2),n.strokeStyle=f(m,.85*s),n.lineWidth=2,n.stroke(),n.beginPath(),n.arc(v,175,9,0,Math.PI*2),n.fillStyle=i.t1,n.fill(),[[0,`0%`],[.5,`50%`],[1,`100%`]].forEach(([e,t])=>{let r=y+e*x,i=e===1?184:168,a=v+Math.cos(r)*i,o=175+Math.sin(r)*i;n.font=l.font,n.fillStyle=l.color,n.textAlign=`center`,n.fillText(t,a,o+4)}),o>.4&&(n.globalAlpha=Math.min(1,(o-.4)/.4),n.font=`700 32px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.textAlign=`center`,n.fillText(`${Math.round(c*s)}%`,v,247),n.globalAlpha=1),o>.7&&a&&(n.globalAlpha=Math.min(1,(o-.7)/.3),n.font=d.font,n.fillStyle=d.color,n.textAlign=`center`,me(n,`${e??0} of ${r??0} ${a}`,ue-40).forEach((e,t)=>{n.fillText(e,v,287+t*fe)}),n.globalAlpha=1),S=requestAnimationFrame(C)};return C(),()=>cancelAnimationFrame(S)},[e,r,a,o]),(0,n.jsx)(`div`,{"data-testid":s,style:{position:`relative`,width:ue,height:de},children:(0,n.jsx)(`canvas`,{ref:u,role:`img`,"aria-label":`Compensation event gauge — ${Math.round((e??0)/(r||1)*100)}% of NCEs confirmed as compensation events`,style:{width:ue,height:de,display:`block`}})})}function ge(e,n,r,i,a=!0,o={}){let s=(0,t.useRef)(0),{easing:c=w,durationFrames:l=48}=o;(0,t.useEffect)(()=>{let t=e.current;if(!t||!n||!r)return;let o=t.getContext(`2d`);if(!o)return;t.width=n*2,t.height=r*2,o.scale(2,2);let u;s.current=0;let d=()=>{s.current++;let e=s.current;o.clearRect(0,0,n,r);let t=a?Math.min(e/l,1):1;if(i(o,c(t),e),t<1)u=requestAnimationFrame(d);else{let e=()=>{s.current++,o.clearRect(0,0,n,r),i(o,1,s.current),u=requestAnimationFrame(e)};u=requestAnimationFrame(e)}};return d(),()=>cancelAnimationFrame(u)},[n,r,a])}var R=780,z=234,_e=130,ve=52,ye=[i.blue,i.amber,i.purple,i.green],be=[`Base Value`,`Variations`,`Commitment`],xe=[`Base`,`Var`,`Commit`];function Se({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),{hoveredRef:s,tooltip:c,hitZonesRef:u}=x(a,{width:R,height:z}),p=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),m=(0,t.useMemo)(()=>{let e=Math.max(...p.map(e=>e.base??0)),t=Math.max(...p.map(e=>e.variation??0));return p.map((n,r)=>{let i=R*(.12+r*.19),a=_e,o=Math.min(R*.075,ve),s=ye[r%ye.length],c=[(n.base??0)/(e||1)*100,(n.variation??0)/(t||1)*100,n.percentage??0],l=[n.baseLabel??String(n.base??0),n.variationLabel??String(n.variation??0),`${n.percentage??0}%`],u=c.map((e,t)=>{let n=-Math.PI/2+t/be.length*Math.PI*2,r=e/100,s=o*Math.max(.08,r);return{name:be[t],short:xe[t],label:l[t],val:Math.round(e),x:i+Math.cos(n)*s,y:a+Math.sin(n)*s,angle:n,norm:r}}),d=u.reduce((e,t)=>e+t.x,0)/u.length,f=u.reduce((e,t)=>e+t.y,0)/u.length,p=Math.sqrt(u.reduce((e,t)=>e+(t.x-d)**2+(t.y-f)**2,0)/u.length);return{...n,cx:i,cy:a,baseR:o,stars:u,scatter:p,color:s}})},[p]);return ge(a,R,z,(e,t,n)=>{A(o.current,s.current),u.current=[],_(e,R,z,n,30),m.forEach((t,r)=>{let a=t.color,s=`constellation-${r}`,c=o.current.get(s)??0;e.beginPath(),e.arc(t.cx,t.cy,t.baseR+5,0,Math.PI*2),e.strokeStyle=f(i.bd,.08+.08*c),e.lineWidth=.5,e.stroke(),e.beginPath(),t.stars.forEach((t,n)=>{n===0?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)}),e.closePath(),e.fillStyle=f(a,.04+.03*c),e.fill(),e.strokeStyle=f(a,.15+.1*c),e.lineWidth=.8,e.stroke(),t.stars.forEach((i,s)=>{let c=O(n,.05,5e-4)*.3+.7,d=3.5*c,p=`star-${r}-${s}`,m=o.current.get(p)??0,h=e.createRadialGradient(i.x,i.y,0,i.x,i.y,d*4);h.addColorStop(0,f(a,(.2+.1*m)*c)),h.addColorStop(1,f(a,0)),e.fillStyle=h,e.beginPath(),e.arc(i.x,i.y,d*4,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(i.x,i.y,d+m*2,0,Math.PI*2),e.fillStyle=f(a,(.8+.2*m)*c),e.fill();let g=Math.sin(i.angle)<-.3;e.textAlign=`center`,e.textBaseline=`middle`,g?(e.font=l.font,e.fillStyle=f(a,.5+.15*m),e.fillText(i.short,i.x,i.y-24),e.font=l.font,e.fillStyle=f(a,.8+.15*m),e.fillText(i.label,i.x,i.y-11)):(e.font=l.font,e.fillStyle=f(a,.5+.15*m),e.fillText(i.short,i.x,i.y+11),e.font=l.font,e.fillStyle=f(a,.8+.15*m),e.fillText(i.label,i.x,i.y+24)),S(u.current,p,i.x,i.y,d*4+2,{label:i.name,value:i.label,sublabel:t.abbreviation??t.name.slice(0,6),color:a})}),c>0&&g(e,t.cx,t.cy,16*c,a,.15*c),e.beginPath(),e.arc(t.cx,t.cy,t.baseR+12,0,Math.PI*2),e.strokeStyle=f(a,.1+O(n,.03,5e-4)*.05),e.lineWidth=1,e.stroke(),e.font=l.font,e.textAlign=`center`,e.textBaseline=`alphabetic`,e.fillStyle=c>0?t.color:l.color,e.fillText(t.abbreviation??t.name.slice(0,6),t.cx,t.cy+t.baseR+26),S(u.current,s,t.cx,t.cy,t.baseR+5,{label:t.name,value:`${t.totalLabel??String(t.total??0)} total`,sublabel:`${t.percentage??0}% committed · scatter ${t.scatter.toFixed(1)}`,color:a})}),e.font=d.font,e.textAlign=`center`,e.textBaseline=`middle`,e.fillStyle=d.color,e.fillText(`▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details`,R/2,z-14),v(e,R,z,n,.012)},!0),m.length===0?(0,n.jsx)(I,{width:R,height:z,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:R,height:z},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Contract value breakdown per contractor — multi-KPI constellation chart`,style:{width:R,height:z,display:`block`}}),(0,n.jsx)(b,{...c,parentW:R,parentH:z})]})}var Ce=680,we=220,Te=8,Ee=[i.teal],B={left:8,right:100,top:16,bottom:38},De=150,V=6;function Oe(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(r+`…`).width>n;)r=r.slice(0,-1);return r+`…`}function ke(e){let t=Math.abs(e),n=e<0?`-`:``;return t>=1e6?`${n}£${(t/1e6).toFixed(1)}M`:t>=1e3?`${n}£${(t/1e3).toFixed(1)}K`:`${n}£${t.toFixed(0)}`}function Ae({data:e,"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),[s,c]=(0,t.useState)(!1),{items:p=[],totals:m}=e,h=p.filter(e=>typeof e==`object`&&!!e),_=[...h].sort((e,t)=>(t.total??0)-(e.total??0)),v=s?_:_.slice(0,Te),y=v.length,S=Math.max(..._.map(e=>Math.abs(e.total??0)),1),w=y*V+Math.max(0,y-1)*38,E=B.top+B.bottom+w,D=Ce-B.left-De-B.right,O=h.length===0,{hoveredRef:j,tooltip:M,hitZonesRef:N}=x(a,{width:Ce,height:E});return ge(a,Ce,E,(e,t)=>{A(o.current,j.current),N.current=[],v.forEach((n,r)=>{let a=Ee[r%Ee.length],s=k(t,r,y,T),c=B.top+r*(V+38),d=B.left+De,p=o.current.get(n.id)??0,m=Math.max(n.total??0,0)/S*D*s;if(e.font=l.font,e.fillStyle=p>0?a:l.color,e.textAlign=`right`,e.textBaseline=`middle`,e.fillText(Oe(e,n.name??``,De-16),d-8,c+V/2),C(N.current,n.id,0,c,d,V,{label:n.name,value:`${n.totalLabel??ke(n.total??0)} total`,sublabel:`Base ${n.baseLabel??ke(n.base??0)} + Var ${n.variationLabel??ke(n.variation??0)}`,color:a}),m>0){p>0&&g(e,d+m/2,c+V/2,m*.15,i.teal,.12*p);let t=e.createLinearGradient(d,0,d+m,0);t.addColorStop(0,f(i.tealDark,.85)),t.addColorStop(1,f(i.teal,1)),e.fillStyle=t,e.beginPath(),e.rect(d,c,m,V),e.fill()}let h=D*s,_=d+m,v=h-m;if(v>2){let t=e.createLinearGradient(_,0,d+h,0);t.addColorStop(0,f(i.tealDark,.55)),t.addColorStop(1,f(i.tealDark,.22)),e.fillStyle=t,e.beginPath(),e.rect(_,c,v,V),e.fill()}if(m>4){let t=d+m,n=c+V;e.strokeStyle=f(i.t4,.9*s),e.lineWidth=4,e.beginPath(),e.moveTo(t,c),e.lineTo(t,n),e.stroke();let r=n+3,a={x:t,y:r},o={x:t+10,y:r+12},l={x:t-10,y:r+12};e.fillStyle=f(i.t1,s),e.beginPath(),e.moveTo((a.x+o.x)/2,(a.y+o.y)/2),e.arcTo(o.x,o.y,l.x,l.y,1),e.arcTo(l.x,l.y,a.x,a.y,1),e.arcTo(a.x,a.y,o.x,o.y,1),e.closePath(),e.fill()}s>.35&&(e.globalAlpha=Math.min(1,(s-.35)/.4),e.font=u.font,e.fillStyle=p>0?a:u.color,e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(n.totalLabel??ke(n.total??0),d+D+28,c+V/2),e.globalAlpha=1),C(N.current,n.id,d,c,Math.max(m,1),V,{label:n.name,value:n.totalLabel??ke(n.total??0),sublabel:`${n.baseLabel??ke(n.base??0)} + ${n.variationLabel??ke(n.variation??0)}`,color:a})});let n=E-14;e.textBaseline=`middle`,e.font=d.font,e.textAlign=`left`;let r=e.createLinearGradient(B.left+De,0,B.left+De+14,0);r.addColorStop(0,f(i.tealDark,.85)),r.addColorStop(1,f(i.teal,1)),e.fillStyle=r,e.beginPath(),e.rect(B.left+De,n-6,12,12),e.fill(),e.fillStyle=d.color,e.fillText(`base value`,B.left+De+16,n),e.fillStyle=f(i.teal,.35),e.beginPath(),e.rect(B.left+De+160,n-6,12,12),e.fill(),e.fillStyle=d.color,e.fillText(`approved variations`,B.left+De+176,n),e.font=d.font,e.textAlign=`right`,e.fillStyle=d.color,e.fillText(`Portfolio: ${ke(m?.total??0)}`,Ce-8,n)},!0,{easing:T}),O?(0,n.jsx)(I,{width:Ce,height:we,message:`No contract data available`,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{width:Ce,transition:`all 0.25s ease`},children:[(0,n.jsxs)(`div`,{style:{position:`relative`},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Total contract value per contractor — horizontal bar chart`,style:{width:Ce,height:E,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...M,parentW:Ce,parentH:E})]}),h.length>Te&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(ne,{expanded:s,onToggle:()=>c(e=>!e)})})]})}var je=[{value:0xe8d4a51000,suffix:`T`,divisor:0xe8d4a51000},{value:1e9,suffix:`B`,divisor:1e9},{value:1e6,suffix:`M`,divisor:1e6},{value:1e3,suffix:`K`,divisor:1e3}];function H(e,t=1){let n=Math.abs(e),r=e<0?`-`:``;for(let e of je)if(n>=e.value)return`${r}${(n/e.divisor).toFixed(t)}${e.suffix}`;return`${r}${n.toFixed(0)}`}var Me=780,U=240,Ne=12,Pe=10,Fe=5,Ie=(Me-2*Ne-(Fe-1)*Pe)/Fe;function Le({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(0),c=(0,t.useRef)(new Map),d=[...(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e])].sort((e,t)=>(t.count??0)-(e.count??0)).slice(0,5),p=d.reduce((e,t)=>e+(t.count??0),0),m=Math.min(Fe,d.length),_=m>0?2*Ne+m*Ie+(m-1)*Pe:Me,{hoveredRef:y,tooltip:S,hitZonesRef:w}=x(a,{width:_,height:U});return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=h(e,_,U);o.current=0;let n=Ie,r=U*.84,m=U*.08,b=Ne,x,S=()=>{o.current++;let e=o.current;t.clearRect(0,0,_,U),t.letterSpacing=l.letterSpacing,w.current=[],c.current.forEach((e,t)=>{let n=t===y.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?c.current.delete(t):c.current.set(t,1):c.current.set(t,r)}),y.current&&!c.current.has(y.current)&&c.current.set(y.current,0),d.forEach((a,o)=>{let l=o===0,d=o===0?i.red:o===1?i.amber:s[o%s.length],h=b+o*(n+Pe),_=c.current.get(a.id)??0,v=_*8,y=h-v/2,x=n+v,S=l?O(e,.04,3e-4)*.06+.06:0;t.fillStyle=f(d,.08+_*.07),t.beginPath(),t.roundRect(y,m,x,r,6),t.fill(),t.strokeStyle=f(d,.2+_*.4+S),t.lineWidth=l?1.5:1,t.stroke(),(_>.01||l)&&g(t,y+x/2,m+r/2,x*.55,d,S+_*.14),t.font=u.font,t.textAlign=`left`,t.textBaseline=`top`,t.fillStyle=f(d,.5+_*.35),t.fillText(`#${o+1}`,y+7,m+6);let T=Math.min(n*.28,r*.32,72),E=y+x/2,D=m+r*.38,k=t.createRadialGradient(E,D-T*.2,0,E,D,T);k.addColorStop(0,f(d,.5+_*.2)),k.addColorStop(1,f(d,.2+_*.1)),t.beginPath(),t.arc(E,D,T,0,Math.PI*2),t.fillStyle=k,t.fill(),t.strokeStyle=f(d,.4+_*.3),t.lineWidth=1,t.stroke(),t.font=u.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=f(i.t1,.9);let A=a.abbreviation??a.name??``,j=T*1.7,M=A;for(;t.measureText(M).width>j&&M.length>1;)M=M.slice(0,-1);M!==A&&(M=M.slice(0,-1)+`…`),t.fillText(M,E,D);let N=a.count==null?null:H(a.count),P=a.label??N;if(P){t.font=u.font,t.textBaseline=`alphabetic`,t.fillStyle=f(d,.9+_*.1);let e=x-16,n=P;for(;t.measureText(n).width>e&&n.length>1;)n=n.slice(0,-1);n!==P&&(n=n.slice(0,-1)+`…`),t.fillText(n,E,m+r*.74)}let F=Math.round((a.count??0)/(p||1)*100);C(w.current,a.id,h,m,n,r,{label:a.name,value:`${P} · ${F}% of total`,sublabel:`Rank #${o+1}`,color:d})}),v(t,_,U,e,.015),x=requestAnimationFrame(S)};return S(),()=>cancelAnimationFrame(x)},[d,p,_]),d.length===0?(0,n.jsx)(I,{width:_,height:U,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:_,height:U},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Contractor rank — open EW count per contractor`,style:{width:_,height:U,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...S,parentW:_,parentH:U})]})}var W=680,G=260;function Re({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(0),s=(0,t.useRef)(new Map),{hoveredRef:c,tooltip:u,hitZonesRef:d}=x(a,{width:W,height:G}),p=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=h(e,W,G);o.current=0;let n=p.length,r=Math.max(...p.map(e=>e.count),1),u=r,m=W*.05,y=G*.1,b=W*.9/n,x=G*.7/u,C=p.reduce((e,t)=>e+t.count,0),w,T=()=>{o.current++;let e=o.current;t.clearRect(0,0,W,G),d.current=[],s.current.forEach((e,t)=>{let n=t===c.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?s.current.delete(t):s.current.set(t,1):s.current.set(t,r)}),c.current&&!s.current.has(c.current)&&s.current.set(c.current,0),_(t,W,G,e,40,f(i.blue,.04)),p.forEach((n,a)=>{let o=n.count===r,c=i.blue,p=s.current.get(`${n.category}-col`)??0;for(let i=0;i<u;i++){let l=m+a*b+b/2,u=y+i*x+x/2,h=Math.min(b,x)*.38;if(i>=r-n.count){let r=h*(1+(O(e,.04,5e-4)+Math.sin(a*.6+i*1.2)*.3)*.12);(o||p>.01)&&g(t,l,u,r*3,c,(o?.2:.1)+p*.1),t.beginPath(),t.arc(l,u,r,0,Math.PI*2),t.fillStyle=f(c,o?.8:.5+p*.2),t.fill();let m=`${n.category}-${i}`;S(d.current,m,l,u,h+4,{label:n.fullName,value:`${n.count} Early Warnings`,sublabel:`${Math.round(n.count/C*100)}% of total`,color:c}),s.current.get(`${n.category}-col`)}else t.beginPath(),t.arc(l,u,1,0,Math.PI*2),t.fillStyle=f(c,.08),t.fill()}let h=y+u*x+16;t.font=l.font,t.textAlign=`center`,t.textBaseline=`alphabetic`,t.fillStyle=o?i.blue:f(i.t2,.65),t.fillText(n.category,m+a*b+b/2,h)}),v(t,W,G,e,.015),w=requestAnimationFrame(T)};return T(),()=>cancelAnimationFrame(w)},[p]),p.length===0?(0,n.jsx)(I,{width:W,height:G,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:W,height:G},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Early Warning count by category — breathing dot grid`,style:{width:W,height:G,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...u,parentW:W,parentH:G})]})}function ze({rows:e=[],className:t,colors:r}){return(0,n.jsx)(N,{rows:e,variant:`line`,className:t,colors:r})}var Be=[`#4C93D9`,`#5DA537`,`#F3862C`,`#4F72C6`,`#A0B724`,`#EEBF3B`,`#3C45D1`],Ve={nodes:[{id:`supplier-x`,name:`Supplier X`,valueLabel:`Si +0.12%`},{id:`bf3-superheat`,name:`BF-3 Superheat`,valueLabel:`22°C (target 34)`},{id:`ccm3-solidification`,name:`CCM-3 Solidification`,valueLabel:`Rate deviation`},{id:`grade-risk`,name:`Grade Risk`,valueLabel:`Automotive 74%`}],links:[{source:`supplier-x`,target:`bf3-superheat`,value:92},{source:`bf3-superheat`,target:`ccm3-solidification`,value:87},{source:`ccm3-solidification`,target:`grade-risk`,value:74}]};function He({rows:e=[],className:t,colors:r}){let i=r?.slices??Be;return(0,n.jsx)(`div`,{className:[`d3-mini-bars`,t].filter(Boolean).join(` `),children:e.map(([e,t,r],a)=>(0,n.jsxs)(`div`,{className:`d3-mini-row`,children:[(0,n.jsx)(`span`,{children:e}),(0,n.jsx)(`div`,{className:`d3-mini-track`,children:(0,n.jsxs)(`svg`,{viewBox:`0 0 100 12`,className:`d3-mini-svg`,"aria-hidden":`true`,children:[(0,n.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`12`,rx:`6`,className:`d3-mini-track-fill`}),(0,n.jsx)(`rect`,{x:`0`,y:`0`,width:Math.max(0,Math.min(100,t)),height:`12`,rx:`6`,className:`d3-mini-fill tone-${a%Be.length}`,fill:i[a%i.length]})]})}),(0,n.jsx)(`span`,{children:r})]},`${e}-${a}`))})}var Ue=770,We=320,Ge=60,Ke=28;function qe({total:e=0,totalLabel:r,items:a=[],width:o=Ue,colorOffset:s=0,"data-testid":d}){let p=(0,t.useRef)(null),m=(0,t.useRef)(new Map),_=(0,t.useRef)(0),v=(0,t.useMemo)(()=>a.filter(e=>typeof e==`object`&&!!e),[a]),y=(0,t.useMemo)(()=>Math.max(We,Ge+Math.max(0,v.length-1)*Ke),[v.length]),C=y,{hoveredRef:T,tooltip:E,hitZonesRef:D}=x(p,{width:o,height:y});return(0,t.useEffect)(()=>{let t=p.current;if(!t)return;let n=h(t,o,C);_.current=0;let a=y/2,d=o-200,b=Math.max(...v.map(e=>e.count??0),1),x=v.length>1?(y-60)/(v.length-1):0,E=d+22+10,O=v.map((e,t)=>({x:d,y:30+t*x})),j,M=()=>{_.current++;let t=_.current;n.clearRect(0,0,o,C),n.letterSpacing=l.letterSpacing;let p=w(Math.min(t/72,1));A(m.current,T.current),D.current=[];let h=c[s%c.length],y=120+60*Math.min(1,p*2.5),x=n.createLinearGradient(120,0,y,0);x.addColorStop(0,f(h,.8)),x.addColorStop(1,f(h,.7)),n.beginPath(),n.moveTo(120,a),n.lineTo(y,a),n.strokeStyle=x,n.lineWidth=1.33,n.stroke(),v.forEach((t,r)=>{let o=k(p,r,v.length,w),s=O[r],c=m.current.get(t.id)??0;if(o<.01)return;let _=180+(d-180)*.35,y=a,x=180+(d-180)*.65,C=s.y;n.beginPath();for(let e=0;e<=40;e++){let t=e/40*o,r=(1-t)**3*180+3*(1-t)**2*t*_+3*(1-t)*t**2*x+t**3*s.x,i=(1-t)**3*a+3*(1-t)**2*t*y+3*(1-t)*t**2*C+t**3*s.y;e===0?n.moveTo(r,i):n.lineTo(r,i)}let T=n.createLinearGradient(180,a,s.x,s.y);if(T.addColorStop(0,f(h,c>0?1:.8)),T.addColorStop(1,f(h,c>0?1:.7)),n.strokeStyle=T,n.lineWidth=c>0?2:1.33,n.stroke(),o>.85){let r=Math.min(1,(o-.85)/.15),a=8+(t.count??0)/b*14;g(n,s.x,s.y,a*2,h,(.2+c*.2)*r),n.beginPath(),n.arc(s.x,s.y,a*r,0,Math.PI*2),n.fillStyle=f(h,r),n.fill();let d=H(t.count??0);S(D.current,t.id,s.x,s.y,a+8,{label:t.name,value:d,sublabel:`${Math.round((t.count??0)/(e||1)*100)}% of total`,color:h}),n.globalAlpha=r,n.font=l.font,n.textAlign=`left`;let p=t.abbreviation??t.name?.slice(0,6)??``,m=` ${H(t.count??0)}`,_=s.y+4;n.fillStyle=c>0?h:f(i.t2,.85),n.fillText(p,E,_);let v=n.measureText(p).width;n.font=u.font,n.fillStyle=c>0?h:i.t1,n.fillText(m,E+v,_),n.globalAlpha=1}});let N=32*p,P=n.createRadialGradient(88,a,0,88,a,N);if(P.addColorStop(0,f(h,.02*p)),P.addColorStop(.55,f(h,.02*p)),P.addColorStop(1,f(h,.15*p)),n.beginPath(),n.arc(88,a,N,0,Math.PI*2),n.fillStyle=P,n.fill(),n.beginPath(),n.arc(88,a,N,0,Math.PI*2),n.strokeStyle=f(h,.8*p),n.lineWidth=1,n.stroke(),p>.4){n.globalAlpha=Math.min(1,(p-.4)/.4);let t=r??H(e,0);n.font=`500 16px 'Satoshi Variable', 'DM Sans', sans-serif`;let o=t;for(;n.measureText(o).width>54.4&&o.length>1;)o=o.slice(0,-1);o!==t&&(o=o.slice(0,-1)+`…`),n.fillStyle=i.t1,n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(o,88,a),n.textBaseline=`alphabetic`,n.globalAlpha=1}S(D.current,`__root__`,88,a,32,{label:r??`Total`,value:H(e,0),sublabel:`${v.length} items`,color:h}),j=requestAnimationFrame(M)};return M(),()=>cancelAnimationFrame(j)},[e,r,v,y,o]),v.length===0?(0,n.jsx)(I,{width:o,height:We,"data-testid":d}):(0,n.jsxs)(`div`,{"data-testid":d,style:{position:`relative`,width:o,height:C},children:[(0,n.jsx)(`canvas`,{ref:p,role:`img`,"aria-label":`NCE fault tree — NCEs per contractor as branching tree`,style:{width:o,height:C,display:`block`}}),(0,n.jsx)(b,{...E,parentW:o,parentH:C})]})}var Je=192,Ye=Je,Xe=Je+80;function Ze({rows:e=[],variant:a,className:o,colors:c}){let l=(0,t.useRef)(null),u=(0,t.useRef)(new Map),d=(0,t.useRef)(0),p=c?.slices??s,{hoveredRef:_,tooltip:v,hitZonesRef:y}=x(l,{width:Ye,height:Xe});return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=h(t,Ye,Xe);d.current=0;let r=Ye/2,o=Je/2,s=Je*.4,c=a===`donut`?Je*.21:0,v=e.reduce((e,t)=>e+(t.pricing??0),0)||1,b,x=()=>{d.current++;let t=d.current;n.clearRect(0,0,Ye,Xe);let l=1-(1-Math.min(t/48,1))**3;A(u.current,_.current),y.current=[];let h=-Math.PI/2;e.forEach((e,a)=>{let d=(e.pricing??0)/v,m=d*Math.PI*2*l,_=h+m,b=p[a%p.length],x=u.current.get(e.id??`sl-${a}`)??0,C=h+m/2,w=(s+c)/2,T=r+Math.cos(C)*w,E=o+Math.sin(C)*w,D=(s-c)/2+8;S(y.current,e.id??`sl-${a}`,T,E,D,{label:e.vendor,value:`${e.pricing??0} (${Math.round(d*100)}%)`,color:b}),x>0&&g(n,T,E,D*2*x,b,.2*x);let k=O(t,.03,3e-4),A=s+x*6+(x>0?k*2:0);n.beginPath(),n.moveTo(r+Math.cos(h)*c,o+Math.sin(h)*c),n.arc(r,o,A,h,_),c>0?n.arc(r,o,c,_,h,!0):n.lineTo(r,o),n.closePath(),n.fillStyle=f(b,.7+x*.2),n.fill(),n.strokeStyle=f(i.bg,.8),n.lineWidth=1.5,n.stroke(),h=_}),a===`donut`&&e.length>0&&g(n,r,o,c*.8,i.blue,.06);let C=Je+12;e.forEach((e,t)=>{let r=p[t%p.length],a=(e.pricing??0)/v,o=u.current.get(e.id??`sl-${t}`)??0,s=C+t*18;n.fillStyle=f(r,.8+o*.2),n.fillRect(4,s-6,12,12),n.font=`9px 'JetBrains Mono', monospace`,n.fillStyle=f(i.t2,.7+o*.2),n.textAlign=`left`,n.fillText(e.vendor,18,s+3.5),n.font=`bold 9px 'JetBrains Mono', monospace`,n.fillStyle=m(i.t3,r,o),n.textAlign=`right`,n.fillText(`${e.pricing??0} (${Math.round(a*100)}%)`,Ye-4,s+3.5)}),b=requestAnimationFrame(x)};return x(),()=>cancelAnimationFrame(b)},[e,a,c,p]),(0,n.jsx)(r,{className:[`canvas-pie-frame`,o].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:Ye,height:Xe},children:[(0,n.jsx)(`canvas`,{ref:l,role:`img`,"aria-label":`${a} chart`,style:{width:Ye,height:Xe,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...v,parentW:Ye,parentH:Xe})]})})}function Qe(e,t,n,r){let i=new Set(t.map(e=>e.source)),a=new Set(t.map(e=>e.target)),o=new Map,s=[];for(e.forEach(e=>{i.has(e.id)&&!a.has(e.id)&&s.push({id:e.id,depth:0})});s.length>0;){let e=s.shift();if(!e)break;let{id:n,depth:r}=e;o.has(n)||(o.set(n,r),t.filter(e=>e.source===n).forEach(e=>{o.has(e.target)||s.push({id:e.target,depth:r+1})}))}let c=o.size>0?Math.max(...Array.from(o.values())):0;e.forEach(e=>{o.has(e.id)||o.set(e.id,c+1)});let l=new Map;e.forEach(e=>{let t=o.get(e.id)??0;l.has(t)||l.set(t,[]),l.get(t).push(e.id)});let u=Math.max(...Array.from(l.keys()))+1,d={left:100,right:80,top:40,bottom:40},f=new Map;return l.forEach((e,t)=>{let i=d.left+t/Math.max(u-1,1)*(n-d.left-d.right),a=r-d.top-d.bottom,o=Math.max(24,(a-(e.length-1)*12)/e.length),s=e.length*o+(e.length-1)*12,c=d.top+(a-s)/2;e.forEach((e,t)=>{f.set(e,{x:i-20/2,y:c+t*(o+12),w:20,h:o})})}),f}function $e({nodes:e,links:a,width:o=960,height:c=280,ariaLabel:l,selectedEntity:u,className:d,colors:p}){let m=(0,t.useRef)(null),_=(0,t.useRef)(new Map),y=(0,t.useRef)(0),w=(0,t.useRef)([]),T=p?.nodes??s,E=p?.links??i.bd,D=p?.activeLinks??i.blue,k=p?.activeNodes??i.blue,j=(0,t.useMemo)(()=>Qe(e,a,o,c),[e,a,o,c]),{hoveredRef:M,tooltip:N,hitZonesRef:P}=x(m,{width:o,height:c});return(0,t.useEffect)(()=>{let t=m.current;if(!t)return;let n=h(t,o,c);y.current=0,w.current=[];let r=a.length>0?Math.max(...a.map(e=>e.value)):1,s,l=()=>{y.current++;let t=y.current;n.clearRect(0,0,o,c);let d=1-(1-Math.min(t/56,1))**3;A(_.current,M.current),P.current=[],a.forEach((e,a)=>{let o=j.get(e.source),s=j.get(e.target);if(!o||!s)return;let c=!!u&&(e.source===u||e.target===u),l=c?D:E,p=c?.5:.2,m=Math.max(3,e.value/r*36*d),h=m/2,g=o.x+o.w,_=o.y+o.h/2,v=s.x,y=s.y+s.h/2,b=(g+v)/2;for(let e=0;e<30;e++){let r=e/30,i=(e+1)/30,o=1-r,s=1-i,c=o*o*g+2*o*r*b+r*r*v,u=o*o*_+2*o*r*_+r*r*y,d=s*s*g+2*s*i*b+i*i*v,m=s*s*_+2*s*i*_+i*i*y,x=O(t+r*120+a*40,.025,3e-4)*1.2;n.beginPath(),n.moveTo(c,u-h+x),n.lineTo(d,m-h+x),n.lineTo(d,m+h+x),n.lineTo(c,u+h+x),n.closePath(),n.fillStyle=f(l,p*(.5+r*.5)),n.fill()}S(P.current,`link-${a}`,b,(_+y)/2,m+6,{label:`${e.source} → ${e.target}`,value:String(e.value),color:c?D:i.blue}),Math.random()<.08&&w.current.push({linkIdx:a,prog:0,speed:.006+Math.random()*.006,off:(Math.random()-.5)*m*.5,sz:1+Math.random()})}),e.forEach((e,r)=>{let a=j.get(e.id);if(!a)return;let o=u===e.id,s=M.current===`node-${r}`,c=_.current.get(`node-${r}`)??0,l=o?k:T[r%T.length];C(P.current,`node-${r}`,a.x,a.y,a.w,a.h,{label:e.name,value:e.valueLabel??e.id,color:l}),(c>0||o)&&g(n,a.x+a.w/2,a.y+a.h/2,a.w*2,l,.2*Math.max(c,o?.6:0));let d=o?O(t,.03,3e-4)*.15:0;n.fillStyle=f(l,.6+c*.25+d),n.beginPath(),n.roundRect(a.x,a.y,a.w,a.h,4),n.fill(),(o||c>0)&&(n.strokeStyle=f(l,.5*Math.max(c,o?1:0)),n.lineWidth=1,n.beginPath(),n.roundRect(a.x,a.y,a.w,a.h,4),n.stroke());let p=a.x+a.w+8;n.font=`${o||s?`bold `:``}10px 'JetBrains Mono', monospace`,n.fillStyle=f(o?l:i.t2,.7+c*.2),n.textAlign=`left`,n.fillText(e.name,p,a.y+a.h/2+4),e.valueLabel&&(n.font=`9px 'JetBrains Mono', monospace`,n.fillStyle=f(l,.5+c*.2),n.fillText(e.valueLabel,p,a.y+a.h/2+17))}),w.current=w.current.filter(e=>{if(e.prog+=e.speed,e.prog>1)return!1;let t=a[e.linkIdx];if(!t)return!1;let r=j.get(t.source),o=j.get(t.target);if(!r||!o)return!1;let s=r.x+r.w,c=r.y+r.h/2,l=o.x,u=o.y+o.h/2,d=(s+l)/2,m=1-e.prog,h=m*m*s+2*m*e.prog*d+e.prog*e.prog*l,g=m*m*c+2*m*e.prog*c+e.prog*e.prog*u+e.off,_=Math.sin(e.prog*Math.PI)*.5,v=p?.links??i.blue;return n.beginPath(),n.arc(h,g,e.sz,0,Math.PI*2),n.fillStyle=f(v,_),n.fill(),!0}),w.current.length>150&&(w.current=w.current.slice(-150)),v(n,o,c,t,.01),s=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(s),w.current=[]}},[e,a,o,c,u,p,j]),(0,n.jsx)(r,{className:[`canvas-sankey-frame`,d].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{role:`img`,"aria-label":l,style:{position:`relative`,width:o,height:c},children:[(0,n.jsx)(`canvas`,{ref:m,style:{width:o,height:c,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...N,parentW:o,parentH:c})]})})}var et=[{x:.13,y:.48},{x:.37,y:.28},{x:.63,y:.62},{x:.87,y:.38},{x:.25,y:.72},{x:.5,y:.18},{x:.75,y:.7},{x:.92,y:.22}],tt=[i.blue,i.orange,i.red,i.purple,i.green,i.amber,i.t2],nt=[26,24,24,26,22,22,22,22];function rt(e,t){let n=1-t;return{x:n*n*n*e.p0.x+3*n*n*t*e.p1.x+3*n*t*t*e.p2.x+t*t*t*e.p3.x,y:n*n*n*e.p0.y+3*n*n*t*e.p1.y+3*n*t*t*e.p2.y+t*t*t*e.p3.y}}function it(e,t){let n=1-t,r=3*n*n*(e.p1.x-e.p0.x)+6*n*t*(e.p2.x-e.p1.x)+3*t*t*(e.p3.x-e.p2.x),i=3*n*n*(e.p1.y-e.p0.y)+6*n*t*(e.p2.y-e.p1.y)+3*t*t*(e.p3.y-e.p2.y),a=Math.sqrt(r*r+i*i)||1;return{x:-i/a,y:r/a}}function at(e,t){let n=t.x-e.x,r=t.y-e.y;return{p0:{x:e.x,y:e.y},p1:{x:e.x+n*.3+r*.15,y:e.y+r*.3-n*.15},p2:{x:t.x-n*.3+r*.08,y:t.y-r*.3-n*.08},p3:{x:t.x,y:t.y}}}function ot({nodes:e,links:r,width:a=960,height:o=280,selectedEntity:s}){let c=(0,t.useRef)(null),l=(0,t.useRef)(0),u=(0,t.useRef)([]),{hoveredRef:d,tooltip:p,hitZonesRef:y}=x(c,{width:a,height:o}),C=(0,t.useMemo)(()=>{let t=new Map;return e.forEach((e,n)=>t.set(e.id,n)),t},[e]),T=(0,t.useMemo)(()=>r.length>0?Math.max(...r.map(e=>e.value)):100,[r]),E=e=>T>1?e/100:e,D=(0,t.useMemo)(()=>e.map((e,t)=>{let n=et[t%et.length];return{id:e.id,label:e.name,sub:e.valueLabel??``,x:n.x*a,y:n.y*o,r:nt[t%nt.length],color:tt[t%tt.length]}}),[e,a,o]),k=(0,t.useMemo)(()=>r.map(e=>({fromIdx:C.get(e.source)??-1,toIdx:C.get(e.target)??-1,conf:E(e.value)})).filter(e=>e.fromIdx>=0&&e.toIdx>=0),[r,C]);return(0,t.useEffect)(()=>{let e=c.current;if(!e)return;let t=h(e,a,o);l.current=0,u.current=[];let n,r=()=>{l.current++;let e=l.current;if(t.clearRect(0,0,a,o),y.current=[],_(t,a,o,e,50,f(i.blue,.05)),k.forEach((e,n)=>{let r=D[e.fromIdx],a=D[e.toIdx];if(!r||!a)return;let o=!!s&&(r.id===s||a.id===s),c=m(r.color,a.color,.5),l=o?.18:.05,d=o?.25:.1,p=at(r,a);t.beginPath(),t.moveTo(p.p0.x,p.p0.y),t.bezierCurveTo(p.p1.x,p.p1.y,p.p2.x,p.p2.y,p.p3.x,p.p3.y),t.strokeStyle=f(c,l),t.lineWidth=16,t.lineCap=`round`,t.stroke(),t.strokeStyle=f(c,d),t.lineWidth=1.5,t.stroke();for(let t=0;t<e.conf*2.5;t++)Math.random()<.45&&u.current.push({edgeIdx:n,t:0,speed:.003+Math.random()*.004,off:(Math.random()-.5)*13,sz:.7+Math.random()*2});let h=rt(p,.5),g=`${Math.round(e.conf*100)}%`;t.font=`bold 12px 'JetBrains Mono', monospace`,t.textBaseline=`middle`;let _=t.measureText(g).width+14;t.fillStyle=`rgba(10,16,24,0.88)`,t.beginPath(),t.roundRect(h.x-_/2,h.y-11,_,22,6),t.fill(),t.strokeStyle=f(i.blue,.25),t.lineWidth=1,t.stroke(),t.fillStyle=f(i.blue,.9),t.textAlign=`center`,t.fillText(g,h.x,h.y)}),u.current=u.current.filter(e=>{if(e.t+=e.speed,e.t>1)return!1;let n=k[e.edgeIdx];if(!n)return!1;let r=D[n.fromIdx],i=D[n.toIdx];if(!r||!i)return!1;let a=at(r,i),o=rt(a,e.t),s=it(a,e.t),c=o.x+s.x*e.off,l=o.y+s.y*e.off,u=Math.sin(e.t*Math.PI)*.7,d=m(r.color,i.color,e.t);return g(t,c,l,e.sz*3,d,u*.1),t.beginPath(),t.arc(c,l,e.sz,0,Math.PI*2),t.fillStyle=f(d,u),t.fill(),!0}),u.current.length>350&&(u.current=u.current.slice(-350)),D.forEach((n,r)=>{let a=s===n.id,o=d.current===`node-${r}`,c=O(e,.03,3e-4)*.1+1,l=n.r*c*(a?1.15:1);t.beginPath(),t.arc(n.x,n.y,l+6,0,Math.PI*2),t.strokeStyle=f(n.color,a?.3:.1),t.lineWidth=a?1.5:.7,t.stroke(),g(t,n.x,n.y,l*3,n.color,a?.22:.12);let u=t.createRadialGradient(n.x,n.y-l*.2,0,n.x,n.y,l);if(u.addColorStop(0,f(n.color,a?1:.85)),u.addColorStop(1,f(n.color,a?.65:.45)),t.fillStyle=u,t.beginPath(),t.arc(n.x,n.y,l,0,Math.PI*2),t.fill(),a||r===D.length-1){let r=l+16,i=e*.04,a=n.x+Math.cos(i)*r,o=n.y+Math.sin(i)*r;g(t,a,o,6,n.color,.3),t.beginPath(),t.arc(a,o,2,0,Math.PI*2),t.fillStyle=f(n.color,.75),t.fill()}S(y.current,`node-${r}`,n.x,n.y,l+8,{label:n.label,value:n.sub||n.id,color:n.color}),t.font=`${a||o?`bold `:``}12px 'DM Sans', sans-serif`,t.textAlign=`center`,t.textBaseline=`alphabetic`,t.fillStyle=f(n.color,a?1:.9),t.fillText(n.label,n.x,n.y+l+18),n.sub&&(t.font=`10px 'JetBrains Mono', monospace`,t.fillStyle=f(i.t3,.65),t.fillText(n.sub,n.x,n.y+l+32))}),k.length>=2){let n=k.reduce((e,t)=>e*t.conf,1),r=o*.92,s=a*.12,c=a*.76,l=w(Math.min(e*.008,1));t.fillStyle=f(i.bd,.35),t.beginPath(),t.roundRect(s,r,c,5,3),t.fill(),t.fillStyle=f(i.orange,.6),t.beginPath(),t.roundRect(s,r,c*n*l,5,3),t.fill(),t.font=`bold 12px 'JetBrains Mono', monospace`,t.textAlign=`left`,t.textBaseline=`middle`,t.fillStyle=f(i.orange,.85),t.fillText(`${Math.round(n*100)}% compound confidence`,s+c*n*l+10,r+2);let u=k.map(e=>e.conf.toFixed(2)).join(` × `);t.textAlign=`right`,t.font=`9px 'JetBrains Mono', monospace`,t.fillStyle=f(i.t4,.6),t.fillText(u,s-6,r+2)}v(t,a,o,e,.012),n=requestAnimationFrame(r)};return r(),()=>{cancelAnimationFrame(n),u.current=[]}},[D,k,a,o,s]),(0,n.jsxs)(`div`,{style:{position:`relative`,width:a,height:o},children:[(0,n.jsx)(`canvas`,{ref:c,style:{width:a,height:o,display:`block`,borderRadius:8},role:`img`,"aria-label":`causal flow diagram`}),(0,n.jsx)(b,{...p,parentW:a,parentH:o})]})}function st({selectedEntity:e,colors:t}){return(0,n.jsx)(ot,{nodes:Ve.nodes,links:Ve.links,width:960,height:280,selectedEntity:e})}function ct({rows:e=[],className:r,colors:i}){let{nodes:a,links:o}=(0,t.useMemo)(()=>{let t=e.slice(0,5);return{nodes:[{id:`score`,name:`Portfolio Score`},...t.map(e=>({id:e.id??e.vendor,name:e.vendor}))],links:t.map(e=>({source:e.id??e.vendor,target:`score`,value:Math.max(8,e.pricing??0)}))}},[e]);return(0,n.jsx)($e,{nodes:a,links:o,width:760,height:280,ariaLabel:`sankey chart`,className:r,colors:i})}var lt=780,ut=420;function dt({left:e,right:r,leftTitle:a=`Accepted`,rightTitle:o=`Submitted`,unit:s=`quotations`,"data-testid":c}){let u=(0,t.useRef)(null),d=(0,t.useRef)(0);return(0,t.useEffect)(()=>{let t=u.current;if(!t)return;let n=h(t,lt,ut);d.current=0;let c=lt/2,p=Math.abs(e.value??0),m=Math.abs(r.value??0),_=Math.max(p,m,1),v=(e.value-r.value)/(2*_)*14,y=Math.max(-14,Math.min(14,v)),b=(e,t,r,a,o)=>{let s=t-99/2,c=r+30,l=[0,0,10,10];n.save(),n.beginPath(),n.roundRect(s,c,99,a,l),n.clip();let u=f(e,.27*o),d=f(e,0),p=n.createLinearGradient(s,0,s+25,0);p.addColorStop(0,u),p.addColorStop(1,d),n.fillStyle=p,n.fillRect(s,c,25,a);let m=n.createLinearGradient(s+99,0,s+99-25,0);m.addColorStop(0,u),m.addColorStop(1,d),n.fillStyle=m,n.fillRect(s+99-25,c,25,a);let h=n.createLinearGradient(0,c,0,c+25);h.addColorStop(0,u),h.addColorStop(1,d),n.fillStyle=h,n.fillRect(s,c,99,25);let g=n.createLinearGradient(0,c+a,0,c+a-25);g.addColorStop(0,u),g.addColorStop(1,d),n.fillStyle=g,n.fillRect(s,c+a-25,99,25),n.restore(),n.beginPath(),n.roundRect(s,c,99,a,l),n.strokeStyle=f(e,1*o),n.lineWidth=1,n.stroke();let _=s+99/2,v=c-5;n.strokeStyle=f(i.t2,.5*o),n.lineWidth=1,n.beginPath(),n.moveTo(t,r+4),n.lineTo(_,v),n.stroke(),n.beginPath(),n.moveTo(_,v),n.lineTo(_-10,c),n.stroke(),n.beginPath(),n.moveTo(_,v),n.lineTo(_+10,c),n.stroke(),n.beginPath(),n.arc(t,r,3,0,Math.PI*2),n.fillStyle=f(i.t2,.7*o),n.fill()},x,S=()=>{d.current++;let t=d.current;n.clearRect(0,0,lt,ut),n.letterSpacing=l.letterSpacing;let u=w(Math.min(t/80,1)),h=y*D(Math.min(t/80,1))*Math.PI/180,v={x:c-Math.cos(h)*240,y:100+Math.sin(-h)*240},C={x:c+Math.cos(h)*240,y:100+Math.sin(h)*240};n.strokeStyle=f(i.t2,.55*u),n.lineWidth=1.5,n.beginPath(),n.moveTo(v.x,v.y),n.lineTo(C.x,C.y),n.stroke(),g(n,c,100,18,i.t2,.14*u),n.beginPath(),n.arc(c,100,9*u,0,Math.PI*2),n.fillStyle=f(i.t2,.85*u),n.fill();let T=Math.max(20,p/_*95*u),E=Math.max(20,m/_*95*u);if(b(i.green,v.x,v.y,T,u),b(i.amber,C.x,C.y,E,u),u>.5){n.globalAlpha=Math.min(1,(u-.5)/.5),n.textAlign=`center`,n.textBaseline=`top`;let t=v.y+30+T+14,c=C.y+30+E+14;n.font=`700 34px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.fillText(e.label,v.x,t),n.font=l.font,n.fillStyle=l.color,n.fillText(`${a} ${e.count} ${s}`,v.x,t+42),n.font=`700 34px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.fillText(r.label,C.x,c),n.font=l.font,n.fillStyle=l.color,n.fillText(`${o} ${r.count} ${s}`,C.x,c+42),n.globalAlpha=1,n.textBaseline=`alphabetic`}x=requestAnimationFrame(S)};return S(),()=>cancelAnimationFrame(x)},[e,r]),(0,n.jsx)(`div`,{"data-testid":c,style:{position:`relative`,width:lt,height:ut},children:(0,n.jsx)(`canvas`,{ref:u,role:`img`,"aria-label":`Quotation balance — accepted vs submitted quotation value`,style:{width:lt,height:ut,display:`block`,borderRadius:8}})})}var ft=780,K=360;function pt({points:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),s=(0,t.useRef)(0),{hoveredRef:c,tooltip:u,hitZonesRef:d}=x(a,{width:ft,height:K}),p=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=h(e,ft,K);s.current=0;let n=ft-64-48,r=K-48-68,u=Math.max(...p.map(e=>e.count),1),m=p.length,_=m>1?n/(m-1):n,v=p.map((e,t)=>({x:64+t*_,y:48+r-e.count/u*r,point:e})),b,x=()=>{s.current++;let e=s.current;t.clearRect(0,0,ft,K),t.letterSpacing=l.letterSpacing;let a=w(Math.min(e/72,1));A(o.current,c.current),d.current=[],[0,.25,.5,.75,1].forEach(e=>{let a=48+r-e*r;t.strokeStyle=f(i.bd,.18),t.lineWidth=1,t.setLineDash([3,5]),t.beginPath(),t.moveTo(64,a),t.lineTo(64+n,a),t.stroke(),t.setLineDash([]),t.font=l.font,t.fillStyle=l.color,t.textAlign=`right`,t.fillText(String(Math.round(u*e)),58,a+3)}),t.save(),t.translate(12,48+r/2),t.rotate(-Math.PI/2),t.font=l.font,t.fillStyle=l.color,t.textAlign=`center`,t.fillText(`Count`,0,0),t.restore(),t.strokeStyle=f(i.bd,.3),t.lineWidth=1,t.setLineDash([]),t.beginPath(),t.moveTo(64,48+r),t.lineTo(64+n,48+r),t.stroke();let p=a*(m-1),h=Math.floor(p)+1;if(h>=2){t.beginPath(),t.moveTo(v[0].x,48+r),t.lineTo(v[0].x,v[0].y);for(let e=1;e<h;e++){let n=p-Math.floor(p),r=e<h-1?v[e].x:v[e-1].x+(v[e].x-v[e-1].x)*(e===Math.ceil(p)?n:1),i=e<h-1?v[e].y:v[e-1].y+(v[e].y-v[e-1].y)*(e===Math.ceil(p)?n:1);t.lineTo(r,i)}let e=v[Math.min(h-1,m-1)];t.lineTo(e.x,48+r),t.closePath();let n=t.createLinearGradient(0,48,0,48+r);n.addColorStop(0,f(i.teal,.12)),n.addColorStop(1,f(i.teal,.02)),t.fillStyle=n,t.fill()}t.beginPath();for(let e=0;e<h;e++){let n=p-Math.floor(p),r=e===h-1&&e>0&&e===Math.ceil(p),i=e===0||e<h-1?v[e].x:v[e-1].x+(v[e].x-v[e-1].x)*(r?n:1),a=e===0||e<h-1?v[e].y:v[e-1].y+(v[e].y-v[e-1].y)*(r?n:1);e===0?t.moveTo(i,a):t.lineTo(i,a)}t.strokeStyle=f(i.teal,.85),t.lineWidth=2,t.stroke(),v.forEach((e,n)=>{if(n>=h)return;let a=`pt-${n}`,s=o.current.get(a)??0;S(d.current,a,e.x,e.y,10,{label:e.point.week,value:String(e.point.count),color:i.teal}),s>0&&y(t,e.x,48,48+r,f(i.teal,.15*s));let c=e.point.count===u;(s>0||c)&&g(t,e.x,e.y,14,i.teal,(c?.3:0)+s*.25),t.beginPath(),t.arc(e.x,e.y,s>0?5:3.5,0,Math.PI*2),t.fillStyle=f(i.teal,s>0?1:.8),t.fill(),(s>0||c)&&(t.font=l.font,t.fillStyle=i.teal,t.textAlign=`center`,t.fillText(String(e.point.count),e.x,e.y-10)),t.font=l.font,t.fillStyle=s>0?i.teal:l.color,t.textAlign=`center`,t.fillText(e.point.week,e.x,K-68+14)}),b=requestAnimationFrame(x)};return x(),()=>cancelAnimationFrame(b)},[p]),p.length<2?(0,n.jsx)(I,{width:ft,height:K,"data-testid":r}):(0,n.jsx)(`div`,{"data-testid":r,className:`trend-scroll`,style:{width:`100%`,overflowX:`auto`},children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:ft,height:K},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Trend chart — count over time`,style:{width:ft,height:K,display:`block`}}),(0,n.jsx)(b,{...u,parentW:ft,parentH:K})]})})}var mt=680,q=280,ht=80,gt=48,_t=64,vt=l.font,yt=12,bt=Math.PI*2,xt=72,St=20,Ct=5e3;function wt({points:e=[],colorOffset:r=0,"data-testid":a}){let o=(0,t.useRef)(null),s=(0,t.useRef)(null),u=(0,t.useRef)(0),d=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),p=(0,t.useMemo)(()=>{if(d.length<=1)return _t;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return _t;e.font=vt;let t=Math.max(1,Math.ceil(d.length/St)),n=Math.max(...d.filter((e,n)=>n%t===0).map(t=>e.measureText(t.week).width));return Math.max(_t,n+yt)},[d]),m=Math.round(p/2),g=gt+m+Math.max(0,d.length-1)*p,_=Math.max(mt-ht,Math.min(g,Ct)),{tooltip:v,hitZonesRef:y}=x(o,{width:_,height:q});return(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=h(e,_,q),n=s.current?h(s.current,ht,q):null;u.current=0;let a=c[r%c.length],g=d.length<=xt?xt:Math.max(24,Math.round(xt*(xt/d.length))),v=_-gt,b=q-42-54,x=d.length>0?d.map(e=>e.count):[0],C=Math.min(...x),T=Math.max(...x),E=T-C||1,D=d.length,O=D>1?(v-m)/(D-1):v-m,k=Math.max(1,Math.ceil(p/O)),A=C<0,j=A?42+b- -C/E*b:42+b,M=d.map((e,t)=>({x:m+t*O,y:42+b-(A?(e.count-C)/E:e.count/(T||1))*b,point:e}));if(n){n.clearRect(0,0,ht,q),n.letterSpacing=l.letterSpacing;let e=A?[C,C+E*.25,C+E*.5,C+E*.75,T]:[0,T*.25,T*.5,T*.75,T];e.forEach((t,r)=>{let i=r/(e.length-1),a=42+b-i*b;n.font=l.font,n.fillStyle=l.color,n.textAlign=`right`,n.fillText(H(t),ht-6,a+3)}),n.save(),n.translate(12,42+b/2),n.rotate(-Math.PI/2),n.font=l.font,n.fillStyle=l.color,n.textAlign=`center`,n.fillText(`Count`,0,0),n.restore()}let N=t.createLinearGradient(0,42,0,42+b);N.addColorStop(0,f(a,.12)),N.addColorStop(1,f(a,.02));let P=0,F,ee=e=>{t.font=vt,t.fillStyle=l.color,t.textAlign=`center`;for(let n=0;n<e;n++)n%k===0&&t.fillText(M[n].point.week,M[n].x,q-54+14)},te=()=>{u.current++;let e=Math.min(u.current/g,1),n=w(e),r=e>=1;t.clearRect(0,0,_,q),t.letterSpacing=l.letterSpacing,(A?[0,.25,.5,.75,1]:[.25,.5,.75,1]).forEach(e=>{let n=42+b-e*b;t.strokeStyle=f(i.bd,.18),t.lineWidth=1,t.setLineDash([3,5]),t.beginPath(),t.moveTo(0,n),t.lineTo(v,n),t.stroke(),t.setLineDash([])}),t.font=l.font,t.fillStyle=l.color,t.textAlign=`center`,t.fillText(`Period`,m+(v-m)/2,q-6),t.strokeStyle=f(i.bd,A?.5:.3),t.lineWidth=A?2:1,t.beginPath(),t.moveTo(m,A?j:42+b),t.lineTo(v,A?j:42+b),t.stroke();let o=n*(D-1),s=Math.floor(o)+1;if(s>=2){let e=A?j:42+b;t.beginPath(),t.moveTo(M[0].x,e),t.lineTo(M[0].x,M[0].y);for(let e=1;e<s;e++){let n=o-Math.floor(o),r=e===s-1&&e===Math.ceil(o)&&n>0,i=r?M[e-1].x+(M[e].x-M[e-1].x)*n:M[e].x,a=r?M[e-1].y+(M[e].y-M[e-1].y)*n:M[e].y;t.lineTo(i,a)}t.lineTo(M[s-1].x,e),t.closePath(),t.fillStyle=N,t.fill()}t.beginPath();for(let e=0;e<s;e++){let n=o-Math.floor(o),r=e===s-1&&e>0&&e===Math.ceil(o)&&n>0,i=r?M[e-1].x+(M[e].x-M[e-1].x)*n:M[e].x,a=r?M[e-1].y+(M[e].y-M[e-1].y)*n:M[e].y;e===0?t.moveTo(i,a):t.lineTo(i,a)}t.strokeStyle=f(a,.85),t.lineWidth=2,t.stroke(),t.fillStyle=f(a,.8),t.beginPath();for(let e=0;e<s;e++)t.moveTo(M[e].x+3.5,M[e].y),t.arc(M[e].x,M[e].y,3.5,0,bt);if(t.fill(),s>P){y.current=[];for(let e=0;e<s;e++)S(y.current,`pt-${e}`,M[e].x,M[e].y,10,{label:M[e].point.week,value:String(M[e].point.count),color:a});P=s}r&&ee(D),r||(F=requestAnimationFrame(te))};return te(),()=>cancelAnimationFrame(F)},[d,_,p,y,r]),d.length<2?(0,n.jsx)(I,{width:mt,height:q,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,style:{position:`relative`,width:`100%`,display:`flex`},children:[(0,n.jsx)(`canvas`,{ref:s,"aria-hidden":`true`,style:{width:ht,height:q,display:`block`,flexShrink:0}}),(0,n.jsx)(`div`,{className:`trend-scroll`,style:{flex:1,minWidth:0,overflowX:`auto`},children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:_,height:q},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Trend chart — count over time`,style:{width:_,height:q,display:`block`}}),(0,n.jsx)(b,{...v,parentW:_,parentH:q})]})})]})}var Tt=780,Et=340,Dt=28,Ot=4,kt=148;function At(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(`${r}…`).width>n;)r=r.slice(0,-1);return`${r}…`}function jt({severities:e=[],colorOffset:r=0,"data-testid":a}){let o=(0,t.useRef)(null),s=(0,t.useRef)(new Map),u=(0,t.useRef)(0),d=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),p=d.length>0?Math.min(Tt,2*Dt+d.length*kt):Tt,{hoveredRef:m,tooltip:g,hitZonesRef:_}=x(o,{width:p,height:Et});return(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=h(e,p,Et);u.current=0;let n=d.reduce((e,t)=>e+(t.count??0),0),a=Dt,g=Dt,v=p-a-g,y=Et-54-54,b=v-Math.max(0,d.length-1)*Ot,x=d.map(e=>(e.count??0)/(n||1)*b),S=c[r%c.length],w,E=()=>{u.current++;let e=u.current;t.clearRect(0,0,p,Et),t.letterSpacing=l.letterSpacing;let r=T(Math.min(e/60,1));A(s.current,m.current),_.current=[];let o=a;d.forEach((e,a)=>{let c=x[a]??0,u=s.current.get(e.severity)??0,d=o+c/2,p=c*.78,m=c*r,h=p*r,g=d-h/2;if(m>0){let e=()=>{t.beginPath(),t.moveTo(g,54),t.lineTo(g+h,54),t.lineTo(o+m,54+y),t.lineTo(o,54+y),t.closePath()},n=o+c/2,i=54+y/2,a=Math.sqrt((c/2)**2+(y/2)**2),s=t.createRadialGradient(n,i,0,n,i,a);s.addColorStop(0,f(S,(.03+u*.02)*r)),s.addColorStop(.5,f(S,(.12+u*.04)*r)),s.addColorStop(1,f(S,(.28+u*.08)*r)),t.save(),e(),t.clip(),e(),t.fillStyle=s,t.fill(),t.restore(),e(),t.strokeStyle=f(S,.9*r),t.lineWidth=1,t.stroke()}if(C(_.current,e.severity,o,54,c,y,{label:e.severity,value:H(e.count??0),sublabel:`${Math.round((e.count??0)/(n||1)*100)}%`,color:S}),r>.5){let a=Math.min(1,(r-.5)/.5),s=o+c/2;t.globalAlpha=a,t.font=l.font,t.fillStyle=u>0?S:f(i.t1,.65),t.textAlign=`center`,t.fillText(At(t,e.severity,c-8),s,40),t.font=`600 22px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=f(i.t1,.92+u*.08),t.fillText(H(e.count??0),s,54+y/2+8),t.font=l.font,t.fillStyle=u>0?S:f(i.t1,.5),t.fillText(`${Math.round((e.count??0)/(n||1)*100)}%`,s,54+y+22),t.globalAlpha=1}o+=c+Ot}),w=requestAnimationFrame(E)};return E(),()=>cancelAnimationFrame(w)},[d,p,r]),d.length===0?(0,n.jsx)(I,{width:p,height:Et,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,style:{position:`relative`,width:p,height:Et},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Early Warning severity distribution — prism spectrum bands`,style:{width:p,height:Et,display:`block`}}),(0,n.jsx)(b,{...g,parentW:p,parentH:Et})]})}var J=300,Y=280,Mt=100,Nt={Open:i.red,Submitted:i.amber,Closed:i.green};function Pt({segments:e=[],title:r,unitLabel:a=``,"data-testid":o}){let s=(0,t.useRef)(null),c=(0,t.useRef)(0),d=(0,t.useRef)(new Map),{hoveredRef:p,tooltip:m,hitZonesRef:y}=x(s,{width:J,height:Y}),C=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=h(e,J,Y);c.current=0;let n=J*.5,o=Y*.56,m=Mt,b=C.reduce((e,t)=>e+(t.count??0),0),x=Math.max(...C.map(e=>e.count??0),1),w,T=()=>{c.current++;let e=c.current;t.clearRect(0,0,J,Y),t.letterSpacing=l.letterSpacing,y.current=[],d.current.forEach((e,t)=>{let n=t===p.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?d.current.delete(t):d.current.set(t,1):d.current.set(t,r)}),p.current&&!d.current.has(p.current)&&d.current.set(p.current,0),_(t,J,Y,e,40,f(i.blue,.04)),C.forEach((r,a)=>{let s=a/3*Math.PI*2-Math.PI/2,c=n+Math.cos(s)*m,l=o+Math.sin(s)*m,d=Nt[r.status]??i.blue,p=2+r.count/x*8;t.beginPath(),t.moveTo(n,o),t.lineTo(c,l),t.strokeStyle=f(d,.08),t.lineWidth=p*2,t.stroke(),t.beginPath(),t.moveTo(n,o),t.lineTo(c,l),t.strokeStyle=f(d,.25),t.lineWidth=1,t.stroke();let h=(e*.005+a*.33)%1,_=n+(c-n)*h,v=o+(l-o)*h;g(t,_,v,6,d,.4),t.beginPath(),t.arc(_,v,2,0,Math.PI*2),t.fillStyle=f(d,.8),t.fill();let y=(n+c)/2,b=(o+l)/2;t.font=u.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=f(d,.85),t.fillText(String(r.count),y,b)}),C.forEach((e,r)=>{let s=r/3*Math.PI*2-Math.PI/2,c=n+Math.cos(s)*m,u=o+Math.sin(s)*m,p=Nt[e.status]??i.blue,h=10+e.count/x*18,_=d.current.get(e.status)??0;g(t,c,u,h*2.5,p,.2+_*.15);let v=t.createRadialGradient(c,u-h*.2,0,c,u,h);v.addColorStop(0,f(p,.8+_*.2)),v.addColorStop(1,f(p,.4+_*.1)),t.beginPath(),t.arc(c,u,h,0,Math.PI*2),t.fillStyle=v,t.fill(),t.font=`bold `+l.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=f(i.t1,.9),t.fillText(e.status,c,u),S(y.current,e.status,c,u,h+6,{label:e.status,value:a?`${e.count} ${a}`:String(e.count),sublabel:`${Math.round((e.count??0)/(b||1)*100)}%`,color:p})});let s=d.current.get(`center`)??0;g(t,n,o,36,i.t2,.2+s*.15);let h=t.createRadialGradient(n,o-4,0,n,o,22);h.addColorStop(0,f(i.t2,.9)),h.addColorStop(1,f(i.t2,.5)),t.beginPath(),t.arc(n,o,22,0,Math.PI*2),t.fillStyle=h,t.fill(),t.font=u.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=f(i.t1,.9),t.fillText(r??``,n,o-4),t.font=`bold `+l.font,t.fillStyle=i.t1,t.fillText(String(b),n,o+8),S(y.current,`center`,n,o,28,{label:r??`Total`,value:a?`${b} ${a}`:String(b),color:i.t2}),v(t,J,Y,e,.015),w=requestAnimationFrame(T)};return T(),()=>cancelAnimationFrame(w)},[C,r,a]),C.length===0?(0,n.jsx)(I,{width:J,height:Y,"data-testid":o}):(0,n.jsxs)(`div`,{"data-testid":o,style:{position:`relative`,width:J,height:Y},children:[(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":r??`EW status arc visualization`,style:{width:J,height:Y,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...m,parentW:J,parentH:Y})]})}var Ft=280,X=96;function It({points:e=[],className:a,colors:o}){let s=(0,t.useRef)(null),c=(0,t.useRef)(new Map),l=(0,t.useRef)(0),u=(0,t.useMemo)(()=>e.filter(Array.isArray).map(([e,t])=>{let n=String(t).match(/-?\d+(\.\d+)?/);return{label:e,value:n?Number(n[0]):0}}),[e]),{mouseRef:d,hoveredRef:p,tooltip:m,hitZonesRef:_}=x(s,{width:Ft,height:X});return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=h(e,Ft,X);l.current=0;let n=o?.line??i.teal,r=o?.point??i.teal,a=o?.axisLine??i.bd,m,v=()=>{l.current++;let e=l.current;if(t.clearRect(0,0,Ft,X),u.length<2){m=requestAnimationFrame(v);return}let o={left:12,right:12,top:16,bottom:20},s=Ft-o.left-o.right,h=X-o.top-o.bottom,b=u.map(e=>e.value),x=Math.min(...b),C=Math.max(...b)-x||1,w=e=>o.left+e/(u.length-1)*s,T=e=>o.top+(1-(e-x)/C)*h,E=1-(1-Math.min(e/48,1))**3,D=Math.max(2,Math.floor(E*u.length));if(A(c.current,p.current),_.current=[],t.strokeStyle=f(a,.3),t.lineWidth=.5,t.setLineDash([]),t.beginPath(),t.moveTo(o.left,X-o.bottom),t.lineTo(Ft-o.right,X-o.bottom),t.stroke(),t.font=`9px 'JetBrains Mono', monospace`,t.fillStyle=f(i.t4,.9),t.textAlign=`center`,u.forEach((e,n)=>{t.fillText(e.label.replace(`Day `,`D`),w(n),X-4)}),d.current.over&&p.current){let e=parseInt(p.current.split(`-`)[1]);isNaN(e)||y(t,w(e),o.top,o.top+h)}if(D>1){let e=t.createLinearGradient(0,o.top,0,o.top+h);e.addColorStop(0,f(n,.15)),e.addColorStop(1,f(n,0)),t.fillStyle=e,t.beginPath(),t.moveTo(w(0),o.top+h);for(let e=0;e<D;e++)t.lineTo(w(e),T(u[e].value));t.lineTo(w(D-1),o.top+h),t.closePath(),t.fill(),t.strokeStyle=f(n,.8),t.lineWidth=1.5,t.setLineDash([]),t.beginPath();for(let e=0;e<D;e++){let n=w(e),r=T(u[e].value);e===0?t.moveTo(n,r):t.lineTo(n,r)}t.stroke()}for(let e=0;e<D;e++){let n=w(e),a=T(u[e].value),o=`tp-${e}`,s=c.current.get(o)??0,l=e===u.length-1;S(_.current,o,n,a,10,{label:u[e].label,value:String(u[e].value),color:l?i.red:r}),s>0&&!l&&(g(t,n,a,12*s,r,.2*s),t.fillStyle=f(r,.8),t.beginPath(),t.arc(n,a,3+s*2,0,Math.PI*2),t.fill())}if(D>=u.length){let n=u.length-1,r=w(n),a=T(u[n].value),o=c.current.get(`tp-${n}`)??0,s=O(e,.05,5e-4),l=1+o*.5;t.shadowColor=f(i.red,.5),t.shadowBlur=(8+s*4)*l,t.fillStyle=i.red,t.beginPath(),t.arc(r,a,(3.5+s*1.5)*l,0,Math.PI*2),t.fill(),t.shadowBlur=0}m=requestAnimationFrame(v)};return v(),()=>cancelAnimationFrame(m)},[u,o]),(0,n.jsx)(r,{className:[`canvas-trend-frame`,a].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:Ft,height:X},children:[(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`trend chart`,style:{width:Ft,height:X,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...m,parentW:Ft,parentH:X})]})})}function Lt(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(r+`…`).width>n;)r=r.slice(0,-1);return r+`…`}var Rt=680,zt=8,Z=6,Bt=8,Vt=Z*2+Bt,Ht=36,Ut=16,Wt=48;function Gt({items:e=[],labelA:r=`Implemented`,labelB:a=`Unimplemented`,unit:o=`variations`,"data-testid":s}){let c=(0,t.useRef)(null),p=(0,t.useRef)(new Map),m=(0,t.useRef)(0),[_,v]=(0,t.useState)(!1),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),S=(0,t.useMemo)(()=>_?y:y.slice(0,zt),[y,_]),w=Ut+Wt+S.length*(Vt+Ht)-Ht,{hoveredRef:E,tooltip:D,hitZonesRef:O}=x(c,{width:Rt,height:w});return(0,t.useEffect)(()=>{let e=c.current;if(!e)return;let t=h(e,Rt,w);m.current=0;let n=Rt-150-100,s=Math.max(...S.map(e=>e.implemented??0),...S.map(e=>e.unimplemented??0),1),_=S.length*(Vt+Ht)-Ht,v=Ut+(w-Ut-Wt-_)/2,y,b=()=>{m.current++;let e=m.current;t.clearRect(0,0,Rt,w);let c=T(Math.min(e/60,1));A(p.current,E.current),O.current=[],S.forEach((e,d)=>{let m=k(c,d,S.length,T),h=v+d*(Vt+Ht),_=h,y=h+Z+Bt,b=`${e.id}-impl`,x=`${e.id}-un`,w=p.current.get(b)??0,E=p.current.get(x)??0,D=(e.implemented??0)/s*n*m,A=(e.unimplemented??0)/s*n*m;if(t.font=l.font,t.fillStyle=w>0||E>0?i.t1:i.t2,t.textAlign=`right`,t.textBaseline=`middle`,t.fillText(Lt(t,e.abbreviation??e.name??``,134),142,h+Vt/2),t.textBaseline=`alphabetic`,C(O.current,b,0,h,150,Vt,{label:e.name??e.abbreviation??``,value:`${H((e.implemented??0)+(e.unimplemented??0))} total ${o}`,sublabel:`${r}: ${H(e.implemented??0)} · ${a}: ${H(e.unimplemented??0)}`,color:i.green}),D>0){w>0&&g(t,150+D/2,_+Z/2,D*.15,i.green,.18*w);let e=t.createLinearGradient(150,0,150+D,0);e.addColorStop(0,f(i.green,.7)),e.addColorStop(1,f(i.green,1)),t.fillStyle=e,t.beginPath(),t.roundRect(150,_,D,Z,Z/2),t.fill()}if(C(O.current,b,150,_,Math.max(D,1),Z,{label:e.name,value:H(e.implemented??0),color:i.green}),m>.4&&(t.globalAlpha=Math.min(1,(m-.4)/.4),t.font=u.font,t.fillStyle=i.t1,t.textAlign=`left`,t.textBaseline=`middle`,t.fillText(H(e.implemented??0),150+D+16,_+Z/2),t.globalAlpha=1,t.textBaseline=`alphabetic`),A>0){E>0&&g(t,150+A/2,y+Z/2,A*.15,i.amber,.18*E);let e=t.createLinearGradient(150,0,150+A,0);e.addColorStop(0,f(i.amber,.5)),e.addColorStop(1,f(i.amber,.9)),t.fillStyle=e,t.beginPath(),t.roundRect(150,y,A,Z,Z/2),t.fill()}C(O.current,x,150,y,Math.max(A,1),Z,{label:e.name,value:H(e.unimplemented??0),color:i.amber}),m>.4&&(t.globalAlpha=Math.min(1,(m-.4)/.4),t.font=u.font,t.fillStyle=i.t1,t.textAlign=`left`,t.textBaseline=`middle`,t.fillText(H(e.unimplemented??0),150+A+16,y+Z/2),t.globalAlpha=1,t.textBaseline=`alphabetic`)});let h=v+_+28,x=150+n/2;t.font=d.font,t.textBaseline=`middle`;let D=t.createLinearGradient(x-120,0,x-120+12,0);D.addColorStop(0,f(i.green,.7)),D.addColorStop(1,f(i.green,1)),t.fillStyle=D,t.beginPath(),t.rect(x-120,h-6,12,12),t.fill(),t.fillStyle=d.color,t.textAlign=`left`,t.fillText(r,x-120+12+6,h);let j=t.createLinearGradient(x+10,0,x+10+12,0);j.addColorStop(0,f(i.amber,.5)),j.addColorStop(1,f(i.amber,.9)),t.fillStyle=j,t.beginPath(),t.rect(x+10,h-6,12,12),t.fill(),t.fillStyle=d.color,t.fillText(a,x+10+12+6,h),t.textBaseline=`alphabetic`,y=requestAnimationFrame(b)};return b(),()=>cancelAnimationFrame(y)},[S,w]),y.length===0?(0,n.jsx)(I,{width:Rt,height:160,"data-testid":s}):(0,n.jsxs)(`div`,{"data-testid":s,style:{width:Rt},children:[(0,n.jsxs)(`div`,{style:{position:`relative`,width:Rt,height:w},children:[(0,n.jsx)(`canvas`,{ref:c,role:`img`,"aria-label":`Implemented vs unimplemented variations per contractor — split bar`,style:{width:Rt,height:w,display:`block`}}),(0,n.jsx)(b,{...D,parentW:Rt,parentH:w})]}),y.length>zt&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(ne,{expanded:_,onToggle:()=>v(e=>!e)})})]})}var Kt=800,qt=360;function Jt({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),c=(0,t.useRef)(0),{hoveredRef:d,tooltip:p,hitZonesRef:m}=x(a,{width:Kt,height:qt});return(0,t.useEffect)(()=>{let t=a.current;if(!t)return;let n=h(t,Kt,qt);c.current=0;let r=e.reduce((e,t)=>e+(t.base??0),0),p=e.reduce((e,t)=>e+(t.variation??0),0),_=e.reduce((e,t)=>e+(t.total??0),0),v=qt-20-26,y=v-6*(e.length-1),b=20,x=e.map((e,t)=>{let n=Math.max(24,(e.total??0)/(_||1)*y),r={x:100-110/2,y:b,h:n,cy:b+n/2,c:e,color:s[t%s.length]};return b+=n+6,r}),S=y-14,T=Math.max(28,r/(_||1)*S),E=Math.max(18,p/(_||1)*S),D=20+(v-(T+E+14))/2,O={x:420-110/2,y:D,h:T,cy:D+T/2},j={x:420-110/2,y:D+T+14,h:E,cy:D+T+14+E/2},M={x:720-110/2,y:20,h:v,cy:20+v/2},N,P=()=>{c.current++;let t=c.current;n.clearRect(0,0,Kt,qt),n.letterSpacing=l.letterSpacing;let a=w(Math.min(t/80,1));if(A(o.current,d.current),m.current=[],e.forEach((t,i)=>{let s=x[i],c=k(a,i,e.length,w),l=o.current.get(t.id)??0;if(c<.01)return;let u=(t.base??0)/(t.total||1),d=(t.variation??0)/(t.total||1),f=s.h*u,m=s.h*d,h=s.y+f/2,g=s.y+f+m/2,_=Math.max(2,(t.base??0)/r*T),v=Math.max(2,(t.variation??0)/p*E),y=O.y+e.slice(0,i).reduce((e,t)=>e+(t.base??0)/r*T,0)+_/2,b=j.y+e.slice(0,i).reduce((e,t)=>e+(t.variation??0)/p*E,0)+v/2,S=l*.2+.18;Yt(n,s.x+110,h,420-110/2,y,_*c,s.color,S),Yt(n,s.x+110,g,420-110/2,b,v*c,s.color,S*.75)}),a>.3){let e=Math.min(1,(a-.3)/.7),t=M.y+r/_*v/2,o=M.y+v-p/_*v/2;Yt(n,475,O.cy,720-110/2,t,T*e,i.blue,.25*e),Yt(n,475,j.cy,720-110/2,o,E*e,i.amber,.22*e)}if([`Contractors`,`Components`,`Total`].forEach((e,t)=>{let r=[100,420,720][t];n.font=l.font,n.fillStyle=l.color,n.textAlign=`center`,n.fillText(e,r,qt-8)}),e.forEach((t,r)=>{let s=x[r],c=k(a,r,e.length,w),u=o.current.get(t.id)??0;C(m.current,t.id,s.x,s.y,110,s.h,{label:t.name,value:t.totalLabel??String(t.total??0),sublabel:`${t.baseLabel??String(t.base??0)} + ${t.variationLabel??String(t.variation??0)}`,color:s.color}),u>0&&g(n,s.x+110/2,s.cy,110*.6,s.color,.12*u),n.fillStyle=f(s.color,(.3+u*.15)*c),n.strokeStyle=f(s.color,(.55+u*.25)*c),n.lineWidth=1,n.beginPath(),n.roundRect(s.x,s.y,110*c,s.h,4),n.fill(),n.stroke(),c>.6&&s.h>=24&&(n.globalAlpha=Math.min(1,(c-.6)/.4),n.font=l.font,n.fillStyle=u>0?s.color:f(i.t2,.9),n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(t.abbreviation??t.name?.slice(0,6)??``,s.x+110/2,s.h>=36?s.cy-5:s.cy),s.h>=36&&(n.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=f(i.t3,.8),n.fillText(t.totalLabel??String(t.total??0),s.x+110/2,s.cy+7)),n.globalAlpha=1,n.textBaseline=`alphabetic`)}),a>.2){let e=Math.min(1,(a-.2)/.4);g(n,420,O.cy,30,i.blue,.1*e),n.fillStyle=f(i.blue,.3*e),n.strokeStyle=f(i.blue,.5*e),n.lineWidth=1,n.beginPath(),n.roundRect(O.x,O.y,110,O.h*e,4),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=l.font,n.fillStyle=i.blue,n.textAlign=`center`,n.fillText(`Base Value`,420,O.cy-6),n.font=u.font,n.fillStyle=u.color,n.fillText(H(r),420,O.cy+8),n.globalAlpha=1,n.textBaseline=`alphabetic`,g(n,420,j.cy,24,i.amber,.1*e),n.fillStyle=f(i.amber,.22*e),n.strokeStyle=f(i.amber,.4*e),n.beginPath(),n.roundRect(j.x,j.y,110,j.h*e,4),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=l.font,n.fillStyle=i.amber,n.textAlign=`center`,n.fillText(`Variations`,420,j.cy-4),n.font=u.font,n.fillStyle=u.color,n.fillText(H(p),420,j.cy+8),n.globalAlpha=1,n.textBaseline=`alphabetic`}if(a>.5){let e=Math.min(1,(a-.5)/.5);g(n,720,M.cy,44,i.blue,.2*e),n.fillStyle=f(i.blue,.25*e),n.strokeStyle=f(i.blue,.6*e),n.lineWidth=1.5,n.beginPath(),n.roundRect(M.x,M.y,110,M.h*e,6),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=l.font,n.fillStyle=i.t2,n.textAlign=`center`,n.fillText(`Total Commitment`,720,M.cy-12),n.font=u.font,n.fillStyle=i.blue,n.fillText(H(_),720,M.cy+6),n.globalAlpha=1,n.textBaseline=`alphabetic`}N=requestAnimationFrame(P)};return P(),()=>cancelAnimationFrame(N)},[e]),(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:Kt,height:qt},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Weekly report flow — base value and variations per contractor flowing to total commitment`,style:{width:Kt,height:qt,display:`block`}}),(0,n.jsx)(b,{...p,parentW:Kt,parentH:qt})]})}function Yt(e,t,n,r,i,a,o,s){let c=(t+r)/2;e.beginPath(),e.moveTo(t,n-a/2),e.bezierCurveTo(c,n-a/2,c,i-a/2,r,i-a/2),e.lineTo(r,i+a/2),e.bezierCurveTo(c,i+a/2,c,n+a/2,t,n+a/2),e.closePath(),e.fillStyle=f(o,s),e.fill()}var Xt=680,Zt=160,Qt={left:8,right:90,top:16,bottom:16},$t=150,en=4,tn=48,nn=8;function rn(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(r+`…`).width>n;)r=r.slice(0,-1);return r+`…`}function an(e,t){let n=Math.abs(e),r=e<0?`-`:``;return n>=1e6?`${r}${t}${(n/1e6).toFixed(1)}M`:n>=1e3?`${r}${t}${(n/1e3).toFixed(1)}K`:`${r}${t}${n.toFixed(0)}`}function on({rows:e,valuePrefix:r=`$`,"data-testid":a}){let o=(0,t.useRef)(null),s=(0,t.useRef)(new Map),[c,d]=(0,t.useState)(!1),p=e.filter(e=>e!=null&&typeof e.value==`number`),m=c?p:p.slice(0,nn),h=m.length,_=Math.max(...p.map(e=>Math.abs(e.value)),1),v=Xt-Qt.left-$t-Qt.right,y=h*tn,S=Qt.top+Qt.bottom+y,{hoveredRef:w,tooltip:E,hitZonesRef:D}=x(o,{width:Xt,height:S});return ge(o,Xt,S,(e,t)=>{A(s.current,w.current),D.current=[],m.forEach((n,a)=>{let o=k(t,a,h,T),c=Qt.top+a*tn,d=c+(tn-en)/2,p=c+tn/2,m=Qt.left+$t,y=s.current.get(n.id)??0,b=Math.abs(n.value)/_*v*o,x=n.valueLabel??an(n.value,r);if(e.save(),e.font=l.font,e.fillStyle=y>0?i.cyan:l.color,e.textAlign=`right`,e.textBaseline=`middle`,e.fillText(rn(e,n.name,$t-16),m-8,p),C(D.current,n.id,0,c,m,tn,{label:n.name,value:x,color:i.cyan}),e.fillStyle=f(i.cyan,.1),e.beginPath(),e.roundRect(m,d,v,en,en/2),e.fill(),b>0){y>0&&g(e,m+b,d+en/2,b*.25,i.cyan,.14*y);let t=e.createLinearGradient(m,d,m+b,d);t.addColorStop(0,f(i.cyan,.2+y*.05)),t.addColorStop(.55,f(i.cyan,.55+y*.15)),t.addColorStop(1,f(i.cyan,.72+y*.18)),e.fillStyle=t,e.beginPath(),e.roundRect(m,d,b,en,en/2),e.fill()}y>0&&b>0&&(e.strokeStyle=f(i.cyan,.6*y),e.lineWidth=1,e.beginPath(),e.roundRect(m,d,b,en,en/2),e.stroke()),o>.35&&(e.globalAlpha=Math.min(1,(o-.35)/.4),e.font=u.font,e.fillStyle=y>0?i.cyan:u.color,e.textAlign=`right`,e.textBaseline=`middle`,e.fillText(x,Xt-8,p)),e.restore(),C(D.current,n.id,m,c,Math.max(b,1),tn,{label:n.name,value:x,color:i.cyan})})},!0,{easing:T}),p.length===0?(0,n.jsx)(I,{width:Xt,height:Zt,message:`No data available`,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,style:{width:Xt},children:[(0,n.jsxs)(`div`,{style:{position:`relative`},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Horizontal bar chart`,style:{width:Xt,height:S,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...E,parentW:Xt,parentH:S})]}),p.length>nn&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(ne,{expanded:c,onToggle:()=>d(e=>!e),"data-testid":a?`${a}-toggle`:void 0})})]})}function sn({config:e,className:t,colorOffset:r=0}){return e.type===`line`?(0,n.jsx)(ze,{rows:e.rows,className:t}):e.type===`area`?(0,n.jsx)(P,{rows:e.rows,className:t}):e.type===`bar`?(0,n.jsx)(te,{rows:e.rows,className:t}):e.type===`pie`?(0,n.jsx)(Ze,{rows:e.rows,variant:`pie`,className:t}):e.type===`donut`?(0,n.jsx)(Ze,{rows:e.rows,variant:`donut`,className:t}):e.type===`sankey`?(0,n.jsx)(ct,{rows:e.rows,className:t}):e.type===`flow`?(0,n.jsx)(st,{selectedEntity:e.selectedEntity,className:t}):e.type===`trend`?(0,n.jsx)(It,{points:e.points,className:t}):e.type===`mini-bars`?(0,n.jsx)(He,{rows:e.rows,className:t}):e.type===`stacked-horizontal-bar-chart`?(0,n.jsx)(Ae,{data:e.data??{items:e.items??[]}}):e.type===`multi-metric-constellation-chart`?(0,n.jsx)(Se,{items:e.items}):e.type===`progress-race-chart`?(0,n.jsx)(le,{items:e.items,colorOffset:r}):e.type===`hub-and-spoke-radial-chart`?(0,n.jsx)(Pt,{segments:e.segments,title:e.title,unitLabel:e.unitLabel}):e.type===`dot-matrix-chart`?(0,n.jsx)(Re,{items:e.items}):e.type===`ranked-card-leaderboard`?(0,n.jsx)(Le,{items:e.items}):e.type===`proportional-band-chart`?(0,n.jsx)(jt,{severities:e.severities,colorOffset:r}):e.type===`radial-fan-tree-chart`?(0,n.jsx)(qe,{total:e.total,totalLabel:e.totalLabel,items:e.items,colorOffset:r}):e.type===`semi-circular-gauge-chart`?(0,n.jsx)(he,{confirmed:e.confirmed,total:e.total,label:e.label,colorOffset:r}):e.type===`segmented-split-bar-chart`?(0,n.jsx)(Gt,{items:e.items,labelA:e.labelA,labelB:e.labelB,unit:e.unit}):e.type===`balance-scale-chart`?(0,n.jsx)(dt,{left:e.left,right:e.right,leftTitle:e.leftTitle,rightTitle:e.rightTitle,unit:e.unit}):e.type===`area-line-chart`?(0,n.jsx)(pt,{points:e.points}):e.type===`trend-view`?(0,n.jsx)(wt,{points:e.points,colorOffset:r}):e.type===`weekly-flow`?(0,n.jsx)(Jt,{items:e.items}):e.type===`horizontal-bar-chart`?(0,n.jsx)(on,{rows:e.rows,valuePrefix:e.valuePrefix}):(0,n.jsx)(`div`,{className:`viz-empty`,children:`Visualization unavailable`})}var cn=[];function ln(e){try{return JSON.parse(decodeURIComponent(e))}catch{return null}}function un(){for(;cn.length;){let e=cn.pop();e&&e.unmount()}}function dn(){un(),document.querySelectorAll(`[data-d3-viz]`).forEach(t=>{let r=t.dataset.d3Viz;if(!r)return;let i=ln(r);if(!i)return;let a=(0,e.createRoot)(t);cn.push(a),a.render((0,n.jsx)(sn,{config:i}))})}function fn(e){return encodeURIComponent(JSON.stringify(e))}function pn({rows:e=[],className:t,colors:r}){return(0,n.jsx)(Ze,{rows:e,variant:`donut`,className:t,colors:r})}var Q={bg:`transparent`,border:`transparent`,t1:i.t1,t2:i.t2,t3:i.t3,t4:i.t4,red:i.red,amber:i.amber,green:i.green},$=`'Satoshi Variable', 'DM Sans', sans-serif`,mn={color:`#F7F7F7`,fontFamily:$,fontSize:24,fontWeight:500,lineHeight:`32px`},hn={color:`#B3B5B6`,fontFamily:$,fontSize:18,fontWeight:400,lineHeight:`20px`};function gn({items:e=[]}){let t=e.filter(e=>e.value);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:20},children:t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,width:286,minHeight:129,padding:`20px 16px`,flexShrink:0,border:`1px solid rgba(255,255,255,0.20)`,background:`rgba(255,255,255,0.05)`,boxShadow:`3.42px 3.42px 3.42px 0px rgba(0,0,0,0.30)`,boxSizing:`border-box`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:24,flex:1,minWidth:0},children:[(0,n.jsx)(`div`,{style:{...mn,color:`#FFFFFF`},children:e.value}),(0,n.jsx)(`div`,{style:{...hn,color:`rgba(255,255,255,0.70)`},children:e.label})]}),e.icon&&(0,n.jsx)(`div`,{style:{width:60,height:60,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,n.jsx)(`img`,{src:e.icon,width:60,height:60,alt:``,style:{objectFit:`contain`}})})]},t))})}function _n({items:e=[]}){let t=e.filter(e=>e.name??e.value);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`10px 0px`,background:Q.bg,border:`1px solid ${Q.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t2,background:`transparent`,padding:`2px 8px`,borderRadius:4,fontFamily:$,flexShrink:0},children:e.name}),(0,n.jsx)(`span`,{style:{...mn,fontSize:18,color:Q.t1,minWidth:70,flexShrink:0},children:e.value}),(0,n.jsx)(`span`,{style:{...hn,flex:1},children:e.kpiLabel})]},t))})}function vn({items:e=[]}){let t=e.filter(e=>e.value);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:20},children:t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,width:286,minHeight:129,padding:`20px 16px`,flexShrink:0,border:`1px solid rgba(255,255,255,0.20)`,background:`rgba(255,255,255,0.05)`,boxShadow:`3.42px 3.42px 3.42px 0px rgba(0,0,0,0.30)`,boxSizing:`border-box`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:24,flex:1,minWidth:0},children:[(0,n.jsx)(`div`,{style:{...mn,color:`#FFFFFF`},children:e.value}),(0,n.jsx)(`div`,{style:{...hn,color:`rgba(255,255,255,0.70)`},children:e.label})]}),e.icon&&(0,n.jsx)(`div`,{style:{width:60,height:60,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,n.jsx)(`img`,{src:e.icon,width:60,height:60,alt:``,style:{objectFit:`contain`}})})]},t))})}var yn={red:Q.red,amber:Q.amber,green:Q.green};function bn({items:e=[]}){let t=e.filter(e=>e.text);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:t.map((e,t)=>(yn[e.severity],(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`10px 0px`,background:Q.bg,border:`1px solid ${Q.border}`},children:[(0,n.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:i.t2,flexShrink:0,marginTop:5}}),(0,n.jsx)(`span`,{style:{...hn,color:`#B3B5B6`},children:e.text})]},t)))})}function xn({min:e,max:t,unit:r,dots:a=[],chips:o=[]}){let s=a.filter(e=>e.name);if(s.length===0)return null;let c=t-e;return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{style:{position:`relative`,height:90,padding:`10px 0px`},children:[(0,n.jsx)(`div`,{style:{position:`absolute`,top:38,left:8,right:8,height:2,background:`rgba(255,255,255,0.08)`,borderRadius:1}}),(0,n.jsxs)(`div`,{style:{position:`absolute`,top:43,left:0,fontSize:16,color:Q.t4,fontFamily:$},children:[e,r]}),(0,n.jsxs)(`div`,{style:{position:`absolute`,top:43,right:0,fontSize:16,color:Q.t4,fontFamily:$},children:[t,r]}),s.map((t,a)=>{let o=(t.val-e)/c*100,s=t.color??i.blue,l=a%2==0;return(0,n.jsxs)(`div`,{style:{position:`absolute`,left:`${o}%`,top:0,transform:`translateX(-50%)`},children:[l&&(0,n.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:2},children:[(0,n.jsx)(`div`,{style:{fontSize:18,color:s,fontFamily:$,whiteSpace:`nowrap`},children:t.name}),(0,n.jsxs)(`div`,{style:{fontSize:18,fontWeight:500,color:s,fontFamily:$,whiteSpace:`nowrap`},children:[t.val,r]})]}),(0,n.jsx)(`div`,{style:{width:10,height:10,borderRadius:`50%`,background:s,boxShadow:`0 0 8px ${s}70`,margin:l?`0 auto`:`26px auto 0`}}),!l&&(0,n.jsxs)(`div`,{style:{textAlign:`center`,marginTop:4},children:[(0,n.jsx)(`div`,{style:{fontSize:18,color:s,fontFamily:$,whiteSpace:`nowrap`},children:t.name}),(0,n.jsxs)(`div`,{style:{fontSize:18,fontWeight:500,color:s,fontFamily:$,whiteSpace:`nowrap`},children:[t.val,r]})]})]},a)})]}),o&&o.length>0&&(0,n.jsx)(vn,{items:o})]})}function Sn({leftPct:e,leftLabel:t,leftValue:r,leftColor:a,rightPct:o,rightLabel:s,rightValue:c,rightColor:l,chips:u}){if(!t&&!s)return null;let d=a??i.blue,f=l??i.blue;return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{style:{display:`flex`,borderRadius:6,overflow:`hidden`,height:36,margin:`10px 0`},children:[(0,n.jsx)(`div`,{style:{width:`${e}%`,background:d+`38`,display:`flex`,alignItems:`center`,justifyContent:`flex-end`,paddingRight:12},children:(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t2,fontFamily:$},children:r})}),(0,n.jsx)(`div`,{style:{width:1,background:`rgba(255,255,255,0.12)`,flexShrink:0}}),(0,n.jsx)(`div`,{style:{width:`${o}%`,background:f+`2A`,display:`flex`,alignItems:`center`,paddingLeft:12},children:(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t2,fontFamily:$},children:c})})]}),(0,n.jsxs)(`div`,{style:{display:`flex`,marginBottom:u?4:0},children:[(0,n.jsx)(`div`,{style:{width:`${e}%`},children:(0,n.jsxs)(`span`,{style:{fontSize:18,color:d,fontFamily:$},children:[e,`% `,t]})}),(0,n.jsx)(`div`,{style:{width:`${o}%`,paddingLeft:10},children:(0,n.jsxs)(`span`,{style:{fontSize:18,color:f,fontFamily:$},children:[o,`% `,s]})})]}),u&&u.length>0&&(0,n.jsx)(vn,{items:u})]})}function Cn({pct:e,label:t,color:r,chips:a}){if(e==null&&!t)return null;let o=r??i.blue,s=2*Math.PI*30,c=s*(1-e/100);return(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:20},children:[(0,n.jsxs)(`div`,{style:{position:`relative`,flexShrink:0,width:80,height:80},children:[(0,n.jsxs)(`svg`,{width:80,height:80,style:{transform:`rotate(-90deg)`},children:[(0,n.jsx)(`circle`,{cx:40,cy:40,r:30,fill:`none`,stroke:`rgba(255,255,255,0.07)`,strokeWidth:8}),(0,n.jsx)(`circle`,{cx:40,cy:40,r:30,fill:`none`,stroke:o,strokeWidth:8,strokeDasharray:s,strokeDashoffset:c,strokeLinecap:`round`})]}),(0,n.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,textAlign:`center`},children:(0,n.jsxs)(`div`,{style:{fontSize:18,fontWeight:500,color:o,fontFamily:$},children:[e,`%`]})})]}),(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{style:{...hn,padding:`10px 0px`},children:t}),a&&(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:a.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,padding:`10px 10px`,background:Q.bg,border:`1px solid ${Q.border}`,borderRadius:5},children:[(0,n.jsx)(`span`,{style:{...mn,color:Q.t2},children:e.value}),(0,n.jsx)(`span`,{style:{...mn,color:Q.t2,fontWeight:400,userSelect:`none`},children:`|`}),(0,n.jsx)(`span`,{style:{...hn},children:e.label})]},t))})]})]})}function wn({items:e=[]}){let t=e.filter(e=>e.name??e.value);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 0px`,background:Q.bg,border:`1px solid ${Q.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t2,background:`transparent`,padding:`2px 7px`,borderRadius:4,fontFamily:$,flexShrink:0,minWidth:62,textAlign:`center`},children:e.name}),(0,n.jsx)(`div`,{style:{flex:1,height:4,background:`rgba(255,255,255,0.07)`,borderRadius:0,overflow:`hidden`},children:(0,n.jsx)(`div`,{style:{height:`100%`,width:`${e.pct}%`,background:e.color??i.purple,borderRadius:0,opacity:.75}})}),(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:400,color:Q.t2,fontFamily:$,flexShrink:0,minWidth:320,textAlign:`right`},children:[e.value,e.badge,e.sublabel].filter(Boolean).join(` `)})]},t))})}var Tn={red:Q.red,amber:Q.amber,green:Q.green};function En({items:e=[]}){let t=e.filter(e=>e.text);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:t.map((e,t)=>{let r=Tn[e.severity];return(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`9px 12px`,background:`transparent`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:r,background:r+`20`,padding:`2px 7px`,borderRadius:4,fontFamily:$,flexShrink:0},children:e.tag}),(0,n.jsx)(`span`,{style:{flex:1,...hn},children:e.text}),(0,n.jsx)(`span`,{style:{...hn,flexShrink:0,marginTop:1},children:e.date})]},t)})})}function Dn({columns:e=[],rows:t=[]}){return t.length===0?null:(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`0 0px 6px`,borderBottom:`1px solid ${Q.border}`},children:[(0,n.jsx)(`div`,{style:{minWidth:64}}),e.map((e,t)=>(0,n.jsx)(`div`,{style:{flex:1,fontSize:18,fontWeight:500,color:Q.t2,fontFamily:$,textTransform:`uppercase`,letterSpacing:.6},children:e},t))]}),t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 0px`,background:Q.bg,border:`1px solid ${Q.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t1,background:`transparent`,padding:`2px 8px`,borderRadius:4,fontFamily:$,flexShrink:0,minWidth:64,textAlign:`center`},children:e.label}),e.cells.map((e,t)=>(0,n.jsx)(`span`,{style:{flex:1,fontSize:18,fontWeight:500,color:Q.t2,fontFamily:$},children:e},t))]},t))]})}function On({block:e}){if(!e)return null;switch(e.type){case`stats`:return(0,n.jsx)(gn,{items:e.items});case`ranked`:return(0,n.jsx)(_n,{items:e.items});case`chips`:return(0,n.jsx)(vn,{items:e.items});case`badges`:return(0,n.jsx)(bn,{items:e.items});case`dot-strip`:return(0,n.jsx)(xn,{min:e.min,max:e.max,unit:e.unit,dots:e.dots,chips:e.chips});case`proportion`:return(0,n.jsx)(Sn,{leftPct:e.leftPct,leftLabel:e.leftLabel,leftValue:e.leftValue,leftColor:e.leftColor,rightPct:e.rightPct,rightLabel:e.rightLabel,rightValue:e.rightValue,rightColor:e.rightColor,chips:e.chips});case`ring`:return(0,n.jsx)(Cn,{pct:e.pct,label:e.label,color:e.color,chips:e.chips});case`scorecard-rows`:return(0,n.jsx)(wn,{items:e.items});case`flags-list`:return(0,n.jsx)(En,{items:e.items});case`comparison-rows`:return(0,n.jsx)(Dn,{columns:e.columns,rows:e.rows});default:return null}}var kn=`'Satoshi Variable', 'DM Sans', sans-serif`,An={color:`#C2C2C2`,fontFamily:kn,fontSize:18,fontWeight:400,lineHeight:1.65};function jn({text:e}){return(0,n.jsxs)(`div`,{style:{padding:`8px 0px`,border:`transparent`,borderRadius:5,background:`transparent`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:i.t1,fontFamily:kn,lineHeight:1.65,marginRight:8},children:`Takeaway`}),(0,n.jsx)(`span`,{style:{...An},children:e})]})}exports.AreaChart=P,exports.BarChart=te,exports.CHART_PALETTE=c,exports.ChartFrame=r,exports.DonutChart=pn,exports.GRAD=a,exports.KeyHighlights=On,exports.LineChart=ze,exports.MiniBars=He,exports.PALETTE=s,exports.PieChart=Ze,exports.ProcessSankey=st,exports.RankingSankey=ct,exports.SOLID=o,exports.SankeySvg=$e,exports.SeriesChart=N,exports.Takeaway=jn,exports.Trend=wt,exports.TrendChart=It,exports.VisualizationRenderer=sn,exports.cleanupVisualizationMounts=un,exports.hydrateVisualizationMounts=dn,exports.serializeVisualizationConfig=fn;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`react-dom/client`),t=require(`react`),n=require(`react/jsx-runtime`);function r({children:e,className:t=``}){return(0,n.jsx)(`div`,{className:`d3-chart ${t}`.trim(),children:e})}var i={bg:`#0C0E12`,bgL:`#0C1420`,sf:`#13161B`,bd:`#22262F`,blue:`#4C93D9`,cyan:`#36BFFA`,orange:`#EC772A`,red:`#EC772A`,green:`#5DA537`,purple:`#818FF8`,amber:`#EEBF3B`,teal:`#69DFE9`,tealDark:`#00818F`,t1:`#F7F9FA`,t2:`#B3B5B6`,t3:`#94979C`,t4:`#334155`},a={teal:[`#00818F`,`#69DFE9`],violet:[`#5B3CB1`,`#C8B6F3`],mint:[`#27837A`,`#81E8CE`],magenta:[`#8732A7`,`#E7A1F0`],sky:[`#0068BE`,`#8EC2F6`],blue:[`#084CF0`,`#8BA9FF`],purple:[`#5C42B8`,`#9DA5FD`],royal:[`#2556C8`,`#A9B1F8`],success:[`#58B21C`,`#97F558`],warning:[`#FFD974`,`#E4AA0D`],error:[`#EC8C42`,`#E46A0D`]},o={teal:`#69DFE9`,violet:`#C8B6F3`,mint:`#81E8CE`,magenta:`#E7A1F0`,sky:`#0068BE`,blue:`#084CF0`,purple:`#5C42B8`,royal:`#2556C8`,success:`#58B21C`,warning:`#E4AA0D`,error:`#E46A0D`},s=[i.blue,i.amber,i.purple,i.green,i.red],c=[i.teal,i.purple,i.amber,i.blue,i.green],l={font:`400 16px 'Satoshi Variable', 'DM Sans', sans-serif`,color:`#F7F7F7`,letterSpacing:`0px`},u={font:`500 16px 'Satoshi Variable', 'DM Sans', sans-serif`,color:`#F7F7F7`},d={font:`400 18px 'Satoshi Variable', 'DM Sans', sans-serif`,color:`#B3B5B6`,letterSpacing:`0px`};function f(e,t=1){let n=e.replace(`#`,``);return`rgba(${parseInt(n.substring(0,2),16)},${parseInt(n.substring(2,4),16)},${parseInt(n.substring(4,6),16)},${t})`}function p(e,t,n){return e+(t-e)*n}function m(e,t,n){let r=e=>{let t=e.replace(`#`,``);return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]},[i,a,o]=r(e),[s,c,l]=r(t),u=e=>Math.max(0,Math.min(255,Math.round(e)));return[u(p(i,s,n)),u(p(a,c,n)),u(p(o,l,n))].map(e=>e.toString(16).padStart(2,`0`)).join(``).replace(/^/,`#`)}function h(e,t,n,r=2){e.width=t*r,e.height=n*r;let i=e.getContext(`2d`);return i.scale(r,r),i}function g(e,t,n,r,i,a=.3){let o=e.createRadialGradient(t,n,0,t,n,r);o.addColorStop(0,f(i,a)),o.addColorStop(1,f(i,0)),e.fillStyle=o,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill()}function _(e,t,n,r,a=50,o=f(i.blue,.05)){for(let i=0;i<a;i++)e.beginPath(),e.arc((Math.sin(r*.001+i*23)*.5+.5)*t,(Math.cos(r*8e-4+i*37)*.5+.5)*n,.6,0,Math.PI*2),e.fillStyle=o,e.fill()}function v(e,t,n,r,i=.015){e.fillStyle=`rgba(0,0,0,${i})`;let a=r*.5%6;for(let r=a;r<n;r+=3)e.fillRect(0,r,t,1)}function y(e,t,n,r,a=f(i.t1,.08)){e.strokeStyle=a,e.lineWidth=1,e.setLineDash([3,3]),e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.stroke(),e.setLineDash([])}function b({visible:e,x:r,y:a,content:o,parentW:s,parentH:c}){let l=(0,t.useRef)(null);if((0,t.useLayoutEffect)(()=>{let t=l.current;if(!t)return;let n=t.offsetWidth,u=t.offsetHeight,d=s??400,f=c??800,p=r+14,m=a-u-14;p+n>d-4&&(p=r-n-14),m<4&&(m=a+14),p<4&&(p=4),m+u>f-4&&(m=f-u-4),t.style.transform=`translate(${p}px, ${m}px)`,t.style.opacity=e?`1`:`0`;let h=o&&typeof o==`object`&&o.color?o.color:i.blue;t.style.setProperty(`--tooltip-accent`,h??i.blue)},[e,r,a,s,o]),!o)return null;let u=typeof o==`object`,d=u?o.label:null,f=u?o.value:o,p=u?o.sublabel:null;return(0,n.jsxs)(`div`,{ref:l,style:{position:`absolute`,top:0,left:0,minWidth:80,pointerEvents:`none`,background:i.sf,border:`1px solid ${i.bd}`,borderLeft:`2px solid var(--tooltip-accent)`,borderRadius:6,padding:`8px 12px`,opacity:0,transition:`opacity 0.15s ease`,zIndex:20,fontFamily:`'Satoshi Variable', 'DM Sans', sans-serif`},children:[d&&(0,n.jsx)(`div`,{style:{fontSize:14,fontWeight:400,color:i.t2,marginBottom:3,whiteSpace:`nowrap`,lineHeight:`20px`},children:d}),f&&(0,n.jsx)(`div`,{style:{fontSize:16,fontWeight:500,color:i.t1,whiteSpace:`nowrap`,lineHeight:`22px`},children:f}),p&&(0,n.jsx)(`div`,{style:{fontSize:14,fontWeight:400,color:`var(--tooltip-accent)`,marginTop:3,whiteSpace:`nowrap`,lineHeight:`20px`},children:p})]})}function x(e,{width:n,height:r,onClick:i,enabled:a=!0}){let o=(0,t.useRef)({x:-1,y:-1,over:!1}),s=(0,t.useRef)(null),c=(0,t.useRef)([]),[l,u]=(0,t.useState)({visible:!1,x:0,y:0,content:null}),d=(0,t.useCallback)((e,t,n)=>{u({visible:!0,x:e,y:t,content:n})},[]),f=(0,t.useCallback)(()=>{u(e=>e.visible?{visible:!1,x:e.x,y:e.y,content:e.content}:e)},[]);return(0,t.useEffect)(()=>{let t=e.current;if(!t||!a)return;let l=e=>{let i=t.getBoundingClientRect(),a=n/i.width,l=r/i.height;o.current.x=(e.clientX-i.left)*a,o.current.y=(e.clientY-i.top)*l,o.current.over=!0;let u=null,p=c.current;for(let e=p.length-1;e>=0;e--)if(p[e].test(o.current.x,o.current.y)){u=p[e];break}let m=s.current;s.current=u?u.id:null,t.style.cursor=u?`pointer`:`default`,u?d((e.clientX-i.left)*a,(e.clientY-i.top)*l,u.data):m&&f()},u=()=>{o.current={x:-1,y:-1,over:!1},s.current&&(s.current=null,t.style.cursor=`default`,f())},p=()=>{if(s.current&&i){let e=c.current.find(e=>e.id===s.current);e&&i(e.id,e.data)}};return t.addEventListener(`mousemove`,l),t.addEventListener(`mouseleave`,u),t.addEventListener(`click`,p),()=>{t.removeEventListener(`mousemove`,l),t.removeEventListener(`mouseleave`,u),t.removeEventListener(`click`,p)}},[e,n,r,a,i,d,f]),{mouseRef:o,hoveredRef:s,tooltip:l,showTooltip:d,hideTooltip:f,hitZonesRef:c}}function S(e,t,n,r,i,a){e.push({id:t,data:a,test:(e,t)=>(e-n)**2+(t-r)**2<=i*i})}function C(e,t,n,r,i,a,o){e.push({id:t,data:o,test:(e,t)=>e>=n&&e<=n+i&&t>=r&&t<=r+a})}var w=e=>1-(1-e)**3,T=e=>1-(1-e)**4,E=e=>e===1?1:1-2**(-10*e),D=e=>{let t=1.70158;return 1+(t+1)*(e-1)**3+t*(e-1)**2},O=(e,t=.04,n=.001)=>Math.sin(e*t)*Math.exp(-Math.min(e*n,4)),k=(e,t,n,r=w)=>{let i=Math.min(.06,.5/n),a=t*i,o=1-(n-1)*i;return r(Math.max(0,Math.min((e-a)/o,1)))};function A(e,t,n=.12){e.forEach((r,i)=>{let a=i===t?1:0,o=r+(a-r)*n;Math.abs(o-a)<.005?a===0?e.delete(i):e.set(i,1):e.set(i,o)}),t&&!e.has(t)&&e.set(t,0)}var j=760,M=250;function N({rows:e=[],variant:a,className:o,colors:s}){let c=(0,t.useRef)(null),l=(0,t.useRef)(new Map),u=(0,t.useRef)(0),{mouseRef:d,hoveredRef:p,tooltip:m,hitZonesRef:_}=x(c,{width:j,height:M});return(0,t.useEffect)(()=>{let t=c.current;if(!t)return;let n=h(t,j,M);u.current=0;let r=s?.line??i.blue,o=s?.point??i.blue,m=s?.axisLine??i.bd,v=s?.areaFill??i.blue,b={top:24,right:24,bottom:44,left:24},x=j-b.left-b.right,C=M-b.top-b.bottom,w,T=()=>{u.current++;let t=u.current;if(n.clearRect(0,0,j,M),e.length<2){w=requestAnimationFrame(T);return}let s=e.map(e=>e.pricing??0),c=Math.max(100,...s),h=t=>b.left+t/(e.length-1)*x,D=e=>b.top+(1-e/c)*C,k=E(Math.min(t/48,1)),N=Math.max(2,Math.floor(k*e.length));A(l.current,p.current),_.current=[],n.strokeStyle=f(i.bd,.2),n.lineWidth=.5;for(let e=0;e<=4;e++){let t=b.top+e/4*C;n.beginPath(),n.moveTo(b.left,t),n.lineTo(b.left+x,t),n.stroke()}if(n.strokeStyle=f(m,.4),n.lineWidth=1,n.setLineDash([]),n.beginPath(),n.moveTo(b.left,D(0)),n.lineTo(b.left+x,D(0)),n.stroke(),d.current.over&&p.current){let e=parseInt(p.current.split(`-`)[1]);isNaN(e)||y(n,h(e),b.top,b.top+C)}if(a===`area`&&N>1){let t=n.createLinearGradient(0,b.top,0,b.top+C);t.addColorStop(0,f(v,.12)),t.addColorStop(1,f(v,0)),n.fillStyle=t,n.beginPath(),n.moveTo(h(0),b.top+C);for(let t=0;t<N;t++)n.lineTo(h(t),D(e[t].pricing??0));n.lineTo(h(N-1),b.top+C),n.closePath(),n.fill()}if(N>1){n.strokeStyle=f(r,.85),n.lineWidth=2,n.setLineDash([]),n.beginPath();for(let t=0;t<N;t++){let r=h(t),i=D(e[t].pricing??0);t===0?n.moveTo(r,i):n.lineTo(r,i)}n.stroke()}for(let r=0;r<N;r++){let s=h(r),c=D(e[r].pricing??0),u=`sc-${r}`,d=l.current.get(u)??0,p=r===e.length-1;S(_.current,u,s,c,12,{label:e[r].vendor,value:String(e[r].pricing??0),color:p?i.red:o}),d>0&&g(n,s,c,16*d,o,.2*d);let m=p?O(t,.05,5e-4):0,v=a===`area`?5:6;p?(n.shadowColor=f(i.red,.5),n.shadowBlur=(8+m*4)*(1+d*.5),n.fillStyle=i.red,n.beginPath(),n.arc(s,c,(v+m*1.5)*(1+d*.3),0,Math.PI*2),n.fill(),n.shadowBlur=0):(n.fillStyle=f(o,.7+d*.3),n.beginPath(),n.arc(s,c,v+d*2,0,Math.PI*2),n.fill()),n.font=`10px 'JetBrains Mono', monospace`,n.fillStyle=f(i.t3,.6+d*.3),n.textAlign=`center`,n.fillText(e[r].vendor,s,M-14)}w=requestAnimationFrame(T)};return T(),()=>cancelAnimationFrame(w)},[e,a,s]),(0,n.jsx)(r,{className:o,children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:j,height:M},children:[(0,n.jsx)(`canvas`,{ref:c,role:`img`,"aria-label":`${a} chart`,style:{width:j,height:M,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...m,parentW:j,parentH:M})]})})}function P({rows:e=[],className:t,colors:r}){return(0,n.jsx)(N,{rows:e,variant:`area`,className:t,colors:r})}var F=760,I=280;function ee({rows:e=[],className:a,colors:o}){let c=(0,t.useRef)(null),l=(0,t.useRef)(new Map),u=(0,t.useRef)(0),{hoveredRef:d,tooltip:p,hitZonesRef:m}=x(c,{width:F,height:I});return(0,t.useEffect)(()=>{let t=c.current;if(!t)return;let n=h(t,F,I);u.current=0;let r=o?.bars??s,a=o?.axisLine??i.bd,p=o?.valueLabel??i.t2,_={top:24,right:24,bottom:56,left:24},v=I-_.top-_.bottom,y=(F-_.left-_.right)/Math.max(e.length,1),b=Math.max(100,...e.map(e=>e.pricing??0)),x=_.top+v,S,w=()=>{u.current++;let t=u.current;n.clearRect(0,0,F,I);let o=T(Math.min(t/48,1));A(l.current,d.current),m.current=[],n.strokeStyle=f(a,.4),n.lineWidth=1,n.setLineDash([]),n.beginPath(),n.moveTo(_.left,x),n.lineTo(F-_.right,x),n.stroke(),e.forEach((t,a)=>{let s=_.left+a*y,c=k(o,a,e.length,T),u=b>0?(t.pricing??0)/b*v:0,d=Math.max(u>0?4:0,u*c),h=r[a%r.length],S=l.current.get(t.id??`bar-${a}`)??0;C(m.current,t.id??`bar-${a}`,s+4,x-d,y-8,d,{label:t.vendor,value:String(t.pricing??0),color:h}),d>0&&(S>0&&g(n,s+y/2,x-d/2,y*.8,h,.12*S),n.shadowColor=f(h,.2*(S>0?S:0)),n.shadowBlur=S>0?6:0,n.fillStyle=f(h,.5+S*.25),n.beginPath(),n.roundRect(s+4,x-d,y-8,d,[4,4,0,0]),n.fill(),n.shadowBlur=0,S>0&&(n.strokeStyle=f(h,.4*S),n.lineWidth=1,n.beginPath(),n.roundRect(s+4,x-d,y-8,d,[4,4,0,0]),n.stroke())),c>.5&&d>0&&(n.globalAlpha=Math.min(1,(c-.5)*2),n.font=`bold 10px 'JetBrains Mono', monospace`,n.fillStyle=S>0?h:f(p,.7),n.textAlign=`center`,n.fillText(String(t.pricing??``),s+y/2,x-d-6),n.globalAlpha=1),n.font=`${S>0?`bold `:``}9px 'JetBrains Mono', monospace`,n.fillStyle=S>0?h:f(i.t3,.6),n.textAlign=`center`,n.fillText(t.vendor,s+y/2,I-14)}),S=requestAnimationFrame(w)};return w(),()=>cancelAnimationFrame(S)},[e,o]),(0,n.jsx)(r,{className:a,children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:F,height:I},children:[(0,n.jsx)(`canvas`,{ref:c,role:`img`,"aria-label":`bar chart`,style:{width:F,height:I,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...p,parentW:F,parentH:I})]})})}function L({width:e,height:t,message:r=`No data available`,"data-testid":i}){return(0,n.jsx)(`div`,{"data-testid":i,style:{width:e,height:t,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:8,background:`rgba(255,255,255,0.03)`,color:`rgba(255,255,255,0.35)`,fontSize:14,fontFamily:`'Satoshi Variable', 'DM Sans', sans-serif`},children:r})}function te({expanded:e,onToggle:t,labelExpanded:r=`View Less`,labelCollapsed:i=`View More`,"data-testid":a}){return(0,n.jsxs)(`button`,{type:`button`,"data-testid":a,onClick:t,style:{display:`flex`,width:90,height:20,justifyContent:`center`,alignItems:`center`,gap:4,boxSizing:`border-box`,border:`none`,borderRadius:6,color:`#69DFE9`,fontSize:14,fontFamily:`'Satoshi Variable', 'DM Sans', sans-serif`,fontStyle:`normal`,fontWeight:400,lineHeight:`19.5px`,textAlign:`center`,cursor:`pointer`,userSelect:`none`},children:[e?r:i,(0,n.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,style:{transform:e?`rotate(180deg)`:`rotate(0deg)`},children:(0,n.jsx)(`path`,{d:`M2 3.5L5 6.5L8 3.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]})}var ne=[{value:0xe8d4a51000,suffix:`T`,divisor:0xe8d4a51000},{value:1e9,suffix:`B`,divisor:1e9},{value:1e6,suffix:`M`,divisor:1e6},{value:1e3,suffix:`K`,divisor:1e3}];function R(e,t=1){let n=Math.abs(e),r=e<0?`-`:``;for(let e of ne)if(n>=e.value)return`${r}${(n/e.divisor).toFixed(t)}${e.suffix}`;return`${r}${n.toFixed(0)}`}var z=660,re=6,ie=30,ae=24,oe=24,se=8;function ce(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(r+`…`).width>n;)r=r.slice(0,-1);return r+`…`}function le({items:e=[],colorOffset:r=0,"data-testid":a}){let o=(0,t.useRef)(null),s=(0,t.useRef)(0),d=(0,t.useRef)(new Map),[p,m]=(0,t.useState)(!1),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),T=(0,t.useMemo)(()=>[...y].sort((e,t)=>(t.percentage??0)-(e.percentage??0)),[y]),E=(0,t.useMemo)(()=>p?T:T.slice(0,se),[T,p]),D=E.length,O=ae+oe+D*re+Math.max(0,D-1)*ie,{hoveredRef:k,tooltip:A,hitZonesRef:j}=x(o,{width:z,height:O});return(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=h(e,z,O);s.current=0;let n=z-150-100,a=c[r%c.length],p,m=()=>{s.current++;let e=s.current;t.clearRect(0,0,z,O),t.letterSpacing=l.letterSpacing,j.current=[],d.current.forEach((e,t)=>{let n=t===k.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?d.current.delete(t):d.current.set(t,1):d.current.set(t,r)}),k.current&&!d.current.has(k.current)&&d.current.set(k.current,0),_(t,z,O,e,40,f(i.blue,.04));let r=Math.max(...E.map(e=>e.total??0),1);E.forEach((o,s)=>{let c=d.current.get(o.id)??0,p=ae+s*(re+ie),m=t.createLinearGradient(150,0,150+n,0);m.addColorStop(0,f(i.tealDark,.55+c*.1)),m.addColorStop(1,f(i.tealDark,.22+c*.08)),t.fillStyle=m,t.beginPath(),t.rect(150,p,n,re),t.fill();let h=(o.total??0)/r,_=150+n*Math.min(h,h*w(Math.min(1,e*.005)));if(_>152){let e=t.createLinearGradient(150,0,_,0);e.addColorStop(0,f(a,.55)),e.addColorStop(1,f(a,.9)),t.fillStyle=e,t.beginPath(),t.rect(150,p,_-150,re),t.fill()}c>0&&g(t,_,p+re/2,12*c,a,.35*c);let v={label:o.name,sublabel:o.totalLabel??(o.total==null?void 0:R(o.total)),color:a};C(j.current,o.id,0,p-ie/2,150+n,re+ie,v),S(j.current,o.id,_,p+re/2,10,v),t.font=u.font,t.fillStyle=c>0?f(a,1):f(i.t1,.85),t.textAlign=`left`,t.textBaseline=`middle`,t.fillText(R(o.total??0),150+n+12,p+re/2),t.font=l.font,t.fillStyle=c>0?f(a,1):l.color,t.textAlign=`right`,t.fillText(ce(t,o.name??o.abbreviation??``,134),142,p+re/2)}),v(t,z,O,e,.015),p=requestAnimationFrame(m)};return m(),()=>cancelAnimationFrame(p)},[E,O,r]),T.length===0?(0,n.jsx)(L,{width:z,height:160,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,style:{width:z},children:[(0,n.jsxs)(`div`,{style:{position:`relative`},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Commitment race — contractors ranked by commitment percentage`,style:{width:z,height:O,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...A,parentW:z,parentH:O})]}),y.length>se&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:p,onToggle:()=>m(e=>!e)})})]})}var ue=480,de=310,fe=18,pe=[`#00818F`,`#5C42B8`,`#C87B0A`,`#2563EB`,`#166534`];function me(e,t,n){let r=t.split(` `),i=[],a=``;for(let t of r){let r=a?`${a} ${t}`:t;e.measureText(r).width>n&&a?(i.push(a),a=t):a=r}return a&&i.push(a),i}function he({confirmed:e,total:r,label:a,colorOffset:o=0,"data-testid":s}){let u=(0,t.useRef)(null),p=(0,t.useRef)(0);return(0,t.useEffect)(()=>{let t=u.current;if(!t)return;let n=h(t,ue,de);p.current=0;let s=o%c.length,m=c[s],_=pe[s],v=ue/2,y=Math.PI,b=2*Math.PI,x=Math.PI,S,C=()=>{p.current++;let t=p.current;n.clearRect(0,0,ue,de),n.letterSpacing=l.letterSpacing;let o=w(Math.min(t/80,1)),s=D(Math.min(t/72,1)),c=Math.round((e??0)/(r||1)*100),u=y+c/100*x*o;n.beginPath(),n.arc(v,175,148,y,b),n.strokeStyle=f(m,.28),n.lineWidth=4,n.lineCap=`round`,n.stroke(),n.lineCap=`butt`,n.beginPath(),n.moveTo(v,175),n.arc(v,175,133,y,u),n.closePath(),n.fillStyle=f(_,.35*o),n.fill();let h=v+Math.cos(u)*148,T=175+Math.sin(u)*148;g(n,h,T,10,m,.3*o);let E=n.createLinearGradient(v+Math.cos(y)*148,175+Math.sin(y)*148,h,T);E.addColorStop(0,f(_,.9*o)),E.addColorStop(1,f(m,1*o)),n.beginPath(),n.arc(v,175,148,y,u),n.strokeStyle=E,n.lineWidth=4,n.lineCap=`round`,n.stroke(),n.lineCap=`butt`;let O=y+c/100*x*s,k=v+Math.cos(O)*133,A=175+Math.sin(O)*133,j=v-Math.cos(O)*24,M=175-Math.sin(O)*24,N=-Math.sin(O),P=Math.cos(O),F=2.5*s;n.beginPath(),n.moveTo(k,A),n.lineTo(v+N*F,175+P*F),n.lineTo(j+N*1,M+P*1),n.lineTo(j-N*1,M-P*1),n.lineTo(v-N*F,175-P*F),n.closePath(),n.fillStyle=f(i.t1,s),n.fill(),n.beginPath(),n.arc(v,175,11,0,Math.PI*2),n.strokeStyle=f(m,.85*s),n.lineWidth=2,n.stroke(),n.beginPath(),n.arc(v,175,9,0,Math.PI*2),n.fillStyle=i.t1,n.fill(),[[0,`0%`],[.5,`50%`],[1,`100%`]].forEach(([e,t])=>{let r=y+e*x,i=e===1?184:168,a=v+Math.cos(r)*i,o=175+Math.sin(r)*i;n.font=l.font,n.fillStyle=l.color,n.textAlign=`center`,n.fillText(t,a,o+4)}),o>.4&&(n.globalAlpha=Math.min(1,(o-.4)/.4),n.font=`700 32px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.textAlign=`center`,n.fillText(`${Math.round(c*s)}%`,v,247),n.globalAlpha=1),o>.7&&a&&(n.globalAlpha=Math.min(1,(o-.7)/.3),n.font=d.font,n.fillStyle=d.color,n.textAlign=`center`,me(n,`${R(e??0)} of ${R(r??0)} ${a}`,ue-40).forEach((e,t)=>{n.fillText(e,v,287+t*fe)}),n.globalAlpha=1),S=requestAnimationFrame(C)};return C(),()=>cancelAnimationFrame(S)},[e,r,a,o]),(0,n.jsx)(`div`,{"data-testid":s,style:{position:`relative`,width:ue,height:de},children:(0,n.jsx)(`canvas`,{ref:u,role:`img`,"aria-label":`Compensation event gauge — ${Math.round((e??0)/(r||1)*100)}% of NCEs confirmed as compensation events`,style:{width:ue,height:de,display:`block`}})})}function ge(e,n,r,i,a=!0,o={}){let s=(0,t.useRef)(0),{easing:c=w,durationFrames:l=48}=o;(0,t.useEffect)(()=>{let t=e.current;if(!t||!n||!r)return;let o=t.getContext(`2d`);if(!o)return;t.width=n*2,t.height=r*2,o.scale(2,2);let u;s.current=0;let d=()=>{s.current++;let e=s.current;o.clearRect(0,0,n,r);let t=a?Math.min(e/l,1):1;if(i(o,c(t),e),t<1)u=requestAnimationFrame(d);else{let e=()=>{s.current++,o.clearRect(0,0,n,r),i(o,1,s.current),u=requestAnimationFrame(e)};u=requestAnimationFrame(e)}};return d(),()=>cancelAnimationFrame(u)},[n,r,a])}var B=780,_e=234,ve=130,ye=52,be=[i.blue,i.amber,i.purple,i.green],xe=[`Base Value`,`Variations`,`Commitment`],Se=[`Base`,`Var`,`Commit`];function Ce({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),{hoveredRef:s,tooltip:c,hitZonesRef:u}=x(a,{width:B,height:_e}),p=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),m=(0,t.useMemo)(()=>{let e=Math.max(...p.map(e=>e.base??0)),t=Math.max(...p.map(e=>e.variation??0));return p.map((n,r)=>{let i=B*(.12+r*.19),a=ve,o=Math.min(B*.075,ye),s=be[r%be.length],c=[(n.base??0)/(e||1)*100,(n.variation??0)/(t||1)*100,n.percentage??0],l=[n.baseLabel??String(n.base??0),n.variationLabel??String(n.variation??0),`${n.percentage??0}%`],u=c.map((e,t)=>{let n=-Math.PI/2+t/xe.length*Math.PI*2,r=e/100,s=o*Math.max(.08,r);return{name:xe[t],short:Se[t],label:l[t],val:Math.round(e),x:i+Math.cos(n)*s,y:a+Math.sin(n)*s,angle:n,norm:r}}),d=u.reduce((e,t)=>e+t.x,0)/u.length,f=u.reduce((e,t)=>e+t.y,0)/u.length,p=Math.sqrt(u.reduce((e,t)=>e+(t.x-d)**2+(t.y-f)**2,0)/u.length);return{...n,cx:i,cy:a,baseR:o,stars:u,scatter:p,color:s}})},[p]);return ge(a,B,_e,(e,t,n)=>{A(o.current,s.current),u.current=[],_(e,B,_e,n,30),m.forEach((t,r)=>{let a=t.color,s=`constellation-${r}`,c=o.current.get(s)??0;e.beginPath(),e.arc(t.cx,t.cy,t.baseR+5,0,Math.PI*2),e.strokeStyle=f(i.bd,.08+.08*c),e.lineWidth=.5,e.stroke(),e.beginPath(),t.stars.forEach((t,n)=>{n===0?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)}),e.closePath(),e.fillStyle=f(a,.04+.03*c),e.fill(),e.strokeStyle=f(a,.15+.1*c),e.lineWidth=.8,e.stroke(),t.stars.forEach((i,s)=>{let c=O(n,.05,5e-4)*.3+.7,d=3.5*c,p=`star-${r}-${s}`,m=o.current.get(p)??0,h=e.createRadialGradient(i.x,i.y,0,i.x,i.y,d*4);h.addColorStop(0,f(a,(.2+.1*m)*c)),h.addColorStop(1,f(a,0)),e.fillStyle=h,e.beginPath(),e.arc(i.x,i.y,d*4,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(i.x,i.y,d+m*2,0,Math.PI*2),e.fillStyle=f(a,(.8+.2*m)*c),e.fill();let g=Math.sin(i.angle)<-.3;e.textAlign=`center`,e.textBaseline=`middle`,g?(e.font=l.font,e.fillStyle=f(a,.5+.15*m),e.fillText(i.short,i.x,i.y-24),e.font=l.font,e.fillStyle=f(a,.8+.15*m),e.fillText(i.label,i.x,i.y-11)):(e.font=l.font,e.fillStyle=f(a,.5+.15*m),e.fillText(i.short,i.x,i.y+11),e.font=l.font,e.fillStyle=f(a,.8+.15*m),e.fillText(i.label,i.x,i.y+24)),S(u.current,p,i.x,i.y,d*4+2,{label:i.name,value:i.label,sublabel:t.abbreviation??t.name.slice(0,6),color:a})}),c>0&&g(e,t.cx,t.cy,16*c,a,.15*c),e.beginPath(),e.arc(t.cx,t.cy,t.baseR+12,0,Math.PI*2),e.strokeStyle=f(a,.1+O(n,.03,5e-4)*.05),e.lineWidth=1,e.stroke(),e.font=l.font,e.textAlign=`center`,e.textBaseline=`alphabetic`,e.fillStyle=c>0?t.color:l.color,e.fillText(t.abbreviation??t.name.slice(0,6),t.cx,t.cy+t.baseR+26),S(u.current,s,t.cx,t.cy,t.baseR+5,{label:t.name,value:`${t.totalLabel??String(t.total??0)} total`,sublabel:`${t.percentage??0}% committed · scatter ${t.scatter.toFixed(1)}`,color:a})}),e.font=d.font,e.textAlign=`center`,e.textBaseline=`middle`,e.fillStyle=d.color,e.fillText(`▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details`,B/2,_e-14),v(e,B,_e,n,.012)},!0),m.length===0?(0,n.jsx)(L,{width:B,height:_e,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:B,height:_e},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Contract value breakdown per contractor — multi-KPI constellation chart`,style:{width:B,height:_e,display:`block`}}),(0,n.jsx)(b,{...c,parentW:B,parentH:_e})]})}var we=680,Te=220,Ee=8,De=[i.teal],V={left:8,right:100,top:16,bottom:38},Oe=150,H=6;function ke(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(r+`…`).width>n;)r=r.slice(0,-1);return r+`…`}function Ae(e){let t=Math.abs(e),n=e<0?`-`:``;return t>=1e6?`${n}£${(t/1e6).toFixed(1)}M`:t>=1e3?`${n}£${(t/1e3).toFixed(1)}K`:`${n}£${t.toFixed(0)}`}function je({data:e,"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),[s,c]=(0,t.useState)(!1),{items:p=[],totals:m}=e,h=p.filter(e=>typeof e==`object`&&!!e),_=[...h].sort((e,t)=>(t.total??0)-(e.total??0)),v=s?_:_.slice(0,Ee),y=v.length,S=Math.max(..._.map(e=>Math.abs(e.total??0)),1),w=y*H+Math.max(0,y-1)*38,E=V.top+V.bottom+w,D=we-V.left-Oe-V.right,O=h.length===0,{hoveredRef:j,tooltip:M,hitZonesRef:N}=x(a,{width:we,height:E});return ge(a,we,E,(e,t)=>{A(o.current,j.current),N.current=[],v.forEach((n,r)=>{let a=De[r%De.length],s=k(t,r,y,T),c=V.top+r*(H+38),d=V.left+Oe,p=o.current.get(n.id)??0,m=Math.max(n.total??0,0)/S*D*s;if(e.font=l.font,e.fillStyle=p>0?a:l.color,e.textAlign=`right`,e.textBaseline=`middle`,e.fillText(ke(e,n.name??``,Oe-16),d-8,c+H/2),C(N.current,n.id,0,c,d,H,{label:n.name,value:`${n.totalLabel??Ae(n.total??0)} total`,sublabel:`Base ${n.baseLabel??Ae(n.base??0)} + Var ${n.variationLabel??Ae(n.variation??0)}`,color:a}),m>0){p>0&&g(e,d+m/2,c+H/2,m*.15,i.teal,.12*p);let t=e.createLinearGradient(d,0,d+m,0);t.addColorStop(0,f(i.tealDark,.85)),t.addColorStop(1,f(i.teal,1)),e.fillStyle=t,e.beginPath(),e.rect(d,c,m,H),e.fill()}let h=D*s,_=d+m,v=h-m;if(v>2){let t=e.createLinearGradient(_,0,d+h,0);t.addColorStop(0,f(i.tealDark,.55)),t.addColorStop(1,f(i.tealDark,.22)),e.fillStyle=t,e.beginPath(),e.rect(_,c,v,H),e.fill()}if(m>4){let t=d+m,n=c+H;e.strokeStyle=f(i.t4,.9*s),e.lineWidth=4,e.beginPath(),e.moveTo(t,c),e.lineTo(t,n),e.stroke();let r=n+3,a={x:t,y:r},o={x:t+10,y:r+12},l={x:t-10,y:r+12};e.fillStyle=f(i.t1,s),e.beginPath(),e.moveTo((a.x+o.x)/2,(a.y+o.y)/2),e.arcTo(o.x,o.y,l.x,l.y,1),e.arcTo(l.x,l.y,a.x,a.y,1),e.arcTo(a.x,a.y,o.x,o.y,1),e.closePath(),e.fill()}s>.35&&(e.globalAlpha=Math.min(1,(s-.35)/.4),e.font=u.font,e.fillStyle=p>0?a:u.color,e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(n.totalLabel??Ae(n.total??0),d+D+28,c+H/2),e.globalAlpha=1),C(N.current,n.id,d,c,Math.max(m,1),H,{label:n.name,value:n.totalLabel??Ae(n.total??0),sublabel:`${n.baseLabel??Ae(n.base??0)} + ${n.variationLabel??Ae(n.variation??0)}`,color:a})});let n=E-14;e.textBaseline=`middle`,e.font=d.font,e.textAlign=`left`;let r=e.createLinearGradient(V.left+Oe,0,V.left+Oe+14,0);r.addColorStop(0,f(i.tealDark,.85)),r.addColorStop(1,f(i.teal,1)),e.fillStyle=r,e.beginPath(),e.rect(V.left+Oe,n-6,12,12),e.fill(),e.fillStyle=d.color,e.fillText(`base value`,V.left+Oe+16,n),e.fillStyle=f(i.teal,.35),e.beginPath(),e.rect(V.left+Oe+160,n-6,12,12),e.fill(),e.fillStyle=d.color,e.fillText(`approved variations`,V.left+Oe+176,n),e.font=d.font,e.textAlign=`right`,e.fillStyle=d.color,e.fillText(`Portfolio: ${Ae(m?.total??0)}`,we-8,n)},!0,{easing:T}),O?(0,n.jsx)(L,{width:we,height:Te,message:`No contract data available`,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{width:we,transition:`all 0.25s ease`},children:[(0,n.jsxs)(`div`,{style:{position:`relative`},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Total contract value per contractor — horizontal bar chart`,style:{width:we,height:E,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...M,parentW:we,parentH:E})]}),h.length>Ee&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:s,onToggle:()=>c(e=>!e)})})]})}var Me=780,U=240,Ne=12,Pe=10,Fe=5,Ie=(Me-2*Ne-(Fe-1)*Pe)/Fe;function Le({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(0),c=(0,t.useRef)(new Map),d=[...(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e])].sort((e,t)=>(t.count??0)-(e.count??0)).slice(0,5),p=d.reduce((e,t)=>e+(t.count??0),0),m=Math.min(Fe,d.length),_=m>0?2*Ne+m*Ie+(m-1)*Pe:Me,{hoveredRef:y,tooltip:S,hitZonesRef:w}=x(a,{width:_,height:U});return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=h(e,_,U);o.current=0;let n=Ie,r=U*.84,m=U*.08,b=Ne,x,S=()=>{o.current++;let e=o.current;t.clearRect(0,0,_,U),t.letterSpacing=l.letterSpacing,w.current=[],c.current.forEach((e,t)=>{let n=t===y.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?c.current.delete(t):c.current.set(t,1):c.current.set(t,r)}),y.current&&!c.current.has(y.current)&&c.current.set(y.current,0),d.forEach((a,o)=>{let l=o===0,d=o===0?i.red:o===1?i.amber:s[o%s.length],h=b+o*(n+Pe),_=c.current.get(a.id)??0,v=_*8,y=h-v/2,x=n+v,S=l?O(e,.04,3e-4)*.06+.06:0;t.fillStyle=f(d,.08+_*.07),t.beginPath(),t.roundRect(y,m,x,r,6),t.fill(),t.strokeStyle=f(d,.2+_*.4+S),t.lineWidth=l?1.5:1,t.stroke(),(_>.01||l)&&g(t,y+x/2,m+r/2,x*.55,d,S+_*.14),t.font=u.font,t.textAlign=`left`,t.textBaseline=`top`,t.fillStyle=f(d,.5+_*.35),t.fillText(`#${o+1}`,y+7,m+6);let T=Math.min(n*.28,r*.32,72),E=y+x/2,D=m+r*.38,k=t.createRadialGradient(E,D-T*.2,0,E,D,T);k.addColorStop(0,f(d,.5+_*.2)),k.addColorStop(1,f(d,.2+_*.1)),t.beginPath(),t.arc(E,D,T,0,Math.PI*2),t.fillStyle=k,t.fill(),t.strokeStyle=f(d,.4+_*.3),t.lineWidth=1,t.stroke(),t.font=u.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=f(i.t1,.9);let A=a.abbreviation??a.name??``,j=T*1.7,M=A;for(;t.measureText(M).width>j&&M.length>1;)M=M.slice(0,-1);M!==A&&(M=M.slice(0,-1)+`…`),t.fillText(M,E,D);let N=a.count==null?null:R(a.count),P=a.label??N;if(P){t.font=u.font,t.textBaseline=`alphabetic`,t.fillStyle=f(d,.9+_*.1);let e=x-16,n=P;for(;t.measureText(n).width>e&&n.length>1;)n=n.slice(0,-1);n!==P&&(n=n.slice(0,-1)+`…`),t.fillText(n,E,m+r*.74)}let F=Math.round((a.count??0)/(p||1)*100);C(w.current,a.id,h,m,n,r,{label:a.name,value:`${P} · ${F}% of total`,sublabel:`Rank #${o+1}`,color:d})}),v(t,_,U,e,.015),x=requestAnimationFrame(S)};return S(),()=>cancelAnimationFrame(x)},[d,p,_]),d.length===0?(0,n.jsx)(L,{width:_,height:U,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:_,height:U},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Contractor rank — open EW count per contractor`,style:{width:_,height:U,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...S,parentW:_,parentH:U})]})}var W=680,G=260;function Re({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(0),s=(0,t.useRef)(new Map),{hoveredRef:c,tooltip:u,hitZonesRef:d}=x(a,{width:W,height:G}),p=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=h(e,W,G);o.current=0;let n=p.length,r=Math.max(...p.map(e=>e.count),1),u=r,m=W*.05,y=G*.1,b=W*.9/n,x=G*.7/u,C=p.reduce((e,t)=>e+t.count,0),w,T=()=>{o.current++;let e=o.current;t.clearRect(0,0,W,G),d.current=[],s.current.forEach((e,t)=>{let n=t===c.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?s.current.delete(t):s.current.set(t,1):s.current.set(t,r)}),c.current&&!s.current.has(c.current)&&s.current.set(c.current,0),_(t,W,G,e,40,f(i.blue,.04)),p.forEach((n,a)=>{let o=n.count===r,c=i.blue,p=s.current.get(`${n.category}-col`)??0;for(let i=0;i<u;i++){let l=m+a*b+b/2,u=y+i*x+x/2,h=Math.min(b,x)*.38;if(i>=r-n.count){let r=h*(1+(O(e,.04,5e-4)+Math.sin(a*.6+i*1.2)*.3)*.12);(o||p>.01)&&g(t,l,u,r*3,c,(o?.2:.1)+p*.1),t.beginPath(),t.arc(l,u,r,0,Math.PI*2),t.fillStyle=f(c,o?.8:.5+p*.2),t.fill();let m=`${n.category}-${i}`;S(d.current,m,l,u,h+4,{label:n.fullName,value:`${n.count} Early Warnings`,sublabel:`${Math.round(n.count/C*100)}% of total`,color:c}),s.current.get(`${n.category}-col`)}else t.beginPath(),t.arc(l,u,1,0,Math.PI*2),t.fillStyle=f(c,.08),t.fill()}let h=y+u*x+16;t.font=l.font,t.textAlign=`center`,t.textBaseline=`alphabetic`,t.fillStyle=o?i.blue:f(i.t2,.65),t.fillText(n.category,m+a*b+b/2,h)}),v(t,W,G,e,.015),w=requestAnimationFrame(T)};return T(),()=>cancelAnimationFrame(w)},[p]),p.length===0?(0,n.jsx)(L,{width:W,height:G,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:W,height:G},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Early Warning count by category — breathing dot grid`,style:{width:W,height:G,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...u,parentW:W,parentH:G})]})}function ze({rows:e=[],className:t,colors:r}){return(0,n.jsx)(N,{rows:e,variant:`line`,className:t,colors:r})}var Be=[`#4C93D9`,`#5DA537`,`#F3862C`,`#4F72C6`,`#A0B724`,`#EEBF3B`,`#3C45D1`],Ve={nodes:[{id:`supplier-x`,name:`Supplier X`,valueLabel:`Si +0.12%`},{id:`bf3-superheat`,name:`BF-3 Superheat`,valueLabel:`22°C (target 34)`},{id:`ccm3-solidification`,name:`CCM-3 Solidification`,valueLabel:`Rate deviation`},{id:`grade-risk`,name:`Grade Risk`,valueLabel:`Automotive 74%`}],links:[{source:`supplier-x`,target:`bf3-superheat`,value:92},{source:`bf3-superheat`,target:`ccm3-solidification`,value:87},{source:`ccm3-solidification`,target:`grade-risk`,value:74}]};function He({rows:e=[],className:t,colors:r}){let i=r?.slices??Be;return(0,n.jsx)(`div`,{className:[`d3-mini-bars`,t].filter(Boolean).join(` `),children:e.map(([e,t,r],a)=>(0,n.jsxs)(`div`,{className:`d3-mini-row`,children:[(0,n.jsx)(`span`,{children:e}),(0,n.jsx)(`div`,{className:`d3-mini-track`,children:(0,n.jsxs)(`svg`,{viewBox:`0 0 100 12`,className:`d3-mini-svg`,"aria-hidden":`true`,children:[(0,n.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`12`,rx:`6`,className:`d3-mini-track-fill`}),(0,n.jsx)(`rect`,{x:`0`,y:`0`,width:Math.max(0,Math.min(100,t)),height:`12`,rx:`6`,className:`d3-mini-fill tone-${a%Be.length}`,fill:i[a%i.length]})]})}),(0,n.jsx)(`span`,{children:r})]},`${e}-${a}`))})}var Ue=770,We=320,Ge=60,Ke=28;function qe({total:e=0,totalLabel:r,items:a=[],width:o=Ue,colorOffset:s=0,"data-testid":d}){let p=(0,t.useRef)(null),m=(0,t.useRef)(new Map),_=(0,t.useRef)(0),v=(0,t.useMemo)(()=>a.filter(e=>typeof e==`object`&&!!e),[a]),y=(0,t.useMemo)(()=>Math.max(We,Ge+Math.max(0,v.length-1)*Ke),[v.length]),C=y,{hoveredRef:T,tooltip:E,hitZonesRef:D}=x(p,{width:o,height:y});return(0,t.useEffect)(()=>{let t=p.current;if(!t)return;let n=h(t,o,C);_.current=0;let a=y/2,d=o-200,b=Math.max(...v.map(e=>e.count??0),1),x=v.length>1?(y-60)/(v.length-1):0,E=d+22+10,O=v.map((e,t)=>({x:d,y:30+t*x})),j,M=()=>{_.current++;let t=_.current;n.clearRect(0,0,o,C),n.letterSpacing=l.letterSpacing;let p=w(Math.min(t/72,1));A(m.current,T.current),D.current=[];let h=c[s%c.length],y=120+60*Math.min(1,p*2.5),x=n.createLinearGradient(120,0,y,0);x.addColorStop(0,f(h,.8)),x.addColorStop(1,f(h,.7)),n.beginPath(),n.moveTo(120,a),n.lineTo(y,a),n.strokeStyle=x,n.lineWidth=1.33,n.stroke(),v.forEach((t,r)=>{let o=k(p,r,v.length,w),s=O[r],c=m.current.get(t.id)??0;if(o<.01)return;let _=180+(d-180)*.35,y=a,x=180+(d-180)*.65,C=s.y;n.beginPath();for(let e=0;e<=40;e++){let t=e/40*o,r=(1-t)**3*180+3*(1-t)**2*t*_+3*(1-t)*t**2*x+t**3*s.x,i=(1-t)**3*a+3*(1-t)**2*t*y+3*(1-t)*t**2*C+t**3*s.y;e===0?n.moveTo(r,i):n.lineTo(r,i)}let T=n.createLinearGradient(180,a,s.x,s.y);if(T.addColorStop(0,f(h,c>0?1:.8)),T.addColorStop(1,f(h,c>0?1:.7)),n.strokeStyle=T,n.lineWidth=c>0?2:1.33,n.stroke(),o>.85){let r=Math.min(1,(o-.85)/.15),a=8+(t.count??0)/b*14;g(n,s.x,s.y,a*2,h,(.2+c*.2)*r),n.beginPath(),n.arc(s.x,s.y,a*r,0,Math.PI*2),n.fillStyle=f(h,r),n.fill();let d=R(t.count??0);S(D.current,t.id,s.x,s.y,a+8,{label:t.name,value:d,sublabel:`${Math.round((t.count??0)/(e||1)*100)}% of total`,color:h}),n.globalAlpha=r,n.font=l.font,n.textAlign=`left`;let p=t.abbreviation??t.name?.slice(0,6)??``,m=` ${R(t.count??0)}`,_=s.y+4;n.fillStyle=c>0?h:f(i.t2,.85),n.fillText(p,E,_);let v=n.measureText(p).width;n.font=u.font,n.fillStyle=c>0?h:i.t1,n.fillText(m,E+v,_),n.globalAlpha=1}});let N=32*p,P=n.createRadialGradient(88,a,0,88,a,N);if(P.addColorStop(0,f(h,.02*p)),P.addColorStop(.55,f(h,.02*p)),P.addColorStop(1,f(h,.15*p)),n.beginPath(),n.arc(88,a,N,0,Math.PI*2),n.fillStyle=P,n.fill(),n.beginPath(),n.arc(88,a,N,0,Math.PI*2),n.strokeStyle=f(h,.8*p),n.lineWidth=1,n.stroke(),p>.4){n.globalAlpha=Math.min(1,(p-.4)/.4);let t=r??R(e,0);n.font=`500 16px 'Satoshi Variable', 'DM Sans', sans-serif`;let o=t;for(;n.measureText(o).width>54.4&&o.length>1;)o=o.slice(0,-1);o!==t&&(o=o.slice(0,-1)+`…`),n.fillStyle=i.t1,n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(o,88,a),n.textBaseline=`alphabetic`,n.globalAlpha=1}S(D.current,`__root__`,88,a,32,{label:r??`Total`,value:R(e,0),sublabel:`${v.length} items`,color:h}),j=requestAnimationFrame(M)};return M(),()=>cancelAnimationFrame(j)},[e,r,v,y,o]),v.length===0?(0,n.jsx)(L,{width:o,height:We,"data-testid":d}):(0,n.jsxs)(`div`,{"data-testid":d,style:{position:`relative`,width:o,height:C},children:[(0,n.jsx)(`canvas`,{ref:p,role:`img`,"aria-label":`NCE fault tree — NCEs per contractor as branching tree`,style:{width:o,height:C,display:`block`}}),(0,n.jsx)(b,{...E,parentW:o,parentH:C})]})}var Je=192,Ye=Je,Xe=Je+80;function Ze({rows:e=[],variant:a,className:o,colors:c}){let l=(0,t.useRef)(null),u=(0,t.useRef)(new Map),d=(0,t.useRef)(0),p=c?.slices??s,{hoveredRef:_,tooltip:v,hitZonesRef:y}=x(l,{width:Ye,height:Xe});return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=h(t,Ye,Xe);d.current=0;let r=Ye/2,o=Je/2,s=Je*.4,c=a===`donut`?Je*.21:0,v=e.reduce((e,t)=>e+(t.pricing??0),0)||1,b,x=()=>{d.current++;let t=d.current;n.clearRect(0,0,Ye,Xe);let l=1-(1-Math.min(t/48,1))**3;A(u.current,_.current),y.current=[];let h=-Math.PI/2;e.forEach((e,a)=>{let d=(e.pricing??0)/v,m=d*Math.PI*2*l,_=h+m,b=p[a%p.length],x=u.current.get(e.id??`sl-${a}`)??0,C=h+m/2,w=(s+c)/2,T=r+Math.cos(C)*w,E=o+Math.sin(C)*w,D=(s-c)/2+8;S(y.current,e.id??`sl-${a}`,T,E,D,{label:e.vendor,value:`${e.pricing??0} (${Math.round(d*100)}%)`,color:b}),x>0&&g(n,T,E,D*2*x,b,.2*x);let k=O(t,.03,3e-4),A=s+x*6+(x>0?k*2:0);n.beginPath(),n.moveTo(r+Math.cos(h)*c,o+Math.sin(h)*c),n.arc(r,o,A,h,_),c>0?n.arc(r,o,c,_,h,!0):n.lineTo(r,o),n.closePath(),n.fillStyle=f(b,.7+x*.2),n.fill(),n.strokeStyle=f(i.bg,.8),n.lineWidth=1.5,n.stroke(),h=_}),a===`donut`&&e.length>0&&g(n,r,o,c*.8,i.blue,.06);let C=Je+12;e.forEach((e,t)=>{let r=p[t%p.length],a=(e.pricing??0)/v,o=u.current.get(e.id??`sl-${t}`)??0,s=C+t*18;n.fillStyle=f(r,.8+o*.2),n.fillRect(4,s-6,12,12),n.font=`9px 'JetBrains Mono', monospace`,n.fillStyle=f(i.t2,.7+o*.2),n.textAlign=`left`,n.fillText(e.vendor,18,s+3.5),n.font=`bold 9px 'JetBrains Mono', monospace`,n.fillStyle=m(i.t3,r,o),n.textAlign=`right`,n.fillText(`${e.pricing??0} (${Math.round(a*100)}%)`,Ye-4,s+3.5)}),b=requestAnimationFrame(x)};return x(),()=>cancelAnimationFrame(b)},[e,a,c,p]),(0,n.jsx)(r,{className:[`canvas-pie-frame`,o].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:Ye,height:Xe},children:[(0,n.jsx)(`canvas`,{ref:l,role:`img`,"aria-label":`${a} chart`,style:{width:Ye,height:Xe,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...v,parentW:Ye,parentH:Xe})]})})}function Qe(e,t,n,r){let i=new Set(t.map(e=>e.source)),a=new Set(t.map(e=>e.target)),o=new Map,s=[];for(e.forEach(e=>{i.has(e.id)&&!a.has(e.id)&&s.push({id:e.id,depth:0})});s.length>0;){let e=s.shift();if(!e)break;let{id:n,depth:r}=e;o.has(n)||(o.set(n,r),t.filter(e=>e.source===n).forEach(e=>{o.has(e.target)||s.push({id:e.target,depth:r+1})}))}let c=o.size>0?Math.max(...Array.from(o.values())):0;e.forEach(e=>{o.has(e.id)||o.set(e.id,c+1)});let l=new Map;e.forEach(e=>{let t=o.get(e.id)??0;l.has(t)||l.set(t,[]),l.get(t).push(e.id)});let u=Math.max(...Array.from(l.keys()))+1,d={left:100,right:80,top:40,bottom:40},f=new Map;return l.forEach((e,t)=>{let i=d.left+t/Math.max(u-1,1)*(n-d.left-d.right),a=r-d.top-d.bottom,o=Math.max(24,(a-(e.length-1)*12)/e.length),s=e.length*o+(e.length-1)*12,c=d.top+(a-s)/2;e.forEach((e,t)=>{f.set(e,{x:i-20/2,y:c+t*(o+12),w:20,h:o})})}),f}function $e({nodes:e,links:a,width:o=960,height:c=280,ariaLabel:l,selectedEntity:u,className:d,colors:p}){let m=(0,t.useRef)(null),_=(0,t.useRef)(new Map),y=(0,t.useRef)(0),w=(0,t.useRef)([]),T=p?.nodes??s,E=p?.links??i.bd,D=p?.activeLinks??i.blue,k=p?.activeNodes??i.blue,j=(0,t.useMemo)(()=>Qe(e,a,o,c),[e,a,o,c]),{hoveredRef:M,tooltip:N,hitZonesRef:P}=x(m,{width:o,height:c});return(0,t.useEffect)(()=>{let t=m.current;if(!t)return;let n=h(t,o,c);y.current=0,w.current=[];let r=a.length>0?Math.max(...a.map(e=>e.value)):1,s,l=()=>{y.current++;let t=y.current;n.clearRect(0,0,o,c);let d=1-(1-Math.min(t/56,1))**3;A(_.current,M.current),P.current=[],a.forEach((e,a)=>{let o=j.get(e.source),s=j.get(e.target);if(!o||!s)return;let c=!!u&&(e.source===u||e.target===u),l=c?D:E,p=c?.5:.2,m=Math.max(3,e.value/r*36*d),h=m/2,g=o.x+o.w,_=o.y+o.h/2,v=s.x,y=s.y+s.h/2,b=(g+v)/2;for(let e=0;e<30;e++){let r=e/30,i=(e+1)/30,o=1-r,s=1-i,c=o*o*g+2*o*r*b+r*r*v,u=o*o*_+2*o*r*_+r*r*y,d=s*s*g+2*s*i*b+i*i*v,m=s*s*_+2*s*i*_+i*i*y,x=O(t+r*120+a*40,.025,3e-4)*1.2;n.beginPath(),n.moveTo(c,u-h+x),n.lineTo(d,m-h+x),n.lineTo(d,m+h+x),n.lineTo(c,u+h+x),n.closePath(),n.fillStyle=f(l,p*(.5+r*.5)),n.fill()}S(P.current,`link-${a}`,b,(_+y)/2,m+6,{label:`${e.source} → ${e.target}`,value:String(e.value),color:c?D:i.blue}),Math.random()<.08&&w.current.push({linkIdx:a,prog:0,speed:.006+Math.random()*.006,off:(Math.random()-.5)*m*.5,sz:1+Math.random()})}),e.forEach((e,r)=>{let a=j.get(e.id);if(!a)return;let o=u===e.id,s=M.current===`node-${r}`,c=_.current.get(`node-${r}`)??0,l=o?k:T[r%T.length];C(P.current,`node-${r}`,a.x,a.y,a.w,a.h,{label:e.name,value:e.valueLabel??e.id,color:l}),(c>0||o)&&g(n,a.x+a.w/2,a.y+a.h/2,a.w*2,l,.2*Math.max(c,o?.6:0));let d=o?O(t,.03,3e-4)*.15:0;n.fillStyle=f(l,.6+c*.25+d),n.beginPath(),n.roundRect(a.x,a.y,a.w,a.h,4),n.fill(),(o||c>0)&&(n.strokeStyle=f(l,.5*Math.max(c,o?1:0)),n.lineWidth=1,n.beginPath(),n.roundRect(a.x,a.y,a.w,a.h,4),n.stroke());let p=a.x+a.w+8;n.font=`${o||s?`bold `:``}10px 'JetBrains Mono', monospace`,n.fillStyle=f(o?l:i.t2,.7+c*.2),n.textAlign=`left`,n.fillText(e.name,p,a.y+a.h/2+4),e.valueLabel&&(n.font=`9px 'JetBrains Mono', monospace`,n.fillStyle=f(l,.5+c*.2),n.fillText(e.valueLabel,p,a.y+a.h/2+17))}),w.current=w.current.filter(e=>{if(e.prog+=e.speed,e.prog>1)return!1;let t=a[e.linkIdx];if(!t)return!1;let r=j.get(t.source),o=j.get(t.target);if(!r||!o)return!1;let s=r.x+r.w,c=r.y+r.h/2,l=o.x,u=o.y+o.h/2,d=(s+l)/2,m=1-e.prog,h=m*m*s+2*m*e.prog*d+e.prog*e.prog*l,g=m*m*c+2*m*e.prog*c+e.prog*e.prog*u+e.off,_=Math.sin(e.prog*Math.PI)*.5,v=p?.links??i.blue;return n.beginPath(),n.arc(h,g,e.sz,0,Math.PI*2),n.fillStyle=f(v,_),n.fill(),!0}),w.current.length>150&&(w.current=w.current.slice(-150)),v(n,o,c,t,.01),s=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(s),w.current=[]}},[e,a,o,c,u,p,j]),(0,n.jsx)(r,{className:[`canvas-sankey-frame`,d].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{role:`img`,"aria-label":l,style:{position:`relative`,width:o,height:c},children:[(0,n.jsx)(`canvas`,{ref:m,style:{width:o,height:c,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...N,parentW:o,parentH:c})]})})}var et=[{x:.13,y:.48},{x:.37,y:.28},{x:.63,y:.62},{x:.87,y:.38},{x:.25,y:.72},{x:.5,y:.18},{x:.75,y:.7},{x:.92,y:.22}],tt=[i.blue,i.orange,i.red,i.purple,i.green,i.amber,i.t2],nt=[26,24,24,26,22,22,22,22];function rt(e,t){let n=1-t;return{x:n*n*n*e.p0.x+3*n*n*t*e.p1.x+3*n*t*t*e.p2.x+t*t*t*e.p3.x,y:n*n*n*e.p0.y+3*n*n*t*e.p1.y+3*n*t*t*e.p2.y+t*t*t*e.p3.y}}function it(e,t){let n=1-t,r=3*n*n*(e.p1.x-e.p0.x)+6*n*t*(e.p2.x-e.p1.x)+3*t*t*(e.p3.x-e.p2.x),i=3*n*n*(e.p1.y-e.p0.y)+6*n*t*(e.p2.y-e.p1.y)+3*t*t*(e.p3.y-e.p2.y),a=Math.sqrt(r*r+i*i)||1;return{x:-i/a,y:r/a}}function at(e,t){let n=t.x-e.x,r=t.y-e.y;return{p0:{x:e.x,y:e.y},p1:{x:e.x+n*.3+r*.15,y:e.y+r*.3-n*.15},p2:{x:t.x-n*.3+r*.08,y:t.y-r*.3-n*.08},p3:{x:t.x,y:t.y}}}function ot({nodes:e,links:r,width:a=960,height:o=280,selectedEntity:s}){let c=(0,t.useRef)(null),l=(0,t.useRef)(0),u=(0,t.useRef)([]),{hoveredRef:d,tooltip:p,hitZonesRef:y}=x(c,{width:a,height:o}),C=(0,t.useMemo)(()=>{let t=new Map;return e.forEach((e,n)=>t.set(e.id,n)),t},[e]),T=(0,t.useMemo)(()=>r.length>0?Math.max(...r.map(e=>e.value)):100,[r]),E=e=>T>1?e/100:e,D=(0,t.useMemo)(()=>e.map((e,t)=>{let n=et[t%et.length];return{id:e.id,label:e.name,sub:e.valueLabel??``,x:n.x*a,y:n.y*o,r:nt[t%nt.length],color:tt[t%tt.length]}}),[e,a,o]),k=(0,t.useMemo)(()=>r.map(e=>({fromIdx:C.get(e.source)??-1,toIdx:C.get(e.target)??-1,conf:E(e.value)})).filter(e=>e.fromIdx>=0&&e.toIdx>=0),[r,C]);return(0,t.useEffect)(()=>{let e=c.current;if(!e)return;let t=h(e,a,o);l.current=0,u.current=[];let n,r=()=>{l.current++;let e=l.current;if(t.clearRect(0,0,a,o),y.current=[],_(t,a,o,e,50,f(i.blue,.05)),k.forEach((e,n)=>{let r=D[e.fromIdx],a=D[e.toIdx];if(!r||!a)return;let o=!!s&&(r.id===s||a.id===s),c=m(r.color,a.color,.5),l=o?.18:.05,d=o?.25:.1,p=at(r,a);t.beginPath(),t.moveTo(p.p0.x,p.p0.y),t.bezierCurveTo(p.p1.x,p.p1.y,p.p2.x,p.p2.y,p.p3.x,p.p3.y),t.strokeStyle=f(c,l),t.lineWidth=16,t.lineCap=`round`,t.stroke(),t.strokeStyle=f(c,d),t.lineWidth=1.5,t.stroke();for(let t=0;t<e.conf*2.5;t++)Math.random()<.45&&u.current.push({edgeIdx:n,t:0,speed:.003+Math.random()*.004,off:(Math.random()-.5)*13,sz:.7+Math.random()*2});let h=rt(p,.5),g=`${Math.round(e.conf*100)}%`;t.font=`bold 12px 'JetBrains Mono', monospace`,t.textBaseline=`middle`;let _=t.measureText(g).width+14;t.fillStyle=`rgba(10,16,24,0.88)`,t.beginPath(),t.roundRect(h.x-_/2,h.y-11,_,22,6),t.fill(),t.strokeStyle=f(i.blue,.25),t.lineWidth=1,t.stroke(),t.fillStyle=f(i.blue,.9),t.textAlign=`center`,t.fillText(g,h.x,h.y)}),u.current=u.current.filter(e=>{if(e.t+=e.speed,e.t>1)return!1;let n=k[e.edgeIdx];if(!n)return!1;let r=D[n.fromIdx],i=D[n.toIdx];if(!r||!i)return!1;let a=at(r,i),o=rt(a,e.t),s=it(a,e.t),c=o.x+s.x*e.off,l=o.y+s.y*e.off,u=Math.sin(e.t*Math.PI)*.7,d=m(r.color,i.color,e.t);return g(t,c,l,e.sz*3,d,u*.1),t.beginPath(),t.arc(c,l,e.sz,0,Math.PI*2),t.fillStyle=f(d,u),t.fill(),!0}),u.current.length>350&&(u.current=u.current.slice(-350)),D.forEach((n,r)=>{let a=s===n.id,o=d.current===`node-${r}`,c=O(e,.03,3e-4)*.1+1,l=n.r*c*(a?1.15:1);t.beginPath(),t.arc(n.x,n.y,l+6,0,Math.PI*2),t.strokeStyle=f(n.color,a?.3:.1),t.lineWidth=a?1.5:.7,t.stroke(),g(t,n.x,n.y,l*3,n.color,a?.22:.12);let u=t.createRadialGradient(n.x,n.y-l*.2,0,n.x,n.y,l);if(u.addColorStop(0,f(n.color,a?1:.85)),u.addColorStop(1,f(n.color,a?.65:.45)),t.fillStyle=u,t.beginPath(),t.arc(n.x,n.y,l,0,Math.PI*2),t.fill(),a||r===D.length-1){let r=l+16,i=e*.04,a=n.x+Math.cos(i)*r,o=n.y+Math.sin(i)*r;g(t,a,o,6,n.color,.3),t.beginPath(),t.arc(a,o,2,0,Math.PI*2),t.fillStyle=f(n.color,.75),t.fill()}S(y.current,`node-${r}`,n.x,n.y,l+8,{label:n.label,value:n.sub||n.id,color:n.color}),t.font=`${a||o?`bold `:``}12px 'DM Sans', sans-serif`,t.textAlign=`center`,t.textBaseline=`alphabetic`,t.fillStyle=f(n.color,a?1:.9),t.fillText(n.label,n.x,n.y+l+18),n.sub&&(t.font=`10px 'JetBrains Mono', monospace`,t.fillStyle=f(i.t3,.65),t.fillText(n.sub,n.x,n.y+l+32))}),k.length>=2){let n=k.reduce((e,t)=>e*t.conf,1),r=o*.92,s=a*.12,c=a*.76,l=w(Math.min(e*.008,1));t.fillStyle=f(i.bd,.35),t.beginPath(),t.roundRect(s,r,c,5,3),t.fill(),t.fillStyle=f(i.orange,.6),t.beginPath(),t.roundRect(s,r,c*n*l,5,3),t.fill(),t.font=`bold 12px 'JetBrains Mono', monospace`,t.textAlign=`left`,t.textBaseline=`middle`,t.fillStyle=f(i.orange,.85),t.fillText(`${Math.round(n*100)}% compound confidence`,s+c*n*l+10,r+2);let u=k.map(e=>e.conf.toFixed(2)).join(` × `);t.textAlign=`right`,t.font=`9px 'JetBrains Mono', monospace`,t.fillStyle=f(i.t4,.6),t.fillText(u,s-6,r+2)}v(t,a,o,e,.012),n=requestAnimationFrame(r)};return r(),()=>{cancelAnimationFrame(n),u.current=[]}},[D,k,a,o,s]),(0,n.jsxs)(`div`,{style:{position:`relative`,width:a,height:o},children:[(0,n.jsx)(`canvas`,{ref:c,style:{width:a,height:o,display:`block`,borderRadius:8},role:`img`,"aria-label":`causal flow diagram`}),(0,n.jsx)(b,{...p,parentW:a,parentH:o})]})}function st({selectedEntity:e,colors:t}){return(0,n.jsx)(ot,{nodes:Ve.nodes,links:Ve.links,width:960,height:280,selectedEntity:e})}function ct({rows:e=[],className:r,colors:i}){let{nodes:a,links:o}=(0,t.useMemo)(()=>{let t=e.slice(0,5);return{nodes:[{id:`score`,name:`Portfolio Score`},...t.map(e=>({id:e.id??e.vendor,name:e.vendor}))],links:t.map(e=>({source:e.id??e.vendor,target:`score`,value:Math.max(8,e.pricing??0)}))}},[e]);return(0,n.jsx)($e,{nodes:a,links:o,width:760,height:280,ariaLabel:`sankey chart`,className:r,colors:i})}var lt=780,ut=420;function dt({left:e,right:r,leftTitle:a=`Accepted`,rightTitle:o=`Submitted`,unit:s=`quotations`,"data-testid":c}){let u=(0,t.useRef)(null),d=(0,t.useRef)(0);return(0,t.useEffect)(()=>{let t=u.current;if(!t)return;let n=h(t,lt,ut);d.current=0;let c=lt/2,p=Math.abs(e.value??0),m=Math.abs(r.value??0),_=Math.max(p,m,1),v=(e.value-r.value)/(2*_)*14,y=Math.max(-14,Math.min(14,v)),b=(e,t,r,a,o)=>{let s=t-99/2,c=r+30,l=[0,0,10,10];n.save(),n.beginPath(),n.roundRect(s,c,99,a,l),n.clip();let u=f(e,.27*o),d=f(e,0),p=n.createLinearGradient(s,0,s+25,0);p.addColorStop(0,u),p.addColorStop(1,d),n.fillStyle=p,n.fillRect(s,c,25,a);let m=n.createLinearGradient(s+99,0,s+99-25,0);m.addColorStop(0,u),m.addColorStop(1,d),n.fillStyle=m,n.fillRect(s+99-25,c,25,a);let h=n.createLinearGradient(0,c,0,c+25);h.addColorStop(0,u),h.addColorStop(1,d),n.fillStyle=h,n.fillRect(s,c,99,25);let g=n.createLinearGradient(0,c+a,0,c+a-25);g.addColorStop(0,u),g.addColorStop(1,d),n.fillStyle=g,n.fillRect(s,c+a-25,99,25),n.restore(),n.beginPath(),n.roundRect(s,c,99,a,l),n.strokeStyle=f(e,1*o),n.lineWidth=1,n.stroke();let _=s+99/2,v=c-5;n.strokeStyle=f(i.t2,.5*o),n.lineWidth=1,n.beginPath(),n.moveTo(t,r+4),n.lineTo(_,v),n.stroke(),n.beginPath(),n.moveTo(_,v),n.lineTo(_-10,c),n.stroke(),n.beginPath(),n.moveTo(_,v),n.lineTo(_+10,c),n.stroke(),n.beginPath(),n.arc(t,r,3,0,Math.PI*2),n.fillStyle=f(i.t2,.7*o),n.fill()},x,S=()=>{d.current++;let t=d.current;n.clearRect(0,0,lt,ut),n.letterSpacing=l.letterSpacing;let u=w(Math.min(t/80,1)),h=y*D(Math.min(t/80,1))*Math.PI/180,v={x:c-Math.cos(h)*240,y:100+Math.sin(-h)*240},C={x:c+Math.cos(h)*240,y:100+Math.sin(h)*240};n.strokeStyle=f(i.t2,.55*u),n.lineWidth=1.5,n.beginPath(),n.moveTo(v.x,v.y),n.lineTo(C.x,C.y),n.stroke(),g(n,c,100,18,i.t2,.14*u),n.beginPath(),n.arc(c,100,9*u,0,Math.PI*2),n.fillStyle=f(i.t2,.85*u),n.fill();let T=Math.max(20,p/_*95*u),E=Math.max(20,m/_*95*u);if(b(i.green,v.x,v.y,T,u),b(i.amber,C.x,C.y,E,u),u>.5){n.globalAlpha=Math.min(1,(u-.5)/.5),n.textAlign=`center`,n.textBaseline=`top`;let t=v.y+30+T+14,c=C.y+30+E+14;n.font=`700 34px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.fillText(e.label,v.x,t),n.font=l.font,n.fillStyle=l.color,n.fillText(`${a} ${e.count} ${s}`,v.x,t+42),n.font=`700 34px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.fillText(r.label,C.x,c),n.font=l.font,n.fillStyle=l.color,n.fillText(`${o} ${r.count} ${s}`,C.x,c+42),n.globalAlpha=1,n.textBaseline=`alphabetic`}x=requestAnimationFrame(S)};return S(),()=>cancelAnimationFrame(x)},[e,r]),(0,n.jsx)(`div`,{"data-testid":c,style:{position:`relative`,width:lt,height:ut},children:(0,n.jsx)(`canvas`,{ref:u,role:`img`,"aria-label":`Quotation balance — accepted vs submitted quotation value`,style:{width:lt,height:ut,display:`block`,borderRadius:8}})})}var ft=780,pt=360;function mt({points:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),s=(0,t.useRef)(0),{hoveredRef:c,tooltip:u,hitZonesRef:d}=x(a,{width:ft,height:pt}),p=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=h(e,ft,pt);s.current=0;let n=ft-64-48,r=pt-48-68,u=Math.max(...p.map(e=>e.count),1),m=p.length,_=m>1?n/(m-1):n,v=p.map((e,t)=>({x:64+t*_,y:48+r-e.count/u*r,point:e})),b,x=()=>{s.current++;let e=s.current;t.clearRect(0,0,ft,pt),t.letterSpacing=l.letterSpacing;let a=w(Math.min(e/72,1));A(o.current,c.current),d.current=[],[0,.25,.5,.75,1].forEach(e=>{let a=48+r-e*r;t.strokeStyle=f(i.bd,.18),t.lineWidth=1,t.setLineDash([3,5]),t.beginPath(),t.moveTo(64,a),t.lineTo(64+n,a),t.stroke(),t.setLineDash([]),t.font=l.font,t.fillStyle=l.color,t.textAlign=`right`,t.fillText(String(Math.round(u*e)),58,a+3)}),t.save(),t.translate(12,48+r/2),t.rotate(-Math.PI/2),t.font=l.font,t.fillStyle=l.color,t.textAlign=`center`,t.fillText(`Count`,0,0),t.restore(),t.strokeStyle=f(i.bd,.3),t.lineWidth=1,t.setLineDash([]),t.beginPath(),t.moveTo(64,48+r),t.lineTo(64+n,48+r),t.stroke();let p=a*(m-1),h=Math.floor(p)+1;if(h>=2){t.beginPath(),t.moveTo(v[0].x,48+r),t.lineTo(v[0].x,v[0].y);for(let e=1;e<h;e++){let n=p-Math.floor(p),r=e<h-1?v[e].x:v[e-1].x+(v[e].x-v[e-1].x)*(e===Math.ceil(p)?n:1),i=e<h-1?v[e].y:v[e-1].y+(v[e].y-v[e-1].y)*(e===Math.ceil(p)?n:1);t.lineTo(r,i)}let e=v[Math.min(h-1,m-1)];t.lineTo(e.x,48+r),t.closePath();let n=t.createLinearGradient(0,48,0,48+r);n.addColorStop(0,f(i.teal,.12)),n.addColorStop(1,f(i.teal,.02)),t.fillStyle=n,t.fill()}t.beginPath();for(let e=0;e<h;e++){let n=p-Math.floor(p),r=e===h-1&&e>0&&e===Math.ceil(p),i=e===0||e<h-1?v[e].x:v[e-1].x+(v[e].x-v[e-1].x)*(r?n:1),a=e===0||e<h-1?v[e].y:v[e-1].y+(v[e].y-v[e-1].y)*(r?n:1);e===0?t.moveTo(i,a):t.lineTo(i,a)}t.strokeStyle=f(i.teal,.85),t.lineWidth=2,t.stroke(),v.forEach((e,n)=>{if(n>=h)return;let a=`pt-${n}`,s=o.current.get(a)??0;S(d.current,a,e.x,e.y,10,{label:e.point.week,value:String(e.point.count),color:i.teal}),s>0&&y(t,e.x,48,48+r,f(i.teal,.15*s));let c=e.point.count===u;(s>0||c)&&g(t,e.x,e.y,14,i.teal,(c?.3:0)+s*.25),t.beginPath(),t.arc(e.x,e.y,s>0?5:3.5,0,Math.PI*2),t.fillStyle=f(i.teal,s>0?1:.8),t.fill(),(s>0||c)&&(t.font=l.font,t.fillStyle=i.teal,t.textAlign=`center`,t.fillText(String(e.point.count),e.x,e.y-10)),t.font=l.font,t.fillStyle=s>0?i.teal:l.color,t.textAlign=`center`,t.fillText(e.point.week,e.x,pt-68+14)}),b=requestAnimationFrame(x)};return x(),()=>cancelAnimationFrame(b)},[p]),p.length<2?(0,n.jsx)(L,{width:ft,height:pt,"data-testid":r}):(0,n.jsx)(`div`,{"data-testid":r,className:`trend-scroll`,style:{width:`100%`,overflowX:`auto`},children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:ft,height:pt},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Trend chart — count over time`,style:{width:ft,height:pt,display:`block`}}),(0,n.jsx)(b,{...u,parentW:ft,parentH:pt})]})})}var ht=680,K=280,gt=80,_t=48,vt=64,yt=l.font,bt=12,xt=Math.PI*2,St=72,Ct=20,wt=5e3;function Tt({points:e=[],colorOffset:r=0,"data-testid":a}){let o=(0,t.useRef)(null),s=(0,t.useRef)(null),u=(0,t.useRef)(0),d=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),p=(0,t.useMemo)(()=>{if(d.length<=1)return vt;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return vt;e.font=yt;let t=Math.max(1,Math.ceil(d.length/Ct)),n=Math.max(...d.filter((e,n)=>n%t===0).map(t=>e.measureText(t.week).width));return Math.max(vt,n+bt)},[d]),m=Math.round(p/2),g=_t+m+Math.max(0,d.length-1)*p,_=Math.max(ht-gt,Math.min(g,wt)),{tooltip:v,hitZonesRef:y}=x(o,{width:_,height:K});return(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=h(e,_,K),n=s.current?h(s.current,gt,K):null;u.current=0;let a=c[r%c.length],g=d.length<=St?St:Math.max(24,Math.round(St*(St/d.length))),v=_-_t,b=K-42-54,x=d.length>0?d.map(e=>e.count):[0],C=Math.min(...x),T=Math.max(...x),E=T-C||1,D=d.length,O=D>1?(v-m)/(D-1):v-m,k=Math.max(1,Math.ceil(p/O)),A=C<0,j=A?42+b- -C/E*b:42+b,M=d.map((e,t)=>({x:m+t*O,y:42+b-(A?(e.count-C)/E:e.count/(T||1))*b,point:e}));if(n){n.clearRect(0,0,gt,K),n.letterSpacing=l.letterSpacing;let e=A?[C,C+E*.25,C+E*.5,C+E*.75,T]:[0,T*.25,T*.5,T*.75,T];e.forEach((t,r)=>{let i=r/(e.length-1),a=42+b-i*b;n.font=l.font,n.fillStyle=l.color,n.textAlign=`right`,n.fillText(R(t),gt-6,a+3)}),n.save(),n.translate(12,42+b/2),n.rotate(-Math.PI/2),n.font=l.font,n.fillStyle=l.color,n.textAlign=`center`,n.fillText(`Count`,0,0),n.restore()}let N=t.createLinearGradient(0,42,0,42+b);N.addColorStop(0,f(a,.12)),N.addColorStop(1,f(a,.02));let P=0,F,I=e=>{t.font=yt,t.fillStyle=l.color,t.textAlign=`center`;for(let n=0;n<e;n++)n%k===0&&t.fillText(M[n].point.week,M[n].x,K-54+14)},ee=()=>{u.current++;let e=Math.min(u.current/g,1),n=w(e),r=e>=1;t.clearRect(0,0,_,K),t.letterSpacing=l.letterSpacing,(A?[0,.25,.5,.75,1]:[.25,.5,.75,1]).forEach(e=>{let n=42+b-e*b;t.strokeStyle=f(i.bd,.18),t.lineWidth=1,t.setLineDash([3,5]),t.beginPath(),t.moveTo(0,n),t.lineTo(v,n),t.stroke(),t.setLineDash([])}),t.font=l.font,t.fillStyle=l.color,t.textAlign=`center`,t.fillText(`Period`,m+(v-m)/2,K-6),t.strokeStyle=f(i.bd,A?.5:.3),t.lineWidth=A?2:1,t.beginPath(),t.moveTo(m,A?j:42+b),t.lineTo(v,A?j:42+b),t.stroke();let o=n*(D-1),s=Math.floor(o)+1;if(s>=2){let e=A?j:42+b;t.beginPath(),t.moveTo(M[0].x,e),t.lineTo(M[0].x,M[0].y);for(let e=1;e<s;e++){let n=o-Math.floor(o),r=e===s-1&&e===Math.ceil(o)&&n>0,i=r?M[e-1].x+(M[e].x-M[e-1].x)*n:M[e].x,a=r?M[e-1].y+(M[e].y-M[e-1].y)*n:M[e].y;t.lineTo(i,a)}t.lineTo(M[s-1].x,e),t.closePath(),t.fillStyle=N,t.fill()}t.beginPath();for(let e=0;e<s;e++){let n=o-Math.floor(o),r=e===s-1&&e>0&&e===Math.ceil(o)&&n>0,i=r?M[e-1].x+(M[e].x-M[e-1].x)*n:M[e].x,a=r?M[e-1].y+(M[e].y-M[e-1].y)*n:M[e].y;e===0?t.moveTo(i,a):t.lineTo(i,a)}t.strokeStyle=f(a,.85),t.lineWidth=2,t.stroke(),t.fillStyle=f(a,.8),t.beginPath();for(let e=0;e<s;e++)t.moveTo(M[e].x+3.5,M[e].y),t.arc(M[e].x,M[e].y,3.5,0,xt);if(t.fill(),s>P){y.current=[];for(let e=0;e<s;e++)S(y.current,`pt-${e}`,M[e].x,M[e].y,10,{label:M[e].point.week,value:String(M[e].point.count),color:a});P=s}r&&I(D),r||(F=requestAnimationFrame(ee))};return ee(),()=>cancelAnimationFrame(F)},[d,_,p,y,r]),d.length<2?(0,n.jsx)(L,{width:ht,height:K,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,style:{position:`relative`,width:`100%`,display:`flex`},children:[(0,n.jsx)(`canvas`,{ref:s,"aria-hidden":`true`,style:{width:gt,height:K,display:`block`,flexShrink:0}}),(0,n.jsx)(`div`,{className:`trend-scroll`,style:{flex:1,minWidth:0,overflowX:`auto`},children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:_,height:K},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Trend chart — count over time`,style:{width:_,height:K,display:`block`}}),(0,n.jsx)(b,{...v,parentW:_,parentH:K})]})})]})}var Et=780,Dt=340,Ot=28,kt=4,At=148;function jt(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(`${r}…`).width>n;)r=r.slice(0,-1);return`${r}…`}function Mt({severities:e=[],colorOffset:r=0,"data-testid":a}){let o=(0,t.useRef)(null),s=(0,t.useRef)(new Map),u=(0,t.useRef)(0),d=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),p=d.length>0?Math.min(Et,2*Ot+d.length*At):Et,{hoveredRef:m,tooltip:g,hitZonesRef:_}=x(o,{width:p,height:Dt});return(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=h(e,p,Dt);u.current=0;let n=d.reduce((e,t)=>e+(t.count??0),0),a=Ot,g=Ot,v=p-a-g,y=Dt-54-54,b=v-Math.max(0,d.length-1)*kt,x=d.map(e=>(e.count??0)/(n||1)*b),S=c[r%c.length],w,E=()=>{u.current++;let e=u.current;t.clearRect(0,0,p,Dt),t.letterSpacing=l.letterSpacing;let r=T(Math.min(e/60,1));A(s.current,m.current),_.current=[];let o=a;d.forEach((e,a)=>{let c=x[a]??0,u=s.current.get(e.severity)??0,d=o+c/2,p=c*.78,m=c*r,h=p*r,g=d-h/2;if(m>0){let e=()=>{t.beginPath(),t.moveTo(g,54),t.lineTo(g+h,54),t.lineTo(o+m,54+y),t.lineTo(o,54+y),t.closePath()},n=o+c/2,i=54+y/2,a=Math.sqrt((c/2)**2+(y/2)**2),s=t.createRadialGradient(n,i,0,n,i,a);s.addColorStop(0,f(S,(.03+u*.02)*r)),s.addColorStop(.5,f(S,(.12+u*.04)*r)),s.addColorStop(1,f(S,(.28+u*.08)*r)),t.save(),e(),t.clip(),e(),t.fillStyle=s,t.fill(),t.restore(),e(),t.strokeStyle=f(S,.9*r),t.lineWidth=1,t.stroke()}if(C(_.current,e.severity,o,54,c,y,{label:e.severity,value:R(e.count??0),sublabel:`${Math.round((e.count??0)/(n||1)*100)}%`,color:S}),r>.5){let a=Math.min(1,(r-.5)/.5),s=o+c/2;t.globalAlpha=a,t.font=l.font,t.fillStyle=u>0?S:f(i.t1,.65),t.textAlign=`center`,t.fillText(jt(t,e.severity,c-8),s,40),t.font=`600 22px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=f(i.t1,.92+u*.08),t.fillText(R(e.count??0),s,54+y/2+8),t.font=l.font,t.fillStyle=u>0?S:f(i.t1,.5),t.fillText(`${Math.round((e.count??0)/(n||1)*100)}%`,s,54+y+22),t.globalAlpha=1}o+=c+kt}),w=requestAnimationFrame(E)};return E(),()=>cancelAnimationFrame(w)},[d,p,r]),d.length===0?(0,n.jsx)(L,{width:p,height:Dt,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,style:{position:`relative`,width:p,height:Dt},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Early Warning severity distribution — prism spectrum bands`,style:{width:p,height:Dt,display:`block`}}),(0,n.jsx)(b,{...g,parentW:p,parentH:Dt})]})}var q=300,J=280,Nt=100,Pt={Open:i.red,Submitted:i.amber,Closed:i.green};function Ft({segments:e=[],title:r,unitLabel:a=``,"data-testid":o}){let s=(0,t.useRef)(null),c=(0,t.useRef)(0),d=(0,t.useRef)(new Map),{hoveredRef:p,tooltip:m,hitZonesRef:y}=x(s,{width:q,height:J}),C=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=h(e,q,J);c.current=0;let n=q*.5,o=J*.56,m=Nt,b=C.reduce((e,t)=>e+(t.count??0),0),x=Math.max(...C.map(e=>e.count??0),1),w,T=()=>{c.current++;let e=c.current;t.clearRect(0,0,q,J),t.letterSpacing=l.letterSpacing,y.current=[],d.current.forEach((e,t)=>{let n=t===p.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?d.current.delete(t):d.current.set(t,1):d.current.set(t,r)}),p.current&&!d.current.has(p.current)&&d.current.set(p.current,0),_(t,q,J,e,40,f(i.blue,.04)),C.forEach((r,a)=>{let s=a/3*Math.PI*2-Math.PI/2,c=n+Math.cos(s)*m,l=o+Math.sin(s)*m,d=Pt[r.status]??i.blue,p=2+r.count/x*8;t.beginPath(),t.moveTo(n,o),t.lineTo(c,l),t.strokeStyle=f(d,.08),t.lineWidth=p*2,t.stroke(),t.beginPath(),t.moveTo(n,o),t.lineTo(c,l),t.strokeStyle=f(d,.25),t.lineWidth=1,t.stroke();let h=(e*.005+a*.33)%1,_=n+(c-n)*h,v=o+(l-o)*h;g(t,_,v,6,d,.4),t.beginPath(),t.arc(_,v,2,0,Math.PI*2),t.fillStyle=f(d,.8),t.fill();let y=(n+c)/2,b=(o+l)/2;t.font=u.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=f(d,.85),t.fillText(String(r.count),y,b)}),C.forEach((e,r)=>{let s=r/3*Math.PI*2-Math.PI/2,c=n+Math.cos(s)*m,u=o+Math.sin(s)*m,p=Pt[e.status]??i.blue,h=10+e.count/x*18,_=d.current.get(e.status)??0;g(t,c,u,h*2.5,p,.2+_*.15);let v=t.createRadialGradient(c,u-h*.2,0,c,u,h);v.addColorStop(0,f(p,.8+_*.2)),v.addColorStop(1,f(p,.4+_*.1)),t.beginPath(),t.arc(c,u,h,0,Math.PI*2),t.fillStyle=v,t.fill(),t.font=`bold `+l.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=f(i.t1,.9),t.fillText(e.status,c,u),S(y.current,e.status,c,u,h+6,{label:e.status,value:a?`${e.count} ${a}`:String(e.count),sublabel:`${Math.round((e.count??0)/(b||1)*100)}%`,color:p})});let s=d.current.get(`center`)??0;g(t,n,o,36,i.t2,.2+s*.15);let h=t.createRadialGradient(n,o-4,0,n,o,22);h.addColorStop(0,f(i.t2,.9)),h.addColorStop(1,f(i.t2,.5)),t.beginPath(),t.arc(n,o,22,0,Math.PI*2),t.fillStyle=h,t.fill(),t.font=u.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=f(i.t1,.9),t.fillText(r??``,n,o-4),t.font=`bold `+l.font,t.fillStyle=i.t1,t.fillText(String(b),n,o+8),S(y.current,`center`,n,o,28,{label:r??`Total`,value:a?`${b} ${a}`:String(b),color:i.t2}),v(t,q,J,e,.015),w=requestAnimationFrame(T)};return T(),()=>cancelAnimationFrame(w)},[C,r,a]),C.length===0?(0,n.jsx)(L,{width:q,height:J,"data-testid":o}):(0,n.jsxs)(`div`,{"data-testid":o,style:{position:`relative`,width:q,height:J},children:[(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":r??`EW status arc visualization`,style:{width:q,height:J,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...m,parentW:q,parentH:J})]})}var It=280,Y=96;function Lt({points:e=[],className:a,colors:o}){let s=(0,t.useRef)(null),c=(0,t.useRef)(new Map),l=(0,t.useRef)(0),u=(0,t.useMemo)(()=>e.filter(Array.isArray).map(([e,t])=>{let n=String(t).match(/-?\d+(\.\d+)?/);return{label:e,value:n?Number(n[0]):0}}),[e]),{mouseRef:d,hoveredRef:p,tooltip:m,hitZonesRef:_}=x(s,{width:It,height:Y});return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=h(e,It,Y);l.current=0;let n=o?.line??i.teal,r=o?.point??i.teal,a=o?.axisLine??i.bd,m,v=()=>{l.current++;let e=l.current;if(t.clearRect(0,0,It,Y),u.length<2){m=requestAnimationFrame(v);return}let o={left:12,right:12,top:16,bottom:20},s=It-o.left-o.right,h=Y-o.top-o.bottom,b=u.map(e=>e.value),x=Math.min(...b),C=Math.max(...b)-x||1,w=e=>o.left+e/(u.length-1)*s,T=e=>o.top+(1-(e-x)/C)*h,E=1-(1-Math.min(e/48,1))**3,D=Math.max(2,Math.floor(E*u.length));if(A(c.current,p.current),_.current=[],t.strokeStyle=f(a,.3),t.lineWidth=.5,t.setLineDash([]),t.beginPath(),t.moveTo(o.left,Y-o.bottom),t.lineTo(It-o.right,Y-o.bottom),t.stroke(),t.font=`9px 'JetBrains Mono', monospace`,t.fillStyle=f(i.t4,.9),t.textAlign=`center`,u.forEach((e,n)=>{t.fillText(e.label.replace(`Day `,`D`),w(n),Y-4)}),d.current.over&&p.current){let e=parseInt(p.current.split(`-`)[1]);isNaN(e)||y(t,w(e),o.top,o.top+h)}if(D>1){let e=t.createLinearGradient(0,o.top,0,o.top+h);e.addColorStop(0,f(n,.15)),e.addColorStop(1,f(n,0)),t.fillStyle=e,t.beginPath(),t.moveTo(w(0),o.top+h);for(let e=0;e<D;e++)t.lineTo(w(e),T(u[e].value));t.lineTo(w(D-1),o.top+h),t.closePath(),t.fill(),t.strokeStyle=f(n,.8),t.lineWidth=1.5,t.setLineDash([]),t.beginPath();for(let e=0;e<D;e++){let n=w(e),r=T(u[e].value);e===0?t.moveTo(n,r):t.lineTo(n,r)}t.stroke()}for(let e=0;e<D;e++){let n=w(e),a=T(u[e].value),o=`tp-${e}`,s=c.current.get(o)??0,l=e===u.length-1;S(_.current,o,n,a,10,{label:u[e].label,value:String(u[e].value),color:l?i.red:r}),s>0&&!l&&(g(t,n,a,12*s,r,.2*s),t.fillStyle=f(r,.8),t.beginPath(),t.arc(n,a,3+s*2,0,Math.PI*2),t.fill())}if(D>=u.length){let n=u.length-1,r=w(n),a=T(u[n].value),o=c.current.get(`tp-${n}`)??0,s=O(e,.05,5e-4),l=1+o*.5;t.shadowColor=f(i.red,.5),t.shadowBlur=(8+s*4)*l,t.fillStyle=i.red,t.beginPath(),t.arc(r,a,(3.5+s*1.5)*l,0,Math.PI*2),t.fill(),t.shadowBlur=0}m=requestAnimationFrame(v)};return v(),()=>cancelAnimationFrame(m)},[u,o]),(0,n.jsx)(r,{className:[`canvas-trend-frame`,a].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:It,height:Y},children:[(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`trend chart`,style:{width:It,height:Y,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...m,parentW:It,parentH:Y})]})})}function Rt(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(r+`…`).width>n;)r=r.slice(0,-1);return r+`…`}var X=680,zt=8,Z=6,Bt=8,Vt=Z*2+Bt,Ht=36,Ut=16,Wt=48;function Gt({items:e=[],labelA:r=`Implemented`,labelB:a=`Unimplemented`,unit:o=`variations`,"data-testid":s}){let c=(0,t.useRef)(null),p=(0,t.useRef)(new Map),m=(0,t.useRef)(0),[_,v]=(0,t.useState)(!1),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),S=(0,t.useMemo)(()=>_?y:y.slice(0,zt),[y,_]),w=Ut+Wt+S.length*(Vt+Ht)-Ht,{hoveredRef:E,tooltip:D,hitZonesRef:O}=x(c,{width:X,height:w});return(0,t.useEffect)(()=>{let e=c.current;if(!e)return;let t=h(e,X,w);m.current=0;let n=X-150-100,s=Math.max(...S.map(e=>e.implemented??0),...S.map(e=>e.unimplemented??0),1),_=S.length*(Vt+Ht)-Ht,v=Ut+(w-Ut-Wt-_)/2,y,b=()=>{m.current++;let e=m.current;t.clearRect(0,0,X,w);let c=T(Math.min(e/60,1));A(p.current,E.current),O.current=[],S.forEach((e,d)=>{let m=k(c,d,S.length,T),h=v+d*(Vt+Ht),_=h,y=h+Z+Bt,b=`${e.id}-impl`,x=`${e.id}-un`,w=p.current.get(b)??0,E=p.current.get(x)??0,D=(e.implemented??0)/s*n*m,A=(e.unimplemented??0)/s*n*m;if(t.font=l.font,t.fillStyle=w>0||E>0?i.t1:i.t2,t.textAlign=`right`,t.textBaseline=`middle`,t.fillText(Rt(t,e.abbreviation??e.name??``,134),142,h+Vt/2),t.textBaseline=`alphabetic`,C(O.current,b,0,h,150,Vt,{label:e.name??e.abbreviation??``,value:`${R((e.implemented??0)+(e.unimplemented??0))} total ${o}`,sublabel:`${r}: ${R(e.implemented??0)} · ${a}: ${R(e.unimplemented??0)}`,color:i.green}),D>0){w>0&&g(t,150+D/2,_+Z/2,D*.15,i.green,.18*w);let e=t.createLinearGradient(150,0,150+D,0);e.addColorStop(0,f(i.green,.7)),e.addColorStop(1,f(i.green,1)),t.fillStyle=e,t.beginPath(),t.roundRect(150,_,D,Z,Z/2),t.fill()}if(C(O.current,b,150,_,Math.max(D,1),Z,{label:e.name,value:R(e.implemented??0),color:i.green}),m>.4&&(t.globalAlpha=Math.min(1,(m-.4)/.4),t.font=u.font,t.fillStyle=i.t1,t.textAlign=`left`,t.textBaseline=`middle`,t.fillText(R(e.implemented??0),150+D+16,_+Z/2),t.globalAlpha=1,t.textBaseline=`alphabetic`),A>0){E>0&&g(t,150+A/2,y+Z/2,A*.15,i.amber,.18*E);let e=t.createLinearGradient(150,0,150+A,0);e.addColorStop(0,f(i.amber,.5)),e.addColorStop(1,f(i.amber,.9)),t.fillStyle=e,t.beginPath(),t.roundRect(150,y,A,Z,Z/2),t.fill()}C(O.current,x,150,y,Math.max(A,1),Z,{label:e.name,value:R(e.unimplemented??0),color:i.amber}),m>.4&&(t.globalAlpha=Math.min(1,(m-.4)/.4),t.font=u.font,t.fillStyle=i.t1,t.textAlign=`left`,t.textBaseline=`middle`,t.fillText(R(e.unimplemented??0),150+A+16,y+Z/2),t.globalAlpha=1,t.textBaseline=`alphabetic`)});let h=v+_+28;t.font=d.font,t.textBaseline=`middle`,t.textAlign=`left`;let x=t.measureText(r).width,D=t.measureText(a).width,j=18+x,M=18+D,N=(X-(j+24+M))/2,P=t.createLinearGradient(N,0,N+12,0);P.addColorStop(0,f(i.green,.7)),P.addColorStop(1,f(i.green,1)),t.fillStyle=P,t.beginPath(),t.rect(N,h-6,12,12),t.fill(),t.fillStyle=d.color,t.fillText(r,N+12+6,h);let F=N+j+24,I=t.createLinearGradient(F,0,F+12,0);I.addColorStop(0,f(i.amber,.5)),I.addColorStop(1,f(i.amber,.9)),t.fillStyle=I,t.beginPath(),t.rect(F,h-6,12,12),t.fill(),t.fillStyle=d.color,t.fillText(a,F+12+6,h),t.textBaseline=`alphabetic`,y=requestAnimationFrame(b)};return b(),()=>cancelAnimationFrame(y)},[S,w]),y.length===0?(0,n.jsx)(L,{width:X,height:160,"data-testid":s}):(0,n.jsxs)(`div`,{"data-testid":s,style:{width:X},children:[(0,n.jsxs)(`div`,{style:{position:`relative`,width:X,height:w},children:[(0,n.jsx)(`canvas`,{ref:c,role:`img`,"aria-label":`Implemented vs unimplemented variations per contractor — split bar`,style:{width:X,height:w,display:`block`}}),(0,n.jsx)(b,{...D,parentW:X,parentH:w})]}),y.length>zt&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:_,onToggle:()=>v(e=>!e)})})]})}var Kt=800,qt=360;function Jt({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),c=(0,t.useRef)(0),{hoveredRef:d,tooltip:p,hitZonesRef:m}=x(a,{width:Kt,height:qt});return(0,t.useEffect)(()=>{let t=a.current;if(!t)return;let n=h(t,Kt,qt);c.current=0;let r=e.reduce((e,t)=>e+(t.base??0),0),p=e.reduce((e,t)=>e+(t.variation??0),0),_=e.reduce((e,t)=>e+(t.total??0),0),v=qt-20-26,y=v-6*(e.length-1),b=20,x=e.map((e,t)=>{let n=Math.max(24,(e.total??0)/(_||1)*y),r={x:100-110/2,y:b,h:n,cy:b+n/2,c:e,color:s[t%s.length]};return b+=n+6,r}),S=y-14,T=Math.max(28,r/(_||1)*S),E=Math.max(18,p/(_||1)*S),D=20+(v-(T+E+14))/2,O={x:420-110/2,y:D,h:T,cy:D+T/2},j={x:420-110/2,y:D+T+14,h:E,cy:D+T+14+E/2},M={x:720-110/2,y:20,h:v,cy:20+v/2},N,P=()=>{c.current++;let t=c.current;n.clearRect(0,0,Kt,qt),n.letterSpacing=l.letterSpacing;let a=w(Math.min(t/80,1));if(A(o.current,d.current),m.current=[],e.forEach((t,i)=>{let s=x[i],c=k(a,i,e.length,w),l=o.current.get(t.id)??0;if(c<.01)return;let u=(t.base??0)/(t.total||1),d=(t.variation??0)/(t.total||1),f=s.h*u,m=s.h*d,h=s.y+f/2,g=s.y+f+m/2,_=Math.max(2,(t.base??0)/r*T),v=Math.max(2,(t.variation??0)/p*E),y=O.y+e.slice(0,i).reduce((e,t)=>e+(t.base??0)/r*T,0)+_/2,b=j.y+e.slice(0,i).reduce((e,t)=>e+(t.variation??0)/p*E,0)+v/2,S=l*.2+.18;Yt(n,s.x+110,h,420-110/2,y,_*c,s.color,S),Yt(n,s.x+110,g,420-110/2,b,v*c,s.color,S*.75)}),a>.3){let e=Math.min(1,(a-.3)/.7),t=M.y+r/_*v/2,o=M.y+v-p/_*v/2;Yt(n,475,O.cy,720-110/2,t,T*e,i.blue,.25*e),Yt(n,475,j.cy,720-110/2,o,E*e,i.amber,.22*e)}if([`Contractors`,`Components`,`Total`].forEach((e,t)=>{let r=[100,420,720][t];n.font=l.font,n.fillStyle=l.color,n.textAlign=`center`,n.fillText(e,r,qt-8)}),e.forEach((t,r)=>{let s=x[r],c=k(a,r,e.length,w),u=o.current.get(t.id)??0;C(m.current,t.id,s.x,s.y,110,s.h,{label:t.name,value:t.totalLabel??String(t.total??0),sublabel:`${t.baseLabel??String(t.base??0)} + ${t.variationLabel??String(t.variation??0)}`,color:s.color}),u>0&&g(n,s.x+110/2,s.cy,110*.6,s.color,.12*u),n.fillStyle=f(s.color,(.3+u*.15)*c),n.strokeStyle=f(s.color,(.55+u*.25)*c),n.lineWidth=1,n.beginPath(),n.roundRect(s.x,s.y,110*c,s.h,4),n.fill(),n.stroke(),c>.6&&s.h>=24&&(n.globalAlpha=Math.min(1,(c-.6)/.4),n.font=l.font,n.fillStyle=u>0?s.color:f(i.t2,.9),n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(t.abbreviation??t.name?.slice(0,6)??``,s.x+110/2,s.h>=36?s.cy-5:s.cy),s.h>=36&&(n.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=f(i.t3,.8),n.fillText(t.totalLabel??String(t.total??0),s.x+110/2,s.cy+7)),n.globalAlpha=1,n.textBaseline=`alphabetic`)}),a>.2){let e=Math.min(1,(a-.2)/.4);g(n,420,O.cy,30,i.blue,.1*e),n.fillStyle=f(i.blue,.3*e),n.strokeStyle=f(i.blue,.5*e),n.lineWidth=1,n.beginPath(),n.roundRect(O.x,O.y,110,O.h*e,4),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=l.font,n.fillStyle=i.blue,n.textAlign=`center`,n.fillText(`Base Value`,420,O.cy-6),n.font=u.font,n.fillStyle=u.color,n.fillText(R(r),420,O.cy+8),n.globalAlpha=1,n.textBaseline=`alphabetic`,g(n,420,j.cy,24,i.amber,.1*e),n.fillStyle=f(i.amber,.22*e),n.strokeStyle=f(i.amber,.4*e),n.beginPath(),n.roundRect(j.x,j.y,110,j.h*e,4),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=l.font,n.fillStyle=i.amber,n.textAlign=`center`,n.fillText(`Variations`,420,j.cy-4),n.font=u.font,n.fillStyle=u.color,n.fillText(R(p),420,j.cy+8),n.globalAlpha=1,n.textBaseline=`alphabetic`}if(a>.5){let e=Math.min(1,(a-.5)/.5);g(n,720,M.cy,44,i.blue,.2*e),n.fillStyle=f(i.blue,.25*e),n.strokeStyle=f(i.blue,.6*e),n.lineWidth=1.5,n.beginPath(),n.roundRect(M.x,M.y,110,M.h*e,6),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=l.font,n.fillStyle=i.t2,n.textAlign=`center`,n.fillText(`Total Commitment`,720,M.cy-12),n.font=u.font,n.fillStyle=i.blue,n.fillText(R(_),720,M.cy+6),n.globalAlpha=1,n.textBaseline=`alphabetic`}N=requestAnimationFrame(P)};return P(),()=>cancelAnimationFrame(N)},[e]),(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:Kt,height:qt},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Weekly report flow — base value and variations per contractor flowing to total commitment`,style:{width:Kt,height:qt,display:`block`}}),(0,n.jsx)(b,{...p,parentW:Kt,parentH:qt})]})}function Yt(e,t,n,r,i,a,o,s){let c=(t+r)/2;e.beginPath(),e.moveTo(t,n-a/2),e.bezierCurveTo(c,n-a/2,c,i-a/2,r,i-a/2),e.lineTo(r,i+a/2),e.bezierCurveTo(c,i+a/2,c,n+a/2,t,n+a/2),e.closePath(),e.fillStyle=f(o,s),e.fill()}var Xt=680,Zt=160,Qt={left:8,right:90,top:16,bottom:16},$t=150,en=4,tn=48,nn=8;function rn(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>0&&e.measureText(r+`…`).width>n;)r=r.slice(0,-1);return r+`…`}function an(e,t){let n=Math.abs(e),r=e<0?`-`:``;return n>=1e6?`${r}${t}${(n/1e6).toFixed(1)}M`:n>=1e3?`${r}${t}${(n/1e3).toFixed(1)}K`:`${r}${t}${n.toFixed(0)}`}function on({rows:e,valuePrefix:r=`$`,"data-testid":a}){let o=(0,t.useRef)(null),s=(0,t.useRef)(new Map),[c,d]=(0,t.useState)(!1),p=e.filter(e=>e!=null&&typeof e.value==`number`),m=c?p:p.slice(0,nn),h=m.length,_=Math.max(...p.map(e=>Math.abs(e.value)),1),v=Xt-Qt.left-$t-Qt.right,y=h*tn,S=Qt.top+Qt.bottom+y,{hoveredRef:w,tooltip:E,hitZonesRef:D}=x(o,{width:Xt,height:S});return ge(o,Xt,S,(e,t)=>{A(s.current,w.current),D.current=[],m.forEach((n,a)=>{let o=k(t,a,h,T),c=Qt.top+a*tn,d=c+(tn-en)/2,p=c+tn/2,m=Qt.left+$t,y=s.current.get(n.id)??0,b=Math.abs(n.value)/_*v*o,x=n.valueLabel??an(n.value,r);if(e.save(),e.font=l.font,e.fillStyle=y>0?i.cyan:l.color,e.textAlign=`right`,e.textBaseline=`middle`,e.fillText(rn(e,n.name,$t-16),m-8,p),C(D.current,n.id,0,c,m,tn,{label:n.name,value:x,color:i.cyan}),e.fillStyle=f(i.cyan,.1),e.beginPath(),e.roundRect(m,d,v,en,en/2),e.fill(),b>0){y>0&&g(e,m+b,d+en/2,b*.25,i.cyan,.14*y);let t=e.createLinearGradient(m,d,m+b,d);t.addColorStop(0,f(i.cyan,.2+y*.05)),t.addColorStop(.55,f(i.cyan,.55+y*.15)),t.addColorStop(1,f(i.cyan,.72+y*.18)),e.fillStyle=t,e.beginPath(),e.roundRect(m,d,b,en,en/2),e.fill()}y>0&&b>0&&(e.strokeStyle=f(i.cyan,.6*y),e.lineWidth=1,e.beginPath(),e.roundRect(m,d,b,en,en/2),e.stroke()),o>.35&&(e.globalAlpha=Math.min(1,(o-.35)/.4),e.font=u.font,e.fillStyle=y>0?i.cyan:u.color,e.textAlign=`right`,e.textBaseline=`middle`,e.fillText(x,Xt-8,p)),e.restore(),C(D.current,n.id,m,c,Math.max(b,1),tn,{label:n.name,value:x,color:i.cyan})})},!0,{easing:T}),p.length===0?(0,n.jsx)(L,{width:Xt,height:Zt,message:`No data available`,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,style:{width:Xt},children:[(0,n.jsxs)(`div`,{style:{position:`relative`},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Horizontal bar chart`,style:{width:Xt,height:S,display:`block`,borderRadius:8}}),(0,n.jsx)(b,{...E,parentW:Xt,parentH:S})]}),p.length>nn&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:c,onToggle:()=>d(e=>!e),"data-testid":a?`${a}-toggle`:void 0})})]})}function sn({config:e,className:t,colorOffset:r=0}){return e.type===`line`?(0,n.jsx)(ze,{rows:e.rows,className:t}):e.type===`area`?(0,n.jsx)(P,{rows:e.rows,className:t}):e.type===`bar`?(0,n.jsx)(ee,{rows:e.rows,className:t}):e.type===`pie`?(0,n.jsx)(Ze,{rows:e.rows,variant:`pie`,className:t}):e.type===`donut`?(0,n.jsx)(Ze,{rows:e.rows,variant:`donut`,className:t}):e.type===`sankey`?(0,n.jsx)(ct,{rows:e.rows,className:t}):e.type===`flow`?(0,n.jsx)(st,{selectedEntity:e.selectedEntity,className:t}):e.type===`trend`?(0,n.jsx)(Lt,{points:e.points,className:t}):e.type===`mini-bars`?(0,n.jsx)(He,{rows:e.rows,className:t}):e.type===`stacked-horizontal-bar-chart`?(0,n.jsx)(je,{data:e.data??{items:e.items??[]}}):e.type===`multi-metric-constellation-chart`?(0,n.jsx)(Ce,{items:e.items}):e.type===`progress-race-chart`?(0,n.jsx)(le,{items:e.items,colorOffset:r}):e.type===`hub-and-spoke-radial-chart`?(0,n.jsx)(Ft,{segments:e.segments,title:e.title,unitLabel:e.unitLabel}):e.type===`dot-matrix-chart`?(0,n.jsx)(Re,{items:e.items}):e.type===`ranked-card-leaderboard`?(0,n.jsx)(Le,{items:e.items}):e.type===`proportional-band-chart`?(0,n.jsx)(Mt,{severities:e.severities,colorOffset:r}):e.type===`radial-fan-tree-chart`?(0,n.jsx)(qe,{total:e.total,totalLabel:e.totalLabel,items:e.items,colorOffset:r}):e.type===`semi-circular-gauge-chart`?(0,n.jsx)(he,{confirmed:e.confirmed,total:e.total,label:e.label,colorOffset:r}):e.type===`segmented-split-bar-chart`?(0,n.jsx)(Gt,{items:e.items,labelA:e.labelA,labelB:e.labelB,unit:e.unit}):e.type===`balance-scale-chart`?(0,n.jsx)(dt,{left:e.left,right:e.right,leftTitle:e.leftTitle,rightTitle:e.rightTitle,unit:e.unit}):e.type===`area-line-chart`?(0,n.jsx)(mt,{points:e.points}):e.type===`trend-view`?(0,n.jsx)(Tt,{points:e.points,colorOffset:r}):e.type===`weekly-flow`?(0,n.jsx)(Jt,{items:e.items}):e.type===`horizontal-bar-chart`?(0,n.jsx)(on,{rows:e.rows,valuePrefix:e.valuePrefix}):(0,n.jsx)(`div`,{className:`viz-empty`,children:`Visualization unavailable`})}var cn=[];function ln(e){try{return JSON.parse(decodeURIComponent(e))}catch{return null}}function un(){for(;cn.length;){let e=cn.pop();e&&e.unmount()}}function dn(){un(),document.querySelectorAll(`[data-d3-viz]`).forEach(t=>{let r=t.dataset.d3Viz;if(!r)return;let i=ln(r);if(!i)return;let a=(0,e.createRoot)(t);cn.push(a),a.render((0,n.jsx)(sn,{config:i}))})}function fn(e){return encodeURIComponent(JSON.stringify(e))}function pn({rows:e=[],className:t,colors:r}){return(0,n.jsx)(Ze,{rows:e,variant:`donut`,className:t,colors:r})}var Q={bg:`transparent`,border:`transparent`,t1:i.t1,t2:i.t2,t3:i.t3,t4:i.t4,red:i.red,amber:i.amber,green:i.green},$=`'Satoshi Variable', 'DM Sans', sans-serif`,mn={color:`#F7F7F7`,fontFamily:$,fontSize:24,fontWeight:500,lineHeight:`32px`},hn={color:`#B3B5B6`,fontFamily:$,fontSize:18,fontWeight:400,lineHeight:`20px`};function gn({items:e=[]}){let t=e.filter(e=>e.value);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:20},children:t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,width:286,minHeight:129,padding:`20px 16px`,flexShrink:0,border:`1px solid rgba(255,255,255,0.20)`,background:`rgba(255,255,255,0.05)`,boxShadow:`3.42px 3.42px 3.42px 0px rgba(0,0,0,0.30)`,boxSizing:`border-box`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:24,flex:1,minWidth:0},children:[(0,n.jsx)(`div`,{style:{...mn,color:`#FFFFFF`},children:e.value}),(0,n.jsx)(`div`,{style:{...hn,color:`rgba(255,255,255,0.70)`},children:e.label})]}),e.icon&&(0,n.jsx)(`div`,{style:{width:60,height:60,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,n.jsx)(`img`,{src:e.icon,width:60,height:60,alt:``,style:{objectFit:`contain`}})})]},t))})}function _n({items:e=[]}){let t=e.filter(e=>e.name??e.value);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`10px 0px`,background:Q.bg,border:`1px solid ${Q.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t2,background:`transparent`,padding:`2px 8px`,borderRadius:4,fontFamily:$,flexShrink:0},children:e.name}),(0,n.jsx)(`span`,{style:{...mn,fontSize:18,color:Q.t1,minWidth:70,flexShrink:0},children:e.value}),(0,n.jsx)(`span`,{style:{...hn,flex:1},children:e.kpiLabel})]},t))})}function vn({items:e=[]}){let t=e.filter(e=>e.value);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:20},children:t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,width:286,minHeight:129,padding:`20px 16px`,flexShrink:0,border:`1px solid rgba(255,255,255,0.20)`,background:`rgba(255,255,255,0.05)`,boxShadow:`3.42px 3.42px 3.42px 0px rgba(0,0,0,0.30)`,boxSizing:`border-box`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:24,flex:1,minWidth:0},children:[(0,n.jsx)(`div`,{style:{...mn,color:`#FFFFFF`},children:e.value}),(0,n.jsx)(`div`,{style:{...hn,color:`rgba(255,255,255,0.70)`},children:e.label})]}),e.icon&&(0,n.jsx)(`div`,{style:{width:60,height:60,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,n.jsx)(`img`,{src:e.icon,width:60,height:60,alt:``,style:{objectFit:`contain`}})})]},t))})}var yn={red:Q.red,amber:Q.amber,green:Q.green};function bn({items:e=[]}){let t=e.filter(e=>e.text);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:t.map((e,t)=>(yn[e.severity],(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`10px 0px`,background:Q.bg,border:`1px solid ${Q.border}`},children:[(0,n.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:i.t2,flexShrink:0,marginTop:5}}),(0,n.jsx)(`span`,{style:{...hn,color:`#B3B5B6`},children:e.text})]},t)))})}function xn({min:e,max:t,unit:r,dots:a=[],chips:o=[]}){let s=a.filter(e=>e.name);if(s.length===0)return null;let c=t-e;return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{style:{position:`relative`,height:90,padding:`10px 0px`},children:[(0,n.jsx)(`div`,{style:{position:`absolute`,top:38,left:8,right:8,height:2,background:`rgba(255,255,255,0.08)`,borderRadius:1}}),(0,n.jsxs)(`div`,{style:{position:`absolute`,top:43,left:0,fontSize:16,color:Q.t4,fontFamily:$},children:[e,r]}),(0,n.jsxs)(`div`,{style:{position:`absolute`,top:43,right:0,fontSize:16,color:Q.t4,fontFamily:$},children:[t,r]}),s.map((t,a)=>{let o=(t.val-e)/c*100,s=t.color??i.blue,l=a%2==0;return(0,n.jsxs)(`div`,{style:{position:`absolute`,left:`${o}%`,top:0,transform:`translateX(-50%)`},children:[l&&(0,n.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:2},children:[(0,n.jsx)(`div`,{style:{fontSize:18,color:s,fontFamily:$,whiteSpace:`nowrap`},children:t.name}),(0,n.jsxs)(`div`,{style:{fontSize:18,fontWeight:500,color:s,fontFamily:$,whiteSpace:`nowrap`},children:[t.val,r]})]}),(0,n.jsx)(`div`,{style:{width:10,height:10,borderRadius:`50%`,background:s,boxShadow:`0 0 8px ${s}70`,margin:l?`0 auto`:`26px auto 0`}}),!l&&(0,n.jsxs)(`div`,{style:{textAlign:`center`,marginTop:4},children:[(0,n.jsx)(`div`,{style:{fontSize:18,color:s,fontFamily:$,whiteSpace:`nowrap`},children:t.name}),(0,n.jsxs)(`div`,{style:{fontSize:18,fontWeight:500,color:s,fontFamily:$,whiteSpace:`nowrap`},children:[t.val,r]})]})]},a)})]}),o&&o.length>0&&(0,n.jsx)(vn,{items:o})]})}function Sn({leftPct:e,leftLabel:t,leftValue:r,leftColor:a,rightPct:o,rightLabel:s,rightValue:c,rightColor:l,chips:u}){if(!t&&!s)return null;let d=a??i.blue,f=l??i.blue;return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{style:{display:`flex`,borderRadius:6,overflow:`hidden`,height:36,margin:`10px 0`},children:[(0,n.jsx)(`div`,{style:{width:`${e}%`,background:d+`38`,display:`flex`,alignItems:`center`,justifyContent:`flex-end`,paddingRight:12},children:(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t2,fontFamily:$},children:r})}),(0,n.jsx)(`div`,{style:{width:1,background:`rgba(255,255,255,0.12)`,flexShrink:0}}),(0,n.jsx)(`div`,{style:{width:`${o}%`,background:f+`2A`,display:`flex`,alignItems:`center`,paddingLeft:12},children:(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t2,fontFamily:$},children:c})})]}),(0,n.jsxs)(`div`,{style:{display:`flex`,marginBottom:u?4:0},children:[(0,n.jsx)(`div`,{style:{width:`${e}%`},children:(0,n.jsxs)(`span`,{style:{fontSize:18,color:d,fontFamily:$},children:[e,`% `,t]})}),(0,n.jsx)(`div`,{style:{width:`${o}%`,paddingLeft:10},children:(0,n.jsxs)(`span`,{style:{fontSize:18,color:f,fontFamily:$},children:[o,`% `,s]})})]}),u&&u.length>0&&(0,n.jsx)(vn,{items:u})]})}function Cn({pct:e,label:t,color:r,chips:a}){if(e==null&&!t)return null;let o=r??i.blue,s=2*Math.PI*30,c=s*(1-e/100);return(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:20},children:[(0,n.jsxs)(`div`,{style:{position:`relative`,flexShrink:0,width:80,height:80},children:[(0,n.jsxs)(`svg`,{width:80,height:80,style:{transform:`rotate(-90deg)`},children:[(0,n.jsx)(`circle`,{cx:40,cy:40,r:30,fill:`none`,stroke:`rgba(255,255,255,0.07)`,strokeWidth:8}),(0,n.jsx)(`circle`,{cx:40,cy:40,r:30,fill:`none`,stroke:o,strokeWidth:8,strokeDasharray:s,strokeDashoffset:c,strokeLinecap:`round`})]}),(0,n.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,textAlign:`center`},children:(0,n.jsxs)(`div`,{style:{fontSize:18,fontWeight:500,color:o,fontFamily:$},children:[e,`%`]})})]}),(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{style:{...hn,padding:`10px 0px`},children:t}),a&&(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:a.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,padding:`10px 10px`,background:Q.bg,border:`1px solid ${Q.border}`,borderRadius:5},children:[(0,n.jsx)(`span`,{style:{...mn,color:Q.t2},children:e.value}),(0,n.jsx)(`span`,{style:{...mn,color:Q.t2,fontWeight:400,userSelect:`none`},children:`|`}),(0,n.jsx)(`span`,{style:{...hn},children:e.label})]},t))})]})]})}function wn({items:e=[]}){let t=e.filter(e=>e.name??e.value);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 0px`,background:Q.bg,border:`1px solid ${Q.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t2,background:`transparent`,padding:`2px 7px`,borderRadius:4,fontFamily:$,flexShrink:0,minWidth:62,textAlign:`center`},children:e.name}),(0,n.jsx)(`div`,{style:{flex:1,height:4,background:`rgba(255,255,255,0.07)`,borderRadius:0,overflow:`hidden`},children:(0,n.jsx)(`div`,{style:{height:`100%`,width:`${e.pct}%`,background:e.color??i.purple,borderRadius:0,opacity:.75}})}),(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:400,color:Q.t2,fontFamily:$,flexShrink:0,minWidth:320,textAlign:`right`},children:[e.value,e.badge,e.sublabel].filter(Boolean).join(` `)})]},t))})}var Tn={red:Q.red,amber:Q.amber,green:Q.green};function En({items:e=[]}){let t=e.filter(e=>e.text);return t.length===0?null:(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:t.map((e,t)=>{let r=Tn[e.severity];return(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`9px 12px`,background:`transparent`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:r,background:r+`20`,padding:`2px 7px`,borderRadius:4,fontFamily:$,flexShrink:0},children:e.tag}),(0,n.jsx)(`span`,{style:{flex:1,...hn},children:e.text}),(0,n.jsx)(`span`,{style:{...hn,flexShrink:0,marginTop:1},children:e.date})]},t)})})}function Dn({columns:e=[],rows:t=[]}){return t.length===0?null:(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`0 0px 6px`,borderBottom:`1px solid ${Q.border}`},children:[(0,n.jsx)(`div`,{style:{minWidth:64}}),e.map((e,t)=>(0,n.jsx)(`div`,{style:{flex:1,fontSize:18,fontWeight:500,color:Q.t2,fontFamily:$,textTransform:`uppercase`,letterSpacing:.6},children:e},t))]}),t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 0px`,background:Q.bg,border:`1px solid ${Q.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:Q.t1,background:`transparent`,padding:`2px 8px`,borderRadius:4,fontFamily:$,flexShrink:0,minWidth:64,textAlign:`center`},children:e.label}),e.cells.map((e,t)=>(0,n.jsx)(`span`,{style:{flex:1,fontSize:18,fontWeight:500,color:Q.t2,fontFamily:$},children:e},t))]},t))]})}function On({block:e}){if(!e)return null;switch(e.type){case`stats`:return(0,n.jsx)(gn,{items:e.items});case`ranked`:return(0,n.jsx)(_n,{items:e.items});case`chips`:return(0,n.jsx)(vn,{items:e.items});case`badges`:return(0,n.jsx)(bn,{items:e.items});case`dot-strip`:return(0,n.jsx)(xn,{min:e.min,max:e.max,unit:e.unit,dots:e.dots,chips:e.chips});case`proportion`:return(0,n.jsx)(Sn,{leftPct:e.leftPct,leftLabel:e.leftLabel,leftValue:e.leftValue,leftColor:e.leftColor,rightPct:e.rightPct,rightLabel:e.rightLabel,rightValue:e.rightValue,rightColor:e.rightColor,chips:e.chips});case`ring`:return(0,n.jsx)(Cn,{pct:e.pct,label:e.label,color:e.color,chips:e.chips});case`scorecard-rows`:return(0,n.jsx)(wn,{items:e.items});case`flags-list`:return(0,n.jsx)(En,{items:e.items});case`comparison-rows`:return(0,n.jsx)(Dn,{columns:e.columns,rows:e.rows});default:return null}}var kn=`'Satoshi Variable', 'DM Sans', sans-serif`,An={color:`#C2C2C2`,fontFamily:kn,fontSize:18,fontWeight:400,lineHeight:1.65};function jn({text:e}){return(0,n.jsxs)(`div`,{style:{padding:`8px 0px`,border:`transparent`,borderRadius:5,background:`transparent`},children:[(0,n.jsx)(`span`,{style:{fontSize:18,fontWeight:500,color:i.t1,fontFamily:kn,lineHeight:1.65,marginRight:8},children:`Takeaway`}),(0,n.jsx)(`span`,{style:{...An},children:e})]})}exports.AreaChart=P,exports.BarChart=ee,exports.CHART_PALETTE=c,exports.ChartFrame=r,exports.DonutChart=pn,exports.GRAD=a,exports.KeyHighlights=On,exports.LineChart=ze,exports.MiniBars=He,exports.PALETTE=s,exports.PieChart=Ze,exports.ProcessSankey=st,exports.RankingSankey=ct,exports.SOLID=o,exports.SankeySvg=$e,exports.SeriesChart=N,exports.Takeaway=jn,exports.Trend=Tt,exports.TrendChart=Lt,exports.VisualizationRenderer=sn,exports.cleanupVisualizationMounts=un,exports.hydrateVisualizationMounts=dn,exports.serializeVisualizationConfig=fn;
package/dist/index.js CHANGED
@@ -527,47 +527,77 @@ function oe({ expanded: e, onToggle: t, labelExpanded: n = "View Less", labelCol
527
527
  });
528
528
  }
529
529
  //#endregion
530
+ //#region src/utils/numberFormat.ts
531
+ var se = [
532
+ {
533
+ value: 0xe8d4a51000,
534
+ suffix: "T",
535
+ divisor: 0xe8d4a51000
536
+ },
537
+ {
538
+ value: 1e9,
539
+ suffix: "B",
540
+ divisor: 1e9
541
+ },
542
+ {
543
+ value: 1e6,
544
+ suffix: "M",
545
+ divisor: 1e6
546
+ },
547
+ {
548
+ value: 1e3,
549
+ suffix: "K",
550
+ divisor: 1e3
551
+ }
552
+ ];
553
+ function z(e, t = 1) {
554
+ let n = Math.abs(e), r = e < 0 ? "-" : "";
555
+ for (let e of se) if (n >= e.value) return `${r}${(n / e.divisor).toFixed(t)}${e.suffix}`;
556
+ return `${r}${n.toFixed(0)}`;
557
+ }
558
+ //#endregion
530
559
  //#region src/components/progressRaceChart/ProgressRaceChart.tsx
531
- var z = 660, se = 6, ce = 30, le = 24, ue = 24, de = 8;
532
- function fe(e, t, n) {
560
+ var B = 660, ce = 6, le = 30, ue = 24, de = 24, fe = 8;
561
+ function pe(e, t, n) {
533
562
  if (e.measureText(t).width <= n) return t;
534
563
  let r = t;
535
564
  for (; r.length > 0 && e.measureText(r + "…").width > n;) r = r.slice(0, -1);
536
565
  return r + "…";
537
566
  }
538
- function pe({ items: e = [], colorOffset: t = 0, "data-testid": r }) {
539
- let l = a(null), d = a(0), f = a(/* @__PURE__ */ new Map()), [p, _] = o(!1), y = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), b = i(() => [...y].sort((e, t) => (t.percentage ?? 0) - (e.percentage ?? 0)), [y]), T = i(() => p ? b : b.slice(0, de), [b, p]), j = T.length, M = le + ue + j * se + Math.max(0, j - 1) * ce, { hoveredRef: N, tooltip: P, hitZonesRef: F } = D(l, {
540
- width: z,
567
+ function me({ items: e = [], colorOffset: t = 0, "data-testid": r }) {
568
+ let l = a(null), d = a(0), f = a(/* @__PURE__ */ new Map()), [p, _] = o(!1), y = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), b = i(() => [...y].sort((e, t) => (t.percentage ?? 0) - (e.percentage ?? 0)), [y]), T = i(() => p ? b : b.slice(0, fe), [b, p]), j = T.length, M = ue + de + j * ce + Math.max(0, j - 1) * le, { hoveredRef: N, tooltip: P, hitZonesRef: F } = D(l, {
569
+ width: B,
541
570
  height: M
542
571
  });
543
572
  return n(() => {
544
573
  let e = l.current;
545
574
  if (!e) return;
546
- let n = x(e, z, M);
575
+ let n = x(e, B, M);
547
576
  d.current = 0;
548
- let r = z - 150 - 80, i = m[t % m.length], a, o = () => {
577
+ let r = B - 150 - 100, i = m[t % m.length], a, o = () => {
549
578
  d.current++;
550
579
  let e = d.current;
551
- n.clearRect(0, 0, z, M), n.letterSpacing = h.letterSpacing, F.current = [], f.current.forEach((e, t) => {
580
+ n.clearRect(0, 0, B, M), n.letterSpacing = h.letterSpacing, F.current = [], f.current.forEach((e, t) => {
552
581
  let n = t === N.current ? 1 : 0, r = e + (n - e) * .12;
553
582
  Math.abs(r - n) < .005 ? n === 0 ? f.current.delete(t) : f.current.set(t, 1) : f.current.set(t, r);
554
- }), N.current && !f.current.has(N.current) && f.current.set(N.current, 0), C(n, z, M, e, 40, v(u.blue, .04)), T.forEach((t, a) => {
555
- let o = f.current.get(t.id) ?? 0, s = le + a * (se + ce), c = n.createLinearGradient(150, 0, 150 + r, 0);
556
- c.addColorStop(0, v(u.tealDark, .55 + o * .1)), c.addColorStop(1, v(u.tealDark, .22 + o * .08)), n.fillStyle = c, n.beginPath(), n.rect(150, s, r, se), n.fill();
557
- let l = (t.percentage ?? 0) / 100, d = 150 + r * Math.min(l, l * A(Math.min(1, e * .005)));
558
- if (d > 152) {
559
- let e = n.createLinearGradient(150, 0, d, 0);
560
- e.addColorStop(0, v(i, .55)), e.addColorStop(1, v(i, .9)), n.fillStyle = e, n.beginPath(), n.rect(150, s, d - 150, se), n.fill();
583
+ }), N.current && !f.current.has(N.current) && f.current.set(N.current, 0), C(n, B, M, e, 40, v(u.blue, .04));
584
+ let t = Math.max(...T.map((e) => e.total ?? 0), 1);
585
+ T.forEach((a, o) => {
586
+ let s = f.current.get(a.id) ?? 0, c = ue + o * (ce + le), l = n.createLinearGradient(150, 0, 150 + r, 0);
587
+ l.addColorStop(0, v(u.tealDark, .55 + s * .1)), l.addColorStop(1, v(u.tealDark, .22 + s * .08)), n.fillStyle = l, n.beginPath(), n.rect(150, c, r, ce), n.fill();
588
+ let d = (a.total ?? 0) / t, p = 150 + r * Math.min(d, d * A(Math.min(1, e * .005)));
589
+ if (p > 152) {
590
+ let e = n.createLinearGradient(150, 0, p, 0);
591
+ e.addColorStop(0, v(i, .55)), e.addColorStop(1, v(i, .9)), n.fillStyle = e, n.beginPath(), n.rect(150, c, p - 150, ce), n.fill();
561
592
  }
562
- o > 0 && S(n, d, s + se / 2, 12 * o, i, .35 * o);
563
- let p = {
564
- label: t.name,
565
- value: `${t.percentage ?? 0}%`,
566
- sublabel: t.totalLabel ?? (t.total == null ? void 0 : String(t.total)),
593
+ s > 0 && S(n, p, c + ce / 2, 12 * s, i, .35 * s);
594
+ let m = {
595
+ label: a.name,
596
+ sublabel: a.totalLabel ?? (a.total == null ? void 0 : z(a.total)),
567
597
  color: i
568
598
  };
569
- k(F.current, t.id, 0, s - ce / 2, 150 + r, se + ce, p), O(F.current, t.id, d, s + se / 2, 10, p), n.font = g.font, n.fillStyle = o > 0 ? v(i, 1) : v(u.t1, .85), n.textAlign = "left", n.textBaseline = "middle", n.fillText(`${t.percentage ?? 0}%`, 150 + r + 32, s + se / 2), n.font = h.font, n.fillStyle = o > 0 ? v(i, 1) : h.color, n.textAlign = "right", n.fillText(fe(n, t.name ?? t.abbreviation ?? "", 134), 142, s + se / 2);
570
- }), w(n, z, M, e, .015), a = requestAnimationFrame(o);
599
+ k(F.current, a.id, 0, c - le / 2, 150 + r, ce + le, m), O(F.current, a.id, p, c + ce / 2, 10, m), n.font = g.font, n.fillStyle = s > 0 ? v(i, 1) : v(u.t1, .85), n.textAlign = "left", n.textBaseline = "middle", n.fillText(z(a.total ?? 0), 150 + r + 12, c + ce / 2), n.font = h.font, n.fillStyle = s > 0 ? v(i, 1) : h.color, n.textAlign = "right", n.fillText(pe(n, a.name ?? a.abbreviation ?? "", 134), 142, c + ce / 2);
600
+ }), w(n, B, M, e, .015), a = requestAnimationFrame(o);
571
601
  };
572
602
  return o(), () => cancelAnimationFrame(a);
573
603
  }, [
@@ -575,12 +605,12 @@ function pe({ items: e = [], colorOffset: t = 0, "data-testid": r }) {
575
605
  M,
576
606
  t
577
607
  ]), b.length === 0 ? /* @__PURE__ */ s(R, {
578
- width: z,
608
+ width: B,
579
609
  height: 160,
580
610
  "data-testid": r
581
611
  }) : /* @__PURE__ */ c("div", {
582
612
  "data-testid": r,
583
- style: { width: z },
613
+ style: { width: B },
584
614
  children: [/* @__PURE__ */ c("div", {
585
615
  style: { position: "relative" },
586
616
  children: [/* @__PURE__ */ s("canvas", {
@@ -588,17 +618,17 @@ function pe({ items: e = [], colorOffset: t = 0, "data-testid": r }) {
588
618
  role: "img",
589
619
  "aria-label": "Commitment race — contractors ranked by commitment percentage",
590
620
  style: {
591
- width: z,
621
+ width: B,
592
622
  height: M,
593
623
  display: "block",
594
624
  borderRadius: 8
595
625
  }
596
626
  }), /* @__PURE__ */ s(E, {
597
627
  ...P,
598
- parentW: z,
628
+ parentW: B,
599
629
  parentH: M
600
630
  })]
601
- }), y.length > de && /* @__PURE__ */ s("div", {
631
+ }), y.length > fe && /* @__PURE__ */ s("div", {
602
632
  style: { marginTop: 8 },
603
633
  children: /* @__PURE__ */ s(oe, {
604
634
  expanded: p,
@@ -609,14 +639,14 @@ function pe({ items: e = [], colorOffset: t = 0, "data-testid": r }) {
609
639
  }
610
640
  //#endregion
611
641
  //#region src/components/semiCircularGaugeChart/SemiCircularGaugeChart.tsx
612
- var me = 480, he = 310, ge = 18, _e = [
642
+ var he = 480, ge = 310, _e = 18, ve = [
613
643
  "#00818F",
614
644
  "#5C42B8",
615
645
  "#C87B0A",
616
646
  "#2563EB",
617
647
  "#166534"
618
648
  ];
619
- function ve(e, t, n) {
649
+ function ye(e, t, n) {
620
650
  let r = t.split(" "), i = [], a = "";
621
651
  for (let t of r) {
622
652
  let r = a ? `${a} ${t}` : t;
@@ -624,17 +654,17 @@ function ve(e, t, n) {
624
654
  }
625
655
  return a && i.push(a), i;
626
656
  }
627
- function ye({ confirmed: e, total: t, label: r, colorOffset: i = 0, "data-testid": o }) {
657
+ function be({ confirmed: e, total: t, label: r, colorOffset: i = 0, "data-testid": o }) {
628
658
  let c = a(null), l = a(0);
629
659
  return n(() => {
630
660
  let n = c.current;
631
661
  if (!n) return;
632
- let a = x(n, me, he);
662
+ let a = x(n, he, ge);
633
663
  l.current = 0;
634
- let o = i % m.length, s = m[o], d = _e[o], f = me / 2, p = Math.PI, g = 2 * Math.PI, y = Math.PI, b, C = () => {
664
+ let o = i % m.length, s = m[o], d = ve[o], f = he / 2, p = Math.PI, g = 2 * Math.PI, y = Math.PI, b, C = () => {
635
665
  l.current++;
636
666
  let n = l.current;
637
- a.clearRect(0, 0, me, he), a.letterSpacing = h.letterSpacing;
667
+ a.clearRect(0, 0, he, ge), a.letterSpacing = h.letterSpacing;
638
668
  let i = A(Math.min(n / 80, 1)), o = N(Math.min(n / 72, 1)), c = Math.round((e ?? 0) / (t || 1) * 100), m = p + c / 100 * y * i;
639
669
  a.beginPath(), a.arc(f, 175, 148, p, g), a.strokeStyle = v(s, .28), a.lineWidth = 4, a.lineCap = "round", a.stroke(), a.lineCap = "butt", a.beginPath(), a.moveTo(f, 175), a.arc(f, 175, 133, p, m), a.closePath(), a.fillStyle = v(d, .35 * i), a.fill();
640
670
  let x = f + Math.cos(m) * 148, w = 175 + Math.sin(m) * 148;
@@ -649,8 +679,8 @@ function ye({ confirmed: e, total: t, label: r, colorOffset: i = 0, "data-testid
649
679
  ].forEach(([e, t]) => {
650
680
  let n = p + e * y, r = e === 1 ? 184 : 168, i = f + Math.cos(n) * r, o = 175 + Math.sin(n) * r;
651
681
  a.font = h.font, a.fillStyle = h.color, a.textAlign = "center", a.fillText(t, i, o + 4);
652
- }), i > .4 && (a.globalAlpha = Math.min(1, (i - .4) / .4), a.font = "700 32px 'Satoshi Variable', 'DM Sans', sans-serif", a.fillStyle = u.t1, a.textAlign = "center", a.fillText(`${Math.round(c * o)}%`, f, 247), a.globalAlpha = 1), i > .7 && r && (a.globalAlpha = Math.min(1, (i - .7) / .3), a.font = _.font, a.fillStyle = _.color, a.textAlign = "center", ve(a, `${e ?? 0} of ${t ?? 0} ${r}`, me - 40).forEach((e, t) => {
653
- a.fillText(e, f, 287 + t * ge);
682
+ }), i > .4 && (a.globalAlpha = Math.min(1, (i - .4) / .4), a.font = "700 32px 'Satoshi Variable', 'DM Sans', sans-serif", a.fillStyle = u.t1, a.textAlign = "center", a.fillText(`${Math.round(c * o)}%`, f, 247), a.globalAlpha = 1), i > .7 && r && (a.globalAlpha = Math.min(1, (i - .7) / .3), a.font = _.font, a.fillStyle = _.color, a.textAlign = "center", ye(a, `${z(e ?? 0)} of ${z(t ?? 0)} ${r}`, he - 40).forEach((e, t) => {
683
+ a.fillText(e, f, 287 + t * _e);
654
684
  }), a.globalAlpha = 1), b = requestAnimationFrame(C);
655
685
  };
656
686
  return C(), () => cancelAnimationFrame(b);
@@ -663,16 +693,16 @@ function ye({ confirmed: e, total: t, label: r, colorOffset: i = 0, "data-testid
663
693
  "data-testid": o,
664
694
  style: {
665
695
  position: "relative",
666
- width: me,
667
- height: he
696
+ width: he,
697
+ height: ge
668
698
  },
669
699
  children: /* @__PURE__ */ s("canvas", {
670
700
  ref: c,
671
701
  role: "img",
672
702
  "aria-label": `Compensation event gauge — ${Math.round((e ?? 0) / (t || 1) * 100)}% of NCEs confirmed as compensation events`,
673
703
  style: {
674
- width: me,
675
- height: he,
704
+ width: he,
705
+ height: ge,
676
706
  display: "block"
677
707
  }
678
708
  })
@@ -680,7 +710,7 @@ function ye({ confirmed: e, total: t, label: r, colorOffset: i = 0, "data-testid
680
710
  }
681
711
  //#endregion
682
712
  //#region src/canvas/useCanvasLoop.ts
683
- function be(e, t, r, i, o = !0, s = {}) {
713
+ function xe(e, t, r, i, o = !0, s = {}) {
684
714
  let c = a(0), { easing: l = A, durationFrames: u = 48 } = s;
685
715
  n(() => {
686
716
  let n = e.current;
@@ -712,28 +742,28 @@ function be(e, t, r, i, o = !0, s = {}) {
712
742
  }
713
743
  //#endregion
714
744
  //#region src/components/multiMetricConstellationChart/MultiMetricConstellationChart.tsx
715
- var B = 780, xe = 234, Se = 130, Ce = 52, we = [
745
+ var V = 780, Se = 234, Ce = 130, we = 52, Te = [
716
746
  u.blue,
717
747
  u.amber,
718
748
  u.purple,
719
749
  u.green
720
- ], Te = [
750
+ ], Ee = [
721
751
  "Base Value",
722
752
  "Variations",
723
753
  "Commitment"
724
- ], Ee = [
754
+ ], De = [
725
755
  "Base",
726
756
  "Var",
727
757
  "Commit"
728
758
  ];
729
- function De({ items: e = [], "data-testid": t }) {
759
+ function Oe({ items: e = [], "data-testid": t }) {
730
760
  let n = a(null), r = a(/* @__PURE__ */ new Map()), { hoveredRef: o, tooltip: l, hitZonesRef: d } = D(n, {
731
- width: B,
732
- height: xe
761
+ width: V,
762
+ height: Se
733
763
  }), f = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), p = i(() => {
734
764
  let e = Math.max(...f.map((e) => e.base ?? 0)), t = Math.max(...f.map((e) => e.variation ?? 0));
735
765
  return f.map((n, r) => {
736
- let i = B * (.12 + r * .19), a = Se, o = Math.min(B * .075, Ce), s = we[r % we.length], c = [
766
+ let i = V * (.12 + r * .19), a = Ce, o = Math.min(V * .075, we), s = Te[r % Te.length], c = [
737
767
  (n.base ?? 0) / (e || 1) * 100,
738
768
  (n.variation ?? 0) / (t || 1) * 100,
739
769
  n.percentage ?? 0
@@ -742,10 +772,10 @@ function De({ items: e = [], "data-testid": t }) {
742
772
  n.variationLabel ?? String(n.variation ?? 0),
743
773
  `${n.percentage ?? 0}%`
744
774
  ], u = c.map((e, t) => {
745
- let n = -Math.PI / 2 + t / Te.length * Math.PI * 2, r = e / 100, s = o * Math.max(.08, r);
775
+ let n = -Math.PI / 2 + t / Ee.length * Math.PI * 2, r = e / 100, s = o * Math.max(.08, r);
746
776
  return {
747
- name: Te[t],
748
- short: Ee[t],
777
+ name: Ee[t],
778
+ short: De[t],
749
779
  label: l[t],
750
780
  val: Math.round(e),
751
781
  x: i + Math.cos(n) * s,
@@ -765,8 +795,8 @@ function De({ items: e = [], "data-testid": t }) {
765
795
  };
766
796
  });
767
797
  }, [f]);
768
- return be(n, B, xe, (e, t, n) => {
769
- I(r.current, o.current), d.current = [], C(e, B, xe, n, 30), p.forEach((t, i) => {
798
+ return xe(n, V, Se, (e, t, n) => {
799
+ I(r.current, o.current), d.current = [], C(e, V, Se, n, 30), p.forEach((t, i) => {
770
800
  let a = t.color, o = `constellation-${i}`, s = r.current.get(o) ?? 0;
771
801
  e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 5, 0, Math.PI * 2), e.strokeStyle = v(u.bd, .08 + .08 * s), e.lineWidth = .5, e.stroke(), e.beginPath(), t.stars.forEach((t, n) => {
772
802
  n === 0 ? e.moveTo(t.x, t.y) : e.lineTo(t.x, t.y);
@@ -786,77 +816,77 @@ function De({ items: e = [], "data-testid": t }) {
786
816
  sublabel: `${t.percentage ?? 0}% committed · scatter ${t.scatter.toFixed(1)}`,
787
817
  color: a
788
818
  });
789
- }), e.font = _.font, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = _.color, e.fillText("▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details", B / 2, xe - 14), w(e, B, xe, n, .012);
819
+ }), e.font = _.font, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = _.color, e.fillText("▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details", V / 2, Se - 14), w(e, V, Se, n, .012);
790
820
  }, !0), p.length === 0 ? /* @__PURE__ */ s(R, {
791
- width: B,
792
- height: xe,
821
+ width: V,
822
+ height: Se,
793
823
  "data-testid": t
794
824
  }) : /* @__PURE__ */ c("div", {
795
825
  "data-testid": t,
796
826
  style: {
797
827
  position: "relative",
798
- width: B,
799
- height: xe
828
+ width: V,
829
+ height: Se
800
830
  },
801
831
  children: [/* @__PURE__ */ s("canvas", {
802
832
  ref: n,
803
833
  role: "img",
804
834
  "aria-label": "Contract value breakdown per contractor — multi-KPI constellation chart",
805
835
  style: {
806
- width: B,
807
- height: xe,
836
+ width: V,
837
+ height: Se,
808
838
  display: "block"
809
839
  }
810
840
  }), /* @__PURE__ */ s(E, {
811
841
  ...l,
812
- parentW: B,
813
- parentH: xe
842
+ parentW: V,
843
+ parentH: Se
814
844
  })]
815
845
  });
816
846
  }
817
847
  //#endregion
818
848
  //#region src/components/stackedHorizontalBarChart/StackedHorizontalBarChart.tsx
819
- var Oe = 680, ke = 220, Ae = 8, je = [u.teal], V = {
849
+ var ke = 680, Ae = 220, je = 8, Me = [u.teal], H = {
820
850
  left: 8,
821
851
  right: 100,
822
852
  top: 16,
823
853
  bottom: 38
824
- }, Me = 150, H = 6;
825
- function Ne(e, t, n) {
854
+ }, Ne = 150, U = 6;
855
+ function Pe(e, t, n) {
826
856
  if (e.measureText(t).width <= n) return t;
827
857
  let r = t;
828
858
  for (; r.length > 0 && e.measureText(r + "…").width > n;) r = r.slice(0, -1);
829
859
  return r + "…";
830
860
  }
831
- function Pe(e) {
861
+ function Fe(e) {
832
862
  let t = Math.abs(e), n = e < 0 ? "-" : "";
833
863
  return t >= 1e6 ? `${n}£${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${n}£${(t / 1e3).toFixed(1)}K` : `${n}£${t.toFixed(0)}`;
834
864
  }
835
- function Fe({ data: e, "data-testid": t }) {
836
- let n = a(null), r = a(/* @__PURE__ */ new Map()), [i, l] = o(!1), { items: d = [], totals: f } = e, p = d.filter((e) => typeof e == "object" && !!e), m = [...p].sort((e, t) => (t.total ?? 0) - (e.total ?? 0)), y = i ? m : m.slice(0, Ae), b = y.length, x = Math.max(...m.map((e) => Math.abs(e.total ?? 0)), 1), C = b * H + Math.max(0, b - 1) * 38, w = V.top + V.bottom + C, T = Oe - V.left - Me - V.right, O = p.length === 0, { hoveredRef: A, tooltip: M, hitZonesRef: N } = D(n, {
837
- width: Oe,
865
+ function Ie({ data: e, "data-testid": t }) {
866
+ let n = a(null), r = a(/* @__PURE__ */ new Map()), [i, l] = o(!1), { items: d = [], totals: f } = e, p = d.filter((e) => typeof e == "object" && !!e), m = [...p].sort((e, t) => (t.total ?? 0) - (e.total ?? 0)), y = i ? m : m.slice(0, je), b = y.length, x = Math.max(...m.map((e) => Math.abs(e.total ?? 0)), 1), C = b * U + Math.max(0, b - 1) * 38, w = H.top + H.bottom + C, T = ke - H.left - Ne - H.right, O = p.length === 0, { hoveredRef: A, tooltip: M, hitZonesRef: N } = D(n, {
867
+ width: ke,
838
868
  height: w
839
869
  });
840
- return be(n, Oe, w, (e, t) => {
870
+ return xe(n, ke, w, (e, t) => {
841
871
  I(r.current, A.current), N.current = [], y.forEach((n, i) => {
842
- let a = je[i % je.length], o = F(t, i, b, j), s = V.top + i * (H + 38), c = V.left + Me, l = r.current.get(n.id) ?? 0, d = Math.max(n.total ?? 0, 0) / x * T * o;
843
- if (e.font = h.font, e.fillStyle = l > 0 ? a : h.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(Ne(e, n.name ?? "", Me - 16), c - 8, s + H / 2), k(N.current, n.id, 0, s, c, H, {
872
+ let a = Me[i % Me.length], o = F(t, i, b, j), s = H.top + i * (U + 38), c = H.left + Ne, l = r.current.get(n.id) ?? 0, d = Math.max(n.total ?? 0, 0) / x * T * o;
873
+ if (e.font = h.font, e.fillStyle = l > 0 ? a : h.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(Pe(e, n.name ?? "", Ne - 16), c - 8, s + U / 2), k(N.current, n.id, 0, s, c, U, {
844
874
  label: n.name,
845
- value: `${n.totalLabel ?? Pe(n.total ?? 0)} total`,
846
- sublabel: `Base ${n.baseLabel ?? Pe(n.base ?? 0)} + Var ${n.variationLabel ?? Pe(n.variation ?? 0)}`,
875
+ value: `${n.totalLabel ?? Fe(n.total ?? 0)} total`,
876
+ sublabel: `Base ${n.baseLabel ?? Fe(n.base ?? 0)} + Var ${n.variationLabel ?? Fe(n.variation ?? 0)}`,
847
877
  color: a
848
878
  }), d > 0) {
849
- l > 0 && S(e, c + d / 2, s + H / 2, d * .15, u.teal, .12 * l);
879
+ l > 0 && S(e, c + d / 2, s + U / 2, d * .15, u.teal, .12 * l);
850
880
  let t = e.createLinearGradient(c, 0, c + d, 0);
851
- t.addColorStop(0, v(u.tealDark, .85)), t.addColorStop(1, v(u.teal, 1)), e.fillStyle = t, e.beginPath(), e.rect(c, s, d, H), e.fill();
881
+ t.addColorStop(0, v(u.tealDark, .85)), t.addColorStop(1, v(u.teal, 1)), e.fillStyle = t, e.beginPath(), e.rect(c, s, d, U), e.fill();
852
882
  }
853
883
  let f = T * o, p = c + d, m = f - d;
854
884
  if (m > 2) {
855
885
  let t = e.createLinearGradient(p, 0, c + f, 0);
856
- t.addColorStop(0, v(u.tealDark, .55)), t.addColorStop(1, v(u.tealDark, .22)), e.fillStyle = t, e.beginPath(), e.rect(p, s, m, H), e.fill();
886
+ t.addColorStop(0, v(u.tealDark, .55)), t.addColorStop(1, v(u.tealDark, .22)), e.fillStyle = t, e.beginPath(), e.rect(p, s, m, U), e.fill();
857
887
  }
858
888
  if (d > 4) {
859
- let t = c + d, n = s + H;
889
+ let t = c + d, n = s + U;
860
890
  e.strokeStyle = v(u.t4, .9 * o), e.lineWidth = 4, e.beginPath(), e.moveTo(t, s), e.lineTo(t, n), e.stroke();
861
891
  let r = n + 3, i = {
862
892
  x: t,
@@ -870,26 +900,26 @@ function Fe({ data: e, "data-testid": t }) {
870
900
  };
871
901
  e.fillStyle = v(u.t1, o), e.beginPath(), e.moveTo((i.x + a.x) / 2, (i.y + a.y) / 2), e.arcTo(a.x, a.y, l.x, l.y, 1), e.arcTo(l.x, l.y, i.x, i.y, 1), e.arcTo(i.x, i.y, a.x, a.y, 1), e.closePath(), e.fill();
872
902
  }
873
- o > .35 && (e.globalAlpha = Math.min(1, (o - .35) / .4), e.font = g.font, e.fillStyle = l > 0 ? a : g.color, e.textAlign = "left", e.textBaseline = "middle", e.fillText(n.totalLabel ?? Pe(n.total ?? 0), c + T + 28, s + H / 2), e.globalAlpha = 1), k(N.current, n.id, c, s, Math.max(d, 1), H, {
903
+ o > .35 && (e.globalAlpha = Math.min(1, (o - .35) / .4), e.font = g.font, e.fillStyle = l > 0 ? a : g.color, e.textAlign = "left", e.textBaseline = "middle", e.fillText(n.totalLabel ?? Fe(n.total ?? 0), c + T + 28, s + U / 2), e.globalAlpha = 1), k(N.current, n.id, c, s, Math.max(d, 1), U, {
874
904
  label: n.name,
875
- value: n.totalLabel ?? Pe(n.total ?? 0),
876
- sublabel: `${n.baseLabel ?? Pe(n.base ?? 0)} + ${n.variationLabel ?? Pe(n.variation ?? 0)}`,
905
+ value: n.totalLabel ?? Fe(n.total ?? 0),
906
+ sublabel: `${n.baseLabel ?? Fe(n.base ?? 0)} + ${n.variationLabel ?? Fe(n.variation ?? 0)}`,
877
907
  color: a
878
908
  });
879
909
  });
880
910
  let n = w - 14;
881
911
  e.textBaseline = "middle", e.font = _.font, e.textAlign = "left";
882
- let i = e.createLinearGradient(V.left + Me, 0, V.left + Me + 14, 0);
883
- i.addColorStop(0, v(u.tealDark, .85)), i.addColorStop(1, v(u.teal, 1)), e.fillStyle = i, e.beginPath(), e.rect(V.left + Me, n - 6, 12, 12), e.fill(), e.fillStyle = _.color, e.fillText("base value", V.left + Me + 16, n), e.fillStyle = v(u.teal, .35), e.beginPath(), e.rect(V.left + Me + 160, n - 6, 12, 12), e.fill(), e.fillStyle = _.color, e.fillText("approved variations", V.left + Me + 176, n), e.font = _.font, e.textAlign = "right", e.fillStyle = _.color, e.fillText(`Portfolio: ${Pe(f?.total ?? 0)}`, Oe - 8, n);
912
+ let i = e.createLinearGradient(H.left + Ne, 0, H.left + Ne + 14, 0);
913
+ i.addColorStop(0, v(u.tealDark, .85)), i.addColorStop(1, v(u.teal, 1)), e.fillStyle = i, e.beginPath(), e.rect(H.left + Ne, n - 6, 12, 12), e.fill(), e.fillStyle = _.color, e.fillText("base value", H.left + Ne + 16, n), e.fillStyle = v(u.teal, .35), e.beginPath(), e.rect(H.left + Ne + 160, n - 6, 12, 12), e.fill(), e.fillStyle = _.color, e.fillText("approved variations", H.left + Ne + 176, n), e.font = _.font, e.textAlign = "right", e.fillStyle = _.color, e.fillText(`Portfolio: ${Fe(f?.total ?? 0)}`, ke - 8, n);
884
914
  }, !0, { easing: j }), O ? /* @__PURE__ */ s(R, {
885
- width: Oe,
886
- height: ke,
915
+ width: ke,
916
+ height: Ae,
887
917
  message: "No contract data available",
888
918
  "data-testid": t
889
919
  }) : /* @__PURE__ */ c("div", {
890
920
  "data-testid": t,
891
921
  style: {
892
- width: Oe,
922
+ width: ke,
893
923
  transition: "all 0.25s ease"
894
924
  },
895
925
  children: [/* @__PURE__ */ c("div", {
@@ -899,17 +929,17 @@ function Fe({ data: e, "data-testid": t }) {
899
929
  role: "img",
900
930
  "aria-label": "Total contract value per contractor — horizontal bar chart",
901
931
  style: {
902
- width: Oe,
932
+ width: ke,
903
933
  height: w,
904
934
  display: "block",
905
935
  borderRadius: 8
906
936
  }
907
937
  }), /* @__PURE__ */ s(E, {
908
938
  ...M,
909
- parentW: Oe,
939
+ parentW: ke,
910
940
  parentH: w
911
941
  })]
912
- }), p.length > Ae && /* @__PURE__ */ s("div", {
942
+ }), p.length > je && /* @__PURE__ */ s("div", {
913
943
  style: { marginTop: 8 },
914
944
  children: /* @__PURE__ */ s(oe, {
915
945
  expanded: i,
@@ -919,35 +949,6 @@ function Fe({ data: e, "data-testid": t }) {
919
949
  });
920
950
  }
921
951
  //#endregion
922
- //#region src/utils/numberFormat.ts
923
- var Ie = [
924
- {
925
- value: 0xe8d4a51000,
926
- suffix: "T",
927
- divisor: 0xe8d4a51000
928
- },
929
- {
930
- value: 1e9,
931
- suffix: "B",
932
- divisor: 1e9
933
- },
934
- {
935
- value: 1e6,
936
- suffix: "M",
937
- divisor: 1e6
938
- },
939
- {
940
- value: 1e3,
941
- suffix: "K",
942
- divisor: 1e3
943
- }
944
- ];
945
- function U(e, t = 1) {
946
- let n = Math.abs(e), r = e < 0 ? "-" : "";
947
- for (let e of Ie) if (n >= e.value) return `${r}${(n / e.divisor).toFixed(t)}${e.suffix}`;
948
- return `${r}${n.toFixed(0)}`;
949
- }
950
- //#endregion
951
952
  //#region src/components/rankedCardLeaderboard/RankedCardLeaderboard.tsx
952
953
  var Le = 780, W = 240, Re = 12, ze = 10, Be = 5, Ve = (Le - 2 * Re - (Be - 1) * ze) / Be;
953
954
  function He({ items: e = [], "data-testid": t }) {
@@ -974,7 +975,7 @@ function He({ items: e = [], "data-testid": t }) {
974
975
  let O = r.abbreviation ?? r.name ?? "", A = w * 1.7, j = O;
975
976
  for (; t.measureText(j).width > A && j.length > 1;) j = j.slice(0, -1);
976
977
  j !== O && (j = j.slice(0, -1) + "…"), t.fillText(j, T, E);
977
- let M = r.count == null ? null : U(r.count), N = r.label ?? M;
978
+ let M = r.count == null ? null : z(r.count), N = r.label ?? M;
978
979
  if (N) {
979
980
  t.font = g.font, t.textBaseline = "alphabetic", t.fillStyle = v(d, .9 + h * .1);
980
981
  let e = b - 16, n = N;
@@ -1227,14 +1228,14 @@ function Qe({ total: e = 0, totalLabel: t, items: r = [], width: o = Je, colorOf
1227
1228
  if (w.addColorStop(0, v(f, m > 0 ? 1 : .8)), w.addColorStop(1, v(f, m > 0 ? 1 : .7)), r.strokeStyle = w, r.lineWidth = m > 0 ? 2 : 1.33, r.stroke(), o > .85) {
1228
1229
  let n = Math.min(1, (o - .85) / .15), i = 8 + (t.count ?? 0) / s * 14;
1229
1230
  S(r, l.x, l.y, i * 2, f, (.2 + m * .2) * n), r.beginPath(), r.arc(l.x, l.y, i * n, 0, Math.PI * 2), r.fillStyle = v(f, n), r.fill();
1230
- let a = U(t.count ?? 0);
1231
+ let a = z(t.count ?? 0);
1231
1232
  O(k.current, t.id, l.x, l.y, i + 8, {
1232
1233
  label: t.name,
1233
1234
  value: a,
1234
1235
  sublabel: `${Math.round((t.count ?? 0) / (e || 1) * 100)}% of total`,
1235
1236
  color: f
1236
1237
  }), r.globalAlpha = n, r.font = h.font, r.textAlign = "left";
1237
- let c = t.abbreviation ?? t.name?.slice(0, 6) ?? "", p = ` ${U(t.count ?? 0)}`, _ = l.y + 4;
1238
+ let c = t.abbreviation ?? t.name?.slice(0, 6) ?? "", p = ` ${z(t.count ?? 0)}`, _ = l.y + 4;
1238
1239
  r.fillStyle = m > 0 ? f : v(u.t2, .85), r.fillText(c, d, _);
1239
1240
  let y = r.measureText(c).width;
1240
1241
  r.font = g.font, r.fillStyle = m > 0 ? f : u.t1, r.fillText(p, d + y, _), r.globalAlpha = 1;
@@ -1243,7 +1244,7 @@ function Qe({ total: e = 0, totalLabel: t, items: r = [], width: o = Je, colorOf
1243
1244
  let j = 32 * c, M = r.createRadialGradient(88, i, 0, 88, i, j);
1244
1245
  if (M.addColorStop(0, v(f, .02 * c)), M.addColorStop(.55, v(f, .02 * c)), M.addColorStop(1, v(f, .15 * c)), r.beginPath(), r.arc(88, i, j, 0, Math.PI * 2), r.fillStyle = M, r.fill(), r.beginPath(), r.arc(88, i, j, 0, Math.PI * 2), r.strokeStyle = v(f, .8 * c), r.lineWidth = 1, r.stroke(), c > .4) {
1245
1246
  r.globalAlpha = Math.min(1, (c - .4) / .4);
1246
- let n = t ?? U(e, 0);
1247
+ let n = t ?? z(e, 0);
1247
1248
  r.font = "500 16px 'Satoshi Variable', 'DM Sans', sans-serif";
1248
1249
  let a = n;
1249
1250
  for (; r.measureText(a).width > 54.4 && a.length > 1;) a = a.slice(0, -1);
@@ -1251,7 +1252,7 @@ function Qe({ total: e = 0, totalLabel: t, items: r = [], width: o = Je, colorOf
1251
1252
  }
1252
1253
  O(k.current, "__root__", 88, i, 32, {
1253
1254
  label: t ?? "Total",
1254
- value: U(e, 0),
1255
+ value: z(e, 0),
1255
1256
  sublabel: `${y.length} items`,
1256
1257
  color: f
1257
1258
  }), E = requestAnimationFrame(D);
@@ -1952,7 +1953,7 @@ function At({ points: e = [], colorOffset: t = 0, "data-testid": r }) {
1952
1953
  ];
1953
1954
  e.forEach((t, n) => {
1954
1955
  let i = n / (e.length - 1), a = 42 + c - i * c;
1955
- r.font = h.font, r.fillStyle = h.color, r.textAlign = "right", r.fillText(U(t), xt - 6, a + 3);
1956
+ r.font = h.font, r.fillStyle = h.color, r.textAlign = "right", r.fillText(z(t), xt - 6, a + 3);
1956
1957
  }), r.save(), r.translate(12, 42 + c / 2), r.rotate(-Math.PI / 2), r.font = h.font, r.fillStyle = h.color, r.textAlign = "center", r.fillText("Count", 0, 0), r.restore();
1957
1958
  }
1958
1959
  let N = n.createLinearGradient(0, 42, 0, 42 + c);
@@ -2100,12 +2101,12 @@ function Lt({ severities: e = [], colorOffset: t = 0, "data-testid": r }) {
2100
2101
  }
2101
2102
  if (k(y.current, e.severity, a, 54, o, c, {
2102
2103
  label: e.severity,
2103
- value: U(e.count ?? 0),
2104
+ value: z(e.count ?? 0),
2104
2105
  sublabel: `${Math.round((e.count ?? 0) / (r || 1) * 100)}%`,
2105
2106
  color: S
2106
2107
  }), t > .5) {
2107
2108
  let i = Math.min(1, (t - .5) / .5), l = a + o / 2;
2108
- n.globalAlpha = i, n.font = h.font, n.fillStyle = s > 0 ? S : v(u.t1, .65), n.textAlign = "center", n.fillText(It(n, e.severity, o - 8), l, 40), n.font = "600 22px 'Satoshi Variable', 'DM Sans', sans-serif", n.fillStyle = v(u.t1, .92 + s * .08), n.fillText(U(e.count ?? 0), l, 54 + c / 2 + 8), n.font = h.font, n.fillStyle = s > 0 ? S : v(u.t1, .5), n.fillText(`${Math.round((e.count ?? 0) / (r || 1) * 100)}%`, l, 54 + c + 22), n.globalAlpha = 1;
2109
+ n.globalAlpha = i, n.font = h.font, n.fillStyle = s > 0 ? S : v(u.t1, .65), n.textAlign = "center", n.fillText(It(n, e.severity, o - 8), l, 40), n.font = "600 22px 'Satoshi Variable', 'DM Sans', sans-serif", n.fillStyle = v(u.t1, .92 + s * .08), n.fillText(z(e.count ?? 0), l, 54 + c / 2 + 8), n.font = h.font, n.fillStyle = s > 0 ? S : v(u.t1, .5), n.fillText(`${Math.round((e.count ?? 0) / (r || 1) * 100)}%`, l, 54 + c + 22), n.globalAlpha = 1;
2109
2110
  }
2110
2111
  a += o + Pt;
2111
2112
  }), C = requestAnimationFrame(w);
@@ -2343,8 +2344,8 @@ function Zt({ items: e = [], labelA: t = "Implemented", labelB: r = "Unimplement
2343
2344
  let c = F(f, o, w.length, j), d = s + o * (qt + Jt), m = d, _ = d + Z + Kt, y = `${e.id}-impl`, b = `${e.id}-un`, x = p.current.get(y) ?? 0, C = p.current.get(b) ?? 0, T = (e.implemented ?? 0) / a * i * c, E = (e.unimplemented ?? 0) / a * i * c;
2344
2345
  if (n.font = h.font, n.fillStyle = x > 0 || C > 0 ? u.t1 : u.t2, n.textAlign = "right", n.textBaseline = "middle", n.fillText(Ut(n, e.abbreviation ?? e.name ?? "", 134), 142, d + qt / 2), n.textBaseline = "alphabetic", k(M.current, y, 0, d, 150, qt, {
2345
2346
  label: e.name ?? e.abbreviation ?? "",
2346
- value: `${U((e.implemented ?? 0) + (e.unimplemented ?? 0))} total ${l}`,
2347
- sublabel: `${t}: ${U(e.implemented ?? 0)} · ${r}: ${U(e.unimplemented ?? 0)}`,
2347
+ value: `${z((e.implemented ?? 0) + (e.unimplemented ?? 0))} total ${l}`,
2348
+ sublabel: `${t}: ${z(e.implemented ?? 0)} · ${r}: ${z(e.unimplemented ?? 0)}`,
2348
2349
  color: u.green
2349
2350
  }), T > 0) {
2350
2351
  x > 0 && S(n, 150 + T / 2, m + Z / 2, T * .15, u.green, .18 * x);
@@ -2353,25 +2354,25 @@ function Zt({ items: e = [], labelA: t = "Implemented", labelB: r = "Unimplement
2353
2354
  }
2354
2355
  if (k(M.current, y, 150, m, Math.max(T, 1), Z, {
2355
2356
  label: e.name,
2356
- value: U(e.implemented ?? 0),
2357
+ value: z(e.implemented ?? 0),
2357
2358
  color: u.green
2358
- }), c > .4 && (n.globalAlpha = Math.min(1, (c - .4) / .4), n.font = g.font, n.fillStyle = u.t1, n.textAlign = "left", n.textBaseline = "middle", n.fillText(U(e.implemented ?? 0), 150 + T + 16, m + Z / 2), n.globalAlpha = 1, n.textBaseline = "alphabetic"), E > 0) {
2359
+ }), c > .4 && (n.globalAlpha = Math.min(1, (c - .4) / .4), n.font = g.font, n.fillStyle = u.t1, n.textAlign = "left", n.textBaseline = "middle", n.fillText(z(e.implemented ?? 0), 150 + T + 16, m + Z / 2), n.globalAlpha = 1, n.textBaseline = "alphabetic"), E > 0) {
2359
2360
  C > 0 && S(n, 150 + E / 2, _ + Z / 2, E * .15, u.amber, .18 * C);
2360
2361
  let e = n.createLinearGradient(150, 0, 150 + E, 0);
2361
2362
  e.addColorStop(0, v(u.amber, .5)), e.addColorStop(1, v(u.amber, .9)), n.fillStyle = e, n.beginPath(), n.roundRect(150, _, E, Z, Z / 2), n.fill();
2362
2363
  }
2363
2364
  k(M.current, b, 150, _, Math.max(E, 1), Z, {
2364
2365
  label: e.name,
2365
- value: U(e.unimplemented ?? 0),
2366
+ value: z(e.unimplemented ?? 0),
2366
2367
  color: u.amber
2367
- }), c > .4 && (n.globalAlpha = Math.min(1, (c - .4) / .4), n.font = g.font, n.fillStyle = u.t1, n.textAlign = "left", n.textBaseline = "middle", n.fillText(U(e.unimplemented ?? 0), 150 + E + 16, _ + Z / 2), n.globalAlpha = 1, n.textBaseline = "alphabetic");
2368
+ }), c > .4 && (n.globalAlpha = Math.min(1, (c - .4) / .4), n.font = g.font, n.fillStyle = u.t1, n.textAlign = "left", n.textBaseline = "middle", n.fillText(z(e.unimplemented ?? 0), 150 + E + 16, _ + Z / 2), n.globalAlpha = 1, n.textBaseline = "alphabetic");
2368
2369
  });
2369
- let y = s + o + 28, b = 150 + i / 2;
2370
- n.font = _.font, n.textBaseline = "middle";
2371
- let x = n.createLinearGradient(b - 120, 0, b - 120 + 12, 0);
2372
- x.addColorStop(0, v(u.green, .7)), x.addColorStop(1, v(u.green, 1)), n.fillStyle = x, n.beginPath(), n.rect(b - 120, y - 6, 12, 12), n.fill(), n.fillStyle = _.color, n.textAlign = "left", n.fillText(t, b - 120 + 12 + 6, y);
2373
- let C = n.createLinearGradient(b + 10, 0, b + 10 + 12, 0);
2374
- C.addColorStop(0, v(u.amber, .5)), C.addColorStop(1, v(u.amber, .9)), n.fillStyle = C, n.beginPath(), n.rect(b + 10, y - 6, 12, 12), n.fill(), n.fillStyle = _.color, n.fillText(r, b + 10 + 12 + 6, y), n.textBaseline = "alphabetic", c = requestAnimationFrame(d);
2370
+ let y = s + o + 28;
2371
+ n.font = _.font, n.textBaseline = "middle", n.textAlign = "left";
2372
+ let b = n.measureText(t).width, x = n.measureText(r).width, C = 18 + b, E = 18 + x, D = (Wt - (C + 24 + E)) / 2, A = n.createLinearGradient(D, 0, D + 12, 0);
2373
+ A.addColorStop(0, v(u.green, .7)), A.addColorStop(1, v(u.green, 1)), n.fillStyle = A, n.beginPath(), n.rect(D, y - 6, 12, 12), n.fill(), n.fillStyle = _.color, n.fillText(t, D + 12 + 6, y);
2374
+ let N = D + C + 24, P = n.createLinearGradient(N, 0, N + 12, 0);
2375
+ P.addColorStop(0, v(u.amber, .5)), P.addColorStop(1, v(u.amber, .9)), n.fillStyle = P, n.beginPath(), n.rect(N, y - 6, 12, 12), n.fill(), n.fillStyle = _.color, n.fillText(r, N + 12 + 6, y), n.textBaseline = "alphabetic", c = requestAnimationFrame(d);
2375
2376
  };
2376
2377
  return d(), () => cancelAnimationFrame(c);
2377
2378
  }, [w, T]), C.length === 0 ? /* @__PURE__ */ s(R, {
@@ -2483,11 +2484,11 @@ function en({ items: e = [], "data-testid": t }) {
2483
2484
  }), c > 0 && S(n, o.x + 110 / 2, o.cy, 110 * .6, o.color, .12 * c), n.fillStyle = v(o.color, (.3 + c * .15) * s), n.strokeStyle = v(o.color, (.55 + c * .25) * s), n.lineWidth = 1, n.beginPath(), n.roundRect(o.x, o.y, 110 * s, o.h, 4), n.fill(), n.stroke(), s > .6 && o.h >= 24 && (n.globalAlpha = Math.min(1, (s - .6) / .4), n.font = h.font, n.fillStyle = c > 0 ? o.color : v(u.t2, .9), n.textAlign = "center", n.textBaseline = "middle", n.fillText(t.abbreviation ?? t.name?.slice(0, 6) ?? "", o.x + 110 / 2, o.h >= 36 ? o.cy - 5 : o.cy), o.h >= 36 && (n.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", n.fillStyle = v(u.t3, .8), n.fillText(t.totalLabel ?? String(t.total ?? 0), o.x + 110 / 2, o.cy + 7)), n.globalAlpha = 1, n.textBaseline = "alphabetic");
2484
2485
  }), r > .2) {
2485
2486
  let e = Math.min(1, (r - .2) / .4);
2486
- S(n, 420, E.cy, 30, u.blue, .1 * e), n.fillStyle = v(u.blue, .3 * e), n.strokeStyle = v(u.blue, .5 * e), n.lineWidth = 1, n.beginPath(), n.roundRect(E.x, E.y, 110, E.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.blue, n.textAlign = "center", n.fillText("Base Value", 420, E.cy - 6), n.font = g.font, n.fillStyle = g.color, n.fillText(U(a), 420, E.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic", S(n, 420, D.cy, 24, u.amber, .1 * e), n.fillStyle = v(u.amber, .22 * e), n.strokeStyle = v(u.amber, .4 * e), n.beginPath(), n.roundRect(D.x, D.y, 110, D.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.amber, n.textAlign = "center", n.fillText("Variations", 420, D.cy - 4), n.font = g.font, n.fillStyle = g.color, n.fillText(U(s), 420, D.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2487
+ S(n, 420, E.cy, 30, u.blue, .1 * e), n.fillStyle = v(u.blue, .3 * e), n.strokeStyle = v(u.blue, .5 * e), n.lineWidth = 1, n.beginPath(), n.roundRect(E.x, E.y, 110, E.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.blue, n.textAlign = "center", n.fillText("Base Value", 420, E.cy - 6), n.font = g.font, n.fillStyle = g.color, n.fillText(z(a), 420, E.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic", S(n, 420, D.cy, 24, u.amber, .1 * e), n.fillStyle = v(u.amber, .22 * e), n.strokeStyle = v(u.amber, .4 * e), n.beginPath(), n.roundRect(D.x, D.y, 110, D.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.amber, n.textAlign = "center", n.fillText("Variations", 420, D.cy - 4), n.font = g.font, n.fillStyle = g.color, n.fillText(z(s), 420, D.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2487
2488
  }
2488
2489
  if (r > .5) {
2489
2490
  let e = Math.min(1, (r - .5) / .5);
2490
- S(n, 720, O.cy, 44, u.blue, .2 * e), n.fillStyle = v(u.blue, .25 * e), n.strokeStyle = v(u.blue, .6 * e), n.lineWidth = 1.5, n.beginPath(), n.roundRect(O.x, O.y, 110, O.h * e, 6), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.t2, n.textAlign = "center", n.fillText("Total Commitment", 720, O.cy - 12), n.font = g.font, n.fillStyle = u.blue, n.fillText(U(c), 720, O.cy + 6), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2491
+ S(n, 720, O.cy, 44, u.blue, .2 * e), n.fillStyle = v(u.blue, .25 * e), n.strokeStyle = v(u.blue, .6 * e), n.lineWidth = 1.5, n.beginPath(), n.roundRect(O.x, O.y, 110, O.h * e, 6), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.t2, n.textAlign = "center", n.fillText("Total Commitment", 720, O.cy - 12), n.font = g.font, n.fillStyle = u.blue, n.fillText(z(c), 720, O.cy + 6), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2491
2492
  }
2492
2493
  j = requestAnimationFrame(M);
2493
2494
  };
@@ -2542,7 +2543,7 @@ function fn({ rows: e, valuePrefix: t = "$", "data-testid": n }) {
2542
2543
  width: nn,
2543
2544
  height: x
2544
2545
  });
2545
- return be(r, nn, x, (e, n) => {
2546
+ return xe(r, nn, x, (e, n) => {
2546
2547
  I(i.current, C.current), T.current = [], p.forEach((r, a) => {
2547
2548
  let o = F(n, a, m, j), s = an.top + a * cn, c = s + (cn - sn) / 2, l = s + cn / 2, d = an.left + on, f = i.current.get(r.id) ?? 0, p = Math.abs(r.value) / _ * y * o, b = r.valueLabel ?? dn(r.value, t);
2548
2549
  if (e.save(), e.font = h.font, e.fillStyle = f > 0 ? u.cyan : h.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(un(e, r.name, on - 16), d - 8, l), k(T.current, r.id, 0, s, d, cn, {
@@ -2627,7 +2628,7 @@ function pn({ config: e, className: t, colorOffset: n = 0 }) {
2627
2628
  }) : e.type === "mini-bars" ? /* @__PURE__ */ s(qe, {
2628
2629
  rows: e.rows,
2629
2630
  className: t
2630
- }) : e.type === "stacked-horizontal-bar-chart" ? /* @__PURE__ */ s(Fe, { data: e.data ?? { items: e.items ?? [] } }) : e.type === "multi-metric-constellation-chart" ? /* @__PURE__ */ s(De, { items: e.items }) : e.type === "progress-race-chart" ? /* @__PURE__ */ s(pe, {
2631
+ }) : e.type === "stacked-horizontal-bar-chart" ? /* @__PURE__ */ s(Ie, { data: e.data ?? { items: e.items ?? [] } }) : e.type === "multi-metric-constellation-chart" ? /* @__PURE__ */ s(Oe, { items: e.items }) : e.type === "progress-race-chart" ? /* @__PURE__ */ s(me, {
2631
2632
  items: e.items,
2632
2633
  colorOffset: n
2633
2634
  }) : e.type === "hub-and-spoke-radial-chart" ? /* @__PURE__ */ s(Bt, {
@@ -2642,7 +2643,7 @@ function pn({ config: e, className: t, colorOffset: n = 0 }) {
2642
2643
  totalLabel: e.totalLabel,
2643
2644
  items: e.items,
2644
2645
  colorOffset: n
2645
- }) : e.type === "semi-circular-gauge-chart" ? /* @__PURE__ */ s(ye, {
2646
+ }) : e.type === "semi-circular-gauge-chart" ? /* @__PURE__ */ s(be, {
2646
2647
  confirmed: e.confirmed,
2647
2648
  total: e.total,
2648
2649
  label: e.label,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divami-artefacts/ai-design-system",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "module": "./dist/index.js",