@divami-artefacts/ai-design-system 1.0.10 → 1.0.11

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.
@@ -10,16 +10,16 @@ export declare const CC: {
10
10
  readonly blue: "#2970FF";
11
11
  readonly cyan: "#36BFFA";
12
12
  readonly orange: "#EF6820";
13
- readonly red: "#D92D20";
14
- readonly green: "#16B364";
13
+ readonly red: "#EF6820";
14
+ readonly green: "#71B941";
15
15
  readonly purple: "#7A5AF8";
16
16
  readonly amber: "#FAC515";
17
17
  readonly t1: "#F7F7F7";
18
- readonly t2: "#94979C";
18
+ readonly t2: "#C2C2C2";
19
19
  readonly t3: "#94979C";
20
20
  readonly t4: "#334155";
21
21
  };
22
- export declare const PALETTE: ("#2970FF" | "#36BFFA" | "#D92D20" | "#16B364" | "#7A5AF8" | "#FAC515")[];
22
+ export declare const PALETTE: ("#2970FF" | "#36BFFA" | "#EF6820" | "#71B941" | "#7A5AF8" | "#FAC515")[];
23
23
  /**
24
24
  * Axis label style — applied to all x-axis and y-axis tick labels, titles, and legends.
25
25
  * Change once here to update every chart.
@@ -30,8 +30,8 @@ export declare const PALETTE: ("#2970FF" | "#36BFFA" | "#D92D20" | "#16B364" | "
30
30
  * line-height: 18px (informational — not applicable in canvas ctx.font)
31
31
  */
32
32
  export declare const AXIS_LABEL: {
33
- readonly font: "400 12px 'Satoshi Variable', 'DM Sans', sans-serif";
34
- readonly color: "#94979C";
33
+ readonly font: "400 14px 'Satoshi Variable', 'DM Sans', sans-serif";
34
+ readonly color: "#C2C2C2";
35
35
  };
36
36
  /**
37
37
  * Legend label style — applied to all chart legend items (swatches, keys, footers).
@@ -44,8 +44,8 @@ export declare const AXIS_LABEL: {
44
44
  * text-align: center (set ctx.textAlign = 'center' at the draw call site)
45
45
  */
46
46
  export declare const LEGEND_LABEL: {
47
- readonly font: "400 12px 'Satoshi Variable', 'DM Sans', sans-serif";
48
- readonly color: "#94979C";
47
+ readonly font: "400 14px 'Satoshi Variable', 'DM Sans', sans-serif";
48
+ readonly color: "#C2C2C2";
49
49
  };
50
50
  /** Convert hex + alpha to rgba string */
51
51
  export declare function rgb(hex: string, alpha?: number): string;
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:`#2970FF`,cyan:`#36BFFA`,orange:`#EF6820`,red:`#D92D20`,green:`#16B364`,purple:`#7A5AF8`,amber:`#FAC515`,t1:`#F7F7F7`,t2:`#94979C`,t3:`#94979C`,t4:`#334155`},a=[i.blue,i.cyan,i.amber,i.purple,i.green,i.red],o={font:`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,color:i.t2},s={font:`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,color:i.t2};function c(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 l(e,t,n){return e+(t-e)*n}function u(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,u]=r(t),d=e=>Math.max(0,Math.min(255,Math.round(e)));return[d(l(i,s,n)),d(l(a,c,n)),d(l(o,u,n))].map(e=>e.toString(16).padStart(2,`0`)).join(``).replace(/^/,`#`)}function d(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 f(e,t,n,r,i,a=.3){let o=e.createRadialGradient(t,n,0,t,n,r);o.addColorStop(0,c(i,a)),o.addColorStop(1,c(i,0)),e.fillStyle=o,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill()}function p(e,t,n,r,a=50,o=c(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 m(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 h(e,t,n,r,a=c(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 g({visible:e,x:r,y:a,content:o,parentW:s}){let c=(0,t.useRef)(null);if((0,t.useLayoutEffect)(()=>{let t=c.current;if(!t)return;let n=t.offsetWidth,l=r-n/2,u=a-58;l<4&&(l=4),l+n>(s??400)-4&&(l=(s??400)-n-4),u<4&&(u=a+16),t.style.transform=`translate(${l}px, ${u}px)`,t.style.opacity=e?`1`:`0`;let d=o&&typeof o==`object`&&o.color?o.color:i.blue;t.style.setProperty(`--tooltip-accent`,d??i.blue)},[e,r,a,s,o]),!o)return null;let l=typeof o==`object`,u=l?o.label:null,d=l?o.value:o,f=l?o.sublabel:null;return(0,n.jsxs)(`div`,{ref:c,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:[u&&(0,n.jsx)(`div`,{style:{fontSize:12,fontWeight:400,color:i.t2,marginBottom:3,whiteSpace:`nowrap`,lineHeight:`18px`},children:u}),(0,n.jsx)(`div`,{style:{fontSize:14,fontWeight:500,color:i.t1,whiteSpace:`nowrap`,lineHeight:`20px`},children:d}),f&&(0,n.jsx)(`div`,{style:{fontSize:12,fontWeight:400,color:`var(--tooltip-accent)`,marginTop:3,whiteSpace:`nowrap`,lineHeight:`18px`},children:f})]})}function _(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=(0,t.useRef)(null),[u,d]=(0,t.useState)({visible:!1,x:0,y:0,content:null}),f=(0,t.useCallback)((e,t,n)=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{d({visible:!0,x:e,y:t,content:n})},30)},[]),p=(0,t.useCallback)(()=>{l.current&&clearTimeout(l.current),d(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 u=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,d=c.current;for(let e=d.length-1;e>=0;e--)if(d[e].test(o.current.x,o.current.y)){u=d[e];break}let m=s.current;s.current=u?u.id:null,t.style.cursor=u?`pointer`:`default`,u?f((e.clientX-i.left)*a,(e.clientY-i.top)*l,u.data):m&&p()},d=()=>{o.current={x:-1,y:-1,over:!1},s.current&&(s.current=null,t.style.cursor=`default`,p())},m=()=>{if(s.current&&i){let e=c.current.find(e=>e.id===s.current);e&&i(e.id,e.data)}};return t.addEventListener(`mousemove`,u),t.addEventListener(`mouseleave`,d),t.addEventListener(`click`,m),()=>{t.removeEventListener(`mousemove`,u),t.removeEventListener(`mouseleave`,d),t.removeEventListener(`click`,m),l.current&&clearTimeout(l.current)}},[e,n,r,a,i,f,p]),{mouseRef:o,hoveredRef:s,tooltip:u,showTooltip:f,hideTooltip:p,hitZonesRef:c}}function v(e,t,n,r,i,a){e.push({id:t,data:a,test:(e,t)=>(e-n)**2+(t-r)**2<=i*i})}function y(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 b=e=>1-(1-e)**3,x=e=>1-(1-e)**4,S=e=>e===1?1:1-2**(-10*e),C=e=>{let t=1.70158;return 1+(t+1)*(e-1)**3+t*(e-1)**2},w=(e,t=.04,n=.001)=>Math.sin(e*t)*Math.exp(-Math.min(e*n,4)),T=(e,t,n,r=b)=>{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 E(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 D=760,O=250;function k({rows:e=[],variant:a,className:o,colors:s}){let l=(0,t.useRef)(null),u=(0,t.useRef)(new Map),p=(0,t.useRef)(0),{mouseRef:m,hoveredRef:y,tooltip:b,hitZonesRef:x}=_(l,{width:D,height:O});return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=d(t,D,O);p.current=0;let r=s?.line??i.blue,o=s?.point??i.blue,g=s?.axisLine??i.bd,_=s?.areaFill??i.blue,b={top:24,right:24,bottom:44,left:24},C=D-b.left-b.right,T=O-b.top-b.bottom,k,A=()=>{p.current++;let t=p.current;if(n.clearRect(0,0,D,O),e.length<2){k=requestAnimationFrame(A);return}let s=e.map(e=>e.pricing??0),l=Math.max(100,...s),d=t=>b.left+t/(e.length-1)*C,j=e=>b.top+(1-e/l)*T,M=S(Math.min(t/48,1)),ee=Math.max(2,Math.floor(M*e.length));E(u.current,y.current),x.current=[],n.strokeStyle=c(i.bd,.2),n.lineWidth=.5;for(let e=0;e<=4;e++){let t=b.top+e/4*T;n.beginPath(),n.moveTo(b.left,t),n.lineTo(b.left+C,t),n.stroke()}if(n.strokeStyle=c(g,.4),n.lineWidth=1,n.setLineDash([]),n.beginPath(),n.moveTo(b.left,j(0)),n.lineTo(b.left+C,j(0)),n.stroke(),m.current.over&&y.current){let e=parseInt(y.current.split(`-`)[1]);isNaN(e)||h(n,d(e),b.top,b.top+T)}if(a===`area`&&ee>1){let t=n.createLinearGradient(0,b.top,0,b.top+T);t.addColorStop(0,c(_,.12)),t.addColorStop(1,c(_,0)),n.fillStyle=t,n.beginPath(),n.moveTo(d(0),b.top+T);for(let t=0;t<ee;t++)n.lineTo(d(t),j(e[t].pricing??0));n.lineTo(d(ee-1),b.top+T),n.closePath(),n.fill()}if(ee>1){n.strokeStyle=c(r,.85),n.lineWidth=2,n.setLineDash([]),n.beginPath();for(let t=0;t<ee;t++){let r=d(t),i=j(e[t].pricing??0);t===0?n.moveTo(r,i):n.lineTo(r,i)}n.stroke()}for(let r=0;r<ee;r++){let s=d(r),l=j(e[r].pricing??0),p=`sc-${r}`,m=u.current.get(p)??0,h=r===e.length-1;v(x.current,p,s,l,12,{label:e[r].vendor,value:String(e[r].pricing??0),color:h?i.red:o}),m>0&&f(n,s,l,16*m,o,.2*m);let g=h?w(t,.05,5e-4):0,_=a===`area`?5:6;h?(n.shadowColor=c(i.red,.5),n.shadowBlur=(8+g*4)*(1+m*.5),n.fillStyle=i.red,n.beginPath(),n.arc(s,l,(_+g*1.5)*(1+m*.3),0,Math.PI*2),n.fill(),n.shadowBlur=0):(n.fillStyle=c(o,.7+m*.3),n.beginPath(),n.arc(s,l,_+m*2,0,Math.PI*2),n.fill()),n.font=`10px 'JetBrains Mono', monospace`,n.fillStyle=c(i.t3,.6+m*.3),n.textAlign=`center`,n.fillText(e[r].vendor,s,O-14)}k=requestAnimationFrame(A)};return A(),()=>cancelAnimationFrame(k)},[e,a,s]),(0,n.jsx)(r,{className:o,children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:D,height:O},children:[(0,n.jsx)(`canvas`,{ref:l,role:`img`,"aria-label":`${a} chart`,style:{width:D,height:O,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...b,parentW:D,parentH:O})]})})}function A({rows:e=[],className:t,colors:r}){return(0,n.jsx)(k,{rows:e,variant:`area`,className:t,colors:r})}var j=760,M=280;function ee({rows:e=[],className:o,colors:s}){let l=(0,t.useRef)(null),u=(0,t.useRef)(new Map),p=(0,t.useRef)(0),{hoveredRef:m,tooltip:h,hitZonesRef:v}=_(l,{width:j,height:M});return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=d(t,j,M);p.current=0;let r=s?.bars??a,o=s?.axisLine??i.bd,h=s?.valueLabel??i.t2,g={top:24,right:24,bottom:56,left:24},_=M-g.top-g.bottom,b=(j-g.left-g.right)/Math.max(e.length,1),S=Math.max(100,...e.map(e=>e.pricing??0)),C=g.top+_,w,D=()=>{p.current++;let t=p.current;n.clearRect(0,0,j,M);let a=x(Math.min(t/48,1));E(u.current,m.current),v.current=[],n.strokeStyle=c(o,.4),n.lineWidth=1,n.setLineDash([]),n.beginPath(),n.moveTo(g.left,C),n.lineTo(j-g.right,C),n.stroke(),e.forEach((t,o)=>{let s=g.left+o*b,l=T(a,o,e.length,x),d=S>0?(t.pricing??0)/S*_:0,p=Math.max(d>0?4:0,d*l),m=r[o%r.length],w=u.current.get(t.id??`bar-${o}`)??0;y(v.current,t.id??`bar-${o}`,s+4,C-p,b-8,p,{label:t.vendor,value:String(t.pricing??0),color:m}),p>0&&(w>0&&f(n,s+b/2,C-p/2,b*.8,m,.12*w),n.shadowColor=c(m,.2*(w>0?w:0)),n.shadowBlur=w>0?6:0,n.fillStyle=c(m,.5+w*.25),n.beginPath(),n.roundRect(s+4,C-p,b-8,p,[4,4,0,0]),n.fill(),n.shadowBlur=0,w>0&&(n.strokeStyle=c(m,.4*w),n.lineWidth=1,n.beginPath(),n.roundRect(s+4,C-p,b-8,p,[4,4,0,0]),n.stroke())),l>.5&&p>0&&(n.globalAlpha=Math.min(1,(l-.5)*2),n.font=`bold 10px 'JetBrains Mono', monospace`,n.fillStyle=w>0?m:c(h,.7),n.textAlign=`center`,n.fillText(String(t.pricing??``),s+b/2,C-p-6),n.globalAlpha=1),n.font=`${w>0?`bold `:``}9px 'JetBrains Mono', monospace`,n.fillStyle=w>0?m:c(i.t3,.6),n.textAlign=`center`,n.fillText(t.vendor,s+b/2,M-14)}),w=requestAnimationFrame(D)};return D(),()=>cancelAnimationFrame(w)},[e,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:l,role:`img`,"aria-label":`bar chart`,style:{width:j,height:M,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...h,parentW:j,parentH:M})]})})}function N({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:`#FFAE43`,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 P=680,F=42,ne=10,re=24,ie=24,ae=8,oe=[i.green,i.blue,i.cyan,i.amber,i.red];function se(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 ce({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),s=(0,t.useRef)(0),l=(0,t.useRef)(new Map),[u,h]=(0,t.useState)(!1),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),x=(0,t.useMemo)(()=>[...y].sort((e,t)=>(t.percentage??0)-(e.percentage??0)),[y]),S=(0,t.useMemo)(()=>u?x:x.slice(0,ae),[x,u]),C=S.length,w=re+ie+C*F+Math.max(0,C-1)*ne,{hoveredRef:T,tooltip:E,hitZonesRef:D}=_(a,{width:P,height:w});return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,P,w);s.current=0;let n=P*.13,r=P*.08,u=P-n-r,h,g=()=>{s.current++;let e=s.current;t.clearRect(0,0,P,w),D.current=[],l.current.forEach((e,t)=>{let n=t===T.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?l.current.delete(t):l.current.set(t,1):l.current.set(t,r)}),T.current&&!l.current.has(T.current)&&l.current.set(T.current,0),p(t,P,w,e,40,c(i.blue,.04)),S.forEach((r,i)=>{let a=oe[i%oe.length],s=l.current.get(r.id)??0,d=re+i*(F+ne);t.fillStyle=c(a,.04+s*.04),t.beginPath(),t.roundRect(n,d,u,F,3),t.fill(),t.strokeStyle=c(a,.08),t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(n,d+F/2),t.lineTo(n+u,d+F/2),t.stroke(),t.setLineDash([]);let p=(r.percentage??0)/100,m=n+u*Math.min(p,p*b(Math.min(1,e*.005)));if(m>n+4){let e=t.createLinearGradient(n,0,m,0);e.addColorStop(0,c(a,.02)),e.addColorStop(1,c(a,.25+s*.15)),t.fillStyle=e,t.beginPath(),t.roundRect(n,d+2,m-n,F-4,2),t.fill()}f(t,m,d+F/2,18+s*8,a,.3+s*.2),t.beginPath(),t.arc(m,d+F/2,5+s*2,0,Math.PI*2),t.fillStyle=c(a,.9),t.fill();let h={label:r.name,value:`${r.percentage??0}% commitment`,sublabel:`Base: ${se(r.base??0)} · Variations: ${se(r.variation??0)}`,color:a};v(D.current,r.id,m,d+F/2,14,h),t.font=`bold `+o.font,t.fillStyle=c(a,.9+s*.1),t.textAlign=`left`,t.textBaseline=`middle`,t.fillText(`${r.percentage??0}%`,m+10,d+F/2),t.font=`${s>0?`bold `:``}`+o.font,t.fillStyle=s>0?a:o.color,t.textAlign=`right`,t.fillText(r.abbreviation??r.name.slice(0,6),n-8,d+F/2)}),t.strokeStyle=c(i.t3,.3),t.lineWidth=1,t.setLineDash([]),t.beginPath(),t.moveTo(n+u,re),t.lineTo(n+u,re+(C-1)*(F+ne)+F),t.stroke(),m(t,P,w,e,.015),h=requestAnimationFrame(g)};return g(),()=>cancelAnimationFrame(h)},[S,w]),x.length===0?(0,n.jsx)(N,{width:P,height:160,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{width:P},children:[(0,n.jsxs)(`div`,{style:{position:`relative`},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Commitment race — contractors ranked by commitment percentage`,style:{width:P,height:w,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...E,parentW:P,parentH:w})]}),y.length>ae&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:u,onToggle:()=>h(e=>!e)})})]})}var le=480,ue=340;function de({value:e,confirmed:r,total:a,"data-testid":s}){let l=(0,t.useRef)(null),u=(0,t.useRef)(0);return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=d(t,le,ue);u.current=0;let s=le/2,p=Math.PI,m=2*Math.PI,h=Math.PI,g,_=()=>{u.current++;let t=u.current;n.clearRect(0,0,le,ue);let l=b(Math.min(t/80,1)),d=C(Math.min(t/72,1));n.beginPath(),n.arc(s,220,120,p,m),n.strokeStyle=c(i.bd,.35),n.lineWidth=46,n.stroke(),[{start:0,end:.33,color:i.red},{start:.33,end:.66,color:i.amber},{start:.66,end:1,color:i.green}].forEach(e=>{let t=p+e.start*h,r=p+e.end*h;n.beginPath(),n.arc(s,220,194/2,t,r),n.strokeStyle=c(e.color,.12),n.lineWidth=42,n.stroke()}),[{label:`Low`,angle:p+.16*h},{label:`Mid`,angle:p+.5*h},{label:`High`,angle:p+.84*h}].forEach(({label:e,angle:t})=>{let r=s+Math.cos(t)*166,a=220+Math.sin(t)*166;n.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=c(i.t3,.55),n.textAlign=`center`,n.fillText(e,r,a+3)});let v=p+e/100*h*l,y=e>=66?i.green:e>=33?i.amber:i.red;f(n,s+Math.cos(v)*194/2,220+Math.sin(v)*194/2,18,y,.35*l),n.beginPath(),n.arc(s,220,194/2,p,v),n.strokeStyle=c(y,.7*l),n.lineWidth=38,n.lineCap=`round`,n.stroke(),n.lineCap=`butt`;let x=p+e/100*h*d,S=s+Math.cos(x)*82,w=220+Math.sin(x)*82,T=s-Math.cos(x)*14,E=220-Math.sin(x)*14;n.strokeStyle=c(y,.18*d),n.lineWidth=6,n.lineCap=`round`,n.beginPath(),n.moveTo(T,E),n.lineTo(S,w),n.stroke(),n.strokeStyle=c(i.t1,.92*d),n.lineWidth=2,n.lineCap=`round`,n.beginPath(),n.moveTo(T,E),n.lineTo(S,w),n.stroke(),n.beginPath(),n.arc(S,w,3,0,Math.PI*2),n.fillStyle=c(y,.9*d),n.fill(),f(n,s,220,20,y,.25*d),n.beginPath(),n.arc(s,220,9,0,Math.PI*2),n.strokeStyle=c(y,.5*d),n.lineWidth=1.5,n.stroke(),n.beginPath(),n.arc(s,220,5,0,Math.PI*2),n.fillStyle=i.t1,n.fill(),l>.5&&(n.globalAlpha=Math.min(1,(l-.5)/.5),n.font=`500 24px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=y,n.textAlign=`center`,n.fillText(`${Math.round(e*d)}%`,s,182),n.globalAlpha=1),l>.7&&(n.globalAlpha=Math.min(1,(l-.7)/.3),n.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=o.color,n.textAlign=`center`,n.fillText(`NCEs confirmed`,s,252),n.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=o.color,n.fillText(`${r} of ${a} NCEs are confirmed compensation events`,s,272),n.globalAlpha=1);for(let e=0;e<=10;e++){let t=p+e/10*h;if(n.strokeStyle=c(i.bd,.5),n.lineWidth=e%5==0?1.5:.8,n.beginPath(),n.moveTo(s+Math.cos(t)*122,220+Math.sin(t)*122),n.lineTo(s+Math.cos(t)*128,220+Math.sin(t)*128),n.stroke(),e%5==0){let r=s+Math.cos(t)*138,a=220+Math.sin(t)*138;n.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=c(i.t3,.45),n.textAlign=`center`,n.fillText(`${e*10}%`,r,a+3)}}g=requestAnimationFrame(_)};return _(),()=>cancelAnimationFrame(g)},[e,r,a]),(0,n.jsx)(`div`,{"data-testid":s,style:{position:`relative`,width:le,height:ue},children:(0,n.jsx)(`canvas`,{ref:l,role:`img`,"aria-label":`Compensation event gauge — ${e}% of NCEs confirmed as compensation events`,style:{width:le,height:ue,display:`block`}})})}function fe(e,n,r,i,a=!0,o={}){let s=(0,t.useRef)(0),{easing:c=b,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 I=780,L=234,pe=130,me=52,he=[i.blue,i.cyan,i.amber,i.purple,i.green],ge=[`Base Value`,`Variations`,`Commitment`],_e=[`Base`,`Var`,`Commit`];function ve({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),{hoveredRef:s,tooltip:l,hitZonesRef:u}=_(a,{width:I,height:L}),d=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),h=(0,t.useMemo)(()=>{let e=Math.max(...d.map(e=>e.base??0)),t=Math.max(...d.map(e=>e.variation??0));return d.map((n,r)=>{let i=I*(.12+r*.19),a=pe,o=Math.min(I*.075,me),s=he[r%he.length],c=[(n.base??0)/(e||1)*100,(n.variation??0)/(t||1)*100,n.percentage??0],l=[`£${n.base??0}M`,`£${n.variation??0}M`,`${n.percentage??0}%`],u=c.map((e,t)=>{let n=-Math.PI/2+t/ge.length*Math.PI*2,r=e/100,s=o*Math.max(.08,r);return{name:ge[t],short:_e[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}})},[d]);return fe(a,I,L,(e,t,n)=>{E(o.current,s.current),u.current=[],p(e,I,L,n,30),h.forEach((t,r)=>{let a=t.color,s=`constellation-${r}`,l=o.current.get(s)??0;e.beginPath(),e.arc(t.cx,t.cy,t.baseR+5,0,Math.PI*2),e.strokeStyle=c(i.bd,.08+.08*l),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=c(a,.04+.03*l),e.fill(),e.strokeStyle=c(a,.15+.1*l),e.lineWidth=.8,e.stroke(),t.stars.forEach((i,s)=>{let l=w(n,.05,5e-4)*.3+.7,d=3.5*l,f=`star-${r}-${s}`,p=o.current.get(f)??0,m=e.createRadialGradient(i.x,i.y,0,i.x,i.y,d*4);m.addColorStop(0,c(a,(.2+.1*p)*l)),m.addColorStop(1,c(a,0)),e.fillStyle=m,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+p*2,0,Math.PI*2),e.fillStyle=c(a,(.8+.2*p)*l),e.fill();let h=Math.sin(i.angle)<-.3;e.textAlign=`center`,e.textBaseline=`middle`,h?(e.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=c(a,.5+.15*p),e.fillText(i.short,i.x,i.y-24),e.font=`500 12px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=c(a,.8+.15*p),e.fillText(i.label,i.x,i.y-11)):(e.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=c(a,.5+.15*p),e.fillText(i.short,i.x,i.y+11),e.font=`500 12px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=c(a,.8+.15*p),e.fillText(i.label,i.x,i.y+24)),v(u.current,f,i.x,i.y,d*4+2,{label:i.name,value:i.label,sublabel:t.abbreviation??t.name.slice(0,6),color:a})}),l>0&&f(e,t.cx,t.cy,16*l,a,.15*l),e.beginPath(),e.arc(t.cx,t.cy,t.baseR+12,0,Math.PI*2),e.strokeStyle=c(a,.1+w(n,.03,5e-4)*.05),e.lineWidth=1,e.stroke(),e.font=`500 12px 'Satoshi Variable', 'DM Sans', sans-serif`,e.textAlign=`center`,e.textBaseline=`alphabetic`,e.fillStyle=c(i.t2,.65+l*.25),e.fillText(t.abbreviation??t.name.slice(0,6),t.cx,t.cy+t.baseR+26),v(u.current,s,t.cx,t.cy,t.baseR+5,{label:t.name,value:`£${t.total??0}M total`,sublabel:`${t.percentage??0}% committed · scatter ${t.scatter.toFixed(1)}`,color:a})}),e.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillStyle=i.t2,e.fillText(`▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details`,I/2,L-14),m(e,I,L,n,.012)},!0),h.length===0?(0,n.jsx)(N,{width:I,height:L,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:I,height:L},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Contract value breakdown per contractor — multi-KPI constellation chart`,style:{width:I,height:L,display:`block`}}),(0,n.jsx)(g,{...l,parentW:I,parentH:L})]})}var ye=680,be=220,xe=8,Se=[i.blue,i.cyan,i.amber,i.purple,i.green],R={left:8,right:80,top:16,bottom:38},Ce=88,z=18;function we(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 Te({data:e,"data-testid":r}){let a=(0,t.useRef)(null),l=(0,t.useRef)(new Map),[u,d]=(0,t.useState)(!1),{items:p=[],totals:m}=e,h=p.filter(e=>typeof e==`object`&&!!e),v=[...h].sort((e,t)=>(t.total??0)-(e.total??0)),b=u?v:v.slice(0,xe),S=b.length,C=Math.max(...v.map(e=>Math.abs(e.total??0)),1),w=Math.max(be,R.top+R.bottom+S*z+Math.max(0,S-1)*8),D=ye-R.left-Ce-R.right,O=S>1?(w-R.top-R.bottom-S*z)/(S-1):0,k=h.length===0,{hoveredRef:A,tooltip:j,hitZonesRef:M}=_(a,{width:ye,height:w});return fe(a,ye,w,(e,t)=>{E(l.current,A.current),M.current=[],b.forEach((n,r)=>{let a=Se[r%Se.length],s=T(t,r,S,x),u=R.top+r*(z+O),d=R.left+Ce,p=l.current.get(n.id)??0,m=Math.max(n.base??0,0),h=Math.max(n.total??0,0),g=m/C*D*s,_=h/C*D*s,v=_-g;e.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=p>0?a:o.color,e.textAlign=`right`,e.textBaseline=`middle`,e.fillText(n.abbreviation??n.name.slice(0,6),d-8,u+z/2),e.fillStyle=c(i.bd,.25),e.beginPath(),e.roundRect(d,u,D,z,4),e.fill(),g>0&&(p>0&&f(e,d+g/2,u+z/2,g*.3,a,.1*p),e.fillStyle=c(a,.5+p*.15),e.beginPath(),e.roundRect(d,u,g,z,4),e.fill()),v>2&&(e.fillStyle=c(a,.22+p*.08),e.beginPath(),e.roundRect(d+g,u,v,z,[0,4,4,0]),e.fill(),e.setLineDash([2,3]),e.strokeStyle=c(a,.55),e.lineWidth=1,e.beginPath(),e.moveTo(d+g,u+3),e.lineTo(d+g,u+z-3),e.stroke(),e.setLineDash([])),p>0&&_>0&&(e.strokeStyle=c(a,.5*p),e.lineWidth=1,e.setLineDash([]),e.beginPath(),e.roundRect(d,u,_,z,4),e.stroke()),s>.35&&(e.globalAlpha=Math.min(1,(s-.35)/.4),e.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=p>0?a:i.t1,e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(we(n.total??0),d+_+6,u+z/2),e.globalAlpha=1),y(M.current,n.id,d,u,Math.max(_,1),z,{label:n.name,value:`${we(n.total??0)} total`,sublabel:`Base ${we(n.base??0)} + Var ${we(n.variation??0)} · ${n.percentage??0}% committed`,color:a})});let n=w-14;e.textBaseline=`middle`,e.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,e.textAlign=`left`,e.fillStyle=c(i.cyan,.5),e.beginPath(),e.roundRect(R.left+Ce,n-3,14,6,2),e.fill(),e.fillStyle=s.color,e.fillText(`base value`,R.left+Ce+18,n),e.fillStyle=c(i.cyan,.22),e.beginPath(),e.roundRect(R.left+Ce+94,n-3,14,6,2),e.fill(),e.setLineDash([2,3]),e.strokeStyle=c(i.cyan,.5),e.lineWidth=.5,e.beginPath(),e.moveTo(R.left+Ce+101,n-3),e.lineTo(R.left+Ce+101,n+3),e.stroke(),e.setLineDash([]),e.fillStyle=s.color,e.fillText(`approved variations`,R.left+Ce+112,n),e.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,e.textAlign=`right`,e.fillStyle=s.color,e.fillText(`Portfolio: ${we(m?.total??0)}`,ye-8,n)},!0,{easing:x}),k?(0,n.jsx)(N,{width:ye,height:be,message:`No contract data available`,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{width:ye,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:ye,height:w,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...j,parentW:ye,parentH:w})]}),h.length>xe&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:u,onToggle:()=>d(e=>!e)})})]})}var Ee=780,B=240,De=12,Oe=10,ke=[`Highest exposure`,`Elevated risk`,`Moderate exposure`,`Moderate exposure`,`Low exposure`];function Ae({items:e=[],"data-testid":r}){let s=(0,t.useRef)(null),l=(0,t.useRef)(0),u=(0,t.useRef)(new Map),{hoveredRef:p,tooltip:h,hitZonesRef:v}=_(s,{width:Ee,height:B}),b=[...(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e])].sort((e,t)=>(t.count??0)-(e.count??0)).slice(0,5),x=b.reduce((e,t)=>e+(t.count??0),0);return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=d(e,Ee,B);l.current=0;let n=Math.min(5,b.length),r=(Ee-2*De-(n-1)*Oe)/n,h=B*.84,g=B*.08,_,S=()=>{l.current++;let e=l.current;t.clearRect(0,0,Ee,B),v.current=[],u.current.forEach((e,t)=>{let n=t===p.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?u.current.delete(t):u.current.set(t,1):u.current.set(t,r)}),p.current&&!u.current.has(p.current)&&u.current.set(p.current,0),b.forEach((n,s)=>{let l=s===0,d=s===0?i.red:s===1?i.amber:a[s%a.length],p=De+s*(r+Oe),m=u.current.get(n.id)??0,_=m*8,b=p-_/2,S=r+_,C=l?w(e,.04,3e-4)*.06+.06:0;t.fillStyle=c(d,.08+m*.07),t.beginPath(),t.roundRect(b,g,S,h,6),t.fill(),t.strokeStyle=c(d,.2+m*.4+C),t.lineWidth=l?1.5:1,t.stroke(),(m>.01||l)&&f(t,b+S/2,g+h/2,S*.55,d,C+m*.14),t.font=`bold `+o.font,t.textAlign=`left`,t.textBaseline=`top`,t.fillStyle=c(d,.5+m*.35),t.fillText(`#${s+1}`,b+7,g+6);let T=Math.min(r*.28,h*.32,72),E=b+S/2,D=g+h*.38,O=t.createRadialGradient(E,D-T*.2,0,E,D,T);O.addColorStop(0,c(d,.5+m*.2)),O.addColorStop(1,c(d,.2+m*.1)),t.beginPath(),t.arc(E,D,T,0,Math.PI*2),t.fillStyle=O,t.fill(),t.strokeStyle=c(d,.4+m*.3),t.lineWidth=1,t.stroke(),t.font=`bold `+o.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=c(i.t1,.9),t.fillText(n.abbreviation??n.name.slice(0,6),E,D),t.font=`bold 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.textBaseline=`alphabetic`,t.fillStyle=c(d,.9+m*.1),t.fillText(String(n.count??0),E,g+h*.76),t.font=o.font,t.fillStyle=o.color,t.fillText(`open EWs`,E,g+h*.88);let k=Math.round((n.count??0)/(x||1)*100),A=ke[s]??`Low exposure`;y(v.current,n.id,p,g,r,h,{label:n.name,value:`${n.count??0} open · ${k}% of total`,sublabel:`Rank #${s+1} · ${A}`,color:d})}),m(t,Ee,B,e,.015),_=requestAnimationFrame(S)};return S(),()=>cancelAnimationFrame(_)},[b,x]),b.length===0?(0,n.jsx)(N,{width:Ee,height:B,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:Ee,height:B},children:[(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`Contractor rank — open EW count per contractor`,style:{width:Ee,height:B,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...h,parentW:Ee,parentH:B})]})}var V=680,H=260;function je({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(0),s=(0,t.useRef)(new Map),{hoveredRef:l,tooltip:u,hitZonesRef:h}=_(a,{width:V,height:H}),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,V,H);o.current=0;let n=y.length,r=Math.max(...y.map(e=>e.count),1),u=r,g=V*.05,_=H*.1,b=V*.9/n,x=H*.7/u,S=y.reduce((e,t)=>e+t.count,0),C,T=()=>{o.current++;let e=o.current;t.clearRect(0,0,V,H),h.current=[],s.current.forEach((e,t)=>{let n=t===l.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)}),l.current&&!s.current.has(l.current)&&s.current.set(l.current,0),p(t,V,H,e,40,c(i.blue,.04)),y.forEach((n,a)=>{let o=n.count===r,l=o?i.cyan:i.blue,d=s.current.get(`${n.category}-col`)??0;for(let i=0;i<u;i++){let u=g+a*b+b/2,p=_+i*x+x/2,m=Math.min(b,x)*.38;if(i>=r-n.count){let r=m*(1+(w(e,.04,5e-4)+Math.sin(a*.6+i*1.2)*.3)*.12);(o||d>.01)&&f(t,u,p,r*3,l,(o?.2:.1)+d*.1),t.beginPath(),t.arc(u,p,r,0,Math.PI*2),t.fillStyle=c(l,o?.8:.5+d*.2),t.fill();let g=`${n.category}-${i}`;v(h.current,g,u,p,m+4,{label:n.fullName,value:`${n.count} Early Warnings`,sublabel:`${Math.round(n.count/S*100)}% of total`,color:l}),s.current.get(`${n.category}-col`)}else t.beginPath(),t.arc(u,p,1,0,Math.PI*2),t.fillStyle=c(l,.08),t.fill()}let p=_+u*x+16;t.font=`${o?`bold `:``}9px 'JetBrains Mono', monospace`,t.textAlign=`center`,t.textBaseline=`alphabetic`,t.fillStyle=o?i.cyan:c(i.t2,.65),t.fillText(n.category,g+a*b+b/2,p)}),m(t,V,H,e,.015),C=requestAnimationFrame(T)};return T(),()=>cancelAnimationFrame(C)},[y]),y.length===0?(0,n.jsx)(N,{width:V,height:H,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:V,height:H},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Early Warning count by category — breathing dot grid`,style:{width:V,height:H,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...u,parentW:V,parentH:H})]})}function Me({rows:e=[],className:t,colors:r}){return(0,n.jsx)(k,{rows:e,variant:`line`,className:t,colors:r})}var Ne=[`#36BFFA`,`#16B364`,`#D444F1`,`#FAC515`,`#2970FF`,`#7A5AF8`,`#EF6820`,`#D92D20`],Pe={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 Fe({rows:e=[],className:t,colors:r}){let i=r?.slices??Ne;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%Ne.length}`,fill:i[a%i.length]})]})}),(0,n.jsx)(`span`,{children:r})]},`${e}-${a}`))})}var Ie=680,U=320;function Le({total:e=0,items:r=[],"data-testid":s}){let l=(0,t.useRef)(null),u=(0,t.useRef)(new Map),p=(0,t.useRef)(0),{hoveredRef:m,tooltip:h,hitZonesRef:y}=_(l,{width:Ie,height:U}),x=(0,t.useMemo)(()=>r.filter(e=>typeof e==`object`&&!!e),[r]);return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=d(t,Ie,U);p.current=0;let r=U/2,s=Ie-80,h=Math.max(...x.map(e=>e.count??0)),g=(U-60)/(x.length-1),_=x.map((e,t)=>({x:s,y:30+t*g})),S,C=()=>{p.current++;let t=p.current;n.clearRect(0,0,Ie,U);let l=b(Math.min(t/72,1));E(u.current,m.current),y.current=[],f(n,88,r,48*l,i.blue,.15*l),x.forEach((t,d)=>{let p=a[d%a.length],m=T(l,d,x.length,b),g=_[d],S=u.current.get(t.id)??0,C=Math.max(1.5,(t.count??0)/h*6);if(m<.01)return;let w=88+(s-88)*.4,E=r,D=88+(s-88)*.6,O=g.y,k=m;n.beginPath();for(let e=0;e<=40;e++){let t=e/40*k,i=(1-t)**3*88+3*(1-t)**2*t*w+3*(1-t)*t**2*D+t**3*g.x,a=(1-t)**3*r+3*(1-t)**2*t*E+3*(1-t)*t**2*O+t**3*g.y;e===0?n.moveTo(i,a):n.lineTo(i,a)}if(n.strokeStyle=c(p,S>0?.8:.45),n.lineWidth=C*(S>0?1.3:1),n.stroke(),m>.85){let r=Math.min(1,(m-.85)/.15),a=4+(t.count??0)/h*12;f(n,g.x,g.y,a*2.5,p,(.25+S*.2)*r),n.beginPath(),n.arc(g.x,g.y,a*r,0,Math.PI*2),n.fillStyle=c(p,(.7+S*.2)*r),n.fill(),v(y.current,t.id,g.x,g.y,a+8,{label:t.name,value:`${t.count??0} NCEs raised`,sublabel:`${Math.round((t.count??0)/e*100)}% of all NCEs`,color:p}),n.globalAlpha=r,n.font=o.font,n.fillStyle=S>0?p:c(i.t2,.85),n.textAlign=`left`,n.fillText(t.abbreviation??t.name.slice(0,6),g.x+a+6,g.y-3),n.font=o.font,n.fillStyle=S>0?p:i.t1,n.fillText(String(t.count??0),g.x+a+6,g.y+10),n.globalAlpha=1}}),n.beginPath(),n.arc(88,r,32*l,0,Math.PI*2),n.fillStyle=i.bgL,n.fill(),n.strokeStyle=c(i.blue,.6*l),n.lineWidth=2,n.stroke(),l>.4&&(n.globalAlpha=Math.min(1,(l-.4)/.4),n.font=`500 24px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.textAlign=`center`,n.fillText(String(e),88,r+5),n.font=o.font,n.fillStyle=o.color,n.fillText(`NCEs`,88,r+18),n.globalAlpha=1),S=requestAnimationFrame(C)};return C(),()=>cancelAnimationFrame(S)},[e,x]),x.length===0?(0,n.jsx)(N,{width:Ie,height:U,"data-testid":s}):(0,n.jsxs)(`div`,{"data-testid":s,style:{position:`relative`,width:Ie,height:U},children:[(0,n.jsx)(`canvas`,{ref:l,role:`img`,"aria-label":`NCE fault tree — NCEs per contractor as branching tree`,style:{width:Ie,height:U,display:`block`}}),(0,n.jsx)(g,{...h,parentW:Ie,parentH:U})]})}var Re=192,ze=Re,Be=Re+80;function Ve({rows:e=[],variant:o,className:s,colors:l}){let p=(0,t.useRef)(null),m=(0,t.useRef)(new Map),h=(0,t.useRef)(0),y=l?.slices??a,{hoveredRef:b,tooltip:x,hitZonesRef:S}=_(p,{width:ze,height:Be});return(0,t.useEffect)(()=>{let t=p.current;if(!t)return;let n=d(t,ze,Be);h.current=0;let r=ze/2,a=Re/2,s=Re*.4,l=o===`donut`?Re*.21:0,g=e.reduce((e,t)=>e+(t.pricing??0),0)||1,_,x=()=>{h.current++;let t=h.current;n.clearRect(0,0,ze,Be);let d=1-(1-Math.min(t/48,1))**3;E(m.current,b.current),S.current=[];let p=-Math.PI/2;e.forEach((e,o)=>{let u=(e.pricing??0)/g,h=u*Math.PI*2*d,_=p+h,b=y[o%y.length],x=m.current.get(e.id??`sl-${o}`)??0,C=p+h/2,T=(s+l)/2,E=r+Math.cos(C)*T,D=a+Math.sin(C)*T,O=(s-l)/2+8;v(S.current,e.id??`sl-${o}`,E,D,O,{label:e.vendor,value:`${e.pricing??0} (${Math.round(u*100)}%)`,color:b}),x>0&&f(n,E,D,O*2*x,b,.2*x);let k=w(t,.03,3e-4),A=s+x*6+(x>0?k*2:0);n.beginPath(),n.moveTo(r+Math.cos(p)*l,a+Math.sin(p)*l),n.arc(r,a,A,p,_),l>0?n.arc(r,a,l,_,p,!0):n.lineTo(r,a),n.closePath(),n.fillStyle=c(b,.7+x*.2),n.fill(),n.strokeStyle=c(i.bg,.8),n.lineWidth=1.5,n.stroke(),p=_}),o===`donut`&&e.length>0&&f(n,r,a,l*.8,i.blue,.06);let C=Re+12;e.forEach((e,t)=>{let r=y[t%y.length],a=(e.pricing??0)/g,o=m.current.get(e.id??`sl-${t}`)??0,s=C+t*18;n.beginPath(),n.arc(8,s,4,0,Math.PI*2),n.fillStyle=c(r,.8+o*.2),n.fill(),n.font=`9px 'JetBrains Mono', monospace`,n.fillStyle=c(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=u(i.t3,r,o),n.textAlign=`right`,n.fillText(`${e.pricing??0} (${Math.round(a*100)}%)`,ze-4,s+3.5)}),_=requestAnimationFrame(x)};return x(),()=>cancelAnimationFrame(_)},[e,o,l,y]),(0,n.jsx)(r,{className:[`canvas-pie-frame`,s].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:ze,height:Be},children:[(0,n.jsx)(`canvas`,{ref:p,role:`img`,"aria-label":`${o} chart`,style:{width:ze,height:Be,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...x,parentW:ze,parentH:Be})]})})}function He(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 Ue({nodes:e,links:o,width:s=960,height:l=280,ariaLabel:u,selectedEntity:p,className:h,colors:b}){let x=(0,t.useRef)(null),S=(0,t.useRef)(new Map),C=(0,t.useRef)(0),T=(0,t.useRef)([]),D=b?.nodes??a,O=b?.links??i.bd,k=b?.activeLinks??i.blue,A=b?.activeNodes??i.blue,j=(0,t.useMemo)(()=>He(e,o,s,l),[e,o,s,l]),{hoveredRef:M,tooltip:ee,hitZonesRef:N}=_(x,{width:s,height:l});return(0,t.useEffect)(()=>{let t=x.current;if(!t)return;let n=d(t,s,l);C.current=0,T.current=[];let r=o.length>0?Math.max(...o.map(e=>e.value)):1,a,u=()=>{C.current++;let t=C.current;n.clearRect(0,0,s,l);let d=1-(1-Math.min(t/56,1))**3;E(S.current,M.current),N.current=[],o.forEach((e,a)=>{let o=j.get(e.source),s=j.get(e.target);if(!o||!s)return;let l=!!p&&(e.source===p||e.target===p),u=l?k:O,f=l?.5:.2,m=Math.max(3,e.value/r*36*d),h=m/2,g=o.x+o.w,_=o.y+o.h/2,y=s.x,b=s.y+s.h/2,x=(g+y)/2;for(let e=0;e<30;e++){let r=e/30,i=(e+1)/30,o=1-r,s=1-i,l=o*o*g+2*o*r*x+r*r*y,d=o*o*_+2*o*r*_+r*r*b,p=s*s*g+2*s*i*x+i*i*y,m=s*s*_+2*s*i*_+i*i*b,v=w(t+r*120+a*40,.025,3e-4)*1.2;n.beginPath(),n.moveTo(l,d-h+v),n.lineTo(p,m-h+v),n.lineTo(p,m+h+v),n.lineTo(l,d+h+v),n.closePath(),n.fillStyle=c(u,f*(.5+r*.5)),n.fill()}v(N.current,`link-${a}`,x,(_+b)/2,m+6,{label:`${e.source} → ${e.target}`,value:String(e.value),color:l?k:i.blue}),Math.random()<.08&&T.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=p===e.id,s=M.current===`node-${r}`,l=S.current.get(`node-${r}`)??0,u=o?A:D[r%D.length];y(N.current,`node-${r}`,a.x,a.y,a.w,a.h,{label:e.name,value:e.valueLabel??e.id,color:u}),(l>0||o)&&f(n,a.x+a.w/2,a.y+a.h/2,a.w*2,u,.2*Math.max(l,o?.6:0));let d=o?w(t,.03,3e-4)*.15:0;n.fillStyle=c(u,.6+l*.25+d),n.beginPath(),n.roundRect(a.x,a.y,a.w,a.h,4),n.fill(),(o||l>0)&&(n.strokeStyle=c(u,.5*Math.max(l,o?1:0)),n.lineWidth=1,n.beginPath(),n.roundRect(a.x,a.y,a.w,a.h,4),n.stroke());let m=a.x+a.w+8;n.font=`${o||s?`bold `:``}10px 'JetBrains Mono', monospace`,n.fillStyle=c(o?u:i.t2,.7+l*.2),n.textAlign=`left`,n.fillText(e.name,m,a.y+a.h/2+4),e.valueLabel&&(n.font=`9px 'JetBrains Mono', monospace`,n.fillStyle=c(u,.5+l*.2),n.fillText(e.valueLabel,m,a.y+a.h/2+17))}),T.current=T.current.filter(e=>{if(e.prog+=e.speed,e.prog>1)return!1;let t=o[e.linkIdx];if(!t)return!1;let r=j.get(t.source),a=j.get(t.target);if(!r||!a)return!1;let s=r.x+r.w,l=r.y+r.h/2,u=a.x,d=a.y+a.h/2,f=(s+u)/2,p=1-e.prog,m=p*p*s+2*p*e.prog*f+e.prog*e.prog*u,h=p*p*l+2*p*e.prog*l+e.prog*e.prog*d+e.off,g=Math.sin(e.prog*Math.PI)*.5,_=b?.links??i.cyan;return n.beginPath(),n.arc(m,h,e.sz,0,Math.PI*2),n.fillStyle=c(_,g),n.fill(),!0}),T.current.length>150&&(T.current=T.current.slice(-150)),m(n,s,l,t,.01),a=requestAnimationFrame(u)};return u(),()=>{cancelAnimationFrame(a),T.current=[]}},[e,o,s,l,p,b,j]),(0,n.jsx)(r,{className:[`canvas-sankey-frame`,h].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{role:`img`,"aria-label":u,style:{position:`relative`,width:s,height:l},children:[(0,n.jsx)(`canvas`,{ref:x,style:{width:s,height:l,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...ee,parentW:s,parentH:l})]})})}var We=[{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}],Ge=[i.blue,i.cyan,i.orange,i.red,i.purple,i.green,i.amber,i.t2],Ke=[26,24,24,26,22,22,22,22];function qe(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 Je(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 Ye(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 Xe({nodes:e,links:r,width:a=960,height:o=280,selectedEntity:s}){let l=(0,t.useRef)(null),h=(0,t.useRef)(0),y=(0,t.useRef)([]),{hoveredRef:x,tooltip:S,hitZonesRef:C}=_(l,{width:a,height:o}),T=(0,t.useMemo)(()=>{let t=new Map;return e.forEach((e,n)=>t.set(e.id,n)),t},[e]),E=(0,t.useMemo)(()=>r.length>0?Math.max(...r.map(e=>e.value)):100,[r]),D=e=>E>1?e/100:e,O=(0,t.useMemo)(()=>e.map((e,t)=>{let n=We[t%We.length];return{id:e.id,label:e.name,sub:e.valueLabel??``,x:n.x*a,y:n.y*o,r:Ke[t%Ke.length],color:Ge[t%Ge.length]}}),[e,a,o]),k=(0,t.useMemo)(()=>r.map(e=>({fromIdx:T.get(e.source)??-1,toIdx:T.get(e.target)??-1,conf:D(e.value)})).filter(e=>e.fromIdx>=0&&e.toIdx>=0),[r,T]);return(0,t.useEffect)(()=>{let e=l.current;if(!e)return;let t=d(e,a,o);h.current=0,y.current=[];let n,r=()=>{h.current++;let e=h.current;if(t.clearRect(0,0,a,o),C.current=[],p(t,a,o,e,50,c(i.blue,.05)),k.forEach((e,n)=>{let r=O[e.fromIdx],a=O[e.toIdx];if(!r||!a)return;let o=!!s&&(r.id===s||a.id===s),l=u(r.color,a.color,.5),d=o?.18:.05,f=o?.25:.1,p=Ye(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=c(l,d),t.lineWidth=16,t.lineCap=`round`,t.stroke(),t.strokeStyle=c(l,f),t.lineWidth=1.5,t.stroke();for(let t=0;t<e.conf*2.5;t++)Math.random()<.45&&y.current.push({edgeIdx:n,t:0,speed:.003+Math.random()*.004,off:(Math.random()-.5)*13,sz:.7+Math.random()*2});let m=qe(p,.5),h=`${Math.round(e.conf*100)}%`;t.font=`bold 12px 'JetBrains Mono', monospace`,t.textBaseline=`middle`;let g=t.measureText(h).width+14;t.fillStyle=`rgba(10,16,24,0.88)`,t.beginPath(),t.roundRect(m.x-g/2,m.y-11,g,22,6),t.fill(),t.strokeStyle=c(i.cyan,.25),t.lineWidth=1,t.stroke(),t.fillStyle=c(i.cyan,.9),t.textAlign=`center`,t.fillText(h,m.x,m.y)}),y.current=y.current.filter(e=>{if(e.t+=e.speed,e.t>1)return!1;let n=k[e.edgeIdx];if(!n)return!1;let r=O[n.fromIdx],i=O[n.toIdx];if(!r||!i)return!1;let a=Ye(r,i),o=qe(a,e.t),s=Je(a,e.t),l=o.x+s.x*e.off,d=o.y+s.y*e.off,p=Math.sin(e.t*Math.PI)*.7,m=u(r.color,i.color,e.t);return f(t,l,d,e.sz*3,m,p*.1),t.beginPath(),t.arc(l,d,e.sz,0,Math.PI*2),t.fillStyle=c(m,p),t.fill(),!0}),y.current.length>350&&(y.current=y.current.slice(-350)),O.forEach((n,r)=>{let a=s===n.id,o=x.current===`node-${r}`,l=w(e,.03,3e-4)*.1+1,u=n.r*l*(a?1.15:1);t.beginPath(),t.arc(n.x,n.y,u+6,0,Math.PI*2),t.strokeStyle=c(n.color,a?.3:.1),t.lineWidth=a?1.5:.7,t.stroke(),f(t,n.x,n.y,u*3,n.color,a?.22:.12);let d=t.createRadialGradient(n.x,n.y-u*.2,0,n.x,n.y,u);if(d.addColorStop(0,c(n.color,a?1:.85)),d.addColorStop(1,c(n.color,a?.65:.45)),t.fillStyle=d,t.beginPath(),t.arc(n.x,n.y,u,0,Math.PI*2),t.fill(),a||r===O.length-1){let r=u+16,i=e*.04,a=n.x+Math.cos(i)*r,o=n.y+Math.sin(i)*r;f(t,a,o,6,n.color,.3),t.beginPath(),t.arc(a,o,2,0,Math.PI*2),t.fillStyle=c(n.color,.75),t.fill()}v(C.current,`node-${r}`,n.x,n.y,u+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=c(n.color,a?1:.9),t.fillText(n.label,n.x,n.y+u+18),n.sub&&(t.font=`10px 'JetBrains Mono', monospace`,t.fillStyle=c(i.t3,.65),t.fillText(n.sub,n.x,n.y+u+32))}),k.length>=2){let n=k.reduce((e,t)=>e*t.conf,1),r=o*.92,s=a*.12,l=a*.76,u=b(Math.min(e*.008,1));t.fillStyle=c(i.bd,.35),t.beginPath(),t.roundRect(s,r,l,5,3),t.fill(),t.fillStyle=c(i.orange,.6),t.beginPath(),t.roundRect(s,r,l*n*u,5,3),t.fill(),t.font=`bold 12px 'JetBrains Mono', monospace`,t.textAlign=`left`,t.textBaseline=`middle`,t.fillStyle=c(i.orange,.85),t.fillText(`${Math.round(n*100)}% compound confidence`,s+l*n*u+10,r+2);let d=k.map(e=>e.conf.toFixed(2)).join(` × `);t.textAlign=`right`,t.font=`9px 'JetBrains Mono', monospace`,t.fillStyle=c(i.t4,.6),t.fillText(d,s-6,r+2)}m(t,a,o,e,.012),n=requestAnimationFrame(r)};return r(),()=>{cancelAnimationFrame(n),y.current=[]}},[O,k,a,o,s]),(0,n.jsxs)(`div`,{style:{position:`relative`,width:a,height:o},children:[(0,n.jsx)(`canvas`,{ref:l,style:{width:a,height:o,display:`block`,borderRadius:8},role:`img`,"aria-label":`causal flow diagram`}),(0,n.jsx)(g,{...S,parentW:a,parentH:o})]})}function Ze({selectedEntity:e,colors:t}){return(0,n.jsx)(Xe,{nodes:Pe.nodes,links:Pe.links,width:960,height:280,selectedEntity:e})}function Qe({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)(Ue,{nodes:a,links:o,width:760,height:280,ariaLabel:`sankey chart`,className:r,colors:i})}var $e=500,et=320;function tt({left:e,right:r,"data-testid":a}){let s=(0,t.useRef)(null),l=(0,t.useRef)(0);return(0,t.useEffect)(()=>{let t=s.current;if(!t)return;let n=d(t,$e,et);l.current=0;let a=$e/2,u=Math.max(e.value,r.value),p=(e.value-r.value)/u*14,m,h=()=>{l.current++;let t=l.current;n.clearRect(0,0,$e,et);let s=b(Math.min(t/80,1)),d=p*C(Math.min(t/80,1))*Math.PI/180;n.strokeStyle=c(i.bd,.5*s),n.lineWidth=2,n.beginPath(),n.moveTo(a,100),n.lineTo(a,et-80),n.stroke(),n.beginPath(),n.arc(a,100,5*s,0,Math.PI*2),n.fillStyle=i.t2,n.fill();let g={x:a-Math.cos(d)*160,y:100+Math.sin(-d)*160},_={x:a+Math.cos(d)*160,y:100+Math.sin(d)*160};n.strokeStyle=c(i.t2,.5*s),n.lineWidth=2,n.beginPath(),n.moveTo(g.x,g.y),n.lineTo(_.x,_.y),n.stroke();let v=Math.max(20,e.value/u*100*s),y=g.y+18;f(n,g.x,y+v/2,90*.5,i.green,.18*s),n.fillStyle=c(i.green,.5*s),n.beginPath(),n.roundRect(g.x-90/2,y,90,v,[0,0,6,6]),n.fill(),n.strokeStyle=c(i.green,.7*s),n.lineWidth=1.5,n.stroke(),n.strokeStyle=c(i.t3,.35*s),n.lineWidth=1,[-90/3,90/3].forEach(e=>{n.beginPath(),n.moveTo(g.x+e,g.y+4),n.lineTo(g.x+e,y),n.stroke()}),s>.5&&(n.globalAlpha=Math.min(1,(s-.5)/.5),n.font=`bold 14px 'JetBrains Mono', monospace`,n.fillStyle=i.green,n.textAlign=`center`,n.fillText(e.label,g.x,y+v+18),n.font=o.font,n.fillStyle=o.color,n.fillText(`Accepted`,g.x,y+v+32),n.fillText(`${e.count} quotations`,g.x,y+v+44),n.globalAlpha=1);let x=Math.max(20,r.value/u*100*s),S=_.y+18;n.fillStyle=c(i.amber,.3*s),n.strokeStyle=c(i.amber,.5*s),n.lineWidth=1.5,n.beginPath(),n.roundRect(_.x-90/2,S,90,x,[0,0,6,6]),n.fill(),n.stroke(),n.strokeStyle=c(i.t3,.35*s),n.lineWidth=1,[-90/3,90/3].forEach(e=>{n.beginPath(),n.moveTo(_.x+e,_.y+4),n.lineTo(_.x+e,S),n.stroke()}),s>.5&&(n.globalAlpha=Math.min(1,(s-.5)/.5),n.font=`bold 14px 'JetBrains Mono', monospace`,n.fillStyle=i.amber,n.textAlign=`center`,n.fillText(r.label,_.x,S+x+18),n.font=o.font,n.fillStyle=o.color,n.fillText(`Submitted`,_.x,S+x+32),n.fillText(`${r.count} quotations`,_.x,S+x+44),n.globalAlpha=1),s>.85&&Math.abs(p)>1&&(n.globalAlpha=Math.min(1,(s-.85)/.15)*.6,n.font=o.font,n.fillStyle=o.color,n.textAlign=`center`,n.fillText(`${Math.abs(p).toFixed(1)}° tilt toward accepted`,a,et-12),n.globalAlpha=1),m=requestAnimationFrame(h)};return h(),()=>cancelAnimationFrame(m)},[e,r]),(0,n.jsx)(`div`,{"data-testid":a,style:{position:`relative`,width:$e,height:et},children:(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`Quotation balance — accepted vs submitted quotation value`,style:{width:$e,height:et,display:`block`}})})}var nt=680,W=280;function rt({points:e=[],"data-testid":r}){let a=(0,t.useRef)(null),s=(0,t.useRef)(new Map),l=(0,t.useRef)(0),{hoveredRef:u,tooltip:p,hitZonesRef:m}=_(a,{width:nt,height:W}),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,nt,W);l.current=0;let n=nt-54-28,r=W-30-54,p=Math.max(...y.map(e=>e.count),1),g=y.length,_=g>1?n/(g-1):n,x=y.map((e,t)=>({x:54+t*_,y:30+r-e.count/p*r,point:e})),S,C=()=>{l.current++;let e=l.current;t.clearRect(0,0,nt,W);let a=b(Math.min(e/72,1));E(s.current,u.current),m.current=[],[.25,.5,.75,1].forEach(e=>{let a=30+r-e*r;t.strokeStyle=c(i.bd,.18),t.lineWidth=1,t.setLineDash([3,5]),t.beginPath(),t.moveTo(54,a),t.lineTo(54+n,a),t.stroke(),t.setLineDash([]),t.font=o.font,t.fillStyle=o.color,t.textAlign=`right`,t.fillText(String(Math.round(p*e)),48,a+3)}),t.save(),t.translate(12,30+r/2),t.rotate(-Math.PI/2),t.font=o.font,t.fillStyle=o.color,t.textAlign=`center`,t.fillText(`Submissions`,0,0),t.restore(),t.font=o.font,t.fillStyle=o.color,t.textAlign=`center`,t.fillText(`Week`,54+n/2,W-6),t.strokeStyle=c(i.bd,.3),t.lineWidth=1,t.setLineDash([]),t.beginPath(),t.moveTo(54,30+r),t.lineTo(54+n,30+r),t.stroke();let d=a*(g-1),_=Math.floor(d)+1;if(_>=2){t.beginPath(),t.moveTo(x[0].x,30+r),t.lineTo(x[0].x,x[0].y);for(let e=1;e<_;e++){let n=d-Math.floor(d),r=e<_-1?x[e].x:x[e-1].x+(x[e].x-x[e-1].x)*(e===Math.ceil(d)?n:1),i=e<_-1?x[e].y:x[e-1].y+(x[e].y-x[e-1].y)*(e===Math.ceil(d)?n:1);t.lineTo(r,i)}let e=x[Math.min(_-1,g-1)];t.lineTo(e.x,30+r),t.closePath();let n=t.createLinearGradient(0,30,0,30+r);n.addColorStop(0,c(i.cyan,.22)),n.addColorStop(1,c(i.cyan,.02)),t.fillStyle=n,t.fill()}t.beginPath();for(let e=0;e<_;e++){let n=d-Math.floor(d),r=e===_-1&&e>0&&e===Math.ceil(d),i=e===0||e<_-1?x[e].x:x[e-1].x+(x[e].x-x[e-1].x)*(r?n:1),a=e===0||e<_-1?x[e].y:x[e-1].y+(x[e].y-x[e-1].y)*(r?n:1);e===0?t.moveTo(i,a):t.lineTo(i,a)}t.strokeStyle=c(i.cyan,.85),t.lineWidth=2,t.stroke(),x.forEach((e,n)=>{if(n>=_)return;let a=`pt-${n}`,l=s.current.get(a)??0;v(m.current,a,e.x,e.y,10,{label:e.point.week,value:`${e.point.count} quotations submitted`,sublabel:`£${e.point.value}M value`,color:i.cyan}),l>0&&h(t,e.x,30,30+r,c(i.cyan,.15*l));let u=e.point.count===p;(l>0||u)&&f(t,e.x,e.y,14,i.cyan,(u?.3:0)+l*.25),t.beginPath(),t.arc(e.x,e.y,l>0?5:3.5,0,Math.PI*2),t.fillStyle=c(i.cyan,l>0?1:.8),t.fill(),(l>0||u)&&(t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=i.cyan,t.textAlign=`center`,t.fillText(String(e.point.count),e.x,e.y-10)),t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=l>0?i.cyan:o.color,t.textAlign=`center`,t.fillText(e.point.week,e.x,W-54+14)}),S=requestAnimationFrame(C)};return C(),()=>cancelAnimationFrame(S)},[y]),y.length<2?(0,n.jsx)(N,{width:nt,height:W,"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:nt,height:W},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Trend chart — count over time`,style:{width:nt,height:W,display:`block`}}),(0,n.jsx)(g,{...p,parentW:nt,parentH:W})]})})}var it=680,G=280,at=54,ot=28,st=64,ct=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,lt=12;function ut({points:e=[],"data-testid":r}){let a=(0,t.useRef)(null),s=(0,t.useRef)(null),l=(0,t.useRef)(0),u=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),f=(0,t.useMemo)(()=>{if(u.length<=1)return st;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return st;e.font=ct;let t=Math.max(...u.map(t=>e.measureText(t.week).width));return Math.max(st,t+lt)},[u]),p=Math.max(it-at,ot+Math.max(0,u.length-1)*f),{tooltip:m,hitZonesRef:h}=_(a,{width:p,height:G});return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,p,G),n=s.current?d(s.current,at,G):null;l.current=0;let r=p-ot,m=G-30-54,g=Math.max(...u.map(e=>e.count),1),_=u.length,y=_>1?Math.max(r/(_-1),f):r,x=u.map((e,t)=>({x:t*y,y:30+m-e.count/g*m,point:e}));n&&(n.clearRect(0,0,at,G),n.fillStyle=i.bg,n.fillRect(0,0,at,G),[.25,.5,.75,1].forEach(e=>{let t=30+m-e*m;n.font=o.font,n.fillStyle=o.color,n.textAlign=`right`,n.fillText(String(Math.round(g*e)),at-6,t+3)}),n.save(),n.translate(12,30+m/2),n.rotate(-Math.PI/2),n.font=o.font,n.fillStyle=o.color,n.textAlign=`center`,n.fillText(`Count`,0,0),n.restore());let S,C=()=>{l.current++;let e=Math.min(l.current/72,1),n=b(e);t.clearRect(0,0,p,G),[.25,.5,.75,1].forEach(e=>{let n=30+m-e*m;t.strokeStyle=c(i.bd,.18),t.lineWidth=1,t.setLineDash([3,5]),t.beginPath(),t.moveTo(0,n),t.lineTo(r,n),t.stroke(),t.setLineDash([])}),t.font=o.font,t.fillStyle=o.color,t.textAlign=`center`,t.fillText(`Period`,r/2,G-6),t.strokeStyle=c(i.bd,.3),t.lineWidth=1,t.beginPath(),t.moveTo(0,30+m),t.lineTo(r,30+m),t.stroke();let a=n*(_-1),s=Math.floor(a)+1;if(s>=2){t.beginPath(),t.moveTo(x[0].x,30+m),t.lineTo(x[0].x,x[0].y);for(let e=1;e<s;e++){let n=a-Math.floor(a),r=e===s-1&&e===Math.ceil(a),i=r?x[e-1].x+(x[e].x-x[e-1].x)*n:x[e].x,o=r?x[e-1].y+(x[e].y-x[e-1].y)*n:x[e].y;t.lineTo(i,o)}t.lineTo(x[s-1].x,30+m),t.closePath();let e=t.createLinearGradient(0,30,0,30+m);e.addColorStop(0,c(i.cyan,.22)),e.addColorStop(1,c(i.cyan,.02)),t.fillStyle=e,t.fill()}t.beginPath();for(let e=0;e<s;e++){let n=a-Math.floor(a),r=e===s-1&&e>0&&e===Math.ceil(a),i=r?x[e-1].x+(x[e].x-x[e-1].x)*n:x[e].x,o=r?x[e-1].y+(x[e].y-x[e-1].y)*n:x[e].y;e===0?t.moveTo(i,o):t.lineTo(i,o)}t.strokeStyle=c(i.cyan,.85),t.lineWidth=2,t.stroke(),h.current=[],x.forEach((e,n)=>{n>=s||(v(h.current,`pt-${n}`,e.x,e.y,10,{label:e.point.week,value:`${e.point.count} submissions`,sublabel:`£${e.point.value}M value`,color:i.cyan}),t.beginPath(),t.arc(e.x,e.y,3.5,0,Math.PI*2),t.fillStyle=c(i.cyan,.8),t.fill(),t.font=ct,t.fillStyle=o.color,t.textAlign=`center`,t.fillText(e.point.week,e.x,G-54+14))}),e<1&&(S=requestAnimationFrame(C))};return C(),()=>cancelAnimationFrame(S)},[u,p,f,h]),u.length<2?(0,n.jsx)(N,{width:it,height:G,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:`100%`,display:`flex`},children:[(0,n.jsx)(`canvas`,{ref:s,"aria-hidden":`true`,style:{width:at,height:G,display:`block`,flexShrink:0}}),(0,n.jsx)(`div`,{className:`trend-scroll`,style:{flex:1,overflowX:`auto`},children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:p,height:G},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Trend chart — count over time`,style:{width:p,height:G,display:`block`}}),(0,n.jsx)(g,{...m,parentW:p,parentH:G})]})})]})}var K=680,dt=240,ft={Critical:i.red,High:i.orange,Medium:i.amber,Low:i.green};function pt({severities:e=[],"data-testid":r}){let a=(0,t.useRef)(null),s=(0,t.useRef)(new Map),l=(0,t.useRef)(0),{hoveredRef:u,tooltip:p,hitZonesRef:m}=_(a,{width:K,height:dt}),h=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,K,dt);l.current=0;let n=h.reduce((e,t)=>e+t.count,0),r=K-28-28,p=dt-50-52,g=h.map(e=>e.count/n*r),_,v=()=>{l.current++;let e=l.current;t.clearRect(0,0,K,dt);let a=x(Math.min(e/60,1));E(s.current,u.current),m.current=[],t.strokeStyle=c(i.bd,.2),t.lineWidth=1,t.beginPath(),t.rect(28,50,r,p),t.stroke(),t.strokeStyle=c(i.t4,.15),t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(K/2,50),t.lineTo(K/2,50+p),t.stroke(),t.setLineDash([]);let d=28;h.forEach((e,r)=>{let l=ft[e.severity]??i.blue,u=g[r];u*a;let h=s.current.get(e.severity)??0,_=d+u/2,v=u*.85;_-v/2;let b=u*a,x=v*a,S=_-x/2;if(b>0&&(h>0&&f(t,d+b/2,50+p/2,b*.4,l,.15*h),t.beginPath(),t.moveTo(S,50),t.lineTo(S+x,50),t.lineTo(d+b,50+p),t.lineTo(d,50+p),t.closePath(),t.fillStyle=c(l,.45+h*.25),t.fill(),t.strokeStyle=c(l,(.5+h*.3)*a),t.lineWidth=h>0?2:1,t.beginPath(),t.moveTo(S,50),t.lineTo(S+x,50),t.stroke(),t.strokeStyle=c(l,(.3+h*.3)*a),t.lineWidth=h>0?2:1,t.beginPath(),t.moveTo(d,50+p),t.lineTo(d+b,50+p),t.stroke()),y(m.current,e.severity,d,50,u,p,{label:e.severity,value:`${e.count} Early Warnings`,sublabel:`${Math.round(e.count/n*100)}% of all EWs`,color:l}),a>.5){let r=Math.min(1,(a-.5)/.5),s=d+u/2;t.globalAlpha=r,t.font=`bold `+o.font,t.fillStyle=h>0?l:c(l,.9),t.textAlign=`center`,t.fillText(e.severity,s,38),t.font=`bold `+o.font,t.fillStyle=h>0?i.t1:c(i.t1,.85),t.fillText(String(e.count),s,50+p/2+6),t.font=o.font,t.fillStyle=h>0?l:o.color,t.fillText(`${Math.round(e.count/n*100)}%`,s,50+p+18),t.globalAlpha=1}d+=u});let b=t.createLinearGradient(28,0,28+r,0);b.addColorStop(0,c(i.red,.03)),b.addColorStop(.33,c(i.orange,.03)),b.addColorStop(.66,c(i.amber,.03)),b.addColorStop(1,c(i.green,.03)),t.fillStyle=b,t.fillRect(28,50,r*a,p),_=requestAnimationFrame(v)};return v(),()=>cancelAnimationFrame(_)},[h]),h.length===0?(0,n.jsx)(N,{width:K,height:dt,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:K,height:dt},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Early Warning severity distribution — prism spectrum bands`,style:{width:K,height:dt,display:`block`}}),(0,n.jsx)(g,{...p,parentW:K,parentH:dt})]})}var q=460,J=300,mt={Open:i.red,Submitted:i.amber,Closed:i.green};function ht({segments:e=[],title:r,"data-testid":a}){let s=(0,t.useRef)(null),l=(0,t.useRef)(0),u=(0,t.useRef)(new Map),{hoveredRef:h,tooltip:y,hitZonesRef:b}=_(s,{width:q,height:J}),x=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=d(e,q,J);l.current=0;let n=q*.5,r=J*.54,a=q*.22,g=x.reduce((e,t)=>e+t.count,0),_=Math.max(...x.map(e=>e.count),1),y,S=()=>{l.current++;let e=l.current;t.clearRect(0,0,q,J),b.current=[],u.current.forEach((e,t)=>{let n=t===h.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?u.current.delete(t):u.current.set(t,1):u.current.set(t,r)}),h.current&&!u.current.has(h.current)&&u.current.set(h.current,0),p(t,q,J,e,40,c(i.blue,.04)),x.forEach((s,l)=>{let u=l/3*Math.PI*2-Math.PI/2,d=n+Math.cos(u)*a,p=r+Math.sin(u)*a,m=mt[s.status]??i.blue,h=2+s.count/_*8;t.beginPath(),t.moveTo(n,r),t.lineTo(d,p),t.strokeStyle=c(m,.08),t.lineWidth=h*2,t.stroke(),t.beginPath(),t.moveTo(n,r),t.lineTo(d,p),t.strokeStyle=c(m,.25),t.lineWidth=1,t.stroke();let g=(e*.005+l*.33)%1,v=n+(d-n)*g,y=r+(p-r)*g;f(t,v,y,6,m,.4),t.beginPath(),t.arc(v,y,2,0,Math.PI*2),t.fillStyle=c(m,.8),t.fill();let b=(n+d)/2,x=(r+p)/2;t.font=`bold `+o.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=c(m,.85),t.fillText(String(s.count),b,x)}),x.forEach((e,s)=>{let l=s/3*Math.PI*2-Math.PI/2,d=n+Math.cos(l)*a,p=r+Math.sin(l)*a,m=mt[e.status]??i.blue,h=10+e.count/_*18,y=u.current.get(e.status)??0;f(t,d,p,h*2.5,m,.2+y*.15);let x=t.createRadialGradient(d,p-h*.2,0,d,p,h);x.addColorStop(0,c(m,.8+y*.2)),x.addColorStop(1,c(m,.4+y*.1)),t.beginPath(),t.arc(d,p,h,0,Math.PI*2),t.fillStyle=x,t.fill(),t.font=`bold `+o.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=c(i.t1,.9),t.fillText(e.status,d,p),v(b.current,e.status,d,p,h+6,{label:e.status,value:`${e.count} Early Warnings`,sublabel:`${Math.round(e.count/g*100)}%`,color:m})});let s=u.current.get(`center`)??0;f(t,n,r,36,i.t3,.2+s*.15);let d=t.createRadialGradient(n,r-4,0,n,r,22);d.addColorStop(0,c(i.t2,.9)),d.addColorStop(1,c(i.t3,.5)),t.beginPath(),t.arc(n,r,22,0,Math.PI*2),t.fillStyle=d,t.fill(),t.font=o.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=c(i.t1,.9),t.fillText(`EW Status`,n,r-4),t.font=`bold `+o.font,t.fillStyle=i.t1,t.fillText(String(g),n,r+8),v(b.current,`center`,n,r,28,{label:`Total EW Status`,value:`${g} Early Warnings`,color:i.t3}),m(t,q,J,e,.015),y=requestAnimationFrame(S)};return S(),()=>cancelAnimationFrame(y)},[x,r]),x.length===0?(0,n.jsx)(N,{width:q,height:J,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,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)(g,{...y,parentW:q,parentH:J})]})}var gt=280,Y=96;function _t({points:e=[],className:a,colors:o}){let s=(0,t.useRef)(null),l=(0,t.useRef)(new Map),u=(0,t.useRef)(0),p=(0,t.useMemo)(()=>e.map(([e,t])=>{let n=String(t).match(/-?\d+(\.\d+)?/);return{label:e,value:n?Number(n[0]):0}}),[e]),{mouseRef:m,hoveredRef:y,tooltip:b,hitZonesRef:x}=_(s,{width:gt,height:Y});return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=d(e,gt,Y);u.current=0;let n=o?.line??i.blue,r=o?.point??i.blue,a=o?.axisLine??i.bd,g,_=()=>{u.current++;let e=u.current;if(t.clearRect(0,0,gt,Y),p.length<2){g=requestAnimationFrame(_);return}let o={left:12,right:12,top:16,bottom:20},s=gt-o.left-o.right,d=Y-o.top-o.bottom,b=p.map(e=>e.value),S=Math.min(...b),C=Math.max(...b)-S||1,T=e=>o.left+e/(p.length-1)*s,D=e=>o.top+(1-(e-S)/C)*d,O=1-(1-Math.min(e/48,1))**3,k=Math.max(2,Math.floor(O*p.length));if(E(l.current,y.current),x.current=[],t.strokeStyle=c(a,.3),t.lineWidth=.5,t.setLineDash([]),t.beginPath(),t.moveTo(o.left,Y-o.bottom),t.lineTo(gt-o.right,Y-o.bottom),t.stroke(),t.font=`9px 'JetBrains Mono', monospace`,t.fillStyle=c(i.t4,.9),t.textAlign=`center`,p.forEach((e,n)=>{t.fillText(e.label.replace(`Day `,`D`),T(n),Y-4)}),m.current.over&&y.current){let e=parseInt(y.current.split(`-`)[1]);isNaN(e)||h(t,T(e),o.top,o.top+d)}if(k>1){let e=t.createLinearGradient(0,o.top,0,o.top+d);e.addColorStop(0,c(n,.15)),e.addColorStop(1,c(n,0)),t.fillStyle=e,t.beginPath(),t.moveTo(T(0),o.top+d);for(let e=0;e<k;e++)t.lineTo(T(e),D(p[e].value));t.lineTo(T(k-1),o.top+d),t.closePath(),t.fill(),t.strokeStyle=c(n,.8),t.lineWidth=1.5,t.setLineDash([]),t.beginPath();for(let e=0;e<k;e++){let n=T(e),r=D(p[e].value);e===0?t.moveTo(n,r):t.lineTo(n,r)}t.stroke()}for(let e=0;e<k;e++){let n=T(e),a=D(p[e].value),o=`tp-${e}`,s=l.current.get(o)??0,u=e===p.length-1;v(x.current,o,n,a,10,{label:p[e].label,value:String(p[e].value),color:u?i.red:r}),s>0&&!u&&(f(t,n,a,12*s,r,.2*s),t.fillStyle=c(r,.8),t.beginPath(),t.arc(n,a,3+s*2,0,Math.PI*2),t.fill())}if(k>=p.length){let n=p.length-1,r=T(n),a=D(p[n].value),o=l.current.get(`tp-${n}`)??0,s=w(e,.05,5e-4),u=1+o*.5;t.shadowColor=c(i.red,.5),t.shadowBlur=(8+s*4)*u,t.fillStyle=i.red,t.beginPath(),t.arc(r,a,(3.5+s*1.5)*u,0,Math.PI*2),t.fill(),t.shadowBlur=0}g=requestAnimationFrame(_)};return _(),()=>cancelAnimationFrame(g)},[p,o]),(0,n.jsx)(r,{className:[`canvas-trend-frame`,a].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:gt,height:Y},children:[(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`trend chart`,style:{width:gt,height:Y,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...b,parentW:gt,parentH:Y})]})})}var X=680,vt=8,yt=26,bt=14,xt=16,St=32;function Ct({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),l=(0,t.useRef)(0),[u,p]=(0,t.useState)(!1),m=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),h=(0,t.useMemo)(()=>u?m:m.slice(0,vt),[m,u]),v=xt+St+h.length*(yt+bt)-bt,{hoveredRef:b,tooltip:S,hitZonesRef:C}=_(a,{width:X,height:v});return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,X,v);l.current=0;let n=xt,r=St,u=yt,p=bt,m=X-60-28,g=Math.max(...h.map(e=>(e.implemented??0)+(e.unimplemented??0))),_=h.length*(u+p)-p,S=n+(v-n-r-_)/2,w,D=()=>{l.current++;let e=l.current;t.clearRect(0,0,X,v);let n=x(Math.min(e/60,1));E(o.current,b.current),C.current=[],h.forEach((e,r)=>{let a=T(n,r,h.length,x),s=S+r*(u+p),l=(e.implemented??0)+(e.unimplemented??0),d=(e.implemented??0)/g*m*a,_=(e.unimplemented??0)/g*m*a,v=`${e.id}-impl`,b=`${e.id}-un`,w=o.current.get(v)??0,E=o.current.get(b)??0;y(C.current,v,60,s,d||1,u,{label:`${e.name} — Implemented`,value:`${e.implemented??0} variations`,sublabel:`${Math.round((e.implemented??0)/(l||1)*100)}% complete`,color:i.green}),y(C.current,b,60+d,s,_||1,u,{label:`${e.name} — Unimplemented`,value:`${e.unimplemented??0} variations`,sublabel:`${Math.round((e.unimplemented??0)/(l||1)*100)}% pending`,color:i.amber}),t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=i.t2,t.textAlign=`right`,t.fillText(e.abbreviation??e.name.slice(0,6),52,s+u/2+4),t.fillStyle=c(i.bd,.15),t.beginPath(),t.roundRect(60,s,l/g*m,u,4),t.fill(),d>0&&(w>0&&f(t,60+d/2,s+u/2,d*.3,i.green,.12*w),t.fillStyle=c(i.green,.6+w*.2),t.beginPath(),t.roundRect(60,s,d,u,[4,0,0,4]),t.fill(),d>28&&a>.5&&(t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=w>0?i.green:i.t2,t.textAlign=`center`,t.fillText(String(e.implemented??0),60+d/2,s+u/2+4))),_>0&&(E>0&&f(t,60+d+_/2,s+u/2,_*.3,i.amber,.12*E),t.fillStyle=c(i.amber,.18+E*.18),t.strokeStyle=c(i.amber,.3+E*.3),t.lineWidth=1,t.beginPath(),t.roundRect(60+d,s,_,u,[0,4,4,0]),t.fill(),t.stroke(),_>28&&a>.5&&(t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=E>0?i.amber:i.t2,t.textAlign=`center`,t.fillText(String(e.unimplemented??0),60+d+_/2,s+u/2+4))),d>0&&_>0&&(t.strokeStyle=c(i.bg,.7),t.lineWidth=2,t.beginPath(),t.moveTo(60+d,s),t.lineTo(60+d,s+u),t.stroke())});let r=S+_+24,a=60+m/2;t.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,t.textAlign=`right`,t.fillStyle=i.green,t.fillText(`■ Implemented`,a-10,r),t.textAlign=`left`,t.fillStyle=s.color,t.fillText(`■ Unimplemented`,a+10,r),w=requestAnimationFrame(D)};return D(),()=>cancelAnimationFrame(w)},[h,v]),m.length===0?(0,n.jsx)(N,{width:X,height:160,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{width:X},children:[(0,n.jsxs)(`div`,{style:{position:`relative`,width:X,height:v},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Implemented vs unimplemented variations per contractor — split bar`,style:{width:X,height:v,display:`block`}}),(0,n.jsx)(g,{...S,parentW:X,parentH:v})]}),m.length>vt&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:u,onToggle:()=>p(e=>!e)})})]})}var wt=800,Tt=360;function Et({items:e=[],"data-testid":r}){let o=(0,t.useRef)(null),s=(0,t.useRef)(new Map),l=(0,t.useRef)(0),{hoveredRef:u,tooltip:p,hitZonesRef:m}=_(o,{width:wt,height:Tt});return(0,t.useEffect)(()=>{let t=o.current;if(!t)return;let n=d(t,wt,Tt);l.current=0;let r=e.reduce((e,t)=>e+(t.base??0),0),p=e.reduce((e,t)=>e+(t.variation??0),0),h=e.reduce((e,t)=>e+(t.total??0),0),g=Tt-20-26,_=g-6*(e.length-1),v=20,x=e.map((e,t)=>{let n=Math.max(24,(e.total??0)/(h||1)*_),r={x:100-110/2,y:v,h:n,cy:v+n/2,c:e,color:a[t%a.length]};return v+=n+6,r}),S=_-14,C=Math.max(28,r/h*S),w=Math.max(18,p/h*S),D=20+(g-(C+w+14))/2,O={x:420-110/2,y:D,h:C,cy:D+C/2},k={x:420-110/2,y:D+C+14,h:w,cy:D+C+14+w/2},A={x:720-110/2,y:20,h:g,cy:20+g/2},j,M=()=>{l.current++;let t=l.current;n.clearRect(0,0,wt,Tt);let a=b(Math.min(t/80,1));if(E(s.current,u.current),m.current=[],e.forEach((t,i)=>{let o=x[i],c=T(a,i,e.length,b),l=s.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=o.h*u,m=o.h*d,h=o.y+f/2,g=o.y+f+m/2,_=Math.max(2,(t.base??0)/r*C),v=Math.max(2,(t.variation??0)/p*w),y=O.y+e.slice(0,i).reduce((e,t)=>e+(t.base??0)/r*C,0)+_/2,S=k.y+e.slice(0,i).reduce((e,t)=>e+(t.variation??0)/p*w,0)+v/2,E=l*.2+.18;Dt(n,o.x+110,h,420-110/2,y,_*c,o.color,E),Dt(n,o.x+110,g,420-110/2,S,v*c,o.color,E*.75)}),a>.3){let e=Math.min(1,(a-.3)/.7),t=A.y+r/h*g/2,o=A.y+g-p/h*g/2;Dt(n,475,O.cy,720-110/2,t,C*e,i.blue,.25*e),Dt(n,475,k.cy,720-110/2,o,w*e,i.amber,.22*e)}if([`Contractors`,`Components`,`Total`].forEach((e,t)=>{let r=[100,420,720][t];n.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=c(i.t3,.5),n.textAlign=`center`,n.fillText(e,r,Tt-8)}),e.forEach((t,r)=>{let o=x[r],l=T(a,r,e.length,b),u=s.current.get(t.id)??0;y(m.current,t.id,o.x,o.y,110,o.h,{label:t.name,value:`£${t.total??0}M total commitment`,sublabel:`Base £${t.base??0}M + Variations £${t.variation??0}M`,color:o.color}),u>0&&f(n,o.x+110/2,o.cy,110*.6,o.color,.12*u),n.fillStyle=c(o.color,(.3+u*.15)*l),n.strokeStyle=c(o.color,(.55+u*.25)*l),n.lineWidth=1,n.beginPath(),n.roundRect(o.x,o.y,110*l,o.h,4),n.fill(),n.stroke(),l>.6&&o.h>=24&&(n.globalAlpha=Math.min(1,(l-.6)/.4),n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=u>0?o.color:c(i.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=c(i.t3,.8),n.fillText(`£${t.total??0}M`,o.x+110/2,o.cy+7)),n.globalAlpha=1,n.textBaseline=`alphabetic`)}),a>.2){let e=Math.min(1,(a-.2)/.4);f(n,420,O.cy,30,i.blue,.1*e),n.fillStyle=c(i.blue,.3*e),n.strokeStyle=c(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=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.blue,n.textAlign=`center`,n.fillText(`Base Value`,420,O.cy-6),n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.fillText(`£${r}M`,420,O.cy+8),n.globalAlpha=1,n.textBaseline=`alphabetic`,f(n,420,k.cy,24,i.amber,.1*e),n.fillStyle=c(i.amber,.22*e),n.strokeStyle=c(i.amber,.4*e),n.beginPath(),n.roundRect(k.x,k.y,110,k.h*e,4),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.amber,n.textAlign=`center`,n.fillText(`Variations`,420,k.cy-4),n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.fillText(`£${p}M`,420,k.cy+8),n.globalAlpha=1,n.textBaseline=`alphabetic`}if(a>.5){let e=Math.min(1,(a-.5)/.5);f(n,720,A.cy,44,i.cyan,.2*e),n.fillStyle=c(i.cyan,.25*e),n.strokeStyle=c(i.cyan,.6*e),n.lineWidth=1.5,n.beginPath(),n.roundRect(A.x,A.y,110,A.h*e,6),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t2,n.textAlign=`center`,n.fillText(`Total Commitment`,720,A.cy-12),n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.cyan,n.fillText(`£${h}M`,720,A.cy+6),n.globalAlpha=1,n.textBaseline=`alphabetic`}j=requestAnimationFrame(M)};return M(),()=>cancelAnimationFrame(j)},[e]),(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:wt,height:Tt},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Weekly report flow — base value and variations per contractor flowing to total commitment`,style:{width:wt,height:Tt,display:`block`}}),(0,n.jsx)(g,{...p,parentW:wt,parentH:Tt})]})}function Dt(e,t,n,r,i,a,o,s){let l=(t+r)/2;e.beginPath(),e.moveTo(t,n-a/2),e.bezierCurveTo(l,n-a/2,l,i-a/2,r,i-a/2),e.lineTo(r,i+a/2),e.bezierCurveTo(l,i+a/2,l,n+a/2,t,n+a/2),e.closePath(),e.fillStyle=c(o,s),e.fill()}function Ot({config:e,className:t}){return e.type===`line`?(0,n.jsx)(Me,{rows:e.rows,className:t}):e.type===`area`?(0,n.jsx)(A,{rows:e.rows,className:t}):e.type===`bar`?(0,n.jsx)(ee,{rows:e.rows,className:t}):e.type===`pie`?(0,n.jsx)(Ve,{rows:e.rows,variant:`pie`,className:t}):e.type===`donut`?(0,n.jsx)(Ve,{rows:e.rows,variant:`donut`,className:t}):e.type===`sankey`?(0,n.jsx)(Qe,{rows:e.rows,className:t}):e.type===`flow`?(0,n.jsx)(Ze,{selectedEntity:e.selectedEntity,className:t}):e.type===`trend`?(0,n.jsx)(_t,{points:e.points,className:t}):e.type===`mini-bars`?(0,n.jsx)(Fe,{rows:e.rows,className:t}):e.type===`stacked-horizontal-bar-chart`?(0,n.jsx)(Te,{data:e.data}):e.type===`multi-metric-constellation-chart`?(0,n.jsx)(ve,{items:e.items}):e.type===`progress-race-chart`?(0,n.jsx)(ce,{items:e.items}):e.type===`hub-and-spoke-radial-chart`?(0,n.jsx)(ht,{segments:e.segments,title:e.title}):e.type===`dot-matrix-chart`?(0,n.jsx)(je,{items:e.items}):e.type===`ranked-card-leaderboard`?(0,n.jsx)(Ae,{items:e.items}):e.type===`proportional-band-chart`?(0,n.jsx)(pt,{severities:e.severities}):e.type===`radial-fan-tree-chart`?(0,n.jsx)(Le,{total:e.total,items:e.items}):e.type===`semi-circular-gauge-chart`?(0,n.jsx)(de,{value:e.value,confirmed:e.confirmed,total:e.total}):e.type===`segmented-split-bar-chart`?(0,n.jsx)(Ct,{items:e.items}):e.type===`balance-scale-chart`?(0,n.jsx)(tt,{left:e.left,right:e.right}):e.type===`area-line-chart`?(0,n.jsx)(rt,{points:e.points}):e.type===`trend-view`?(0,n.jsx)(ut,{points:e.points}):e.type===`weekly-flow`?(0,n.jsx)(Et,{items:e.items}):(0,n.jsx)(`div`,{className:`viz-empty`,children:`Visualization unavailable`})}var kt=[];function At(e){try{return JSON.parse(decodeURIComponent(e))}catch{return null}}function jt(){for(;kt.length;){let e=kt.pop();e&&e.unmount()}}function Mt(){jt(),document.querySelectorAll(`[data-d3-viz]`).forEach(t=>{let r=t.dataset.d3Viz;if(!r)return;let i=At(r);if(!i)return;let a=(0,e.createRoot)(t);kt.push(a),a.render((0,n.jsx)(Ot,{config:i}))})}function Nt(e){return encodeURIComponent(JSON.stringify(e))}function Pt({rows:e=[],className:t,colors:r}){return(0,n.jsx)(Ve,{rows:e,variant:`donut`,className:t,colors:r})}var Z={bg:i.sf,border:i.bd,t1:i.t1,t2:i.t2,t3:i.t3,t4:i.t4,red:i.red,amber:i.amber,green:i.green},Q=`'Satoshi Variable', 'DM Sans', sans-serif`,Ft={color:`#F7F7F7`,fontFamily:Q,fontSize:24,fontWeight:500,lineHeight:`32px`},$={color:`#CECFD2`,fontFamily:Q,fontSize:14,fontWeight:400,lineHeight:`20px`};function It({chips:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,gap:6,marginTop:10},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{width:260,height:120,display:`flex`,alignItems:`baseline`,gap:8,padding:`8px 12px`,background:Z.bg,border:`1px solid ${Z.border}`,borderRadius:5,boxSizing:`border-box`},children:[(0,n.jsx)(`span`,{style:{...Ft,color:e.color??Z.t1},children:e.value}),(0,n.jsx)(`span`,{style:{...$,flex:1},children:e.label})]},t))})}function Lt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,gap:8},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`flex-start`,width:260,height:120,padding:24,gap:8,flexShrink:0,border:`1px solid ${Z.border}`,background:Z.bg,boxSizing:`border-box`},children:[(0,n.jsx)(`div`,{style:{...Ft,color:e.color??Z.t1},children:e.value}),(0,n.jsx)(`div`,{style:{...$},children:e.label})]},t))})}function Rt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`9px 14px`,background:Z.bg,border:`1px solid ${Z.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:e.color??Z.t2,background:(e.color??Z.t2)+`22`,padding:`2px 8px`,borderRadius:4,fontFamily:Q,flexShrink:0},children:e.name}),(0,n.jsx)(`span`,{style:{...Ft,fontSize:14,color:e.color??Z.t1,minWidth:70,flexShrink:0},children:e.value}),(0,n.jsx)(`span`,{style:{...$,flex:1},children:e.kpiLabel})]},t))})}function zt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,gap:8},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`flex-start`,width:260,height:120,padding:24,gap:8,flexShrink:0,background:Z.bg,border:`1px solid ${e.color?e.color+`30`:Z.border}`,boxSizing:`border-box`},children:[(0,n.jsx)(`div`,{style:{...Ft,color:e.color??Z.t1},children:e.value}),(0,n.jsx)(`div`,{style:{...$},children:e.label})]},t))})}var Bt={red:Z.red,amber:Z.amber,green:Z.green};function Vt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:e.map((e,t)=>{let r=Bt[e.severity];return(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`10px 14px`,background:i.sf,border:`1px solid ${Z.border}`},children:[(0,n.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:r,flexShrink:0,marginTop:5}}),(0,n.jsx)(`span`,{style:{...$},children:e.text})]},t)})})}function Ht({min:e,max:t,unit:r,dots:a=[],chips:o=[]}){let s=t-e;return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{style:{position:`relative`,height:90,marginTop:4},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:14,color:Z.t4,fontFamily:Q},children:[e,r]}),(0,n.jsxs)(`div`,{style:{position:`absolute`,top:43,right:0,fontSize:14,color:Z.t4,fontFamily:Q},children:[t,r]}),a.map((t,a)=>{let o=(t.val-e)/s*100,c=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:14,color:c,fontFamily:Q,whiteSpace:`nowrap`},children:t.name}),(0,n.jsxs)(`div`,{style:{fontSize:14,fontWeight:700,color:c,fontFamily:Q,whiteSpace:`nowrap`},children:[t.val,r]})]}),(0,n.jsx)(`div`,{style:{width:10,height:10,borderRadius:`50%`,background:c,boxShadow:`0 0 8px ${c}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:14,color:c,fontFamily:Q,whiteSpace:`nowrap`},children:t.name}),(0,n.jsxs)(`div`,{style:{fontSize:14,fontWeight:700,color:c,fontFamily:Q,whiteSpace:`nowrap`},children:[t.val,r]})]})]},a)})]}),o&&o.length>0&&(0,n.jsx)(It,{chips:o})]})}function Ut({leftPct:e,leftLabel:t,leftValue:r,leftColor:a,rightPct:o,rightLabel:s,rightValue:c,rightColor:l,chips:u}){let d=a??i.blue,f=l??i.cyan;return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{style:{display:`flex`,borderRadius:6,overflow:`hidden`,height:36,marginBottom:8},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:14,fontWeight:700,color:d,fontFamily:Q},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:14,fontWeight:700,color:f,fontFamily:Q},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:14,color:d,fontFamily:Q},children:[e,`% `,t]})}),(0,n.jsx)(`div`,{style:{width:`${o}%`,paddingLeft:10},children:(0,n.jsxs)(`span`,{style:{fontSize:14,color:f,fontFamily:Q},children:[o,`% `,s]})})]}),u&&u.length>0&&(0,n.jsx)(It,{chips:u})]})}function Wt({pct:e,label:t,color:r,chips:a}){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:14,fontWeight:700,color:o,fontFamily:Q},children:[e,`%`]})})]}),(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{style:{...$,marginBottom:10},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:`7px 10px`,background:Z.bg,border:`1px solid ${Z.border}`,borderRadius:5},children:[(0,n.jsx)(`span`,{style:{...Ft,color:e.color??Z.t1},children:e.value}),(0,n.jsx)(`span`,{style:{...$},children:e.label})]},t))})]})]})}var Gt={green:`#34D39918`,amber:`#FBBF2418`,red:`#F0606018`},Kt={green:`#34D399`,amber:`#FBBF24`,red:`#F06060`};function qt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 12px`,background:Z.bg,border:`1px solid ${Z.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:e.color??Z.t2,background:(e.color??Z.t2)+`1A`,padding:`2px 7px`,borderRadius:4,fontFamily:Q,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:2,overflow:`hidden`},children:(0,n.jsx)(`div`,{style:{height:`100%`,width:`${e.pct}%`,background:e.color??Z.t2,borderRadius:2,opacity:.75}})}),(0,n.jsx)(`span`,{style:{fontSize:14,fontWeight:700,color:e.color??Z.t1,fontFamily:Q,flexShrink:0,minWidth:52,textAlign:`right`},children:e.value}),e.badge&&e.badgeSeverity&&(0,n.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:Kt[e.badgeSeverity],background:Gt[e.badgeSeverity],padding:`2px 7px`,borderRadius:4,fontFamily:Q,flexShrink:0,minWidth:72,textAlign:`center`},children:e.badge}),e.sublabel&&(0,n.jsx)(`span`,{style:{...$,flexShrink:0,minWidth:80,textAlign:`right`},children:e.sublabel})]},t))})}var Jt={red:Z.red,amber:Z.amber,green:Z.green};function Yt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:e.map((e,t)=>{let r=Jt[e.severity];return(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`9px 12px`,background:r+`0A`,border:`1px solid ${r}25`},children:[(0,n.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:r,flexShrink:0,marginTop:5}}),(0,n.jsx)(`span`,{style:{flex:1,...$},children:e.text}),(0,n.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:r,background:r+`20`,padding:`2px 7px`,borderRadius:4,fontFamily:Q,flexShrink:0},children:e.tag}),(0,n.jsx)(`span`,{style:{...$,flexShrink:0,marginTop:1},children:e.date})]},t)})})}function Xt({columns:e=[],rows:t=[]}){return(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 12px 6px`,borderBottom:`1px solid ${Z.border}`},children:[(0,n.jsx)(`div`,{style:{minWidth:64}}),e.map((e,t)=>(0,n.jsx)(`div`,{style:{flex:1,fontSize:14,fontWeight:600,color:Z.t2,fontFamily:Q,textTransform:`uppercase`,letterSpacing:.6},children:e},t))]}),t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 12px`,background:Z.bg,border:`1px solid ${Z.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:Z.t2,background:(e.color??Z.t4)+`1A`,padding:`2px 8px`,borderRadius:4,fontFamily:Q,flexShrink:0,minWidth:64,textAlign:`center`},children:e.label}),e.cells.map((t,r)=>(0,n.jsx)(`span`,{style:{flex:1,fontSize:14,fontWeight:700,color:e.color??Z.t1,fontFamily:Q},children:t},r))]},t))]})}function Zt({text:e}){return(0,n.jsxs)(`div`,{style:{padding:`8px 12px`,border:`1px solid ${i.bd}`,borderLeft:`4px solid #FFAE43`,borderRadius:5,background:`linear-gradient(90deg, rgba(255, 174, 67, 0.10) -48.4%, rgba(19, 22, 27, 0.10) 83.98%), ${i.sf}`},children:[(0,n.jsx)(`span`,{style:{fontSize:14,fontWeight:500,color:i.t1,fontFamily:Q,lineHeight:`20px`,marginRight:8},children:`Takeaway`}),(0,n.jsx)(`span`,{style:{...$},children:e})]})}function Qt({block:e}){if(!e)return null;let t=(()=>{switch(e.type){case`stats`:return(0,n.jsx)(Lt,{items:e.items});case`ranked`:return(0,n.jsx)(Rt,{items:e.items});case`chips`:return(0,n.jsx)(zt,{items:e.items});case`badges`:return(0,n.jsx)(Vt,{items:e.items});case`dot-strip`:return(0,n.jsx)(Ht,{min:e.min,max:e.max,unit:e.unit,dots:e.dots,chips:e.chips});case`proportion`:return(0,n.jsx)(Ut,{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)(Wt,{pct:e.pct,label:e.label,color:e.color,chips:e.chips});case`scorecard-rows`:return(0,n.jsx)(qt,{items:e.items});case`flags-list`:return(0,n.jsx)(Yt,{items:e.items});case`comparison-rows`:return(0,n.jsx)(Xt,{columns:e.columns,rows:e.rows});default:return null}})();return e.takeaway?(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:24},children:[t,(0,n.jsx)(Zt,{text:e.takeaway})]}):t}exports.AreaChart=A,exports.BarChart=ee,exports.ChartFrame=r,exports.DonutChart=Pt,exports.KeyHighlights=Qt,exports.LineChart=Me,exports.MiniBars=Fe,exports.PieChart=Ve,exports.ProcessSankey=Ze,exports.RankingSankey=Qe,exports.SankeySvg=Ue,exports.SeriesChart=k,exports.Trend=ut,exports.TrendChart=_t,exports.VisualizationRenderer=Ot,exports.cleanupVisualizationMounts=jt,exports.hydrateVisualizationMounts=Mt,exports.serializeVisualizationConfig=Nt;
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:`#2970FF`,cyan:`#36BFFA`,orange:`#EF6820`,red:`#EF6820`,green:`#71B941`,purple:`#7A5AF8`,amber:`#FAC515`,t1:`#F7F7F7`,t2:`#C2C2C2`,t3:`#94979C`,t4:`#334155`},a=[i.blue,i.cyan,i.amber,i.purple,i.green,i.red],o={font:`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,color:`#C2C2C2`},s={font:`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,color:`#C2C2C2`};function c(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 l(e,t,n){return e+(t-e)*n}function u(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,u]=r(t),d=e=>Math.max(0,Math.min(255,Math.round(e)));return[d(l(i,s,n)),d(l(a,c,n)),d(l(o,u,n))].map(e=>e.toString(16).padStart(2,`0`)).join(``).replace(/^/,`#`)}function d(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 f(e,t,n,r,i,a=.3){let o=e.createRadialGradient(t,n,0,t,n,r);o.addColorStop(0,c(i,a)),o.addColorStop(1,c(i,0)),e.fillStyle=o,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill()}function p(e,t,n,r,a=50,o=c(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 m(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 h(e,t,n,r,a=c(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 g({visible:e,x:r,y:a,content:o,parentW:s}){let c=(0,t.useRef)(null);if((0,t.useLayoutEffect)(()=>{let t=c.current;if(!t)return;let n=t.offsetWidth,l=r-n/2,u=a-58;l<4&&(l=4),l+n>(s??400)-4&&(l=(s??400)-n-4),u<4&&(u=a+16),t.style.transform=`translate(${l}px, ${u}px)`,t.style.opacity=e?`1`:`0`;let d=o&&typeof o==`object`&&o.color?o.color:i.blue;t.style.setProperty(`--tooltip-accent`,d??i.blue)},[e,r,a,s,o]),!o)return null;let l=typeof o==`object`,u=l?o.label:null,d=l?o.value:o,f=l?o.sublabel:null;return(0,n.jsxs)(`div`,{ref:c,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:[u&&(0,n.jsx)(`div`,{style:{fontSize:12,fontWeight:400,color:i.t2,marginBottom:3,whiteSpace:`nowrap`,lineHeight:`18px`},children:u}),(0,n.jsx)(`div`,{style:{fontSize:14,fontWeight:500,color:i.t1,whiteSpace:`nowrap`,lineHeight:`20px`},children:d}),f&&(0,n.jsx)(`div`,{style:{fontSize:12,fontWeight:400,color:`var(--tooltip-accent)`,marginTop:3,whiteSpace:`nowrap`,lineHeight:`18px`},children:f})]})}function _(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=(0,t.useRef)(null),[u,d]=(0,t.useState)({visible:!1,x:0,y:0,content:null}),f=(0,t.useCallback)((e,t,n)=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{d({visible:!0,x:e,y:t,content:n})},30)},[]),p=(0,t.useCallback)(()=>{l.current&&clearTimeout(l.current),d(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 u=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,d=c.current;for(let e=d.length-1;e>=0;e--)if(d[e].test(o.current.x,o.current.y)){u=d[e];break}let m=s.current;s.current=u?u.id:null,t.style.cursor=u?`pointer`:`default`,u?f((e.clientX-i.left)*a,(e.clientY-i.top)*l,u.data):m&&p()},d=()=>{o.current={x:-1,y:-1,over:!1},s.current&&(s.current=null,t.style.cursor=`default`,p())},m=()=>{if(s.current&&i){let e=c.current.find(e=>e.id===s.current);e&&i(e.id,e.data)}};return t.addEventListener(`mousemove`,u),t.addEventListener(`mouseleave`,d),t.addEventListener(`click`,m),()=>{t.removeEventListener(`mousemove`,u),t.removeEventListener(`mouseleave`,d),t.removeEventListener(`click`,m),l.current&&clearTimeout(l.current)}},[e,n,r,a,i,f,p]),{mouseRef:o,hoveredRef:s,tooltip:u,showTooltip:f,hideTooltip:p,hitZonesRef:c}}function v(e,t,n,r,i,a){e.push({id:t,data:a,test:(e,t)=>(e-n)**2+(t-r)**2<=i*i})}function y(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 b=e=>1-(1-e)**3,x=e=>1-(1-e)**4,S=e=>e===1?1:1-2**(-10*e),C=e=>{let t=1.70158;return 1+(t+1)*(e-1)**3+t*(e-1)**2},w=(e,t=.04,n=.001)=>Math.sin(e*t)*Math.exp(-Math.min(e*n,4)),T=(e,t,n,r=b)=>{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 E(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 D=760,O=250;function k({rows:e=[],variant:a,className:o,colors:s}){let l=(0,t.useRef)(null),u=(0,t.useRef)(new Map),p=(0,t.useRef)(0),{mouseRef:m,hoveredRef:y,tooltip:b,hitZonesRef:x}=_(l,{width:D,height:O});return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=d(t,D,O);p.current=0;let r=s?.line??i.blue,o=s?.point??i.blue,g=s?.axisLine??i.bd,_=s?.areaFill??i.blue,b={top:24,right:24,bottom:44,left:24},C=D-b.left-b.right,T=O-b.top-b.bottom,k,A=()=>{p.current++;let t=p.current;if(n.clearRect(0,0,D,O),e.length<2){k=requestAnimationFrame(A);return}let s=e.map(e=>e.pricing??0),l=Math.max(100,...s),d=t=>b.left+t/(e.length-1)*C,j=e=>b.top+(1-e/l)*T,M=S(Math.min(t/48,1)),ee=Math.max(2,Math.floor(M*e.length));E(u.current,y.current),x.current=[],n.strokeStyle=c(i.bd,.2),n.lineWidth=.5;for(let e=0;e<=4;e++){let t=b.top+e/4*T;n.beginPath(),n.moveTo(b.left,t),n.lineTo(b.left+C,t),n.stroke()}if(n.strokeStyle=c(g,.4),n.lineWidth=1,n.setLineDash([]),n.beginPath(),n.moveTo(b.left,j(0)),n.lineTo(b.left+C,j(0)),n.stroke(),m.current.over&&y.current){let e=parseInt(y.current.split(`-`)[1]);isNaN(e)||h(n,d(e),b.top,b.top+T)}if(a===`area`&&ee>1){let t=n.createLinearGradient(0,b.top,0,b.top+T);t.addColorStop(0,c(_,.12)),t.addColorStop(1,c(_,0)),n.fillStyle=t,n.beginPath(),n.moveTo(d(0),b.top+T);for(let t=0;t<ee;t++)n.lineTo(d(t),j(e[t].pricing??0));n.lineTo(d(ee-1),b.top+T),n.closePath(),n.fill()}if(ee>1){n.strokeStyle=c(r,.85),n.lineWidth=2,n.setLineDash([]),n.beginPath();for(let t=0;t<ee;t++){let r=d(t),i=j(e[t].pricing??0);t===0?n.moveTo(r,i):n.lineTo(r,i)}n.stroke()}for(let r=0;r<ee;r++){let s=d(r),l=j(e[r].pricing??0),p=`sc-${r}`,m=u.current.get(p)??0,h=r===e.length-1;v(x.current,p,s,l,12,{label:e[r].vendor,value:String(e[r].pricing??0),color:h?i.red:o}),m>0&&f(n,s,l,16*m,o,.2*m);let g=h?w(t,.05,5e-4):0,_=a===`area`?5:6;h?(n.shadowColor=c(i.red,.5),n.shadowBlur=(8+g*4)*(1+m*.5),n.fillStyle=i.red,n.beginPath(),n.arc(s,l,(_+g*1.5)*(1+m*.3),0,Math.PI*2),n.fill(),n.shadowBlur=0):(n.fillStyle=c(o,.7+m*.3),n.beginPath(),n.arc(s,l,_+m*2,0,Math.PI*2),n.fill()),n.font=`10px 'JetBrains Mono', monospace`,n.fillStyle=c(i.t3,.6+m*.3),n.textAlign=`center`,n.fillText(e[r].vendor,s,O-14)}k=requestAnimationFrame(A)};return A(),()=>cancelAnimationFrame(k)},[e,a,s]),(0,n.jsx)(r,{className:o,children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:D,height:O},children:[(0,n.jsx)(`canvas`,{ref:l,role:`img`,"aria-label":`${a} chart`,style:{width:D,height:O,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...b,parentW:D,parentH:O})]})})}function A({rows:e=[],className:t,colors:r}){return(0,n.jsx)(k,{rows:e,variant:`area`,className:t,colors:r})}var j=760,M=280;function ee({rows:e=[],className:o,colors:s}){let l=(0,t.useRef)(null),u=(0,t.useRef)(new Map),p=(0,t.useRef)(0),{hoveredRef:m,tooltip:h,hitZonesRef:v}=_(l,{width:j,height:M});return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=d(t,j,M);p.current=0;let r=s?.bars??a,o=s?.axisLine??i.bd,h=s?.valueLabel??i.t2,g={top:24,right:24,bottom:56,left:24},_=M-g.top-g.bottom,b=(j-g.left-g.right)/Math.max(e.length,1),S=Math.max(100,...e.map(e=>e.pricing??0)),C=g.top+_,w,D=()=>{p.current++;let t=p.current;n.clearRect(0,0,j,M);let a=x(Math.min(t/48,1));E(u.current,m.current),v.current=[],n.strokeStyle=c(o,.4),n.lineWidth=1,n.setLineDash([]),n.beginPath(),n.moveTo(g.left,C),n.lineTo(j-g.right,C),n.stroke(),e.forEach((t,o)=>{let s=g.left+o*b,l=T(a,o,e.length,x),d=S>0?(t.pricing??0)/S*_:0,p=Math.max(d>0?4:0,d*l),m=r[o%r.length],w=u.current.get(t.id??`bar-${o}`)??0;y(v.current,t.id??`bar-${o}`,s+4,C-p,b-8,p,{label:t.vendor,value:String(t.pricing??0),color:m}),p>0&&(w>0&&f(n,s+b/2,C-p/2,b*.8,m,.12*w),n.shadowColor=c(m,.2*(w>0?w:0)),n.shadowBlur=w>0?6:0,n.fillStyle=c(m,.5+w*.25),n.beginPath(),n.roundRect(s+4,C-p,b-8,p,[4,4,0,0]),n.fill(),n.shadowBlur=0,w>0&&(n.strokeStyle=c(m,.4*w),n.lineWidth=1,n.beginPath(),n.roundRect(s+4,C-p,b-8,p,[4,4,0,0]),n.stroke())),l>.5&&p>0&&(n.globalAlpha=Math.min(1,(l-.5)*2),n.font=`bold 10px 'JetBrains Mono', monospace`,n.fillStyle=w>0?m:c(h,.7),n.textAlign=`center`,n.fillText(String(t.pricing??``),s+b/2,C-p-6),n.globalAlpha=1),n.font=`${w>0?`bold `:``}9px 'JetBrains Mono', monospace`,n.fillStyle=w>0?m:c(i.t3,.6),n.textAlign=`center`,n.fillText(t.vendor,s+b/2,M-14)}),w=requestAnimationFrame(D)};return D(),()=>cancelAnimationFrame(w)},[e,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:l,role:`img`,"aria-label":`bar chart`,style:{width:j,height:M,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...h,parentW:j,parentH:M})]})})}function N({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:`#71B941`,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 P=680,F=42,ne=10,re=24,ie=24,ae=8,oe=[i.green,i.blue,i.cyan,i.amber,i.red];function se(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 ce({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),s=(0,t.useRef)(0),l=(0,t.useRef)(new Map),[u,h]=(0,t.useState)(!1),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),x=(0,t.useMemo)(()=>[...y].sort((e,t)=>(t.percentage??0)-(e.percentage??0)),[y]),S=(0,t.useMemo)(()=>u?x:x.slice(0,ae),[x,u]),C=S.length,w=re+ie+C*F+Math.max(0,C-1)*ne,{hoveredRef:T,tooltip:E,hitZonesRef:D}=_(a,{width:P,height:w});return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,P,w);s.current=0;let n=P*.13,r=P*.08,u=P-n-r,h,g=()=>{s.current++;let e=s.current;t.clearRect(0,0,P,w),D.current=[],l.current.forEach((e,t)=>{let n=t===T.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?l.current.delete(t):l.current.set(t,1):l.current.set(t,r)}),T.current&&!l.current.has(T.current)&&l.current.set(T.current,0),p(t,P,w,e,40,c(i.blue,.04)),S.forEach((r,i)=>{let a=oe[i%oe.length],s=l.current.get(r.id)??0,d=re+i*(F+ne);t.fillStyle=c(a,.04+s*.04),t.beginPath(),t.roundRect(n,d,u,F,3),t.fill(),t.strokeStyle=c(a,.08),t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(n,d+F/2),t.lineTo(n+u,d+F/2),t.stroke(),t.setLineDash([]);let p=(r.percentage??0)/100,m=n+u*Math.min(p,p*b(Math.min(1,e*.005)));if(m>n+4){let e=t.createLinearGradient(n,0,m,0);e.addColorStop(0,c(a,.02)),e.addColorStop(1,c(a,.25+s*.15)),t.fillStyle=e,t.beginPath(),t.roundRect(n,d+2,m-n,F-4,2),t.fill()}f(t,m,d+F/2,18+s*8,a,.3+s*.2),t.beginPath(),t.arc(m,d+F/2,5+s*2,0,Math.PI*2),t.fillStyle=c(a,.9),t.fill();let h={label:r.name,value:`${r.percentage??0}% commitment`,sublabel:`Base: ${se(r.base??0)} · Variations: ${se(r.variation??0)}`,color:a};v(D.current,r.id,m,d+F/2,14,h),t.font=`bold `+o.font,t.fillStyle=c(a,.9+s*.1),t.textAlign=`left`,t.textBaseline=`middle`,t.fillText(`${r.percentage??0}%`,m+10,d+F/2),t.font=`${s>0?`bold `:``}`+o.font,t.fillStyle=s>0?a:o.color,t.textAlign=`right`,t.fillText(r.abbreviation??r.name.slice(0,6),n-8,d+F/2)}),t.strokeStyle=c(i.t3,.3),t.lineWidth=1,t.setLineDash([]),t.beginPath(),t.moveTo(n+u,re),t.lineTo(n+u,re+(C-1)*(F+ne)+F),t.stroke(),m(t,P,w,e,.015),h=requestAnimationFrame(g)};return g(),()=>cancelAnimationFrame(h)},[S,w]),x.length===0?(0,n.jsx)(N,{width:P,height:160,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{width:P},children:[(0,n.jsxs)(`div`,{style:{position:`relative`},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Commitment race — contractors ranked by commitment percentage`,style:{width:P,height:w,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...E,parentW:P,parentH:w})]}),y.length>ae&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:u,onToggle:()=>h(e=>!e)})})]})}var le=480,ue=340;function de({value:e,confirmed:r,total:a,"data-testid":s}){let l=(0,t.useRef)(null),u=(0,t.useRef)(0);return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=d(t,le,ue);u.current=0;let s=le/2,p=Math.PI,m=2*Math.PI,h=Math.PI,g,_=()=>{u.current++;let t=u.current;n.clearRect(0,0,le,ue);let l=b(Math.min(t/80,1)),d=C(Math.min(t/72,1));n.beginPath(),n.arc(s,220,120,p,m),n.strokeStyle=c(i.bd,.35),n.lineWidth=46,n.stroke(),[{start:0,end:.33,color:i.red},{start:.33,end:.66,color:i.amber},{start:.66,end:1,color:i.green}].forEach(e=>{let t=p+e.start*h,r=p+e.end*h;n.beginPath(),n.arc(s,220,194/2,t,r),n.strokeStyle=c(e.color,.12),n.lineWidth=42,n.stroke()}),[{label:`Low`,angle:p+.16*h},{label:`Mid`,angle:p+.5*h},{label:`High`,angle:p+.84*h}].forEach(({label:e,angle:t})=>{let r=s+Math.cos(t)*166,a=220+Math.sin(t)*166;n.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=c(i.t2,.55),n.textAlign=`center`,n.fillText(e,r,a+3)});let v=p+e/100*h*l,y=e>=66?i.green:e>=33?i.amber:i.red;f(n,s+Math.cos(v)*194/2,220+Math.sin(v)*194/2,18,y,.35*l),n.beginPath(),n.arc(s,220,194/2,p,v),n.strokeStyle=c(y,.7*l),n.lineWidth=38,n.lineCap=`round`,n.stroke(),n.lineCap=`butt`;let x=p+e/100*h*d,S=s+Math.cos(x)*82,w=220+Math.sin(x)*82,T=s-Math.cos(x)*14,E=220-Math.sin(x)*14;n.strokeStyle=c(y,.18*d),n.lineWidth=6,n.lineCap=`round`,n.beginPath(),n.moveTo(T,E),n.lineTo(S,w),n.stroke(),n.strokeStyle=c(i.t1,.92*d),n.lineWidth=2,n.lineCap=`round`,n.beginPath(),n.moveTo(T,E),n.lineTo(S,w),n.stroke(),n.beginPath(),n.arc(S,w,3,0,Math.PI*2),n.fillStyle=c(y,.9*d),n.fill(),f(n,s,220,20,y,.25*d),n.beginPath(),n.arc(s,220,9,0,Math.PI*2),n.strokeStyle=c(y,.5*d),n.lineWidth=1.5,n.stroke(),n.beginPath(),n.arc(s,220,5,0,Math.PI*2),n.fillStyle=i.t1,n.fill(),l>.5&&(n.globalAlpha=Math.min(1,(l-.5)/.5),n.font=`500 24px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=y,n.textAlign=`center`,n.fillText(`${Math.round(e*d)}%`,s,182),n.globalAlpha=1),l>.7&&(n.globalAlpha=Math.min(1,(l-.7)/.3),n.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=o.color,n.textAlign=`center`,n.fillText(`NCEs confirmed`,s,252),n.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=o.color,n.fillText(`${r} of ${a} NCEs are confirmed compensation events`,s,272),n.globalAlpha=1);for(let e=0;e<=10;e++){let t=p+e/10*h;if(n.strokeStyle=c(i.bd,.5),n.lineWidth=e%5==0?1.5:.8,n.beginPath(),n.moveTo(s+Math.cos(t)*122,220+Math.sin(t)*122),n.lineTo(s+Math.cos(t)*128,220+Math.sin(t)*128),n.stroke(),e%5==0){let r=s+Math.cos(t)*138,a=220+Math.sin(t)*138;n.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=c(i.t3,.45),n.textAlign=`center`,n.fillText(`${e*10}%`,r,a+3)}}g=requestAnimationFrame(_)};return _(),()=>cancelAnimationFrame(g)},[e,r,a]),(0,n.jsx)(`div`,{"data-testid":s,style:{position:`relative`,width:le,height:ue},children:(0,n.jsx)(`canvas`,{ref:l,role:`img`,"aria-label":`Compensation event gauge — ${e}% of NCEs confirmed as compensation events`,style:{width:le,height:ue,display:`block`}})})}function fe(e,n,r,i,a=!0,o={}){let s=(0,t.useRef)(0),{easing:c=b,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 I=780,L=234,pe=130,me=52,he=[i.blue,i.cyan,i.amber,i.purple,i.green],ge=[`Base Value`,`Variations`,`Commitment`],_e=[`Base`,`Var`,`Commit`];function ve({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),{hoveredRef:s,tooltip:l,hitZonesRef:u}=_(a,{width:I,height:L}),d=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),h=(0,t.useMemo)(()=>{let e=Math.max(...d.map(e=>e.base??0)),t=Math.max(...d.map(e=>e.variation??0));return d.map((n,r)=>{let i=I*(.12+r*.19),a=pe,o=Math.min(I*.075,me),s=he[r%he.length],c=[(n.base??0)/(e||1)*100,(n.variation??0)/(t||1)*100,n.percentage??0],l=[`£${n.base??0}M`,`£${n.variation??0}M`,`${n.percentage??0}%`],u=c.map((e,t)=>{let n=-Math.PI/2+t/ge.length*Math.PI*2,r=e/100,s=o*Math.max(.08,r);return{name:ge[t],short:_e[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}})},[d]);return fe(a,I,L,(e,t,n)=>{E(o.current,s.current),u.current=[],p(e,I,L,n,30),h.forEach((t,r)=>{let a=t.color,s=`constellation-${r}`,l=o.current.get(s)??0;e.beginPath(),e.arc(t.cx,t.cy,t.baseR+5,0,Math.PI*2),e.strokeStyle=c(i.bd,.08+.08*l),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=c(a,.04+.03*l),e.fill(),e.strokeStyle=c(a,.15+.1*l),e.lineWidth=.8,e.stroke(),t.stars.forEach((i,s)=>{let l=w(n,.05,5e-4)*.3+.7,d=3.5*l,f=`star-${r}-${s}`,p=o.current.get(f)??0,m=e.createRadialGradient(i.x,i.y,0,i.x,i.y,d*4);m.addColorStop(0,c(a,(.2+.1*p)*l)),m.addColorStop(1,c(a,0)),e.fillStyle=m,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+p*2,0,Math.PI*2),e.fillStyle=c(a,(.8+.2*p)*l),e.fill();let h=Math.sin(i.angle)<-.3;e.textAlign=`center`,e.textBaseline=`middle`,h?(e.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=c(a,.5+.15*p),e.fillText(i.short,i.x,i.y-24),e.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=c(a,.8+.15*p),e.fillText(i.label,i.x,i.y-11)):(e.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=c(a,.5+.15*p),e.fillText(i.short,i.x,i.y+11),e.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=c(a,.8+.15*p),e.fillText(i.label,i.x,i.y+24)),v(u.current,f,i.x,i.y,d*4+2,{label:i.name,value:i.label,sublabel:t.abbreviation??t.name.slice(0,6),color:a})}),l>0&&f(e,t.cx,t.cy,16*l,a,.15*l),e.beginPath(),e.arc(t.cx,t.cy,t.baseR+12,0,Math.PI*2),e.strokeStyle=c(a,.1+w(n,.03,5e-4)*.05),e.lineWidth=1,e.stroke(),e.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.textAlign=`center`,e.textBaseline=`alphabetic`,e.fillStyle=c(i.t2,.65+l*.25),e.fillText(t.abbreviation??t.name.slice(0,6),t.cx,t.cy+t.baseR+26),v(u.current,s,t.cx,t.cy,t.baseR+5,{label:t.name,value:`£${t.total??0}M total`,sublabel:`${t.percentage??0}% committed · scatter ${t.scatter.toFixed(1)}`,color:a})}),e.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillStyle=i.t2,e.fillText(`▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details`,I/2,L-14),m(e,I,L,n,.012)},!0),h.length===0?(0,n.jsx)(N,{width:I,height:L,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:I,height:L},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Contract value breakdown per contractor — multi-KPI constellation chart`,style:{width:I,height:L,display:`block`}}),(0,n.jsx)(g,{...l,parentW:I,parentH:L})]})}var ye=680,be=220,xe=8,Se=[i.blue,i.cyan,i.amber,i.purple,i.green],R={left:8,right:80,top:16,bottom:38},Ce=88,z=18;function we(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 Te({data:e,"data-testid":r}){let a=(0,t.useRef)(null),l=(0,t.useRef)(new Map),[u,d]=(0,t.useState)(!1),{items:p=[],totals:m}=e,h=p.filter(e=>typeof e==`object`&&!!e),v=[...h].sort((e,t)=>(t.total??0)-(e.total??0)),b=u?v:v.slice(0,xe),S=b.length,C=Math.max(...v.map(e=>Math.abs(e.total??0)),1),w=Math.max(be,R.top+R.bottom+S*z+Math.max(0,S-1)*8),D=ye-R.left-Ce-R.right,O=S>1?(w-R.top-R.bottom-S*z)/(S-1):0,k=h.length===0,{hoveredRef:A,tooltip:j,hitZonesRef:M}=_(a,{width:ye,height:w});return fe(a,ye,w,(e,t)=>{E(l.current,A.current),M.current=[],b.forEach((n,r)=>{let a=Se[r%Se.length],s=T(t,r,S,x),u=R.top+r*(z+O),d=R.left+Ce,p=l.current.get(n.id)??0,m=Math.max(n.base??0,0),h=Math.max(n.total??0,0),g=m/C*D*s,_=h/C*D*s,v=_-g;e.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=p>0?a:o.color,e.textAlign=`right`,e.textBaseline=`middle`,e.fillText(n.abbreviation??n.name.slice(0,6),d-8,u+z/2),e.fillStyle=c(i.bd,.25),e.beginPath(),e.roundRect(d,u,D,z,4),e.fill(),g>0&&(p>0&&f(e,d+g/2,u+z/2,g*.3,a,.1*p),e.fillStyle=c(a,.5+p*.15),e.beginPath(),e.roundRect(d,u,g,z,4),e.fill()),v>2&&(e.fillStyle=c(a,.22+p*.08),e.beginPath(),e.roundRect(d+g,u,v,z,[0,4,4,0]),e.fill(),e.setLineDash([2,3]),e.strokeStyle=c(a,.55),e.lineWidth=1,e.beginPath(),e.moveTo(d+g,u+3),e.lineTo(d+g,u+z-3),e.stroke(),e.setLineDash([])),p>0&&_>0&&(e.strokeStyle=c(a,.5*p),e.lineWidth=1,e.setLineDash([]),e.beginPath(),e.roundRect(d,u,_,z,4),e.stroke()),s>.35&&(e.globalAlpha=Math.min(1,(s-.35)/.4),e.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.fillStyle=p>0?a:`#F7F9FA`,e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(we(n.total??0),d+_+6,u+z/2),e.globalAlpha=1),y(M.current,n.id,d,u,Math.max(_,1),z,{label:n.name,value:`${we(n.total??0)} total`,sublabel:`Base ${we(n.base??0)} + Var ${we(n.variation??0)} · ${n.percentage??0}% committed`,color:a})});let n=w-14;e.textBaseline=`middle`,e.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.textAlign=`left`,e.fillStyle=c(i.cyan,.5),e.beginPath(),e.roundRect(R.left+Ce,n-3,14,6,2),e.fill(),e.fillStyle=s.color,e.fillText(`base value`,R.left+Ce+18,n),e.fillStyle=c(i.cyan,.22),e.beginPath(),e.roundRect(R.left+Ce+94,n-3,14,6,2),e.fill(),e.setLineDash([2,3]),e.strokeStyle=c(i.cyan,.5),e.lineWidth=.5,e.beginPath(),e.moveTo(R.left+Ce+101,n-3),e.lineTo(R.left+Ce+101,n+3),e.stroke(),e.setLineDash([]),e.fillStyle=s.color,e.fillText(`approved variations`,R.left+Ce+112,n),e.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,e.textAlign=`right`,e.fillStyle=s.color,e.fillText(`Portfolio: ${we(m?.total??0)}`,ye-8,n)},!0,{easing:x}),k?(0,n.jsx)(N,{width:ye,height:be,message:`No contract data available`,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{width:ye,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:ye,height:w,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...j,parentW:ye,parentH:w})]}),h.length>xe&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:u,onToggle:()=>d(e=>!e)})})]})}var Ee=780,B=240,De=12,Oe=10,ke=[`Highest exposure`,`Elevated risk`,`Moderate exposure`,`Moderate exposure`,`Low exposure`];function Ae({items:e=[],"data-testid":r}){let s=(0,t.useRef)(null),l=(0,t.useRef)(0),u=(0,t.useRef)(new Map),{hoveredRef:p,tooltip:h,hitZonesRef:v}=_(s,{width:Ee,height:B}),b=[...(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e])].sort((e,t)=>(t.count??0)-(e.count??0)).slice(0,5),x=b.reduce((e,t)=>e+(t.count??0),0);return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=d(e,Ee,B);l.current=0;let n=Math.min(5,b.length),r=(Ee-2*De-(n-1)*Oe)/n,h=B*.84,g=B*.08,_,S=()=>{l.current++;let e=l.current;t.clearRect(0,0,Ee,B),v.current=[],u.current.forEach((e,t)=>{let n=t===p.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?u.current.delete(t):u.current.set(t,1):u.current.set(t,r)}),p.current&&!u.current.has(p.current)&&u.current.set(p.current,0),b.forEach((n,s)=>{let l=s===0,d=s===0?i.red:s===1?i.amber:a[s%a.length],p=De+s*(r+Oe),m=u.current.get(n.id)??0,_=m*8,b=p-_/2,S=r+_,C=l?w(e,.04,3e-4)*.06+.06:0;t.fillStyle=c(d,.08+m*.07),t.beginPath(),t.roundRect(b,g,S,h,6),t.fill(),t.strokeStyle=c(d,.2+m*.4+C),t.lineWidth=l?1.5:1,t.stroke(),(m>.01||l)&&f(t,b+S/2,g+h/2,S*.55,d,C+m*.14),t.font=`bold `+o.font,t.textAlign=`left`,t.textBaseline=`top`,t.fillStyle=c(d,.5+m*.35),t.fillText(`#${s+1}`,b+7,g+6);let T=Math.min(r*.28,h*.32,72),E=b+S/2,D=g+h*.38,O=t.createRadialGradient(E,D-T*.2,0,E,D,T);O.addColorStop(0,c(d,.5+m*.2)),O.addColorStop(1,c(d,.2+m*.1)),t.beginPath(),t.arc(E,D,T,0,Math.PI*2),t.fillStyle=O,t.fill(),t.strokeStyle=c(d,.4+m*.3),t.lineWidth=1,t.stroke(),t.font=`bold `+o.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=c(i.t1,.9),t.fillText(n.abbreviation??n.name.slice(0,6),E,D),t.font=`bold 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.textBaseline=`alphabetic`,t.fillStyle=c(d,.9+m*.1),t.fillText(String(n.count??0),E,g+h*.76),t.font=o.font,t.fillStyle=o.color,t.fillText(`open EWs`,E,g+h*.88);let k=Math.round((n.count??0)/(x||1)*100),A=ke[s]??`Low exposure`;y(v.current,n.id,p,g,r,h,{label:n.name,value:`${n.count??0} open · ${k}% of total`,sublabel:`Rank #${s+1} · ${A}`,color:d})}),m(t,Ee,B,e,.015),_=requestAnimationFrame(S)};return S(),()=>cancelAnimationFrame(_)},[b,x]),b.length===0?(0,n.jsx)(N,{width:Ee,height:B,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:Ee,height:B},children:[(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`Contractor rank — open EW count per contractor`,style:{width:Ee,height:B,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...h,parentW:Ee,parentH:B})]})}var V=680,H=260;function je({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(0),s=(0,t.useRef)(new Map),{hoveredRef:l,tooltip:u,hitZonesRef:h}=_(a,{width:V,height:H}),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,V,H);o.current=0;let n=y.length,r=Math.max(...y.map(e=>e.count),1),u=r,g=V*.05,_=H*.1,b=V*.9/n,x=H*.7/u,S=y.reduce((e,t)=>e+t.count,0),C,T=()=>{o.current++;let e=o.current;t.clearRect(0,0,V,H),h.current=[],s.current.forEach((e,t)=>{let n=t===l.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)}),l.current&&!s.current.has(l.current)&&s.current.set(l.current,0),p(t,V,H,e,40,c(i.blue,.04)),y.forEach((n,a)=>{let o=n.count===r,l=o?i.cyan:i.blue,d=s.current.get(`${n.category}-col`)??0;for(let i=0;i<u;i++){let u=g+a*b+b/2,p=_+i*x+x/2,m=Math.min(b,x)*.38;if(i>=r-n.count){let r=m*(1+(w(e,.04,5e-4)+Math.sin(a*.6+i*1.2)*.3)*.12);(o||d>.01)&&f(t,u,p,r*3,l,(o?.2:.1)+d*.1),t.beginPath(),t.arc(u,p,r,0,Math.PI*2),t.fillStyle=c(l,o?.8:.5+d*.2),t.fill();let g=`${n.category}-${i}`;v(h.current,g,u,p,m+4,{label:n.fullName,value:`${n.count} Early Warnings`,sublabel:`${Math.round(n.count/S*100)}% of total`,color:l}),s.current.get(`${n.category}-col`)}else t.beginPath(),t.arc(u,p,1,0,Math.PI*2),t.fillStyle=c(l,.08),t.fill()}let p=_+u*x+16;t.font=`${o?`bold `:``}14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.textAlign=`center`,t.textBaseline=`alphabetic`,t.fillStyle=o?i.cyan:c(i.t2,.65),t.fillText(n.category,g+a*b+b/2,p)}),m(t,V,H,e,.015),C=requestAnimationFrame(T)};return T(),()=>cancelAnimationFrame(C)},[y]),y.length===0?(0,n.jsx)(N,{width:V,height:H,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:V,height:H},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Early Warning count by category — breathing dot grid`,style:{width:V,height:H,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...u,parentW:V,parentH:H})]})}function Me({rows:e=[],className:t,colors:r}){return(0,n.jsx)(k,{rows:e,variant:`line`,className:t,colors:r})}var Ne=[`#4C93D9`,`#5DA537`,`#F3862C`,`#4F72C6`,`#A0B724`,`#EEBF3B`,`#3C45D1`],Pe={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 Fe({rows:e=[],className:t,colors:r}){let i=r?.slices??Ne;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%Ne.length}`,fill:i[a%i.length]})]})}),(0,n.jsx)(`span`,{children:r})]},`${e}-${a}`))})}var Ie=680,U=320;function Le({total:e=0,items:r=[],"data-testid":s}){let l=(0,t.useRef)(null),u=(0,t.useRef)(new Map),p=(0,t.useRef)(0),{hoveredRef:m,tooltip:h,hitZonesRef:y}=_(l,{width:Ie,height:U}),x=(0,t.useMemo)(()=>r.filter(e=>typeof e==`object`&&!!e),[r]);return(0,t.useEffect)(()=>{let t=l.current;if(!t)return;let n=d(t,Ie,U);p.current=0;let r=U/2,s=Ie-80,h=Math.max(...x.map(e=>e.count??0)),g=(U-60)/(x.length-1),_=x.map((e,t)=>({x:s,y:30+t*g})),S,C=()=>{p.current++;let t=p.current;n.clearRect(0,0,Ie,U);let l=b(Math.min(t/72,1));E(u.current,m.current),y.current=[],f(n,88,r,48*l,i.blue,.15*l),x.forEach((t,d)=>{let p=a[d%a.length],m=T(l,d,x.length,b),g=_[d],S=u.current.get(t.id)??0,C=Math.max(1.5,(t.count??0)/h*6);if(m<.01)return;let w=88+(s-88)*.4,E=r,D=88+(s-88)*.6,O=g.y,k=m;n.beginPath();for(let e=0;e<=40;e++){let t=e/40*k,i=(1-t)**3*88+3*(1-t)**2*t*w+3*(1-t)*t**2*D+t**3*g.x,a=(1-t)**3*r+3*(1-t)**2*t*E+3*(1-t)*t**2*O+t**3*g.y;e===0?n.moveTo(i,a):n.lineTo(i,a)}if(n.strokeStyle=c(p,S>0?.8:.45),n.lineWidth=C*(S>0?1.3:1),n.stroke(),m>.85){let r=Math.min(1,(m-.85)/.15),a=4+(t.count??0)/h*12;f(n,g.x,g.y,a*2.5,p,(.25+S*.2)*r),n.beginPath(),n.arc(g.x,g.y,a*r,0,Math.PI*2),n.fillStyle=c(p,(.7+S*.2)*r),n.fill(),v(y.current,t.id,g.x,g.y,a+8,{label:t.name,value:`${t.count??0} NCEs raised`,sublabel:`${Math.round((t.count??0)/e*100)}% of all NCEs`,color:p}),n.globalAlpha=r,n.font=o.font,n.fillStyle=S>0?p:c(i.t2,.85),n.textAlign=`left`,n.fillText(t.abbreviation??t.name.slice(0,6),g.x+a+6,g.y-3),n.font=o.font,n.fillStyle=S>0?p:i.t1,n.fillText(String(t.count??0),g.x+a+6,g.y+10),n.globalAlpha=1}}),n.beginPath(),n.arc(88,r,32*l,0,Math.PI*2),n.fillStyle=i.bgL,n.fill(),n.strokeStyle=c(i.blue,.6*l),n.lineWidth=2,n.stroke(),l>.4&&(n.globalAlpha=Math.min(1,(l-.4)/.4),n.font=`500 24px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.textAlign=`center`,n.fillText(String(e),88,r+5),n.font=o.font,n.fillStyle=o.color,n.fillText(`NCEs`,88,r+18),n.globalAlpha=1),S=requestAnimationFrame(C)};return C(),()=>cancelAnimationFrame(S)},[e,x]),x.length===0?(0,n.jsx)(N,{width:Ie,height:U,"data-testid":s}):(0,n.jsxs)(`div`,{"data-testid":s,style:{position:`relative`,width:Ie,height:U},children:[(0,n.jsx)(`canvas`,{ref:l,role:`img`,"aria-label":`NCE fault tree — NCEs per contractor as branching tree`,style:{width:Ie,height:U,display:`block`}}),(0,n.jsx)(g,{...h,parentW:Ie,parentH:U})]})}var Re=192,ze=Re,Be=Re+80;function Ve({rows:e=[],variant:o,className:s,colors:l}){let p=(0,t.useRef)(null),m=(0,t.useRef)(new Map),h=(0,t.useRef)(0),y=l?.slices??a,{hoveredRef:b,tooltip:x,hitZonesRef:S}=_(p,{width:ze,height:Be});return(0,t.useEffect)(()=>{let t=p.current;if(!t)return;let n=d(t,ze,Be);h.current=0;let r=ze/2,a=Re/2,s=Re*.4,l=o===`donut`?Re*.21:0,g=e.reduce((e,t)=>e+(t.pricing??0),0)||1,_,x=()=>{h.current++;let t=h.current;n.clearRect(0,0,ze,Be);let d=1-(1-Math.min(t/48,1))**3;E(m.current,b.current),S.current=[];let p=-Math.PI/2;e.forEach((e,o)=>{let u=(e.pricing??0)/g,h=u*Math.PI*2*d,_=p+h,b=y[o%y.length],x=m.current.get(e.id??`sl-${o}`)??0,C=p+h/2,T=(s+l)/2,E=r+Math.cos(C)*T,D=a+Math.sin(C)*T,O=(s-l)/2+8;v(S.current,e.id??`sl-${o}`,E,D,O,{label:e.vendor,value:`${e.pricing??0} (${Math.round(u*100)}%)`,color:b}),x>0&&f(n,E,D,O*2*x,b,.2*x);let k=w(t,.03,3e-4),A=s+x*6+(x>0?k*2:0);n.beginPath(),n.moveTo(r+Math.cos(p)*l,a+Math.sin(p)*l),n.arc(r,a,A,p,_),l>0?n.arc(r,a,l,_,p,!0):n.lineTo(r,a),n.closePath(),n.fillStyle=c(b,.7+x*.2),n.fill(),n.strokeStyle=c(i.bg,.8),n.lineWidth=1.5,n.stroke(),p=_}),o===`donut`&&e.length>0&&f(n,r,a,l*.8,i.blue,.06);let C=Re+12;e.forEach((e,t)=>{let r=y[t%y.length],a=(e.pricing??0)/g,o=m.current.get(e.id??`sl-${t}`)??0,s=C+t*18;n.beginPath(),n.arc(8,s,4,0,Math.PI*2),n.fillStyle=c(r,.8+o*.2),n.fill(),n.font=`9px 'JetBrains Mono', monospace`,n.fillStyle=c(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=u(i.t3,r,o),n.textAlign=`right`,n.fillText(`${e.pricing??0} (${Math.round(a*100)}%)`,ze-4,s+3.5)}),_=requestAnimationFrame(x)};return x(),()=>cancelAnimationFrame(_)},[e,o,l,y]),(0,n.jsx)(r,{className:[`canvas-pie-frame`,s].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:ze,height:Be},children:[(0,n.jsx)(`canvas`,{ref:p,role:`img`,"aria-label":`${o} chart`,style:{width:ze,height:Be,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...x,parentW:ze,parentH:Be})]})})}function He(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 Ue({nodes:e,links:o,width:s=960,height:l=280,ariaLabel:u,selectedEntity:p,className:h,colors:b}){let x=(0,t.useRef)(null),S=(0,t.useRef)(new Map),C=(0,t.useRef)(0),T=(0,t.useRef)([]),D=b?.nodes??a,O=b?.links??i.bd,k=b?.activeLinks??i.blue,A=b?.activeNodes??i.blue,j=(0,t.useMemo)(()=>He(e,o,s,l),[e,o,s,l]),{hoveredRef:M,tooltip:ee,hitZonesRef:N}=_(x,{width:s,height:l});return(0,t.useEffect)(()=>{let t=x.current;if(!t)return;let n=d(t,s,l);C.current=0,T.current=[];let r=o.length>0?Math.max(...o.map(e=>e.value)):1,a,u=()=>{C.current++;let t=C.current;n.clearRect(0,0,s,l);let d=1-(1-Math.min(t/56,1))**3;E(S.current,M.current),N.current=[],o.forEach((e,a)=>{let o=j.get(e.source),s=j.get(e.target);if(!o||!s)return;let l=!!p&&(e.source===p||e.target===p),u=l?k:O,f=l?.5:.2,m=Math.max(3,e.value/r*36*d),h=m/2,g=o.x+o.w,_=o.y+o.h/2,y=s.x,b=s.y+s.h/2,x=(g+y)/2;for(let e=0;e<30;e++){let r=e/30,i=(e+1)/30,o=1-r,s=1-i,l=o*o*g+2*o*r*x+r*r*y,d=o*o*_+2*o*r*_+r*r*b,p=s*s*g+2*s*i*x+i*i*y,m=s*s*_+2*s*i*_+i*i*b,v=w(t+r*120+a*40,.025,3e-4)*1.2;n.beginPath(),n.moveTo(l,d-h+v),n.lineTo(p,m-h+v),n.lineTo(p,m+h+v),n.lineTo(l,d+h+v),n.closePath(),n.fillStyle=c(u,f*(.5+r*.5)),n.fill()}v(N.current,`link-${a}`,x,(_+b)/2,m+6,{label:`${e.source} → ${e.target}`,value:String(e.value),color:l?k:i.blue}),Math.random()<.08&&T.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=p===e.id,s=M.current===`node-${r}`,l=S.current.get(`node-${r}`)??0,u=o?A:D[r%D.length];y(N.current,`node-${r}`,a.x,a.y,a.w,a.h,{label:e.name,value:e.valueLabel??e.id,color:u}),(l>0||o)&&f(n,a.x+a.w/2,a.y+a.h/2,a.w*2,u,.2*Math.max(l,o?.6:0));let d=o?w(t,.03,3e-4)*.15:0;n.fillStyle=c(u,.6+l*.25+d),n.beginPath(),n.roundRect(a.x,a.y,a.w,a.h,4),n.fill(),(o||l>0)&&(n.strokeStyle=c(u,.5*Math.max(l,o?1:0)),n.lineWidth=1,n.beginPath(),n.roundRect(a.x,a.y,a.w,a.h,4),n.stroke());let m=a.x+a.w+8;n.font=`${o||s?`bold `:``}10px 'JetBrains Mono', monospace`,n.fillStyle=c(o?u:i.t2,.7+l*.2),n.textAlign=`left`,n.fillText(e.name,m,a.y+a.h/2+4),e.valueLabel&&(n.font=`9px 'JetBrains Mono', monospace`,n.fillStyle=c(u,.5+l*.2),n.fillText(e.valueLabel,m,a.y+a.h/2+17))}),T.current=T.current.filter(e=>{if(e.prog+=e.speed,e.prog>1)return!1;let t=o[e.linkIdx];if(!t)return!1;let r=j.get(t.source),a=j.get(t.target);if(!r||!a)return!1;let s=r.x+r.w,l=r.y+r.h/2,u=a.x,d=a.y+a.h/2,f=(s+u)/2,p=1-e.prog,m=p*p*s+2*p*e.prog*f+e.prog*e.prog*u,h=p*p*l+2*p*e.prog*l+e.prog*e.prog*d+e.off,g=Math.sin(e.prog*Math.PI)*.5,_=b?.links??i.cyan;return n.beginPath(),n.arc(m,h,e.sz,0,Math.PI*2),n.fillStyle=c(_,g),n.fill(),!0}),T.current.length>150&&(T.current=T.current.slice(-150)),m(n,s,l,t,.01),a=requestAnimationFrame(u)};return u(),()=>{cancelAnimationFrame(a),T.current=[]}},[e,o,s,l,p,b,j]),(0,n.jsx)(r,{className:[`canvas-sankey-frame`,h].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{role:`img`,"aria-label":u,style:{position:`relative`,width:s,height:l},children:[(0,n.jsx)(`canvas`,{ref:x,style:{width:s,height:l,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...ee,parentW:s,parentH:l})]})})}var We=[{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}],Ge=[i.blue,i.cyan,i.orange,i.red,i.purple,i.green,i.amber,i.t2],Ke=[26,24,24,26,22,22,22,22];function qe(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 Je(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 Ye(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 Xe({nodes:e,links:r,width:a=960,height:o=280,selectedEntity:s}){let l=(0,t.useRef)(null),h=(0,t.useRef)(0),y=(0,t.useRef)([]),{hoveredRef:x,tooltip:S,hitZonesRef:C}=_(l,{width:a,height:o}),T=(0,t.useMemo)(()=>{let t=new Map;return e.forEach((e,n)=>t.set(e.id,n)),t},[e]),E=(0,t.useMemo)(()=>r.length>0?Math.max(...r.map(e=>e.value)):100,[r]),D=e=>E>1?e/100:e,O=(0,t.useMemo)(()=>e.map((e,t)=>{let n=We[t%We.length];return{id:e.id,label:e.name,sub:e.valueLabel??``,x:n.x*a,y:n.y*o,r:Ke[t%Ke.length],color:Ge[t%Ge.length]}}),[e,a,o]),k=(0,t.useMemo)(()=>r.map(e=>({fromIdx:T.get(e.source)??-1,toIdx:T.get(e.target)??-1,conf:D(e.value)})).filter(e=>e.fromIdx>=0&&e.toIdx>=0),[r,T]);return(0,t.useEffect)(()=>{let e=l.current;if(!e)return;let t=d(e,a,o);h.current=0,y.current=[];let n,r=()=>{h.current++;let e=h.current;if(t.clearRect(0,0,a,o),C.current=[],p(t,a,o,e,50,c(i.blue,.05)),k.forEach((e,n)=>{let r=O[e.fromIdx],a=O[e.toIdx];if(!r||!a)return;let o=!!s&&(r.id===s||a.id===s),l=u(r.color,a.color,.5),d=o?.18:.05,f=o?.25:.1,p=Ye(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=c(l,d),t.lineWidth=16,t.lineCap=`round`,t.stroke(),t.strokeStyle=c(l,f),t.lineWidth=1.5,t.stroke();for(let t=0;t<e.conf*2.5;t++)Math.random()<.45&&y.current.push({edgeIdx:n,t:0,speed:.003+Math.random()*.004,off:(Math.random()-.5)*13,sz:.7+Math.random()*2});let m=qe(p,.5),h=`${Math.round(e.conf*100)}%`;t.font=`bold 12px 'JetBrains Mono', monospace`,t.textBaseline=`middle`;let g=t.measureText(h).width+14;t.fillStyle=`rgba(10,16,24,0.88)`,t.beginPath(),t.roundRect(m.x-g/2,m.y-11,g,22,6),t.fill(),t.strokeStyle=c(i.cyan,.25),t.lineWidth=1,t.stroke(),t.fillStyle=c(i.cyan,.9),t.textAlign=`center`,t.fillText(h,m.x,m.y)}),y.current=y.current.filter(e=>{if(e.t+=e.speed,e.t>1)return!1;let n=k[e.edgeIdx];if(!n)return!1;let r=O[n.fromIdx],i=O[n.toIdx];if(!r||!i)return!1;let a=Ye(r,i),o=qe(a,e.t),s=Je(a,e.t),l=o.x+s.x*e.off,d=o.y+s.y*e.off,p=Math.sin(e.t*Math.PI)*.7,m=u(r.color,i.color,e.t);return f(t,l,d,e.sz*3,m,p*.1),t.beginPath(),t.arc(l,d,e.sz,0,Math.PI*2),t.fillStyle=c(m,p),t.fill(),!0}),y.current.length>350&&(y.current=y.current.slice(-350)),O.forEach((n,r)=>{let a=s===n.id,o=x.current===`node-${r}`,l=w(e,.03,3e-4)*.1+1,u=n.r*l*(a?1.15:1);t.beginPath(),t.arc(n.x,n.y,u+6,0,Math.PI*2),t.strokeStyle=c(n.color,a?.3:.1),t.lineWidth=a?1.5:.7,t.stroke(),f(t,n.x,n.y,u*3,n.color,a?.22:.12);let d=t.createRadialGradient(n.x,n.y-u*.2,0,n.x,n.y,u);if(d.addColorStop(0,c(n.color,a?1:.85)),d.addColorStop(1,c(n.color,a?.65:.45)),t.fillStyle=d,t.beginPath(),t.arc(n.x,n.y,u,0,Math.PI*2),t.fill(),a||r===O.length-1){let r=u+16,i=e*.04,a=n.x+Math.cos(i)*r,o=n.y+Math.sin(i)*r;f(t,a,o,6,n.color,.3),t.beginPath(),t.arc(a,o,2,0,Math.PI*2),t.fillStyle=c(n.color,.75),t.fill()}v(C.current,`node-${r}`,n.x,n.y,u+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=c(n.color,a?1:.9),t.fillText(n.label,n.x,n.y+u+18),n.sub&&(t.font=`10px 'JetBrains Mono', monospace`,t.fillStyle=c(i.t3,.65),t.fillText(n.sub,n.x,n.y+u+32))}),k.length>=2){let n=k.reduce((e,t)=>e*t.conf,1),r=o*.92,s=a*.12,l=a*.76,u=b(Math.min(e*.008,1));t.fillStyle=c(i.bd,.35),t.beginPath(),t.roundRect(s,r,l,5,3),t.fill(),t.fillStyle=c(i.orange,.6),t.beginPath(),t.roundRect(s,r,l*n*u,5,3),t.fill(),t.font=`bold 12px 'JetBrains Mono', monospace`,t.textAlign=`left`,t.textBaseline=`middle`,t.fillStyle=c(i.orange,.85),t.fillText(`${Math.round(n*100)}% compound confidence`,s+l*n*u+10,r+2);let d=k.map(e=>e.conf.toFixed(2)).join(` × `);t.textAlign=`right`,t.font=`9px 'JetBrains Mono', monospace`,t.fillStyle=c(i.t4,.6),t.fillText(d,s-6,r+2)}m(t,a,o,e,.012),n=requestAnimationFrame(r)};return r(),()=>{cancelAnimationFrame(n),y.current=[]}},[O,k,a,o,s]),(0,n.jsxs)(`div`,{style:{position:`relative`,width:a,height:o},children:[(0,n.jsx)(`canvas`,{ref:l,style:{width:a,height:o,display:`block`,borderRadius:8},role:`img`,"aria-label":`causal flow diagram`}),(0,n.jsx)(g,{...S,parentW:a,parentH:o})]})}function Ze({selectedEntity:e,colors:t}){return(0,n.jsx)(Xe,{nodes:Pe.nodes,links:Pe.links,width:960,height:280,selectedEntity:e})}function Qe({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)(Ue,{nodes:a,links:o,width:760,height:280,ariaLabel:`sankey chart`,className:r,colors:i})}var $e=500,et=320;function tt({left:e,right:r,"data-testid":a}){let s=(0,t.useRef)(null),l=(0,t.useRef)(0);return(0,t.useEffect)(()=>{let t=s.current;if(!t)return;let n=d(t,$e,et);l.current=0;let a=$e/2,u=Math.max(e.value,r.value),p=(e.value-r.value)/u*14,m,h=()=>{l.current++;let t=l.current;n.clearRect(0,0,$e,et);let s=b(Math.min(t/80,1)),d=p*C(Math.min(t/80,1))*Math.PI/180;n.strokeStyle=c(i.bd,.5*s),n.lineWidth=2,n.beginPath(),n.moveTo(a,100),n.lineTo(a,et-80),n.stroke(),n.beginPath(),n.arc(a,100,5*s,0,Math.PI*2),n.fillStyle=i.t2,n.fill();let g={x:a-Math.cos(d)*160,y:100+Math.sin(-d)*160},_={x:a+Math.cos(d)*160,y:100+Math.sin(d)*160};n.strokeStyle=c(i.t2,.5*s),n.lineWidth=2,n.beginPath(),n.moveTo(g.x,g.y),n.lineTo(_.x,_.y),n.stroke();let v=Math.max(20,e.value/u*100*s),y=g.y+18;f(n,g.x,y+v/2,90*.5,i.green,.18*s),n.fillStyle=c(i.green,.5*s),n.beginPath(),n.roundRect(g.x-90/2,y,90,v,[0,0,6,6]),n.fill(),n.strokeStyle=c(i.green,.7*s),n.lineWidth=1.5,n.stroke(),n.strokeStyle=c(i.t3,.35*s),n.lineWidth=1,[-90/3,90/3].forEach(e=>{n.beginPath(),n.moveTo(g.x+e,g.y+4),n.lineTo(g.x+e,y),n.stroke()}),s>.5&&(n.globalAlpha=Math.min(1,(s-.5)/.5),n.font=`bold 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.green,n.textAlign=`center`,n.fillText(e.label,g.x,y+v+18),n.font=o.font,n.fillStyle=o.color,n.fillText(`Accepted`,g.x,y+v+32),n.fillText(`${e.count} quotations`,g.x,y+v+44),n.globalAlpha=1);let x=Math.max(20,r.value/u*100*s),S=_.y+18;n.fillStyle=c(i.amber,.3*s),n.strokeStyle=c(i.amber,.5*s),n.lineWidth=1.5,n.beginPath(),n.roundRect(_.x-90/2,S,90,x,[0,0,6,6]),n.fill(),n.stroke(),n.strokeStyle=c(i.t3,.35*s),n.lineWidth=1,[-90/3,90/3].forEach(e=>{n.beginPath(),n.moveTo(_.x+e,_.y+4),n.lineTo(_.x+e,S),n.stroke()}),s>.5&&(n.globalAlpha=Math.min(1,(s-.5)/.5),n.font=`bold 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.amber,n.textAlign=`center`,n.fillText(r.label,_.x,S+x+18),n.font=o.font,n.fillStyle=o.color,n.fillText(`Submitted`,_.x,S+x+32),n.fillText(`${r.count} quotations`,_.x,S+x+44),n.globalAlpha=1),s>.85&&Math.abs(p)>1&&(n.globalAlpha=Math.min(1,(s-.85)/.15)*.6,n.font=o.font,n.fillStyle=o.color,n.textAlign=`center`,n.fillText(`${Math.abs(p).toFixed(1)}° tilt toward accepted`,a,et-12),n.globalAlpha=1),m=requestAnimationFrame(h)};return h(),()=>cancelAnimationFrame(m)},[e,r]),(0,n.jsx)(`div`,{"data-testid":a,style:{position:`relative`,width:$e,height:et},children:(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`Quotation balance — accepted vs submitted quotation value`,style:{width:$e,height:et,display:`block`}})})}var nt=680,W=280;function rt({points:e=[],"data-testid":r}){let a=(0,t.useRef)(null),s=(0,t.useRef)(new Map),l=(0,t.useRef)(0),{hoveredRef:u,tooltip:p,hitZonesRef:m}=_(a,{width:nt,height:W}),y=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,nt,W);l.current=0;let n=nt-54-28,r=W-30-54,p=Math.max(...y.map(e=>e.count),1),g=y.length,_=g>1?n/(g-1):n,x=y.map((e,t)=>({x:54+t*_,y:30+r-e.count/p*r,point:e})),S,C=()=>{l.current++;let e=l.current;t.clearRect(0,0,nt,W);let a=b(Math.min(e/72,1));E(s.current,u.current),m.current=[],[.25,.5,.75,1].forEach(e=>{let a=30+r-e*r;t.strokeStyle=c(i.bd,.18),t.lineWidth=1,t.setLineDash([3,5]),t.beginPath(),t.moveTo(54,a),t.lineTo(54+n,a),t.stroke(),t.setLineDash([]),t.font=o.font,t.fillStyle=o.color,t.textAlign=`right`,t.fillText(String(Math.round(p*e)),48,a+3)}),t.save(),t.translate(12,30+r/2),t.rotate(-Math.PI/2),t.font=o.font,t.fillStyle=o.color,t.textAlign=`center`,t.fillText(`Submissions`,0,0),t.restore(),t.font=o.font,t.fillStyle=o.color,t.textAlign=`center`,t.fillText(`Week`,54+n/2,W-6),t.strokeStyle=c(i.bd,.3),t.lineWidth=1,t.setLineDash([]),t.beginPath(),t.moveTo(54,30+r),t.lineTo(54+n,30+r),t.stroke();let d=a*(g-1),_=Math.floor(d)+1;if(_>=2){t.beginPath(),t.moveTo(x[0].x,30+r),t.lineTo(x[0].x,x[0].y);for(let e=1;e<_;e++){let n=d-Math.floor(d),r=e<_-1?x[e].x:x[e-1].x+(x[e].x-x[e-1].x)*(e===Math.ceil(d)?n:1),i=e<_-1?x[e].y:x[e-1].y+(x[e].y-x[e-1].y)*(e===Math.ceil(d)?n:1);t.lineTo(r,i)}let e=x[Math.min(_-1,g-1)];t.lineTo(e.x,30+r),t.closePath();let n=t.createLinearGradient(0,30,0,30+r);n.addColorStop(0,c(i.cyan,.22)),n.addColorStop(1,c(i.cyan,.02)),t.fillStyle=n,t.fill()}t.beginPath();for(let e=0;e<_;e++){let n=d-Math.floor(d),r=e===_-1&&e>0&&e===Math.ceil(d),i=e===0||e<_-1?x[e].x:x[e-1].x+(x[e].x-x[e-1].x)*(r?n:1),a=e===0||e<_-1?x[e].y:x[e-1].y+(x[e].y-x[e-1].y)*(r?n:1);e===0?t.moveTo(i,a):t.lineTo(i,a)}t.strokeStyle=c(i.cyan,.85),t.lineWidth=2,t.stroke(),x.forEach((e,n)=>{if(n>=_)return;let a=`pt-${n}`,l=s.current.get(a)??0;v(m.current,a,e.x,e.y,10,{label:e.point.week,value:`${e.point.count} quotations submitted`,sublabel:`£${e.point.value}M value`,color:i.cyan}),l>0&&h(t,e.x,30,30+r,c(i.cyan,.15*l));let u=e.point.count===p;(l>0||u)&&f(t,e.x,e.y,14,i.cyan,(u?.3:0)+l*.25),t.beginPath(),t.arc(e.x,e.y,l>0?5:3.5,0,Math.PI*2),t.fillStyle=c(i.cyan,l>0?1:.8),t.fill(),(l>0||u)&&(t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=i.cyan,t.textAlign=`center`,t.fillText(String(e.point.count),e.x,e.y-10)),t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=l>0?i.cyan:o.color,t.textAlign=`center`,t.fillText(e.point.week,e.x,W-54+14)}),S=requestAnimationFrame(C)};return C(),()=>cancelAnimationFrame(S)},[y]),y.length<2?(0,n.jsx)(N,{width:nt,height:W,"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:nt,height:W},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Trend chart — count over time`,style:{width:nt,height:W,display:`block`}}),(0,n.jsx)(g,{...p,parentW:nt,parentH:W})]})})}var it=680,G=280,at=54,ot=28,st=64,ct=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,lt=12;function ut({points:e=[],"data-testid":r}){let a=(0,t.useRef)(null),s=(0,t.useRef)(null),l=(0,t.useRef)(0),u=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),f=(0,t.useMemo)(()=>{if(u.length<=1)return st;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return st;e.font=ct;let t=Math.max(...u.map(t=>e.measureText(t.week).width));return Math.max(st,t+lt)},[u]),p=Math.max(it-at,ot+Math.max(0,u.length-1)*f),{tooltip:m,hitZonesRef:h}=_(a,{width:p,height:G});return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,p,G),n=s.current?d(s.current,at,G):null;l.current=0;let r=p-ot,m=G-30-54,g=Math.max(...u.map(e=>e.count),1),_=u.length,y=_>1?Math.max(r/(_-1),f):r,x=u.map((e,t)=>({x:t*y,y:30+m-e.count/g*m,point:e}));n&&(n.clearRect(0,0,at,G),n.fillStyle=i.bg,n.fillRect(0,0,at,G),[.25,.5,.75,1].forEach(e=>{let t=30+m-e*m;n.font=o.font,n.fillStyle=o.color,n.textAlign=`right`,n.fillText(String(Math.round(g*e)),at-6,t+3)}),n.save(),n.translate(12,30+m/2),n.rotate(-Math.PI/2),n.font=o.font,n.fillStyle=o.color,n.textAlign=`center`,n.fillText(`Count`,0,0),n.restore());let S,C=()=>{l.current++;let e=Math.min(l.current/72,1),n=b(e);t.clearRect(0,0,p,G),[.25,.5,.75,1].forEach(e=>{let n=30+m-e*m;t.strokeStyle=c(i.bd,.18),t.lineWidth=1,t.setLineDash([3,5]),t.beginPath(),t.moveTo(0,n),t.lineTo(r,n),t.stroke(),t.setLineDash([])}),t.font=o.font,t.fillStyle=o.color,t.textAlign=`center`,t.fillText(`Period`,r/2,G-6),t.strokeStyle=c(i.bd,.3),t.lineWidth=1,t.beginPath(),t.moveTo(0,30+m),t.lineTo(r,30+m),t.stroke();let a=n*(_-1),s=Math.floor(a)+1;if(s>=2){t.beginPath(),t.moveTo(x[0].x,30+m),t.lineTo(x[0].x,x[0].y);for(let e=1;e<s;e++){let n=a-Math.floor(a),r=e===s-1&&e===Math.ceil(a),i=r?x[e-1].x+(x[e].x-x[e-1].x)*n:x[e].x,o=r?x[e-1].y+(x[e].y-x[e-1].y)*n:x[e].y;t.lineTo(i,o)}t.lineTo(x[s-1].x,30+m),t.closePath();let e=t.createLinearGradient(0,30,0,30+m);e.addColorStop(0,c(i.cyan,.22)),e.addColorStop(1,c(i.cyan,.02)),t.fillStyle=e,t.fill()}t.beginPath();for(let e=0;e<s;e++){let n=a-Math.floor(a),r=e===s-1&&e>0&&e===Math.ceil(a),i=r?x[e-1].x+(x[e].x-x[e-1].x)*n:x[e].x,o=r?x[e-1].y+(x[e].y-x[e-1].y)*n:x[e].y;e===0?t.moveTo(i,o):t.lineTo(i,o)}t.strokeStyle=c(i.cyan,.85),t.lineWidth=2,t.stroke(),h.current=[],x.forEach((e,n)=>{n>=s||(v(h.current,`pt-${n}`,e.x,e.y,10,{label:e.point.week,value:`${e.point.count} submissions`,sublabel:`£${e.point.value}M value`,color:i.cyan}),t.beginPath(),t.arc(e.x,e.y,3.5,0,Math.PI*2),t.fillStyle=c(i.cyan,.8),t.fill(),t.font=ct,t.fillStyle=o.color,t.textAlign=`center`,t.fillText(e.point.week,e.x,G-54+14))}),e<1&&(S=requestAnimationFrame(C))};return C(),()=>cancelAnimationFrame(S)},[u,p,f,h]),u.length<2?(0,n.jsx)(N,{width:it,height:G,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:`100%`,display:`flex`},children:[(0,n.jsx)(`canvas`,{ref:s,"aria-hidden":`true`,style:{width:at,height:G,display:`block`,flexShrink:0}}),(0,n.jsx)(`div`,{className:`trend-scroll`,style:{flex:1,overflowX:`auto`},children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:p,height:G},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Trend chart — count over time`,style:{width:p,height:G,display:`block`}}),(0,n.jsx)(g,{...m,parentW:p,parentH:G})]})})]})}var K=680,dt=240,ft={Critical:i.red,High:i.orange,Medium:i.amber,Low:i.green};function pt({severities:e=[],"data-testid":r}){let a=(0,t.useRef)(null),s=(0,t.useRef)(new Map),l=(0,t.useRef)(0),{hoveredRef:u,tooltip:p,hitZonesRef:m}=_(a,{width:K,height:dt}),h=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,K,dt);l.current=0;let n=h.reduce((e,t)=>e+t.count,0),r=K-28-28,p=dt-50-52,g=h.map(e=>e.count/n*r),_,v=()=>{l.current++;let e=l.current;t.clearRect(0,0,K,dt);let a=x(Math.min(e/60,1));E(s.current,u.current),m.current=[],t.strokeStyle=c(i.bd,.2),t.lineWidth=1,t.beginPath(),t.rect(28,50,r,p),t.stroke(),t.strokeStyle=c(i.t4,.15),t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(K/2,50),t.lineTo(K/2,50+p),t.stroke(),t.setLineDash([]);let d=28;h.forEach((e,r)=>{let l=ft[e.severity]??i.blue,u=g[r];u*a;let h=s.current.get(e.severity)??0,_=d+u/2,v=u*.85;_-v/2;let b=u*a,x=v*a,S=_-x/2;if(b>0&&(h>0&&f(t,d+b/2,50+p/2,b*.4,l,.15*h),t.beginPath(),t.moveTo(S,50),t.lineTo(S+x,50),t.lineTo(d+b,50+p),t.lineTo(d,50+p),t.closePath(),t.fillStyle=c(l,.45+h*.25),t.fill(),t.strokeStyle=c(l,(.5+h*.3)*a),t.lineWidth=h>0?2:1,t.beginPath(),t.moveTo(S,50),t.lineTo(S+x,50),t.stroke(),t.strokeStyle=c(l,(.3+h*.3)*a),t.lineWidth=h>0?2:1,t.beginPath(),t.moveTo(d,50+p),t.lineTo(d+b,50+p),t.stroke()),y(m.current,e.severity,d,50,u,p,{label:e.severity,value:`${e.count} Early Warnings`,sublabel:`${Math.round(e.count/n*100)}% of all EWs`,color:l}),a>.5){let r=Math.min(1,(a-.5)/.5),s=d+u/2;t.globalAlpha=r,t.font=`bold `+o.font,t.fillStyle=h>0?l:c(l,.9),t.textAlign=`center`,t.fillText(e.severity,s,38),t.font=`bold `+o.font,t.fillStyle=h>0?i.t1:c(i.t1,.85),t.fillText(String(e.count),s,50+p/2+6),t.font=o.font,t.fillStyle=h>0?l:o.color,t.fillText(`${Math.round(e.count/n*100)}%`,s,50+p+18),t.globalAlpha=1}d+=u});let b=t.createLinearGradient(28,0,28+r,0);b.addColorStop(0,c(i.red,.03)),b.addColorStop(.33,c(i.orange,.03)),b.addColorStop(.66,c(i.amber,.03)),b.addColorStop(1,c(i.green,.03)),t.fillStyle=b,t.fillRect(28,50,r*a,p),_=requestAnimationFrame(v)};return v(),()=>cancelAnimationFrame(_)},[h]),h.length===0?(0,n.jsx)(N,{width:K,height:dt,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:K,height:dt},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Early Warning severity distribution — prism spectrum bands`,style:{width:K,height:dt,display:`block`}}),(0,n.jsx)(g,{...p,parentW:K,parentH:dt})]})}var q=460,J=300,mt={Open:i.red,Submitted:i.amber,Closed:i.green};function ht({segments:e=[],title:r,"data-testid":a}){let s=(0,t.useRef)(null),l=(0,t.useRef)(0),u=(0,t.useRef)(new Map),{hoveredRef:h,tooltip:y,hitZonesRef:b}=_(s,{width:q,height:J}),x=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]);return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=d(e,q,J);l.current=0;let n=q*.5,r=J*.54,a=q*.22,g=x.reduce((e,t)=>e+t.count,0),_=Math.max(...x.map(e=>e.count),1),y,S=()=>{l.current++;let e=l.current;t.clearRect(0,0,q,J),b.current=[],u.current.forEach((e,t)=>{let n=t===h.current?1:0,r=e+(n-e)*.12;Math.abs(r-n)<.005?n===0?u.current.delete(t):u.current.set(t,1):u.current.set(t,r)}),h.current&&!u.current.has(h.current)&&u.current.set(h.current,0),p(t,q,J,e,40,c(i.blue,.04)),x.forEach((s,l)=>{let u=l/3*Math.PI*2-Math.PI/2,d=n+Math.cos(u)*a,p=r+Math.sin(u)*a,m=mt[s.status]??i.blue,h=2+s.count/_*8;t.beginPath(),t.moveTo(n,r),t.lineTo(d,p),t.strokeStyle=c(m,.08),t.lineWidth=h*2,t.stroke(),t.beginPath(),t.moveTo(n,r),t.lineTo(d,p),t.strokeStyle=c(m,.25),t.lineWidth=1,t.stroke();let g=(e*.005+l*.33)%1,v=n+(d-n)*g,y=r+(p-r)*g;f(t,v,y,6,m,.4),t.beginPath(),t.arc(v,y,2,0,Math.PI*2),t.fillStyle=c(m,.8),t.fill();let b=(n+d)/2,x=(r+p)/2;t.font=`bold `+o.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=c(m,.85),t.fillText(String(s.count),b,x)}),x.forEach((e,s)=>{let l=s/3*Math.PI*2-Math.PI/2,d=n+Math.cos(l)*a,p=r+Math.sin(l)*a,m=mt[e.status]??i.blue,h=10+e.count/_*18,y=u.current.get(e.status)??0;f(t,d,p,h*2.5,m,.2+y*.15);let x=t.createRadialGradient(d,p-h*.2,0,d,p,h);x.addColorStop(0,c(m,.8+y*.2)),x.addColorStop(1,c(m,.4+y*.1)),t.beginPath(),t.arc(d,p,h,0,Math.PI*2),t.fillStyle=x,t.fill(),t.font=`bold `+o.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=c(i.t1,.9),t.fillText(e.status,d,p),v(b.current,e.status,d,p,h+6,{label:e.status,value:`${e.count} Early Warnings`,sublabel:`${Math.round(e.count/g*100)}%`,color:m})});let s=u.current.get(`center`)??0;f(t,n,r,36,i.t3,.2+s*.15);let d=t.createRadialGradient(n,r-4,0,n,r,22);d.addColorStop(0,c(i.t2,.9)),d.addColorStop(1,c(i.t3,.5)),t.beginPath(),t.arc(n,r,22,0,Math.PI*2),t.fillStyle=d,t.fill(),t.font=o.font,t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=c(i.t1,.9),t.fillText(`EW Status`,n,r-4),t.font=`bold `+o.font,t.fillStyle=i.t1,t.fillText(String(g),n,r+8),v(b.current,`center`,n,r,28,{label:`Total EW Status`,value:`${g} Early Warnings`,color:i.t3}),m(t,q,J,e,.015),y=requestAnimationFrame(S)};return S(),()=>cancelAnimationFrame(y)},[x,r]),x.length===0?(0,n.jsx)(N,{width:q,height:J,"data-testid":a}):(0,n.jsxs)(`div`,{"data-testid":a,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)(g,{...y,parentW:q,parentH:J})]})}var gt=280,Y=96;function _t({points:e=[],className:a,colors:o}){let s=(0,t.useRef)(null),l=(0,t.useRef)(new Map),u=(0,t.useRef)(0),p=(0,t.useMemo)(()=>e.map(([e,t])=>{let n=String(t).match(/-?\d+(\.\d+)?/);return{label:e,value:n?Number(n[0]):0}}),[e]),{mouseRef:m,hoveredRef:y,tooltip:b,hitZonesRef:x}=_(s,{width:gt,height:Y});return(0,t.useEffect)(()=>{let e=s.current;if(!e)return;let t=d(e,gt,Y);u.current=0;let n=o?.line??i.blue,r=o?.point??i.blue,a=o?.axisLine??i.bd,g,_=()=>{u.current++;let e=u.current;if(t.clearRect(0,0,gt,Y),p.length<2){g=requestAnimationFrame(_);return}let o={left:12,right:12,top:16,bottom:20},s=gt-o.left-o.right,d=Y-o.top-o.bottom,b=p.map(e=>e.value),S=Math.min(...b),C=Math.max(...b)-S||1,T=e=>o.left+e/(p.length-1)*s,D=e=>o.top+(1-(e-S)/C)*d,O=1-(1-Math.min(e/48,1))**3,k=Math.max(2,Math.floor(O*p.length));if(E(l.current,y.current),x.current=[],t.strokeStyle=c(a,.3),t.lineWidth=.5,t.setLineDash([]),t.beginPath(),t.moveTo(o.left,Y-o.bottom),t.lineTo(gt-o.right,Y-o.bottom),t.stroke(),t.font=`9px 'JetBrains Mono', monospace`,t.fillStyle=c(i.t4,.9),t.textAlign=`center`,p.forEach((e,n)=>{t.fillText(e.label.replace(`Day `,`D`),T(n),Y-4)}),m.current.over&&y.current){let e=parseInt(y.current.split(`-`)[1]);isNaN(e)||h(t,T(e),o.top,o.top+d)}if(k>1){let e=t.createLinearGradient(0,o.top,0,o.top+d);e.addColorStop(0,c(n,.15)),e.addColorStop(1,c(n,0)),t.fillStyle=e,t.beginPath(),t.moveTo(T(0),o.top+d);for(let e=0;e<k;e++)t.lineTo(T(e),D(p[e].value));t.lineTo(T(k-1),o.top+d),t.closePath(),t.fill(),t.strokeStyle=c(n,.8),t.lineWidth=1.5,t.setLineDash([]),t.beginPath();for(let e=0;e<k;e++){let n=T(e),r=D(p[e].value);e===0?t.moveTo(n,r):t.lineTo(n,r)}t.stroke()}for(let e=0;e<k;e++){let n=T(e),a=D(p[e].value),o=`tp-${e}`,s=l.current.get(o)??0,u=e===p.length-1;v(x.current,o,n,a,10,{label:p[e].label,value:String(p[e].value),color:u?i.red:r}),s>0&&!u&&(f(t,n,a,12*s,r,.2*s),t.fillStyle=c(r,.8),t.beginPath(),t.arc(n,a,3+s*2,0,Math.PI*2),t.fill())}if(k>=p.length){let n=p.length-1,r=T(n),a=D(p[n].value),o=l.current.get(`tp-${n}`)??0,s=w(e,.05,5e-4),u=1+o*.5;t.shadowColor=c(i.red,.5),t.shadowBlur=(8+s*4)*u,t.fillStyle=i.red,t.beginPath(),t.arc(r,a,(3.5+s*1.5)*u,0,Math.PI*2),t.fill(),t.shadowBlur=0}g=requestAnimationFrame(_)};return _(),()=>cancelAnimationFrame(g)},[p,o]),(0,n.jsx)(r,{className:[`canvas-trend-frame`,a].filter(Boolean).join(` `),children:(0,n.jsxs)(`div`,{style:{position:`relative`,width:gt,height:Y},children:[(0,n.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`trend chart`,style:{width:gt,height:Y,display:`block`,borderRadius:8}}),(0,n.jsx)(g,{...b,parentW:gt,parentH:Y})]})})}var X=680,vt=8,yt=26,bt=14,xt=16,St=32;function Ct({items:e=[],"data-testid":r}){let a=(0,t.useRef)(null),o=(0,t.useRef)(new Map),l=(0,t.useRef)(0),[u,p]=(0,t.useState)(!1),m=(0,t.useMemo)(()=>e.filter(e=>typeof e==`object`&&!!e),[e]),h=(0,t.useMemo)(()=>u?m:m.slice(0,vt),[m,u]),v=xt+St+h.length*(yt+bt)-bt,{hoveredRef:b,tooltip:S,hitZonesRef:C}=_(a,{width:X,height:v});return(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=d(e,X,v);l.current=0;let n=xt,r=St,u=yt,p=bt,m=X-60-28,g=Math.max(...h.map(e=>(e.implemented??0)+(e.unimplemented??0))),_=h.length*(u+p)-p,S=n+(v-n-r-_)/2,w,D=()=>{l.current++;let e=l.current;t.clearRect(0,0,X,v);let n=x(Math.min(e/60,1));E(o.current,b.current),C.current=[],h.forEach((e,r)=>{let a=T(n,r,h.length,x),s=S+r*(u+p),l=(e.implemented??0)+(e.unimplemented??0),d=(e.implemented??0)/g*m*a,_=(e.unimplemented??0)/g*m*a,v=`${e.id}-impl`,b=`${e.id}-un`,w=o.current.get(v)??0,E=o.current.get(b)??0;y(C.current,v,60,s,d||1,u,{label:`${e.name} — Implemented`,value:`${e.implemented??0} variations`,sublabel:`${Math.round((e.implemented??0)/(l||1)*100)}% complete`,color:i.green}),y(C.current,b,60+d,s,_||1,u,{label:`${e.name} — Unimplemented`,value:`${e.unimplemented??0} variations`,sublabel:`${Math.round((e.unimplemented??0)/(l||1)*100)}% pending`,color:i.amber}),t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=i.t2,t.textAlign=`right`,t.fillText(e.abbreviation??e.name.slice(0,6),52,s+u/2+4),t.fillStyle=c(i.bd,.15),t.beginPath(),t.roundRect(60,s,l/g*m,u,4),t.fill(),d>0&&(w>0&&f(t,60+d/2,s+u/2,d*.3,i.green,.12*w),t.fillStyle=c(i.green,.6+w*.2),t.beginPath(),t.roundRect(60,s,d,u,[4,0,0,4]),t.fill(),d>28&&a>.5&&(t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=w>0?i.green:i.t2,t.textAlign=`center`,t.fillText(String(e.implemented??0),60+d/2,s+u/2+4))),_>0&&(E>0&&f(t,60+d+_/2,s+u/2,_*.3,i.amber,.12*E),t.fillStyle=c(i.amber,.18+E*.18),t.strokeStyle=c(i.amber,.3+E*.3),t.lineWidth=1,t.beginPath(),t.roundRect(60+d,s,_,u,[0,4,4,0]),t.fill(),t.stroke(),_>28&&a>.5&&(t.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.fillStyle=E>0?i.amber:i.t2,t.textAlign=`center`,t.fillText(String(e.unimplemented??0),60+d+_/2,s+u/2+4))),d>0&&_>0&&(t.strokeStyle=c(i.bg,.7),t.lineWidth=2,t.beginPath(),t.moveTo(60+d,s),t.lineTo(60+d,s+u),t.stroke())});let r=S+_+24,a=60+m/2;t.font=`400 14px 'Satoshi Variable', 'DM Sans', sans-serif`,t.textAlign=`right`,t.fillStyle=i.green,t.fillText(`■ Implemented`,a-10,r),t.textAlign=`left`,t.fillStyle=s.color,t.fillText(`■ Unimplemented`,a+10,r),w=requestAnimationFrame(D)};return D(),()=>cancelAnimationFrame(w)},[h,v]),m.length===0?(0,n.jsx)(N,{width:X,height:160,"data-testid":r}):(0,n.jsxs)(`div`,{"data-testid":r,style:{width:X},children:[(0,n.jsxs)(`div`,{style:{position:`relative`,width:X,height:v},children:[(0,n.jsx)(`canvas`,{ref:a,role:`img`,"aria-label":`Implemented vs unimplemented variations per contractor — split bar`,style:{width:X,height:v,display:`block`}}),(0,n.jsx)(g,{...S,parentW:X,parentH:v})]}),m.length>vt&&(0,n.jsx)(`div`,{style:{marginTop:8},children:(0,n.jsx)(te,{expanded:u,onToggle:()=>p(e=>!e)})})]})}var wt=800,Tt=360;function Et({items:e=[],"data-testid":r}){let o=(0,t.useRef)(null),s=(0,t.useRef)(new Map),l=(0,t.useRef)(0),{hoveredRef:u,tooltip:p,hitZonesRef:m}=_(o,{width:wt,height:Tt});return(0,t.useEffect)(()=>{let t=o.current;if(!t)return;let n=d(t,wt,Tt);l.current=0;let r=e.reduce((e,t)=>e+(t.base??0),0),p=e.reduce((e,t)=>e+(t.variation??0),0),h=e.reduce((e,t)=>e+(t.total??0),0),g=Tt-20-26,_=g-6*(e.length-1),v=20,x=e.map((e,t)=>{let n=Math.max(24,(e.total??0)/(h||1)*_),r={x:100-110/2,y:v,h:n,cy:v+n/2,c:e,color:a[t%a.length]};return v+=n+6,r}),S=_-14,C=Math.max(28,r/h*S),w=Math.max(18,p/h*S),D=20+(g-(C+w+14))/2,O={x:420-110/2,y:D,h:C,cy:D+C/2},k={x:420-110/2,y:D+C+14,h:w,cy:D+C+14+w/2},A={x:720-110/2,y:20,h:g,cy:20+g/2},j,M=()=>{l.current++;let t=l.current;n.clearRect(0,0,wt,Tt);let a=b(Math.min(t/80,1));if(E(s.current,u.current),m.current=[],e.forEach((t,i)=>{let o=x[i],c=T(a,i,e.length,b),l=s.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=o.h*u,m=o.h*d,h=o.y+f/2,g=o.y+f+m/2,_=Math.max(2,(t.base??0)/r*C),v=Math.max(2,(t.variation??0)/p*w),y=O.y+e.slice(0,i).reduce((e,t)=>e+(t.base??0)/r*C,0)+_/2,S=k.y+e.slice(0,i).reduce((e,t)=>e+(t.variation??0)/p*w,0)+v/2,E=l*.2+.18;Dt(n,o.x+110,h,420-110/2,y,_*c,o.color,E),Dt(n,o.x+110,g,420-110/2,S,v*c,o.color,E*.75)}),a>.3){let e=Math.min(1,(a-.3)/.7),t=A.y+r/h*g/2,o=A.y+g-p/h*g/2;Dt(n,475,O.cy,720-110/2,t,C*e,i.blue,.25*e),Dt(n,475,k.cy,720-110/2,o,w*e,i.amber,.22*e)}if([`Contractors`,`Components`,`Total`].forEach((e,t)=>{let r=[100,420,720][t];n.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=c(i.t3,.5),n.textAlign=`center`,n.fillText(e,r,Tt-8)}),e.forEach((t,r)=>{let o=x[r],l=T(a,r,e.length,b),u=s.current.get(t.id)??0;y(m.current,t.id,o.x,o.y,110,o.h,{label:t.name,value:`£${t.total??0}M total commitment`,sublabel:`Base £${t.base??0}M + Variations £${t.variation??0}M`,color:o.color}),u>0&&f(n,o.x+110/2,o.cy,110*.6,o.color,.12*u),n.fillStyle=c(o.color,(.3+u*.15)*l),n.strokeStyle=c(o.color,(.55+u*.25)*l),n.lineWidth=1,n.beginPath(),n.roundRect(o.x,o.y,110*l,o.h,4),n.fill(),n.stroke(),l>.6&&o.h>=24&&(n.globalAlpha=Math.min(1,(l-.6)/.4),n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=u>0?o.color:c(i.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=c(i.t3,.8),n.fillText(`£${t.total??0}M`,o.x+110/2,o.cy+7)),n.globalAlpha=1,n.textBaseline=`alphabetic`)}),a>.2){let e=Math.min(1,(a-.2)/.4);f(n,420,O.cy,30,i.blue,.1*e),n.fillStyle=c(i.blue,.3*e),n.strokeStyle=c(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=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.blue,n.textAlign=`center`,n.fillText(`Base Value`,420,O.cy-6),n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.fillText(`£${r}M`,420,O.cy+8),n.globalAlpha=1,n.textBaseline=`alphabetic`,f(n,420,k.cy,24,i.amber,.1*e),n.fillStyle=c(i.amber,.22*e),n.strokeStyle=c(i.amber,.4*e),n.beginPath(),n.roundRect(k.x,k.y,110,k.h*e,4),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.amber,n.textAlign=`center`,n.fillText(`Variations`,420,k.cy-4),n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t1,n.fillText(`£${p}M`,420,k.cy+8),n.globalAlpha=1,n.textBaseline=`alphabetic`}if(a>.5){let e=Math.min(1,(a-.5)/.5);f(n,720,A.cy,44,i.cyan,.2*e),n.fillStyle=c(i.cyan,.25*e),n.strokeStyle=c(i.cyan,.6*e),n.lineWidth=1.5,n.beginPath(),n.roundRect(A.x,A.y,110,A.h*e,6),n.fill(),n.stroke(),n.globalAlpha=e,n.textBaseline=`middle`,n.font=`400 12px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.t2,n.textAlign=`center`,n.fillText(`Total Commitment`,720,A.cy-12),n.font=`500 14px 'Satoshi Variable', 'DM Sans', sans-serif`,n.fillStyle=i.cyan,n.fillText(`£${h}M`,720,A.cy+6),n.globalAlpha=1,n.textBaseline=`alphabetic`}j=requestAnimationFrame(M)};return M(),()=>cancelAnimationFrame(j)},[e]),(0,n.jsxs)(`div`,{"data-testid":r,style:{position:`relative`,width:wt,height:Tt},children:[(0,n.jsx)(`canvas`,{ref:o,role:`img`,"aria-label":`Weekly report flow — base value and variations per contractor flowing to total commitment`,style:{width:wt,height:Tt,display:`block`}}),(0,n.jsx)(g,{...p,parentW:wt,parentH:Tt})]})}function Dt(e,t,n,r,i,a,o,s){let l=(t+r)/2;e.beginPath(),e.moveTo(t,n-a/2),e.bezierCurveTo(l,n-a/2,l,i-a/2,r,i-a/2),e.lineTo(r,i+a/2),e.bezierCurveTo(l,i+a/2,l,n+a/2,t,n+a/2),e.closePath(),e.fillStyle=c(o,s),e.fill()}function Ot({config:e,className:t}){return e.type===`line`?(0,n.jsx)(Me,{rows:e.rows,className:t}):e.type===`area`?(0,n.jsx)(A,{rows:e.rows,className:t}):e.type===`bar`?(0,n.jsx)(ee,{rows:e.rows,className:t}):e.type===`pie`?(0,n.jsx)(Ve,{rows:e.rows,variant:`pie`,className:t}):e.type===`donut`?(0,n.jsx)(Ve,{rows:e.rows,variant:`donut`,className:t}):e.type===`sankey`?(0,n.jsx)(Qe,{rows:e.rows,className:t}):e.type===`flow`?(0,n.jsx)(Ze,{selectedEntity:e.selectedEntity,className:t}):e.type===`trend`?(0,n.jsx)(_t,{points:e.points,className:t}):e.type===`mini-bars`?(0,n.jsx)(Fe,{rows:e.rows,className:t}):e.type===`stacked-horizontal-bar-chart`?(0,n.jsx)(Te,{data:e.data}):e.type===`multi-metric-constellation-chart`?(0,n.jsx)(ve,{items:e.items}):e.type===`progress-race-chart`?(0,n.jsx)(ce,{items:e.items}):e.type===`hub-and-spoke-radial-chart`?(0,n.jsx)(ht,{segments:e.segments,title:e.title}):e.type===`dot-matrix-chart`?(0,n.jsx)(je,{items:e.items}):e.type===`ranked-card-leaderboard`?(0,n.jsx)(Ae,{items:e.items}):e.type===`proportional-band-chart`?(0,n.jsx)(pt,{severities:e.severities}):e.type===`radial-fan-tree-chart`?(0,n.jsx)(Le,{total:e.total,items:e.items}):e.type===`semi-circular-gauge-chart`?(0,n.jsx)(de,{value:e.value,confirmed:e.confirmed,total:e.total}):e.type===`segmented-split-bar-chart`?(0,n.jsx)(Ct,{items:e.items}):e.type===`balance-scale-chart`?(0,n.jsx)(tt,{left:e.left,right:e.right}):e.type===`area-line-chart`?(0,n.jsx)(rt,{points:e.points}):e.type===`trend-view`?(0,n.jsx)(ut,{points:e.points}):e.type===`weekly-flow`?(0,n.jsx)(Et,{items:e.items}):(0,n.jsx)(`div`,{className:`viz-empty`,children:`Visualization unavailable`})}var kt=[];function At(e){try{return JSON.parse(decodeURIComponent(e))}catch{return null}}function jt(){for(;kt.length;){let e=kt.pop();e&&e.unmount()}}function Mt(){jt(),document.querySelectorAll(`[data-d3-viz]`).forEach(t=>{let r=t.dataset.d3Viz;if(!r)return;let i=At(r);if(!i)return;let a=(0,e.createRoot)(t);kt.push(a),a.render((0,n.jsx)(Ot,{config:i}))})}function Nt(e){return encodeURIComponent(JSON.stringify(e))}function Pt({rows:e=[],className:t,colors:r}){return(0,n.jsx)(Ve,{rows:e,variant:`donut`,className:t,colors:r})}var Z={bg:i.sf,border:i.bd,t1:i.t1,t2:i.t2,t3:i.t3,t4:i.t4,red:i.red,amber:i.amber,green:i.green},Q=`'Satoshi Variable', 'DM Sans', sans-serif`,Ft={color:`#F7F7F7`,fontFamily:Q,fontSize:24,fontWeight:500,lineHeight:`32px`},$={color:`#C2C2C2`,fontFamily:Q,fontSize:16,fontWeight:400,lineHeight:`20px`};function It({chips:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,gap:6,marginTop:10},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{width:260,height:120,display:`flex`,alignItems:`baseline`,gap:8,padding:`8px 12px`,background:Z.bg,border:`1px solid ${Z.border}`,borderRadius:5,boxSizing:`border-box`},children:[(0,n.jsx)(`span`,{style:{...Ft,color:e.color??Z.t1},children:e.value}),(0,n.jsx)(`span`,{style:{...$,flex:1},children:e.label})]},t))})}function Lt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,gap:8},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`flex-start`,width:260,height:120,padding:24,gap:8,flexShrink:0,border:`1px solid ${Z.border}`,background:Z.bg,boxSizing:`border-box`},children:[(0,n.jsx)(`div`,{style:{...Ft,color:e.color??Z.t1},children:e.value}),(0,n.jsx)(`div`,{style:{...$},children:e.label})]},t))})}function Rt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`9px 14px`,background:Z.bg,border:`1px solid ${Z.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:16,fontWeight:600,color:e.color??Z.t2,background:(e.color??Z.t2)+`22`,padding:`2px 8px`,borderRadius:4,fontFamily:Q,flexShrink:0},children:e.name}),(0,n.jsx)(`span`,{style:{...Ft,fontSize:16,color:e.color??Z.t1,minWidth:70,flexShrink:0},children:e.value}),(0,n.jsx)(`span`,{style:{...$,flex:1},children:e.kpiLabel})]},t))})}function zt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,gap:8},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`flex-start`,width:260,height:120,padding:24,gap:8,flexShrink:0,background:Z.bg,border:`1px solid ${e.color?e.color+`30`:Z.border}`,boxSizing:`border-box`},children:[(0,n.jsx)(`div`,{style:{...Ft,color:e.color??Z.t1},children:e.value}),(0,n.jsx)(`div`,{style:{...$},children:e.label})]},t))})}var Bt={red:Z.red,amber:Z.amber,green:Z.green};function Vt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:e.map((e,t)=>{let r=Bt[e.severity];return(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`10px 14px`,background:i.sf,border:`1px solid ${Z.border}`},children:[(0,n.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:r,flexShrink:0,marginTop:5}}),(0,n.jsx)(`span`,{style:{...$},children:e.text})]},t)})})}function Ht({min:e,max:t,unit:r,dots:a=[],chips:o=[]}){let s=t-e;return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{style:{position:`relative`,height:90,marginTop:4},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:Z.t4,fontFamily:Q},children:[e,r]}),(0,n.jsxs)(`div`,{style:{position:`absolute`,top:43,right:0,fontSize:16,color:Z.t4,fontFamily:Q},children:[t,r]}),a.map((t,a)=>{let o=(t.val-e)/s*100,c=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:16,color:c,fontFamily:Q,whiteSpace:`nowrap`},children:t.name}),(0,n.jsxs)(`div`,{style:{fontSize:16,fontWeight:700,color:c,fontFamily:Q,whiteSpace:`nowrap`},children:[t.val,r]})]}),(0,n.jsx)(`div`,{style:{width:10,height:10,borderRadius:`50%`,background:c,boxShadow:`0 0 8px ${c}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:16,color:c,fontFamily:Q,whiteSpace:`nowrap`},children:t.name}),(0,n.jsxs)(`div`,{style:{fontSize:16,fontWeight:700,color:c,fontFamily:Q,whiteSpace:`nowrap`},children:[t.val,r]})]})]},a)})]}),o&&o.length>0&&(0,n.jsx)(It,{chips:o})]})}function Ut({leftPct:e,leftLabel:t,leftValue:r,leftColor:a,rightPct:o,rightLabel:s,rightValue:c,rightColor:l,chips:u}){let d=a??i.blue,f=l??i.cyan;return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{style:{display:`flex`,borderRadius:6,overflow:`hidden`,height:36,marginBottom:8},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:16,fontWeight:700,color:d,fontFamily:Q},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:16,fontWeight:700,color:f,fontFamily:Q},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:16,color:d,fontFamily:Q},children:[e,`% `,t]})}),(0,n.jsx)(`div`,{style:{width:`${o}%`,paddingLeft:10},children:(0,n.jsxs)(`span`,{style:{fontSize:16,color:f,fontFamily:Q},children:[o,`% `,s]})})]}),u&&u.length>0&&(0,n.jsx)(It,{chips:u})]})}function Wt({pct:e,label:t,color:r,chips:a}){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:16,fontWeight:700,color:o,fontFamily:Q},children:[e,`%`]})})]}),(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{style:{...$,marginBottom:10},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:`7px 10px`,background:Z.bg,border:`1px solid ${Z.border}`,borderRadius:5},children:[(0,n.jsx)(`span`,{style:{...Ft,color:e.color??Z.t1},children:e.value}),(0,n.jsx)(`span`,{style:{...$},children:e.label})]},t))})]})]})}var Gt={green:`#34D39918`,amber:`#FBBF2418`,red:`#F0606018`},Kt={green:`#34D399`,amber:`#FBBF24`,red:`#F06060`};function qt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:e.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 12px`,background:Z.bg,border:`1px solid ${Z.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:16,fontWeight:600,color:e.color??Z.t2,background:(e.color??Z.t2)+`1A`,padding:`2px 7px`,borderRadius:4,fontFamily:Q,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:2,overflow:`hidden`},children:(0,n.jsx)(`div`,{style:{height:`100%`,width:`${e.pct}%`,background:e.color??Z.t2,borderRadius:2,opacity:.75}})}),(0,n.jsx)(`span`,{style:{fontSize:16,fontWeight:700,color:e.color??Z.t1,fontFamily:Q,flexShrink:0,minWidth:52,textAlign:`right`},children:e.value}),e.badge&&e.badgeSeverity&&(0,n.jsx)(`span`,{style:{fontSize:16,fontWeight:600,color:Kt[e.badgeSeverity],background:Gt[e.badgeSeverity],padding:`2px 7px`,borderRadius:4,fontFamily:Q,flexShrink:0,minWidth:72,textAlign:`center`},children:e.badge}),e.sublabel&&(0,n.jsx)(`span`,{style:{...$,flexShrink:0,minWidth:80,textAlign:`right`},children:e.sublabel})]},t))})}var Jt={red:Z.red,amber:Z.amber,green:Z.green};function Yt({items:e=[]}){return(0,n.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5},children:e.map((e,t)=>{let r=Jt[e.severity];return(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`9px 12px`,background:r+`0A`,border:`1px solid ${r}25`},children:[(0,n.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:r,flexShrink:0,marginTop:5}}),(0,n.jsx)(`span`,{style:{flex:1,...$},children:e.text}),(0,n.jsx)(`span`,{style:{fontSize:16,fontWeight:600,color:r,background:r+`20`,padding:`2px 7px`,borderRadius:4,fontFamily:Q,flexShrink:0},children:e.tag}),(0,n.jsx)(`span`,{style:{...$,flexShrink:0,marginTop:1},children:e.date})]},t)})})}function Xt({columns:e=[],rows:t=[]}){return(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 12px 6px`,borderBottom:`1px solid ${Z.border}`},children:[(0,n.jsx)(`div`,{style:{minWidth:64}}),e.map((e,t)=>(0,n.jsx)(`div`,{style:{flex:1,fontSize:16,fontWeight:600,color:Z.t2,fontFamily:Q,textTransform:`uppercase`,letterSpacing:.6},children:e},t))]}),t.map((e,t)=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 12px`,background:Z.bg,border:`1px solid ${Z.border}`},children:[(0,n.jsx)(`span`,{style:{fontSize:16,fontWeight:600,color:Z.t2,background:(e.color??Z.t4)+`1A`,padding:`2px 8px`,borderRadius:4,fontFamily:Q,flexShrink:0,minWidth:64,textAlign:`center`},children:e.label}),e.cells.map((t,r)=>(0,n.jsx)(`span`,{style:{flex:1,fontSize:16,fontWeight:700,color:e.color??Z.t1,fontFamily:Q},children:t},r))]},t))]})}function Zt({text:e}){return(0,n.jsxs)(`div`,{style:{padding:`8px 12px`,border:`1px solid ${i.bd}`,borderLeft:`4px solid #71B941`,borderRadius:5,background:`linear-gradient(90deg, rgba(113, 185, 65, 0.10) -48.4%, rgba(19, 22, 27, 0.10) 83.98%), ${i.sf}`},children:[(0,n.jsx)(`span`,{style:{fontSize:16,fontWeight:500,color:i.t1,fontFamily:Q,lineHeight:`20px`,marginRight:8},children:`Takeaway`}),(0,n.jsx)(`span`,{style:{...$},children:e})]})}function Qt({block:e}){if(!e)return null;let t=(()=>{switch(e.type){case`stats`:return(0,n.jsx)(Lt,{items:e.items});case`ranked`:return(0,n.jsx)(Rt,{items:e.items});case`chips`:return(0,n.jsx)(zt,{items:e.items});case`badges`:return(0,n.jsx)(Vt,{items:e.items});case`dot-strip`:return(0,n.jsx)(Ht,{min:e.min,max:e.max,unit:e.unit,dots:e.dots,chips:e.chips});case`proportion`:return(0,n.jsx)(Ut,{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)(Wt,{pct:e.pct,label:e.label,color:e.color,chips:e.chips});case`scorecard-rows`:return(0,n.jsx)(qt,{items:e.items});case`flags-list`:return(0,n.jsx)(Yt,{items:e.items});case`comparison-rows`:return(0,n.jsx)(Xt,{columns:e.columns,rows:e.rows});default:return null}})();return e.takeaway?(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:24},children:[t,(0,n.jsx)(Zt,{text:e.takeaway})]}):t}exports.AreaChart=A,exports.BarChart=ee,exports.ChartFrame=r,exports.DonutChart=Pt,exports.KeyHighlights=Qt,exports.LineChart=Me,exports.MiniBars=Fe,exports.PieChart=Ve,exports.ProcessSankey=Ze,exports.RankingSankey=Qe,exports.SankeySvg=Ue,exports.SeriesChart=k,exports.Trend=ut,exports.TrendChart=_t,exports.VisualizationRenderer=Ot,exports.cleanupVisualizationMounts=jt,exports.hydrateVisualizationMounts=Mt,exports.serializeVisualizationConfig=Nt;
package/dist/index.js CHANGED
@@ -18,12 +18,12 @@ var u = {
18
18
  blue: "#2970FF",
19
19
  cyan: "#36BFFA",
20
20
  orange: "#EF6820",
21
- red: "#D92D20",
22
- green: "#16B364",
21
+ red: "#EF6820",
22
+ green: "#71B941",
23
23
  purple: "#7A5AF8",
24
24
  amber: "#FAC515",
25
25
  t1: "#F7F7F7",
26
- t2: "#94979C",
26
+ t2: "#C2C2C2",
27
27
  t3: "#94979C",
28
28
  t4: "#334155"
29
29
  }, d = [
@@ -34,11 +34,11 @@ var u = {
34
34
  u.green,
35
35
  u.red
36
36
  ], f = {
37
- font: "400 12px 'Satoshi Variable', 'DM Sans', sans-serif",
38
- color: u.t2
37
+ font: "400 14px 'Satoshi Variable', 'DM Sans', sans-serif",
38
+ color: "#C2C2C2"
39
39
  }, p = {
40
- font: "400 12px 'Satoshi Variable', 'DM Sans', sans-serif",
41
- color: u.t2
40
+ font: "400 14px 'Satoshi Variable', 'DM Sans', sans-serif",
41
+ color: "#C2C2C2"
42
42
  };
43
43
  function m(e, t = 1) {
44
44
  let n = e.replace("#", "");
@@ -466,7 +466,7 @@ function ae({ expanded: e, onToggle: t, labelExpanded: n = "View Less", labelCol
466
466
  boxSizing: "border-box",
467
467
  border: "none",
468
468
  borderRadius: 6,
469
- color: "#FFAE43",
469
+ color: "#71B941",
470
470
  fontSize: 14,
471
471
  fontFamily: "'Satoshi Variable', 'DM Sans', sans-serif",
472
472
  fontStyle: "normal",
@@ -622,7 +622,7 @@ function he({ value: e, confirmed: t, total: r, "data-testid": i }) {
622
622
  }
623
623
  ].forEach(({ label: e, angle: t }) => {
624
624
  let n = a + Math.cos(t) * 166, r = 220 + Math.sin(t) * 166;
625
- i.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", i.fillStyle = m(u.t3, .55), i.textAlign = "center", i.fillText(e, n, r + 3);
625
+ i.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", i.fillStyle = m(u.t2, .55), i.textAlign = "center", i.fillText(e, n, r + 3);
626
626
  });
627
627
  let _ = s + e / 100 * d * o, y = e >= 66 ? u.green : e >= 33 ? u.amber : u.red;
628
628
  v(i, a + Math.cos(_) * 194 / 2, 220 + Math.sin(_) * 194 / 2, 18, y, .35 * o), i.beginPath(), i.arc(a, 220, 194 / 2, s, _), i.strokeStyle = m(y, .7 * o), i.lineWidth = 38, i.lineCap = "round", i.stroke(), i.lineCap = "butt";
@@ -758,19 +758,19 @@ function Se({ items: e = [], "data-testid": t }) {
758
758
  let c = A(n, .05, 5e-4) * .3 + .7, l = 3.5 * c, u = `star-${i}-${s}`, f = r.current.get(u) ?? 0, p = e.createRadialGradient(o.x, o.y, 0, o.x, o.y, l * 4);
759
759
  p.addColorStop(0, m(a, (.2 + .1 * f) * c)), p.addColorStop(1, m(a, 0)), e.fillStyle = p, e.beginPath(), e.arc(o.x, o.y, l * 4, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(o.x, o.y, l + f * 2, 0, Math.PI * 2), e.fillStyle = m(a, (.8 + .2 * f) * c), e.fill();
760
760
  let h = Math.sin(o.angle) < -.3;
761
- e.textAlign = "center", e.textBaseline = "middle", h ? (e.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = m(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y - 24), e.font = "500 12px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = m(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y - 11)) : (e.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = m(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y + 11), e.font = "500 12px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = m(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y + 24)), w(d.current, u, o.x, o.y, l * 4 + 2, {
761
+ e.textAlign = "center", e.textBaseline = "middle", h ? (e.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = m(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y - 24), e.font = "500 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = m(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y - 11)) : (e.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = m(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y + 11), e.font = "500 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = m(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y + 24)), w(d.current, u, o.x, o.y, l * 4 + 2, {
762
762
  label: o.name,
763
763
  value: o.label,
764
764
  sublabel: t.abbreviation ?? t.name.slice(0, 6),
765
765
  color: a
766
766
  });
767
- }), s > 0 && v(e, t.cx, t.cy, 16 * s, a, .15 * s), e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 12, 0, Math.PI * 2), e.strokeStyle = m(a, .1 + A(n, .03, 5e-4) * .05), e.lineWidth = 1, e.stroke(), e.font = "500 12px 'Satoshi Variable', 'DM Sans', sans-serif", e.textAlign = "center", e.textBaseline = "alphabetic", e.fillStyle = m(u.t2, .65 + s * .25), e.fillText(t.abbreviation ?? t.name.slice(0, 6), t.cx, t.cy + t.baseR + 26), w(d.current, o, t.cx, t.cy, t.baseR + 5, {
767
+ }), s > 0 && v(e, t.cx, t.cy, 16 * s, a, .15 * s), e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 12, 0, Math.PI * 2), e.strokeStyle = m(a, .1 + A(n, .03, 5e-4) * .05), e.lineWidth = 1, e.stroke(), e.font = "500 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.textAlign = "center", e.textBaseline = "alphabetic", e.fillStyle = m(u.t2, .65 + s * .25), e.fillText(t.abbreviation ?? t.name.slice(0, 6), t.cx, t.cy + t.baseR + 26), w(d.current, o, t.cx, t.cy, t.baseR + 5, {
768
768
  label: t.name,
769
769
  value: `£${t.total ?? 0}M total`,
770
770
  sublabel: `${t.percentage ?? 0}% committed · scatter ${t.scatter.toFixed(1)}`,
771
771
  color: a
772
772
  });
773
- }), e.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = u.t2, e.fillText("▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details", R / 2, z - 14), b(e, R, z, n, .012);
773
+ }), e.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = u.t2, e.fillText("▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details", R / 2, z - 14), b(e, R, z, n, .012);
774
774
  }, !0), p.length === 0 ? /* @__PURE__ */ s(F, {
775
775
  width: R,
776
776
  height: z,
@@ -824,12 +824,12 @@ function ke({ data: e, "data-testid": t }) {
824
824
  return ge(n, Ce, w, (e, t) => {
825
825
  M(r.current, A.current), N.current = [], y.forEach((n, i) => {
826
826
  let a = Ee[i % Ee.length], o = j(t, i, b, D), s = B.top + i * (V + O), c = B.left + De, l = r.current.get(n.id) ?? 0, d = Math.max(n.base ?? 0, 0), p = Math.max(n.total ?? 0, 0), h = d / x * E * o, g = p / x * E * o, _ = g - h;
827
- e.font = "500 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = l > 0 ? a : f.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(n.abbreviation ?? n.name.slice(0, 6), c - 8, s + V / 2), e.fillStyle = m(u.bd, .25), e.beginPath(), e.roundRect(c, s, E, V, 4), e.fill(), h > 0 && (l > 0 && v(e, c + h / 2, s + V / 2, h * .3, a, .1 * l), e.fillStyle = m(a, .5 + l * .15), e.beginPath(), e.roundRect(c, s, h, V, 4), e.fill()), _ > 2 && (e.fillStyle = m(a, .22 + l * .08), e.beginPath(), e.roundRect(c + h, s, _, V, [
827
+ e.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = l > 0 ? a : f.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(n.abbreviation ?? n.name.slice(0, 6), c - 8, s + V / 2), e.fillStyle = m(u.bd, .25), e.beginPath(), e.roundRect(c, s, E, V, 4), e.fill(), h > 0 && (l > 0 && v(e, c + h / 2, s + V / 2, h * .3, a, .1 * l), e.fillStyle = m(a, .5 + l * .15), e.beginPath(), e.roundRect(c, s, h, V, 4), e.fill()), _ > 2 && (e.fillStyle = m(a, .22 + l * .08), e.beginPath(), e.roundRect(c + h, s, _, V, [
828
828
  0,
829
829
  4,
830
830
  4,
831
831
  0
832
- ]), e.fill(), e.setLineDash([2, 3]), e.strokeStyle = m(a, .55), e.lineWidth = 1, e.beginPath(), e.moveTo(c + h, s + 3), e.lineTo(c + h, s + V - 3), e.stroke(), e.setLineDash([])), l > 0 && g > 0 && (e.strokeStyle = m(a, .5 * l), e.lineWidth = 1, e.setLineDash([]), e.beginPath(), e.roundRect(c, s, g, V, 4), e.stroke()), o > .35 && (e.globalAlpha = Math.min(1, (o - .35) / .4), e.font = "500 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = l > 0 ? a : u.t1, e.textAlign = "left", e.textBaseline = "middle", e.fillText(Oe(n.total ?? 0), c + g + 6, s + V / 2), e.globalAlpha = 1), T(N.current, n.id, c, s, Math.max(g, 1), V, {
832
+ ]), e.fill(), e.setLineDash([2, 3]), e.strokeStyle = m(a, .55), e.lineWidth = 1, e.beginPath(), e.moveTo(c + h, s + 3), e.lineTo(c + h, s + V - 3), e.stroke(), e.setLineDash([])), l > 0 && g > 0 && (e.strokeStyle = m(a, .5 * l), e.lineWidth = 1, e.setLineDash([]), e.beginPath(), e.roundRect(c, s, g, V, 4), e.stroke()), o > .35 && (e.globalAlpha = Math.min(1, (o - .35) / .4), e.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.fillStyle = l > 0 ? a : "#F7F9FA", e.textAlign = "left", e.textBaseline = "middle", e.fillText(Oe(n.total ?? 0), c + g + 6, s + V / 2), e.globalAlpha = 1), T(N.current, n.id, c, s, Math.max(g, 1), V, {
833
833
  label: n.name,
834
834
  value: `${Oe(n.total ?? 0)} total`,
835
835
  sublabel: `Base ${Oe(n.base ?? 0)} + Var ${Oe(n.variation ?? 0)} · ${n.percentage ?? 0}% committed`,
@@ -837,7 +837,7 @@ function ke({ data: e, "data-testid": t }) {
837
837
  });
838
838
  });
839
839
  let n = w - 14;
840
- e.textBaseline = "middle", e.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", e.textAlign = "left", e.fillStyle = m(u.cyan, .5), e.beginPath(), e.roundRect(B.left + De, n - 3, 14, 6, 2), e.fill(), e.fillStyle = p.color, e.fillText("base value", B.left + De + 18, n), e.fillStyle = m(u.cyan, .22), e.beginPath(), e.roundRect(B.left + De + 94, n - 3, 14, 6, 2), e.fill(), e.setLineDash([2, 3]), e.strokeStyle = m(u.cyan, .5), e.lineWidth = .5, e.beginPath(), e.moveTo(B.left + De + 101, n - 3), e.lineTo(B.left + De + 101, n + 3), e.stroke(), e.setLineDash([]), e.fillStyle = p.color, e.fillText("approved variations", B.left + De + 112, n), e.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", e.textAlign = "right", e.fillStyle = p.color, e.fillText(`Portfolio: ${Oe(h?.total ?? 0)}`, Ce - 8, n);
840
+ e.textBaseline = "middle", e.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.textAlign = "left", e.fillStyle = m(u.cyan, .5), e.beginPath(), e.roundRect(B.left + De, n - 3, 14, 6, 2), e.fill(), e.fillStyle = p.color, e.fillText("base value", B.left + De + 18, n), e.fillStyle = m(u.cyan, .22), e.beginPath(), e.roundRect(B.left + De + 94, n - 3, 14, 6, 2), e.fill(), e.setLineDash([2, 3]), e.strokeStyle = m(u.cyan, .5), e.lineWidth = .5, e.beginPath(), e.moveTo(B.left + De + 101, n - 3), e.lineTo(B.left + De + 101, n + 3), e.stroke(), e.setLineDash([]), e.fillStyle = p.color, e.fillText("approved variations", B.left + De + 112, n), e.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", e.textAlign = "right", e.fillStyle = p.color, e.fillText(`Portfolio: ${Oe(h?.total ?? 0)}`, Ce - 8, n);
841
841
  }, !0, { easing: D }), k ? /* @__PURE__ */ s(F, {
842
842
  width: Ce,
843
843
  height: we,
@@ -979,7 +979,7 @@ function Fe({ items: e = [], "data-testid": t }) {
979
979
  } else t.beginPath(), t.arc(a, _, 1, 0, Math.PI * 2), t.fillStyle = m(d, .08), t.fill();
980
980
  }
981
981
  let _ = c + a * g + 16;
982
- t.font = `${o ? "bold " : ""}9px 'JetBrains Mono', monospace`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = o ? u.cyan : m(u.t2, .65), t.fillText(n.category, s + r * f + f / 2, _);
982
+ t.font = `${o ? "bold " : ""}14px 'Satoshi Variable', 'DM Sans', sans-serif`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = o ? u.cyan : m(u.t2, .65), t.fillText(n.category, s + r * f + f / 2, _);
983
983
  }), b(t, U, W, e, .015), S = requestAnimationFrame(C);
984
984
  };
985
985
  return C(), () => cancelAnimationFrame(S);
@@ -1024,14 +1024,13 @@ function Ie({ rows: e = [], className: t, colors: n }) {
1024
1024
  //#endregion
1025
1025
  //#region src/components/constants.ts
1026
1026
  var Le = [
1027
- "#36BFFA",
1028
- "#16B364",
1029
- "#D444F1",
1030
- "#FAC515",
1031
- "#2970FF",
1032
- "#7A5AF8",
1033
- "#EF6820",
1034
- "#D92D20"
1027
+ "#4C93D9",
1028
+ "#5DA537",
1029
+ "#F3862C",
1030
+ "#4F72C6",
1031
+ "#A0B724",
1032
+ "#EEBF3B",
1033
+ "#3C45D1"
1035
1034
  ], Re = {
1036
1035
  nodes: [
1037
1036
  {
@@ -1669,7 +1668,7 @@ function ot({ left: e, right: t, "data-testid": r }) {
1669
1668
  6
1670
1669
  ]), r.fill(), r.strokeStyle = m(u.green, .7 * i), r.lineWidth = 1.5, r.stroke(), r.strokeStyle = m(u.t3, .35 * i), r.lineWidth = 1, [-90 / 3, 90 / 3].forEach((e) => {
1671
1670
  r.beginPath(), r.moveTo(h.x + e, h.y + 4), r.lineTo(h.x + e, y), r.stroke();
1672
- }), i > .5 && (r.globalAlpha = Math.min(1, (i - .5) / .5), r.font = "bold 14px 'JetBrains Mono', monospace", r.fillStyle = u.green, r.textAlign = "center", r.fillText(e.label, h.x, y + _ + 18), r.font = f.font, r.fillStyle = f.color, r.fillText("Accepted", h.x, y + _ + 32), r.fillText(`${e.count} quotations`, h.x, y + _ + 44), r.globalAlpha = 1);
1671
+ }), i > .5 && (r.globalAlpha = Math.min(1, (i - .5) / .5), r.font = "bold 14px 'Satoshi Variable', 'DM Sans', sans-serif", r.fillStyle = u.green, r.textAlign = "center", r.fillText(e.label, h.x, y + _ + 18), r.font = f.font, r.fillStyle = f.color, r.fillText("Accepted", h.x, y + _ + 32), r.fillText(`${e.count} quotations`, h.x, y + _ + 44), r.globalAlpha = 1);
1673
1672
  let b = Math.max(20, t.value / s * 100 * i), x = g.y + 18;
1674
1673
  r.fillStyle = m(u.amber, .3 * i), r.strokeStyle = m(u.amber, .5 * i), r.lineWidth = 1.5, r.beginPath(), r.roundRect(g.x - 90 / 2, x, 90, b, [
1675
1674
  0,
@@ -1678,7 +1677,7 @@ function ot({ left: e, right: t, "data-testid": r }) {
1678
1677
  6
1679
1678
  ]), r.fill(), r.stroke(), r.strokeStyle = m(u.t3, .35 * i), r.lineWidth = 1, [-90 / 3, 90 / 3].forEach((e) => {
1680
1679
  r.beginPath(), r.moveTo(g.x + e, g.y + 4), r.lineTo(g.x + e, x), r.stroke();
1681
- }), i > .5 && (r.globalAlpha = Math.min(1, (i - .5) / .5), r.font = "bold 14px 'JetBrains Mono', monospace", r.fillStyle = u.amber, r.textAlign = "center", r.fillText(t.label, g.x, x + b + 18), r.font = f.font, r.fillStyle = f.color, r.fillText("Submitted", g.x, x + b + 32), r.fillText(`${t.count} quotations`, g.x, x + b + 44), r.globalAlpha = 1), i > .85 && Math.abs(c) > 1 && (r.globalAlpha = Math.min(1, (i - .85) / .15) * .6, r.font = f.font, r.fillStyle = f.color, r.textAlign = "center", r.fillText(`${Math.abs(c).toFixed(1)}° tilt toward accepted`, a, at - 12), r.globalAlpha = 1), l = requestAnimationFrame(d);
1680
+ }), i > .5 && (r.globalAlpha = Math.min(1, (i - .5) / .5), r.font = "bold 14px 'Satoshi Variable', 'DM Sans', sans-serif", r.fillStyle = u.amber, r.textAlign = "center", r.fillText(t.label, g.x, x + b + 18), r.font = f.font, r.fillStyle = f.color, r.fillText("Submitted", g.x, x + b + 32), r.fillText(`${t.count} quotations`, g.x, x + b + 44), r.globalAlpha = 1), i > .85 && Math.abs(c) > 1 && (r.globalAlpha = Math.min(1, (i - .85) / .15) * .6, r.font = f.font, r.fillStyle = f.color, r.textAlign = "center", r.fillText(`${Math.abs(c).toFixed(1)}° tilt toward accepted`, a, at - 12), r.globalAlpha = 1), l = requestAnimationFrame(d);
1682
1681
  };
1683
1682
  return d(), () => cancelAnimationFrame(l);
1684
1683
  }, [e, t]), /* @__PURE__ */ s("div", {
@@ -2208,7 +2207,7 @@ function kt({ items: e = [], "data-testid": t }) {
2208
2207
  ]), t.fill(), t.stroke(), g > 28 && i > .5 && (t.font = "500 14px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = S > 0 ? u.amber : u.t2, t.textAlign = "center", t.fillText(String(e.unimplemented ?? 0), 60 + p + g / 2, d + a / 2 + 4))), p > 0 && g > 0 && (t.strokeStyle = m(u.bg, .7), t.lineWidth = 2, t.beginPath(), t.moveTo(60 + p, d), t.lineTo(60 + p, d + a), t.stroke());
2209
2208
  });
2210
2209
  let r = h + f + 24, i = 60 + s / 2;
2211
- t.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", t.textAlign = "right", t.fillStyle = u.green, t.fillText("■ Implemented", i - 10, r), t.textAlign = "left", t.fillStyle = p.color, t.fillText("■ Unimplemented", i + 10, r), g = requestAnimationFrame(S);
2210
+ t.font = "400 14px 'Satoshi Variable', 'DM Sans', sans-serif", t.textAlign = "right", t.fillStyle = u.green, t.fillText("■ Implemented", i - 10, r), t.textAlign = "left", t.fillStyle = p.color, t.fillText("■ Unimplemented", i + 10, r), g = requestAnimationFrame(S);
2212
2211
  };
2213
2212
  return S(), () => cancelAnimationFrame(g);
2214
2213
  }, [y, b]), g.length === 0 ? /* @__PURE__ */ s(F, {
@@ -2464,9 +2463,9 @@ var Z = {
2464
2463
  fontWeight: 500,
2465
2464
  lineHeight: "32px"
2466
2465
  }, $ = {
2467
- color: "#CECFD2",
2466
+ color: "#C2C2C2",
2468
2467
  fontFamily: Q,
2469
- fontSize: 14,
2468
+ fontSize: 16,
2470
2469
  fontWeight: 400,
2471
2470
  lineHeight: "20px"
2472
2471
  };
@@ -2559,7 +2558,7 @@ function Wt({ items: e = [] }) {
2559
2558
  children: [
2560
2559
  /* @__PURE__ */ s("span", {
2561
2560
  style: {
2562
- fontSize: 14,
2561
+ fontSize: 16,
2563
2562
  fontWeight: 600,
2564
2563
  color: e.color ?? Z.t2,
2565
2564
  background: (e.color ?? Z.t2) + "22",
@@ -2573,7 +2572,7 @@ function Wt({ items: e = [] }) {
2573
2572
  /* @__PURE__ */ s("span", {
2574
2573
  style: {
2575
2574
  ...Vt,
2576
- fontSize: 14,
2575
+ fontSize: 16,
2577
2576
  color: e.color ?? Z.t1,
2578
2577
  minWidth: 70,
2579
2578
  flexShrink: 0
@@ -2686,7 +2685,7 @@ function Jt({ min: e, max: t, unit: n, dots: r = [], chips: i = [] }) {
2686
2685
  position: "absolute",
2687
2686
  top: 43,
2688
2687
  left: 0,
2689
- fontSize: 14,
2688
+ fontSize: 16,
2690
2689
  color: Z.t4,
2691
2690
  fontFamily: Q
2692
2691
  },
@@ -2697,7 +2696,7 @@ function Jt({ min: e, max: t, unit: n, dots: r = [], chips: i = [] }) {
2697
2696
  position: "absolute",
2698
2697
  top: 43,
2699
2698
  right: 0,
2700
- fontSize: 14,
2699
+ fontSize: 16,
2701
2700
  color: Z.t4,
2702
2701
  fontFamily: Q
2703
2702
  },
@@ -2720,7 +2719,7 @@ function Jt({ min: e, max: t, unit: n, dots: r = [], chips: i = [] }) {
2720
2719
  },
2721
2720
  children: [/* @__PURE__ */ s("div", {
2722
2721
  style: {
2723
- fontSize: 14,
2722
+ fontSize: 16,
2724
2723
  color: o,
2725
2724
  fontFamily: Q,
2726
2725
  whiteSpace: "nowrap"
@@ -2728,7 +2727,7 @@ function Jt({ min: e, max: t, unit: n, dots: r = [], chips: i = [] }) {
2728
2727
  children: t.name
2729
2728
  }), /* @__PURE__ */ c("div", {
2730
2729
  style: {
2731
- fontSize: 14,
2730
+ fontSize: 16,
2732
2731
  fontWeight: 700,
2733
2732
  color: o,
2734
2733
  fontFamily: Q,
@@ -2752,7 +2751,7 @@ function Jt({ min: e, max: t, unit: n, dots: r = [], chips: i = [] }) {
2752
2751
  },
2753
2752
  children: [/* @__PURE__ */ s("div", {
2754
2753
  style: {
2755
- fontSize: 14,
2754
+ fontSize: 16,
2756
2755
  color: o,
2757
2756
  fontFamily: Q,
2758
2757
  whiteSpace: "nowrap"
@@ -2760,7 +2759,7 @@ function Jt({ min: e, max: t, unit: n, dots: r = [], chips: i = [] }) {
2760
2759
  children: t.name
2761
2760
  }), /* @__PURE__ */ c("div", {
2762
2761
  style: {
2763
- fontSize: 14,
2762
+ fontSize: 16,
2764
2763
  fontWeight: 700,
2765
2764
  color: o,
2766
2765
  fontFamily: Q,
@@ -2798,7 +2797,7 @@ function Yt({ leftPct: e, leftLabel: t, leftValue: n, leftColor: r, rightPct: i,
2798
2797
  },
2799
2798
  children: /* @__PURE__ */ s("span", {
2800
2799
  style: {
2801
- fontSize: 14,
2800
+ fontSize: 16,
2802
2801
  fontWeight: 700,
2803
2802
  color: f,
2804
2803
  fontFamily: Q
@@ -2821,7 +2820,7 @@ function Yt({ leftPct: e, leftLabel: t, leftValue: n, leftColor: r, rightPct: i,
2821
2820
  },
2822
2821
  children: /* @__PURE__ */ s("span", {
2823
2822
  style: {
2824
- fontSize: 14,
2823
+ fontSize: 16,
2825
2824
  fontWeight: 700,
2826
2825
  color: p,
2827
2826
  fontFamily: Q
@@ -2840,7 +2839,7 @@ function Yt({ leftPct: e, leftLabel: t, leftValue: n, leftColor: r, rightPct: i,
2840
2839
  style: { width: `${e}%` },
2841
2840
  children: /* @__PURE__ */ c("span", {
2842
2841
  style: {
2843
- fontSize: 14,
2842
+ fontSize: 16,
2844
2843
  color: f,
2845
2844
  fontFamily: Q
2846
2845
  },
@@ -2857,7 +2856,7 @@ function Yt({ leftPct: e, leftLabel: t, leftValue: n, leftColor: r, rightPct: i,
2857
2856
  },
2858
2857
  children: /* @__PURE__ */ c("span", {
2859
2858
  style: {
2860
- fontSize: 14,
2859
+ fontSize: 16,
2861
2860
  color: p,
2862
2861
  fontFamily: Q
2863
2862
  },
@@ -2919,7 +2918,7 @@ function Xt({ pct: e, label: t, color: n, chips: r }) {
2919
2918
  },
2920
2919
  children: /* @__PURE__ */ c("div", {
2921
2920
  style: {
2922
- fontSize: 14,
2921
+ fontSize: 16,
2923
2922
  fontWeight: 700,
2924
2923
  color: i,
2925
2924
  fontFamily: Q
@@ -2994,7 +2993,7 @@ function $t({ items: e = [] }) {
2994
2993
  children: [
2995
2994
  /* @__PURE__ */ s("span", {
2996
2995
  style: {
2997
- fontSize: 14,
2996
+ fontSize: 16,
2998
2997
  fontWeight: 600,
2999
2998
  color: e.color ?? Z.t2,
3000
2999
  background: (e.color ?? Z.t2) + "1A",
@@ -3025,7 +3024,7 @@ function $t({ items: e = [] }) {
3025
3024
  }),
3026
3025
  /* @__PURE__ */ s("span", {
3027
3026
  style: {
3028
- fontSize: 14,
3027
+ fontSize: 16,
3029
3028
  fontWeight: 700,
3030
3029
  color: e.color ?? Z.t1,
3031
3030
  fontFamily: Q,
@@ -3037,7 +3036,7 @@ function $t({ items: e = [] }) {
3037
3036
  }),
3038
3037
  e.badge && e.badgeSeverity && /* @__PURE__ */ s("span", {
3039
3038
  style: {
3040
- fontSize: 14,
3039
+ fontSize: 16,
3041
3040
  fontWeight: 600,
3042
3041
  color: Qt[e.badgeSeverity],
3043
3042
  background: Zt[e.badgeSeverity],
@@ -3104,7 +3103,7 @@ function tn({ items: e = [] }) {
3104
3103
  }),
3105
3104
  /* @__PURE__ */ s("span", {
3106
3105
  style: {
3107
- fontSize: 14,
3106
+ fontSize: 16,
3108
3107
  fontWeight: 600,
3109
3108
  color: n,
3110
3109
  background: n + "20",
@@ -3146,7 +3145,7 @@ function nn({ columns: e = [], rows: t = [] }) {
3146
3145
  children: [/* @__PURE__ */ s("div", { style: { minWidth: 64 } }), e.map((e, t) => /* @__PURE__ */ s("div", {
3147
3146
  style: {
3148
3147
  flex: 1,
3149
- fontSize: 14,
3148
+ fontSize: 16,
3150
3149
  fontWeight: 600,
3151
3150
  color: Z.t2,
3152
3151
  fontFamily: Q,
@@ -3166,7 +3165,7 @@ function nn({ columns: e = [], rows: t = [] }) {
3166
3165
  },
3167
3166
  children: [/* @__PURE__ */ s("span", {
3168
3167
  style: {
3169
- fontSize: 14,
3168
+ fontSize: 16,
3170
3169
  fontWeight: 600,
3171
3170
  color: Z.t2,
3172
3171
  background: (e.color ?? Z.t4) + "1A",
@@ -3181,7 +3180,7 @@ function nn({ columns: e = [], rows: t = [] }) {
3181
3180
  }), e.cells.map((t, n) => /* @__PURE__ */ s("span", {
3182
3181
  style: {
3183
3182
  flex: 1,
3184
- fontSize: 14,
3183
+ fontSize: 16,
3185
3184
  fontWeight: 700,
3186
3185
  color: e.color ?? Z.t1,
3187
3186
  fontFamily: Q
@@ -3196,13 +3195,13 @@ function rn({ text: e }) {
3196
3195
  style: {
3197
3196
  padding: "8px 12px",
3198
3197
  border: `1px solid ${u.bd}`,
3199
- borderLeft: "4px solid #FFAE43",
3198
+ borderLeft: "4px solid #71B941",
3200
3199
  borderRadius: 5,
3201
- background: `linear-gradient(90deg, rgba(255, 174, 67, 0.10) -48.4%, rgba(19, 22, 27, 0.10) 83.98%), ${u.sf}`
3200
+ background: `linear-gradient(90deg, rgba(113, 185, 65, 0.10) -48.4%, rgba(19, 22, 27, 0.10) 83.98%), ${u.sf}`
3202
3201
  },
3203
3202
  children: [/* @__PURE__ */ s("span", {
3204
3203
  style: {
3205
- fontSize: 14,
3204
+ fontSize: 16,
3206
3205
  fontWeight: 500,
3207
3206
  color: u.t1,
3208
3207
  fontFamily: Q,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divami-artefacts/ai-design-system",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "module": "./dist/index.js",