semiotic 3.8.3 → 3.8.4
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 +9 -9
- package/README.md +40 -39
- package/ai/examples.md +1 -1
- package/ai/schema.json +2726 -300
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +1 -0
- package/dist/{chunk-chunk-XQYVEKEJ.module.min.js → chunk-chunk-6TPGFL7M.module.min.js} +1 -1
- package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
- package/dist/chunk-chunk-7KZJUTKP.module.min.js +2 -0
- package/dist/chunk-chunk-7RYBCTK5.module.min.js +1 -0
- package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
- package/dist/{chunk-chunk-AZJUDQRM.module.min.js → chunk-chunk-AQPQN2HH.module.min.js} +1 -1
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +1 -0
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +2 -0
- package/dist/chunk-chunk-BFHUYEOS.module.min.js +2 -0
- package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
- package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
- package/dist/chunk-chunk-F5V4UIE6.module.min.js +2 -0
- package/dist/chunk-chunk-F7WFPD4O.module.min.js +2 -0
- package/dist/{chunk-chunk-SANERMIZ.module.min.js → chunk-chunk-FBGHXL72.module.min.js} +1 -1
- package/dist/chunk-chunk-FP44FHFO.module.min.js +2 -0
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +2 -0
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +2 -0
- package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
- package/dist/{chunk-chunk-7FW6EGLP.module.min.js → chunk-chunk-JDXT6ORT.module.min.js} +1 -1
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +1 -0
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +1 -0
- package/dist/{chunk-chunk-OQTLSTGI.module.min.js → chunk-chunk-KQ546MKE.module.min.js} +1 -1
- package/dist/chunk-chunk-LQBSXO7K.module.min.js +2 -0
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +1 -0
- package/dist/{chunk-chunk-JNCHKRIR.module.min.js → chunk-chunk-N6VKKF3A.module.min.js} +1 -1
- package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +2 -0
- package/dist/chunk-chunk-PLIDPQNG.module.min.js +2 -0
- package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +1 -0
- package/dist/chunk-chunk-RP7WTID5.module.min.js +1 -0
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +1 -0
- package/dist/chunk-chunk-SR4ZXOWR.module.min.js +2 -0
- package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
- package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
- package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
- package/dist/components/ChartContainer.d.ts +2 -2
- package/dist/components/ai/chartCapabilityTypes.d.ts +5 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +7 -3
- package/dist/components/charts/geo/FlowMap.d.ts +4 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
- package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
- package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
- package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
- package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
- package/dist/components/charts/shared/chartMode.d.ts +8 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
- package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
- package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
- package/dist/components/charts/shared/types.d.ts +2 -2
- package/dist/components/charts/shared/validateProps.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +10 -0
- package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
- package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
- package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
- package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
- package/dist/components/realtime/types.d.ts +5 -0
- package/dist/components/recipes/gridObservatory.d.ts +176 -0
- package/dist/components/recipes/recipeChrome.d.ts +24 -0
- package/dist/components/recipes/sequenceLayout.d.ts +139 -0
- package/dist/components/semiotic-recipes-core.d.ts +6 -2
- package/dist/components/server/staticAnnotations.d.ts +3 -1
- package/dist/components/stream/SceneToSVG.d.ts +6 -6
- package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
- package/dist/components/stream/networkFramePaint.d.ts +2 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
- package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
- package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +30 -1
- package/dist/components/stream/types.d.ts +4 -0
- package/dist/components/stream/useHydration.d.ts +7 -1
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
- package/dist/forceLayoutWorker.js +1 -1
- 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/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +6 -2
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- 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 +3 -2
- package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
- package/dist/chunk-chunk-2CCFBTQC.module.min.js +0 -2
- package/dist/chunk-chunk-2RXP3FS3.module.min.js +0 -1
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
- package/dist/chunk-chunk-4TMZXLCR.module.min.js +0 -1
- package/dist/chunk-chunk-5APBQXZA.module.min.js +0 -1
- package/dist/chunk-chunk-6HSGDMTA.module.min.js +0 -2
- package/dist/chunk-chunk-7OEOSCBP.module.min.js +0 -1
- package/dist/chunk-chunk-A63CTACR.module.min.js +0 -2
- package/dist/chunk-chunk-B6V35LMY.module.min.js +0 -2
- package/dist/chunk-chunk-BOSVL645.module.min.js +0 -2
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
- package/dist/chunk-chunk-F25UA5HT.module.min.js +0 -1
- package/dist/chunk-chunk-FRIO6MCV.module.min.js +0 -1
- package/dist/chunk-chunk-GWSWSPXN.module.min.js +0 -1
- package/dist/chunk-chunk-I6C3KR5H.module.min.js +0 -2
- package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
- package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
- package/dist/chunk-chunk-J5RL6GXU.module.min.js +0 -2
- package/dist/chunk-chunk-L3H6DQCR.module.min.js +0 -2
- package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
- package/dist/chunk-chunk-M7VYYHCE.module.min.js +0 -2
- package/dist/chunk-chunk-MC35ILYP.module.min.js +0 -2
- package/dist/chunk-chunk-N72SWNBV.module.min.js +0 -1
- package/dist/chunk-chunk-OBQRFTIL.module.min.js +0 -2
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
- package/dist/chunk-chunk-SA3D43RA.module.min.js +0 -2
- package/dist/chunk-chunk-UHSZEB74.module.min.js +0 -1
- package/dist/chunk-chunk-Y6AXCRVO.module.min.js +0 -1
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getHitRadius as e,hitTestRect as t,isTimeLandmark as n,normalizeAngle as o}from"./chunk-chunk-CP3EN6KZ.module.min.js";import{CustomLayoutSelectionProvider as r,canUseForceWorker as s,createFrameForceWorkerRequest as i,runForceLayoutWorker as a,shouldUseForceWorker as l,wrapWithCustomLayoutSelection as c}from"./chunk-chunk-7OEOSCBP.module.min.js";import{AccessibleDataTable as u,AriaLiveTooltip as d,CanvasFrameBackground as h,FlippingTooltip as p,FocusRing as f,NetworkAccessibleDataTable as y,SceneRevisionDiagnosticsObserver as g,ScreenReaderSummary as m,SkipToTableLink as v,computeCanvasAriaLabel as x,computeNetworkAriaLabel as b,createDefaultAnnotationRules as k,getDevicePixelRatio as w,prepareCanvas as A,renderAnnotationPass as S,renderEmptyState as _,renderLegendFromConfig as T,renderLoadingState as C,runSceneBuild as P,useFrame as R,useFrameCanvasHost as M,useHydration as N,useSceneRevisionDiagnostics as I,useWasHydratingFromSSR as W}from"./chunk-chunk-FRIO6MCV.module.min.js";import{annotationActivationProps as D,buildHoverData as E,defaultTooltipStyle as z,getPointerHitRadius as B,isAnnotationActivationTarget as L,smartTooltipEntries as O,useAnnotationActivationOptions as H}from"./chunk-chunk-255KDHW5.module.min.js";import"./chunk-chunk-SV4XAZ3Q.module.min.js";import{PipelineStore as F,attachUpdateResultStore as j,compileMotionEncoding as $,computeDecayOpacity as Y,createCustomLayoutFailureDiagnostic as X,deriveMotionVector as V,enrichDatumWithBand as G,getLayoutPlugin as q,opacityFromAge as U,paintSceneWithBackend as Q,renderSceneWithBackend as K,resolveDownwardHistogramExtent as Z,resolveMotionAccessor as J,resolveMotionVector as ee,ticksForMode as te,warnCustomLayoutDiagnostics as ne}from"./chunk-chunk-GWSWSPXN.module.min.js";import{IncrementalExtent as oe,RingBuffer as re}from"./chunk-chunk-VVCA3DB7.module.min.js";import"./chunk-chunk-5APBQXZA.module.min.js";import{ANNOTATION_DISCLOSURE_REVEAL_CSS as se,DEFAULT_COLORS as ie,TITLE_BASELINE as ae,buildColorStopGradient as le,buildLinearFillGradient as ce,buildResolveColor as ue,clampCornerRadii as de,computeEasing as he,computeRawProgress as pe,emitClickObservations as fe,emitHoverObservations as ye,filterSparseArray as ge,hasAnyCornerRadius as me,isInteractiveKeyboardTarget as ve,isServerEnvironment as xe,lerp as be,networkLabelToSVG as ke,networkSceneEdgeToSVG as we,networkSceneNodeToSVG as Ae,normalizeLinkedBrush as Se,now as _e,observationInputType as Te,resolveCanvasFill as Ce,resolveCurveFactory as Pe,resolveCustomLayoutPalette as Re,unlockCrosshair as Me,useBrushSelection as Ne,useChartLegendAndMargin as Ie,useChartMode as We,useChartSelection as De,useCrosshairPosition as Ee,xySceneNodeToSVG as ze}from"./chunk-chunk-F25UA5HT.module.min.js";import"./chunk-chunk-XEVJDUTH.module.min.js";import{DEFAULT_LIFECYCLE_THRESHOLDS as Be,bandFromAge as Le}from"./chunk-chunk-2WVCH4PL.module.min.js";import{UpdateResultTracker as Oe,annotationLayout as He,drawGlyphParts as Fe,glyphFractionClipRect as je,glyphHitGeometry as $e,glyphPlacement as Ye,schemeCategory10 as Xe,symbolPathString as Ve,symbolRadius as Ge}from"./chunk-chunk-5RKXZQ2P.module.min.js";import"./chunk-chunk-U66USBWU.module.min.js";import{getMax as qe}from"./chunk-chunk-JJ2OOIET.module.min.js";import{getCSSColorCacheVersion as Ue,resolveCSSColor as Qe}from"./chunk-chunk-QRIBHZYW.module.min.js";import"./chunk-chunk-J3QOW4OE.module.min.js";import{resolveThemeSemanticColors as Ke}from"./chunk-chunk-DSNGDNJY.module.min.js";import*as Ze from"react";import{useRef as Je,useState as et,useEffect as tt,useMemo as nt,useCallback as ot,useImperativeHandle as rt,useId as st,forwardRef as it,memo as at}from"react";import*as lt from"react";import{jsx as ct}from"react/jsx-runtime";var ut=null,dt=null;function ht(e){const[t,n]=lt.useState(()=>ut);return lt.useEffect(()=>{if(t)return;let e=!1;return(ut?Promise.resolve(ut):(dt||(dt=import("./chunk-XYBrushOverlay-ECZJJLAJ.module.min.js").then(e=>ut=e.XYBrushOverlay)),dt)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?ct(t,{...e}):null}var pt=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=ge(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=ge(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};import*as ft from"react";function yt(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:ft.createElement(ft.Fragment,null,...t)}import{useEffect as gt,useRef as mt}from"react";function vt(e,t,n,o){gt(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}function xt(e,t,n,o){const r=mt(null);gt(()=>{const s=e.current;if(!s)return;const i=t??null;r.current!==i&&(r.current=i,s.setLayoutSelection(i),s.hasCustomRestyle?s.restyleScene(i):n.current=!0,o())},[t,o,e,n])}function bt(t,n,o,r,s,i=e=>e.x,a=e=>e.y,l=e=>e.r){const c=Math.max(r,s+5,12),u=n-c,d=n+c,h=o-c,p=o+c;let f=null,y=1/0;return t.visit((t,s,c,g,m)=>{if(s>d||u>g||c>p||h>m)return!0;if(!t.length){let s=t;do{const t=s.data,c=i(t)-n,u=a(t)-o,d=Math.sqrt(c*c+u*u);e(l(t),r)>=d&&y>d&&(f=t,y=d),s=s.next}while(s)}return!1}),f?{node:f,distance:y}:null}import{line as kt}from"d3-shape";var wt=new WeakMap;function At(e,t){const n=Pe(t);if(!n)return e;const o=wt.get(e);if(o)return o;const r=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let r=null;const s={moveTo(e,t){r=[e,t],o.push([e,t])},lineTo(e,t){r=[e,t],o.push([e,t])},bezierCurveTo(e,t,s,i,a,l){if(!r)return r=[a,l],void o.push([a,l]);const[c,u]=r;for(let r=1;n>=r;r++){const d=r/n,h=1-d;o.push([h*h*h*c+3*h*h*d*e+3*h*d*d*s+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*i+d*d*d*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,s){r=[n,s],o.push([n,s])}};return kt().x(e=>e[0]).y(e=>e[1]).curve(t).context(s)(e),o}(e,n);return wt.set(e,r),r}function St(e,t,n,o=30,r,s=0){let i=null;if(r){const e=bt(r,t,n,o,s);e&&(i={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const s of e){let e=null;switch(s.type){case"point":if(r)break;e=Tt(s,t,n,o);break;case"symbol":e=Ct(s,t,n,o);break;case"glyph":e=Pt(s,t,n,o);break;case"line":e=Rt(s,t,n,o);break;case"rect":if(null==s.datum)break;e=Nt(s,t,n);break;case"heatcell":e=It(s,t,n);break;case"area":if(!1===s.interactive)break;e=Dt(s,t,n);break;case"candlestick":e=Wt(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}function _t(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Et(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,s=o;o>0&&e[o][0]>=t?(r=o-1,s=o):e.length-1>o&&(r=o,s=o+1);const[i,a]=e[r],[l,c]=e[s];return l===i?a:a+Math.max(0,Math.min(1,(t-i)/(l-i)))*(c-a)}function Tt(t,n,o,r=30){const s=n-t.x,i=o-t.y,a=Math.sqrt(s*s+i*i);return a>e(t.r,r)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:a}}function Ct(t,n,o,r=30){const s=n-t.x,i=o-t.y,a=Math.sqrt(s*s+i*i);return a>e(Ge(t.size),r)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:a}}function Pt(t,n,o,r=30){if(null==t.datum)return null;const s=$e(t.glyph,t.size),i=t.x+s.centerDx,a=t.y+s.centerDy,l=n-i,c=o-a,u=Math.sqrt(l*l+c*c);return u>e(s.radius,r)?null:{node:t,datum:t.datum,x:i,y:a,distance:u}}function Rt(e,t,n,o=30){if(0===e.path.length)return null;const r=Et(e.path,t);if(0>r)return null;const[s,i]=e.path[r];let a;if(e.path.length>1){let o=1/0;const s=Math.max(0,r-1),i=Math.min(e.path.length-2,r);for(let r=s;i>=r;r++){const[s,i]=e.path[r],[a,l]=e.path[r+1],c=Mt(t,n,s,i,a,l);o>c&&(o=c)}a=o}else{const e=t-s,o=n-i;a=Math.sqrt(e*e+o*o)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:s,y:i,distance:a}}function Mt(e,t,n,o,r,s){const i=r-n,a=s-o,l=i*i+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*i+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*i))**2+(t-(o+c*a))**2)}function Nt(e,n,o){const r=t(n,o,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function It(e,n,o){const r=t(n,o,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function Wt(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,s=t-e.x,i=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(s*s+i*i)}}return null}function Dt(e,t,n){if(0===e.topPath.length)return null;const o=Et(e.topPath,t);if(0>o)return null;const[r,s]=e.topPath[o],i=t-r,a=n-s,l=Math.sqrt(i*i+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:s,distance:l}}function Et(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}import{useEffect as zt,useRef as Bt}from"react";var Lt={fresh:1,aging:.7,stale:.45,expired:.25},Ot={alpha:1,band:"fresh",isStale:!1};function Ht(e,t){if(!e||0>=t)return Ot;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=Le(t,n,e.thresholds);return{alpha:{...Lt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Ot}function Ft(e,t,n,o,r,s){const i=Bt("fresh");zt(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=Ht(e,l-a.lastIngestTime);c.band===i.current&&c.isStale===r||(i.current=c.band,c.isStale!==r&&s(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,s,n])}import{jsx as jt}from"react/jsx-runtime";function $t({isStale:e,position:t}){return jt("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}import{useMemo as Yt,useRef as Xt,useEffect as Vt}from"react";import{useMemo as Gt}from"react";import{bin as qt}from"d3-array";import{jsx as Ut,jsxs as Qt}from"react/jsx-runtime";function Kt(e){return"string"==typeof e?{type:e}:e}function Zt({orient:e,config:t,values:n,scale:o,size:r,length:s}){const i=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=Gt(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===i.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],s=t[Math.floor(.75*n)],i=s-o;return{q1:o,median:r,q3:s,whiskerLow:Math.max(t[0],o-1.5*i),whiskerHigh:Math.min(t[n-1],s+1.5*i)}}(n);if(!t)return null;const{q1:r,median:s,q3:c,whiskerLow:u,whiskerHigh:d}=t,h=Math.min(.5*l,20),p=(l-h)/2+4;if(a){const t=o(r),n=o(c),a=o(s),l=o(u),f=o(d),y="top"===e?-1:1,g=0;return Qt("g",{"data-testid":"marginal-boxplot-"+e,children:[Ut("line",{x1:l,y1:g+y*(p+h/2),x2:f,y2:g+y*(p+h/2),stroke:i.fill,strokeWidth:i.strokeWidth}),Ut("line",{x1:l,y1:g+y*p,x2:l,y2:g+y*(p+h),stroke:i.fill,strokeWidth:i.strokeWidth}),Ut("line",{x1:f,y1:g+y*p,x2:f,y2:g+y*(p+h),stroke:i.fill,strokeWidth:i.strokeWidth}),Ut("rect",{x:Math.min(t,n),y:"top"===e?g-p-h:g+p,width:Math.abs(n-t),height:h,fill:i.fill,fillOpacity:i.fillOpacity,stroke:"none"===i.stroke?i.fill:i.stroke,strokeWidth:i.strokeWidth}),Ut("line",{x1:a,y1:"top"===e?g-p-h:g+p,x2:a,y2:"top"===e?g-p:g+p+h,stroke:i.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(s),l=o(u),f=o(d),y="left"===e?-1:1,g=0;return Qt("g",{"data-testid":"marginal-boxplot-"+e,children:[Ut("line",{x1:g+y*(p+h/2),y1:l,x2:g+y*(p+h/2),y2:f,stroke:i.fill,strokeWidth:i.strokeWidth}),Ut("line",{x1:g+y*p,y1:l,x2:g+y*(p+h),y2:l,stroke:i.fill,strokeWidth:i.strokeWidth}),Ut("line",{x1:g+y*p,y1:f,x2:g+y*(p+h),y2:f,stroke:i.fill,strokeWidth:i.strokeWidth}),Ut("rect",{x:"left"===e?g-p-h:g+p,y:Math.min(t,n),width:h,height:Math.abs(n-t),fill:i.fill,fillOpacity:i.fillOpacity,stroke:"none"===i.stroke?i.fill:i.stroke,strokeWidth:i.strokeWidth}),Ut("line",{x1:"left"===e?g-p-h:g+p,y1:a,x2:"left"===e?g-p:g+p+h,y2:a,stroke:i.fill,strokeWidth:2})]})}}const c=qt().domain(t).thresholds(i.bins)(n);if(0===c.length)return null;const u=qe(c.map(e=>e.length));if(0===u)return null;if("histogram"===i.type)return Ut("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const s=o(t.x0),a=o(t.x1)-o(t.x0);return Ut("rect",{x:s,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:i.fill,fillOpacity:i.fillOpacity,stroke:i.stroke,strokeWidth:i.strokeWidth},n)}{const s=o(t.x0),a=o(t.x1)-o(t.x0);return Ut("rect",{x:"left"===e?-4-r:4,y:Math.min(s,s+a),width:r,height:Math.abs(a),fill:i.fill,fillOpacity:i.fillOpacity,stroke:i.stroke,strokeWidth:i.strokeWidth},n)}})});if("violin"===i.type){const t=l/2+4,n=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const s=r.length/u*(l/2),i=o((r.x0+r.x1)/2);n.push(a?`${i},${"top"===e?-(t-s):t-s}`:`${"left"===e?-(t-s):t-s},${i}`)}for(let r=c.length-1;r>=0;r--){const s=c[r];if(null==s.x0||null==s.x1)continue;const i=s.length/u*(l/2),d=o((s.x0+s.x1)/2);n.push(a?`${d},${"top"===e?-(t+i):t+i}`:`${"left"===e?-(t+i):t+i},${d}`)}return Ut("g",{"data-testid":"marginal-violin-"+e,children:Ut("polygon",{points:n.join(" "),fill:i.fill,fillOpacity:i.fillOpacity,stroke:"none"===i.stroke?i.fill:i.stroke,strokeWidth:i.strokeWidth})})}if("ridgeline"===i.type){const t=[];if(a){const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${r},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,s=o((n.x0+n.x1)/2);t.push(`L${s},${"top"===e?-r-4:r+4}`)}const i=null!=c[c.length-1].x1?o(c[c.length-1].x1):s;t.push(`L${i},${n}`),t.push("Z")}else{const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${n},${r}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,s=o((n.x0+n.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${s}`)}const i=null!=c[c.length-1].x1?o(c[c.length-1].x1):s;t.push(`L${n},${i}`),t.push("Z")}return Ut("g",{"data-testid":"marginal-ridgeline-"+e,children:Ut("path",{d:t.join(" "),fill:i.fill,fillOpacity:i.fillOpacity,stroke:"none"===i.stroke?i.fill:i.stroke,strokeWidth:i.strokeWidth})})}return null},[n,o,i,r,s,e,a,4]);return l?Ut("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}function Jt(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function en(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function tn(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function nn(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function on(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,s=Math.ceil(t/8);let i="M0,"+o;for(let e=0;s>e;e++){const n=8*(e+1);i+=`L${Math.min(8*e+4,t)},${o+4*r}`,i+=`L${Math.min(n,t)},${o}`}return i}const o="bottom"===e?0:t,r="bottom"===e?1:-1,s=Math.ceil(n/8);let i=`M${o},0`;for(let e=0;s>e;e++){const t=8*(e+1);i+=`L${o+4*r},${Math.min(8*e+4,n)}`,i+=`L${o},${Math.min(t,n)}`}return i}import{Fragment as rn,jsx as sn,jsxs as an}from"react/jsx-runtime";function ln(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:s,scales:i,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:d,axisExtent:h}=e,p=Yt(()=>{if(!i)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||u||cn,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,s="exact"===h?Math.max(2,r):Math.min(r,o),a=e?.tickValues??te(i.x,s,h),c=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:i.x(e),label:n(e,t,c)})),p=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return un(d,Math.max(55,p+8))},[i,l,u,t,h]),f=Yt(()=>{if(!i)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||d||cn,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,s="exact"===h?Math.max(2,r):Math.min(r,o);return un((e?.tickValues??te(i.y,s,h)).map(e=>({value:e,pixel:i.y(e),label:t(e)})),22)},[i,l,d,n,h]),y=c&&i,g=a&&i;if(!y&&!g)return null;const m=l?.find(e=>"bottom"===e.orient),v=l?.find(e=>"left"===e.orient),x=g&&(!m||!1!==m.baseline),b=g&&(!v||!1!==v.baseline),k=m?.jaggedBase||!1,w=v?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return sn("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:an("g",{transform:`translate(${s.left},${s.top})`,children:[y&&(()=>{const e=nn(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=nn(l?.find(e=>"left"===e.orient)?.gridStyle);return an("g",{className:"stream-grid",children:[p.map((t,o)=>sn("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),f.map((e,n)=>sn("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),x&&!k&&sn("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&sn("path",{d:on("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),b&&!w&&sn("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&sn("path",{d:on("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function cn(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function un(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function dn(e){const{width:t,height:o,totalWidth:r,totalHeight:s,margin:i,scales:a,showAxes:l,axes:c,xLabel:u,yLabel:d,yLabelRight:h,xFormat:p,yFormat:f,axisExtent:y,showGrid:g,title:m,legend:v,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:w,legendIsolatedCategories:A,legendPosition:_="right",legendLayout:C,foregroundGraphics:P,marginalGraphics:R,xValues:M,yValues:N,annotations:I,onAnnotationActivate:W,onObservation:D,chartId:E,chartType:z,autoPlaceAnnotations:B,svgAnnotationRules:L,xAccessor:O,yAccessor:F,annotationData:j,pointNodes:$,curve:Y,underlayRendered:X,canvasObscuresUnderlay:V=!0,linkedCrosshairName:G,linkedCrosshairSourceId:q,children:U}=e,Q=H({onAnnotationActivate:W,onObservation:D,chartId:E,chartType:z}),K=Yt(()=>{if(!l||!a)return[];const e=c?.find(e=>"bottom"===e.orient),n=e?.tickFormat||p||cn,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,s="exact"===y?Math.max(2,r):Math.min(r,o),i=e?.tickValues??te(a.x,s,y),u=i.map(e=>e.valueOf()),d=i.map((e,t)=>({value:e,pixel:a.x(e),label:n(e,t,u)})),h=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),f=e?.autoRotate?Math.max(20,Math.min(h+8,55)):Math.max(55,h+8);let g=un(d,f);if(g.length>1&&(g=g.filter((e,t)=>0===t||e.label+""!=g[t-1].label+"")),e?.includeMax&&g.length>0&&"exact"!==y&&!e?.tickValues){const e=a.x.domain()[1],t=a.x(e),o=g[g.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,g.length,u);f>t-o&&g.length>1&&(g=g.slice(0,-1)),g.push({value:e,pixel:t,label:r})}}return g},[l,a,c,p,t,y]),Z=Yt(()=>{if(!l||!a)return[];const e=c?.find(e=>"left"===e.orient),t=e?.tickFormat||f||cn,n=Math.max(2,Math.floor(o/30)),r=e?.ticks??5,s="exact"===y?Math.max(2,r):Math.min(r,n);let i=un((e?.tickValues??te(a.y,s,y)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22);if(i.length>1&&(i=i.filter((e,t)=>0===t||e.label+""!=i[t-1].label+"")),e?.includeMax&&i.length>0&&"exact"!==y&&!e?.tickValues){const e=a.y.domain()[1],n=a.y(e),o=i[i.length-1].pixel;if(Math.abs(n-o)>1){const r=t(e);22>Math.abs(n-o)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:n,label:r})}}return i},[l,a,c,f,o,y]),J=Yt(()=>{if(!l||!a)return[];const e=c?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||cn,n=Math.max(2,Math.floor(o/30)),r=e.ticks??5;return un((e.tickValues??te(a.y,"exact"===y?Math.max(2,r):Math.min(r,n),y)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22)},[l,a,c,f,o,y]),ee=Xt(new Map),ne=Xt(I?.length??0),oe=I?.length??0;ne.current!==oe&&(ne.current=oe,ee.current=new Map);const re=Yt(()=>{if(!I||0===I.length)return null;const e=k("xy",Q),n={scales:a?{x:a.x,y:a.y,time:a.x,value:a.y}:null,timeAxis:"x",xAccessor:O,yAccessor:F,width:t,height:o,data:j,frameType:"xy",pointNodes:$,curve:Y,stickyPositionCache:ee.current},r=B?He({annotations:I,context:n,..."object"==typeof B?B:{}}):I;return S(r,e,L,n)},[I,B,L,t,o,O,F,j,a,$,Y,Q]),se=Ee(G);return Vt(()=>{if(!se?.locked||!G)return;const e=e=>{"Escape"===e.key&&Me(G)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[se?.locked,G]),l||m||v||P||R||re&&re.length>0||g||U||se?an("svg",{role:"img",width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[sn("title",{children:"string"==typeof m?m:"XY Chart"}),sn("desc",{children:"string"==typeof m?m+" (XY data visualization)":"XY data visualization"}),an("g",{transform:`translate(${i.left},${i.top})`,children:[g&&a&&(!X||V)&&(()=>{const e=nn(c?.find(e=>"bottom"===e.orient)?.gridStyle),n=nn(c?.find(e=>"left"===e.orient)?.gridStyle);return an("g",{className:"stream-grid",children:[K.map((t,n)=>sn("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+n)),Z.map((e,o)=>sn("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"ygrid-"+o))]})})(),l&&a&&(()=>{const e=c?.find(e=>"left"===e.orient),r=c?.find(e=>"bottom"===e.orient),s=!e||!1!==e.baseline,a=!r||!1!==r.baseline,l=e?.jaggedBase||!1,p=r?.jaggedBase||!1,f=r?.landmarkTicks,y=e?.landmarkTicks,g="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",v="var(--semiotic-text, #333)",x=!!r?.autoRotate&&K.length>1&&(()=>{const e=t/Math.max(K.length-1,1);return K.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),b=x?12:18,k=o+(x?58:40),w={fontSize:"var(--semiotic-tick-font-size, 12px)"},A={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},S={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},_=r?.tickAnchor,T=e?.tickAnchor,C=tn(K),P=tn(Z);return an("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[an("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!X||V)&&a&&!p&&sn("line",{x1:0,y1:o,x2:t,y2:o,stroke:g,strokeWidth:1}),(!X||V)&&p&&sn("path",{d:on("bottom",t,o),fill:"none",stroke:g,strokeWidth:1}),K.map((e,t)=>{const r=!!f&&("function"==typeof f?f(e.value,t):n(e.value,t>0?K[t-1].value:void 0));return an("g",{transform:`translate(${e.pixel},${o})`,children:[sn("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?sn("text",{y:b,textAnchor:x?"end":Jt(_,e.pixel===C.min,e.pixel===C.max),fontWeight:r?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...r?A:w},transform:x?"rotate(-45)":void 0,children:e.label}):sn("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:sn("div",{style:{textAlign:"center",userSelect:"none",...w},children:e.label})})]},"xtick-"+t)}),u&&sn("text",{x:t/2,y:k,textAnchor:"middle",fill:v,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:u})]}),an("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!X||V)&&s&&!l&&sn("line",{x1:0,y1:0,x2:0,y2:o,stroke:g,strokeWidth:1}),(!X||V)&&l&&sn("path",{d:on("left",t,o),fill:"none",stroke:g,strokeWidth:1}),Z.map((e,t)=>{const o=!!y&&("function"==typeof y?y(e.value,t):n(e.value,t>0?Z[t-1].value:void 0));return an("g",{transform:`translate(0,${e.pixel})`,children:[sn("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?sn("text",{x:-8,textAnchor:"end",dominantBaseline:en(T,e.pixel===P.min,e.pixel===P.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?A:w},children:e.label}):sn("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:sn("div",{style:{textAlign:"right",userSelect:"none",...w},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||d;return t?sn("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:v,transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:t}):null})()]}),(()=>{const e=c?.find(e=>"right"===e.orient);if(!e||0===J.length)return null;const r=!1!==e.baseline,s=e.landmarkTicks,a=e.label||h,l=e.tickAnchor,u=tn(J);return an("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[r&&sn("line",{x1:t,y1:0,x2:t,y2:o,stroke:g,strokeWidth:1}),J.map((e,o)=>{const r=!!s&&("function"==typeof s?s(e.value,o):n(e.value,o>0?J[o-1].value:void 0));return an("g",{transform:`translate(${t},${e.pixel})`,children:[sn("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?sn("text",{x:8,textAnchor:"start",dominantBaseline:en(l,e.pixel===u.min,e.pixel===u.max),fontWeight:r?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...r?A:w},children:e.label}):sn("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:sn("div",{style:{textAlign:"left",userSelect:"none",...w},children:e.label})})]},"ytick-r-"+o)}),a&&sn("text",{x:t+i.right-15,y:o/2,textAnchor:"middle",fill:v,transform:`rotate(90, ${t+i.right-15}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:a})]})})()]})})(),re,R&&a&&M&&N&&an(rn,{children:[R.top&&sn("g",{transform:"translate(0, 0)",children:sn(Zt,{orient:"top",config:Kt(R.top),values:M,scale:a.x,size:i.top,length:t})}),R.bottom&&sn("g",{transform:`translate(0, ${o})`,children:sn(Zt,{orient:"bottom",config:Kt(R.bottom),values:M,scale:a.x,size:i.bottom,length:t})}),R.left&&sn("g",{transform:"translate(0, 0)",children:sn(Zt,{orient:"left",config:Kt(R.left),values:N,scale:a.y,size:i.left,length:o})}),R.right&&sn("g",{transform:`translate(${t}, 0)`,children:sn(Zt,{orient:"right",config:Kt(R.right),values:N,scale:a.y,size:i.right,length:o})})]}),P,se&&se.sourceId!==q&&a?.x&&(()=>{const e=a.x(se.xValue);if(null==e||0>e||e>t)return null;const n=se.locked;return sn("line",{x1:e,y1:0,x2:e,y2:o,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),U]}),m&&"string"==typeof m?sn("text",{x:r/2,y:ae,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?sn("foreignObject",{x:0,y:0,width:r,height:i.top,children:m}):null,T({legend:v,totalWidth:r,totalHeight:s,margin:i,legendPosition:_,title:m,legendLayout:C,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:w,legendIsolatedCategories:A})]}):null}import{useRef as hn}from"react";function pn(e){const t=hn(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return yn(e,t);if(!gn(e)||!gn(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!yn(n,r))return!1}else{if(!gn(n)||!gn(r))return!1;if(!fn(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function fn(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function yn(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function gn(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function mn(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:o=""}=e;return"transparent"===t||n?null:t||(o&&"transparent"!==o?o:"")||null}function vn(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:s=0,y:i=0,width:a,height:l}=t,c=mn({background:n,hasBackgroundGraphics:o,themeBackground:r});if(!c)return!1;const u=Qe(e,c);return!!u&&(e.fillStyle=u,e.fillRect(s,i,a,l),!0)}var xn={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function bn(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}function kn(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}import{useCallback as wn,useRef as An}from"react";function Sn(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var _n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Tn=3156e7;function Cn(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:Tn>t?e=>{const t=new Date(e);return`${_n[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*Tn>t?e=>{const t=new Date(e);return`${_n[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Pn(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:Ge(n.size)});else if("glyph"===n.type){const e=$e(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}import{line as Rn}from"d3-shape";function Mn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Nn(e,t,n,o,r,s){if(2>t.length)return;const i=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];i.push(i[e-1]+Math.sqrt(n*n+o*o))}const a=i[i.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=s;for(let n=0;t.length-1>n;n++){const o=(i[n]+i[n+1])/2;let s=r;l>o&&(s*=o/l),l>a-o&&(s*=(a-o)/l),e.globalAlpha=Math.max(0,s),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}var In=(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const r=t.style.stroke||"#007bff",s=Qe(e,r)||r,i=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=i,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Nn(e,t.path,s,i,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Pe(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=s;const n=t.style.opacity??1;for(let o=0;t.path.length-1>o;o++)e.globalAlpha=.5*(d[o]+d[o+1])*n,e.beginPath(),e.moveTo(t.path[o][0],t.path[o][1]),e.lineTo(t.path[o+1][0],t.path[o+1][1]),e.stroke()}else if(u){let n=function(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),d=!0},o=function(){d&&(e.stroke(),d=!1)},r=null,i=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,p]=t.path[d],f=l[d],y=Mn(f,a,s);if(null!==r&&null!==u&&null!==c){if(y===u)e.lineTo(h,p);else{const t=[];for(const e of a){const n=e.value;(c>n||n>f)&&(n>c||f>n)||c===n||f===n||t.push({t:(n-c)/(f-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(h-r)*l.t,u=i+(p-i)*l.t,d=Mn(c+(f-c)*Math.min(l.t+1e-4,1),a,s);e.lineTo(t,u),o(),n(d,t,u)}e.lineTo(h,p)}r=h,i=p,c=f,u=y}else n(y,h,p),r=h,i=p,c=f,u=y}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?le(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||s,c)Rn().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=Ce(e,t.style.fill,t.style.fill),c&&!u)Rn().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],o.height),e.lineTo(n,o.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Wn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Dn(e,t,n=.3){Wn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function En(e,t,n=.6){if(!Wn(t))return;const o=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,s=t.cy??t.y??0;e.beginPath(),e.arc(r,s,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function zn(e,t,n,o=.35){Wn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}import{area as Bn,line as Ln}from"d3-shape";function On(e,t){const n=Pe(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=Bn().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}var Hn=(e,t,n,o)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,o.width*r,o.height),e.clip());const s=Ce(e,t.style.fill,"#4e79a7"),i=t._decayOpacities;if(i&&i.length===t.topPath.length){const n=t.style.fillOpacity??.7;e.fillStyle=s;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(i[o]+i[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(i[n]+i[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(On(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=ce(e,t.fillGradient,"string"==typeof s?s:"#4e79a7",0,n,0,o);e.fillStyle=r||s,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=s;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(On(e,t),zn(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const n=t.strokeGradient&&t.topPath.length>=2?le(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Pe(t.curve);if(e.beginPath(),o)Ln().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Fn=(e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=Ce(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=Ce(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),En(e,n)}finally{e.restore()}}},jn=new Map;function $n(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=jn.get(t);return n||(n=new Path2D(Ve(e.symbolType,e.size)),jn.size>256&&jn.clear(),jn.set(t,n)),n}catch{return null}}var Yn=(e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=$n(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const s=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=n*s*(t.style.fillOpacity??1),e.fillStyle=Ce(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*s,e.strokeStyle=Ce(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n};function Xn(e,t,n,o,r){if(0>=t.size)return;const s=t.glyph;if(!s||!s.parts?.length)return;const i=Ye(s,t.size);if(0>=i.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=Ce(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(i.offsetX,i.offsetY),e.scale(i.scale,i.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=je(s,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Fe(e,s,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Fe(e,s,c,t.accent,void 0,l),e.restore()}function Vn(e,t){const{x:n,y:o,w:r,h:s}=t,{tl:i,tr:a,br:l,bl:c}=de(t);e.beginPath(),e.moveTo(n+i,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+s-l),l>0&&e.arcTo(n+r,o+s,n+r-l,o+s,l),e.lineTo(n+c,o+s),c>0&&e.arcTo(n,o+s,n,o+s-c,c),e.lineTo(n,o+i),i>0&&e.arcTo(n,o,n+i,o,i),e.closePath()}function Gn(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var qn=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Un(e,t);else if(t.cornerRadii&&me(t.cornerRadii)){const n=Ce(e,t.style.fill,Qe(e,"var(--semiotic-primary, #007bff)")),o=Gn(t),r=t.fillGradient&&"string"==typeof n?ce(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,Vn(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Ce(e,t.style.fill,Qe(e,"var(--semiotic-primary, #007bff)")),o=Gn(t),r=t.fillGradient&&"string"==typeof n?ce(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const s=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:i,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(i,a),e.lineTo(i+l-s,a),e.arcTo(i+l,a,i+l,a+s,s),e.lineTo(i+l,a+c-s),e.arcTo(i+l,a+c,i+l-s,a+c,s),e.lineTo(i,a+c);break;case"left":e.moveTo(i+l,a),e.lineTo(i+s,a),e.arcTo(i,a,i,a+s,s),e.lineTo(i,a+c-s),e.arcTo(i,a+c,i+s,a+c,s),e.lineTo(i+l,a+c);break;case"bottom":e.moveTo(i,a),e.lineTo(i+l,a),e.lineTo(i+l,a+c-s),e.arcTo(i+l,a+c,i+l-s,a+c,s),e.lineTo(i+s,a+c),e.arcTo(i,a+c,i,a+c-s,s);break;default:e.moveTo(i,a+c),e.lineTo(i,a+s),e.arcTo(i,a,i+s,a,s),e.lineTo(i+l-s,a),e.arcTo(i+l,a,i+l,a+s,s),e.lineTo(i+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Ce(e,t.style.fill,Qe(e,"var(--semiotic-primary, #007bff)")),o=Gn(t),r=t.fillGradient&&"string"==typeof n?ce(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Dn(e,t),e.globalAlpha=1}};function Un(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const s=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),s){const s=r+o,i=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=s)e.drawImage(n,i,o,r,r)}else{const s=r+o,i=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=s)e.drawImage(n,o,i,r,r)}e.restore()}function Qn(e){const[t,n,o]=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*n+.114*o>128?"#000":"#fff"}function Kn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var Zn=(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Qe(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Dn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Kn(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,s=t.y+t.h/2;e.fillStyle=Qn(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,s)}}}finally{e.restore()}},Jn=(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const s=Qe(e,t.wickColor)||t.wickColor,i=60>o.height,a=i?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=s,e.lineWidth=a,e.stroke()};if(i||l(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=s,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,s=Qe(e,r)||r;e.fillStyle=s,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=s,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}i&&l(),e.restore()}},eo={line:[Hn,In,Fn],area:[Hn,Fn],stackedarea:[Hn,Fn],scatter:[Fn,Yn],bubble:[Fn,Yn],heatmap:[Zn],bar:[qn],swarm:[Fn],waterfall:[(e,t,n,o)=>{qn(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const s=r[0].datum,i=s?._connectorStroke;if(i){e.save(),e.strokeStyle=Qe(e,i)||i,e.lineWidth=s?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],s=r[t+1],i=o.datum,a=s.datum;if(null==i?.cumEnd||null==a?.baseline)continue;const l=n.y(i.cumEnd),c=o.x+o.w,u=s.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Jn],mixed:[Hn,In,Fn],custom:[Hn,qn,Zn,In,Fn,Yn,(e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Xn(e,o,o.x,o.y,n);e.globalAlpha=n},Jn]};import{jsx as to,jsxs as no}from"react/jsx-runtime";import{jsx as oo,jsxs as ro}from"react/jsx-runtime";function so(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function io({hover:e}){const t=e.data??{},n=t.y??t.value,o=t.x??t.time;if(void 0===n&&void 0===o){const e=O(t);if(null!=e.title||e.entries.length>0)return ro("div",{className:"semiotic-tooltip",style:z,children:[null!=e.title&&oo("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>ro("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",oo("span",{style:{fontWeight:600},children:so(e.value)})]},e.key))]})}return ro("div",{className:"semiotic-tooltip",style:z,children:[oo("div",{style:{fontWeight:600,marginBottom:2},children:so(n)}),oo("div",{style:{opacity:.7,fontSize:11},children:so(o)})]})}io.ownsChrome=!0;import{useCallback as ao}from"react";import{useCallback as lo,useRef as co}from"react";function uo(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.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 n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}function ho(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}function po(e,t,n){const{group:o,indexInGroup:r}=t,s=n.byGroup.get(o);switch(e){case"ArrowRight":return s.length-1>r?s[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?s[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?fo(n,n.groups[e+1],s[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?fo(n,n.groups[e-1],s[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function fo(e,t,n){const o=e.byGroup.get(t);let r=0,s=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);s>t&&(s=t,r=e)}return o[r]._flatIndex}function yo(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=$e(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n],shape:"circle",group:r});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n],shape:"circle",group:r});break}case"rect":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function go(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}import{jsx as mo,jsxs as vo}from"react/jsx-runtime";var xo={top:20,right:20,bottom:30,left:40},bo=xn;function ko(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var wo=at(it(function(e,t){const{chartType:n,runtimeMode:o,data:r,chunkThreshold:s,chunkSize:i,xAccessor:a,yAccessor:l,accessorRevision:y,colorAccessor:b,sizeAccessor:k,symbolAccessor:S,symbolMap:_,groupAccessor:T,lineDataAccessor:C,curve:P,normalize:D,baseline:z,stackOrder:O,binSize:H,valueAccessor:j,arrowOfTime:$="right",windowMode:Y="sliding",windowSize:X=200,timeAccessor:V,xExtent:q,yExtent:U,extentPadding:Z=.1,scalePadding:J,sizeRange:ee,size:te=[500,300],responsiveWidth:ne,responsiveHeight:oe,margin:re,className:se,background:ie,renderMode:ae,lineStyle:le,pointStyle:ce,areaStyle:ue,barStyle:de,waterfallStyle:he,swarmStyle:pe,barColors:me,colorScheme:be,boundsAccessor:ke,boundsStyle:we,y0Accessor:Ae,band:Se,gradientFill:_e,lineGradient:Ce,areaGroups:Pe,openAccessor:Re,highAccessor:Me,lowAccessor:Ne,closeAccessor:Ie,candlestickStyle:We,showAxes:De=!0,axes:Ee,xLabel:Be,yLabel:Le,yLabelRight:Oe,xFormat:He,yFormat:Fe,axisExtent:je,tickFormatTime:$e,tickFormatValue:Ye,hoverAnnotation:Xe,tooltipContent:Ve,customHoverBehavior:Ge,customClickBehavior:qe,onObservation:Qe,annotationObservationCallback:it,chartId:at,enableHover:lt,hoverRadius:ct=30,tooltipMode:ut,annotations:dt,onAnnotationActivate:ft,autoPlaceAnnotations:gt,svgAnnotationRules:mt,showGrid:bt,legend:kt,legendHoverBehavior:wt,legendClickBehavior:Tt,legendHighlightedCategory:Ct,legendIsolatedCategories:Pt,legendPosition:Rt,legendLayout:Mt,legendCategoryAccessor:Nt,onCategoriesChange:It,backgroundGraphics:Wt,foregroundGraphics:Dt,canvasPreRenderers:zt,svgPreRenderers:Bt,title:Lt,categoryAccessor:Ot,brush:jt,onBrush:Yt,decay:Xt,pulse:Vt,transition:Gt,animate:qt,staleness:Ut,frameScheduler:Qt,clock:Kt,random:Zt,seed:Jt,paused:en=!1,suspendWhenHidden:tn=!0,heatmapAggregation:nn,heatmapXBins:on,heatmapYBins:rn,showValues:sn,heatmapValueFormat:an,marginalGraphics:cn,pointIdAccessor:un,xScaleType:hn,yScaleType:fn,accessibleTable:yn=!0,description:gn,summary:_n,linkedCrosshairName:Tn,linkedCrosshairSourceId:Rn,customLayout:Mn,onLayoutError:Nn,layoutConfig:In,layoutSelection:Wn}=e,{customHoverBehavior:Dn,customClickBehavior:En,hasClickBehavior:zn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:ao((t,s)=>{e?.(t,s),ye({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:s})},[o,r,e,n]),customClickBehavior:ao((e,s)=>{t?.(e,s),fe({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:s})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:Ge,customClickBehavior:qe,onObservation:Qe,chartId:at,chartType:"StreamXYFrame"}),Bn=st().replace(/:/g,""),Ln=Je(!1),On=Je({w:-1,h:-1}),Hn=Je(!1),Fn=R({sizeProp:te,responsiveWidth:ne,responsiveHeight:oe,userMargin:re,marginDefault:xo,title:Lt,legend:kt,legendPosition:Rt,animate:qt,transitionProp:Gt,frameScheduler:Qt,clock:Kt,random:Zt,seed:Jt,paused:en,suspendWhenHidden:tn,themeDirtyRef:Ln}),jn=N(),$n=W(),{reducedMotionRef:Yn,responsiveRef:Xn,size:Vn,currentTheme:Gn,transition:qn,introEnabled:Un,tableId:Qn,rafRef:Kn,renderFnRef:Zn,scheduleRender:Jn,frameRuntime:to}=Fn;let no=Fn.margin;if(cn){const e=60,t={...Fn.margin};cn.top&&e>t.top&&(t.top=e),cn.bottom&&e>t.bottom&&(t.bottom=e),cn.left&&e>t.left&&(t.left=e),cn.right&&e>t.right&&(t.right=e),no=t}const oo=Vn[0]-no.left-no.right,ro=Vn[1]-no.top-no.bottom,so=nt(()=>ge(r),[r]),fo=Xe??lt,[go,wo]=et(0),Ao=Je(0),[So,_o]=et(null),To=kn(Dt,Vn,no,So),Co=kn(Wt,Vn,no,So),Po=Je(null),Ro=Je(null),Mo=Je(void 0),[No,Io]=et(null),Wo=Je(bo.primary),Do=Je(function(){let e=-1,t=xn;return{resolve(n){if(!n)return xn;const o=Ue();return o===e||(t=function(e){if(!e)return xn;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),s=t.getPropertyValue("--semiotic-primary").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return i||a||n||s?{axisStroke:l||xn.axisStroke,tickText:i||xn.tickText,crosshair:i?bn(i,"66"):xn.crosshair,hoverFill:c?bn(c,"4D"):xn.hoverFill,hoverStroke:i?bn(i,"99"):xn.hoverStroke,pointRing:c||xn.pointRing,primary:s||xn.primary,background:c||xn.background}:xn}(n),e=o),t},invalidate(){e=-1}}}()),Eo=Je(!1),zo=I("StreamXYFrame"),[Bo,Lo]=et(!1),[Oo,Ho]=et([]),[Fo,jo]=et([]),$o="streaming"===o||["bar","swarm","waterfall"].includes(n),Yo=pn(nt(()=>({chartType:n,runtimeMode:$o?"streaming":"bounded",windowSize:X,windowMode:Y,arrowOfTime:$o?$:"right",extentPadding:Z,scalePadding:J,axisExtent:je,xAccessor:a,yAccessor:l,accessorRevision:y,timeAccessor:$o?V:void 0,valueAccessor:j,colorAccessor:b,sizeAccessor:k,symbolAccessor:S,symbolMap:_,groupAccessor:T||(C?"_lineGroup":void 0),categoryAccessor:Ot,lineDataAccessor:C,xScaleType:hn,yScaleType:fn,xExtent:q,yExtent:U,sizeRange:ee,binSize:H,normalize:D,baseline:z,stackOrder:O,boundsAccessor:ke,boundsStyle:we,y0Accessor:Ae,band:Se,gradientFill:!0===_e?{topOpacity:.8,bottomOpacity:.05}:!1===_e?void 0:_e,areaGroups:Pe?new Set(Pe):void 0,lineGradient:Ce,openAccessor:Re,highAccessor:Me,lowAccessor:Ne,closeAccessor:Ie,candlestickStyle:We,lineStyle:le,pointStyle:ce,areaStyle:ue,swarmStyle:pe,waterfallStyle:he,colorScheme:be,barColors:me,barStyle:de,annotations:dt,decay:Xt,pulse:Vt,transition:qn,introAnimation:Un,staleness:Ut,clock:to.now,heatmapAggregation:nn,heatmapXBins:on,heatmapYBins:rn,showValues:sn,heatmapValueFormat:an,pointIdAccessor:un,curve:P,themeCategorical:Gn?.colors?.categorical,themeSemantic:Ke(Gn),themeSequential:Gn?.colors?.sequential,themeDiverging:Gn?.colors?.diverging,customLayout:Mn,onLayoutError:Nn,layoutConfig:In,layoutMargin:no}),[n,$o,X,Y,$,Z,J,je,a,l,y,V,j,b,k,S,_,T,C,Ot,hn,fn,q,U,ee,H,D,z,O,ke,we,Ae,Se,_e,Pe,Ce,Re,Me,Ne,Ie,We,le,ce,ue,pe,he,be,me,de,dt,Xt,Vt,qn,Un,Ut,to.now,nn,on,rn,sn,an,un,P,Gn,Mn,Nn,In,no])),Xo=Je(null);Xo.current||(Xo.current=new F(Yo));const Vo=function(e,t,n,o){const r=An({accessor:t,onChange:n,readData:o}),s=An([]);return r.current={accessor:t,onChange:n,readData:o},wn(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const s=e+"";n.has(s)||(n.add(s),o.push(s))}return o}(e.current?o(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,s.current)||(s.current=i,n(i))},[e])}(Xo,Nt,It,e=>e.getData());vt(Xo,Yo,Ln,Jn),xt(Xo,Wn,Ln,Jn);const Go=Je(null);Go.current||(Go.current=new pt(e=>{const t=Xo.current;t&&t.ingest(e)&&(Ln.current=!0,Jn())},{chunkThreshold:s,chunkSize:i})),tt(()=>{Go.current?.updateChunkOptions({chunkThreshold:s,chunkSize:i})},[s,i]);const qo=ot(e=>{Go.current?.push(e)},[]),Uo=ot(e=>{Go.current?.pushMany(e)},[]),Qo=ot(()=>{Go.current?.clear(),Xo.current?.clear(),Ln.current=!0,Jn()},[Jn]);rt(t,()=>({push:qo,pushMany:Uo,remove:e=>{Go.current?.flush();const t=Xo.current?.remove(e)??[];return t.length>0&&(Po.current&&t.some(e=>e===Po.current?.data)&&(Po.current=null,Io(null)),Ln.current=!0,Jn()),t},update:(e,t)=>{Go.current?.flush();const n=Xo.current?.update(e,t)??[];return n.length>0&&(Ln.current=!0,Jn()),n},clear:Qo,getData:()=>(Go.current?.flush(),Xo.current?.getData()??[]),getScales:()=>Xo.current?.scales??null,getExtents:()=>Xo.current?.getExtents()??null,getCustomLayout:()=>Xo.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Xo.current?.lastCustomLayoutFailure??null}),[qo,Uo,Qo,Jn]),tt(()=>{if(r){if(C&&so.length>0&&"object"==typeof so[0]&&null!==so[0]){const e="string"==typeof C?C:"coordinates";if(Array.isArray(so[0][e])){const t=[];for(const n of so){const o=n[e];if(Array.isArray(o)){const e=n.label||n.id||n.key;if(null!=e)for(const n of o)t.push({...n,_lineGroup:e});else for(const e of o)t.push(e)}}return void Go.current?.setBoundedData(t)}}Go.current?.setBoundedData(so)}},[r,so,C]);const{canvasRef:Ko,interactionCanvasRef:Zo}=M(Fn,{storeRef:Xo,dirtyRef:Ln,hydrated:jn,wasHydratingFromSSR:$n,cleanup:()=>Go.current?.clear(),canvasPaintDependencies:[n,oo,ro,De,ie,Wt,le,ae,zt,Jn]}),{hoverHandlerRef:Jo,hoverLeaveRef:er,onPointerMove:tr,onPointerLeave:nr}=Fn;Jo.current=e=>{if(!fo)return;const t=Ko.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-no.left,s=e.clientY-o.top-no.top;if(0>r||r>oo||0>s||s>ro)return void(Po.current&&(Po.current=null,Ro.current=null,Io(null),Dn&&(Dn(null),Ln.current=!0),Jn()));const i=Xo.current;if(!i||0===i.scene.length)return;const l=B(ct,e.pointerType),c=St(i.scene,r,s,l,i.quadtree,i.maxPointRadius),u="multi"===ut,d=()=>{Po.current&&(Po.current=null,Ro.current=null,Io(null),Dn&&Dn(null),Jn())};if(!c&&!u)return void d();const h=u||!c?r:c.x,p=u||!c?s:c.y,f=c?.datum?G(c.datum,i.resolvedRibbons):{},y=i.scales?.x?.invert,g="function"==typeof y?y(h):void 0;let m=E(f,h,p,null!=g?{xValue:g,xPx:h}:void 0);if(u&&i.scene.length>0&&i.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const s=_t(At(e.path,e.curve),t,n);if(null===s)continue;const i=Et(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[i]?e.datum[i]:e.datum,x:e.path[i][0],y:s,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const s=At(e.topPath,e.curve),i=At(e.bottomPath,e.curve),a=_t(s,t,n);if(null===a)continue;const l=_t(i,t,n),c=Et(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(i.scene,h,Math.max(l,oo));if(e.length>0){const t=i.scales.y.invert,o=Wo.current,r=y?y(h):h;if(c)m.xValue=r,m.xPx=h;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),m=E(e,h,p,{xValue:r,xPx:h})}m.allSeries=e.map(e=>{const r=t?t(e.y):e.y,s=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=s?r-s:r,valuePx:e.y,color:e.color||o,datum:G(e.datum,i.resolvedRibbons)}})}}c||m.allSeries?.length?(Po.current=m,Ro.current=c?.node??null,Io(m),Dn&&(Dn(m),Ln.current=!0),Jn()):d()},er.current=()=>{Po.current&&(Po.current=null,Ro.current=null,Io(null),Dn&&(Dn(null),Ln.current=!0),Jn())};const or=Je(()=>{});or.current=e=>{if(L(e.target))return;if(!En)return;const t=Ko.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-no.left,r=e.clientY-n.top-no.top;if(0>o||o>oo||0>r||r>ro)return void En(null);const s=Xo.current;if(!s||0===s.scene.length)return void En(null);const i=B(ct,Mo.current),a=St(s.scene,o,r,i,s.quadtree,s.maxPointRadius);if(!a)return void En(null);const l=a.datum||{},c=s.scales?.x?.invert,u="function"==typeof c?c(a.x):void 0;En(E(l,a.x,a.y,null!=u?{xValue:u,xPx:a.x}:void 0),{type:"activate",inputType:Te(Mo.current)})};const rr=ot(e=>or.current(e),[]),{kbFocusIndexRef:sr,focusedNavPointRef:ir,onKeyDown:ar}=(dr={storeRef:Xo,hoverRef:Po,hoveredNodeRef:Ro,setHoverPoint:Io,customHoverBehavior:Dn,customClickBehavior:En,scheduleRender:Jn},function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:s,scheduleRender:i,extractPoints:a,toHover:l}){const c=co(-1),u=co(null),d=co(null),h=lo(h=>{if(ve(h))return;const p=e.current;if(!p)return;const f=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),i()};if(0===p.scene.length)return void(0>c.current||f());let y;if(d.current?.version===p.version)y=d.current.graph;else{const e=a(p.scene);if(0===e.length)return void(0>c.current||f());y=uo(e),d.current={version:p.version,graph:y}}let g=c.current;if(y.flat.length>g||(f(),g=-1),("Enter"===h.key||" "===h.key)&&g>=0)return h.preventDefault(),void s(l(y.flat[g],p),{type:"activate",inputType:"keyboard"});if(0>g){if("Escape"===h.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(h.key))return;h.preventDefault(),c.current=0;const e=y.flat[0];u.current=e;const n=l(e,p);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void i()}const m=po(h.key,ho(y,g),y);if(null===m)return;if(h.preventDefault(),0>m)return void f();c.current=m;const v=y.flat[m];u.current=v;const x=l(v,p);t.current=x,o(x),r(x,{type:"focus",inputType:"keyboard"}),i()},[s,r,a,t,n,i,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}({...dr,extractPoints:yo,toHover:(e,t)=>function(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}({...e,datum:G(e.datum,t.resolvedRibbons)})})),lr=ot(e=>{Mo.current=e.pointerType,sr.current=-1,ir.current=null,tr(e)},[ir,sr,tr]),cr=ot(e=>{Mo.current="mouse",sr.current=-1,ir.current=null,tr({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[ir,sr,tr]),ur=ot(e=>{Mo.current=e.pointerType},[]);var dr;Zn.current=()=>{if(Kn.current=null,!to.isActive)return;const e=Ko.current,t=Zo.current;if(!e||!t)return;const o=Xo.current;if(!o)return;const r=to.now(),s=o.advanceTransition(Yn.current?r+1e6:r),i=!Yn.current&&s,c=On.current.w!==oo||On.current.h!==ro,u=Ln.current||s||c,d=o.consumeStylePaintPending();let h=!1;const p=o.getLastUpdateResult(),f=zo.current.beforeCompute(p,i);!u||i&&!c||(o.computeScene({width:oo,height:ro}),On.current={w:oo,h:ro},h=!0,Vo()),zo.current.afterCompute(f,h,c);const y=function(e,t,n,o){const r=o.current,s=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,i=!s&&e.hasActivePulsesAt(t),a=!(n||s||!i&&!r)&&e.refreshPulse(t);return o.current=i,{changed:a,pending:i}}(o,r,h,Hn),g=w(),m=Do.current.resolve(e);Wo.current=m.primary;const v=Ht(Ut,o.lastIngestTime>0?r-o.lastIngestTime:0),b=Ut&&v.isStale;if(u||d||y.changed){const t=A(e,Vn,no,g);if(t){if(t.clearRect(-no.left,-no.top,Vn[0],Vn[1]),Ut&&1>v.alpha&&(t.globalAlpha=v.alpha),vn(t,{background:ie,hasBackgroundGraphics:!!Wt,themeBackground:m.background,x:-no.left,y:-no.top,width:Vn[0],height:Vn[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,oo,ro),t.clip()),zt&&o.scales)for(const e of zt)t.save(),e(t,o.scene,o.scales,{width:oo,height:ro}),t.restore();const e=Mn?eo.custom:eo[n];Q({context:t,nodes:o.scene,renderMode:ae,pixelRatio:g,paintBuiltIn:n=>{if(e&&o.scales)for(const r of e)r(t,n,o.scales,{width:oo,height:ro})}}),t.restore(),Ut&&1>v.alpha&&(t.globalAlpha=1)}}const k=!!(fo&&Po.current&&o.scales),S=!!(Ro.current&&Array.isArray(Xe)&&Xe.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),_=k||S;if(_||Eo.current){const e=A(t,Vn,no,g);if(e&&(e.clearRect(-no.left,-no.top,Vn[0],Vn[1]),k&&Po.current&&function(e,t,n,o,r,s,i){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||i.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,o),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=i.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||i.primary,e.fill(),e.stroke())}else{const n=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(s)||i.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=i.pointRing,e.lineWidth=2,e.stroke()}}(e,Po.current,oo,ro,"object"==typeof fo?fo:{},Ro.current,m),S&&Ro.current&&Array.isArray(Xe))){const t=Xe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,r){if(!n)return;const s="group"in n?n.group:void 0;if(void 0!==s)for(const n of t){if("line"!==n.type)continue;if(n.group!==s)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,o.scene,Ro.current,t,m)}Eo.current=_}u&&e&&e.setAttribute("aria-label",x(o.scene,n+" chart"));const T=Ln.current;if(Ln.current=T&&i&&!h,T&&o.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!So||e(So.x.domain()[0])!==e(o.scales.x.domain()[0])||e(So.x.domain()[1])!==e(o.scales.x.domain()[1])||e(So.y.domain()[0])!==e(o.scales.y.domain()[0])||e(So.y.domain()[1])!==e(o.scales.y.domain()[1])||So.x.range()[0]!==o.scales.x.range()[0]||So.x.range()[1]!==o.scales.x.range()[1]||So.y.range()[0]!==o.scales.y.range()[0]||So.y.range()[1]!==o.scales.y.range()[1])&&_o(o.scales),cn){const e=o.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];Ho(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),jo(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((dt&&dt.length>0||Mn)&&(h||i))||!h&&33>r-Ao.current||(wo(e=>e+1),Ao.current=r),Ut?.showBadge&&Lo(!!b),(i||null!=o.activeTransition||y.pending)&&Jn()},Ft(Ut,Xo,Ln,Jn,Bo,Lo);const hr=nt(()=>{if(He||$e)return;const e=Xo.current;return e?.xIsDate&&So?Cn(So.x.domain()):void 0},[He,$e,So]),pr=He||$e||hr,fr=fo&&No?Ve?Ve(No):mo(io,{hover:No}):null,yr=fr?mo(p,{x:No.x,y:No.y,containerWidth:oo,containerHeight:ro,margin:no,className:"stream-frame-tooltip",children:fr}):null,gr=ir.current,mr=mo(f,{active:sr.current>=0,hoverPoint:No,margin:no,size:Vn,shape:gr?.shape,width:gr?.w,height:gr?.h}),vr=Sn(a,V,"__semiotic_resolvedX","__semiotic_resolvedTime"),xr=Sn(l,j,"__semiotic_resolvedY","__semiotic_resolvedValue"),br=vr.key,kr=xr.key,wr=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const s=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),s=t.fn&&t.key&&!(t.key in n);if(!o&&!s)return n;r=!0;const i={...n};return o&&(i[e.key]=e.fn(n)),s&&(i[t.key]=t.fn(n)),i});return r?s:o}}(vr,xr,dt&&dt.length>0||!1);if(xe||!jn&&$n){const e=Xo.current;e&&r&&(e.ingest({inserts:so,bounded:!0}),e.computeScene({width:oo,height:ro}));const t=e?.scene??[],n=e?.scales??null,o=kn(Dt,Vn,no,n),s=kn(Wt,Vn,no,n),i=pr||(()=>{if(e?.xIsDate&&n)return Cn(n.x.domain())})();return vo("div",{ref:Xn,className:"stream-xy-frame"+(se?" "+se:""),role:"img","aria-label":gn||("string"==typeof Lt?Lt:"XY chart"),style:{position:"relative",width:ne?"100%":Vn[0],height:oe?"100%":Vn[1]},children:[mo(m,{summary:_n}),vo("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vn[0],height:Vn[1],style:{position:"absolute",left:0,top:0},children:[mo("g",{transform:`translate(${no.left},${no.top})`,children:s}),vo("g",{transform:`translate(${no.left},${no.top})`,children:[ie&&mo("rect",{x:0,y:0,width:oo,height:ro,fill:ie}),Bt&&n&&Bt.map((e,o)=>mo(Ze.Fragment,{children:e(t,n,{width:oo,height:ro})},"svgpre-"+o)),t.map((e,t)=>K({node:e,index:t,renderMode:ae,fallback:()=>ze(e,t,Bn)})).filter(Boolean)]})]}),mo(dn,{width:oo,height:ro,totalWidth:Vn[0],totalHeight:Vn[1],margin:no,scales:n,showAxes:De,axes:Ee,xLabel:Be,yLabel:Le,yLabelRight:Oe,xFormat:i,yFormat:Fe||Ye,axisExtent:je,showGrid:bt,title:Lt,legend:kt,legendHoverBehavior:wt,legendClickBehavior:Tt,legendHighlightedCategory:Ct,legendIsolatedCategories:Pt,legendPosition:Rt,legendLayout:Mt,foregroundGraphics:yt(o,c(Xo.current?.customLayoutOverlays,Wn??null)),marginalGraphics:cn,xValues:[],yValues:[],annotations:dt,onAnnotationActivate:ft,onObservation:it??Qe,chartId:at,chartType:"StreamXYFrame",autoPlaceAnnotations:gt,svgAnnotationRules:mt,annotationFrame:0,xAccessor:br,yAccessor:kr,annotationData:wr(Xo.current?.getData()),pointNodes:Pn(Xo.current?.scene),curve:"string"==typeof P?P:void 0,linkedCrosshairName:Tn,linkedCrosshairSourceId:Rn})]})}return vo("div",{ref:Xn,className:"stream-xy-frame"+(se?" "+se:""),role:"group","aria-label":gn||("string"==typeof Lt?Lt:"XY chart"),tabIndex:0,style:{position:"relative",width:ne?"100%":Vn[0],height:oe?"100%":Vn[1],overflow:"visible",touchAction:ko(jt)},onKeyDown:ar,children:["production"!==process.env.NODE_ENV&&Xo.current&&mo(g,{store:Xo.current,diagnostics:zo.current}),yn&&mo(v,{tableId:Qn}),yn&&mo(u,{scene:Xo.current?.scene??[],chartType:n+" chart",tableId:Qn,chartTitle:"string"==typeof Lt?Lt:void 0}),mo(m,{summary:_n}),mo(d,{hoverPoint:No}),vo("div",{role:"img","aria-label":gn||("string"==typeof Lt?Lt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:fo?lr:void 0,onMouseMove:fo?cr:void 0,onPointerLeave:fo?nr:void 0,onMouseLeave:fo?nr:void 0,onPointerDown:fo||zn?ur:void 0,onClick:zn?rr:void 0,children:[mo(h,{size:Vn,margin:no,children:Co}),mo(ln,{width:oo,height:ro,totalWidth:Vn[0],totalHeight:Vn[1],margin:no,scales:So,showAxes:De,axes:Ee,showGrid:bt,xFormat:pr,yFormat:Fe||Ye,axisExtent:je}),mo("canvas",{ref:Ko,"aria-label":x(Xo.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),mo("canvas",{ref:Zo,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),mo(dn,{width:oo,height:ro,totalWidth:Vn[0],totalHeight:Vn[1],margin:no,scales:So,showAxes:De,axes:Ee,xLabel:Be,yLabel:Le,yLabelRight:Oe,xFormat:pr,yFormat:Fe||Ye,axisExtent:je,showGrid:bt,title:Lt,legend:kt,legendHoverBehavior:wt,legendClickBehavior:Tt,legendHighlightedCategory:Ct,legendIsolatedCategories:Pt,legendPosition:Rt,legendLayout:Mt,foregroundGraphics:yt(To,c(Xo.current?.customLayoutOverlays,Wn??null)),marginalGraphics:cn,xValues:Oo,yValues:Fo,annotations:dt,onAnnotationActivate:ft,onObservation:it??Qe,chartId:at,chartType:"StreamXYFrame",autoPlaceAnnotations:gt,svgAnnotationRules:mt,annotationFrame:go,xAccessor:br,yAccessor:kr,annotationData:wr(Xo.current?.getData()),pointNodes:Pn(Xo.current?.scene),curve:"string"==typeof P?P:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!mn({background:ie,hasBackgroundGraphics:!!Wt,themeBackground:Gn?.colors.background}),linkedCrosshairName:Tn,linkedCrosshairSourceId:Rn}),(jt||Yt)&&mo(ht,{width:oo,height:ro,totalWidth:Vn[0],totalHeight:Vn[1],margin:no,dimension:jt?.dimension??"xy",scales:So,onBrush:Yt??(()=>{}),binSize:H,snap:jt?.snap,binBoundaries:jt?.binBoundaries??("bar"===n?Xo.current?.getBinBoundaries():void 0),snapDuring:jt?.snapDuring,streaming:"streaming"===o}),Ut?.showBadge&&mo($t,{isStale:Bo,position:Ut.badgePosition}),mr,yr]})]})}));wo.displayName="StreamXYFrame";var Ao=wo;import{useRef as So,useState as _o,useEffect as To,useMemo as Co,useCallback as Po,useImperativeHandle as Ro,forwardRef as Mo,memo as No}from"react";var Io={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Wo={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},Do=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){const n=this._freeIndices.pop();if(void 0===n)return null;const o=this.particles[n];return o.active=!0,o.t=0,o.offset=t()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const s=this.particles[r];if(!s.active)continue;const i=n[s.edgeIndex];i&&i.bezier?(s.t+=e*t*(o?o[s.edgeIndex]??1:1)*(i.bezier.circular?.3:1),1>s.t?Eo(i.bezier,s.t,s.offset,s):(s.active=!1,this._freeIndices.push(r))):(s.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)t.length>n?this.particles[n]=t[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=e}};function Eo(e,t,n,o){if(e.circular&&e.segments)return void function(e,t,n,o,r){const s=e.length,i=t*s,a=Math.min(Math.floor(i),s-1),l=i-a,[c,u,d,h]=e[a];zo(c,u,d,h,l,r);const p=h.x-c.x,f=h.y-c.y,y=Math.sqrt(p*p+f*f);if(y>.001){const e=p/y;r.x+=-f/y*n*o*2,r.y+=e*n*o*2}}(e.segments,t,n,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);const[r,s,i,a]=e.points;zo(r,s,i,a,t,o);const l=a.x-r.x,c=a.y-r.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;o.x+=-c/u*n*e.halfWidth*2,o.y+=t*n*e.halfWidth*2}}function zo(e,t,n,o,r,s){const i=1-r,a=i*i,l=a*i,c=r*r,u=c*r;s.x=l*e.x+3*a*r*t.x+3*i*c*n.x+u*o.x,s.y=l*e.y+3*a*r*t.y+3*i*c*n.y+u*o.y}import{quadtree as Bo}from"d3-quadtree";function Lo(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 Oo(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!Ho(e))return!1;return!0}return Ho(t.points)}function Ho(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}import{interpolateNumber as Fo}from"d3-interpolate";var jo="rgba(34, 197, 94, 0.7)",$o=2e3,Yo=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Xo=["scene-style","data-paint","accessibility","evidence"],Vo=(e,t)=>({retainedData:e,invalidations:t}),Go=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],qo=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Uo=["scene-geometry","data-paint","overlay","accessibility","evidence"],Qo=["scene-style","data-paint","accessibility","evidence"],Ko=["scene-geometry","data-paint","overlay","accessibility","evidence"],Zo=[],Jo={chartType:Vo("rebuild",Go),nodeIDAccessor:Vo("rebuild",Go),sourceAccessor:Vo("rebuild",Go),targetAccessor:Vo("rebuild",Go),valueAccessor:Vo("rebuild",Go),edgeIdAccessor:Vo("rebuild",Go),childrenAccessor:Vo("rebuild",Go),hierarchySum:Vo("rebuild",Go),orientation:Vo("preserve",qo),nodeAlign:Vo("preserve",qo),nodePaddingRatio:Vo("preserve",qo),nodeWidth:Vo("preserve",qo),edgeSort:Vo("preserve",qo),iterations:Vo("preserve",qo),forceStrength:Vo("preserve",qo),padAngle:Vo("preserve",qo),groupWidth:Vo("preserve",qo),sortGroups:Vo("preserve",qo),treeOrientation:Vo("preserve",qo),edgeType:Vo("preserve",qo),padding:Vo("preserve",qo),paddingTop:Vo("preserve",qo),orbitMode:Vo("preserve",qo),orbitSize:Vo("preserve",qo),orbitSpeed:Vo("preserve",qo),orbitRevolution:Vo("preserve",qo),orbitRevolutionStyle:Vo("preserve",qo),orbitEccentricity:Vo("preserve",qo),orbitShowRings:Vo("preserve",qo),orbitAnimated:Vo("preserve",qo),customNetworkLayout:Vo("preserve",qo),layoutConfig:Vo("preserve",qo),nodeSize:Vo("preserve",Uo),nodeSizeRange:Vo("preserve",Uo),colorByDepth:Vo("preserve",Uo),nodeLabel:Vo("preserve",Ko),showLabels:Vo("preserve",Ko),labelMode:Vo("preserve",Ko),nodeStyle:Vo("preserve",Qo),edgeStyle:Vo("preserve",Qo),colorBy:Vo("preserve",Qo),colorScheme:Vo("preserve",Qo),themeCategorical:Vo("preserve",Qo),themeSemantic:Vo("preserve",Qo),edgeColorBy:Vo("preserve",Qo),edgeOpacity:Vo("preserve",Qo),showParticles:Vo("preserve",Qo),particleStyle:Vo("preserve",Qo),decay:Vo("preserve",Qo),pulse:Vo("preserve",Qo),thresholds:Vo("preserve",Qo),staleness:Vo("preserve",Qo),layoutSelection:Vo("preserve",Qo),clock:Vo("preserve",Zo),random:Vo("preserve",Zo),seed:Vo("preserve",Zo),tensionConfig:Vo("preserve",Zo),transition:Vo("preserve",Zo),introAnimation:Vo("preserve",Zo),onLayoutError:Vo("preserve",Zo),__skipForceSimulation:Vo("preserve",Zo),__hierarchyRoot:Vo("preserve",Zo),__orbitState:Vo("preserve",Zo),__previousPositions:Vo("preserve",Zo)},er=Vo("preserve",qo),tr=class{constructor(){this.tracker=new Oe}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Yo)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Xo):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=Jo[o]??er;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},nr=class e{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new tr,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=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._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...Io,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Do(2e3))}currentTime(){return this.config.clock?.()??_e()}updateConfig(e){const t=this.config,n={...t,...e};t.__orbitState&&(n.__orbitState=t.__orbitState),t.__hierarchyRoot&&(n.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(n.layoutSelection=t.layoutSelection);const o=[...new Set([...Object.keys(t),...Object.keys(n)])].filter(e=>t[e]!==n[e]);this.config=n,this.tensionConfig={...Io,...n.tensionConfig},!n.showParticles||"sankey"!==n.chartType&&!n.customNetworkLayout||this.particlePool||(this.particlePool=new Do(2e3)),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,n,o){const{nodeIDAccessor:r="id",sourceAccessor:s="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,l="function"==typeof r?r:e=>e[r],c="function"==typeof s?s:e=>e[s],u="function"==typeof i?i:e=>e[i],d="function"==typeof a?a:e=>e[a]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=l(t)+"";this.nodes.set(e,{...Lo(e),data:t})}for(let e=0;t.length>e;e++){const n=t[e],o=c(n)+"",r=u(n)+"",s=d(n),i=null==s?NaN:Number(s),a=Number.isFinite(i)?i:1;this.nodes.has(o)||this.nodes.set(o,{...Lo(o),data:n}),this.nodes.has(r)||this.nodes.set(r,{...Lo(r),data:n});const l=`${o}\0${r}\0${e}`,h={source:o,target:r,value:a,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:l};n&&"object"==typeof n&&Oo(n.bezier)&&(h.bezier=n.bezier),this.edges.set(l,h)}o?.deferLayout||this.runLayout(n),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,n,o){return this.ingestBounded(e,t,n,o),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,n]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=n.x,e.y=n.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let s=!1;const i=this.currentTime();this.lastIngestTime=i,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,Lo(t)),this.nodeTimestamps.set(t,i),this.tension+=this.tensionConfig.newNode,s=!0),this.nodes.has(n)||(this.nodes.set(n,Lo(n)),this.nodeTimestamps.set(n,i),this.tension+=this.tensionConfig.newNode,s=!0);const a=this.edgeKey(t,n),l=this.edges.get(a);let c=!1;l?(l.value+=o,this.edgeTimestamps.set(a,i),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,i),this.tension+=this.tensionConfig.newEdge,s=!0);const u=r||s||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=q(this.config.chartType);if(!t)return;let n=Array.from(this.nodes.values());const o=Array.from(this.edges.values());if(0===n.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of n)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):0===t.x&&0===t.y||e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(n,o,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of n)this.nodes.set(e.id,e);for(let e=0;o.length>e;e++){const t=o[e],n=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=n,this.edges.set(n,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const n=e.get(t.id);n&&(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,n=Array.from(this.nodes.values())}this.finalizeLayout();const r=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||r.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=r,this.saveTargetPositions();const s=n.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),i=this.config.transition?.duration??this.tensionConfig.transitionDuration,a=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&a&&n.length>0&&i>0){const t=e[0]/2,n=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=n,e._prevY1=n;for(const e of this.edges.values())e._prevY0=n,e._prevY1=n,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:i}}else s&&i>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:i});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){const t=function({nodes:e,edges:t,restyle:n,restyleEdge:o,baseStyles:r,selection:s}){const i=!(!n&&!o);if(n)for(const t of e){const e=r.get(t)??t.style,o=n(t,s);t.style=o?{...e,...o}:e}if(o)for(const e of t){const t=r.get(e)??e.style,n=o(e,s);e.style=n?{...t,...n}:t}return i}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){const t=function({config:e,customLayout:t,size:n,nodes:o,edges:r,previousResult:s,revision:i}){const a=Re(e.colorScheme,e.themeCategorical,Xe),l={nodes:o,edges:r,dimensions:{width:n[0],height:n[1],plot:{x:0,y:0,width:n[0],height:n[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...a]},resolveColor:ue(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const n=null!==s,o=X("network",t,n,i);"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t);try{e.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:o,preservedLastGoodScene:n}}}({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++));const n=t.result;return this.sceneNodes=n.sceneNodes??[],this.sceneEdges=n.sceneEdges??[],this.labels=n.labels??[],this.customLayoutOverlays=n.overlays??null,this.customLayoutHtmlMarks=n.htmlMarks??[],this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=n.restyle,this._customRestyleEdge=n.restyleEdge,this.hasCustomRestyle=!(!n.restyle&&!n.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const n=new WeakMap;for(const t of e)n.set(t,t.style);for(const e of t)n.set(e,e.style);return n}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void ne({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null;const t=q(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const n=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,o=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:r,sceneEdges:s,labels:i}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=s,this.labels=i,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,n=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxNodeRadius=n,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const o=Array(t);let r=0;for(const e of this.sceneNodes)"circle"===e.type&&(o[r++]=e);this._nodeQuadtree=Bo().x(e=>e.cx).y(e=>e.cy).addAll(o)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=q(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=q(this.config.chartType);if(!n?.tick)return!1;const o=n.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=n.hierarchical?Array.from(this.edges.values()):this.edgesArray;return n.tick(o,r,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=pe(e,this.transition),n=he(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=be(e._prevX0,e._targetX0,n),e.x1=be(e._prevX1,e._targetX1,n),e.y0=be(e._prevY0,e._targetY0,n),e.y1=be(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=be(e._prevY0,e._targetY0,n),e.y1=be(e._prevY1,e._targetY1,n),e.sankeyWidth=be(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const n=e?.get(t.id);n&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const n=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(n){e._prevY0=n.y0,e._prevY1=n.y1,e._prevSankeyWidth=n.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}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),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,n=.5){const o="string"==typeof e.source?t.get(e.source):e.source,r="string"==typeof e.target?t.get(e.target):e.target;!o||!r||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(!n)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],s=n.x-t.x,i=n.y-t.y;r.push([t,{x:t.x+s/3,y:t.y+i/3},{x:t.x+2*s/3,y:t.y+2*i/3},n])}return{circular:!0,segments:r,halfWidth:t}}(e):function(e,t,n,o=.5){const r=(e.sankeyWidth||1)/2;if("down"===e.direction){const s=t.x1,i=n.x0,a=Fo(s,i);return{circular:!1,points:[{x:e.y0,y:s},{x:e.y0,y:a(o)},{x:e.y1,y:a(1-o)},{x:e.y1,y:i}],halfWidth:r}}const s=t.x1,i=n.x0,a=Fo(s,i);return{circular:!1,points:[{x:s,y:e.y0},{x:a(o),y:e.y0},{x:a(1-o),y:e.y1},{x:i,y:e.y1}],halfWidth:r}}(e,o,r,n))}(e,this.nodes,.5)}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){!function(e){const t=e.pulse;if(!t)return;const n=t.duration??500,o=t.color??"rgba(255,255,255,0.6)",r=t.glowRadius??4,{now:s}=e;for(const t of e.sceneNodes){const i=t.id;if(!i)continue;const a=e.nodeTimestamps.get(i);if(!a)continue;const l=s-a;n>l&&(t._pulseIntensity=1-l/n,t._pulseColor=o,t._pulseGlowRadius=r)}for(const t of e.sceneEdges){const r=t.datum;if(!r)continue;const i="object"==typeof r.source?r.source?.id:r.source,a="object"==typeof r.target?r.target?.id:r.target;if(!i||!a)continue;const l=e.edgeTimestamps.get(`${i}\0${a}`);if(!l)continue;const c=s-l;n>c&&(t._pulseIntensity=1-c/n,t._pulseColor=o)}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){const t=e.decay;if(!t)return;const n=e.nodeTimestamps.size;if(1>=n)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const t=new Map;for(let n=0;e.cache.sortedNodes.length>n;n++)t.set(e.cache.sortedNodes[n][0],n);e.cache.ageMap=t}const o=e.cache.ageMap;for(const r of e.sceneNodes){const e=r.id;if(!e)continue;const s=o.get(e);if(void 0===s)continue;const i=Y(t,s,n);r.style={...r.style,opacity:(r.style?.opacity??1)*i}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===jo&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;const t=e.now-e.lastTopologyChangeTime;if(t>=$o)return;const n=1-t/$o;for(const t of e.sceneNodes){const o=t.id;o&&e.addedNodes.has(o)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,n),t._pulseColor=jo,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&$o>n-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const n=t.warningColor??"#f59e0b",o=t.criticalColor??"#ef4444",r=!1!==t.pulse;for(const s of e.sceneNodes){const i=s.id;if(!i)continue;const a=e.nodes.get(i);if(!a)continue;const l=t.metric(a);let c=null;void 0===t.critical||t.critical>l?void 0===t.warning||t.warning>l||(c=n):c=o,c&&(s.style={...s.style,fill:c},r&&(s._pulseIntensity=.6+.4*Math.sin(e.now/300),s._pulseColor=c,s._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const n of e){const e=t.metric(n);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){const t=e.pulse;if(!t||0===e.lastIngestTime)return!1;const n=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>n-e.lastIngestTime}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){const n=this.nodes.get(e);if(!n)return this.updateResults.recordNoop("update"),null;const o=n.data?{...n.data}:{};return n.data=t(n.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),o}updateEdge(e,t,n){const o=this.config.valueAccessor,r="function"==typeof o?o:o?e=>e[o]:e=>e.value,s=[];for(const[,o]of this.edges)if(("string"==typeof o.source?o.source:o.source.id)===e&&("string"==typeof o.target?o.target:o.target.id)===t){s.push(o.data?{...o.data}:{}),o.data=n(o.data??{});const e=r(o.data);null!=e&&(o.value=Number(e))}return s.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",s.length)):this.updateResults.recordNoop("update"),s}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){const n=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const o="function"==typeof t?t:e=>e?.[t];for(const[t,r]of this.edges)r.data&&o(r.data)===e&&n.push(t)}else for(const[o,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",n.length)):this.updateResults.recordNoop("remove"),n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};nr.QUADTREE_THRESHOLD=500;var or=nr;j(or);import*as rr from"react";import{Fragment as sr,jsx as ir,jsxs as ar}from"react/jsx-runtime";function lr(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:s,labels:i,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:p="right",legendLayout:f,foregroundGraphics:y,sceneNodes:g,annotations:m,onAnnotationActivate:v,onObservation:x,chartId:b,chartType:w,autoPlaceAnnotations:A,svgAnnotationRules:_}=e,C=H({onAnnotationActivate:v,onObservation:x,chartId:b,chartType:w}),P=rr.useMemo(()=>{const e=(g||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,n=e.cy??e.y;if("number"!=typeof t||"number"!=typeof n)return null;const o=$e(e.glyph,e.size);return{x:t+o.centerDx,y:n+o.centerDy,r:Math.max(1,o.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),n=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof n?null:{x:t,y:n,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,Ge(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),n=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:n,...t}]:[]});return{scales:null,width:t,height:n,frameType:"network",pointNodes:e,sceneNodes:g}},[n,g,t]),R=rr.useMemo(()=>m&&A?He({annotations:m,context:P,..."object"==typeof A?A:{}}):m,[m,A,P]),M=rr.useMemo(()=>k("network"),[]),N=R?S(R.filter(e=>"widget"!==e.type),M,_,P):null,I=!0===R?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return ar(sr,{children:[I&&ir("style",{children:se},"annotation-widget-disclosure-style"),ar("svg",{role:"img",width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[ir("title",{children:"string"==typeof a?a:"Network Chart"}),ir("desc",{children:"string"==typeof a?a+" (network data visualization)":"Network data visualization"}),ar("g",{transform:`translate(${s.left},${s.top})`,children:[i.map((e,t)=>ir("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),N,y]}),a&&"string"==typeof a?ir("text",{x:o/2,y:ae,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?ir("foreignObject",{x:0,y:0,width:o,height:s.top,children:a}):null,T({legend:l,totalWidth:o,totalHeight:r,margin:s,legendPosition:p,title:a,legendLayout:f,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),R?.filter(e=>"widget"===e.type&&e.nodeId&&g).map((e,t)=>{const n=!0===e._annotationDeferred,o=g.find(t=>t.id===e.nodeId||t.datum?.id===e.nodeId||t.datum?.data?.id===e.nodeId||t.datum?.data?.name===e.nodeId);if(!o)return null;const r=s.left+(o.cx??(null!=o.x&&null!=o.w?o.x+o.w/2:o.x??0)),i=s.top+(o.cy??(null!=o.y&&null!=o.h?o.y+o.h/2:o.y??0)),a=e.dx??0,l=e.dy??-16,c=e.width??32,u=e.height??32,d=e.content??ir("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return ir("div",{...D(e,C),className:n?"annotation-deferred":void 0,"data-annotation-disclosure":n?"deferred":void 0,style:{position:"absolute",left:r+a-c/2,top:i+l-u/2,width:c,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:d},"widget-"+t)})]})}lr.displayName="NetworkSVGOverlay";import*as cr from"react";import{jsx as ur}from"react/jsx-runtime";var dr={position:"absolute",top:0,left:0,pointerEvents:"none"};function hr({marks:e,margin:t,selection:n=null,overscan:o=400}){const s=cr.useRef(null),i=function(e,t,n){const[o,r]=cr.useState(null);return cr.useLayoutEffect(()=>{const e=t.current,n=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:n,overflowY:o}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${o} ${n}`))return t;t=t.parentElement}return null}(e);if(!e||!n)return void r(null);let o=0;const s=()=>{o=0;const t=n.getBoundingClientRect(),s=e.getBoundingClientRect();r(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:s.left,originY:s.top}:null)},i=()=>{0===o&&(o=window.requestAnimationFrame(s))};s(),n.addEventListener("scroll",i,{passive:!0});const a=new ResizeObserver(i);return a.observe(n),()=>{0!==o&&window.cancelAnimationFrame(o),n.removeEventListener("scroll",i),a.disconnect()}},[t,e,n]),cr.useMemo(()=>{if(!e||!o)return e;const{scroll:t,originX:r,originY:s}=o,i=t.left-n,a=t.right+n,l=t.top-n,c=t.bottom+n;return e.filter(e=>{const t=r+e.x,n=s+e.y;return!(i>t+e.width||t>a||l>n+e.height||n>c)})},[e,o,n])}(e,s,o);if(!e||0===e.length)return null;const a=ur("div",{className:"semiotic-network-html-marks",ref:s,style:{...dr,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>ur("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=n?ur(r,{value:n,children:a}):a}import{jsx as pr,jsxs as fr}from"react/jsx-runtime";function yr({props:e,store:t,responsiveRef:n,size:o,margin:r,adjustedWidth:s,adjustedHeight:i,resolvedBackground:a,resolvedForeground:l}){const{chartType:u,nodes:d,edges:h,data:p,className:f,description:y,title:g,responsiveWidth:v,responsiveHeight:x,summary:b,background:k,renderMode:w,legend:A,legendPosition:S,legendLayout:_,legendHoverBehavior:T,legendClickBehavior:C,legendHighlightedCategory:P,legendIsolatedCategories:R,layoutSelection:M,annotations:N,onAnnotationActivate:I,annotationObservationCallback:W,onObservation:D,chartId:E,autoPlaceAnnotations:z,svgAnnotationRules:B}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(u),n=e?p||(Array.isArray(h)?void 0:h):void 0;if(e&&n)t.ingestHierarchy(n,[s,i]),t.buildScene([s,i]);else{const e=ge(d),n=Array.isArray(h)?ge(h):[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[s,i]),t.buildScene([s,i]))}}const L=t?.sceneNodes??[],O=t?.sceneEdges??[],H=t?.labels??[];return fr("div",{ref:n,className:"stream-network-frame"+(f?" "+f:""),role:"img","aria-label":y||("string"==typeof g?g:"Network chart"),style:{position:"relative",width:v?"100%":o[0],height:x?"100%":o[1]},children:[pr(m,{summary:b}),fr("svg",{xmlns:"http://www.w3.org/2000/svg",width:o[0],height:o[1],style:{position:"absolute",left:0,top:0},children:[a&&pr("g",{transform:`translate(${r.left},${r.top})`,children:a}),fr("g",{transform:`translate(${r.left},${r.top})`,children:[k&&pr("rect",{x:0,y:0,width:s,height:i,fill:k}),O.map((e,t)=>K({node:e,index:t,renderMode:w,fallback:()=>we(e,t)})).filter(Boolean),L.map((e,t)=>K({node:e,index:t,renderMode:w,fallback:()=>Ae(e,t)})).filter(Boolean),H.map((e,t)=>ke(e,t)).filter(Boolean)]})]}),pr(lr,{width:s,height:i,totalWidth:o[0],totalHeight:o[1],margin:r,labels:H,sceneNodes:L,title:g,legend:A,legendPosition:S,legendLayout:_,legendHoverBehavior:T,legendClickBehavior:C,legendHighlightedCategory:P,legendIsolatedCategories:R,foregroundGraphics:yt(l,c(t?.customLayoutOverlays,M??null)),annotations:N,onAnnotationActivate:I,onObservation:W??D,chartId:E,chartType:"StreamNetworkFrame",autoPlaceAnnotations:z,svgAnnotationRules:B,annotationFrame:0}),pr(hr,{marks:t?.customLayoutHtmlMarks,margin:r,selection:M??null})]})}import{jsx as gr,jsxs as mr}from"react/jsx-runtime";var vr=/^(value|amount|total|count|weight|score)$/i;function xr({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?mr("div",{className:"semiotic-tooltip",style:z,children:[mr("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&mr("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const n=t.__hierarchyNode;if(n){const e=[];let o=n;for(;o;){const n=o.data?.name??o.data?.id??t.id;null!=n&&e.unshift(n+""),o=o.parent}e.length>1&&e.shift();const r=e.length-1;return mr("div",{className:"semiotic-tooltip",style:z,children:[gr("div",{children:e.map((e,t)=>mr("span",{children:[t>0&&gr("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===r?gr("strong",{children:e}):gr("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&gr("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const o=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),r=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),s=O(t.data??t),i=null!=s.title?s.title+"":t.id,a=s.entries.some(e=>vr.test(e.key));return mr("div",{className:"semiotic-tooltip",style:z,children:[gr("div",{style:{fontWeight:600},children:i}),s.entries.map(e=>{return mr("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")]},e.key);var t}),!a&&null!=t.value&&t.value>0&&mr("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),o>0&&mr("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",o,r!==o&&` (weighted: ${r.toLocaleString()})`]})]})}function br(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function kr(e,t){if(!t.pathD)return;e.save();const n=br(t);if(t.style.fill&&"none"!==t.style.fill){const o=t._gradient;if(o){const n=e.createLinearGradient(o.x0,0,o.x1,0),r=t.style.fillOpacity??t.style.opacity??.5,s="string"==typeof t.style.fill?t.style.fill:"#999",i=Qe(e,s)||s;n.addColorStop(0,1===o.from?i:"transparent"),n.addColorStop(1,1===o.to?i:"transparent"),e.fillStyle=n,e.globalAlpha=r}else e.fillStyle=Ce(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(n)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(n)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(n)),e.restore()}function wr(e,t){e.save();const n=t.style.stroke||"#999";e.strokeStyle=Qe(e,n)||n,e.lineWidth=t.style.strokeWidth??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=(t.style.strokeWidth??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 Ar(e,t){if(!t.pathD)return;e.save();const n=br(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Ce(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(n)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(n)),e.restore()}function Sr(e,t){if(!t.pathD)return;e.save();const n=br(t),o=t.style.stroke||"#999";e.strokeStyle=Qe(e,o)||o,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(n),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Ce(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(n)),e.restore()}xr.ownsChrome=!0;var _r=new Map;function Tr(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=_r.get(t);return n||(n=new Path2D(Ve(e.symbolType,e.size)),_r.size>256&&_r.clear(),_r.set(t,n)),n}catch{return null}}function Cr(e){const{sceneNodes:t,nodes:n,nodeColorMap:o,colorScheme:r}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&o.set(e.id,e.style.fill);const s=Array.isArray(r)?r:ie,i=Array.from(n);for(let e=0;i.length>e;e++){const t=i[e];o.has(t.id)||o.set(t.id,s[e%s.length])}return i.length}function Pr(n,r,s,i=30){switch(n.type){case"circle":return function(t,n,o,r=30){const s=n-t.cx,i=o-t.cy,a=Math.sqrt(s*s+i*i);return a>e(t.r,r)?null:{type:"node",datum:t.datum,x:t.cx,y:t.cy,distance:a}}(n,r,s,i);case"rect":return function(e,n,o){const r=t(n,o,e);return r.hit?{type:"node",datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}(n,r,s);case"arc":return function(e,t,n){const r=t-e.cx,s=n-e.cy,i=Math.sqrt(r*r+s*s);if(e.innerR-2>i||i>e.outerR+2)return null;const a=o(Math.atan2(s,r)),l=o(e.startAngle),c=o(e.endAngle);if(l>c?a>=l||c>=a:a>=l&&c>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(n,r,s);case"symbol":return function(t,n,o,r=30){const s=n-t.cx,i=o-t.cy,a=Math.sqrt(s*s+i*i);return a>e(Ge(t.size),r)?null:{type:"node",datum:t.datum,x:t.cx,y:t.cy,distance:a}}(n,r,s,i);case"glyph":return function(t,n,o,r=30){if(null==t.datum)return null;const s=$e(t.glyph,t.size),i=t.cx+s.centerDx,a=t.cy+s.centerDy,l=n-i,c=o-a,u=Math.sqrt(l*l+c*c);return u>e(s.radius,r)?null:{type:"node",datum:t.datum,x:i,y:a,distance:u}}(n,r,s,i);default:return null}}var Rr=null,Mr=null;function Nr(){return Mr||((Rr=document.createElement("canvas")).width=1,Rr.height=1,Mr=Rr.getContext("2d")),Mr}function Ir(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function Wr(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const o=Ir(e),r=Nr();if(!o||!r)return null;try{if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const s=r.lineWidth;r.lineWidth=10;const i=r.isPointInStroke(o,t,n);if(r.lineWidth=s,i)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch{}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,s=o*o+r*r;if(0===s)return null;let i=((t-e.x1)*o+(n-e.y1)*r)/s;i=Math.max(0,Math.min(1,i));const a=e.x1+i*o,l=e.y1+i*r,c=Math.sqrt((t-a)**2+(n-l)**2);return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const o=Ir(e),r=Nr();if(!o||!r)return null;try{if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const s=r.lineWidth;r.lineWidth=10;const i=r.isPointInStroke(o,t,n);if(r.lineWidth=s,i)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch{}return null}(e,t,n);default:return null}}function Dr(e){const{clientX:t,clientY:n,canvasRect:o,margin:r,adjustedWidth:s,adjustedHeight:i,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:u,hitRadius:d=30}=e,h=t-o.left-r.left,p=n-o.top-r.top;if(0>h||h>s||0>p||p>i)return{kind:"miss-outside"};const f=function(e,t,n,o,r=30,s,i=0){let a=null,l=r,c=1/0;if(s){const e=bt(s,n,o,r,i,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(s&&"circle"===t.type)continue;const e=Pr(t,n,o,r);if(e)if("rect"===t.type){const n=t.w*t.h;c>n&&(a=e,c=n)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=Wr(e,n,o);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,h,p,d,c,u);return f?{kind:"hit",hover:E(f.datum||{},f.x,f.y,{nodeOrEdge:f.type})}:{kind:"miss"}}import{useCallback as Er}from"react";var zr="StreamNetworkFrame";import{jsx as Br,jsxs as Lr}from"react/jsx-runtime";var Or={top:20,right:80,bottom:20,left:80},Hr={top:40,right:40,bottom:40,left:40},Fr=new Set(["chord","force","circlepack","orbit"]),jr=[800,600],$r=No(Mo(function(e,t){const{chartType:n,nodes:o,edges:r,data:u,initialEdges:x,nodeIDAccessor:k="id",sourceAccessor:S="source",targetAccessor:_="target",valueAccessor:T="value",edgeIdAccessor:D,childrenAccessor:z,hierarchySum:B,orientation:O="horizontal",nodeAlign:H="justify",nodePaddingRatio:F=.05,nodeWidth:j=15,iterations:$=300,forceStrength:Y=.1,layoutExecution:X="auto",layoutLoadingContent:V,onLayoutStateChange:G,padAngle:q=.01,groupWidth:U=20,sortGroups:K,edgeSort:Z,treeOrientation:J="vertical",edgeType:ee="curve",padding:te,paddingTop:ne,tensionConfig:oe,showParticles:re=!1,particleStyle:se,renderMode:ae,nodeStyle:le,edgeStyle:ce,colorBy:ue,colorScheme:de="category10",edgeColorBy:he="source",edgeOpacity:pe=.5,colorByDepth:me=!1,nodeSize:be=8,nodeSizeRange:ke=[5,20],nodeLabel:we,showLabels:Ae=!0,labelMode:Se,size:_e=jr,responsiveWidth:Pe,responsiveHeight:Re,margin:Me,className:Ne,background:Ie,enableHover:We=!0,tooltipContent:De,customHoverBehavior:Ee,customClickBehavior:ze,onObservation:Be,annotationObservationCallback:Le,chartId:Oe,onTopologyChange:He,annotations:Fe,onAnnotationActivate:je,autoPlaceAnnotations:Ye,svgAnnotationRules:Xe,legend:Ve,legendPosition:Ge,legendLayout:qe,legendHoverBehavior:Ue,legendClickBehavior:Ze,legendHighlightedCategory:Je,legendIsolatedCategories:et,title:tt,foregroundGraphics:nt,backgroundGraphics:ot,decay:rt,pulse:st,transition:it,animate:at,staleness:lt,frameScheduler:ct,clock:ut,random:dt,seed:ht,paused:pt=!1,suspendWhenHidden:ft=!0,thresholds:gt,accessibleTable:mt=!0,description:bt,summary:kt,orbitMode:wt,orbitSize:At,orbitSpeed:St,orbitRevolution:_t,orbitRevolutionStyle:Tt,orbitEccentricity:Ct,orbitShowRings:Pt,orbitAnimated:Rt,customNetworkLayout:Mt,onLayoutError:Nt,layoutConfig:It,layoutSelection:Wt}=e,Dt=Fr.has(n)?Hr:Or,Et=So(!0),zt=R({sizeProp:_e,responsiveWidth:Pe,responsiveHeight:Re,userMargin:Me,marginDefault:Dt,title:tt,legend:Ve,legendPosition:Ge,foregroundGraphics:nt,backgroundGraphics:ot,animate:at,transitionProp:it,frameScheduler:ct,clock:ut,random:dt,seed:ht,paused:pt,suspendWhenHidden:ft,themeDirtyRef:Et}),{reducedMotionRef:Bt,responsiveRef:Lt,size:Ot,margin:Ht,adjustedWidth:jt,adjustedHeight:Yt,resolvedForeground:Xt,resolvedBackground:Vt,transition:Gt,introEnabled:qt,tableId:Ut,rafRef:Qt,renderFnRef:Kt,scheduleRender:Zt,frameRuntime:Jt,currentTheme:en}=zt,tn=N(),nn=W(),on=Co(()=>ge(o),[o]),rn=Co(()=>Array.isArray(r)?ge(r):r,[r]),sn=Co(()=>({...Io,...oe}),[oe]),an=Co(()=>({...Wo,...se}),[se]),ln=Co(()=>{return{chartType:(e={chartType:n,clock:Jt.now,random:dt,seed:ht,nodeIDAccessor:k,sourceAccessor:S,targetAccessor:_,valueAccessor:T,edgeIdAccessor:D,childrenAccessor:z,hierarchySum:B,orientation:O,nodeAlign:H,nodePaddingRatio:F,nodeWidth:j,iterations:$,forceStrength:Y,padAngle:q,groupWidth:U,sortGroups:K,edgeSort:Z,treeOrientation:J,edgeType:ee,padding:te,paddingTop:ne,tensionConfig:sn,showParticles:re,particleStyle:an,nodeStyle:le,edgeStyle:ce,nodeLabel:we,showLabels:Ae,labelMode:Se,colorBy:ue,colorScheme:de,edgeColorBy:he,edgeOpacity:pe,colorByDepth:me,nodeSize:be,nodeSizeRange:ke,decay:rt,pulse:st,transition:Gt,introAnimation:qt,staleness:lt,thresholds:gt,orbitMode:wt,orbitSize:At,orbitSpeed:St,orbitRevolution:_t,orbitRevolutionStyle:Tt,orbitEccentricity:Ct,orbitShowRings:Pt,orbitAnimated:Rt,customNetworkLayout:Mt,onLayoutError:Nt,layoutConfig:It,currentTheme:en}).chartType,clock:e.clock,random:e.random,seed:e.seed,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:Ke(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[n,Jt.now,dt,ht,k,S,_,T,D,z,B,O,H,F,j,$,Y,q,U,K,Z,J,ee,te,ne,sn,re,an,le,ce,we,Ae,Se,ue,de,he,pe,me,be,ke,rt,st,Gt,qt,lt,gt,wt,At,St,_t,Tt,Ct,Pt,Rt,Mt,Nt,It,en]),cn=pn(ln),un=pn({chartType:(dn={chartType:n,nodeIDAccessor:k,sourceAccessor:S,targetAccessor:_,valueAccessor:T,edgeIdAccessor:D,childrenAccessor:z,hierarchySum:B,orientation:O,nodeAlign:H,nodePaddingRatio:F,nodeWidth:j,iterations:$,forceStrength:Y,padAngle:q,groupWidth:U,sortGroups:K,edgeSort:Z,treeOrientation:J,edgeType:ee,padding:te,paddingTop:ne,random:dt,seed:ht,tensionConfig:sn,customNetworkLayout:Mt,orbitMode:wt,orbitSize:At,orbitEccentricity:Ct}).chartType,nodeIDAccessor:dn.nodeIDAccessor,sourceAccessor:dn.sourceAccessor,targetAccessor:dn.targetAccessor,valueAccessor:dn.valueAccessor,edgeIdAccessor:dn.edgeIdAccessor,childrenAccessor:dn.childrenAccessor,hierarchySum:dn.hierarchySum,orientation:dn.orientation,nodeAlign:dn.nodeAlign,nodePaddingRatio:dn.nodePaddingRatio,nodeWidth:dn.nodeWidth,iterations:dn.iterations,forceStrength:dn.forceStrength,padAngle:dn.padAngle,groupWidth:dn.groupWidth,sortGroups:dn.sortGroups,edgeSort:dn.edgeSort,treeOrientation:dn.treeOrientation,edgeType:dn.edgeType,padding:dn.padding,paddingTop:dn.paddingTop,random:dn.random,seed:dn.seed,tensionConfig:dn.tensionConfig,customNetworkLayout:dn.customNetworkLayout,orbitMode:dn.orbitMode,orbitSize:dn.orbitSize,orbitEccentricity:dn.orbitEccentricity});var dn;const hn=So(0),fn=So(0),yn=So(!1),gn=So(null);gn.current||(gn.current=new or(cn));const mn=I("StreamNetworkFrame"),xn=Po((e,t,n=!1)=>P(mn.current,e,()=>e.buildScene(t),n),[mn]),[bn,kn]=_o(null),[wn,An]=_o(0),[Sn,_n]=_o(0),[Tn,Cn]=_o(!1),[Pn,Rn]=_o(!1),Mn=So(0),Nn=So(null),In=So(!1),Wn=So(G);Wn.current=G;const zn=So(cn);zn.current=cn;const Bn=So(null),Ln=So(new Map),On=So(0),Hn=Po(e=>function(e){const{node:t,colorBy:n,colorScheme:o,nodeColorMap:r,colorIndexRef:s}=e;if("function"==typeof n)return n(t)+"";if("string"==typeof n&&t.data){const e=t.data[n];if(void 0!==e){if(!r.has(e+"")){const t=Array.isArray(o)?o:ie;r.set(e+"",t[s.current++%t.length])}return r.get(e+"")}}if(r.has(t.id))return r.get(t.id);const i=Array.isArray(o)?o:ie,a=n?i[s.current++%i.length]:i[0];return r.set(t.id,a),a}({node:e,colorBy:ue,colorScheme:de,nodeColorMap:Ln.current,colorIndexRef:On}),[ue,de]),Fn=(jn=en,jn?.colors?.border||jn?.colors?.secondary||jn?.colors?.primary||"#999");var jn;const $n=Po(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,gn.current?.nodes),[]),Yn=Po(e=>function(e){const{edge:t,edgeColorBy:n,getNodeColor:o,resolveEndpoint:r,fallback:s}=e;if("function"==typeof n)return n(t);const i=r(t.source),a=r(t.target);return"target"===n&&a?o(a):i?o(i):s}({edge:e,edgeColorBy:he,getNodeColor:Hn,resolveEndpoint:$n,fallback:Fn}),[he,Hn,Fn,$n]),Vn=Po(e=>function(e){const{edge:t,particleStyleColor:n,particleColorBy:o,hasExplicitParticleColorBy:r,getEdgeColor:s,getNodeColor:i,resolveEndpoint:a,fallback:l}=e;if("function"==typeof n){const e=a(t.source);return e?n(t,e):l}if(!r)return s(t);const c=o,u=a(t.source),d=a(t.target);return"target"===c&&d?i(d):u?i(u):l}({edge:e,particleStyleColor:an.color,particleColorBy:an.colorBy,hasExplicitParticleColorBy:!!se?.colorBy,getEdgeColor:Yn,getNodeColor:Hn,resolveEndpoint:$n,fallback:Fn}),[se?.colorBy,an.color,an.colorBy,Hn,Yn,Fn,$n]),Gn=function(e,t,n,o,r){return("sankey"===e||t)&&n||o||r}(n,!!Mt,re,!!st,gn.current?.isAnimating??!1);vt(gn,cn,Et,Zt),xt(gn,Wt,Et,Zt),To(()=>{const e=gn.current;e&&(xn(e,[jt,Yt]),On.current=Cr({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Ln.current,colorScheme:de}),Et.current=!0,Zt())},[en,jt,Yt,xn,Zt,de]);const qn=Po(()=>{const e=gn.current;if(e&&(e.runLayout([jt,Yt]),xn(e,[jt,Yt]),Et.current=!0,On.current=Cr({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Ln.current,colorScheme:de}),An(e.layoutVersion),He)){const{nodes:t,edges:n}=e.getLayoutData();He(t,n)}},[jt,Yt,xn,He,de]),Un=Po(e=>{if(null==e||"object"!=typeof e)return;const t=gn.current;t&&(t.ingestEdge(e)&&qn(),Zt())},[qn,Zt]),Qn=Po(e=>{const t=gn.current;if(!t)return;let n=!1;for(const o of e)null!=o&&"object"==typeof o&&t.ingestEdge(o)&&(n=!0);n&&qn(),Zt()},[qn,Zt]),Kn=Po(()=>{gn.current?.clear(),Ln.current.clear(),On.current=0,An(gn.current?.layoutVersion??0),kn(null),Bn.current=null,Et.current=!0,Zt()},[Zt]),Zn=Po(()=>{const e=gn.current;e&&(e.tension+=999,qn(),Zt())},[qn,Zt]);Ro(t,()=>({push:Un,pushMany:Qn,removeNode:e=>{const t=gn.current?.removeNode(e)??!1;if(t){const t=Bn.current?.data?"function"==typeof k?k(Bn.current.data):Bn.current.data[k]:void 0;Bn.current&&"node"===Bn.current.nodeOrEdge&&t===e&&(Bn.current=null,kn(null)),Ln.current.delete(e),qn(),Et.current=!0,Zt()}return t},removeEdge:(e,t)=>{const n=gn.current?.removeEdge(e,t)??!1;if(n){if(Bn.current&&"edge"===Bn.current.nodeOrEdge){const n=Bn.current.data;let o;o=void 0!==t?("object"==typeof n?.source?n.source.id:n?.source)===e&&("object"==typeof n?.target?n.target.id:n?.target)===t:!D||!n||("function"==typeof D?D:e=>e?.[D])(n)===e,o&&(Bn.current=null,kn(null))}qn(),Et.current=!0,Zt()}return n},updateNode:(e,t)=>{const n=gn.current?.updateNode(e,t)??null;return n&&(Et.current=!0,Zt()),n},updateEdge:(e,t,n)=>{const o=gn.current?.updateEdge(e,t,n)??[];return o.length>0&&(qn(),Et.current=!0,Zt()),o},clear:Kn,getTopology:()=>gn.current?.getLayoutData()??{nodes:[],edges:[]},getCustomLayout:()=>gn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>gn.current?.lastCustomLayoutFailure??null,getTopologyDiff:()=>{const e=gn.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:Zn,getTension:()=>gn.current?.tension??0}),[Un,Qn,Kn,Zn,k,qn,Zt,D]);const Jn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(n),eo=Jn?u||(Array.isArray(r)?void 0:r):void 0;To(()=>{const e=gn.current;if(!e)return;const t=++Mn.current;if(Nn.current?.abort(),Nn.current=null,Jn&&eo)e.ingestHierarchy(eo,[jt,Yt]),xn(e,[jt,Yt]),Rn(!1),Wn.current?.("ready"),Et.current=!0,Zt();else{const c=on,u=Array.isArray(rn)?rn:[];if(0===c.length&&0===u.length)return null==o&&null==r||0>=e.nodes.size&&0>=e.edges.size||Kn(),Rn(!1),void Wn.current?.("ready");const d=[jt,Yt],h="force"===n&&!Mt&&s()&&!dt&&l(X,c.length,u.length,$);if(h&&nn&&!In.current&&e.sceneNodes.length>0)return In.current=!0,Rn(!1),Wn.current?.("ready"),Et.current=!0,void Zt();if(h){const n=new AbortController;Nn.current=n;const o=e._lastPositionSnapshot;e.ingestBounded(c,u,d,{deferLayout:!0});const r=e.getLayoutData(),s=i(r.nodes,r.edges,zn.current,d,o);return Rn(!0),Wn.current?.("pending"),a(s,n.signal).then(({positions:n})=>{t===Mn.current&&(e.applyForceLayoutPositions(n,d),xn(e,d),On.current=Cr({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Ln.current,colorScheme:de}),Rn(!1),Wn.current?.("ready"),An(e.layoutVersion),Et.current=!0,Zt())}).catch(n=>{"AbortError"!==n.name&&t===Mn.current&&(e.runLayout(d),xn(e,d),On.current=Cr({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Ln.current,colorScheme:de}),Rn(!1),Wn.current?.("error"),An(e.layoutVersion),Et.current=!0,Zt())}),()=>n.abort()}e.ingestBounded(c,u,d),xn(e,d),Rn(!1),Wn.current?.("ready"),On.current=Cr({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Ln.current,colorScheme:de}),Et.current=!0,Zt()}},[on,rn,o,r,u,eo,Jn,jt,Yt,un,X,$,nn,n,Mt,dt,Zt,Kn,de,xn]),To(()=>{x&&x.length>0&&Qn(x)},[x,Qn]);const{customHoverBehavior:to,customClickBehavior:no}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o}){return{customHoverBehavior:Er((t,r)=>{e?.(t,r),ye({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:zr,chartId:o,context:r})},[e,n,o]),customClickBehavior:Er((e,r)=>{t?.(e,r),fe({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:zr,chartId:o,context:r})},[t,n,o])}}({customHoverBehavior:Ee,customClickBehavior:ze,onObservation:Be,chartId:Oe}),{hoverHandlerRef:oo,hoverLeaveRef:ro,onPointerMove:so,onPointerLeave:io}=zt,ao=()=>!Mt||(gn.current?.hasCustomRestyle??!1);oo.current=e=>{if(!We)return;const t=ao(),n=bo.current;if(!n)return;const o=gn.current;if(!o)return;const r=Dr({clientX:e.clientX,clientY:e.clientY,canvasRect:n.getBoundingClientRect(),margin:Ht,adjustedWidth:jt,adjustedHeight:Yt,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===r.kind?(Bn.current=r.hover,kn(r.hover),to&&(to(r.hover),t&&(Et.current=!0)),t&&Zt()):Bn.current&&(Bn.current=null,kn(null),to&&(to(null),t&&(Et.current=!0)),t&&Zt())},ro.current=()=>{if(Bn.current){const e=ao();Bn.current=null,kn(null),to&&(to(null),e&&(Et.current=!0)),e&&Zt()}};const lo=So(()=>{});lo.current=e=>{if(L(e.target))return;if(!ze&&!Be)return;const t=bo.current;if(!t)return;const n=gn.current;if(!n)return;const o=Dr({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:Ht,adjustedWidth:jt,adjustedHeight:Yt,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===o.kind?no(o.hover,{type:"activate",inputType:Te(e.nativeEvent.pointerType)}):"miss"===o.kind&&no(null)};const co=Po(e=>lo.current(e),[]),fo=So(-1),yo=So(null),mo=So(-1),vo=Po(e=>{if(ve(e))return;const t=gn.current;if(!t)return;const n=()=>{fo.current=-1,yo.current=null,mo.current=-1,Bn.current=null,kn(null),to&&(to(null),Et.current=!0),Zt()},o=function(e){const t=[];for(const n of e)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const e=$e(n.glyph,n.size);t.push({x:n.cx+e.centerDx,y:n.cy+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:n.datum?.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===o.length)return void(0>fo.current||n());const r=uo(o);let s=fo.current;if(r.flat.length>s||(n(),s=-1)," "===e.key&&s>=0){e.preventDefault();const t=r.flat[s];return void no(E(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>s){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),fo.current=0,mo.current=-1;const t=r.flat[0];yo.current={shape:t.shape,w:t.w,h:t.h};const n=E(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Bn.current=n,kn(n),to&&(to(n,{type:"focus",inputType:"keyboard"}),Et.current=!0),void Zt()}const i=ho(r,s),a=function(e,t,n,o,r){const s=n.flat[t.flatIndex];if(!s)return po(e,t,n);const i=s.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=function(e,t,n){let o=null,r=1/0;for(let s=0;e.flat.length>s;s++){const i=e.flat[s];if(i===t)continue;const a=i.x-t.x,l=i.y-t.y;let c=!1;switch(n){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;r>u&&(r=u,o=s)}return o}(n,s,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return o!==t.flatIndex&&(r.current=-1),o}case"Enter":{if(null==i)return t.flatIndex;const e=function(e,t){const n=e+"",o=[];for(const e of t){const t=e.datum??e,r=go(t.source),s=go(t.target),i=null!=r,a=null!=s;i&&r+""===n&&a?o.push(s+""):a&&s+""===n&&i&&o.push(r+"")}return o}(i,o);if(0===e.length)return t.flatIndex;const s=n.idToIdx.get(e[(r.current+1)%e.length])??-1;return 0>s?t.flatIndex:(r.current=-1,s)}default:{const o=po(e,t,n);return null!==o&&o!==t.flatIndex&&(r.current=-1),o}}}(e.key,i,r,t.sceneEdges??[],mo);if(null===a)return;if(e.preventDefault(),0>a)return void n();fo.current=a;const l=r.flat[a];yo.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Bn.current=c,kn(c),to&&(to(c,{type:"focus",inputType:"keyboard"}),Et.current=!0),Zt()},[no,to,Zt]),xo=Po(e=>{fo.current=-1,yo.current=null,so(e)},[so]);Kt.current=()=>{if(Qt.current=null,!Jt.isActive)return;const e=bo.current;if(!e)return;const t=gn.current;t&&function(e){const{canvas:t,store:n,sceneRevisionDiagnostics:o,size:r,margin:s,adjustedWidth:i,adjustedHeight:a,background:l,renderMode:c,hasBackgroundGraphics:u=!1,dirtyRef:d,lastFrameTimeRef:h,now:p,random:f,reducedMotion:y,showParticles:g,isContinuous:m,animate:v,decay:x,pulse:k,thresholds:S,staleness:_,particleStyle:T,getParticleColor:C,pendingAnnotationFrameRef:P,lastAnnotationFrameTimeRef:R,setAnnotationFrame:M,scheduleNextFrame:N}=e,I=t.getContext("2d");if(!I)return;const W=h.current?Math.min((p-h.current)/1e3,.1):.016;h.current=p;const D=n.advanceTransition(y?p+1e6:p),E=!y&&D,z=!y&&n.tickAnimation([i,a],W),B=d.current,L=o?.beforeCompute(n.getLastUpdateResult(),E),O=D||B||z;O&&n.buildScene([i,a]),L&&o?.afterCompute(L,O,!1);const H=g&&!y&&!!n.particlePool,F=!!((j={dirtyOrRebuilt:B,transitioning:E,animationTicked:z,continuous:H||m,liveEncoding:!!x||!!k||!!S||!1!==v&&n.hasActiveTopologyDiff||n.hasActivePulses||n.hasActiveThresholds,forced:n.consumeStylePaintPending()}).dirtyOrRebuilt||j.transitioning||j.animationTicked||j.continuous||j.liveEncoding||j.forced);var j;const $=!!_&&n.lastIngestTime>0&&p-n.lastIngestTime>(_?.threshold??5e3);if(F){const e=w();if(!A(t,r,s,e))return;if(I.clearRect(-s.left,-s.top,r[0],r[1]),vn(I,{background:l,hasBackgroundGraphics:u,width:i,height:a}),x&&n.applyDecay(),k&&n.applyPulse(p),S&&n.applyThresholds(p),!1!==v&&n.applyTopologyDiff(p),$&&(I.globalAlpha=_?.dimOpacity??.5),Q({context:I,nodes:n.sceneEdges,renderMode:c,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const n of t)switch(n.type){case"bezier":kr(e,n);break;case"line":wr(e,n);break;case"ribbon":Ar(e,n);break;case"curved":Sr(e,n)}}(I,e)}),Q({context:I,nodes:n.sceneNodes,renderMode:c,pixelRatio:e,paintBuiltIn:e=>{const t=e;!function(e,t){for(const n of t){if("rect"!==n.type)continue;const t=n;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=Ce(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.strokeRect(t.x,t.y,t.w,t.h)),Dn(e,t),e.restore())}}(I,t),function(e,t){for(const n of t){if("circle"!==n.type)continue;const t=n;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=Ce(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),En(e,t),e.restore())}}(I,t),function(e,t){for(const n of t){if("arc"!==n.type)continue;const t=n;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=Ce(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(I,t),function(e,t){const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=Tr(t);if(!r)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const s=t.style.opacity??1;t.style.fill&&(e.globalAlpha=n*s*(t.style.fillOpacity??1),e.fillStyle=Ce(e,t.style.fill,"#007bff"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*s,e.strokeStyle=Qe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}}(I,t),function(e,t){const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Xn(e,o,o.cx,o.cy,n);e.globalAlpha=n}(I,t)}}),H&&!$){const e=n.edgesArray;if(e.length>0){!function(e,t,n,o,r=Math.random){const s=o.spawnRate??.1,i=o.maxPerEdge??50;for(let o=0;t.length>o;o++){const a=t[o];if(!a.bezier)continue;if(e.countForEdge(o)>=i)continue;const l=a.value*s*n*(a.bezier.circular?.3:1),c=Math.floor(l),u=l-c;let d=c;r()<u&&d++;for(let t=0;d>t&&e.countForEdge(o)<i;t++)e.spawn(o,r)}}(n.particlePool,e,W,T,f);const t=.5*(T.speedMultiplier??1);let o;if(T.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}n.particlePool.step(W,t,e,o),function(e,t,n,o,r){const s=o.radius??3;e.globalAlpha=o.opacity??.7;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(!l)continue;let c;c="string"==typeof o.color&&"inherit"!==o.color?o.color:r(l),e.fillStyle=Qe(e,c)||c,e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}e.globalAlpha=1}(I,n.particlePool,e,T,C)}}$&&(I.globalAlpha=1)}d.current=!1,(B||E||z)&&t.setAttribute("aria-label",b(n.sceneNodes?.length??0,n.sceneEdges?.length??0,"Network chart"));const Y=B||E||z||P.current;Y&&p-R.current>=33?(M(e=>e+1),R.current=p,P.current=!1):P.current=!!Y,(m||E||null!=n.transition||z||n.hasActivePulses||n.hasActiveThresholds||!1!==v&&n.hasActiveTopologyDiff||P.current)&&N()}({canvas:e,store:t,sceneRevisionDiagnostics:mn.current,size:Ot,margin:Ht,adjustedWidth:jt,adjustedHeight:Yt,background:Ie,renderMode:ae,hasBackgroundGraphics:!!ot,dirtyRef:Et,lastFrameTimeRef:hn,now:Jt.now(),random:Jt.random,reducedMotion:!!Bt.current,showParticles:re,isContinuous:Gn,animate:at,decay:rt,pulse:st,thresholds:gt,staleness:lt,particleStyle:an,getParticleColor:Vn,pendingAnnotationFrameRef:yn,lastAnnotationFrameTimeRef:fn,setAnnotationFrame:_n,scheduleNextFrame:()=>{Zt()}})};const{canvasRef:bo}=M(zt,{hydrated:tn,wasHydratingFromSSR:nn,storeRef:gn,dirtyRef:Et,canvasPaintDependencies:[n,jt,Yt,Ie,ot,ae,Zt]});Ft(lt,gn,Et,Zt,Tn,Cn);const ko=We&&bn?Br(p,{x:bn.x,y:bn.y,containerWidth:jt,containerHeight:Yt,margin:Ht,className:"stream-network-tooltip",zIndex:2,children:De?De(bn):Br(xr,{data:bn})}):null;if(xe||!tn&&nn)return Br(yr,{props:e,store:gn.current,responsiveRef:Lt,size:Ot,margin:Ht,adjustedWidth:jt,adjustedHeight:Yt,resolvedBackground:Vt,resolvedForeground:Xt});const wo=gn.current;return Lr("div",{ref:Lt,className:"stream-network-frame"+(Ne?" "+Ne:""),role:"group","aria-label":bt||("string"==typeof tt?tt:"Network chart"),tabIndex:0,"aria-busy":Pn||void 0,style:{position:"relative",width:Pe?"100%":Ot[0],height:Re?"100%":Ot[1],overflow:"visible"},onKeyDown:vo,children:["production"!==process.env.NODE_ENV&&gn.current&&Br(g,{store:gn.current,diagnostics:mn.current}),mt&&Br(v,{tableId:Ut}),mt&&Br(y,{nodes:wo?.sceneNodes??[],edges:wo?.sceneEdges??[],chartType:"Network chart",tableId:Ut,chartTitle:"string"==typeof tt?tt:void 0}),Br(m,{summary:kt}),Br(d,{hoverPoint:bn}),Lr("div",{role:"img","aria-label":bt||("string"==typeof tt?tt:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:We?xo:void 0,onMouseLeave:We?io:void 0,onClick:ze||Be?co:void 0,children:[Pn&&!1!==V&&Br("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:C(!0,Ot[0],Ot[1],V)}),Br(h,{size:Ot,margin:Ht,overflowVisible:!0,children:Vt}),Br("canvas",{ref:bo,"aria-label":b(wo?.sceneNodes?.length??0,wo?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),Br(lr,{width:jt,height:Yt,totalWidth:Ot[0],totalHeight:Ot[1],margin:Ht,labels:wo?.labels||[],sceneNodes:wo?.sceneNodes,title:tt,legend:Ve,legendPosition:Ge,legendLayout:qe,legendHoverBehavior:Ue,legendClickBehavior:Ze,legendHighlightedCategory:Je,legendIsolatedCategories:et,foregroundGraphics:yt(Xt,c(gn.current?.customLayoutOverlays,Wt??null)),annotations:Fe,onAnnotationActivate:je,onObservation:Le??Be,chartId:Oe,chartType:"StreamNetworkFrame",autoPlaceAnnotations:Ye,svgAnnotationRules:Xe,annotationFrame:Sn}),Br(hr,{marks:wo?.customLayoutHtmlMarks,margin:Ht,selection:Wt??null}),Br(f,{active:fo.current>=0,hoverPoint:bn,margin:Ht,size:Ot,shape:yo.current?.shape,width:yo.current?.w,height:yo.current?.h}),ko,lt?.showBadge&&Br($t,{isStale:Tn,position:lt.badgePosition})]})]})}));$r.displayName="StreamNetworkFrame";var Yr=$r,Xr=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},Vr=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,o=Math.floor(e/n);for(let r=Math.floor((e-this.size)/n)+1;o>=r;r++)this.bump(r*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new Xr,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,o=new Xr;o.push(t);let r=e,s=e;const i=[],a={start:r,end:s,stats:o};for(const t of this.sessions)e-n>t.end||t.start>e+n?i.push(t):(a.stats.merge(t.stats),r>t.start&&(r=t.start),t.end>s&&(s=t.end));a.start=r,a.end=s,i.push(a),i.sort((e,t)=>e.start-t.start),this.sessions=i}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const o=t+this.size;e.push(this.row(t,o,n,o>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,o){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:o}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function Gr(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function qr(e,t,n,o=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const r=Gr(e,n),s=e.stddev*o;return[r-s,r+s]}var Ur={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},Qr=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Kr(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;Qr.lastIndex=0;let n,o=0,r=0;for(;null!==(n=Qr.exec(t));){const e=parseFloat(n[1]),t=Ur[n[2]];if(null==t||!Number.isFinite(e))return null;o+=e*t,r+=n[0].length}return r!==t.length?null:o>0?o:null}var Zr=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const o of this.held)this.getTime(o)>e?n.push(o):t.push(o);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as Jr,useImperativeHandle as es,forwardRef as ts,useCallback as ns,useState as os,useEffect as rs}from"react";import{jsx as ss,jsxs as is}from"react/jsx-runtime";var as={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},ls={opacity:.7,marginRight:4};function cs(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function us(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function ds(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:o="x",yLabel:r="y"}=e;return e=>{const s=e?.data??null,i=cs(s,t,"time"),a=cs(s,n,"value");return is("div",{className:"semiotic-tooltip",style:as,children:[is("div",{children:[is("span",{style:ls,children:[o,":"]}),us(i)]}),is("div",{children:[is("span",{style:ls,children:[r,":"]}),us(a)]})]})}}function hs(e,t){return null!=e?e:Math.max(t?.length??0,200)}var ps="time",fs="value",ys="__aggLower",gs="__aggUpper",ms="__aggPartial",vs="count",xs="__aggStart",bs="__aggEnd";function ks(e,t){const n=t.stat??"mean",o=t.band??"none",r=t.sigma??1;return e.emit().map(e=>{const t={[ps]:(e.start+e.end)/2,[fs]:Gr(e,n),[vs]:e.count,[ms]:e.partial,[xs]:e.start,[bs]:e.end},s=qr(e,o,n,r);return s&&(t[ys]=s[0],t[gs]=s[1]),t})}function ws(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:s,hoverHighlight:i,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,p={};o&&(p.annotationObservationCallback=o);const f=c?.enabled?Math.max(s??30,Math.ceil((c.targetSize||44)/2),24):s;return(a||t||o||r||i)&&(p.customHoverBehavior=u),d&&(l||(h?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||i||n))&&(p.customClickBehavior=d),null!=f&&(p.hoverRadius=f),p}import{jsx as As}from"react/jsx-runtime";function Ss(e,t,n){const o="function"==typeof t?t(e):e[t??n];if(null==o)return null;if(o instanceof Date)return o.getTime();const r=Number(o);return Number.isFinite(r)?r:null}var _s=ts(function(e,t){const n=We(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:o,margin:r,className:s,arrowOfTime:i="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,extentPadding:f,stroke:y="#007bff",strokeWidth:g=2,strokeDasharray:m,opacity:v,background:x,tooltipContent:b,tooltip:k,onHover:w,annotations:A,autoPlaceAnnotations:S,svgAnnotationRules:T,tickFormatTime:P,tickFormatValue:R,decay:M,pulse:N,staleness:I,transition:W,linkedHover:D,selection:E,onObservation:z,chartId:B,loading:L,loadingContent:O,emptyContent:H,emphasis:F,legendPosition:j,aggregate:$,eventTime:Y}=e,X=n.showAxes,V=n.enableHover,G=r??n.marginDefaults,q=o??[n.width,n.height],U=b??k??ds({timeAccessor:u,valueAccessor:d}),Q=Jr(null),{customHoverBehavior:K}=De({selection:E,linkedHover:D,unwrapData:!0,onObservation:z,chartType:"RealtimeLineChart",chartId:B}),Z=ns(e=>{w&&w(e),K(e)},[w,K]),J=null!=$,[ee,te]=os([]),ne=Jr(null),oe=Jr($);oe.current=$;const re=Jr(J);re.current=J;const se=Jr(ee);se.current=ee;const ie=Jr({timeAccessor:u,valueAccessor:d});ie.current={timeAccessor:u,valueAccessor:d},rs(()=>{if(!J)return void(ne.current=null);const e=oe.current,t=function(e){const t=e.window??"tumbling",n=Kr("session"===t?e.gap??e.size:e.size);if(null==n)return null;const o=null!=e.hop?Kr(e.hop):void 0,r=null!=e.gap?Kr(e.gap):void 0;return new Vr({window:t,size:n,hop:o??void 0,gap:r??void 0,retain:e.retain})}(e);if(ne.current=t,t&&c){const{timeAccessor:e,valueAccessor:n}=ie.current;for(const o of c){const r=Ss(o,e,"time"),s=Ss(o,n,"value");null!=r&&null!=s&&t.push(r,s)}}te(t?ks(t,e):[])},[J?[$.window??"tumbling",$.size,$.hop??"",$.gap??"",$.retain??""].join("|"):"",J,c]),rs(()=>{J&&ne.current&&te(ks(ne.current,oe.current))},[$?.stat,$?.band,$?.sigma]);const ae=ns(e=>{const t=ne.current,n=oe.current;if(!t||!n)return;const{timeAccessor:o,valueAccessor:r}=ie.current;for(const n of e){const e=Ss(n,o,"time"),s=Ss(n,r,"value");null!=e&&null!=s&&t.push(e,s)}te(ks(t,n))},[]),le=null!=Y,ce=Jr(null),ue=Jr(Y);ue.current=Y;const de=Jr(le);de.current=le;const he=Jr(z);he.current=z;const pe=Jr(B);pe.current=B,rs(()=>{ce.current=le?function(e){const t=Kr(e.lateness);return null==t?null:new Zr({lateness:t,getTime:e=>Ss(e,ie.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(ue.current):null},[le?`${Y.lateness}|${Y.latePolicy??"drop"}`:"",le]);const fe=ns(e=>{0!==e.length&&(re.current?ae(e):Q.current?.pushMany(e))},[ae]),ye=ns(e=>{const t=ce.current;if(!de.current||!t)return void fe(e);const n=[];for(const o of e){const e=t.push(o);if(e.released.length&&n.push(...e.released),e.late.length){const n=he.current;if(n){const{timeAccessor:o}=ie.current,r=ue.current?.latePolicy??"drop";for(const s of e.late)n({type:"late-data",datum:s,eventTime:Ss(s,o,"time")??NaN,watermark:t.watermark,policy:r,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:pe.current})}}}fe(n)},[fe]);es(t,()=>({push:e=>ye([e]),pushMany:e=>ye(e),remove:e=>re.current?[]:Q.current?.remove(e)??[],update:(e,t)=>re.current?[]:Q.current?.update(e,t)??[],clear:()=>{ce.current?.clear(),re.current?(ne.current?.clear(),te([])):Q.current?.clear()},getData:()=>re.current?se.current:Q.current?.getData()??[],getScales:()=>Q.current?.getScales()??null}),[ye]);const ge=C(L,q[0],q[1],O),me=ge?null:_(J?void 0:c,q[0],q[1],H),ve={stroke:y,strokeWidth:g,strokeDasharray:m};null!=v&&(ve.opacity=v);const xe=hs(l,c),be=J?ee:c,ke=J?ps:u,we=J?fs:d,Ae=J&&$&&"none"!==($.band??"none")?{y0Accessor:ys,y1Accessor:gs,perSeries:!1}:void 0;return ge||me||As(Ao,{ref:Q,chartType:"line",runtimeMode:"streaming",size:q,margin:G,className:F?`${s||""} semiotic-emphasis-${F}`.trim():s,arrowOfTime:i,windowMode:J?"growing":a,windowSize:J?Math.max(1,$?.retain??Math.max(ee.length,600)):xe,data:be,timeAccessor:ke,valueAccessor:we,xExtent:h,yExtent:p,extentPadding:f,band:Ae,lineStyle:ve,showAxes:X,background:x,hoverAnnotation:V,tooltipContent:U,...ws({linkedHover:D,selection:E,onObservation:z,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:Z}),annotations:A,autoPlaceAnnotations:S,svgAnnotationRules:T,tickFormatTime:P,tickFormatValue:R,decay:M,pulse:N,staleness:I,transition:W,pointIdAccessor:e.pointIdAccessor,legendPosition:j})});_s.displayName="RealtimeLineChart";import{useRef as Ts,useImperativeHandle as Cs,forwardRef as Ps,useCallback as Rs,useMemo as Ms}from"react";import{jsx as Ns}from"react/jsx-runtime";var Is=Ps(function(e,t){const n=We(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,showLegend:e.showLegend,enableHover:null!=e.enableHover?!!e.enableHover:void 0,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{binSize:o,size:r,margin:s,className:i,arrowOfTime:a="right",windowMode:l="sliding",windowSize:c,data:u,timeAccessor:d,valueAccessor:h,direction:p="up",timeExtent:f,valueExtent:y,extentPadding:g,categoryAccessor:m,colors:v,fill:x,stroke:b,strokeWidth:k,opacity:w,gap:A,background:S,tooltipContent:T,tooltip:P,onHover:R,annotations:M,autoPlaceAnnotations:N,svgAnnotationRules:I,tickFormatTime:W,tickFormatValue:D,linkedHover:E,selection:z,decay:B,pulse:L,staleness:O,transition:H,onObservation:F,chartId:j,loading:$,loadingContent:Y,emptyContent:X,emphasis:V,legendPosition:G,legend:q,brush:U,onBrush:Q,linkedBrush:K}=e,J=n.showAxes,ee=n.enableHover,te=r??[n.width,n.height],ne=Ms(()=>v?e=>v[e]??x??"#999":void 0,[v,x]),{legend:oe,margin:re,legendPosition:se}=Ie({data:u??[],colorBy:m,colorScale:ne,showLegend:n.showLegend,legendPosition:G,userMargin:s,defaults:n.marginDefaults,additionalLegend:q}),ie=T??P??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const o=e?.data??null;if(null==o?.binStart||null==o?.binEnd){const e=cs(o,t,"time"),r=cs(o,n,"value");return is("div",{className:"semiotic-tooltip",style:as,children:[is("div",{children:[ss("span",{style:ls,children:"x:"}),us(e)]}),is("div",{children:[ss("span",{style:ls,children:"y:"}),us(r)]})]})}return is("div",{className:"semiotic-tooltip",style:as,children:[is("div",{children:[ss("span",{style:ls,children:"range:"}),us(o.binStart),"–",us(o.binEnd)]}),null!=o.total&&is("div",{children:[ss("span",{style:ls,children:"count:"}),us(o.total)]}),null!=o.category&&is("div",{children:[ss("span",{style:ls,children:"category:"}),us(o.category)]})]})}}({timeAccessor:d,valueAccessor:h}),ae=Ts(null),{customHoverBehavior:le}=De({selection:z,linkedHover:E,unwrapData:!0,onObservation:F,chartType:"RealtimeHistogram",chartId:j}),ce=Rs(e=>{R&&R(e),le(e)},[R,le]),ue=!0===U?{dimension:"x",snap:"bin"}:"x"===U?{dimension:"x"}:"object"==typeof U?U:void 0,de=Se(K),he="string"==typeof d?d:"time",pe=Ne({name:de?.name||"__unused_hist_brush__",xField:de?.xField||he,...de?.yField?{yField:de.yField}:{}}),fe=Ts(pe.brushInteraction);fe.current=pe.brushInteraction;const ye=Rs(e=>{if(Q&&Q(e),F&&F(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:j}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:j}),de){const t=fe.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[Q,F,j,de]);Cs(t,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const ge=C($,te[0],te[1],Y),me=ge?null:_(u,te[0],te[1],X),ve={};null!=x&&(ve.fill=x),null!=b&&(ve.stroke=b),null!=k&&(ve.strokeWidth=k),null!=w&&(ve.opacity=w),null!=A&&(ve.gap=A);const xe=V?`${i||""} semiotic-emphasis-${V}`.trim():i,be=hs(c,u),ke=Ms(()=>"down"!==p?y:Z({data:u,valueAccessor:h,timeAccessor:d,binSize:o,valueExtent:y,extentPadding:g}),[p,u,h,d,o,y,g]);return ge||me||Ns(Ao,{ref:ae,chartType:"bar",runtimeMode:"streaming",size:te,margin:re,className:xe,arrowOfTime:a,windowMode:l,windowSize:be,data:u,timeAccessor:d,valueAccessor:h,xExtent:f,yExtent:ke,extentPadding:g,binSize:o,categoryAccessor:m,barColors:v,barStyle:ve,showAxes:J,background:S,hoverAnnotation:ee,tooltipContent:ie,...ws({linkedHover:E,selection:z,onObservation:F,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:ce}),annotations:M,autoPlaceAnnotations:N,svgAnnotationRules:I,tickFormatTime:W,tickFormatValue:D,decay:B,pulse:L,staleness:O,transition:H,pointIdAccessor:e.pointIdAccessor,legend:oe,legendPosition:se,brush:ue||(K?{dimension:"x"}:void 0),onBrush:ue||K?ye:void 0})});function Ws(e){return Ns(Is,{...e,windowMode:"growing"})}Is.displayName="RealtimeHistogram",Ws.displayName="TemporalHistogram";import{useRef as Ds,useImperativeHandle as Es,forwardRef as zs,useCallback as Bs}from"react";import{jsx as Ls}from"react/jsx-runtime";var Os=zs(function(e,t){const n=We(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:o,margin:r,className:s,arrowOfTime:i="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,yScaleType:f,extentPadding:y,categoryAccessor:g,colors:m,radius:v,fill:x,opacity:b,stroke:k,strokeWidth:w,pointStyle:A,background:S,tooltipContent:T,tooltip:P,onHover:R,annotations:M,autoPlaceAnnotations:N,svgAnnotationRules:I,tickFormatTime:W,tickFormatValue:D,linkedHover:E,selection:z,onObservation:B,chartId:L,loading:O,loadingContent:H,emptyContent:F,emphasis:j,legendPosition:$}=e,Y=n.showAxes,X=n.enableHover,V=r??n.marginDefaults,G=o??[n.width,n.height],q=T??P??ds({timeAccessor:u,valueAccessor:d}),U=Ds(null),{customHoverBehavior:Q}=De({selection:z,linkedHover:E,unwrapData:!0,onObservation:B,chartType:"RealtimeSwarmChart",chartId:L}),K=Bs(e=>{R&&R(e),Q(e)},[R,Q]);Es(t,()=>({push:e=>U.current?.push(e),pushMany:e=>U.current?.pushMany(e),remove:e=>U.current?.remove(e)??[],update:(e,t)=>U.current?.update(e,t)??[],clear:()=>U.current?.clear(),getData:()=>U.current?.getData()??[],getScales:()=>U.current?.getScales()??null}),[]);const Z=C(O,G[0],G[1],H),J=Z?null:_(c,G[0],G[1],F),ee={};null!=v&&(ee.radius=v),null!=x&&(ee.fill=x),null!=b&&(ee.opacity=b),null!=k&&(ee.stroke=k),null!=w&&(ee.strokeWidth=w);const te=A,ne=j?`${s||""} semiotic-emphasis-${j}`.trim():s,oe=hs(l,c);return Z||J||Ls(Ao,{ref:U,chartType:"swarm",runtimeMode:"streaming",size:G,margin:V,className:ne,arrowOfTime:i,windowMode:a,windowSize:oe,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:p,yScaleType:f,extentPadding:y,categoryAccessor:g,barColors:m,swarmStyle:ee,pointStyle:te,showAxes:Y,background:S,hoverAnnotation:X,tooltipContent:q,...ws({linkedHover:E,selection:z,onObservation:B,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:K}),annotations:M,autoPlaceAnnotations:N,svgAnnotationRules:I,tickFormatTime:W,tickFormatValue:D,legendPosition:$,pointIdAccessor:e.pointIdAccessor})});Os.displayName="RealtimeSwarmChart";import{useRef as Hs,useImperativeHandle as Fs,forwardRef as js,useCallback as $s}from"react";import{jsx as Ys}from"react/jsx-runtime";var Xs=js(function(e,t){const n=We(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:o,margin:r,className:s,arrowOfTime:i="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,extentPadding:f,positiveColor:y,negativeColor:g,connectorStroke:m,connectorWidth:v,gap:x,stroke:b,strokeWidth:k,opacity:w,background:A,tooltipContent:S,tooltip:T,onHover:P,annotations:R,autoPlaceAnnotations:M,svgAnnotationRules:N,tickFormatTime:I,tickFormatValue:W,linkedHover:D,selection:E,onObservation:z,chartId:B,loading:L,loadingContent:O,emptyContent:H,emphasis:F,legendPosition:j}=e,$=n.showAxes,Y=n.enableHover,X=r??n.marginDefaults,V=o??[n.width,n.height],G=S??T??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const o=e?.data??null,r=cs(o,t,"time"),s=o?.delta??cs(o,n,"value"),i=o?.cumEnd,a="number"==typeof s?0>s?us(s):"+"+us(s):us(s);return is("div",{className:"semiotic-tooltip",style:as,children:[is("div",{children:[ss("span",{style:ls,children:"x:"}),us(r)]}),is("div",{children:[ss("span",{style:ls,children:"Δ:"}),a]}),null!=i&&is("div",{children:[ss("span",{style:ls,children:"total:"}),us(i)]})]})}}({timeAccessor:u,valueAccessor:d}),q=Hs(null),{customHoverBehavior:U}=De({selection:E,linkedHover:D,unwrapData:!0,onObservation:z,chartType:"RealtimeWaterfallChart",chartId:B}),Q=$s(e=>{P&&P(e),U(e)},[P,U]);Fs(t,()=>({push:e=>q.current?.push(e),pushMany:e=>q.current?.pushMany(e),remove:e=>q.current?.remove(e)??[],update:(e,t)=>q.current?.update(e,t)??[],clear:()=>q.current?.clear(),getData:()=>q.current?.getData()??[],getScales:()=>q.current?.getScales()??null}),[]);const K=C(L,V[0],V[1],O),Z=K?null:_(c,V[0],V[1],H),J={};null!=y&&(J.positiveColor=y),null!=g&&(J.negativeColor=g),null!=m&&(J.connectorStroke=m),null!=v&&(J.connectorWidth=v),null!=x&&(J.gap=x),null!=b&&(J.stroke=b),null!=k&&(J.strokeWidth=k),null!=w&&(J.opacity=w);const ee=F?`${s||""} semiotic-emphasis-${F}`.trim():s,te=hs(l,c);return K||Z||Ys(Ao,{ref:q,chartType:"waterfall",runtimeMode:"streaming",size:V,margin:X,className:ee,arrowOfTime:i,windowMode:a,windowSize:te,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:p,extentPadding:f,waterfallStyle:J,showAxes:$,background:A,hoverAnnotation:Y,tooltipContent:G,...ws({linkedHover:D,selection:E,onObservation:z,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:Q}),annotations:R,autoPlaceAnnotations:M,svgAnnotationRules:N,tickFormatTime:I,tickFormatValue:W,legendPosition:j,pointIdAccessor:e.pointIdAccessor})});Xs.displayName="RealtimeWaterfallChart";import{useRef as Vs,useImperativeHandle as Gs,forwardRef as qs,useCallback as Us}from"react";import{jsx as Qs}from"react/jsx-runtime";var Ks=qs(function(e,t){const n=We(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:o,margin:r,className:s,arrowOfTime:i="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,timeExtent:p,valueExtent:f,extentPadding:y,heatmapXBins:g=20,heatmapYBins:m=20,aggregation:v="count",background:x,tooltipContent:b,tooltip:k,onHover:w,annotations:A,autoPlaceAnnotations:S,svgAnnotationRules:T,tickFormatTime:P,tickFormatValue:R,decay:M,pulse:N,staleness:I,linkedHover:W,selection:D,onObservation:E,chartId:z,loading:B,loadingContent:L,emptyContent:O,emphasis:H,legendPosition:F}=e,j=n.showAxes,$=n.enableHover,Y=r??n.marginDefaults,X=o??[n.width,n.height],V=b??k??function(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:o="x",yLabel:r="y"}=e;return e=>{const s=e?.data??null,i=s?.xCenter??cs(s,t,"time"),a=s?.yCenter??cs(s,n,"value"),l=s?.count,c=s?.sum,u=s?.value,d=s?.agg??"count";return is("div",{className:"semiotic-tooltip",style:as,children:[is("div",{children:[is("span",{style:ls,children:[o,":"]}),us(i)]}),is("div",{children:[is("span",{style:ls,children:[r,":"]}),us(a)]}),null!=l&&is("div",{children:[ss("span",{style:ls,children:"count:"}),us(l)]}),"sum"===d&&null!=c&&is("div",{children:[ss("span",{style:ls,children:"sum:"}),us(c)]}),"mean"===d&&null!=u&&is("div",{children:[ss("span",{style:ls,children:"mean:"}),us(u)]})]})}}({timeAccessor:u,valueAccessor:d}),G=Vs(null),{customHoverBehavior:q}=De({selection:D,linkedHover:W,unwrapData:!0,onObservation:E,chartType:"RealtimeHeatmap",chartId:z}),U=Us(e=>{w&&w(e),q(e)},[w,q]);Gs(t,()=>({push:e=>G.current?.push(e),pushMany:e=>G.current?.pushMany(e),remove:e=>G.current?.remove(e)??[],update:(e,t)=>G.current?.update(e,t)??[],clear:()=>G.current?.clear(),getData:()=>G.current?.getData()??[],getScales:()=>G.current?.getScales()??null}),[]);const Q=C(B,X[0],X[1],L),K=Q?null:_(c,X[0],X[1],O),Z=H?`${s||""} semiotic-emphasis-${H}`.trim():s,J=hs(l,c);return Q||K||Qs(Ao,{ref:G,chartType:"heatmap",runtimeMode:"streaming",size:X,margin:Y,className:Z,arrowOfTime:i,windowMode:a,windowSize:J,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,xExtent:p,yExtent:f,extentPadding:y,heatmapXBins:g,heatmapYBins:m,heatmapAggregation:v,showAxes:j,background:x,hoverAnnotation:$,tooltipContent:V,...ws({linkedHover:W,selection:D,onObservation:E,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:U}),annotations:A,autoPlaceAnnotations:S,svgAnnotationRules:T,tickFormatTime:P,tickFormatValue:R,decay:M,pulse:N,staleness:I,legendPosition:F,pointIdAccessor:e.pointIdAccessor})});Ks.displayName="RealtimeHeatmap";export{Be as DEFAULT_LIFECYCLE_THRESHOLDS,oe as IncrementalExtent,Ks as RealtimeHeatmap,Is as RealtimeHistogram,_s as RealtimeLineChart,Os as RealtimeSwarmChart,Xs as RealtimeWaterfallChart,Zr as ReorderBuffer,re as RingBuffer,Xr as RunningStats,Yr as StreamNetworkFrame,Ao as StreamXYFrame,Ws as TemporalHistogram,Vr as WindowAccumulator,qr as bandBounds,Le as bandFromAge,$ as compileMotionEncoding,V as deriveMotionVector,U as opacityFromAge,Kr as parseWindowDuration,J as resolveMotionAccessor,ee as resolveMotionVector,Gr as statValue};
|
|
1
|
+
import{canUseForceWorker as e,createFrameForceWorkerRequest as t,runForceLayoutWorker as o,shouldUseForceWorker as n}from"./chunk-chunk-ZOAQDIJO.module.min.js";import"./chunk-chunk-SV4XAZ3Q.module.min.js";import{StalenessBadge as s,StreamXYFrame_default as r,attachUpdateResultStore as i,buildCustomBehaviorProps as a,buildNavGraph as l,compileMotionEncoding as c,composeOverlays as d,computeDecayOpacity as u,createCustomLayoutFailureDiagnostic as h,deriveMotionVector as g,extractNetworkNavPoints as y,findHitPointInQuadtree as p,formatVal as m,getLayoutPlugin as f,needsDataCanvasPaint as v,networkGlyphRenderer as b,nextNetworkIndex as _,opacityFromAge as w,paintCanvasBackground as x,paintSceneWithBackend as k,renderCirclePulse as A,renderRectPulse as S,renderSceneWithBackend as C,resolveDownwardHistogramExtent as R,resolveMotionAccessor as N,resolveMotionVector as T,resolvePosition as E,useConfigSync as P,useLayoutSelectionSync as I,useStableShallow as D,useStalenessCheck as M,warnCustomLayoutDiagnostics as z}from"./chunk-chunk-3ILKBVVQ.module.min.js";import{IncrementalExtent as L,RingBuffer as H,getHitRadius as W,hitTestRect as B,normalizeAngle as F}from"./chunk-chunk-7ALTGHK6.module.min.js";import{CustomLayoutSelectionProvider as O,wrapWithCustomLayoutSelection as Y}from"./chunk-chunk-C4YA6TDR.module.min.js";import{ANNOTATION_DISCLOSURE_REVEAL_CSS as j,AriaLiveTooltip as X,CanvasFrameBackground as $,DEFAULT_COLORS as V,FlippingTooltip as G,FocusRing as Q,NetworkAccessibleDataTable as q,SceneRevisionDiagnosticsObserver as K,ScreenReaderSummary as U,SkipToTableLink as Z,TITLE_BASELINE as J,buildResolveColor as ee,computeEasing as te,computeNetworkAriaLabel as oe,computeRawProgress as ne,createDefaultAnnotationRules as se,emitClickObservations as re,emitHoverObservations as ie,filterSparseArray as ae,getDevicePixelRatio as le,isInteractiveKeyboardTarget as ce,isServerEnvironment as de,lerp as ue,networkLabelToSVG as he,networkSceneEdgeToSVG as ge,networkSceneNodeToSVG as ye,normalizeLinkedBrush as pe,now as me,observationInputType as fe,prepareCanvas as ve,renderAnnotationPass as be,renderEmptyState as _e,renderLegendFromConfig as we,renderLoadingState as xe,resolveCanvasFill as ke,resolveCustomLayoutPalette as Ae,runSceneBuild as Se,useBrushSelection as Ce,useChartLegendAndMargin as Re,useChartMode as Ne,useChartSelection as Te,useFrame as Ee,useFrameCanvasHost as Pe,useHydration as Ie,useSceneRevisionDiagnostics as De,useWasHydratingFromSSR as Me}from"./chunk-chunk-MFHF4J2Z.module.min.js";import"./chunk-chunk-XEVJDUTH.module.min.js";import{DEFAULT_LIFECYCLE_THRESHOLDS as ze,annotationActivationProps as Le,bandFromAge as He,buildHoverData as We,defaultTooltipStyle as Be,filterAnnotationsByStatus as Fe,isAnnotationActivationTarget as Oe,smartTooltipEntries as Ye,useAnnotationActivationOptions as je}from"./chunk-chunk-JMVEIZXP.module.min.js";import{UpdateResultTracker as Xe,annotationLayout as $e,glyphHitGeometry as Ve,schemeCategory10 as Ge,symbolPathString as Qe,symbolRadius as qe}from"./chunk-chunk-5RKXZQ2P.module.min.js";import"./chunk-chunk-U66USBWU.module.min.js";import"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveCSSColor as Ke}from"./chunk-chunk-IY7RYD4S.module.min.js";import"./chunk-chunk-J3QOW4OE.module.min.js";import{resolveThemeSemanticColors as Ue}from"./chunk-chunk-DSNGDNJY.module.min.js";import*as Ze from"react";import{useRef as Je,useState as et,useEffect as tt,useMemo as ot,useCallback as nt,useImperativeHandle as st,forwardRef as rt,memo as it}from"react";var at={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},lt={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},ct=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){const o=this._freeIndices.pop();if(void 0===o)return null;const n=this.particles[o];return n.active=!0,n.t=0,n.offset=t()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,o,n){for(let s=0;this.capacity>s;s++){const r=this.particles[s];if(!r.active)continue;const i=o[r.edgeIndex];i&&i.bezier?(r.t+=e*t*(n?n[r.edgeIndex]??1:1)*(i.bezier.circular?.3:1),1>r.t?dt(i.bezier,r.t,r.offset,r):(r.active=!1,this._freeIndices.push(s))):(r.active=!1,this._freeIndices.push(s))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}};function dt(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,s){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),l=i-a,[c,d,u,h]=e[a];ut(c,d,u,h,l,s);const g=h.x-c.x,y=h.y-c.y,p=Math.sqrt(g*g+y*y);if(p>.001){const e=g/p;s.x+=-y/p*o*n*2,s.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[s,r,i,a]=e.points;ut(s,r,i,a,t,n);const l=a.x-s.x,c=a.y-s.y,d=Math.sqrt(l*l+c*c);if(d>.001){const t=l/d;n.x+=-c/d*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function ut(e,t,o,n,s,r){const i=1-s,a=i*i,l=a*i,c=s*s,d=c*s;r.x=l*e.x+3*a*s*t.x+3*i*c*o.x+d*n.x,r.y=l*e.y+3*a*s*t.y+3*i*c*o.y+d*n.y}import{quadtree as ht}from"d3-quadtree";function gt(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 yt(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!pt(e))return!1;return!0}return pt(t.points)}function pt(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}import{interpolateNumber as mt}from"d3-interpolate";var ft="rgba(34, 197, 94, 0.7)",vt=2e3,bt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],_t=["scene-style","data-paint","accessibility","evidence"],wt=(e,t)=>({retainedData:e,invalidations:t}),xt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],kt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],At=["scene-geometry","data-paint","overlay","accessibility","evidence"],St=["scene-style","data-paint","accessibility","evidence"],Ct=["scene-geometry","data-paint","overlay","accessibility","evidence"],Rt=[],Nt={chartType:wt("rebuild",xt),nodeIDAccessor:wt("rebuild",xt),sourceAccessor:wt("rebuild",xt),targetAccessor:wt("rebuild",xt),valueAccessor:wt("rebuild",xt),edgeIdAccessor:wt("rebuild",xt),childrenAccessor:wt("rebuild",xt),hierarchySum:wt("rebuild",xt),orientation:wt("preserve",kt),nodeAlign:wt("preserve",kt),nodePaddingRatio:wt("preserve",kt),nodeWidth:wt("preserve",kt),edgeSort:wt("preserve",kt),iterations:wt("preserve",kt),forceStrength:wt("preserve",kt),padAngle:wt("preserve",kt),groupWidth:wt("preserve",kt),sortGroups:wt("preserve",kt),treeOrientation:wt("preserve",kt),edgeType:wt("preserve",kt),padding:wt("preserve",kt),paddingTop:wt("preserve",kt),orbitMode:wt("preserve",kt),orbitSize:wt("preserve",kt),orbitSpeed:wt("preserve",kt),orbitRevolution:wt("preserve",kt),orbitRevolutionStyle:wt("preserve",kt),orbitEccentricity:wt("preserve",kt),orbitShowRings:wt("preserve",kt),orbitAnimated:wt("preserve",kt),customNetworkLayout:wt("preserve",kt),layoutConfig:wt("preserve",kt),nodeSize:wt("preserve",At),nodeSizeRange:wt("preserve",At),colorByDepth:wt("preserve",At),nodeLabel:wt("preserve",Ct),showLabels:wt("preserve",Ct),labelMode:wt("preserve",Ct),nodeStyle:wt("preserve",St),edgeStyle:wt("preserve",St),colorBy:wt("preserve",St),colorScheme:wt("preserve",St),themeCategorical:wt("preserve",St),themeSemantic:wt("preserve",St),edgeColorBy:wt("preserve",St),edgeOpacity:wt("preserve",St),showParticles:wt("preserve",St),particleStyle:wt("preserve",St),decay:wt("preserve",St),pulse:wt("preserve",St),thresholds:wt("preserve",St),staleness:wt("preserve",St),layoutSelection:wt("preserve",St),clock:wt("preserve",Rt),random:wt("preserve",Rt),seed:wt("preserve",Rt),tensionConfig:wt("preserve",Rt),transition:wt("preserve",Rt),introAnimation:wt("preserve",Rt),onLayoutError:wt("preserve",Rt),__skipForceSimulation:wt("preserve",Rt),__hierarchyRoot:wt("preserve",Rt),__orbitState:wt("preserve",Rt),__previousPositions:wt("preserve",Rt)},Tt=wt("preserve",kt),Et=class{constructor(){this.tracker=new Xe}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},bt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},_t):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=Nt[n]??Tt;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},Pt=class e{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new Et,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=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._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...at,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new ct(2e3))}currentTime(){return this.config.clock?.()??me()}updateConfig(e){const t=this.config,o={...t,...e};t.__orbitState&&(o.__orbitState=t.__orbitState),t.__hierarchyRoot&&(o.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(o.layoutSelection=t.layoutSelection);const n=[...new Set([...Object.keys(t),...Object.keys(o)])].filter(e=>t[e]!==o[e]);this.config=o,this.tensionConfig={...at,...o.tensionConfig},!o.showParticles||"sankey"!==o.chartType&&!o.customNetworkLayout||this.particlePool||(this.particlePool=new ct(2e3)),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,o,n){const{nodeIDAccessor:s="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,l="function"==typeof s?s:e=>e[s],c="function"==typeof r?r:e=>e[r],d="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>e[a]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=l(t)+"";this.nodes.set(e,{...gt(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],n=c(o)+"",s=d(o)+"",r=u(o),i=null==r?NaN:Number(r),a=Number.isFinite(i)?i:1;this.nodes.has(n)||this.nodes.set(n,{...gt(n),data:o}),this.nodes.has(s)||this.nodes.set(s,{...gt(s),data:o});const l=`${n}\0${s}\0${e}`,h={source:n,target:s,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&yt(o.bezier)&&(h.bezier=o.bezier),this.edges.set(l,h)}n?.deferLayout||this.runLayout(o),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,o,n){return this.ingestBounded(e,t,o,n),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,o]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=o.x,e.y=o.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,s=0===this.nodes.size;let r=!1;const i=this.currentTime();this.lastIngestTime=i,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,gt(t)),this.nodeTimestamps.set(t,i),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,gt(o)),this.nodeTimestamps.set(o,i),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;l?(l.value+=n,this.edgeTimestamps.set(a,i),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,i),this.tension+=this.tensionConfig.newEdge,r=!0);const d=s||r||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),d}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=f(this.config.chartType);if(!t)return;let o=Array.from(this.nodes.values());const n=Array.from(this.edges.values());if(0===o.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of o)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):0===t.x&&0===t.y||e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(o,n,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&o.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of o)this.nodes.set(e.id,e);for(let e=0;n.length>e;e++){const t=n[e],o=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=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,o=Array.from(this.nodes.values())}this.finalizeLayout();const s=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||s.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=s,this.saveTargetPositions();const r=o.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),i=this.config.transition?.duration??this.tensionConfig.transitionDuration,a=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&a&&o.length>0&&i>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:i}}else r&&i>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:i});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){const t=function({nodes:e,edges:t,restyle:o,restyleEdge:n,baseStyles:s,selection:r}){const i=!(!o&&!n);if(o)for(const t of e){const e=s.get(t)??t.style,n=o(t,r);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=s.get(e)??e.style,o=n(e,r);e.style=o?{...t,...o}:t}return i}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){const t=function({config:e,customLayout:t,size:o,nodes:n,edges:s,previousResult:r,revision:i}){const a=Ae(e.colorScheme,e.themeCategorical,Ge),l={nodes:n,edges:s,dimensions:{width:o[0],height:o[1],plot:{x:0,y:0,width:o[0],height:o[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...a]},resolveColor:ee(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const o=null!==r,n=h("network",t,o,i);"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t);try{e.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:n,preservedLastGoodScene:o}}}({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++));const o=t.result;return this.sceneNodes=o.sceneNodes??[],this.sceneEdges=o.sceneEdges??[],this.labels=o.labels??[],this.customLayoutOverlays=o.overlays??null,this.customLayoutHtmlMarks=o.htmlMarks??[],this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=o.restyle,this._customRestyleEdge=o.restyleEdge,this.hasCustomRestyle=!(!o.restyle&&!o.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const o=new WeakMap;for(const t of e)o.set(t,t.style);for(const e of t)o.set(e,e.style);return o}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void z({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null;const t=f(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const o=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:s,sceneEdges:r,labels:i}=t.buildScene(o,n,this.config,e);this.sceneNodes=s,this.sceneEdges=r,this.labels=i,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,o=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxNodeRadius=o,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const n=Array(t);let s=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[s++]=e);this._nodeQuadtree=ht().x(e=>e.cx).y(e=>e.cy).addAll(n)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=f(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=f(this.config.chartType);if(!o?.tick)return!1;const n=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,s=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(n,s,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=ne(e,this.transition),o=te(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=ue(e._prevX0,e._targetX0,o),e.x1=ue(e._prevX1,e._targetX1,o),e.y0=ue(e._prevY0,e._targetY0,o),e.y1=ue(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=ue(e._prevY0,e._targetY0,o),e.y1=ue(e._prevY1,e._targetY1,o),e.sankeyWidth=ue(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=e?.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}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),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,o=.5){const n="string"==typeof e.source?t.get(e.source):e.source,s="string"==typeof e.target?t.get(e.target):e.target;!n||!s||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const s=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,i=o.y-t.y;s.push([t,{x:t.x+r/3,y:t.y+i/3},{x:t.x+2*r/3,y:t.y+2*i/3},o])}return{circular:!0,segments:s,halfWidth:t}}(e):function(e,t,o,n=.5){const s=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.x1,i=o.x0,a=mt(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(n)},{x:e.y1,y:a(1-n)},{x:e.y1,y:i}],halfWidth:s}}const r=t.x1,i=o.x0,a=mt(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(n),y:e.y0},{x:a(1-n),y:e.y1},{x:i,y:e.y1}],halfWidth:s}}(e,n,s,o))}(e,this.nodes,.5)}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){!function(e){const t=e.pulse;if(!t)return;const o=t.duration??500,n=t.color??"rgba(255,255,255,0.6)",s=t.glowRadius??4,{now:r}=e;for(const t of e.sceneNodes){const i=t.id;if(!i)continue;const a=e.nodeTimestamps.get(i);if(!a)continue;const l=r-a;o>l&&(t._pulseIntensity=1-l/o,t._pulseColor=n,t._pulseGlowRadius=s)}for(const t of e.sceneEdges){const s=t.datum;if(!s)continue;const i="object"==typeof s.source?s.source?.id:s.source,a="object"==typeof s.target?s.target?.id:s.target;if(!i||!a)continue;const l=e.edgeTimestamps.get(`${i}\0${a}`);if(!l)continue;const c=r-l;o>c&&(t._pulseIntensity=1-c/o,t._pulseColor=n)}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){const t=e.decay;if(!t)return;const o=e.nodeTimestamps.size;if(1>=o)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const t=new Map;for(let o=0;e.cache.sortedNodes.length>o;o++)t.set(e.cache.sortedNodes[o][0],o);e.cache.ageMap=t}const n=e.cache.ageMap;for(const s of e.sceneNodes){const e=s.id;if(!e)continue;const r=n.get(e);if(void 0===r)continue;const i=u(t,r,o);s.style={...s.style,opacity:(s.style?.opacity??1)*i}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===ft&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;const t=e.now-e.lastTopologyChangeTime;if(t>=vt)return;const o=1-t/vt;for(const t of e.sceneNodes){const n=t.id;n&&e.addedNodes.has(n)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,o),t._pulseColor=ft,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&vt>o-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const o=t.warningColor??"#f59e0b",n=t.criticalColor??"#ef4444",s=!1!==t.pulse;for(const r of e.sceneNodes){const i=r.id;if(!i)continue;const a=e.nodes.get(i);if(!a)continue;const l=t.metric(a);let c=null;void 0===t.critical||t.critical>l?void 0===t.warning||t.warning>l||(c=o):c=n,c&&(r.style={...r.style,fill:c},s&&(r._pulseIntensity=.6+.4*Math.sin(e.now/300),r._pulseColor=c,r._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const o of e){const e=t.metric(o);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){const t=e.pulse;if(!t||0===e.lastIngestTime)return!1;const o=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>o-e.lastIngestTime}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){const o=this.nodes.get(e);if(!o)return this.updateResults.recordNoop("update"),null;const n=o.data?{...o.data}:{};return o.data=t(o.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),n}updateEdge(e,t,o){const n=this.config.valueAccessor,s="function"==typeof n?n:n?e=>e[n]:e=>e.value,r=[];for(const[,n]of this.edges)if(("string"==typeof n.source?n.source:n.source.id)===e&&("string"==typeof n.target?n.target:n.target.id)===t){r.push(n.data?{...n.data}:{}),n.data=o(n.data??{});const e=s(n.data);null!=e&&(n.value=Number(e))}return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",r.length)):this.updateResults.recordNoop("update"),r}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>e?.[t];for(const[t,s]of this.edges)s.data&&n(s.data)===e&&o.push(t)}else for(const[n,s]of this.edges)("string"==typeof s.source?s.source:s.source.id)===e&&("string"==typeof s.target?s.target:s.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};Pt.QUADTREE_THRESHOLD=500;var It=Pt;i(It);import*as Dt from"react";import{Fragment as Mt,jsx as zt,jsxs as Lt}from"react/jsx-runtime";function Ht(e){const{width:t,height:o,totalWidth:n,totalHeight:s,margin:r,labels:i,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:d,legendHighlightedCategory:u,legendIsolatedCategories:h,legendPosition:g="right",legendLayout:y,foregroundGraphics:p,sceneNodes:m,annotations:f,onAnnotationActivate:v,onObservation:b,chartId:_,chartType:w,autoPlaceAnnotations:x,svgAnnotationRules:k}=e,A=je({onAnnotationActivate:v,onObservation:b,chartId:_,chartType:w}),S=Dt.useMemo(()=>{const e=(m||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,o=e.cy??e.y;if("number"!=typeof t||"number"!=typeof o)return null;const n=Ve(e.glyph,e.size);return{x:t+n.centerDx,y:o+n.centerDy,r:Math.max(1,n.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),o=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof o?null:{x:t,y:o,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,qe(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),o=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:o,...t}]:[]});return{scales:null,width:t,height:o,frameType:"network",pointNodes:e,sceneNodes:m}},[o,m,t]),C=Dt.useMemo(()=>{if(!f)return f;const e=Fe(f);return x?$e({annotations:e,context:S,..."object"==typeof x?x:{}}):e},[f,x,S]),R=Dt.useMemo(()=>se("network"),[]),N=C?be(C.filter(e=>"widget"!==e.type),R,k,S):null,T=!0===C?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return Lt(Mt,{children:[T&&zt("style",{children:j},"annotation-widget-disclosure-style"),Lt("svg",{role:"img",width:n,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[zt("title",{children:"string"==typeof a?a:"Network Chart"}),zt("desc",{children:"string"==typeof a?a+" (network data visualization)":"Network data visualization"}),Lt("g",{transform:`translate(${r.left},${r.top})`,children:[i.map((e,t)=>zt("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),N,p]}),a&&"string"==typeof a?zt("text",{x:n/2,y:J,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?zt("foreignObject",{x:0,y:0,width:n,height:r.top,children:a}):null,we({legend:l,totalWidth:n,totalHeight:s,margin:r,legendPosition:g,title:a,legendLayout:y,legendHoverBehavior:c,legendClickBehavior:d,legendHighlightedCategory:u,legendIsolatedCategories:h})]}),C?.filter(e=>"widget"===e.type&&e.nodeId&&m).map((e,t)=>{const o=!0===e._annotationDeferred,n=m.find(t=>t.id===e.nodeId||t.datum?.id===e.nodeId||t.datum?.data?.id===e.nodeId||t.datum?.data?.name===e.nodeId);if(!n)return null;const s=r.left+(n.cx??(null!=n.x&&null!=n.w?n.x+n.w/2:n.x??0)),i=r.top+(n.cy??(null!=n.y&&null!=n.h?n.y+n.h/2:n.y??0)),a=e.dx??0,l=e.dy??-16,c=e.width??32,d=e.height??32,u=e.content??zt("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return zt("div",{...Le(e,A),className:o?"annotation-deferred":void 0,"data-annotation-disclosure":o?"deferred":void 0,style:{position:"absolute",left:s+a-c/2,top:i+l-d/2,width:c,height:d,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:u},"widget-"+t)})]})}Ht.displayName="NetworkSVGOverlay";import*as Wt from"react";import{jsx as Bt}from"react/jsx-runtime";var Ft={position:"absolute",top:0,left:0,pointerEvents:"none"};function Ot({marks:e,margin:t,selection:o=null,overscan:n=400}){const s=Wt.useRef(null),r=function(e,t,o){const[n,s]=Wt.useState(null);return Wt.useLayoutEffect(()=>{const e=t.current,o=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:o,overflowY:n}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${n} ${o}`))return t;t=t.parentElement}return null}(e);if(!e||!o)return void s(null);let n=0;const r=()=>{n=0;const t=o.getBoundingClientRect(),r=e.getBoundingClientRect();s(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:r.left,originY:r.top}:null)},i=()=>{0===n&&(n=window.requestAnimationFrame(r))};r(),o.addEventListener("scroll",i,{passive:!0});const a=new ResizeObserver(i);return a.observe(o),()=>{0!==n&&window.cancelAnimationFrame(n),o.removeEventListener("scroll",i),a.disconnect()}},[t,e,o]),Wt.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:s,originY:r}=n,i=t.left-o,a=t.right+o,l=t.top-o,c=t.bottom+o;return e.filter(e=>{const t=s+e.x,o=r+e.y;return!(i>t+e.width||t>a||l>o+e.height||o>c)})},[e,n,o])}(e,s,n);if(!e||0===e.length)return null;const i=Bt("div",{className:"semiotic-network-html-marks",ref:s,style:{...Ft,transform:`translate(${t.left}px, ${t.top}px)`},children:(r??e).map(e=>Bt("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=o?Bt(O,{value:o,children:i}):i}import{jsx as Yt,jsxs as jt}from"react/jsx-runtime";function Xt({props:e,store:t,responsiveRef:o,size:n,margin:s,adjustedWidth:r,adjustedHeight:i,resolvedBackground:a,resolvedForeground:l}){const{chartType:c,nodes:u,edges:h,data:g,className:y,description:p,title:m,responsiveWidth:f,responsiveHeight:v,summary:b,background:_,renderMode:w,legend:x,legendPosition:k,legendLayout:A,legendHoverBehavior:S,legendClickBehavior:R,legendHighlightedCategory:N,legendIsolatedCategories:T,layoutSelection:E,annotations:P,onAnnotationActivate:I,annotationObservationCallback:D,onObservation:M,chartId:z,autoPlaceAnnotations:L,svgAnnotationRules:H}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),o=e?g||(Array.isArray(h)?void 0:h):void 0;if(e&&o)t.ingestHierarchy(o,[r,i]),t.buildScene([r,i]);else{const e=ae(u),o=Array.isArray(h)?ae(h):[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[r,i]),t.buildScene([r,i]))}}const W=t?.sceneNodes??[],B=t?.sceneEdges??[],F=t?.labels??[];return jt("div",{ref:o,className:"stream-network-frame"+(y?" "+y:""),role:"img","aria-label":p||("string"==typeof m?m:"Network chart"),style:{position:"relative",width:f?"100%":n[0],height:v?"100%":n[1]},children:[Yt(U,{summary:b}),jt("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[a&&Yt("g",{transform:`translate(${s.left},${s.top})`,children:a}),jt("g",{transform:`translate(${s.left},${s.top})`,children:[_&&Yt("rect",{x:0,y:0,width:r,height:i,fill:_}),B.map((e,t)=>C({node:e,index:t,renderMode:w,fallback:()=>ge(e,t)})).filter(Boolean),W.map((e,t)=>C({node:e,index:t,renderMode:w,fallback:()=>ye(e,t)})).filter(Boolean),F.map((e,t)=>he(e,t)).filter(Boolean)]})]}),Yt(Ht,{width:r,height:i,totalWidth:n[0],totalHeight:n[1],margin:s,labels:F,sceneNodes:W,title:m,legend:x,legendPosition:k,legendLayout:A,legendHoverBehavior:S,legendClickBehavior:R,legendHighlightedCategory:N,legendIsolatedCategories:T,foregroundGraphics:d(l,Y(t?.customLayoutOverlays,E??null)),annotations:P,onAnnotationActivate:I,onObservation:D??M,chartId:z,chartType:"StreamNetworkFrame",autoPlaceAnnotations:L,svgAnnotationRules:H,annotationFrame:0}),Yt(Ot,{marks:t?.customLayoutHtmlMarks,margin:s,selection:E??null})]})}import{jsx as $t,jsxs as Vt}from"react/jsx-runtime";var Gt=/^(value|amount|total|count|weight|score)$/i;function Qt({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?Vt("div",{className:"semiotic-tooltip",style:Be,children:[Vt("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&Vt("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const o=t.__hierarchyNode;if(o){const e=[];let n=o;for(;n;){const o=n.data?.name??n.data?.id??t.id;null!=o&&e.unshift(o+""),n=n.parent}e.length>1&&e.shift();const s=e.length-1;return Vt("div",{className:"semiotic-tooltip",style:Be,children:[$t("div",{children:e.map((e,t)=>Vt("span",{children:[t>0&&$t("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===s?$t("strong",{children:e}):$t("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&$t("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const n=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),s=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),r=Ye(t.data??t),i=null!=r.title?r.title+"":t.id,a=r.entries.some(e=>Gt.test(e.key));return Vt("div",{className:"semiotic-tooltip",style:Be,children:[$t("div",{style:{fontWeight:600},children:i}),r.entries.map(e=>Vt("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",m(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&Vt("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&Vt("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,s!==n&&` (weighted: ${s.toLocaleString()})`]})]})}function qt(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Kt(e,t){if(!t.pathD)return;e.save();const o=qt(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const o=e.createLinearGradient(n.x0,0,n.x1,0),s=t.style.fillOpacity??t.style.opacity??.5,r="string"==typeof t.style.fill?t.style.fill:"#999",i=Ke(e,r)||r;o.addColorStop(0,1===n.from?i:"transparent"),o.addColorStop(1,1===n.to?i:"transparent"),e.fillStyle=o,e.globalAlpha=s}else e.fillStyle=ke(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(o)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(o)),e.restore()}function Ut(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=Ke(e,o)||o,e.lineWidth=t.style.strokeWidth??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=(t.style.strokeWidth??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 Zt(e,t){if(!t.pathD)return;e.save();const o=qt(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=ke(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(o)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(o)),e.restore()}function Jt(e,t){if(!t.pathD)return;e.save();const o=qt(t),n=t.style.stroke||"#999";e.strokeStyle=Ke(e,n)||n,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=ke(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}Qt.ownsChrome=!0;var eo=new Map;function to(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=eo.get(t);return o||(o=new Path2D(Qe(e.symbolType,e.size)),eo.size>256&&eo.clear(),eo.set(t,o)),o}catch{return null}}function oo(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const s=t-e.cx,r=o-e.cy,i=Math.sqrt(s*s+r*r);return i>W(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,o,n);case"rect":return function(e,t,o){const n=B(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,s=o-e.cy,r=Math.sqrt(n*n+s*s);if(e.innerR-2>r||r>e.outerR+2)return null;const i=F(Math.atan2(s,n)),a=F(e.startAngle),l=F(e.endAngle);if(a>l?i>=a||l>=i:i>=a&&l>=i){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);case"symbol":return function(e,t,o,n=30){const s=t-e.cx,r=o-e.cy,i=Math.sqrt(s*s+r*r);return i>W(qe(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,o,n);case"glyph":return function(e,t,o,n=30){if(null==e.datum)return null;const s=Ve(e.glyph,e.size),r=e.cx+s.centerDx,i=e.cy+s.centerDy,a=t-r,l=o-i,c=Math.sqrt(a*a+l*l);return c>W(s.radius,n)?null:{type:"node",datum:e.datum,x:r,y:i,distance:c}}(e,t,o,n);default:return null}}var no=null,so=null;function ro(){return so||((no=document.createElement("canvas")).width=1,no.height=1,so=no.getContext("2d")),so}function io(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function ao(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=io(e),s=ro();if(!n||!s)return null;try{if(s.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=s.lineWidth;s.lineWidth=10;const i=s.isPointInStroke(n,t,o);if(s.lineWidth=r,i)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,s=e.y2-e.y1,r=n*n+s*s;if(0===r)return null;let i=((t-e.x1)*n+(o-e.y1)*s)/r;i=Math.max(0,Math.min(1,i));const a=e.x1+i*n,l=e.y1+i*s,c=Math.sqrt((t-a)**2+(o-l)**2);return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=io(e),s=ro();if(!n||!s)return null;try{if(s.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=s.lineWidth;s.lineWidth=10;const i=s.isPointInStroke(n,t,o);if(s.lineWidth=r,i)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function lo(e){const{clientX:t,clientY:o,canvasRect:n,margin:s,adjustedWidth:r,adjustedHeight:i,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:d,hitRadius:u=30}=e,h=t-n.left-s.left,g=o-n.top-s.top;if(0>h||h>r||0>g||g>i)return{kind:"miss-outside"};const y=function(e,t,o,n,s=30,r,i=0){let a=null,l=s,c=1/0;if(r){const e=p(r,o,n,s,i,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(r&&"circle"===t.type)continue;const e=oo(t,o,n,s);if(e)if("rect"===t.type){const o=t.w*t.h;c>o&&(a=e,c=o)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=ao(e,o,n);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,h,g,u,c,d);return y?{kind:"hit",hover:We(y.datum||{},y.x,y.y,{nodeOrEdge:y.type})}:{kind:"miss"}}import{useCallback as co}from"react";var uo="StreamNetworkFrame";import{jsx as ho,jsxs as go}from"react/jsx-runtime";var yo={top:20,right:80,bottom:20,left:80},po={top:40,right:40,bottom:40,left:40},mo=new Set(["chord","force","circlepack","orbit"]),fo=[800,600],vo=it(rt(function(r,i){const{chartType:a,nodes:c,edges:u,data:h,initialEdges:g,nodeIDAccessor:p="id",sourceAccessor:m="source",targetAccessor:f="target",valueAccessor:w="value",edgeIdAccessor:C,childrenAccessor:R,hierarchySum:N,orientation:T="horizontal",nodeAlign:z="justify",nodePaddingRatio:L=.05,nodeWidth:H=15,iterations:W=300,forceStrength:B=.1,layoutExecution:F="auto",layoutLoadingContent:O,onLayoutStateChange:j,padAngle:J=.01,groupWidth:ee=20,sortGroups:te,edgeSort:ne,treeOrientation:se="vertical",edgeType:ue="curve",padding:he,paddingTop:ge,tensionConfig:ye,showParticles:pe=!1,particleStyle:me,renderMode:be,nodeStyle:_e,edgeStyle:we,colorBy:Ae,colorScheme:Ce="category10",edgeColorBy:Re="source",edgeOpacity:Ne=.5,colorByDepth:Te=!1,nodeSize:ze=8,nodeSizeRange:Le=[5,20],nodeLabel:He,showLabels:Be=!0,labelMode:Fe,size:Ye=fo,responsiveWidth:je,responsiveHeight:Xe,margin:$e,className:Ve,background:Ge,enableHover:Qe=!0,tooltipContent:qe,customHoverBehavior:rt,customClickBehavior:it,onObservation:ct,annotationObservationCallback:dt,chartId:ut,onTopologyChange:ht,annotations:gt,onAnnotationActivate:yt,autoPlaceAnnotations:pt,svgAnnotationRules:mt,legend:ft,legendPosition:vt,legendLayout:bt,legendHoverBehavior:_t,legendClickBehavior:wt,legendHighlightedCategory:xt,legendIsolatedCategories:kt,title:At,foregroundGraphics:St,backgroundGraphics:Ct,decay:Rt,pulse:Nt,transition:Tt,animate:Et,staleness:Pt,frameScheduler:Dt,clock:Mt,random:zt,seed:Lt,paused:Wt=!1,suspendWhenHidden:Bt=!0,thresholds:Ft,accessibleTable:Yt=!0,description:jt,summary:$t,orbitMode:Vt,orbitSize:Gt,orbitSpeed:qt,orbitRevolution:eo,orbitRevolutionStyle:oo,orbitEccentricity:no,orbitShowRings:so,orbitAnimated:ro,customNetworkLayout:io,onLayoutError:ao,layoutConfig:vo,layoutSelection:bo}=r,_o=mo.has(a)?po:yo,wo=Je(!0),xo=Ee({sizeProp:Ye,responsiveWidth:je,responsiveHeight:Xe,userMargin:$e,marginDefault:_o,title:At,legend:ft,legendPosition:vt,foregroundGraphics:St,backgroundGraphics:Ct,animate:Et,transitionProp:Tt,frameScheduler:Dt,clock:Mt,random:zt,seed:Lt,paused:Wt,suspendWhenHidden:Bt,themeDirtyRef:wo}),{reducedMotionRef:ko,responsiveRef:Ao,size:So,margin:Co,adjustedWidth:Ro,adjustedHeight:No,resolvedForeground:To,resolvedBackground:Eo,transition:Po,introEnabled:Io,tableId:Do,rafRef:Mo,renderFnRef:zo,scheduleRender:Lo,frameRuntime:Ho,currentTheme:Wo}=xo,Bo=Ie(),Fo=Me(),Oo=ot(()=>ae(c),[c]),Yo=ot(()=>Array.isArray(u)?ae(u):u,[u]),jo=ot(()=>({...at,...ye}),[ye]),Xo=ot(()=>({...lt,...me}),[me]),$o=ot(()=>{return{chartType:(e={chartType:a,clock:Ho.now,random:zt,seed:Lt,nodeIDAccessor:p,sourceAccessor:m,targetAccessor:f,valueAccessor:w,edgeIdAccessor:C,childrenAccessor:R,hierarchySum:N,orientation:T,nodeAlign:z,nodePaddingRatio:L,nodeWidth:H,iterations:W,forceStrength:B,padAngle:J,groupWidth:ee,sortGroups:te,edgeSort:ne,treeOrientation:se,edgeType:ue,padding:he,paddingTop:ge,tensionConfig:jo,showParticles:pe,particleStyle:Xo,nodeStyle:_e,edgeStyle:we,nodeLabel:He,showLabels:Be,labelMode:Fe,colorBy:Ae,colorScheme:Ce,edgeColorBy:Re,edgeOpacity:Ne,colorByDepth:Te,nodeSize:ze,nodeSizeRange:Le,decay:Rt,pulse:Nt,transition:Po,introAnimation:Io,staleness:Pt,thresholds:Ft,orbitMode:Vt,orbitSize:Gt,orbitSpeed:qt,orbitRevolution:eo,orbitRevolutionStyle:oo,orbitEccentricity:no,orbitShowRings:so,orbitAnimated:ro,customNetworkLayout:io,onLayoutError:ao,layoutConfig:vo,currentTheme:Wo}).chartType,clock:e.clock,random:e.random,seed:e.seed,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:Ue(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[a,Ho.now,zt,Lt,p,m,f,w,C,R,N,T,z,L,H,W,B,J,ee,te,ne,se,ue,he,ge,jo,pe,Xo,_e,we,He,Be,Fe,Ae,Ce,Re,Ne,Te,ze,Le,Rt,Nt,Po,Io,Pt,Ft,Vt,Gt,qt,eo,oo,no,so,ro,io,ao,vo,Wo]),Vo=D($o),Go=D({chartType:(Qo={chartType:a,nodeIDAccessor:p,sourceAccessor:m,targetAccessor:f,valueAccessor:w,edgeIdAccessor:C,childrenAccessor:R,hierarchySum:N,orientation:T,nodeAlign:z,nodePaddingRatio:L,nodeWidth:H,iterations:W,forceStrength:B,padAngle:J,groupWidth:ee,sortGroups:te,edgeSort:ne,treeOrientation:se,edgeType:ue,padding:he,paddingTop:ge,random:zt,seed:Lt,tensionConfig:jo,customNetworkLayout:io,orbitMode:Vt,orbitSize:Gt,orbitEccentricity:no}).chartType,nodeIDAccessor:Qo.nodeIDAccessor,sourceAccessor:Qo.sourceAccessor,targetAccessor:Qo.targetAccessor,valueAccessor:Qo.valueAccessor,edgeIdAccessor:Qo.edgeIdAccessor,childrenAccessor:Qo.childrenAccessor,hierarchySum:Qo.hierarchySum,orientation:Qo.orientation,nodeAlign:Qo.nodeAlign,nodePaddingRatio:Qo.nodePaddingRatio,nodeWidth:Qo.nodeWidth,iterations:Qo.iterations,forceStrength:Qo.forceStrength,padAngle:Qo.padAngle,groupWidth:Qo.groupWidth,sortGroups:Qo.sortGroups,edgeSort:Qo.edgeSort,treeOrientation:Qo.treeOrientation,edgeType:Qo.edgeType,padding:Qo.padding,paddingTop:Qo.paddingTop,random:Qo.random,seed:Qo.seed,tensionConfig:Qo.tensionConfig,customNetworkLayout:Qo.customNetworkLayout,orbitMode:Qo.orbitMode,orbitSize:Qo.orbitSize,orbitEccentricity:Qo.orbitEccentricity});var Qo;const qo=Je(0),Ko=Je(0),Uo=Je(!1),Zo=Je(null);Zo.current||(Zo.current=new It(Vo));const Jo=De("StreamNetworkFrame"),en=nt((e,t,o=!1)=>Se(Jo.current,e,()=>e.buildScene(t),o),[Jo]),[tn,on]=et(null),[nn,sn]=et(0),[rn,an]=et(0),[ln,cn]=et(!1),[dn,un]=et(!1),hn=Je(0),gn=Je(null),yn=Je(!1),pn=Je(j);pn.current=j;const mn=Je(Vo);mn.current=Vo;const fn=Je(null),vn=Je(new Map),bn=Je(0),_n=nt(e=>function(e){const{node:t,colorBy:o,colorScheme:n,nodeColorMap:s,colorIndexRef:r}=e;if("function"==typeof o)return o(t)+"";if("string"==typeof o&&t.data){const e=t.data[o];if(void 0!==e){if(!s.has(e+"")){const t=Array.isArray(n)?n:V;s.set(e+"",t[r.current++%t.length])}return s.get(e+"")}}if(s.has(t.id))return s.get(t.id);const i=Array.isArray(n)?n:V,a=o?i[r.current++%i.length]:i[0];return s.set(t.id,a),a}({node:e,colorBy:Ae,colorScheme:Ce,nodeColorMap:vn.current,colorIndexRef:bn}),[Ae,Ce]),wn=nt(e=>{bn.current=function(e){const{sceneNodes:t,nodes:o,nodeColorMap:n,colorScheme:s}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const r=Array.isArray(s)?s:V,i=Array.from(o);for(let e=0;i.length>e;e++){const t=i[e];n.has(t.id)||n.set(t.id,r[e%r.length])}return i.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:vn.current,colorScheme:Ce})},[Ce]),xn=nt((e,t)=>{en(e,t),wn(e),wo.current=!1,e.markStylePaintPending()},[en,wn]),kn=(An=Wo,An?.colors?.border||An?.colors?.secondary||An?.colors?.primary||"#999");var An;const Sn=nt(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Zo.current?.nodes),[]),Cn=nt(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:n,resolveEndpoint:s,fallback:r}=e;if("function"==typeof o)return o(t);const i=s(t.source),a=s(t.target);return"target"===o&&a?n(a):i?n(i):r}({edge:e,edgeColorBy:Re,getNodeColor:_n,resolveEndpoint:Sn,fallback:kn}),[Re,_n,kn,Sn]),Rn=nt(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:n,hasExplicitParticleColorBy:s,getEdgeColor:r,getNodeColor:i,resolveEndpoint:a,fallback:l}=e;if("function"==typeof o){const e=a(t.source);return e?o(t,e):l}if(!s)return r(t);const c=n,d=a(t.source),u=a(t.target);return"target"===c&&u?i(u):d?i(d):l}({edge:e,particleStyleColor:Xo.color,particleColorBy:Xo.colorBy,hasExplicitParticleColorBy:!!me?.colorBy,getEdgeColor:Cn,getNodeColor:_n,resolveEndpoint:Sn,fallback:kn}),[me?.colorBy,Xo.color,Xo.colorBy,_n,Cn,kn,Sn]),Nn=function(e,t,o,n,s){return("sankey"===e||t)&&o||n||s}(a,!!io,pe,!!Nt,Zo.current?.isAnimating??!1);P(Zo,Vo,wo,Lo),I(Zo,bo,wo,Lo),tt(()=>{const e=Zo.current;e&&(xn(e,[Ro,No]),Lo())},[Wo,Ro,No,xn,Lo]);const Tn=nt(()=>{const e=Zo.current;if(e&&(e.runLayout([Ro,No]),xn(e,[Ro,No]),sn(e.layoutVersion),ht)){const{nodes:t,edges:o}=e.getLayoutData();ht(t,o)}},[Ro,No,xn,ht]),En=nt(e=>{if(null==e||"object"!=typeof e)return;const t=Zo.current;t&&(t.ingestEdge(e)&&Tn(),Lo())},[Tn,Lo]),Pn=nt(e=>{const t=Zo.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&Tn(),Lo()},[Tn,Lo]),In=nt(()=>{Zo.current?.clear(),vn.current.clear(),bn.current=0,sn(Zo.current?.layoutVersion??0),on(null),fn.current=null,wo.current=!0,Lo()},[Lo]),Dn=nt(()=>{const e=Zo.current;e&&(e.tension+=999,Tn(),Lo())},[Tn,Lo]);st(i,()=>({push:En,pushMany:Pn,removeNode:e=>{const t=Zo.current?.removeNode(e)??!1;if(t){const t=fn.current?.data?"function"==typeof p?p(fn.current.data):fn.current.data[p]:void 0;fn.current&&"node"===fn.current.nodeOrEdge&&t===e&&(fn.current=null,on(null)),vn.current.delete(e),Tn(),wo.current=!0,Lo()}return t},removeEdge:(e,t)=>{const o=Zo.current?.removeEdge(e,t)??!1;if(o){if(fn.current&&"edge"===fn.current.nodeOrEdge){const o=fn.current.data;let n;n=void 0!==t?("object"==typeof o?.source?o.source.id:o?.source)===e&&("object"==typeof o?.target?o.target.id:o?.target)===t:!C||!o||("function"==typeof C?C:e=>e?.[C])(o)===e,n&&(fn.current=null,on(null))}Tn(),wo.current=!0,Lo()}return o},updateNode:(e,t)=>{const o=Zo.current?.updateNode(e,t)??null;return o&&(Tn(),wo.current=!0,Lo()),o},updateEdge:(e,t,o)=>{const n=Zo.current?.updateEdge(e,t,o)??[];return n.length>0&&(Tn(),wo.current=!0,Lo()),n},clear:In,getTopology:()=>Zo.current?.getLayoutData()??{nodes:[],edges:[]},getCustomLayout:()=>Zo.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Zo.current?.lastCustomLayoutFailure??null,getTopologyDiff:()=>{const e=Zo.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:Dn,getTension:()=>Zo.current?.tension??0}),[En,Pn,In,Dn,p,Tn,Lo,C]);const Mn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(a),zn=Mn?h||(Array.isArray(u)?void 0:u):void 0;tt(()=>{const s=Zo.current;if(!s)return;const r=++hn.current;if(gn.current?.abort(),gn.current=null,Mn&&zn)s.ingestHierarchy(zn,[Ro,No]),xn(s,[Ro,No]),un(!1),pn.current?.("ready"),Lo();else{const i=Oo,l=Array.isArray(Yo)?Yo:[];if(0===i.length&&0===l.length)return null==c&&null==u||0>=s.nodes.size&&0>=s.edges.size||In(),un(!1),void pn.current?.("ready");const d=[Ro,No],h="force"===a&&!io&&e()&&!zt&&n(F,i.length,l.length,W);if(h&&Fo&&!yn.current&&s.sceneNodes.length>0)return yn.current=!0,un(!1),pn.current?.("ready"),wo.current=!0,void Lo();if(h){const e=new AbortController;gn.current=e;const n=s._lastPositionSnapshot;s.ingestBounded(i,l,d,{deferLayout:!0});const a=s.getLayoutData(),c=t(a.nodes,a.edges,mn.current,d,n);return un(!0),pn.current?.("pending"),o(c,e.signal).then(({positions:e})=>{r===hn.current&&(s.applyForceLayoutPositions(e,d),xn(s,d),un(!1),pn.current?.("ready"),sn(s.layoutVersion),Lo())}).catch(e=>{"AbortError"!==e.name&&r===hn.current&&(s.runLayout(d),xn(s,d),un(!1),pn.current?.("error"),sn(s.layoutVersion),Lo())}),()=>e.abort()}s.ingestBounded(i,l,d),xn(s,d),un(!1),pn.current?.("ready"),Lo()}},[Oo,Yo,c,u,h,zn,Mn,Ro,No,Go,F,W,Fo,a,io,zt,Lo,In,xn]);const Ln=Ze.useRef(!1);tt(()=>{Ln.current||g&&g.length>0&&(Ln.current=!0,Pn(g))},[g,Pn]);const{customHoverBehavior:Hn,customClickBehavior:Wn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n}){return{customHoverBehavior:co((t,s)=>{e?.(t,s),ie({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:uo,chartId:n,context:s})},[e,o,n]),customClickBehavior:co((e,s)=>{t?.(e,s),re({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:uo,chartId:n,context:s})},[t,o,n])}}({customHoverBehavior:rt,customClickBehavior:it,onObservation:ct,chartId:ut}),{hoverHandlerRef:Bn,hoverLeaveRef:Fn,onPointerMove:On,onPointerLeave:Yn}=xo,jn=()=>!io||(Zo.current?.hasCustomRestyle??!1);Bn.current=e=>{if(!Qe)return;const t=jn(),o=Un.current;if(!o)return;const n=Zo.current;if(!n)return;const s=lo({clientX:e.clientX,clientY:e.clientY,canvasRect:o.getBoundingClientRect(),margin:Co,adjustedWidth:Ro,adjustedHeight:No,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===s.kind?(fn.current=s.hover,on(s.hover),Hn&&(Hn(s.hover),t&&(wo.current=!0)),t&&Lo()):fn.current&&(fn.current=null,on(null),Hn&&(Hn(null),t&&(wo.current=!0)),t&&Lo())},Fn.current=()=>{if(fn.current){const e=jn();fn.current=null,on(null),Hn&&(Hn(null),e&&(wo.current=!0)),e&&Lo()}};const Xn=Je(()=>{});Xn.current=e=>{if(Oe(e.target))return;if(!it&&!ct)return;const t=Un.current;if(!t)return;const o=Zo.current;if(!o)return;const n=lo({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:Co,adjustedWidth:Ro,adjustedHeight:No,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===n.kind?Wn(n.hover,{type:"activate",inputType:fe(e.nativeEvent.pointerType)}):"miss"===n.kind&&Wn(null)};const $n=nt(e=>Xn.current(e),[]),Vn=Je(-1),Gn=Je(null),Qn=Je(-1),qn=nt(e=>{if(ce(e))return;const t=Zo.current;if(!t)return;const o=()=>{Vn.current=-1,Gn.current=null,Qn.current=-1,fn.current=null,on(null),Hn&&(Hn(null),wo.current=!0),Lo()},n=y(t.sceneNodes);if(0===n.length)return void(0>Vn.current||o());const s=l(n);let r=Vn.current;if(s.flat.length>r||(o(),r=-1)," "===e.key&&r>=0){e.preventDefault();const t=s.flat[r];return void Wn(We(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Vn.current=0,Qn.current=-1;const t=s.flat[0];Gn.current={shape:t.shape,w:t.w,h:t.h};const o=We(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return fn.current=o,on(o),Hn&&(Hn(o,{type:"focus",inputType:"keyboard"}),wo.current=!0),void Lo()}const i=E(s,r),a=_(e.key,i,s,t.sceneEdges??[],Qn);if(null===a)return;if(e.preventDefault(),0>a)return void o();Vn.current=a;const c=s.flat[a];Gn.current={shape:c.shape,w:c.w,h:c.h};const d={data:c.datum||{},x:c.x,y:c.y,__semioticHoverData:!0,nodeOrEdge:"node"};fn.current=d,on(d),Hn&&(Hn(d,{type:"focus",inputType:"keyboard"}),wo.current=!0),Lo()},[Wn,Hn,Lo]),Kn=nt(e=>{Vn.current=-1,Gn.current=null,On(e)},[On]);zo.current=()=>{if(Mo.current=null,!Ho.isActive)return;const e=Un.current;if(!e)return;const t=Zo.current;t&&function(e){const{canvas:t,store:o,sceneRevisionDiagnostics:n,size:s,margin:r,adjustedWidth:i,adjustedHeight:a,background:l,renderMode:c,hasBackgroundGraphics:d=!1,dirtyRef:u,lastFrameTimeRef:h,now:g,random:y,reducedMotion:p,showParticles:m,isContinuous:f,animate:_,decay:w,pulse:C,thresholds:R,staleness:N,particleStyle:T,getParticleColor:E,pendingAnnotationFrameRef:P,lastAnnotationFrameTimeRef:I,setAnnotationFrame:D,scheduleNextFrame:M,syncColorMap:z}=e,L=t.getContext("2d");if(!L)return;const H=h.current?Math.min((g-h.current)/1e3,.1):.016;h.current=g;const W=o.advanceTransition(p?g+1e6:g),B=!p&&W,F=!p&&o.tickAnimation([i,a],H),O=u.current,Y=n?.beforeCompute(o.getLastUpdateResult(),B),j=W||O||F;j&&(o.buildScene([i,a]),O&&z?.()),Y&&n?.afterCompute(Y,j,!1);const X=m&&!p&&!!o.particlePool,$=!!w||!!C||!!R||!1!==_&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,V=o.consumeStylePaintPending(),G=v({dirtyOrRebuilt:O,transitioning:B,animationTicked:F,continuous:X||f,liveEncoding:$,forced:V}),Q=!!N&&o.lastIngestTime>0&&g-o.lastIngestTime>(N?.threshold??5e3);if(G){const e=le();if(!ve(t,s,r,e))return;if(L.clearRect(-r.left,-r.top,s[0],s[1]),x(L,{background:l,hasBackgroundGraphics:d,width:i,height:a}),w&&o.applyDecay(),C&&o.applyPulse(g),R&&o.applyThresholds(g),!1!==_&&o.applyTopologyDiff(g),Q&&(L.globalAlpha=N?.dimOpacity??.5),k({context:L,nodes:o.sceneEdges,renderMode:c,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const o of t)switch(o.type){case"bezier":Kt(e,o);break;case"line":Ut(e,o);break;case"ribbon":Zt(e,o);break;case"curved":Jt(e,o)}}(L,e)}),k({context:L,nodes:o.sceneNodes,renderMode:c,pixelRatio:e,paintBuiltIn:e=>{const t=e;!function(e,t){for(const o of t){if("rect"!==o.type)continue;const t=o;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=ke(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.strokeRect(t.x,t.y,t.w,t.h)),S(e,t),e.restore())}}(L,t),function(e,t){for(const o of t){if("circle"!==o.type)continue;const t=o;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=ke(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),A(e,t),e.restore())}}(L,t),function(e,t){for(const o of t){if("arc"!==o.type)continue;const t=o;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=ke(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(L,t),function(e,t){const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const s=to(t);if(!s)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const r=t.style.opacity??1;t.style.fill&&(e.globalAlpha=o*r*(t.style.fillOpacity??1),e.fillStyle=ke(e,t.style.fill,"#007bff"),e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*r,e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(s)),e.restore()}}(L,t),b(L,t)}}),X&&!Q){const e=o.edgesArray;if(e.length>0){!function(e,t,o,n,s=Math.random){const r=n.spawnRate??.1,i=n.maxPerEdge??50;for(let n=0;t.length>n;n++){const a=t[n];if(!a.bezier)continue;if(e.countForEdge(n)>=i)continue;const l=a.value*r*o*(a.bezier.circular?.3:1),c=Math.floor(l),d=l-c;let u=c;s()<d&&u++;for(let t=0;u>t&&e.countForEdge(n)<i;t++)e.spawn(n,s)}}(o.particlePool,e,H,T,y);const t=.5*(T.speedMultiplier??1);let n;if(T.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)}o.particlePool.step(H,t,e,n),function(e,t,o,n,s){const r=n.radius??3;e.globalAlpha=n.opacity??.7;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=o[a.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:s(l),e.fillStyle=Ke(e,c)||c,e.beginPath(),e.arc(a.x,a.y,r,0,2*Math.PI),e.fill()}e.globalAlpha=1}(L,o.particlePool,e,T,E)}}Q&&(L.globalAlpha=1)}u.current=!1,(O||B||F)&&t.setAttribute("aria-label",oe(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const q=O||B||F||P.current;q&&g-I.current>=33?(D(e=>e+1),I.current=g,P.current=!1):P.current=!!q,(f||B||null!=o.transition||F||o.hasActivePulses||o.hasActiveThresholds||!1!==_&&o.hasActiveTopologyDiff||P.current)&&M()}({canvas:e,store:t,sceneRevisionDiagnostics:Jo.current,size:So,margin:Co,adjustedWidth:Ro,adjustedHeight:No,background:Ge,renderMode:be,hasBackgroundGraphics:!!Ct,dirtyRef:wo,lastFrameTimeRef:qo,now:Ho.now(),random:Ho.random,reducedMotion:!!ko.current,showParticles:pe,isContinuous:Nn,animate:Et,decay:Rt,pulse:Nt,thresholds:Ft,staleness:Pt,particleStyle:Xo,getParticleColor:Rn,pendingAnnotationFrameRef:Uo,lastAnnotationFrameTimeRef:Ko,setAnnotationFrame:an,scheduleNextFrame:()=>{Lo()},syncColorMap:()=>wn(t)})};const{canvasRef:Un}=Pe(xo,{hydrated:Bo,wasHydratingFromSSR:Fo,storeRef:Zo,dirtyRef:wo,skipInitialCanvasPaintInvalidation:!0,canvasPaintDependencies:[a,Ro,No,Ge,Ct,be,Lo]});M(Pt,Zo,wo,Lo,ln,cn);const Zn=Qe&&tn?ho(G,{x:tn.x,y:tn.y,containerWidth:Ro,containerHeight:No,margin:Co,className:"stream-network-tooltip",zIndex:2,children:qe?qe(tn):ho(Qt,{data:tn})}):null;if(de||!Bo&&Fo)return ho(Xt,{props:r,store:Zo.current,responsiveRef:Ao,size:So,margin:Co,adjustedWidth:Ro,adjustedHeight:No,resolvedBackground:Eo,resolvedForeground:To});const Jn=Zo.current;return go("div",{ref:Ao,className:"stream-network-frame"+(Ve?" "+Ve:""),role:"group","aria-label":jt||("string"==typeof At?At:"Network chart"),tabIndex:0,"aria-busy":dn||void 0,style:{position:"relative",width:je?"100%":So[0],height:Xe?"100%":So[1],overflow:"visible"},onKeyDown:qn,children:["production"!==process.env.NODE_ENV&&Zo.current&&ho(K,{store:Zo.current,diagnostics:Jo.current}),Yt&&ho(Z,{tableId:Do}),Yt&&ho(q,{nodes:Jn?.sceneNodes??[],edges:Jn?.sceneEdges??[],chartType:"Network chart",tableId:Do,chartTitle:"string"==typeof At?At:void 0}),ho(U,{summary:$t}),ho(X,{hoverPoint:tn}),go("div",{role:"img","aria-label":jt||("string"==typeof At?At:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Qe?Kn:void 0,onMouseLeave:Qe?Yn:void 0,onClick:it||ct?$n:void 0,children:[dn&&!1!==O&&ho("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:xe(!0,So[0],So[1],O)}),ho($,{size:So,margin:Co,overflowVisible:!0,children:Eo}),ho("canvas",{ref:Un,"aria-label":oe(Jn?.sceneNodes?.length??0,Jn?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),ho(Ht,{width:Ro,height:No,totalWidth:So[0],totalHeight:So[1],margin:Co,labels:Jn?.labels||[],sceneNodes:Jn?.sceneNodes,title:At,legend:ft,legendPosition:vt,legendLayout:bt,legendHoverBehavior:_t,legendClickBehavior:wt,legendHighlightedCategory:xt,legendIsolatedCategories:kt,foregroundGraphics:d(To,Y(Zo.current?.customLayoutOverlays,bo??null)),annotations:gt,onAnnotationActivate:yt,onObservation:dt??ct,chartId:ut,chartType:"StreamNetworkFrame",autoPlaceAnnotations:pt,svgAnnotationRules:mt,annotationFrame:rn}),ho(Ot,{marks:Jn?.customLayoutHtmlMarks,margin:Co,selection:bo??null}),ho(Q,{active:Vn.current>=0,hoverPoint:tn,margin:Co,size:So,shape:Gn.current?.shape,width:Gn.current?.w,height:Gn.current?.h}),Zn,Pt?.showBadge&&ho(s,{isStale:ln,position:Pt.badgePosition})]})]})}));vo.displayName="StreamNetworkFrame";var bo=vo,_o=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,o=e._mean-this._mean;this._mean+=o*e._count/t,this._m2+=e._m2+o*o*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},wo=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const o=this.hop,n=Math.floor(e/o);for(let s=Math.floor((e-this.size)/o)+1;n>=s;s++)this.bump(s*o,t)}bump(e,t){let o=this.windows.get(e);o||(o=new _o,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,n=new _o;n.push(t);let s=e,r=e;const i=[],a={start:s,end:r,stats:n};for(const t of this.sessions)e-o>t.end||t.start>e+o?i.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>r&&(r=t.end));a.start=s,a.end=r,i.push(a),i.sort((e,t)=>e.start-t.start),this.sessions=i}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let o=0;t>o;o++)this.windows.delete(e[o])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,o]of this.windows){const n=t+this.size;e.push(this.row(t,n,o,n>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,o,n){return{start:e,end:t,count:o.count,mean:o.mean,sum:o.sum,min:o.min,max:o.max,stddev:o.stddev,partial:n}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function xo(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function ko(e,t,o,n=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=xo(e,o),r=e.stddev*n;return[s-r,s+r]}var Ao={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},So=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Co(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;So.lastIndex=0;let o,n=0,s=0;for(;null!==(o=So.exec(t));){const e=parseFloat(o[1]),t=Ao[o[2]];if(null==t||!Number.isFinite(e))return null;n+=e*t,s+=o[0].length}return s!==t.length?null:n>0?n:null}var Ro=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const o=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,o.push(e),"drop"===this.latePolicy?{released:[],late:o}:{released:[e],late:o}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:o})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],o=[];for(const n of this.held)this.getTime(n)>e?o.push(n):t.push(n);return this.held=o,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as No,useImperativeHandle as To,forwardRef as Eo,useCallback as Po,useState as Io,useEffect as Do}from"react";import{jsx as Mo,jsxs as zo}from"react/jsx-runtime";var Lo={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},Ho={opacity:.7,marginRight:4};function Wo(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function Bo(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Fo(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:s="y"}=e;return e=>{const r=e?.data??null,i=Wo(r,t,"time"),a=Wo(r,o,"value");return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[zo("span",{style:Ho,children:[n,":"]}),Bo(i)]}),zo("div",{children:[zo("span",{style:Ho,children:[s,":"]}),Bo(a)]})]})}}function Oo(e,t){return null!=e?e:Math.max(t?.length??0,200)}var Yo="time",jo="value",Xo="__aggLower",$o="__aggUpper",Vo="__aggPartial",Go="count",Qo="__aggStart",qo="__aggEnd";function Ko(e,t){const o=t.stat??"mean",n=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[Yo]:(e.start+e.end)/2,[jo]:xo(e,o),[Go]:e.count,[Vo]:e.partial,[Qo]:e.start,[qo]:e.end},r=ko(e,n,o,s);return r&&(t[Xo]=r[0],t[$o]=r[1]),t})}import{jsx as Uo}from"react/jsx-runtime";function Zo(e,t,o){const n="function"==typeof t?t(e):e[t??o];if(null==n)return null;if(n instanceof Date)return n.getTime();const s=Number(n);return Number.isFinite(s)?s:null}var Jo=Eo(function(e,t){const o=Ne(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:s,className:i,arrowOfTime:l="right",windowMode:c="sliding",windowSize:d,data:u,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:p,extentPadding:m,stroke:f="#007bff",strokeWidth:v=2,strokeDasharray:b,opacity:_,background:w,tooltipContent:x,tooltip:k,onHover:A,annotations:S,autoPlaceAnnotations:C,svgAnnotationRules:R,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,transition:D,linkedHover:M,selection:z,onObservation:L,chartId:H,loading:W,loadingContent:B,emptyContent:F,emphasis:O,legendPosition:Y,aggregate:j,eventTime:X}=e,$=o.showAxes,V=o.enableHover,G=s??o.marginDefaults,Q=n??[o.width,o.height],q=x??k??Fo({timeAccessor:h,valueAccessor:g}),K=No(null),{customHoverBehavior:U}=Te({selection:z,linkedHover:M,unwrapData:!0,onObservation:L,chartType:"RealtimeLineChart",chartId:H}),Z=Po(e=>{A&&A(e),U(e)},[A,U]),J=null!=j,[ee,te]=Io([]),oe=No(null),ne=No(j);ne.current=j;const se=No(J);se.current=J;const re=No(ee);re.current=ee;const ie=No({timeAccessor:h,valueAccessor:g});ie.current={timeAccessor:h,valueAccessor:g},Do(()=>{if(!J)return void(oe.current=null);const e=ne.current,t=function(e){const t=e.window??"tumbling",o=Co("session"===t?e.gap??e.size:e.size);if(null==o)return null;const n=null!=e.hop?Co(e.hop):void 0,s=null!=e.gap?Co(e.gap):void 0;return new wo({window:t,size:o,hop:n??void 0,gap:s??void 0,retain:e.retain})}(e);if(oe.current=t,t&&u){const{timeAccessor:e,valueAccessor:o}=ie.current;for(const n of u){const s=Zo(n,e,"time"),r=Zo(n,o,"value");null!=s&&null!=r&&t.push(s,r)}}te(t?Ko(t,e):[])},[J?[j.window??"tumbling",j.size,j.hop??"",j.gap??"",j.retain??""].join("|"):"",J,u]),Do(()=>{J&&oe.current&&te(Ko(oe.current,ne.current))},[j?.stat,j?.band,j?.sigma]);const ae=Po(e=>{const t=oe.current,o=ne.current;if(!t||!o)return;const{timeAccessor:n,valueAccessor:s}=ie.current;for(const o of e){const e=Zo(o,n,"time"),r=Zo(o,s,"value");null!=e&&null!=r&&t.push(e,r)}te(Ko(t,o))},[]),le=null!=X,ce=No(null),de=No(X);de.current=X;const ue=No(le);ue.current=le;const he=No(L);he.current=L;const ge=No(H);ge.current=H,Do(()=>{ce.current=le?function(e){const t=Co(e.lateness);return null==t?null:new Ro({lateness:t,getTime:e=>Zo(e,ie.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(de.current):null},[le?`${X.lateness}|${X.latePolicy??"drop"}`:"",le]);const ye=Po(e=>{0!==e.length&&(se.current?ae(e):K.current?.pushMany(e))},[ae]),pe=Po(e=>{const t=ce.current;if(!ue.current||!t)return void ye(e);const o=[];for(const n of e){const e=t.push(n);if(e.released.length&&o.push(...e.released),e.late.length){const o=he.current;if(o){const{timeAccessor:n}=ie.current,s=de.current?.latePolicy??"drop";for(const r of e.late)o({type:"late-data",datum:r,eventTime:Zo(r,n,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:ge.current})}}}ye(o)},[ye]);To(t,()=>({push:e=>pe([e]),pushMany:e=>pe(e),remove:e=>se.current?[]:K.current?.remove(e)??[],update:(e,t)=>se.current?[]:K.current?.update(e,t)??[],clear:()=>{ce.current?.clear(),se.current?(oe.current?.clear(),te([])):K.current?.clear()},getData:()=>se.current?re.current:K.current?.getData()??[],getScales:()=>K.current?.getScales()??null}),[pe]);const me=xe(W,Q[0],Q[1],B),fe=me?null:_e(J?void 0:u,Q[0],Q[1],F),ve={stroke:f,strokeWidth:v,strokeDasharray:b};null!=_&&(ve.opacity=_);const be=Oo(d,u),we=J?ee:u,ke=J?Yo:h,Ae=J?jo:g,Se=J&&j&&"none"!==(j.band??"none")?{y0Accessor:Xo,y1Accessor:$o,perSeries:!1}:void 0;return me||fe||Uo(r,{ref:K,chartType:"line",runtimeMode:"streaming",size:Q,margin:G,className:O?`${i||""} semiotic-emphasis-${O}`.trim():i,arrowOfTime:l,windowMode:J?"growing":c,windowSize:J?Math.max(1,j?.retain??Math.max(ee.length,600)):be,data:we,timeAccessor:ke,valueAccessor:Ae,xExtent:y,yExtent:p,extentPadding:m,band:Se,lineStyle:ve,showAxes:$,background:w,hoverAnnotation:V,tooltipContent:q,...a({linkedHover:M,selection:z,onObservation:L,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:Z}),annotations:S,autoPlaceAnnotations:C,svgAnnotationRules:R,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,transition:D,pointIdAccessor:e.pointIdAccessor,legendPosition:Y})});Jo.displayName="RealtimeLineChart";import{useRef as en,useImperativeHandle as tn,forwardRef as on,useCallback as nn,useMemo as sn}from"react";import{jsx as rn}from"react/jsx-runtime";var an=on(function(e,t){const o=Ne(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,showLegend:e.showLegend,enableHover:null!=e.enableHover?!!e.enableHover:void 0,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{binSize:n,size:s,margin:i,className:l,arrowOfTime:c="right",windowMode:d="sliding",windowSize:u,data:h,timeAccessor:g,valueAccessor:y,direction:p="up",timeExtent:m,valueExtent:f,extentPadding:v,categoryAccessor:b,colors:_,fill:w,stroke:x,strokeWidth:k,opacity:A,gap:S,background:C,tooltipContent:N,tooltip:T,onHover:E,annotations:P,autoPlaceAnnotations:I,svgAnnotationRules:D,tickFormatTime:M,tickFormatValue:z,linkedHover:L,selection:H,decay:W,pulse:B,staleness:F,transition:O,onObservation:Y,chartId:j,loading:X,loadingContent:$,emptyContent:V,emphasis:G,legendPosition:Q,legend:q,brush:K,onBrush:U,linkedBrush:Z}=e,J=o.showAxes,ee=o.enableHover,te=s??[o.width,o.height],oe=sn(()=>_?e=>_[e]??w??"#999":void 0,[_,w]),{legend:ne,margin:se,legendPosition:re}=Re({data:h??[],colorBy:b,colorScale:oe,showLegend:o.showLegend,legendPosition:Q,userMargin:i,defaults:o.marginDefaults,additionalLegend:q}),ie=N??T??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null;if(null==n?.binStart||null==n?.binEnd){const e=Wo(n,t,"time"),s=Wo(n,o,"value");return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Ho,children:"x:"}),Bo(e)]}),zo("div",{children:[Mo("span",{style:Ho,children:"y:"}),Bo(s)]})]})}return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Ho,children:"range:"}),Bo(n.binStart),"–",Bo(n.binEnd)]}),null!=n.total&&zo("div",{children:[Mo("span",{style:Ho,children:"count:"}),Bo(n.total)]}),null!=n.category&&zo("div",{children:[Mo("span",{style:Ho,children:"category:"}),Bo(n.category)]})]})}}({timeAccessor:g,valueAccessor:y}),ae=en(null),{customHoverBehavior:le}=Te({selection:H,linkedHover:L,unwrapData:!0,onObservation:Y,chartType:"RealtimeHistogram",chartId:j}),ce=nn(e=>{E&&E(e),le(e)},[E,le]),de=!0===K?{dimension:"x",snap:"bin"}:"x"===K?{dimension:"x"}:"object"==typeof K?K:void 0,ue=pe(Z),he="string"==typeof g?g:"time",ge=Ce({name:ue?.name||"__unused_hist_brush__",xField:ue?.xField||he,...ue?.yField?{yField:ue.yField}:{}}),ye=en(ge.brushInteraction);ye.current=ge.brushInteraction;const me=nn(e=>{if(U&&U(e),Y&&Y(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:j}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:j}),ue){const t=ye.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[U,Y,j,ue]);tn(t,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const fe=xe(X,te[0],te[1],$),ve=fe?null:_e(h,te[0],te[1],V),be={};null!=w&&(be.fill=w),null!=x&&(be.stroke=x),null!=k&&(be.strokeWidth=k),null!=A&&(be.opacity=A),null!=S&&(be.gap=S);const we=G?`${l||""} semiotic-emphasis-${G}`.trim():l,ke=Oo(u,h),Ae=sn(()=>"down"!==p?f:R({data:h,valueAccessor:y,timeAccessor:g,binSize:n,valueExtent:f,extentPadding:v}),[p,h,y,g,n,f,v]);return fe||ve||rn(r,{ref:ae,chartType:"bar",runtimeMode:"streaming",size:te,margin:se,className:we,arrowOfTime:c,windowMode:d,windowSize:ke,data:h,timeAccessor:g,valueAccessor:y,xExtent:m,yExtent:Ae,extentPadding:v,binSize:n,categoryAccessor:b,barColors:_,barStyle:be,showAxes:J,background:C,hoverAnnotation:ee,tooltipContent:ie,...a({linkedHover:L,selection:H,onObservation:Y,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:ce}),annotations:P,autoPlaceAnnotations:I,svgAnnotationRules:D,tickFormatTime:M,tickFormatValue:z,decay:W,pulse:B,staleness:F,transition:O,pointIdAccessor:e.pointIdAccessor,legend:ne,legendPosition:re,brush:de||(Z?{dimension:"x"}:void 0),onBrush:de||Z?me:void 0})});function ln(e){return rn(an,{...e,windowMode:"growing"})}an.displayName="RealtimeHistogram",ln.displayName="TemporalHistogram";import{useRef as cn,useImperativeHandle as dn,forwardRef as un,useCallback as hn}from"react";import{jsx as gn}from"react/jsx-runtime";var yn=un(function(e,t){const o=Ne(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:s,className:i,arrowOfTime:l="right",windowMode:c="sliding",windowSize:d,data:u,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:p,yScaleType:m,extentPadding:f,categoryAccessor:v,colors:b,radius:_,fill:w,opacity:x,stroke:k,strokeWidth:A,pointStyle:S,background:C,tooltipContent:R,tooltip:N,onHover:T,annotations:E,autoPlaceAnnotations:P,svgAnnotationRules:I,tickFormatTime:D,tickFormatValue:M,linkedHover:z,selection:L,onObservation:H,chartId:W,loading:B,loadingContent:F,emptyContent:O,emphasis:Y,legendPosition:j}=e,X=o.showAxes,$=o.enableHover,V=s??o.marginDefaults,G=n??[o.width,o.height],Q=R??N??Fo({timeAccessor:h,valueAccessor:g}),q=cn(null),{customHoverBehavior:K}=Te({selection:L,linkedHover:z,unwrapData:!0,onObservation:H,chartType:"RealtimeSwarmChart",chartId:W}),U=hn(e=>{T&&T(e),K(e)},[T,K]);dn(t,()=>({push:e=>q.current?.push(e),pushMany:e=>q.current?.pushMany(e),remove:e=>q.current?.remove(e)??[],update:(e,t)=>q.current?.update(e,t)??[],clear:()=>q.current?.clear(),getData:()=>q.current?.getData()??[],getScales:()=>q.current?.getScales()??null}),[]);const Z=xe(B,G[0],G[1],F),J=Z?null:_e(u,G[0],G[1],O),ee={};null!=_&&(ee.radius=_),null!=w&&(ee.fill=w),null!=x&&(ee.opacity=x),null!=k&&(ee.stroke=k),null!=A&&(ee.strokeWidth=A);const te=S,oe=Y?`${i||""} semiotic-emphasis-${Y}`.trim():i,ne=Oo(d,u);return Z||J||gn(r,{ref:q,chartType:"swarm",runtimeMode:"streaming",size:G,margin:V,className:oe,arrowOfTime:l,windowMode:c,windowSize:ne,data:u,timeAccessor:h,valueAccessor:g,xExtent:y,yExtent:p,yScaleType:m,extentPadding:f,categoryAccessor:v,barColors:b,swarmStyle:ee,pointStyle:te,showAxes:X,background:C,hoverAnnotation:$,tooltipContent:Q,...a({linkedHover:z,selection:L,onObservation:H,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:E,autoPlaceAnnotations:P,svgAnnotationRules:I,tickFormatTime:D,tickFormatValue:M,legendPosition:j,pointIdAccessor:e.pointIdAccessor})});yn.displayName="RealtimeSwarmChart";import{useRef as pn,useImperativeHandle as mn,forwardRef as fn,useCallback as vn}from"react";import{jsx as bn}from"react/jsx-runtime";var _n=fn(function(e,t){const o=Ne(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:s,className:i,arrowOfTime:l="right",windowMode:c="sliding",windowSize:d,data:u,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:p,extentPadding:m,positiveColor:f,negativeColor:v,connectorStroke:b,connectorWidth:_,gap:w,stroke:x,strokeWidth:k,opacity:A,background:S,tooltipContent:C,tooltip:R,onHover:N,annotations:T,autoPlaceAnnotations:E,svgAnnotationRules:P,tickFormatTime:I,tickFormatValue:D,linkedHover:M,selection:z,onObservation:L,chartId:H,loading:W,loadingContent:B,emptyContent:F,emphasis:O,legendPosition:Y}=e,j=o.showAxes,X=o.enableHover,$=s??o.marginDefaults,V=n??[o.width,o.height],G=C??R??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null,s=Wo(n,t,"time"),r=n?.delta??Wo(n,o,"value"),i=n?.cumEnd,a="number"==typeof r?0>r?Bo(r):"+"+Bo(r):Bo(r);return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Ho,children:"x:"}),Bo(s)]}),zo("div",{children:[Mo("span",{style:Ho,children:"Δ:"}),a]}),null!=i&&zo("div",{children:[Mo("span",{style:Ho,children:"total:"}),Bo(i)]})]})}}({timeAccessor:h,valueAccessor:g}),Q=pn(null),{customHoverBehavior:q}=Te({selection:z,linkedHover:M,unwrapData:!0,onObservation:L,chartType:"RealtimeWaterfallChart",chartId:H}),K=vn(e=>{N&&N(e),q(e)},[N,q]);mn(t,()=>({push:e=>Q.current?.push(e),pushMany:e=>Q.current?.pushMany(e),remove:e=>Q.current?.remove(e)??[],update:(e,t)=>Q.current?.update(e,t)??[],clear:()=>Q.current?.clear(),getData:()=>Q.current?.getData()??[],getScales:()=>Q.current?.getScales()??null}),[]);const U=xe(W,V[0],V[1],B),Z=U?null:_e(u,V[0],V[1],F),J={};null!=f&&(J.positiveColor=f),null!=v&&(J.negativeColor=v),null!=b&&(J.connectorStroke=b),null!=_&&(J.connectorWidth=_),null!=w&&(J.gap=w),null!=x&&(J.stroke=x),null!=k&&(J.strokeWidth=k),null!=A&&(J.opacity=A);const ee=O?`${i||""} semiotic-emphasis-${O}`.trim():i,te=Oo(d,u);return U||Z||bn(r,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:V,margin:$,className:ee,arrowOfTime:l,windowMode:c,windowSize:te,data:u,timeAccessor:h,valueAccessor:g,xExtent:y,yExtent:p,extentPadding:m,waterfallStyle:J,showAxes:j,background:S,hoverAnnotation:X,tooltipContent:G,...a({linkedHover:M,selection:z,onObservation:L,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:T,autoPlaceAnnotations:E,svgAnnotationRules:P,tickFormatTime:I,tickFormatValue:D,legendPosition:Y,pointIdAccessor:e.pointIdAccessor})});_n.displayName="RealtimeWaterfallChart";import{useRef as wn,useImperativeHandle as xn,forwardRef as kn,useCallback as An}from"react";import{jsx as Sn}from"react/jsx-runtime";var Cn=kn(function(e,t){const o=Ne(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:s,className:i,arrowOfTime:l="right",windowMode:c="sliding",windowSize:d,data:u,timeAccessor:h,valueAccessor:g,categoryAccessor:y,timeExtent:p,valueExtent:m,extentPadding:f,heatmapXBins:v=20,heatmapYBins:b=20,aggregation:_="count",background:w,tooltipContent:x,tooltip:k,onHover:A,annotations:S,autoPlaceAnnotations:C,svgAnnotationRules:R,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,linkedHover:D,selection:M,onObservation:z,chartId:L,loading:H,loadingContent:W,emptyContent:B,emphasis:F,legendPosition:O}=e,Y=o.showAxes,j=o.enableHover,X=s??o.marginDefaults,$=n??[o.width,o.height],V=x??k??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:s="y"}=e;return e=>{const r=e?.data??null,i=r?.xCenter??Wo(r,t,"time"),a=r?.yCenter??Wo(r,o,"value"),l=r?.count,c=r?.sum,d=r?.value,u=r?.agg??"count";return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[zo("span",{style:Ho,children:[n,":"]}),Bo(i)]}),zo("div",{children:[zo("span",{style:Ho,children:[s,":"]}),Bo(a)]}),null!=l&&zo("div",{children:[Mo("span",{style:Ho,children:"count:"}),Bo(l)]}),"sum"===u&&null!=c&&zo("div",{children:[Mo("span",{style:Ho,children:"sum:"}),Bo(c)]}),"mean"===u&&null!=d&&zo("div",{children:[Mo("span",{style:Ho,children:"mean:"}),Bo(d)]})]})}}({timeAccessor:h,valueAccessor:g}),G=wn(null),{customHoverBehavior:Q}=Te({selection:M,linkedHover:D,unwrapData:!0,onObservation:z,chartType:"RealtimeHeatmap",chartId:L}),q=An(e=>{A&&A(e),Q(e)},[A,Q]);xn(t,()=>({push:e=>G.current?.push(e),pushMany:e=>G.current?.pushMany(e),remove:e=>G.current?.remove(e)??[],update:(e,t)=>G.current?.update(e,t)??[],clear:()=>G.current?.clear(),getData:()=>G.current?.getData()??[],getScales:()=>G.current?.getScales()??null}),[]);const K=xe(H,$[0],$[1],W),U=K?null:_e(u,$[0],$[1],B),Z=F?`${i||""} semiotic-emphasis-${F}`.trim():i,J=Oo(d,u);return K||U||Sn(r,{ref:G,chartType:"heatmap",runtimeMode:"streaming",size:$,margin:X,className:Z,arrowOfTime:l,windowMode:c,windowSize:J,data:u,timeAccessor:h,valueAccessor:g,categoryAccessor:y,xExtent:p,yExtent:m,extentPadding:f,heatmapXBins:v,heatmapYBins:b,heatmapAggregation:_,showAxes:Y,background:w,hoverAnnotation:j,tooltipContent:V,...a({linkedHover:D,selection:M,onObservation:z,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:q}),annotations:S,autoPlaceAnnotations:C,svgAnnotationRules:R,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,legendPosition:O,pointIdAccessor:e.pointIdAccessor})});Cn.displayName="RealtimeHeatmap";export{ze as DEFAULT_LIFECYCLE_THRESHOLDS,L as IncrementalExtent,Cn as RealtimeHeatmap,an as RealtimeHistogram,Jo as RealtimeLineChart,yn as RealtimeSwarmChart,_n as RealtimeWaterfallChart,Ro as ReorderBuffer,H as RingBuffer,_o as RunningStats,bo as StreamNetworkFrame,r as StreamXYFrame,ln as TemporalHistogram,wo as WindowAccumulator,ko as bandBounds,He as bandFromAge,c as compileMotionEncoding,g as deriveMotionVector,w as opacityFromAge,Co as parseWindowDuration,N as resolveMotionAccessor,T as resolveMotionVector,xo as statValue};
|