semiotic 3.8.4 → 3.8.6
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 -5
- package/README.md +52 -46
- package/ai/behaviorContracts.cjs +2 -2
- package/ai/componentMetadata.cjs +2 -2
- package/ai/dist/mcp-server.js +6 -2
- package/ai/examples.md +211 -2
- package/ai/schema.json +1388 -14
- package/ai/surface-manifest.json +8 -4
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js +2 -0
- package/dist/chunk-chunk-2CHN2TA3.module.min.js +1 -0
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
- package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
- package/dist/chunk-chunk-3SHB24AG.module.min.js +1 -0
- package/dist/chunk-chunk-4MMOOYTX.module.min.js +2 -0
- package/dist/chunk-chunk-75OTQSXS.module.min.js +1 -0
- package/dist/chunk-chunk-A5GRQUOF.module.min.js +1 -0
- package/dist/chunk-chunk-AAF5LZAU.module.min.js +2 -0
- package/dist/{chunk-chunk-LQBSXO7K.module.min.js → chunk-chunk-ARZGA4LJ.module.min.js} +1 -1
- package/dist/chunk-chunk-CAFLML4L.module.min.js +2 -0
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +1 -0
- package/dist/chunk-chunk-FHBN7OEB.module.min.js +2 -0
- package/dist/{chunk-chunk-KQ546MKE.module.min.js → chunk-chunk-GFTVACTO.module.min.js} +1 -1
- package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
- package/dist/chunk-chunk-ITDWLZXV.module.min.js +2 -0
- package/dist/chunk-chunk-LPSPATPC.module.min.js +1 -0
- package/dist/chunk-chunk-OM6NWS4H.module.min.js +2 -0
- package/dist/chunk-chunk-PX5YQGDP.module.min.js +2 -0
- package/dist/chunk-chunk-Q2BS46W2.module.min.js +2 -0
- package/dist/{chunk-chunk-FBGHXL72.module.min.js → chunk-chunk-RA7JCG7D.module.min.js} +1 -1
- package/dist/chunk-chunk-RNUHEXZA.module.min.js +2 -0
- package/dist/chunk-chunk-ROZWKEUG.module.min.js +1 -0
- package/dist/chunk-chunk-SMVD3EQJ.module.min.js +2 -0
- package/dist/chunk-chunk-T2FKJD4O.module.min.js +2 -0
- package/dist/chunk-chunk-UDREYOLV.module.min.js +1 -0
- package/dist/chunk-chunk-VOWE3SAP.module.min.js +2 -0
- package/dist/chunk-chunk-VQPNBUSW.module.min.js +2 -0
- package/dist/{chunk-chunk-7RYBCTK5.module.min.js → chunk-chunk-WAWCIHFJ.module.min.js} +1 -1
- package/dist/{chunk-chunk-F7WFPD4O.module.min.js → chunk-chunk-WYARAXHR.module.min.js} +1 -1
- package/dist/{chunk-chunk-JDXT6ORT.module.min.js → chunk-chunk-XP3OHHFX.module.min.js} +1 -1
- package/dist/chunk-chunk-XV3KGYTR.module.min.js +2 -0
- package/dist/chunk-chunk-YC2IVEPX.module.min.js +1 -0
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +2 -0
- package/dist/components/ChartContainer.d.ts +10 -0
- package/dist/components/ai/chartCapabilities.d.ts +3 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +14 -0
- package/dist/components/chartContainerDataAudit.d.ts +10 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +30 -4
- package/dist/components/charts/index.d.ts +4 -0
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +36 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
- package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
- package/dist/components/charts/physics/CrucibleChart.capability.d.ts +8 -0
- package/dist/components/charts/physics/CrucibleChart.d.ts +63 -0
- package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +27 -0
- package/dist/components/charts/physics/crucibleChartProps.d.ts +90 -0
- package/dist/components/charts/physics/crucibleChrome.d.ts +47 -0
- package/dist/components/charts/physics/crucibleController.d.ts +59 -0
- package/dist/components/charts/physics/crucibleEffects.d.ts +30 -0
- package/dist/components/charts/physics/cruciblePhysics.d.ts +54 -0
- package/dist/components/charts/physics/crucibleProgram.d.ts +38 -0
- package/dist/components/charts/physics/crucibleTypes.d.ts +415 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +10 -4
- package/dist/components/charts/shared/crucibleWireSchema.d.ts +5 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
- package/dist/components/charts/shared/gradient.d.ts +35 -0
- package/dist/components/charts/shared/hatchFill.d.ts +3 -10
- package/dist/components/charts/shared/hooks.d.ts +2 -50
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
- package/dist/components/charts/shared/useChartLegend.d.ts +58 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +5 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +25 -42
- package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
- package/dist/components/charts/xy/BumpChart.d.ts +161 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
- package/dist/components/charts/xy/Heatmap.d.ts +3 -0
- package/dist/components/charts/xy/LineChart.d.ts +6 -8
- package/dist/components/data/auditData.d.ts +51 -0
- package/dist/components/data/dataAuditPresentation.d.ts +18 -0
- package/dist/components/data/dataAuditSources.d.ts +9 -0
- package/dist/components/data/numericContracts.d.ts +59 -0
- package/dist/components/data/numericFieldProfiler.d.ts +23 -0
- package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
- package/dist/components/legendLayout.d.ts +19 -1
- package/dist/components/recipes/netEnsembleLayout.d.ts +167 -0
- package/dist/components/recipes/netEnsembleOverlays.d.ts +20 -0
- package/dist/components/recipes/wordTrails.d.ts +156 -0
- package/dist/components/recipes/wordTrailsProgressiveReveal.d.ts +42 -0
- package/dist/components/semiotic-ai-core.d.ts +3 -0
- package/dist/components/semiotic-ai-data-audit.d.ts +4 -0
- package/dist/components/semiotic-ai.d.ts +9 -6
- package/dist/components/semiotic-geo.d.ts +1 -0
- package/dist/components/semiotic-network.d.ts +1 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-physics.d.ts +2 -0
- package/dist/components/semiotic-realtime-core.d.ts +1 -0
- package/dist/components/semiotic-recipes-core.d.ts +4 -0
- package/dist/components/semiotic-server-edge.d.ts +1 -1
- package/dist/components/semiotic-server.d.ts +1 -1
- package/dist/components/semiotic-utils-core.d.ts +3 -0
- package/dist/components/semiotic-xy.d.ts +4 -0
- package/dist/components/semiotic.d.ts +5 -5
- package/dist/components/server/renderEvidence.d.ts +27 -0
- package/dist/components/server/serverChartConfigs.d.ts +2 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
- package/dist/components/server/staticAnnotations.d.ts +12 -0
- package/dist/components/server/staticLegend.d.ts +4 -2
- package/dist/components/server/staticSVGChrome.d.ts +4 -4
- package/dist/components/stream/GeoPipelineStore.d.ts +1 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +11 -10
- package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
- package/dist/components/stream/SVGOverlay.d.ts +2 -6
- package/dist/components/stream/StalenessBadge.d.ts +2 -6
- package/dist/components/stream/geoCartogram.d.ts +7 -0
- package/dist/components/stream/geoTypes.d.ts +20 -8
- package/dist/components/stream/legendRenderer.d.ts +2 -6
- package/dist/components/stream/networkFrameHandleTypes.d.ts +4 -0
- package/dist/components/stream/ordinalTypes.d.ts +7 -31
- package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +8 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
- package/dist/components/stream/pipelineConfig.d.ts +7 -15
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
- package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
- package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
- package/dist/components/stream/types.d.ts +32 -56
- package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
- package/dist/components/types/legendTypes.d.ts +15 -6
- package/dist/components/useChartContainerDataAudit.d.ts +7 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/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/semiotic-ai-core.d.ts +3 -0
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +9 -6
- 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-geo.d.ts +1 -0
- package/dist/semiotic-network.d.ts +1 -0
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-physics.d.ts +2 -0
- package/dist/semiotic-realtime-core.d.ts +1 -0
- 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 +4 -0
- 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.d.ts +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-server.d.ts +1 -1
- package/dist/semiotic-utils-core.d.ts +3 -0
- 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-xy.d.ts +4 -0
- package/dist/semiotic.d.ts +5 -5
- 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 +2 -2
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +0 -1
- package/dist/chunk-chunk-6TPGFL7M.module.min.js +0 -2
- package/dist/chunk-chunk-7KZJUTKP.module.min.js +0 -2
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
- package/dist/chunk-chunk-AQPQN2HH.module.min.js +0 -2
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +0 -1
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +0 -2
- package/dist/chunk-chunk-BFHUYEOS.module.min.js +0 -2
- package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
- package/dist/chunk-chunk-F5V4UIE6.module.min.js +0 -2
- package/dist/chunk-chunk-FP44FHFO.module.min.js +0 -2
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +0 -2
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +0 -2
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +0 -1
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +0 -1
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +0 -1
- package/dist/chunk-chunk-N6VKKF3A.module.min.js +0 -2
- package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +0 -2
- package/dist/chunk-chunk-PLIDPQNG.module.min.js +0 -2
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +0 -1
- package/dist/chunk-chunk-RP7WTID5.module.min.js +0 -1
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +0 -1
- package/dist/chunk-chunk-SR4ZXOWR.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{buildRegressionAnnotation as e}from"./chunk-chunk-YCQYG6J5.module.min.js";import{validateArrayData as t}from"./chunk-chunk-JCG72SGW.module.min.js";import{mergeShapeStyle as o,normalizePartialMargin as n,useChartSetup as i,useCustomChartSetup as r,useFrameImperativeHandle as a,useResolvedSelection as s}from"./chunk-chunk-VQPNBUSW.module.min.js";import{StreamXYFrame_default as l}from"./chunk-chunk-AAF5LZAU.module.min.js";import{normalizeColorGradient as c,normalizeGradient as h,normalizeSemanticGradient as d,reverseGradient as u}from"./chunk-chunk-XV3KGYTR.module.min.js";import{accessorName as m,bandTooltipFields as p,buildBaseMetadataProps as y,buildCustomBehaviorProps as f,buildDefaultTooltip as g,buildTooltipProps as b}from"./chunk-chunk-WYARAXHR.module.min.js";import{useCustomLayoutSelection as v}from"./chunk-chunk-5UKL5W76.module.min.js";import{makeXYRuleContext as x,resolveStyleRules as A}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as k,DEFAULT_COLOR as w,DEFAULT_COLORS as S,DEFAULT_SELECTION_OPACITY as C,LinkedCharts as L,MultiPointTooltip as _,composeLegendConfigs as H,defaultTooltipStyle as R,filterSparseArray as I,getColor as B,getCrosshairProps as F,getSequentialInterpolator as P,getSize as N,interpolateViridis as M,normalizeLinkedBrush as W,normalizeTooltip as O,resolveDefaultFill as D,resolveMobileInteraction as T,useBrushSelection as E,useChartLegendAndMargin as G,useChartMode as j,useChartSelection as z,useColorScale as V,useLegendInteraction as $,useSelection as X,useSelectionSelector as Q,useThemeCategorical as Y,useThemeSequential as U,wrapStyleWithSelection as q}from"./chunk-chunk-PX5YQGDP.module.min.js";import{getMax as J,getMinMax as K}from"./chunk-chunk-JJ2OOIET.module.min.js";import{useTheme as Z}from"./chunk-chunk-WCX6U47H.module.min.js";import{ChartError as ee,SafeRender as te,renderEmptyState as oe,renderLoadingState as ne,warnMissingField as ie}from"./chunk-chunk-ACLDBMRH.module.min.js";import*as re from"react";import{useMemo as ae,useCallback as se,forwardRef as le,useRef as ce}from"react";import{useMemo as he}from"react";function de(e){const{colorBy:t,colorScale:n,color:i,pointRadius:r=5,radiusFn:a,fillOpacity:s=1,fallbackFill:l,baseStyleExtras:c,stroke:h,strokeWidth:d,opacity:u,effectiveSelectionHook:m,resolvedSelection:p,colorDatumAccessor:y,styleRules:f,ruleContext:g}=e,b=he(()=>e=>{const o="function"==typeof c?c(e):c,h=o?{...o}:{};if(void 0===h.fillOpacity&&(h.fillOpacity=s),void 0===h.fill)if(t){if(n){const o=y?y(e):e;h.fill=B(o,t,n)}}else h.fill=l?l(e):i||w;return void 0===h.r&&(h.r=a?a(e):r),f&&f.length>0&&Object.assign(h,A(e,f,g?g(e):{value:void 0})),h},[t,n,i,r,a,s,l,c,y,f,g]),v=he(()=>o(b,{stroke:h,strokeWidth:d,opacity:u}),[b,h,d,u]);return he(()=>q(v,m??null,p),[v,m,p])}import{useCallback as ue,useMemo as me,useRef as pe,useState as ye}from"react";function fe(e){const{accessor:t,data:o,isPushMode:n}=e,i=pe(null),[r,a]=ye(0),s=ue(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[t];if(null==e)continue;const r="number"==typeof e?e:Number(e);Number.isFinite(r)&&(i.current?(i.current[0]>r&&(i.current[0]=r,o=!0),r>i.current[1]&&(i.current[1]=r,o=!0)):(i.current=[r,r],o=!0))}o&&a(e=>e+1)},[n,t]),l=ue(()=>{n&&(i.current=null,a(e=>e+1))},[n]);return{domain:me(()=>{if(n)return i.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let r=1/0,a=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(r>n&&(r=n),n>a&&(a=n))}return Number.isFinite(r)&&Number.isFinite(a)?[r,a]:void 0},[o,t,n,r]),trackPushed:s,reset:l}}import{useEffect as ge,useMemo as be,useRef as ve,useState as xe}from"react";var Ae="__forecastSegment",ke=null;async function we(){return ke||(ke=await import("./chunk-statisticalOverlays-6MVAK5RW.module.min.js")),ke}var Se="__semiotic_resolvedX",Ce="__semiotic_resolvedY";function Le(e){const{data:t,xAccessor:o,yAccessor:n,forecast:i,anomaly:r,groupBy:a}=e,s="string"==typeof o?o:Se,l="string"==typeof n?n:Ce,c=be(()=>{if(!i&&!r)return t;const e="function"==typeof o,a="function"==typeof n;return e||a?t.map(t=>{const i={...t};return e&&(i[Se]=o(t)),a&&(i[Ce]=n(t)),i}):t},[t,i,r,o,n]),[h,d]=xe(null),[u,m]=xe([]),p=ve(i),y=ve(r);return ge(()=>{if(!i&&!r)return void((p.current||y.current)&&(d(null),m([]),p.current=i,y.current=r));let e=!1;const t=i!==p.current||r!==y.current;if(p.current=i,y.current=r,t&&(d(null),m([])),i){const t=a&&"string"==typeof a&&"object"==typeof i?{...i,_groupBy:a}:i;(async function(...e){return(await we()).buildForecast(...e)})(c,s,l,t,r).then(t=>{e||(d(t),m(t.annotations))}).catch(()=>{e||(d(null),m([]))})}else r&&async function(...e){return(await we()).buildAnomalyAnnotations(...e)}(r).then(t=>{e||(d(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[c,i,r,s,l,a]),{effectiveData:h?h.processedData:t,statisticalAnnotations:u,hasForecast:!!h,xAccessorKey:s,yAccessorKey:l}}import{jsx as _e}from"react/jsx-runtime";var He=le(function(o,n){const r=ce(null),s=j(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:c,margin:h,className:d,xFormat:u,yFormat:p,xAccessor:v="x",yAccessor:A="y",xScaleType:k,yScaleType:w,colorBy:S,colorScheme:C,styleRules:L,sizeBy:_,sizeRange:H=[3,15],symbolBy:R,symbolMap:B,pointRadius:F=5,pointOpacity:P=.8,tooltip:M,marginalGraphics:O,pointIdAccessor:D,annotations:T,regression:G,forecast:z,anomaly:V,xExtent:$,yExtent:X,frameProps:Q={},selection:Y,linkedHover:U,linkedBrush:q,onObservation:J,onClick:K,hoverHighlight:Z,chartId:oe,loading:ne,loadingContent:le,emptyContent:he,legendInteraction:ue,legendPosition:me,color:pe,stroke:ye,strokeWidth:ge,opacity:be}=o,{width:ve,height:xe,enableHover:Ae,showGrid:ke,showLegend:we,title:Se,description:Ce,summary:He,accessibleTable:Re,xLabel:Ie,yLabel:Be}=s,Fe=ae(()=>I(c),[c]),Pe=void 0===c,{domain:Ne,trackPushed:Me,reset:We}=fe({accessor:_,data:Fe,isPushMode:Pe}),Oe=se(e=>{Me([e]),r.current?.push(e)},[Me]),De=se(e=>{Me(e),r.current?.pushMany(e)},[Me]);a(n,{variant:"xy",frameRef:r,overrides:{push:Oe,pushMany:De,clear:()=>{We(),r.current?.clear()}}});const Te=i({data:Fe,rawData:c,colorBy:S,colorScheme:C,legendInteraction:ue,legendPosition:me,selection:Y,linkedHover:U,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:J,onClick:K,hoverHighlight:Z,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"Scatterplot",chartId:oe,showLegend:we,userMargin:h,marginDefaults:s.marginDefaults,loading:ne,loadingContent:le,emptyContent:he,width:ve,height:xe,hasTitle:!!Se}),Ee=W(q),Ge=E({name:Ee?.name||"__unused_brush__",xField:Ee?.xField||("string"==typeof v?v:void 0),yField:Ee?.yField||("string"==typeof A?A:void 0)}),je=Ee?"xyBrush"===Ge.brushInteraction.brush?"xy":"xBrush"===Ge.brushInteraction.brush?"x":"y":void 0,ze=re.useRef(Ge.brushInteraction);ze.current=Ge.brushInteraction;const Ve=se(e=>{const t=ze.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);ie("Scatterplot",Fe,"xAccessor",v),ie("Scatterplot",Fe,"yAccessor",A);const $e=ae(()=>_?Ne??[0,1]:void 0,[_,Ne]),Xe=ae(()=>_?e=>N(e,_,H,$e):void 0,[_,H,$e]),Qe=ae(()=>x(v,A),[v,A]),Ye=de({colorBy:S,colorScale:Te.colorScale,color:pe,pointRadius:F,fillOpacity:P,radiusFn:Xe,stroke:ye,strokeWidth:ge,opacity:be,styleRules:L,ruleContext:Qe,effectiveSelectionHook:Te.effectiveSelectionHook,resolvedSelection:Te.resolvedSelection}),Ue=ae(()=>g([{label:Ie||m(v),accessor:v,role:"x",format:u},{label:Be||m(A),accessor:A,role:"y",format:p},...S?[{label:m(S),accessor:S,role:"color"}]:[],..._?[{label:m(_),accessor:_,role:"size"}]:[]]),[v,A,Ie,Be,S,_,u,p]),{effectiveData:qe,statisticalAnnotations:Je}=Le({data:Fe,xAccessor:v,yAccessor:A,forecast:z,anomaly:V}),Ke=ae(()=>{const t=e(G);return t||0!==Je.length?[...t?[t]:[],...T||[],...Je]:T},[G,T,Je]);if(Te.earlyReturn)return Te.earlyReturn;const Ze=t({componentName:"Scatterplot",data:c,accessors:{xAccessor:v,yAccessor:A}});if(Ze)return _e(ee,{componentName:"Scatterplot",message:Ze,width:ve,height:xe});const et={chartType:"scatter",...null!=c&&{data:qe},xAccessor:v,yAccessor:A,xScaleType:k,yScaleType:w,colorAccessor:S||void 0,sizeAccessor:_||void 0,...R&&{symbolAccessor:R},...B&&{symbolMap:B},sizeRange:H,pointStyle:Ye,colorScheme:C,size:[ve,xe],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Te.margin,showAxes:s.showAxes,xLabel:Ie,yLabel:Be,xFormat:u,yFormat:p,enableHover:Ae,showGrid:ke,...Te.legendBehaviorProps,...y({title:Se,description:Ce,summary:He,accessibleTable:Re,className:d,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...b({tooltip:M,defaultTooltipContent:Ue}),...f({linkedHover:U,selection:Y,onObservation:J,onClick:K,hoverHighlight:Z,mobileInteraction:Te.mobileInteraction,customHoverBehavior:Te.customHoverBehavior,customClickBehavior:Te.customClickBehavior}),...O&&{marginalGraphics:O},...D&&{pointIdAccessor:D},...Ke&&Ke.length>0&&{annotations:Ke},...$&&{xExtent:$},...X&&{yExtent:X},...Ee&&{brush:{dimension:je},onBrush:Ve},...Te.crosshairProps,...Q};return _e(te,{componentName:"Scatterplot",width:ve,height:xe,children:_e(l,{ref:r,...et})})});He.displayName="Scatterplot";import{useMemo as Re,forwardRef as Ie,useRef as Be}from"react";import{Fragment as Fe,jsx as Pe}from"react/jsx-runtime";function Ne(e,t){return M(1===t?.5:e/(t-1))}var Me=Ie(function(o,n){const r=Be(null);a(n,{variant:"xy",frameRef:r});const s=j(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:c,margin:h,className:d,xFormat:u,yFormat:p,xAccessor:v="x",yAccessor:A="y",orderAccessor:k,orderLabel:w,styleRules:S,pointRadius:L=4,tooltip:_,pointIdAccessor:H,annotations:R,regression:I,forecast:B,anomaly:F,xExtent:P,yExtent:N,frameProps:M={},selection:W,linkedHover:O,onObservation:D,onClick:T,hoverHighlight:E,chartId:G,loading:z,loadingContent:V,emptyContent:$,legendInteraction:X,stroke:Q,strokeWidth:Y,opacity:U}=o,{width:q,height:J,enableHover:K,showGrid:Z,title:oe,description:ne,summary:re,accessibleTable:ae,xLabel:se,yLabel:le}=s,{safeData:ce,orderMap:he}=Re(()=>{const e=c||[],t="function"==typeof v?v:e=>e[v],o="function"==typeof A?A:e=>e[A];let n=e;if(k&&e.length>0){const t="function"==typeof k?k:e=>e[k];n=[...e].sort((e,o)=>{const n=t(e),i=t(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const i=new WeakMap;let r=0;for(const e of n){const n=t(e),i=o(e);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let a=0;for(const e of n){const n=t(e),s=o(e);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&i.set(e,{idx:a++,total:r})}return{safeData:n,orderMap:i}},[c,k,v,A]);ie("ConnectedScatterplot",ce,"xAccessor",v),ie("ConnectedScatterplot",ce,"yAccessor",A);const ue=i({data:ce,rawData:c,colorBy:void 0,colorScheme:void 0,legendInteraction:X,selection:W,linkedHover:O,fallbackFields:[],unwrapData:!1,onObservation:D,onClick:T,hoverHighlight:E,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"ConnectedScatterplot",chartId:G,showLegend:void 0,userMargin:h,marginDefaults:s.marginDefaults,loading:z,loadingContent:V,emptyContent:$,width:q,height:J,hasTitle:!!oe}),me=ue.resolvedSelection?.unselectedOpacity??C,pe=Re(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const n=ue.effectiveSelectionHook?.isActive,i=ue.effectiveSelectionHook?.predicate,r=100>o.length,a=o.length;e.lineCap="round";for(let t=0;a-1>t;t++){const s=o[t],l=o[t+1],c=Ne(t,a),h=!n||!i||i(s.datum??s)||i(l.datum??l),d=n?h?1:me:1;r&&(e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=L+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=L,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[L,ue.effectiveSelectionHook,me]),ye=Re(()=>[pe],[pe]),fe=Re(()=>(e,t,o)=>{const n=e.filter(e=>"point"===e.type);if(2>n.length)return null;const i=n.length,r=100>i,a=[];for(let e=0;i-1>e;e++){const t=n[e],o=n[e+1],s=Ne(e,i),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);r&&a.push(Pe("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:L+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),a.push(Pe("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:s,strokeWidth:L,strokeLinecap:"round",opacity:l},"seg-"+e))}return Pe(Fe,{children:a})},[L]),ge=Re(()=>[fe],[fe]),be=de({colorScale:void 0,baseStyleExtras:Re(()=>e=>{const t=he.get(e),o=t?.idx??0,n=t?.total??1;return{fill:n>0?Ne(o,n):"#6366f1",stroke:"white",strokeWidth:1,r:L,fillOpacity:1}},[L,he]),stroke:Q,strokeWidth:Y,opacity:U,styleRules:S,ruleContext:Re(()=>x(v,A),[v,A]),effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection}),ve=w||("string"==typeof k?k:"Order"),xe=Re(()=>g([{label:se||m(v),accessor:v,role:"x",format:u},{label:le||m(A),accessor:A,role:"y",format:p},...k?[{label:ve,accessor:k,role:"group"}]:[]]),[v,A,se,le,k,ve,u,p]),Ae=t({componentName:"ConnectedScatterplot",data:c,accessors:{xAccessor:v,yAccessor:A}}),{effectiveData:ke,statisticalAnnotations:we}=Le({data:ce,xAccessor:v,yAccessor:A,forecast:B,anomaly:F});if(ue.earlyReturn)return ue.earlyReturn;const Se=e(I),Ce=Se||we.length>0?[...Se?[Se]:[],...R||[],...we]:R,_e={chartType:"scatter",...null!=c&&{data:ke},xAccessor:v,yAccessor:A,pointStyle:be,size:[q,J],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue.margin,showAxes:s.showAxes,xLabel:se,yLabel:le,xFormat:u,yFormat:p,enableHover:K,showGrid:Z,...y({title:oe,description:ne,summary:re,accessibleTable:ae,className:d,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...b({tooltip:_,defaultTooltipContent:xe}),...f({linkedHover:O,selection:W,onObservation:D,onClick:T,hoverHighlight:E,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...H&&{pointIdAccessor:H},canvasPreRenderers:ye,svgPreRenderers:ge,...Ce&&Ce.length>0&&{annotations:Ce},...P&&{xExtent:P},...N&&{yExtent:N},...ue.crosshairProps,...M};return Ae?Pe(ee,{componentName:"ConnectedScatterplot",message:Ae,width:q,height:J}):Pe(te,{componentName:"ConnectedScatterplot",width:q,height:J,children:Pe(l,{ref:r,..._e})})});Me.displayName="ConnectedScatterplot";import{useMemo as We,useCallback as Oe,useState as De,useEffect as Te,forwardRef as Ee,useRef as Ge}from"react";import{useMemo as je}from"react";function ze(e){const{lineWidth:t=2,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:h,opacity:d,effectiveSelectionHook:u,resolvedSelection:m,styleRules:p,ruleContext:y}=e,f=je(()=>function(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:i,resolveStroke:r,fillArea:a,areaOpacity:s=.3,styleRules:l,ruleContext:c}=e;return(e,h)=>{const d={strokeWidth:t},u=!0===a||Array.isArray(a)&&null!=h&&a.includes(h);let m;return r?m=r(e,h):o?n&&(m=B(e,o,n)):m=i||w,void 0!==m&&(d.stroke=m,u&&(d.fill=m,d.fillOpacity=s)),l?.length&&Object.assign(d,A(e,l,c?c(e,h):{value:void 0,category:h})),d}}({lineWidth:t,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l,styleRules:p,ruleContext:y}),[t,n,i,r,a,s,l,p,y]),g=je(()=>o(f,{stroke:c,strokeWidth:h,opacity:d}),[f,c,h,d]);return je(()=>q(g,u??null,m),[g,u,m])}import{jsx as Ve}from"react/jsx-runtime";var $e="__lineObjectSeries",Xe=Ee(function(e,o){const n=Ge(null);a(o,{variant:"xy",frameRef:n});const r=j(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:h,className:d,xFormat:u,yFormat:y,axisExtent:b,xAccessor:v="x",yAccessor:A="y",lineBy:k,lineDataAccessor:S="coordinates",colorBy:C,colorScheme:L,styleRules:R,curve:F="linear",showPoints:P=!1,pointRadius:N=3,fillArea:M=!1,areaOpacity:W=.3,lineWidth:D=2,lineGradient:T,tooltip:E,pointIdAccessor:G,annotations:z,directLabel:V,gapStrategy:$="break",anomaly:X,forecast:Q,band:Y,xExtent:U,yExtent:q,frameProps:J={},selection:K,linkedHover:Z,onObservation:oe,onClick:ne,hoverHighlight:re,hoverRadius:ae,chartId:se,loading:le,loadingContent:ce,emptyContent:he,legendInteraction:de,legendPosition:ue,legend:me,xScaleType:pe,yScaleType:ye,color:fe,stroke:ge,strokeWidth:be,opacity:ve}=e,{legend:xe,...ke}=J,Se=We(()=>H(xe,me),[xe,me]),{width:Ce,height:_e,enableHover:He,showGrid:Re,showLegend:Ie,title:Be,description:Fe,summary:Pe,accessibleTable:Ne,xLabel:Me,yLabel:Ee}=r,je=We(()=>I(s),[s]),Xe=Array.isArray(je[0]?.[S])?je[0][S]:je;ie("LineChart",Xe,"xAccessor",v),ie("LineChart",Xe,"yAccessor",A);const{effectiveData:Qe,statisticalAnnotations:Ye}=Le({data:je,xAccessor:v,yAccessor:A,forecast:Q,anomaly:X,groupBy:k}),Ue="__compoundGroup",qe=!(!Q||!k),Je=qe?Ue:Q?Ae:k,Ke=We(()=>{if(!qe)return Qe;const e="function"==typeof k?k:e=>e[k];return Qe.map(t=>{const o={...t};return o[Ue]=`${e(t)}__${t[Ae]||"observed"}`,o})},[Qe,qe,k]),Ze=qe?Ke:Qe,et=C||k,tt=We(()=>{if(!Q)return;const e=Q.upperBounds,t=Q.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const a=Qe;for(const e of a){const t="function"==typeof A?A(e):+e[A];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[Q,Qe,A]),ot=Oe(e=>{const t="function"==typeof v?v(e):e[v],o="function"==typeof A?A(e):e[A];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[v,A]),nt=void 0!==Ze[0]?.[S],it=nt?$e:Je,rt=We(()=>{if(nt)return Ze.map((e,t)=>{const o="function"==typeof k?k(e):"string"==typeof k?e[k]:void 0,n=null==o?"line-"+t:o+"",i=Array.isArray(e[S])?e[S]:[];return{...e,[$e]:n,[S]:i.map(t=>({...t,[$e]:n,parentLine:e,..."string"==typeof k&&void 0!==e[k]?{[k]:e[k]}:{}}))}});if(Je){const e=Ze.reduce((e,t)=>{const o="function"==typeof Je?Je(t):t[Je];if(!e[o]){const n={[S]:[]};"string"==typeof Je&&(n[Je]=o),qe&&(n[Ae]=t[Ae],"string"==typeof k&&(n[k]=t[k])),e[o]=n}return e[o][S].push(t),e},{});return Object.values(e)}return[{[S]:Ze}]},[nt,Je,S,Ze,k,qe]),{gapProcessedLineData:at,hasGaps:st}=We(()=>{if("interpolate"===$){let e=!1;const t=[];for(const o of rt){const n=(o[S]||[]).filter(t=>!ot(t)||(e=!0,!1));n.length>0&&t.push({...o,[S]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===$){let e=!1;const t=[];for(const o of rt){const n=o[S]||[];let i=[],r=0;const a=it&&"string"==typeof it?o[it]:void 0;for(const s of n)if(ot(s))e=!0,i.length>0&&(t.push({...o,[S]:i}),i=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;i.push({...s,_gapSegment:e})}i.length>0&&t.push({...o,[S]:i})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===$){let e=!1;const t="string"==typeof A?A:"y",o=[];for(const n of rt){const i=n[S]||[],r=[];for(const o of i)ot(o)?(e=!0,r.push({...o,[t]:0})):r.push(o);o.push({...n,[S]:r})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:rt,hasGaps:!1}},[rt,$,S,ot,it,A]),lt="object"==typeof V?V:{},ct=lt.position||"end",ht=lt.fontSize||11,dt=We(()=>{if(!V||!et)return[];const e="function"==typeof et?et:e=>e[et],t=new Set;for(const o of at){const n=o[S]||[];if(0===n.length)continue;const i=e("end"===ct?n[n.length-1]:n[0])??e(o);if(null==i)continue;const r=i+"";""!==r&&t.add(r)}return Array.from(t)},[V,et,at,S,ct]),ut=We(()=>{if(!V)return r.marginDefaults;const e=dt.reduce((e,t)=>Math.max(e,t.length*(.6*ht)),0)+10,t="end"===ct?"right":"left";return{...r.marginDefaults,[t]:Math.max(r.marginDefaults[t]||0,e)}},[V,dt,ht,ct,r.marginDefaults]),mt=i({data:Qe,rawData:s,colorBy:et,colorScheme:L,legendInteraction:de,legendPosition:ue,selection:K,linkedHover:Z,fallbackFields:et?["string"==typeof et?et:""]:[],unwrapData:!1,onObservation:oe,onClick:ne,hoverHighlight:re,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LineChart",chartId:se,showLegend:(!V||void 0!==Ie)&&Ie,legend:Se,userMargin:h,marginDefaults:ut,loading:le,loadingContent:ce,emptyContent:he,width:Ce,height:_e,hasTitle:!!Be}),pt=mt.colorScale,yt=mt.effectiveSelectionHook,ft=mt.resolvedSelection,gt=mt.customHoverBehavior,bt=mt.customClickBehavior,vt=mt.crosshairProps,xt=We(()=>{if(et)return nt?e=>{const t=e.parentLine||e;return"function"==typeof et?et(t):t[et]}:et},[et,nt]),At=We(()=>x(v,A),[v,A]),kt=ze({lineWidth:D,colorBy:xt,colorScale:pt,color:fe,fillArea:M,areaOpacity:W,stroke:ge,strokeWidth:be,opacity:ve,effectiveSelectionHook:yt,resolvedSelection:ft,styleRules:R,ruleContext:At}),[wt,St]=De(null);Te(()=>{if(!Q)return void St(null);let e=!1;return async function(...e){return(await we()).createSegmentLineStyle(...e)}(kt,Q).then(t=>{e||St(()=>t)}).catch(()=>{e||St(null)}),()=>{e=!0}},[kt,Q]);const Ct=wt||kt,Lt=We(()=>{if(P)return e=>{const t={r:N,fillOpacity:1};return et?pt&&(t.fill=B(e.parentLine||e,et,pt)):t.fill=fe||w,t}},[P,N,et,pt,fe]),_t=Array.isArray(M)?"mixed":M?"area":"line",Ht=We(()=>{if(!V||!et)return[];const e="function"==typeof v?v:e=>e[v],t="function"==typeof A?A:e=>e[A],o="function"==typeof et?et:e=>e[et],n=new Map;for(const e of at){const t=e[S]||[];if(0===t.length)continue;const i="end"===ct?t[t.length-1]:t[0],r=o(i)??o(e);if(null==r)continue;const a=r+"";""===a||n.has(a)||n.set(a,i)}const i=Array.from(n.entries()).map(([o,n])=>({type:"text",label:o,["string"==typeof v?v:"x"]:e(n),["string"==typeof A?A:"y"]:t(n),dx:"end"===ct?6:-6,dy:0,color:pt?pt(o):w,fontSize:ht}));i.sort((e,t)=>{const o="string"==typeof A?A:"y";return e[o]-t[o]});for(let e=1;i.length>e;e++){const t="string"==typeof A?A:"y",o=i[e-1],n=i[e];ht+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=ht+2)}return i},[V,et,pt,at,S,v,A,ct,ht]),Rt=mt.margin,It=k||C,Bt=We(()=>g([{label:Me||m(v),accessor:v,role:"x",format:u},{label:Ee||m(A),accessor:A,role:"y",format:y},...It?[{label:m(It),accessor:It,role:"group"}]:[],...p(Y,y)]),[v,A,Me,Ee,It,u,y,Y]),Ft=t({componentName:"LineChart",data:nt?Qe[0]?.[S]||[]:s,accessors:{xAccessor:v,yAccessor:A}}),Pt=We(()=>nt||it||st?at.flatMap(e=>{const t=e[S]||[];return it&&"string"==typeof it?t.map(t=>({...t,[it]:t[it]??e[it]})):t}):Ze,[at,S,nt,it,Ze,st]),Nt=c(T),Mt={chartType:_t,...Array.isArray(M)&&{areaGroups:M},...Nt&&{lineGradient:Nt},...null!=s&&{data:Pt},xAccessor:v,yAccessor:A,xScaleType:pe,yScaleType:ye,...U&&{xExtent:U},...!q||null==q[0]&&null==q[1]?tt?{yExtent:tt}:{}:{yExtent:q},groupAccessor:"break"===$&&st?"_gapSegment":it||void 0,...Y&&{band:Y},curve:F,lineStyle:Ct,...P&&{pointStyle:Lt},size:[Ce,_e],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Rt,showAxes:r.showAxes,xLabel:Me,yLabel:Ee,xFormat:u,yFormat:y,...void 0!==b&&{axisExtent:b},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:He,showGrid:Re,...mt.legendBehaviorProps,...Be&&{title:Be},...Fe&&{description:Fe},...Pe&&{summary:Pe},...void 0!==Ne&&{accessibleTable:Ne},...d&&{className:d},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===E?()=>null:"multi"===E?_():O(E)||Bt,..."multi"===E&&{tooltipMode:"multi"},...f({linkedHover:Z,selection:K,onObservation:oe,onClick:ne,hoverRadius:ae,hoverHighlight:re,mobileInteraction:mt.mobileInteraction,customHoverBehavior:gt,customClickBehavior:bt}),...G&&{pointIdAccessor:G},...(z?.length||Ye.length||Ht.length)&&{annotations:[...z||[],...Ye,...Ht]},...vt,...ke};return mt.earlyReturn?mt.earlyReturn:Ft?Ve(ee,{componentName:"LineChart",message:Ft,width:Ce,height:_e}):Ve(te,{componentName:"LineChart",width:Ce,height:_e,children:Ve(l,{ref:n,...Mt})})});Xe.displayName="LineChart";import{forwardRef as Qe,useMemo as Ye}from"react";import{jsx as Ue}from"react/jsx-runtime";var qe=Qe(function(e,t){const{data:o,layout:n,layoutConfig:i,onLayoutError:a,xExtent:s,yExtent:c,showAxes:h=!1,margin:d,className:u,annotations:m,onObservation:p,onClick:g,selection:b,linkedHover:v,hoverHighlight:x,chartId:A,loading:k,loadingContent:w,emptyContent:S,colorBy:C,colorScheme:L,legend:_,legendInteraction:R,legendPosition:I,frameProps:B={}}=e,{legend:F,...P}=B,N=Ye(()=>H(F,_),[F,_]),{frameRef:M,resolved:W,safeData:O,setup:D,earlyReturn:T}=r({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:C,colorScheme:L,legend:N,legendInteraction:R,legendPosition:I,selection:b,linkedHover:v,hoverHighlight:x,onObservation:p,onClick:g,chartId:A,loading:k,loadingContent:w,emptyContent:S,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),E=D.effectiveSelectionHook,G=Ye(()=>E?.isActive?{isActive:!0,predicate:E.predicate}:null,[E?.isActive,E?.predicate]);if(T)return T;const{width:j,height:z,enableHover:V,showGrid:$,title:X,description:Q,summary:Y,accessibleTable:U,xLabel:q,yLabel:J}=W,K={chartType:"custom",...null!=o&&{data:O},customLayout:n,layoutConfig:i,onLayoutError:a,...G&&{layoutSelection:G},xExtent:s,yExtent:c,colorAccessor:C,colorScheme:L,size:[j,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:D.margin,showAxes:h,xLabel:q,yLabel:J,enableHover:V,showGrid:$,...D.legendBehaviorProps,...y({title:X,description:Q,summary:Y,accessibleTable:U,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...f({linkedHover:v,selection:b,onObservation:p,onClick:g,hoverRadius:e.hoverRadius,hoverHighlight:x,mobileInteraction:D.mobileInteraction,customHoverBehavior:D.customHoverBehavior,customClickBehavior:D.customClickBehavior}),...m&&m.length>0&&{annotations:m},...D.crosshairProps,...P};return Ue(te,{componentName:"XYCustomChart",width:j,height:z,children:Ue(l,{ref:M,...K})})});qe.displayName="XYCustomChart";import{forwardRef as Je,useCallback as Ke,useMemo as Ze}from"react";function et(e,t,o,n,i){const r=1-i;return r*r*r*e+3*r*r*i*t+3*r*i*i*o+i*i*i*n}function tt(e,t,o,n,i){const r=1-i;return 3*r*r*(t-e)+6*r*i*(o-t)+3*i*i*(n-o)}function ot(e,t,o,n,i){const r=[],a=(e.x+t.x)/2;for(let s=0;i>=s;s++){const l=s/i;let c,h,d,u;"linear"===n?(c=e.x+(t.x-e.x)*l,h=e.y+(t.y-e.y)*l,d=t.x-e.x,u=t.y-e.y):(c=et(e.x,a,a,t.x,l),h=et(e.y,e.y,t.y,t.y,l),d=tt(e.x,a,a,t.x,l),u=tt(e.y,e.y,t.y,t.y,l)),r.push({x:c,y:h,dx:d,dy:u,radius:e.radius+(t.radius-e.radius)*l,datumIndex:.5>l?o:o+1})}return r}function nt(e,t={}){const o=[],n=[],i=[];if(2>e.length)return{topPath:o,bottomPath:n,datumIndices:i};const r=t.curve??"smooth",a=Math.max(2,Math.floor(t.samplesPerSegment??12));for(let t=0;e.length-1>t;t++){const s=ot(e[t],e[t+1],t,r,a);for(let e=0===t?0:1;s.length>e;e++){const t=s[e],r=Math.hypot(t.dx,t.dy)||1,a=-t.dy/r,l=t.dx/r,c=Math.max(0,t.radius);o.push([t.x+a*c,t.y+l*c]),n.push([t.x-a*c,t.y-l*c]),i.push(t.datumIndex)}}return{topPath:o,bottomPath:n,datumIndices:i}}import{jsx as it,jsxs as rt}from"react/jsx-runtime";function at(e,t,o){return"function"==typeof e?e(t,o):t[e]}function st(e){return e instanceof Date?"date:"+e.getTime():`${typeof e}:${e+""}`}function lt(e,t={}){const o=t.xAccessor??"x",n=t.yAccessor??"y",i=t.lineBy??"series",r=t.rankDirection??"descending",a=[],s=new Map,l=new Map,c=[],h=new Map;let d=1/0,u=-1/0;e.forEach((e,t)=>{const r=at(o,e,t),m=st(r);let p=s.get(m);null==p&&(p=a.length,s.set(m,p),a.push(r),l.set(p,[]));const y=at(i,e,t)+"";h.has(y)||(h.set(y,c.length),c.push(y));const f=Number(at(n,e,t));Number.isFinite(f)&&(d=Math.min(d,f),u=Math.max(u,f),l.get(p)?.push({datum:e,inputIndex:t,series:y,value:f}))});const m=[],p=new Map,y=new Map;for(let e=0;a.length>e;e++){const t=l.get(e)??[];t.sort((e,t)=>("descending"===r?t.value-e.value:e.value-t.value)||(h.get(e.series)??0)-(h.get(t.series)??0)),t.forEach((t,o)=>{const n=o+1;m.push({datum:t.datum,xIndex:e,xValue:a[e],series:t.series,value:t.value,rank:n}),p.set(t.series,(p.get(t.series)??0)+n),y.set(t.series,(y.get(t.series)??0)+1)})}const f=c.length+1,g=[...c].sort((e,t)=>{const o=y.get(e)??0,n=y.get(t)??0;return((p.get(e)??0)+(a.length-o)*f)/Math.max(1,a.length)-((p.get(t)??0)+(a.length-n)*f)/Math.max(1,a.length)||(h.get(e)??0)-(h.get(t)??0)}),b=new Set(g.slice(0,null==t.highlightTop?g.length:Math.max(0,Math.floor(t.highlightTop))));return{data:m.map(e=>{const t=b.has(e.series);return{...e.datum,x:e.xIndex,y:e.rank,__bumpRaw:e.datum,__bumpSeries:e.series,__bumpColorGroup:t?e.series:"Other",__bumpValue:e.value,__bumpRank:e.rank,__bumpXValue:e.xValue,__bumpHighlighted:t}}),xValues:a,seriesOrder:c,overallOrder:g,valueExtent:d===1/0?[0,0]:[d,u]}}function ct({datum:e,x:t,y:o,side:n,color:i,highlighted:r,labelStyle:a}){const s=v(),l=s.isActive&&!s.predicate(e),c="function"==typeof a?a(e.__bumpRaw):a;return it("text",{className:"semiotic-bump-label",x:t+("end"===n?8:-8),y:o,dy:"0.35em",textAnchor:"end"===n?"start":"end",fill:i,fillOpacity:l?.16:1,fontWeight:r?650:450,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-axis-label-font-size, 11px)",...c},children:e.__bumpSeries})}function ht(e,t,o){const[n,i]=t,[r,a]=o;return i===n?(r+a)/2:r+(a-r)*Math.max(0,Math.min(1,(e-n)/(i-n)))}function dt(e){const t=e instanceof Date?e.getTime():Number(e);return Number.isFinite(t)?t:void 0}function ut(e){return{value:e.__bumpValue,x:dt(e.__bumpXValue),y:e.__bumpValue,category:e.__bumpSeries}}function mt(e){const t=e.config,o=new Map;for(const t of e.data){const e=o.get(t.__bumpSeries)??[];e.push(t),o.set(t.__bumpSeries,e)}const n=t.seriesOrder.filter(e=>o.has(e)).sort((e,n)=>(o.get(e)?.[0]?.__bumpHighlighted?1:0)-(o.get(n)?.[0]?.__bumpHighlighted?1:0)||t.seriesOrder.indexOf(e)-t.seriesOrder.indexOf(n)),i=[],r=[];for(const a of n){const n=(o.get(a)??[]).sort((e,t)=>e.x-t.x);if(2>n.length)continue;const s=n[0].__bumpHighlighted,l=e.resolveColor(n[0].__bumpSeries,n[0]),c=t.color??(s?l:t.neutralColor??e.theme.semantic.textSecondary??e.theme.semantic.border??l),h=n.map(o=>({x:e.scales.x(o.x),y:e.scales.y(o.y),radius:t.ribbon?ht(o.__bumpValue,t.valueExtent,t.ribbonSizeRange)/2:Math.max(.5,t.lineWidth/2)})),d=nt(h,{curve:t.curve,samplesPerSegment:t.samplesPerSegment}),u=d.datumIndices.map(e=>n[e]),m={fill:c,fillOpacity:1,opacity:s?t.ribbon?t.ribbonOpacity:t.lineOpacity:Math.min(t.ribbon?t.ribbonOpacity:t.lineOpacity,.58)};t.styleRules?.length&&Object.assign(m,A(n[0].__bumpRaw,t.styleRules,ut(n[0]))),t.areaStyle&&Object.assign(m,t.areaStyle(n[0].__bumpRaw)??{}),void 0!==t.stroke&&(m.stroke=t.stroke),void 0!==t.strokeWidth&&(m.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(m.opacity=t.opacity),i.push({type:"area",topPath:d.topPath,bottomPath:d.bottomPath,style:m,datum:u,accessibleDatum:n.map(e=>e.__bumpRaw),accessibility:{label:a+" ranking trajectory",tableFields:n.map(e=>e.__bumpRaw)},group:a,interactive:!0}),t.showPoints&&n.forEach((e,o)=>{const n={fill:c,stroke:"none",opacity:s?1:.75};t.styleRules?.length&&Object.assign(n,A(e.__bumpRaw,t.styleRules,ut(e))),t.pointStyle&&Object.assign(n,t.pointStyle(e.__bumpRaw)??{}),void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),i.push({type:"point",x:h[o].x,y:h[o].y,r:n.r??t.pointRadius,style:n,datum:e,accessibleDatum:e.__bumpRaw,accessibility:{label:`${a}, rank ${e.__bumpRank}, value ${e.__bumpValue}`},pointId:`${a}:${e.x}`})});const p=!0===t.showLabels?"end":t.showLabels,y=(e,o,n)=>{r.push(it(ct,{datum:e,x:h[o].x,y:h[o].y,side:n,color:"string"==typeof m.fill?m.fill:c,highlighted:s,labelStyle:t.labelStyle},`${a}-${n}`))};"start"!==p&&"both"!==p||y(n[0],0,"start"),"end"!==p&&"both"!==p||y(n.at(-1),n.length-1,"end")}return{nodes:i,overlays:r.length?it("g",{className:"semiotic-bump-labels",children:r}):void 0,restyle:(e,t)=>{const o=function(e){const t=Array.isArray(e.datum)?e.datum[0]:e.datum;return t&&"object"==typeof t&&"__bumpSeries"in t?t:void 0}(e);if(t?.isActive&&o&&!t.predicate(o))return{opacity:.14}}}}var pt=Je(function(e,t){const o=Y(),n=Z(),{data:i,xAccessor:r,yAccessor:a,lineBy:s,rankDirection:l="descending",ribbon:c=!1,curve:h="smooth",ribbonSizeRange:d=[4,28],samplesPerSegment:u=12,lineWidth:m=3,highlightTop:p,neutralColor:y,styleRules:f,labelStyle:g,colorScheme:b,ribbonOpacity:v=.82,lineOpacity:x=.9,showPoints:A=!1,pointRadius:k=3,showLabels:w=!0,showAxes:S=!0,showGrid:C=!0,showLegend:L=!1,enableHover:_=!0,hoverHighlight:H=!0,tooltip:I,frameProps:B={},xFormat:F,yFormat:P,onClick:N}=e,M=Ze(()=>lt(i,{xAccessor:r,yAccessor:a,lineBy:s,rankDirection:l,highlightTop:p}),[i,r,a,s,l,p]),{axes:W,areaStyle:T,pointStyle:E,...G}=B,j=Ze(()=>function(e){const{seriesOrder:t,overallOrder:o,highlightTop:n,color:i,colorScheme:r,neutralColor:a,themeCategorical:s,themeNeutral:l}=e;if(null==n&&null==i)return r;const c=new Set(o.slice(0,null==n?o.length:Math.max(0,Math.floor(n)))),h=new Map,d={};for(const e of t)d[e]=i??(c.has(e)?D(void 0,s,r,e,h):a??l??"#b8bec8");return d}({seriesOrder:M.seriesOrder,overallOrder:M.overallOrder,highlightTop:p,color:e.color,colorScheme:b,neutralColor:y,themeCategorical:o,themeNeutral:n.colors.textSecondary}),[M.seriesOrder,M.overallOrder,p,e.color,b,y,o,n.colors.textSecondary]),z=Ze(()=>({ribbon:c,curve:h,samplesPerSegment:u,ribbonSizeRange:d,valueExtent:M.valueExtent,seriesOrder:M.seriesOrder,lineWidth:m,ribbonOpacity:v,lineOpacity:x,neutralColor:y,color:e.color,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity,styleRules:f,areaStyle:T,pointStyle:E,labelStyle:g,showPoints:A,pointRadius:k,showLabels:w}),[c,h,u,d,M.valueExtent,M.seriesOrder,m,v,x,y,e.color,e.stroke,e.strokeWidth,e.opacity,f,T,E,g,A,k,w]),V=Ke((e,t)=>{if(0===M.xValues.length)return"";const o=M.xValues[Math.max(0,Math.min(M.xValues.length-1,Math.round(Number(e))))];return F?F(o,t):(o instanceof Date?o.toLocaleDateString():o)+""},[M.xValues,F]),$=Ke(e=>P?P(e):e.toLocaleString(),[P]),X=Ze(()=>"multi"===I?void 0:O(I),[I]),Q=Ke(e=>{const t=e?.data??e;return t?!1===I?null:X?X({...e,data:t.__bumpRaw,__semioticHoverData:!0}):rt("div",{className:"semiotic-tooltip",style:R,children:[it("div",{style:{fontWeight:700},children:t.__bumpSeries}),rt("div",{children:[V(t.x)," · Rank ",t.__bumpRank]}),rt("div",{children:["Value: ",$(t.__bumpValue)]})]}):null},[$,V,X,I]),U=Ze(()=>{if(N)return(e,t)=>{N(e.__bumpRaw??e,t)}},[N]),q=Math.max(1,M.seriesOrder.length),J=M.xValues.map((e,t)=>t),K=Array.from({length:q},(e,t)=>t+1),ee=W??[{orient:"left",tickValues:K,tickFormat:e=>e+"",label:e.yLabel??"Rank",baseline:!1},{orient:"bottom",tickValues:J,tickFormat:V,label:e.xLabel,tickAnchor:"edges"}],te=Ze(()=>function(e,t){if(!e?.length)return;const o=new Map(t.map((e,t)=>[st(e),t]));return e.map(e=>{const t={...e},n=n=>{if(!(n in e))return;const i=o.get(st(e[n]));void 0!==i&&(t[n]=i)};return n("x"),n("x0"),n("x1"),"string"!=typeof e.type||"x-threshold"!==e.type&&"x"!==e.type||n("value"),t})}(e.annotations,M.xValues),[e.annotations,M.xValues]);return it(qe,{ref:t,data:M.data,layout:mt,layoutConfig:z,xExtent:[0,Math.max(1,M.xValues.length-1)],yExtent:[q+.5,.5],showAxes:S,showGrid:C,showLegend:L,enableHover:_,hoverHighlight:H,colorBy:"__bumpSeries",colorScheme:j,tooltip:Q,onClick:U,hoverRadius:e.hoverRadius,width:e.width,height:e.height,responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,responsiveRules:e.responsiveRules,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,mode:e.mode,margin:e.margin??{top:20,right:w?110:24,bottom:48,left:48},className:e.className,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,selection:e.selection,linkedHover:e.linkedHover,legend:e.legend,legendInteraction:e.legendInteraction,legendPosition:e.legendPosition,onObservation:e.onObservation,chartId:e.chartId,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations,annotations:te,xLabel:e.xLabel,yLabel:e.yLabel??"Rank",frameProps:{axes:ee,axisExtent:"exact",...G}})});pt.displayName="BumpChart";import{useMemo as yt,forwardRef as ft,useRef as gt}from"react";import{useMemo as bt}from"react";function vt(e){const{safeData:t,data:n,areaBy:i,lineDataAccessor:r,colorBy:a,colorScale:s,color:l,stroke:c,strokeWidth:h,opacity:d,effectiveSelectionHook:u,resolvedSelection:y,areaOpacity:f,showLine:b,lineWidth:v,showPoints:x,pointRadius:k,xAccessor:S,yAccessor:C,xLabel:L,yLabel:_,xFormat:H,yFormat:R,groupField:I,styleRules:F,ruleContext:P}=e,N=bt(()=>function({data:e,safeData:t,areaBy:o,lineDataAccessor:n}){if(null==e)return[];const i=void 0!==t[0]?.[n];if(!i&&!o)return t;let r;if(i)r=t;else{const e=t.reduce((e,t)=>{const i="function"==typeof o?o(t):t[o],r=i+"";if(!e[r]){const t={[n]:[]};"string"==typeof o&&(t[o]=i),e[r]=t}return e[r][n].push(t),e},{});r=Object.values(e)}return r.flatMap(e=>{const t=Array.isArray(e[n])?e[n]:[];return"string"==typeof o?t.map(t=>({...t,[o]:t[o]??e[o]})):t})}({data:n,safeData:t,areaBy:i,lineDataAccessor:r}),[n,t,i,r]),M=bt(()=>e=>{const t={};if(a){if(s){const o=B(e,a,s);t.fill=o,b?(t.stroke=o,t.strokeWidth=v):t.stroke="none"}}else{const e=l||w;t.fill=e,b?(t.stroke=e,t.strokeWidth=v):t.stroke="none"}return t.fillOpacity=f,F&&F.length>0&&Object.assign(t,A(e,F,P?P(e):{value:void 0})),t},[a,s,l,f,b,v,F,P]),W=bt(()=>o(M,{stroke:c,strokeWidth:h,opacity:d}),[M,c,h,d]);return{flattenedData:N,lineStyle:bt(()=>q(W,u??null,y),[W,u,y]),pointStyle:bt(()=>{if(x)return e=>{const t={r:k,fillOpacity:1};return a?s&&(t.fill=B(e.parentLine||e,a,s)):t.fill=l||w,t}},[x,k,a,s,l]),defaultTooltipContent:bt(()=>g([{label:L||m(S),accessor:S,role:"x",format:H},{label:_||m(C),accessor:C,role:"y",format:R},...I?[{label:m(I),accessor:I,role:"group"}]:[],...p(e.band,R)]),[S,C,L,_,I,H,R,e.band])}}import{jsx as xt}from"react/jsx-runtime";var At=ft(function(e,o){const n=gt(null);a(o,{variant:"xy",frameRef:n});const r=j(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:m,className:p,xFormat:g,yFormat:v,xAccessor:A="x",yAccessor:k="y",areaBy:w,y0Accessor:S,gradientFill:C=!1,semanticGradient:L,semanticLine:H=!0,lineDataAccessor:R="coordinates",colorBy:B,colorScheme:F,styleRules:P,curve:N="monotoneX",areaOpacity:M=.7,lineGradient:W,showLine:O=!0,lineWidth:D=2,showPoints:T=!1,pointRadius:E=3,tooltip:G,annotations:z,forecast:V,anomaly:$,band:X,xExtent:Q,yExtent:Y,frameProps:U={},selection:q,linkedHover:J,onObservation:K,onClick:Z,hoverHighlight:oe,chartId:ne,loading:re,loadingContent:ae,emptyContent:se,legendInteraction:le,legendPosition:ce,color:he,stroke:de,strokeWidth:ue,opacity:me}=e,{width:pe,height:ye,enableHover:fe,showGrid:ge,showLegend:be,title:ve,description:xe,summary:Ae,accessibleTable:ke,xLabel:we,yLabel:Se}=r,Ce=yt(()=>I(s),[s]),_e=B||w,He=yt(()=>d(L),[L]),Re=yt(()=>He?.stops.length?u(He):h(C),[He,C]),Ie=yt(()=>c(W),[W]),Be=yt(()=>H&&He?.stops.length?He.stops.flatMap(({offset:e,color:t})=>t?[{offset:e,color:t}]:[]):void 0,[He,H]);ie("AreaChart",Ce,"xAccessor",A),ie("AreaChart",Ce,"yAccessor",k);const Fe=i({data:Ce,rawData:s,colorBy:_e,colorScheme:F,legendInteraction:le,legendPosition:ce,selection:q,linkedHover:J,fallbackFields:_e?["string"==typeof _e?_e:""]:[],unwrapData:!1,onObservation:K,onClick:Z,hoverHighlight:oe,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"AreaChart",chartId:ne,showLegend:be,userMargin:m,marginDefaults:r.marginDefaults,loading:re,loadingContent:ae,emptyContent:se,width:pe,height:ye,hasTitle:!!ve}),{effectiveData:Pe,statisticalAnnotations:Ne}=Le({data:Ce,xAccessor:A,yAccessor:k,forecast:V,anomaly:$,groupBy:w}),Me=yt(()=>x(A,k),[A,k]),{flattenedData:We,lineStyle:Oe,pointStyle:De,defaultTooltipContent:Te}=vt({safeData:Pe,data:s,areaBy:w,lineDataAccessor:R,colorBy:_e,colorScale:Fe.colorScale,color:he,stroke:de,strokeWidth:ue,opacity:me,effectiveSelectionHook:Fe.effectiveSelectionHook,resolvedSelection:Fe.resolvedSelection,areaOpacity:M,showLine:O,lineWidth:D,showPoints:T,pointRadius:E,xAccessor:A,yAccessor:k,xLabel:we,yLabel:Se,xFormat:g,yFormat:v,groupField:w||B,band:X,styleRules:P,ruleContext:Me}),Ee=t({componentName:"AreaChart",data:s,accessors:{xAccessor:A,yAccessor:k}}),Ge={chartType:"area",...null!=s&&{data:We},xAccessor:A,yAccessor:k,groupAccessor:w||void 0,...S&&{y0Accessor:S},...X&&{band:X},...Re&&{gradientFill:Re},...Ie&&{lineGradient:Ie},...Be&&{semanticLineStops:Be},curve:N,lineStyle:Oe,...T&&De&&{pointStyle:De},size:[pe,ye],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Fe.margin,showAxes:r.showAxes,xLabel:we,yLabel:Se,xFormat:g,yFormat:v,enableHover:fe,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:ge,...Fe.legendBehaviorProps,...y({title:ve,description:xe,summary:Ae,accessibleTable:ke,className:p,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===G?{tooltipContent:_(),tooltipMode:"multi"}:b({tooltip:G,defaultTooltipContent:Te}),...f({linkedHover:J,selection:q,onObservation:K,onClick:Z,hoverHighlight:oe,mobileInteraction:Fe.mobileInteraction,customHoverBehavior:Fe.customHoverBehavior,customClickBehavior:Fe.customClickBehavior}),...(z&&z.length>0||Ne.length>0)&&{annotations:[...z||[],...Ne]},...Q&&{xExtent:Q},...Y&&{yExtent:Y},...Fe.crosshairProps,...U};return Fe.earlyReturn?Fe.earlyReturn:Ee?xt(ee,{componentName:"AreaChart",message:Ee,width:pe,height:ye}):xt(te,{componentName:"AreaChart",width:pe,height:ye,children:xt(l,{ref:n,...Ge})})});At.displayName="AreaChart";import{useMemo as kt,forwardRef as wt,useRef as St,useState as Ct,useImperativeHandle as Lt,useCallback as _t}from"react";import{jsx as Ht,jsxs as Rt}from"react/jsx-runtime";function It(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var Bt=wt(function(e,t){const o=St(null),n=j(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:a,className:s,xFormat:c,yFormat:d,xAccessor:u="x",seriesAAccessor:m="a",seriesBAccessor:p="b",seriesALabel:g="A",seriesBLabel:b="B",seriesAColor:v="var(--semiotic-danger, #dc2626)",seriesBColor:x="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:k=1.5,showPoints:w=!1,pointRadius:S=3,curve:C="linear",areaOpacity:L=.6,gradientFill:_,tooltip:H,annotations:B,xExtent:F,yExtent:P,frameProps:N={},selection:M,linkedHover:W,onObservation:D,onClick:T,hoverHighlight:E,chartId:G,loading:z,loadingContent:V,emptyContent:$,legendInteraction:X,legendPosition:Q,pointIdAccessor:Y,windowSize:U}=e,{width:q,height:J,enableHover:K,showGrid:Z,showLegend:ee,title:oe,description:ne,summary:ie,accessibleTable:re,xLabel:ae,yLabel:se}=n,le=kt(()=>"function"==typeof u?e=>It(u(e)):e=>It(e[u]),[u]),ce=kt(()=>"function"==typeof m?e=>It(m(e)):e=>It(e[m]),[m]),he=kt(()=>"function"==typeof p?e=>It(p(e)):e=>It(e[p]),[p]),[de,ue]=Ct([]),me=St([]),pe=null==r,ye=kt(()=>I(pe?de:r),[pe,de,r]),fe=kt(()=>function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let a=0,s=null,l=null,c=[];const h=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,u=e=>r.push(e),m=(e,t)=>{u({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],p=t(r),y=o(r),f=n(r);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(f))continue;const g=h(y,f);if(null!==g)if(null!=s){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=y-l.a-(f-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(p-l.x),t=l.a+n*(y-l.a)}else e=l.x,t=l.a}u({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=g,u({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)m(c[e],s)}else for(const e of c)m(e,s);c=[],u({__x:p,__y:f>y?f:y,__y0:f>y?y:f,__diffSegment:d(s),__diffWinner:s,__valA:y,__valB:f,__sourceDatum:r}),l={x:p,a:y,b:f,w:g}}else{s=g;for(const e of c)m(e,s);c=[],u({__x:p,__y:f>y?f:y,__y0:f>y?y:f,__diffSegment:d(s),__diffWinner:s,__valA:y,__valB:f,__sourceDatum:r}),l={x:p,a:y,b:f,w:g}}else c.push({x:p,y:y,datum:r})}for(const e of c)m(e,s??"A");return r}(ye,le,ce,he),[ye,le,ce,he]),ge=kt(()=>A?function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];for(const e of i){const i=t(e),a=o(e),s=n(e);Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-B"})}return r}(ye,le,ce,he):[],[A,ye,le,ce,he]),be=kt(()=>[...fe,...ge],[fe,ge]),ve=kt(()=>{const e=new Set;for(const t of fe)e.add(t.__diffSegment);return Array.from(e)},[fe]);Lt(t,()=>{const e=e=>{const t=U&&e.length>U?e.slice(e.length-U):e;me.current=t,ue(t)},t=Y?"function"==typeof Y?Y:e=>e[Y]:null;return{push:t=>e([...me.current,t]),pushMany:t=>e([...me.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of me.current)n.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(o,n)=>{if(!t)return[];const i=Array.isArray(o)?o:[o],r=[],a=me.current.map(e=>{if(i.includes(t(e))){const t=n(e);return r.push(t),t}return e});return e(a),r},clear:()=>e([]),getData:()=>pe?me.current:ye,getScales:()=>o.current?.getScales()??null}},[pe,ye,Y,U]);const xe=i({data:ye,rawData:r,colorBy:"__diffWinner",colorScheme:[v,x],legendInteraction:X,legendPosition:Q,selection:M,linkedHover:W,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:D,onClick:T,hoverHighlight:E,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DifferenceChart",chartId:G,showLegend:ee,userMargin:a,marginDefaults:n.marginDefaults,loading:z,loadingContent:V,emptyContent:$,width:q,height:J,hasTitle:!!oe}),Ae=kt(()=>{if(!1!==ee)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:g,color:v},{label:b,color:x}]}]}},[ee,g,b,v,x]),ke=_t(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?v:x,stroke:"none",fillOpacity:L}},[v,x,L]),we=_t(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?v:x,strokeWidth:k,fill:"none"}),[v,x,k]),Se=_t(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?v:x,r:S}),[v,x,S]),Ce=_t(e=>{const t=e.data,o=e.allSeries,n=e.xValue??t?.__x;let i=t?.__valA,r=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(i=e.value),null!=t?.value&&Number.isFinite(t.value)&&(r=t.value)}if(null!=n&&(null==i||null==r)){const e=ye.find(e=>le(e)===n);e&&(null==i&&(i=ce(e)),null==r&&(r=he(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",s=c&&null!=n?c(n):null!=n?n+"":"";return Rt("div",{className:"semiotic-tooltip",style:R,children:[s&&Ht("div",{style:{fontWeight:600,marginBottom:4},children:s}),Rt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Ht("span",{style:{width:10,height:10,background:v,display:"inline-block",borderRadius:2}}),Rt("span",{children:[g,": ",a(i)]})]}),Rt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Ht("span",{style:{width:10,height:10,background:x,display:"inline-block",borderRadius:2}}),Rt("span",{children:[b,": ",a(r)]})]}),null!=i&&null!=r&&Number.isFinite(i)&&Number.isFinite(r)&&Rt("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(i-r)]})]})},[ye,le,ce,he,c,v,x,g,b]),Le="multi"===H,_e=kt(()=>!1===H?()=>null:Le?Ce:O(H)||Ce,[H,Le,Ce]),He=kt(()=>h(_,{stops:[{offset:0,opacity:.85},{offset:1,opacity:.15}]}),[_]);if(xe.earlyReturn)return xe.earlyReturn;const Re={chartType:"mixed",data:be,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ve,curve:C,areaStyle:ke,lineStyle:we,...w&&{pointStyle:Se},size:[q,J],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe.margin,showAxes:n.showAxes,xLabel:ae,yLabel:se,xFormat:c,yFormat:d,enableHover:K,showGrid:Z,...He&&{gradientFill:He},...Ae&&{legend:Ae,legendPosition:xe.legendPosition},...y({title:oe,description:ne,summary:ie,accessibleTable:re,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:_e,...Le&&{tooltipMode:"multi"},...f({linkedHover:W,selection:M,onObservation:D,onClick:T,hoverHighlight:E,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior}),...B&&B.length>0&&{annotations:B},...F&&{xExtent:F},...P&&{yExtent:P},...xe.crosshairProps,...N};return Ht(te,{componentName:"DifferenceChart",width:q,height:J,children:Ht(l,{ref:o,...Re})})});"function"==typeof Bt&&(Bt.displayName="DifferenceChart");import{useMemo as Ft,forwardRef as Pt,useRef as Nt}from"react";import{jsx as Mt}from"react/jsx-runtime";var Wt=Pt(function(e,o){const n=Nt(null),r=j(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:d,yFormat:u,xAccessor:m="x",yAccessor:p="y",areaBy:g,lineDataAccessor:v="coordinates",colorBy:A,colorScheme:k,styleRules:w,curve:S="monotoneX",areaOpacity:C=.7,showLine:L=!0,lineWidth:H=2,showPoints:R=!1,pointRadius:B=3,normalize:F=!1,baseline:P="zero",stackOrder:N,tooltip:M,annotations:W,xExtent:O,yExtent:D,frameProps:T={},selection:E,linkedHover:G,onObservation:z,onClick:V,hoverHighlight:$,chartId:X,loading:Q,loadingContent:Y,emptyContent:U,legendInteraction:q,legendPosition:J,color:K,stroke:Z,strokeWidth:oe,opacity:ne}=e,{width:ie,height:re,enableHover:ae,showGrid:se,showLegend:le,title:ce,description:he,summary:de,accessibleTable:ue,xLabel:me,yLabel:pe}=r,ye=Ft(()=>I(s),[s]),fe=A||g;a(o,{variant:"xy",frameRef:n});const ge=i({data:ye,rawData:s,colorBy:fe,colorScheme:k,legendInteraction:q,legendPosition:J,selection:E,linkedHover:G,fallbackFields:fe?["string"==typeof fe?fe:""]:[],unwrapData:!1,onObservation:z,onClick:V,hoverHighlight:$,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedAreaChart",chartId:X,showLegend:le,userMargin:c,marginDefaults:r.marginDefaults,loading:Q,loadingContent:Y,emptyContent:U,width:ie,height:re,hasTitle:!!ce}),be=Ft(()=>x(m,p),[m,p]),{flattenedData:ve,lineStyle:xe,pointStyle:Ae,defaultTooltipContent:ke}=vt({safeData:ye,data:s,areaBy:g,lineDataAccessor:v,colorBy:fe,colorScale:ge.colorScale,color:K,stroke:Z,strokeWidth:oe,opacity:ne,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection,areaOpacity:C,showLine:L,lineWidth:H,showPoints:R,pointRadius:B,xAccessor:m,yAccessor:p,xLabel:me,yLabel:pe,xFormat:d,yFormat:u,groupField:g||A,styleRules:w,ruleContext:be}),we=t({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:m,yAccessor:p}}),Se={chartType:"stackedarea",...null!=s&&{data:ve},xAccessor:m,yAccessor:p,groupAccessor:g||void 0,curve:S,normalize:F,baseline:F?"zero":P,stackOrder:N,lineStyle:xe,...R&&Ae&&{pointStyle:Ae},size:[ie,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:me,yLabel:pe,xFormat:d,yFormat:u,enableHover:ae,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:se,...ge.legendBehaviorProps,...y({title:ce,description:he,summary:de,accessibleTable:ue,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:_(),tooltipMode:"multi"}:b({tooltip:M,defaultTooltipContent:ke}),...f({linkedHover:G,selection:E,onObservation:z,onClick:V,hoverHighlight:$,mobileInteraction:ge.mobileInteraction,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior}),...W&&W.length>0&&{annotations:W},...O&&{xExtent:O},...D&&{yExtent:D},...ge.crosshairProps,...T};return ge.earlyReturn?ge.earlyReturn:we?Mt(ee,{componentName:"StackedAreaChart",message:we,width:ie,height:re}):Mt(te,{componentName:"StackedAreaChart",width:ie,height:re,children:Mt(l,{ref:n,...Se})})});Wt.displayName="StackedAreaChart";import{useMemo as Ot,forwardRef as Dt,useRef as Tt}from"react";import{scaleSequential as Et}from"d3-scale";import{jsx as Gt}from"react/jsx-runtime";var jt=Dt(function(e,o){const n=Tt(null);a(o,{variant:"xy",frameRef:n});const i=j(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:c,className:h,xAccessor:d="x",yAccessor:u="y",valueAccessor:p="value",xFormat:v,yFormat:x,colorScheme:A,customColorScale:k,showValues:w=!1,valueFormat:S,cellBorderColor:C="#fff",cellBorderWidth:L=1,tooltip:_,annotations:H,xExtent:R,yExtent:B,frameProps:N={},selection:M,linkedHover:W,onObservation:O,onClick:D,hoverHighlight:T,chartId:E,loading:V,loadingContent:X,emptyContent:Q,showLegend:Y,legendPosition:q,legend:J,legendInteraction:Z}=e,{width:ie,height:re,enableHover:ae,title:se,description:le,summary:ce,accessibleTable:he,xLabel:de,yLabel:ue}=i,me=ne(V,ie,re,X),pe=me?null:oe(r,ie,re,Q),ye=Ot(()=>I(r),[r]),fe=U(),ge=A??fe??"blues",be=Y??!1,ve=q??"right",{customHoverBehavior:xe,customClickBehavior:Ae,crosshairSourceId:ke}=z({selection:M,linkedHover:W,fallbackFields:[],onObservation:O,onClick:D,chartType:"Heatmap",chartId:E,hoverHighlight:T,colorByField:void 0,mobileInteraction:i.mobileInteraction});s(M);const we=F(W,ke);$(Z,void 0,[]);const Se=Ot(()=>"function"==typeof p?e=>p(e):e=>e[p],[p]),Ce=Ot(()=>{const e=ye.map(Se);return K(e)},[ye,Se]),Le=Ot(()=>{if("custom"===ge&&k)return k;const e=P(ge);return Et(e).domain(Ce)},[ge,k,Ce]),_e=Ot(()=>{const e=Number.isFinite(L)?Math.max(0,L):1;return()=>({stroke:C,strokeWidth:e})},[C,L]),He=Ot(()=>g([{label:de||m(d),accessor:d,role:"x",format:v},{label:ue||m(u),accessor:u,role:"y",format:x},{label:m(p),accessor:p,role:"value",format:S}]),[d,u,de,ue,p,v,x,S]),Re=t({componentName:"Heatmap",data:r,accessors:{xAccessor:d,yAccessor:u,valueAccessor:p}}),Ie=Ot(()=>{if(be)return{gradient:{colorFn:e=>Le(e),domain:Ce,label:"string"==typeof p?p:"value",format:S},legendDistance:J?.legendDistance}},[be,Le,Ce,p,S,J?.legendDistance]),{margin:Be}=G({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:ve,userMargin:c,defaults:i.marginDefaults,additionalLegend:Ie,chartWidth:ie,legendLayout:N.legendLayout,hasTitle:!!se}),Fe={chartType:"heatmap",...null!=r&&{data:ye},xAccessor:d,yAccessor:u,valueAccessor:p,colorScheme:"custom"!==ge?ge:void 0,areaStyle:_e,showValues:w,heatmapValueFormat:S,size:[ie,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Be,showAxes:i.showAxes,xLabel:de,yLabel:ue,xFormat:v,yFormat:x,enableHover:ae,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Ie&&{legend:Ie,legendPosition:ve},...y({title:se,description:le,summary:ce,accessibleTable:he,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...b({tooltip:_,defaultTooltipContent:He}),...f({linkedHover:W,selection:M,onObservation:O,onClick:D,hoverHighlight:T,mobileInteraction:i.mobileInteraction,customHoverBehavior:xe,customClickBehavior:Ae}),...H&&H.length>0&&{annotations:H},...R&&{xExtent:R},...B&&{yExtent:B},...we,...N};return me||pe||(Re?Gt(ee,{componentName:"Heatmap",message:Re,width:ie,height:re}):Gt(te,{componentName:"Heatmap",width:ie,height:re,children:Gt(l,{ref:n,...Fe})}))});jt.displayName="Heatmap";import{useMemo as zt,useCallback as Vt,forwardRef as $t,useRef as Xt}from"react";import{jsx as Qt}from"react/jsx-runtime";var Yt=$t(function(o,n){const r=Xt(null),s=j(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:c,margin:h,className:d,xFormat:u,yFormat:p,xAccessor:v="x",yAccessor:A="y",sizeBy:k,sizeRange:w=[5,40],colorBy:S,colorScheme:C,styleRules:L,bubbleOpacity:_=.6,bubbleStrokeWidth:H=1,bubbleStrokeColor:R="white",tooltip:B,marginalGraphics:F,pointIdAccessor:P,annotations:M,regression:O,xExtent:D,yExtent:T,frameProps:G={},selection:z,linkedHover:V,linkedBrush:$,onObservation:X,onClick:Q,hoverHighlight:Y,chartId:U,loading:q,loadingContent:J,emptyContent:K,legendInteraction:Z,legendPosition:oe,color:ne,stroke:ie,strokeWidth:re,opacity:ae}=o,{width:se,height:le,enableHover:ce,showGrid:he,showLegend:ue,title:me,description:pe,summary:ye,accessibleTable:ge,xLabel:be,yLabel:ve}=s,xe=zt(()=>I(c),[c]),Ae=void 0===c,ke=i({data:xe,rawData:c,colorBy:S,colorScheme:C,legendInteraction:Z,legendPosition:oe,selection:z,linkedHover:V,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:X,onClick:Q,hoverHighlight:Y,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"BubbleChart",chartId:U,showLegend:ue,userMargin:h,marginDefaults:s.marginDefaults,loading:q,loadingContent:J,emptyContent:K,width:se,height:le,hasTitle:!!me}),{domain:we,trackPushed:Se,reset:Ce}=fe({accessor:k,data:xe,isPushMode:Ae}),Le=Vt(e=>{Se([e]),r.current?.push(e)},[Se]),_e=Vt(e=>{Se(e),r.current?.pushMany(e)},[Se]);a(n,{variant:"xy",frameRef:r,overrides:{push:Le,pushMany:_e,clear:()=>{Ce(),r.current?.clear()}}});const He=W($),Re=(E({name:He?.name||"__unused_brush__",xField:He?.xField||("string"==typeof v?v:void 0),yField:He?.yField||("string"==typeof A?A:void 0)}),zt(()=>({stroke:R,strokeWidth:H}),[R,H])),Ie=zt(()=>we??[0,1],[we]),Be=Vt(e=>N(e,k,w,Ie),[k,w,Ie]),Fe=zt(()=>x(v,A),[v,A]),Pe=de({colorBy:S,colorScale:ke.colorScale,color:ne,fillOpacity:_,radiusFn:Be,baseStyleExtras:Re,stroke:ie,strokeWidth:re,opacity:ae,styleRules:L,ruleContext:Fe,effectiveSelectionHook:ke.effectiveSelectionHook,resolvedSelection:ke.resolvedSelection}),Ne=zt(()=>g([{label:be||m(v),accessor:v,role:"x",format:u},{label:ve||m(A),accessor:A,role:"y",format:p},{label:m(k),accessor:k,role:"size"},...S?[{label:m(S),accessor:S,role:"color"}]:[]]),[v,A,be,ve,k,S,u,p]);if(ke.earlyReturn)return ke.earlyReturn;const Me=t({componentName:"BubbleChart",data:c,accessors:{xAccessor:v,yAccessor:A},requiredProps:{sizeBy:k}});if(Me)return Qt(ee,{componentName:"BubbleChart",message:Me,width:se,height:le});const We=e(O),Oe=We?[We,...M||[]]:M,De={chartType:"bubble",...null!=c&&{data:xe},xAccessor:v,yAccessor:A,colorAccessor:S||void 0,sizeAccessor:k,sizeRange:w,pointStyle:Pe,colorScheme:C,size:[se,le],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ke.margin,showAxes:s.showAxes,xLabel:be,yLabel:ve,xFormat:u,yFormat:p,enableHover:ce,showGrid:he,...ke.legendBehaviorProps,...y({title:me,description:pe,summary:ye,accessibleTable:ge,className:d,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...b({tooltip:B,defaultTooltipContent:Ne}),...f({linkedHover:V,selection:z,onObservation:X,onClick:Q,hoverHighlight:Y,mobileInteraction:ke.mobileInteraction,customHoverBehavior:ke.customHoverBehavior,customClickBehavior:ke.customClickBehavior}),...F&&{marginalGraphics:F},...P&&{pointIdAccessor:P},...Oe&&Oe.length>0&&{annotations:Oe},...D&&{xExtent:D},...T&&{yExtent:T},...ke.crosshairProps,...G};return Qt(te,{componentName:"BubbleChart",width:se,height:le,children:Qt(l,{ref:r,...De})})});Yt.displayName="BubbleChart";import*as Ut from"react";import{useMemo as qt,useCallback as Jt,useState as Kt,useRef as Zt}from"react";import*as eo from"react";import{jsx as to}from"react/jsx-runtime";var oo=null,no=null;function io(e){const[t,o]=eo.useState(()=>oo);return eo.useEffect(()=>{if(t)return;let e=!1;return(oo?Promise.resolve(oo):(no||(no=import("./chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js").then(e=>oo=e.ScatterplotMatrixBrushOverlay).catch(e=>{throw no=null,e})),no)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?to(t,{...e}):null}import{jsx as ro,jsxs as ao}from"react/jsx-runtime";var so="__splomIdx",lo={top:4,bottom:4,left:4,right:4};function co({data:e,xField:t,yField:o,cellSize:n,pointRadius:i,pointOpacity:r,colorBy:a,colorScale:s,brushSelectionName:c,hoverSelectionName:h,unselectedOpacity:d,mobileInteraction:u,mode:m,onPointHover:p,onPointClick:y}){const g=Zt(null),b=X({name:c,clientId:`splom-${t}-${o}`,fields:[t,o]}),v=E({name:c,xField:t,yField:o}),x=X({name:h,clientId:"splom-hover-source",fields:[so]}),A=x.selectPoints,k=Jt(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),S=Jt(e=>{if(!e)return void p?.(null);const t=e.data,o=t?.[so];void 0!==o&&(A({[so]:[o]}),p?.(t,e.x+lo.left,e.y+lo.top))},[A,p]),C=Jt(e=>{if(!e)return void y?.(null);const t=e.data;t&&y?.(t,e.x+lo.left,e.y+lo.top)},[y]),L=Jt(e=>{const t={opacity:r,r:i};return t.fill=a?B(e,a,s):w,"hover"===m?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*i,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*r):b.isActive&&!b.predicate(e)&&(t.opacity=d),t},[r,i,a,m,s,x,b,d]);return ao("div",{style:{position:"relative",width:n,height:n},children:[ro(l,{ref:g,chartType:"scatter",data:e,size:[n,n],xAccessor:t,yAccessor:o,pointStyle:L,margin:lo,showAxes:!1,enableHover:"hover"===m,...f({forceHoverBehavior:"hover"===m,forceClickBehavior:!!y,mobileInteraction:u,customHoverBehavior:S,customClickBehavior:C}),tooltipContent:"hover"===m?()=>null:void 0}),"brush"===m&&ro(io,{frameRef:g,cellSize:n,onBrush:k})]})}function ho({data:e,field:t,label:o,cellSize:n,bins:i,colorBy:r,colorScale:a,brushSelectionName:s,hoverSelectionName:l,mode:c}){const h=X({name:s,clientId:"splom-diag-"+t,fields:[t]}),d=X({name:l,clientId:`splom-diag-${t}-hover`,fields:[so]}),u="hover"===c?d:h,m=u.isActive,p=u.predicate,y=qt(()=>{const o="string"==typeof r?r:null,a=[],s=new Set;for(const n of e){const e=n[t];if(null==e||isNaN(e)||a.push(Number(e)),o){const e=n[o];null!=e&&s.add(e+"")}}if(0===a.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=K(a),h=(c-l)/i||1,d=Array.from(s),u=new Map(d.map((e,t)=>[e,t])),y=Array(i).fill(0),f=Array(i).fill(0),g=Array.from({length:i},()=>Array(d.length).fill(0)),b=Array.from({length:i},()=>Array(d.length).fill(0));for(const n of e){const e=n[t];if(null==e||isNaN(e))continue;const r=Math.min(Math.floor((e-l)/h),i-1);if(y[r]++,m&&!p(n)||f[r]++,o){const e=u.get(n[o]+"");void 0!==e&&(g[r][e]++,m&&!p(n)||b[r][e]++)}}const v=J(y,1),x=g.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/v*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})}),A=b.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/v*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})});return{bars:y.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/v*(n-24),count:e})),selectedBars:f.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/v*(n-24),count:e})),categoryBars:x,selectedCategoryBars:A,max:v,categories:d}},[e,t,i,n,m,p,r]);return ao("svg",{width:n,height:n,style:{overflow:"hidden"},children:[ro("text",{x:n/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,o)=>ro("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):w,opacity:m?.3:.6},`bg-${t}-${o}`))):y.bars.map((e,t)=>ro("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:w,opacity:m?.3:.6},"bg-"+t)),m&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,o)=>ro("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):w,opacity:.7},`sel-${t}-${o}`))):y.selectedBars.map((e,t)=>ro("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:w,opacity:.7},"sel-"+t)))]})}function uo({label:e,cellSize:t}){return ro("svg",{width:t,height:t,children:ro("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function mo(e){const{data:t,fields:o,fieldLabels:n={},colorBy:i,colorScheme:r,cellSize:a=150,cellGap:s=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:h="histogram",histogramBins:d=20,brushMode:u="crossfilter",hoverMode:m=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:f,showLegend:g,idAccessor:b,width:v,className:x,onObservation:A,onClick:k,chartId:S}=e,C="splom",L="splom-hover",_=T(e.mobileInteraction,{mode:e.mode,width:v??o.length*a,mobileSemantics:e.mobileSemantics}),H=m?"hover":u?"brush":"hover",R=Q(e=>e.clearSelection),[I,B]=Kt(null),F=Jt(()=>{R(L),B(null)},[R,L]),P=qt(()=>(t||[]).map((e,t)=>void 0!==e[so]?e:{...e,[so]:t}),[t]),N=V(P,i,r),M=Jt((e,t,o,n)=>[40+e*(a+s)+(o??0),t*(a+s)+(n??0)],[40,a,s]),W=void 0!==g?g:!!i,O=qt(()=>{if(!W||!i)return null;const e="string"==typeof i?i:null;return e?Array.from(new Set(P.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:N?N(e+""):w})):null},[W,i,P,N]),D=qt(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>a+"px").join(" "),gridTemplateRows:o.map(()=>a+"px").join(" ")+" 40px",gap:s+"px",width:"fit-content"}),[o,a,s,40]);return ao("div",{className:x,style:{position:"relative"},children:[O&&ro("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:O.map(e=>ao("div",{style:{display:"flex",alignItems:"center",gap:4},children:[ro("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),ro("span",{style:{fontSize:11},children:e.label})]},e.label))}),ao("div",{style:D,onMouseLeave:"hover"===H?F:void 0,children:[o.map((e,t)=>ao(Ut.Fragment,{children:[ro("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e}),o.map((o,r)=>t===r?"label"===h?ro(uo,{label:n[e]||e,cellSize:a},"diag-"+e):ro(ho,{data:P,field:e,label:n[e]||e,cellSize:a,bins:d,colorBy:i,colorScale:N,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,mode:H},"diag-"+e):ro(co,{data:P,xField:o,yField:e,fieldLabels:n,cellSize:a,pointRadius:l,pointOpacity:c,colorBy:i,colorScale:N,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,showGrid:y,tooltip:f,mobileInteraction:_,mode:H,onPointHover:"hover"===H?(n,i,a)=>{if(n){if(B({datum:n,xField:o,yField:e,colIndex:r,rowIndex:t,px:i??0,py:a??0}),A){const[e,o]=M(r,t,i,a);A({type:"hover",datum:n,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else B(null),A&&A({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:k||A?(e,o,n)=>{if(!e)return;const[i,a]=M(r,t,o,n);k&&k(e,{x:i,y:a}),A&&A({type:"click",datum:e,x:i,y:a,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),ro("div",{})," ",o.map(e=>ro("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e},"col-label-"+e))]}),I&&"hover"===H&&(()=>{const e=I.datum,t=n[I.xField]||I.xField,o=n[I.yField]||I.yField,r=i?"function"==typeof i?i(e):e[i]:null,l=b?"function"==typeof b?b(e):e[b]:"Row "+e[so];return ao("div",{style:{position:"absolute",left:40+I.colIndex*(a+s)+I.px,top:I.rowIndex*(a+s)+I.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[ro("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),ao("div",{children:[t,": ",null!=e[I.xField]?Number(e[I.xField]).toFixed(1):"–"]}),ao("div",{children:[o,": ",null!=e[I.yField]?Number(e[I.yField]).toFixed(1):"–"]}),null!=r&&ao("div",{style:{opacity:.8},children:["string"==typeof i?i:"group",": ",r+""]})]})})()]})}function po(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),ro(L,{selections:n,children:ro(mo,{...e})})}po.displayName="ScatterplotMatrix";import{useState as yo,useRef as fo,useEffect as go,useMemo as bo,useCallback as vo}from"react";import*as xo from"react";import{jsx as Ao}from"react/jsx-runtime";var ko=null,wo=null;function So(e){const[t,o]=xo.useState(()=>ko);return xo.useEffect(()=>{if(t)return;let e=!1;return(ko?Promise.resolve(ko):(wo||(wo=import("./chunk-minimapBrushOverlay-JU57U7NM.module.min.js").then(e=>ko=e.MinimapBrushOverlay).catch(e=>{throw wo=null,e})),wo)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?Ao(t,{...e}):null}import{jsx as Co,jsxs as Lo}from"react/jsx-runtime";function _o(e){const{data:o,width:n=600,height:i=400,margin:r,className:a,title:s,description:c,summary:h,xLabel:d,yLabel:u,xFormat:p,yFormat:y,xAccessor:f="x",yAccessor:b="y",lineBy:v,lineDataAccessor:x="coordinates",colorBy:A,colorScheme:k,curve:S="linear",lineWidth:C=2,fillArea:L=!1,areaOpacity:_=.3,showPoints:H=!1,pointRadius:R=3,enableHover:F=!0,showGrid:P=!1,showLegend:N,legendPosition:M,tooltip:W,minimap:D={},renderBefore:T=!1,onBrush:E,brushExtent:j,yExtent:z,frameProps:$={},loading:X,loadingContent:Q,emptyContent:Y}=e,U=ne(X,n,i,Q),q=U?null:oe(o,n,i,Y),J=bo(()=>I(o),[o]),[K,Z]=yo(null),ie=j??K,re=vo(e=>{j||Z(e),E?.(e)},[j,E]),ae=fo(null),[se,le]=yo(null);go(()=>{let e=0,t=!1;const o=()=>{if(t)return;const n=ae.current?.getScales?.();n?le(n):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[o]);const ce=void 0!==J[0]?.[x],he=bo(()=>{if(ce)return J;if(v){const e=J.reduce((e,t)=>{const o="function"==typeof v?v(t):t[v];if(!e[o]){const t={[x]:[]};"string"==typeof v&&(t[v]=o),e[o]=t}return e[o][x].push(t),e},{});return Object.values(e)}return[{[x]:J}]},[J,v,x,ce]),de=bo(()=>ce||v?he.flatMap(e=>{const t=e[x]||[];return v&&"string"==typeof v?t.map(t=>({...t,[v]:e[v]})):t}):J,[he,x,ce,v,J]),ue=V(J,A,k),me=ze({lineWidth:C,colorBy:A,colorScale:ue,fillArea:L,areaOpacity:_}),pe=bo(()=>{if(D.lineStyle)return D.lineStyle},[D.lineStyle]),ye=ze({lineWidth:1,colorBy:A,colorScale:ue}),fe=pe??ye,ge=bo(()=>{if(H)return e=>{const t={r:R,fillOpacity:1};return t.fill=A?B(e.parentLine||e,A,ue):w,t}},[H,R,A,ue]),{legend:be,margin:ve,legendPosition:xe}=G({data:he,colorBy:A,colorScale:ue,showLegend:N,legendPosition:M,userMargin:r,chartWidth:n,hasTitle:!!s}),Ae=D.height||60,ke=bo(()=>({top:D.margin?.top??0,bottom:D.margin?.bottom??20,left:D.margin?.left??ve.left,right:D.margin?.right??ve.right}),[D.margin,ve]),we=D.brushDirection||"x",Se=bo(()=>g([{label:d||m(f),accessor:f,role:"x",format:p},{label:u||m(b),accessor:b,role:"y",format:y}]),[f,b,d,u,p,y]),Ce=t({componentName:"MinimapChart",data:o,accessors:{xAccessor:f,yAccessor:b}});if(Ce)return Co(ee,{componentName:"MinimapChart",message:Ce,width:n,height:i});const Le=L?"area":"line",_e={chartType:Le,data:de,xAccessor:f,yAccessor:b,groupAccessor:v||void 0,curve:S,lineStyle:me,...H&&{pointStyle:ge},size:[n,i],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,showAxes:!0,xLabel:d,yLabel:u,xFormat:p,yFormat:y,enableHover:F,showGrid:P,...be&&{legend:be,legendPosition:xe},...s&&{title:s},...c&&{description:c},...h&&{summary:h},tooltipContent:!1===W?()=>null:O(W)||Se,...ie&&{xExtent:ie},...z&&{yExtent:z},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...$},He={chartType:Le,data:de,xAccessor:f,yAccessor:b,groupAccessor:v||void 0,curve:S,lineStyle:fe,size:[n,Ae+ke.top+ke.bottom],margin:ke,showAxes:D.showAxes??!1,background:D.background,enableHover:!1,...z&&{yExtent:z}},Re=Lo("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[Co(l,{ref:ae,...He}),Co(So,{width:n-ke.left-ke.right,height:Ae,margin:ke,scales:se,brushDirection:we,extent:ie,onBrush:re})]},"minimap"),Ie=Co("div",{style:{overflow:"hidden"},children:Co(l,{..._e})},"main");return U||q||Co(te,{componentName:"MinimapChart",width:n,height:i,children:Lo("div",{className:"minimap-chart"+(a?" "+a:""),children:[T?Re:Ie,T?Ie:Re]})})}_o.displayName="MinimapChart";import{useMemo as Ho,forwardRef as Ro,useRef as Io}from"react";var Bo={topLeft:{label:"Low / High",color:"#E9C46A",opacity:.08},topRight:{label:"High / High",color:"#2A9D8F",opacity:.08},bottomLeft:{label:"Low / Low",color:"#E76F51",opacity:.08},bottomRight:{label:"High / Low",color:"#86BBD8",opacity:.08}};import{Fragment as Fo,jsx as Po,jsxs as No}from"react/jsx-runtime";function Mo(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Wo=Ro(function(e,o){const n=Io(null);a(o,{variant:"xy",frameRef:n});const r=j(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:d,yFormat:u,xAccessor:p="x",yAccessor:y="y",xCenter:b,yCenter:v,quadrants:A,centerlineStyle:k={},showQuadrantLabels:S=!0,quadrantLabelSize:C=12,colorBy:L,colorScheme:_,styleRules:H,sizeBy:R,sizeRange:B=[3,15],pointRadius:F=5,pointOpacity:P=.8,tooltip:M,pointIdAccessor:W,annotations:D,frameProps:T={},selection:E,linkedHover:G,onObservation:z,onClick:V,hoverHighlight:$,chartId:X,loading:Q,loadingContent:Y,emptyContent:U,legendInteraction:q,legendPosition:J,color:Z,stroke:oe,strokeWidth:ne,opacity:re}=e,{width:ae,height:se,enableHover:le,showGrid:ce,showLegend:he,title:ue,description:me,summary:pe,accessibleTable:ye,xLabel:fe,yLabel:ge}=r,be=Ho(()=>({topLeft:Mo(Bo.topLeft,A?.topLeft),topRight:Mo(Bo.topRight,A?.topRight),bottomLeft:Mo(Bo.bottomLeft,A?.bottomLeft),bottomRight:Mo(Bo.bottomRight,A?.bottomRight)}),[A]),ve=Ho(()=>I(s),[s]),xe=i({data:ve,rawData:s,colorBy:L,colorScheme:_,legendInteraction:q,legendPosition:J,selection:E,linkedHover:G,fallbackFields:"string"==typeof L?[L]:[],unwrapData:!1,onObservation:z,onClick:V,hoverHighlight:$,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"QuadrantChart",chartId:X,showLegend:he,userMargin:c,marginDefaults:r.marginDefaults,loading:Q,loadingContent:Y,emptyContent:U,width:ae,height:se,hasTitle:!!ue});ie("QuadrantChart",ve,"xAccessor",p),ie("QuadrantChart",ve,"yAccessor",y);const Ae=Ho(()=>{if(!ve.length)return;const e="function"==typeof p?p:e=>+e[p],t="function"==typeof y?y:e=>+e[y];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const a of ve){const s=e(a),l=t(a);isFinite(s)&&(o>s&&(o=s),s>n&&(n=s)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=b&&isFinite(b)&&(o>b&&(o=b),b>n&&(n=b)),null!=v&&isFinite(v)&&(i>v&&(i=v),v>r&&(r=v)),o===1/0)return;const a=.1*(n-o)||1,s=.1*(r-i)||1;return{xExtent:[o-a,n+a],yExtent:[i-s,r+s]}},[ve,p,y,b,v]),ke=Ho(()=>{if(!R||0===ve.length)return;const e=ve.map(e=>"function"==typeof R?R(e):e[R]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?K(e):void 0},[ve,R]),we=Ho(()=>"function"==typeof p?p:e=>+e[p],[p]),Se=Ho(()=>"function"==typeof y?y:e=>+e[y],[y]),Ce=Ho(()=>e=>{const t=we(e),o=Se(e),n=null!=b?t>=b:void 0,i=null!=v?o>=v:void 0;return void 0===i||void 0===n?Z||w:i&&n?be.topRight.color:i&&!n?be.topLeft.color:!i&&n?be.bottomRight.color:be.bottomLeft.color},[we,Se,b,v,be,Z]),Le=Ho(()=>R?e=>N(e,R,B,ke):void 0,[R,B,ke]),_e=Ho(()=>x(p,y),[p,y]),He=de({colorBy:L,colorScale:xe.colorScale,color:Z,pointRadius:F,fillOpacity:P,radiusFn:Le,fallbackFill:Ce,stroke:oe,strokeWidth:ne,opacity:re,styleRules:H,ruleContext:_e,effectiveSelectionHook:xe.effectiveSelectionHook,resolvedSelection:xe.resolvedSelection}),Re=Ho(()=>{if(!ve.length)return;const e=new Set;"string"==typeof p&&e.add(p),"string"==typeof y&&e.add(y),"string"==typeof L&&e.add(L),"string"==typeof R&&e.add(R);const t=ve[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ve,p,y,L,R]),Ie=Ho(()=>g([...Re?[{label:Re,accessor:Re,role:"title"}]:[],{label:fe||m(p),accessor:p,role:"x",format:d},{label:ge||m(y),accessor:y,role:"y",format:u},...L?[{label:m(L),accessor:L,role:"color"}]:[],...R?[{label:m(R),accessor:R,role:"size"}]:[]]),[Re,p,y,fe,ge,L,R,d,u]),Be=t({componentName:"QuadrantChart",data:s,accessors:{xAccessor:p,yAccessor:y}}),Fe=Ho(()=>{const e={stroke:k.stroke||"#999",strokeWidth:k.strokeWidth??1,dashArray:k.strokeDasharray||[]};return[(t,o,n,i)=>{if(!n?.x||!n?.y)return;const r=i.width,a=i.height,s=null!=b?n.x(b):r/2,l=null!=v?n.y(v):a/2;if(null!=b&&!isFinite(s))return;if(null!=v&&!isFinite(l))return;const c=Math.max(0,Math.min(r,s)),h=Math.max(0,Math.min(a,l)),d=[{config:be.topLeft,x:0,y:0,w:c,h:h},{config:be.topRight,x:c,y:0,w:r-c,h:h},{config:be.bottomLeft,x:0,y:h,w:c,h:a-h},{config:be.bottomRight,x:c,y:h,w:r-c,h:a-h}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,a),t.stroke(),t.beginPath(),t.moveTo(0,h),t.lineTo(r,h),t.stroke(),t.setLineDash([])}]},[b,v,be,k]),Pe=Ho(()=>S?[...Fe,(e,t,o,n)=>{if(!o?.x||!o?.y)return;const i=n.width,r=n.height,a=null!=b?o.x(b):i/2,s=null!=v?o.y(v):r/2;(null==b||isFinite(a))&&(null==v||isFinite(s))&&(e.font=`600 ${C}px sans-serif`,e.globalAlpha=.5,e.fillStyle=be.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(be.topLeft.label,8,8),e.fillStyle=be.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(be.topRight.label,i-8,8),e.fillStyle=be.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(be.bottomLeft.label,8,r-8),e.fillStyle=be.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(be.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:Fe,[Fe,S,C,be,b,v]),Ne=Ho(()=>{const e=T.canvasPreRenderers||[];return[...Pe,...e]},[Pe,T.canvasPreRenderers]),Me=Ho(()=>{const e={stroke:k.stroke||"#999",strokeWidth:k.strokeWidth??1,dashArray:k.strokeDasharray?Array.isArray(k.strokeDasharray)?k.strokeDasharray.join(","):k.strokeDasharray:void 0};return[(t,o,n)=>{if(!o?.x||!o?.y)return null;const i=n.width,r=n.height,a=null!=b?o.x(b):i/2,s=null!=v?o.y(v):r/2;if(null!=b&&!isFinite(a))return null;if(null!=v&&!isFinite(s))return null;const l=Math.max(0,Math.min(i,a)),c=Math.max(0,Math.min(r,s));return No(Fo,{children:[[{config:be.topLeft,x:0,y:0,w:l,h:c},{config:be.topRight,x:l,y:0,w:i-l,h:c},{config:be.bottomLeft,x:0,y:c,w:l,h:r-c},{config:be.bottomRight,x:l,y:c,w:i-l,h:r-c}].map((e,t)=>e.w>0&&e.h>0?Po("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),Po("line",{x1:l,y1:0,x2:l,y2:r,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),Po("line",{x1:0,y1:c,x2:i,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),S&&No(Fo,{children:[Po("text",{x:8,y:8+C,fill:be.topLeft.color,fontWeight:600,fontSize:C,opacity:.5,children:be.topLeft.label}),Po("text",{x:i-8,y:8+C,fill:be.topRight.color,fontWeight:600,fontSize:C,opacity:.5,textAnchor:"end",children:be.topRight.label}),Po("text",{x:8,y:r-8,fill:be.bottomLeft.color,fontWeight:600,fontSize:C,opacity:.5,children:be.bottomLeft.label}),Po("text",{x:i-8,y:r-8,fill:be.bottomRight.color,fontWeight:600,fontSize:C,opacity:.5,textAnchor:"end",children:be.bottomRight.label})]})]})}]},[b,v,be,k,S,C]);if(xe.earlyReturn)return xe.earlyReturn;const We={chartType:"scatter",...null!=s&&{data:ve},xAccessor:p,yAccessor:y,colorAccessor:L||void 0,sizeAccessor:R||void 0,sizeRange:B,pointStyle:He,colorScheme:_,size:[ae,se],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe.margin,showAxes:r.showAxes,xLabel:fe,yLabel:ge,xFormat:d,yFormat:u,enableHover:le,showGrid:ce,...Ae&&{xExtent:Ae.xExtent,yExtent:Ae.yExtent},...xe.legendBehaviorProps,...ue&&{title:ue},...me&&{description:me},...pe&&{summary:pe},...void 0!==ye&&{accessibleTable:ye},...h&&{className:h},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===M?()=>null:!0===M||void 0===M?Ie:O(M)||Ie,...f({linkedHover:G,selection:E,onObservation:z,onClick:V,hoverHighlight:$,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior}),...W&&{pointIdAccessor:W},...D&&D.length>0&&{annotations:D},canvasPreRenderers:Ne,...xe.crosshairProps,...T,...Ne.length>0&&{canvasPreRenderers:Ne},svgPreRenderers:Me};return Be?Po(ee,{componentName:"QuadrantChart",message:Be,width:ae,height:se}):Po(te,{componentName:"QuadrantChart",width:ae,height:se,children:Po(l,{ref:n,...We})})});Wo.displayName="QuadrantChart";import*as Oo from"react";import{useMemo as Do,useCallback as To,forwardRef as Eo,useRef as Go,useImperativeHandle as jo}from"react";import{jsx as zo}from"react/jsx-runtime";var Vo="__ma_unitized",$o="__ma_series";function Xo(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Qo(e,t){return t[0]+e*(t[1]-t[0])}var Yo=Eo(function(e,o){const n=Go(null),r=Go([]),a=Go(e.series);a.current=e.series,jo(o,()=>{const e=()=>(a.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const o=e(),i=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],a=t.extent||r.current[e];if(!a)continue;const s=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=s&&isFinite(s)&&n.current.push({...i,[Vo]:Xo(s,a),[$o]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const o=e(),i=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const n=o[t],a=n.extent||r.current[t];if(!a)continue;const s=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=s&&isFinite(s)&&i.push({...e,[Vo]:Xo(s,a),[$o]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const s=j(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:c,margin:h,className:d,xFormat:u,xAccessor:m="x",series:p,colorScheme:y,curve:g="monotoneX",lineWidth:b=2,tooltip:v,annotations:x,frameProps:A={},selection:w,linkedHover:C,onObservation:L,onClick:_,hoverHighlight:H,chartId:R,loading:B,loadingContent:F,emptyContent:P,legendInteraction:N,legendPosition:M,stroke:W,strokeWidth:D,opacity:T}=e,{width:E,height:G,enableHover:z,showGrid:V,showLegend:$=!0,title:X,description:Q,summary:U,accessibleTable:q,xLabel:J}=s,K=Do(()=>I(c),[c]),Z=Do(()=>I(p),[p]),ie=Z,re=2===Z.length,ae=Do(()=>re?{...A.legendLayout,sideGutter:A.legendLayout?.sideGutter??70}:A.legendLayout,[A.legendLayout,re]);"undefined"==typeof process||"production"===process.env?.NODE_ENV||re||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${Z.length}. Rendering as a standard multi-line chart.`);const se=ne(B,E,G,F),le=se?null:oe(c,E,G,P),ce=Y(),he=Do(()=>{let e;if(Array.isArray(y))e=y;else if(ce&&ce.length>0)e=ce;else{const t=k[y];e=Array.isArray(t)?t:S}return ie.map((t,o)=>t.color||e[o%e.length])},[ie,y,ce]),de=Do(()=>Z.map((e,t)=>e.label||"Series "+(t+1)),[Z]),{unitizedData:ue,extents:me}=Do(()=>{if(0===K.length){const e=Z.map(e=>e.extent||null).filter(Boolean);return e.length===Z.length&&(r.current=e),{unitizedData:[],extents:e.length===Z.length?e:[]}}const e=Z.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(K,e.yAccessor));if(r.current=e,!re){const t=[];for(const e of K)for(let o=0;Z.length>o;o++){const n=Z[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push({...e,[Vo]:i,[$o]:de[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of K)for(let n=0;2>n;n++){const i=Z[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push({...o,[Vo]:Xo(r,e[n]),[$o]:de[n]})}return{unitizedData:t,extents:e}},[K,Z,re,de]),pe=Do(()=>{if(re&&me.length>=2)return[{orient:"left",label:de[0],tickFormat:Z[0].format||(e=>{const t=Qo(e,me[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:de[1],tickFormat:Z[1].format||(e=>{const t=Qo(e,me[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[re,me,Z,de]),ye=Do(()=>ue.length>0?ue:de.map(e=>({[$o]:e})),[ue,de]),fe=i({data:ye,rawData:c,colorBy:$o,colorScheme:he,legendInteraction:N,legendPosition:M,selection:w,linkedHover:C,fallbackFields:[$o],unwrapData:!1,onObservation:L,onClick:_,hoverHighlight:H,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"MultiAxisLineChart",chartId:R,showLegend:$,legendLayout:ae,userMargin:h,marginDefaults:re?{...s.marginDefaults,left:70,right:70}:s.marginDefaults,loading:B,loadingContent:F,emptyContent:P,width:E,height:G,hasTitle:!!X}),ge=Do(()=>{const e=new Map;return de.forEach((t,o)=>e.set(t,he[o])),e},[de,he]),be=ze({lineWidth:b,resolveStroke:To(e=>ge.get(e[$o])||he[0],[ge,he]),stroke:W,strokeWidth:D,opacity:T,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),ve=Do(()=>{if(!1===v)return()=>null;return O(v)||(e=>{const t=e.data||e,o=t[$o],n=de.indexOf(o),i=t[Vo],r=re&&n>=0&&me[n]?Qo(i,me[n]):i,a=n>=0&&Z[n]?.format?Z[n].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),s="function"==typeof m?m(t):t[m];return Oo.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Oo.createElement("div",{style:{fontWeight:600,marginBottom:4,color:he[n]||"inherit"}},o),Oo.createElement("div",null,`${"string"==typeof m?m:"x"}: ${s}`),Oo.createElement("div",null,`${o}: ${a(r)}`))})},[v,de,he,me,re,Z,m]);if(fe.earlyReturn)return fe.earlyReturn;const xe=t({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:m}}),Ae=re?[0,1]:void 0,ke={chartType:"line",...null!=c&&{data:ue},xAccessor:m,yAccessor:Vo,groupAccessor:$o,lineStyle:be,colorScheme:he,size:[E,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:s.showAxes,...pe&&{axes:pe},xLabel:J,...re?{}:{yLabel:de[0]},xFormat:u,...re&&Ae&&{yExtent:Ae},enableHover:z,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:V,curve:g,...fe.legendBehaviorProps,...X&&{title:X},...Q&&{description:Q},...U&&{summary:U},...void 0!==q&&{accessibleTable:q},...d&&{className:d},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:ve,...x&&{annotations:x},...f({linkedHover:C,selection:w,onObservation:L,onClick:_,hoverHighlight:H,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...fe.crosshairProps,...A,...ae&&{legendLayout:ae}};return se||le||(xe?zo(ee,{componentName:"MultiAxisLineChart",message:xe,width:E,height:G}):zo(te,{componentName:"MultiAxisLineChart",width:E,height:G,children:zo(l,{ref:n,...ke})}))});Yo.displayName="MultiAxisLineChart";import{useMemo as Uo,forwardRef as qo,useRef as Jo}from"react";import{jsx as Ko}from"react/jsx-runtime";var Zo=qo(function(e,o){const i=Jo(null);a(o,{variant:"xy",frameRef:i});const r=j(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:d,yFormat:u,xAccessor:p="x",highAccessor:v="high",lowAccessor:x="low",openAccessor:A,closeAccessor:k,candlestickStyle:w,tooltip:S,annotations:C,xExtent:L,yExtent:_,frameProps:H={},selection:R,linkedHover:B,onObservation:P,onClick:N,chartId:M,loading:W,loadingContent:O,emptyContent:D}=e,{width:T,height:E,enableHover:G,showGrid:V,title:$,description:X,summary:Q,accessibleTable:Y,xLabel:U,yLabel:q}=r,J=ne(W,T,E,O),K=J?null:oe(s,T,E,D),Z=Uo(()=>I(s),[s]),re=null==A||null==k;ie("CandlestickChart",Z,"xAccessor",p),ie("CandlestickChart",Z,"highAccessor",v),ie("CandlestickChart",Z,"lowAccessor",x),re||(ie("CandlestickChart",Z,"openAccessor",A),ie("CandlestickChart",Z,"closeAccessor",k));const{customHoverBehavior:ae,customClickBehavior:se,crosshairSourceId:le}=z({selection:R,linkedHover:B,onObservation:P,onClick:N,chartType:"CandlestickChart",chartId:M,mobileInteraction:r.mobileInteraction}),ce=F(B,le),he=Uo(()=>{const e=r.marginDefaults,t="sparkline"===r.mode?{...e,top:0,bottom:0}:e;return null==c?t:{...t,...n(c)}},[c,r.marginDefaults,r.mode]),de=Uo(()=>{const e=[{label:U||m(p),accessor:p,role:"x",format:d}];return re?(e.push({label:"High",accessor:v,role:"y",format:u}),e.push({label:"Low",accessor:x,format:u})):(e.push({label:"Open",accessor:A,format:u}),e.push({label:"High",accessor:v,format:u}),e.push({label:"Low",accessor:x,format:u}),e.push({label:"Close",accessor:k,format:u})),g(e)},[p,U,d,u,v,x,A,k,re]),ue=t({componentName:"CandlestickChart",data:s,accessors:{xAccessor:p,highAccessor:v,lowAccessor:x,...!re&&{openAccessor:A,closeAccessor:k}}}),me={chartType:"candlestick",...null!=s&&{data:Z},xAccessor:p,yAccessor:v,highAccessor:v,lowAccessor:x,...!re&&{openAccessor:A,closeAccessor:k},...w&&{candlestickStyle:w},scalePadding:Math.max(2,Math.min(12,Math.round(T/40))),extentPadding:T>200?.1:.02,size:[T,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he,showAxes:r.showAxes,xLabel:U,yLabel:q,xFormat:d,yFormat:u,enableHover:G,showGrid:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...y({title:$,description:X,summary:Q,accessibleTable:Y,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...b({tooltip:S,defaultTooltipContent:de}),...f({linkedHover:B,selection:R,onObservation:P,onClick:N,mobileInteraction:r.mobileInteraction,customHoverBehavior:ae,customClickBehavior:se}),...C&&C.length>0&&{annotations:C},...L&&{xExtent:L},..._&&{yExtent:_},...ce,...H};return J||K||(ue?Ko(ee,{componentName:"CandlestickChart",message:ue,width:T,height:E}):Ko(te,{componentName:"CandlestickChart",width:T,height:E,children:Ko(l,{ref:i,...me})}))});Zo.displayName="CandlestickChart";export{He as Scatterplot,Me as ConnectedScatterplot,Xe as LineChart,qe as XYCustomChart,lt as rankBumpData,pt as BumpChart,At as AreaChart,Bt as DifferenceChart,Wt as StackedAreaChart,jt as Heatmap,Yt as BubbleChart,po as ScatterplotMatrix,_o as MinimapChart,Bo as DEFAULT_QUADRANTS,Wo as QuadrantChart,Yo as MultiAxisLineChart,Zo as CandlestickChart};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LayoutCache as t,clamp as e,createSafeDatum as n,datumFromFields as o,dimFor as r,forceLayout as i,generateTokens as a,groupBy as s,layoutTokenGrid as c,makeShade as l,normalizeTokenEncoding as u,readField as d,resolveAccessor as h,signatureKey as f,stableGlyphId as m,unwrapDatum as p}from"./chunk-chunk-2CXCXRB4.module.min.js";import{canUseForceWorker as g,runForceLayoutWorker as y,shouldUseForceWorker as x}from"./chunk-chunk-ZOAQDIJO.module.min.js";import{collidersFromPlotBounds as b,collidersFromXScaleBins as w,sedimentHeightfield as M}from"./chunk-chunk-LPSPATPC.module.min.js";import{mulberry32 as v}from"./chunk-chunk-SIRIJ3DY.module.min.js";import{useCustomLayoutSelection as k}from"./chunk-chunk-C4YA6TDR.module.min.js";import{SYMBOL_SEQUENCE as $,symbolExtent as A,symbolPathString as S}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{isNoteAnnotation as C}from"./chunk-chunk-U66USBWU.module.min.js";var z=t=>{const e=t.config,o=e.rows??10,r=e.columns??10,i=e.gutter??2,a=o*r;if(0>=o||0>=r||0>=a)return{nodes:[]};const{plot:s}=t.dimensions;if(0>=s.width||0>=s.height)return{nodes:[]};const c=(s.width-i*(r-1))/r,l=(s.height-i*(o-1))/o;if(0>=c||0>=l)return{nodes:[]};const u=(null==(d=e.categoryAccessor)?null:"function"==typeof d?d:t=>t[d])??(()=>"_default");var d;const h=function(t){return null==t?null:"function"==typeof t?t:e=>Number(e[t])}(e.valueAccessor)??(()=>1),f=new Map,m=[];for(const e of t.data){const t=u(e)+"",n=Number(h(e)),o=Number.isFinite(n)?Math.max(0,n):0;f.has(t)||m.push(t),f.set(t,(f.get(t)??0)+o)}const p=Array.from(f.values()).reduce((t,e)=>t+e,0);if(0>=p)return{nodes:[]};let g;if(e.categoryOrder&&e.categoryOrder.length>0){const t=new Set,n=[];for(const o of e.categoryOrder)f.has(o)&&!t.has(o)&&(t.add(o),n.push(o));g=[...n,...m.filter(e=>!t.has(e))]}else g=m;if(0===g.length)return{nodes:[]};const y=g.map(t=>({cat:t,exact:(f.get(t)??0)/p*a})).map(t=>({...t,count:Math.floor(t.exact)})),x=y.reduce((t,e)=>t+e.count,0),b=y.map((t,e)=>({i:e,rem:t.exact-t.count})).sort((t,e)=>e.rem-t.rem);for(let t=0;a-x>t;t++)y[b[t%b.length].i].count+=1;const w="string"==typeof e.categoryAccessor?e.categoryAccessor:"category",M="string"==typeof e.valueAccessor?e.valueAccessor:"value",v=(t,e,o)=>n(n=>{n("category",t),n("value",f.get(t)??0),n("share",(f.get(t)??0)/p),"category"!==w&&n(w,t),"value"!==M&&n(M,f.get(t)??0),n("cells",o),n("_waffleCategory",t),n("_waffleIndex",e)}),k=[];let $=0;for(const e of y){const n=t.resolveColor(e.cat);for(let t=0;e.count>t;t++)k.push({type:"rect",x:s.x+$%r*(c+i),y:s.y+(o-1-Math.floor($/r))*(l+i),w:c,h:l,style:{fill:n,stroke:"none"},datum:v(e.cat,$,e.count),group:e.cat,_transitionKey:`waffle-${e.cat}-${t}`}),$++}return{nodes:k}};function N(t,e,n){const o=Math.max(0,Math.floor(n?.minPerCategory??0)),r=t.reduce((t,e)=>t+Math.max(0,e.weight),0);if(0>=e||0>=r)return t.map(t=>({...t,exact:0,cells:0,remainder:0}));const i=t.map(t=>{const n=Math.max(0,t.weight)/r*e;return{...t,exact:n,cells:Math.max(o,Math.floor(n)),remainder:n-Math.floor(n)}});let a=i.reduce((t,e)=>t+e.cells,0);for(;a>e;){const t=i.filter(t=>t.cells>o).sort((t,e)=>e.cells-t.cells||t.remainder-e.remainder||t.key.localeCompare(e.key))[0];if(!t)break;t.cells--,a--}const s=[...i].sort((t,e)=>e.remainder-t.remainder||e.weight-t.weight||t.key.localeCompare(e.key));for(let t=0;e>a;t++)s[t%s.length].cells++,a++;return i}var L="#334155",I="#f8fafc",W="#cbd5e1",F={viewBox:[40,40],anchor:[.5,1],parts:[{d:"M8 3h24v34H8z",fill:"color"},{d:"M12 9h16v5H12zM12 18h16v5H12zM12 27h16v5H12z",fill:"accent"},{d:"M23.8 11.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 20.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 29.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0",fill:"color"}]},T={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M10 8h20a2 2 0 0 1 2 2v20a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z",fill:"color"},{d:"M15 15h10v10H15z",fill:"accent"},{d:"M7 2v6M14 2v6M21 2v6M28 2v6M7 32v6M14 32v6M21 32v6M28 32v6M2 7h6M2 14h6M2 21h6M2 28h6M32 7h6M32 14h6M32 21h6M32 28h6",fill:"none",stroke:"color",strokeWidth:3}]},E={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M23 1L7 23h10l-3 16 19-25H22z",fill:"color"}]},j={viewBox:[48,40],anchor:[.5,.78],parts:[{d:"M7 12c0-4 3-7 7-7h20c4 0 7 3 7 7v15H7z",fill:"color"},{d:"M11 15h26v8H11z",fill:"accent",opacity:.9},{d:"M12 27h7v4h-7zM29 27h7v4h-7z",fill:"accent",opacity:.95},{d:"M12 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0M28 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0",fill:"color",stroke:"accent",strokeWidth:1.8},{d:"M5 13h4v8H5zM39 13h4v8h-4z",fill:"color"}]},R="M 9.12,3.34 C 8.28,3.29 7.44,3.40 6.64,3.69 4.17,3.63 1.97,5.37 0.91,7.51 -1.32,11.80 2.55,17.76 8.19,16.55 11.62,16.13 15.55,14.04 16.17,10.33 16.38,6.53 12.77,3.52 9.12,3.34 Z M 9.35,19.86 C 8.89,19.84 8.41,19.92 7.92,20.11 5.12,21.55 3.72,24.68 2.79,27.54 2.32,29.86 0.87,32.04 1.36,34.49 1.63,37.60 8.04,38.95 8.04,38.95 8.04,38.95 14.67,39.65 16.50,36.33 17.16,31.95 16.34,27.23 14.01,23.42 13.07,21.69 11.36,19.92 9.35,19.86 Z",O={viewBox:[18,40],anchor:[.5,1],parts:[{d:R,fill:"color",stroke:"color",strokeWidth:1.4}]},P={server:F,chip:T,bolt:E,bus:j,person:O},D="var(--semiotic-primary, #4e79a7)",B="var(--semiotic-border, #d1d5db)";function H(t){return"object"==typeof t&&null!==t&&"tokens"in t&&"encoding"in t}function Y(t,e,n){return"function"==typeof t?t(e)??n:t??n}function G(t,e){return"function"==typeof t?t(e):t}function q(t){return t.sample??t.value??t.index}var X=new Set($);function V(t,e){return void 0!==e.datum?Y(e.datum,t,null):t.datum??null}function _(t,e){return{fill:!1!==t.highlighted?"scenario"===t.range?Y(e.rangeColor,t,"var(--semiotic-secondary, #9ca3af)"):Y(e.color,t,D):Y(e.inactiveColor,t,B),stroke:"none",...G(e.style,t)??{}}}function K(t,e){const n=G(e.pointId,t)??(e.idPrefix?`${e.idPrefix}-${"scenario"===t.range?"range-":""}${t.index}`:void 0);return{datum:V(t,e),accessibleDatum:G(e.accessibleDatum,t),accessibility:G(e.accessibility,t),pointId:n,_transitionKey:n}}function U({input:t,encoding:e,options:n={}}){if(!H(t)&&!e)throw Error("tokenLayer requires an encoding when input is not a TokenSet.");const o=H(t)?{...t,encoding:u(t.encoding)}:a(t,e),r=function(t,e){const n=e.includeRange&&t.rangeTokens?[...t.tokens,...t.rangeTokens]:t.tokens;if(e.positionToken)return function(t,e){const n=e.positionToken;return n?t.map((e,o)=>{const r=n(e,o,t);return{...e,x:r.x,y:r.y,row:r.row??o,column:r.column??0}}):[]}(n,e);const o=e.layout??t.encoding.layout??"grid";if("quantile-strip"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),i=e.gutter??2,a=Math.max(1,Math.floor(e.rows??1)),s=t.map(q),c=Math.min(...s),l=Math.max(...s)-c||1;return t.map((s,u)=>{const d=q(s),h=u%a,f=e.valueToX?e.valueToX(d,s):n+(d-c)/l*(e.width??12*Math.max(1,t.length-1)),m=e.valueToY?e.valueToY(d,s):o+h*(r+i);return{...s,x:f,y:m,row:h,column:u}})}(n,e);if("dotplot"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r="number"==typeof e.tokenSize?e.tokenSize:12,i=e.gutter??2,a=e.cellWidth??r+i,s=e.cellHeight??r+i,c=t.map(q),l=Math.min(...c),u=Math.max(...c)-l||1,d=new Map;return t.map(r=>{const i=q(r),c=e.valueToX?e.valueToX(i,r):n+(i-l)/u*(e.width??Math.max(1,t.length-1)*a),h=Math.round((c-n)/Math.max(1,a)),f=d.get(h)??0;d.set(h,f+1);const m=e.valueToY?e.valueToY(i,r):o+f*s;return{...r,x:n+h*a,y:m,row:f,column:h}})}(n,e);if("bar-segment"===o){if(!e.valueToX)throw Error('tokenLayer layout "bar-segment" requires valueToX and optionally valueToY.');return function(t,e){if(!e.valueToX)return[];const n=e.y??0,o=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),r=e.anchor??[.5,.5];return t.map((t,i)=>{const a=Number.isFinite(t.start)?t.start:q(t),s=(a+(Number.isFinite(t.end)?t.end:a+t.value))/2,c=e.valueToY?e.valueToY(s,t):n+r[1]*o;return{...t,x:e.valueToX(s,t),y:c,row:0,column:i}})}(n,e)}if("beeswarm"===o||"small-multiple"===o)throw Error(`tokenLayer layout "${o}" is not implemented yet; use row, column, stack, grid, waffle, dotplot, quantile-strip, bar-segment with valueToX, or positionToken.`);const r="number"==typeof e.tokenSize?e.tokenSize:void 0,i=e.cellWidth??r??12,a=e.cellHeight??r??i,s="row"===o?Math.max(1,n.length):"column"===o||"stack"===o?1:"waffle"===o&&"fixed-denominator"===t.encoding.countStrategy&&100===t.denominator?10:function(t,e,n){if(e.columns)return e.columns;if(e.width&&n>0){const t=e.gutter??2;return Math.max(1,Math.floor((e.width+t)/(n+t)))}return t.length>0?Math.ceil(Math.sqrt(t.length)):1}(n,e,i);return c(n,{...e,columns:s,cellWidth:i,cellHeight:a})}(o,n).filter(t=>!n.include||n.include(t));return{tokenSet:o,positionedTokens:r,nodes:r.map(t=>function(t,e,n){if("dot"===n.tokenType)return function(t,e){const n=Y(e.tokenSize,t,12);return{type:"point",x:t.x,y:t.y,r:Y(e.radius,t,n/2),style:_(t,e),...K(t,e)}}(t,e);const o=G(e.glyph,t)??function(t){if(t)return P[t]}(n.icon);if(o)return function(t,e,n){const o=_(t,n),r=Y(n.tokenSize,t,12);return{type:"glyph",x:t.x,y:t.y,size:r,glyph:e,color:(o.fill??D)+"",accent:Y(n.accent,t,"var(--semiotic-bg, #ffffff)"),fraction:1>t.fraction?t.fraction:void 0,fractionStart:t.startFraction>0?t.startFraction:void 0,fractionDirection:Y(n.fractionDirection,t,"horizontal"),ghostColor:1>t.fraction?G(n.ghostColor,t)??B:void 0,rotation:G(n.rotation,t),style:o,...K(t,n)}}(t,o,e);const r=(i=n.icon)&&X.has(i)?i:void 0;var i;return function(t,e){const n=Y(e.tokenSize,t,12);return{type:"symbol",x:t.x,y:t.y,size:Math.PI*Math.max(1,n/2)**2,symbolType:Y(e.symbolType,t,"circle"),path:G(e.symbolPath,t),rotation:G(e.rotation,t),style:_(t,e),...K(t,e)}}(t,r&&null==e.symbolType?{...e,symbolType:r}:e)}(t,n,o.encoding))}}import{interpolateRgb as Z}from"d3-interpolate";var Q=864e5,J=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height)return{nodes:[]};const o=t=>{const n="function"==typeof e.dateAccessor?e.dateAccessor(t):t[e.dateAccessor];return n instanceof Date?n:new Date(n)},r=t=>{const n="function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor];return Number(n)},i=new Map;let a=null;for(const e of t.data){const t=o(e);if(!isFinite(t.getTime()))continue;null==a&&(a=t.getUTCFullYear());const n=tt(t),s=r(e);i.set(n,(i.get(n)??0)+(Number.isFinite(s)?s:0))}const s=e.year??a??(new Date).getUTCFullYear();let c=1/0,l=-1/0;for(const t of i.values())c>t&&(c=t),t>l&&(l=t);c===1/0&&(c=0,l=0);const[u,d]=e.colorRamp??[t.theme.semantic.surface??"#ebedf0",t.theme.semantic.primary??"#216e39"],h=t=>{if(l===c)return u;const e=(t-c)/(l-c);return Z(u,d)(e)},f=e.gutter??2,m=e.labelInset??0,p=Math.min((n.width-m-53*f)/54,(n.height-6*f)/7);if(0>=p)return{nodes:[]};const g=new Date(Date.UTC(s,0,1)),y=g.getUTCDay(),x=new Date(g.getTime()-y*Q),b=[];for(let t=0;54>t;t++)for(let e=0;7>e;e++){const o=new Date(x.getTime()+(7*t+e)*Q);if(o.getUTCFullYear()!==s)continue;const r=tt(o),a=i.get(r),c=null==a?u:h(a);b.push({type:"rect",x:n.x+m+t*(p+f),y:n.y+e*(p+f),w:p,h:p,style:{fill:c,stroke:"none"},datum:{date:o,value:a??0}})}return{nodes:b}};function tt(t){return`${t.getUTCFullYear()}-${et(t.getUTCMonth()+1)}-${et(t.getUTCDate())}`}function et(t){return 10>t?"0"+t:t+""}import{jsx as nt,jsxs as ot}from"react/jsx-runtime";var rt={resource:32,city:64},it=["#739b58","#83a964","#668d52","#8baa68"],at={land:"#78985c",ocean:"#4d8192",forest:"#4f7c4b",grassland:"#8eaa68",cropland:"#a6a568",wetland:"#668f79",urban:"#8d8a72",scrub:"#9b9665",bare:"#aa906a",snow:"#d8ddcf"},st={land:"Open land",ocean:"Open ocean",forest:"Forest",grassland:"Grassland",cropland:"Cropland",wetland:"Wetland",urban:"Urban district",scrub:"Scrubland",bare:"Bare ground",snow:"Snow cover"},ct=new Set(["city","culture","monument","faith","nature","knowledge","defense","arena","transport"]);function lt(t,e){if("function"==typeof t)return t;const n=t??e;return t=>t[n]}function ut(t,e,n){return[111.32*(t-n.lon)*Math.cos((e+n.lat)/2*(Math.PI/180)),110.574*(e-n.lat)]}function dt(t){const e=Math.max(3,Math.round(t??5));return e%2==0?e+1:e}function ht(t){return ct.has(t)?t:"monument"}function ft(t,e){const n=dt(e.gridSize),o=Math.max(1,e.gridRadiusKm??75),r=2*o/n,i=Math.floor(n/2),a=lt(e.idAccessor,"id"),s=lt(e.nameAccessor,"name"),c=lt(e.longitudeAccessor,"lon"),l=lt(e.latitudeAccessor,"lat"),u=lt(e.kindAccessor,"kind"),d=e.candidatePriorityAccessor?lt(e.candidatePriorityAccessor,"priority"):()=>0,h=new Map;let f=null;for(const m of t){const t=Number(c(m)),p=Number(l(m));if(!Number.isFinite(t)||!Number.isFinite(p))continue;const g=(a(m)??`${t},${p}`)+"",y=(s(m)??g)+"",x=ht(u(m)),[b,w]=ut(t,p,e.center);if(Math.abs(b)>o||Math.abs(w)>o)continue;const M=Math.min(n-1,Math.max(0,Math.floor((b+o)/r))),v=Math.min(n-1,Math.max(0,Math.floor((o-w)/r))),k=(M+.5)*r-o,$=o-(v+.5)*r,A={...m,id:g,name:y,kind:x,lon:t,lat:p,distanceKm:Math.sqrt(b*b+w*w),row:v,column:M,cellDistanceSq:(b-k)**2+(w-$)**2,candidatePriority:Number(d(m))||0};(null!=e.centerId&&g===e.centerId||!f&&"city"===x||!f&&v===i&&M===i)&&(f=A);const S=`${v}:${M}`,C=h.get(S)??[];C.push(A),h.set(S,C)}const m=new Map;f&&m.set("city",1);const p=[];for(let t=0;n>t;t++)for(let e=0;n>e;e++){const n=`tile-${t}-${e}`,a=(e+.5)*r-o,s=o-(t+.5)*r;let c,l;if(t===i&&e===i&&f){c=f;const n=(h.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id).sort((t,e)=>t.candidatePriority-e.candidatePriority||t.cellDistanceSq-e.cellDistanceSq||t.name.localeCompare(e.name));l=[f,...n]}else{const n=(h.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id);n.sort((t,e)=>{const n=t.candidatePriority-e.candidatePriority;if(0!==n)return n;const o=m.get(t.kind)??0,i=m.get(e.kind)??0,a=r*r*.35;return t.cellDistanceSq+o*a-(e.cellDistanceSq+i*a)||t.name.localeCompare(e.name)}),c=n[0]??null,l=n}c&&m.set(c.kind,(m.get(c.kind)??0)+1),p.push({id:n,row:t,column:e,centerXKm:a,centerYKm:s,terrainIndex:Math.abs((17*t+31*e)%it.length),landmark:c,landmarks:l})}return p}var mt=t=>{const e=dt(t.config.gridSize),n=Math.max(20,t.config.tileWidth??80),o=Math.max(10,t.config.tileHeight??40),r=t.config.terrainColors?.length?t.config.terrainColors:it,i=t.dimensions.width/2,a=(t.dimensions.height-e*o)/2+o/2,s=ft(t.points,t.config).map(t=>({...t,x:i+n/2*(t.column-t.row),y:a+(t.column+t.row)*(o/2)}));return{nodes:s.map(e=>{const i=t.config.terrainByCell?.[e.id],a="string"==typeof i?{kind:i}:i,s="city"===e.landmark?.kind?"urban":a?.kind??"land",c=a?.fill??t.config.terrainPalette?.[s]??at[s],l=e.landmark?{...e.landmark,gridRow:e.row,gridColumn:e.column,cellId:e.id,terrainKind:s,terrainCoverage:a?.coverage,features:e.landmarks,featureCount:e.landmarks.length}:{id:e.id,name:st[s],kind:"terrain",terrainKind:s,terrainCoverage:a?.coverage,gridRow:e.row,gridColumn:e.column,cellId:e.id,features:[],featureCount:0};return{type:"geoarea",pathData:(u=e.x,d=e.y,h=n,f=o,`M${u},${d-f/2}L${u+h/2},${d}L${u},${d+f/2}L${u-h/2},${d}Z`),centroid:[e.x,e.y],bounds:[[e.x-n/2,e.y-o/2],[e.x+n/2,e.y+o/2]],screenArea:n*o/2,style:{fill:a||"urban"===s?c:r[e.terrainIndex%r.length],stroke:"ocean"===s?"#315d6c":t.config.tileStroke??"#314934",strokeWidth:1},datum:l,group:e.landmark?.kind??s,interactive:!0};var u,d,h,f}),overlays:nt(pt,{tiles:s,tileWidth:n,tileHeight:o,sprites:t.config.sprites,resourceSize:t.config.resourceSpriteSize??32,citySize:t.config.citySpriteSize??64,showCityLabel:!1!==t.config.showCityLabel}),restyle:(t,e)=>e?.isActive&&t.datum&&"terrain"!==t.datum.kind?{fillOpacity:e.predicate(t.datum)?1:.28}:{fillOpacity:1}}};function pt({tiles:t,tileWidth:e,tileHeight:n,sprites:o,resourceSize:r,citySize:i,showCityLabel:a}){const s=k(),c=t.filter(t=>t.landmark).sort((t,e)=>t.y-e.y||t.x-e.x);return ot("g",{"aria-hidden":"true",pointerEvents:"none",children:[c.map(t=>{const a=t.landmark,c="city"===a.kind?i:r,l=t.y+n/2,u=s.isActive&&!s.predicate(a)?.28:1;return ot("g",{opacity:u,children:[nt("ellipse",{cx:t.x,cy:t.y+.15*n,rx:.28*c,ry:.1*c,fill:"#17251d",opacity:.32}),nt(bt,{kind:a.kind,href:o?.[a.kind],x:t.x-c/2,y:l-c,size:c}),t.landmarks.length>1&&nt(gt,{x:t.x+.3*e,y:t.y-.19*n,count:t.landmarks.length-1,tileHeight:n})]},a.id)}),a&&c.filter(t=>"city"===t.landmark?.kind).map(t=>{const e=t.landmark.name.toUpperCase(),o=Math.max(56,6.4*e.length+14);return ot("g",{transform:`translate(${t.x},${t.y+.72*n})`,children:[nt("rect",{x:-o/2,y:-7,width:o,height:14,rx:1,fill:"#17251d",opacity:.92}),nt("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:9,fontWeight:700,letterSpacing:.8,children:e})]},t.landmark.id+"-label")})]})}function gt({x:t,y:e,count:n,tileHeight:o}){const r=Math.max(10,Math.min(15,.34*o)),i="+"+n,a=Math.max(r,i.length*r*.58);return ot("g",{transform:`translate(${t},${e})`,children:[nt("rect",{x:-a/2,y:-r/2,width:a,height:r,rx:1,fill:"#17251d",stroke:"#f0d36d",strokeWidth:1}),nt("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:Math.max(7,.62*r),fontWeight:700,children:i})]})}var yt={city:["..1111..","..1221..",".111111.",".133331.","11111111","13311331","14411441","11111111"],culture:["..1111..",".122221.","11111111",".133331.",".133331.",".133331.","11111111",".444444."],monument:["...11...","..1221..","..1221..","..1331..",".113311.",".133331.","11111111",".444444."],faith:["...11...","...11...","..1111..","...11...","..1221..",".133331.","11111111",".444444."],nature:["...11...","..1221..",".122221.","12222221",".133331.","...11...","..1441..",".144441."],knowledge:[".111111.","12211221","12211221","13311331","13311331","13311331","11111111",".444444."],defense:["11.11.11","11111111","12222221","12211221","13311331","13333331","11111111",".444444."],arena:["..1111..",".122221.","12333321","12344321","12344321","12333321",".122221.","..1111.."],transport:["...11...","..1221..",".122221.","11111111","..1331..","..1331..",".114411.","11444411"]},xt={city:{1:"#29364a",2:"#d8b45b",3:"#b7693c",4:"#6d9fc5"},culture:{1:"#29364a",2:"#d5c9a3",3:"#9c6fb2",4:"#ece3c4"},monument:{1:"#29364a",2:"#d8cba8",3:"#9c8f79",4:"#ece3c4"},faith:{1:"#29364a",2:"#d9c36d",3:"#a877a5",4:"#ece3c4"},nature:{1:"#29364a",2:"#4f8a4e",3:"#79aa56",4:"#79583a"},knowledge:{1:"#29364a",2:"#d5c9a3",3:"#4f7da0",4:"#ece3c4"},defense:{1:"#29364a",2:"#a6a298",3:"#777b7f",4:"#d5c9a3"},arena:{1:"#29364a",2:"#cb8056",3:"#d8cba8",4:"#6d9fc5"},transport:{1:"#29364a",2:"#d8b45b",3:"#6d9fc5",4:"#ece3c4"}};function bt({kind:t,href:e,x:n,y:o,size:r}){if(e)return nt("image",{href:e,x:n,y:o,width:r,height:r,preserveAspectRatio:"xMidYMax meet",style:{imageRendering:"pixelated"}});const i=xt[t];return nt("svg",{x:n,y:o,width:r,height:r,viewBox:"0 0 8 8",shapeRendering:"crispEdges",children:yt[t].flatMap((t,e)=>[...t].map((t,n)=>"."===t?null:nt("rect",{x:n,y:e,width:1,height:1,fill:i[t]},`${e}-${n}`)))})}var wt=t=>{const e=t.config,n=e.nodeWidth??80,o=e.nodeHeight??30,r=e.orientation??"vertical",i=e.edgeCurve??"curved",a=!1!==e.showLabels,s=e.labelAccessor??"id",c="function"==typeof s?s:t=>d(t,s,t.id??"")+"",l=new Map,u=[],h=[],f=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??n,h:("number"==typeof e.height?e.height:t.height)??o}};for(const n of t.nodes){const{x:o,y:r,w:i,h:s}=f(n);null!=o&&null!=r&&(l.set(n.id,{x:o,y:r,w:i,h:s}),u.push({type:"rect",x:o-i/2,y:r-s/2,w:i,h:s,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-surface, ${t.theme.semantic.surface??"#fff"})`,strokeWidth:1.5},datum:n,id:n.id,label:c(n)+""}),a&&h.push({x:o,y:r,text:c(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const m=[];for(const e of t.edges){const n="string"==typeof e.target?e.target:e.target.id,o=l.get("string"==typeof e.source?e.source:e.source.id),a=l.get(n);if(!o||!a)continue;const s="vertical"===r?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},c="vertical"===r?{x:a.x,y:a.y-a.h/2}:{x:a.x-a.w/2,y:a.y};if("line"===i)m.push({type:"line",x1:s.x,y1:s.y,x2:c.x,y2:c.y,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1},datum:e});else{const n=(s.y+c.y)/2,o=(s.x+c.x)/2;m.push({type:"curved",pathD:"vertical"===r?`M${s.x},${s.y} C${s.x},${n} ${c.x},${n} ${c.x},${c.y}`:`M${s.x},${s.y} C${o},${s.y} ${o},${c.y} ${c.x},${c.y}`,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1,fill:"none"},datum:e})}}return{sceneNodes:u,sceneEdges:m,labels:h}},Mt=t=>{const e=t.config,n=e.nodeWidth??100,o=e.nodeHeight??36,r=e.edgeStyle??"polyline",i=!1!==e.showLabels,a=e.labelAccessor??"label",s="function"==typeof a?a:t=>d(t,a,t.id??"")+"",c=new Map,l=[],u=[],h=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??n,h:("number"==typeof e.height?e.height:t.height)??o}};for(const n of t.nodes){const{x:o,y:r,w:a,h:d}=h(n);null!=o&&null!=r&&(c.set(n.id,{x:o,y:r,w:a,h:d}),l.push({type:"rect",x:o-a/2,y:r-d/2,w:a,h:d,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#888"})`,strokeWidth:1.5},datum:n,id:n.id,label:s(n)+""}),i&&u.push({x:o,y:r,text:s(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const f=e.edgeStroke??`var(--semiotic-border, ${t.theme.semantic.border??"#666"})`,m=[];for(const e of t.edges){const t="string"==typeof e.target?e.target:e.target.id,n=c.get("string"==typeof e.source?e.source:e.source.id),o=c.get(t);if(!n||!o)continue;const i=e.data??{},a=Array.isArray(i.points)?i.points:e.points;if(a&&a.length>=2)if("smooth"!==r||3>a.length){const t="M"+a.map(t=>`${t.x},${t.y}`).join(" L ");m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else{let t=`M${a[0].x},${a[0].y}`;for(let e=1;a.length-1>e;e++)t+=` Q${a[e].x},${a[e].y} ${(a[e].x+a[e+1].x)/2},${(a[e].y+a[e+1].y)/2}`;const n=a[a.length-1];t+=` T${n.x},${n.y}`,m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else m.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:f,strokeWidth:1},datum:e})}return{sceneNodes:l,sceneEdges:m,labels:u}};import{jsx as vt,jsxs as kt}from"react/jsx-runtime";var $t={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},At={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function St(t){return Array.isArray(t)?t.map((t,e)=>"string"==typeof t?{storeName:t,slotIndex:e}:{storeName:(t.storeName??"")+"",slotIndex:t.slotIndex??e}):[]}var Ct=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.layerAccessor??"x",r=e.rowAccessor??"y",i=e.partitionAccessor??"partition",a=e.semanticAccessor??"semantic",s=e.labelAccessor??"label",c=e.storesAccessor??"stores",l=e.backEdgeAccessor??"isBackEdge",u=e.edgeTypeAccessor??"edgeType",h={...$t,...e.partitionColors},f={...At,...e.edgeColors},m=e.accentColor??"var(--semiotic-focus, #ffcc33)",p=e.borderColor??"var(--semiotic-border, #555)",g=e.dimOpacity??.14,y=e.edgeOpacity??.5,x=e.edgeWidth??1.25,b=e.backEdgeWidth??e.edgeWidth??1.5,w=!1!==e.showStoreChips,M=e.storeChipColor??"var(--semiotic-info, #6a8caf)";let v=e.layerCount,k=e.maxLayerSize;if(null==v||null==k){let e=0;const n=new Map;for(const r of t.nodes){const t=Math.round(Number(d(r,o,0)));e=Math.max(e,t),n.set(t,(n.get(t)??0)+1)}v=v??e+1,k=k??Math.max(1,...n.values())}const $=n.width/Math.max(1,v),A=n.height/Math.max(1,k);let S=Math.min(e.nodeWidth??172,Math.max(8,$-(e.minGapX??26))),C=Math.min(e.nodeHeight??54,Math.max(8,A-(e.minGapY??18)));const z=e.lod&&"auto"!==e.lod?e.lod:16>S?"dot":48>S?"icon":108>S?"compact":"full";if("dot"===z){const t=Math.min(S,C,11);S=t,C=t}const N=Math.max(1,n.width-S),L=Math.max(1,n.height-C),I=Math.max(1,k-1),W=t=>n.x+S/2+(v>1?t/(v-1):.5)*N,F=t=>n.y+C/2+(t+I/2)/I*L,T=e.reachableIds?new Set(e.reachableIds):null,E=e.selectedId??null,j=t.selection,R=new Map,O=new Map,P=[],D=[];for(const e of t.nodes){const t=e.id,n=Number(d(e,o,0)),l=Number(d(e,r,0)),u=d(e,i,"processor")+"",f=d(e,a,"processor")+"",y=d(e,s,t)+"",x=St(d(e,c,[])),b=e.data??e,w=W(n),M=F(l);R.set(t,{cx:w,cy:M});const v=T?T.has(t):null,k=j?.isActive?j.predicate(b):null,$=null!==v?!v:null!==k&&!k;O.set(t,$);const A=null!=E&&t===E,N=$&&!A?g:1,L=h[u]??h.unknown;"dot"===z?P.push({type:"circle",cx:w,cy:M,r:S/2,style:{fill:L,opacity:N,stroke:A?m:"transparent",strokeWidth:A?2:0},datum:e,id:t,label:y}):(P.push({type:"rect",x:w-S/2,y:M-C/2,w:S,h:C,style:{fill:L,opacity:N,stroke:A?m:p,strokeWidth:A?3:1},datum:e,id:t,label:y}),D.push({id:t,cx:w,cy:M,partition:u,semantic:f,label:y,stores:x,opacity:N,selected:A,node:b}))}const B=[];for(const e of t.edges){const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=R.get(t),r=R.get(n);if(!o||!r)continue;const i=!!d(e,l,!1),a=d(e,u,"internal")+"",s=O.get(t)||O.get(n)?Math.min(y,1.4*g):y,c=i?f.back:f[a]??f.internal;let h;if(i){const t=o.cx,e=o.cy+C/2,n=r.cx,i=r.cy+C/2,a=Math.max(48,.28*Math.abs(t-n))+C;h=`M${t},${e} C${t},${e+a} ${n},${i+a} ${n},${i}`}else{const t=o.cx+S/2,e=o.cy,n=r.cx-S/2,i=r.cy,a=(t+n)/2;h=`M${t},${e} C${a},${e} ${a},${i} ${n},${i}`}const m={type:"curved",pathD:h,style:{stroke:c,strokeWidth:i?b:x,fill:"none",opacity:s,...i?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}},datum:e};B.push(m)}const H=0===D.length?null:vt("g",{className:"lineage-dag-glyphs",children:D.map(t=>function(t,e){const{w:n,h:o,lod:r}=e,i="icon"===r?Math.min(n,o):Math.min(o-14,26),a="icon"===r?0:8+i+8,s=null!=e.renderIcon?e.renderIcon({semantic:t.semantic,partition:t.partition,size:i,color:e.partColors[t.partition]??e.partColors.unknown??"#5a5a6a",node:t.node}):function(t,e,n){const o=e.startsWith("topic")?"T":{source:"SR",sink:"SK",filter:"FL",map:"MP",aggregate:"AG",reduce:"RD","join-this":"JN","join-other":"JN",merge:"MG",suppress:"SP",select:"SE",tostream:"TS"}[t]??"PR";return kt("g",{children:[vt("rect",{width:n,height:n,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),vt("text",{x:n/2,y:n/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*n,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:o})]})}(t.semantic,t.partition,i),c="full"===r,l="icon"!==r,u="full"===r&&e.showChips&&t.stores.length>0;return kt("g",{transform:`translate(${t.cx-n/2}, ${t.cy-o/2})`,opacity:t.opacity,style:{pointerEvents:"none"},children:[vt("g",{transform:`translate(${"icon"===r?(n-i)/2:8}, ${(o-i)/2})`,children:s}),l&&vt("foreignObject",{x:a,y:c?o/2-12:o/2-9,width:Math.max(8,n-a-8),height:18,style:{pointerEvents:"none"},children:vt("div",{title:t.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===r?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})}),c&&vt("text",{x:a,y:o/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:e.typeLabel?e.typeLabel({semantic:t.semantic,partition:t.partition,node:t.node}):t.partition.startsWith("topic")?"topic":t.semantic}),u&&t.stores.map((t,n)=>vt("rect",{x:a+15*n,y:o-10,width:12,height:5,rx:1.5,fill:e.chipColor,children:vt("title",{children:t.storeName})},t.storeName+n))]},t.id)}(t,{w:S,h:C,lod:z,partColors:h,chipColor:M,showChips:w,renderIcon:e.renderIcon,typeLabel:e.typeLabel}))});return{sceneNodes:P,sceneEdges:B,overlays:H}};import{jsx as zt,jsxs as Nt}from"react/jsx-runtime";function Lt(t,e){return t.length>e?t.slice(0,Math.max(1,e-1))+"…":t}var It={rect:"process",round:"process",stadium:"terminal",subroutine:"subprocess",cylinder:"database",circle:"connector",diamond:"decision",hexagon:"preparation",flag:"process"};function Wt(t,e,n,o,r,i,a,s){const c=e-o/2,l=n-r/2,u={fill:i,stroke:a,strokeWidth:s};switch(t){case"diamond":return zt("polygon",{points:`${e},${l} ${e+o/2},${n} ${e},${n+r/2} ${c},${n}`,...u});case"circle":return zt("circle",{cx:e,cy:n,r:Math.min(o,r)/2,...u});case"stadium":case"round":return zt("rect",{x:c,y:l,width:o,height:r,rx:"stadium"===t?r/2:8,ry:"stadium"===t?r/2:8,...u});case"hexagon":{const t=Math.min(.18*o,16);return zt("polygon",{points:`${c+t},${l} ${e+o/2-t},${l} ${e+o/2},${n} ${e+o/2-t},${n+r/2} ${c+t},${n+r/2} ${c},${n}`,...u})}case"cylinder":{const t=Math.min(.16*r,8),e=`M${c},${l+t} a${o/2},${t} 0 0 1 ${o},0`;return Nt("g",{children:[zt("path",{d:`M${c},${l+t} a${o/2},${t} 0 0 0 ${o},0 v${r-2*t} a${o/2},${t} 0 0 1 ${-o},0 z`,...u}),zt("path",{d:e,fill:"none",stroke:a,strokeWidth:s})]})}case"subroutine":{const t=Math.min(8,.08*o);return Nt("g",{children:[zt("rect",{x:c,y:l,width:o,height:r,rx:3,...u}),zt("line",{x1:c+t,y1:l,x2:c+t,y2:l+r,stroke:a,strokeWidth:s}),zt("line",{x1:c+o-t,y1:l,x2:c+o-t,y2:l+r,stroke:a,strokeWidth:s})]})}default:return zt("rect",{x:c,y:l,width:o,height:r,rx:4,...u})}}var Ft=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.direction??"TD",r="LR"===o||"RL"===o,i="BT"===o||"RL"===o,a=e.layerAccessor??"layer",s=e.rowAccessor??"row",c=e.labelAccessor??"label",l=e.shapeAccessor??"shape",u=e.edgeLabelAccessor??"label",h=e.nodeFill??"var(--semiotic-surface, #20242d)",f=e.nodeStroke??"var(--semiotic-border, #5a6573)",m=e.textColor??"var(--semiotic-text, #e6e6e6)",p=e.edgeColor??"var(--semiotic-text-secondary, #9aa0a6)",g=e.accentColor??"var(--semiotic-warning, #d49a00)";if(0===t.nodes.length)return{sceneNodes:[],overlays:null};const y=new Map;let x=0;for(const e of t.nodes){const t=Math.round(Number(d(e,a,0)));x=Math.max(x,t);const n=y.get(t)||[];n.push(e),y.set(t,n)}const b=x+1;let w=1;for(const t of y.values())t.sort((t,e)=>Number(d(t,s,0))-Number(d(e,s,0))),w=Math.max(w,t.length);const M=r?n.width:n.height,v=r?n.height:n.width,k=M/b,$=v/(w+1),A=Math.max(44,Math.min(e.nodeWidth??150,r?k-36:.92*$)),S=Math.max(26,Math.min(e.nodeHeight??46,r?.7*$:.5*k)),C=(r?A:S)/2+6,z=Math.max(1,M-2*C),N=t=>(r?n.x:n.y)+C+(b>1?(i?b-1-t:t)/(b-1)*z:z/2),L=new Map,I=[],W=[];for(const[t,e]of y)e.forEach((o,i)=>{const a=N(t),s=(r?n.y:n.x)+(i+1)/(e.length+1)*v,u=r?a:s,p=r?s:a,y=d(o,l,"rect")+"",x=d(o,c,o.id)+"";L.set(o.id,{cx:u,cy:p,shape:y}),I.push({type:"rect",x:u-A/2,y:p-S/2,w:A,h:S,style:{fill:"transparent",stroke:"transparent"},datum:{id:o.id,name:x,type:It[y]??"process",shape:y},id:o.id,label:x}),W.push(Nt("g",{children:[Wt(y,u,p,A,S,h,"diamond"===y?g:f,1.5),zt("text",{x:u,y:p,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fill:m,style:{pointerEvents:"none"},children:Lt(x,Math.max(4,Math.floor((A-12)/7)))})]},"n-"+o.id))});const F=[];return t.edges.forEach((t,e)=>{const n="string"==typeof t.target?t.target:t.target.id,o=L.get("string"==typeof t.source?t.source:t.source.id),i=L.get(n);if(!o||!i)return;const a=r?o.cx+A/2:o.cx,s=r?o.cy:o.cy+S/2,c=r?i.cx-A/2:i.cx,l=r?i.cy:i.cy-S/2,h=r?`M${a},${s} C${(a+c)/2},${s} ${(a+c)/2},${l} ${c},${l}`:`M${a},${s} C${a},${(s+l)/2} ${c},${(s+l)/2} ${c},${l}`,g=Math.atan2(l-s,c-a),y=c-9*Math.cos(g),x=l-9*Math.sin(g),b=4.5*-Math.sin(g),w=4.5*Math.cos(g),M=`${c},${l} ${y+b},${x+w} ${y-b},${x-w}`,v=d(t,u,void 0),k=(a+c)/2,$=(s+l)/2;F.push(Nt("g",{children:[zt("path",{d:h,fill:"none",stroke:p,strokeWidth:1.4}),zt("polygon",{points:M,fill:p}),"string"==typeof v&&v.length>0&&Nt("g",{children:[zt("rect",{x:k-6.5*v.length/2-4,y:$-9,width:6.5*v.length+8,height:18,rx:3,fill:"var(--semiotic-bg, #11151c)",stroke:f,strokeWidth:.75}),zt("text",{x:k,y:$,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fill:m,style:{pointerEvents:"none"},children:v})]})]},"e-"+e))}),{sceneNodes:I,overlays:Nt("g",{className:"mermaid-dag",children:[F,W]})}};import{jsx as Tt,jsxs as Et}from"react/jsx-runtime";function jt(t){return Tt("rect",{className:t.className,x:t.x,y:t.y,width:Math.max(0,t.width),height:Math.max(0,t.height),rx:t.radius??10,ry:t.radius??10,fill:t.fill??"none",stroke:t.stroke,strokeWidth:t.strokeWidth??1.5,strokeDasharray:t.strokeDasharray,opacity:t.opacity??.6,style:{pointerEvents:"none"}},t.keyId)}function Rt(t,e=0){let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of t){const t=e.r??0;n>e.x-t&&(n=e.x-t),e.x+t>r&&(r=e.x+t),o>e.y-t&&(o=e.y-t),e.y+t>i&&(i=e.y+t)}return Number.isFinite(n)?{x:n-e,y:o-e,width:r-n+2*e,height:i-o+2*e}:null}function Ot(t,e=0){if(!t.length)return null;const n="number"==typeof e?e:e.x??0,o="number"==typeof e?e:e.y??0;let r=1/0,i=1/0,a=-1/0,s=-1/0;for(const e of t){if(!Number.isFinite(e.x)||!Number.isFinite(e.y))continue;if(!Number.isFinite(e.width)||!Number.isFinite(e.height))continue;const t=Math.max(0,e.width),n=Math.max(0,e.height);r>e.x&&(r=e.x),i>e.y&&(i=e.y),e.x+t>a&&(a=e.x+t),e.y+n>s&&(s=e.y+n)}return Number.isFinite(r)?{x:r-n,y:i-o,width:a-r+2*n,height:s-i+2*o}:null}function Pt(t){const e=t.fontSize??12;return null!=t.maxWidth&&t.text.length*e*.56>t.maxWidth?null:Tt("text",{className:t.className,x:t.x,y:t.y,textAnchor:t.anchor??"middle",dominantBaseline:t.baseline??"middle",fontSize:e,fontWeight:t.fontWeight,fill:t.color,style:{pointerEvents:"none"},children:t.text},t.keyId)}function Dt(t){const e=t.spacing??8;return{def:Tt("pattern",{id:t.id,width:e,height:e,patternUnits:"userSpaceOnUse",patternTransform:`rotate(${t.angle??45})`,children:Tt("line",{x1:0,y1:0,x2:0,y2:e,stroke:t.color??"currentColor",strokeWidth:t.strokeWidth??1,opacity:t.opacity??.5})},t.id),fill:`url(#${t.id})`}}function Bt(t){const e=t.orient??"bottom",n="bottom"===e||"top"===e,o=t.offset??0,r=t.tickLength??6,i=t.gridLength??0,a=t.labelGap??4,s=t.fontSize??11,c=t.color??"var(--semiotic-text-secondary, #888)",l=t.gridColor??c,u=t.format??(t=>t+""),d="top"===e||"left"===e?-1:1,h=t.ticks.length-1,f=t.ticks.map((f,m)=>{const p=t.scale(f),g=o+d*r,y=o-d*i,x=g+d*a;let b;b=t.labelAnchor?t.labelAnchor:n?t.edgeAnchor&&0===m?"start":t.edgeAnchor&&m===h?"end":"middle":"left"===e?"end":"start";const w=n?"top"===e?"auto":"hanging":"middle",M=n?{x:p,y:x}:{x:x,y:p};return Et("g",{children:[(r>0||i>0)&&Tt("line",{...n?{x1:p,x2:p,y1:g,y2:y}:{x1:g,x2:y,y1:p,y2:p},stroke:i>0?l:c,strokeWidth:1,strokeDasharray:i>0?t.gridDasharray:void 0,opacity:i>0?.7:1}),Tt("text",{x:M.x,y:M.y,textAnchor:b,dominantBaseline:w,fontSize:s,fontWeight:t.fontWeight,fill:c,children:u(f)})]},`tick-${f}-${m}`)});return Tt("g",{className:t.className,style:{pointerEvents:"none"},children:f},t.keyId)}function Ht(t){const e=t.stroke??"var(--semiotic-text, #f4f4f8)",n=t.strokeWidth??1,o=t.markRadius??0,r=t.labelX-t.markX,i=t.labelY-t.markY,a=Math.hypot(r,i)||1,s=t.markX+r/a*o,c=t.markY+i/a*o;let l;return l="elbow"===t.connector?`M${s},${c} L${s},${t.labelY} L${t.labelX},${t.labelY}`:"curve"===t.connector?`M${s},${c} Q${(s+t.labelX)/2},${c} ${t.labelX},${t.labelY}`:`M${s},${c} L${t.labelX},${t.labelY}`,Et("g",{className:t.className,style:{pointerEvents:"none"},children:[o>0&&Tt("circle",{cx:t.markX,cy:t.markY,r:o,fill:"none",stroke:e,strokeWidth:n}),Tt("path",{d:l,fill:"none",stroke:e,strokeWidth:n}),Tt("text",{x:t.labelX,y:t.labelY,textAnchor:t.labelAnchor??"middle",dominantBaseline:t.labelBaseline??"hanging",fontSize:t.fontSize??11,fontWeight:t.fontWeight,fill:t.color??e,children:t.label})]},t.keyId)}import{jsx as Yt,jsxs as Gt}from"react/jsx-runtime";function qt(t,e,n={}){const o=n.fingerprintRounds??3,r=[],i=new Set;for(const e of t)null==e.id||i.has(e.id)||(i.add(e.id),r.push(e.id));const{outAdj:a,inAdj:s,undirected:c}=Zt(r,e),l=Qt(r,a,s,c,o).map(t=>({ids:t.ids,nodeCount:t.nodeCount,edgeCount:t.edgeCount,sinkCount:t.sinkCount,sourceCount:t.sourceCount,directed:t.directed,motif:t.motif,descriptor:Ut(t)})),u=new Map;for(const t of l){const e=u.get(t.motif);e?e.count+=1:u.set(t.motif,{motif:t.motif,descriptor:t.descriptor,count:1,directed:t.directed})}return{components:l,motifs:[...u.values()].sort((t,e)=>e.count-t.count),directedCount:l.filter(t=>t.directed).length,branchingCount:l.filter(t=>!t.directed).length}}function Xt(t){let e=2166136261;for(let n=0;t.length>n;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}function Vt(t){return"string"==typeof t?t:t?.id}function _t(t,e,n,o,r){const i=new Set(t);let a=new Map;for(const o of t){let t=0,r=0;for(const t of e.get(o)??[])i.has(t)&&(r+=1);for(const e of n.get(o)??[])i.has(e)&&(t+=1);a.set(o,`${t}:${r}`)}for(let o=0;r>o;o+=1){const o=new Map;for(const r of t){const t=[];for(const n of e.get(r)??[])i.has(n)&&t.push(a.get(n));const s=[];for(const t of n.get(r)??[])i.has(t)&&s.push(a.get(t));t.sort(),s.sort(),o.set(r,Xt(`${a.get(r)}>${t.join(",")}<${s.join(",")}`))}a=o}const s=t.map(t=>a.get(t)).sort();return Xt(`${t.length}#${o}#${s.join(";")}`)}function Kt(t,n,r,i,a,s,c){const{layer:l,layerCount:u}=function(t,e){const n=new Set(t),o=new Map,r=new Set,i=t=>{const a=o.get(t);if(void 0!==a)return a;if(r.has(t))return 0;r.add(t);let s=0;for(const o of e.get(t)??[])n.has(o)&&(s=Math.max(s,1+i(o)));return r.delete(t),o.set(t,s),s};let a=0;for(const e of t)a=Math.max(a,i(e));const s=new Map;for(const e of t)s.set(e,a-o.get(e));return{layer:s,layerCount:a+1}}(t.ids,i),d=Array.from({length:u},()=>[]);for(const e of t.ids)d[l.get(e)].push(e);const h=.14*Math.min(s.width,s.height),f=Math.max(1,s.width-2*h),m=Math.max(1,s.height-2*h),p=new Map,g=new Set(t.ids);for(let t=0;u>t;t+=1){let e=d[t];t>0&&(e=[...e].sort((t,e)=>y(t)-y(e)));const n=e.length,o=s.y+h+(1===u?.5:t/(u-1))*m;e.forEach((t,e)=>{p.set(t,{x:s.x+h+(1===n?.5:e/(n-1))*f,y:o})})}function y(t){let e=0,n=0;for(const o of a.get(t)??[]){const t=p.get(o);g.has(o)&&t&&(e+=t.x,n+=1)}return n>0?e/n:s.x+f/2}const x=d.reduce((t,e)=>Math.max(t,e.length),1),b=e(Math.min(c,f/(2.4*x),m/(2.4*u)),1.4,c),w=t.ids.map(t=>{const e=p.get(t);return{id:t,cx:e.x,cy:e.y,r:b,datum:n.get(t)??o({id:t}),category:r.get(t)??""}}),M=[];for(const e of t.ids){const t=p.get(e);for(const n of i.get(e)??[]){if(!g.has(n))continue;const e=p.get(n);M.push({x1:t.x,y1:t.y,x2:e.x,y2:e.y})}}return{nodes:w,edges:M}}function Ut(t){const{nodeCount:e,edgeCount:n,sinkCount:o,sourceCount:r}=t;return 1===e?"isolate":2===e&&1===n?"pair":1===r&&1===o&&n===e-1?"chain of "+e:t.directed&&1===r&&n>e-1?"diamond / mesh":t.directed?`converging (${e})`:"branching → "+o}function Zt(t,e){const n=new Set(t),o=new Map,r=new Map,i=new Map;for(const e of t)o.set(e,new Set),r.set(e,new Set),i.set(e,new Set);for(const t of e){const e=t.source,a=t.target;n.has(e)&&n.has(a)&&e!==a&&(o.get(e).has(a)||(o.get(e).add(a),r.get(a).add(e),i.get(e).add(a),i.get(a).add(e)))}return{outAdj:o,inAdj:r,undirected:i}}function Qt(t,e,n,o,r){const i=new Set,a=[];for(const s of t){if(i.has(s))continue;const t=[s];i.add(s);const c=[];for(;t.length;){const e=t.pop();c.push(e);for(const n of o.get(e)??[])i.has(n)||(i.add(n),t.push(n))}const l=new Set(c);let u=0,d=0,h=0;for(const t of c){let o=0,r=0;for(const n of e.get(t)??[])l.has(n)&&(o+=1);for(const e of n.get(t)??[])l.has(e)&&(r+=1);h+=o,0===o&&(u+=1),0===r&&(d+=1)}a.push({ids:c,nodeCount:c.length,edgeCount:h,sinkCount:u,sourceCount:d,directed:1===u,motif:_t(c,e,n,h,r)})}return a}var Jt=new t(8),te=t=>{const e=t.config||{},n=t.dimensions.plot;if(!t.nodes.length)return{sceneNodes:[]};const i=e.sourceAccessor??"source",a=e.targetAccessor??"target",s=e.labelAccessor??"label",c=e.categoryAccessor??"category",l=e.nodeRadius??4,u=e.cellGap??16,h=e.bandGap??22,m=e.headerHeight??34,p=e.minCellForFull??38,g=e.maxCellSize??120,y=e.minCellSize??12,x=e.fingerprintRounds??3,b=!1!==e.groupByMotif,w=e.sort??"frequency",M=new Map,v=new Map,k=[];for(const e of t.nodes){const t=e.id;null==t||M.has(t)||(k.push(t),M.set(t,e.data??e),v.set(t,d(e,c,"")+""))}const $=[];for(const e of t.edges){const t=Vt(e.source??d(e,i,void 0)),n=Vt(e.target??d(e,a,void 0));null!=t&&null!=n&&$.push({source:t,target:n})}const{outAdj:A,inAdj:S,undirected:C}=Zt(k,$),z=Qt(k,A,S,C,x),N=new Map;if(b)for(const t of z){const e=N.get(t.motif);e?e.push(t):N.set(t.motif,[t])}else N.set("all",[...z].sort((t,e)=>e.nodeCount-t.nodeCount));const L=[...N.entries()];L.sort((t,e)=>"size"===w?e[1][0].nodeCount-t[1][0].nodeCount:"directedness"===w?Number(e[1][0].directed)-Number(t[1][0].directed):e[1].length-t[1].length);const I=Xt(k.join(",")+"|"+[...A.entries()].map(([t,e])=>t+">"+[...e].sort().join(".")).join(";")),W=f([Math.round(n.x),Math.round(n.y),Math.round(n.width),Math.round(n.height),u,h,m,p,g,y,x,b,w,l,L.map(([t,e])=>t+":"+e.length).join(","),I]),F=Jt.getOrCompute(W,()=>function(t,e){const{plot:n}=e,o=Math.max(40,n.width),{cell:r,cols:i}=(()=>{for(let r=e.maxCellSize;r>=e.minCellSize;r-=2){const i=Math.max(1,Math.floor((o+e.cellGap)/(r+e.cellGap)));let a=0;for(const[,n]of t)a+=e.headerHeight+Math.ceil(n.length/i)*(r+e.cellGap)+e.bandGap;if(n.height>=a)return{cell:r,cols:i}}return{cell:e.minCellSize,cols:Math.max(1,Math.floor((o+e.cellGap)/(e.minCellSize+e.cellGap)))}})(),a=[],s=[];let c=n.y;for(const[l,u]of t){const t=Math.ceil(u.length/i),d=c,h=d+e.headerHeight,f=r>=e.minCellForFull;u.forEach((t,o)=>{const s=n.x+o%i*(r+e.cellGap),c=h+Math.floor(o/i)*(r+e.cellGap);if(f){const n=Kt(t,e.nodeDatum,e.nodeCategory,e.outAdj,e.inAdj,{x:s,y:c,width:r,height:r},e.nodeRadius);a.push({component:t,lod:"full",cx:s+r/2,cy:c+r/2,glyphR:0,nodes:n.nodes,edges:n.edges})}else a.push({component:t,lod:"glyph",cx:s+r/2,cy:c+r/2,glyphR:Math.max(2.5,.36*r),nodes:[],edges:[]})});const m=ee(u[0],e,{x:n.x,y:d+2,width:Math.min(e.headerHeight-6,40),height:e.headerHeight-6});s.push({motif:l,descriptor:Ut(u[0]),count:u.length,directed:u[0].directed,x:n.x,y:d,width:o,height:e.headerHeight+t*(r+e.cellGap),exemplar:m}),c=h+t*(r+e.cellGap)+e.bandGap}return{cells:a,bands:s}}(L,{plot:n,cellGap:u,bandGap:h,headerHeight:m,minCellForFull:p,maxCellSize:g,minCellSize:y,nodeRadius:l,nodeDatum:M,nodeCategory:v,outAdj:A,inAdj:S})),T=t.theme.semantic||{},E=e.convergeColor??T.info??"#4c78a8",j=e.branchColor??T.warning??"#e8853a",R=e.edgeColor??T.border??"#9aa0aa",O=e.colorMode??"directedness",P={predicate:t.selection?.isActive?t.selection.predicate:null,highlight:e.highlight??null,dimOpacity:.14},D=e=>"motif"===O?t.resolveColor(e.motif):"category"===O||e.directed?E:j,B=[],H=[];for(const e of F.cells){const n=e.component,i=D(n);if("full"===e.lod){for(const t of e.edges)H.push({type:"line",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,style:{stroke:R,strokeWidth:1,opacity:.5},datum:null});for(const n of e.nodes){const e="category"===O&&n.category?t.resolveColor(n.category):i,o={type:"symbol",cx:n.cx,cy:n.cy,size:Math.PI*n.r*n.r,symbolType:"circle",style:{fill:e,opacity:r(n.datum,P)},datum:n.datum,id:n.id,label:d(n.datum,s,n.id)+""};B.push(o)}}else{const t=o({id:`motif-${n.motif}-${e.cx.toFixed(0)}-${e.cy.toFixed(0)}`,motif:n.motif,shape:Ut(n),nodes:n.nodeCount,edges:n.edgeCount,sinks:n.sinkCount,sources:n.sourceCount,directedness:n.directed?"converging":"branching"}),a={type:"symbol",cx:e.cx,cy:e.cy,size:Math.PI*e.glyphR*e.glyphR,symbolType:n.directed?"circle":"diamond",style:{fill:i,opacity:r(t,P),stroke:R,strokeWidth:.75},datum:t,id:t.id+"",label:Ut(n)};B.push(a)}}return{sceneNodes:B,sceneEdges:H,overlays:function(t,e){const n=[];for(const o of t){const t=o.directed?e.convergeColor:e.branchColor;if(n.push(jt({keyId:"band-"+o.motif,x:o.x-6,y:o.y-4,width:o.width+12,height:o.height+4,radius:8,stroke:t,strokeWidth:1,opacity:.28})),e.showExemplars&&o.exemplar){const r=o.exemplar;n.push(Gt("g",{style:{pointerEvents:"none"},children:[r.edges.map((t,n)=>Yt("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:e.edgeColor,strokeWidth:.75,opacity:.55},"exe-"+n)),r.nodes.map(e=>Yt("circle",{cx:e.cx,cy:e.cy,r:Math.max(1.6,e.r),fill:t},"exn-"+e.id))]},"ex-"+o.motif))}if(e.showBandLabels){const t=o.x+(e.showExemplars?48:4);n.push(Yt("text",{x:t,y:o.y+12,fontSize:13,fontWeight:600,fill:e.textColor,style:{pointerEvents:"none"},children:o.descriptor},"bl-"+o.motif)),n.push(Yt("text",{x:t,y:o.y+27,fontSize:11,fill:e.subText,style:{pointerEvents:"none"},children:`×${o.count} · ${o.directed?"converges to 1 sink":"branches to ≥2 sinks"}`},"bc-"+o.motif))}}if(e.showLegend){const t=e.plot.x+e.plot.width-168,i=e.plot.y-2;n.push(Gt("g",{style:{pointerEvents:"none"},children:[Yt("circle",{cx:t,cy:i,r:5,fill:e.convergeColor}),Yt("text",{x:t+10,y:i+4,fontSize:11,fill:e.subText,children:"converges (1 sink)"}),Yt("path",{d:(o=t,r=i+18,`M${o},${r-5} L${o+5},${r} L${o},${r+5} L${o-5},${r} Z`),fill:e.branchColor}),Yt("text",{x:t+10,y:i+22,fontSize:11,fill:e.subText,children:"branches (≥2 sinks)"})]},"net-legend"))}var o,r;return Yt("g",{className:"net-ensemble-overlays",children:n})}(F.bands,{convergeColor:E,branchColor:j,edgeColor:R,plot:n,showBandLabels:!1!==e.showBandLabels,showExemplars:!1!==e.showExemplars,showLegend:!1!==e.showLegend&&"directedness"===O,textColor:T.text??"var(--semiotic-text, #1a1a1a)",subText:T.textSecondary??"var(--semiotic-text-secondary, #888)"})}};function ee(t,e,n){return t?Kt(t,e.nodeDatum,e.nodeCategory,e.outAdj,e.inAdj,n,3):null}import{jsx as ne,jsxs as oe}from"react/jsx-runtime";var re=new t(12);function ie(t){if(null==t)return NaN;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();const e=t+"",n=Number(e);if(!Number.isNaN(n)&&""!==e.trim())return n;const o=Date.parse(e);return Number.isNaN(o)?NaN:o}function ae(t,e,n){return e>t?e:t>n?n:t}var se=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.columnAccessor??"column",i=e.rowAccessor??"row",a=e.sizeAccessor,c=e.colorAccessor,u=e.symbolAccessor,h=e.shadeAccessor,m=e.markerAccessor,p=e.iconAccessor,g=e.defaultSymbol??"circle",[y,x]=e.sizeRange??[2,8],b=e.shadeStrength??.72,w=e.shadeReverse??!1,M=e.rowMode??"banded",v=e.cellSizing??"proportional",k=e.proportionExponent??1,C=e.columnGap??16,z=e.rowGap??12,N=e.packPadding??1,L=e.iterations??12,I=!1!==e.showEnclosures,W=!1!==e.showColumnHeaders,F=!1!==e.showRowLabels,T=W?e.headerHeight??26:0,E=F?e.labelWidth??66:0,j=e.callouts&&e.callouts.length>0?e.footerHeight??30:0,R=n.x+E,O=n.y+T,P=Math.max(1,n.width-E),D=Math.max(1,n.height-T-j),B=[];for(const e of t.nodes){const t=e.data??e;B.push({id:e.id,col:d(e,o,"—")+"",row:d(e,i,"—")+"",sizeVal:a?Number(d(e,a,1)):1,colorKey:c?d(e,c,"")+"":"",symVal:u?d(e,u,"")+"":"",shadeVal:h?ie(d(e,h,null)):NaN,marker:!!m&&!!d(e,m,!1),iconVal:p?d(e,p,"")+"":"",datum:t,size:0,packR:0,baseShape:"circle",iconShape:null})}if(0===B.length)return{sceneNodes:[]};let H=1/0,Y=-1/0;if(a)for(const t of B)Number.isFinite(t.sizeVal)&&(H>t.sizeVal&&(H=t.sizeVal),t.sizeVal>Y&&(Y=t.sizeVal));e.sizeDomain&&([H,Y]=e.sizeDomain),Number.isFinite(H)&&Number.isFinite(Y)||(H=0,Y=1);const G=t=>{if(H>=Y)return(y+x)/2;const e=Math.sqrt(ae((t-H)/(Y-H),0,1));return y+e*(x-y)};let q=1/0,X=-1/0;if(h)for(const t of B)Number.isFinite(t.shadeVal)&&(q>t.shadeVal&&(q=t.shadeVal),t.shadeVal>X&&(X=t.shadeVal));e.shadeDomain&&([q,X]=e.shadeDomain);const V=t=>{if(!h||!Number.isFinite(t)||q>=X)return.5;const e=ae((t-q)/(X-q),0,1);return w?1-e:e},_=e.colorMap,K=new Map,U=(e,n)=>{let o=K.get(e);if(!o){const n=_&&_[e]||t.resolveColor(e);o=l(n,b),K.set(e,o)}return o(n)},Z=new Map;if(e.symbolMap)for(const[t,n]of Object.entries(e.symbolMap))Z.set(t,n);let Q=0;const J=e.iconMap,tt=t=>p&&J&&J[t]?J[t]:null,et=t=>p?"circle":(t=>{if(!u)return g;let e=Z.get(t);return e||(e=$[Q%$.length],Q++,Z.set(t,e)),e})(t.symVal),nt=e.maxAreaFraction??.4;let ot=0;const rt=Array(B.length),it=Array(B.length);for(let t=0;B.length>t;t++){const e=B[t],n=G(e.sizeVal);rt[t]=n,e.baseShape=et(e),e.iconShape=tt(e.iconVal);const o=A(e.baseShape,Math.PI*n*n);it[t]=o,ot+=Math.PI*o*o}const at=nt*P*D,st=ot>at?Math.sqrt(at/ot):1;for(let t=0;B.length>t;t++){const e=B[t],n=rt[t]*st;e.size=Math.PI*n*n,e.packR=it[t]*st}const ct=new Map,lt=new Map;for(const t of B)ct.set(t.col,(ct.get(t.col)??0)+1),lt.set(t.row,(lt.get(t.row)??0)+1);const ut=e.columnOrder?.filter(t=>ct.has(t))??[...ct.keys()].sort((t,e)=>(ct.get(e)??0)-(ct.get(t)??0)),dt=e.rowOrder?.filter(t=>lt.has(t))??[...lt.keys()].sort((t,e)=>(lt.get(e)??0)-(lt.get(t)??0)),ht=f([Math.round(n.x),Math.round(n.y),Math.round(n.width),Math.round(n.height),T,E,j,M,v,k,C,z,N,L,y,x,H,Y,nt,ut.join(","),dt.join(","),B.length,le(B)]),ft=re.getOrCompute(ht,()=>function(t,e){const n=new Map;for(const e of t){let t=n.get(e.col);t||(t=[],n.set(e.col,t)),t.push(e)}const o=e.columnOrder.filter(t=>n.has(t)),r=Math.max(1,e.innerW-e.columnGap*Math.max(0,o.length-1)),i=e.proportionExponent,a=o.map(t=>Math.pow(n.get(t).length,i)),c=a.reduce((t,e)=>t+e,0)||1,l=t=>"uniform"===e.cellSizing?r/o.length:a[t]/c*r,u=new Map,d=[];let h=e.innerX;for(let t=0;o.length>t;t++)d.push({col:o[t],x:h,w:l(t)}),h+=l(t)+e.columnGap;let f=1;const m=new Map,p=[],g=(t,e,n,o)=>{let r=m.get(t);r||(r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},m.set(t,r)),r.minX>e-o&&(r.minX=e-o),e+o>r.maxX&&(r.maxX=e+o),r.minY>n-o&&(r.minY=n-o),n+o>r.maxY&&(r.maxY=n+o)},y=(t,n,o,r,i,a)=>{const s=t.map(t=>({id:t.id,r:t.packR})),c=function(t,e,n,o,r,i,a,s){const c=e+o/2,l=n+r/2,u=new Map,d=t.length;if(0===d)return u;if(1===d)return u.set(t[0].id,{px:c,py:l}),u;const h=function(t){let e=t>>>0||1;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}(s),f=new Float64Array(d);let m=0;for(let e=0;d>e;e++)f[e]=t[e].r+i,f[e]>m&&(m=f[e]);const p=Math.max(1,Math.round(Math.sqrt(d*o/Math.max(1,r)))),g=new Float64Array(d),y=new Float64Array(d),x=o/p,b=r/Math.ceil(d/p);for(let t=0;d>t;t++){const o=t%p,r=Math.floor(t/p);g[t]=e+(o+.3+.4*h())*x,y[t]=n+(r+.3+.4*h())*b}const w=Math.max(0,Math.min(a,14)),M=Math.max(1,2*m),v=new Map,k=Math.max(1,Math.ceil(o/M)+3),$=(t,e)=>(e+1)*k+(t+1);for(let t=0;w>t;t++){v.clear();for(let t=0;d>t;t++){const o=$(Math.floor((g[t]-e)/M),Math.floor((y[t]-n)/M)),r=v.get(o);r?r.push(t):v.set(o,[t])}for(let t=0;d>t;t++){const o=Math.floor((g[t]-e)/M),r=Math.floor((y[t]-n)/M);for(let e=-1;1>=e;e++)for(let n=-1;1>=n;n++){const i=v.get($(o+e,r+n));if(i)for(let e=0;i.length>e;e++){const n=i[e];if(t>=n)continue;let o=g[n]-g[t],r=y[n]-y[t];const a=f[t]+f[n],s=o*o+r*r;if(a*a>s)if(s>1e-9){const e=Math.sqrt(s),i=(a-e)/2;o/=e,r/=e,g[t]-=o*i,y[t]-=r*i,g[n]+=o*i,y[n]+=r*i}else{const e=2.39996323*t;g[t]+=Math.cos(e)*f[t],y[t]+=Math.sin(e)*f[t]}}}}for(let t=0;d>t;t++){const i=f[t],a=e+i,s=e+o-i,u=n+i,d=n+r-i;g[t]=s>a?ae(g[t],a,s):c,y[t]=d>u?ae(y[t],u,d):l}}for(let e=0;d>e;e++)u.set(t[e].id,{px:g[e],py:y[e]});return u}(s,n,o,r,i,e.packPadding,e.iterations,f++);let l=1/0,d=1/0,h=-1/0,m=-1/0;for(const t of s){const e=c.get(t.id);u.set(t.id,{px:e.px,py:e.py}),g(a,e.px,e.py,t.r),l>e.px-t.r&&(l=e.px-t.r),e.px+t.r>h&&(h=e.px+t.r),d>e.py-t.r&&(d=e.py-t.r),e.py+t.r>m&&(m=e.py+t.r)}return Number.isFinite(l)?{x:l-ce,y:d-ce,w:h-l+2*ce,h:m-d+2*ce}:null};if("banded"===e.rowMode){const r=new Map;for(const e of t)r.set(e.row,(r.get(e.row)??0)+1);const a=e.rowOrder.filter(t=>r.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,a.length-1)),l=a.map(t=>Math.pow(r.get(t),i)),h=l.reduce((t,e)=>t+e,0)||1,f=new Map;let p=e.innerY+e.innerH;for(let t=0;a.length>t;t++){const n="uniform"===e.cellSizing?c/a.length:l[t]/h*c,o=p-n;f.set(a[t],{y:o,h:n}),p=o-e.rowGap}o.forEach((t,e)=>{const o=s(n.get(t),t=>t.row);for(const t of a){const n=o.get(t),r=f.get(t);n&&r&&y(n,d[e].x,r.y,d[e].w,r.h,t)}});const g=[],x=new Map;for(const t of a){const e=f.get(t);x.set(t,e.y+e.h/2);const n=m.get(t);n&&Number.isFinite(n.minX)&&g.push({x:n.minX-ce,y:n.minY-ce,w:n.maxX-n.minX+2*ce,h:n.maxY-n.minY+2*ce})}return{positions:u,enclosures:g,colBands:d,rowLabelY:x}}const x=new Map;o.forEach((t,o)=>{const r=s(n.get(t),t=>t.row),a=e.rowOrder.filter(t=>r.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,a.length-1)),l=a.map(t=>Math.pow(r.get(t).length,i)),u=l.reduce((t,e)=>t+e,0)||1;let h=e.innerY+e.innerH;a.forEach((t,n)=>{const i="uniform"===e.cellSizing?c/a.length:l[n]/u*c,s=h-i,f=y(r.get(t),d[o].x,s,d[o].w,i,t);if(f){p.push(f);const e=x.get(t)??{sum:0,n:0};e.sum+=f.y+f.h/2,e.n+=1,x.set(t,e)}h=s-e.rowGap})});const b=new Map;for(const[t,e]of x)b.set(t,e.sum/e.n);return{positions:u,enclosures:p,colBands:d,rowLabelY:b}}(B,{columnOrder:ut,rowOrder:dt,innerX:R,innerY:O,innerW:P,innerH:D,rowMode:M,cellSizing:v,proportionExponent:k,columnGap:C,rowGap:z,packPadding:N,iterations:L})),mt=t.selection,pt=mt?.isActive?mt.predicate:null,gt=e.highlight??null,yt=e.dimOpacity??.16,xt=e.markStroke,bt=e.markStrokeWidth??0,wt=e.markerColor??"#ffffff",Mt=e.iconColor??"rgba(255,255,255,0.92)",vt=e.iconStrokeWidth??1,kt=e.iconScale??.72,$t=[],At=[],St=[];for(const t of B){const e=ft.positions.get(t.id);if(!e)continue;const n=r(t.datum,{highlight:gt,predicate:pt,dimOpacity:yt}),o={type:"symbol",cx:e.px,cy:e.py,size:t.size,symbolType:t.baseShape,style:{fill:U(t.colorKey,V(t.shadeVal)),opacity:n,...xt?{stroke:xt,strokeWidth:bt}:{}},datum:t.datum,id:t.id,label:t.id+""};if($t.push(o),t.iconShape){const o=Math.sqrt(t.size/Math.PI)*kt,r=A(t.iconShape,100);St.push({x:e.px,y:e.py,size:r>0?o/r*100*(o/r):Math.PI*o*o,shape:t.iconShape,opacity:n})}t.marker&&n>yt+.001&&At.push({x:e.px,y:e.py,r:Math.max(1,.4*Math.sqrt(t.size/Math.PI))})}const Ct=[];if(e.callouts&&e.callouts.length>0){const t=e.calloutColor??"var(--semiotic-text, #f4f4f8)",o=n.y+n.height-(j>0?.45*j:9),r=[];for(let t=0;e.callouts.length>t;t++){const n=e.callouts[t],o=B.find(t=>t.datum[n.field]+""==n.value+"");if(!o)continue;const i=ft.positions.get(o.id);i&&r.push({c:n,ci:t,px:i.px,py:i.py,markR:Math.sqrt(o.size/Math.PI)})}const i=r.filter(t=>null==t.c.at).sort((t,e)=>t.px-e.px),a=new Map;i.forEach((t,e)=>{a.set(t.ci,R+(e+.5)/i.length*P)});for(const e of r){const r=e.c;let i=a.get(e.ci)??e.px,s=o;const c=r.connector??(a.has(e.ci)?"elbow":"straight");"object"==typeof r.at&&r.at?(i=r.at.x,s=r.at.y):"number"==typeof r.at&&(s=n.y+r.at*n.height),Ct.push({keyId:"callout-"+e.ci,markX:e.px,markY:e.py,labelX:i,labelY:s,label:r.label,connector:c,markRadius:Math.max(e.markR+3,7),stroke:t,color:t,fontSize:11,labelAnchor:"middle",labelBaseline:"auto"})}}const zt=function(t,e){const n=e.columnLabel??(t=>t),o=e.rowLabel??(t=>t);return oe("g",{className:"packed-cluster-matrix-chrome",style:{pointerEvents:"none"},children:[e.showEnclosures&&t.enclosures.map((t,n)=>jt({keyId:"enc-"+n,x:t.x,y:t.y,width:t.w,height:t.h,radius:e.enclosureRadius,stroke:e.enclosureColor,strokeWidth:e.enclosureWidth,opacity:e.enclosureOpacity})),e.iconMarks.length>0&&ne("g",{className:"packed-cluster-matrix-icons",children:e.iconMarks.map((t,n)=>ne("path",{d:S(t.shape,t.size),transform:`translate(${t.x},${t.y})`,fill:"none",stroke:e.iconColor,strokeWidth:e.iconStrokeWidth,opacity:t.opacity},"ic-"+n))}),e.markerDots.length>0&&ne("g",{className:"packed-cluster-matrix-markers",children:e.markerDots.map((t,n)=>ne("circle",{cx:t.x,cy:t.y,r:t.r,fill:e.markerColor},"mk-"+n))}),e.showColumnHeaders&&t.colBands.map((t,o)=>Pt({keyId:"col-"+o,text:n(t.col),x:t.x+t.w/2,y:e.headerY,anchor:"middle",fontSize:e.headerFontSize,fontWeight:700,color:e.headerColor})),e.showRowLabels&&[...t.rowLabelY].map(([t,n])=>Pt({keyId:"row-"+t,text:o(t),x:e.labelX,y:n,anchor:"end",fontSize:e.labelFontSize,fontWeight:600,color:e.labelColor})),e.callouts.map(t=>Ht(t))]})}(ft,{markerDots:At,markerColor:wt,iconMarks:St,iconColor:Mt,iconStrokeWidth:vt,callouts:Ct,plot:n,showEnclosures:I,showColumnHeaders:W,showRowLabels:F,enclosureColor:e.enclosureColor??"var(--semiotic-text, #f4f4f8)",enclosureRadius:e.enclosureRadius??9,enclosureOpacity:e.enclosureOpacity??.5,enclosureWidth:e.enclosureWidth??1.5,headerColor:e.headerColor??"var(--semiotic-text, #f4f4f8)",labelColor:e.labelColor??"var(--semiotic-text-secondary, #b9b9c8)",headerFontSize:e.headerFontSize??13,labelFontSize:e.labelFontSize??11,headerY:n.y+.62*T,labelX:n.x+E-10,columnLabel:e.columnLabel,rowLabel:e.rowLabel});return{sceneNodes:$t,overlays:zt}},ce=4;function le(t){let e=2166136261;const n=t=>{for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619)};for(const o of t)n(o.id),n(o.col),n(o.row),e^=Math.round(8*o.packR),e=Math.imul(e,16777619);return(e>>>0).toString(36)}import*as ue from"react";var de=t=>{const e=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height)return{nodes:[]};const r=h(e.categoryAccessor),i=h(e.stackBy),a=t=>{const n="function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor],o=Number(n);return Number.isFinite(o)&&o>0?o:0},s=e.gutter??2,c="string"==typeof e.categoryAccessor?e.categoryAccessor:"category",l="string"==typeof e.stackBy?e.stackBy:"stack",u="string"==typeof e.valueAccessor?e.valueAccessor:"value",d=(t,e,o)=>n(n=>{n("category",t),n("stack",e),n("value",o),"category"!==c&&n(c,t),"stack"!==l&&n(l,e),"value"!==u&&n(u,o)}),f=!1!==e.showCategoryLabels,m=Math.max(0,o.height-(e.labelPadding??(f?22:0))),p=[],g=new Map,y=[],x=new Set,b=new Map;for(const e of t.data){const t=r(e)+"",n=i(e)+"",o=a(e);g.has(t)||(p.push(t),g.set(t,0),b.set(t,new Map)),x.has(n)||(x.add(n),y.push(n)),g.set(t,(g.get(t)??0)+o);const s=b.get(t);s.set(n,(s.get(n)??0)+o)}const w=e.categoryOrder?he(e.categoryOrder,p,t=>g.has(t)):p,M=e.stackOrder?he(e.stackOrder,y,()=>!0):y,v=w.reduce((t,e)=>t+(g.get(e)??0),0);if(0>=v)return{nodes:[]};const k=Math.max(0,o.width-s*Math.max(0,w.length-1)),$=[],A=[];let S=o.x;for(const e of w){const n=g.get(e)??0,r=n/v*k;if(0>=r)continue;A.push({cat:e,x:S,w:r});const i=b.get(e);let a=o.y;for(const o of M){const s=i.get(o)??0;if(0>=s)continue;const c=s/n*m;$.push({type:"rect",x:S,y:a,w:r,h:c,style:{fill:t.resolveColor(o),stroke:"none"},datum:d(e,o,s),group:o}),a+=c}S+=r+s}return{nodes:$,overlays:f&&A.length>0?function(t,e,n){const o=t.map((t,o)=>Pt({keyId:"marimekko-label-"+o,text:t.cat,x:t.x+t.w/2,y:e+12,anchor:"middle",baseline:"auto",maxWidth:t.w-4,fontSize:12,color:n}));return ue.createElement(ue.Fragment,null,...o)}(A,o.y+m+4,`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`):null}};function he(t,e,n){const o=new Set,r=[];for(const e of t)n(e)&&!o.has(e)&&(o.add(e),r.push(e));for(const t of e)o.has(t)||r.push(t);return r}import*as fe from"react";var me=t=>{const e=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height||0===t.data.length)return{nodes:[]};const r=e.rowHeight??28,i=e.rowGap??12,a=!1!==e.showLabels,s=a?e.labelWidth??120:0,c=!1!==e.showTicks,l=c?14:0,u=e.tickFormat??(t=>t.toLocaleString()),d=o.x+s,f=Math.max(0,o.width-s);if(0>=f)return{nodes:[]};const m=h(e.categoryAccessor),p=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:0},g=t=>p("function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor]),y=t=>p("function"==typeof e.targetAccessor?e.targetAccessor(t):t[e.targetAccessor]),x=t=>{const n="function"==typeof e.rangesAccessor?e.rangesAccessor(t):t[e.rangesAccessor];return Array.isArray(n)?n.map(p).sort((t,e)=>t-e):[]},b="string"==typeof e.categoryAccessor?e.categoryAccessor:"metric",w="string"==typeof e.valueAccessor?e.valueAccessor:"value",M="string"==typeof e.targetAccessor?e.targetAccessor:"target",v=e.actualColor??t.theme.semantic.primary??"#3b6cb1",k=t.theme.semantic.text??"currentColor",$=e.targetColor??`var(--semiotic-text, ${k})`,A=[`var(--semiotic-surface, ${t.theme.semantic.surface??"#e8eaed"})`,`var(--semiotic-grid, ${t.theme.semantic.grid??"#cdd1d6"})`,`var(--semiotic-border, ${t.theme.semantic.border??"#a3a8af"})`],S=`var(--semiotic-text, ${k})`,C=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,z=[],N=[];for(let e=0;t.data.length>e;e++){const a=t.data[e],s=x(a),c=g(a),u=y(a),h=Math.max(c,u,...s.length?s:[0]);if(0>=h)continue;const p=o.y+e*(r+i+l);if(p+r+l>o.y+o.height)break;N.push({yTop:p,label:m(a),actual:c,target:u,maxVal:h});const k=t=>d+t/h*f,S=m(a),C=t=>n(e=>{e("metric",S),"metric"!==b&&e(b,S),t(e)});let L=d;for(let t=0;s.length>t;t++){const e=k(s[t]),n=e-L;n>0&&z.push({type:"rect",x:L,y:p,w:n,h:r,style:{fill:A[Math.min(t,A.length-1)],stroke:"none"},datum:C(e=>{e("range",t),e("rangeValue",s[t]),e("kind","range")}),group:"range-"+t}),L=e}const I=Math.max(6,Math.floor(.45*r));z.push({type:"rect",x:d,y:p+(r-I)/2,w:k(c)-d,h:I,style:{fill:v,stroke:"none"},datum:C(t=>{t("value",c),t("kind","actual"),"value"!==w&&t(w,c)}),group:"actual"});const W=3,F=Math.floor(.8*r);z.push({type:"rect",x:k(u)-W/2,y:p+(r-F)/2,w:W,h:F,style:{fill:$,stroke:"none"},datum:C(t=>{t("target",u),t("kind","target"),"target"!==M&&t(M,u)}),group:"target"})}const L=[];for(let t=0;N.length>t;t++){const e=N[t];if(a&&L.push(Pt({keyId:"bullet-label-"+t,text:e.label,x:o.x+s-8,y:e.yTop+r/2,anchor:"end",baseline:"middle",fontSize:13,fontWeight:500,color:S})),c){const n=5,o=e.yTop+r+2;for(let r=0;n>r;r++){const i=e.maxVal*r/(n-1),a=d+i/e.maxVal*f;L.push(fe.createElement("line",{key:`bullet-tick-${t}-${r}`,x1:a,x2:a,y1:o,y2:o+3,stroke:C,strokeWidth:1}),Pt({keyId:`bullet-ticktext-${t}-${r}`,text:u(i),x:a,y:o+12,anchor:0===r?"start":r===n-1?"end":"middle",baseline:"auto",fontSize:10,color:C}))}}}return{nodes:z,overlays:L.length>0?fe.createElement(fe.Fragment,null,...L):null}};import*as pe from"react";import{scaleLinear as ge}from"d3-scale";var ye=t=>{const e=t.config,{plot:n}=t.dimensions,o=e.fields??[];if(2>o.length||0>=n.width||0>=n.height)return{nodes:[]};if(0===t.data.length)return{nodes:[]};const i={};for(const n of o){if(e.domains?.[n]){i[n]=e.domains[n];continue}let o=1/0,r=-1/0;for(const e of t.data){const t=Number(e[n]);Number.isFinite(t)&&(o>t&&(o=t),t>r&&(r=t))}i[n]=Number.isFinite(o)&&Number.isFinite(r)&&o!==r?[o,r]:[0,1]}const a=!1!==e.showAxes,s=a?e.axisLabelPadding??24:8,c=a?18:8,l=o.map(t=>ge().domain(i[t]).range([n.y+n.height-c,n.y+s])),u=o.map((t,e)=>1===o.length?n.x+n.width/2:n.x+e/(o.length-1)*n.width),d=e.colorBy?"function"==typeof e.colorBy?e.colorBy:t=>(t[e.colorBy]??"")+"":null,h=e.opacity??.45,f=e.strokeWidth??1.25,m=t.theme.semantic.primary??"#3b6cb1",p=e.dimmedOpacity??.08,g=e.highlightFn,y=[],x=[];for(const n of t.data){const i=d?t.resolveColor(d(n)+""):m,a=!g||g(n),s=r(n,{predicate:g,baseOpacity:h,dimOpacity:p,brighten:.4}),c=a?x:y;for(let t=0;o.length-1>t;t++){const e=Number(n[o[t]]),r=Number(n[o[t+1]]);if(!Number.isFinite(e)||!Number.isFinite(r))continue;const d={type:"connector",x1:u[t],y1:l[t](e),x2:u[t+1],y2:l[t+1](r),style:{stroke:i,strokeWidth:g&&a?f+.75:f,opacity:s,fill:"none"},datum:n};c.push(d)}if(e.showPoints)for(let t=0;o.length>t;t++){const e=Number(n[o[t]]);if(!Number.isFinite(e))continue;const r={type:"point",x:u[t],y:l[t](e),r:2.5,style:{fill:i,stroke:"none",opacity:Math.min(1,s+.3)},datum:n};c.push(r)}}let b=null;if(a){const r=`var(--semiotic-border, ${t.theme.semantic.border??"#aaa"})`,a=`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`,d=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,h=n.y+s,f=n.y+n.height-c,m=[];for(let t=0;o.length>t;t++){const c=o[t],p=u[t],g=e.tickFormat?.[c]??(t=>t.toLocaleString());m.push(pe.createElement("line",{key:"pc-axis-line-"+t,x1:p,x2:p,y1:h,y2:f,stroke:r,strokeWidth:1})),m.push(Pt({keyId:"pc-axis-label-"+t,text:c,x:p,y:n.y+s-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:a}));const[y,x]=i[c],b=5;for(let e=0;b>e;e++){const n=y+(x-y)*e/(b-1),o=l[t](n);m.push(pe.createElement("line",{key:`pc-tick-${t}-${e}`,x1:p-3,x2:p+3,y1:o,y2:o,stroke:r,strokeWidth:1}),Pt({keyId:`pc-ticktext-${t}-${e}`,text:g(n),x:p+6,y:o+3,anchor:"start",baseline:"auto",fontSize:10,color:d}))}}b=pe.createElement(pe.Fragment,null,...m)}return{nodes:y.concat(x),overlays:b}};import{jsx as xe,jsxs as be}from"react/jsx-runtime";var we=1.75,Me="#222222";function ve(t,e){return t.topRadius+(e-t.height)/t.height*(t.topRadius-t.bottomRadius)}function ke(t,e){return function(t,e,n){return Math.PI*n/3*(t*t+t*e+e*e)}(ve(t,e),t.bottomRadius,e)}function $e(t,e){const n=(t.topRadius+t.bottomRadius)/2,o=Math.PI*n*n;let r=e/o,i=e-ke(t,r),a=0;for(;100>a&&Math.abs(i)>1e-4;)r+=i/o,i=e-ke(t,r),a++;return r}function Ae(t,e){const n=43758.5453*Math.sin(12.9898*t+78.233);return 2*(n-Math.floor(n)-.5)*e}function Se(t,e){if(e>t||2*e>t)return[{x:0,y:0}];const n=[],o=t=>{let r=Math.floor(2*Math.PI*t/(2*e));1>r&&(r=1);const i=0*t,a=Math.hypot(1*t-t*Math.cos(2*Math.PI/r),i-t*Math.sin(2*Math.PI/r));2*e>a&&r>1&&r--;for(let e=0;r>e;e++)n.push({x:t*Math.cos(2*e*Math.PI/r),y:t*Math.sin(2*e*Math.PI/r)});const s=t-2*e;e>s?t>2*e&&n.push({x:0,y:0}):o(s)};return o(t-e),n}function Ce(t,e,n){const o=[];let r=n,i=0;for(;r>0&&60>i;){const n=e*(1+2*i),a=Se(ve(t,n),e),s=a.length-r,c=s>1?a.slice(Math.floor(s/2),Math.floor(s/2)+r):a,l=t.height-n;if(c.forEach((t,e)=>{o.push({x:t.x+Ae(97*i+e,.15),z:l+Ae(31*i+e,.05)})}),r-=c.length,i++,0===c.length)break}return{pearls:o,layers:i}}function ze(t,e,n,o){if(0>=o)return[];const r=function(t,e,n){let o=n,r=0;for(;o>0&&60>r;){const n=ve(t,e+.875*(1+2*r));o-=Math.max(1,Math.floor(2*n/we)),r++}return r}(t,e,o),i=Math.max(e,n-r*we)+.875,a=[];let s=0;for(let e=0;r>e&&o>s;e++){const n=i+we*e,r=ve(t,n),c=Math.max(1,Math.floor(2*r/we)),l=(2*r-c*we)/(c+1),u=-r+l,d=t.height-n-.875-.1;for(let t=0;c>t&&o>s;t++)a.push({cx:u+(l+we)*t+.875,cy:d+.875,rotation:Ae(53*e+t,10)}),s++}return a}function Ne(t,e){const n=Number(t);return Number.isFinite(n)?n:e}var Le=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height)return{nodes:[]};const r=h(e.categoryAccessor??"name"),i=h(e.teaVolumeAccessor??"teaVolume"),a=h(e.bobaVolumeAccessor??"bobaVolume"),s=h(e.iceVolumeAccessor??"iceVolume"),c=h(e.cupHeightAccessor??"cupHeight"),l=h(e.cupTopRadiusAccessor??"cupTopRadius"),u=h(e.cupBottomRadiusAccessor??"cupBottomRadius"),d=h(e.bobaRadiusAccessor??"bobaRadius"),f=e.cupWidthRatio??.82,p=t.scales.o,g=p.bandwidth(),y=Math.max(1,n.height-26-8),x=n.y+8,b=[],w=[];for(const e of t.data){const n=r(e)+"",h=p(n);if(null==h)continue;const M={height:Ne(c(e),15.5),topRadius:Ne(l(e),4.75),bottomRadius:Ne(u(e),3.75)},v=Ne(d(e),.6),k=Math.max(0,Ne(i(e),450)),$=Math.max(0,Ne(a(e),110)),A=Math.max(0,Ne(s(e),135)),S=Math.PI*v*v,C=Math.floor($/S),z=C*S,N=Math.floor(A/5.359375),L=N*we*we*we,I=k+z+L,W=$e(M,I),F=Math.min(M.height,Math.max(0,W)),T=ve(M,F),{pearls:E,layers:j}=Ce(M,v,C),R=F,O=ze(M,j*v*2,R,N),P=M.height-20.32,D=Math.min(0,P),B=Math.min(g*f/(2*(M.topRadius+1)),y/(M.height-D)),H=h+g/2,Y=t=>H+t*B,G=t=>x+(t-D)*B,q=Y(-(M.topRadius+1)),X=Y(M.topRadius+1),V=G(D),_=G(M.height),K=o({name:n,teaVolume:k,bobaVolume:Math.round(z),iceVolume:Math.round(L),totalVolume:Math.round(I),numBobas:C,numIce:N,kind:"boba cup"});b.push({type:"rect",x:q,y:V,w:Math.max(1,X-q),h:Math.max(1,_-V),style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:K,group:n,_transitionKey:"boba-"+m(n)});const U=M.height-R,Z=m(n),Q=t.resolveColor(n);w.push(be("g",{children:[k>0?xe("path",{d:`M${Y(-T)},${G(U)} L${Y(-M.bottomRadius)},${G(M.height)} L${Y(M.bottomRadius)},${G(M.height)} L${Y(T)},${G(U)} z`,fill:"#D2B799"}):null,E.map((t,e)=>xe("circle",{cx:Y(t.x),cy:G(t.z),r:v*B,fill:"#222222",opacity:.5},"p-"+e)),O.map((t,e)=>xe("rect",{x:Y(t.cx)-.95*we*B/2,y:G(t.cy)-.95*we*B/2,width:.95*we*B,height:.95*we*B,rx:2,fill:"#a5f2f3",opacity:.85,transform:`rotate(${t.rotation} ${Y(t.cx)} ${G(t.cy)})`},"i-"+e)),xe("path",{d:`M${Y(-M.topRadius)},${G(0)} L${Y(-M.bottomRadius)},${G(M.height)} L${Y(M.bottomRadius)},${G(M.height)} L${Y(M.topRadius)},${G(0)}`,fill:"none",stroke:Me,strokeWidth:2.5}),xe("line",{x1:Y(-(M.topRadius+1)),y1:G(0),x2:Y(M.topRadius+1),y2:G(0),stroke:Me,strokeWidth:3,strokeLinecap:"round"}),k>0?xe("path",{d:`M${Y(-.635)},${G(P)} L${Y(-.635)},${G(M.height-.4)} L${Y(.635)},${G(M.height-1.27-.4)} L${Y(.635)},${G(P)} z`,fill:"#4F91CB",stroke:Me,strokeWidth:1,opacity:.78}):null,xe("text",{x:H,y:_+16,textAnchor:"middle",fontSize:12,fontWeight:600,fill:"var(--semiotic-text, #333)",children:n}),xe("text",{x:H,y:_+30,textAnchor:"middle",fontSize:10,fill:Q,children:`${C} pearls · ${Math.round(I)} cm³`})]},"boba-"+Z))}return{nodes:b,overlays:xe("g",{className:"semiotic-boba",style:{pointerEvents:"none"},children:w})}},Ie=["naturalGas","coal","nuclear","hydro","wind","solar","other"],We={naturalGas:"Natural gas",coal:"Coal",nuclear:"Nuclear",hydro:"Hydro",wind:"Wind",solar:"Solar",other:"Other"},Fe={tight:5,watch:12,comfortable:20};function Te(t,e=0){return"number"==typeof t&&Number.isFinite(t)?t:e}function Ee(t,e={}){const n=e.fuels??Ie,o=!0===e.includeZero,r=[];for(const e of t)if(e&&"number"==typeof e.t)for(const t of n){const n=Te(e.fuels?.[t]);(o||n>0)&&r.push({t:e.t,fuel:t,fuelLabel:We[t],mw:n,ba:e.ba})}return r}function je(t){const e=[];for(const n of t){if(!n||"number"!=typeof n.t)continue;const t=Te(n.demandMw),o=n.forecastMw;"number"==typeof o&&Number.isFinite(o)&&e.push({t:n.t,a:t,b:o,demandMw:t,forecastMw:o,errorMw:t-o,ba:n.ba})}return e}function Re(t){const e=Te(t.demand);if(0>=e)return 0;const n=Te(t.capacityOrNetGen),o=Te(t.interchange);return(n+(0>o?-o:0)-e)/e*100}function Oe(t){return t.filter(t=>t&&"number"==typeof t.t).map(t=>{const e=Te(t.demandMw),n=Te(t.netGenMw),o=Re({demand:e,capacityOrNetGen:n,interchange:t.interchangeMw});return{t:t.t,ba:t.ba,reserveMarginPct:o,netLoadMw:e,demandMw:e,netGenMw:n}})}function Pe(t={},e={}){const{watch:n,comfortable:o}={...Fe,...t},r=e.field,i=r?{field:r}:{},a=e.tightHatch??{type:"hatch",background:"var(--semiotic-danger, #c2410c)",stroke:"rgba(255, 240, 200, 0.55)",spacing:5,angle:-35,lineWidth:1.25,lineOpacity:.9};return[{id:"reserve-comfortable",label:`Comfortable (≥ ${o}%)`,when:{...i,gte:o},style:{fill:e.comfortableFill??"var(--semiotic-success, #16a34a)",fillOpacity:.85}},{id:"reserve-watch",label:`Watch (< ${o}%, ≥ ${n}%)`,when:{...i,lt:o,gte:n},style:{fill:e.watchFill??"var(--semiotic-warning, #d97706)",fillOpacity:.9}},{id:"reserve-tight",label:`Tight (< ${n}%)`,when:{...i,lt:n},style:{fill:a,stroke:e.tightFill??"var(--semiotic-danger, #c2410c)",strokeWidth:1,fillOpacity:1}}]}function De(t={}){const{tight:e,watch:n,comfortable:o}={...Fe,...t};return[{type:"band",y0:-50,y1:e,label:"Tight",color:"var(--semiotic-danger, #c2410c)",fillOpacity:.12,emphasis:"secondary"},{type:"band",y0:e,y1:n,label:"Watch",color:"var(--semiotic-warning, #d97706)",fillOpacity:.1,emphasis:"secondary"},{type:"band",y0:n,y1:Math.max(o+30,40),label:"Headroom",color:"var(--semiotic-success, #16a34a)",fillOpacity:.06,emphasis:"secondary"}]}function Be(t,e){if(!t.length)return null;const n=[...t].filter(t=>t&&"number"==typeof t.t).sort((t,e)=>t.t-e.t);if(!n.length)return null;let o=n[n.length-1];if("number"==typeof e&&Number.isFinite(e)){const t=n.filter(t=>e>=t.t);o=t.length?t[t.length-1]:n[0]}const r=Te(o.demandMw),i=Te(o.netGenMw),a="number"==typeof o.forecastMw&&Number.isFinite(o.forecastMw)?o.forecastMw:null,s=Re({demand:r,capacityOrNetGen:i,interchange:o.interchangeMw}),c={};let l=null,u=0,d=0;for(const t of Ie){const e=Te(o.fuels?.[t]);e>0&&(d+=e,c[t]=e,e>u&&(u=e,l=t))}if(d>0)for(const t of Object.keys(c))c[t]=c[t]/d;return{t:o.t,ba:o.ba,demandMw:r,forecastMw:a,forecastErrorMw:null==a?null:r-a,netGenMw:i,reserveMarginPct:s,topFuel:l,topFuelShare:d>0?u/d:0,topFuelMw:u,fuelShares:c}}function He(t,e={}){const n=e.now??Date.now(),o=e.author??"system",r=e.source??"authored-scenario";return t.map(t=>{const e=(t.start+t.end)/2,i=new Date(t.start).toISOString();return{type:"x-band",x0:t.start,x1:t.end,label:t.label,color:"outage"===t.kind?"var(--semiotic-danger)":"var(--semiotic-warning)",fillOpacity:.12,emphasis:"secondary",x:e,y:t.y??t.value,note:t.note,provenance:{author:o,authorKind:"system",source:r,basis:"rule",confidence:.85,createdAt:i,stableId:t.id,dataVersion:t.start+""},lifecycle:{status:"accepted",ttlHint:t.ttlHint??"P14D",anchor:"fixed"},_eventKind:t.kind,_createdAtMs:t.start,_nowMs:n}})}function Ye(t,e=12){return[...t].filter(t=>Number.isFinite(t.reserveMarginPct)).sort((t,e)=>t.reserveMarginPct-e.reserveMarginPct).slice(0,Math.max(0,e))}function Ge(t,e=0){return Number.isFinite(t)?t.toLocaleString(void 0,{maximumFractionDigits:e,minimumFractionDigits:e})+" MW":"—"}function qe(t,e=1){return Number.isFinite(t)?`${t>0?"+":""}${t.toFixed(e)}%`:"—"}import*as Xe from"react";function Ve(t,e){if("function"==typeof t)return t;const n=t??e;return t=>Number(t[n])}function _e(t,e={}){const n=Ve(e.start,"start"),o=Ve(e.end,"end"),r=!1===e.sort?t.slice():t.slice().sort((t,e)=>n(t)-n(e)||o(e)-o(t)),i=[];return{packed:r.map(t=>{const e=n(t);let r=i.findIndex(t=>e>=t);return-1===r&&(r=i.length),i[r]=o(t),{item:t,track:r}}),trackCount:Math.max(1,i.length)}}function Ke(t,e){const n=Ve(e.start,"start"),o=Ve(e.end,"end"),[r,i]=e.domain,a=e.step??1,s="half-open"===e.bounds,c=[];for(let e=r;i>=e;e+=a){let r=0;for(const i of t){const t=n(i),a=o(i);t>e||(s?e>=a:e>a)||r++}c.push({value:e,count:r})}return c}function Ue(t){return"function"==typeof t?t:e=>e[t]}var Ze=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height||0===t.data.length||!e?.domain)return{nodes:[]};const o=Ue(e.laneAccessor),r=Ue(e.startAccessor),i=Ue(e.endAccessor),a=e.idAccessor?Ue(e.idAccessor):null,s=e.unit??0,c=e.barGap??1.5,l=Math.max(0,e.minBarWidth??2),u=e.minBarHeight??3.5,d=e.maxBarHeight??10,h=e.lanePadding??7,f=e.cornerRadius??2,m=e.bottomInset??0,p=e.color??((e,n)=>t.resolveColor(n)),[g,y]=e.domain,x=y-g||1,b=t=>n.x+(t-g)/x*n.width,w=t.scales?.o?.domain?.()??[],M=e.lanes??(w.length>0?w:[...new Set(t.data.map(o))]),v=Math.max(0,n.height-m)/Math.max(1,M.length),k=t=>b(r(t)),$=t=>Math.max(k(t)+l,b(i(t)+s)),A=[];M.forEach((e,r)=>{const i=n.y+r*v,s=t.data.filter(t=>o(t)===e);if(0===s.length)return;const{packed:l,trackCount:m}=_e(s,{start:k,end:$}),g=new Map,y=new Map;for(const{item:t,track:e}of l){const n=y.get(e);n?n.push(t):y.set(e,[t])}for(const t of y.values()){t.sort((t,e)=>k(t)-k(e));for(let e=0;t.length-1>e;e++)g.set(t[e],k(t[e+1]))}const x=(v-2*h)/m,b=Math.min(d,Math.max(Math.min(u,x),x-c));for(const{item:t,track:n}of l){const o=k(t),r=g.get(t),s=$(t)-o;A.push({type:"rect",x:o,y:i+h+n*x,w:void 0!==r&&o+s>r-1?Math.max(1,r-1-o):s,h:b,cornerRadii:f>0?{tl:f,tr:f,br:f,bl:f}:void 0,style:{fill:p(t,e),stroke:"none"},datum:t,group:e,_transitionKey:a?a(t)+"":void 0})}});const S=`var(--semiotic-text, ${t.theme.semantic.text??"#1a1a1a"})`,C=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,z=`var(--semiotic-border, ${t.theme.semantic.border??"#94a3b8"})`,N=[];(e.periods??[]).forEach((t,e)=>{const o=b(t.start),r=Math.max(1,b(t.end+s)-o);N.push(Xe.createElement("rect",{key:"period-"+e,x:o,y:n.y,width:r,height:n.height,fill:z,opacity:e%2==0?.06:.025,pointerEvents:"none"})),t.name&&N.push(Pt({keyId:"period-label-"+e,text:t.name,x:o+4,y:n.y+12,anchor:"start",baseline:"hanging",fontSize:13,fontWeight:700,color:C}))});const L=!1!==e.showLaneLabels,I=e.laneLabelGap??12;if(M.forEach((t,e)=>{const o=n.y+e*v;N.push(Xe.createElement("line",{key:"lane-sep-"+e,x1:n.x,x2:n.x+n.width,y1:o,y2:o,stroke:z,opacity:.45})),L&&N.push(Pt({keyId:"lane-label-"+e,text:t,x:n.x-I,y:o+v/2,anchor:"end",baseline:"middle",fontSize:12,fontWeight:600,color:S}))}),!1!==e.showAxis){const t=e.axisTicks??Array.from({length:8},(t,e)=>Math.round(g+e/7*x));N.push(Bt({keyId:"interval-axis",scale:b,ticks:t,orient:"top",offset:n.y,tickLength:0,gridLength:n.height,gridDasharray:"3 5",edgeAnchor:!0,format:e.tickFormat,color:C}))}return{nodes:A,overlays:Xe.createElement(Xe.Fragment,null,...N)}};function Qe(t,e,n){const o=n?.orientation??"vertical",r=n?.bend??0,i=n?.minAlong??18,a=(t,e)=>(t+e)/2;if("vertical"===o){if(i>Math.abs(e.y-t.y)){const n=t.x>e.x?-1:1,o=a(t.x,e.x)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${o},${a(t.y,e.y)} ${e.x},${e.y}`}const n=a(t.y,e.y)+r;return`M${t.x},${t.y} C${t.x},${n} ${e.x},${n} ${e.x},${e.y}`}if(i>Math.abs(e.x-t.x)){const n=t.y>e.y?-1:1,o=a(t.y,e.y)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${a(t.x,e.x)},${o} ${e.x},${e.y}`}const s=a(t.x,e.x)+r;return`M${t.x},${t.y} C${s},${t.y} ${s},${e.y} ${e.x},${e.y}`}function Je(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=(t.y+e.y)/2;return`M${t.x},${t.y} L${t.x},${n} L${e.x},${n} L${e.x},${e.y}`}const o=(t.x+e.x)/2;return`M${t.x},${t.y} L${o},${t.y} L${o},${e.y} L${e.x},${e.y}`}function tn(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=e.cy>=t.cy;return{from:{x:t.cx,y:t.cy+(n?t.height/2:-t.height/2)},to:{x:e.cx,y:e.cy+(n?-e.height/2:e.height/2)}}}const o=e.cx>=t.cx;return{from:{x:t.cx+(o?t.width/2:-t.width/2),y:t.cy},to:{x:e.cx+(o?-e.width/2:e.width/2),y:e.cy}}}function en(t,e){const n=e?.spread??5;return e?.modulo&&e.modulo>0?(t%e.modulo-(e.modulo-1)/2)*n:(t-((e?.count??1)-1)/2)*n}function nn(t,e){const n=1-e,o=n*n*n,r=3*n*n*e,i=3*n*e*e,a=e*e*e;return{x:o*t.p0.x+r*t.p1.x+i*t.p2.x+a*t.p3.x,y:o*t.p0.y+r*t.p1.y+i*t.p2.y+a*t.p3.y}}function on(t,e){const n=1-e,o=3*n*n,r=6*n*e,i=3*e*e;return{x:o*(t.p1.x-t.p0.x)+r*(t.p2.x-t.p1.x)+i*(t.p3.x-t.p2.x),y:o*(t.p1.y-t.p0.y)+r*(t.p2.y-t.p1.y)+i*(t.p3.y-t.p2.y)}}function rn(t){return`M${t.p0.x},${t.p0.y} C${t.p1.x},${t.p1.y} ${t.p2.x},${t.p2.y} ${t.p3.x},${t.p3.y}`}function an(t,e){const n=e?.axis??"x",o=e?.padding??0,r=e?.strength??.5,i="x"===n?"y":"x",a="x"===n?"width":"height",s="x"===n?"height":"width",c=new Map;for(const e of t)c.set(e.id,0);for(let e=0;t.length>e;e++)for(let l=e+1;t.length>l;l++){const u=t[e],d=t[l];if(Math.abs(u[i]-d[i])>(u[s]+d[s])/2+o)continue;const h=d[n]-u[n]||(d.id>u.id?-.5:.5),f=(u[a]+d[a])/2+o-Math.abs(h);if(0>=f)continue;const m=f*r*Math.sign(h);c.set(u.id,(c.get(u.id)??0)-m),c.set(d.id,(c.get(d.id)??0)+m)}return c}var sn={width:60,height:34};function cn(t,e){if("function"==typeof t)return t;const n=t??e;return t=>d(t,n,void 0)}function ln(t,e,n,o){const r=o.fixedAxis??"y",i=t=>cn(o.sourceAccessor,"source")(t)+"",a=t=>cn(o.targetAccessor,"target")(t)+"",s=o.size??(()=>sn),c=o.iterations??180,l=o.attraction??.012,u=o.anchorStrength??.003,d=o.collisionStrength??.12,h=o.collisionPadding??15,f=o.edgePadding??42,m=o.fixedPadding??16,g=o.damping??.72,y=o.spread??1,[x,b]=o.fixedDomain,w=b-x||1,M=("y"===r?n.y:n.x)+m,v=("y"===r?n.y+n.height:n.x+n.width)-m,k=("y"===r?n.x:n.y)+f,$=("y"===r?n.x+n.width:n.y+n.height)-f,A=Math.max(1,$-k),S=t.map(t=>{const e=p(t)??t,n=(r=t,cn(o.idAccessor,"id")(r)+"");var r;const{width:i,height:a}=s(e),c=(t=>Number(cn(o.fixedAccessor,"fixed")(t)))(t),l=k+function(t){let e=2166136261;for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0)/4294967295}(n)*A;return{data:e,id:n,width:i,height:a,fixedValue:c,fixed:(u=c,M+(u-x)/w*(v-M)),free:l,anchor:l};var u}),C=new Map(S.map(t=>[t.id,t])),z=t=>"y"===r?t.width:t.height;for(let t=0;c>t;t++){const t=new Map;for(const e of S)t.set(e.id,0);for(const n of e){const e=C.get(i(n)),o=C.get(a(n));if(!e||!o)continue;const r=(o.free-e.free)*l;t.set(e.id,(t.get(e.id)??0)+r),t.set(o.id,(t.get(o.id)??0)-r)}for(const e of S)t.set(e.id,(t.get(e.id)??0)+(e.anchor-e.free)*u);const n=an(S.map(t=>({id:t.id,x:"y"===r?t.free:t.fixed,y:"y"===r?t.fixed:t.free,width:t.width,height:t.height})),{axis:"y"===r?"x":"y",padding:h,strength:d});for(const e of S)t.set(e.id,(t.get(e.id)??0)+(n.get(e.id)??0));for(const e of S){e.free+=(t.get(e.id)??0)*g;const n=z(e)/2;e.free=Math.max(k+n,Math.min($-n,e.free))}}if(1!==y){const t=(k+$)/2;for(const e of S){const n=z(e)/2;e.free=Math.max(k+n,Math.min($-n,t+(e.free-t)*y))}}const N=S.map(t=>({data:t.data,id:t.id,x:"y"===r?t.free:t.fixed,y:"y"===r?t.fixed:t.free,width:t.width,height:t.height,fixedValue:t.fixedValue}));return{positioned:N,byId:new Map(N.map(t=>[t.id,t]))}}var un=t=>{const{plot:e}=t.dimensions;if(0>=e.width||0>=e.height||0===t.nodes.length||!t.config?.fixedDomain)return{sceneNodes:[]};const n=t.config.fixedAxis??"y",{positioned:o,byId:r}=ln(t.nodes,t.edges,e,t.config),i=o.map(e=>({type:"rect",x:e.x-e.width/2,y:e.y-e.height/2,w:e.width,h:e.height,style:{fill:t.resolveColor(e.id),stroke:"none"},datum:e.data,id:e.id,label:e.id})),a=[];t.edges.forEach((e,o)=>{const i=r.get((s=e,("function"==typeof t.config.sourceAccessor?t.config.sourceAccessor(s):d(s,t.config.sourceAccessor??"source",void 0))+""));var s;const c=r.get((e=>("function"==typeof t.config.targetAccessor?t.config.targetAccessor(e):d(e,t.config.targetAccessor??"target",void 0))+"")(e));if(!i||!c)return;const{from:l,to:u}=tn({cx:i.x,cy:i.y,width:i.width,height:i.height},{cx:c.x,cy:c.y,width:c.width,height:c.height},{orientation:"y"===n?"vertical":"horizontal"});a.push({type:"curved",pathD:Qe(l,u,{orientation:"y"===n?"vertical":"horizontal",bend:en(o,{modulo:5,spread:5})}),style:{stroke:"var(--semiotic-border, #888)",fill:"none",strokeWidth:1.4},datum:p(e)??e})});const s=o.map(t=>({x:t.x,y:t.y,text:t.id}));return{sceneNodes:i,sceneEdges:a,labels:s}};function dn(t){const n=Number(t.segmentDomain?.[0]),o=Number(t.segmentDomain?.[1]),r=Number.isFinite(n)?n:0,i=Number.isFinite(o)?o:r,a=r>i?-1:1,s=Math.abs(i-r),c=Number(t.currentSegment),l=Number.isFinite(c)?e((c-r)*a,0,s):0,u=(t,n)=>{const o=Number(t);return Number.isFinite(o)?e(o,0,1):n},d=u(t.oldestOpacity,.25),h=u(t.currentOpacity,1),f=u(t.futureOpacity,0);return{weightOpacity:!0===t.combineWeightOpacity,wordOpacity:({segment:t})=>{const n=Number(t);if(!Number.isFinite(n))return f;const o=(n-r)*a;if(o>l)return f;if(0===l)return h;const i=e(o/l,0,1);return d+(h-d)*i}}}import{jsx as hn,jsxs as fn}from"react/jsx-runtime";function mn(t){let e=2166136261;for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0)/4294967295}var pn=1.15,gn={a:.556,b:.556,c:.5,d:.556,e:.556,f:.278,g:.556,h:.556,i:.222,j:.222,k:.5,l:.222,m:.833,n:.556,o:.556,p:.556,q:.556,r:.333,s:.5,t:.278,u:.556,v:.5,w:.722,x:.5,y:.5,z:.5,"'":.191,"-":.333,".":.278," ":.278};function yn(t){let e=0;for(const n of t)e+=gn[n]??.6;return e}function xn(t,e){return Math.max(8,yn(t)*e*1.05+1)}function bn(t,e,n){for(const o of e)if((t.w+o.w)/2+n>Math.abs(t.x-o.x)&&(t.h+o.h)/2+n>Math.abs(t.y-o.y))return!0;return!1}var wn=t=>{const o=t.config,{plot:r}=t.dimensions;if(0>=r.width||0>=r.height||0===t.data.length)return{nodes:[]};const i=h(o.textAccessor),a=t=>{const e=Number(h(o.weightAccessor)(t));return Number.isFinite(e)&&e>0?e:0},s=h(o.columnAccessor),c=t=>Number(h(o.segmentAccessor)(t)),l=o.minFontSize??11,u=o.maxFontSize??42,d=o.columnGutter??18,f=o.collisionPadding??2,m=!1!==o.showColumnLabels,p=!1!==o.showSegmentAxis,g=o.segmentTickCount??6,y=o.segmentTickFormat??(t=>Math.round(t)+""),x=o.rotate??0,b=!0===o.repeatWords,w=!1!==o.scaleToFit,M=o.packingDensity??.6,v="string"==typeof o.textAccessor?o.textAccessor:"word",k="string"==typeof o.weightAccessor?o.weightAccessor:"weight",$="string"==typeof o.columnAccessor?o.columnAccessor:"column",A="string"==typeof o.segmentAccessor?o.segmentAccessor:"segment",S=[],C=new Map;let z=1/0,N=-1/0;for(let e=0;t.data.length>e;e++){const n=t.data[e],o=s(n)+"",r=i(n)+"",l=a(n),u=c(n);r&&Number.isFinite(u)&&(C.has(o)||(S.push(o),C.set(o,[])),C.get(o).push({col:o,text:r,weight:l,segment:u,datum:n,dataIndex:e}),z>u&&(z=u),u>N&&(N=u))}if(0===S.length)return{nodes:[]};if(!b)for(const[t,e]of C){const n=new Map;for(const t of e){const e=n.get(t.text);e&&e.weight>=t.weight||n.set(t.text,t)}C.set(t,[...n.values()])}let L=1/0,I=-1/0;for(const t of C.values())for(const e of t)L>e.weight&&(L=e.weight),e.weight>I&&(I=e.weight);if(!Number.isFinite(L))return{nodes:[]};const W=o.columnOrder?[...o.columnOrder.filter(t=>C.has(t)),...S.filter(t=>!o.columnOrder.includes(t))]:S,F=new Map(W.map(e=>[e,o.columnColor?.(e)||t.resolveColor(e)])),[T,E]=o.segmentDomain??[z,N],j=E-T||1,R=I-L||1,O=m?22:0,P=p?52:0,D=r.x+P,B=r.y+O,H=Math.max(0,r.width-P),Y=Math.max(0,r.height-O),G=W.length,q=G>0?Math.max(0,H-d*Math.max(0,G-1))/G:0,X=B+14,V=B+Y-14,_=t=>X+(t-T)/j*(V-X),K=q*Y;let U=1/0,Z=1/0;const Q=W.map((t,n)=>{const r=F.get(t),i=(C.get(t)??[]).map(t=>{const i={word:t.text,column:t.col,weight:t.weight,segment:t.segment,datum:t.datum,dataIndex:t.dataIndex,columnIndex:n,resolvedColumnColor:r},a=o.wordOpacity?Number(o.wordOpacity(i)):1,s=o.wordColor?.(i);return{text:t.text,weight:t.weight,segment:t.segment,baseFont:(c=t.weight,l+Math.sqrt((c-L)/R)*(u-l)),opacity:Number.isFinite(a)?e(a,0,1):0,color:s||r,info:i};var c});if(0===i.length)return null;let a=0;for(const t of i){const e=1.05*yn(t.text);a+=e*pn*t.baseFont*t.baseFont,Z=Math.min(Z,(q-8-1)/(e*t.baseFont))}return a>0&&(U=Math.min(U,Math.sqrt(M*K/a))),{col:t,colLeft:D+n*(q+d),center:D+n*(q+d)+q/2,rows:i}}).filter(t=>null!==t),J=t=>{const o=[];let r=0;for(const i of Q){if(0>=q)continue;const a=i.colLeft+4,s=i.colLeft+q-4,c=i.rows.map((e,n)=>{const o=Math.max(5,t*e.baseFont),r=`${i.col}::${e.text}::${n}`;return{id:r,text:e.text,weight:e.weight,segment:e.segment,font:o,w:xn(e.text,o),h:o*pn+2,anchorY:_(e.segment),seed:(mn(r)-.5)*Math.min(.5*q,80),opacity:e.opacity,color:e.color,info:e.info}}).sort((t,e)=>e.font-t.font||(e.id>t.id?-1:1)),l=[];for(const t of c){const c=t.w/2,u=t.h/2,d=e(i.center+t.seed,a+c,s-c),h=t.anchorY;let m=d,p=e(h,X+u,V-u),g=!1;for(let n=0;2600>n;n++){const o=3.2*Math.sqrt(n),r=2.399963229728653*n,i={x:e(d+o*Math.cos(r),a+c,s-c),y:e(h+o*Math.sin(r),X+u,V-u),w:t.w,h:t.h};if(!bn(i,l,f)){m=i.x,p=i.y,g=!0;break}}g||r++,l.push({x:m,y:p,w:t.w,h:t.h});const y=Math.sqrt((t.weight-L)/R),b=x>0?2*(mn(t.id+"r")-.5)*x:0;o.push({id:t.id,text:t.text,x:m,y:p,fontSize:t.font,rotation:b,color:t.color,opacity:t.opacity,datum:n(e=>{for(const n of Object.keys(t.info.datum))e(n,t.info.datum[n]);e("word",t.text),e("weight",t.weight),e("column",i.col),e("segment",t.segment),"word"!==v&&e(v,t.text),"weight"!==k&&e(k,t.weight),"column"!==$&&e($,i.col),"segment"!==A&&e(A,t.segment),e("__strength",.5+.5*y)})})}}return{placed:o,unplaced:r}};let tt=w?Math.min(1,U,Z):Math.min(1,Z),et=J(tt);if(w)for(let t=0;6>t&&et.unplaced>0&&tt>.1;t++)tt*=.88,et=J(tt);const nt=et.placed.filter(t=>t.opacity>0);return{nodes:nt.map(t=>{const e=xn(t.text,t.fontSize)/2,n=t.fontSize*pn/2;return{type:"rect",x:t.x-e,y:t.y-n,w:2*e,h:2*n,style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:t.datum,group:t.datum.column+"",_transitionKey:t.id}}),overlays:fn("g",{className:"semiotic-word-trails",children:[p&&Mn({x:r.x+P-10,yTop:X,yBot:V,segLo:T,segHi:E,segToY:_,tickCount:g,tickFormat:y,color:`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,label:o.segmentAxisLabel,labelX:r.x}),m&&W.map((t,e)=>q>0?hn("text",{x:D+e*(q+d)+q/2,y:r.y+14,textAnchor:"middle",fontSize:13,fontWeight:600,fill:F.get(t),style:{pointerEvents:"none"},children:t},"wt-col-"+e):null),nt.map(t=>hn("text",{x:t.x,y:t.y,textAnchor:"middle",dominantBaseline:"central",fontSize:t.fontSize,fontWeight:600,fill:t.color,opacity:(!1===o.weightOpacity?1:Number(t.datum.__strength))*t.opacity,transform:t.rotation?`rotate(${t.rotation} ${t.x} ${t.y})`:void 0,style:{pointerEvents:"none"},children:t.text},"wt-"+t.id))]})}};function Mn(t){const e=[],n=t.segHi-t.segLo||1;for(let o=0;t.tickCount>o;o++)e.push(t.segLo+n*o/Math.max(1,t.tickCount-1));return fn("g",{className:"semiotic-word-trails-axis",style:{pointerEvents:"none"},children:[hn("line",{x1:t.x,y1:t.yTop,x2:t.x,y2:t.yBot,stroke:t.color,strokeWidth:1,opacity:.5}),e.map((e,n)=>{const o=t.segToY(e);return fn("g",{children:[hn("line",{x1:t.x-4,y1:o,x2:t.x,y2:o,stroke:t.color,strokeWidth:1,opacity:.6}),hn("text",{x:t.x-7,y:o,textAnchor:"end",dominantBaseline:"central",fontSize:11,fill:t.color,children:t.tickFormat(e)})]},"wt-tick-"+n)}),t.label&&hn("text",{transform:`rotate(-90 ${t.labelX+10} ${(t.yTop+t.yBot)/2})`,x:t.labelX+10,y:(t.yTop+t.yBot)/2,textAnchor:"middle",fontSize:11,fontWeight:600,fill:t.color,children:t.label})]})}var vn={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},kn=8;function $n(t){return null==t?void 0:t+""}function An(t){const e=$n(t.id);return{type:"point",x:t.x,y:t.y,r:t.r??8,style:{...vn},datum:t.datum,pointId:e,_transitionKey:e}}function Sn(t){return An(t)}function Cn(t){const[[e,n],[o,r]]=t.bounds;return{type:"geoarea",pathData:t.pathData,centroid:t.centroid,bounds:t.bounds,screenArea:t.screenArea??Math.abs((o-e)*(r-n)),style:{...vn},datum:t.datum,group:t.group,interactive:!0}}function zn(t){return{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...vn},datum:t.datum,group:t.group,_transitionKey:$n(t.id)}}function Nn(t){const e=$n(t.id);return"width"in t&&"height"in t?{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...vn},datum:t.datum,id:e,label:t.label}:{type:"circle",cx:t.x,cy:t.y,r:t.r??8,style:{...vn},datum:t.datum,id:e,label:t.label}}function Ln(t,e,n={}){const{coord:o,step:r=1,equals:i=Object.is,truthyOnly:a=!1}=n,s=[],c=e=>o?o(t[e],e):e,l=(t,e,n)=>{t.endIndex=e,t.count=e-t.startIndex+1,t.end=o?null==n||c(n)-c(e)>r?c(e)+r:c(n):e+1,s.push(t)};let u=null;for(let n=0;t.length>n;n++){const s=e(t[n],n);if(a&&!s){u&&(l(u,u.endIndex,n),u=null);continue}const d=!o||0>=n||c(n)-c(n-1)<=r;u&&d&&i(u.value,s)?u.endIndex=n:(u&&l(u,u.endIndex,n),u={value:s,start:c(n),end:c(n),count:1,startIndex:n,endIndex:n})}return u&&l(u,u.endIndex,null),s}var In=Ln;function Wn(t,e,n=0){return e>0?((t-n)%e+e)%e+n:t}function Fn(t,e,n){if(0>=n)return e-t;let o=(e-t)%n;return o>n/2?o-=n:-n/2>o&&(o+=n),o}function Tn(t,e,n){return e>n?t>=e||n>=t:t>=e&&n>=t}function En(t,e,n,o){return n>o?[...t.filter(t=>e(t)>=n),...t.filter(t=>e(t)<=o)]:t.filter(t=>Tn(e(t),n,o))}function jn(t,e){const n=Math.max(0,e.width),o=e.y,r=Math.min(74,Math.max(34,.08*n)),i=e.paddingLeft??r,a=t.length>1?Math.max(0,n-i-(e.paddingRight??r))/(t.length-1):0,s=new Map;return t.forEach((t,e)=>{s.set(t.id,{id:t.id,x:i+a*e,y:o,index:e})}),s}function Rn(t,e){const n=Math.max(0,e.width),o=e.y,r=Math.min(74,Math.max(34,.08*n)),i=e.paddingLeft??r,a=e.paddingRight??r,s=e.gap??8,c=!1!==e.distribute,l=e.estimateWidth??(t=>On(t.label??t.id)),u=t.map((t,e)=>Math.max(1,l(t,e))),d=u.reduce((t,e)=>t+e,0)+s*Math.max(0,t.length-1),h=Math.max(0,n-i-a),f=c&&t.length>1?Math.max(0,h-d)/(t.length-1):0,m=new Map;let p=i;return c||1!==t.length||(p=i+Math.max(0,(h-u[0])/2)),t.forEach((t,e)=>{const n=u[e];m.set(t.id,{id:t.id,x:p+n/2,y:o,index:e,width:n}),p+=n+s+f}),m}function On(t,e=38,n=7.4,o=20){return Math.max(e,((t??"")+"").length*n+o)}function Pn(t){const e=t.map(t=>{const e=Math.min(t.a,t.b),n=Math.max(t.a,t.b);return{span:t,a:e,b:n,width:n-e}}).sort((t,e)=>t.width-e.width||t.a-e.a),n=[],o=e.map(t=>{let e=n.findIndex(e=>t.a>=e);return 0>e?(e=n.length,n.push(t.b)):n[e]=t.b,{span:t.span,level:e}}),r=o.reduce((t,e)=>Math.max(t,e.level),0);return{packed:o,maxLevel:r,levelCount:o.length?r+1:1}}function Dn(t){const e=t.labelRoom??18,n=Math.max(48,t.baselineY-t.ceilingY-28),o=Math.max(1,t.levelCount),r=Math.min(42,Math.max(26,.18*n)),i=Math.max(24,n-r-e);return{arcLift:r,levelStep:Math.min(72,Math.max(28,o>1?i/Math.max(1,o-1):i))}}function Bn(t,e,n,o,r={}){const i=n-(r.footLift??26);return`M${t} ${i}Q${(t+e)/2} ${o} ${e} ${i}`}function Hn(t,e,n){return t-n.arcLift-e*n.levelStep}function Yn(t,e=Gn){if(!t.length)return{shared:[],exclusive:[]};if(1===t.length)return{shared:[...t[0]],exclusive:[[]]};const n=t.map(t=>new Set(t.map(t=>e(t)))),o=new Set;for(const t of n[0])n.every(e=>e.has(t))&&o.add(t);const r=[],i=new Set;for(const n of t[0]){const t=e(n);o.has(t)&&!i.has(t)&&(r.push(n),i.add(t))}return{shared:r,exclusive:t.map(t=>t.filter(t=>!o.has(e(t))))}}function Gn(t){return null==t||"object"!=typeof t?t+"":null!=t.id?t.id+"":`${(t.sourceTokenId??t.source)+""}|${(t.targetTokenId??t.target)+""}|${(t.relation??t.label??"")+""}`}var qn=2*Math.PI;function Xn(t,e,n){const o=n?.center?.x??0,r=n?.center?.y??0;return{x:o+Math.sin(t)*e,y:r-Math.cos(t)*e}}function Vn(t,e,n){return(Math.atan2(t-(n?.center?.x??0),-(e-(n?.center?.y??0)))+qn)%qn}function _n(t,e){const[n,o]=t,r=o-n||1,i=e?.startAngle??0,a=e?.endAngle??qn;return t=>i+(t-n)/r*(a-i)}function Kn(t,e){const[n,o]=t,[r,i]=e,a=o-n||1;return t=>r+(t-n)/a*(i-r)}function Un(t,e,n,o,r){const i=r?.center,a=(t,e)=>{const{x:n,y:o}=Xn(t,e,{center:i});return`${Zn(n)},${Zn(o)}`},s=Math.max(0,n),c=Math.max(s,o),l=Math.abs(e-t),u=t>e?0:1;if(l>=qn-1e-6){const t=i?.x??0,e=i?.y??0,n=`${Zn(t)},${Zn(e-c)}`,o=`${Zn(t)},${Zn(e+c)}`;let r=`M${n} A${Zn(c)},${Zn(c)} 0 1 1 ${o} A${Zn(c)},${Zn(c)} 0 1 1 ${n} Z`;if(s>0){const n=`${Zn(t)},${Zn(e-s)}`,o=`${Zn(t)},${Zn(e+s)}`;r+=` M${n} A${Zn(s)},${Zn(s)} 0 1 0 ${o} A${Zn(s)},${Zn(s)} 0 1 0 ${n} Z`}return r}const d=l>Math.PI?1:0,h=a(t,c),f=a(e,c);if(0>=s){const t=i?.x??0,e=i?.y??0;return`M${Zn(t)},${Zn(e)} L${h} A${Zn(c)},${Zn(c)} 0 ${d} ${u} ${f} Z`}const m=a(e,s),p=a(t,s);return`M${h} A${Zn(c)},${Zn(c)} 0 ${d} ${u} ${f} L${m} A${Zn(s)},${Zn(s)} 0 ${d} ${1===u?0:1} ${p} Z`}function Zn(t){return Math.round(1e3*t)/1e3}function Qn(t,e){return{x:t.x+e.x,y:t.y+e.y}}function Jn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function to(t,e){return{x:t.x*e,y:t.y*e}}function eo(t){return Math.hypot(t.x,t.y)}function no(t){const e=eo(t)||1;return{x:t.x/e,y:t.y/e}}import{jsx as oo,jsxs as ro}from"react/jsx-runtime";var io="var(--semiotic-text, currentColor)";function ao(t,e){const n=A(t,100);return n>0?e/n*100*(e/n):Math.PI*e*e}function so(t){const e=[],n=t.colorMap?Object.entries(t.colorMap):t.keys?t.keys.map(e=>[e,t.color?t.color(e):void 0]):[];if(n.length>0){const o=t.colorType??"fill",r=n.map(([t,e])=>({label:t,color:e}));e.push({type:o,label:t.colorLabel??"",items:r,styleFn:"line"===o?t=>({stroke:t.color??io,strokeWidth:2,fill:"none"}):t=>({fill:t.color??io,stroke:t.color??io})})}if(t.symbolMap&&Object.keys(t.symbolMap).length>0){const n=t.symbolColor??io,o=Object.entries(t.symbolMap).map(([t,e])=>({label:t,shape:e,color:n}));e.push({label:t.symbolLabel??"",items:o,styleFn:()=>({}),type:t=>{const e=t.shape;return oo("path",{d:S(e,ao(e,7)),transform:"translate(8,8)",fill:t.color??n})}})}if(t.sizeStops&&t.sizeStops.length>0&&t.sizeRadius){const n=t.sizeRadius,o=t.sizeFormat??(t=>t+""),r=t.sizeColor??io,i=t.sizeStops.map(t=>({label:o(t),r:Math.max(.5,n(t)),color:r}));e.push({label:t.sizeLabel??"",items:i,styleFn:()=>({}),type:t=>oo("circle",{cx:8,cy:8,r:t.r,fill:t.color??r})})}return e}function co(t){const e=t.orientation??"vertical",n=t.swatchSize??14,o=t.gap??8,r=t.labelGap??6,i=t.fontSize??12,a=t.color??"var(--semiotic-text-secondary, #888)",s=n+o;let c=0;const l=[];return t.entries.forEach((t,u)=>{l.push(ro("g",{transform:`translate(${"vertical"===e?0:c},${"vertical"===e?c:0})`,children:[lo(t,n,t.color??t.line??a,a),oo("text",{x:n+r,y:n/2,dominantBaseline:"middle",fontSize:i,fill:a,children:t.label})]},"legend-"+u)),c+="vertical"===e?s:n+r+t.label.length*i*.58+o+8}),oo("g",{className:t.className,transform:`translate(${t.x},${t.y})`,style:{pointerEvents:"none"},children:l},t.keyId)}function lo(t,e,n,o){if(t.shape){const o=ao(t.shape,e/2-1);return oo("path",{d:S(t.shape,o),transform:`translate(${e/2},${e/2})`,fill:n})}if(t.hatch){const n=t.color??o;return ro("g",{children:[oo("svg",{width:e,height:e,style:{overflow:"hidden"},children:[-e,-e/2,0,e/2].map((t,o)=>oo("line",{x1:t,y1:e,x2:t+e,y2:0,stroke:n,strokeWidth:1,opacity:.7},o))}),oo("rect",{width:e,height:e,fill:"none",stroke:n,strokeWidth:1,opacity:.5,rx:2})]})}return oo("rect",t.line?{y:e/2-1.5,width:e,height:3,rx:1.5,fill:t.line}:{width:e,height:e,rx:2,fill:n})}var uo=new Set(["rows"]);function ho(t){const e=t,n=[go(e,["datum","data"]),go(e,["datum"]),go(e,["data","data"]),go(e,["data"]),go(e,["node","datum","data"]),go(e,["node","datum"]),t];for(const t of n){if(!yo(t))continue;const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||"function"==typeof o||(e[n]=o);if(Object.keys(e).length>0)return e}return null}function fo(t,e={}){const n=ho(t);if(!n)return[];const o=new Set(uo);if(e.excludeKeys)for(const t of e.excludeKeys)o.add(t);const r=[];for(const[t,i]of Object.entries(n))if((e.includeInternal||!t.startsWith("_"))&&!o.has(t)&&(e.includeEmpty||null!=i&&""!==i)&&"function"!=typeof i&&(r.push({key:t,label:po(t,e.labels),value:i,formatted:e.valueFormat?e.valueFormat(i,t,n):mo(i)}),r.length>=(e.maxEntries??8)))break;return r}function mo(t){if(null==t)return"";if(t instanceof Date)return t.toISOString();if("number"==typeof t)return Number.isInteger(t)?t+"":t.toLocaleString(void 0,{maximumFractionDigits:2});if("boolean"==typeof t)return t?"true":"false";if(Array.isArray(t))return t.length+" items";if("object"==typeof t)try{return JSON.stringify(t)}catch{return t+""}return t+""}function po(t,e){return"function"==typeof e?e(t):e&&e[t]?e[t]:t}function go(t,e){let n=t;for(const t of e){if(!yo(n))return;n=n[t]}return n}function yo(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function xo(t,e){const n=new Map;for(const e of t)n.set(e.id,new Set);for(const t of e)n.has(t.source)||n.set(t.source,new Set),n.has(t.target)||n.set(t.target,new Set),n.get(t.source).add(t.target),n.get(t.target).add(t.source);return n}function bo(t,e){const n={};for(const e of t)n[e.id]=0;for(const t of e)n[t.source]=(n[t.source]||0)+1,n[t.target]=(n[t.target]||0)+1;return n}function wo(t,e){const n={[e]:0},o=[e];let r=0;for(;o.length>r;){const e=o[r];r+=1;for(const r of t.get(e)||[])void 0===n[r]&&(n[r]=n[e]+1,o.push(r))}return n}function Mo(t,e,n,o){if(n===o)return n?[n]:[];const r=xo(t,e),i={[n]:null},a=[n];let s=0;for(;a.length>s;){const t=a[s];if(s+=1,t===o)break;for(const e of r.get(t)||[])void 0===i[e]&&(i[e]=t,a.push(e))}if(void 0===i[o])return[];const c=[];let l=o;for(;null!=l;)c.unshift(l),l=i[l];return c}function vo(t,e,n,o=1){const r=xo(t,e);if(!r.has(n))return new Set;const i=wo(r,n),a=new Set;for(const t in i)i[t]>o||a.add(t);return a}function ko(t,e){const n=xo(t,e),o={};for(const e of t)o[e.id]=0;for(const e of t.map(t=>t.id)){const r=[],i={},a={},s={};for(const e of t)i[e.id]=[],a[e.id]=0,s[e.id]=-1;a[e]=1,s[e]=0;const c=[e];let l=0;for(;c.length>l;){const t=c[l];l+=1,r.push(t);for(const e of n.get(t)||[])0>s[e]&&(s[e]=s[t]+1,c.push(e)),s[e]===s[t]+1&&(a[e]+=a[t],i[e].push(t))}const u={};for(const e of t)u[e.id]=0;for(;r.length;){const t=r.pop();for(const e of i[t])u[e]+=a[e]/a[t]*(1+u[t]);t!==e&&(o[t]+=u[t])}}for(const t in o)o[t]/=2;return o}function $o(t,e){const n=xo(t,e),o={};for(const e of t){const t=wo(n,e.id);let r=0,i=0;for(const e in t)r+=t[e],i+=1;o[e.id]=r>0?(i-1)/r:0}return o}function Ao(t,e){const n=xo(t,e),o={};for(const e of t){const t=[...n.get(e.id)||[]],r=t.length;if(2>r){o[e.id]=0;continue}let i=0;for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1)n.get(t[e])?.has(t[o])&&(i+=1);o[e.id]=2*i/(r*(r-1))}return o}function So(t){let e=0;for(const n in t)t[n]>e&&(e=t[n]);const n={};for(const o in t)n[o]=e>0?t[o]/e:0;return n}function Co(t,e,n,o={}){const r=xo(t,e),i={};for(const e of t)i[e.id]=wo(r,e.id);let a=o.minHops??4,s=o.startThreshold??.08;const c=o.maxThreshold??.2,l=new Set;let u=0;for(;0===l.size&&40>u;){for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1){const r=t[e].id,c=t[o].id,u=n[r],d=n[c];if(!u||!d)continue;const h=u.x-d.x,f=u.y-d.y;(void 0===i[r][c]?1/0:i[r][c])>=a&&s>Math.sqrt(h*h+f*f)&&(l.add(r),l.add(c))}0===l.size&&(s+=.02,s>c&&(s=o.startThreshold??.08,a=Math.max(2,a-1))),u+=1}return{problemIds:l,threshold:s,minHops:a}}async function zo(t,e,n={}){const{execution:o="auto",signal:r,workerThreshold:a,nodeRadius:s,...c}=n,l=c.iterations??260;if(!g()||!x(o,t.length,e.length,l,a))return i(t,e,{...c,nodeRadius:s});const u={kind:"normalized",nodes:t.map(t=>({...t})),edges:e.map(t=>({...t})),options:c,nodeRadii:"function"==typeof s?Object.fromEntries(t.map(t=>[t.id,s(t)])):null==s?void 0:Object.fromEntries(t.map(t=>[t.id,s]))};try{return(await y(u,r)).positions}catch(n){if("AbortError"===n?.name)throw n;return i(t,e,{...c,nodeRadius:s})}}var No=[.1,.5,.9],Lo=1e6;function Io(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function Wo(t,e,n,o,r){return"function"==typeof o?o(t,e,n):function(t,e){let n=t;for(const t of e.split(".")){if(null==n||"object"!=typeof n)return;n=n[t]}return n}(t,o??r)}function Fo(t){const e=Number(t.toFixed(12));return Object.is(e,-0)?0:e}function To(t,e,n,o){const r=t.flatMap((t,r)=>{const i=Io(Wo(t,r,e,n,"time")),a=Io(Wo(t,r,e,o,"value"));return null==i||null==a?[]:[{time:Fo(i),value:a,index:r}]});r.sort((t,e)=>t.time-e.time||t.index-e.index);const i=[];for(const t of r){const e=i[i.length-1];e?.time===t.time?e.value=t.value:i.push({time:t.time,value:t.value})}return i}function Eo(t,e,n,o){if(!t.length)return null;const r=t[0],i=t[t.length-1];if(r.time>e)return"clamp"===o?r.value:null;if(e>i.time)return"clamp"===o?i.value:null;const a=function(t,e){let n=0,o=t.length;for(;o>n;){const r=n+o>>>1;e>t[r].time?n=r+1:o=r}return n}(t,e),s=t[a];if(s?.time===e)return s.value;const c=t[Math.max(0,a-1)];return"step"!==n&&s&&s.time!==c.time?c.value+(e-c.time)/(s.time-c.time)*(s.value-c.value):c.value}function jo(t,e){if(1===t.length)return t[0];const n=(t.length-1)*e,o=Math.floor(n),r=Math.ceil(n);return o===r?t[o]:t[o]+(t[r]-t[o])*(n-o)}function Ro(t){const e=t.interpolation??"step",n=t.outsideDomain??"omit",o=function(t){const e=(t??No).map(t=>{const e=Io(t);if(null==e||0>e||e>1)throw new RangeError("physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received "+t);return Fo(e)});return Array.from(new Set(e)).sort((t,e)=>t-e)}(t.quantiles),r=function(t){if(Array.isArray(t)){if(t.length>Lo)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(t.map(Io).filter(t=>null!=t).map(Fo))).sort((t,e)=>t-e)}const e=t,n=Io(e.start),o=Io(e.end),r=Io(e.step);if(null==n||null==o||null==r||0>=r||n>o)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");const i=Math.floor((o-n)/r)+1;if(i>Lo)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");const a=[],s=1e-10*Math.max(1,Math.abs(o),Math.abs(n));for(let t=0;i>t;t+=1){const e=n+t*r;if(e>o+s)break;a.push(Fo(Math.min(e,o)))}if(a.length&&s>=Math.abs(a[a.length-1]-o)||a.push(Fo(o)),a.length>Lo)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(a)).sort((t,e)=>t-e)}(t.sampleAt),i=t.runs.map(e=>To(e.samples,e.id,t.timeAccessor,t.valueAccessor));return{points:r.map(t=>{const r=i.map(o=>Eo(o,t,e,n)).filter(t=>null!=t).sort((t,e)=>t-e),a={};for(const t of o)a[t]=r.length?jo(r,t):null;return{time:t,count:r.length,min:r.length?r[0]:null,max:r.length?r[r.length-1]:null,median:r.length?jo(r,.5):null,quantiles:a}}),quantiles:o,interpolation:e,outsideDomain:n,runCount:t.runs.length}}function Oo(t,e){return t.quantiles.length?"lower"===e?t.quantiles[0]:t.quantiles[t.quantiles.length-1]:"lower"===e?"min":"max"}function Po(t,e){if("min"===e||"median"===e||"max"===e)return t[e];const n=Io(e);if(null==n||0>n||n>1)throw new RangeError("comparePhysicsTrace quantile selectors must be from 0 to 1; received "+e);const o=Fo(n);if(!Object.prototype.hasOwnProperty.call(t.quantiles,o))throw Error(`comparePhysicsTrace could not find quantile ${o} in the reference envelope`);return t.quantiles[o]??null}function Do(t,e,n){return e>t?"below":t>n?"above":"inside"}function Bo(t,e){const n=Math.max(0,e.time-t.time);if(0>=n||null==t.value||null==t.lower||null==t.upper||null==e.value||null==e.lower||null==e.upper)return{below:0,inside:0,above:0,observed:0};const o=t.value-t.lower,r=e.value-e.lower,i=t.value-t.upper,a=e.value-e.upper,s=[0,1];for(const[t,e]of[[o,r],[i,a]])(0>t&&e>0||t>0&&0>e)&&s.push(-t/(e-t));s.sort((t,e)=>t-e);let c=0,l=0,u=0;for(let o=0;s.length-1>o;o+=1){const r=s[o],i=s[o+1];if(r>=i)continue;const a=(r+i)/2,d=(i-r)*n,h=Do(t.value+(e.value-t.value)*a,t.lower+(e.lower-t.lower)*a,t.upper+(e.upper-t.upper)*a);"below"===h?c+=d:"above"===h?u+=d:l+=d}return{below:c,inside:l,above:u,observed:n}}function Ho(t,e,n={}){const o=n.interpolation??e.interpolation,r=n.outsideDomain??e.outsideDomain,i=To(t,n.traceId??"trace",n.timeAccessor,n.valueAccessor),a=n.lower??Oo(e,"lower"),s=n.upper??Oo(e,"upper"),c=e.points.map(t=>{const e=Eo(i,t.time,o,r),n=Po(t,a),c=Po(t,s);if(null!=n&&null!=c&&n>c)throw new RangeError("comparePhysicsTrace lower band exceeds upper band at time "+t.time);return{time:t.time,value:e,lower:n,upper:c,status:null==e||null==n||null==c?"unobserved":Do(e,n,c)}});let l=0,u=0,d=0,h=0,f=null,m=0,p=null;for(const t of c){if("below"===t.status?l+=1:"inside"===t.status?u+=1:"above"===t.status&&(d+=1),null==t.value||null==t.lower||null==t.upper)continue;const e=Math.max(0,t.value-t.upper),n=Math.max(0,t.lower-t.value);e>h&&(h=e,f=t.time),n>m&&(m=n,p=t.time)}let g=0,y=0,x=0,b=0;for(let t=0;c.length-1>t;t+=1){const e=c[t],n=c[t+1],r=Math.max(0,n.time-e.time);if(r>0){if("linear"===o){const t=Bo(e,n);g+=t.below,y+=t.inside,x+=t.above,b+=t.observed;continue}"unobserved"!==e.status&&(b+=r,"below"===e.status?g+=r:"above"===e.status?x+=r:y+=r)}}const w=c[0]?.time,M=c[c.length-1]?.time,v=null==w||null==M?0:Math.max(0,M-w);return{points:c,sampleCount:c.length,observedSamples:l+u+d,belowSamples:l,insideSamples:u,aboveSamples:d,totalDuration:v,observedDuration:b,unobservedDuration:Math.max(0,v-b),belowDuration:g,insideDuration:y,aboveDuration:x,peakExcess:h,peakExcessAt:f,peakDeficit:m,peakDeficitAt:p}}function Yo(t){return{id:t,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function Go(t){const e=Array.from(new Set(t.bodyIds??[]));return{stages:t.stages.map(t=>({...t})),bodyIds:e,entities:Object.fromEntries(e.map(t=>[t,Yo(t)]))}}function qo(t,e,n={}){if("region-enter"!==e.type)return t;const o=function(t,e){const n=e.stageId?.(t);if(n)return n;const o=t.region.metadata;if(o&&"object"==typeof o){const t=o.stageId;if("string"==typeof t)return t}return t.region.id}(e,n),r=t.stages.findIndex(t=>t.id===o);if(0>r)return t;const i=n.entityId?.(e)??e.bodyId;if(!i)return t;const a=t.entities[i]??Yo(i),s=a.currentStageId?t.stages.findIndex(t=>t.id===a.currentStageId):-1,c=!a.visitedStageIds.includes(o),l=Number(e.observation.timestamp),u=Number.isFinite(l)?l:0,d={...a,currentStageId:o,furthestStageId:r>a.furthestStageIndex?o:a.furthestStageId,furthestStageIndex:Math.max(a.furthestStageIndex,r),visitedStageIds:c?[...a.visitedStageIds,o]:a.visitedStageIds,visitsByStage:{...a.visitsByStage,[o]:(a.visitsByStage[o]??0)+1},firstEnteredAt:c?{...a.firstEnteredAt,[o]:u}:a.firstEnteredAt,lastEnteredAt:{...a.lastEnteredAt,[o]:u},regressionCount:s>=0&&s>r?a.regressionCount+1:a.regressionCount};return{...t,bodyIds:t.bodyIds.includes(i)?t.bodyIds:[...t.bodyIds,i],entities:{...t.entities,[i]:d}}}function Xo(t){const e=t.bodyIds.map(e=>t.entities[e]??Yo(e)),n=e.length;let o=n;return t.stages.map((t,r)=>{const i=e.filter(t=>t.furthestStageIndex>=r).length,a=e.filter(e=>e.visitedStageIds.includes(t.id)).length,s=e.reduce((e,n)=>e+(n.visitsByStage[t.id]??0),0),c={id:t.id,label:t.label??t.id,reached:i,entered:a,total:n,conversion:n>0?i/n:0,fromPrevious:o>0?i/o:0,dropoff:Math.max(0,o-i),visits:s,repeatVisits:Math.max(0,s-a)};return o=i,c})}import{Fragment as Vo,jsx as _o,jsxs as Ko}from"react/jsx-runtime";var Uo={flow:{fill:"rgba(59, 130, 246, 0.14)",stroke:"rgba(96, 165, 250, 0.7)",accent:"#60a5fa"},capacity:{fill:"rgba(251, 146, 60, 0.18)",stroke:"rgba(251, 146, 60, 0.85)",accent:"#fb923c"},portal:{fill:"rgba(244, 114, 182, 0.14)",stroke:"rgba(244, 114, 182, 0.7)",accent:"#f472b6"},absorb:{fill:"rgba(52, 211, 153, 0.18)",stroke:"rgba(52, 211, 153, 0.8)",accent:"#34d399"}};function Zo(t,e,n){return Math.max(e,Math.min(n,t))}function Qo(t){return 6.2*t.length}function Jo(t,e){const n=t.trim();if(e>=n.length)return n;if(1>=e)return n.slice(0,1);const o=n.split(/\s+/).filter(Boolean).map(t=>t[0]).join("").toUpperCase();return o.length>1&&e>=o.length?o:e>3?n.slice(0,Math.max(1,e-2))+"..":n.slice(0,e).toUpperCase()}function tr(t,e,n="auto"){const o=Math.max(1,Math.floor(e/6.2)),r="compact"===n?Jo(t,o):"full"===n?t:Qo(t)>e?Jo(t,o):t;return{text:r,textLength:Qo(r)>e?Math.max(4,e):void 0}}function er(t,e={}){const{showFlowSpine:n=!0,showStageCounts:o=!0,showCapacityBadges:r=!0,showGroupSockets:i=!0,stageLabelMode:a="auto",outlineStages:s=!1,testId:c="process-flow-chrome"}=e,{width:l,height:u,left:d,right:h,topY:f,bottomY:m,midY:p,stages:g,groups:y=[]}=t,x=m-f;return Ko("svg",{"aria-hidden":"true","data-testid":c,"data-outline-stages":s?"true":void 0,width:l,height:u,viewBox:`0 0 ${l} ${u}`,style:{position:"absolute",inset:0,pointerEvents:"none"},className:["semiotic-process-chrome",s?"semiotic-process-chrome--outline-stages":null].filter(Boolean).join(" "),children:[_o("defs",{children:Ko("linearGradient",{id:"semiotic-process-floor",x1:"0",x2:"0",y1:"0",y2:"1",children:[_o("stop",{offset:"0%",stopColor:"var(--semiotic-process-floor, var(--semiotic-bg, #0f172a))",stopOpacity:"0.2"}),_o("stop",{offset:"100%",stopColor:"var(--semiotic-process-lane, var(--semiotic-surface, #1e293b))",stopOpacity:"0.55"})]})}),_o("rect",{x:0,y:0,width:l,height:u,fill:"url(#semiotic-process-floor)"}),_o("rect",{x:d-6,y:f-8,width:h-d+12,height:x+16,rx:14,fill:"var(--semiotic-process-lane, var(--semiotic-surface, #111827))",fillOpacity:.45,stroke:"var(--semiotic-process-border, var(--semiotic-border, #334155))",strokeOpacity:.95}),n?_o("line",{x1:d+8,x2:h-8,y1:p,y2:p,stroke:"var(--semiotic-process-border, var(--semiotic-border, #475569))",strokeWidth:2,strokeDasharray:"6 8",opacity:.55}):null,g.map((t,e)=>{const n=function(t){return t.absorb?"absorb":t.portalTarget?"portal":null!=t.capacity?"capacity":"flow"}(t),i=Uo[n],c=Math.max(12,t.width-8),l=Zo(c-8,22,88),d=tr(t.label,Math.max(8,l-10),a),h="none"!==a&&c-8>=22,y=function(t){if(null!=t.capacity){const e=null!=t.queueDepth?" · q "+t.queueDepth:"";return t.capacityLabel?`${t.capacityLabel}${e}`:`cap ${Number.isInteger(t.capacity)?t.capacity+"":t.capacity.toFixed(1)}${e}`}return t.absorb?"absorb":t.portalTarget?"portal":"flow"}(t),b=tr(y,Math.max(16,c-10),"auto"),w=r&&!1!==t.showBadge&&c>=32,M=null!=t.count?`n=${t.count}${null!=t.processed?" done "+t.processed:""}`:"",v=tr(M,Math.max(16,c-8),"auto"),k=Math.max(30,f-15),$=k-13;return Ko("g",{"data-stage":t.id,"data-role":n,children:[_o("rect",{className:"semiotic-process-chrome__stage-bay",x:t.x0+4,y:f+6,width:c,height:x-12,rx:10,fill:s?"none":i.fill,stroke:i.stroke,strokeWidth:s?1.85:"flow"===n?1:1.6}),g.length-1>e?_o("polygon",{points:`${t.x1-2},${p-7} ${t.x1+8},${p} ${t.x1-2},${p+7}`,fill:i.accent,opacity:.85}):null,h?Ko(Vo,{children:[_o("rect",{className:"semiotic-process-chrome__stage-label-bg",x:t.x-l/2,y:$,width:l,height:18,rx:9,fill:"var(--semiotic-bg, #0f172a)",fillOpacity:.75,stroke:i.stroke}),Ko("text",{x:t.x,y:k,textAnchor:"middle",fill:i.accent,fontSize:10,fontWeight:800,className:"semiotic-process-chrome__stage-label",textLength:d.textLength,lengthAdjust:d.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:t.label}),d.text]})]}):null,w?Ko("text",{x:t.x,y:f+22,textAnchor:"middle",fill:"var(--semiotic-process-muted, var(--semiotic-text-secondary, #94a3b8))",fontSize:9,fontWeight:700,textLength:b.textLength,lengthAdjust:b.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:y}),b.text]}):null,o&&null!=t.count?Ko("text",{x:t.x,y:Math.min(u-8,m+16),textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #e2e8f0))",fontSize:11,fontWeight:800,textLength:v.textLength,lengthAdjust:v.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:M}),v.text]}):null]},t.id)}),i?y.map((t,e)=>{const n=t.total??0,o=t.absorbed??0,r=t.complete??(n>0&&o>=n),i=!r&&n>0&&o/n>=.75,a=r?"rgba(52, 211, 153, 0.35)":i?"rgba(251, 191, 36, 0.28)":"rgba(15, 23, 42, 0.75)",s=r?"#34d399":i?"#fbbf24":"var(--semiotic-border, #64748b)",c=n>0?`${o}/${n}${r?" shipped":i?" almost":""}`:"feature "+(e+1),l=Zo(Math.max(54,Qo(t.label)+18,Qo(c)+16),54,104),u=tr(t.label,l-12,"auto"),d=tr(c,l-12,"auto");return Ko("g",{"data-group":t.id,children:[_o("rect",{x:t.x-l/2,y:t.y-22,width:l,height:44,rx:10,fill:a,stroke:s,strokeWidth:1.5}),Ko("text",{x:t.x,y:t.y-4,textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #f8fafc))",fontSize:10,fontWeight:800,textLength:u.textLength,lengthAdjust:u.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:t.label}),u.text]}),Ko("text",{x:t.x,y:t.y+12,textAnchor:"middle",fill:s,fontSize:9,fontWeight:700,textLength:d.textLength,lengthAdjust:d.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:c}),d.text]})]},t.id)}):null]})}function nr(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function or(t,e,n,o){const r="function"==typeof t?t(e,n):t;return Number.isFinite(r)?Number(r):o}function rr(t,e,n){return nr(t[e])??n}function ir(t,e){return"number"==typeof t?t:t?.[e]??0}function ar(t){const{band:e,idPrefix:n,plot:o,projection:r}=t,{includeBoundaryWalls:i=!0,includeInteriorWalls:a=!0,wallThickness:s=4}=e,c=function(t){const e=t.bandwidth??t.scale.bandwidth?.()??0,n=new Set;for(const o of t.values){const r=t.scale(o);Number.isFinite(r)&&(n.add(Number(r)),n.add(Number(r)+e))}return Array.from(n).sort((t,e)=>t-e)}(e);if(2>c.length)return[];const l=i?c.length-1:c.length-2,u=[];for(let t=i?0:1;l>=t;t+=1){if(!a&&t>0&&c.length-1>t)continue;const e=c[t];u.push({id:`${n}-wall-${t}`,shape:"x"===r?{type:"aabb",x:e,y:o.y+o.height/2,width:s,height:o.height}:{type:"aabb",x:o.x+o.width/2,y:e,width:o.width,height:s}})}return u}function sr(t){const{plot:e,idPrefix:n="physics-scale",bounds:o={},xBins:r,xBands:i,yBands:a}=t,s=[];if(!1!==o&&s.push(...b(e,{idPrefix:n,...o})),r){const{idPrefix:t,yTop:o,yBottom:i,...a}=r;s.push(...w({...a,idPrefix:t??n+"-xbin",yTop:o??e.y,yBottom:i??e.y+e.height}))}return i&&s.push(...ar({band:i,idPrefix:i.idPrefix??n+"-xband",plot:e,projection:"x"})),a&&s.push(...ar({band:a,idPrefix:a.idPrefix??n+"-yband",plot:e,projection:"y"})),s}function cr(t){const{plot:e,rows:n,columns:o=n+1,pegRadius:r=3,idPrefix:i="galton-peg",yStart:a=e.y+.18*e.height,yEnd:s=e.y+.58*e.height,stagger:c=!0,restitution:l=.2,friction:u=.04}=t,d=Math.max(0,Math.floor(n)),h=Math.max(1,Math.floor(o));if(0===d)return[];const f=d>1?(s-a)/(d-1):0,m=e.width/h,p=[];for(let t=0;d>t;t+=1){const n=c&&t%2==1?m/2:0;for(let o=0;h>o;o+=1){const s=e.x+m*(o+.5)+n;e.x+r>s||s>e.x+e.width-r||p.push({id:`${i}-${t}-${o}`,shape:{type:"aabb",x:s,y:a+t*f,width:2*r,height:2*r},restitution:l,friction:u})}}return p}function lr(t,e={}){const{idPrefix:n="physics-token",radius:o=5,shape:r,mass:i,vx:a,vy:s,spawnAt:c,seed:l=1,jitter:u,datum:d}=e,h=v(l),f=ir(u,"x"),m=ir(u,"y");return t.map((t,l)=>{const u=or(e.x,t,l,rr(t,"x",0)),p=or(e.y,t,l,rr(t,"y",0)),g=or(o,t,l,5),y="function"==typeof r?r(t,l):r??{type:"circle",radius:g};return{id:`${n}-${t.index??l}`,x:u+(h()-.5)*f,y:p+(h()-.5)*m,vx:or(a,t,l,0),vy:or(s,t,l,0),mass:or(i,t,l,1),spawnAt:or(c,t,l,void 0),shape:y,datum:d?d(t,l):t.datum??t}}).map(t=>{if(Number.isFinite(t.spawnAt))return t;const{spawnAt:e,...n}=t;return n})}function ur(t,e={}){const{idPrefix:n="sediment",collider:o=!0,colliderThickness:r=1,restitution:i=.05,friction:a=.2,...s}=e,c=M(t,s),l=o?c.filter(t=>t.height>0).map(t=>({id:`${n}-${t.binId}`,shape:{type:"aabb",x:t.x+t.width/2,y:t.y+r/2,width:t.width,height:r},restitution:i,friction:a})):[];return{columns:c,colliders:l}}function dr(t,e={}){const{timeAccessor:n="arrivalTime",timeScale:o=1,startAt:r=0,rebase:i=!0,sort:a=!0}=e,s=t.map((t,e)=>({spawn:t,time:function(t,e,n){return nr("function"==typeof n?n(t,e):t[n]??t.datum?.[n])}(t,e,n)??t.spawnAt??e})),c=s.length?Math.min(...s.map(t=>t.time)):0;return{initialSpawns:s.map(({spawn:t,time:e})=>({...t,spawnAt:r+(i?e-c:e)})).sort((t,e)=>a?(t.spawnAt??0)-(e.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:r,timeAccessor:"spawnAt",timeScale:o}}}function hr(t,e,n="group"){const o=bo(t,e),r=t=>"function"==typeof n?n(t):t[n]??0;return t.slice().sort((t,e)=>{const n=r(t),i=r(e);return i>n?-1:n>i?1:(o[e.id]||0)-(o[t.id]||0)}).map(t=>t.id)}function fr(t,e={}){const n=e.baseline??.62,o=e.inset??.06,r={},i=t.length;return t.forEach((t,e)=>{r[t]={x:i>1?o+e/(i-1)*(1-2*o):.5,y:n}}),r}function mr(t,e,n=.55){return`M${t.x},${t.y} Q${(t.x+e.x)/2},${t.y-Math.abs(e.x-t.x)*n} ${e.x},${e.y}`}function pr(t,e={}){const n=e.radius??.42,o=e.center?.x??.5,r=e.center?.y??.5,i=e.startAngle??0,a={},s=t.length;return t.forEach((t,e)=>{const c=i+e/s*Math.PI*2-Math.PI/2;a[t]={x:o+Math.cos(c)*n,y:r+Math.sin(c)*n}}),a}function gr(t,e,n={}){const o=(n.order??hr(t,e,n.groupAccessor??"group")).slice(),r=new Map(o.map((t,e)=>[t,e])),i=new Map;for(const t of e){if(!r.has(t.source)||!r.has(t.target)||t.source===t.target)continue;const e=t.target>t.source?`${t.source}\0${t.target}`:`${t.target}\0${t.source}`;i.set(e,(i.get(e)||0)+(t.value??1))}const a=[];let s=0;for(const[t,e]of i){const[n,o]=t.split("\0"),i=r.get(n),c=r.get(o);e>s&&(s=e),a.push({row:i,col:c,source:n,target:o,value:e}),a.push({row:c,col:i,source:o,target:n,value:e})}return{order:o,cells:a,size:o.length,maxValue:s}}function yr(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function xr(t){if("string"!=typeof t)return;const e=t.trim();return e.length?e:void 0}function br(t,e){const n=yr(t.note)?t.note:void 0;return e?xr(t.mobileText)||xr(t.shortText)||xr(t.label)||xr(n?.mobileText)||xr(n?.shortText)||xr(n?.label)||xr(n?.title):xr(t.label)||xr(t.mobileText)||xr(t.shortText)||xr(n?.label)||xr(n?.title)}function wr(t,e,n){const o=function(t,e,n){if(!n)return;const o="function"==typeof n?n(t,e):t[n];return"number"==typeof o&&Number.isFinite(o)?o:void 0}(t,e,n.priorityAccessor);if(void 0!==o)return o;let r=1e3-e;const i=((t.emphasis??"")+"").toLowerCase();"primary"!==i&&"critical"!==i||(r+=1e4),"secondary"===i&&(r-=1e3),"high"===t.priority&&(r+=5e3),"low"===t.priority&&(r-=1500),"number"==typeof t.priority&&(r+=100*t.priority);const a=yr(t.provenance)?t.provenance:void 0;"number"==typeof a?.confidence&&(r+=100*a.confidence);const s=yr(t.lifecycle)?t.lifecycle:void 0,c=((s?.freshness??"")+"").toLowerCase();return"expired"!==c&&"stale"!==c||(r-=3e3),r}function Mr(t,e){if(!e)return t;const n=br(t,!0);return n&&"string"==typeof t.label?{...t,label:n}:t}function vr(t,e={}){const n=Array.isArray(t)?t.filter(yr):[],o=e.active??(null==e.width||(e.breakpoint??480)>=e.width),r=e.strategy??"hybrid",i=!1!==e.preferShortText,a=!1!==e.preservePrimary,s=Math.max(0,e.maxPlotAnnotations??e.maxAnnotations??("callout-list"===r?1:2)),c=Math.max(0,e.minPlotAnnotations??e.minVisible??1);if(!o||"plot"===r)return{active:o,strategy:r,budget:n.length,visible:i?n.map(t=>Mr(t,i)):n,deferred:[],calloutList:[],hidden:[]};const l=[],u=n.map((t,n)=>({annotation:t,index:n,priority:wr(t,n,e)})).filter(t=>!!C(t.annotation)||(l.push(t.annotation),!1)).sort((t,e)=>e.priority-t.priority),d=a?u.filter(t=>"primary"===((t.annotation.emphasis??"")+"").toLowerCase()):[],h=new Set(d.map(t=>t.index)),f=u.filter(t=>!h.has(t.index)),m=[...d,...f].slice(0,Math.max(s,c)),p=new Set(m.map(t=>t.index)),g=u.filter(t=>!p.has(t.index)),y=[...l,...m.sort((t,e)=>t.index-e.index).map(t=>Mr(t.annotation,i))],x=g.sort((t,e)=>t.index-e.index).map(t=>t.annotation),b=Math.max(0,e.maxCalloutItems??6),w=g.filter(t=>!e.calloutFilter||e.calloutFilter(t.annotation,t.index)).map(t=>function(t,e,n,o){const r=br(t,o);if(!r)return null;const i=xr(t.id)||xr(t.key)||xr(t.pointId)||"annotation-"+(e+1),a=yr(t.provenance)?xr(t.provenance.source)||xr(t.provenance.authorKind):void 0;return{id:i,label:r,shortLabel:xr(t.shortText),pointId:t.pointId,emphasis:"string"==typeof t.emphasis?t.emphasis:void 0,source:a,priority:n,annotation:t}}(t.annotation,t.index,t.priority,i)).filter(t=>!!t).slice(0,b),M=new Set(w.map(t=>t.annotation)),v=x.filter(t=>!M.has(t));return{active:o,strategy:r,budget:s,visible:y,deferred:x,calloutList:w,hidden:v}}function kr(t){return"dense"===t.density?.75:"compact"===t.density?.9:1}function $r(t,e){const n=!1!==e.keepAxes,o=!1===e.directLabel?12:28;return"ordinal"===t?{top:12,right:o,bottom:n?44:12,left:n?48:12}:"geo"===t||"network"===t?{top:12,right:12,bottom:12,left:12}:{top:12,right:o,bottom:n?42:14,left:n?44:14}}function Ar(t,e,n,o={}){const r={...n},i={mode:!1===e.mode?void 0:"mobile",...r,margin:$r(t,e),...o},a=Object.fromEntries(Object.entries(r).filter(([,t])=>void 0!==t)),s=Object.fromEntries(Object.entries(i).filter(([,t])=>void 0!==t)),c=function(t,e){const n=e.targetSize??44,o=[],r=e.standardControls,i=t=>!0===r||"all"===r||r===t||Array.isArray(r)&&r.includes(t);return i("brush")&&o.push("range-inputs","clear-brush"),i("zoom")&&o.push("zoom-buttons","reset-view"),i("legend")&&o.push("legend-chips","show-all-series"),{strategy:`${t}-${e.transformProfile??"overview"}-mobile-recipe`,supportsResponsiveLayout:!0,breakpoints:[320,360,390,430,e.breakpoint??480,768],maxAnnotations:e.maxAnnotations??2,minimumHitTarget:n,summary:e.summary??!0,interaction:{primary:"tap",hoverFallback:"tap-to-lock",targetSize:n,...o.length>0&&{alternatives:o}},labels:{strategy:!1===e.directLabel?"compact":"direct",minFontSize:12}}}(t,e),l=function(t){return{tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:t.targetSize??44,snap:t.snap??"nearestDatum",brushHandleSize:t.targetSize??44,standardControls:t.standardControls??!1}}(e);return{family:t,props:a,responsiveRules:[{id:t+"-mobile",description:`Apply Semiotic's mobile ${t} recipe at phone width.`,when:{maxWidth:e.breakpoint??480},transform:{...s,mobileInteraction:l,mobileSemantics:c}}],mobileInteraction:l,mobileSemantics:c}}function Sr(t={}){const e=kr(t);return Ar("line",t,{showLegend:t.showLegend??!1,directLabel:t.directLabel??!0,lineWidth:"inspect"===t.transformProfile?3:Math.max(1.5,2.5*e),showPoints:"inspect"===t.transformProfile,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Cr(t={}){const e=kr(t);return Ar("area",t,{showLegend:t.showLegend??!1,showPoints:!1,areaOpacity:"compare"===t.transformProfile?.55:.42,lineWidth:Math.max(1.25,2*e),autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function zr(t={}){return Ar("ordinal",t,{showLegend:t.showLegend??!1,showCategoryTicks:t.keepAxes??!0,sort:"compare"===t.transformProfile?"desc":void 0},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Nr(t={}){const e=kr(t);return Ar("scatter",t,{showLegend:t.showLegend??!1,pointRadius:Math.max(4,Math.round((t.targetSize??44)/8*e)),hoverRadius:Math.ceil((t.targetSize??44)/2),pointOpacity:"dense"===t.density?.42:.68,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??1,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Lr(t={}){const e=kr(t);return Ar("network",t,{showLegend:t.showLegend??!1,nodeSizeRange:[Math.max(4,Math.round(6*e)),Math.max(12,Math.round((t.targetSize??44)/2*e))],showLabels:"inspect"===t.transformProfile,edgeOpacity:"dense"===t.density?.28:.44})}function Ir(t={}){return Ar("geo",t,{showLegend:t.showLegend??!1})}function Wr(t={}){return Ar("small-multiple",t,{mobileColumns:t.mobileColumns??1,tabletColumns:t.tabletColumns??2,chartHeight:t.chartHeight??180,sharedExtent:!0})}function Fr(t,e={}){switch(t){case"line":return Sr(e);case"area":return Cr(e);case"ordinal":return zr(e);case"scatter":return Nr(e);case"network":return Lr(e);case"geo":return Ir(e);case"small-multiple":return Wr(e)}}function Tr(t={}){const e=t.controls??["range-inputs","chip-filter","clear"];return{mobileInteraction:{enabled:!0,targetSize:t.targetSize??44,tapToSelect:!0,tapToLockTooltip:!0,standardControls:"brush"},mobileSemantics:{interaction:{primary:"filter",alternatives:e,summary:t.summary??"Expose brushable ranges through touch-sized controls in addition to drag gestures."}},controls:e}}export{z as waffleLayout,N as allocateCells,L as isotypeInk,I as isotypePaper,W as isotypeGhost,F as isotypeServerGlyph,T as isotypeChipGlyph,E as isotypeBoltGlyph,j as isotypeBusGlyph,R as isotypePersonPath,O as isotypePersonGlyph,P as isotypeNetworkGlyphs,U as tokenLayer,J as calendarLayout,rt as DEFAULT_ISOMETRIC_SPRITE_SIZES,ft as selectIsometricLandmarks,mt as isometricLandmarkLayout,wt as flextreeLayout,Mt as dagreLayout,Ct as lineageDagLayout,Ft as mermaidDagLayout,jt as roundedEnclosure,Rt as boundsOf,Ot as hullFromBoxes,Pt as bandLabel,Dt as hatchFill,Bt as linearAxis,Ht as markCallout,qt as analyzeNetEnsemble,te as netEnsembleLayout,se as packedClusterMatrix,de as marimekkoLayout,me as bulletLayout,ye as parallelCoordinatesLayout,Le as bobaLayout,Ie as GRID_FUEL_KEYS,We as GRID_FUEL_LABELS,Ee as stackFuelSeries,je as demandForecastRows,Re as reserveMarginPct,Oe as reserveSeries,Pe as thresholdBandsForReserve,De as reserveAnnotationBands,Be as summarizeOperatingPoint,He as gridEventAnnotations,Ye as tightestHours,Ge as formatMw,qe as formatReservePct,_e as packIntervals,Ke as activeCountOverDomain,Ze as intervalLanesLayout,Qe as curvedEdgePath,Je as orthogonalEdgePath,tn as boxEdgeAnchors,en as fanOutBend,nn as cubicPoint,on as cubicTangent,rn as cubicPath,an as rectCollide,ln as axisFixedForcePositions,un as axisFixedForceLayout,dn as wordTrailsProgressiveReveal,wn as wordTrailsLayout,kn as DEFAULT_HIT_RADIUS,An as hitTargetPoint,Sn as geoHitTarget,Cn as geoAreaHitTarget,zn as hitTargetRect,Nn as networkHitTarget,Ln as runs,In as runLengthEncode,Wn as wrapValue,Fn as shortestArcDelta,Tn as cyclicRangeContains,En as selectCyclicRange,jn as layoutSequence,Rn as layoutChipStrip,On as estimateLabelWidth,Pn as packSpanLevels,Dn as scaleArcBand,Bn as spanArcPath,Hn as spanArcPeakY,Yn as partitionSharedEdges,qn as TAU,Xn as polarToXY,Vn as xyToAngle,_n as angleScale,Kn as radiusScale,Un as ringArcPath,Qn as addPoints,Jn as subtractPoints,to as scalePoint,eo as pointMagnitude,no as normalizePoint,so as legendGroupsFrom,co as legendSwatches,ho as extractTooltipDatum,fo as buildTooltipEntries,mo as formatTooltipValue,xo as buildAdjacency,bo as degree,wo as bfsDistances,Mo as shortestPath,vo as egoNetwork,ko as betweenness,$o as closeness,Ao as clustering,So as normalizeScores,Co as proximityProblem,zo as forceLayoutAsync,Ro as physicsReferenceEnvelope,Ho as comparePhysicsTrace,Go as createProcessJourneyLedger,qo as updateProcessJourney,Xo as processJourneyRows,er as processChrome,sr as collidersFromScales,cr as galtonPegs,lr as spawnFromTokens,ur as sedimentBake,dr as arrivalReplay,hr as orderByGroupDegree,fr as arcLayout,mr as arcPath,pr as circularLayout,gr as adjacencyMatrix,vr as mobileAnnotationStrategy,Sr as mobileLineChartRecipe,Cr as mobileAreaChartRecipe,zr as mobileOrdinalChartRecipe,Nr as mobileScatterplotRecipe,Lr as mobileNetworkChartRecipe,Ir as mobileGeoChartRecipe,Wr as mobileSmallMultipleRecipe,Fr as mobileChartFamilyRecipe,Tr as mobileBrushAlternatives};
|