semiotic 3.8.2 → 3.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +9 -9
- package/README.md +42 -40
- package/ai/examples.md +1 -1
- package/ai/schema.json +2726 -300
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +1 -0
- package/dist/{chunk-chunk-NO4MCQVD.module.min.js → chunk-chunk-5RKXZQ2P.module.min.js} +1 -1
- package/dist/{chunk-chunk-CYIML3AV.module.min.js → chunk-chunk-6TPGFL7M.module.min.js} +1 -1
- package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
- package/dist/chunk-chunk-7KZJUTKP.module.min.js +2 -0
- package/dist/chunk-chunk-7RYBCTK5.module.min.js +1 -0
- package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +1 -0
- package/dist/{chunk-chunk-ZLKRTF5N.module.min.js → chunk-chunk-AQPQN2HH.module.min.js} +1 -1
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +1 -0
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +2 -0
- package/dist/chunk-chunk-BFHUYEOS.module.min.js +2 -0
- package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
- package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
- package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
- package/dist/chunk-chunk-F5V4UIE6.module.min.js +2 -0
- package/dist/chunk-chunk-F7WFPD4O.module.min.js +2 -0
- package/dist/chunk-chunk-FBGHXL72.module.min.js +2 -0
- package/dist/chunk-chunk-FP44FHFO.module.min.js +2 -0
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +2 -0
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +2 -0
- package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
- package/dist/{chunk-chunk-7LHMKRKE.module.min.js → chunk-chunk-JDXT6ORT.module.min.js} +1 -1
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +1 -0
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +1 -0
- package/dist/chunk-chunk-KQ546MKE.module.min.js +2 -0
- package/dist/chunk-chunk-LQBSXO7K.module.min.js +2 -0
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +1 -0
- package/dist/chunk-chunk-N6VKKF3A.module.min.js +2 -0
- package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +2 -0
- package/dist/chunk-chunk-PLIDPQNG.module.min.js +2 -0
- package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +1 -0
- package/dist/chunk-chunk-RP7WTID5.module.min.js +1 -0
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +1 -0
- package/dist/chunk-chunk-SR4ZXOWR.module.min.js +2 -0
- package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
- package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
- package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
- package/dist/components/ChartContainer.d.ts +2 -2
- package/dist/components/ai/chartCapabilityTypes.d.ts +5 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +7 -3
- package/dist/components/charts/geo/FlowMap.d.ts +4 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
- package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
- package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
- package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
- package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -6
- package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +11 -0
- package/dist/components/charts/shared/areaSeriesData.d.ts +15 -0
- package/dist/components/charts/shared/chartMode.d.ts +75 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
- package/dist/components/charts/shared/colorUtils.d.ts +8 -0
- package/dist/components/charts/shared/geoStyleDefaults.d.ts +3 -0
- package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
- package/dist/components/charts/shared/hooks.d.ts +13 -80
- package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
- package/dist/components/charts/shared/types.d.ts +2 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useXYLineStyle.d.ts +3 -2
- package/dist/components/charts/shared/validateProps.d.ts +1 -1
- package/dist/components/charts/shared/xyLineStyle.d.ts +21 -0
- package/dist/components/charts/xy/AreaChart.d.ts +10 -0
- package/dist/components/charts/xy/LineChart.d.ts +3 -0
- package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
- package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
- package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
- package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
- package/dist/components/legendLayout.d.ts +31 -0
- package/dist/components/realtime/types.d.ts +5 -0
- package/dist/components/recipes/gridObservatory.d.ts +176 -0
- package/dist/components/recipes/recipeChrome.d.ts +24 -0
- package/dist/components/recipes/sequenceLayout.d.ts +139 -0
- package/dist/components/semiotic-recipes-core.d.ts +6 -2
- package/dist/components/server/serverChartConfigShared.d.ts +29 -0
- package/dist/components/server/serverChartConfigs.d.ts +2 -13
- package/dist/components/server/serverChartConfigsXY.d.ts +3 -0
- package/dist/components/server/serverGaugeOverlay.d.ts +28 -0
- package/dist/components/server/staticAnnotations.d.ts +3 -1
- package/dist/components/server/staticLegend.d.ts +7 -1
- package/dist/components/server/staticSVGChrome.d.ts +57 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +2 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +2 -0
- package/dist/components/stream/SceneToSVG.d.ts +10 -8
- package/dist/components/stream/SceneToSVGGeo.d.ts +10 -0
- package/dist/components/stream/SceneToSVGNetwork.d.ts +12 -0
- package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
- package/dist/components/stream/canvasBackground.d.ts +7 -0
- package/dist/components/stream/networkFramePaint.d.ts +2 -0
- package/dist/components/stream/networkTypes.d.ts +2 -4
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
- package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
- package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
- package/dist/components/stream/renderBackend.d.ts +14 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +80 -0
- package/dist/components/stream/types.d.ts +4 -0
- package/dist/components/stream/useHydration.d.ts +7 -1
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
- package/dist/components/types/legendTypes.d.ts +16 -3
- package/dist/forceLayoutWorker.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +6 -2
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
- package/dist/chunk-chunk-27HVVXS6.module.min.js +0 -1
- package/dist/chunk-chunk-2UN3ANRN.module.min.js +0 -2
- package/dist/chunk-chunk-2VUEY5TH.module.min.js +0 -1
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
- package/dist/chunk-chunk-5WEFWNUW.module.min.js +0 -2
- package/dist/chunk-chunk-6F6GEAQU.module.min.js +0 -1
- package/dist/chunk-chunk-BHYTYMY2.module.min.js +0 -2
- package/dist/chunk-chunk-C6EJ4IOD.module.min.js +0 -2
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
- package/dist/chunk-chunk-DNY43POY.module.min.js +0 -1
- package/dist/chunk-chunk-E7MIQX7D.module.min.js +0 -2
- package/dist/chunk-chunk-ES4DCG3L.module.min.js +0 -1
- package/dist/chunk-chunk-FAKO3RGQ.module.min.js +0 -2
- package/dist/chunk-chunk-H4PPRW6N.module.min.js +0 -1
- package/dist/chunk-chunk-IFYPMWKY.module.min.js +0 -1
- package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
- package/dist/chunk-chunk-L6D3I3V7.module.min.js +0 -2
- package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
- package/dist/chunk-chunk-ODUZEEBH.module.min.js +0 -2
- package/dist/chunk-chunk-P6UBCMSQ.module.min.js +0 -2
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
- package/dist/chunk-chunk-RH5TSQPH.module.min.js +0 -1
- package/dist/chunk-chunk-STZFFTAN.module.min.js +0 -2
- package/dist/chunk-chunk-T27ZEV6A.module.min.js +0 -1
- package/dist/chunk-chunk-U3AGQ5EF.module.min.js +0 -2
- package/dist/chunk-chunk-W3DB2MN4.module.min.js +0 -2
- package/dist/chunk-chunk-WDIN4LRC.module.min.js +0 -1
- package/dist/chunk-chunk-XOYX77KF.module.min.js +0 -2
- package/dist/chunk-chunk-Z5KXAVQD.module.min.js +0 -2
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
- package/dist/chunk-chunk-ZTNVDWAK.module.min.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{getMinMax as e}from"./chunk-chunk-JJ2OOIET.module.min.js";import{createStore as t,useTheme as n,useThemeSelector as r}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphFractionClipRect as o,glyphPlacement as i,resolveGlyphPaint as a}from"./chunk-chunk-KTWEBFMX.module.min.js";import{useHydrationLifecycle as s}from"./chunk-chunk-ACLDBMRH.module.min.js";import{useReducedMotion as l}from"./chunk-chunk-YHNZCPOZ.module.min.js";var c={fresh:1,aging:1.5,stale:3};function u(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}function d(e,t,n){if(null!=e)return"function"==typeof e?e(t,n):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function h(e){const{data:t,encoding:n}=e,r=[],o=new Map;return t.forEach((e,t)=>{const i=d(n.id,e,t);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const a=i+"";if(o.has(a))throw Error(`[semiotic] Duplicate motion encoding id "${a}".`);const s=d(n.process?.group,e,t),l=d(n.process?.stage,e,t),c=d(n.accessible?.group,e,t)??(null!=s?s+"":null!=l?l+"":void 0),u={};for(const r of Object.keys(n.evidence??{}))u[r]=d(n.evidence?.[r],e,t);const h={id:a,datum:e,time:{arrival:d(n.time?.arrival,e,t),basis:n.time?.basis,unit:n.time?.unit},placement:{x:d(n.placement?.x,e,t),y:d(n.placement?.y,e,t),lane:d(n.placement?.lane,e,t),space:n.placement?.space},kinematics:{velocityX:d(n.kinematics?.velocityX,e,t),velocityY:d(n.kinematics?.velocityY,e,t),space:n.kinematics?.space},process:{group:s,stage:l,target:d(n.process?.target,e,t),work:d(n.process?.work,e,t)},evidence:u,accessible:{description:d(n.accessible?.description,e,t),group:c,label:d(n.accessible?.label,e,t)??a}};r.push(h),o.set(a,h)}),{rows:r,byId:o}}function f(e){const t=e.now-e.arrival;return{age:t,progress:Number.isFinite(t)&&Number.isFinite(e.ttl)&&e.ttl>0?Math.max(0,t)/e.ttl:t===1/0&&Number.isFinite(e.ttl)&&e.ttl>0?1/0:0,lifecycle:u(t,e.ttl,e.thresholds)}}function y(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}function p(e,t){const n=Number.isFinite(e)?e:0,r=Number.isFinite(t)?t:0;return{velocityX:n,velocityY:r,speed:Math.hypot(n,r),direction:Math.atan2(r,n)}}function m(e,t,n){return Number.isFinite(n)&&n>0?p((t.x-e.x)/n,(t.y-e.y)/n):p(0,0)}function g(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var b=null;function x(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:a=45}=e,s={background:n,stroke:r,lineWidth:o,spacing:i,angle:a},l=Math.max(8,Math.ceil(2*i));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(b||(b=document.createElement("canvas")),b.width=e,b.height=e,b)}(l)}catch{return g(s)}const u=c.getContext("2d");if(!u)return g(s);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=r,u.lineWidth=o,u.lineCap="square";const d=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-l;2*l>=t;t+=i)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(d);const e=2*l;for(let t=-e;e>=t;t+=i)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}import{jsx as v,jsxs as k}from"react/jsx-runtime";function w(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function $(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function M(e,t){let n=2166136261;const r=$(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var A=new Map;function S(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:a=45,lineOpacity:s=1}=e,l=Math.max(8,Math.ceil(2*i));return k("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==a?`rotate(${a})`:void 0,children:[n&&"transparent"!==n&&v("rect",{width:l,height:l,fill:n}),v("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:o,strokeOpacity:s}),v("line",{x1:i,y1:0,x2:i,y2:l,stroke:r,strokeWidth:o,strokeOpacity:s})]},t)}function W(e,t,n="#4e79a7"){if(w(e)){const n=M(t,e);return{fill:`url(#${n})`,def:S(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}import*as C from"react";var[j,N]=t(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function O(e){const t=N(e=>e.pushObservation),n=C.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return C.useMemo(()=>({...e,onObservation:n}),[n,e])}function I(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}function R(e,t={}){const n=I(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function L(e){return e instanceof Element&&null!=e.closest("[data-semiotic-annotation-widget]")}import{jsx as F,jsxs as P}from"react/jsx-runtime";var z="var(--semiotic-bg, #ffffff)";function T(e,t){return(e+"").length*t*.6}function D(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>F("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:a,fontFamily:s,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??z,strokeWidth:h.haloWidth??3});const y=h.padding??{x:6,y:3},p="number"==typeof y?y:y.x,m="number"==typeof y?y:y.y,g=T(r,i),b=i+2*m;let x,v;return x="middle"===l?t-g/2-p:"end"===l?t-g-p:t-p,v="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,P("g",{className:d,children:[F("rect",{x:x,y:v,width:g+2*p,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??z,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var E=["name","label","title"],B=["type","kind","category","group","class","status","role","shape"],H=["value","amount","total","count","weight","score"],_=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function G(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function q(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&_.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>E.includes(e.lower));const a=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:o[i];let l=o.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=G(l,B),u=G(l,H),d=new Set(B),h=new Set(H),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:f}}function V(e,t){return"touch"===t?Math.max(e,24):e}function Y(e){return Array.isArray(e)?e[0]:e}function U(e,t,n,r){return{data:Y(e),x:t,y:n,__semioticHoverData:!0,...r}}import{jsx as X,jsxs as Z}from"react/jsx-runtime";var K={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function J(e,t){return"function"==typeof t?t(e):e[t]}function Q(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function ee(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=J(e,n);a=Q(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const a=J(e,o);s.push({label:n,value:Q(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=Q(e[n],r);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=Q(e[t[0]],r))}}const l={...K,...o};return Z("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&X("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>Z("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&Z("span",{children:[e.label,": "]}),e.value]},t))]})}}function te(e={}){const{fields:t=[],title:n,format:r,style:o={},className:i="",showLabels:a=!0,separator:s=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=J(e,n);l.push({value:Q(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const s=Q(J(e,o),i);l.push({label:a?n:void 0,value:s})});else{const t=q(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:Q(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:a?e.key:void 0,value:Q(e.value,r)})})}const c={...K,...o};return Array.isArray(l)&&0!==l.length?X("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>Z("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&Z("strong",{children:[e.label,s]}),e.value]},t))}):null}}function ne(){return e=>{const t=e.allSeries;if(!t||0===t.length)return X("div",{className:"semiotic-tooltip",style:K,children:X("div",{children:Q(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return Z("div",{className:"semiotic-tooltip",style:K,children:[null!=n&&X("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Q(n)}),t.map((e,t)=>Z("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[X("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),X("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),X("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Q(e.value)})]},t))]})}}function re(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Y(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const r=t(n);return null==r?null:X("div",{className:"semiotic-tooltip",style:K,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?ee(e):"multi"===e?("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip — prefer charts that set tooltipMode (LineChart, AreaChart, StackedAreaChart, DifferenceChart). Rendering MultiLineTooltip content as a fallback.'),te()):ee())}}import{createContext as oe,useContext as ie,useMemo as ae}from"react";import{scaleOrdinal as se}from"d3-scale";function le(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function ce(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function ue(e){const t=e.map(le),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return ce(e,n,r)}if(e>=1){const[e,r,o]=t[n];return ce(e,r,o)}const r=e*n,o=Math.floor(r),i=r-o,[a,s,l]=t[o],[c,u,d]=t[o+1];return ce(Math.round(a+(c-a)*i),Math.round(s+(u-s)*i),Math.round(l+(d-l)*i))}}var de=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],he=ue(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),fe=ue(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),ye=ue(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),pe=ue(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),me=ue(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ge=ue(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),be=ue(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),xe=ue(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),ve=ue(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ke=ue(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),we=ue(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),$e=ue(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Me={blues:he,reds:fe,greens:ye,viridis:be,oranges:pe,purples:me,greys:ge,plasma:xe,inferno:ve,magma:ke,cividis:we,turbo:$e};function Ae(e){return e&&Me[e]||he}var Se=ue(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),We=ue(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Ce=ue(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),je=ue(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Ne=ue(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Oe=ue(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Ie=ue(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),Re={category10:de,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Me},Le=de,Fe="#007bff";function Pe(e,t,n=Le){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Re[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}var ze=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Te=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],De=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Ee(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||De.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):Le[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%Le.length]}function Be(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function He(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Be(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return se().domain(r).range(n).unknown("#999");const i=Re[n]||Re.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Le;return se().domain(r).range(e).unknown("#999")}}function _e(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,a]=r,[s,l]=n;if(a===i)return(s+l)/2;let c=(o-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}import{jsx as Ge}from"react/jsx-runtime";var qe=oe(null);function Ve({colors:e,categories:t,colorScheme:n="category10",children:r}){const o=ae(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,r={};let o=0;for(const n of t)r[n]=Be(e,n)??Le[o++%Le.length];return r}const e=Array.isArray(n)?n:Re[n]||Le,r={};for(let n=0;t.length>n;n++)r[t[n]]=e[n%e.length];return r}return{}},[e,t,n]);return Ge(qe.Provider,{value:o,children:r})}function Ye(){return ie(qe)}Ve.displayName="CategoryColorProvider";import{useId as Ue,useMemo as Xe,useCallback as Ze}from"react";function Ke(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function Je(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(Ke(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function Qe(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function et(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[tt,nt]=t(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!et(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),a=Qe(i,t),s=new Map(a.clauses);return s.set(n.clientId,n),i.set(t,{...a,clauses:s}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=Qe(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}}));import{useSyncExternalStore as rt}from"react";var ot={positions:new Map},it=new Set;function at(){for(const e of it)e()}function st(e,t){const n=ot.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(ot.positions);r.delete(e),ot={positions:r},at()}function lt(e,t){const n=ot.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(ot.positions);r.delete(e),ot={positions:r},at()}function ct(){return ot}function ut(e){return it.add(e),()=>it.delete(e)}var dt={positions:new Map};function ht(){return()=>{}}function ft(){return dt}function yt(e){const t=rt(e?ut:ht,e?ct:ft,e?ct:ft);return e?t.positions.get(e)??null:null}function pt(e){const t=Ue(),n=e.clientId||t,{name:r}=e,o=nt(e=>e.selections.get(r)),i=nt(e=>e.setClause),a=nt(e=>e.clearClause),s=Xe(()=>!!o&&o.clauses.size>0,[o]);return{predicate:Xe(()=>o&&0!==o.clauses.size?Je(o,n):()=>!0,[o,n]),isActive:s,selectPoints:Ze(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:Ze(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:Ze(()=>{a(r,n)},[a,r,n]),clientId:n}}function mt(e,t){const n=Ue(),r=t||n,o=nt(e=>e.setClause),i=nt(e=>e.clearClause);return{selectPoints:Ze(t=>{const n={};let i=!1;for(const[e,r]of Object.entries(t))n[e]={type:"point",values:new Set(r)},i=!0;i&&o(e,{clientId:r,type:"point",fields:n})},[e,r,o]),clear:Ze(()=>i(e,r),[e,r,i]),clientId:r}}function gt(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:a}=pt({name:t,fields:n});return{onHover:Ze(e=>{if(!e)return void a();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}vt(t)&&i(t)},[n,i,a]),predicate:r,isActive:o}}function bt(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function xt(e){const{name:t,xField:n,yField:r}=e,{predicate:o,isActive:i,selectInterval:a,clear:s}=pt({name:t,fields:[n,r].filter(Boolean)}),l=n&&r?"xyBrush":n?"xBrush":"yBrush",c=Ze(e=>{if(!e)return void s();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&bt(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&bt(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),vt(t)&&a(t)},[l,n,r,a,s]);return{brushInteraction:Xe(()=>({brush:l,during:c,end:c}),[l,c]),predicate:o,isActive:i,clear:s}}function vt(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function kt(e,t,n){const r=nt(e=>e.selections.get(t));return Xe(()=>{if(!r||0===r.clauses.size)return e;const t=Je(r,n);return e.filter(t)},[e,r,n])}import{useMemo as wt}from"react";function $t(e={}){const{limit:t=50,types:n,chartId:r}=e,o=N(e=>e.version),i=N(e=>e.observations),a=N(e=>e.clearObservations),s=wt(()=>{let e=i;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[i,n,r,t,o]);return{observations:s,latest:s.length>0?s[s.length-1]:null,clear:a}}import{createContext as Mt,useContext as At,useEffect as St,useId as Wt,useLayoutEffect as Ct,useMemo as jt,useRef as Nt,useState as Ot,useCallback as It}from"react";import*as Rt from"react";import{jsx as Lt,jsxs as Ft}from"react/jsx-runtime";var Pt={fill:(e,t)=>Lt("rect",{style:e,width:t,height:t}),line:(e,t)=>Lt("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function zt(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Pt[n])(r(e,t),o),i}function Tt({swatchSize:e}){return Lt("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Dt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Et=(e,t,n,r,o,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,y=[];let p=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:x,rowHeight:v}=u;return f.forEach((e,c)=>{const u=zt(e,c,d,h,b),k=Dt(e,r,o),w=o&&o.size>0&&o.has(e.label);y.push(Ft("g",{transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?s===i&&c===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?w||!1:void 0,"aria-current":m&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:m?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(s,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&Lt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&Lt(Tt,{swatchSize:b}),Lt("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),p+=v}),y};function Bt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Rt.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Lt("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return Ft("g",{"aria-label":i||"Gradient legend",children:[Lt("defs",{children:Lt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&Lt("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Lt("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),Lt("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[0])}),Lt("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Lt("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return Ft("g",{"aria-label":i||"Gradient legend",children:[i&&Lt("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Lt("defs",{children:Lt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Lt("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),Lt("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[1])}),Lt("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[0])})]})}function Ht(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,y]=Rt.useState(0),[p,m]=Rt.useState(0),g=Rt.useCallback((e,t)=>{y(e),m(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const d=[],h=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const o=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const a=n;return n+=r*t+8,{lineY:o,labelY:i,itemsY:a,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const y=h[f];d.push(Lt("line",{stroke:"gray",x1:0,y1:y.lineY,x2:t,y2:y.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=y.labelY&&d.push(Lt("text",{y:y.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d.push(Lt("g",{className:"legend-item",transform:`translate(0,${y.itemsY})`,children:Et(e,n,r,o,i,a,s,f,l,c,u)},"legend-group-"+f))}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:g,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const p=((e,t,n,r,o,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:y}=e,p=[],{swatchSize:m,labelGap:g,itemGap:b,rowHeight:x,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=o,$=y.map(e=>m+g+7*e.label.length),M=[];let A=0,S=0;$.forEach((e,t)=>{const n=0===S?e:S+b+e;d&&d>0&&S>0&&n>d?(M.push({start:A,end:t,width:S}),A=t,S=e):S=n}),y.length>0&&M.push({start:A,end:y.length,width:S}),M.forEach((e,c)=>{let u="center"===v?Math.max(0,((d??e.width)-e.width)/2):"end"===v?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=y[d],v=zt(e,d,h,f,m),M=Dt(e,r,o),A=o&&o.size>0&&o.has(e.label);p.push(Ft("g",{transform:`translate(${u},${c*x})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?s===i&&d===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?A||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+y.length)%y.length;l(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(s,d),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&Lt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,A&&Lt(Tt,{swatchSize:m}),Lt("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=$[d]+b}});const W=Math.max(0,...M.map(e=>e.width)),C=M.length;return{items:p,offset:W,totalRows:C,totalHeight:C*x}})(e,r,o,i,a,s,l,t,c,u,d,d.maxWidth??n);y+=p.offset+5,f.push({label:e.label,...p,offset:y,totalRows:p.totalRows,totalHeight:p.totalHeight}),h+=y+12});const y=d.maxWidth??n;let p=h>y?0:"center"===d.align?Math.max(0,(y-h)/2):"end"===d.align?Math.max(0,y-h):0;const m=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(m.push(Lt("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),p+=16),m.push(Lt("g",{className:"legend-item",transform:`translate(${p},0)`,children:n.items},"legend-group-"+r)),p+=n.offset+5,e[r+1]&&m.push(Lt("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),Lt("g",{children:m})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:g,legendInteraction:a,metrics:h}),x=!(!n&&!r);return Ft("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&Lt("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s}),b]})}import{useRef as _t,useState as Gt,useEffect as qt}from"react";function Vt(e,t,n){const r=_t(null),[o,i]=Gt(null);return qt(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}import{jsx as Yt,jsxs as Ut}from"react/jsx-runtime";var Xt=Mt(!1),Zt=Mt(!1);function Kt(){return At(Zt)}var Jt=Mt(null),Qt="undefined"==typeof window?St:Ct;function en(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function tn(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function nn(e){const t=At(Jt),n=Wt(),r=en(e),o=Nt([]);tn(o.current,r)||(o.current=r);const i=o.current;Qt(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Qt(()=>{t&&t.registerCategories(n,i)},[t,n,i])}var rn="__linked-legend-isolate__",on="__linked-legend-highlight__";function an({categoryColors:e,interaction:t,selectionName:n,field:r}){const o=Object.entries(e),i=o.map(([e])=>e),a=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:o.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:s,clear:l}=pt({name:n,fields:[r],clientId:rn}),{selectPoints:c,clear:u}=pt({name:n,fields:[r],clientId:on}),d=nt(e=>e.selections.get(n)),{isolatedCategories:h,highlightedCategory:f}=jt(()=>{const e=new Set;let t=null;const n=d?.clauses.get(rn)?.fields[r];if("point"===n?.type)for(const t of n.values)e.add(t+"");const o=d?.clauses.get(on)?.fields[r];if("point"===o?.type){const e=o.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[d,r]),y=It(e=>{"highlight"===t&&(e?c({[r]:[e.label]}):u())},[t,r,c,u]),p=It(e=>{if("isolate"!==t)return;const n=new Set(h);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():s({[r]:Array.from(n)})},[t,r,h,i.length,s,l]),[m,[g]]=Vt([0,0],!0,!1),b=jt(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,r=1;for(const o of e){const e=26+7*o.length;n>0&&n+e>t&&(r++,n=0),n+=e}return r}(o.map(([e])=>e),g),[o,g]);return 0===o.length?null:Yt("div",{ref:m,style:{width:"100%",display:"block"},children:Yt("svg",{width:"100%",height:Math.max(30,22*b+8),style:{display:"block",overflow:"visible"},children:Yt(Ht,{legendGroups:a,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?y:void 0,customClickBehavior:"isolate"===t?p:void 0,highlightedCategory:f,isolatedCategories:h})})})}function sn({children:e,selections:t,showLegend:n,legendPosition:r="top",legendInteraction:o="none",legendSelectionName:i="legend",legendField:a="category"}){const s=jt(()=>{if(!t)return;const e=new Map;for(const[n,r]of Object.entries(t))r.resolution&&e.set(n,{name:n,resolution:r.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=Ye(),[c,u]=Ot({}),d=Nt({}),h=jt(()=>({registerCategories:(e,t)=>{const n=en(t);u(t=>tn(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=jt(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return en(e)},[c]),y=jt(()=>{const e=l??{},t=d.current;let n=Object.keys(e).length+Object.keys(t).length;for(const r of f)e[r]||t[r]||(t[r]=Le[n%Le.length],n++);const r={...e};for(const n of f)r[n]=e[n]??t[n];return r},[l,f]),p=void 0===n||n,m=Object.keys(y).length>0;return Yt(tt,{initialState:s,children:Yt(j,{children:Yt(Zt.Provider,{value:!0,children:Yt(Jt.Provider,{value:h,children:Yt(Ve,{colors:y,children:Ut(Xt.Provider,{value:p&&m,children:[p&&"top"===r&&Yt(an,{categoryColors:y,interaction:o,selectionName:i,field:a}),e,p&&"bottom"===r&&Yt(an,{categoryColors:y,interaction:o,selectionName:i,field:a})]})})})})})})}function ln(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function cn(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),a=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}function un(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>cn(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])ln(e[r])&&ln(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}var dn=Object.freeze([]);function hn(e){if(!e)return dn;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var fn={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function yn(e,t){const n={...e};for(const e of t)n[fn[e]]++;return n}function pn(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:yn(n,r)}}var mn=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=pn({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=pn(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}};import{memo as gn,useEffect as bn,useRef as xn}from"react";var vn={sceneGeometry:0,layout:0,domain:0};function kn(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function wn(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var $n="production"!==process.env.NODE_ENV,Mn={revisions:vn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},An=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=vn,this.lastObserved=vn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){$n&&(this.lastObserved=wn(this.lastObserved,kn(e)))}beforeCompute(e,t){if(!$n)return Mn;const n=wn(kn(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if($n){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}};function Sn(e){return xn(new An(e))}function Wn(e,t,n,r=!1,o=!1){const i=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(i,!0,o)}var Cn=gn(function({store:e,diagnostics:t}){return bn(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});function jn(...e){let t;for(const n of e)n&&(t=Nn(t)&&Nn(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}function Nn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}import{jsx as On}from"react/jsx-runtime";function In(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,y=!!s,p=Math.max(0,n-o.left-o.right),m=Math.max(1,f?a?.maxWidth??p:100);let g,b;return"left"===i?(g=Math.max(4,o.left-m-10),b=o.top):"top"===i?(g=o.left,b=y?32:8):"bottom"===i?(g=o.left,b=r-o.bottom+38):(g=n-o.right+10,b=o.top),On("g",{transform:`translate(${g}, ${b})`,children:(x=t,"object"==typeof x&&null!==x&&"gradient"in x?On(Bt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:m}):Nn(t)?On(Ht,{legendGroups:t.legendGroups,title:"",width:m,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var x}import{jsx as Rn}from"react/jsx-runtime";var Ln={secondary:0,primary:3},Fn=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function Pn(e){return!0===e?._annotationDeferred}function zn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Tn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Dn(e){return Math.max(.72,.95-.06*e)}import*as En from"react";import{jsx as Bn,jsxs as Hn}from"react/jsx-runtime";function _n(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let a="";for(const e of o)a&&a.length+1+e.length>r?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Gn(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function qn(e,t,n,r){if(!e)return Bn("g",{className:"annotation-note"});const{label:o,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!o&&!i)return Bn("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,y=i?c?[i]:_n(i,l):[],p=o?c?[o]:_n(o,l):[],m="leftRight"===u?"end"===h?-4:4:0;let g=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Bn("foreignObject",{className:"annotation-note-html",x:"end"===h?m-l:"middle"===h?m-l/2:m,y:-16,width:l,height:Math.max(f,(y.length+p.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:Hn("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Bn("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&Bn("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(y.length>0&&(b.push(Bn("text",{className:"annotation-note-title",fill:x,textAnchor:h,fontWeight:"bold",children:y.map((e,t)=>Bn("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=y.length*f),p.length>0&&b.push(Bn("text",{className:"annotation-note-label",fill:x,textAnchor:h,y:g,children:p.map((e,t)=>Bn("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=Bn("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+p.length)*f+(p.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),v=Bn("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+p.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+f+(p.length>0&&y.length>0?2:0))/2+8:"bottom"===d||0>n?-(k+2):18),Hn("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[Bn("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),v]})}function Vn(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Bn("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push(Bn("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,a=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push(Bn("line",{x1:r,y1:(t.y1||0)-a,x2:r,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-a;i.push(Bn("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push(Bn("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push(Bn("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push(Bn("path",{d:Gn(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Bn("g",{className:"annotation-subject",children:i})}function Yn(e,t,n,r,o,i){const a=[];let s=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,a=e-o,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;s=o+a*h,l=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);s=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-s)**2+(t-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-s);if(i){const r=(s+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-s)/c,f=(n?.curve??.25)*c,y=r+d*f,p=i+h*f;a.push(Bn("path",{className:"connector-curve",d:`M${s},${l}Q${y},${p} ${e},${t}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(p-l,y-s)}else a.push(Bn("line",{x1:s,y1:l,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(Bn("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return Bn("g",{className:"annotation-connector",children:a})}function Un(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:y,strokeDasharray:p,events:m={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,x=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=r||0,w=o||0;null!=i&&(k=i-b),null!=a&&(w=a-x);const $="string"==typeof u?u:"label";if("bracket"===$&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return Hn("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${x})`,"data-testid":g,...null!=y&&{opacity:y},...p&&{strokeDasharray:p},...m,children:[!v.has("connector")&&Yn(k,w,l,d,$,c),!v.has("subject")&&Vn($,c,d,b,x),!v.has("note")&&qn(s,k,w,d)]})}function Xn(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return Bn(Un,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+i)});return Bn("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Bn(Un,{"data-testid":"semiotic-annotation",events:o,...t,type:r},a)}import{packEnclose as Zn}from"d3-hierarchy";import{area as Kn,curveLinear as Jn,curveMonotoneX as Qn,curveMonotoneY as er,curveStep as tr,curveStepAfter as nr,curveStepBefore as rr,curveBasis as or,curveCardinal as ir,curveCatmullRom as ar}from"d3-shape";function sr(e){return Math.round(100*e)/100}function lr(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const a=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));a.push(r)}r.push(a)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(sr);return{points:e.map(([e])=>[sr(e),sr(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}function cr(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function ur(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function dr(e){return null==e?null:e+""}function hr(e,t,n){return t.stickyPositionCache?.set(e,n),n}function fr(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const o=n.pointNodes[r];if(o.pointId===e.pointId)return hr(t,n,{x:o.x,y:o.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,o=e.scales?.y??e.scales?.value;if(!r||!o)return null;const i=n[e.xAccessor||"x"],a=n[e.yAccessor||"y"];return null==i||null==a?null:{x:r(i),y:o(a)}}(n);return r?hr(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return dr(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const o=n.pointNodes?.find(e=>dr(e.pointId)===r);if(o)return hr(t,n,{x:o.x,y:o.y});const i=n.data?.find(e=>function(e){return dr(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const a=cr(i,n),s=ur(i,n);return null==a||null==s?null:hr(t,n,{x:a,y:s})}(e,t,n);if(r)return r}let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(o=t.x,i=t.y)}if(null!=o&&null!=i||(o=cr(e,n),i=ur(e,n)),null!=o&&null!=i)return hr(t,n,{x:o,y:i});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function yr(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}import{jsx as pr,jsxs as mr}from"react/jsx-runtime";var gr={linear:Jn,monotoneX:Qn,monotoneY:er,step:tr,stepAfter:nr,stepBefore:rr,basis:or,cardinal:ir,catmullRom:ar};function br(e,t,n,r){const o=[];return e.forEach((e,i)=>{let a;if(n){const o=n(e,i,r);a=null!=o?o:t(e,i,r)}else a=t(e,i,r);a&&o.push({node:a,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Tn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Pn(e.annotation)),o=e.some(e=>null!=zn(e.annotation)),i=e.some(e=>"layer"===zn(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=Ln[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=Pn(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;a=Rn("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Dn(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const s=zn(t.annotation);return s&&(a=Rn("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),i&&(a=Rn("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&s.unshift(Rn("style",{children:Fn},"annotation-disclosure-style")),i&&s.unshift(Rn("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}(o)}function xr(t,n={}){return function(t,r,o){switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const e=fr(t,r,o);if(!e)return null;const{x:n,y:i}=e;if(!yr(n,i,o))return null;const a="callout"===t.type?"callout-circle":t.type,s="callout-circle"===a?{radius:t.radius??12,radiusPadding:t.radiusPadding}:"callout-rect"===a?{width:t.width,height:t.height}:void 0;return pr(Xn,{noteData:{x:n,y:i,dx:t.dx??30,dy:t.dy??-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:a,...s?{subject:s}:{},connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className}},"ann-"+r)}case"x-threshold":{const e=cr(null!=t.value?{...t,x:t.value}:t,o);if(null==e)return null;const n=t.color||"#f97316",i=t.labelPosition||"top";let a;a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const s=e>.6*(o.width||0),l=s?e-4:e+4,c=s?"end":"start";return mr("g",{opacity:t.opacity,children:[pr("line",{x1:e,y1:0,x2:e,y2:o.height||0,stroke:n,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&pr(D,{x:l,y:a,text:t.label,textAnchor:c,fill:n,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+r)}case"y-threshold":{const e=ur(null!=t.value?{...t,y:t.value}:t,o);if(null==e)return null;const n=t.color||"#f97316",i=t.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=e)?Math.min((o.height||0)-4,s+16):s-4;return mr("g",{opacity:t.opacity,children:[pr("line",{x1:0,y1:e,x2:o.width||0,y2:e,stroke:n,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&pr(D,{x:a,y:c,text:t.label,textAnchor:l,fill:n,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+r)}case"enclose":{const e=(t.coordinates||[]).map(e=>({x:cr({...e,type:"point"},o),y:ur({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>e.length)return null;const n=Zn(e),i=t.padding||10;return mr("g",{children:[pr("circle",{cx:n.x,cy:n.y,r:n.r+i,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&pr(D,{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+r)}case"rect-enclose":{const n=(t.coordinates||[]).map(e=>({x:cr({...e,type:"point"},o),y:ur({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>n.length)return null;const i=t.padding||10,a=n.map(e=>e.x),s=n.map(e=>e.y),[l,c]=e(a),[u,d]=e(s),h=l-i,f=c+i,y=u-i;return mr("g",{children:[pr("rect",{x:h,y:y,width:f-h,height:d+i-y,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&pr(D,{x:(h+f)/2,y:y-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+r)}case"highlight":{const e=o.data||[],n="function"==typeof t.filter?e.filter(t.filter):t.field&&null!=t.value?e.filter(e=>e[t.field]===t.value):[],i={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return pr("g",{children:n.map((e,n)=>{const r=cr(e,o),a=ur(e,o);if(null==r||null==a)return null;const s="function"==typeof t.r?t.r(e):t.r||6,l="function"==typeof t.style?t.style(e):t.style||i;return pr("circle",{cx:r,cy:a,r:s,...l},"hl-"+n)})},"ann-"+r)}case"bracket":{const e=cr(t,o),n=ur(t,o);return pr(Xn,{noteData:{x:e??0,y:n??0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+r)}case"trend":{const e=o.data||[];if(2>e.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a="ordinal"===o.frameType,s="horizontal"===o.projection,l=a?n:null,c=a?i:null;let u;const d=[],h=new Map;if(a&&l&&c){for(const t of e){const e=t[l];if(null==e)continue;const n=e+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=e.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=e.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,y=o.scales?.y??o.scales?.value;if(!f||!y)return null;const p=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},m=f,g=y;let b;if(a)if(s){const e=p(g);b=(t,n)=>[m(n),e(t)]}else{const e=p(m);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[m(e),g(t)];const x=t.method||"linear";let v;if("loess"===x)v=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],y+=t*o[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*y-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(u,t.bandwidth??.3);else{const e="polynomial"===x?lr(u,t.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:sr((n*t[3]-t[0]*t[1])/r),i=sr(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[sr(e),sr(o*e+i)]),equation:[o,i]}}(u);v=e.points}const k=v.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),w=t.color||"#6366f1",$=v[v.length-1],[M,A]=b($[0],$[1]);return mr("g",{children:[pr("polyline",{points:k,fill:"none",stroke:w,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&pr("text",{x:M+4,y:A-4,fill:w,fontSize:11,children:t.label})]},"ann-"+r)}case"band":{const e=o.scales?.y??o.scales?.value,n=e?.domain?.(),s=t.y0??n?.[0],l=t.y1??n?.[1],c=null!=s&&e?e(s):0,u=null!=l&&e?e(l):o.height||0,d=W(t.fill,"ann-"+r,"var(--semiotic-primary, #6366f1)");return mr("g",{opacity:t.opacity,children:[d.def&&pr("defs",{children:d.def}),pr("rect",{x:0,y:Math.min(c,u),width:o.width||0,height:Math.abs(u-c),fill:d.fill,fillOpacity:t.fillOpacity||.1}),t.label&&pr(D,{x:(o.width||0)-4,y:(i=c,a=u,Math.max(Math.min(i,a),0)+16),textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+r)}case"x-band":{const e=o.scales?.x??o.scales?.time,n=e?.domain?.(),i=t.x0??n?.[0],a=t.x1??n?.[1],s=null!=i&&e?e(i):null,l=null!=a&&e?e(a):null;if(null==s||null==l)return null;const c=W(t.fill||t.color,"ann-"+r,"var(--semiotic-primary, #6366f1)");return mr("g",{opacity:t.opacity,children:[c.def&&pr("defs",{children:c.def}),pr("rect",{x:Math.min(s,l),y:0,width:Math.abs(l-s),height:o.height||0,fill:c.fill,fillOpacity:t.fillOpacity??.1}),t.label&&pr(D,{x:Math.min(s,l)+4,y:16,textAnchor:"start",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+r)}case"envelope":{const e=o.data||[];if(2>e.length)return null;const n=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=t.upperAccessor||"upperBounds",l=t.lowerAccessor||"lowerBounds",c=t.filter,u=e.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>u.length)return null;const d=gr[o.curve||"linear"]||Jn,h=Kn().x(e=>i(e[n])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const f=t.fill||"#6366f1";return mr("g",{children:[pr("path",{d:h,fill:f,fillOpacity:t.fillOpacity??.15,stroke:"none"}),t.label&&u.length>0&&pr("text",{x:i(u[u.length-1][n])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+r)}case"anomaly-band":{const e=o.data||[];if(2>e.length)return null;const n=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=e.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),d=t.threshold??2,h=l-d*u,f=!1!==t.showBand,y=t.fill||"#6366f1",p=t.fillOpacity??.1,m=t.anomalyColor||"#ef4444",g=t.anomalyRadius??6,b=a(l+d*u),x=a(h),v=e.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-l)>d*u});return mr("g",{children:[f&&pr("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:p}),v.map((e,t)=>{const n=cr(e,o),r=ur(e,o);return null==n||null==r?null:pr("circle",{cx:n,cy:r,r:g,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),t.label&&pr("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11,children:t.label})]},"ann-"+r)}case"forecast":{const e=o.data||[];if(3>e.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!a||!s)return null;const l=e.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(t.method||"linear")){const e=lr(l,t.order||2).equation;c=t=>e.reduce((e,n,r)=>e+n*Math.pow(t,r),0)}else{const e=l.length;let t=0,n=0,r=0,o=0;for(const[e,i]of l)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const a=(e*o-t*n)/i,s=(n-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),y=l.reduce((e,t)=>e+t[0],0)/u,p=l.reduce((e,t)=>e+(t[0]-y)**2,0),m=t.confidence??.95,g=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=t.steps??5,x=l[u-1][0],v=(x-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/u+(p>0?(e-y)**2/p:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const $=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,M=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),A=`${a(x)},${s(c(x))}`,S=t.strokeColor||"#6366f1";return mr("g",{children:[pr("path",{d:$,fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity??.15,stroke:"none"}),pr("polyline",{points:`${A} ${M}`,fill:"none",stroke:S,strokeWidth:t.strokeWidth??2,strokeDasharray:t.strokeDasharray??"6,3"}),t.label&&w.length>0&&pr("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:S,fontSize:11,children:t.label})]},"ann-"+r)}case"widget":{let e,i;if(null!=t.px&&null!=t.py)e=t.px,i=t.py;else{const n=fr(t,r,o);if(!n)return null;e=n.x,i=n.y}if(!yr(e,i,o))return null;const a=t.dx??0,s=t.dy??0,l=t.width??32,c=t.height??32,u=t.content??pr("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return pr("foreignObject",{x:e+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:pr("div",{...R(t,n),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+r)}case"text":{const e=fr(t,r,o);if(!e)return null;const{x:n,y:i}=e,a=n+(t.dx||0),s=i+(t.dy||0),l=t.color||"var(--semiotic-text, #333)",c=pr("text",{x:a,y:s,fill:l,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?En.cloneElement(c,{key:"ann-text-"+r}):mr("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[pr("line",{x1:n,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),En.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+r)}case"category-highlight":{const e=t.category;if(null==e)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,a=o.scales?.x,s=o.scales?.y,l=n(i)?i:n(a)?a:n(s)?s:null;if(!l)return null;const c=l(e+"");if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=t.opacity??.15,f=t.label;return mr("g",(o.projection?"vertical"===o.projection:l===a)?{children:[pr("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&pr(D,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:t.labelBackground??"none"})]}:{children:[pr("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&pr(D,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:t.labelBackground??"none"})]},"ann-"+r)}default:return null}var i,a,s}}var vr=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),kr=new Set(["label","callout","callout-circle","callout-rect"]);function wr(e){return"string"==typeof e?.type?e.type:""}function $r(e){return!!e&&"object"==typeof e&&vr.has(wr(e))}function Mr(e){return kr.has(wr(e))&&!function(e){return Array.isArray(e?.disable)&&e.disable.includes("connector")}(e)}function Ar(e){return"primary"===e?.emphasis||!0===e?.defensive}function Sr(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Wr(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}var Cr=32,jr=6,Nr=4,Or=8,Ir=72;var Rr={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Lr(e){if(!Fr(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function Fr(e){return $r(e)}function Pr(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),o=[];let i="";for(const e of r)i&&i.length+e.length+1>n?(o.push(i),i=e):i=i?`${i} ${e}`:e;return i&&o.push(i),o}function zr(e,t,n,r,o){const i=e+n,a=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?i-o.width-4:i+4,y:0>r?a-o.height:a,width:o.width,height:o.height}:{x:0>n?i-o.width:i,y:0>r?a-o.height-4:a+4,width:o.width,height:o.height}}function Tr(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Dr(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Er(e,t,n,r,o,i,a,s){const l=Tr(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const o=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(o+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,o,i,s);for(const e of n)c+=12*Dr(l,e);for(const e of r)c+=4*Dr(l,e);return c}function Br(e){const{annotations:t,context:n,defaultOffset:r=Cr,notePadding:o=jr,markPadding:i=Nr,edgePadding:a=Or,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=Ir,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:y,cohesion:p,audience:m}=e,g=n.width||0,b=n.height||0,x="object"==typeof y?y:{},v=x.breakpoint??480,k=!!y&&v>=g,w=k&&!1!==x.preferShortText?t.map(Lr):t,$=k&&!u?{maxAnnotations:x.maxAnnotations??("callout-list"===x.strategy?1:2),minVisible:x.minVisible??1}:u,M=d||k&&(!1!==x.progressiveDisclosure||"callout-list"===x.strategy),A=k&&!f?x.responsive??{minWidth:v}:f,S=k&&!p?x.cohesion:p;if(0===w.length||0>=g||0>=b)return w.slice();const W=[],C=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let j=!1;const N=w.map((e,t)=>{if(!Fr(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const o=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(o)&&o.length>=2&&i){const e=o[0],t=o[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?fr(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...Pr("string"==typeof e.title?e.title:void 0,t),...Pr("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*n.length+6)}}(e);if(s&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return W.push(Tr(zr(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),o)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=Er(zr(i.x,i.y,e.dx,e.dy,u),e,W,C,g,b,o,a);f>t&&(h=e,f=t)}if(!h)return e;const y=Tr(zr(i.x,i.y,h.dx,h.dy,u),o);W.push(y);const p=Math.hypot(h.dx,h.dy),m=l&&p>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return j=!0,{...e,dx:h.dx,dy:h.dy,...m?{connector:m}:{}}}),O=j?N:w.slice();let I=O;if(h){let e=!1;const t=O.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:O}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Rr[t.source]??t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const o=[n,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${o})`)?e:{...e,label:i?`${i} (${o})`:`(${o})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const R=new Set;if($){const e="object"==typeof $?$:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(m),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Sr(g,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,o=Math.max(0,e.minVisible??1),i=Sr(n,r,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,$r(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const l=s.filter(e=>Ar(e.annotation)),c=s.filter(e=>!Ar(e.annotation)).sort((e,t)=>Wr(t.annotation)-Wr(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,o-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:I,width:g,height:b,...n});for(const e of r)R.add(e)}if(A&&("object"==typeof A&&"number"==typeof A.minWidth?A.minWidth:480)>=g)for(const e of I)Fr(e)&&"secondary"===e.emphasis&&R.add(e);if(R.size>0)for(const e of I)!0===e?.defensive&&R.delete(e);let L;return L=0===R.size?I:M?I.map(e=>R.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!R.has(e)),S?function(e,t){let n=!1;const r=e.map(e=>Fr(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(L,S):L}import*as Hr from"react";function _r(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Gr(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,n));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}import{symbol as qr,symbolCircle as Vr,symbolCross as Yr,symbolDiamond as Ur,symbolSquare as Xr,symbolStar as Zr,symbolTriangle as Kr,symbolWye as Jr}from"d3-shape";var Qr={circle:Vr,square:Xr,triangle:Kr,diamond:Ur,star:Zr,cross:Yr,wye:Jr},eo=["circle","triangle","diamond","star","square","chevron","cross","wye"];function to(e,t,n){if(n)return n;const r=e??"circle";return"chevron"===r?function(e){const t=1.5*no(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):qr(Qr[r]??Vr,Math.max(1,t))()??""}function no(e){return Math.sqrt(Math.max(1,e)/Math.PI)}import{jsx as ro,jsxs as oo}from"react/jsx-runtime";var io={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ao(e,t="#4e79a7"){return w(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function so(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function lo(e,t,n,r){const s=e.glyph;if(!s?.parts?.length||0>=e.size)return null;const l=i(s,e.size);if(0>=l.scale)return null;const c=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${l.offsetX},${l.offsetY}) scale(${l.scale})`,u=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),d=o(s,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),h=d?so(r+"-clip"):void 0,f=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),y=t=>s.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:a(n.fill,u,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:a(n.stroke??"none",u,e.accent);return o||i?ro("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return oo("g",{transform:c,opacity:1===f?void 0:f,children:[d&&h&&ro("clipPath",{id:h,children:ro("rect",{x:d.x,y:d.y,width:d.width,height:d.height})}),d&&e.ghostColor?ro("g",{children:y(e.ghostColor)}):null,d&&h?ro("g",{clipPath:`url(#${h})`,children:y()}):y()]},r)}function co(e){const t=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));return 2>t.length?null:t.map((e,t)=>ro("stop",{offset:e.offset,stopColor:e.color},t))}function uo(e,t,n){const r=to(e.symbolType,e.size,e.path);return ro("path",{d:r,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?ao(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}import{jsx as ho,jsxs as fo}from"react/jsx-runtime";function yo(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=w(n.style.fill)?S(n.style.fill,`geoarea-${t}-hatch`):void 0;return fo(Hr.Fragment,{children:[r&&ho("defs",{children:r}),ho("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:ao(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1})]},"geoarea-"+t)}case"point":{const n=e,r=w(n.style.fill)?S(n.style.fill,`geopoint-${t}-hatch`):void 0;return fo(Hr.Fragment,{children:[r&&ho("defs",{children:r}),ho("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:ao(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return ho("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+t)}case"glyph":return lo(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}import*as po from"react";import{arc as mo}from"d3-shape";var go=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function bo(e){const{innerRadius:t,outerRadius:n,startAngle:r,endAngle:o}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=go(n,r),t=go(n,o);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${o-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=go(n,r),a=go(n,o),s=go(t,o),l=go(t,r),c=o-r>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${a.x},${a.y} L${s.x},${s.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===a)return bo({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const s=Math.asin(Math.min(1,a/Math.max(1e-9,n-a))),l=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=o-r,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>s,h=!!e.roundEnd&&u>s;if(!d&&!h)return bo({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=r+(d?s:0),y=o-(h?s:0),p=r+(d?l:0),m=o-(h?l:0),g=go(n,f),b=go(n,y),x=(n-a)*Math.cos(s),v=go(x,r),k=go(x,o),w=i?null:go(t,m),$=i?null:go(t,p),M=i?0:(t+a)*Math.cos(l),A=i?null:go(M,r),S=i?null:go(M,o),W=y-f>Math.PI?1:0,C=i?0:m-p>Math.PI?1:0;let j="";if(d)j+=`M${v.x},${v.y}`,j+=` A${a},${a} 0 0 1 ${g.x},${g.y}`;else{const e=go(n,r);j+=`M${e.x},${e.y}`}if(h)j+=` A${n},${n} 0 ${W} 1 ${b.x},${b.y}`,j+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=go(n,o);j+=` A${n},${n} 0 ${W} 1 ${e.x},${e.y}`}if(i)j+=" L0,0";else{if(h)j+=` L${S.x},${S.y}`,j+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=go(t,o);j+=` L${e.x},${e.y}`}if(d)j+=` A${t},${t} 0 ${C} 0 ${$.x},${$.y}`,j+=` A${a},${a} 0 0 1 ${A.x},${A.y}`;else{const e=go(t,r);j+=` A${t},${t} 0 ${C} 0 ${e.x},${e.y}`}}return j+=" Z",j}function xo(e){const t=bo({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],r=e.colors;if(r.length>0){const t=(e.endAngle-e.startAngle)/r.length;for(let o=0;r.length>o;o++)n.push({d:bo({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+o*t,endAngle:e.endAngle}),color:r[o]})}return{clipPath:t,slices:n}}import{jsx as vo,jsxs as ko}from"react/jsx-runtime";function wo(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function $o(e,t){const n=e.datum;if(!n)return null;const r=[],o=n.__funnelStepLabel,i=Number(n.__funnelStepLabelX),a=Number(n.__funnelStepLabelY),s=Number(n.__funnelRowWidth);"string"!=typeof o||!Number.isFinite(i)||!Number.isFinite(a)||Number.isFinite(s)&&8.4*o.length+16>s||r.push(vo("text",{x:i,y:a+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-step"));const l=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),u=Number(n.__funnelValueLabelY),d=Number(n.__funnelBarW);if(Number.isFinite(l)&&0!==l&&Number.isFinite(c)&&Number.isFinite(u)&&d>=60){const e=Number(n.__funnelPercent);let o=!0!==n.__funnelIsFirstStep&&Number.isFinite(e)?`${wo(l)} (${.05>Math.abs(e-Math.round(e))?Math.round(e):e.toFixed(1)}%)`:wo(l);7.8*o.length+16>d&&(o=wo(l)),7.8*o.length+16>d||r.push(vo("text",{x:c,y:u+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-value"))}return r.length?vo("g",{children:r},t+"-funnel-labels"):null}function Mo(e,t,n){const r=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",o=n=>`ord-${e.type}-${r}-${t}-${n}`,i=`ord-${e.type}-${r}-${t}`;switch(e.type){case"rect":{const t=e,n=so(i)+"-grad",r=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=e.x,o=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(o=e.y+e.h,a=e.y):"right"===e.roundedEdge?(r=e.x+e.w,o=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(r=e.x,o=e.y,i=e.x+e.w,a=e.y);const s=[];if("colorStops"in n){const e=co(n.colorStops);if(!e)return null;s.push(...e)}else{const t=ao(e.style.fill);s.push(ro("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),s.push(ro("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return ro("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:a,children:s})}(t,n);let o,a;if(r)a=`url(#${n})`;else if(w(t.style.fill)){const e=so(i)+"-hatch";o=S(t.style.fill,e),a=`url(#${e})`}else a=ao(t.style.fill);const s=r||o?ko("defs",{children:[r,o]}):null;if(t.cornerRadii&&_r(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:r,h:o}=e,{tl:i,tr:a,br:s,bl:l}=Gr(e);let c=`M${t+i},${n}`;return c+=` L${t+r-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+r},${n+a}`),c+=` L${t+r},${n+o-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+r-s},${n+o}`),c+=` L${t+l},${n+o}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+o-l}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return ko(po.Fragment,{children:[s,vo("path",{d:e,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:r,w:o,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${n},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+l-e} A${e},${e} 0 0 1 ${n+o-e},${r+l} L${n},${r+l} Z`;break;case"left":c=`M${n+o},${r} L${n+e},${r} A${e},${e} 0 0 0 ${n},${r+e} L${n},${r+l-e} A${e},${e} 0 0 0 ${n+e},${r+l} L${n+o},${r+l} Z`;break;case"bottom":c=`M${n},${r} L${n+o},${r} L${n+o},${r+l-e} A${e},${e} 0 0 1 ${n+o-e},${r+l} L${n+e},${r+l} A${e},${e} 0 0 1 ${n},${r+l-e} Z`;break;default:c=`M${n},${r+l} L${n},${r+e} A${e},${e} 0 0 1 ${n+e},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+l} Z`}return ko(po.Fragment,{children:[s,vo("path",{d:c,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return ko(po.Fragment,{children:[s,vo("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth}),$o(t,i)]},i)}case"point":{const t=e;return vo("circle",{cx:t.x,cy:t.y,r:t.r,fill:ao(t.style.fill),opacity:t.style.opacity??t.style.fillOpacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return uo(e,t,n);case"glyph":return lo(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const r=e;if(r._gradientBand&&r._gradientBand.colors.length>0){const e=so(`${n?n+"-":""}gauge-grad-${r.category||i}-${t}`),{clipPath:o,slices:a}=xo({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return ko("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[vo("defs",{children:vo("clipPath",{id:e,children:vo("path",{d:o})})}),vo("g",{clipPath:`url(#${e})`,children:a.map((e,t)=>vo("path",{d:e.d,fill:ao(e.color)},t))}),r.style.stroke&&"none"!==r.style.stroke&&vo("path",{d:o,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},i)}let o;if(r.roundedEnds)o=bo({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const e=mo().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&e.cornerRadius(r.cornerRadius),o=e(io)||""}return vo("path",{d:o,transform:`translate(${r.cx},${r.cy})`,fill:ao(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},i)}case"boxplot":{const t=e,n=t.columnWidth/2;return ko("g","vertical"===t.projection?{children:[vo("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),vo("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:ao(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),vo("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),vo("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),vo("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[vo("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),vo("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:ao(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),vo("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),vo("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),vo("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,n=[vo("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:ao(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},o("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,r=e.x+e.width/2,i=e.y+e.height/2;t.iqrLine.isVertical?n.push(vo("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),vo("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med"))):n.push(vo("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),vo("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med")))}return vo("g",{children:n},i)}case"connector":return vo("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return vo("polygon",{points:n,fill:ao(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}import*as Ao from"react";import{area as So,line as Wo}from"d3-shape";var Co=new WeakMap,jo=0,No=!1,Oo=null,Io=null;function Ro(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),r=n.indexOf(",");if(-1===r){const e=n.trim();return e.startsWith("--")?{name:e}:null}const o=n.slice(0,r).trim(),i=n.slice(r+1).trim();return o.startsWith("--")?{name:o,fallback:i||void 0}:null}(t);if(!n)return t;const r=()=>n.fallback?Ro(e,n.fallback):t,o=e.canvas;if(!o)return r();!function(){if(No)return;if("undefined"==typeof window||"undefined"==typeof document)return;No=!0;const e=()=>{jo++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"],subtree:!0}),"function"==typeof window.matchMedia)try{Oo=window.matchMedia("(prefers-color-scheme: dark)"),Io=e,"function"==typeof Oo.addEventListener?Oo.addEventListener("change",Io):"function"==typeof Oo.addListener&&Oo.addListener(Io)}catch{}}();let i=Co.get(o);i&&i.version===jo||(i={version:jo,map:new Map},Co.set(o,i));const a=i.map.get(t);if(void 0!==a)return a;const s=getComputedStyle(o).getPropertyValue(n.name).trim()||r()||t;return i.map.set(t,s),s}function Lo(){return jo}function Fo(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const o=e.fillStyle;if(e.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const i=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}import{curveMonotoneX as Po,curveMonotoneY as zo,curveCardinal as To,curveCatmullRom as Do,curveStep as Eo,curveStepBefore as Bo,curveStepAfter as Ho,curveBasis as _o,curveNatural as Go}from"d3-shape";function qo(e){switch(e){case"monotoneX":return Po;case"monotoneY":return zo;case"cardinal":return To;case"catmullRom":return Do;case"step":return Eo;case"stepBefore":return Bo;case"stepAfter":return Ho;case"basis":return _o;case"natural":return Go;default:return null}}function Vo(e,t,n){if(null==t)return n;if(w(t)){const r=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${$(e)}@${n}`,o=A.get(r);if(void 0!==o)return o;const i=x({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),a=w(i)?null:i;return A.set(r,a),a}(t,e);return r||t.background&&Ro(e,t.background)||n}return"string"!=typeof t?t:Ro(e,t)||n}function Yo(e,t){if(null==t)return;const n=Vo(e,t,"");return""===n?void 0:n}function Uo(e,t,n,r,o,i,a){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const s=e.createLinearGradient(r,o,i,a);for(const e of n)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(r,o,i,a),[h,f,y]=Fo(e,n);return d.addColorStop(0,`rgba(${h},${f},${y},${c})`),d.addColorStop(1,`rgba(${h},${f},${y},${u})`),d}function Xo(e,t,n,r,o,i){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(n,r,o,i);for(const e of a)s.addColorStop(e.offset,e.color);return s}import*as Zo from"react";import{arc as Ko}from"d3-shape";import{jsx as Jo,jsxs as Qo}from"react/jsx-runtime";function ei(e,t){switch(e.type){case"circle":{const n=e,r=w(n.style.fill)?S(n.style.fill,`net-circle-${t}-hatch`):void 0;return Qo(Zo.Fragment,{children:[r&&Jo("defs",{children:r}),Jo("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${t}-hatch)`:ao(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-circle-"+t)}case"rect":{const n=e,r=w(n.style.fill)?S(n.style.fill,`net-rect-${t}-hatch`):void 0;return Qo(Zo.Fragment,{children:[r&&Jo("defs",{children:r}),Jo("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${t}-hatch)`:ao(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-rect-"+t)}case"arc":{const n=e,r=Ko().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(io)||"",o=w(n.style.fill)?S(n.style.fill,`net-arc-${t}-hatch`):void 0;return Qo(Zo.Fragment,{children:[o&&Jo("defs",{children:o}),Jo("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:o?`url(#net-arc-${t}-hatch)`:ao(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-arc-"+t)}case"symbol":{const n=e,r=to(n.symbolType,n.size,n.path);return Jo("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?ao(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-symbol-"+t)}case"glyph":return lo(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}function ti(e,t){switch(e.type){case"line":return Jo("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const n=e;return Jo("path",{d:n.pathD,fill:ao(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"ribbon":{const n=e;return Jo("path",{d:n.pathD,fill:ao(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"curved":{const n=e;return Jo("path",{d:n.pathD,fill:ao(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+t)}default:return null}}function ni(e,t){return Jo("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}import{jsx as ri,jsxs as oi}from"react/jsx-runtime";function ii(e,t,n){if(!e||2>t.length)return null;const r=co(e.colorStops);return r?ri("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:r}):null}function ai(e,t,n){switch(e.type){case"line":{const r=e;if(0===r.path.length)return null;const o=qo(r.curve),i=o?Wo().x(([e])=>e).y(([,e])=>e).curve(o)(r.path)??"":"M"+r.path.map(([e,t])=>`${e},${t}`).join("L"),a=so(`${n?n+"-":""}line-${t}-stroke-gradient`),s=ii(r.strokeGradient,r.path,a);return oi(Ao.Fragment,{children:[s&&ri("defs",{children:s}),ri("path",{d:i,fill:"none",stroke:s?`url(#${a})`:r.style.stroke||"#4e79a7",strokeWidth:r.style.strokeWidth||2,strokeDasharray:r.style.strokeDasharray,opacity:r.style.opacity})]},"line-"+t)}case"area":{const r=e;if(0===r.topPath.length)return null;const o=qo(r.curve),i=!o||2>r.topPath.length||2>r.bottomPath.length?`M${r.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:So().x(([e])=>e).y0((e,t)=>r.bottomPath[t][1]).y1(([,e])=>e).curve(o)(r.topPath)??"",a=`${n?n+"-":""}area-${t}-hatch`,s=w(r.style.fill)?S(r.style.fill,a):void 0,l=so(`${n?n+"-":""}area-${t}-gradient`),c=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=1/0;for(const[,t]of e.topPath)r=Math.min(r,t);let o=-1/0;for(const[,t]of e.bottomPath)o=Math.max(o,t);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const i=[];if("colorStops"in n){const e=co(n.colorStops);if(!e)return null;i.push(...e)}else{if(!Number.isFinite(n.topOpacity)||!Number.isFinite(n.bottomOpacity))return null;i.push(ri("stop",{offset:0,stopColor:ao(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.topOpacity))},"0")),i.push(ri("stop",{offset:1,stopColor:ao(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.bottomOpacity))},"1"))}return ri("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:o,children:i})}(r,l),u=c?`url(#${l})`:s?`url(#${a})`:ao(r.style.fill),d=c?void 0:r.style.fillOpacity??r.style.opacity??.7,h=o?Wo().x(([e])=>e).y(([,e])=>e).curve(o)(r.topPath)??"":"M"+r.topPath.map(([e,t])=>`${e},${t}`).join("L"),f=so(`${n?n+"-":""}area-${t}-stroke-gradient`),y=ii(r.strokeGradient,r.topPath,f),p=r.style.stroke&&"none"!==r.style.stroke?ri("path",{d:h,fill:"none",stroke:y?`url(#${f})`:ao(r.style.stroke),strokeWidth:r.style.strokeWidth||2,opacity:r.style.opacity}):null;if(r.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return oi("g",{children:[oi("defs",{children:[c,!c&&s,y,ri("clipPath",{id:e,children:ri("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})]}),oi("g",{clipPath:`url(#${e})`,children:[ri("path",{d:i,fill:u,fillOpacity:d,opacity:c?r.style.opacity:void 0,stroke:"none"}),p]})]},"area-"+t)}return oi(Ao.Fragment,{children:[(c||s||y)&&oi("defs",{children:[c,!c&&s,y]}),ri("path",{d:i,fill:u,fillOpacity:d,opacity:c?r.style.opacity:void 0,stroke:"none"}),p]},"area-"+t)}case"point":{const r=e,o=`${n?n+"-":""}point-${t}-hatch`,i=w(r.style.fill)?S(r.style.fill,o):void 0;return oi(Ao.Fragment,{children:[i&&ri("defs",{children:i}),ri("circle",{cx:r.x,cy:r.y,r:r.r,fill:i?`url(#${o})`:ao(r.style.fill),opacity:r.style.opacity??r.style.fillOpacity??.8,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"point-"+t)}case"symbol":return uo(e,t);case"glyph":return lo(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const r=e,o=`${n?n+"-":""}xyrect-${t}-hatch`,i=w(r.style.fill)?S(r.style.fill,o):void 0;return oi(Ao.Fragment,{children:[i&&ri("defs",{children:i}),ri("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:i?`url(#${o})`:ao(r.style.fill),opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[r,o,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),a=.299*r+.587*o+.114*i>128?"#000":"#fff",s=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return oi("g",{children:[ri("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth}),ri("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:s+"px",children:e})]},"heatcell-"+t)}return ri("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth},"heatcell-"+t)}case"candlestick":{const n=e;if(n.isRange){const e=n.dotRadius??Math.max(2,n.bodyWidth/2);return oi("g",{children:[ri("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),ri("circle",{cx:n.x,cy:n.highY,r:e,fill:n.wickColor}),ri("circle",{cx:n.x,cy:n.lowY,r:e,fill:n.wickColor})]},"candle-"+t)}const r=Math.min(n.openY,n.closeY),o=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return oi("g",{children:[ri("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),ri("rect",{x:n.x-n.bodyWidth/2,y:r,width:n.bodyWidth,height:o,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}var si="undefined"==typeof window||"undefined"==typeof document;import*as li from"react";import{jsx as ci}from"react/jsx-runtime";var ui=li.createContext(null);function di({children:e}){const[t,n]=li.useState(!1),r=li.useCallback(()=>n(e=>!e),[]),o=li.useMemo(()=>({visible:t,setVisible:n,toggle:r}),[t,r]);return ci(ui.Provider,{value:o,children:e})}function hi(){return li.useContext(ui)}function fi(){const e=li.useContext(ui);return e?e.toggle:null}import{jsx as yi}from"react/jsx-runtime";var pi={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function mi({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return yi("div",{"aria-live":"polite","aria-atomic":"true",style:pi,children:t})}function gi(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function bi(e){return e&&"object"==typeof e?e:{}}function xi(e){return bi(e.accessibility).tableFields??e.accessibleDatum??e.datum}function vi(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:gi(xi(r))});break;case"line":case"area":{const e=xi(r),n=Array.isArray(e)?e:[],o="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:o,values:gi(e)});break}case"rect":{const e=xi(r),n=null!=e&&"object"==typeof e?e:{},o=n.category??r.group??"",i=n.value??n.__aggregateValue??n.total,a=gi(n);null==a.category&&""!==o&&(a.category=o+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=gi(xi(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=xi(r),n=gi(e);if(null==n.category){const t=bi(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:gi(xi(r))});break;case"arc":t.push({label:"Arc",values:gi(xi(r))});break;case"candlestick":t.push({label:"Candlestick",values:gi(xi(r))});break;case"geoarea":{const e=bi(xi(r)),n=gi(e);if(null==n.name){const t=bi(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}import*as ki from"react";import{jsx as wi,jsxs as $i}from"react/jsx-runtime";function Mi(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of a)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}function Ai(e,t,n){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var Si=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Wi="semiotic-accessible-data-table",Ci=Wi+" semiotic-accessible-data-table-hidden",ji=Wi+" semiotic-accessible-data-table-visible",Ni=ji+" semiotic-accessible-data-table-network",Oi={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Ii={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Ri={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Li={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Fi={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Pi={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},zi={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Ti={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Di({scene:e,chartType:t,tableId:n,chartTitle:r}){const[o,i]=ki.useState(!1),[a,s]=ki.useState(5),l=hi(),c=l?.visible??!1,u=o||c,d=ki.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;ki.useEffect(()=>{u||s(5)},[u]);const f=ki.useCallback(e=>{e.target===e.currentTarget&&(o||c||i(!0))},[o,c]),y=ki.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?wi("span",{id:n,tabIndex:-1,style:pi}):null;if(!u)return wi("div",{id:n,className:Ci,tabIndex:-1,onFocus:f,style:pi,role:"region","aria-label":h,children:$i("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const p=vi(e),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Si(e.min)} to ${Si(e.max)}, mean ${Si(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(p.length,m),b=Math.min(a,p.length),x=p.slice(0,b),v=p.length-b,k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return $i("div",{ref:d,id:n,className:ji,tabIndex:-1,onBlur:y,style:Oi,role:"region","aria-label":h,children:[wi("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Ri,children:"×"}),wi("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ii,children:g}),$i("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Li,children:[wi("caption",{className:"semiotic-accessible-data-table-caption",style:zi,children:v>0?`First ${b} of ${p.length} data points`:`All ${p.length} data points`}),wi("thead",{children:$i("tr",{children:[wi("th",{style:Fi,children:"type"}),w.map(e=>wi("th",{style:Fi,children:e},e))]})}),wi("tbody",{children:x.map((e,t)=>$i("tr",{children:[wi("td",{style:Pi,children:e.label}),w.map(t=>{return wi("td",{style:Pi,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Si(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&$i("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Ti,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function Ei({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:o}){const[i,a]=ki.useState(!1),[s,l]=ki.useState(5),c=hi(),u=c?.visible??!1,d=i||u,h=o?"Data summary for "+o:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=ki.useRef(null);ki.useEffect(()=>{d||l(5)},[d]);const y=ki.useCallback(e=>{e.target===e.currentTarget&&(i||u||a(!0))},[i,u]),p=ki.useCallback(e=>{u||f.current?.contains(e.relatedTarget)||a(!1)},[u]);if(!e||0===e.length)return r?wi("span",{id:r,tabIndex:-1,style:pi}):null;if(!d)return wi("div",{id:r,className:Ci,tabIndex:-1,onFocus:y,style:pi,role:"region","aria-label":h,children:$i("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const m=Array.isArray(e)?e:[],g=Array.isArray(t)?t:[],b=new Map,x=new Map,v=new Map,k=new Map;for(const e of g){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},n="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";x.set(e,(x.get(e)??0)+1),k.set(e,(k.get(e)??0)+o)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),v.set(e,(v.get(e)??0)+o)}}const w=[];for(let e=0;m.length>e;e++){const t=m[e];if(!t||"object"!=typeof t)continue;const n=t.datum?.id??t.id,r=null!=n?n+"":"node-"+e,o=b.get(r)??0,i=x.get(r)??0,a=v.get(r)??0,s=k.get(r)??0;w.push({id:r,degree:o+i,inDeg:o,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}w.sort((e,t)=>t.degree-e.degree);let $=0,M=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>M&&(M=t.degree);$=e/w.length}const A=g.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),S=[`${w.length} nodes, ${g.length} edges.`];w.length>0&&S.push(`Mean degree: ${Si($)}, max degree: ${M}.`);const W=Math.min(s,w.length),C=w.slice(0,W),j=w.length-W;return $i("div",{ref:f,id:r,className:Ni,tabIndex:-1,onBlur:p,style:Oi,role:"region","aria-label":h,children:[wi("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Ri,children:"×"}),wi("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ii,children:S.join(" ")}),$i("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:Li,children:[wi("caption",{className:"semiotic-accessible-data-table-caption",style:zi,children:j>0?`Top ${W} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),wi("thead",{children:$i("tr",{children:[wi("th",{style:Fi,children:"id"}),wi("th",{style:Fi,children:"degree"}),wi("th",{style:Fi,children:"in"}),wi("th",{style:Fi,children:"out"}),A&&wi("th",{style:Fi,children:"w. degree"}),A&&wi("th",{style:Fi,children:"w. in"}),A&&wi("th",{style:Fi,children:"w. out"})]})}),wi("tbody",{children:C.map((e,t)=>$i("tr",{children:[wi("td",{style:Pi,children:e.id}),wi("td",{style:Pi,children:e.degree}),wi("td",{style:Pi,children:e.inDeg}),wi("td",{style:Pi,children:e.outDeg}),A&&wi("td",{style:Pi,children:Si(e.wDegree)}),A&&wi("td",{style:Pi,children:Si(e.wInDeg)}),A&&wi("td",{style:Pi,children:Si(e.wOutDeg)})]},t))})]}),j>0&&$i("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:Ti,children:["Show ",Math.min(25,j)," more"," ",1===j?"node":"nodes"," (",j," remaining)"]})]})}function Bi({summary:e}){return e?wi("div",{role:"note",style:pi,children:e}):null}function Hi({tableId:e}){return wi("a",{href:"#"+e,style:pi,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,pi)},children:"Skip to data table"})}import{jsx as _i}from"react/jsx-runtime";var Gi="var(--semiotic-focus, #005fcc)";function qi({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!s)if("rect"===o&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=_i("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Gi,strokeWidth:2,strokeDasharray:"4,2"})}else u=_i("circle","wedge"===o?{cx:l,cy:c,r:12,fill:"none",stroke:Gi,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Gi,strokeWidth:2,strokeDasharray:"4,2"});else u=_i("g",{transform:`translate(${n.left},${n.top})`,children:_i("path",{d:s,fill:"none",stroke:Gi,strokeWidth:2.5,strokeDasharray:"6,3"})});return _i("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as Vi from"react";import{jsx as Yi}from"react/jsx-runtime";function Ui({x:e,y:t,containerWidth:n,containerHeight:r,margin:o,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Vi.useRef(null),[u,d]=Vi.useState(null);Vi.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[a,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Vi.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),y=f?null:K;return l?Yi("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...y||{},position:"absolute",left:o.left+e,top:o.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import*as Xi from"react";import{useCallback as Zi,useEffect as Ki,useLayoutEffect as Ji,useMemo as Qi,useRef as ea}from"react";function ta(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function na(e,t){return Math.min((e-t.startTime)/t.duration,1)}function ra(e,t,n){return e+(t-e)*n}function oa(){return"undefined"!=typeof performance?performance.now():Date.now()}var ia=()=>"undefined"!=typeof performance?performance.now():Date.now();function aa(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function sa(e,t){const n=e();return Number.isFinite(n)?n:t}var la=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??ia,this.lastWallTime=sa(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=sa(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??ia;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=sa(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:aa(n)))}},ca=22,ua="undefined"==typeof window?Ki:Ji,da={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function ha(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function fa(e){const t=l(),n=ea(t);n.current=t;const[o,i]=Vt(e.sizeProp,e.responsiveWidth,e.responsiveHeight),a=!!e.title,s=!!e.legend&&"top"===e.legendPosition,c=Qi(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},a,s),[e.marginDefault,e.userMargin,a,s]),u=i[0]-c.left-c.right,d=i[1]-c.top-c.bottom,h=ha(e.foregroundGraphics,i,c),f=ha(e.backgroundGraphics,i,c),y=r(e=>e.theme),{transition:p,introEnabled:m}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+Xi.useId(),b=ea(null);if(!b.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new la({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const x=b.current;x.configure({clock:e.clock,random:e.random,seed:e.seed});const v=ea(null),k=ea(e.frameScheduler??da);k.current=e.frameScheduler??da;const w=ea(null),$=ea(!1),M=ea(()=>{}),A=Zi(()=>{if(null!==v.current||$.current)return;const e=k.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&($.current=!0),v.current=null,w.current=null;try{M.current()}finally{e&&($.current=!1)}});n=!0,t||(v.current=r,w.current=e)},[]),S=Zi(()=>{null!==v.current&&((w.current??k.current).cancelAnimationFrame(v.current),v.current=null,w.current=null)},[]);ua(()=>{x.setPaused(!0===e.paused)},[x,e.paused]),Ki(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void x.setVisible(!0);const t=()=>x.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[x,e.suspendWhenHidden]),Ki(()=>()=>{S()},[S]);const W=ea(()=>{}),C=ea(()=>{}),j=ea(null),N=ea(null),O=ea(null),I=Zi(()=>{const e=j.current;j.current=null,e&&W.current(e)},[]),R=Zi(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===N.current){const e=k.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,N.current=null,O.current=null,I()});t||(N.current=n,O.current=e)}},[I]),L=Zi(()=>{j.current=null,null!==N.current&&((O.current??k.current).cancelAnimationFrame(N.current),N.current=null,O.current=null),C.current()},[]);Ki(()=>()=>{j.current=null,null!==N.current&&((O.current??k.current).cancelAnimationFrame(N.current),N.current=null,O.current=null)},[]);const F=e.themeDirtyRef;return ua(()=>{F&&(jo++,F.current=!0,A())},[y,A,F]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:i,margin:c,adjustedWidth:u,adjustedHeight:d,resolvedForeground:h,resolvedBackground:f,currentTheme:y,transition:p,introEnabled:m,tableId:g,frameRuntime:x,rafRef:v,renderFnRef:M,scheduleRender:A,cancelRender:S,hoverHandlerRef:W,hoverLeaveRef:C,onPointerMove:R,onPointerLeave:L}}import{useEffect as ya,useRef as pa}from"react";import{jsx as ma}from"react/jsx-runtime";function ga(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,a=pa(null),l=pa(null),c=pa(!1);return s({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),ya(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),ya(()=>{!c.current&&(c.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:l}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function ba({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?ma("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:ma("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function xa(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),a=Math.round(t[1]*r),s=i/t[0],l=a/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(s,0,0,l,0,0),o.translate(n.left,n.top),o}function va(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function ka(e){return"touch"===e?"touch":"pointer"}function wa(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function $a(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:i,chartId:a})):t({type:"hover-end",timestamp:l,chartType:i,chartId:a}))}function Ma(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:i,chartId:a})):t({type:"click-end",timestamp:l,chartType:i,chartId:a}))}function Aa(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}function Sa(e){return e?"string"==typeof e?{name:e}:e:null}var Wa=.5;function Ca(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var ja={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Na(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!o&&!i)return ja;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}var Oa={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}},Ia={top:10,bottom:10,left:10,right:10};function Ra(e){return e.compactMode?e.marginDefaults:Ia}function La(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}import{useMemo as Fa,useCallback as Pa,useState as za,useId as Ta,useEffect as Da,useRef as Ea}from"react";function Ba({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),s=a?r(a,t,n):n?n(o):ze[i%ze.length];return{label:o+"",color:s}}),label:""}]}}function Ha(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function _a(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function Ga(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var qa=[];function Va(){const e=n(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Ya(){const e=n();return e?.colors?.sequential||void 0}function Ua(){const e=n();return e?.colors?.diverging||void 0}function Xa(e,t,n,r,o){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=Be(n,r);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Re[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(o.has(r)||o.set(r,o.size),i[o.get(r)%i.length]):i[0]:Fe}function Za(e,t,n){const r=Ye(),o=Va();return Fa(()=>{if(!t)return;const i=r??void 0,a=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Ga(i)){const e=He(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return He(n.map(e=>({_cat:e})),"_cat",a)}if(i&&Ga(i)){const n=He(e,t,a);return e=>i[e]||n(e)}return He(e,t,a)}if(i&&Ga(i)){const e=He([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,r,o])}function Ka(e,t,n){return Fa(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const r=[...e],o="function"==typeof(i=n)?i:e=>e[i];var i;return r.sort("asc"===t?(e,t)=>o(e)-o(t):(e,t)=>o(t)-o(e))},[e,t,n])}function Ja({selection:e,linkedHover:t,fallbackFields:n=qa,unwrapData:r=!1,onObservation:o,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=Ta(),h=Fa(()=>Aa(t,n),[t,n]),f=Fa(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),y=pt({name:e?.name||"__unused__",fields:f}),p=gt({name:h?.name||"hover",fields:f}),m=N(e=>e.pushObservation),g=Pa(e=>{o?.(e),m?.(e)},[o,m]),b=e?{isActive:y.isActive,predicate:y.predicate}:null,[x,v]=za(null),k=Ea(!1),w=c||n[0],$=Fa(()=>{if(!l||null==x||!w)return null;const e=x,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,x,w]),M=Pa((e,n)=>{const r=!e&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Ha(e,t,h.xField);null!=n&&function(e,t,n){const r=ot.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n})},at())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&p.onHover(t)}else"x-position"!==h?.mode||r||st(h.name||"hover",d),"x-position"===h?.mode||r||p.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else r||v(null);(o||m)&&$a({onObservation:g,datum:e?_a(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:a,context:n})},[t,p,h,d,o,i,a,m,g,l,w,u]),A=Pa((n=!0)=>{k.current=!1,t&&"x-position"!==h?.mode&&p.onHover(null),e&&u?.tapToSelect&&y.clear(),n&&l&&v(null),"x-position"===h?.mode&&(lt(h.name||"hover",d),st(h.name||"hover",d))},[t,h,p,e,u,y,l,d]),S=Pa((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Ha(n,e,h.xField);null!=t&&function(e,t,n){const r=ot.positions.get(e);if(r?.locked){const t=new Map(ot.positions);return t.delete(e),ot={positions:t},at(),!1}ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n,locked:!0})},at()}(h.name||"hover",t,d)}if(c)if(n){k.current=!0;const r=_a(n);if(t&&"x-position"!==h?.mode&&p.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}Ga(e)&&y.selectPoints(e)}if(l&&w){const e=r?.[w];v(null!=e?e+"":null)}}else b&&A();if(n||b){if(n&&s){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),s(e,{x:n.x??0,y:n.y??0})}(o||m)&&Ma({onObservation:g,datum:n?_a(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:a,context:r})}},[s,o,m,g,i,a,h,d,u,t,p,e,y,f,l,w,A]);return Da(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),Da(()=>()=>{k.current&&A(!1)},[A]),Da(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{lt(e,d),st(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:$,customHoverBehavior:M,customClickBehavior:S,crosshairSourceId:d}}function Qa(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function es({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s,additionalLegend:l}){const c=At(Xt),u=null!==At(Jt),d=void 0!==r?r:!c&&!!t,h=!!t&&(d||u),f=Fa(()=>{if(!h)return[];if(void 0!==s)return s;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[s,t,e,h]);nn(u&&t?f:[]);const y=Fa(()=>{if(!d||!t)return;const r=Ba({data:e,colorBy:t,colorScale:n,getColor:Ee,categories:f});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[d,t,e,n,f]),p=Fa(()=>jn(y,l),[y,l]),m=Fa(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return p&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,i,p,o]);return{legend:p,margin:m,legendPosition:o}}function ts(e,t,n){const[r,o]=za(null),[i,a]=za(new Set),s=Fa(()=>new Set,[]),l=Pa(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=Pa(t=>{"isolate"===e&&a(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),u=Fa(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}function ns(e,t,n){return function(e,t,n){const r=Oa[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,a=un({...t,mode:e},{width:t.width??o,height:t.height??i}).props,s=a.mode||e||"primary",l=Oa[s],c="context"===s||"sparkline"===s,u="primary"===s&&n?.width?n.width:l.width;return{mode:s,width:a.width??u,height:a.height??("primary"===s&&n?.height?n.height:l.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:La(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:Na(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}(e,t,n)}export{dn as EMPTY_ARRAY,hn as filterSparseArray,de as schemeCategory10,be as interpolateViridis,Me as SEQUENTIAL_INTERPOLATORS,Ae as getSequentialInterpolator,Se as interpolateRdBu,We as interpolatePiYG,Ce as interpolatePRGn,je as interpolateBrBG,Ne as interpolateRdYlBu,Oe as interpolateRdYlGn,Ie as interpolateSpectral,Re as COLOR_SCHEMES,Le as DEFAULT_COLORS,Fe as DEFAULT_COLOR,Pe as resolveCategoricalPalette,ze as STREAMING_PALETTE,Te as DEPTH_PALETTE_COLORS,Ee as getColor,Be as resolveExplicitColor,He as createColorScale,_e as getSize,ta as computeEasing,na as computeRawProgress,ra as lerp,oa as now,c as DEFAULT_LIFECYCLE_THRESHOLDS,u as bandFromAge,d as resolveMotionAccessor,h as compileMotionEncoding,f as resolveMotionAge,y as opacityFromAge,p as resolveMotionVector,m as deriveMotionVector,eo as SYMBOL_SEQUENCE,to as symbolPathString,no as symbolRadius,mn as UpdateResultTracker,Sn as useSceneRevisionDiagnostics,Wn as runSceneBuild,Cn as SceneRevisionDiagnosticsObserver,Ro as resolveCSSColor,Lo as getCSSColorCacheVersion,Fo as parseCanvasColor,x as createHatchPattern,w as isHatchFill,M as hatchFillId,S as hatchPatternDef,W as resolveSvgFill,qo as resolveCurveFactory,Vo as resolveCanvasFill,Yo as coerceCanvasFill,Uo as buildLinearFillGradient,Xo as buildColorStopGradient,jn as composeLegendConfigs,In as renderLegendFromConfig,Fn as ANNOTATION_DISCLOSURE_REVEAL_CSS,N as useObservationSelector,O as useAnnotationActivationOptions,I as annotationStableId,R as annotationActivationProps,L as isAnnotationActivationTarget,T as estimateLabelWidth,D as AnnotationLabel,br as renderAnnotationPass,xr as createDefaultAnnotationRules,wr as annotationType,$r as isNoteAnnotation,Mr as annotationDrawsConnector,Sr as annotationBudget,Br as annotationLayout,lt as unlockCrosshair,yt as useCrosshairPosition,ca as TITLE_BASELINE,_r as hasAnyCornerRadius,Gr as clampCornerRadii,ei as networkSceneNodeToSVG,ti as networkSceneEdgeToSVG,ni as networkLabelToSVG,yo as geoSceneNodeToSVG,bo as annularSectorPath,xo as buildGaugeGradientGeometry,Mo as ordinalSceneNodeToSVG,ai as xySceneNodeToSVG,si as isServerEnvironment,di as DataSummaryProvider,hi as useDataSummary,fi as useDataSummaryToggle,mi as AriaLiveTooltip,vi as extractAllRows,Mi as computeCanvasAriaLabel,Ai as computeNetworkAriaLabel,Di as AccessibleDataTable,Ei as NetworkAccessibleDataTable,Bi as ScreenReaderSummary,Hi as SkipToTableLink,qi as FocusRing,V as getPointerHitRadius,U as buildHoverData,q as smartTooltipEntries,K as defaultTooltipStyle,ee as Tooltip,te as MultiLineTooltip,ne as MultiPointTooltip,re as normalizeTooltip,Ui as FlippingTooltip,aa as createSeededFrameRandom,fa as useFrame,ga as useFrameCanvasHost,ba as CanvasFrameBackground,xa as prepareCanvas,va as getDevicePixelRatio,ka as observationInputType,wa as isInteractiveKeyboardTarget,$a as emitHoverObservations,Ma as emitClickObservations,Ve as CategoryColorProvider,Ye as useCategoryColors,nt as useSelectionSelector,pt as useSelection,mt as useSelectionActions,gt as useLinkedHover,xt as useBrushSelection,kt as useFilteredData,$t as useChartObserver,Kt as useLinkedChartsActive,nn as useLinkedChartCategories,sn as LinkedCharts,Ba as createLegend,Aa as normalizeLinkedHover,Sa as normalizeLinkedBrush,Wa as DEFAULT_SELECTION_OPACITY,Ca as wrapStyleWithSelection,cn as responsiveRuleMatches,un as resolveResponsiveRules,Na as resolveMobileInteraction,Ra as resolveAxisFreeMarginDefaults,Va as useThemeCategorical,Ya as useThemeSequential,Ua as useThemeDiverging,Xa as resolveDefaultFill,Za as useColorScale,Ka as useSortedData,Ja as useChartSelection,Qa as getCrosshairProps,es as useChartLegendAndMargin,ts as useLegendInteraction,ns as useChartMode};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createSeededFrameRandom as t,schemeCategory10 as e}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{getMinMax as o}from"./chunk-chunk-JJ2OOIET.module.min.js";import*as n from"react";import{jsx as r}from"react/jsx-runtime";var s={isActive:!1,predicate:()=>!0},i=n.createContext(null);function a({value:t,children:e}){return r(i.Provider,{value:t,children:e})}function c(){return n.useContext(i)??s}function l(t,e){return null!=t?r(a,{value:e,children:t}):t}import{forceSimulation as f,forceCenter as u,forceX as h,forceY as d,forceLink as g,forceManyBody as y,forceCollide as m}from"d3-force";import{scaleLinear as p}from"d3-scale";var x=new Set,M=new WeakMap;function S(t,e){if("production"===process.env.NODE_ENV)return t;if(!t||!t.data||"object"!=typeof t.data)return t;let o=M.get(t);if(o){const t=o.get(e);if(t)return t}else o=new Map,M.set(t,o);const n=new Proxy(t,{get(t,o,n){if("string"==typeof o&&!(o in t)&&t.data&&o in t.data){const t=`${e}:${o}`;x.has(t)||(x.add(t),console.warn(`[Semiotic] "${e}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(t,o,n)}});return o.set(e,n),n}var b={supportsStreaming:!0,hierarchical:!1,computeLayout(e,o,n,r){if(0===e.length)return;const s=n.forceStrength??.1,i=r[0]/2,a=r[1]/2,c=Math.max(.1,Math.min(1,Math.min(r[0],r[1])/200)),l=Math.min(.5,.06+1.8*(1-c)),p=n.__previousPositions;let x=0;const M=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=p?.get(t.id);e?x++:o?(t.x=o.x,t.y=o.y,x++):M.push(t)}const S=x>0&&.3>=(e.length>0?M.length/e.length:1);if(S){const t=new Map;for(const o of e)t.set(o.id,o);for(const e of M){const n=v(e.id,o,t);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const r=k(e.id),s=r%360*(Math.PI/180),i=(10+r%20)*c;e.x=t/n.length+i*Math.cos(s),e.y=o/n.length+i*Math.sin(s)}else{const t=k(e.id),o=t%360*(Math.PI/180),n=(15+t%30)*c;e.x=i+n*Math.cos(o),e.y=a+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5)*c,r=o*t;n.x=i+e*Math.cos(r),n.y=a+e*Math.sin(r)}}}const b=n.__skipForceSimulation||0===n.iterations?0:S?40:n.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),_=w(n.nodeSize,n.nodeSizeRange,e),z=t=>_(t);if(b>0){const p=new Map,x=new Map;for(const t of e)p.set(t.id,0),x.set(t.id,t);for(const t of o){const e="string"==typeof t.source?t.source:t.source.id,o="string"==typeof t.target?t.target:t.target.id;p.set(e,(p.get(e)??0)+1),p.set(o,(p.get(o)??0)+1)}const M=g().strength(t=>{const e=t.weight,o="string"==typeof t.target?t.target:t.target.id,n=Math.max(1,Math.min(p.get("string"==typeof t.source?t.source:t.source.id)??1,p.get(o)??1));return Math.min(2.5,(e&&e>0?Math.sqrt(e):1)*s/(.1*n))}).distance(t=>{const e="string"==typeof t.source?x.get(t.source):t.source,o="string"==typeof t.target?x.get(t.target):t.target,n=(e?z(e):0)+(o?z(o):0)+Math.max(6,12*c);return Math.max(16,40*c,n)}).id(t=>t.id),v=f();if(void 0===n.random&&void 0===n.seed||v.randomSource(n.random??t(n.seed)),v.force("charge",y().strength(t=>{const e=p.get(t.id)??0;return-15*c*z(t)*Math.sqrt(e+1)})).force("collide",m(t=>z(t)+3*c).strength(.9).iterations(2)).force("center",u(i,a).strength(.8)).force("x",h(i).strength(l)).force("y",d(a).strength(l)).force("bounds",function(t,e,o=2,n=.6){let r=[];const s=s=>{const i=n*Math.max(s,.2);for(const n of r){const r=n.x??t[0]/2,s=n.y??t[1]/2,a=n.vx??0,c=n.vy??0,l=e(n)+o,f=Math.min(t[0]/2,l),u=Math.max(t[0]/2,t[0]-l),h=Math.min(t[1]/2,l),d=Math.max(t[1]/2,t[1]-l),g=r+a,y=s+c;f>g?n.vx=a+(f-g)*i:g>u&&(n.vx=a+(u-g)*i),h>y?n.vy=c+(h-y)*i:y>d&&(n.vy=c+(d-y)*i)}};return s.initialize=t=>{r=t},s}(r,z)),v.nodes(e),o.length>0){const t=o.map(t=>({...t,source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id}));M.links(t),v.force("link",M)}S?v.alpha(.3):.1>v.alpha()&&v.alpha(1),v.stop();for(let t=0;b>t;++t)v.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=z(t),o=b>0?2:0,n=Math.min(r[0]/2,e+o),s=Math.min(r[1]/2,e+o);t.x=Math.max(n,Math.min(r[0]-n,t.x)),t.y=Math.max(s,Math.min(r[1]-s,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const R=new Map;for(const t of e)R.set(t.id,t);for(const t of o){if("string"==typeof t.source){const e=R.get(t.source);e&&(t.source=e)}if("string"==typeof t.target){const e=R.get(t.target);e&&(t.target=e)}}},buildScene(t,o,n,r){const s=n.nodeStyle,i=n.edgeStyle,a=w(n.nodeSize,n.nodeSizeRange,t),c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:e,l=new Map;t.forEach((t,e)=>{l.set(t.id,c[e%c.length])});const f=[],u=[],h=[];for(const e of t){if(null==e.x||null==e.y)continue;const t=a(S(e,"nodeSize")),o=s?s(S(e,"nodeStyle")):{},r={fill:o.fill||l.get(e.id)||n.themeSemantic?.primary||"#007bff",stroke:o.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??2,opacity:o.opacity};f.push({type:"circle",cx:e.x,cy:e.y,r:t,style:r,datum:e,id:e.id,label:e.id})}const d=new Map;for(const e of t)d.set(e.id,e);for(const t of o){const e="object"==typeof t.source?t.source:d.get(t.source),o="object"==typeof t.target?t.target:d.get(t.target);if(!e||!o)continue;if(null==e.x||null==e.y)continue;if(null==o.x||null==o.y)continue;const r=i?i(S(t,"edgeStyle")):{};u.push({type:"line",x1:e.x,y1:e.y,x2:o.x,y2:o.y,style:{stroke:r.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:r.strokeWidth??1,opacity:r.opacity??.6},datum:t})}if(!1!==n.showLabels){const e=(g=n.nodeLabel)?"function"==typeof g?g:t=>t[g]||t.id:null;for(const o of t){if(null==o.x||null==o.y)continue;const t=e?e(o):o.id;if(!t)continue;const n=a(S(o,"nodeSize"));h.push({x:o.x,y:o.y-n-4,text:t+"",anchor:"middle",baseline:"auto",fontSize:11})}}var g;return{sceneNodes:f,sceneEdges:u,labels:h}}};function v(t,e,o){const n=[];for(const r of e){const e="string"==typeof r.source?r.source:r.source.id,s="string"==typeof r.target?r.target:r.target.id;let i=null;if(e===t?i=s:s===t&&(i=e),i){const t=o.get(i);!t||0===t.x&&0===t.y||n.push({x:t.x,y:t.y})}}return n}function k(t){let e=0;for(let o=0;t.length>o;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}function w(t,e,n){if(n.some(t=>null!=t.__forceRadius))return t=>t.__forceRadius??8;if(null==t)return()=>8;if("number"==typeof t)return()=>t;if("function"==typeof t)return e=>t(e)||8;const r=e||[5,20],s=[];for(const e of n){const o=e.data?.[t];"number"==typeof o&&s.push(o)}if(0===s.length)return()=>r[0];const[i,a]=o(s);if(i===a)return()=>(r[0]+r[1])/2;const c=p().domain([i,a]).range(r).clamp(!0);return e=>{const o=e.data?.[t];return null==o||"number"!=typeof o?r[0]:c(o)}}export{a as CustomLayoutSelectionProvider,c as useCustomLayoutSelection,l as wrapWithCustomLayoutSelection,S as wrapWithDataHint,b as forceLayoutPlugin,w as resolveNodeSizeFn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{darkenColor as t,lightenColor as o}from"./chunk-chunk-2JGJ5GUG.module.min.js";import{getMax as n,getMinMax as e}from"./chunk-chunk-JJ2OOIET.module.min.js";var r="__forecastSegment",a="__forecastOpacity";function s(t,o,n,r){const s=o.uncertaintyOpacity,i=o.confidenceAccessor;if(!s&&!i)return;const l="object"==typeof s?s:{},c=l.min??.15,f=l.max??1;if(i){const o="function"==typeof i?i:t=>t[i];for(const n of t){const t=o(n);null!=t&&Number.isFinite(t)&&(n[a]=c+Math.max(0,Math.min(1,t))*(f-c))}return}const u=t.map(t=>{const o=n(t),e=r(t);return null!=o&&null!=e&&Number.isFinite(o)&&Number.isFinite(e)?Math.abs(o-e):NaN}),p=u.filter(t=>Number.isFinite(t));if(0===p.length)return;const[h,y]=e(p),d=y-h;t.forEach((t,o)=>{const n=u[o];Number.isFinite(n)&&(t[a]=f-(d>0?(n-h)/d:0)*(f-c))})}function i(t,o){return"function"==typeof o?o(t):!!t[o]}function l(t){return[{type:"anomaly-band",threshold:t.threshold??2,showBand:!1!==t.showBand,fill:t.bandColor||"#6366f1",fillOpacity:t.bandOpacity??.1,anomalyColor:t.anomalyColor||"#ef4444",anomalyRadius:t.anomalyRadius??6,label:t.label}]}function c(t,o,e,a,l){return(c=a).isTraining||c.isForecast||c.isAnomaly||c.upperBounds||c.lowerBounds?function(t,o,n,e,a){const{isTraining:l,isForecast:c,isAnomaly:f,upperBounds:u,lowerBounds:p,color:h="#6366f1",bandOpacity:y=.15,anomalyColor:d="#ef4444",anomalyRadius:m=6,label:b}=e,g=t.map(t=>{let o="observed";return c&&i(t,c)?o="forecast":l&&i(t,l)&&(o="training"),{...t,[r]:o}}),k=e._groupBy,_=[];if(k){const t=new Map;for(const o of g){const n=o[k]??"__default";t.has(n)||t.set(n,[]),t.get(n).push(o)}const o=[];for(const[,n]of t)for(let t=0;n.length-1>t;t++)n[t][r]!==n[t+1][r]&&(o.push({...n[t+1],[r]:n[t][r]}),o.push({...n[t],[r]:n[t+1][r]}));_.push(...g,...o)}else for(let t=0;g.length>t;t++)_.push(g[t]),g.length-1>t&&g[t][r]!==g[t+1][r]&&(_.push({...g[t+1],[r]:g[t][r]}),_.push({...g[t],[r]:g[t+1][r]}));if(e.trainUnderline){const t=[];for(const o of _)"training"===o[r]&&t.push({...o,[r]:"training-base"});_.unshift(...t)}const O=[];if(u&&p){const t="string"==typeof u?u:"__envUpper",o="string"==typeof p?p:"__envLower";if("function"==typeof u||"function"==typeof p)for(const n of _)"function"==typeof u&&(n[t]=u(n)),"function"==typeof p&&(n[o]=p(n));O.push({type:"envelope",upperAccessor:t,lowerAccessor:o,fill:h,fillOpacity:y,label:b})}if(e.uncertaintyOpacity||e.confidenceAccessor){const t=u?"function"==typeof u?u:t=>t[u]:()=>{},o=p?"function"==typeof p?p:t=>t[p]:()=>{};s(_.filter(t=>"forecast"===t[r]),e,t,o)}if(f){const t=e.anomalyStyle,o={type:"highlight",filter:t=>i(t,f)};t?(o.style=t,o.r=m):"function"==typeof d?(o.style=t=>{const o=d(t);return{stroke:o,strokeWidth:1.5,fill:o,fillOpacity:.7}},o.r=m):(o.color=d,o.r=m,o.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),O.push(o)}return a&&O.push({type:"anomaly-band",threshold:a.threshold??2,showBand:!1!==a.showBand,fill:a.bandColor||"#6366f1",fillOpacity:a.bandOpacity??.1,anomalyColor:a.anomalyColor||"#ef4444",anomalyRadius:a.anomalyRadius??6,label:a.label}),{processedData:_,annotations:O}}(t,0,0,a,l):function(t,o,e,a,i){const{trainEnd:l,steps:c=10,confidence:f=.95,color:u="#6366f1",bandOpacity:p=.15,label:h}=a;if(null==l)return{processedData:t,annotations:[]};const y=[],d=[];for(const n of t)n[o]>l?d.push({...n,[r]:"observed"}):y.push({...n,[r]:"training"});const m=y.map(t=>[t[o],t[e]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,o)=>t[0]-o[0]),b=[],g=[];if(m.length>=3){const i=m.length;let l=0,y=0,d=0,k=0;for(const[t,o]of m)l+=t,y+=o,d+=t*t,k+=t*o;const _=i*d-l*l;if(Math.abs(_)>1e-12){const d=(i*k-l*y)/_,O=(y-d*l)/i,w=t=>O+d*t,B=m.map(([t,o])=>o-w(t)).reduce((t,o)=>t+o*o,0),F=Math.sqrt(B/Math.max(i-2,1)),v=m.reduce((t,o)=>t+o[0],0)/i,C=m.reduce((t,o)=>t+(o[0]-v)**2,0),D=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,A=t.map(t=>t[o]).filter(t=>null!=t&&isFinite(t)),M=n(A),N=m.length>1?(m[i-1][0]-m[0][0])/(i-1):1;for(let t=1;c>=t;t++){const n=M+t*N,a=w(n),s=F*Math.sqrt(1+1/i+(C>0?(n-v)**2/C:0))*D;g.push({[o]:n,[e]:a,[r]:"forecast",__forecastUpper:a+s,__forecastLower:a-s})}s(g,a,t=>t.__forecastUpper,t=>t.__forecastLower),b.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:u,fillOpacity:p,label:h})}}b.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&b.push({type:"anomaly-band",threshold:i.threshold??2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:i.bandOpacity??.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:i.anomalyRadius??6,label:i.label});const k=[];if(k.push(...y),y.length>0&&d.length>0&&k.push({...y[y.length-1],[r]:"observed"}),k.push(...d),g.length>0){const t=d.length>0?d[d.length-1]:y[y.length-1];t&&k.push({...t,[r]:"forecast"}),k.push(...g)}return{processedData:k,annotations:b}}(t,o,e,a,l);var c}function f(n,e){const s=e.trainDasharray??"8,4",i=e.forecastDasharray??"4,4",l=e.color||"#6366f1",c=e.trainOpacity,f=e.forecastOpacity,u=e.trainStroke,p=e.trainLinecap,h=e.trainUnderline;return e=>{const y=n(e),d=e[r];if("training"===d){let o=y.stroke;return"darken"===u?o=t(y.stroke||"#666",.5):u&&(o=u),{...y,stroke:o,strokeDasharray:s,...p&&{strokeLinecap:p},...null!=c&&{strokeOpacity:c}}}if("training-base"===d){let t=y.stroke||"#666";return"lighten"===h&&(t=o(t,.4)),{...y,stroke:t,strokeDasharray:void 0}}if("forecast"===d){const t=e[a],o=null!=t?t:f;return{...y,stroke:l,strokeDasharray:i,...null!=o&&{strokeOpacity:o}}}return y}}export{r as SEGMENT_FIELD,a as FORECAST_OPACITY_FIELD,s as stampForecastOpacity,l as buildAnomalyAnnotations,c as buildForecast,f as createSegmentLineStyle};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
function t(t){if(null==t)return()=>{};const n="function"==typeof t?t:n=>n[t];return t=>e(n(t))}function n(n,i){const e=t(n),o=t(i);return(t,n)=>{const i=o(t);return{value:i,x:e(t),y:i,category:n}}}function i(n,i){const e=t(i??"value"),o=null==n?void 0:"function"==typeof n?n:t=>t[n];return t=>{const n=o?o(t):void 0;return{value:e(t),category:null==n?void 0:n+""}}}function e(t){if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t&&""!==t.trim()){const n=Number(t);return Number.isFinite(n)?n:void 0}}function o(t,n,i){const o=null!=t.axis?i[t.axis]:null!=t.field?n[t.field]:i.value;if(void 0!==t.eq&&o!==t.eq)return!1;if(void 0!==t.ne&&o===t.ne)return!1;if(void 0!==t.in&&!t.in.includes(o))return!1;if(void 0===t.gt&&void 0===t.gte&&void 0===t.lt&&void 0===t.lte&&void 0===t.within&&void 0===t.outside)return!0;const r=e(o);if(void 0===r)return!1;if(void 0!==t.gt&&t.gt>=r)return!1;if(void 0!==t.gte&&t.gte>r)return!1;if(void 0!==t.lt&&r>=t.lt)return!1;if(void 0!==t.lte&&r>t.lte)return!1;if(void 0!==t.within){const[n,i]=t.within;if(n>r||r>i)return!1}if(void 0!==t.outside){const[n,i]=t.outside;if(r>=n&&i>=r)return!1}return!0}function r(t,n,i){const e=t.when;return void 0===e||!0===e||!1!==e&&("function"==typeof e?e(n,i):o(e,n,i))}function u(t,n,i){if(!n||0===n.length)return{};let e={};for(const o of n){if(!r(o,t,i))continue;const n="function"==typeof o.style?o.style(t,i):o.style;n&&(e={...e,...n})}return e}function f(t,n,i,e=t=>t){const o=t??(()=>({}));return n&&0!==n.length?(t,r)=>{const f=e(t),c={...o(t,r)};return Object.assign(c,u(f,n,i(f,r))),c}:o}function c(t,n,i){return t&&0!==t.length?(e,o)=>{const r=u(e,t,n(e,o)),f=i?i(e,o):void 0;return f?{...r,...f}:r}:i}function s(t,n,e,o){if(!t||0===t.length)return o;const r=i(n,e);return(n,i)=>{const e=n&&n.data||n,f=u(e,t,r(e)),c=o?o(n,i):void 0;return c?{...f,...c}:f}}function l(t,i,e,o){return c(t,n(i,e),o)}function d(n,i,e){const o=t(i);return c(n,(t,n)=>({value:o(t),category:n}),e)}export{t as makeRuleValueResolver,n as makeXYRuleContext,i as makeNodeRuleContext,o as matchesThreshold,r as ruleMatches,u as resolveStyleRules,f as composeStyleRules,c as makeStyleRuleStyleFn,s as styleRulesToNodeStyle,l as styleRulesToXYStyle,d as styleRulesToPieceStyle};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{buildNavGraph as t,extractGeoNavPoints as e,extractOrdinalNavPoints as r,extractXYNavPoints as n,navPointToHover as i,nextGraphIndex as s,nextIndex as o,renderCirclePulse as c,resolvePosition as u}from"./chunk-chunk-F7WFPD4O.module.min.js";import{emitClickObservations as a,emitHoverObservations as f,isInteractiveKeyboardTarget as l,resolveCanvasFill as h}from"./chunk-chunk-BFHUYEOS.module.min.js";var p=class{constructor(t){if(this._capacity=t,this.head=0,this._size=0,1>t)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(t)}push(t){let e;return this._size===this._capacity?e=this.buffer[this.head]:this._size++,this.buffer[this.head]=t,this.head=(this.head+1)%this._capacity,e}pushMany(t){const e=[];for(const r of t){const t=this.push(r);void 0!==t&&e.push(t)}return e}get(t){if(t>=0&&this._size>t)return this.buffer[(this.head-this._size+t+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let t=0;return{next:()=>this._size>t?{done:!1,value:this.get(t++)}:{done:!0,value:void 0}}}forEach(t){const e=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++)t(this.buffer[(e+r)%this._capacity],r)}toArray(){const t=Array(this._size),e=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++)t[r]=this.buffer[(e+r)%this._capacity];return t}resize(t){if(1>t)throw Error("RingBuffer capacity must be at least 1");const e=this.toArray();let r=0,n=[];e.length>t&&(r=e.length-t,n=e.slice(0,r)),this._capacity=t,this.buffer=Array(t),this.head=0,this._size=0;for(let t=r;e.length>t;t++)this.push(e[t]);return n}update(t,e){const r=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const s=(n+i)%this._capacity,o=this.buffer[s];if(t(o)){let t;t="object"!=typeof o||null===o?o:Array.isArray(o)?[...o]:{...o},r.push(t),this.buffer[s]=e(o)}}return r}remove(t){const e=[],r=[];if(this.forEach(n=>{t(n)?r.push(n):e.push(n)}),0===r.length)return r;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const t of e)this.push(t);return r}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}};function y(t,e,r,n){return"function"==typeof e.style?e.style(n||{},r):e.style&&"object"==typeof e.style?e.style:t.resolveBoundsStyle(r,n)}function d(t,e,r,n){if(!t.scales)return null;const i=[],s=[];for(const r of e){const e=t.getX(r);if(!Number.isFinite(e))continue;const o=n.getTop(r),c=n.getBottom(r);if(!Number.isFinite(o)||!Number.isFinite(c))continue;const u=t.scales.x(e),a=t.scales.y(o),f=t.scales.y(c);Number.isFinite(u)&&Number.isFinite(a)&&Number.isFinite(f)&&(i.push([u,a]),s.push([u,f]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:s,...t.config.curve&&"linear"!==t.config.curve&&{curve:t.config.curve},style:y(t,n,r,e[0]),datum:e,group:r,interactive:n.interactive}}function v(t){const e=[],r=[];if(!t)return{perSeries:e,aggregate:r};for(const n of t)n.perSeries?e.push(n):r.push(n);return{perSeries:e,aggregate:r}}function _(t,e,r){const n=[];for(const i of r){const r=d(t,e,"__ribbon_aggregate",i);r&&n.push(r)}return n}function g(t,e,r,n){const i=[];for(const s of n){const n=d(t,e,r,s);n&&i.push(n)}return i}function m(t,e){if(!t)return{};if(!e||0===e.length)return t;const r=[];for(const n of e){if("band"!==n.kind)continue;const e=n.getTop(t),i=n.getBottom(t);Number.isFinite(i)&&Number.isFinite(e)&&r.push({y0:i,y1:e})}return 0===r.length?t:{...t,band:r[0],bands:r}}function b(t,e,r,n){const i=n.current,s=!0===t.lastCustomLayoutFailure?.preservedLastGoodScene,o=!s&&t.hasActivePulsesAt(e),c=!(r||s||!o&&!i)&&t.refreshPulse(e);return n.current=o,{changed:c,pending:o}}import{useCallback as k,useRef as z}from"react";function A(t,e,r,n){const i=z({accessor:e,onChange:r,readData:n}),s=z([]);return i.current={accessor:e,onChange:r,readData:n},k(()=>{const{accessor:e,onChange:r,readData:n}=i.current;if(!r||!e)return;const o=function(t,e){if(!e)return[];const r=new Set,n=[];for(const i of t){if(!i||"object"!=typeof i)continue;const t="function"==typeof e?e(i):i[e];if(null==t)continue;const s=t+"";r.has(s)||(r.add(s),n.push(s))}return n}(t.current?n(t.current):[],e);(function(t,e){if(t.length!==e.length)return!1;for(let r=0;t.length>r;r++)if(t[r]!==e[r])return!1;return!0})(o,s.current)||(s.current=o,r(o))},[t])}var w=(t,e,r,n)=>{const i=e.filter(t=>"point"===t.type);if(0!==i.length){t.save();try{const e=t.globalAlpha;for(const r of i)t.beginPath(),t.arc(r.x,r.y,r.r,0,2*Math.PI),t.globalAlpha=e*(r.style.opacity??r.style.fillOpacity??1),t.fillStyle=h(t,r.style.fill,"#4e79a7"),t.fill(),r.style.stroke&&(t.strokeStyle=h(t,r.style.stroke,r.style.stroke),t.lineWidth=r.style.strokeWidth||1,t.stroke()),c(t,r)}finally{t.restore()}}};import{useCallback as R}from"react";function x({customHoverBehavior:t,customClickBehavior:e,onObservation:r,chartId:n,chartType:i}){return{customHoverBehavior:R((e,s)=>{t?.(e,s),f({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:n,context:s})},[n,i,t,r]),customClickBehavior:R((t,s)=>{e?.(t,s),a({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:n,context:s})},[n,i,e,r]),hasClickBehavior:!(!e&&!r)}}import{useCallback as D,useRef as P}from"react";function B({storeRef:e,hoverRef:r,hoveredNodeRef:n,setHoverPoint:i,customHoverBehavior:o,customClickBehavior:c,scheduleRender:a,extractPoints:f,toHover:h}){const p=P(-1),y=P(null),d=P(null),v=D(v=>{if(l(v))return;const _=e.current;if(!_)return;const g=()=>{p.current=-1,y.current=null,r.current=null,n&&(n.current=null),i(null),o(null),a()};if(0===_.scene.length)return void(0>p.current||g());let m;if(d.current?.version===_.version)m=d.current.graph;else{const e=f(_.scene);if(0===e.length)return void(0>p.current||g());m=t(e),d.current={version:_.version,graph:m}}let b=p.current;if(m.flat.length>b||(g(),b=-1),("Enter"===v.key||" "===v.key)&&b>=0)return v.preventDefault(),void c(h(m.flat[b],_),{type:"activate",inputType:"keyboard"});if(0>b){if("Escape"===v.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(v.key))return;v.preventDefault(),p.current=0;const t=m.flat[0];y.current=t;const e=h(t,_);return r.current=e,i(e),o(e,{type:"focus",inputType:"keyboard"}),void a()}const k=s(v.key,u(m,b),m);if(null===k)return;if(v.preventDefault(),0>k)return void g();p.current=k;const z=m.flat[k];y.current=z;const A=h(z,_);r.current=A,i(A),o(A,{type:"focus",inputType:"keyboard"}),a()},[c,o,f,r,n,a,i,e,h]);return{kbFocusIndexRef:p,focusedNavPointRef:y,onKeyDown:v}}function C(t){return B({...t,extractPoints:n,toHover:(t,e)=>i({...t,datum:m(t.datum,e.resolvedRibbons)})})}function F({chartType:t,oAccessor:e,rAccessor:n,...s}){return B({...s,extractPoints:r,toHover:r=>({...i(r),__oAccessor:"string"==typeof e?e:void 0,__rAccessor:"string"==typeof n?n:void 0,__chartType:t})})}function H(t){const e=t.datum;return{...e||{},...e?.properties||{},data:e,properties:e?.properties,x:t.x,y:t.y,__semioticHoverData:!0}}function N({storeRef:t,hoverRef:r,hoveredNodeRef:n,setHoverPoint:i,customHoverBehavior:s,customClickBehavior:c,scheduleRender:u}){const a=P(-1),f=P(null),h=D(h=>{if(l(h))return;const p=t.current;if(!p)return;const y=()=>{a.current=-1,f.current=null,r.current=null,n&&(n.current=null),i(null),s(null),u()};if(0===p.scene.length)return void(0>a.current||y());const d=e(p.scene);if(0===d.length)return void(0>a.current||y());let v=a.current;if(d.length>v||(y(),v=-1),("Enter"===h.key||" "===h.key)&&v>=0)return h.preventDefault(),void c(H(d[v]),{type:"activate",inputType:"keyboard"});const _=o(h.key,0>v?-1:v,d.length);if(null===_)return;if(h.preventDefault(),0>_)return void y();const g=0>v?0:_;a.current=g;const m=d[g];f.current=m;const b=H(m);r.current=b,i(b),s(b,{type:"focus",inputType:"keyboard"}),u()},[c,s,r,n,u,i,t]);return{kbFocusIndexRef:a,focusedNavPointRef:f,onKeyDown:h}}function T(t,e,r){const n=t.duration??500,i=r-e;return n>i?1-i/n:0}function E(t,e,r,n,i,s=("undefined"!=typeof performance?performance.now():Date.now())){const o=t.color??"rgba(255,255,255,0.6)",c=t.glowRadius??4;let u=!1;const a=i??(()=>{const t=new Map;for(let e=0;r.length>e;e++)t.set(r[e],e);return t})();for(const r of e){if("line"===r.type)continue;if("area"===r.type){const e=Array.isArray(r.datum)?r.datum:[r.datum];let i=0,c=!1;for(const r of e){const e=a.get(r);if(null==e)continue;c=!0;const o=n.get(e);if(null==o)continue;const u=T(t,o,s);u>i&&(i=u)}c&&(u=S(r,i,o)||u);continue}const e=a.get(r.datum);if(null==e)continue;const i=n.get(e);u=S(r,null==i?0:T(t,i,s),o,c)||u}return u}function S(t,e,r,n){let i=!1;return e>0?(t._pulseIntensity!==e&&(t._pulseIntensity=e,i=!0),t._pulseColor!==r&&(t._pulseColor=r,i=!0),t._pulseGlowRadius!==n&&(t._pulseGlowRadius=n,i=!0),i):(0!==t._pulseIntensity&&(t._pulseIntensity=0,i=!0),void 0!==t._pulseColor&&(t._pulseColor=void 0,i=!0),void 0!==t._pulseGlowRadius&&(t._pulseGlowRadius=void 0,i=!0),i)}function I(t,e,r=("undefined"!=typeof performance?performance.now():Date.now())){if(!e||0===e.size)return!1;const n=t.duration??500,i=e.peek();return null!=i&&n>r-i}function O(t,e,r){e>t.capacity&&(t.resize(e),r&&e>r.capacity&&r.resize(e))}function j(t,e){const r=new p(t.capacity);return t.forEach(()=>r.push(e)),r}function G(t,e,r,n){const i=t.push(e);return r&&r.push(n),i}function L(t,e,r){if(!e||0===e.size)return;const n=new Set;if(t.forEach((t,e)=>{r(t)&&n.add(e)}),0===n.size)return;const i=e.toArray();e.clear();for(let t=0;i.length>t;t++)n.has(t)||e.push(i[t])}export{p as RingBuffer,T as computePulseIntensity,E as applyPulse,S as setPulseState,I as hasActivePulses,v as partitionRibbons,_ as buildAggregateRibbons,g as buildPerSeriesRibbons,m as enrichDatumWithBand,O as ensureRingBufferCapacity,j as createTimestampBufferForData,G as pushWithTimestamp,L as compactTimestampBufferForRemoval,b as refreshIdlePulse,A as useLegendCategoryEmission,w as pointCanvasRenderer,x as useSemanticFrameInteractions,C as useXYKeyboardNavigation,F as useOrdinalKeyboardNavigation,N as useGeoKeyboardNavigation};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{bandFromAge as t,defaultTooltipStyle as e,normalizeTooltip as n,opacityFromAge as r,resolveCanvasFill as o}from"./chunk-chunk-BFHUYEOS.module.min.js";import{drawGlyphParts as a,glyphFractionClipRect as s,glyphHitGeometry as l,glyphPlacement as c}from"./chunk-chunk-KTWEBFMX.module.min.js";function i(t,e){const n={...t};return e.provenance&&(n.provenance=e.provenance),e.lifecycle&&(n.lifecycle=e.lifecycle),n}function u(){return(new Date).toISOString()}function f(t,e={}){const n=t.provenance;return{...t,provenance:{...n,...e,createdAt:e.createdAt??n?.createdAt??u()}}}function d(t){if(null==t)return null;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();const e=Date.parse(t);return Number.isFinite(e)?e:null}function p(t){const e=d(t?.now);if(null!=e)return e;const n=t?.dataExtent;if(n)if(Array.isArray(n)){const t=d(n[n.length-1]);if(null!=t)return t}else if("max"in n){const t=d(n.max);if(null!=t)return t}return Date.now()}function h(e,n,r={}){const o=e?.lifecycle?.freshness,a=d(e?.provenance?.createdAt),s=function(t){if(null==t)return null;if("number"==typeof t)return t;const e=function(t){const e=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/.exec(t);return e?1e3*(3600*(24*parseInt(e[1]||"0",10)+parseInt(e[2]||"0",10))+60*parseInt(e[3]||"0",10)+parseInt(e[4]||"0",10)):0}(t);return e>0?e:null}(e?.lifecycle?.ttlHint);return null==a||null==s?o??"fresh":t(n-a,s,r)}function y(t,e={}){const n=p(e);return t.map(t=>{const r=h(t,n,e.thresholds);return{...t,lifecycle:{...t.lifecycle,freshness:r}}})}var g={fresh:null,aging:.55,stale:.35,expired:.2},m={fresh:null,aging:null,stale:"4 4",expired:"2 4"};function x(t,e,n){return t&&n in t?t[n]:e[n]}function b(t,e={}){const n=p(e),r=!0===e.showExpiredAnnotations,o=[];for(const a of t){const t=h(a,n,e.thresholds);if("expired"===t&&!r)continue;const s=x(e.opacity,g,t),l=x(e.strokeDasharray,m,t),c=e.labelSuffix?.[t],i={...a,lifecycle:{...a.lifecycle,freshness:t}};null!=s&&null==i.opacity&&(i.opacity=s),null!=l&&null==i.strokeDasharray&&(i.strokeDasharray=l),c&&"string"==typeof i.label&&(i.label=i.label+c);const u=a.lifecycle?.anchor;u&&null==i.anchor&&(i.anchor=u),o.push(i)}return o}var v={proposed:.7,accepted:null,disputed:.7,retracted:.25},w={proposed:"3 3",accepted:null,disputed:"2 3",retracted:"2 4"},A={proposed:" (proposed)",accepted:"",disputed:" (?)",retracted:""};function k(t,e,n){return t&&n in t?t[n]:e[n]}function I(t,e={}){const n=!0===e.showRetractedAnnotations,r=!0===e.showSupersededAnnotations,o=new Set;for(const e of t){const t=e?.lifecycle?.supersedes;t&&"retracted"!==e?.lifecycle?.status&&o.add(t)}return t.filter(t=>{if("retracted"===t?.lifecycle?.status&&!n)return!1;const e=t?.provenance?.stableId;return!(e&&o.has(e)&&!r)})}function _(t,e={}){const n=[];for(const r of I(t,e)){const t=r?.lifecycle?.status;if(!t){n.push(r);continue}const o=k(e.opacity,v,t),a=k(e.strokeDasharray,w,t),s=e.labelSuffix?.[t]??A[t],l={...r};null!=o&&(l.opacity=("number"==typeof l.opacity?l.opacity:1)*o),null!=a&&null==l.strokeDasharray&&(l.strokeDasharray=a),s&&"string"==typeof l.label&&(l.label=l.label+s),n.push(l)}return n}import{jsx as M,jsxs as S}from"react/jsx-runtime";function D(t){return"string"==typeof t?t:"value"}function O(t){return null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+""}function E(t,e){if(!e)return O(t);try{const n=e(t);return null==n?O(t):n}catch{return O(t)}}function R(t,e){return"function"==typeof e?e(t):t[e]}function P(t,e){if(!t)return[];const n=[];return(Array.isArray(t)?t:[t]).forEach((t,r)=>{const o="string"==typeof t?.y0Accessor?t.y0Accessor:"low",a="string"==typeof t?.y1Accessor?t.y1Accessor:"high";n.push({label:o,accessor:t=>t.bands?.[r]?.y0??(0===r?t.band?.y0:void 0),format:e}),n.push({label:a,accessor:t=>t.bands?.[r]?.y1??(0===r?t.band?.y1:void 0),format:e})}),n}function j(t){const n=t.find(t=>"title"===t.role),r=t.filter(t=>"title"!==t.role);return t=>{const o=t.data;if(!o)return null;const a=n?E(R(o,n.accessor),n.format):null;return S("div",{className:"semiotic-tooltip",style:e,children:[null!=a&&M("div",{style:{fontWeight:"bold",marginBottom:r.length>0?4:0},children:a}),r.map((t,e)=>{const n=E(R(o,t.accessor),t.format);return S("div",{style:e>0?{marginTop:2}:void 0,children:[S("span",{style:{opacity:.7},children:[t.label,": "]}),M("span",{children:n})]},e)})]})}}function C({categoryAccessor:t,valueAccessor:n,groupAccessor:r,groupLabel:o,pieData:a=!1,valueFormat:s}){return l=>{const c=a?l.data?.[0]||l.data||l:l.data||l,i=R(c,t),u=R(c,n),f=r?R(c,r):void 0;return S("div",{className:"semiotic-tooltip",style:e,children:[M("div",{style:{fontWeight:"bold"},children:O(i)}),M("div",{style:{marginTop:4},children:E(u,s)}),null!=f&&S("div",{style:{marginTop:2,opacity:.8},children:[o||D(r),": ",O(f)]})]})}}import*as T from"react";function L(...t){const e=t.filter(t=>null!=t);return 0===e.length?null:1===e.length?e[0]:T.createElement(T.Fragment,null,...e)}import{useEffect as z,useRef as H}from"react";function $(t,e,n,r){z(()=>{t.current?.updateConfig(e),n.current=!0,r()},[e,r,t,n])}function N(t,e,n,r){const o=H(null);z(()=>{const a=t.current;if(!a)return;const s=e??null;o.current!==s&&(o.current=s,a.setLayoutSelection(s),a.hasCustomRestyle?a.restyleScene(s):n.current=!0,r())},[e,r,t,n])}var U={fresh:1,aging:.7,stale:.45,expired:.25},B={alpha:1,band:"fresh",isStale:!1};function G(e,n){if(!e||0>=n)return B;const r=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},a=t(n,r,e.thresholds);return{alpha:{...U,...e.opacities??{}}[a],band:a,isStale:"fresh"!==a}}return n>r?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:B}import{useEffect as W,useRef as F}from"react";function V(t,e,n,r,o,a){const s=F("fresh");W(()=>{if(!t)return;const l=setInterval(()=>{const l=e.current;if(!l||0===l.lastIngestTime)return;const c="undefined"!=typeof performance?performance.now():Date.now(),i=G(t,c-l.lastIngestTime);i.band===s.current&&i.isStale===o||(s.current=i.band,i.isStale!==o&&a(i.isStale),n.current=!0,r())},1e3);return()=>clearInterval(l)},[t,o,r,e,a,n])}import{jsx as Y}from"react/jsx-runtime";function K({isStale:t,position:e}){return Y("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===e?{top:4,left:4}:"bottom-left"===e?{bottom:4,left:4}:"bottom-right"===e?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"},children:t?"STALE":"LIVE"})}import{useRef as X}from"react";function q(t){const e=X(t);return function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return Q(t,e);if(!Z(t)||!Z(e))return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;const n=t[r],o=e[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!Q(n,o))return!1}else{if(!Z(n)||!Z(o))return!1;if(!J(n,o))return!1}}return!0}(e.current,t)||(e.current=t),e.current}function J(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;if(!Object.is(t[r],e[r]))return!1}return!0}function Q(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function Z(t){if(null===t||"object"!=typeof t)return!1;if(Array.isArray(t))return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function tt(t,e,n,r,l){if(0>=e.size)return;const i=e.glyph;if(!i||!i.parts?.length)return;const u=c(i,e.size);if(0>=u.scale)return;const f=(e.style.opacity??1)*(e._decayOpacity??1);if(0>=f)return;const d=e=>{const n=o(t,e,e);return"string"==typeof n?n:e},p=e.color??("string"==typeof e.style.fill?e.style.fill:void 0);t.save(),t.translate(n,r),e.rotation&&t.rotate(e.rotation),t.translate(u.offsetX,u.offsetY),t.scale(u.scale,u.scale),t.globalAlpha=l*f*(e.style.fillOpacity??1);const h=s(i,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal");h&&e.ghostColor&&a(t,i,p,e.accent,e.ghostColor,d),h&&(t.beginPath(),t.rect(h.x,h.y,h.width,h.height),t.clip()),a(t,i,p,e.accent,void 0,d),t.restore()}var et=(t,e)=>{const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&tt(t,r,r.x,r.y,n);t.globalAlpha=n};function nt(t,e){const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&tt(t,r,r.cx,r.cy,n);t.globalAlpha=n}var rt=new Set;function ot(t,e){const n="function"==typeof t?t(e.datum??null,e):t;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function at(t,e){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${t}:${e}`;rt.has(n)||(rt.add(n),console.warn(`[Semiotic] Render backend "${t}" does not support scene node "${e}"; using the built-in renderer.`))}function st(t){const{context:e,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:a}=t;if(!r||"sketchy"===r)return void a(n);let s=[];const l=()=>{s.length&&(a(s),s=[])};for(const t of n){const n=ot(r,t);if(!n){s.push(t);continue}let c;l(),e.save();try{c=n.drawCanvas({context:e,node:t,style:t.style??{},pixelRatio:o})}finally{e.restore()}c||(at(n.id,t.type??"unknown"),a([t]))}l()}function lt(t){const{node:e,index:n,renderMode:r,fallback:o}=t,a=ot(r,e);if(!a)return o();const s=a.renderStaticSVG({node:e,style:e.style??{},key:`${a.id}-${n}`});return null!=s?s:(at(a.id,e.type??"unknown"),o())}function ct(t){const e=new Map;for(const n of t){const t=n.group??"_default";let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}for(const t of e.values()){t.sort((t,e)=>t.x-e.x||t.y-e.y);for(let e=0;t.length>e;e++)t[e]._groupIndex=e}const n=Array.from(e.keys()).sort((t,n)=>{const r=e.get(t),o=e.get(n);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),r=Array.from(e.values()).flat();r.sort((t,e)=>t.x-e.x||t.y-e.y);const o=new Map;for(let t=0;r.length>t;t++){r[t]._flatIndex=t;const e=r[t].datum?.id;null!=e&&o.set(e+"",t)}return{flat:r,groups:n,byGroup:e,idToIdx:o}}function it(t,e){if(0===t.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(e,t.flat.length-1)),r=t.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function ut(t,e,n){const{group:r,indexInGroup:o}=e,a=n.byGroup.get(r);switch(t){case"ArrowRight":return a.length-1>o?a[o+1]._flatIndex:e.flatIndex;case"ArrowLeft":return o>0?a[o-1]._flatIndex:e.flatIndex;case"ArrowDown":{const t=n.groups.indexOf(r);return n.groups.length-1>t?ft(n,n.groups[t+1],a[o]):e.flatIndex}case"ArrowUp":{const t=n.groups.indexOf(r);return t>0?ft(n,n.groups[t-1],a[o]):e.flatIndex}case"PageDown":return Math.min(e.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(e.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function ft(t,e,n){const r=t.byGroup.get(e);let o=0,a=Math.abs(r[0].x-n.x);for(let t=1;r.length>t;t++){const e=Math.abs(r[t].x-n.x);a>e&&(a=e,o=t)}return r[o]._flatIndex}function dt(t){const e=[];for(const n of t)switch(n.type){case"point":e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"});break}case"line":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.path.length>n&&r.length>n;n++)e.push({x:t.path[n][0],y:t.path[n][1],datum:r[n],shape:"circle",group:o});break}case"area":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.topPath.length>n&&r.length>n;n++)e.push({x:t.topPath[n][0],y:t.topPath[n][1],datum:r[n],shape:"circle",group:o});break}case"rect":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function pt(t){const e=[];for(const n of t)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??n.datum?.category??""})}else if("point"===n.type)e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const t=((n.startAngle||0)+(n.endAngle||0))/2,r=((n.innerRadius||0)+(n.outerRadius||50))/2;e.push({x:n.cx+Math.cos(t)*r,y:n.cy+Math.sin(t)*r,datum:n.datum,shape:"wedge",group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function ht(t){const e=[];for(const n of t)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.cx+t.centerDx,y:n.cy+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:n.datum?.id??"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function yt(t,e,n,r,o){const a=n.flat[e.flatIndex];if(!a)return ut(t,e,n);const s=a.datum?.id;switch(t){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(t,e,n){let r=null,o=1/0;for(let a=0;t.flat.length>a;a++){const s=t.flat[a];if(s===e)continue;const l=s.x-e.x,c=s.y-e.y;let i=!1;switch(n){case"right":i=l>0&&Math.abs(l)>=Math.abs(c);break;case"left":i=0>l&&Math.abs(l)>=Math.abs(c);break;case"down":i=c>0&&Math.abs(c)>=Math.abs(l);break;case"up":i=0>c&&Math.abs(c)>=Math.abs(l)}if(!i)continue;const u=l*l+c*c;o>u&&(o=u,r=a)}return r}(n,a,"ArrowRight"===t?"right":"ArrowLeft"===t?"left":"ArrowDown"===t?"down":"up")??e.flatIndex;return r!==e.flatIndex&&(o.current=-1),r}case"Enter":{if(null==s)return e.flatIndex;const t=function(t,e){const n=t+"",r=[];for(const t of e){const e=t.datum??t,o=gt(e.source),a=gt(e.target),s=null!=o,l=null!=a;s&&o+""===n&&l?r.push(a+""):l&&a+""===n&&s&&r.push(o+"")}return r}(s,r);if(0===t.length)return e.flatIndex;const a=n.idToIdx.get(t[(o.current+1)%t.length])??-1;return 0>a?e.flatIndex:(o.current=-1,a)}default:{const r=ut(t,e,n);return null!==r&&r!==e.flatIndex&&(o.current=-1),r}}}function gt(t){return"object"==typeof t&&null!==t&&"id"in t?t.id:t}function mt(t){const e=[];for(const n of t)if("point"===n.type&&null!=n.x)e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&e.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function xt(t,e,n){switch(t){case"ArrowRight":case"ArrowDown":return n-1>e?e+1:e;case"ArrowLeft":case"ArrowUp":return e>0?e-1:e;case"PageDown":return Math.min(e+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(e-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}function bt(t){return{data:t.datum||{},x:t.x,y:t.y,__semioticHoverData:!0}}function vt(t){const{title:e,description:n,summary:r,accessibleTable:o,className:a,animate:s,axisExtent:l,autoPlaceAnnotations:c}=t,i={};return e&&(i.title=e),n&&(i.description=n),r&&(i.summary=r),void 0!==o&&(i.accessibleTable=o),a&&(i.className=a),null!=s&&(i.animate=s),void 0!==l&&(i.axisExtent=l),void 0!==c&&(i.autoPlaceAnnotations=c),i}function wt(t){const{linkedHover:e,selection:n,onObservation:r,onClick:o,hoverRadius:a,hoverHighlight:s,forceHoverBehavior:l,forceClickBehavior:c,mobileInteraction:i,customHoverBehavior:u,customClickBehavior:f,linkedHoverInClickPredicate:d=!0}=t,p={};r&&(p.annotationObservationCallback=r);const h=i?.enabled?Math.max(a??30,Math.ceil((i.targetSize||44)/2),24):a;return(l||e||r||o||s)&&(p.customHoverBehavior=u),f&&(c||(d?r||o||e:r||o)||i?.enabled&&(i.tapToSelect||i.tapToLockTooltip)&&(e||s||n))&&(p.customClickBehavior=f),null!=h&&(p.hoverRadius=h),p}function At(t){const{tooltip:e,defaultTooltipContent:r}=t;return{tooltipContent:!1===e?()=>null:n(e)||r}}function kt(t,e,n){if(1>=n)return 1;const o=n-1;return r({age:o-e,extent:o,type:t.type,halfLife:t.halfLife??n/2,threshold:t.stepThreshold??.5*n,minOpacity:t.minOpacity??.1})}function It(t){const e=new Map;for(let n=0;t.length>n;n++)e.set(t[n],n);return e}function _t(t,e,n,r=It(n)){const o=n.length;if(o>1)for(const n of e){if("line"===n.type){const e=Array.isArray(n.datum)?n.datum:[];if(2>e.length)continue;const a=Array(e.length);let s=!1;for(let n=0;e.length>n;n++){const l=r.get(e[n]);null!=l?(a[n]=kt(t,l,o),1>a[n]&&(s=!0)):a[n]=1}s&&(n._decayOpacities=a);continue}if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[],a=n.topPath?n.topPath.length:e.length;if(2>a)continue;if(e.length===a){const s=Array(a);let l=!1;for(let n=0;e.length>n;n++){const a=r.get(e[n]);null!=a?(s[n]=kt(t,a,o),1>s[n]&&(l=!0)):s[n]=1}l&&(n._decayOpacities=s)}else{let s=1;for(const n of e){const e=r.get(n);if(null!=e){const n=kt(t,e,o);s>n&&(s=n)}}if(1>s){const t=Array(a);t.fill(s),n._decayOpacities=t}}continue}const e=r.get(n.datum);if(null==e)continue;const a=kt(t,e,o);"heatcell"===n.type?n.style={opacity:a}:"candlestick"===n.type?n._decayOpacity=a:n.style={...n.style,opacity:(n.style?.opacity??1)*a}}}function Mt(t){if("production"===process.env.NODE_ENV)return;const{label:e,nodes:n,overlays:r,warned:o}=t;St(r)&&0===n.length&&Dt(o,"overlay-only",`[semiotic] ${e} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(t=>null==t.datum)&&Dt(o,"null-datums",`[semiotic] ${e} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function St(t){return null!=t&&!1!==t&&""!==t&&(!Array.isArray(t)||t.some(St))}function Dt(t,e,n){t.has(e)||(t.add(e),console.warn(n))}function Ot(t,e,n,r){const o=function(t){if(t instanceof Error)return{name:t.name||"Error",message:t.message||"Custom layout threw."};if("string"==typeof t)return{name:"Error",message:t};if(null==t)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:t+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(e),a="network"===t?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:t,source:a,message:`Semiotic ${t} ${a} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}var Et=new WeakMap;function Rt(){return this.updateResults.last}function Pt(){return this.updateResults.last}function jt(t){return this.updateResults.subscribe(t)}function Ct(t){this.config.layoutSelection=t}function Tt(){Et.set(this,!0)}function Lt(){const t=!0===Et.get(this);return Et.delete(this),t}function zt(t){Object.assign(t.prototype,{getLastUpdateResult:Rt,getUpdateSnapshot:Pt,subscribeUpdateResult:jt,setLayoutSelection:Ct,markStylePaintPending:Tt,consumeStylePaintPending:Lt})}function Ht(t,e,n){return n.x>t||t>n.x+n.w||n.y>e||e>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function $t(t,e=30){return Math.max((t??4)+5,12,e)}function Nt(t){return t instanceof Date?t:"number"==typeof t&&t>1e9?new Date(t):null}function Ut(t,e){const n=Nt(t);if(!n)return!1;const r=Nt(e);return!r||n.getFullYear()!==r.getFullYear()||n.getMonth()!==r.getMonth()}function Bt(t){let e=t%(2*Math.PI);return 0>e&&(e+=2*Math.PI),e}function Gt(t,e,n,r,o,a=t=>t.x,s=t=>t.y,l=t=>t.r){const c=Math.max(r,o+5,12),i=e-c,u=e+c,f=n-c,d=n+c;let p=null,h=1/0;return t.visit((t,o,c,y,g)=>{if(o>u||i>y||c>d||f>g)return!0;if(!t.length){let o=t;do{const t=o.data,c=a(t)-e,i=s(t)-n,u=Math.sqrt(c*c+i*i);$t(l(t),r)>=u&&h>u&&(p=t,h=u),o=o.next}while(o)}return!1}),p?{node:p,distance:h}:null}function Wt(t){return!(!t._pulseIntensity||0>=t._pulseIntensity)}function Ft(t,e,n=.3){Wt(e)&&(t.globalAlpha=e._pulseIntensity*n,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h))}function Vt(t,e,n=.6){if(!Wt(e))return;const r=e.r+(e._pulseGlowRadius??4)*e._pulseIntensity,o=e.cx??e.x??0,a=e.cy??e.y??0;t.beginPath(),t.arc(o,a,r,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=e._pulseIntensity*n,t.stroke()}function Yt(t,e,n,r=.35){Wt(e)&&(t.globalAlpha=e._pulseIntensity*r,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",n?t.fill(n):t.fill())}export{kt as computeDecayOpacity,It as buildDatumIndexMap,_t as applyDecay,Mt as warnCustomLayoutDiagnostics,Ot as createCustomLayoutFailureDiagnostic,zt as attachUpdateResultStore,L as composeOverlays,$ as useConfigSync,N as useLayoutSelectionSync,Ht as hitTestRect,$t as getHitRadius,Ut as isTimeLandmark,Bt as normalizeAngle,Gt as findHitPointInQuadtree,G as resolveStaleness,V as useStalenessCheck,K as StalenessBadge,i as withProvenance,u as currentTimestamp,f as withCurrentProvenance,h as annotationFreshnessFor,y as computeAnnotationFreshness,b as applyAnnotationLifecycle,I as filterAnnotationsByStatus,_ as applyAnnotationStatus,q as useStableShallow,Ft as renderRectPulse,Vt as renderCirclePulse,Yt as renderPathPulse,et as glyphCanvasRenderer,nt as networkGlyphRenderer,st as paintSceneWithBackend,lt as renderSceneWithBackend,D as accessorName,O as formatVal,P as bandTooltipFields,j as buildDefaultTooltip,C as buildOrdinalTooltip,ct as buildNavGraph,it as resolvePosition,ut as nextGraphIndex,dt as extractXYNavPoints,pt as extractOrdinalNavPoints,ht as extractNetworkNavPoints,yt as nextNetworkIndex,mt as extractGeoNavPoints,xt as nextIndex,bt as navPointToHover,vt as buildBaseMetadataProps,wt as buildCustomBehaviorProps,At as buildTooltipProps};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{resolveCategoricalPalette as t,resolveExplicitColor as r}from"./chunk-chunk-BFHUYEOS.module.min.js";function e(r,e,n){return t(r,e,n)}function n(t,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:void 0;return 0===t.length?t=>n&&r(n,t)||"#4e79a7":e=>{if(n){const t=r(n,e);if(t)return t}let o=0;for(let t=0;e.length>t;t++)o=31*o+e.charCodeAt(t)|0;return t[Math.abs(o)%t.length]??"#4e79a7"}}export{e as resolveCustomLayoutPalette,n as buildResolveColor};
|