semiotic 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +50 -8
- package/README.md +11 -11
- package/ai/examples.md +91 -0
- package/ai/schema.json +223 -9
- package/ai/system-prompt.md +12 -4
- package/dist/components/ChartContainer.d.ts +2 -0
- package/dist/components/DataSummaryContext.d.ts +12 -0
- package/dist/components/Tooltip/FlippingTooltip.d.ts +34 -0
- package/dist/components/charts/index.d.ts +4 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +3 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +3 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +0 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +3 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +3 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +16 -2
- package/dist/components/charts/ordinal/LikertChart.d.ts +94 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +0 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +11 -7
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +14 -1
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +65 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +16 -2
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +20 -0
- package/dist/components/charts/shared/annotationResolvers.d.ts +28 -0
- package/dist/components/charts/shared/hooks.d.ts +23 -2
- package/dist/components/charts/shared/selectionUtils.d.ts +5 -1
- package/dist/components/charts/shared/statsTooltip.d.ts +11 -0
- package/dist/components/charts/shared/types.d.ts +22 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +12 -2
- package/dist/components/charts/shared/useLikertAggregation.d.ts +51 -0
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +54 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +12 -0
- package/dist/components/charts/xy/AreaChart.d.ts +11 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -0
- package/dist/components/realtime/types.d.ts +4 -0
- package/dist/components/semiotic-ai.d.ts +1 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-themes.d.ts +16 -0
- package/dist/components/semiotic-utils.d.ts +30 -0
- package/dist/components/semiotic.d.ts +4 -4
- package/dist/components/store/LinkedCrosshairStore.d.ts +11 -0
- package/dist/components/store/useSelection.d.ts +1 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +28 -6
- package/dist/components/stream/FocusRing.d.ts +33 -0
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +43 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +16 -0
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +5 -47
- package/dist/components/stream/SVGOverlay.d.ts +4 -0
- package/dist/components/stream/SceneGraph.d.ts +6 -1
- package/dist/components/stream/XYBrushOverlay.d.ts +47 -0
- package/dist/components/stream/geoTypes.d.ts +5 -1
- package/dist/components/stream/keyboardNav.d.ts +85 -9
- package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +35 -0
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +25 -0
- package/dist/components/stream/networkTypes.d.ts +5 -1
- package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +12 -0
- package/dist/components/stream/ordinalTypes.d.ts +15 -3
- package/dist/components/stream/pipelineDecay.d.ts +20 -0
- package/dist/components/stream/pipelinePulse.d.ts +24 -0
- package/dist/components/stream/pipelineTransitions.d.ts +59 -0
- package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +2 -1
- package/dist/components/stream/types.d.ts +19 -1
- package/dist/components/stream/useMediaPreferences.d.ts +11 -0
- package/dist/components/stream/xySceneBuilders/areaScene.d.ts +13 -0
- package/dist/components/stream/xySceneBuilders/barScene.d.ts +18 -0
- package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +8 -0
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +13 -0
- package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +3 -0
- package/dist/components/stream/xySceneBuilders/lineScene.d.ts +12 -0
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +12 -0
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +93 -0
- package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +12 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +1 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/{semiotic-statisticalOverlays-D8LhSbQt.js → semiotic-statisticalOverlays-DGX_WWc5.js} +1 -1
- package/dist/semiotic-themes.d.ts +16 -0
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.d.ts +30 -0
- package/dist/semiotic-utils.min.js +1 -0
- package/dist/semiotic-utils.module.min.js +1 -0
- package/dist/semiotic.d.ts +4 -4
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +15 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useRef as t,useState as r,useEffect as n,createContext as o,useMemo as i,useContext as a,useCallback as s,useSyncExternalStore as c,forwardRef as l,useImperativeHandle as u,useId as d}from"react";import{interpolateNumber as h}from"d3-interpolate";import{min as y,groups as g,max as f,sum as p,mean as m,group as v}from"d3-array";import{schemeCategory10 as b,interpolatePlasma as x,interpolateViridis as k,interpolatePurples as A,interpolateOranges as w,interpolateGreens as S,interpolateReds as E,interpolateBlues as L,schemeSet3 as O,schemeTableau10 as D}from"d3-scale-chromatic";import{forceLink as j,forceSimulation as P,forceManyBody as C,forceCenter as I,forceX as N,forceY as M}from"d3-force";import{scaleLinear as T,scaleOrdinal as $}from"d3-scale";import{ribbon as _,chord as W}from"d3-chord";import{arc as B,pie as R}from"d3-shape";import{hierarchy as z,partition as H,pack as F,treemap as Y,treemapBinary as X,cluster as q,tree as G}from"d3-hierarchy";const V={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},K={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Z{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const r=this.particles[t];if(!r.active)return r.active=!0,r.t=0,r.offset=Math.random()-.5,r.edgeIndex=e,r.x=0,r.y=0,r}return null}step(e,t,r,n){var o;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=r[a.edgeIndex];if(!s||!s.bezier){a.active=!1;continue}const c=n&&null!==(o=n[a.edgeIndex])&&void 0!==o?o:1;if(a.t+=e*t*c*(s.bezier.circular?.3:1),a.t>=1){a.active=!1;continue}const l=U(s.bezier,a.t,a.offset);a.x=l.x,a.y=l.y}}countForEdge(e){let t=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let r=0;e>r;r++)this.particles[r]=t.length>r?t[r]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function U(e,t,r){if(e.circular&&e.segments)return function(e,t,r,n){const o=e.length,i=t*o,a=Math.min(Math.floor(i),o-1),s=i-a,[c,l,u,d]=e[a],h=Q(c,l,u,d,s),y=d.x-c.x,g=d.y-c.y,f=Math.sqrt(y*y+g*g);if(f>.001){const e=y/f;h.x+=-g/f*r*n*2,h.y+=e*r*n*2}return h}(e.segments,t,r,e.halfWidth);if(!e.points)return{x:0,y:0};const[n,o,i,a]=e.points,s=Q(n,o,i,a,t),c=a.x-n.x,l=a.y-n.y,u=Math.sqrt(c*c+l*l);if(u>.001){const t=c/u;s.x+=-l/u*r*e.halfWidth*2,s.y+=t*r*e.halfWidth*2}return s}function Q(e,t,r,n,o){const i=1-o,a=i*i,s=a*i,c=o*o,l=c*o;return{x:s*e.x+3*a*o*t.x+3*i*c*r.x+l*n.x,y:s*e.y+3*a*o*t.y+3*i*c*r.y+l*n.y}}function J(e,t){var r=e.get(t);if(!r)throw Error("missing: "+t);return r}function ee(e,t){var r,n=[],o=[],i=[],a={},s=[];function c(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&c(t)})}function l(e){var t,n,d=!1;for(o.push(e),i[e]=!0,t=0;s[e].length>t;t++)(n=s[e][t])===r?(u(r,o),d=!0):i[n]||(d=l(n));if(d)c(e);else for(t=0;s[e].length>t;t++){var h=a[n=s[e][t]];h||(a[n]=h={}),h[n]=!0}return o.pop(),d}function u(e,t){var r=[].concat(t).concat(e);n.push(r)}function d(t){!function(t){for(var r=0;e.length>r;r++)r>=t&&e[r]||(e[r]=[]),e[r]=e[r].filter(function(e){return e>=t})}(t);for(var r,n=function(e){for(var t=e.length,r=Array(t),n=Array(t),o=Array(t),i=Array(t),a=Array(t),s=Array(t),c=0;t>c;++c)r[c]=-1,n[c]=0,o[c]=!1,i[c]=0,a[c]=-1,s[c]=[];var l,u=0,d=[],h=[];function y(t){var c=[t],l=[t];for(r[t]=n[t]=u,o[t]=!0,u+=1;l.length>0;){var y=e[t=l[l.length-1]];if(y.length>i[t]){for(var g=i[t];y.length>g;++g){var f=y[g];if(0>r[f]){r[f]=n[f]=u,o[f]=!0,u+=1,c.push(f),l.push(f);break}o[f]&&(n[t]=0|Math.min(n[t],n[f])),0>a[f]||s[t].push(a[f])}i[t]=g}else{if(n[t]===r[t]){var p=[],m=[],v=0;for(g=c.length-1;g>=0;--g){var b=c[g];if(o[b]=!1,p.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){c.length=g;break}}d.push(p);var x=Array(v);for(g=0;m.length>g;g++)for(var k=0;m[g].length>k;k++)x[--v]=m[g][k];h.push(x)}l.pop()}}}for(c=0;t>c;++c)0>r[c]&&y(c);for(c=0;h.length>c;c++){var g=h[c];if(0!==g.length){g.sort(function(e,t){return e-t}),l=[g[0]];for(var f=1;g.length>f;f++)g[f]!==g[f-1]&&l.push(g[f]);h[c]=l}}return{components:d,adjacencyList:h}}(e),o=n.components.filter(function(e){return e.length>1}),i=1/0,a=0;o.length>a;a++)for(var s=0;o[a].length>s;s++)i>o[a][s]&&(i=o[a][s],r=a);var c=o[r];if(!c)return!1;var l=e.map(function(e,t){return-1===c.indexOf(t)?[]:e.filter(function(e){return-1!==c.indexOf(e)})});return{leastVertex:i,adjList:l}}r=0;for(var h=e.length;h>r;){var y=d(r);if(r=y.leastVertex,s=y.adjList){for(var g=0;s.length>g;g++)for(var f=0;s[g].length>f;f++){var p=s[g][f];i[+p]=!1,a[p]={}}l(r),r+=1}else r=h}return n}function te(e){return e.y0-e.y1>0?"up":"down"}function re(e,t){return t(e.source)==t(e.target)}function ne(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var r=0;return e.target.targetLinks.forEach(function(e){r=e.circular?r+1:r}),1>=t&&1>=r}function oe(e){return e.target.x0-e.source.x1}function ie(e,t){var r=se(e),n=oe(t)/Math.tan(r);return"up"==te(e)?e.y1-n:e.y1+n}function ae(e,t){var r=se(e),n=oe(t)/Math.tan(r);return"up"==te(e)?e.y1+n:e.y1-n}function se(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function ce(e,t){return t(e)}function le(e){return de(e.source)}function ue(e){return de(e.target)}function de(e){return(e.y0+e.y1)/2}function he(e){return e.virtual?0:e.value}function ye(e,t){var r=0;e.sourceLinks.forEach(function(e){r=e.circular&&!re(e,t)?r+1:r});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!re(e,t)?n+1:n}),r+n}function ge(e){return e.target.depth}function fe(e,t){return e.sourceLinks.length?e.depth:t-1}function pe(e,t){return e.y0-t.y0}function me(e,t){return t.y0-e.y0}function ve(e,t){return e.y1-t.y1}function be(e,t){return t.y1-e.y1}function xe(e,t){return Ae(e.source,t.source)||e.index-t.index}function ke(e,t){return Ae(e.target,t.target)||e.index-t.index}function Ae(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function we(e,t){return Se(e)==Se(t)?"bottom"==e.circularLinkType?me(e,t):pe(e,t):Se(t)-Se(e)}function Se(e){return e.target.column-e.source.column}function Ee(e,t){return Le(e)==Le(t)}function Le(e){return e.y0-e.y1>0?"up":"down"}function Oe(e,t,r,n,o){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=y(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=i.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),De(i.links.filter(function(e){return"top"==e.circularLinkType}),t,r),De(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,r),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,re(e,t)&&ne(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,c=e.circularLinkType,l=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==c});l.sort("bottom"==e.circularLinkType?me:pe);var u=0;l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),a=e.target.column,(l=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==c})).sort("bottom"==e.circularLinkType?be:ve),u=0,l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,r=e.y0,n=e.target.x0,o=e.y1,i=(t+n)/2;return"M"+t+","+r+"C"+i+","+r+" "+i+","+o+" "+n+","+o}(e)}),i}function De(e,t,r){e.sort(we);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,o){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(re(e,t)&&ne(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;n.length>a;a++){var s=n[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&je(e,s)){var c=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+r;i=c>i?c:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function je(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Pe(e){return function(){return e}}function Ce(e){return e.index}function Ie(e){return e.nodes}function Ne(e){return e.links}function Me(e,t,r){var n=g(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(o,i){var a=o.length;if(t)o.sort(t);else if(i>0){var s=new Map;o.forEach(function(e,t){var r,n,o,i=(n=0,o=0,(r=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=de(e.source)*t,n+=t}}),r.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=de(e.target)*t,n+=t}}),n>0?o/n:NaN);s.set(e,{bc:i,idx:t})}),o.sort(function(e,t){var r=s.get(e),n=s.get(t),o=r.bc,i=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?r.idx-n.idx:1:-1:o-i})}else o.sort(function(e,t){return e.circularLinkType==t.circularLinkType?ye(t,r)-ye(e,r):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});o.forEach(function(t,o){t.depth==n.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==ye(t,r)?(t.y0=e.y1/2+o,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+o,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-o,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*o,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+o,t.y1=t.y0+t.value*e.ky)})})}function Te(e,t,r,n,o,i){var a=g(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,c=i;c>0;--c)l(s*=.99,r),u();function l(t,r){var n=a.length;a.forEach(function(o){var i=o.length,a=o[0].depth;o.forEach(function(o){var s;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&ye(o,r)>0){var c=m(o.sourceLinks,ue),l=m(o.targetLinks,le),u=c&&l?(c+l)/2:c||l;if(u){var d=(u-de(o))*t*.3;o.y0+=d,o.y1+=d}}else if(0==a&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(a==n-1&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)s=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+s;else{var h=m(o.sourceLinks,ue),y=m(o.targetLinks,le),g=((h&&y?(h+y)/2:h||y)-de(o))*t;o.y0+=g,o.y1+=g}})})}function u(){a.forEach(function(r){var i,a,s,c=e.y0,l=r.length;for(r.sort(t||Ae),s=0;l>s;++s)(a=c-(i=r[s]).y0)>0&&(i.y0+=a,i.y1+=a),c=i.y1+n;if((a=c-n-e.y1)>0)for(c=i.y0-=a,i.y1-=a,s=l-2;s>=0;--s)(a=(i=r[s]).y1+o-c)>0&&(i.y0-=a,i.y1-=a),c=i.y0})}}function $e(e){e.nodes.forEach(function(e){e.sourceLinks.sort(ke),e.targetLinks.sort(xe)}),e.nodes.forEach(function(e){var t=e.y0,r=t,n=e.y1,o=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=o-e.width/2,o-=e.width):(e.y1=r+e.width/2,r+=e.width)})})}function _e(){var e=0,t=0,r=1,n=1,o=24,i=8,a=null,s=Ce,c=fe,l=void 0,u=32,d=2,h=Ie,m=Ne;function b(){var b={nodes:h.apply(null,arguments),links:m.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=r,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var r=function(e,t){var r=new Map;return v(e,t).forEach(function(e,t){r.set(t,e[0])}),r}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,o=e.target;"object"!=typeof n&&(n=e.source=J(r,n)),"object"!=typeof o&&(o=e.target=J(r,o)),n.sourceLinks.push(e),o.targetLinks.push(e)})}(h,s),function(e,t){var r=0;if(null==t){for(var n=[],o=0;e.links.length>o;o++){var i=e.links[o],a=i.source.index,s=i.target.index;n[a]||(n[a]=[]),n[s]||(n[s]=[]),-1===n[a].indexOf(s)&&n[a].push(s)}var c=ee(n);c.sort(function(e,t){return e.length-t.length});var l={};for(o=0;c.length>o;o++){var u=c[o].slice(-2);l[u[0]]||(l[u[0]]={}),l[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||l[n]&&l[n][t]?(e.circular=!0,e.circularLinkID=r++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=r++)})}(h,l),function(e,t){var r=0,n=0;e.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:n>r?"top":"bottom","top"==o.circularLinkType?r++:n++,e.nodes.forEach(function(e){ce(e,t)!=ce(o.source,t)&&ce(e,t)!=ce(o.target,t)||(e.circularLinkType=o.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),re(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(p(e.sourceLinks,he),p(e.targetLinks,he)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,r){var n,o,i;if(null!=t){e.nodes.sort(function(e,r){return t(e)<t(r)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>o.indexOf(e.target)&&!e.circular&&o.push(e.target)})});for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>o.indexOf(e.source)&&!e.circular&&o.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?r(e,i):e.column})}(h,l,c);var m=i;if(null!==a){var b=g(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),x=f(b,function(e){return e.length});x>1&&(m=Math.max(1,(n-t)*a/(x-1)))}(function(e,t,r){var n=g(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var o=y(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/p(t,function(e){return e.value})});e.ky=o,e.links.forEach(function(t){t.width=t.value*e.ky});var i=f(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-r)/i),t.x1=t.x0+r}:function(t){t.x0=e.x0,t.x1=t.x0+r})})(h,m,o),Me(h,l,s),Te(h,l,s,m,m,u),$e(h),Oe(h,s,d,10,8),Me(h,l,s),Te(h,l,s,m,m,u),$e(h),Oe(h,s,d,10,8),function(e,t){let r=e;r.nodes.forEach(function(e){e.y+(e.y1-e.y0)>r.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-r.y1));var n=r.links.filter(function(r){return ce(r.source,t)==ce(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Ee(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var r=ie(t,e);return e.y1-r}if(t.target.column>e.target.column)return ie(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let r=e;r.nodes.forEach(function(e){var n=r.links.filter(function(r){return ce(r.target,t)==ce(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Ee(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var r=ae(t,e);return e.y0-r}if(t.source.column>e.source.column)return ae(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,r=e.links,n=!1,o=!1;if(r.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(o=!0)}),0==n||0==o){var i=y(t,function(e){return e.y0}),a=f(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function c(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1)}),r.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,r=c(e.y0)-e.y0;e.y0=c(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+r}),e.targetLinks.forEach(function(e){e.y1=e.y1+r})})}}(h),Oe(h,s,d,10,8)}(b),b}return b.update=function(e){return $e(e),Oe(e,s,d,10,8),e},b.nodeWidth=function(e){return arguments.length?(o=+e,b):o},b.nodePadding=function(e){return arguments.length?(i=+e,b):i},b.nodePaddingRatio=function(e){return arguments.length?(a=+e,b):a},b.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Pe(e),b):h},b.links=function(e){return arguments.length?(m="function"==typeof e?e:Pe(e),b):m},b.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Pe(e),b):s},b.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Pe(e),b):c},b.nodeSort=function(e){return arguments.length?(l=e,b):l},b.iterations=function(e){return arguments.length?(u=+e,b):u},b.circularLinkGap=function(e){return arguments.length?(d=+e,b):d},b.extent=function(o){return arguments.length?(e=+o[0][0],t=+o[0][1],r=+o[1][0],n=+o[1][1],b):[[e,t],[r,n]]},b.size=function(o){return arguments.length?(e=t=0,r=+o[0],n=+o[1],b):[r-e,n-t]},b}const We=e=>{let t,r,n,o,i,a,s,c,l;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,r=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,o=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=h(i,a),c=s(.5),l=s(.5),`M${t},${i}C${t},${c} ${r},${l} ${r},${a}L${n},${a}C${n},${l} ${o},${c} ${o},${i}Z`):(t=e.source.x1,r=e.target.x0,s=h(t,r),n=s(.5),o=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,c=e.y1+e.sankeyWidth/2,l=e.y0+e.sankeyWidth/2,`M${t},${i}C${n},${i} ${o},${a} ${r},${a}L${r},${c}C${o},${c} ${n},${l} ${t},${l}Z`)};function Be(e){var t;const r=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,o=e.circularPathData;if(!o)return null;if("down"===e.direction)return null;if(e._circularStub){const t=o.sourceX,n=o.sourceY,i=o.targetX,a=o.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(o.rightFullExtent-t))),c=Math.max(15,Math.min(40,.33*(i-o.leftFullExtent)));return`M${t},${n-r}L${t+s},${n-r}L${t+s},${n+r}L${t},${n+r}ZM${i},${a-r}L${i-c},${a-r}L${i-c},${a+r}L${i},${a+r}Z`}const i=o.sourceX,a=o.sourceY,s=o.targetX,c=o.targetY,l=o.rightFullExtent,u=o.leftFullExtent,d=o.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,y=Math.max(4,Math.min(n,15));return`M${i},${a-h*r}L${l},${a-h*r}L${l+n},${a-h*r+h*y}L${l+n},${d+h*n-h*y}L${l+n-y},${d+h*n}L${u-n+y},${d+h*n}L${u-n},${d+h*n-h*y}L${u-n},${c-h*r+h*y}L${u-n+y},${c-h*r}L${s},${c-h*r}L${s},${c+h*r}L${u+n},${c+h*r}L${u+n},${d-h*n}L${l-n},${d-h*n}L${l-n},${a+h*r}L${i},${a+h*r}Z`}const Re={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(ge))-1:0},justify:fe},ze={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){var o,i,a,s,c,l,u;if(0===e.length)return;const d="vertical"===r.orientation?"down":"right",h=r.nodeAlign||"justify",y=null!==(o=r.nodeWidth)&&void 0!==o?o:15,g=null!==(i=r.nodePaddingRatio)&&void 0!==i?i:.05,f=null!==(a=r.iterations)&&void 0!==a?a:100,p=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=_e().extent(v).links(m).nodes(p).nodeAlign(Re[h]||fe).nodeId(e=>e.id).nodeWidth(y).iterations(f);b.nodePaddingRatio&&b.nodePaddingRatio(g),b();{let e=1/0,t=-1/0,r=1/0,o=-1/0;for(const n of p)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),r>n.y0&&(r=n.y0),n.y1>o&&(o=n.y1);for(const n of m){if(!n.circular||!n.circularPathData)continue;const i=n.circularPathData,a=(null!==(c=null!==(s=n._circularWidth)&&void 0!==s?s:n.width)&&void 0!==c?c:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),r>i.verticalFullExtent-a&&(r=i.verticalFullExtent-a),i.verticalFullExtent+a>o&&(o=i.verticalFullExtent+a)}const i=t-e,a=o-r,u=n[0],d=n[1];if(i>0&&a>0&&(0>e||0>r||t>u||o>d)){const t=Math.min(u/i,d/a),n=-e*t+(u-i*t)/2,o=-r*t+(d-a*t)/2;for(const e of p)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+o,e.y1=e.y1*t+o;for(const e of m)if(e.y0=e.y0*t+o,e.y1=e.y1*t+o,e.width=(null!==(l=e.width)&&void 0!==l?l:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const r=e.circularPathData;r.sourceX=r.sourceX*t+n,r.targetX=r.targetX*t+n,r.sourceY=r.sourceY*t+o,r.targetY=r.targetY*t+o,r.rightFullExtent=r.rightFullExtent*t+n,r.leftFullExtent=r.leftFullExtent*t+n,r.verticalFullExtent=r.verticalFullExtent*t+o,r.rightInnerExtent=r.rightInnerExtent*t+n,r.leftInnerExtent=r.leftInnerExtent*t+n,r.verticalRightInnerExtent=r.verticalRightInnerExtent*t+o,r.verticalLeftInnerExtent=r.verticalLeftInnerExtent*t+o,r.rightSmallArcRadius*=t,r.rightLargeArcRadius*=t,r.leftSmallArcRadius*=t,r.leftLargeArcRadius*=t,r.sourceWidth*=t,r.rightNodeBuffer*=t,r.leftNodeBuffer*=t,r.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of p){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=e.source,r=e.target,n="object"==typeof t&&null!==t?t.id:t+"",o="object"==typeof r&&null!==r?r.id:r+"",i=k.get(e._edgeKey?e._edgeKey:`${n}\0${o}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(n),r=x.get(o);t&&(i.source=t),r&&(i.target=r)}}},buildScene(e,t,r,n){var o,i,a,s;const c="vertical"===r.orientation?"down":"right",l=r.nodeStyle,u=r.edgeStyle,d=null!==(o=r.edgeOpacity)&&void 0!==o?o:.5,h=r.edgeColorBy||"source",y=Array.isArray(r.colorScheme)?r.colorScheme:b,g=new Map;e.forEach((e,t)=>{g.set(e.id,y[t%y.length])});const f=[],p=[],m=[],v=new Map;for(const t of e){const e=t.x1-t.x0,r=t.y1-t.y0;if(0>=e||0>=r)continue;const n=l?l(t):{},o={fill:n.fill||g.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};v.set(t.id,("string"==typeof o.fill?o.fill:null)||g.get(t.id)||"#4d430c"),f.push("down"===c?{type:"rect",x:t.y0,y:t.x0,w:r,h:e,style:o,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:r,style:o,datum:t,id:t.id,label:t.id})}const x=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of x){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let n="#999";n="function"==typeof h?h(e)||n:"target"===h?v.get(r.id)||g.get(r.id)||n:v.get(t.id)||g.get(t.id)||n;const o=u?u(e):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,r=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),c=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),l=o.fill||n;p.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-r}L${t.sourceX+s},${t.sourceY-r}L${t.sourceX+s},${t.sourceY+r}L${t.sourceX},${t.sourceY+r}Z`,style:{fill:l,fillOpacity:null!==(i=o.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:o.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),p.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-r}L${t.targetX-c},${t.targetY-r}L${t.targetX-c},${t.targetY+r}L${t.targetX},${t.targetY+r}Z`,style:{fill:l,fillOpacity:null!==(a=o.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:o.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-c,x1:t.targetX}});continue}let c;if(c=e.circular&&e.circularPathData?Be(e):We(e),!c)continue;const l={fill:o.fill||n,fillOpacity:null!==(s=o.fillOpacity)&&void 0!==s?s:d,stroke:o.stroke||"none",strokeWidth:o.strokeWidth,opacity:o.opacity};p.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:l,datum:e})}if(!1!==r.showLabels){const t=(k=r.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null;for(const r of e){const e=r.x1-r.x0,o=r.y1-r.y0;if(0>=e||0>=o)continue;const i=t?t(r):r.id;if(!i)continue;let a,s,l;"down"===c?(a=r.y0+(r.y1-r.y0)/2,s=r.x1+14,l="middle"):(n[0]/2>r.x0+e/2?(a=r.x0-6,l="end"):(a=r.x1+6,l="start"),s=r.y0+o/2),m.push({x:a,y:s,text:i+"",anchor:l,baseline:"middle",fontSize:11})}}var k;return{sceneNodes:f,sceneEdges:p,labels:m}}},He={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){var o,i;if(0===e.length)return;const a=null!==(o=r.forceStrength)&&void 0!==o?o:.1,s=n[0]/2,c=n[1]/2,l=r.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),r=null==l?void 0:l.get(t.id);e?u++:r?(t.x=r.x,t.y=r.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const r=new Map;for(const t of e)r.set(t.id,t);for(const e of d){const n=Fe(e.id,t,r);if(n.length>0){let t=0,r=0;for(const e of n)t+=e.x,r+=e.y;const o=Ye(e.id),i=o%360*(Math.PI/180),a=10+o%20;e.x=t/n.length+a*Math.cos(i),e.y=r/n.length+a*Math.sin(i)}else{const t=Ye(e.id),r=t%360*(Math.PI/180),n=15+t%30;e.x=s+n*Math.cos(r),e.y=c+n*Math.sin(r)}}}else{const t=2.399963229728653;for(let r=0;e.length>r;r++){const n=e[r];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(r+.5),o=r*t;n.x=s+e*Math.cos(o),n.y=c+e*Math.sin(o)}}}const y=null!==(i=r.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),g=h?40:y,f=Xe(r.nodeSize,r.nodeSizeRange,e),p=e=>f(e),m=j().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),v=P().force("charge",C().strength(e=>-25*p(e))).force("center",I(s,c).strength(.8)).force("x",N(s).strength(.15)).force("y",M(c).strength(.15));if(v.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));v.force("link",m),v.force("link").links(e)}h?v.alpha(.3):.1>v.alpha()&&v.alpha(1),v.stop();for(let e=0;g>e;++e)v.tick();for(const t of e){if(null==t.x||null==t.y)continue;const e=p(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=b.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=b.get(e.target);t&&(e.target=t)}}},buildScene(e,t,r,n){var o,i,a;const s=r.nodeStyle,c=r.edgeStyle,l=Xe(r.nodeSize,r.nodeSizeRange,e),u=Array.isArray(r.colorScheme)?r.colorScheme:b,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],y=[],g=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=l(t),r=s?s(t):{},n={fill:r.fill||d.get(t.id)||"#007bff",stroke:r.stroke||"#fff",strokeWidth:null!==(o=r.strokeWidth)&&void 0!==o?o:2,opacity:r.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:n,datum:t,id:t.id,label:t.id})}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:f.get(e.source),r="object"==typeof e.target?e.target:f.get(e.target);if(!t||!r)continue;if(null==t.x||null==t.y)continue;if(null==r.x||null==r.y)continue;const n=c?c(e):{},o={stroke:n.stroke||"#999",strokeWidth:null!==(i=n.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=n.opacity)&&void 0!==a?a:.6};y.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:o,datum:e})}if(!1!==r.showLabels){const t=(p=r.nodeLabel)?"function"==typeof p?p:e=>e[p]||e.id:null;for(const r of e){if(null==r.x||null==r.y)continue;const e=t?t(r):r.id;if(!e)continue;const n=l(r);g.push({x:r.x,y:r.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var p;return{sceneNodes:h,sceneEdges:y,labels:g}}};function Fe(e,t,r){const n=[];for(const o of t){const t="string"==typeof o.source?o.source:o.source.id,i="string"==typeof o.target?o.target:o.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=r.get(a);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function Ye(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function Xe(e,t,r){var n,o;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=r.map(t=>{var r;return null===(r=t.data)||void 0===r?void 0:r[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(n=y(a))&&void 0!==n?n:0,c=null!==(o=f(a))&&void 0!==o?o:1;if(s===c)return()=>(i[0]+i[1])/2;const l=T().domain([s,c]).range(i).clamp(!0);return t=>{var r;const n=null===(r=t.data)||void 0===r?void 0:r[e];return null==n||"number"!=typeof n?i[0]:l(n)}}const qe=b,Ge={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const{padAngle:o=.01,groupWidth:i=20,sortGroups:a}=r,s=Math.min(n[0],n[1])/2,c=s-i,l=n[0]/2,u=n[1]/2,d=(h=r.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const y=new Map;for(let t=0;e.length>t;t++)y.set(e[t].id,t);const g=e.length,f=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,r=y.get("string"==typeof e.source?e.source:e.source.id),n=y.get(t);if(void 0===r||void 0===n)continue;const o=d(e);f[r][n]=o}const p=W().padAngle(o);a&&p.sortGroups(a);const m=p(f),v=m.groups,b=B().innerRadius(c).outerRadius(s);for(const t of v){const r=e[t.index],n=b.centroid(t);r.x=n[0]+l,r.y=n[1]+u,r.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,r=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);r&&(e.source=r),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const r=e[t.source.index].id,n=e[t.target.index].id,o=k.get(`${r}\0${n}`)||k.get(`${n}\0${r}`);o&&(o.chordData=t)}},buildScene(e,t,r,n){var o,i;const{groupWidth:a=20,edgeOpacity:s=.5}=r,c=Math.min(n[0],n[1])/2,l=c-a,u=n[0]/2,d=n[1]/2,h=r.nodeStyle,y=r.edgeStyle,g=r.edgeColorBy||"source",f=Array.isArray(r.colorScheme)?r.colorScheme:qe,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const m=_().radius(l),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const r=e[t],n=r.arcData;if(!n)continue;let i;i=h?h(r).fill||p.get(r.id)||f[t%f.length]:p.get(r.id)||f[t%f.length];const a=h?h(r):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(o=a.strokeWidth)&&void 0!==o?o:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:l,outerR:c,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:s,datum:r,id:r.id,label:r.id})}for(const e of t){const t=e.chordData;if(!t)continue;const r=m(t);if(!r)continue;const n=Ve(r,u,d);let o="#999";if(y)o=y(e).fill||o;else{const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;"target"===g&&r?o=p.get(r.id)||o:t&&(o=p.get(t.id)||o)}const a=y?y(e):{},c={fill:o,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:n,style:c,datum:e})}if(!1!==r.showLabels){const t=(k=r.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null,n=c+12;for(const r of e){const e=r.arcData;if(!e)continue;const o=t?t(r):r.id;if(!o)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*n,y:d+Math.sin(a)*n,text:o+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:v,sceneEdges:b,labels:x}}};function Ve(e,t,r){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const o=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("C"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("Q"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("A"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&(o.push(Number(n[i])+t+""),i++),n.length>i&&(o.push(Number(n[i])+r+""),i++);else"Z"===e||"z"===e?(o.push(e),i++):(o.push(n[i]),i++)}return o.join(" ")}function Ke(e){const[t,r,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*r+.114*n>150?"#222":"#fff"}const Ze={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,r,n){var o;const i=r.__hierarchyRoot;if(!i)return;const a=r.chartType,s=(c=r.childrenAccessor)?"function"==typeof c?c:e=>e[c]:void 0;var c;const l=r.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=z(i,s);u.sum(l),u.sort((e,t)=>{var r,n;return(null!==(r=t.value)&&void 0!==r?r:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[d,h]=n;switch(a){case"tree":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=G();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(u,r,d,h);break;case"cluster":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=q();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(u,r,d,h);break;case"treemap":!function(e,t,r,n){var o,i;const a=null!==(o=t.padding)&&void 0!==o?o:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,c=Y().size([r,n]).tile(X).padding(a);s>0&&c.paddingTop(s),c(e)}(u,r,d,h);break;case"circlepack":!function(e,t,r,n){var o;const i=null!==(o=t.padding)&&void 0!==o?o:4;F().size([r,n]).padding(i)(e)}(u,r,d,h);break;case"partition":!function(e,t,r,n){var o;H().size([r,n]).padding(null!==(o=t.padding)&&void 0!==o?o:1)(e)}(u,r,d,h)}const y=u.descendants();e.length=0,t.length=0;const g=new Map;for(let t=0;y.length>t;t++){const n=y[t],i={id:tt(n,r,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(o=n.value)&&void 0!==o?o:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===a||"cluster"===a?Ue(i,n,r):"treemap"===a||"partition"===a?Qe(i,n):"circlepack"===a&&Je(i,n),i.__hierarchyNode=n,e.push(i),g.set(n,i)}if("tree"===a||"cluster"===a)for(const e of y)if(e.parent){const r=g.get(e.parent),n=g.get(e);r&&n&&t.push({source:r,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,r,n){const o=r.nodeStyle||(()=>({})),i=r.edgeStyle||(()=>({}));switch(r.chartType){case"tree":case"cluster":return function(e,t,r,n,o,i){var a,s,c,l,u;const d=[],h=[],y=[],g=r.treeOrientation||"vertical",f="radial"===g,p=n[0]/2,m=n[1]/2,v="number"==typeof(x=r.nodeSize)?x:5,b=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];var x;for(const t of e){let e=t.x,n=t.y;f&&(e+=p,n+=m);const i=o(t);let s=i.fill||"#4d430c";r.colorByDepth&&void 0!==t.depth&&(s=b[t.depth%b.length]);const c={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:n,r:v,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const k=null!==(s=r.edgeOpacity)&&void 0!==s?s:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let n=t.x,o=t.y,a=r.x,s=r.y;f&&(n+=p,o+=m,a+=p,s+=m);const u=et(n,o,a,s,g),d=i(e),y={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(c=d.strokeWidth)&&void 0!==c?c:1.5,opacity:null!==(l=d.opacity)&&void 0!==l?l:k};h.push({type:"curved",pathD:u,style:y,datum:e})}if(!1!==r.showLabels){const t=rt(r.nodeLabel);for(const r of e){const e=t?t(r):r.id;if(!e)continue;let n,o,i,a=r.x,s=r.y;if(f&&(a+=p,s+=m),f){const e=a-p,t=s-m,r=Math.sqrt(e*e+t*t);r>0?(n=a+e/r*10,o=s+t/r*10,i=0>e?"end":"start"):(n=a,o=s-12,i="middle")}else"horizontal"===g?((null===(u=r.data)||void 0===u?void 0:u.children)&&0!==r.data.children.length?(n=a-v-6,i="end"):(n=a+v+6,i="start"),o=s):(n=a,o=s+v+14,i="middle");y.push({x:n,y:o,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:y}}(e,t,r,n,o,i);case"treemap":case"partition":return function(e,t,r,n){var o,i;const a=[],s=[],c=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const r of e){const e=r.x1-r.x0,i=r.y1-r.y0;if(0>=e||0>=i)continue;const s=n(r);let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==r.depth&&(l=c[r.depth%c.length]);const u={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(o=s.strokeWidth)&&void 0!==o?o:1,opacity:s.opacity};a.push({type:"rect",x:r.x0,y:r.y0,w:e,h:i,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=rt(t.nodeLabel),o=t.labelMode||"leaf",a="partition"===t.chartType;for(const l of e){const e=l.x1-l.x0,u=l.y1-l.y0;if(0>=e||0>=u)continue;const d=!((null===(i=l.data)||void 0===i?void 0:i.children)&&l.data.children.length>0);if(!a){if("leaf"===o&&!d)continue;if("parent"===o&&d)continue}const h=r?r(l):l.id;if(!h)continue;if((d?30:40)>e||(d?16:14)>u)continue;let y=n(l).fill||"#4d430c";t.colorByDepth&&void 0!==l.depth&&(y=c[l.depth%c.length]);const g=Ke(y);s.push(d?{x:l.x0+e/2,y:l.y0+u/2,text:h+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,u)/6)),fill:g}:{x:l.x0+4,y:l.y0+12,text:h+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:g})}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,r,0,o);case"circlepack":return function(e,t,r,n){var o,i,a,s,c;const l=[],u=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const r of e){const e=null!==(o=r.__radius)&&void 0!==o?o:5;if(0>=e)continue;const s=n(r);let c=s.fill||"#4d430c";t.colorByDepth&&void 0!==r.depth&&(c=d[r.depth%d.length]);const u={fill:c,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};l.push({type:"circle",cx:r.x,cy:r.y,r:e,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=rt(t.nodeLabel);for(const o of e){const e=null!==(s=o.__radius)&&void 0!==s?s:5,i=r?r(o):o.id;if(!i)continue;if(15>e)continue;const a=!((null===(c=o.data)||void 0===c?void 0:c.children)&&o.data.children.length>0);let l=n(o).fill||"#4d430c";if(t.colorByDepth&&void 0!==o.depth&&(l=d[o.depth%d.length]),a){const t=Ke(l);u.push({x:o.x,y:o.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:t})}else u.push({x:o.x,y:o.y-e+14,text:i+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:"#000",stroke:"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:l,sceneEdges:[],labels:u}}(e,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Ue(e,t,r){const n=r.treeOrientation||"vertical";if("radial"===n){const r=t.x,n=t.y;e.x=n*Math.cos(r-Math.PI/2),e.y=n*Math.sin(r-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Qe(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Je(e,t){var r;const n=null!==(r=t.r)&&void 0!==r?r:0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}function et(e,t,r,n,o){if("horizontal"===o){const o=(e+r)/2;return`M ${e},${t} C ${o},${t} ${o},${n} ${r},${n}`}if("radial"===o){const o=(e+r)/2;return`M ${e},${t} Q ${o},${t} ${o},${(t+n)/2} T ${r},${n}`}{const o=(t+n)/2;return`M ${e},${t} C ${e},${o} ${r},${o} ${r},${n}`}}function tt(e,t,r){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+r}function rt(e){return e?"function"==typeof e?e:t=>{var r;return(null===(r=t.data)||void 0===r?void 0:r[e])||t[e]||t.id}:null}function nt(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const ot={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;o&&function(e,t,r,n,o){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(r.childrenAccessor),c=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var r;return(null!==(r=e[t])&&void 0!==r?r:"")+""}}(r.nodeIDAccessor),l=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),u=null!==(i=r.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=r.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,y="number"==typeof d?()=>d:d,g=nt(r);g.metaMap.clear(),n.length=0,o.length=0;const f=new Map;function p(e){var t;const r=null!==(t=f.get(e))&&void 0!==t?t:0;return f.set(e,r+1),0===r?e:`${e}__${r}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=p(c(e));n.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),g.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,r,i,a,u,d,f){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=l[Math.min(k,l.length-1)],k++,b++;let A=0;for(let v=0;b>v;v++){const x=l[Math.min(v,l.length-1)],k=m.slice(A,A+x);if(!k.length)break;const w=(v+1)/b,S={id:r,depth:d,data:t,parentId:r},E=f?u/h(S)*w:u*w,L=R().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),O=L(k),D=y(S);for(let t=0;k.length>t;t++){const s=(O[t].startAngle+O[t].endAngle)/2,l=k[t],u=p(c(l)),h=i+E*Math.sin(s),y=a+E*Math.cos(s)*D;n.push({id:u,x:h,y:y,x0:h,x1:h,y0:y,y1:y,width:0,height:0,value:0,depth:d,data:l}),g.metaMap.set(u,{ring:E,angle:s,depth:d,parentId:r,eccentricity:D}),o.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),e(l,u,h,y,E,d+1,!0)}A+=x}}(e,x,m,v,b,1,!1)}(o,n,r,e,t)},buildScene(e,t,r,n){var o,i,a,s,c;const l=r.nodeStyle,u=r.nodeSize,d="number"==typeof u?()=>u:"function"==typeof u?u:()=>6,h=[],y=[],g=[];if(!1!==r.orbitShowRings){const t=nt(r),n=new Map;for(const t of e)n.set(t.id,t);const o=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const r=`${e.parentId}:${e.ring}`;o.has(r)||o.set(r,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:r,ecc:n}]of o)for(let o=0;i>o;o++){const s=o/i*Math.PI*2,c=(o+1)/i*Math.PI*2;y.push({type:"line",x1:e+r*Math.sin(s),y1:t+r*Math.cos(s)*n,x2:e+r*Math.sin(c),y2:t+r*Math.cos(c)*n,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=d(t),r=l?l(t):{},n={fill:r.fill||"#6366f1",stroke:r.stroke||"#fff",strokeWidth:null!==(o=r.strokeWidth)&&void 0!==o?o:1,opacity:null!==(i=r.opacity)&&void 0!==i?i:0===(null!==(a=t.depth)&&void 0!==a?a:0)?1:.85};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:n,datum:t,id:t.id,label:t.id,depth:t.depth})}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:f.get(e.source),r="object"==typeof e.target?e.target:f.get(e.target);t&&r&&(null!=t.x&&null!=r.x&&y.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(r.showLabels){const t=r.nodeLabel;for(const r of e){const e=d(r);if(4>=e)continue;const n="function"==typeof t?t(r):t&&null!==(c=null===(s=r.data)||void 0===s?void 0:s[t])&&void 0!==c?c:r.id;g.push({x:r.x,y:r.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:y,labels:g}},tick:(e,t,r,n,o)=>!1!==r.orbitAnimated&&(function(e,t){var r,n;const o=nt(t),i=null!==(r=t.orbitSpeed)&&void 0!==r?r:.25,a=null!==(n=t.orbitRevolution)&&void 0!==n?n:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const r=null!==(t=e.depth)&&void 0!==t?t:0;return(r%2==0?1:-1)/(r+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,c=i*(Math.PI/6),l=new Map;for(const t of e)l.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=l.get(e.parentId);if(!r)continue;const n=e.angle+s*c*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=r.x+e.ring*Math.sin(n),t.y=r.y+e.ring*Math.cos(n)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,r),!0)},it={sankey:ze,force:He,chord:Ge,tree:Ze,cluster:Ze,treemap:Ze,circlepack:Ze,partition:Ze,orbit:ot};function at(e){return it[e]}function st(e,t,r){return e+(t-e)*r}class ct{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},V),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Z(2e3))}updateConfig(e){const t=this.config,r=e;t.__orbitState&&(r.__orbitState=t.__orbitState),t.__hierarchyRoot&&(r.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},V),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new Z(2e3))}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,r){const{nodeIDAccessor:n="id",sourceAccessor:o="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof n?n:e=>e[n],c="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},lt(e)),{data:t}))}for(let e=0;t.length>e;e++){const r=t[e],n=c(r)+"",o=l(r)+"",i=Number(u(r))||1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},lt(n)),{data:r})),this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},lt(o)),{data:r}));const a=`${n}\0${o}\0${e}`;this.edges.set(a,{source:n,target:o,value:i,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:a})}this.runLayout(r)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:r,value:n}=e,o=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,lt(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(r)||(this.nodes.set(r,lt(r)),this.nodeTimestamps.set(r,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,r),c=this.edges.get(s);let l=!1;return c?(c.value+=n,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,l=!0):(this.edges.set(s,{source:t,target:r,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),o||i||l||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,r,n,o,i,a;const s=at(this.config.chartType);if(!s)return;let c=Array.from(this.nodes.values()),l=Array.from(this.edges.values());if(0===c.length&&!s.hierarchical)return;if(this.prepareForRelayout(),s.supportsStreaming&&!s.hierarchical){const e=new Map;for(const s of c)if(void 0!==s._prevX0){const c=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(r=s._prevX0)&&void 0!==r?r:0),l=(null!==(n=s._prevY1)&&void 0!==n?n:0)-(null!==(o=s._prevY0)&&void 0!==o?o:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+c/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+l/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,r]of this._lastPositionSnapshot)e.has(t)||e.set(t,r);this.config.__previousPositions=e.size>0?e:void 0}if(s.computeLayout(c,l,this.config,e),delete this.config.__previousPositions,s.hierarchical&&c.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of c)this.nodes.set(e.id,e);for(let e=0;l.length>e;e++){const t=l[e],r=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=r,this.edges.set(r,t)}}this.finalizeLayout();const u=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||u.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=u,this.saveTargetPositions(),c.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const d=new Set(this.nodes.keys()),h=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of d)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)d.has(e)||this.removedNodes.add(e);for(const e of h)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)h.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=d,this.previousEdgeKeys=h,this.layoutVersion++}buildScene(e){const t=at(this.config.chartType);if(!t)return;const r=Array.from(this.nodes.values()),n=Array.from(this.edges.values()),{sceneNodes:o,sceneEdges:i,labels:a}=t.buildScene(r,n,this.config,e);this.sceneNodes=o,this.sceneEdges=i,this.labels=a}get isAnimating(){const e=at(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const r=at(this.config.chartType);if(!(null==r?void 0:r.tick))return!1;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());return r.tick(n,o,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.transition),r=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=st(e._prevX0,e._targetX0,r),e.x1=st(e._prevX1,e._targetX1,r),e.y0=st(e._prevY0,e._targetY0,r),e.y1=st(e._prevY1,e._targetY1,r));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=st(e._prevY0,e._targetY0,r),e.y1=st(e._prevY1,e._targetY1,r),e.sankeyWidth=st(e._prevSankeyWidth,e._targetSankeyWidth,r));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,r="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&r&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,r))}buildStandardBezier(e,t,r){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const o=t.x1,i=r.x0,a=h(o,i);return{circular:!1,points:[{x:e.y0,y:o},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:n}}const o=t.x1,i=r.x0,a=h(o,i);return{circular:!1,points:[{x:o,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,r=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(r.rightFullExtent-r.sourceX))),n=Math.max(15,Math.min(40,.33*(r.targetX-r.leftFullExtent)));return{circular:!0,segments:[[{x:r.sourceX,y:r.sourceY},{x:r.sourceX+.33*e,y:r.sourceY},{x:r.sourceX+.66*e,y:r.sourceY},{x:r.sourceX+e,y:r.sourceY}],[{x:r.targetX-n,y:r.targetY},{x:r.targetX-.66*n,y:r.targetY},{x:r.targetX-.33*n,y:r.targetY},{x:r.targetX,y:r.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:r.sourceY,y:r.sourceX},{x:r.sourceY,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.leftFullExtent},{x:r.targetY,y:r.leftFullExtent},{x:r.targetY,y:r.targetX}]:[{x:r.sourceX,y:r.sourceY},{x:r.rightFullExtent,y:r.sourceY},{x:r.rightFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.targetY},{x:r.targetX,y:r.targetY}];const o=[];for(let e=0;n.length-1>e;e++){const t=n[e],r=n[e+1],i=r.x-t.x,a=r.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},r])}return{circular:!0,segments:o,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,r,n,o,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,c=null!==(r=a.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(n=a.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const r=t.id;if(!r)continue;const n=this.nodeTimestamps.get(r);if(!n)continue;const o=e-n;s>o&&(t._pulseIntensity=1-o/s,t._pulseColor=c,t._pulseGlowRadius=l)}for(const t of this.sceneEdges){const r=t.datum;if(!r)continue;const n="object"==typeof r.source?null===(o=r.source)||void 0===o?void 0:o.id:r.source,a="object"==typeof r.target?null===(i=r.target)||void 0===i?void 0:i.id:r.target;if(!n||!a)continue;const l=this.edgeTimestamps.get(`${n}\0${a}`);if(!l)continue;const u=e-l;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=c)}}applyDecay(){var e,t,r,n,o;const i=this.config.decay;if(!i)return;const a=null!==(e=i.minOpacity)&&void 0!==e?e:.1,s=this.nodeTimestamps.size;if(1>=s)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const c=this._decaySortedNodes,l=new Map;for(let e=0;c.length>e;e++)l.set(c[e][0],e);for(const e of this.sceneNodes){const c=e.id;if(!c)continue;const u=l.get(c);if(void 0===u)continue;const d=s-1-u;let h;switch(i.type){case"linear":h=a+(1-d/(s-1))*(1-a);break;case"exponential":{const e=null!==(t=i.halfLife)&&void 0!==t?t:s/2;h=a+Math.pow(.5,d/e)*(1-a);break}case"step":h=(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*s)>d?1:a;break;default:h=1}const y=null!==(o=null===(n=e.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;e.style=Object.assign(Object.assign({},e.style),{opacity:y*h})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const r=e-this.lastTopologyChangeTime;if(r>=2e3)return;const n=1-r/2e3;for(const e of this.sceneNodes){const r=e.id;r&&this.addedNodes.has(r)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,n),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,r;const n=this.config.thresholds;if(!n)return;const o=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(r=n.criticalColor)&&void 0!==r?r:"#ef4444",a=!1!==n.pulse;for(const t of this.sceneNodes){const r=t.id;if(!r)continue;const s=this.nodes.get(r);if(!s)continue;const c=n.metric(s);let l=null;void 0===n.critical||n.critical>c?void 0===n.warning||n.warning>c||(l=o):l=i,l&&(t.style=Object.assign(Object.assign({},t.style),{fill:l}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=l,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const r=e.metric(t);if(void 0!==e.warning&&r>=e.warning||void 0!==e.critical&&r>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const r="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>r-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function lt(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function ut(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function dt(e,t,r,n,o=30){let i=null,a=o,s=1/0;for(const t of e){const e=ht(t,r,n);if(e)if("rect"===t.type){const r=t.w*t.h;s>r&&(i=e,s=r)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=pt(e,r,n);t&&a>t.distance&&(i=t,a=t.distance)}return i}function ht(e,t,r){switch(e.type){case"circle":return function(e,t,r){const n=t-e.cx,o=r-e.cy,i=Math.sqrt(n*n+o*o);return i>Math.max(e.r,5)+5?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,r);case"rect":return function(e,t,r){const n=function(e,t,r){return r.x>e||e>r.x+r.w||r.y>t||t>r.y+r.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:r.x+r.w/2,cy:r.y+r.h/2}}(t,r,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,r);case"arc":return function(e,t,r){const n=t-e.cx,o=r-e.cy,i=Math.sqrt(n*n+o*o);if(e.innerR-2>i||i>e.outerR+2)return null;const a=ut(Math.atan2(o,n)),s=ut(e.startAngle),c=ut(e.endAngle);if(s>c?a>=s||c>=a:a>=s&&c>=a){const t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+r*Math.cos(t),y:e.cy+r*Math.sin(t),distance:0}}return null}(e,t,r);default:return null}}let yt=null,gt=null;function ft(){return gt||(yt=document.createElement("canvas"),yt.width=1,yt.height=1,gt=yt.getContext("2d")),gt}function pt(e,t,r){switch(e.type){case"bezier":return function(e,t,r){var n,o;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),a=ft();if(!a)return null;if(a.isPointInPath(i,t,r)){const i="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.source)?e.datum.source:null,a="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:r,distance:0}}const s=a.lineWidth;a.lineWidth=10;const c=a.isPointInStroke(i,t,r);if(a.lineWidth=s,c)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch(e){}return null}(e,t,r);case"line":return function(e,t,r){const n=e.x2-e.x1,o=e.y2-e.y1,i=n*n+o*o;if(0===i)return null;let a=((t-e.x1)*n+(r-e.y1)*o)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*n,c=e.y1+a*o,l=Math.sqrt(Math.pow(t-s,2)+Math.pow(r-c,2));return l>5?null:{type:"edge",datum:e.datum,x:s,y:c,distance:l}}(e,t,r);case"ribbon":case"curved":return function(e,t,r){if(!e.pathD)return null;try{const n=new Path2D(e.pathD),o=ft();if(!o)return null;if(o.isPointInPath(n,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(n,t,r);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch(e){}return null}(e,t,r);default:return null}}const mt={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function vt(e,t,r,n){let o;return o="function"==typeof r?r(e):(0,mt[r])(n(e,t)),o}function bt(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function xt(e,t,r){return r&&r.size>0?r.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function kt({config:t,orientation:r="vertical",width:n=100}){const{colorFn:o,domain:i,label:a,format:s}=t,c=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+e.useId();if("horizontal"===r){const t=12,r=Math.min(n,200),s=Math.max(0,(n-r)/2),u=[];for(let t=0;64>=t;t++){const r=t/64;u.push(e.createElement("stop",{key:t,offset:100*r+"%",stopColor:o(i[0]+r*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+r/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:r,height:t,fill:`url(#${l})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},c(i[0])),e.createElement("text",{x:s+r,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},c(i[1])))}const u=[];for(let t=0;64>=t;t++){const r=t/64;u.push(e.createElement("stop",{key:t,offset:100*r+"%",stopColor:o(i[1]-r*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("defs",null,e.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},c(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},c(i[0])))}function At(t){const{legendGroups:r,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:c="Legend",width:l=100,height:u=20,orientation:d="vertical"}=t,[h,y]=e.useState(0),[g,f]=e.useState(0),p=e.useCallback((e,t)=>{y(e),f(t)},[]),m="vertical"===d?(({legendGroups:t,width:r,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:c,onFocusedIndexChange:l,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,y)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+y,stroke:"gray",x1:0,y1:d,x2:r,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+y,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+y,className:"legend-item",transform:`translate(0,${d})`},((t,r,n,o,i,a,s,c,l,u)=>{const{type:d="fill",styleFn:h,items:y}=t,g=[];let f=0;const p=!(!r&&!n),m="isolate"===u||void 0===u&&null!=i;return y.forEach((t,u)=>{const v=vt(t,u,d,h),b=xt(t,o,i),x=i&&i.size>0&&i.has(t.label);g.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${f})`,onClick:r?()=>r(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:p?c===a&&u===s?0:-1:void 0,role:p?"option":void 0,"aria-selected":p&&m?x||!1:void 0,"aria-current":p&&!m&&null!=o&&t.label===o||void 0,"aria-label":t.label,onKeyDown:p?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r&&r(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+y.length)%y.length;l(c,t);const r=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];r instanceof SVGElement&&r.focus()}}:void 0,onFocus:p?e=>{l(c,u),n&&n(t);const r=e.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:p?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:p?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},p&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(bt,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),f+=22}),g})(t,n,o,i,a,s,c,y,l,u))),d+=22*t.items.length+8}),h})({legendGroups:r||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s}):(({legendGroups:t,height:r,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:c,focusedItemIndex:l,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const y=[];t.forEach((t,r)=>{let n=0;t.label&&(n+=16);const g=((t,r,n,o,i,a,s,c,l,u)=>{const{type:d="fill",styleFn:h,items:y}=t,g=[];let f=0;const p=!(!r&&!n),m="isolate"===u||void 0===u&&null!=i;return y.forEach((t,u)=>{const v=vt(t,u,d,h),b=xt(t,o,i),x=i&&i.size>0&&i.has(t.label);g.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},0)`,onClick:r?()=>r(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:p?c===a&&u===s?0:-1:void 0,role:p?"option":void 0,"aria-selected":p&&m?x||!1:void 0,"aria-current":p&&!m&&null!=o&&t.label===o||void 0,"aria-label":t.label,onKeyDown:p?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r&&r(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+y.length)%y.length;l(c,t);const r=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];r instanceof SVGElement&&r.focus()}}:void 0,onFocus:p?e=>{l(c,u),n&&n(t);const r=e.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:p?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:p?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},p&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(bt,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),f+=26+7*t.label.length}),{items:g,offset:f}})(t,o,i,a,s,c,l,r,u,d);n+=g.offset+5,y.push(Object.assign(Object.assign({label:t.label},g),{offset:n})),h+=n+12});let g=Math.max(0,(n-h)/2);const f=[];return y.forEach((n,o)=>{const i=t[o];i.label&&(f.push(e.createElement("text",{key:"legend-text-"+o,transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),g+=16),f.push(e.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${g},0)`},n.items)),g+=n.offset+5,t[o+1]&&f.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:g,y1:-8,x2:g,y2:r+0+8})),g+=12}),e.createElement("g",null,f)})({legendGroups:r||[],title:c,height:u,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s}),v=!(!n&&!o);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==c&&""!==c&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},c),m)}function wt(t){const{width:r,height:n,totalWidth:o,totalHeight:i,margin:a,labels:s,title:c,legend:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:y,legendPosition:g="right",foregroundGraphics:f,sceneNodes:p,annotations:m,svgAnnotationRules:v}=t;return e.createElement(e.Fragment,null,e.createElement("svg",{role:"img",width:o,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof c?c:"Network Chart"),e.createElement("desc",null,"string"==typeof c?c+" — network data visualization":"Network data visualization"),e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,r)=>e.createElement("text",{key:"label-"+r,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),m&&m.filter(e=>"widget"!==e.type).map((t,o)=>{if(v){const i=v(t,o,{width:r,height:n,sceneNodes:p});if(i)return e.createElement(e.Fragment,{key:"annotation-"+o},i)}return null}),f),c&&"string"==typeof c?e.createElement("text",{x:o/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},c):c?e.createElement("foreignObject",{x:0,y:0,width:o,height:a.top},c):null,function(t){const{legend:r,totalWidth:n,totalHeight:o,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:c,legendClickBehavior:l,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!r)return null;const y="top"===a||"bottom"===a;let g,f;return"left"===a?(g=4,f=i.top):"top"===a?(g=0,f=s?32:8):"bottom"===a?(g=0,f=o-i.bottom+50):(g=n-i.right+10,f=i.top),e.createElement("g",{transform:`translate(${g}, ${f})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(r)?e.createElement(kt,{config:r.gradient,orientation:y?"horizontal":"vertical",width:y?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(r)?e.createElement(At,{legendGroups:r.legendGroups,title:"",width:y?n:100,orientation:y?"horizontal":"vertical",customHoverBehavior:c,customClickBehavior:l,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):r)}({legend:l,totalWidth:o,totalHeight:i,margin:a,legendPosition:g,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:y})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&p).map((t,r)=>{var n,o,i,s,c,l,u,d,h;const y=p.find(e=>{var r,n,o,i,a;return e.id===t.nodeId||(null===(r=e.datum)||void 0===r?void 0:r.id)===t.nodeId||(null===(o=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===o?void 0:o.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!y)return null;const g=a.left+(null!==(n=y.cx)&&void 0!==n?n:null!=y.x&&null!=y.w?y.x+y.w/2:null!==(o=y.x)&&void 0!==o?o:0),f=a.top+(null!==(i=y.cy)&&void 0!==i?i:null!=y.y&&null!=y.h?y.y+y.h/2:null!==(s=y.y)&&void 0!==s?s:0),m=null!==(c=t.dx)&&void 0!==c?c:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,b=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e.createElement("span",{style:{fontSize:18,cursor:"default"}},"ℹ️");return e.createElement("div",{key:"widget-"+r,style:{position:"absolute",left:g+m-b/2,top:f+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function St(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}wt.displayName="NetworkSVGOverlay";const Et="undefined"==typeof window||"undefined"==typeof document,Lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ot(e,t,r){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?r+", empty":`${r}, ${n.join(", ")}`}function Dt({nodes:t,chartType:r}){var n,o,i,a,s;const c=[];for(const e of t){if(c.length>=50)break;c.push({values:{id:(null===(n=e.datum)||void 0===n?void 0:n.id)||e.id||"",x:Math.round(100*(null!==(i=null!==(o=e.cx)&&void 0!==o?o:e.x)&&void 0!==i?i:0))/100+"",y:Math.round(100*(null!==(s=null!==(a=e.cy)&&void 0!==a?a:e.y)&&void 0!==s?s:0))/100+""}})}if(0===c.length)return null;const l=new Set;for(const e of c)for(const t of Object.keys(e.values))l.add(t);const u=Array.from(l);return e.createElement("table",{style:Lt,role:"table","aria-label":"Data table for "+r},e.createElement("thead",null,e.createElement("tr",null,u.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,c.map((t,r)=>e.createElement("tr",{key:r},u.map(r=>{var n;return e.createElement("td",{key:r},null!==(n=t.values[r])&&void 0!==n?n:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:u.length},"...and ",t.length-50," more items"))))}function jt({hoverPoint:t}){let r="";if(t){const e=t.data||t;r="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:Lt},r)}function Pt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Ct(e,t,r=.3){Pt(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function It(e,t,r=.6){var n,o,i,a,s;if(!Pt(t))return;const c=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,l=t.r+c*t._pulseIntensity,u=null!==(i=null!==(o=t.cx)&&void 0!==o?o:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,l,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*r,e.stroke()}function Nt(e,t){var r,n,o,i,a,s;if(!t.pathD)return;e.save();const c=new Path2D(t.pathD);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const o=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==n?n:.5,s="string"==typeof t.style.fill?t.style.fill:"#999";o.addColorStop(0,1===a.from?s:"transparent"),o.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=o,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==i?i:.5;e.fill(c)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(c)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(c)),e.restore()}function Mt(e,t){var r,n;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(n=t.style.strokeWidth)&&void 0!==n?n:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Tt(e,t){var r,n,o,i;if(!t.pathD)return;e.save();const a=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==n?n:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function $t(e,t){var r,n;if(!t.pathD)return;e.save();const o=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(o)),e.restore()}const _t={category10:b,tableau10:D,set3:O,blues:L,reds:E,greens:S,oranges:w,purples:A,viridis:k,plasma:x},Wt=b,Bt=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Rt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],zt=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Ht(e,t,r){if("function"==typeof t){const n=t(e);return r&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||zt.has(t)}(n)?r(n):n}const n=e[t];return r?r(n):Wt[Math.abs(function(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return Math.abs(t)}(n+""))%Wt.length]}function Ft(e,t,r="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),o=n.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(r))return $().domain(n).range(r).unknown("#999");const i=_t[r]||_t.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of n){const r=Number(t);r>e&&(e=r)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Wt;return $().domain(n).range(e).unknown("#999")}}function Yt(r){const n=o(null),l=Xt(r);return[function({children:t}){const o=i(()=>Xt(r),[]);return e.createElement(n.Provider,{value:o,children:t})},e=>{var r;const o=null!==(r=a(n))&&void 0!==r?r:l,i=t(e);i.current=e;const u=s(()=>i.current(o.getState()),[o]),d=s(()=>i.current(o.getState()),[o]);return c(o.subscribe,u,d)}]}function Xt(e){const t=new EventTarget;let r=e(function(e){r=Object.assign(Object.assign({},r),e(r)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>r,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const qt={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Gt={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Vt={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[Kt,Zt]=Yt(e=>({theme:qt,setTheme(t){e(e=>{if("light"===t)return{theme:qt};if("dark"===t)return{theme:Gt};if("high-contrast"===t)return{theme:Vt};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Gt:qt;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}})),Ut={top:20,right:80,bottom:20,left:80},Qt={top:40,right:40,bottom:40,left:40},Jt=new Set(["chord","force","circlepack","orbit"]),er=[800,600],tr={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function rr({data:t}){var r,n,o,i,a,s;if("edge"===t.type){const r=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:tr},e.createElement("div",{style:{fontWeight:600}},"object"==typeof r.source?r.source.id:r.source," → ","object"==typeof r.target?r.target.id:r.target),null!=r.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof r.value?r.value.toLocaleString():r.value+""))}const c=t.data,l=null==c?void 0:c.__hierarchyNode;if(l){const t=[];let a=l;for(;a;){const e=null!==(i=null!==(n=null===(r=a.data)||void 0===r?void 0:r.name)&&void 0!==n?n:null===(o=a.data)||void 0===o?void 0:o.id)&&void 0!==i?i:c.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:tr},e.createElement("div",null,t.map((t,r)=>e.createElement("span",{key:r},r>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),r===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=c.value&&c.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof c.value?c.value.toLocaleString():c.value+""))}const u=((null===(a=c.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=c.targetLinks)||void 0===s?void 0:s.length)||0),d=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:tr},e.createElement("div",{style:{fontWeight:600}},c.id),null!=c.value&&c.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const nr=l(function(o,a){var c,l,d,h,y,g,f,p,m,v,b;const{chartType:x,nodes:k,edges:A,data:w,initialEdges:S,nodeIDAccessor:E="id",sourceAccessor:L="source",targetAccessor:O="target",valueAccessor:D="value",childrenAccessor:j,hierarchySum:P,orientation:C="horizontal",nodeAlign:I="justify",nodePaddingRatio:N=.05,nodeWidth:M=15,iterations:T=300,forceStrength:$=.1,padAngle:_=.01,groupWidth:W=20,sortGroups:R,edgeSort:z,treeOrientation:H="vertical",edgeType:F="curve",padding:Y,paddingTop:X,tensionConfig:q,showParticles:G=!1,particleStyle:Z,nodeStyle:U,edgeStyle:Q,colorBy:J,colorScheme:ee="category10",edgeColorBy:te="source",edgeOpacity:re=.5,colorByDepth:ne=!1,nodeSize:oe=8,nodeSizeRange:ie=[5,20],nodeLabel:ae,showLabels:se=!0,labelMode:ce,size:le=er,responsiveWidth:ue,responsiveHeight:de,margin:he,className:ye,background:ge,enableHover:fe=!0,tooltipContent:pe,customHoverBehavior:me,customClickBehavior:ve,onObservation:be,chartId:xe,onTopologyChange:ke,annotations:Ae,svgAnnotationRules:we,legend:Se,legendPosition:Ee,legendHoverBehavior:Le,legendClickBehavior:Oe,legendHighlightedCategory:De,legendIsolatedCategories:je,title:Pe,foregroundGraphics:Ce,backgroundGraphics:Ie,decay:Ne,pulse:Me,staleness:Te,thresholds:$e,accessibleTable:_e,orbitMode:We,orbitSize:Be,orbitSpeed:Re,orbitRevolution:ze,orbitRevolutionStyle:He,orbitEccentricity:Fe,orbitShowRings:Ye,orbitAnimated:Xe}=o,qe=Jt.has(x)?Qt:Ut,[Ge,Ve]=function(e,o,i){const a=t(null),[s,c]=r(null);return n(()=>{if(!o&&!i)return;const e=a.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:r}=t.contentRect;c(t=>t&&t.w===e&&t.h===r?t:{w:e,h:r})}});return t.observe(e),()=>t.disconnect()},[o,i]),[a,[o&&s?s.w:e[0],i&&s?s.h:e[1]]]}(le,ue,de),Ke=Object.assign(Object.assign({},qe),he),Ze=Ve[0]-Ke.left-Ke.right,Ue=Ve[1]-Ke.top-Ke.bottom,Qe="function"==typeof Ce?Ce({size:Ve,margin:Ke}):Ce,Je=i(()=>Object.assign(Object.assign({},V),q),[q]),et=i(()=>Object.assign(Object.assign({},K),Z),[Z]),tt=i(()=>({chartType:x,nodeIDAccessor:E,sourceAccessor:L,targetAccessor:O,valueAccessor:D,childrenAccessor:j,hierarchySum:P,orientation:C,nodeAlign:I,nodePaddingRatio:N,nodeWidth:M,iterations:T,forceStrength:$,padAngle:_,groupWidth:W,sortGroups:R,edgeSort:z,treeOrientation:H,edgeType:F,padding:Y,paddingTop:X,tensionConfig:Je,showParticles:G,particleStyle:et,nodeStyle:U,edgeStyle:Q,nodeLabel:ae,showLabels:se,labelMode:ce,colorBy:J,colorScheme:ee,edgeColorBy:te,edgeOpacity:re,colorByDepth:ne,nodeSize:oe,nodeSizeRange:ie,decay:Ne,pulse:Me,staleness:Te,thresholds:$e,orbitMode:We,orbitSize:Be,orbitSpeed:Re,orbitRevolution:ze,orbitRevolutionStyle:He,orbitEccentricity:Fe,orbitShowRings:Ye,orbitAnimated:Xe}),[x,E,L,O,D,j,P,C,I,N,M,T,$,_,W,R,z,H,F,Y,X,Je,G,et,U,Q,ae,se,ce,J,ee,te,re,ne,oe,ie,Ne,Me,Te,$e,We,Be,Re,ze,He,Fe,Ye,Xe]),rt=t(null),nt=t(0),ot=t(0),it=t(!0),at=Zt(e=>e.theme),st=t(()=>{}),lt=t(null);lt.current||(lt.current=new ct(tt));const[ut,ht]=r(null),[yt,gt]=r(0),[ft,pt]=r(0),[mt,vt]=r(!1),bt=t(null),xt=t(new Map),kt=t(0),At=s(e=>{if("function"==typeof J)return J(e)+"";if("string"==typeof J&&e.data){const t=e.data[J];if(void 0!==t){if(!xt.current.has(t+"")){const e=Array.isArray(ee)?ee:Wt;xt.current.set(t+"",e[kt.current++%e.length])}return xt.current.get(t+"")}}if(xt.current.has(e.id))return xt.current.get(e.id);const t=Array.isArray(ee)?ee:Wt,r=J?t[kt.current++%t.length]:t[0];return xt.current.set(e.id,r),r},[J,ee]),Lt=s(e=>{if("function"==typeof te)return te(e);const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;return"target"===te&&r?At(r):t?At(t):"#999"},[te,At]),Pt=s(e=>{if(!(null==Z?void 0:Z.colorBy))return Lt(e);const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;return"target"===et.colorBy&&r?At(r):t?At(t):"#999"},[null==Z?void 0:Z.colorBy,et.colorBy,At,Lt]),_t="sankey"===x&&G||!!Me||null!==(l=null===(c=lt.current)||void 0===c?void 0:c.isAnimating)&&void 0!==l&&l,Bt=s(()=>{nt.current&&!_t||nt.current||(nt.current=requestAnimationFrame(()=>st.current()))},[_t]);n(()=>{var e;null===(e=lt.current)||void 0===e||e.updateConfig(tt),it.current=!0,Bt()},[tt,Bt]),n(()=>{it.current=!0,Bt()},[at,Bt]);const Rt=s(()=>{var e;const t=lt.current;if(!t)return;t.runLayout([Ze,Ue]),t.buildScene([Ze,Ue]),it.current=!0;for(const r of t.sceneNodes)r.id&&"string"==typeof(null===(e=r.style)||void 0===e?void 0:e.fill)&&xt.current.set(r.id,r.style.fill);const r=Array.isArray(ee)?ee:Wt,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];xt.current.has(t.id)||xt.current.set(t.id,r[e%r.length])}if(kt.current=n.length,gt(t.layoutVersion),ke){const{nodes:e,edges:r}=t.getLayoutData();ke(e,r)}},[Ze,Ue,ke,ee]),zt=s(e=>{const t=lt.current;t&&(t.ingestEdge(e)&&Rt(),Bt())},[Rt,Bt]),Ht=s(e=>{const t=lt.current;if(!t)return;let r=!1;for(const n of e)t.ingestEdge(n)&&(r=!0);r&&Rt(),Bt()},[Rt,Bt]),Ft=s(()=>{var e;null===(e=lt.current)||void 0===e||e.clear(),xt.current.clear(),kt.current=0,gt(0),ht(null),bt.current=null,it.current=!0,Bt()},[Bt]),Yt=s(()=>{const e=lt.current;e&&(e.tension+=999,Rt(),Bt())},[Rt,Bt]);u(a,()=>({push:zt,pushMany:Ht,clear:Ft,getTopology:()=>{var e,t;return null!==(t=null===(e=lt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=lt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Yt,getTension:()=>{var e,t;return null!==(t=null===(e=lt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[zt,Ht,Ft,Yt]);const Xt=["tree","cluster","treemap","circlepack","partition","orbit"].includes(x),qt=Xt?w||(Array.isArray(A)?void 0:A):void 0;n(()=>{var e;const t=lt.current;if(t)if(Xt&&qt)t.ingestHierarchy(qt,[Ze,Ue]),t.buildScene([Ze,Ue]),it.current=!0,Bt();else{const r=k||[],n=Array.isArray(A)?A:[];if(0===r.length&&0===n.length)return;t.ingestBounded(r,n,[Ze,Ue]),t.buildScene([Ze,Ue]);for(const r of t.sceneNodes)r.id&&(null===(e=r.style)||void 0===e?void 0:e.fill)&&xt.current.set(r.id,r.style.fill+"");const o=Array.isArray(ee)?ee:Wt,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];xt.current.has(t.id)||xt.current.set(t.id,o[e%o.length])}kt.current=i.length,it.current=!0,Bt()}},[k,A,w,qt,Xt,Ze,Ue,tt,Bt,ee]),n(()=>{S&&S.length>0&&Ht(S)},[]);const Gt=s(e=>{if(me&&me(e),be){const t=Date.now();be(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:xe}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:xe})}},[me,be,xe]),Vt=s(e=>{if(ve&&ve(e),be){const t=Date.now();be(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:xe}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:xe})}},[ve,be,xe]),Kt=t(()=>{}),tr=t(()=>{});Kt.current=e=>{if(!fe)return;const t=rt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-Ke.left,o=e.clientY-r.top-Ke.top;if(0>n||n>Ze||0>o||o>Ue)return void(bt.current&&(bt.current=null,ht(null),Gt&&(Gt(null),it.current=!0),Bt()));const i=lt.current;if(!i)return;const a=dt(i.sceneNodes,i.sceneEdges,n,o);if(!a)return void(bt.current&&(bt.current=null,ht(null),Gt&&(Gt(null),it.current=!0),Bt()));const s=a.datum||{},c=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{type:a.type,data:s,x:a.x,y:a.y});bt.current=c,ht(c),Gt&&(Gt(c),it.current=!0),Bt()},tr.current=()=>{bt.current&&(bt.current=null,ht(null),Gt&&(Gt(null),it.current=!0),Bt())};const nr=t(()=>{});nr.current=e=>{if(!ve&&!be)return;const t=rt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-Ke.left,o=e.clientY-r.top-Ke.top;if(0>n||n>Ze||0>o||o>Ue)return;const i=lt.current;if(!i)return;const a=dt(i.sceneNodes,i.sceneEdges,n,o);if(a){const e=a.datum||{};Vt(Object.assign(Object.assign({},"object"!=typeof e||null===e||Array.isArray(e)?{}:e),{type:a.type,data:e,x:a.x,y:a.y}))}else Vt(null)},s(e=>Kt.current(e),[]);const or=s(()=>tr.current(),[]),ir=s(e=>nr.current(e),[]),ar=t(-1),sr=s(e=>{const t=lt.current;if(!t)return;const r=function(e){const t=[];for(const r of e)"circle"===r.type&&null!=r.cx?t.push({x:r.cx,y:r.cy,datum:r.datum}):"rect"===r.type&&null!=r.x?t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum}):"arc"===r.type&&null!=r.cx&&t.push({x:r.cx,y:r.cy,datum:r.datum});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===r.length)return;const n=ar.current,o=function(e,t,r){switch(e){case"ArrowRight":case"ArrowDown":return r-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return r-1;case"Escape":return-1;default:return null}}(e.key,0>n?-1:n,r.length);if(null===o)return;if(e.preventDefault(),0>o)return ar.current=-1,bt.current=null,ht(null),Gt&&(Gt(null),it.current=!0),void Bt();const i=0>n?0:o;ar.current=i;const a=r[i],s=a.datum||{},c=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{type:"node",data:s,x:a.x,y:a.y});bt.current=c,ht(c),Gt&&(Gt(c),it.current=!0),Bt()},[Gt,Bt]),cr=s(e=>{ar.current=-1,Kt.current(e)},[]);st.current=()=>{var e,t,r,n,o,i,a;nt.current=0;const s=rt.current;if(!s)return;const c=s.getContext("2d");if(!c)return;const l=lt.current;if(!l)return;const u=performance.now(),d=ot.current?Math.min((u-ot.current)/1e3,.1):.016;ot.current=u;const h=l.advanceTransition(u),y=l.tickAnimation([Ze,Ue],d);(h||it.current||y)&&l.buildScene([Ze,Ue]);const g="undefined"!=typeof window&&window.devicePixelRatio||1;if(!function(e,t,r,n){const o=e.getContext("2d");if(!o)return null;const i=t[0]*n,a=t[1]*n,s=t[0]+"px",c=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==c&&(e.style.height=c),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(n,0,0,n,0,0),o.translate(r.left,r.top),o}(s,Ve,Ke,g))return;c.clearRect(-Ke.left,-Ke.top,Ve[0],Ve[1]),ge&&(c.fillStyle=ge,c.fillRect(0,0,Ze,Ue)),Ne&&l.applyDecay(),Me&&l.applyPulse(u),$e&&l.applyThresholds(u),l.applyTopologyDiff(u);const f=null!==(e=null==Te?void 0:Te.threshold)&&void 0!==e?e:5e3,p=Te&&l.lastIngestTime>0&&u-l.lastIngestTime>f;if(p&&(c.globalAlpha=null!==(t=null==Te?void 0:Te.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const r of t)switch(r.type){case"bezier":Nt(e,r);break;case"line":Mt(e,r);break;case"ribbon":Tt(e,r);break;case"curved":$t(e,r)}}(c,l.sceneEdges),function(e,t){var r,n,o;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.strokeRect(t.x,t.y,t.w,t.h)),Ct(e,t),e.restore())}}(c,l.sceneNodes),function(e,t){var r,n,o;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.stroke()),It(e,t),e.restore())}}(c,l.sceneNodes),function(e,t){var r,n,o;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.stroke()),e.restore()}}(c,l.sceneNodes),G&&l.particlePool&&!p){const e=Array.from(l.edges.values());if(e.length>0){!function(e,t,r,n){var o,i;const a=null!==(o=n.spawnRate)&&void 0!==o?o:K.spawnRate,s=null!==(i=n.maxPerEdge)&&void 0!==i?i:K.maxPerEdge;for(let n=0;t.length>n;n++){const o=t[n];if(!o.bezier)continue;if(e.countForEdge(n)>=s)continue;const i=o.value*a*r*(o.bezier.circular?.3:1),c=Math.floor(i),l=i-c;let u=c;Math.random()<l&&u++;for(let t=0;u>t&&e.countForEdge(n)<s;t++)e.spawn(n)}}(l.particlePool,e,d,et);const t=.5*(null!==(r=et.speedMultiplier)&&void 0!==r?r:1);let n;if(et.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}l.particlePool.step(d,t,e,n),function(e,t,r,n,o){var i,a;const s=null!==(i=n.radius)&&void 0!==i?i:K.radius,c=null!==(a=n.opacity)&&void 0!==a?a:K.opacity;e.globalAlpha=c;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const c=r[a.edgeIndex];if(c){if("function"==typeof n.color){const t="object"==typeof c.source?c.source:null;e.fillStyle=t?n.color(c,t):"#666"}else e.fillStyle=n.color&&"inherit"!==n.color?n.color:o(c);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(c,l.particlePool,e,et,Pt)}}p&&(c.globalAlpha=1);const m=it.current;if(it.current=!1,m||h||y){const e=rt.current;e&&e.setAttribute("aria-label",Ot(null!==(o=null===(n=l.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==o?o:0,null!==(a=null===(i=l.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}(m||h||y)&&pt(e=>e+1),(_t||h||y||l.hasActivePulses||l.hasActiveThresholds||l.hasActiveTopologyDiff)&&(nt.current=requestAnimationFrame(()=>st.current()))},n(()=>(Bt(),()=>{nt.current&&(cancelAnimationFrame(nt.current),nt.current=0)}),[Bt]),n(()=>{it.current=!0,Bt()},[x,Ze,Ue,ge,Bt]),function(e,t,r,o,i,a){n(()=>{if(!e)return;const n=setInterval(()=>{var n;const s=t.current;if(!s||0===s.lastIngestTime)return;const c="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(n=e.threshold)&&void 0!==n?n:5e3,u=c-s.lastIngestTime>l;u!==i&&(a(u),r.current=!0,o())},1e3);return()=>clearInterval(n)},[e,i,o])}(Te,lt,it,Bt,mt,vt);const lr=fe&&ut?e.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:Ke.left+ut.x,top:Ke.top+ut.y,transform:`translate(${ut.x>.6*Ze?"calc(-100% - 12px)":"12px"}, ${.3*Ue>ut.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2,width:"max-content"}},pe?pe(ut):e.createElement(rr,{data:ut})):null;if(Et){const t=lt.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(x),r=e?w||(Array.isArray(A)?void 0:A):void 0;if(e&&r)t.ingestHierarchy(r,[Ze,Ue]),t.buildScene([Ze,Ue]);else{const e=k||[],r=Array.isArray(A)?A:[];(e.length>0||r.length>0)&&(t.ingestBounded(e,r,[Ze,Ue]),t.buildScene([Ze,Ue]))}}const r=null!==(d=null==t?void 0:t.sceneNodes)&&void 0!==d?d:[],n=null!==(h=null==t?void 0:t.sceneEdges)&&void 0!==h?h:[],o=null!==(y=null==t?void 0:t.labels)&&void 0!==y?y:[];return e.createElement("div",{className:"stream-network-frame"+(ye?" "+ye:""),role:"img","aria-label":"string"==typeof Pe?Pe:"Network chart",style:{position:"relative",width:Ve[0],height:Ve[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ve[0],height:Ve[1],style:{position:"absolute",left:0,top:0}},Ie&&e.createElement("g",{transform:`translate(${Ke.left},${Ke.top})`},Ie),e.createElement("g",{transform:`translate(${Ke.left},${Ke.top})`},ge&&e.createElement("rect",{x:0,y:0,width:Ze,height:Ue,fill:ge}),n.map((t,r)=>function(t,r){switch(t.type){case"line":return e.createElement("line",{key:"net-edge-"+r,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity});case"bezier":{const n=t;return e.createElement("path",{key:"net-edge-"+r,d:n.pathD,fill:St(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"ribbon":{const n=t;return e.createElement("path",{key:"net-edge-"+r,d:n.pathD,fill:St(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"curved":{const n=t;return e.createElement("path",{key:"net-edge-"+r,d:n.pathD,fill:St(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity})}default:return null}}(t,r)).filter(Boolean),r.map((t,r)=>function(t,r){switch(t.type){case"circle":{const n=t;return e.createElement("circle",{key:"net-circle-"+r,cx:n.cx,cy:n.cy,r:n.r,fill:St(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"rect":{const n=t;return e.createElement("rect",{key:"net-rect-"+r,x:n.x,y:n.y,width:n.w,height:n.h,fill:St(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"arc":{const n=t,o=B().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle).endAngle(n.endAngle)({})||"";return e.createElement("path",{key:"net-arc-"+r,d:o,transform:`translate(${n.cx},${n.cy})`,fill:St(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}default:return null}}(t,r)).filter(Boolean),o.map((t,r)=>function(t,r){return e.createElement("text",{key:"net-label-"+r,x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder},t.text)}(t,r)).filter(Boolean))),e.createElement(wt,{width:Ze,height:Ue,totalWidth:Ve[0],totalHeight:Ve[1],margin:Ke,labels:o,sceneNodes:r,title:Pe,legend:Se,legendPosition:Ee,legendHoverBehavior:Le,legendClickBehavior:Oe,legendHighlightedCategory:De,legendIsolatedCategories:je,foregroundGraphics:Qe,annotations:Ae,svgAnnotationRules:we,annotationFrame:0}))}const ur=lt.current;return e.createElement("div",{ref:Ge,className:"stream-network-frame"+(ye?" "+ye:""),role:"img","aria-label":"string"==typeof Pe?Pe:"Network chart",tabIndex:0,style:{position:"relative",width:ue?"100%":Ve[0],height:de?"100%":Ve[1],overflow:"visible"},onMouseMove:fe?cr:void 0,onMouseLeave:fe?or:void 0,onClick:ve||be?ir:void 0,onKeyDown:sr},Ie&&e.createElement("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:Ve[0],height:Ve[1],pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${Ke.left},${Ke.top})`},Ie)),e.createElement("canvas",{ref:rt,"aria-label":Ot(null!==(f=null===(g=null==ur?void 0:ur.sceneNodes)||void 0===g?void 0:g.length)&&void 0!==f?f:0,null!==(m=null===(p=null==ur?void 0:ur.sceneEdges)||void 0===p?void 0:p.length)&&void 0!==m?m:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(jt,{hoverPoint:ut}),_e&&e.createElement(Dt,{nodes:null!==(v=null==ur?void 0:ur.sceneNodes)&&void 0!==v?v:[],edges:null!==(b=null==ur?void 0:ur.sceneEdges)&&void 0!==b?b:[],chartType:"Network chart"}),e.createElement(wt,{width:Ze,height:Ue,totalWidth:Ve[0],totalHeight:Ve[1],margin:Ke,labels:(null==ur?void 0:ur.labels)||[],sceneNodes:null==ur?void 0:ur.sceneNodes,title:Pe,legend:Se,legendPosition:Ee,legendHoverBehavior:Le,legendClickBehavior:Oe,legendHighlightedCategory:De,legendIsolatedCategories:je,foregroundGraphics:Qe,annotations:Ae,svgAnnotationRules:we,annotationFrame:ft}),lr,(null==Te?void 0:Te.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Te.badgePosition?{top:4,left:4}:"bottom-left"===Te.badgePosition?{bottom:4,left:4}:"bottom-right"===Te.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:mt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},mt?"STALE":"LIVE"))});nr.displayName="StreamNetworkFrame";const or={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function ir(e,t){return"function"==typeof t?t(e):e[t]}function ar(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function sr(t={}){const{fields:r,title:n,format:o,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const c=[];if(n){const e=ir(t,n);s=ar(e,o)}if(r&&r.length>0)r.forEach(e=>{let r,n,i;"string"==typeof e?(r=e,n=e,i=o):(r=e.label,n=e.accessor||e.key||"",i=e.format||o);const a=ir(t,n);c.push({label:r,value:ar(a,i)})});else if(!n){const e=["value","y","name","id","label"];for(const r of e)if(void 0!==t[r]){s=ar(t[r],o);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=ar(t[e[0]],o))}}const l=Object.assign(Object.assign({},or),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:l},s&&e.createElement("div",{style:{fontWeight:c.length>0?"bold":"normal"}},s),c.map((t,r)=>e.createElement("div",{key:r,style:{marginTop:0===r&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function cr(t){if(!0===t)return sr();if("function"==typeof t){const r=t;return t=>{const n=r(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==n?null:e.createElement("div",{className:"semiotic-tooltip",style:or},n)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?sr(t):sr())}const lr=o(null);function ur(e){const t=[];for(const[r,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[r]));else{const[e,o]=n.range;t.push(t=>{const n=t[r];return n>=e&&o>=n})}return e=>t.every(t=>t(e))}function dr(e,t){let r=e.get(t);return r||(r={name:t,resolution:"union",clauses:new Map},e.set(t,r)),r}const[hr,yr]=Yt(e=>({selections:new Map,setClause(t,r){e(e=>{const n=new Map(e.selections),o=dr(n,t),i=new Map(o.clauses);return i.set(r.clientId,r),n.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:n}})},clearClause(t,r){e(e=>{const n=e.selections.get(t);if(!n)return{};const o=new Map(e.selections),i=new Map(n.clauses);return i.delete(r),o.set(t,Object.assign(Object.assign({},n),{clauses:i})),{selections:o}})},setResolution(t,r){e(e=>{const n=new Map(e.selections),o=dr(n,t);return n.set(t,Object.assign(Object.assign({},o),{resolution:r})),{selections:n}})},clearSelection(t){e(e=>{const r=new Map(e.selections),n=r.get(t);return n&&r.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:r}})}})),[gr,fr]=Yt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const r=e.observations;return r.push(t),r.length>e.maxObservations&&r.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function pr(e){const t=d(),r=e.clientId||t,{name:n}=e,o=yr(e=>e.selections.get(n)),a=yr(e=>e.setClause),c=yr(e=>e.clearClause),l=i(()=>!!o&&o.clauses.size>0,[o]);return{predicate:i(()=>o&&0!==o.clauses.size?function(e,t){const r=[];for(const[n,o]of e.clauses)"crossfilter"===e.resolution&&n===t||r.push(ur(o));return 0===r.length?()=>!0:"intersect"===e.resolution?e=>r.every(t=>t(e)):e=>r.some(t=>t(e))}(o,r):()=>!0,[o,r]),isActive:l,selectPoints:s(e=>{const t={};for(const[r,n]of Object.entries(e))t[r]={type:"point",values:new Set(n)};a(n,{clientId:r,type:"point",fields:t})},[r,n,a]),selectInterval:s(e=>{const t={};for(const[r,n]of Object.entries(e))t[r]={type:"interval",range:n};a(n,{clientId:r,type:"interval",fields:t})},[r,n,a]),clear:s(()=>{c(n,r)},[c,n,r]),clientId:r}}const mr=o(!1);function vr(){var e;const t=Zt(e=>e.theme),r=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return r&&r.length>0?r:void 0}function br(e,t,r,n,o){let i;if(Array.isArray(r))i=r;else if(t&&t.length>0)i=t;else if("string"==typeof r){const e=_t[r];Array.isArray(e)&&(i=e)}return i&&0!==i.length?i[0]:"#007bff"}function xr(e,t,r="category10"){const n=a(lr);return i(()=>{if(t){if(0===e.length)return n&&Object.keys(n).length>0?e=>n[e]||"#999":void 0;if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));return n&&Object.keys(n).length>0?e=>n[e]||"#999":Ft(o.map(e=>({_cat:e})),"_cat",r)}if(n&&Object.keys(n).length>0){const o=Ft(e,t,r);return e=>n[e]||o(e)}return Ft(e,t,r)}},[e,t,r,n])}function kr({selection:e,linkedHover:t,fallbackFields:r=[],unwrapData:n=!1,onObservation:o,chartType:i,chartId:a}){const c=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}(t,r),l=pr({name:(null==e?void 0:e.name)||"__unused__"}),u=function(e){const t=e.name||"hover",{fields:r}=e,{predicate:n,isActive:o,selectPoints:i,clear:a}=pr({name:t});return{onHover:s(e=>{if(!e)return void a();const t={};for(const n of r){const r=e[n];void 0!==r&&(t[n]=[r])}Object.keys(t).length>0&&i(t)},[r,i,a,t]),predicate:n,isActive:o}}({name:(null==c?void 0:c.name)||"hover",fields:(null==c?void 0:c.fields)||r||[]}),d=fr(e=>e.pushObservation),h=e?{isActive:l.isActive,predicate:l.predicate}:null,y=s(e=>{var r,n;if(t)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(o||d){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(r=e.x)&&void 0!==r?r:0,y:null!==(n=e.y)&&void 0!==n?n:0});o&&o(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});o&&o(e),d&&d(e)}}},[t,u,o,i,a,d]),g=s(e=>{var t,r;if(o||d){const n={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},n),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(r=e.y)&&void 0!==r?r:0});o&&o(a),d&&d(a)}else{const e=Object.assign(Object.assign({},n),{type:"click-end"});o&&o(e),d&&d(e)}}},[o,d,i,a]);return{activeSelectionHook:h,customHoverBehavior:y,customClickBehavior:g}}function Ar(e,t,n){const[o,a]=r(null),[c,l]=r(new Set),u=s(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&l(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),h=i(()=>{if(!e||"none"===e||!t)return null;const r="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(r?e[r]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&c.size>0?{isActive:!0,predicate:e=>{const n=r?e[r]:"function"==typeof t?t(e):null;return c.has(n)}}:null},[e,t,o,c]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?c:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}e.createContext(void 0);const wr={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Sr(e,t,r){var n,o,i,a,s,c;const l=wr[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==r?void 0:r.width)?l.width:r.width,height:null!==(o=t.height)&&void 0!==o?o:e&&"primary"!==e||!(null==r?void 0:r.height)?l.height:r.height,showAxes:l.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:l.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||l.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:l.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:l.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:Er(l.marginDefaults,t.showCategoryTicks,t.orientation)}}function Er(e,t,r){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===r?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function Lr({componentName:t,message:r,diagnosticHint:n,width:o,height:i}){return e.createElement("div",{role:"alert",style:{width:o,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},r),n&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class Or extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var r,n;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,r=this.state.error;return"function"==typeof t?t(r):void 0!==t?t:e.createElement(Lr,{componentName:"ChartErrorBoundary",message:r.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Dr(e,t){const r=e.length,n=t.length,o=Array(n+1);for(let e=0;n>=e;e++)o[e]=e;for(let i=1;r>=i;i++){let r=o[0];o[0]=i;for(let a=1;n>=a;a++){const n=o[a];o[a]=e[i-1]===t[a-1]?r:1+Math.min(r,o[a],o[a-1]),r=n}}return o[n]}function jr(e,t,r=3){let n,o=r+1;for(const r of t){const t=Dr(e.toLowerCase(),r.toLowerCase());o>t&&(o=t,n=r)}return o>r?void 0:n}function Pr(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Cr(e,t){var r;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(r=jr(e,t,3))&&void 0!==r?r:null)}function Ir({componentName:e,data:t,dataLabel:r="data"}){return null==t?`${e}: No ${r} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${r} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function Nr({componentName:e,nodes:t,edges:r,nodesRequired:n=!1,edgesRequired:o=!0,accessors:i}){if(null==t&&null==r)return null;if(o&&(!r||!Array.isArray(r)||0===r.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const r=Pr(t).find(e=>e&&"object"==typeof e);if(r){const t=Object.keys(r);for(const[n,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in r)){const r=Cr(o,t),i=r?` Try ${n}="${r}".`:"";return`${e}: ${n} "${o}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const Mr={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"}},Tr={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},$r={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},_r=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Wr=["vertical","horizontal"],Br={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:_r},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:_r},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:_r},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),Tr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wr},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wr},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wr},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wr},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wr},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wr},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wr},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Mr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Mr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mr),$r),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Mr),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Mr),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Wr},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Mr),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Mr),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Mr),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Mr),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Mr),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Rr(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const zr=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Hr=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Fr=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Yr=new Set(["LineChart","AreaChart","StackedAreaChart"]),Xr=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function qr(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[r,n,o]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(r)+.7152*i(n)+.0722*i(o)}function Gr(e,t){const r=qr(e),n=qr(t);return null===r||null===n?null:(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}const Vr=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Kr(e,t){const r=[],n=function(e,t){const r=[],n=Br[e];if(!n)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Br).join(", ")}`]};for(const o of n.required)null==t[o]&&r.push(`"${o}" is required for ${e}.`);for(const[e,o]of Object.entries(t)){if(null==o)continue;const t=n.props[e];if(t){if(!Rr(o,t.type)){const n=Array.isArray(t.type)?t.type.join(" | "):t.type;r.push(`"${e}" should be ${n}, got ${Array.isArray(o)?"array":typeof o}.`);continue}t.enum&&"string"==typeof o&&!t.enum.includes(o)&&r.push(`"${e}" value "${o}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const o=Object.keys(n.props),i=new Set(o);for(const n of Object.keys(t))if(void 0!==t[n]&&!i.has(n)){const t=jr(n,o),i=t?`Unknown prop "${n}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${n}" for ${e}. Valid props: ${o.join(", ")}.`;r.push(i)}if("array"===n.dataShape){const o=t.data,i={};for(const e of n.dataAccessors){const r=t[e];"string"==typeof r&&(i[e]=r)}const a=function({componentName:e,data:t,accessors:r,requiredProps:n}){if(n)for(const[t,r]of Object.entries(n))if(null==r)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(r){const n=Pr(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const r=Cr(i,t),n=r?` Try ${o}="${r}".`:"";return`${e}: ${o} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}({componentName:e,data:o,accessors:Object.keys(i).length>0?i:void 0});a&&r.push(a)}else if("object"===n.dataShape){const n=Ir({componentName:e,data:t.data});n&&r.push(n)}else if("network"===n.dataShape){const o=Nr({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:n.required.includes("nodes"),edgesRequired:n.required.includes("edges")});o&&r.push(o)}return{valid:0===r.length,errors:r}}(e,t);for(const e of n.errors)r.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Br[e]?(function(e,t,r){const n=Br[e];if(n){if("array"===n.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&r.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===n.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&r.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,r),function(e,t,r){const n=t.width,o=t.height;if(void 0===n||"number"==typeof n&&n>0||r.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(n)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===o||"number"==typeof o&&o>0||r.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,n]=t.size;(null!=e&&0>=e||null!=n&&0>=n)&&r.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${n}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,r),function(e,t,r){const n=Br[e];if(!n||"array"!==n.dataShape)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of n.dataAccessors){const n=t[e];"string"==typeof n&&(n in i||r.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${n}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,r),function(e,t,r){zr.has(e)&&Array.isArray(t.data)&&r.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,r),function(e,t,r){Hr.has(e)&&(t.edges||t.data||r.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,r),function(e,t,r){const n=Br[e];if(!n||"array"!==n.dataShape)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&r.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,r),function(e,t,r){t.linkedHover&&!t.selection&&r.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,r),function(e,t,r){var n;if(!Fr.has(e))return;const o=t.rExtent||t.yExtent;o&&Array.isArray(o)&&o.length>=1&&null!=o[0]&&0!==o[0]&&r.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${o[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(n=o[1])&&void 0!==n?n:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,r),function(e,t,r){if(!Yr.has(e))return;if(t.gapStrategy)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const o=t.yAccessor||"y";"string"==typeof o&&n.some(e=>{const t=e[o];return null==t||Number.isNaN(t)})&&r.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${o}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,r),function(e,t,r){var n,o;const i=null!==(n=t.width)&&void 0!==n?n:600,a=null!==(o=t.height)&&void 0!==o?o:400,s=t.margin;if(!s||"object"!=typeof s)return;const c=(s.left||0)+(s.right||0),l=(s.top||0)+(s.bottom||0);i>c||r.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${c}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>l||r.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${l}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,r),function(e,t,r){var n;const o=Br[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let r=0;s>r;r++){const o=null===(n=i[r])||void 0===n?void 0:n[e.name];if("number"==typeof o&&Number.isFinite(o)){t=!1;break}}t&&r.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,r),function(e,t,r){if(!Xr.has(e))return;const n=t.barPadding;"number"==typeof n&&10>n&&r.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${n} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,r),function(e,t,r){if("bottom"!==t.legendPosition)return;const n=t.margin;if(!n||"object"!=typeof n)return;const o=n.bottom;"number"==typeof o&&70>o&&r.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${o}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,r),function(e,t,r){var n;if(!t.showLegend)return;if("right"!==(null!==(n=t.legendPosition)&&void 0!==n?n:"right"))return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.right;"number"==typeof i&&100>i&&r.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,r),function(e,t,r){if("Heatmap"!==e)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const o=n[0];if(o&&"object"==typeof o)for(const e of["xAccessor","yAccessor"]){const n=t[e];if("string"!=typeof n)continue;const i=o[n];"string"==typeof i&&r.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${n}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,r),function(e,t,r){const n=t.colorScheme;if(!n||!Array.isArray(n))return;const o="string"==typeof t.background?t.background:"#ffffff";if(!o.startsWith("#"))return;const i=[];for(const e of n){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Gr(e,o);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&r.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${o}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,r),function(e,t,r){const n=[];for(const e of Vr)"function"==typeof t[e]&&n.push(e);n.length>0&&r.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${n.length>1?"s":""} detected: ${n.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,r),{ok:r.every(e=>"warning"===e.severity),diagnoses:r}):{ok:0===r.length,diagnoses:r}}var Zr;const Ur="undefined"!=typeof process&&"production"!==(null===(Zr=process.env)||void 0===Zr?void 0:Zr.NODE_ENV);function Qr({componentName:t,width:r,height:n,chartProps:o,children:i}){return e.createElement(Or,{fallback:i=>{let a="";if(Ur&&o)try{const e=Kr(t,o);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(Lr,{componentName:t,message:i.message,diagnosticHint:a,width:r,height:n})}},i)}const Jr={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},en={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function tn(t,r,n,o){return!1===o||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},Jr),{width:r,height:n})},o||"No data available"):null}function rn(t,r,n){if(!t)return null;const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(i+a)-a))/2);return e.createElement("div",{style:{width:r,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(t,n)=>e.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},en),{position:"absolute",top:s+n*(i+a),left:Math.floor(.1*r),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2})})))}const nn=l(function(r,n){var o;const s=t(null);u(n,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=s.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const c=Sr(r.mode,{width:r.width,height:r.height,enableHover:r.enableHover,showLegend:r.showLegend,showLabels:r.showLabels,title:r.title},{width:600,height:600}),{nodes:l,edges:d,margin:h,className:y,nodeIDAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:m,colorBy:v,colorScheme:b="category10",nodeSize:x=8,nodeSizeRange:k=[5,20],edgeWidth:A=1,edgeColor:w="#999",edgeOpacity:S=.6,iterations:E=300,forceStrength:L=.1,tooltip:O,frameProps:D={},onObservation:j,chartId:P,selection:C,linkedHover:I,loading:N,emptyContent:M,legendInteraction:T,legendPosition:$}=r,_=c.width,W=c.height,B=c.enableHover,R=c.showLegend,z=null!==(o=c.showLabels)&&void 0!==o&&o,H=c.title,F=rn(N,_,W),Y=F?null:tn(l,_,W,M),X=l||[],q=d||[],G=xr(X,v,b),V=i(()=>{if(!v)return[];const e=new Set;for(const t of X){const r="function"==typeof v?v(t):t[v];null!=r&&e.add(r+"")}return Array.from(e)},[X,v]),K=Ar(T,v,V),Z=vr(),U=i(()=>new Map,[]),Q=i(()=>{if(Array.isArray(b))return b;if(Z&&Z.length>0)return Z;const e=_t[b];return Array.isArray(e)?e:Wt},[b,Z]),J=i(()=>e=>{const t={};return t.fill=v?Ht(e.data||e,v,G):br(0,Z,b),"number"==typeof x&&(t.r=x),t},[v,G,x,Z,b,U]),ee=i(()=>e=>({stroke:w,strokeWidth:"number"==typeof A?A:"function"==typeof A?A(e):e[A]||1,opacity:S}),[A,w,S]),te=i(()=>{if(z&&m)return"function"==typeof m?m:e=>{var t,r,n;return null!==(n=null!==(r=null===(t=e.data)||void 0===t?void 0:t[m])&&void 0!==r?r:e[m])&&void 0!==n?n:e.id}},[z,m]),{legend:re,margin:ne,legendPosition:oe}=function({data:e,colorBy:t,colorScale:r,showLegend:n,legendPosition:o="right",userMargin:s,defaults:c={top:50,bottom:60,left:70,right:40},categories:l}){const u=a(mr),d=void 0!==n?n:!u&&!!t,h=i(()=>{if(d&&t)return function({data:e,colorBy:t,colorScale:r,getColor:n,strokeColor:o,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),s=a?n(a,t,r):r?r(o):Bt[i%Bt.length];return{label:o+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",r={fill:t,stroke:t};return void 0!==o&&(r.stroke=o),void 0!==i&&(r.strokeWidth=i),r},type:"fill",items:s,label:""}]}}({data:e,colorBy:t,colorScale:r,getColor:Ht,categories:l})},[d,t,e,r,l]),y=i(()=>{const e=Object.assign(Object.assign({},c),s);return h&&("right"===o&&110>e.right?e.right=110:"left"===o&&110>e.left?e.left=110:"top"===o&&50>e.top?e.top=50:"bottom"===o&&80>e.bottom&&(e.bottom=80)),e},[c,s,h,o]);return{legend:h,margin:y,legendPosition:o}}({data:X,colorBy:v,colorScale:G,showLegend:R,legendPosition:$,userMargin:h,defaults:c.marginDefaults}),{customHoverBehavior:ie}=kr({selection:C,linkedHover:I,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:j,chartType:"ForceDirectedGraph",chartId:P}),ae=Nr({componentName:"ForceDirectedGraph",nodes:l,edges:d,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return ae?e.createElement(Lr,{componentName:"ForceDirectedGraph",message:ae,width:_,height:W}):F||Y||e.createElement(Qr,{componentName:"ForceDirectedGraph",width:_,height:W},e.createElement(nr,Object.assign({ref:s,chartType:"force"},null!=l&&{nodes:X},null!=d&&{edges:q},{size:[_,W],responsiveWidth:r.responsiveWidth,responsiveHeight:r.responsiveHeight,margin:ne,nodeIDAccessor:g,sourceAccessor:f,targetAccessor:p,iterations:E,forceStrength:L,nodeStyle:J,edgeStyle:ee,colorBy:v,colorScheme:Q,nodeSize:x,nodeSizeRange:k,nodeLabel:te,showLabels:z,enableHover:B,tooltipContent:!1===O?()=>null:cr(O)||void 0,customHoverBehavior:I||j?ie:void 0,legend:re,legendPosition:oe},T&&"none"!==T&&{legendHoverBehavior:K.onLegendHover,legendClickBehavior:K.onLegendClick,legendHighlightedCategory:K.highlightedCategory,legendIsolatedCategories:K.isolatedCategories},{className:y,title:H},D)))});function on(e,t){if(!e)return[];const r=[],n=e=>{r.push(e);const o="function"==typeof t?t(e):e[t];o&&Array.isArray(o)&&o.forEach(n)};return n(e),r}function an(e,t,r,n){if(e&&e.length>0)return e;const o=new Set;return t.forEach(e=>{const t="function"==typeof r?r(e):e[r],i="function"==typeof n?n(e):e[n];o.add(t),o.add(i)}),Array.from(o).map(e=>({id:e}))}function sn(e){return"function"==typeof e?e:t=>t[e]||1}function cn({edgeColorBy:e,colorBy:t,colorScale:r,nodeStyleFn:n,edgeOpacity:o,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:o},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Ht(e.data||e,t,r):e&&(s.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Ht(e.data||e,t,r):e&&(s.fill=n(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*o);return s}}nn.displayName="ForceDirectedGraph";const ln=l(function(r,n){var o;const a=t(null);u(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const s=Sr(r.mode,{width:r.width,height:r.height,enableHover:r.enableHover,showLabels:r.showLabels,title:r.title},{width:800,height:600}),{nodes:c,edges:l,margin:d,className:h,sourceAccessor:y="source",targetAccessor:g="target",valueAccessor:f="value",nodeIdAccessor:p="id",colorBy:m,colorScheme:v="category10",edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:A=.05,nodeWidth:w=15,nodeLabel:S,edgeOpacity:E=.5,edgeSort:L,tooltip:O,frameProps:D={},onObservation:j,chartId:P,selection:C,linkedHover:I,loading:N,emptyContent:M,legendInteraction:T}=r,$=s.width,_=s.height,W=s.enableHover,B=null===(o=s.showLabels)||void 0===o||o,R=s.title,z=rn(N,$,_),H=z?null:tn(l,$,_,M),F=l||[],Y=i(()=>an(c,F,y,g),[c,F,y,g]),X=xr(Y,m,v),q=i(()=>{if(!m)return[];const e=new Set;for(const t of Y){const r="function"==typeof m?m(t):t[m];null!=r&&e.add(r+"")}return Array.from(e)},[Y,m]),G=Ar(T,m,q),V=vr(),K=i(()=>new Map,[]),Z=i(()=>{if(Array.isArray(v))return v;if(V&&V.length>0)return V;const e=_t[v];return Array.isArray(e)?e:Wt},[v,V]),U=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?Ht(e.data||e,m,X):br(0,V,v),t},[m,X,V,v,K]),Q=i(()=>cn({edgeColorBy:b,colorBy:m,colorScale:X,nodeStyleFn:U,edgeOpacity:E,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,X,U,E]),J=i(()=>{if(!B)return;const e=S||p;return"function"==typeof e?e:t=>{var r,n,o;return null!==(o=null!==(n=null===(r=t.data)||void 0===r?void 0:r[e])&&void 0!==n?n:t[e])&&void 0!==o?o:t.id}},[B,S,p]),ee=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:te,customClickBehavior:re}=kr({selection:C,linkedHover:I,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:j,chartType:"SankeyDiagram",chartId:P}),ne=Nr({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return ne?e.createElement(Lr,{componentName:"SankeyDiagram",message:ne,width:$,height:_}):z||H||e.createElement(Qr,{componentName:"SankeyDiagram",width:$,height:_},e.createElement(nr,Object.assign({ref:a,chartType:"sankey"},Y.length>0&&{nodes:Y},null!=l&&{edges:F},{size:[$,_],responsiveWidth:r.responsiveWidth,responsiveHeight:r.responsiveHeight,margin:ee,nodeIDAccessor:p,sourceAccessor:y,targetAccessor:g,valueAccessor:f,orientation:x,nodeAlign:k,nodePaddingRatio:A,nodeWidth:w,nodeStyle:U,edgeStyle:Q,colorBy:m,colorScheme:Z,edgeColorBy:b,edgeOpacity:E,edgeSort:L,nodeLabel:J,showLabels:B,enableHover:W,tooltipContent:!1===O?()=>null:cr(O)||void 0,customHoverBehavior:I||j?te:void 0,customClickBehavior:j?re:void 0},T&&"none"!==T&&{legendHoverBehavior:G.onLegendHover,legendClickBehavior:G.onLegendClick,legendHighlightedCategory:G.highlightedCategory,legendIsolatedCategories:G.isolatedCategories},{className:h,title:R},D)))});ln.displayName="SankeyDiagram";const un=l(function(r,n){var o;const a=t(null);u(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const s=Sr(r.mode,{width:r.width,height:r.height,enableHover:r.enableHover,showLabels:r.showLabels,title:r.title},{width:600,height:600}),{nodes:c,edges:l,margin:d,className:h,sourceAccessor:y="source",targetAccessor:g="target",valueAccessor:f="value",nodeIdAccessor:p="id",colorBy:m,colorScheme:v="category10",edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:A,nodeLabel:w,edgeOpacity:S=.5,tooltip:E,frameProps:L={},onObservation:O,chartId:D,selection:j,linkedHover:P,loading:C,emptyContent:I,legendInteraction:N}=r,M=s.width,T=s.height,$=s.enableHover,_=null===(o=s.showLabels)||void 0===o||o,W=s.title,B=rn(C,M,T),R=B?null:tn(l,M,T,I),z=l||[],H=i(()=>an(c,z,y,g),[c,z,y,g]),F=xr(H,m,v),Y=i(()=>{if(!m)return[];const e=new Set;for(const t of H){const r="function"==typeof m?m(t):t[m];null!=r&&e.add(r+"")}return Array.from(e)},[H,m]),X=Ar(N,m,Y),q=vr(),G=i(()=>new Map,[]),V=i(()=>{if(Array.isArray(v))return v;if(q&&q.length>0)return q;const e=_t[v];return Array.isArray(e)?e:Wt},[v,q]),K=H.length>0,Z=i(()=>{if(K)return(e,t)=>{var r,n;const o={stroke:"black",strokeWidth:1};if(m)o.fill=Ht(e.data||e,m,F);else{const i=Array.isArray(v)?v:_t[v]||Wt,a=Array.isArray(i)?i:Wt,s=null!==(n=null!==(r=e.index)&&void 0!==r?r:t)&&void 0!==n?n:0;o.fill=a[s%a.length]}return o}},[K,m,F,v]),U=i(()=>{if(K)return cn({edgeColorBy:b,colorBy:m,colorScale:F,nodeStyleFn:Z||(e=>({fill:br(0,q,v)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[K,b,m,F,Z,S,q,v,G]),Q=i(()=>{if(!_)return;const e=w||p;return"function"==typeof e?e:t=>{var r,n,o;return null!==(o=null!==(n=null===(r=t.data)||void 0===r?void 0:r[e])&&void 0!==n?n:t[e])&&void 0!==o?o:t.id}},[_,w,p]),J=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:ee}=kr({selection:j,linkedHover:P,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:O,chartType:"ChordDiagram",chartId:D}),te=Nr({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return te?e.createElement(Lr,{componentName:"ChordDiagram",message:te,width:M,height:T}):B||R||e.createElement(Qr,{componentName:"ChordDiagram",width:M,height:T},e.createElement(nr,Object.assign({ref:a,chartType:"chord"},H.length>0&&{nodes:H},null!=l&&{edges:z},{size:[M,T],responsiveWidth:r.responsiveWidth,responsiveHeight:r.responsiveHeight,margin:J,nodeIDAccessor:p,sourceAccessor:y,targetAccessor:g,valueAccessor:f,padAngle:x,groupWidth:k,sortGroups:A,nodeStyle:Z,edgeStyle:U,colorBy:m,colorScheme:V,edgeColorBy:b,edgeOpacity:S,nodeLabel:Q,showLabels:_,enableHover:$,tooltipContent:!1===E?()=>null:cr(E)||void 0,customHoverBehavior:P||O?ee:void 0},N&&"none"!==N&&{legendHoverBehavior:X.onLegendHover,legendClickBehavior:X.onLegendClick,legendHighlightedCategory:X.highlightedCategory,legendIsolatedCategories:X.isolatedCategories},{className:h,title:W},L)))});function dn(t){var r;const n=Sr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{width:600,height:600}),{data:o,margin:a,className:s,layout:c="tree",orientation:l="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:y,colorScheme:g="category10",colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,chartId:A,selection:w,linkedHover:S,loading:E,legendInteraction:L}=t,O=n.width,D=n.height,j=n.enableHover,P=null===(r=n.showLabels)||void 0===r||r,C=n.title,I=rn(E,O,D),N=i(()=>on(null!=o?o:null,u),[o,u]),M=xr(N,f?void 0:y,g),T=i(()=>{if(!y||f)return[];const e=new Set;for(const t of N){const r="function"==typeof y?y(t):t[y];null!=r&&e.add(r+"")}return Array.from(e)},[N,y,f]),$=Ar(L,f?void 0:y,T),_=vr(),W=i(()=>new Map,[]),B=i(()=>{if(Array.isArray(g))return g;if(_&&_.length>0)return _;const e=_t[g];return Array.isArray(e)?e:Wt},[g,_]),R=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?Rt[(e.depth||0)%Rt.length]:y?Ht(e.data||e,y,M):br(0,_,g),t},[y,f,M,_,g,W]),z=i(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),H=i(()=>{if("treemap"===c||"circlepack"===c||"partition"===c)return sn(d)},[c,d]),F=Object.assign(Object.assign({},n.marginDefaults),a),{customHoverBehavior:Y}=kr({selection:w,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:k,chartType:"TreeDiagram",chartId:A}),X=Ir({componentName:"TreeDiagram",data:o});return X?e.createElement(Lr,{componentName:"TreeDiagram",message:X,width:O,height:D}):I||e.createElement(Qr,{componentName:"TreeDiagram",width:O,height:D},e.createElement(nr,Object.assign({chartType:c},null!=o&&{data:o},{size:[O,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:H,treeOrientation:l,edgeType:p,nodeStyle:R,edgeStyle:z,colorBy:y,colorScheme:B,colorByDepth:f,nodeSize:v,nodeLabel:P?m||h:void 0,showLabels:P,enableHover:j,tooltipContent:!1===b?()=>null:cr(b)||void 0,customHoverBehavior:S||k?Y:void 0},L&&"none"!==L&&{legendHoverBehavior:$.onLegendHover,legendClickBehavior:$.onLegendClick,legendHighlightedCategory:$.highlightedCategory,legendIsolatedCategories:$.isolatedCategories},{className:s,title:C},x)))}function hn(t){var r;const n=Sr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,linkedHover:t.linkedHover},{width:600,height:600}),{data:o,margin:a,className:c,childrenAccessor:l="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:y="category10",colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:A,onObservation:w,chartId:S,loading:E,legendInteraction:L}=t,O=n.width,D=n.height,j=n.enableHover,P=null===(r=n.showLabels)||void 0===r||r,C=n.title,I=rn(E,O,D),{activeSelectionHook:N,customHoverBehavior:M}=kr({selection:k,linkedHover:A,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:w,chartType:"Treemap",chartId:S}),T=s(e=>{if(!e)return M(null);const t=e.data||e;M({data:(null==t?void 0:t.data)||t})},[M]),$=i(()=>on(null!=o?o:null,l),[o,l]),_=xr($,g?void 0:h,y),W=i(()=>{if(!h||g)return[];const e=new Set;for(const t of $){const r="function"==typeof h?h(t):t[h];null!=r&&e.add(r+"")}return Array.from(e)},[$,h,g]),B=Ar(L,g?void 0:h,W),R=vr(),z=i(()=>new Map,[]),H=i(()=>{if(Array.isArray(y))return y;if(R&&R.length>0)return R;const e=_t[y];return Array.isArray(e)?e:Wt},[y,R]),F=i(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=g?Rt[(e.depth||0)%Rt.length]:h?Ht(e.data||e,h,_):br(0,R,y),t},[h,g,_,R,y,z]),Y=i(()=>N?e=>{var t;const r=Object.assign({},F(e));if(N.isActive)if(N.predicate(e.data||e))(null==k?void 0:k.selectedStyle)&&Object.assign(r,k.selectedStyle);else{const e=null!==(t=null==k?void 0:k.unselectedOpacity)&&void 0!==t?t:.2;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==k?void 0:k.unselectedStyle)&&Object.assign(r,k.unselectedStyle)}return r}:F,[F,N,k]),X=i(()=>sn(u),[u]),q=void 0!==v?v:!P||"parent"!==f&&"all"!==f?void 0:18,G=Object.assign(Object.assign({},n.marginDefaults),a),V=Ir({componentName:"Treemap",data:o});return V?e.createElement(Lr,{componentName:"Treemap",message:V,width:O,height:D}):I||e.createElement(Qr,{componentName:"Treemap",width:O,height:D},e.createElement(nr,Object.assign({chartType:"treemap"},null!=o&&{data:o},{size:[O,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,nodeIDAccessor:d,childrenAccessor:l,hierarchySum:X,padding:m,paddingTop:q,nodeStyle:Y,colorBy:h,colorScheme:H,colorByDepth:g,nodeLabel:P?p||d:void 0,showLabels:P,labelMode:f,enableHover:j,tooltipContent:!1===b?()=>null:cr(b)||void 0},(A||w)&&{customHoverBehavior:T},L&&"none"!==L&&{legendHoverBehavior:B.onLegendHover,legendClickBehavior:B.onLegendClick,legendHighlightedCategory:B.highlightedCategory,legendIsolatedCategories:B.isolatedCategories},{className:c,title:C},x)))}function yn(t){var r;const n=Sr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{width:600,height:600}),{data:o,margin:a,className:s,childrenAccessor:c="children",valueAccessor:l="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h="category10",colorByDepth:y=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:m,frameProps:v={},onObservation:b,chartId:x,selection:k,linkedHover:A,loading:w,legendInteraction:S}=t,E=n.width,L=n.height,O=n.enableHover,D=null===(r=n.showLabels)||void 0===r||r,j=n.title,P=rn(w,E,L),C=i(()=>on(null!=o?o:null,c),[o,c]),I=xr(C,y?void 0:d,h),N=i(()=>{if(!d||y)return[];const e=new Set;for(const t of C){const r="function"==typeof d?d(t):t[d];null!=r&&e.add(r+"")}return Array.from(e)},[C,d,y]),M=Ar(S,y?void 0:d,N),T=vr(),$=i(()=>new Map,[]),_=i(()=>{if(Array.isArray(h))return h;if(T&&T.length>0)return T;const e=_t[h];return Array.isArray(e)?e:Wt},[h,T]),W=i(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=y?Rt[(e.depth||0)%Rt.length]:d?Ht(e.data||e,d,I):br(0,T,h),t},[d,y,I,f,T,h,$]),B=i(()=>sn(l),[l]),R=Object.assign(Object.assign({},n.marginDefaults),a),{customHoverBehavior:z}=kr({selection:k,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,chartType:"CirclePack",chartId:x}),H=Ir({componentName:"CirclePack",data:o});return H?e.createElement(Lr,{componentName:"CirclePack",message:H,width:E,height:L}):P||e.createElement(Qr,{componentName:"CirclePack",width:E,height:L},e.createElement(nr,Object.assign({chartType:"circlepack"},null!=o&&{data:o},{size:[E,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:R,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:B,padding:p,nodeStyle:W,colorBy:d,colorScheme:_,colorByDepth:y,nodeLabel:D?g||u:void 0,showLabels:D,enableHover:O,tooltipContent:!1===m?()=>null:cr(m)||void 0,customHoverBehavior:A||b?z:void 0},S&&"none"!==S&&{legendHoverBehavior:M.onLegendHover,legendClickBehavior:M.onLegendClick,legendHighlightedCategory:M.highlightedCategory,legendIsolatedCategories:M.isolatedCategories},{className:s,title:j},v)))}un.displayName="ChordDiagram",dn.displayName="TreeDiagram",hn.displayName="Treemap",yn.displayName="CirclePack";const gn=Rt;function fn(t){const r=Sr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title},{width:600,height:600}),{data:n,margin:o,className:a,childrenAccessor:s="children",nodeIdAccessor:c="name",colorBy:l,colorScheme:u="category10",colorByDepth:d=!1,orbitMode:h="flat",orbitSize:y=2.95,speed:g=.25,revolution:f,revolutionStyle:p,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:A,foregroundGraphics:w,annotations:S,frameProps:E={},onObservation:L,chartId:O,selection:D,linkedHover:j,loading:P}=t,C=r.width,I=r.height,N=r.enableHover,M=r.title,T=rn(P,C,I),$=xr(i(()=>on(n,s),[n,s]),d?void 0:l,u),_=vr(),W=i(()=>new Map,[]),B=i(()=>{if(Array.isArray(u))return u;if(_&&_.length>0)return _;const e=_t[u];return Array.isArray(e)?e:Wt},[u,_]),R=i(()=>{if(Array.isArray(u))return u;const e=_t[u];return Array.isArray(e)?e:Wt},[u]),z=i(()=>e=>{var t;const r={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return r.fill=d?n?R[0]:gn[(e.depth||0)%gn.length]:l?Ht(e.data||e,l,$):br(0,_,u),r.opacity=n?1:.85,r},[l,d,$,R,_,u,W]),H=i(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),F=Object.assign({top:10,right:10,bottom:10,left:10},o),{customHoverBehavior:Y}=kr({selection:D,linkedHover:j,fallbackFields:l?["string"==typeof l?l:""]:[],unwrapData:!0,onObservation:L,chartType:"OrbitDiagram",chartId:O}),X=i(()=>{if(Y)return e=>{Y(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[Y]),q=Ir({componentName:"OrbitDiagram",data:n});return q?e.createElement(Lr,{componentName:"OrbitDiagram",message:q,width:C,height:I}):T||e.createElement(Qr,{componentName:"OrbitDiagram",width:C,height:I},e.createElement(nr,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[C,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F,nodeIDAccessor:c,childrenAccessor:s,nodeStyle:z,edgeStyle:H,colorBy:l,colorScheme:B,colorByDepth:d,nodeSize:b,nodeLabel:x?c:void 0,showLabels:x,enableHover:!k&&N,tooltipContent:k?void 0:!1===A?()=>null:cr(A)||void 0,customHoverBehavior:j||L?X:void 0,foregroundGraphics:w,annotations:S,className:a,title:M,orbitMode:h,orbitSize:y,orbitSpeed:g,orbitRevolution:f,orbitRevolutionStyle:p,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k},E)))}fn.displayName="OrbitDiagram";export{un as ChordDiagram,yn as CirclePack,nn as ForceDirectedGraph,fn as OrbitDiagram,ln as SankeyDiagram,nr as StreamNetworkFrame,dn as TreeDiagram,hn as Treemap};
|
|
1
|
+
import*as e from"react";import{useState as t,useEffect as r,useRef as n,createContext as o,useMemo as i,useContext as a,useCallback as s,useSyncExternalStore as c,forwardRef as l,useImperativeHandle as u,useId as d}from"react";import{interpolateNumber as h}from"d3-interpolate";import{min as y,groups as g,max as p,sum as f,mean as m,group as v}from"d3-array";import{schemeCategory10 as b,interpolatePlasma as x,interpolateViridis as k,interpolatePurples as A,interpolateOranges as w,interpolateGreens as E,interpolateReds as S,interpolateBlues as L,schemeSet3 as O,schemeTableau10 as D}from"d3-scale-chromatic";import{forceLink as j,forceSimulation as C,forceManyBody as I,forceCenter as P,forceX as T,forceY as M}from"d3-force";import{scaleLinear as N,scaleOrdinal as _}from"d3-scale";import{ribbon as $,chord as B}from"d3-chord";import{arc as W,pie as R}from"d3-shape";import{hierarchy as z,partition as H,pack as F,treemap as Y,treemapBinary as G,cluster as X,tree as q}from"d3-hierarchy";const V={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},K={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class U{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const r=this.particles[t];if(!r.active)return r.active=!0,r.t=0,r.offset=Math.random()-.5,r.edgeIndex=e,r.x=0,r.y=0,r}return null}step(e,t,r,n){var o;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=r[a.edgeIndex];if(!s||!s.bezier){a.active=!1;continue}const c=n&&null!==(o=n[a.edgeIndex])&&void 0!==o?o:1;if(a.t+=e*t*c*(s.bezier.circular?.3:1),a.t>=1){a.active=!1;continue}const l=Z(s.bezier,a.t,a.offset);a.x=l.x,a.y=l.y}}countForEdge(e){let t=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let r=0;e>r;r++)this.particles[r]=t.length>r?t[r]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function Z(e,t,r){if(e.circular&&e.segments)return function(e,t,r,n){const o=e.length,i=t*o,a=Math.min(Math.floor(i),o-1),s=i-a,[c,l,u,d]=e[a],h=Q(c,l,u,d,s),y=d.x-c.x,g=d.y-c.y,p=Math.sqrt(y*y+g*g);if(p>.001){const e=y/p;h.x+=-g/p*r*n*2,h.y+=e*r*n*2}return h}(e.segments,t,r,e.halfWidth);if(!e.points)return{x:0,y:0};const[n,o,i,a]=e.points,s=Q(n,o,i,a,t),c=a.x-n.x,l=a.y-n.y,u=Math.sqrt(c*c+l*l);if(u>.001){const t=c/u;s.x+=-l/u*r*e.halfWidth*2,s.y+=t*r*e.halfWidth*2}return s}function Q(e,t,r,n,o){const i=1-o,a=i*i,s=a*i,c=o*o,l=c*o;return{x:s*e.x+3*a*o*t.x+3*i*c*r.x+l*n.x,y:s*e.y+3*a*o*t.y+3*i*c*r.y+l*n.y}}function J(e,t){var r=e.get(t);if(!r)throw Error("missing: "+t);return r}function ee(e,t){var r,n=[],o=[],i=[],a={},s=[];function c(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&c(t)})}function l(e){var t,n,d=!1;for(o.push(e),i[e]=!0,t=0;s[e].length>t;t++)(n=s[e][t])===r?(u(r,o),d=!0):i[n]||(d=l(n));if(d)c(e);else for(t=0;s[e].length>t;t++){var h=a[n=s[e][t]];h||(a[n]=h={}),h[n]=!0}return o.pop(),d}function u(e,t){var r=[].concat(t).concat(e);n.push(r)}function d(t){!function(t){for(var r=0;e.length>r;r++)r>=t&&e[r]||(e[r]=[]),e[r]=e[r].filter(function(e){return e>=t})}(t);for(var r,n=function(e){for(var t=e.length,r=Array(t),n=Array(t),o=Array(t),i=Array(t),a=Array(t),s=Array(t),c=0;t>c;++c)r[c]=-1,n[c]=0,o[c]=!1,i[c]=0,a[c]=-1,s[c]=[];var l,u=0,d=[],h=[];function y(t){var c=[t],l=[t];for(r[t]=n[t]=u,o[t]=!0,u+=1;l.length>0;){var y=e[t=l[l.length-1]];if(y.length>i[t]){for(var g=i[t];y.length>g;++g){var p=y[g];if(0>r[p]){r[p]=n[p]=u,o[p]=!0,u+=1,c.push(p),l.push(p);break}o[p]&&(n[t]=0|Math.min(n[t],n[p])),0>a[p]||s[t].push(a[p])}i[t]=g}else{if(n[t]===r[t]){var f=[],m=[],v=0;for(g=c.length-1;g>=0;--g){var b=c[g];if(o[b]=!1,f.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){c.length=g;break}}d.push(f);var x=Array(v);for(g=0;m.length>g;g++)for(var k=0;m[g].length>k;k++)x[--v]=m[g][k];h.push(x)}l.pop()}}}for(c=0;t>c;++c)0>r[c]&&y(c);for(c=0;h.length>c;c++){var g=h[c];if(0!==g.length){g.sort(function(e,t){return e-t}),l=[g[0]];for(var p=1;g.length>p;p++)g[p]!==g[p-1]&&l.push(g[p]);h[c]=l}}return{components:d,adjacencyList:h}}(e),o=n.components.filter(function(e){return e.length>1}),i=1/0,a=0;o.length>a;a++)for(var s=0;o[a].length>s;s++)i>o[a][s]&&(i=o[a][s],r=a);var c=o[r];if(!c)return!1;var l=e.map(function(e,t){return-1===c.indexOf(t)?[]:e.filter(function(e){return-1!==c.indexOf(e)})});return{leastVertex:i,adjList:l}}r=0;for(var h=e.length;h>r;){var y=d(r);if(r=y.leastVertex,s=y.adjList){for(var g=0;s.length>g;g++)for(var p=0;s[g].length>p;p++){var f=s[g][p];i[+f]=!1,a[f]={}}l(r),r+=1}else r=h}return n}function te(e){return e.y0-e.y1>0?"up":"down"}function re(e,t){return t(e.source)==t(e.target)}function ne(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var r=0;return e.target.targetLinks.forEach(function(e){r=e.circular?r+1:r}),1>=t&&1>=r}function oe(e){return e.target.x0-e.source.x1}function ie(e,t){var r=se(e),n=oe(t)/Math.tan(r);return"up"==te(e)?e.y1-n:e.y1+n}function ae(e,t){var r=se(e),n=oe(t)/Math.tan(r);return"up"==te(e)?e.y1+n:e.y1-n}function se(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function ce(e,t){return t(e)}function le(e){return de(e.source)}function ue(e){return de(e.target)}function de(e){return(e.y0+e.y1)/2}function he(e){return e.virtual?0:e.value}function ye(e,t){var r=0;e.sourceLinks.forEach(function(e){r=e.circular&&!re(e,t)?r+1:r});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!re(e,t)?n+1:n}),r+n}function ge(e){return e.target.depth}function pe(e,t){return e.sourceLinks.length?e.depth:t-1}function fe(e,t){return e.y0-t.y0}function me(e,t){return t.y0-e.y0}function ve(e,t){return e.y1-t.y1}function be(e,t){return t.y1-e.y1}function xe(e,t){return Ae(e.source,t.source)||e.index-t.index}function ke(e,t){return Ae(e.target,t.target)||e.index-t.index}function Ae(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function we(e,t){return Ee(e)==Ee(t)?"bottom"==e.circularLinkType?me(e,t):fe(e,t):Ee(t)-Ee(e)}function Ee(e){return e.target.column-e.source.column}function Se(e,t){return Le(e)==Le(t)}function Le(e){return e.y0-e.y1>0?"up":"down"}function Oe(e,t,r,n,o){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=y(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=i.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),De(i.links.filter(function(e){return"top"==e.circularLinkType}),t,r),De(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,r),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,re(e,t)&&ne(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,c=e.circularLinkType,l=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==c});l.sort("bottom"==e.circularLinkType?me:fe);var u=0;l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),a=e.target.column,(l=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==c})).sort("bottom"==e.circularLinkType?be:ve),u=0,l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,r=e.y0,n=e.target.x0,o=e.y1,i=(t+n)/2;return"M"+t+","+r+"C"+i+","+r+" "+i+","+o+" "+n+","+o}(e)}),i}function De(e,t,r){e.sort(we);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,o){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(re(e,t)&&ne(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;n.length>a;a++){var s=n[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&je(e,s)){var c=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+r;i=c>i?c:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function je(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Ce(e){return function(){return e}}function Ie(e){return e.index}function Pe(e){return e.nodes}function Te(e){return e.links}function Me(e,t,r){var n=g(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(o,i){var a=o.length;if(t)o.sort(t);else if(i>0){var s=new Map;o.forEach(function(e,t){var r,n,o,i=(n=0,o=0,(r=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=de(e.source)*t,n+=t}}),r.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=de(e.target)*t,n+=t}}),n>0?o/n:NaN);s.set(e,{bc:i,idx:t})}),o.sort(function(e,t){var r=s.get(e),n=s.get(t),o=r.bc,i=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?r.idx-n.idx:1:-1:o-i})}else o.sort(function(e,t){return e.circularLinkType==t.circularLinkType?ye(t,r)-ye(e,r):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});o.forEach(function(t,o){t.depth==n.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==ye(t,r)?(t.y0=e.y1/2+o,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+o,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-o,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*o,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+o,t.y1=t.y0+t.value*e.ky)})})}function Ne(e,t,r,n,o,i){var a=g(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,c=i;c>0;--c)l(s*=.99,r),u();function l(t,r){var n=a.length;a.forEach(function(o){var i=o.length,a=o[0].depth;o.forEach(function(o){var s;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&ye(o,r)>0){var c=m(o.sourceLinks,ue),l=m(o.targetLinks,le),u=c&&l?(c+l)/2:c||l;if(u){var d=(u-de(o))*t*.3;o.y0+=d,o.y1+=d}}else if(0==a&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(a==n-1&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)s=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+s;else{var h=m(o.sourceLinks,ue),y=m(o.targetLinks,le),g=((h&&y?(h+y)/2:h||y)-de(o))*t;o.y0+=g,o.y1+=g}})})}function u(){a.forEach(function(r){var i,a,s,c=e.y0,l=r.length;for(r.sort(t||Ae),s=0;l>s;++s)(a=c-(i=r[s]).y0)>0&&(i.y0+=a,i.y1+=a),c=i.y1+n;if((a=c-n-e.y1)>0)for(c=i.y0-=a,i.y1-=a,s=l-2;s>=0;--s)(a=(i=r[s]).y1+o-c)>0&&(i.y0-=a,i.y1-=a),c=i.y0})}}function _e(e){e.nodes.forEach(function(e){e.sourceLinks.sort(ke),e.targetLinks.sort(xe)}),e.nodes.forEach(function(e){var t=e.y0,r=t,n=e.y1,o=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=o-e.width/2,o-=e.width):(e.y1=r+e.width/2,r+=e.width)})})}function $e(){var e=0,t=0,r=1,n=1,o=24,i=8,a=null,s=Ie,c=pe,l=void 0,u=32,d=2,h=Pe,m=Te;function b(){var b={nodes:h.apply(null,arguments),links:m.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=r,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var r=function(e,t){var r=new Map;return v(e,t).forEach(function(e,t){r.set(t,e[0])}),r}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,o=e.target;"object"!=typeof n&&(n=e.source=J(r,n)),"object"!=typeof o&&(o=e.target=J(r,o)),n.sourceLinks.push(e),o.targetLinks.push(e)})}(h,s),function(e,t){var r=0;if(null==t){for(var n=[],o=0;e.links.length>o;o++){var i=e.links[o],a=i.source.index,s=i.target.index;n[a]||(n[a]=[]),n[s]||(n[s]=[]),-1===n[a].indexOf(s)&&n[a].push(s)}var c=ee(n);c.sort(function(e,t){return e.length-t.length});var l={};for(o=0;c.length>o;o++){var u=c[o].slice(-2);l[u[0]]||(l[u[0]]={}),l[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||l[n]&&l[n][t]?(e.circular=!0,e.circularLinkID=r++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=r++)})}(h,l),function(e,t){var r=0,n=0;e.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:n>r?"top":"bottom","top"==o.circularLinkType?r++:n++,e.nodes.forEach(function(e){ce(e,t)!=ce(o.source,t)&&ce(e,t)!=ce(o.target,t)||(e.circularLinkType=o.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),re(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(f(e.sourceLinks,he),f(e.targetLinks,he)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,r){var n,o,i;if(null!=t){e.nodes.sort(function(e,r){return t(e)<t(r)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>o.indexOf(e.target)&&!e.circular&&o.push(e.target)})});for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>o.indexOf(e.source)&&!e.circular&&o.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?r(e,i):e.column})}(h,l,c);var m=i;if(null!==a){var b=g(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),x=p(b,function(e){return e.length});x>1&&(m=Math.max(1,(n-t)*a/(x-1)))}(function(e,t,r){var n=g(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var o=y(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/f(t,function(e){return e.value})});e.ky=o,e.links.forEach(function(t){t.width=t.value*e.ky});var i=p(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-r)/i),t.x1=t.x0+r}:function(t){t.x0=e.x0,t.x1=t.x0+r})})(h,m,o),Me(h,l,s),Ne(h,l,s,m,m,u),_e(h),Oe(h,s,d,10,8),Me(h,l,s),Ne(h,l,s,m,m,u),_e(h),Oe(h,s,d,10,8),function(e,t){let r=e;r.nodes.forEach(function(e){e.y+(e.y1-e.y0)>r.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-r.y1));var n=r.links.filter(function(r){return ce(r.source,t)==ce(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Se(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var r=ie(t,e);return e.y1-r}if(t.target.column>e.target.column)return ie(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let r=e;r.nodes.forEach(function(e){var n=r.links.filter(function(r){return ce(r.target,t)==ce(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Se(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var r=ae(t,e);return e.y0-r}if(t.source.column>e.source.column)return ae(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,r=e.links,n=!1,o=!1;if(r.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(o=!0)}),0==n||0==o){var i=y(t,function(e){return e.y0}),a=p(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function c(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1)}),r.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,r=c(e.y0)-e.y0;e.y0=c(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+r}),e.targetLinks.forEach(function(e){e.y1=e.y1+r})})}}(h),Oe(h,s,d,10,8)}(b),b}return b.update=function(e){return _e(e),Oe(e,s,d,10,8),e},b.nodeWidth=function(e){return arguments.length?(o=+e,b):o},b.nodePadding=function(e){return arguments.length?(i=+e,b):i},b.nodePaddingRatio=function(e){return arguments.length?(a=+e,b):a},b.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Ce(e),b):h},b.links=function(e){return arguments.length?(m="function"==typeof e?e:Ce(e),b):m},b.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Ce(e),b):s},b.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Ce(e),b):c},b.nodeSort=function(e){return arguments.length?(l=e,b):l},b.iterations=function(e){return arguments.length?(u=+e,b):u},b.circularLinkGap=function(e){return arguments.length?(d=+e,b):d},b.extent=function(o){return arguments.length?(e=+o[0][0],t=+o[0][1],r=+o[1][0],n=+o[1][1],b):[[e,t],[r,n]]},b.size=function(o){return arguments.length?(e=t=0,r=+o[0],n=+o[1],b):[r-e,n-t]},b}const Be=e=>{let t,r,n,o,i,a,s,c,l;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,r=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,o=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=h(i,a),c=s(.5),l=s(.5),`M${t},${i}C${t},${c} ${r},${l} ${r},${a}L${n},${a}C${n},${l} ${o},${c} ${o},${i}Z`):(t=e.source.x1,r=e.target.x0,s=h(t,r),n=s(.5),o=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,c=e.y1+e.sankeyWidth/2,l=e.y0+e.sankeyWidth/2,`M${t},${i}C${n},${i} ${o},${a} ${r},${a}L${r},${c}C${o},${c} ${n},${l} ${t},${l}Z`)};function We(e){var t;const r=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,o=e.circularPathData;if(!o)return null;if("down"===e.direction)return null;if(e._circularStub){const t=o.sourceX,n=o.sourceY,i=o.targetX,a=o.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(o.rightFullExtent-t))),c=Math.max(15,Math.min(40,.33*(i-o.leftFullExtent)));return`M${t},${n-r}L${t+s},${n-r}L${t+s},${n+r}L${t},${n+r}ZM${i},${a-r}L${i-c},${a-r}L${i-c},${a+r}L${i},${a+r}Z`}const i=o.sourceX,a=o.sourceY,s=o.targetX,c=o.targetY,l=o.rightFullExtent,u=o.leftFullExtent,d=o.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,y=Math.max(4,Math.min(n,15));return`M${i},${a-h*r}L${l},${a-h*r}L${l+n},${a-h*r+h*y}L${l+n},${d+h*n-h*y}L${l+n-y},${d+h*n}L${u-n+y},${d+h*n}L${u-n},${d+h*n-h*y}L${u-n},${c-h*r+h*y}L${u-n+y},${c-h*r}L${s},${c-h*r}L${s},${c+h*r}L${u+n},${c+h*r}L${u+n},${d-h*n}L${l-n},${d-h*n}L${l-n},${a+h*r}L${i},${a+h*r}Z`}const Re={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(ge))-1:0},justify:pe},ze={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){var o,i,a,s,c,l,u;if(0===e.length)return;const d="vertical"===r.orientation?"down":"right",h=r.nodeAlign||"justify",y=null!==(o=r.nodeWidth)&&void 0!==o?o:15,g=null!==(i=r.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=r.iterations)&&void 0!==a?a:100,f=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=$e().extent(v).links(m).nodes(f).nodeAlign(Re[h]||pe).nodeId(e=>e.id).nodeWidth(y).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(g),b();{let e=1/0,t=-1/0,r=1/0,o=-1/0;for(const n of f)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),r>n.y0&&(r=n.y0),n.y1>o&&(o=n.y1);for(const n of m){if(!n.circular||!n.circularPathData)continue;const i=n.circularPathData,a=(null!==(c=null!==(s=n._circularWidth)&&void 0!==s?s:n.width)&&void 0!==c?c:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),r>i.verticalFullExtent-a&&(r=i.verticalFullExtent-a),i.verticalFullExtent+a>o&&(o=i.verticalFullExtent+a)}const i=t-e,a=o-r,u=n[0],d=n[1];if(i>0&&a>0&&(0>e||0>r||t>u||o>d)){const t=Math.min(u/i,d/a),n=-e*t+(u-i*t)/2,o=-r*t+(d-a*t)/2;for(const e of f)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+o,e.y1=e.y1*t+o;for(const e of m)if(e.y0=e.y0*t+o,e.y1=e.y1*t+o,e.width=(null!==(l=e.width)&&void 0!==l?l:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const r=e.circularPathData;r.sourceX=r.sourceX*t+n,r.targetX=r.targetX*t+n,r.sourceY=r.sourceY*t+o,r.targetY=r.targetY*t+o,r.rightFullExtent=r.rightFullExtent*t+n,r.leftFullExtent=r.leftFullExtent*t+n,r.verticalFullExtent=r.verticalFullExtent*t+o,r.rightInnerExtent=r.rightInnerExtent*t+n,r.leftInnerExtent=r.leftInnerExtent*t+n,r.verticalRightInnerExtent=r.verticalRightInnerExtent*t+o,r.verticalLeftInnerExtent=r.verticalLeftInnerExtent*t+o,r.rightSmallArcRadius*=t,r.rightLargeArcRadius*=t,r.leftSmallArcRadius*=t,r.leftLargeArcRadius*=t,r.sourceWidth*=t,r.rightNodeBuffer*=t,r.leftNodeBuffer*=t,r.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of f){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=e.source,r=e.target,n="object"==typeof t&&null!==t?t.id:t+"",o="object"==typeof r&&null!==r?r.id:r+"",i=k.get(e._edgeKey?e._edgeKey:`${n}\0${o}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(n),r=x.get(o);t&&(i.source=t),r&&(i.target=r)}}},buildScene(e,t,r,n){var o,i,a,s;const c="vertical"===r.orientation?"down":"right",l=r.nodeStyle,u=r.edgeStyle,d=null!==(o=r.edgeOpacity)&&void 0!==o?o:.5,h=r.edgeColorBy||"source",y=Array.isArray(r.colorScheme)?r.colorScheme:b,g=new Map;e.forEach((e,t)=>{g.set(e.id,y[t%y.length])});const p=[],f=[],m=[],v=new Map;for(const t of e){const e=t.x1-t.x0,r=t.y1-t.y0;if(0>=e||0>=r)continue;const n=l?l(t):{},o={fill:n.fill||g.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};v.set(t.id,("string"==typeof o.fill?o.fill:null)||g.get(t.id)||"#4d430c"),p.push("down"===c?{type:"rect",x:t.y0,y:t.x0,w:r,h:e,style:o,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:r,style:o,datum:t,id:t.id,label:t.id})}const x=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of x){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let n="#999";n="function"==typeof h?h(e)||n:"target"===h?v.get(r.id)||g.get(r.id)||n:v.get(t.id)||g.get(t.id)||n;const o=u?u(e):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,r=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),c=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),l=o.fill||n;f.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-r}L${t.sourceX+s},${t.sourceY-r}L${t.sourceX+s},${t.sourceY+r}L${t.sourceX},${t.sourceY+r}Z`,style:{fill:l,fillOpacity:null!==(i=o.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:o.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),f.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-r}L${t.targetX-c},${t.targetY-r}L${t.targetX-c},${t.targetY+r}L${t.targetX},${t.targetY+r}Z`,style:{fill:l,fillOpacity:null!==(a=o.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:o.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-c,x1:t.targetX}});continue}let c;if(c=e.circular&&e.circularPathData?We(e):Be(e),!c)continue;const l={fill:o.fill||n,fillOpacity:null!==(s=o.fillOpacity)&&void 0!==s?s:d,stroke:o.stroke||"none",strokeWidth:o.strokeWidth,opacity:o.opacity};f.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:l,datum:e})}if(!1!==r.showLabels){const t=(k=r.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null;for(const r of e){const e=r.x1-r.x0,o=r.y1-r.y0;if(0>=e||0>=o)continue;const i=t?t(r):r.id;if(!i)continue;let a,s,l;"down"===c?(a=r.y0+(r.y1-r.y0)/2,s=r.x1+14,l="middle"):(n[0]/2>r.x0+e/2?(a=r.x0-6,l="end"):(a=r.x1+6,l="start"),s=r.y0+o/2),m.push({x:a,y:s,text:i+"",anchor:l,baseline:"middle",fontSize:11})}}var k;return{sceneNodes:p,sceneEdges:f,labels:m}}},He={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){var o,i;if(0===e.length)return;const a=null!==(o=r.forceStrength)&&void 0!==o?o:.1,s=n[0]/2,c=n[1]/2,l=r.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),r=null==l?void 0:l.get(t.id);e?u++:r?(t.x=r.x,t.y=r.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const r=new Map;for(const t of e)r.set(t.id,t);for(const e of d){const n=Fe(e.id,t,r);if(n.length>0){let t=0,r=0;for(const e of n)t+=e.x,r+=e.y;const o=Ye(e.id),i=o%360*(Math.PI/180),a=10+o%20;e.x=t/n.length+a*Math.cos(i),e.y=r/n.length+a*Math.sin(i)}else{const t=Ye(e.id),r=t%360*(Math.PI/180),n=15+t%30;e.x=s+n*Math.cos(r),e.y=c+n*Math.sin(r)}}}else{const t=2.399963229728653;for(let r=0;e.length>r;r++){const n=e[r];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(r+.5),o=r*t;n.x=s+e*Math.cos(o),n.y=c+e*Math.sin(o)}}}const y=null!==(i=r.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),g=h?40:y,p=Ge(r.nodeSize,r.nodeSizeRange,e),f=e=>p(e),m=j().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),v=C().force("charge",I().strength(e=>-25*f(e))).force("center",P(s,c).strength(.8)).force("x",T(s).strength(.15)).force("y",M(c).strength(.15));if(v.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));v.force("link",m),v.force("link").links(e)}h?v.alpha(.3):.1>v.alpha()&&v.alpha(1),v.stop();for(let e=0;g>e;++e)v.tick();for(const t of e){if(null==t.x||null==t.y)continue;const e=f(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=b.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=b.get(e.target);t&&(e.target=t)}}},buildScene(e,t,r,n){var o,i,a;const s=r.nodeStyle,c=r.edgeStyle,l=Ge(r.nodeSize,r.nodeSizeRange,e),u=Array.isArray(r.colorScheme)?r.colorScheme:b,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],y=[],g=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=l(t),r=s?s(t):{},n={fill:r.fill||d.get(t.id)||"#007bff",stroke:r.stroke||"#fff",strokeWidth:null!==(o=r.strokeWidth)&&void 0!==o?o:2,opacity:r.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:n,datum:t,id:t.id,label:t.id})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),r="object"==typeof e.target?e.target:p.get(e.target);if(!t||!r)continue;if(null==t.x||null==t.y)continue;if(null==r.x||null==r.y)continue;const n=c?c(e):{},o={stroke:n.stroke||"#999",strokeWidth:null!==(i=n.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=n.opacity)&&void 0!==a?a:.6};y.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:o,datum:e})}if(!1!==r.showLabels){const t=(f=r.nodeLabel)?"function"==typeof f?f:e=>e[f]||e.id:null;for(const r of e){if(null==r.x||null==r.y)continue;const e=t?t(r):r.id;if(!e)continue;const n=l(r);g.push({x:r.x,y:r.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var f;return{sceneNodes:h,sceneEdges:y,labels:g}}};function Fe(e,t,r){const n=[];for(const o of t){const t="string"==typeof o.source?o.source:o.source.id,i="string"==typeof o.target?o.target:o.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=r.get(a);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function Ye(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function Ge(e,t,r){var n,o;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=r.map(t=>{var r;return null===(r=t.data)||void 0===r?void 0:r[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(n=y(a))&&void 0!==n?n:0,c=null!==(o=p(a))&&void 0!==o?o:1;if(s===c)return()=>(i[0]+i[1])/2;const l=N().domain([s,c]).range(i).clamp(!0);return t=>{var r;const n=null===(r=t.data)||void 0===r?void 0:r[e];return null==n||"number"!=typeof n?i[0]:l(n)}}const Xe=b,qe={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const{padAngle:o=.01,groupWidth:i=20,sortGroups:a}=r,s=Math.min(n[0],n[1])/2,c=s-i,l=n[0]/2,u=n[1]/2,d=(h=r.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const y=new Map;for(let t=0;e.length>t;t++)y.set(e[t].id,t);const g=e.length,p=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,r=y.get("string"==typeof e.source?e.source:e.source.id),n=y.get(t);if(void 0===r||void 0===n)continue;const o=d(e);p[r][n]=o}const f=B().padAngle(o);a&&f.sortGroups(a);const m=f(p),v=m.groups,b=W().innerRadius(c).outerRadius(s);for(const t of v){const r=e[t.index],n=b.centroid(t);r.x=n[0]+l,r.y=n[1]+u,r.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,r=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);r&&(e.source=r),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const r=e[t.source.index].id,n=e[t.target.index].id,o=k.get(`${r}\0${n}`)||k.get(`${n}\0${r}`);o&&(o.chordData=t)}},buildScene(e,t,r,n){var o,i;const{groupWidth:a=20,edgeOpacity:s=.5}=r,c=Math.min(n[0],n[1])/2,l=c-a,u=n[0]/2,d=n[1]/2,h=r.nodeStyle,y=r.edgeStyle,g=r.edgeColorBy||"source",p=Array.isArray(r.colorScheme)?r.colorScheme:Xe,f=new Map;e.forEach((e,t)=>{f.set(e.id,p[t%p.length])});const m=$().radius(l),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const r=e[t],n=r.arcData;if(!n)continue;let i;i=h?h(r).fill||f.get(r.id)||p[t%p.length]:f.get(r.id)||p[t%p.length];const a=h?h(r):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(o=a.strokeWidth)&&void 0!==o?o:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:l,outerR:c,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:s,datum:r,id:r.id,label:r.id})}for(const e of t){const t=e.chordData;if(!t)continue;const r=m(t);if(!r)continue;const n=Ve(r,u,d);let o="#999";if(y)o=y(e).fill||o;else{const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;"target"===g&&r?o=f.get(r.id)||o:t&&(o=f.get(t.id)||o)}const a=y?y(e):{},c={fill:o,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:n,style:c,datum:e})}if(!1!==r.showLabels){const t=(k=r.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null,n=c+12;for(const r of e){const e=r.arcData;if(!e)continue;const o=t?t(r):r.id;if(!o)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*n,y:d+Math.sin(a)*n,text:o+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:v,sceneEdges:b,labels:x}}};function Ve(e,t,r){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const o=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("C"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("Q"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("A"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&(o.push(Number(n[i])+t+""),i++),n.length>i&&(o.push(Number(n[i])+r+""),i++);else"Z"===e||"z"===e?(o.push(e),i++):(o.push(n[i]),i++)}return o.join(" ")}const Ke=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Ue(e){const[t,r,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*r+.114*n>150?"#222":"#fff"}function Ze(e,t,r){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+r}function Qe(e){return e?"function"==typeof e?e:t=>{var r;return(null===(r=t.data)||void 0===r?void 0:r[e])||t[e]||t.id}:null}function Je(e,t,r,n,o){if("horizontal"===o){const o=(e+r)/2;return`M ${e},${t} C ${o},${t} ${o},${n} ${r},${n}`}if("radial"===o){const o=(e+r)/2;return`M ${e},${t} Q ${o},${t} ${o},${(t+n)/2} T ${r},${n}`}{const o=(t+n)/2;return`M ${e},${t} C ${e},${o} ${r},${o} ${r},${n}`}}const et={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,r,n){var o;const i=r.__hierarchyRoot;if(!i)return;const a=r.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(r.childrenAccessor),c=r.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),l=z(i,s);l.sum(c),l.sort((e,t)=>{var r,n;return(null!==(r=t.value)&&void 0!==r?r:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[u,d]=n;switch(a){case"tree":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=q();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(l,r,u,d);break;case"cluster":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=X();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(l,r,u,d);break;case"treemap":!function(e,t,r,n){var o,i;const a=null!==(o=t.padding)&&void 0!==o?o:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,c=Y().size([r,n]).tile(G).padding(a);s>0&&c.paddingTop(s),c(e)}(l,r,u,d);break;case"circlepack":!function(e,t,r,n){var o;const i=null!==(o=t.padding)&&void 0!==o?o:4;F().size([r,n]).padding(i)(e)}(l,r,u,d);break;case"partition":!function(e,t,r,n){var o;H().size([r,n]).padding(null!==(o=t.padding)&&void 0!==o?o:1)(e)}(l,r,u,d)}const h=l.descendants();e.length=0,t.length=0;const y=new Map;for(let t=0;h.length>t;t++){const n=h[t],i={id:Ze(n,r,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(o=n.value)&&void 0!==o?o:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===a||"cluster"===a?tt(i,n,r):"treemap"===a||"partition"===a?rt(i,n):"circlepack"===a&&nt(i,n),i.__hierarchyNode=n,e.push(i),y.set(n,i)}if("tree"===a||"cluster"===a)for(const e of h)if(e.parent){const r=y.get(e.parent),n=y.get(e);r&&n&&t.push({source:r,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,r,n){const o=r.nodeStyle||(()=>({})),i=r.edgeStyle||(()=>({}));switch(r.chartType){case"tree":case"cluster":return function(e,t,r,n,o,i){var a,s,c,l,u;const d=[],h=[],y=[],g=r.treeOrientation||"vertical",p="radial"===g,f=n[0]/2,m=n[1]/2,v="number"==typeof(b=r.nodeSize)?b:5;var b;for(const t of e){let e=t.x,n=t.y;p&&(e+=f,n+=m);const i=o(t);let s=i.fill||"#4d430c";r.colorByDepth&&void 0!==t.depth&&(s=Ke[t.depth%Ke.length]);const c={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:n,r:v,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(s=r.edgeOpacity)&&void 0!==s?s:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let n=t.x,o=t.y,a=r.x,s=r.y;p&&(n+=f,o+=m,a+=f,s+=m);const u=Je(n,o,a,s,g),d=i(e),y={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(c=d.strokeWidth)&&void 0!==c?c:1.5,opacity:null!==(l=d.opacity)&&void 0!==l?l:x};h.push({type:"curved",pathD:u,style:y,datum:e})}if(!1!==r.showLabels){const t=Qe(r.nodeLabel);for(const r of e){const e=t?t(r):r.id;if(!e)continue;let n,o,i,a=r.x,s=r.y;if(p&&(a+=f,s+=m),p){const e=a-f,t=s-m,r=Math.sqrt(e*e+t*t);r>0?(n=a+e/r*10,o=s+t/r*10,i=0>e?"end":"start"):(n=a,o=s-12,i="middle")}else"horizontal"===g?((null===(u=r.data)||void 0===u?void 0:u.children)&&0!==r.data.children.length?(n=a-v-6,i="end"):(n=a+v+6,i="start"),o=s):(n=a,o=s+v+14,i="middle");y.push({x:n,y:o,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:y}}(e,t,r,n,o,i);case"treemap":case"partition":return function(e,t,r,n){var o,i;const a=[],s=[];for(const r of e){const e=r.x1-r.x0,i=r.y1-r.y0;if(0>=e||0>=i)continue;const s=n(r);let c=s.fill||"#4d430c";t.colorByDepth&&void 0!==r.depth&&(c=Ke[r.depth%Ke.length]);const l={fill:c,stroke:s.stroke||"#fff",strokeWidth:null!==(o=s.strokeWidth)&&void 0!==o?o:1,opacity:s.opacity};a.push({type:"rect",x:r.x0,y:r.y0,w:e,h:i,style:l,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=Qe(t.nodeLabel),o=t.labelMode||"leaf",a="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,l=c.y1-c.y0;if(0>=e||0>=l)continue;const u=!((null===(i=c.data)||void 0===i?void 0:i.children)&&c.data.children.length>0);if(!a){if("leaf"===o&&!u)continue;if("parent"===o&&u)continue}const d=r?r(c):c.id;if(!d)continue;if((u?30:40)>e||(u?16:14)>l)continue;let h=n(c).fill||"#4d430c";t.colorByDepth&&void 0!==c.depth&&(h=Ke[c.depth%Ke.length]);const y=Ue(h);s.push(u?{x:c.x0+e/2,y:c.y0+l/2,text:d+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,l)/6)),fill:y}:{x:c.x0+4,y:c.y0+12,text:d+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:y})}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,r,0,o);case"circlepack":return function(e,t,r,n){var o,i,a,s,c;const l=[],u=[];for(const r of e){const e=null!==(o=r.__radius)&&void 0!==o?o:5;if(0>=e)continue;const s=n(r);let c=s.fill||"#4d430c";t.colorByDepth&&void 0!==r.depth&&(c=Ke[r.depth%Ke.length]);const u={fill:c,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};l.push({type:"circle",cx:r.x,cy:r.y,r:e,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=Qe(t.nodeLabel);for(const o of e){const e=null!==(s=o.__radius)&&void 0!==s?s:5,i=r?r(o):o.id;if(!i)continue;if(15>e)continue;const a=!((null===(c=o.data)||void 0===c?void 0:c.children)&&o.data.children.length>0);let l=n(o).fill||"#4d430c";if(t.colorByDepth&&void 0!==o.depth&&(l=Ke[o.depth%Ke.length]),a){const t=Ue(l);u.push({x:o.x,y:o.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:t})}else u.push({x:o.x,y:o.y-e+14,text:i+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:"#000",stroke:"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:l,sceneEdges:[],labels:u}}(e,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function tt(e,t,r){const n=r.treeOrientation||"vertical";if("radial"===n){const r=t.x,n=t.y;e.x=n*Math.cos(r-Math.PI/2),e.y=n*Math.sin(r-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function rt(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function nt(e,t){var r;const n=null!==(r=t.r)&&void 0!==r?r:0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}function ot(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const it={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;o&&function(e,t,r,n,o){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(r.childrenAccessor),c=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var r;return(null!==(r=e[t])&&void 0!==r?r:"")+""}}(r.nodeIDAccessor),l=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),u=null!==(i=r.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=r.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,y="number"==typeof d?()=>d:d,g=ot(r);g.metaMap.clear(),n.length=0,o.length=0;const p=new Map;function f(e){var t;const r=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,r+1),0===r?e:`${e}__${r}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=f(c(e));n.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),g.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,r,i,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=l[Math.min(k,l.length-1)],k++,b++;let A=0;for(let v=0;b>v;v++){const x=l[Math.min(v,l.length-1)],k=m.slice(A,A+x);if(!k.length)break;const w=(v+1)/b,E={id:r,depth:d,data:t,parentId:r},S=p?u/h(E)*w:u*w,L=R().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),O=L(k),D=y(E);for(let t=0;k.length>t;t++){const s=(O[t].startAngle+O[t].endAngle)/2,l=k[t],u=f(c(l)),h=i+S*Math.sin(s),y=a+S*Math.cos(s)*D;n.push({id:u,x:h,y:y,x0:h,x1:h,y0:y,y1:y,width:0,height:0,value:0,depth:d,data:l}),g.metaMap.set(u,{ring:S,angle:s,depth:d,parentId:r,eccentricity:D}),o.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),e(l,u,h,y,S,d+1,!0)}A+=x}}(e,x,m,v,b,1,!1)}(o,n,r,e,t)},buildScene(e,t,r,n){var o,i,a,s,c;const l=r.nodeStyle,u=r.nodeSize,d="number"==typeof u?()=>u:"function"==typeof u?u:()=>6,h=[],y=[],g=[];if(!1!==r.orbitShowRings){const t=ot(r),n=new Map;for(const t of e)n.set(t.id,t);const o=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const r=`${e.parentId}:${e.ring}`;o.has(r)||o.set(r,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:r,ecc:n}]of o)for(let o=0;i>o;o++){const s=o/i*Math.PI*2,c=(o+1)/i*Math.PI*2;y.push({type:"line",x1:e+r*Math.sin(s),y1:t+r*Math.cos(s)*n,x2:e+r*Math.sin(c),y2:t+r*Math.cos(c)*n,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=d(t),r=l?l(t):{},n={fill:r.fill||"#6366f1",stroke:r.stroke||"#fff",strokeWidth:null!==(o=r.strokeWidth)&&void 0!==o?o:1,opacity:null!==(i=r.opacity)&&void 0!==i?i:0===(null!==(a=t.depth)&&void 0!==a?a:0)?1:.85};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:n,datum:t,id:t.id,label:t.id,depth:t.depth})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),r="object"==typeof e.target?e.target:p.get(e.target);t&&r&&(null!=t.x&&null!=r.x&&y.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(r.showLabels){const t=r.nodeLabel;for(const r of e){const e=d(r);if(4>=e)continue;const n="function"==typeof t?t(r):t&&null!==(c=null===(s=r.data)||void 0===s?void 0:s[t])&&void 0!==c?c:r.id;g.push({x:r.x,y:r.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:y,labels:g}},tick:(e,t,r,n,o)=>!1!==r.orbitAnimated&&(function(e,t){var r,n;const o=ot(t),i=null!==(r=t.orbitSpeed)&&void 0!==r?r:.25,a=null!==(n=t.orbitRevolution)&&void 0!==n?n:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const r=null!==(t=e.depth)&&void 0!==t?t:0;return(r%2==0?1:-1)/(r+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,c=i*(Math.PI/6),l=new Map;for(const t of e)l.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=l.get(e.parentId);if(!r)continue;const n=e.angle+s*c*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=r.x+e.ring*Math.sin(n),t.y=r.y+e.ring*Math.cos(n)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,r),!0)},at={sankey:ze,force:He,chord:qe,tree:et,cluster:et,treemap:et,circlepack:et,partition:et,orbit:it};function st(e){return at[e]}function ct(e,t,r){return e+(t-e)*r}class lt{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},V),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new U(2e3))}updateConfig(e){const t=this.config,r=e;t.__orbitState&&(r.__orbitState=t.__orbitState),t.__hierarchyRoot&&(r.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},V),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new U(2e3))}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,r){const{nodeIDAccessor:n="id",sourceAccessor:o="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof n?n:e=>e[n],c="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},ut(e)),{data:t}))}for(let e=0;t.length>e;e++){const r=t[e],n=c(r)+"",o=l(r)+"",i=Number(u(r))||1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},ut(n)),{data:r})),this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},ut(o)),{data:r}));const a=`${n}\0${o}\0${e}`;this.edges.set(a,{source:n,target:o,value:i,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:a})}this.runLayout(r)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:r,value:n}=e,o=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,ut(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(r)||(this.nodes.set(r,ut(r)),this.nodeTimestamps.set(r,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,r),c=this.edges.get(s);let l=!1;return c?(c.value+=n,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,l=!0):(this.edges.set(s,{source:t,target:r,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),o||i||l||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,r,n,o,i,a;const s=st(this.config.chartType);if(!s)return;let c=Array.from(this.nodes.values()),l=Array.from(this.edges.values());if(0===c.length&&!s.hierarchical)return;if(this.prepareForRelayout(),s.supportsStreaming&&!s.hierarchical){const e=new Map;for(const s of c)if(void 0!==s._prevX0){const c=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(r=s._prevX0)&&void 0!==r?r:0),l=(null!==(n=s._prevY1)&&void 0!==n?n:0)-(null!==(o=s._prevY0)&&void 0!==o?o:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+c/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+l/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,r]of this._lastPositionSnapshot)e.has(t)||e.set(t,r);this.config.__previousPositions=e.size>0?e:void 0}if(s.computeLayout(c,l,this.config,e),delete this.config.__previousPositions,s.hierarchical&&c.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of c)this.nodes.set(e.id,e);for(let e=0;l.length>e;e++){const t=l[e],r=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=r,this.edges.set(r,t)}}this.finalizeLayout();const u=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||u.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=u,this.saveTargetPositions(),c.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const d=new Set(this.nodes.keys()),h=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of d)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)d.has(e)||this.removedNodes.add(e);for(const e of h)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)h.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=d,this.previousEdgeKeys=h,this.layoutVersion++}buildScene(e){const t=st(this.config.chartType);if(!t)return;const r=Array.from(this.nodes.values()),n=Array.from(this.edges.values()),{sceneNodes:o,sceneEdges:i,labels:a}=t.buildScene(r,n,this.config,e);this.sceneNodes=o,this.sceneEdges=i,this.labels=a}get isAnimating(){const e=st(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const r=st(this.config.chartType);if(!(null==r?void 0:r.tick))return!1;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());return r.tick(n,o,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.transition),r=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=ct(e._prevX0,e._targetX0,r),e.x1=ct(e._prevX1,e._targetX1,r),e.y0=ct(e._prevY0,e._targetY0,r),e.y1=ct(e._prevY1,e._targetY1,r));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=ct(e._prevY0,e._targetY0,r),e.y1=ct(e._prevY1,e._targetY1,r),e.sankeyWidth=ct(e._prevSankeyWidth,e._targetSankeyWidth,r));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,r="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&r&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,r))}buildStandardBezier(e,t,r){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const o=t.x1,i=r.x0,a=h(o,i);return{circular:!1,points:[{x:e.y0,y:o},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:n}}const o=t.x1,i=r.x0,a=h(o,i);return{circular:!1,points:[{x:o,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,r=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(r.rightFullExtent-r.sourceX))),n=Math.max(15,Math.min(40,.33*(r.targetX-r.leftFullExtent)));return{circular:!0,segments:[[{x:r.sourceX,y:r.sourceY},{x:r.sourceX+.33*e,y:r.sourceY},{x:r.sourceX+.66*e,y:r.sourceY},{x:r.sourceX+e,y:r.sourceY}],[{x:r.targetX-n,y:r.targetY},{x:r.targetX-.66*n,y:r.targetY},{x:r.targetX-.33*n,y:r.targetY},{x:r.targetX,y:r.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:r.sourceY,y:r.sourceX},{x:r.sourceY,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.leftFullExtent},{x:r.targetY,y:r.leftFullExtent},{x:r.targetY,y:r.targetX}]:[{x:r.sourceX,y:r.sourceY},{x:r.rightFullExtent,y:r.sourceY},{x:r.rightFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.targetY},{x:r.targetX,y:r.targetY}];const o=[];for(let e=0;n.length-1>e;e++){const t=n[e],r=n[e+1],i=r.x-t.x,a=r.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},r])}return{circular:!0,segments:o,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,r,n,o,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,c=null!==(r=a.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(n=a.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const r=t.id;if(!r)continue;const n=this.nodeTimestamps.get(r);if(!n)continue;const o=e-n;s>o&&(t._pulseIntensity=1-o/s,t._pulseColor=c,t._pulseGlowRadius=l)}for(const t of this.sceneEdges){const r=t.datum;if(!r)continue;const n="object"==typeof r.source?null===(o=r.source)||void 0===o?void 0:o.id:r.source,a="object"==typeof r.target?null===(i=r.target)||void 0===i?void 0:i.id:r.target;if(!n||!a)continue;const l=this.edgeTimestamps.get(`${n}\0${a}`);if(!l)continue;const u=e-l;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=c)}}applyDecay(){var e,t,r,n,o;const i=this.config.decay;if(!i)return;const a=null!==(e=i.minOpacity)&&void 0!==e?e:.1,s=this.nodeTimestamps.size;if(1>=s)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const c=this._decaySortedNodes,l=new Map;for(let e=0;c.length>e;e++)l.set(c[e][0],e);for(const e of this.sceneNodes){const c=e.id;if(!c)continue;const u=l.get(c);if(void 0===u)continue;const d=s-1-u;let h;switch(i.type){case"linear":h=a+(1-d/(s-1))*(1-a);break;case"exponential":{const e=null!==(t=i.halfLife)&&void 0!==t?t:s/2;h=a+Math.pow(.5,d/e)*(1-a);break}case"step":h=(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*s)>d?1:a;break;default:h=1}const y=null!==(o=null===(n=e.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;e.style=Object.assign(Object.assign({},e.style),{opacity:y*h})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const r=e-this.lastTopologyChangeTime;if(r>=2e3)return;const n=1-r/2e3;for(const e of this.sceneNodes){const r=e.id;r&&this.addedNodes.has(r)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,n),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,r;const n=this.config.thresholds;if(!n)return;const o=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(r=n.criticalColor)&&void 0!==r?r:"#ef4444",a=!1!==n.pulse;for(const t of this.sceneNodes){const r=t.id;if(!r)continue;const s=this.nodes.get(r);if(!s)continue;const c=n.metric(s);let l=null;void 0===n.critical||n.critical>c?void 0===n.warning||n.warning>c||(l=o):l=i,l&&(t.style=Object.assign(Object.assign({},t.style),{fill:l}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=l,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const r=e.metric(t);if(void 0!==e.warning&&r>=e.warning||void 0!==e.critical&&r>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const r="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>r-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function ut(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function dt(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function ht(e,t,r,n,o=30){let i=null,a=o,s=1/0;for(const t of e){const e=yt(t,r,n);if(e)if("rect"===t.type){const r=t.w*t.h;s>r&&(i=e,s=r)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=mt(e,r,n);t&&a>t.distance&&(i=t,a=t.distance)}return i}function yt(e,t,r){switch(e.type){case"circle":return function(e,t,r){const n=t-e.cx,o=r-e.cy,i=Math.sqrt(n*n+o*o);return i>Math.max(e.r+5,12)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,r);case"rect":return function(e,t,r){const n=function(e,t,r){return r.x>e||e>r.x+r.w||r.y>t||t>r.y+r.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:r.x+r.w/2,cy:r.y+r.h/2}}(t,r,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,r);case"arc":return function(e,t,r){const n=t-e.cx,o=r-e.cy,i=Math.sqrt(n*n+o*o);if(e.innerR-2>i||i>e.outerR+2)return null;const a=dt(Math.atan2(o,n)),s=dt(e.startAngle),c=dt(e.endAngle);if(s>c?a>=s||c>=a:a>=s&&c>=a){const t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+r*Math.cos(t),y:e.cy+r*Math.sin(t),distance:0}}return null}(e,t,r);default:return null}}let gt=null,pt=null;function ft(){return pt||(gt=document.createElement("canvas"),gt.width=1,gt.height=1,pt=gt.getContext("2d")),pt}function mt(e,t,r){switch(e.type){case"bezier":return function(e,t,r){var n,o;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),a=ft();if(!a)return null;if(a.isPointInPath(i,t,r)){const i="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.source)?e.datum.source:null,a="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:r,distance:0}}const s=a.lineWidth;a.lineWidth=10;const c=a.isPointInStroke(i,t,r);if(a.lineWidth=s,c)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch(e){}return null}(e,t,r);case"line":return function(e,t,r){const n=e.x2-e.x1,o=e.y2-e.y1,i=n*n+o*o;if(0===i)return null;let a=((t-e.x1)*n+(r-e.y1)*o)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*n,c=e.y1+a*o,l=Math.sqrt(Math.pow(t-s,2)+Math.pow(r-c,2));return l>5?null:{type:"edge",datum:e.datum,x:s,y:c,distance:l}}(e,t,r);case"ribbon":case"curved":return function(e,t,r){if(!e.pathD)return null;try{const n=new Path2D(e.pathD),o=ft();if(!o)return null;if(o.isPointInPath(n,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(n,t,r);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch(e){}return null}(e,t,r);default:return null}}function vt(e,t,r){const{group:n,indexInGroup:o}=t,i=r.byGroup.get(n);switch(e){case"ArrowRight":return i.length-1>o?i[o+1]._flatIndex:t.flatIndex;case"ArrowLeft":return o>0?i[o-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=r.groups.indexOf(n);return r.groups.length-1>e?bt(r,r.groups[e+1],i[o]):t.flatIndex}case"ArrowUp":{const e=r.groups.indexOf(n);return e>0?bt(r,r.groups[e-1],i[o]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*r.flat.length)),r.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*r.flat.length)),0);case"Home":return 0;case"End":return r.flat.length-1;case"Escape":return-1;default:return null}}function bt(e,t,r){const n=e.byGroup.get(t);let o=0,i=Math.abs(n[0].x-r.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-r.x);i>t&&(i=t,o=e)}return n[o]._flatIndex}const xt="var(--semiotic-focus, #005fcc)";function kt({active:t,hoverPoint:r,margin:n,size:o,shape:i="circle",width:a,height:s}){if(!t||!r)return null;const c=r.x+n.left,l=r.y+n.top;let u;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),r=Math.max(s,4);u=e.createElement("rect",{x:c-t/2-3,y:l-r/2-3,width:t+6,height:r+6,rx:3,fill:"none",stroke:xt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:c,cy:l,r:12,fill:"none",stroke:xt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:c,cy:l,r:8,fill:"none",stroke:xt,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function At({x:t,y:r,containerWidth:n,containerHeight:o,margin:i,children:a,className:s="stream-frame-tooltip",zIndex:c=1}){const l=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,s,n,o]);let h;return h=u?`translate(${u.width+12>n-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-r?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>r?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:l,className:s,style:{position:"absolute",left:i.left+t,top:i.top+r,transform:h,pointerEvents:"none",zIndex:c,width:"max-content"}},a)}const wt={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Et(e,t,r,n){let o;return o="function"==typeof r?r(e):(0,wt[r])(n(e,t)),o}function St(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Lt(e,t,r){return r&&r.size>0?r.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function Ot({config:t,orientation:r="vertical",width:n=100}){const{colorFn:o,domain:i,label:a,format:s}=t,c=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+e.useId();if("horizontal"===r){const t=12,r=Math.min(n,200),s=Math.max(0,(n-r)/2),u=[];for(let t=0;64>=t;t++){const r=t/64;u.push(e.createElement("stop",{key:t,offset:100*r+"%",stopColor:o(i[0]+r*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+r/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:r,height:t,fill:`url(#${l})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},c(i[0])),e.createElement("text",{x:s+r,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},c(i[1])))}const u=[];for(let t=0;64>=t;t++){const r=t/64;u.push(e.createElement("stop",{key:t,offset:100*r+"%",stopColor:o(i[1]-r*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("defs",null,e.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},c(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},c(i[0])))}function Dt(t){const{legendGroups:r,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:c="Legend",width:l=100,height:u=20,orientation:d="vertical"}=t,[h,y]=e.useState(0),[g,p]=e.useState(0),f=e.useCallback((e,t)=>{y(e),p(t)},[]),m="vertical"===d?(({legendGroups:t,width:r,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:c,onFocusedIndexChange:l,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,y)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+y,stroke:"gray",x1:0,y1:d,x2:r,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+y,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+y,className:"legend-item",transform:`translate(0,${d})`},((t,r,n,o,i,a,s,c,l,u)=>{const{type:d="fill",styleFn:h,items:y}=t,g=[];let p=0;const f=!(!r&&!n),m="isolate"===u||void 0===u&&null!=i;return y.forEach((t,u)=>{const v=Et(t,u,d,h),b=Lt(t,o,i),x=i&&i.size>0&&i.has(t.label);g.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:r?()=>r(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:f?c===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=o&&t.label===o||void 0,"aria-label":t.label,onKeyDown:f?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r&&r(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+y.length)%y.length;l(c,t);const r=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];r instanceof SVGElement&&r.focus()}}:void 0,onFocus:f?e=>{l(c,u),n&&n(t);const r=e.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(St,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=22}),g})(t,n,o,i,a,s,c,y,l,u))),d+=22*t.items.length+8}),h})({legendGroups:r||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:g,onFocusedIndexChange:f,legendInteraction:s}):(({legendGroups:t,height:r,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:c,focusedItemIndex:l,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const y=[];t.forEach((t,r)=>{let g=0;t.label&&(g+=16);const p=((t,r,n,o,i,a,s,c,l,u,d)=>{const{type:h="fill",styleFn:y,items:g}=t,p=[];let f=0,m=0;const v=!(!r&&!n),b="isolate"===u||void 0===u&&null!=i;g.forEach((t,u)=>{const x=Et(t,u,h,y),k=Lt(t,o,i),A=i&&i.size>0&&i.has(t.label),w=26+7*t.label.length;d&&d>0&&f>0&&f+w>d&&(m++,f=0),p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},${22*m})`,onClick:r?()=>r(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:v?c===a&&u===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?A||!1:void 0,"aria-current":v&&!b&&null!=o&&t.label===o||void 0,"aria-label":t.label,onKeyDown:v?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r&&r(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+g.length)%g.length;l(c,t);const r=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];r instanceof SVGElement&&r.focus()}}:void 0,onFocus:v?e=>{l(c,u),n&&n(t);const r=e.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,A&&e.createElement(St,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),f+=w});let x=0,k=0;for(const e of g){const t=26+7*e.label.length;d&&d>0&&k>0&&k+t>d?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const A=m+1;return{items:p,offset:x,totalRows:A,totalHeight:22*A}})(t,o,i,a,s,c,l,r,u,d,n);g+=p.offset+5,y.push(Object.assign(Object.assign({label:t.label},p),{offset:g,totalRows:p.totalRows,totalHeight:p.totalHeight})),h+=g+12});let g=h>n?0:Math.max(0,(n-h)/2);const p=[];return y.forEach((n,o)=>{const i=t[o];i.label&&(p.push(e.createElement("text",{key:"legend-text-"+o,transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),g+=16),p.push(e.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${g},0)`},n.items)),g+=n.offset+5,t[o+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:g,y1:-8,x2:g,y2:(n.totalHeight||r)+0+8})),g+=12}),e.createElement("g",null,p)})({legendGroups:r||[],title:c,height:u,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:g,onFocusedIndexChange:f,legendInteraction:s}),v=!(!n&&!o);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==c&&""!==c&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},c),m)}function jt(t){const{width:r,height:n,totalWidth:o,totalHeight:i,margin:a,labels:s,title:c,legend:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:y,legendPosition:g="right",foregroundGraphics:p,sceneNodes:f,annotations:m,svgAnnotationRules:v}=t;return e.createElement(e.Fragment,null,e.createElement("svg",{role:"img",width:o,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof c?c:"Network Chart"),e.createElement("desc",null,"string"==typeof c?c+" — network data visualization":"Network data visualization"),e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,r)=>e.createElement("text",{key:"label-"+r,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),m&&m.filter(e=>"widget"!==e.type).map((t,o)=>{if(v){const i=v(t,o,{width:r,height:n,sceneNodes:f});if(i)return e.createElement(e.Fragment,{key:"annotation-"+o},i)}return null}),p),c&&"string"==typeof c?e.createElement("text",{x:o/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},c):c?e.createElement("foreignObject",{x:0,y:0,width:o,height:a.top},c):null,function(t){const{legend:r,totalWidth:n,totalHeight:o,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:c,legendClickBehavior:l,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!r)return null;const y="top"===a||"bottom"===a;let g,p;return"left"===a?(g=4,p=i.top):"top"===a?(g=0,p=s?32:8):"bottom"===a?(g=0,p=o-i.bottom+50):(g=n-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${g}, ${p})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(r)?e.createElement(Ot,{config:r.gradient,orientation:y?"horizontal":"vertical",width:y?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(r)?e.createElement(Dt,{legendGroups:r.legendGroups,title:"",width:y?n:100,orientation:y?"horizontal":"vertical",customHoverBehavior:c,customClickBehavior:l,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):r)}({legend:l,totalWidth:o,totalHeight:i,margin:a,legendPosition:g,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:y})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&f).map((t,r)=>{var n,o,i,s,c,l,u,d,h;const y=f.find(e=>{var r,n,o,i,a;return e.id===t.nodeId||(null===(r=e.datum)||void 0===r?void 0:r.id)===t.nodeId||(null===(o=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===o?void 0:o.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!y)return null;const g=a.left+(null!==(n=y.cx)&&void 0!==n?n:null!=y.x&&null!=y.w?y.x+y.w/2:null!==(o=y.x)&&void 0!==o?o:0),p=a.top+(null!==(i=y.cy)&&void 0!==i?i:null!=y.y&&null!=y.h?y.y+y.h/2:null!==(s=y.y)&&void 0!==s?s:0),m=null!==(c=t.dx)&&void 0!==c?c:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,b=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e.createElement("span",{style:{fontSize:18,cursor:"default"}},"ℹ️");return e.createElement("div",{key:"widget-"+r,style:{position:"absolute",left:g+m-b/2,top:p+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function Ct(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}jt.displayName="NetworkSVGOverlay";const It="undefined"==typeof window||"undefined"==typeof document,Pt=e.createContext(null),Tt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Mt(e,t,r){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?r+", empty":`${r}, ${n.join(", ")}`}const Nt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},_t={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},$t={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Bt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Wt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Rt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},zt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ht={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ft({nodes:t,edges:r,chartType:n,tableId:o,chartTitle:i}){var a,s,c,l,u,d,h,y,g,p,f,m,v,b;const[x,k]=e.useState(!1),A=e.useContext(Pt),w=null!==(a=null==A?void 0:A.visible)&&void 0!==a&&a,E=x||w,S=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n,L=e.useRef(null),O=e.useCallback(()=>{x||w||k(!0)},[x,w]),D=e.useCallback(e=>{var t;w||(null===(t=L.current)||void 0===t?void 0:t.contains(e.relatedTarget))||k(!1)},[w]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:Tt}):null;if(!E)return e.createElement("div",{id:o,tabIndex:-1,onFocus:O,style:Tt,role:"region","aria-label":S},e.createElement("button",{type:"button",onClick:()=>k(!0)},"View data summary (",t.length," nodes, ",r.length," edges)"));const j=Array.isArray(t)?t:[],C=Array.isArray(r)?r:[],I=new Map,P=new Map,T=new Map,M=new Map;for(const e of C){if(!e||"object"!=typeof e)continue;const t=null!==(s=e.datum)&&void 0!==s?s:e,r="object"==typeof t.source?null===(c=t.source)||void 0===c?void 0:c.id:t.source,n="object"==typeof t.target?null===(l=t.target)||void 0===l?void 0:l.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=r&&""!==r){const e=r+"";P.set(e,(null!==(u=P.get(e))&&void 0!==u?u:0)+1),M.set(e,(null!==(d=M.get(e))&&void 0!==d?d:0)+o)}if(null!=n&&""!==n){const e=n+"";I.set(e,(null!==(h=I.get(e))&&void 0!==h?h:0)+1),T.set(e,(null!==(y=T.get(e))&&void 0!==y?y:0)+o)}}const N=[];for(let e=0;j.length>e;e++){const t=j[e];if(!t||"object"!=typeof t)continue;const r=null!==(p=null===(g=t.datum)||void 0===g?void 0:g.id)&&void 0!==p?p:t.id,n=null!=r?r+"":"node-"+e,o=null!==(f=I.get(n))&&void 0!==f?f:0,i=null!==(m=P.get(n))&&void 0!==m?m:0,a=null!==(v=T.get(n))&&void 0!==v?v:0,s=null!==(b=M.get(n))&&void 0!==b?b:0;N.push({id:n,degree:o+i,inDeg:o,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}N.sort((e,t)=>t.degree-e.degree);let _=0,$=0;if(N.length>0){let e=0;for(const t of N)e+=t.degree,t.degree>$&&($=t.degree);_=e/N.length}const B=C.some(e=>{var t;const r=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==r?void 0:r.value)&&Number.isFinite(r.value)}),W=[`${N.length} nodes, ${C.length} edges.`];N.length>0&&W.push(`Mean degree: ${Nt(_)}, max degree: ${$}.`);const R=N.slice(0,5);return e.createElement("div",{ref:L,id:o,tabIndex:-1,onBlur:D,style:_t,role:"region","aria-label":S},e.createElement("button",{type:"button",onClick:()=>{w&&A&&A.setVisible(!1),k(!1)},"aria-label":"Close data summary",style:Bt},"×"),e.createElement("div",{role:"note",style:$t},W.join(" ")),e.createElement("table",{role:"table","aria-label":"Node degree summary for "+n,style:Wt},e.createElement("caption",{style:Ht},"Top ",R.length," of ",N.length," nodes by degree"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:Rt},"id"),e.createElement("th",{style:Rt},"degree"),e.createElement("th",{style:Rt},"in"),e.createElement("th",{style:Rt},"out"),B&&e.createElement("th",{style:Rt},"w. degree"),B&&e.createElement("th",{style:Rt},"w. in"),B&&e.createElement("th",{style:Rt},"w. out"))),e.createElement("tbody",null,R.map((t,r)=>e.createElement("tr",{key:r},e.createElement("td",{style:zt},t.id),e.createElement("td",{style:zt},t.degree),e.createElement("td",{style:zt},t.inDeg),e.createElement("td",{style:zt},t.outDeg),B&&e.createElement("td",{style:zt},Nt(t.wDegree)),B&&e.createElement("td",{style:zt},Nt(t.wInDeg)),B&&e.createElement("td",{style:zt},Nt(t.wOutDeg)))))))}function Yt({summary:t}){return t?e.createElement("div",{role:"note",style:Tt},t):null}function Gt({tableId:t}){return e.createElement("a",{href:"#"+t,style:Tt,onClick:e=>{e.preventDefault();const r=document.getElementById(t);r&&requestAnimationFrame(()=>r.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Tt)}},"Skip to data table")}function Xt({hoverPoint:t}){let r="";if(t){const e=t.data||t;r="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:Tt},r)}function qt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Vt(e,t,r=.3){qt(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Kt(e,t,r=.6){var n,o,i,a,s;if(!qt(t))return;const c=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,l=t.r+c*t._pulseIntensity,u=null!==(i=null!==(o=t.cx)&&void 0!==o?o:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,l,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*r,e.stroke()}function Ut(e,t){var r,n,o,i,a,s;if(!t.pathD)return;e.save();const c=new Path2D(t.pathD);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const o=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==n?n:.5,s="string"==typeof t.style.fill?t.style.fill:"#999";o.addColorStop(0,1===a.from?s:"transparent"),o.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=o,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==i?i:.5;e.fill(c)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(c)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(c)),e.restore()}function Zt(e,t){var r,n;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(n=t.style.strokeWidth)&&void 0!==n?n:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Qt(e,t){var r,n,o,i;if(!t.pathD)return;e.save();const a=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==n?n:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function Jt(e,t){var r,n;if(!t.pathD)return;e.save();const o=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(o)),e.restore()}const er={category10:b,tableau10:D,set3:O,blues:L,reds:S,greens:E,oranges:w,purples:A,viridis:k,plasma:x},tr=b,rr=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],nr=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],or=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function ir(e,t,r){if("function"==typeof t){const n=t(e);return r&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||or.has(t)}(n)?r(n):n}const n=e[t];return r?r(n):tr[Math.abs(function(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return Math.abs(t)}(n+""))%tr.length]}function ar(e,t,r="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),o=n.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(r))return _().domain(n).range(r).unknown("#999");const i=er[r]||er.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of n){const r=Number(t);r>e&&(e=r)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:tr;return _().domain(n).range(e).unknown("#999")}}function sr(t){const r=o(null),l=cr(t);return[function({children:n}){const o=i(()=>cr(t),[]);return e.createElement(r.Provider,{value:o,children:n})},e=>{var t;const o=null!==(t=a(r))&&void 0!==t?t:l,i=n(e);i.current=e;const u=s(()=>i.current(o.getState()),[o]),d=s(()=>i.current(o.getState()),[o]);return c(o.subscribe,u,d)}]}function cr(e){const t=new EventTarget;let r=e(function(e){r=Object.assign(Object.assign({},r),e(r)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>r,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const lr={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},ur={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},dr={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[hr,yr]=sr(e=>({theme:lr,setTheme(t){e(e=>{if("light"===t)return{theme:lr};if("dark"===t)return{theme:ur};if("high-contrast"===t)return{theme:dr};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?ur:lr;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}})),gr={top:20,right:80,bottom:20,left:80},pr={top:40,right:40,bottom:40,left:40},fr=new Set(["chord","force","circlepack","orbit"]),mr=[800,600],vr={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function br({data:t}){var r,n,o,i,a,s;if("edge"===t.type){const r=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:vr},e.createElement("div",{style:{fontWeight:600}},"object"==typeof r.source?r.source.id:r.source," → ","object"==typeof r.target?r.target.id:r.target),null!=r.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof r.value?r.value.toLocaleString():r.value+""))}const c=t.data,l=null==c?void 0:c.__hierarchyNode;if(l){const t=[];let a=l;for(;a;){const e=null!==(i=null!==(n=null===(r=a.data)||void 0===r?void 0:r.name)&&void 0!==n?n:null===(o=a.data)||void 0===o?void 0:o.id)&&void 0!==i?i:c.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:vr},e.createElement("div",null,t.map((t,r)=>e.createElement("span",{key:r},r>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),r===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=c.value&&c.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof c.value?c.value.toLocaleString():c.value+""))}const u=((null===(a=c.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=c.targetLinks)||void 0===s?void 0:s.length)||0),d=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:vr},e.createElement("div",{style:{fontWeight:600}},c.id),null!=c.value&&c.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const xr=l(function(o,a){var c,l,d,h,y,g,p,f,m,v,b,x,k,A;const{chartType:w,nodes:E,edges:S,data:L,initialEdges:O,nodeIDAccessor:D="id",sourceAccessor:j="source",targetAccessor:C="target",valueAccessor:I="value",childrenAccessor:P,hierarchySum:T,orientation:M="horizontal",nodeAlign:N="justify",nodePaddingRatio:_=.05,nodeWidth:$=15,iterations:B=300,forceStrength:R=.1,padAngle:z=.01,groupWidth:H=20,sortGroups:F,edgeSort:Y,treeOrientation:G="vertical",edgeType:X="curve",padding:q,paddingTop:U,tensionConfig:Z,showParticles:Q=!1,particleStyle:J,nodeStyle:ee,edgeStyle:te,colorBy:re,colorScheme:ne="category10",edgeColorBy:oe="source",edgeOpacity:ie=.5,colorByDepth:ae=!1,nodeSize:se=8,nodeSizeRange:ce=[5,20],nodeLabel:le,showLabels:ue=!0,labelMode:de,size:he=mr,responsiveWidth:ye,responsiveHeight:ge,margin:pe,className:fe,background:me,enableHover:ve=!0,tooltipContent:be,customHoverBehavior:xe,customClickBehavior:ke,onObservation:Ae,chartId:we,onTopologyChange:Ee,annotations:Se,svgAnnotationRules:Le,legend:Oe,legendPosition:De,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Ie,legendIsolatedCategories:Pe,title:Te,foregroundGraphics:Me,backgroundGraphics:Ne,decay:_e,pulse:$e,staleness:Be,thresholds:We,accessibleTable:Re=!0,description:ze,summary:He,orbitMode:Fe,orbitSize:Ye,orbitSpeed:Ge,orbitRevolution:Xe,orbitRevolutionStyle:qe,orbitEccentricity:Ve,orbitShowRings:Ke,orbitAnimated:Ue}=o,Ze=function(){const[e,n]=t(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return r(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),e}(),Qe=n(Ze);Qe.current=Ze;const Je="semiotic-table-"+e.useId(),et=fr.has(w)?pr:gr,[tt,rt]=function(e,o,i){const a=n(null),[s,c]=t(null);return r(()=>{if(!o&&!i)return;const e=a.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:r}=t.contentRect;c(t=>t&&t.w===e&&t.h===r?t:{w:e,h:r})}});return t.observe(e),()=>t.disconnect()},[o,i]),[a,[o&&s?s.w:e[0],i&&s?s.h:e[1]]]}(he,ye,ge),nt=Object.assign(Object.assign({},et),pe),ot=rt[0]-nt.left-nt.right,it=rt[1]-nt.top-nt.bottom,at="function"==typeof Me?Me({size:rt,margin:nt}):Me,st=i(()=>Object.assign(Object.assign({},V),Z),[Z]),ct=i(()=>Object.assign(Object.assign({},K),J),[J]),ut=i(()=>({chartType:w,nodeIDAccessor:D,sourceAccessor:j,targetAccessor:C,valueAccessor:I,childrenAccessor:P,hierarchySum:T,orientation:M,nodeAlign:N,nodePaddingRatio:_,nodeWidth:$,iterations:B,forceStrength:R,padAngle:z,groupWidth:H,sortGroups:F,edgeSort:Y,treeOrientation:G,edgeType:X,padding:q,paddingTop:U,tensionConfig:st,showParticles:Q,particleStyle:ct,nodeStyle:ee,edgeStyle:te,nodeLabel:le,showLabels:ue,labelMode:de,colorBy:re,colorScheme:ne,edgeColorBy:oe,edgeOpacity:ie,colorByDepth:ae,nodeSize:se,nodeSizeRange:ce,decay:_e,pulse:$e,staleness:Be,thresholds:We,orbitMode:Fe,orbitSize:Ye,orbitSpeed:Ge,orbitRevolution:Xe,orbitRevolutionStyle:qe,orbitEccentricity:Ve,orbitShowRings:Ke,orbitAnimated:Ue}),[w,D,j,C,I,P,T,M,N,_,$,B,R,z,H,F,Y,G,X,q,U,st,Q,ct,ee,te,le,ue,de,re,ne,oe,ie,ae,se,ce,_e,$e,Be,We,Fe,Ye,Ge,Xe,qe,Ve,Ke,Ue]),dt=n(null),yt=n(0),gt=n(0),pt=n(!0),ft=yr(e=>e.theme),mt=n(()=>{}),bt=n(null);bt.current||(bt.current=new lt(ut));const[xt,wt]=t(null),[Et,St]=t(0),[Lt,Ot]=t(0),[Dt,Pt]=t(!1),Tt=n(null),Nt=n(new Map),_t=n(0),$t=s(e=>{if("function"==typeof re)return re(e)+"";if("string"==typeof re&&e.data){const t=e.data[re];if(void 0!==t){if(!Nt.current.has(t+"")){const e=Array.isArray(ne)?ne:tr;Nt.current.set(t+"",e[_t.current++%e.length])}return Nt.current.get(t+"")}}if(Nt.current.has(e.id))return Nt.current.get(e.id);const t=Array.isArray(ne)?ne:tr,r=re?t[_t.current++%t.length]:t[0];return Nt.current.set(e.id,r),r},[re,ne]),Bt=s(e=>{if("function"==typeof oe)return oe(e);const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;return"target"===oe&&r?$t(r):t?$t(t):"#999"},[oe,$t]),Wt=s(e=>{if(!(null==J?void 0:J.colorBy))return Bt(e);const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;return"target"===ct.colorBy&&r?$t(r):t?$t(t):"#999"},[null==J?void 0:J.colorBy,ct.colorBy,$t,Bt]),Rt="sankey"===w&&Q||!!$e||null!==(l=null===(c=bt.current)||void 0===c?void 0:c.isAnimating)&&void 0!==l&&l,zt=s(()=>{yt.current&&!Rt||yt.current||(yt.current=requestAnimationFrame(()=>mt.current()))},[Rt]);r(()=>{var e;null===(e=bt.current)||void 0===e||e.updateConfig(ut),pt.current=!0,zt()},[ut,zt]),r(()=>{pt.current=!0,zt()},[ft,zt]);const Ht=s(()=>{var e;const t=bt.current;if(!t)return;t.runLayout([ot,it]),t.buildScene([ot,it]),pt.current=!0;for(const r of t.sceneNodes)r.id&&"string"==typeof(null===(e=r.style)||void 0===e?void 0:e.fill)&&Nt.current.set(r.id,r.style.fill);const r=Array.isArray(ne)?ne:tr,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];Nt.current.has(t.id)||Nt.current.set(t.id,r[e%r.length])}if(_t.current=n.length,St(t.layoutVersion),Ee){const{nodes:e,edges:r}=t.getLayoutData();Ee(e,r)}},[ot,it,Ee,ne]),qt=s(e=>{const t=bt.current;t&&(t.ingestEdge(e)&&Ht(),zt())},[Ht,zt]),er=s(e=>{const t=bt.current;if(!t)return;let r=!1;for(const n of e)t.ingestEdge(n)&&(r=!0);r&&Ht(),zt()},[Ht,zt]),rr=s(()=>{var e;null===(e=bt.current)||void 0===e||e.clear(),Nt.current.clear(),_t.current=0,St(0),wt(null),Tt.current=null,pt.current=!0,zt()},[zt]),nr=s(()=>{const e=bt.current;e&&(e.tension+=999,Ht(),zt())},[Ht,zt]);u(a,()=>({push:qt,pushMany:er,clear:rr,getTopology:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=bt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:nr,getTension:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[qt,er,rr,nr]);const or=["tree","cluster","treemap","circlepack","partition","orbit"].includes(w),ir=or?L||(Array.isArray(S)?void 0:S):void 0;r(()=>{var e;const t=bt.current;if(t)if(or&&ir)t.ingestHierarchy(ir,[ot,it]),t.buildScene([ot,it]),pt.current=!0,zt();else{const r=E||[],n=Array.isArray(S)?S:[];if(0===r.length&&0===n.length)return;t.ingestBounded(r,n,[ot,it]),t.buildScene([ot,it]);for(const r of t.sceneNodes)r.id&&(null===(e=r.style)||void 0===e?void 0:e.fill)&&Nt.current.set(r.id,r.style.fill+"");const o=Array.isArray(ne)?ne:tr,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];Nt.current.has(t.id)||Nt.current.set(t.id,o[e%o.length])}_t.current=i.length,pt.current=!0,zt()}},[E,S,L,ir,or,ot,it,ut,zt,ne]),r(()=>{O&&O.length>0&&er(O)},[]);const ar=s(e=>{if(xe&&xe(e),Ae){const t=Date.now();Ae(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:we}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:we})}},[xe,Ae,we]),sr=s(e=>{if(ke&&ke(e),Ae){const t=Date.now();Ae(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:we}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:we})}},[ke,Ae,we]),cr=n(()=>{}),lr=n(()=>{});cr.current=e=>{if(!ve)return;const t=dt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-nt.left,o=e.clientY-r.top-nt.top;if(0>n||n>ot||0>o||o>it)return void(Tt.current&&(Tt.current=null,wt(null),ar&&(ar(null),pt.current=!0),zt()));const i=bt.current;if(!i)return;const a=ht(i.sceneNodes,i.sceneEdges,n,o);if(!a)return void(Tt.current&&(Tt.current=null,wt(null),ar&&(ar(null),pt.current=!0),zt()));const s=a.datum||{},c=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{type:a.type,data:s,x:a.x,y:a.y});Tt.current=c,wt(c),ar&&(ar(c),pt.current=!0),zt()},lr.current=()=>{Tt.current&&(Tt.current=null,wt(null),ar&&(ar(null),pt.current=!0),zt())};const ur=n(()=>{});ur.current=e=>{if(!ke&&!Ae)return;const t=dt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-nt.left,o=e.clientY-r.top-nt.top;if(0>n||n>ot||0>o||o>it)return;const i=bt.current;if(!i)return;const a=ht(i.sceneNodes,i.sceneEdges,n,o);if(a){const e=a.datum||{};sr(Object.assign(Object.assign({},"object"!=typeof e||null===e||Array.isArray(e)?{}:e),{type:a.type,data:e,x:a.x,y:a.y}))}else sr(null)},s(e=>cr.current(e),[]);const dr=s(()=>lr.current(),[]),hr=s(e=>ur.current(e),[]),vr=n(-1),xr=n(null),kr=n(-1),Ar=s(e=>{var t;const r=bt.current;if(!r)return;const n=function(e){var t,r,n,o,i,a;const s=[];for(const c of e)"circle"===c.type&&null!=c.cx?s.push({x:c.cx,y:c.cy,datum:c.datum,shape:"circle",group:null!==(r=null===(t=c.datum)||void 0===t?void 0:t.id)&&void 0!==r?r:"_default"}):"rect"===c.type&&null!=c.x?s.push({x:c.x+c.w/2,y:c.y+c.h/2,datum:c.datum,shape:"rect",w:c.w,h:c.h,group:null!==(o=null===(n=c.datum)||void 0===n?void 0:n.id)&&void 0!==o?o:"_default"}):"arc"===c.type&&null!=c.cx&&s.push({x:c.cx,y:c.cy,datum:c.datum,shape:"circle",group:null!==(a=null===(i=c.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(r.sceneNodes);if(0===n.length)return;const o=function(e){var t,r;const n=new Map;for(const r of e){const e=null!==(t=r.group)&&void 0!==t?t:"_default";let o=n.get(e);o||(o=[],n.set(e,o)),o.push(r)}for(const e of n.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const o=Array.from(n.keys()).sort((e,t)=>{const r=n.get(e),o=n.get(t);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),i=Array.from(n.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(r=i[e].datum)||void 0===r?void 0:r.id;null!=t&&a.set(t+"",e)}return{flat:i,groups:o,byGroup:n,idToIdx:a}}(n),i=vr.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),vr.current=0,kr.current=-1;const t=o.flat[0];xr.current={shape:t.shape,w:t.w,h:t.h};const r=t.datum||{},n=Object.assign(Object.assign({},"object"!=typeof r||null===r||Array.isArray(r)?{}:r),{type:"node",data:r,x:t.x,y:t.y});return Tt.current=n,wt(n),ar&&(ar(n),pt.current=!0),void zt()}const a=function(e,t){var r,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[o];return{flatIndex:o,group:null!==(r=i.group)&&void 0!==r?r:"_default",indexInGroup:null!==(n=i._groupIndex)&&void 0!==n?n:0}}(o,i),s=function(e,t,r,n,o){var i,a,s;const c=r.flat[t.flatIndex];if(!c)return vt(e,t,r);const l=null===(i=c.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(a=function(e,t,r){let n=null,o=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,c=a.y-t.y;let l=!1;switch(r){case"right":l=s>0&&Math.abs(s)>=Math.abs(c);break;case"left":l=0>s&&Math.abs(s)>=Math.abs(c);break;case"down":l=c>0&&Math.abs(c)>=Math.abs(s);break;case"up":l=0>c&&Math.abs(c)>=Math.abs(s)}if(!l)continue;const u=s*s+c*c;o>u&&(o=u,n=i)}return n}(r,c,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return n!==t.flatIndex&&(o.current=-1),n}case"Enter":{if(null==l)return t.flatIndex;const e=function(e,t){var r,n,o;const i=e+"",a=[];for(const e of t){const t=null!==(r=e.datum)&&void 0!==r?r:e,s="object"==typeof t.source?null===(n=t.source)||void 0===n?void 0:n.id:t.source,c="object"==typeof t.target?null===(o=t.target)||void 0===o?void 0:o.id:t.target,l=null!=s,u=null!=c;l&&s+""===i&&u?a.push(c+""):u&&c+""===i&&l&&a.push(s+"")}return a}(l,n);if(0===e.length)return t.flatIndex;const i=null!==(s=r.idToIdx.get(e[(o.current+1)%e.length]))&&void 0!==s?s:-1;return 0>i?t.flatIndex:(o.current=-1,i)}default:{const n=vt(e,t,r);return null!==n&&n!==t.flatIndex&&(o.current=-1),n}}}(e.key,a,o,null!==(t=r.sceneEdges)&&void 0!==t?t:[],kr);if(null===s)return;if(e.preventDefault(),0>s)return vr.current=-1,xr.current=null,kr.current=-1,Tt.current=null,wt(null),ar&&(ar(null),pt.current=!0),void zt();vr.current=s;const c=o.flat[s];xr.current={shape:c.shape,w:c.w,h:c.h};const l=c.datum||{},u=Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{type:"node",data:l,x:c.x,y:c.y});Tt.current=u,wt(u),ar&&(ar(u),pt.current=!0),zt()},[ar,zt]),wr=s(e=>{vr.current=-1,xr.current=null,cr.current(e)},[]);mt.current=()=>{var e,t,r,n,o,i,a;yt.current=0;const s=dt.current;if(!s)return;const c=s.getContext("2d");if(!c)return;const l=bt.current;if(!l)return;const u=performance.now(),d=gt.current?Math.min((u-gt.current)/1e3,.1):.016;gt.current=u;const h=l.advanceTransition(Qe.current?u+1e6:u),y=!Qe.current&&h,g=!Qe.current&&l.tickAnimation([ot,it],d);(h||pt.current||g)&&l.buildScene([ot,it]);const p="undefined"!=typeof window&&window.devicePixelRatio||1;if(!function(e,t,r,n){const o=e.getContext("2d");if(!o)return null;const i=t[0]*n,a=t[1]*n,s=t[0]+"px",c=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==c&&(e.style.height=c),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(n,0,0,n,0,0),o.translate(r.left,r.top),o}(s,rt,nt,p))return;c.clearRect(-nt.left,-nt.top,rt[0],rt[1]),me&&(c.fillStyle=me,c.fillRect(0,0,ot,it)),_e&&l.applyDecay(),$e&&l.applyPulse(u),We&&l.applyThresholds(u),l.applyTopologyDiff(u);const f=null!==(e=null==Be?void 0:Be.threshold)&&void 0!==e?e:5e3,m=Be&&l.lastIngestTime>0&&u-l.lastIngestTime>f;if(m&&(c.globalAlpha=null!==(t=null==Be?void 0:Be.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const r of t)switch(r.type){case"bezier":Ut(e,r);break;case"line":Zt(e,r);break;case"ribbon":Qt(e,r);break;case"curved":Jt(e,r)}}(c,l.sceneEdges),function(e,t){var r,n,o;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.strokeRect(t.x,t.y,t.w,t.h)),Vt(e,t),e.restore())}}(c,l.sceneNodes),function(e,t){var r,n,o;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.stroke()),Kt(e,t),e.restore())}}(c,l.sceneNodes),function(e,t){var r,n,o;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.stroke()),e.restore()}}(c,l.sceneNodes),Q&&l.particlePool&&!m){const e=Array.from(l.edges.values());if(e.length>0){!function(e,t,r,n){var o,i;const a=null!==(o=n.spawnRate)&&void 0!==o?o:K.spawnRate,s=null!==(i=n.maxPerEdge)&&void 0!==i?i:K.maxPerEdge;for(let n=0;t.length>n;n++){const o=t[n];if(!o.bezier)continue;if(e.countForEdge(n)>=s)continue;const i=o.value*a*r*(o.bezier.circular?.3:1),c=Math.floor(i),l=i-c;let u=c;Math.random()<l&&u++;for(let t=0;u>t&&e.countForEdge(n)<s;t++)e.spawn(n)}}(l.particlePool,e,d,ct);const t=.5*(null!==(r=ct.speedMultiplier)&&void 0!==r?r:1);let n;if(ct.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}l.particlePool.step(d,t,e,n),function(e,t,r,n,o){var i,a;const s=null!==(i=n.radius)&&void 0!==i?i:K.radius,c=null!==(a=n.opacity)&&void 0!==a?a:K.opacity;e.globalAlpha=c;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const c=r[a.edgeIndex];if(c){if("function"==typeof n.color){const t="object"==typeof c.source?c.source:null;e.fillStyle=t?n.color(c,t):"#666"}else e.fillStyle=n.color&&"inherit"!==n.color?n.color:o(c);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(c,l.particlePool,e,ct,Wt)}}m&&(c.globalAlpha=1);const v=pt.current;if(pt.current=!1,v||y||g){const e=dt.current;e&&e.setAttribute("aria-label",Mt(null!==(o=null===(n=l.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==o?o:0,null!==(a=null===(i=l.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}(v||y||g)&&Ot(e=>e+1),(Rt||y||g||l.hasActivePulses||l.hasActiveThresholds||l.hasActiveTopologyDiff)&&(yt.current=requestAnimationFrame(()=>mt.current()))},r(()=>(zt(),()=>{yt.current&&(cancelAnimationFrame(yt.current),yt.current=0)}),[zt]),r(()=>{pt.current=!0,zt()},[w,ot,it,me,zt]),function(e,t,n,o,i,a){r(()=>{if(!e)return;const r=setInterval(()=>{var r;const s=t.current;if(!s||0===s.lastIngestTime)return;const c="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(r=e.threshold)&&void 0!==r?r:5e3,u=c-s.lastIngestTime>l;u!==i&&(a(u),n.current=!0,o())},1e3);return()=>clearInterval(r)},[e,i,o])}(Be,bt,pt,zt,Dt,Pt);const Er=ve&&xt?e.createElement(At,{x:xt.x,y:xt.y,containerWidth:ot,containerHeight:it,margin:nt,className:"stream-network-tooltip",zIndex:2},be?be(xt):e.createElement(br,{data:xt})):null;if(It){const t=bt.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(w),r=e?L||(Array.isArray(S)?void 0:S):void 0;if(e&&r)t.ingestHierarchy(r,[ot,it]),t.buildScene([ot,it]);else{const e=E||[],r=Array.isArray(S)?S:[];(e.length>0||r.length>0)&&(t.ingestBounded(e,r,[ot,it]),t.buildScene([ot,it]))}}const r=null!==(d=null==t?void 0:t.sceneNodes)&&void 0!==d?d:[],n=null!==(h=null==t?void 0:t.sceneEdges)&&void 0!==h?h:[],o=null!==(y=null==t?void 0:t.labels)&&void 0!==y?y:[];return e.createElement("div",{className:"stream-network-frame"+(fe?" "+fe:""),role:"img","aria-label":ze||("string"==typeof Te?Te:"Network chart"),style:{position:"relative",width:rt[0],height:rt[1]}},e.createElement(Yt,{summary:He}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:rt[0],height:rt[1],style:{position:"absolute",left:0,top:0}},Ne&&e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},Ne),e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},me&&e.createElement("rect",{x:0,y:0,width:ot,height:it,fill:me}),n.map((t,r)=>function(t,r){switch(t.type){case"line":return e.createElement("line",{key:"net-edge-"+r,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity});case"bezier":{const n=t;return e.createElement("path",{key:"net-edge-"+r,d:n.pathD,fill:Ct(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"ribbon":{const n=t;return e.createElement("path",{key:"net-edge-"+r,d:n.pathD,fill:Ct(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"curved":{const n=t;return e.createElement("path",{key:"net-edge-"+r,d:n.pathD,fill:Ct(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity})}default:return null}}(t,r)).filter(Boolean),r.map((t,r)=>function(t,r){switch(t.type){case"circle":{const n=t;return e.createElement("circle",{key:"net-circle-"+r,cx:n.cx,cy:n.cy,r:n.r,fill:Ct(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"rect":{const n=t;return e.createElement("rect",{key:"net-rect-"+r,x:n.x,y:n.y,width:n.w,height:n.h,fill:Ct(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"arc":{const n=t,o=W().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle).endAngle(n.endAngle)({})||"";return e.createElement("path",{key:"net-arc-"+r,d:o,transform:`translate(${n.cx},${n.cy})`,fill:Ct(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}default:return null}}(t,r)).filter(Boolean),o.map((t,r)=>function(t,r){return e.createElement("text",{key:"net-label-"+r,x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder},t.text)}(t,r)).filter(Boolean))),e.createElement(jt,{width:ot,height:it,totalWidth:rt[0],totalHeight:rt[1],margin:nt,labels:o,sceneNodes:r,title:Te,legend:Oe,legendPosition:De,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Ie,legendIsolatedCategories:Pe,foregroundGraphics:at,annotations:Se,svgAnnotationRules:Le,annotationFrame:0}))}const Sr=bt.current;return e.createElement("div",{ref:tt,className:"stream-network-frame"+(fe?" "+fe:""),role:"group","aria-label":ze||("string"==typeof Te?Te:"Network chart"),tabIndex:0,style:{position:"relative",width:ye?"100%":rt[0],height:ge?"100%":rt[1],overflow:"visible"},onKeyDown:Ar},Re&&e.createElement(Gt,{tableId:Je}),Re&&e.createElement(Ft,{nodes:null!==(g=null==Sr?void 0:Sr.sceneNodes)&&void 0!==g?g:[],edges:null!==(p=null==Sr?void 0:Sr.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:Je,chartTitle:"string"==typeof Te?Te:void 0}),e.createElement(Yt,{summary:He}),e.createElement("div",{role:"img","aria-label":ze||("string"==typeof Te?Te:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ve?wr:void 0,onMouseLeave:ve?dr:void 0,onClick:ke||Ae?hr:void 0},Ne&&e.createElement("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:rt[0],height:rt[1],pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},Ne)),e.createElement("canvas",{ref:dt,"aria-label":Mt(null!==(m=null===(f=null==Sr?void 0:Sr.sceneNodes)||void 0===f?void 0:f.length)&&void 0!==m?m:0,null!==(b=null===(v=null==Sr?void 0:Sr.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(Xt,{hoverPoint:xt}),e.createElement(jt,{width:ot,height:it,totalWidth:rt[0],totalHeight:rt[1],margin:nt,labels:(null==Sr?void 0:Sr.labels)||[],sceneNodes:null==Sr?void 0:Sr.sceneNodes,title:Te,legend:Oe,legendPosition:De,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Ie,legendIsolatedCategories:Pe,foregroundGraphics:at,annotations:Se,svgAnnotationRules:Le,annotationFrame:Lt}),e.createElement(kt,{active:vr.current>=0,hoverPoint:xt,margin:nt,size:rt,shape:null===(x=xr.current)||void 0===x?void 0:x.shape,width:null===(k=xr.current)||void 0===k?void 0:k.w,height:null===(A=xr.current)||void 0===A?void 0:A.h}),Er,(null==Be?void 0:Be.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Be.badgePosition?{top:4,left:4}:"bottom-left"===Be.badgePosition?{bottom:4,left:4}:"bottom-right"===Be.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Dt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},Dt?"STALE":"LIVE")))});xr.displayName="StreamNetworkFrame";const kr={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Ar(e,t){return"function"==typeof t?t(e):e[t]}function wr(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Er(t={}){const{fields:r,title:n,format:o,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const c=[];if(n){const e=Ar(t,n);s=wr(e,o)}if(r&&r.length>0)r.forEach(e=>{let r,n,i;"string"==typeof e?(r=e,n=e,i=o):(r=e.label,n=e.accessor||e.key||"",i=e.format||o);const a=Ar(t,n);c.push({label:r,value:wr(a,i)})});else if(!n){const e=["value","y","name","id","label"];for(const r of e)if(void 0!==t[r]){s=wr(t[r],o);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=wr(t[e[0]],o))}}const l=Object.assign(Object.assign({},kr),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:l},s&&e.createElement("div",{style:{fontWeight:c.length>0?"bold":"normal"}},s),c.map((t,r)=>e.createElement("div",{key:r,style:{marginTop:0===r&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function Sr(t){if(!0===t)return Er();if("function"==typeof t){const r=t;return t=>{const n=r(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==n?null:e.createElement("div",{className:"semiotic-tooltip",style:kr},n)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Er(t):Er())}const Lr=o(null);function Or(e){const t=[];for(const[r,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[r]));else{const[e,o]=n.range;t.push(t=>{const n=t[r];return n>=e&&o>=n})}return e=>t.every(t=>t(e))}function Dr(e,t){let r=e.get(t);return r||(r={name:t,resolution:"union",clauses:new Map},e.set(t,r)),r}const[jr,Cr]=sr(e=>({selections:new Map,setClause(t,r){e(e=>{const n=new Map(e.selections),o=Dr(n,t),i=new Map(o.clauses);return i.set(r.clientId,r),n.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:n}})},clearClause(t,r){e(e=>{const n=e.selections.get(t);if(!n)return{};const o=new Map(e.selections),i=new Map(n.clauses);return i.delete(r),o.set(t,Object.assign(Object.assign({},n),{clauses:i})),{selections:o}})},setResolution(t,r){e(e=>{const n=new Map(e.selections),o=Dr(n,t);return n.set(t,Object.assign(Object.assign({},o),{resolution:r})),{selections:n}})},clearSelection(t){e(e=>{const r=new Map(e.selections),n=r.get(t);return n&&r.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:r}})}})),[Ir,Pr]=sr(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const r=e.observations;return r.push(t),r.length>e.maxObservations&&r.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let Tr={positions:new Map};const Mr=new Set;function Nr(){for(const e of Mr)e()}function _r(e,t){const r=Tr.positions.get(e);if(!r||r.sourceId!==t)return;const n=new Map(Tr.positions);n.delete(e),Tr={positions:n},Nr()}function $r(e){const t=d(),r=e.clientId||t,{name:n}=e,o=Cr(e=>e.selections.get(n)),a=Cr(e=>e.setClause),c=Cr(e=>e.clearClause),l=i(()=>!!o&&o.clauses.size>0,[o]);return{predicate:i(()=>o&&0!==o.clauses.size?function(e,t){const r=[];for(const[n,o]of e.clauses)"crossfilter"===e.resolution&&n===t||r.push(Or(o));return 0===r.length?()=>!0:"intersect"===e.resolution?e=>r.every(t=>t(e)):e=>r.some(t=>t(e))}(o,r):()=>!0,[o,r]),isActive:l,selectPoints:s(e=>{const t={};for(const[r,n]of Object.entries(e))t[r]={type:"point",values:new Set(n)};a(n,{clientId:r,type:"point",fields:t})},[r,n,a]),selectInterval:s(e=>{const t={};for(const[r,n]of Object.entries(e))t[r]={type:"interval",range:n};a(n,{clientId:r,type:"interval",fields:t})},[r,n,a]),clear:s(()=>{c(n,r)},[c,n,r]),clientId:r}}const Br=o(!1);function Wr(){var e;const t=yr(e=>e.theme),r=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return r&&r.length>0?r:void 0}function Rr(e,t,r,n,o){let i;if(Array.isArray(r))i=r;else if(t&&t.length>0)i=t;else if("string"==typeof r){const e=er[r];Array.isArray(e)&&(i=e)}return i&&0!==i.length?i[0]:"#007bff"}function zr(e,t,r){const n=a(Lr),o=Wr();return i(()=>{var i;if(!t)return;const a=null!==(i=null!=r?r:o&&o.length>0?o:void 0)&&void 0!==i?i:"category10";if(0!==e.length){if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=ar(r.map(e=>({_cat:e})),"_cat",a);return t=>n[t]||e(t)}return ar(r.map(e=>({_cat:e})),"_cat",a)}if(n&&Object.keys(n).length>0){const r=ar(e,t,a);return e=>n[e]||r(e)}return ar(e,t,a)}if(n&&Object.keys(n).length>0){const e=ar([{_:"a"}],"_",a);return t=>n[t]||e(t)}},[e,t,r,n,o])}function Hr({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:a,chartId:c,onClick:l}){const u=d(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),y=$r({name:(null==e?void 0:e.name)||"__unused__"}),g=function(e){const t=e.name||"hover",{fields:r}=e,{predicate:n,isActive:o,selectPoints:i,clear:a}=$r({name:t});return{onHover:s(e=>{if(!e)return void a();const t={};for(const n of r){const r=e[n];void 0!==r&&(t[n]=[r])}Object.keys(t).length>0&&i(t)},[r,i,a,t]),predicate:n,isActive:o}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||n||[]}),p=Pr(e=>e.pushObservation),f=e?{isActive:y.isActive,predicate:y.predicate}:null,m=s(e=>{var r,n;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,r){const n=Tr.positions.get(e);n&&n.xValue===t&&n.sourceId===r||(Tr={positions:new Map(Tr.positions).set(e,{xValue:t,sourceId:r})},Nr())}(h.name||"hover",Number(e),u)}"x-position"!==(null==h?void 0:h.mode)&&g.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&_r(h.name||"hover",u),"x-position"!==(null==h?void 0:h.mode)&&g.onHover(null);if(i||p){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const a=Object.assign(Object.assign({},t),{type:"hover",datum:o||{},x:null!==(r=e.x)&&void 0!==r?r:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(a),p&&p(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),p&&p(e)}}},[t,g,h,u,i,a,c,p]),v=s(e=>{var t,r,n,o;if(e&&l){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),l(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(r=e.y)&&void 0!==r?r:0})}if(i||p){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},t),{type:"click",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),p&&p(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),p&&p(e)}}},[l,i,p,a,c]);return r(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{_r(e,u)}},[null==h?void 0:h.mode,null==h?void 0:h.name,u]),{activeSelectionHook:f,customHoverBehavior:m,customClickBehavior:v,crosshairSourceId:u}}function Fr(e,r,n){const[o,a]=t(null),[c,l]=t(new Set),u=s(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&l(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),h=i(()=>{if(!e||"none"===e||!r)return null;const t="string"==typeof r?r:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof r?r(e):null)===o}:"isolate"===e&&c.size>0?{isActive:!0,predicate:e=>{const n=t?e[t]:"function"==typeof r?r(e):null;return c.has(n)}}:null},[e,r,o,c]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?c:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}e.createContext(void 0);const Yr={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Gr(e,t,r){var n,o,i,a,s,c;const l=Yr[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==r?void 0:r.width)?l.width:r.width,height:null!==(o=t.height)&&void 0!==o?o:e&&"primary"!==e||!(null==r?void 0:r.height)?l.height:r.height,showAxes:l.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:l.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||l.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:l.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:l.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:Xr(l.marginDefaults,t.showCategoryTicks,t.orientation)}}function Xr(e,t,r){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===r?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function qr({componentName:t,message:r,diagnosticHint:n,width:o,height:i}){return e.createElement("div",{role:"alert",style:{width:o,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},r),n&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class Vr extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var r,n;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,r=this.state.error;return"function"==typeof t?t(r):void 0!==t?t:e.createElement(qr,{componentName:"ChartErrorBoundary",message:r.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Kr(e,t){const r=e.length,n=t.length,o=Array(n+1);for(let e=0;n>=e;e++)o[e]=e;for(let i=1;r>=i;i++){let r=o[0];o[0]=i;for(let a=1;n>=a;a++){const n=o[a];o[a]=e[i-1]===t[a-1]?r:1+Math.min(r,o[a],o[a-1]),r=n}}return o[n]}function Ur(e,t,r=3){let n,o=r+1;for(const r of t){const t=Kr(e.toLowerCase(),r.toLowerCase());o>t&&(o=t,n=r)}return o>r?void 0:n}function Zr(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Qr(e,t){var r;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(r=Ur(e,t,3))&&void 0!==r?r:null)}function Jr({componentName:e,data:t,dataLabel:r="data"}){return null==t?`${e}: No ${r} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${r} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function en({componentName:e,nodes:t,edges:r,nodesRequired:n=!1,edgesRequired:o=!0,accessors:i}){if(null==t&&null==r)return null;if(o&&(!r||!Array.isArray(r)||0===r.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const r=Zr(t).find(e=>e&&"object"==typeof e);if(r){const t=Object.keys(r);for(const[n,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in r)){const r=Qr(o,t),i=r?` Try ${n}="${r}".`:"";return`${e}: ${n} "${o}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const tn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},rn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},nn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},on=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],an=["vertical","horizontal"],sn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:on},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:on},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:on},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:an},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:an},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:an},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:an},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:an},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:an},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:an},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:an},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},tn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},tn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},tn),nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},tn),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},tn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:an},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},tn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},tn),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},tn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},tn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},tn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function cn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ln=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),un=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),dn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),hn=new Set(["LineChart","AreaChart","StackedAreaChart"]),yn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function gn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[r,n,o]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(r)+.7152*i(n)+.0722*i(o)}function pn(e,t){const r=gn(e),n=gn(t);return null===r||null===n?null:(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}const fn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function mn(e,t){const r=[],n=function(e,t){const r=[],n=sn[e];if(!n)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(sn).join(", ")}`]};for(const o of n.required)null==t[o]&&r.push(`"${o}" is required for ${e}.`);for(const[e,o]of Object.entries(t)){if(null==o)continue;const t=n.props[e];if(t){if(!cn(o,t.type)){const n=Array.isArray(t.type)?t.type.join(" | "):t.type;r.push(`"${e}" should be ${n}, got ${Array.isArray(o)?"array":typeof o}.`);continue}t.enum&&"string"==typeof o&&!t.enum.includes(o)&&r.push(`"${e}" value "${o}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const o=Object.keys(n.props),i=new Set(o);for(const n of Object.keys(t))if(void 0!==t[n]&&!i.has(n)){const t=Ur(n,o),i=t?`Unknown prop "${n}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${n}" for ${e}. Valid props: ${o.join(", ")}.`;r.push(i)}if("array"===n.dataShape){const o=t.data,i={};for(const e of n.dataAccessors){const r=t[e];"string"==typeof r&&(i[e]=r)}const a=function({componentName:e,data:t,accessors:r,requiredProps:n}){if(n)for(const[t,r]of Object.entries(n))if(null==r)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(r){const n=Zr(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const r=Qr(i,t),n=r?` Try ${o}="${r}".`:"";return`${e}: ${o} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}({componentName:e,data:o,accessors:Object.keys(i).length>0?i:void 0});a&&r.push(a)}else if("object"===n.dataShape){const n=Jr({componentName:e,data:t.data});n&&r.push(n)}else if("network"===n.dataShape){const o=en({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:n.required.includes("nodes"),edgesRequired:n.required.includes("edges")});o&&r.push(o)}return{valid:0===r.length,errors:r}}(e,t);for(const e of n.errors)r.push({severity:"error",code:"VALIDATION",message:e,fix:""});return sn[e]?(function(e,t,r){const n=sn[e];if(n){if("array"===n.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&r.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===n.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&r.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,r),function(e,t,r){const n=t.width,o=t.height;if(void 0===n||"number"==typeof n&&n>0||r.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(n)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===o||"number"==typeof o&&o>0||r.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,n]=t.size;(null!=e&&0>=e||null!=n&&0>=n)&&r.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${n}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,r),function(e,t,r){const n=sn[e];if(!n||"array"!==n.dataShape)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of n.dataAccessors){const n=t[e];"string"==typeof n&&(n in i||r.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${n}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,r),function(e,t,r){ln.has(e)&&Array.isArray(t.data)&&r.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,r),function(e,t,r){un.has(e)&&(t.edges||t.data||r.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,r),function(e,t,r){const n=sn[e];if(!n||"array"!==n.dataShape)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&r.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,r),function(e,t,r){t.linkedHover&&!t.selection&&r.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,r),function(e,t,r){var n;if(!dn.has(e))return;const o=t.rExtent||t.yExtent;o&&Array.isArray(o)&&o.length>=1&&null!=o[0]&&0!==o[0]&&r.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${o[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(n=o[1])&&void 0!==n?n:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,r),function(e,t,r){if(!hn.has(e))return;if(t.gapStrategy)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const o=t.yAccessor||"y";"string"==typeof o&&n.some(e=>{const t=e[o];return null==t||Number.isNaN(t)})&&r.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${o}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,r),function(e,t,r){var n,o;const i=null!==(n=t.width)&&void 0!==n?n:600,a=null!==(o=t.height)&&void 0!==o?o:400,s=t.margin;if(!s||"object"!=typeof s)return;const c=(s.left||0)+(s.right||0),l=(s.top||0)+(s.bottom||0);i>c||r.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${c}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>l||r.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${l}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,r),function(e,t,r){var n;const o=sn[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let r=0;s>r;r++){const o=null===(n=i[r])||void 0===n?void 0:n[e.name];if("number"==typeof o&&Number.isFinite(o)){t=!1;break}}t&&r.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,r),function(e,t,r){if(!yn.has(e))return;const n=t.barPadding;"number"==typeof n&&10>n&&r.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${n} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,r),function(e,t,r){if("bottom"!==t.legendPosition)return;const n=t.margin;if(!n||"object"!=typeof n)return;const o=n.bottom;"number"==typeof o&&70>o&&r.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${o}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,r),function(e,t,r){var n;if(!t.showLegend)return;if("right"!==(null!==(n=t.legendPosition)&&void 0!==n?n:"right"))return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.right;"number"==typeof i&&100>i&&r.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,r),function(e,t,r){if("Heatmap"!==e)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const o=n[0];if(o&&"object"==typeof o)for(const e of["xAccessor","yAccessor"]){const n=t[e];if("string"!=typeof n)continue;const i=o[n];"string"==typeof i&&r.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${n}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,r),function(e,t,r){const n=t.colorScheme;if(!n||!Array.isArray(n))return;const o="string"==typeof t.background?t.background:"#ffffff";if(!o.startsWith("#"))return;const i=[];for(const e of n){if("string"!=typeof e||!e.startsWith("#"))continue;const t=pn(e,o);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&r.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${o}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,r),function(e,t,r){const n=t.colorScheme;if(!n||!Array.isArray(n)||2>n.length)return;const o=n.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>o.length)return;const i=[];for(let e=0;o.length-1>e;e++){const t=pn(o[e],o[e+1]);null!==t&&1.5>t&&i.push(`${o[e]} / ${o[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&r.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,r),function(e,t,r){const n="string"==typeof t.title&&t.title.trim().length>0,o="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;n||o||i||r.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,r),function(e,t,r){const n=[];for(const e of fn)"function"==typeof t[e]&&n.push(e);n.length>0&&r.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${n.length>1?"s":""} detected: ${n.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,r),{ok:r.every(e=>"warning"===e.severity),diagnoses:r}):{ok:0===r.length,diagnoses:r}}var vn;const bn="undefined"!=typeof process&&"production"!==(null===(vn=process.env)||void 0===vn?void 0:vn.NODE_ENV);function xn({componentName:t,width:r,height:n,chartProps:o,children:i}){return e.createElement(Vr,{fallback:i=>{let a="";if(bn&&o)try{const e=mn(t,o);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(qr,{componentName:t,message:i.message,diagnosticHint:a,width:r,height:n})}},i)}const kn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},An={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function wn(t,r,n,o){return!1===o||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},kn),{width:r,height:n})},o||"No data available"):null}function En(t,r,n){if(!t)return null;const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(i+a)-a))/2);return e.createElement("div",{style:{width:r,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(t,n)=>e.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},An),{position:"absolute",top:s+n*(i+a),left:Math.floor(.1*r),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2})})))}const Sn=l(function(t,r){var o;const s=n(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=s.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const c=Gr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:d,margin:h,className:y,nodeIDAccessor:g="id",sourceAccessor:p="source",targetAccessor:f="target",nodeLabel:m,colorBy:v,colorScheme:b,nodeSize:x=8,nodeSizeRange:k=[5,20],edgeWidth:A=1,edgeColor:w="#999",edgeOpacity:E=.6,iterations:S=300,forceStrength:L=.1,tooltip:O,frameProps:D={},onObservation:j,onClick:C,chartId:I,selection:P,linkedHover:T,loading:M,emptyContent:N,legendInteraction:_,legendPosition:$}=t,B=c.width,W=c.height,R=c.enableHover,z=c.showLegend,H=null!==(o=c.showLabels)&&void 0!==o&&o,F=c.title,Y=c.description,G=c.summary,X=c.accessibleTable,q=En(M,B,W),V=q?null:wn(l,B,W,N),K=l||[],U=d||[],Z=zr(K,v,b),Q=i(()=>{if(!v)return[];const e=new Set;for(const t of K){const r="function"==typeof v?v(t):t[v];null!=r&&e.add(r+"")}return Array.from(e)},[K,v]),J=Fr(_,v,Q),ee=Wr(),te=i(()=>new Map,[]),re=i(()=>{if(Array.isArray(b))return b;if(ee&&ee.length>0)return ee;const e=er[b];return Array.isArray(e)?e:tr},[b,ee]),ne=i(()=>e=>{const t={};return t.fill=v?ir(e.data||e,v,Z):Rr(0,ee,b),"number"==typeof x&&(t.r=x),t},[v,Z,x,ee,b,te]),oe=i(()=>e=>({stroke:w,strokeWidth:"number"==typeof A?A:"function"==typeof A?A(e):e[A]||1,opacity:E}),[A,w,E]),ie=i(()=>{if(H&&m)return"function"==typeof m?m:e=>{var t,r,n;return null!==(n=null!==(r=null===(t=e.data)||void 0===t?void 0:t[m])&&void 0!==r?r:e[m])&&void 0!==n?n:e.id}},[H,m]),{legend:ae,margin:se,legendPosition:ce}=function({data:e,colorBy:t,colorScale:r,showLegend:n,legendPosition:o="right",userMargin:s,defaults:c={top:50,bottom:60,left:70,right:40},categories:l}){const u=a(Br),d=void 0!==n?n:!u&&!!t,h=i(()=>{if(d&&t)return function({data:e,colorBy:t,colorScale:r,getColor:n,strokeColor:o,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),s=a?n(a,t,r):r?r(o):rr[i%rr.length];return{label:o+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",r={fill:t,stroke:t};return void 0!==o&&(r.stroke=o),void 0!==i&&(r.strokeWidth=i),r},type:"fill",items:s,label:""}]}}({data:e,colorBy:t,colorScale:r,getColor:ir,categories:l})},[d,t,e,r,l]),y=i(()=>{const e=Object.assign(Object.assign({},c),s);return h&&("right"===o&&110>e.right?e.right=110:"left"===o&&110>e.left?e.left=110:"top"===o&&50>e.top?e.top=50:"bottom"===o&&80>e.bottom&&(e.bottom=80)),e},[c,s,h,o]);return{legend:h,margin:y,legendPosition:o}}({data:K,colorBy:v,colorScale:Z,showLegend:z,legendPosition:$,userMargin:h,defaults:c.marginDefaults}),{customHoverBehavior:le,customClickBehavior:ue}=Hr({selection:P,linkedHover:T,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"ForceDirectedGraph",chartId:I}),de=en({componentName:"ForceDirectedGraph",nodes:l,edges:d,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return de?e.createElement(qr,{componentName:"ForceDirectedGraph",message:de,width:B,height:W}):q||V||e.createElement(xn,{componentName:"ForceDirectedGraph",width:B,height:W},e.createElement(xr,Object.assign({ref:s,chartType:"force"},null!=l&&{nodes:K},null!=d&&{edges:U},{size:[B,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,nodeIDAccessor:g,sourceAccessor:p,targetAccessor:f,iterations:S,forceStrength:L,nodeStyle:ne,edgeStyle:oe,colorBy:v,colorScheme:re,nodeSize:x,nodeSizeRange:k,nodeLabel:ie,showLabels:H,enableHover:R,tooltipContent:!1===O?()=>null:Sr(O)||void 0,customHoverBehavior:T||j||C?le:void 0,customClickBehavior:j||C?ue:void 0,legend:ae,legendPosition:ce},_&&"none"!==_&&{legendHoverBehavior:J.onLegendHover,legendClickBehavior:J.onLegendClick,legendHighlightedCategory:J.highlightedCategory,legendIsolatedCategories:J.isolatedCategories},{className:y,title:F,description:Y,summary:G,accessibleTable:X},D)))});function Ln(e,t){if(!e)return[];const r=[],n=e=>{r.push(e);const o="function"==typeof t?t(e):e[t];o&&Array.isArray(o)&&o.forEach(n)};return n(e),r}function On(e,t,r,n){if(e&&e.length>0)return e;const o=new Set;return t.forEach(e=>{const t="function"==typeof r?r(e):e[r],i="function"==typeof n?n(e):e[n];o.add(t),o.add(i)}),Array.from(o).map(e=>({id:e}))}function Dn(e){return"function"==typeof e?e:t=>t[e]||1}function jn({edgeColorBy:e,colorBy:t,colorScale:r,nodeStyleFn:n,edgeOpacity:o,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:o},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=ir(e.data||e,t,r):e&&(s.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=ir(e.data||e,t,r):e&&(s.fill=n(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*o);return s}}Sn.displayName="ForceDirectedGraph";const Cn=l(function(t,r){var o;const a=n(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const s=Gr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:c,edges:l,margin:d,className:h,sourceAccessor:y="source",targetAccessor:g="target",valueAccessor:p="value",nodeIdAccessor:f="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:A=.05,nodeWidth:w=15,nodeLabel:E,edgeOpacity:S=.5,edgeSort:L,tooltip:O,frameProps:D={},onObservation:j,onClick:C,chartId:I,selection:P,linkedHover:T,loading:M,emptyContent:N,legendInteraction:_}=t,$=s.width,B=s.height,W=s.enableHover,R=null===(o=s.showLabels)||void 0===o||o,z=s.title,H=s.description,F=s.summary,Y=s.accessibleTable,G=En(M,$,B),X=G?null:wn(l,$,B,N),q=l||[],V=i(()=>On(c,q,y,g),[c,q,y,g]),K=zr(V,m,v),U=i(()=>{if(!m)return[];const e=new Set;for(const t of V){const r="function"==typeof m?m(t):t[m];null!=r&&e.add(r+"")}return Array.from(e)},[V,m]),Z=Fr(_,m,U),Q=Wr(),J=i(()=>new Map,[]),ee=i(()=>{if(Array.isArray(v))return v;if(Q&&Q.length>0)return Q;const e=er[v];return Array.isArray(e)?e:tr},[v,Q]),te=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?ir(e.data||e,m,K):Rr(0,Q,v),t},[m,K,Q,v,J]),re=i(()=>jn({edgeColorBy:b,colorBy:m,colorScale:K,nodeStyleFn:te,edgeOpacity:S,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,K,te,S]),ne=i(()=>{if(!R)return;const e=E||f;return"function"==typeof e?e:t=>{var r,n,o;return null!==(o=null!==(n=null===(r=t.data)||void 0===r?void 0:r[e])&&void 0!==n?n:t[e])&&void 0!==o?o:t.id}},[R,E,f]),oe=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:ie,customClickBehavior:ae}=Hr({selection:P,linkedHover:T,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"SankeyDiagram",chartId:I}),se=en({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return se?e.createElement(qr,{componentName:"SankeyDiagram",message:se,width:$,height:B}):G||X||e.createElement(xn,{componentName:"SankeyDiagram",width:$,height:B},e.createElement(xr,Object.assign({ref:a,chartType:"sankey"},V.length>0&&{nodes:V},null!=l&&{edges:q},{size:[$,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe,nodeIDAccessor:f,sourceAccessor:y,targetAccessor:g,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:A,nodeWidth:w,nodeStyle:te,edgeStyle:re,colorBy:m,colorScheme:ee,edgeColorBy:b,edgeOpacity:S,edgeSort:L,nodeLabel:ne,showLabels:R,enableHover:W,tooltipContent:!1===O?()=>null:Sr(O)||void 0,customHoverBehavior:T||j||C?ie:void 0,customClickBehavior:j||C?ae:void 0},_&&"none"!==_&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories},{className:h,title:z,description:H,summary:F,accessibleTable:Y},D)))});Cn.displayName="SankeyDiagram";const In=l(function(t,r){var o;const a=n(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const s=Gr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:c,edges:l,margin:d,className:h,sourceAccessor:y="source",targetAccessor:g="target",valueAccessor:p="value",nodeIdAccessor:f="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:A,nodeLabel:w,edgeOpacity:E=.5,tooltip:S,frameProps:L={},onObservation:O,onClick:D,chartId:j,selection:C,linkedHover:I,loading:P,emptyContent:T,legendInteraction:M}=t,N=s.width,_=s.height,$=s.enableHover,B=null===(o=s.showLabels)||void 0===o||o,W=s.title,R=s.description,z=s.summary,H=s.accessibleTable,F=En(P,N,_),Y=F?null:wn(l,N,_,T),G=l||[],X=i(()=>On(c,G,y,g),[c,G,y,g]),q=zr(X,m,v),V=i(()=>{if(!m)return[];const e=new Set;for(const t of X){const r="function"==typeof m?m(t):t[m];null!=r&&e.add(r+"")}return Array.from(e)},[X,m]),K=Fr(M,m,V),U=Wr(),Z=i(()=>new Map,[]),Q=i(()=>{if(Array.isArray(v))return v;if(U&&U.length>0)return U;const e=er[v];return Array.isArray(e)?e:tr},[v,U]),J=X.length>0,ee=i(()=>{if(J)return(e,t)=>{var r,n;const o={stroke:"black",strokeWidth:1};if(m)o.fill=ir(e.data||e,m,q);else{const i=Array.isArray(v)?v:er[v]||tr,a=Array.isArray(i)?i:tr,s=null!==(n=null!==(r=e.index)&&void 0!==r?r:t)&&void 0!==n?n:0;o.fill=a[s%a.length]}return o}},[J,m,q,v]),te=i(()=>{if(J)return jn({edgeColorBy:b,colorBy:m,colorScale:q,nodeStyleFn:ee||(e=>({fill:Rr(0,U,v)})),edgeOpacity:E,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:E}})},[J,b,m,q,ee,E,U,v,Z]),re=i(()=>{if(!B)return;const e=w||f;return"function"==typeof e?e:t=>{var r,n,o;return null!==(o=null!==(n=null===(r=t.data)||void 0===r?void 0:r[e])&&void 0!==n?n:t[e])&&void 0!==o?o:t.id}},[B,w,f]),ne=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:oe,customClickBehavior:ie}=Hr({selection:C,linkedHover:I,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:O,onClick:D,chartType:"ChordDiagram",chartId:j}),ae=en({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return ae?e.createElement(qr,{componentName:"ChordDiagram",message:ae,width:N,height:_}):F||Y||e.createElement(xn,{componentName:"ChordDiagram",width:N,height:_},e.createElement(xr,Object.assign({ref:a,chartType:"chord"},X.length>0&&{nodes:X},null!=l&&{edges:G},{size:[N,_],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne,nodeIDAccessor:f,sourceAccessor:y,targetAccessor:g,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:A,nodeStyle:ee,edgeStyle:te,colorBy:m,colorScheme:Q,edgeColorBy:b,edgeOpacity:E,nodeLabel:re,showLabels:B,enableHover:$,tooltipContent:!1===S?()=>null:Sr(S)||void 0,customHoverBehavior:I||O||D?oe:void 0,customClickBehavior:O||D?ie:void 0},M&&"none"!==M&&{legendHoverBehavior:K.onLegendHover,legendClickBehavior:K.onLegendClick,legendHighlightedCategory:K.highlightedCategory,legendIsolatedCategories:K.isolatedCategories},{className:h,title:W,description:R,summary:z,accessibleTable:H},L)))});function Pn(t){var r;const n=Gr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:a,className:s,layout:c="tree",orientation:l="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:y,colorScheme:g,colorByDepth:p=!1,edgeStyle:f="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,onClick:A,chartId:w,selection:E,linkedHover:S,loading:L,legendInteraction:O}=t,D=n.width,j=n.height,C=n.enableHover,I=null===(r=n.showLabels)||void 0===r||r,P=n.title,T=n.description,M=n.summary,N=n.accessibleTable,_=En(L,D,j),$=i(()=>Ln(null!=o?o:null,u),[o,u]),B=zr($,p?void 0:y,g),W=i(()=>{if(!y||p)return[];const e=new Set;for(const t of $){const r="function"==typeof y?y(t):t[y];null!=r&&e.add(r+"")}return Array.from(e)},[$,y,p]),R=Fr(O,p?void 0:y,W),z=Wr(),H=i(()=>new Map,[]),F=i(()=>{if(Array.isArray(g))return g;if(z&&z.length>0)return z;const e=er[g];return Array.isArray(e)?e:tr},[g,z]),Y=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?nr[(e.depth||0)%nr.length]:y?ir(e.data||e,y,B):Rr(0,z,g),t},[y,p,B,z,g,H]),G=i(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),X=i(()=>{if("treemap"===c||"circlepack"===c||"partition"===c)return Dn(d)},[c,d]),q=Object.assign(Object.assign({},n.marginDefaults),a),{customHoverBehavior:V,customClickBehavior:K}=Hr({selection:E,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:k,onClick:A,chartType:"TreeDiagram",chartId:w}),U=Jr({componentName:"TreeDiagram",data:o});return U?e.createElement(qr,{componentName:"TreeDiagram",message:U,width:D,height:j}):_||e.createElement(xn,{componentName:"TreeDiagram",width:D,height:j},e.createElement(xr,Object.assign({chartType:c},null!=o&&{data:o},{size:[D,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:X,treeOrientation:l,edgeType:f,nodeStyle:Y,edgeStyle:G,colorBy:y,colorScheme:F,colorByDepth:p,nodeSize:v,nodeLabel:I?m||h:void 0,showLabels:I,enableHover:C,tooltipContent:!1===b?()=>null:Sr(b)||void 0,customHoverBehavior:S||k||A?V:void 0,customClickBehavior:k||A?K:void 0},O&&"none"!==O&&{legendHoverBehavior:R.onLegendHover,legendClickBehavior:R.onLegendClick,legendHighlightedCategory:R.highlightedCategory,legendIsolatedCategories:R.isolatedCategories},{className:s,title:P,description:T,summary:M,accessibleTable:N},x)))}function Tn(t){var r;const n=Gr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:o,margin:a,className:c,childrenAccessor:l="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:y,colorByDepth:g=!1,labelMode:p="leaf",nodeLabel:f,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:A,onObservation:w,onClick:E,chartId:S,loading:L,legendInteraction:O}=t,D=n.width,j=n.height,C=n.enableHover,I=null===(r=n.showLabels)||void 0===r||r,P=n.title,T=n.description,M=n.summary,N=n.accessibleTable,_=En(L,D,j),{activeSelectionHook:$,customHoverBehavior:B,customClickBehavior:W}=Hr({selection:k,linkedHover:A,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:w,onClick:E,chartType:"Treemap",chartId:S}),R=s(e=>{if(!e)return B(null);const t=e.data||e;B({data:(null==t?void 0:t.data)||t})},[B]),z=i(()=>Ln(null!=o?o:null,l),[o,l]),H=zr(z,g?void 0:h,y),F=i(()=>{if(!h||g)return[];const e=new Set;for(const t of z){const r="function"==typeof h?h(t):t[h];null!=r&&e.add(r+"")}return Array.from(e)},[z,h,g]),Y=Fr(O,g?void 0:h,F),G=Wr(),X=i(()=>new Map,[]),q=i(()=>{if(Array.isArray(y))return y;if(G&&G.length>0)return G;const e=er[y];return Array.isArray(e)?e:tr},[y,G]),V=i(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=g?nr[(e.depth||0)%nr.length]:h?ir(e.data||e,h,H):Rr(0,G,y),t},[h,g,H,G,y,X]),K=i(()=>$?e=>{var t;const r=Object.assign({},V(e));if($.isActive)if($.predicate(e.data||e))(null==k?void 0:k.selectedStyle)&&Object.assign(r,k.selectedStyle);else{const e=null!==(t=null==k?void 0:k.unselectedOpacity)&&void 0!==t?t:.2;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==k?void 0:k.unselectedStyle)&&Object.assign(r,k.unselectedStyle)}return r}:V,[V,$,k]),U=i(()=>Dn(u),[u]),Z=void 0!==v?v:!I||"parent"!==p&&"all"!==p?void 0:18,Q=Object.assign(Object.assign({},n.marginDefaults),a),J=Jr({componentName:"Treemap",data:o});return J?e.createElement(qr,{componentName:"Treemap",message:J,width:D,height:j}):_||e.createElement(xn,{componentName:"Treemap",width:D,height:j},e.createElement(xr,Object.assign({chartType:"treemap"},null!=o&&{data:o},{size:[D,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,nodeIDAccessor:d,childrenAccessor:l,hierarchySum:U,padding:m,paddingTop:Z,nodeStyle:K,colorBy:h,colorScheme:q,colorByDepth:g,nodeLabel:I?f||d:void 0,showLabels:I,labelMode:p,enableHover:C,tooltipContent:!1===b?()=>null:Sr(b)||void 0},(A||w||E)&&{customHoverBehavior:R},(w||E)&&{customClickBehavior:W},O&&"none"!==O&&{legendHoverBehavior:Y.onLegendHover,legendClickBehavior:Y.onLegendClick,legendHighlightedCategory:Y.highlightedCategory,legendIsolatedCategories:Y.isolatedCategories},{className:c,title:P,description:T,summary:M,accessibleTable:N},x)))}function Mn(t){var r;const n=Gr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:a,className:s,childrenAccessor:c="children",valueAccessor:l="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:y=!1,nodeLabel:g,circleOpacity:p=.7,padding:f=4,tooltip:m,frameProps:v={},onObservation:b,onClick:x,chartId:k,selection:A,linkedHover:w,loading:E,legendInteraction:S}=t,L=n.width,O=n.height,D=n.enableHover,j=null===(r=n.showLabels)||void 0===r||r,C=n.title,I=n.description,P=n.summary,T=n.accessibleTable,M=En(E,L,O),N=i(()=>Ln(null!=o?o:null,c),[o,c]),_=zr(N,y?void 0:d,h),$=i(()=>{if(!d||y)return[];const e=new Set;for(const t of N){const r="function"==typeof d?d(t):t[d];null!=r&&e.add(r+"")}return Array.from(e)},[N,d,y]),B=Fr(S,y?void 0:d,$),W=Wr(),R=i(()=>new Map,[]),z=i(()=>{if(Array.isArray(h))return h;if(W&&W.length>0)return W;const e=er[h];return Array.isArray(e)?e:tr},[h,W]),H=i(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=y?nr[(e.depth||0)%nr.length]:d?ir(e.data||e,d,_):Rr(0,W,h),t},[d,y,_,p,W,h,R]),F=i(()=>Dn(l),[l]),Y=Object.assign(Object.assign({},n.marginDefaults),a),{customHoverBehavior:G,customClickBehavior:X}=Hr({selection:A,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,onClick:x,chartType:"CirclePack",chartId:k}),q=Jr({componentName:"CirclePack",data:o});return q?e.createElement(qr,{componentName:"CirclePack",message:q,width:L,height:O}):M||e.createElement(xn,{componentName:"CirclePack",width:L,height:O},e.createElement(xr,Object.assign({chartType:"circlepack"},null!=o&&{data:o},{size:[L,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:F,padding:f,nodeStyle:H,colorBy:d,colorScheme:z,colorByDepth:y,nodeLabel:j?g||u:void 0,showLabels:j,enableHover:D,tooltipContent:!1===m?()=>null:Sr(m)||void 0,customHoverBehavior:w||b||x?G:void 0,customClickBehavior:b||x?X:void 0},S&&"none"!==S&&{legendHoverBehavior:B.onLegendHover,legendClickBehavior:B.onLegendClick,legendHighlightedCategory:B.highlightedCategory,legendIsolatedCategories:B.isolatedCategories},{className:s,title:C,description:I,summary:P,accessibleTable:T},v)))}In.displayName="ChordDiagram",Pn.displayName="TreeDiagram",Tn.displayName="Treemap",Mn.displayName="CirclePack";const Nn=nr;function _n(t){const r=Gr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:o,className:a,childrenAccessor:s="children",nodeIdAccessor:c="name",colorBy:l,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:y=2.95,speed:g=.25,revolution:p,revolutionStyle:f,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:A,foregroundGraphics:w,annotations:E,frameProps:S={},onObservation:L,onClick:O,chartId:D,selection:j,linkedHover:C,loading:I}=t,P=r.width,T=r.height,M=r.enableHover,N=r.title,_=r.description,$=r.summary,B=r.accessibleTable,W=En(I,P,T),R=zr(i(()=>Ln(n,s),[n,s]),d?void 0:l,u),z=Wr(),H=i(()=>new Map,[]),F=i(()=>{if(Array.isArray(u))return u;if(z&&z.length>0)return z;const e=er[u];return Array.isArray(e)?e:tr},[u,z]),Y=i(()=>{if(Array.isArray(u))return u;const e=er[u];return Array.isArray(e)?e:tr},[u]),G=i(()=>e=>{var t;const r={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return r.fill=d?n?Y[0]:Nn[(e.depth||0)%Nn.length]:l?ir(e.data||e,l,R):Rr(0,z,u),r.opacity=n?1:.85,r},[l,d,R,Y,z,u,H]),X=i(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),q=Object.assign({top:10,right:10,bottom:10,left:10},o),{customHoverBehavior:V,customClickBehavior:K}=Hr({selection:j,linkedHover:C,fallbackFields:l?["string"==typeof l?l:""]:[],unwrapData:!0,onObservation:L,onClick:O,chartType:"OrbitDiagram",chartId:D}),U=i(()=>{if(V)return e=>{V(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[V]),Z=i(()=>{if(K)return e=>{K(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[K]),Q=Jr({componentName:"OrbitDiagram",data:n});return Q?e.createElement(qr,{componentName:"OrbitDiagram",message:Q,width:P,height:T}):W||e.createElement(xn,{componentName:"OrbitDiagram",width:P,height:T},e.createElement(xr,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[P,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q,nodeIDAccessor:c,childrenAccessor:s,nodeStyle:G,edgeStyle:X,colorBy:l,colorScheme:F,colorByDepth:d,nodeSize:b,nodeLabel:x?c:void 0,showLabels:x,enableHover:!k&&M,tooltipContent:k?void 0:!1===A?()=>null:Sr(A)||void 0,customHoverBehavior:C||L||O?U:void 0,customClickBehavior:L||O?Z:void 0,foregroundGraphics:w,annotations:E,className:a,title:N,description:_,summary:$,orbitMode:h,orbitSize:y,orbitSpeed:g,orbitRevolution:p,orbitRevolutionStyle:f,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:B},S)))}_n.displayName="OrbitDiagram";export{In as ChordDiagram,Mn as CirclePack,Sn as ForceDirectedGraph,_n as OrbitDiagram,Cn as SankeyDiagram,xr as StreamNetworkFrame,Pn as TreeDiagram,Tn as Treemap};
|